[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen staging] x86/vtd: Drop struct intel_iommu
commit 9676360b7ae3dc59ce0e0080769fbd6a1121d1be Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Tue Nov 27 15:27:41 2018 +0000 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Thu Sep 5 11:45:00 2019 +0100 x86/vtd: Drop struct intel_iommu The sole remaining member of struct intel_iommu is the drhd backpointer. Move this into struct vtd_iommu, replacing the the 'intel' pointer. This removes one dynamic memory allocation per IOMMU on the system. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Acked-by: Kevin Tian <kevin.tian@xxxxxxxxx> --- xen/drivers/passthrough/vtd/iommu.c | 33 +++++---------------------------- xen/drivers/passthrough/vtd/iommu.h | 6 +----- xen/drivers/passthrough/vtd/quirks.c | 9 +++------ xen/drivers/passthrough/vtd/utils.c | 2 +- 4 files changed, 10 insertions(+), 40 deletions(-) diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index 2fa0e743e2..04d46f7eab 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -139,22 +139,6 @@ static int context_get_domain_id(struct context_entry *context, return domid; } -static struct intel_iommu *__init alloc_intel_iommu(void) -{ - struct intel_iommu *intel; - - intel = xzalloc(struct intel_iommu); - if ( intel == NULL ) - return NULL; - - return intel; -} - -static void __init free_intel_iommu(struct intel_iommu *intel) -{ - xfree(intel); -} - static int iommus_incoherent; static void __iommu_flush_cache(void *addr, unsigned int size) { @@ -850,7 +834,7 @@ static int iommu_page_fault_do_one(struct vtd_iommu *iommu, int type, { const char *reason, *kind; enum faulttype fault_type; - u16 seg = iommu->intel->drhd->segment; + u16 seg = iommu->drhd->segment; reason = iommu_get_fault_reason(fault_reason, &fault_type); switch ( fault_type ) @@ -963,7 +947,7 @@ static void __do_iommu_page_fault(struct vtd_iommu *iommu) iommu_page_fault_do_one(iommu, type, fault_reason, source_id, guest_addr); - pci_check_disable_device(iommu->intel->drhd->segment, + pci_check_disable_device(iommu->drhd->segment, PCI_BUS(source_id), PCI_DEVFN2(source_id)); fault_index++; @@ -1162,13 +1146,7 @@ int __init iommu_alloc(struct acpi_drhd_unit *drhd) INIT_LIST_HEAD(&iommu->ats_devices); spin_lock_init(&iommu->intremap.lock); - iommu->intel = alloc_intel_iommu(); - if ( iommu->intel == NULL ) - { - xfree(iommu); - return -ENOMEM; - } - iommu->intel->drhd = drhd; + iommu->drhd = drhd; drhd->iommu = iommu; iommu->reg = ioremap(drhd->address, PAGE_SIZE); @@ -1258,7 +1236,6 @@ void __init iommu_free(struct acpi_drhd_unit *drhd) xfree(iommu->domid_bitmap); xfree(iommu->domid_map); - free_intel_iommu(iommu->intel); if ( iommu->msi.irq >= 0 ) destroy_irq(iommu->msi.irq); xfree(iommu); @@ -1308,7 +1285,7 @@ int domain_context_mapping_one( struct domain_iommu *hd = dom_iommu(domain); struct context_entry *context, *context_entries; u64 maddr, pgd_maddr; - u16 seg = iommu->intel->drhd->segment; + u16 seg = iommu->drhd->segment; int agaw, rc, ret; bool_t flush_dev_iotlb; @@ -1608,7 +1585,7 @@ int domain_context_unmap_one( spin_unlock(&iommu->lock); unmap_vtd_domain_page(context_entries); - if ( !iommu->intel->drhd->segment && !rc ) + if ( !iommu->drhd->segment && !rc ) rc = me_wifi_quirk(domain, bus, devfn, UNMAP_ME_PHANTOM_FUNC); return rc; diff --git a/xen/drivers/passthrough/vtd/iommu.h b/xen/drivers/passthrough/vtd/iommu.h index ae2369ca55..216791b3d6 100644 --- a/xen/drivers/passthrough/vtd/iommu.h +++ b/xen/drivers/passthrough/vtd/iommu.h @@ -505,10 +505,6 @@ extern struct list_head acpi_drhd_units; extern struct list_head acpi_rmrr_units; extern struct list_head acpi_ioapic_units; -struct intel_iommu { - struct acpi_drhd_unit *drhd; -}; - struct vtd_iommu { struct list_head list; void __iomem *reg; /* Pointer to hardware regs, virtual addr */ @@ -521,7 +517,7 @@ struct vtd_iommu { u64 root_maddr; /* root entry machine address */ nodeid_t node; struct msi_desc msi; - struct intel_iommu *intel; + struct acpi_drhd_unit *drhd; uint64_t qinval_maddr; /* queue invalidation page machine address */ diff --git a/xen/drivers/passthrough/vtd/quirks.c b/xen/drivers/passthrough/vtd/quirks.c index 30c6234845..e7e326fe8c 100644 --- a/xen/drivers/passthrough/vtd/quirks.c +++ b/xen/drivers/passthrough/vtd/quirks.c @@ -139,8 +139,7 @@ static void __init map_igd_reg(void) */ static int cantiga_vtd_ops_preamble(struct vtd_iommu *iommu) { - struct intel_iommu *intel = iommu->intel; - struct acpi_drhd_unit *drhd = intel ? intel->drhd : NULL; + struct acpi_drhd_unit *drhd = iommu->drhd; if ( !is_igd_drhd(drhd) || !is_cantiga_b3 ) return 0; @@ -174,8 +173,7 @@ static int cantiga_vtd_ops_preamble(struct vtd_iommu *iommu) */ static void snb_vtd_ops_preamble(struct vtd_iommu *iommu) { - struct intel_iommu *intel = iommu->intel; - struct acpi_drhd_unit *drhd = intel ? intel->drhd : NULL; + struct acpi_drhd_unit *drhd = iommu->drhd; s_time_t start_time; if ( !is_igd_drhd(drhd) || !is_snb_gfx ) @@ -204,8 +202,7 @@ static void snb_vtd_ops_preamble(struct vtd_iommu *iommu) static void snb_vtd_ops_postamble(struct vtd_iommu *iommu) { - struct intel_iommu *intel = iommu->intel; - struct acpi_drhd_unit *drhd = intel ? intel->drhd : NULL; + struct acpi_drhd_unit *drhd = iommu->drhd; if ( !is_igd_drhd(drhd) || !is_snb_gfx ) return; diff --git a/xen/drivers/passthrough/vtd/utils.c b/xen/drivers/passthrough/vtd/utils.c index 9fdbd52ec1..7552dd8e0c 100644 --- a/xen/drivers/passthrough/vtd/utils.c +++ b/xen/drivers/passthrough/vtd/utils.c @@ -96,7 +96,7 @@ void print_vtd_entries(struct vtd_iommu *iommu, int bus, int devfn, u64 gmfn) u32 l_index, level; printk("print_vtd_entries: iommu #%u dev %04x:%02x:%02x.%u gmfn %"PRI_gfn"\n", - iommu->index, iommu->intel->drhd->segment, bus, + iommu->index, iommu->drhd->segment, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), gmfn); if ( iommu->root_maddr == 0 ) -- generated by git-patchbot for /home/xen/git/xen.git#staging _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |