Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
766877d
Revert "x86/module: prepare module loading for ROX allocations of text"
rppt Jan 26, 2025
1b96a80
x86/ibt: Clean up is_endbr()
Feb 7, 2025
301e3ae
Revert "NVIDIA: SAUCE: iommu/arm-smmu-v3: Implement arm_smmu_get_msi_…
nirmoy Jul 11, 2025
fc78ff3
iommufd/fault: Remove iommufd_fault_domain_attach/detach/replace_dev()
nicolinc Feb 4, 2025
1d46c11
Revert "NVIDIA: SAUCE: iommu/dma: Support MSIs through nested domains"
nirmoy Jul 11, 2025
0cce0ae
genirq/msi: Store the IOMMU IOVA directly in msi_desc instead of iomm…
jgunthorpe Feb 20, 2025
f5af33d
genirq/msi: Refactor iommu_dma_compose_msi_msg()
jgunthorpe Feb 20, 2025
642d198
iommu: Make iommu_dma_prepare_msi() into a generic operation
jgunthorpe Feb 20, 2025
d31ea23
iommu: Make @handle mandatory in iommu_{attach|replace}_group_handle()
yiliu1765 Feb 26, 2025
ce8b472
iommu: Drop iommu_group_replace_domain()
yiliu1765 Feb 26, 2025
1d6c10d
iommu: Store either domain or handle in group->pasid_array
yiliu1765 Feb 26, 2025
11c146f
iommu: Swap the order of setting group->pasid_array and calling attac…
yiliu1765 Feb 26, 2025
d083a79
iommu: Unexport iommu_fwspec_free()
rmurphy-arm Feb 27, 2025
432264e
iommu: Keep dev->iommu state consistent
rmurphy-arm Feb 28, 2025
b6f9274
irqchip: Have CONFIG_IRQ_MSI_IOMMU be selected by irqchips that need it
jgunthorpe Feb 20, 2025
0b34d70
iommu: Turn fault_data to iommufd private pointer
nicolinc Feb 20, 2025
fce7a91
iommufd: Implement sw_msi support natively
jgunthorpe Feb 20, 2025
74fde91
iommufd/fault: Move two fault functions out of the header
nicolinc Mar 11, 2025
8aa8b03
iommufd/fault: Add an iommufd_fault_init() helper
nicolinc Mar 11, 2025
b3068ad
iommufd: Abstract an iommufd_eventq from iommufd_fault
nicolinc Mar 11, 2025
840eabe
iommufd: Rename fault.c to eventq.c
nicolinc Mar 11, 2025
3bee6ff
iommufd: Add IOMMUFD_OBJ_VEVENTQ and IOMMUFD_CMD_VEVENTQ_ALLOC
nicolinc Mar 11, 2025
29c9ed7
iommufd/viommu: Add iommufd_viommu_get_vdev_id helper
nicolinc Mar 11, 2025
f9781aa
iommufd/viommu: Add iommufd_viommu_report_event helper
nicolinc Mar 11, 2025
9117e94
iommufd/selftest: Require vdev_id when attaching to a nested domain
nicolinc Mar 11, 2025
5c3b053
iommufd/selftest: Add IOMMU_TEST_OP_TRIGGER_VEVENT for vEVENTQ coverage
nicolinc Mar 11, 2025
0e0203a
iommufd/selftest: Add IOMMU_VEVENTQ_ALLOC test coverage
nicolinc Mar 11, 2025
ee3e6a9
Documentation: userspace-api: iommufd: Update FAULT and VEVENTQ
nicolinc Mar 11, 2025
1cb13ea
iommu/arm-smmu-v3: Introduce struct arm_smmu_vmaster
nicolinc Mar 11, 2025
2295f18
iommu/arm-smmu-v3: Report events that belong to devices attached to v…
nicolinc Mar 11, 2025
9187b94
iommufd: Disallow allocating nested parent domain with fault ID
yiliu1765 Feb 26, 2025
d2dc49b
iommufd: Set domain->iommufd_hwpt in all hwpt->domain allocators
nicolinc Mar 5, 2025
7a0d84a
iommu: Sort out domain user data
rmurphy-arm Mar 25, 2025
6770864
iommufd: Move iommufd_sw_msi and related functions to driver.c
nicolinc Mar 25, 2025
7f1cb59
iommu: Drop sw_msi from iommu_domain
nicolinc Mar 25, 2025
fb837eb
iommu: Require passing new handles to APIs supporting handle
yiliu1765 Mar 21, 2025
436ebad
NVIDIA: SAUCE: Revert "iommu: Skip PASID validation for devices witho…
nirmoy Aug 5, 2025
af3e847
iommu: Introduce a replace API for device pasid
yiliu1765 Mar 21, 2025
67af2b8
iommu: Skip PASID validation for devices without PASID capability
tdavenvidia May 20, 2025
f9d0844
iommufd: Pass @pasid through the device attach/replace path
yiliu1765 Mar 21, 2025
f3a7a37
iommufd/device: Only add reserved_iova in non-pasid path
yiliu1765 Mar 21, 2025
3fd529e
iommufd/device: Replace idev->igroup with local variable
yiliu1765 Mar 21, 2025
dc02e6b
iommufd/device: Add helper to detect the first attach of a group
yiliu1765 Mar 21, 2025
2297682
iommufd/device: Wrap igroup->hwpt and igroup->device_list into attach…
yiliu1765 Mar 21, 2025
574bc36
iommufd/device: Replace device_list with device_array
yiliu1765 Mar 21, 2025
a7262bd
iommufd/device: Add pasid_attach array to track per-PASID attach
yiliu1765 Mar 21, 2025
0fe1a26
iommufd: Enforce PASID-compatible domain in PASID path
yiliu1765 Mar 21, 2025
568f449
iommufd: Support pasid attach/replace
yiliu1765 Mar 21, 2025
c74a78c
iommufd: Enforce PASID-compatible domain for RID
yiliu1765 Mar 21, 2025
2461f01
iommu/vt-d: Add IOMMU_HWPT_ALLOC_PASID support
yiliu1765 Mar 21, 2025
3bb382e
iommufd: Allow allocating PASID-compatible domain
yiliu1765 Mar 21, 2025
cb33fb8
iommufd/selftest: Add set_dev_pasid in mock iommu
yiliu1765 Mar 21, 2025
e60cbdb
iommufd/selftest: Add a helper to get test device
yiliu1765 Mar 21, 2025
979bc3e
iommufd/selftest: Add test ops to test pasid attach/detach
yiliu1765 Mar 21, 2025
b656d10
iommufd/selftest: Add coverage for iommufd pasid attach/detach
yiliu1765 Mar 21, 2025
69d4624
ida: Add ida_find_first_range()
yiliu1765 Mar 21, 2025
5dbff6f
vfio-iommufd: Support pasid [at|de]tach for physical VFIO devices
yiliu1765 Mar 21, 2025
9fe8139
vfio: VFIO_DEVICE_[AT|DE]TACH_IOMMUFD_PT support pasid
yiliu1765 Mar 21, 2025
5674530
iommufd: Extend IOMMU_GET_HW_INFO to report PASID capability
yiliu1765 Mar 21, 2025
91e976a
iommufd: Initialize the flags of vevent in iommufd_viommu_report_event()
yiliu1765 Mar 24, 2025
666066a
iommufd: Balance veventq->num_events inc/dec
yiliu1765 Mar 24, 2025
3405f8b
iommu: Convert unreachable() to BUG()
jpoimboe Mar 27, 2025
eee9efe
iommufd: Test attach before detaching pasid
yiliu1765 Mar 28, 2025
7eba123
iommu: Fix crash in report_iommu_fault()
pchelkin91 Apr 8, 2025
80b61ca
iommufd/selftest: Add coverage for reporting max_pasid_log2 via IOMMU…
yiliu1765 Mar 21, 2025
90f069c
iommu/virtio: Break out bypass identity support into a global static
jgunthorpe Apr 8, 2025
5f83b7c
iommu: Add domain_alloc_identity()
jgunthorpe Apr 8, 2025
a0f8f72
iommu/virtio: Move to domain_alloc_paging()
jgunthorpe Apr 8, 2025
ec970c5
iommu: Do not call domain_alloc() in iommu_sva_domain_alloc()
jgunthorpe Apr 8, 2025
b69a401
iommu: Hide ops.domain_alloc behind CONFIG_FSL_PAMU
jgunthorpe Apr 8, 2025
7888476
iommufd: Apply obvious cosmetic fixes
nicolinc Jun 14, 2025
435a2da
iommufd: Drop unused ictx in struct iommufd_vdevice
nicolinc Jun 14, 2025
bdca5a3
iommufd: Use enum iommu_viommu_type for type in struct iommufd_viommu
nicolinc Jun 14, 2025
974bf39
iommufd: Use enum iommu_veventq_type for type in struct iommufd_veventq
nicolinc Jun 14, 2025
c9adfa0
iommufd: Return EOPNOTSUPP for failures due to driver bugs
nicolinc Jun 14, 2025
23690a3
iommu: Introduce get_viommu_size and viommu_init ops
nicolinc Jun 14, 2025
47ee4f4
iommufd/viommu: Support get_viommu_size and viommu_init ops
nicolinc Jun 14, 2025
aa8b240
iommufd/selftest: Drop parent domain from mock_iommu_domain_nested
nicolinc Jun 14, 2025
c94dd42
iommufd/selftest: Replace mock_viommu_alloc with mock_viommu_init
nicolinc Jun 14, 2025
c629ee0
iommu/arm-smmu-v3: Replace arm_vsmmu_alloc with arm_vsmmu_init
nicolinc Jun 14, 2025
839d509
iommu: Deprecate viommu_alloc op
nicolinc Jun 14, 2025
0439869
iommufd: Move _iommufd_object_alloc out of driver.c
nicolinc Jun 14, 2025
485a99c
iommufd: Introduce iommufd_object_alloc_ucmd helper
nicolinc Jun 14, 2025
b9f5a7d
iommufd: Apply the new iommufd_object_alloc_ucmd helper
nicolinc Jun 14, 2025
27cd044
iommufd: Report unmapped bytes in the error path of iopt_unmap_iova_r…
nicolinc Jul 10, 2025
b082173
iommufd: Correct virt_id kdoc at struct iommu_vdevice_alloc
nicolinc Jul 10, 2025
8c55209
iommufd/viommu: Explicitly define vdev->virt_id
nicolinc Jul 10, 2025
9a8a025
iommu: Use enum iommu_hw_info_type for type in hw_info op
nicolinc Jul 10, 2025
7e5e8d9
iommu: Add iommu_copy_struct_to_user helper
nicolinc Jul 10, 2025
9db0eed
iommu: Pass in a driver-level user data structure to viommu_init op
nicolinc Jul 10, 2025
605fddd
iommufd/viommu: Allow driver-specific user data for a vIOMMU object
nicolinc Jul 10, 2025
6579bd6
iommufd/selftest: Support user_data in mock_viommu_alloc
nicolinc Jul 10, 2025
c652796
iommufd/selftest: Add coverage for viommu data
nicolinc Jul 10, 2025
10572ba
iommufd/access: Add internal APIs for HW queue to use
nicolinc Jul 10, 2025
550924e
iommufd/access: Bypass access->ops->unmap for internal use
nicolinc Jul 10, 2025
01ec396
iommufd/viommu: Add driver-defined vDEVICE support
nicolinc Jul 10, 2025
8985ab6
iommufd/viommu: Introduce IOMMUFD_OBJ_HW_QUEUE and its related struct
nicolinc Jul 10, 2025
44f52d8
iommufd/viommu: Add IOMMUFD_CMD_HW_QUEUE_ALLOC ioctl
nicolinc Jul 10, 2025
2e5546b
iommufd/driver: Add iommufd_hw_queue_depend/undepend() helpers
nicolinc Jul 10, 2025
3c049ac
iommufd/selftest: Add coverage for IOMMUFD_CMD_HW_QUEUE_ALLOC
nicolinc Jul 10, 2025
f78a245
iommufd: Add mmap interface
nicolinc Jul 10, 2025
e310ce6
iommufd/selftest: Add coverage for the new mmap interface
nicolinc Jul 10, 2025
f73b784
Documentation: userspace-api: iommufd: Update HW QUEUE
nicolinc Jul 10, 2025
2271248
iommu: Allow an input type in hw_info op
nicolinc Jul 10, 2025
9e1fbb5
iommufd: Allow an input data_type via iommu_hw_info
nicolinc Jul 10, 2025
03a251b
iommufd/selftest: Update hw_info coverage for an input data_type
nicolinc Jul 10, 2025
d67b386
iommu/arm-smmu-v3-iommufd: Add vsmmu_size/type and vsmmu_init impl ops
nicolinc Jul 10, 2025
e3b8c8b
iommu/arm-smmu-v3-iommufd: Add hw_info to impl_ops
nicolinc Jul 10, 2025
1c2d30d
iommu/tegra241-cmdqv: Use request_threaded_irq
nicolinc Jul 10, 2025
6d79641
iommu/tegra241-cmdqv: Simplify deinit flow in tegra241_cmdqv_remove_v…
nicolinc Jul 10, 2025
d5aee1a
iommu/tegra241-cmdqv: Do not statically map LVCMDQs
nicolinc Jul 10, 2025
3c7b2d3
iommu/tegra241-cmdqv: Add user-space use support
nicolinc Jul 10, 2025
87f28b4
iommu/tegra241-cmdqv: Add IOMMU_VEVENTQ_TYPE_TEGRA241_CMDQV support
nicolinc Jul 10, 2025
311f0fa
iommufd: Do not allow _iommufd_object_alloc_ucmd if abort op is set
nicolinc Jul 10, 2025
567a110
iommu/tegra241-cmdqv: import IOMMUFD module namespace
arndb Jul 14, 2025
00c8161
NVIDIA: SAUCE: mm: handle poisoning of pfn without struct pages
ankita-nv Jul 14, 2025
a538e6f
NVIDIA: SAUCE: mm: Add poison error check in fixup_user_fault() for m…
ankita-nv Dec 6, 2023
489bb41
NVIDIA: SAUCE: mm: Change ghes code to allow poison of non-struct pfn
ankita-nv Dec 6, 2023
374b4eb
NVIDIA: SAUCE: vfio/nvgrace-gpu: register device memory for poison ha…
ankita-nv Feb 25, 2024
e9da60b
NVIDIA: SAUCE: arm64: configs: Build NVGRACE_GPU_VFIO_PCI as LKM
nicolinc Dec 4, 2023
238c186
NVIDIA: SAUCE: arm64: configs: Enable IOMMUFD and VFIO_DEVICE_CDEV
nicolinc Nov 7, 2023
1f55e3a
NVIDIA: SAUCE: arm64: configs: Replace VFIO_CONTAINER with IOMMUFD_VF…
nicolinc Jan 22, 2024
1bb50a4
NVIDIA: SAUCE: KVM: arm64: Allow exec fault on memory mapped cacheabl…
ankita-nv Aug 29, 2024
34549f0
NVIDIA: SAUCE: vfio/nvgrace-egm: Introduce module to manage EGM
ankita-nv Aug 29, 2024
76870b2
NVIDIA: SAUCE: vfio/nvgrace-egm: Handle pages with ECC errors on the EGM
ankita-nv Aug 29, 2024
374a46a
NVIDIA: SAUCE: vfio/nvgrace-egm: Register EGM for runtime ECC poison …
ankita-nv Aug 29, 2024
bd95986
NVIDIA: SAUCE: arm64: configs: Build CONFIG_NVGRACE_EGM as LKM
nvmochs Aug 30, 2024
f14ee03
NVIDIA: SAUCE: vfio/nvgrace-egm: Move the egm header file to include
ankita-nv Oct 13, 2024
e7c565b
NVIDIA: SAUCE: vfio/nvgrace-egm: Free region memory during unregistra…
nvmochs Nov 7, 2024
2fa8d23
NVIDIA: SAUCE: vfio/nvgrace-egm: Move region hash initialization
nvmochs Nov 7, 2024
c42d504
NVIDIA: SAUCE: vfio/nvgrace-egm: Handle and convey EGM registration e…
nvmochs Nov 7, 2024
672584f
NVIDIA: SAUCE: vfio/nvgrace-gpu: Handle EGM registration failure
nvmochs Nov 7, 2024
57b69bd
NVIDIA: SAUCE: vfio/nvgrace-gpu: Address checkpatch warnings
nvmochs Nov 7, 2024
d400cc5
NVIDIA: SAUCE: vfio/nvgrace-egm: Address sparse errors
nvmochs Nov 8, 2024
88cb287
NVIDIA: SAUCE: vfio/nvgrace-egm: Address smatch errors
nvmochs Nov 8, 2024
e0e3db6
NVIDIA: SAUCE: vfio/nvgrace-gpu: Address smatch errors
nvmochs Nov 8, 2024
b5d70ae
NVIDIA: SAUCE: vfio/nvgrace-egm: Ensure ACPI value reads are successful
nvmochs Nov 22, 2024
2d6a975
NVIDIA: SAUCE: vfio/nvgrace-egm: Avoid invalid retired pages base
nvmochs Nov 14, 2024
360a6f6
NVIDIA: SAUCE: vfio/nvgrace-egm: Update EGM unregistration API
nvmochs Jan 23, 2025
1e7a774
NVIDIA: SAUCE: vfio/nvgrace-egm: track GPUs associated with the EGM r…
ankita-nv May 6, 2025
4b6b81c
NVIDIA: SAUCE: vfio/nvgrace-egm: list gpus through sysfs
ankita-nv May 6, 2025
2e86858
NVIDIA: SAUCE: vfio/nvgrace-egm: expose the egm size through sysfs
ankita-nv May 6, 2025
204a923
NVIDIA: SAUCE: vfio/nvgrace-egm: Add null pointer checks after memory…
KobaKoNvidia May 26, 2025
ee4d180
NVIDIA: SAUCE: arm64: configs: enable NVGRACE_EGM as module
nirmoy Jul 14, 2025
e7fe105
NVIDIA: SAUCE: vfio/nvgrace-gpu: Avoid resmem pfn unregistration
nvmochs Jun 30, 2025
adec7f3
NVIDIA: [Config] Fix CONFIG_IRQ_MSI_IOMMU annotation for amd64
nvmochs Jul 25, 2025
043885e
software node: Prevent link creation failure from causing kobj refere…
Apr 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions Documentation/userspace-api/iommufd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ Following IOMMUFD objects are exposed to userspace:
space usually has mappings from guest-level I/O virtual addresses to guest-
level physical addresses.

- IOMMUFD_FAULT, representing a software queue for an HWPT reporting IO page
faults using the IOMMU HW's PRI (Page Request Interface). This queue object
provides user space an FD to poll the page fault events and also to respond
to those events. A FAULT object must be created first to get a fault_id that
could be then used to allocate a fault-enabled HWPT via the IOMMU_HWPT_ALLOC
command by setting the IOMMU_HWPT_FAULT_ID_VALID bit in its flags field.

- IOMMUFD_OBJ_VIOMMU, representing a slice of the physical IOMMU instance,
passed to or shared with a VM. It may be some HW-accelerated virtualization
features and some SW resources used by the VM. For examples:
Expand Down Expand Up @@ -109,6 +116,25 @@ Following IOMMUFD objects are exposed to userspace:
vIOMMU, which is a separate ioctl call from attaching the same device to an
HWPT_PAGING that the vIOMMU holds.

- IOMMUFD_OBJ_VEVENTQ, representing a software queue for a vIOMMU to report its
events such as translation faults occurred to a nested stage-1 (excluding I/O
page faults that should go through IOMMUFD_OBJ_FAULT) and HW-specific events.
This queue object provides user space an FD to poll/read the vIOMMU events. A
vIOMMU object must be created first to get its viommu_id, which could be then
used to allocate a vEVENTQ. Each vIOMMU can support multiple types of vEVENTS,
but is confined to one vEVENTQ per vEVENTQ type.

