From 227475c278699a62bfcf7d3a19349efe47f30712 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Wed, 7 Jan 2026 15:59:55 +0100 Subject: [PATCH] VT-d: move {,un}map_vtd_domain_page() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ..., thus allowing them to become static. There's nothing x86-specific about these functions anyway. Since only the "iommu_inclusive_mapping" parameter declaration would be left in the file, move that as well. There's nothing VT-d specific about it (anymore?): "dom0-iommu=map-inclusive" is similarly generic, and documentation also doesn't say anything. Signed-off-by: Jan Beulich Acked-by: Roger Pau Monné --- docs/misc/xen-command-line.pandoc | 2 +- xen/drivers/passthrough/vtd/Makefile | 2 - xen/drivers/passthrough/vtd/extern.h | 13 ++++++- xen/drivers/passthrough/vtd/x86/Makefile | 1 - xen/drivers/passthrough/vtd/x86/vtd.c | 48 ------------------------ xen/drivers/passthrough/x86/iommu.c | 7 ++++ 6 files changed, 19 insertions(+), 54 deletions(-) delete mode 100644 xen/drivers/passthrough/vtd/x86/Makefile delete mode 100644 xen/drivers/passthrough/vtd/x86/vtd.c diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc index 805da22c44..bbbdf6a5bb 100644 --- a/docs/misc/xen-command-line.pandoc +++ b/docs/misc/xen-command-line.pandoc @@ -1651,7 +1651,7 @@ Specify the timeout of the device IOTLB invalidation in milliseconds. By default, the timeout is 1000 ms. When you see error 'Queue invalidate wait descriptor timed out', try increasing this value. -### iommu_inclusive_mapping +### iommu_inclusive_mapping (x86) > `= ` **WARNING: This command line option is deprecated, and superseded by diff --git a/xen/drivers/passthrough/vtd/Makefile b/xen/drivers/passthrough/vtd/Makefile index fde7555fac..3204546f11 100644 --- a/xen/drivers/passthrough/vtd/Makefile +++ b/xen/drivers/passthrough/vtd/Makefile @@ -1,5 +1,3 @@ -obj-$(CONFIG_X86) += x86/ - obj-y += iommu.o obj-y += dmar.o obj-y += utils.o diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h index 4df26df6d4..65f81a8bf1 100644 --- a/xen/drivers/passthrough/vtd/extern.h +++ b/xen/drivers/passthrough/vtd/extern.h @@ -21,6 +21,7 @@ #define DRIVERS__PASSTHROUGH__VTD__EXTERN_H #include "dmar.h" +#include #include #define VTDPREFIX "[VT-D]" @@ -68,8 +69,6 @@ struct acpi_rhsa_unit *drhd_to_rhsa(const struct acpi_drhd_unit *drhd); uint64_t alloc_pgtable_maddr(unsigned long npages, nodeid_t node); void free_pgtable_maddr(u64 maddr); -void *map_vtd_domain_page(u64 maddr); -void unmap_vtd_domain_page(const void *va); int domain_context_mapping_one(struct domain *domain, struct vtd_iommu *iommu, uint8_t bus, uint8_t devfn, const struct pci_dev *pdev, domid_t domid, @@ -79,6 +78,16 @@ int domain_context_unmap_one(struct domain *domain, struct vtd_iommu *iommu, int cf_check intel_iommu_get_reserved_device_memory( iommu_grdm_t *func, void *ctxt); +static inline void *map_vtd_domain_page(paddr_t maddr) +{ + return map_domain_page(_mfn(paddr_to_pfn(maddr))); +} + +static inline void unmap_vtd_domain_page(const void *va) +{ + unmap_domain_page(va); +} + unsigned int cf_check io_apic_read_remap_rte( unsigned int apic, unsigned int reg); void cf_check io_apic_write_remap_rte( diff --git a/xen/drivers/passthrough/vtd/x86/Makefile b/xen/drivers/passthrough/vtd/x86/Makefile deleted file mode 100644 index 85243e3aa7..0000000000 --- a/xen/drivers/passthrough/vtd/x86/Makefile +++ /dev/null @@ -1 +0,0 @@ -obj-y += vtd.o diff --git a/xen/drivers/passthrough/vtd/x86/vtd.c b/xen/drivers/passthrough/vtd/x86/vtd.c deleted file mode 100644 index 76f12adc23..0000000000 --- a/xen/drivers/passthrough/vtd/x86/vtd.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2008, Intel Corporation. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; If not, see . - * - * Copyright (C) Allen Kay - * Copyright (C) Weidong Han - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "../iommu.h" -#include "../dmar.h" -#include "../vtd.h" -#include "../extern.h" - -/* - * iommu_inclusive_mapping: when set, all memory below 4GB is included in dom0 - * 1:1 iommu mappings except xen and unusable regions. - */ -boolean_param("iommu_inclusive_mapping", iommu_hwdom_inclusive); - -void *map_vtd_domain_page(u64 maddr) -{ - return map_domain_page(_mfn(paddr_to_pfn(maddr))); -} - -void unmap_vtd_domain_page(const void *va) -{ - unmap_domain_page(va); -} diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c index 0954cc4922..951f1f30b7 100644 --- a/xen/drivers/passthrough/x86/iommu.c +++ b/xen/drivers/passthrough/x86/iommu.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -36,6 +37,12 @@ bool __initdata iommu_superpages = true; enum iommu_intremap __read_mostly iommu_intremap = iommu_intremap_full; +/* + * iommu_inclusive_mapping: When set, all memory below 4GB is included in dom0 + * 1:1 iommu mappings except xen and unusable regions. + */ +boolean_param("iommu_inclusive_mapping", iommu_hwdom_inclusive); + #ifdef CONFIG_PV /* Possible unfiltered LAPIC/MSI messages from untrusted sources? */ bool __read_mostly untrusted_msi;