mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 10:11:27 +01:00
IOMMU/x86: remove indirection from certain IOMMU hook accesses
There's no need to go through an extra level of indirection. In order to limit code churn, call sites using struct domain_iommu's platform_ops don't get touched here, however. Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Kevin Tian <kevin.tian@intel.com> Acked-by: Brian Woods <brian.woods@amd.com>
This commit is contained in:
1 parent
cb8252bf47
commit
32a5ea00ec
6 files changed
+17
-15
No files matched your search
@@ -29,6 +29,8 @@
|
||||
|
||||
static bool_t __read_mostly init_done;
|
||||
|
||||
static const struct iommu_ops amd_iommu_ops;
|
||||
|
||||
struct amd_iommu *find_iommu_for_device(int seg, int bdf)
|
||||
{
|
||||
struct ivrs_mappings *ivrs_mappings = get_ivrs_mappings(seg);
|
||||
@@ -182,6 +184,8 @@ int __init amd_iov_detect(void)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
iommu_ops = amd_iommu_ops;
|
||||
|
||||
if ( amd_iommu_init() != 0 )
|
||||
{
|
||||
printk("AMD-Vi: Error initialization\n");
|
||||
@@ -566,7 +570,7 @@ static void amd_dump_p2m_table(struct domain *d)
|
||||
amd_dump_p2m_table_level(hd->arch.root_table, hd->arch.paging_mode, 0, 0);
|
||||
}
|
||||
|
||||
const struct iommu_ops amd_iommu_ops = {
|
||||
static const struct iommu_ops __initconstrel amd_iommu_ops = {
|
||||
.init = amd_iommu_domain_init,
|
||||
.hwdom_init = amd_iommu_hwdom_init,
|
||||
.add_device = amd_iommu_add_device,
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
struct pci_ats_dev;
|
||||
extern bool_t rwbf_quirk;
|
||||
extern const struct iommu_ops intel_iommu_ops;
|
||||
|
||||
void print_iommu_regs(struct acpi_drhd_unit *drhd);
|
||||
void print_vtd_entries(struct iommu *iommu, int bus, int devfn, u64 gmfn);
|
||||
|
||||
@@ -897,6 +897,8 @@ int iommu_enable_x2apic_IR(void)
|
||||
else if ( !x2apic_enabled )
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
iommu_ops = intel_iommu_ops;
|
||||
|
||||
for_each_drhd_unit ( drhd )
|
||||
{
|
||||
iommu = drhd->iommu;
|
||||
|
||||
@@ -2299,6 +2299,8 @@ int __init intel_vtd_setup(void)
|
||||
goto error;
|
||||
}
|
||||
|
||||
iommu_ops = intel_iommu_ops;
|
||||
|
||||
/* We enable the following features only if they are supported by all VT-d
|
||||
* engines: Snoop Control, DMA passthrough, Queued Invalidation, Interrupt
|
||||
* Remapping, and Posted Interrupt
|
||||
@@ -2698,7 +2700,7 @@ static void vtd_dump_p2m_table(struct domain *d)
|
||||
vtd_dump_p2m_table_level(hd->arch.pgd_maddr, agaw_to_level(hd->arch.agaw), 0, 0);
|
||||
}
|
||||
|
||||
const struct iommu_ops intel_iommu_ops = {
|
||||
const struct iommu_ops __initconstrel intel_iommu_ops = {
|
||||
.init = intel_iommu_domain_init,
|
||||
.hwdom_init = intel_iommu_hwdom_init,
|
||||
.add_device = intel_iommu_add_device,
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#include <asm/hvm/io.h>
|
||||
#include <asm/setup.h>
|
||||
|
||||
struct iommu_ops iommu_ops;
|
||||
|
||||
void iommu_update_ire_from_apic(
|
||||
unsigned int apic, unsigned int reg, unsigned int value)
|
||||
{
|
||||
|
||||
@@ -56,24 +56,15 @@ struct arch_iommu
|
||||
struct guest_iommu *g_iommu;
|
||||
};
|
||||
|
||||
extern const struct iommu_ops intel_iommu_ops;
|
||||
extern const struct iommu_ops amd_iommu_ops;
|
||||
int intel_vtd_setup(void);
|
||||
int amd_iov_detect(void);
|
||||
|
||||
extern struct iommu_ops iommu_ops;
|
||||
|
||||
static inline const struct iommu_ops *iommu_get_ops(void)
|
||||
{
|
||||
switch ( boot_cpu_data.x86_vendor )
|
||||
{
|
||||
case X86_VENDOR_INTEL:
|
||||
return &intel_iommu_ops;
|
||||
case X86_VENDOR_AMD:
|
||||
return &amd_iommu_ops;
|
||||
}
|
||||
|
||||
BUG();
|
||||
|
||||
return NULL;
|
||||
BUG_ON(!iommu_ops.init);
|
||||
return &iommu_ops;
|
||||
}
|
||||
|
||||
static inline int iommu_hardware_setup(void)
|
||||
|
||||