- IOMMUFD_OBJ_HW_QUEUE, representing a hardware accelerated queue, as a subset
of IOMMU's virtualization features, for the IOMMU HW to directly read or write
the virtual queue memory owned by a guest OS. This HW-acceleration feature can
allow VM to work with the IOMMU HW directly without a VM Exit, so as to reduce
overhead from the hypercalls. Along with the HW QUEUE object, iommufd provides
user space an mmap interface for VMM to mmap a physical MMIO region from the
host physical address space to the guest physical address space, allowing the
guest OS to directly control the allocated HW QUEUE. Thus, when allocating a
HW QUEUE, the VMM must request a pair of mmap info (offset/length) and pass in
exactly to an mmap syscall via its offset and length arguments.

All user-visible objects are destroyed via the IOMMU_DESTROY uAPI.

The diagrams below show relationships between user-visible objects and kernel
Expand Down Expand Up @@ -251,8 +277,11 @@ User visible objects are backed by following datastructures:
- iommufd_device for IOMMUFD_OBJ_DEVICE.
- iommufd_hwpt_paging for IOMMUFD_OBJ_HWPT_PAGING.
- iommufd_hwpt_nested for IOMMUFD_OBJ_HWPT_NESTED.
- iommufd_fault for IOMMUFD_OBJ_FAULT.
- iommufd_viommu for IOMMUFD_OBJ_VIOMMU.
- iommufd_vdevice for IOMMUFD_OBJ_VDEVICE.
- iommufd_veventq for IOMMUFD_OBJ_VEVENTQ.
- iommufd_hw_queue for IOMMUFD_OBJ_HW_QUEUE.

