[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen staging] VT-d: tidy <X>_to_<Y>() functions
commit e03eb145484c10351b40755a148babe2ad69d1d8 Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Thu Sep 5 09:57:44 2019 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Thu Sep 5 09:57:44 2019 +0200 VT-d: tidy <X>_to_<Y>() functions Drop iommu_to_drhd() altogether - there's no need for a loop here, the corresponding DRHD is a field in struct intel_iommu. Constify drhd_to_rhsa()'s parameter and adjust style. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx> --- xen/drivers/passthrough/vtd/dmar.c | 20 +++----------------- xen/drivers/passthrough/vtd/extern.h | 11 +++++------ xen/drivers/passthrough/vtd/intremap.c | 5 ++--- xen/drivers/passthrough/vtd/iommu.c | 4 +--- xen/drivers/passthrough/vtd/qinval.c | 5 ++--- 5 files changed, 13 insertions(+), 32 deletions(-) diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c index 9c94deac0b..608be4883a 100644 --- a/xen/drivers/passthrough/vtd/dmar.c +++ b/xen/drivers/passthrough/vtd/dmar.c @@ -128,7 +128,7 @@ static int acpi_ioapic_device_match( return 0; } -struct acpi_drhd_unit * ioapic_to_drhd(unsigned int apic_id) +struct acpi_drhd_unit *ioapic_to_drhd(unsigned int apic_id) { struct acpi_drhd_unit *drhd; list_for_each_entry( drhd, &acpi_drhd_units, list ) @@ -137,21 +137,7 @@ struct acpi_drhd_unit * ioapic_to_drhd(unsigned int apic_id) return NULL; } -struct acpi_drhd_unit * iommu_to_drhd(struct iommu *iommu) -{ - struct acpi_drhd_unit *drhd; - - if ( iommu == NULL ) - return NULL; - - list_for_each_entry( drhd, &acpi_drhd_units, list ) - if ( drhd->iommu == iommu ) - return drhd; - - return NULL; -} - -struct iommu * ioapic_to_iommu(unsigned int apic_id) +struct iommu *ioapic_to_iommu(unsigned int apic_id) { struct acpi_drhd_unit *drhd; @@ -265,7 +251,7 @@ struct acpi_atsr_unit *acpi_find_matched_atsr_unit(const struct pci_dev *pdev) return all_ports; } -struct acpi_rhsa_unit * drhd_to_rhsa(struct acpi_drhd_unit *drhd) +struct acpi_rhsa_unit *drhd_to_rhsa(const struct acpi_drhd_unit *drhd) { struct acpi_rhsa_unit *rhsa; diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h index 331d6e64f7..92519f6c8c 100644 --- a/xen/drivers/passthrough/vtd/extern.h +++ b/xen/drivers/passthrough/vtd/extern.h @@ -52,12 +52,11 @@ int iommu_flush_iec_global(struct iommu *iommu); int iommu_flush_iec_index(struct iommu *iommu, u8 im, u16 iidx); void clear_fault_bits(struct iommu *iommu); -struct iommu * ioapic_to_iommu(unsigned int apic_id); -struct iommu * hpet_to_iommu(unsigned int hpet_id); -struct acpi_drhd_unit * ioapic_to_drhd(unsigned int apic_id); -struct acpi_drhd_unit * hpet_to_drhd(unsigned int hpet_id); -struct acpi_drhd_unit * iommu_to_drhd(struct iommu *iommu); -struct acpi_rhsa_unit * drhd_to_rhsa(struct acpi_drhd_unit *drhd); +struct iommu *ioapic_to_iommu(unsigned int apic_id); +struct iommu *hpet_to_iommu(unsigned int hpet_id); +struct acpi_drhd_unit *ioapic_to_drhd(unsigned int apic_id); +struct acpi_drhd_unit *hpet_to_drhd(unsigned int hpet_id); +struct acpi_rhsa_unit *drhd_to_rhsa(const struct acpi_drhd_unit *drhd); struct acpi_drhd_unit * find_ats_dev_drhd(struct iommu *iommu); diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c index df0e8ac5cb..e8d6091eb4 100644 --- a/xen/drivers/passthrough/vtd/intremap.c +++ b/xen/drivers/passthrough/vtd/intremap.c @@ -760,7 +760,6 @@ int __init intel_setup_hpet_msi(struct msi_desc *msi_desc) int enable_intremap(struct iommu *iommu, int eim) { - struct acpi_drhd_unit *drhd; struct ir_ctrl *ir_ctrl; u32 sts, gcmd; unsigned long flags; @@ -796,8 +795,8 @@ int enable_intremap(struct iommu *iommu, int eim) if ( ir_ctrl->iremap_maddr == 0 ) { - drhd = iommu_to_drhd(iommu); - ir_ctrl->iremap_maddr = alloc_pgtable_maddr(drhd, IREMAP_ARCH_PAGE_NR); + ir_ctrl->iremap_maddr = alloc_pgtable_maddr(iommu->intel->drhd, + IREMAP_ARCH_PAGE_NR); if ( ir_ctrl->iremap_maddr == 0 ) { dprintk(XENLOG_WARNING VTDPREFIX, diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index defa74fae3..efbf2ee3ec 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -224,7 +224,6 @@ void free_pgtable_maddr(u64 maddr) /* context entry handling */ static u64 bus_to_context_maddr(struct iommu *iommu, u8 bus) { - struct acpi_drhd_unit *drhd; struct root_entry *root, *root_entries; u64 maddr; @@ -233,8 +232,7 @@ static u64 bus_to_context_maddr(struct iommu *iommu, u8 bus) root = &root_entries[bus]; if ( !root_present(*root) ) { - drhd = iommu_to_drhd(iommu); - maddr = alloc_pgtable_maddr(drhd, 1); + maddr = alloc_pgtable_maddr(iommu->intel->drhd, 1); if ( maddr == 0 ) { unmap_vtd_domain_page(root_entries); diff --git a/xen/drivers/passthrough/vtd/qinval.c b/xen/drivers/passthrough/vtd/qinval.c index 09cbd36ebb..ca1a5acd43 100644 --- a/xen/drivers/passthrough/vtd/qinval.c +++ b/xen/drivers/passthrough/vtd/qinval.c @@ -397,7 +397,6 @@ static int __must_check flush_iotlb_qi(void *_iommu, u16 did, u64 addr, int enable_qinval(struct iommu *iommu) { - struct acpi_drhd_unit *drhd; struct qi_ctrl *qi_ctrl; struct iommu_flush *flush; u32 sts; @@ -416,8 +415,8 @@ int enable_qinval(struct iommu *iommu) if ( qi_ctrl->qinval_maddr == 0 ) { - drhd = iommu_to_drhd(iommu); - qi_ctrl->qinval_maddr = alloc_pgtable_maddr(drhd, QINVAL_ARCH_PAGE_NR); + qi_ctrl->qinval_maddr = alloc_pgtable_maddr(iommu->intel->drhd, + QINVAL_ARCH_PAGE_NR); if ( qi_ctrl->qinval_maddr == 0 ) { dprintk(XENLOG_WARNING VTDPREFIX, -- 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 |