iommu/vt-d: Refactor device_to_iommu() to retrieve iommu directly
authorLu Baolu <baolu.lu@linux.intel.com>
Mon, 18 Dec 2023 07:34:42 +0000 (15:34 +0800)
committerJoerg Roedel <jroedel@suse.de>
Tue, 19 Dec 2023 13:32:26 +0000 (14:32 +0100)
commit1903ef8f0d77680e6eb36bd0cc3ea3aa6e95a050
tree5a50ef5ffd1e1188757af9c3c29bc0764f3df033
parent2cc14f52aeb78ce3f29677c2de1f06c0e91471ab
iommu/vt-d: Refactor device_to_iommu() to retrieve iommu directly

The device_to_iommu() helper was originally designed to look up the DMAR
ACPI table to retrieve the iommu device and the request ID for a given
device. However, it was also being used in other places where there was
no need to lookup the ACPI table at all.

Retrieve the iommu device directly from the per-device iommu private data
in functions called after device is probed.

Rename the original device_to_iommu() function to a more meaningful name,
device_lookup_iommu(), to avoid mis-using it.

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Link: https://lore.kernel.org/r/20231116015048.29675-2-baolu.lu@linux.intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/intel/iommu.c
drivers/iommu/intel/iommu.h
drivers/iommu/intel/svm.c