Several terminologies when looking at these datastructures:

Expand Down
9 changes: 9 additions & 0 deletions arch/arm64/configs/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1762,3 +1762,12 @@ CONFIG_CORESIGHT_STM=m
CONFIG_CORESIGHT_CPU_DEBUG=m
CONFIG_CORESIGHT_CTI=m
CONFIG_MEMTEST=y
CONFIG_NVGRACE_GPU_VFIO_PCI=m
CONFIG_NVGRACE_EGM=m
CONFIG_VFIO_DEVICE_CDEV=y
# CONFIG_VFIO_CONTAINER is not set
CONFIG_FAULT_INJECTION=y
CONFIG_IOMMUFD_DRIVER=y
CONFIG_IOMMUFD=y
CONFIG_IOMMUFD_TEST=y
CONFIG_IOMMUFD_VFIO_CONTAINER=y
5 changes: 4 additions & 1 deletion arch/arm64/kvm/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1472,6 +1472,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
bool s2_force_noncacheable = false, vfio_allow_any_uc = false;
unsigned long mmu_seq;
phys_addr_t ipa = fault_ipa;
unsigned long mt;
struct kvm *kvm = vcpu->kvm;
struct vm_area_struct *vma;
short vma_shift;
Expand Down Expand Up @@ -1593,6 +1594,8 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
vma_pagesize = min(vma_pagesize, (long)max_map_size);
}

mt = FIELD_GET(PTE_ATTRINDX_MASK, pgprot_val(vma->vm_page_prot));

/*
* Both the canonical IPA and fault IPA must be hugepage-aligned to
* ensure we find the right PFN and lay down the mapping in the right
Expand Down Expand Up @@ -1676,7 +1679,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
writable = false;
}

if (exec_fault && s2_force_noncacheable)
if (exec_fault && s2_force_noncacheable && mt != MT_NORMAL)
return -ENOEXEC;

/*
Expand Down
11 changes: 5 additions & 6 deletions arch/um/kernel/um_arch.c
Original file line number Diff line number Diff line change
Expand Up @@ -440,25 +440,24 @@ void __init arch_cpu_finalize_init(void)
os_check_bugs();
}

void apply_seal_endbr(s32 *start, s32 *end, struct module *mod)
void apply_seal_endbr(s32 *start, s32 *end)
{
}

void apply_retpolines(s32 *start, s32 *end, struct module *mod)
void apply_retpolines(s32 *start, s32 *end)
{
}

void apply_returns(s32 *start, s32 *end, struct module *mod)
void apply_returns(s32 *start, s32 *end)
{
}

void apply_fineibt(s32 *start_retpoline, s32 *end_retpoline,
s32 *start_cfi, s32 *end_cfi, struct module *mod)
s32 *start_cfi, s32 *end_cfi)
{
}

void apply_alternatives(struct alt_instr *start, struct alt_instr *end,
struct module *mod)
void apply_alternatives(struct alt_instr *start, struct alt_instr *end)
{
}

Expand Down
3 changes: 1 addition & 2 deletions arch/x86/entry/vdso/vma.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ int __init init_vdso_image(const struct vdso_image *image)

apply_alternatives((struct alt_instr *)(image->data + image->alt),
(struct alt_instr *)(image->data + image->alt +
image->alt_len),
NULL);
image->alt_len));

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/events/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2845,7 +2845,7 @@ static bool is_uprobe_at_func_entry(struct pt_regs *regs)
return true;

/* endbr64 (64-bit only) */
if (user_64bit_mode(regs) && is_endbr(*(u32 *)auprobe->insn))
if (user_64bit_mode(regs) && is_endbr((u32 *)auprobe->insn))
return true;

return false;
Expand Down
14 changes: 7 additions & 7 deletions arch/x86/include/asm/alternative.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,16 @@ extern struct alt_instr __alt_instructions[], __alt_instructions_end[];
* instructions were patched in already:
*/
extern int alternatives_patched;
struct module;

extern void alternative_instructions(void);
extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end,
struct module *mod);
extern void apply_retpolines(s32 *start, s32 *end, struct module *mod);
extern void apply_returns(s32 *start, s32 *end, struct module *mod);
extern void apply_seal_endbr(s32 *start, s32 *end, struct module *mod);
extern void apply_alternatives(struct alt_instr *start, struct alt_instr *end);
extern void apply_retpolines(s32 *start, s32 *end);
extern void apply_returns(s32 *start, s32 *end);
extern void apply_seal_endbr(s32 *start, s32 *end);
extern void apply_fineibt(s32 *start_retpoline, s32 *end_retpoine,
s32 *start_cfi, s32 *end_cfi, struct module *mod);
s32 *start_cfi, s32 *end_cfi);

struct module;

struct callthunk_sites {
s32 *call_start, *call_end;
Expand Down
16 changes: 2 additions & 14 deletions arch/x86/include/asm/ftrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,9 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr)

static inline unsigned long arch_ftrace_get_symaddr(unsigned long fentry_ip)
{
#ifdef CONFIG_X86_KERNEL_IBT
u32 instr;

/* We want to be extra safe in case entry ip is on the page edge,
* but otherwise we need to avoid get_kernel_nofault()'s overhead.
*/
if ((fentry_ip & ~PAGE_MASK) < ENDBR_INSN_SIZE) {
if (get_kernel_nofault(instr, (u32 *)(fentry_ip - ENDBR_INSN_SIZE)))
return fentry_ip;
} else {
instr = *(u32 *)(fentry_ip - ENDBR_INSN_SIZE);
}
if (is_endbr(instr))
if (is_endbr((void*)(fentry_ip - ENDBR_INSN_SIZE)))
fentry_ip -= ENDBR_INSN_SIZE;
#endif

return fentry_ip;
}
#define ftrace_get_symaddr(fentry_ip) arch_ftrace_get_symaddr(fentry_ip)
Expand Down
5 changes: 3 additions & 2 deletions arch/x86/include/asm/ibt.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static inline __attribute_const__ u32 gen_endbr_poison(void)
return 0x001f0f66; /* osp nopl (%rax) */
}

static inline bool is_endbr(u32 val)
static inline bool __is_endbr(u32 val)
{
if (val == gen_endbr_poison())
return true;
Expand All @@ -74,6 +74,7 @@ static inline bool is_endbr(u32 val)
return val == gen_endbr();
}

extern __noendbr bool is_endbr(u32 *val);
extern __noendbr u64 ibt_save(bool disable);
extern __noendbr void ibt_restore(u64 save);

Expand All @@ -98,7 +99,7 @@ extern __noendbr void ibt_restore(u64 save);

#define __noendbr

static inline bool is_endbr(u32 val) { return false; }
static inline bool is_endbr(u32 *val) { return false; }

static inline u64 ibt_save(bool disable) { return 0; }
static inline void ibt_restore(u64 save) { }
Expand Down
Loading