* [PATCH v2 0/5] Various IOMMU related simplifications
@ 2025-10-23 9:12 Teddy Astie
2025-10-23 9:12 ` [PATCH v2 2/5] vtd: Drop "iommu_inclusive_mapping" command-line option Teddy Astie
` (5 more replies)
0 siblings, 6 replies; 17+ messages in thread
From: Teddy Astie @ 2025-10-23 9:12 UTC (permalink / raw)
To: xen-devel; +Cc: Teddy Astie
Various simplifications in the VT-d and IO-APIC code (mostly related to legacy ia64 code).
No functional change intended.
Changed in v2 :
- drop (un)map_vtd_domain_page wrapper instead of moving it
- drop deprecated and Intel-exclusive iommu_inclusive_mapping=<boolean>
- description and formatting changes
Teddy Astie (5):
vtd: Drop (un)map_vtd_domain_page wrapper
vtd: Drop "iommu_inclusive_mapping" command-line option
vtd: Collapse x86 subdirectory
vtd: Remove IO_xAPIC_route_entry macro
x86/ioapic: Don't open-code 32-bits rte reads
CHANGELOG.md | 2 +
docs/misc/xen-command-line.pandoc | 6 --
xen/arch/x86/include/asm/io_apic.h | 1 +
xen/arch/x86/io_apic.c | 29 +++----
xen/drivers/passthrough/vtd/Makefile | 3 +-
xen/drivers/passthrough/vtd/{x86 => }/ats.c | 21 ++---
xen/drivers/passthrough/vtd/dmar.c | 2 +-
xen/drivers/passthrough/vtd/extern.h | 3 -
xen/drivers/passthrough/vtd/intremap.c | 34 ++++----
xen/drivers/passthrough/vtd/iommu.c | 88 ++++++++++-----------
xen/drivers/passthrough/vtd/iommu.h | 7 +-
xen/drivers/passthrough/vtd/qinval.c | 13 +--
xen/drivers/passthrough/vtd/utils.c | 25 +++---
xen/drivers/passthrough/vtd/vtd.h | 3 -
xen/drivers/passthrough/vtd/x86/Makefile | 2 -
xen/drivers/passthrough/vtd/x86/vtd.c | 48 -----------
16 files changed, 108 insertions(+), 179 deletions(-)
rename xen/drivers/passthrough/vtd/{x86 => }/ats.c (92%)
delete mode 100644 xen/drivers/passthrough/vtd/x86/Makefile
delete mode 100644 xen/drivers/passthrough/vtd/x86/vtd.c
--
2.51.1
--
Teddy Astie | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
^ permalink raw reply [flat|nested] 17+ messages in thread* [PATCH v2 2/5] vtd: Drop "iommu_inclusive_mapping" command-line option 2025-10-23 9:12 [PATCH v2 0/5] Various IOMMU related simplifications Teddy Astie @ 2025-10-23 9:12 ` Teddy Astie 2025-10-23 10:11 ` Jan Beulich 2025-10-23 9:12 ` [PATCH v2 4/5] vtd: Remove IO_xAPIC_route_entry macro Teddy Astie ` (4 subsequent siblings) 5 siblings, 1 reply; 17+ messages in thread From: Teddy Astie @ 2025-10-23 9:12 UTC (permalink / raw) To: xen-devel; +Cc: Teddy Astie This command-line option is deprecated and super-seeded with dom0-iommu=map-inclusive. Drop this command-line parameter and delete vtd/x86/vtd.c which is now empty. Signed-off-by: Teddy Astie <teddy.astie@vates.tech> --- v2: - new CHANGELOG.md | 2 ++ docs/misc/xen-command-line.pandoc | 6 ---- xen/drivers/passthrough/vtd/x86/Makefile | 3 +- xen/drivers/passthrough/vtd/x86/vtd.c | 38 ------------------------ 4 files changed, 3 insertions(+), 46 deletions(-) delete mode 100644 xen/drivers/passthrough/vtd/x86/vtd.c diff --git a/CHANGELOG.md b/CHANGELOG.md index 0cf9ad2d95..d4a22b8f8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - On x86: - GNTTABOP_cache_flush: it's unused on x86 and the implementation is broken. + - Intel-specific iommu_inclusive_mapping=<boolean> option: super-seeded + by dom0-iommu=map-inclusive since Xen 4.16. - Support of qemu-traditional has been removed. diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc index 28a98321c7..0af71e289a 100644 --- a/docs/misc/xen-command-line.pandoc +++ b/docs/misc/xen-command-line.pandoc @@ -1691,12 +1691,6 @@ 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 -> `= <boolean>` - -**WARNING: This command line option is deprecated, and superseded by -_dom0-iommu=map-inclusive_ - using both options in combination is undefined.** - ### irq-max-guests (x86) > `= <integer>` diff --git a/xen/drivers/passthrough/vtd/x86/Makefile b/xen/drivers/passthrough/vtd/x86/Makefile index fe20a0b019..82b3904a91 100644 --- a/xen/drivers/passthrough/vtd/x86/Makefile +++ b/xen/drivers/passthrough/vtd/x86/Makefile @@ -1,2 +1 @@ -obj-y += ats.o -obj-y += vtd.o +obj-y += ats.o \ No newline at end of file diff --git a/xen/drivers/passthrough/vtd/x86/vtd.c b/xen/drivers/passthrough/vtd/x86/vtd.c deleted file mode 100644 index b0798dc6a1..0000000000 --- a/xen/drivers/passthrough/vtd/x86/vtd.c +++ /dev/null @@ -1,38 +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 <http://www.gnu.org/licenses/>. - * - * Copyright (C) Allen Kay <allen.m.kay@intel.com> - * Copyright (C) Weidong Han <weidong.han@intel.com> - */ - -#include <xen/param.h> -#include <xen/sched.h> -#include <xen/softirq.h> -#include <xen/domain_page.h> -#include <asm/paging.h> -#include <xen/iommu.h> -#include <xen/irq.h> -#include <xen/numa.h> -#include <asm/fixmap.h> -#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); -- 2.51.1 -- Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH v2 2/5] vtd: Drop "iommu_inclusive_mapping" command-line option 2025-10-23 9:12 ` [PATCH v2 2/5] vtd: Drop "iommu_inclusive_mapping" command-line option Teddy Astie @ 2025-10-23 10:11 ` Jan Beulich 0 siblings, 0 replies; 17+ messages in thread From: Jan Beulich @ 2025-10-23 10:11 UTC (permalink / raw) To: Teddy Astie; +Cc: xen-devel On 23.10.2025 11:12, Teddy Astie wrote: > --- a/CHANGELOG.md > +++ b/CHANGELOG.md > @@ -50,6 +50,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) > - On x86: > - GNTTABOP_cache_flush: it's unused on x86 and the implementation is > broken. > + - Intel-specific iommu_inclusive_mapping=<boolean> option: super-seeded > + by dom0-iommu=map-inclusive since Xen 4.16. > > - Support of qemu-traditional has been removed. This is the kind of change that isn't very useful to post during the freeze period. The change to this file will need re-basing anyway after branching, when in fact it may then still (wrongly) apply cleanly. Jan ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v2 4/5] vtd: Remove IO_xAPIC_route_entry macro 2025-10-23 9:12 [PATCH v2 0/5] Various IOMMU related simplifications Teddy Astie 2025-10-23 9:12 ` [PATCH v2 2/5] vtd: Drop "iommu_inclusive_mapping" command-line option Teddy Astie @ 2025-10-23 9:12 ` Teddy Astie 2025-10-23 9:36 ` Jan Beulich 2025-10-23 9:12 ` [PATCH v2 5/5] x86/ioapic: Don't open-code 32-bits rte reads Teddy Astie ` (3 subsequent siblings) 5 siblings, 1 reply; 17+ messages in thread From: Teddy Astie @ 2025-10-23 9:12 UTC (permalink / raw) To: xen-devel; +Cc: Teddy Astie This macro was introduced to abstract between IO-APIC and IO-SAPIC (ia64), now that ia64 isn't supported anymore, this macro now only refers to IO-APIC. Signed-off-by: Teddy Astie <teddy.astie@vates.tech> --- v2: - formatting changes xen/drivers/passthrough/vtd/intremap.c | 10 +++++----- xen/drivers/passthrough/vtd/vtd.h | 3 --- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c index 6c779d476d..612e08bcec 100644 --- a/xen/drivers/passthrough/vtd/intremap.c +++ b/xen/drivers/passthrough/vtd/intremap.c @@ -269,7 +269,7 @@ static unsigned int alloc_remap_entry(struct vtd_iommu *iommu, unsigned int nr) } static int remap_entry_to_ioapic_rte( - struct vtd_iommu *iommu, int index, struct IO_xAPIC_route_entry *old_rte) + struct vtd_iommu *iommu, int index, struct IO_APIC_route_entry *old_rte) { struct iremap_entry *iremap_entry = NULL, *iremap_entries; unsigned long flags; @@ -317,8 +317,8 @@ static int remap_entry_to_ioapic_rte( } static int ioapic_rte_to_remap_entry(struct vtd_iommu *iommu, - int apic, unsigned int ioapic_pin, struct IO_xAPIC_route_entry *old_rte, - struct IO_xAPIC_route_entry new_rte) + int apic, unsigned int ioapic_pin, struct IO_APIC_route_entry *old_rte, + struct IO_APIC_route_entry new_rte) { struct iremap_entry *iremap_entry = NULL, *iremap_entries; struct iremap_entry new_ire; @@ -399,7 +399,7 @@ unsigned int cf_check io_apic_read_remap_rte( { unsigned int ioapic_pin = (reg - 0x10) / 2; int index; - struct IO_xAPIC_route_entry old_rte = { }; + struct IO_APIC_route_entry old_rte = {}; int rte_upper = (reg & 1) ? 1 : 0; struct vtd_iommu *iommu = ioapic_to_iommu(IO_APIC_ID(apic)); @@ -421,7 +421,7 @@ unsigned int cf_check io_apic_read_remap_rte( void cf_check io_apic_write_remap_rte( unsigned int apic, unsigned int pin, uint64_t rte) { - struct IO_xAPIC_route_entry old_rte = {}, new_rte; + struct IO_APIC_route_entry old_rte = {}, new_rte; struct vtd_iommu *iommu = ioapic_to_iommu(IO_APIC_ID(apic)); int rc; diff --git a/xen/drivers/passthrough/vtd/vtd.h b/xen/drivers/passthrough/vtd/vtd.h index b95124517b..f0286b40c3 100644 --- a/xen/drivers/passthrough/vtd/vtd.h +++ b/xen/drivers/passthrough/vtd/vtd.h @@ -31,9 +31,6 @@ #define MAP_ERROR_RECOVERY (1u << 2) #define UNMAP_ME_PHANTOM_FUNC (1u << 3) -/* Allow for both IOAPIC and IOSAPIC. */ -#define IO_xAPIC_route_entry IO_APIC_route_entry - struct IO_APIC_route_remap_entry { union { u64 val; -- 2.51.1 -- Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH v2 4/5] vtd: Remove IO_xAPIC_route_entry macro 2025-10-23 9:12 ` [PATCH v2 4/5] vtd: Remove IO_xAPIC_route_entry macro Teddy Astie @ 2025-10-23 9:36 ` Jan Beulich 0 siblings, 0 replies; 17+ messages in thread From: Jan Beulich @ 2025-10-23 9:36 UTC (permalink / raw) To: Teddy Astie; +Cc: xen-devel On 23.10.2025 11:12, Teddy Astie wrote: > This macro was introduced to abstract between IO-APIC and IO-SAPIC (ia64), > now that ia64 isn't supported anymore, this macro now only refers to IO-APIC. > > Signed-off-by: Teddy Astie <teddy.astie@vates.tech> > --- > v2: > - formatting changes But you could have retained Andrew's ack, I suppose? Jan ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v2 5/5] x86/ioapic: Don't open-code 32-bits rte reads 2025-10-23 9:12 [PATCH v2 0/5] Various IOMMU related simplifications Teddy Astie 2025-10-23 9:12 ` [PATCH v2 2/5] vtd: Drop "iommu_inclusive_mapping" command-line option Teddy Astie 2025-10-23 9:12 ` [PATCH v2 4/5] vtd: Remove IO_xAPIC_route_entry macro Teddy Astie @ 2025-10-23 9:12 ` Teddy Astie 2025-11-19 10:34 ` Andrew Cooper 2025-11-19 11:02 ` [PATCH v2.1 " Teddy Astie 2025-10-23 9:12 ` [PATCH v2 1/5] vtd: Drop (un)map_vtd_domain_page wrapper Teddy Astie ` (2 subsequent siblings) 5 siblings, 2 replies; 17+ messages in thread From: Teddy Astie @ 2025-10-23 9:12 UTC (permalink / raw) To: xen-devel; +Cc: Teddy Astie There are many places where we use interesting ways of reading 32-bits components of the RTE. Introduce and use low and high components directly to the rte structure instead. Also take the opportunity to simplify "x & 1 ? 1 : 0". Signed-off-by: Teddy Astie <teddy.astie@vates.tech> --- v2: - make rte_upper to use bool instead xen/arch/x86/include/asm/io_apic.h | 1 + xen/arch/x86/io_apic.c | 29 ++++++++++---------------- xen/drivers/passthrough/vtd/intremap.c | 9 +++----- 3 files changed, 15 insertions(+), 24 deletions(-) diff --git a/xen/arch/x86/include/asm/io_apic.h b/xen/arch/x86/include/asm/io_apic.h index 4680dce9e1..0e85f2a860 100644 --- a/xen/arch/x86/include/asm/io_apic.h +++ b/xen/arch/x86/include/asm/io_apic.h @@ -122,6 +122,7 @@ struct IO_APIC_route_entry { } dest; }; uint64_t raw; + struct { uint32_t low, high; }; }; }; diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c index 24447aef6c..9d2edec179 100644 --- a/xen/arch/x86/io_apic.c +++ b/xen/arch/x86/io_apic.c @@ -257,28 +257,23 @@ nomem: return NULL; } -union entry_union { - struct { u32 w1, w2; }; - struct IO_APIC_route_entry entry; -}; - struct IO_APIC_route_entry __ioapic_read_entry( unsigned int apic, unsigned int pin, bool raw) { - union entry_union eu; + struct IO_APIC_route_entry entry; if ( raw || !iommu_intremap ) { - eu.w1 = __io_apic_read(apic, 0x10 + 2 * pin); - eu.w2 = __io_apic_read(apic, 0x11 + 2 * pin); + entry.low = __io_apic_read(apic, 0x10 + 2 * pin); + entry.high = __io_apic_read(apic, 0x11 + 2 * pin); } else { - eu.w1 = iommu_read_apic_from_ire(apic, 0x10 + 2 * pin); - eu.w2 = iommu_read_apic_from_ire(apic, 0x11 + 2 * pin); + entry.low = iommu_read_apic_from_ire(apic, 0x10 + 2 * pin); + entry.high = iommu_read_apic_from_ire(apic, 0x11 + 2 * pin); } - return eu.entry; + return entry; } static struct IO_APIC_route_entry ioapic_read_entry( @@ -297,12 +292,10 @@ void __ioapic_write_entry( unsigned int apic, unsigned int pin, bool raw, struct IO_APIC_route_entry e) { - union entry_union eu = { .entry = e }; - if ( raw || !iommu_intremap ) { - __io_apic_write(apic, 0x11 + 2 * pin, eu.w2); - __io_apic_write(apic, 0x10 + 2 * pin, eu.w1); + __io_apic_write(apic, 0x11 + 2 * pin, e.high); + __io_apic_write(apic, 0x10 + 2 * pin, e.low); /* * Might be called before io_apic_pin_eoi is allocated. Entry will be * initialized to the RTE value once the cache is allocated. @@ -2235,7 +2228,7 @@ int ioapic_guest_read(unsigned long physbase, unsigned int reg, u32 *pval) dprintk(XENLOG_INFO, "IO-APIC: apic=%d, pin=%d, irq=%d\n" \ XENLOG_INFO "IO-APIC: new_entry=%08x\n" \ XENLOG_INFO "IO-APIC: " f "\n", \ - apic, pin, irq, *(u32 *)&rte, ##a ) + apic, pin, irq, rte.low, ##a ) int ioapic_guest_write(unsigned long physbase, unsigned int reg, u32 val) { @@ -2254,7 +2247,7 @@ int ioapic_guest_write(unsigned long physbase, unsigned int reg, u32 val) pin = (reg - 0x10) >> 1; /* Write first half from guest; second half is target info. */ - *(u32 *)&rte = val; + rte.low = val; /* * What about weird destination types? @@ -2305,7 +2298,7 @@ int ioapic_guest_write(unsigned long physbase, unsigned int reg, u32 val) ret = io_apic_read(apic, 0x10 + 2 * pin); spin_unlock_irqrestore(&ioapic_lock, flags); rte.vector = desc->arch.vector; - if ( *(u32*)&rte != ret ) + if ( rte.low != ret ) WARN_BOGUS_WRITE("old_entry=%08x pirq=%d\n" XENLOG_INFO "IO-APIC: Attempt to modify IO-APIC pin for in-use IRQ!", ret, pirq); diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c index 612e08bcec..a276518c52 100644 --- a/xen/drivers/passthrough/vtd/intremap.c +++ b/xen/drivers/passthrough/vtd/intremap.c @@ -400,7 +400,7 @@ unsigned int cf_check io_apic_read_remap_rte( unsigned int ioapic_pin = (reg - 0x10) / 2; int index; struct IO_APIC_route_entry old_rte = {}; - int rte_upper = (reg & 1) ? 1 : 0; + bool rte_upper = reg & 1; struct vtd_iommu *iommu = ioapic_to_iommu(IO_APIC_ID(apic)); if ( !iommu->intremap.num || @@ -411,11 +411,8 @@ unsigned int cf_check io_apic_read_remap_rte( if ( remap_entry_to_ioapic_rte(iommu, index, &old_rte) ) return __io_apic_read(apic, reg); - - if ( rte_upper ) - return (*(((u32 *)&old_rte) + 1)); - else - return (*(((u32 *)&old_rte) + 0)); + + return rte_upper ? old_rte.high : old_rte.low; } void cf_check io_apic_write_remap_rte( -- 2.51.1 -- Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH v2 5/5] x86/ioapic: Don't open-code 32-bits rte reads 2025-10-23 9:12 ` [PATCH v2 5/5] x86/ioapic: Don't open-code 32-bits rte reads Teddy Astie @ 2025-11-19 10:34 ` Andrew Cooper 2025-11-19 11:02 ` [PATCH v2.1 " Teddy Astie 1 sibling, 0 replies; 17+ messages in thread From: Andrew Cooper @ 2025-11-19 10:34 UTC (permalink / raw) To: Teddy Astie, xen-devel On 23/10/2025 10:12 am, Teddy Astie wrote: > diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c > index 612e08bcec..a276518c52 100644 > --- a/xen/drivers/passthrough/vtd/intremap.c > +++ b/xen/drivers/passthrough/vtd/intremap.c > @@ -411,11 +411,8 @@ unsigned int cf_check io_apic_read_remap_rte( > > if ( remap_entry_to_ioapic_rte(iommu, index, &old_rte) ) > return __io_apic_read(apic, reg); > - > - if ( rte_upper ) > - return (*(((u32 *)&old_rte) + 1)); > - else > - return (*(((u32 *)&old_rte) + 0)); > + > + return rte_upper ? old_rte.high : old_rte.low; > } This hunk introduces trailing whitespace where there was none previously. ~Andrew ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v2.1 5/5] x86/ioapic: Don't open-code 32-bits rte reads 2025-10-23 9:12 ` [PATCH v2 5/5] x86/ioapic: Don't open-code 32-bits rte reads Teddy Astie 2025-11-19 10:34 ` Andrew Cooper @ 2025-11-19 11:02 ` Teddy Astie 2025-11-19 14:26 ` Jan Beulich 1 sibling, 1 reply; 17+ messages in thread From: Teddy Astie @ 2025-11-19 11:02 UTC (permalink / raw) To: xen-devel; +Cc: Teddy Astie, Jan Beulich, Andrew Cooper, Roger Pau Monné There are many places where we use interesting ways of reading 32-bits components of the RTE. Introduce and use low and high components directly to the rte structure instead. Also take the opportunity to simplify "x & 1 ? 1 : 0". Signed-off-by: Teddy Astie <teddy.astie@vates.tech> Acked-by: Jan Beulich <jbeulich@suse.com> --- v2.1: - fix trailing spaces v2: - make rte_upper to use bool instead xen/arch/x86/include/asm/io_apic.h | 1 + xen/arch/x86/io_apic.c | 29 ++++++++++---------------- xen/drivers/passthrough/vtd/intremap.c | 7 ++----- 3 files changed, 14 insertions(+), 23 deletions(-) diff --git a/xen/arch/x86/include/asm/io_apic.h b/xen/arch/x86/include/asm/io_apic.h index 4680dce9e1..0e85f2a860 100644 --- a/xen/arch/x86/include/asm/io_apic.h +++ b/xen/arch/x86/include/asm/io_apic.h @@ -122,6 +122,7 @@ struct IO_APIC_route_entry { } dest; }; uint64_t raw; + struct { uint32_t low, high; }; }; }; diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c index d20ab2aa98..46c2a43dac 100644 --- a/xen/arch/x86/io_apic.c +++ b/xen/arch/x86/io_apic.c @@ -254,28 +254,23 @@ nomem: return NULL; } -union entry_union { - struct { u32 w1, w2; }; - struct IO_APIC_route_entry entry; -}; - struct IO_APIC_route_entry __ioapic_read_entry( unsigned int apic, unsigned int pin, bool raw) { - union entry_union eu; + struct IO_APIC_route_entry entry; if ( raw || !iommu_intremap ) { - eu.w1 = __io_apic_read(apic, 0x10 + 2 * pin); - eu.w2 = __io_apic_read(apic, 0x11 + 2 * pin); + entry.low = __io_apic_read(apic, 0x10 + 2 * pin); + entry.high = __io_apic_read(apic, 0x11 + 2 * pin); } else { - eu.w1 = iommu_read_apic_from_ire(apic, 0x10 + 2 * pin); - eu.w2 = iommu_read_apic_from_ire(apic, 0x11 + 2 * pin); + entry.low = iommu_read_apic_from_ire(apic, 0x10 + 2 * pin); + entry.high = iommu_read_apic_from_ire(apic, 0x11 + 2 * pin); } - return eu.entry; + return entry; } static struct IO_APIC_route_entry ioapic_read_entry( @@ -294,12 +289,10 @@ void __ioapic_write_entry( unsigned int apic, unsigned int pin, bool raw, struct IO_APIC_route_entry e) { - union entry_union eu = { .entry = e }; - if ( raw || !iommu_intremap ) { - __io_apic_write(apic, 0x11 + 2 * pin, eu.w2); - __io_apic_write(apic, 0x10 + 2 * pin, eu.w1); + __io_apic_write(apic, 0x11 + 2 * pin, e.high); + __io_apic_write(apic, 0x10 + 2 * pin, e.low); /* * Might be called before io_apic_pin_eoi is allocated. Entry will be * initialized to the RTE value once the cache is allocated. @@ -2218,7 +2211,7 @@ int ioapic_guest_read(unsigned long physbase, unsigned int reg, u32 *pval) dprintk(XENLOG_INFO, "IO-APIC: apic=%d, pin=%d, irq=%d\n" \ XENLOG_INFO "IO-APIC: new_entry=%08x\n" \ XENLOG_INFO "IO-APIC: " f "\n", \ - apic, pin, irq, *(u32 *)&rte, ##a ) + apic, pin, irq, rte.low, ##a ) int ioapic_guest_write(unsigned long physbase, unsigned int reg, u32 val) { @@ -2237,7 +2230,7 @@ int ioapic_guest_write(unsigned long physbase, unsigned int reg, u32 val) pin = (reg - 0x10) >> 1; /* Write first half from guest; second half is target info. */ - *(u32 *)&rte = val; + rte.low = val; /* * What about weird destination types? @@ -2288,7 +2281,7 @@ int ioapic_guest_write(unsigned long physbase, unsigned int reg, u32 val) ret = io_apic_read(apic, 0x10 + 2 * pin); spin_unlock_irqrestore(&ioapic_lock, flags); rte.vector = desc->arch.vector; - if ( *(u32*)&rte != ret ) + if ( rte.low != ret ) WARN_BOGUS_WRITE("old_entry=%08x pirq=%d\n" XENLOG_INFO "IO-APIC: Attempt to modify IO-APIC pin for in-use IRQ!", ret, pirq); diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c index 116c2e75ae..ac39405c0d 100644 --- a/xen/drivers/passthrough/vtd/intremap.c +++ b/xen/drivers/passthrough/vtd/intremap.c @@ -399,7 +399,7 @@ unsigned int cf_check io_apic_read_remap_rte( unsigned int ioapic_pin = (reg - 0x10) / 2; int index; struct IO_APIC_route_entry old_rte = {}; - int rte_upper = (reg & 1) ? 1 : 0; + bool rte_upper = reg & 1; struct vtd_iommu *iommu = ioapic_to_iommu(IO_APIC_ID(apic)); if ( !iommu->intremap.num || @@ -411,10 +411,7 @@ unsigned int cf_check io_apic_read_remap_rte( if ( remap_entry_to_ioapic_rte(iommu, index, &old_rte) ) return __io_apic_read(apic, reg); - if ( rte_upper ) - return (*(((u32 *)&old_rte) + 1)); - else - return (*(((u32 *)&old_rte) + 0)); + return rte_upper ? old_rte.high : old_rte.low; } void cf_check io_apic_write_remap_rte( -- 2.51.2 -- Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH v2.1 5/5] x86/ioapic: Don't open-code 32-bits rte reads 2025-11-19 11:02 ` [PATCH v2.1 " Teddy Astie @ 2025-11-19 14:26 ` Jan Beulich 0 siblings, 0 replies; 17+ messages in thread From: Jan Beulich @ 2025-11-19 14:26 UTC (permalink / raw) To: Teddy Astie; +Cc: Andrew Cooper, Roger Pau Monné, xen-devel On 19.11.2025 12:02, Teddy Astie wrote: > There are many places where we use interesting ways of reading 32-bits > components of the RTE. Introduce and use low and high components directly > to the rte structure instead. > > Also take the opportunity to simplify "x & 1 ? 1 : 0". > > Signed-off-by: Teddy Astie <teddy.astie@vates.tech> > Acked-by: Jan Beulich <jbeulich@suse.com> > --- > v2.1: > - fix trailing spaces You did notice v2 was committed already, didn't you? I suppose that's what made Andrew notice the style issue. Jan ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v2 1/5] vtd: Drop (un)map_vtd_domain_page wrapper 2025-10-23 9:12 [PATCH v2 0/5] Various IOMMU related simplifications Teddy Astie ` (2 preceding siblings ...) 2025-10-23 9:12 ` [PATCH v2 5/5] x86/ioapic: Don't open-code 32-bits rte reads Teddy Astie @ 2025-10-23 9:12 ` Teddy Astie 2025-10-23 10:04 ` Jan Beulich 2025-10-23 9:12 ` [PATCH v2 3/5] vtd: Collapse x86 subdirectory Teddy Astie 2025-10-23 9:15 ` [PATCH v2 0/5] Various IOMMU related simplifications Teddy Astie 5 siblings, 1 reply; 17+ messages in thread From: Teddy Astie @ 2025-10-23 9:12 UTC (permalink / raw) To: xen-devel; +Cc: Teddy Astie Replace use of (un)map_vtd_domain_page with its general equivalents. Also take the opportunity to make iommu->root_page (previously root_maddr) use struct page_info instead of u64. Signed-off-by: Teddy Astie <teddy.astie@vates.tech> --- v2: - drop instead of moving - also replace `root_addr` with `root_page` (with struct page_info) xen/drivers/passthrough/vtd/dmar.c | 2 +- xen/drivers/passthrough/vtd/extern.h | 3 - xen/drivers/passthrough/vtd/intremap.c | 15 +++-- xen/drivers/passthrough/vtd/iommu.c | 88 ++++++++++++-------------- xen/drivers/passthrough/vtd/iommu.h | 7 +- xen/drivers/passthrough/vtd/qinval.c | 13 ++-- xen/drivers/passthrough/vtd/utils.c | 25 ++++---- xen/drivers/passthrough/vtd/x86/ats.c | 11 ++-- xen/drivers/passthrough/vtd/x86/vtd.c | 10 --- 9 files changed, 80 insertions(+), 94 deletions(-) diff --git a/xen/drivers/passthrough/vtd/dmar.c b/xen/drivers/passthrough/vtd/dmar.c index 91c22b8330..2380825f1c 100644 --- a/xen/drivers/passthrough/vtd/dmar.c +++ b/xen/drivers/passthrough/vtd/dmar.c @@ -1107,7 +1107,7 @@ int __init acpi_dmar_init(void) if ( rhsa ) iommu->node = pxm_to_node(rhsa->proximity_domain); - if ( !(iommu->root_maddr = alloc_pgtable_maddr(1, iommu->node)) ) + if ( !(iommu->root_page = maddr_to_page(alloc_pgtable_maddr(1, iommu->node))) ) ret = -ENOMEM; } diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h index c16583c951..2be50de168 100644 --- a/xen/drivers/passthrough/vtd/extern.h +++ b/xen/drivers/passthrough/vtd/extern.h @@ -77,9 +77,6 @@ int __must_check qinval_device_iotlb_sync(struct vtd_iommu *iommu, u16 did, u16 size, u64 addr); 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, diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c index 7726ee618a..6c779d476d 100644 --- a/xen/drivers/passthrough/vtd/intremap.c +++ b/xen/drivers/passthrough/vtd/intremap.c @@ -17,6 +17,7 @@ * Copyright (C) Xiaohui Xin <xiaohui.xin@intel.com> */ +#include <xen/domain_page.h> #include <xen/irq.h> #include <xen/sched.h> #include <xen/iommu.h> @@ -222,7 +223,7 @@ static void free_remap_entry(struct vtd_iommu *iommu, int index) iommu_sync_cache(iremap_entry, sizeof(*iremap_entry)); iommu_flush_iec_index(iommu, 0, index); - unmap_vtd_domain_page(iremap_entries); + unmap_domain_page(iremap_entries); iommu->intremap.num--; } @@ -244,7 +245,7 @@ static unsigned int alloc_remap_entry(struct vtd_iommu *iommu, unsigned int nr) { /* This entry across page boundry */ if ( iremap_entries ) - unmap_vtd_domain_page(iremap_entries); + unmap_domain_page(iremap_entries); GET_IREMAP_ENTRY(iommu->intremap.maddr, i, iremap_entries, p); @@ -259,7 +260,7 @@ static unsigned int alloc_remap_entry(struct vtd_iommu *iommu, unsigned int nr) } if ( iremap_entries ) - unmap_vtd_domain_page(iremap_entries); + unmap_domain_page(iremap_entries); if ( i < IREMAP_ENTRY_NR ) iommu->intremap.num += nr; @@ -291,7 +292,7 @@ static int remap_entry_to_ioapic_rte( dprintk(XENLOG_ERR VTDPREFIX, "IO-APIC index (%d) has an empty entry\n", index); - unmap_vtd_domain_page(iremap_entries); + unmap_domain_page(iremap_entries); spin_unlock_irqrestore(&iommu->intremap.lock, flags); return -EFAULT; } @@ -309,7 +310,7 @@ static int remap_entry_to_ioapic_rte( old_rte->dest.logical.logical_dest = iremap_entry->remap.dst >> 8; } - unmap_vtd_domain_page(iremap_entries); + unmap_domain_page(iremap_entries); spin_unlock_irqrestore(&iommu->intremap.lock, flags); return 0; @@ -388,7 +389,7 @@ static int ioapic_rte_to_remap_entry(struct vtd_iommu *iommu, iommu_sync_cache(iremap_entry, sizeof(*iremap_entry)); iommu_flush_iec_index(iommu, 0, index); - unmap_vtd_domain_page(iremap_entries); + unmap_domain_page(iremap_entries); spin_unlock_irqrestore(&iommu->intremap.lock, flags); return 0; } @@ -607,7 +608,7 @@ static int msi_msg_to_remap_entry( iommu_sync_cache(iremap_entry, sizeof(*iremap_entry)); iommu_flush_iec_index(iommu, 0, index); - unmap_vtd_domain_page(iremap_entries); + unmap_domain_page(iremap_entries); spin_unlock_irqrestore(&iommu->intremap.lock, flags); return alloc; diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index 90f36ac22b..5bd4f19848 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -272,12 +272,6 @@ uint64_t alloc_pgtable_maddr(unsigned long npages, nodeid_t node) return page_to_maddr(pg); } -void free_pgtable_maddr(u64 maddr) -{ - if ( maddr != 0 ) - free_domheap_page(maddr_to_page(maddr)); -} - /* context entry handling */ static u64 bus_to_context_maddr(struct vtd_iommu *iommu, u8 bus) { @@ -285,14 +279,14 @@ static u64 bus_to_context_maddr(struct vtd_iommu *iommu, u8 bus) u64 maddr; ASSERT(spin_is_locked(&iommu->lock)); - root_entries = (struct root_entry *)map_vtd_domain_page(iommu->root_maddr); + root_entries = __map_domain_page(iommu->root_page); root = &root_entries[bus]; if ( !root_present(*root) ) { maddr = alloc_pgtable_maddr(1, iommu->node); if ( maddr == 0 ) { - unmap_vtd_domain_page(root_entries); + unmap_domain_page(root_entries); return 0; } set_root_value(*root, maddr); @@ -300,7 +294,7 @@ static u64 bus_to_context_maddr(struct vtd_iommu *iommu, u8 bus) iommu_sync_cache(root, sizeof(struct root_entry)); } maddr = (u64) get_context_addr(*root); - unmap_vtd_domain_page(root_entries); + unmap_domain_page(root_entries); return maddr; } @@ -344,7 +338,7 @@ static uint64_t addr_to_dma_page_maddr(struct domain *domain, daddr_t addr, } pte_maddr = hd->arch.vtd.pgd_maddr; - parent = map_vtd_domain_page(pte_maddr); + parent = map_domain_page(maddr_to_mfn(pte_maddr)); while ( level > target ) { offset = address_level_offset(addr, level); @@ -388,7 +382,7 @@ static uint64_t addr_to_dma_page_maddr(struct domain *domain, daddr_t addr, if ( dma_pte_present(*pte) ) { - struct dma_pte *split = map_vtd_domain_page(pte_maddr); + struct dma_pte *split = map_domain_page(maddr_to_mfn(pte_maddr)); unsigned long inc = 1UL << level_to_offset_bits(level - 1); split[0].val |= pte->val & ~DMA_PTE_CONTIG_MASK; @@ -400,7 +394,7 @@ static uint64_t addr_to_dma_page_maddr(struct domain *domain, daddr_t addr, (split[offset - 1].val & ~DMA_PTE_CONTIG_MASK) + inc; iommu_sync_cache(split, PAGE_SIZE); - unmap_vtd_domain_page(split); + unmap_domain_page(split); if ( flush_flags ) *flush_flags |= IOMMU_FLUSHF_modified; @@ -422,11 +416,11 @@ static uint64_t addr_to_dma_page_maddr(struct domain *domain, daddr_t addr, break; } - unmap_vtd_domain_page(parent); - parent = map_vtd_domain_page(pte_maddr); + unmap_domain_page(parent); + parent = map_domain_page(maddr_to_mfn(pte_maddr)); } - unmap_vtd_domain_page(parent); + unmap_domain_page(parent); out: return pte_maddr; } @@ -469,10 +463,10 @@ static paddr_t domain_pgd_maddr(struct domain *d, paddr_t pgd_maddr, agaw != level_to_agaw(nr_pt_levels); agaw-- ) { - const struct dma_pte *p = map_vtd_domain_page(pgd_maddr); + const struct dma_pte *p = map_domain_page(maddr_to_mfn(pgd_maddr)); pgd_maddr = dma_pte_addr(*p); - unmap_vtd_domain_page(p); + unmap_domain_page(p); if ( !pgd_maddr ) return 0; } @@ -815,7 +809,7 @@ static int iommu_set_root_entry(struct vtd_iommu *iommu) unsigned long flags; spin_lock_irqsave(&iommu->register_lock, flags); - dmar_writeq(iommu->reg, DMAR_RTADDR_REG, iommu->root_maddr); + dmar_writeq(iommu->reg, DMAR_RTADDR_REG, page_to_maddr(iommu->root_page)); sts = dmar_readl(iommu->reg, DMAR_GSTS_REG); dmar_writel(iommu->reg, DMAR_GCMD_REG, sts | DMA_GCMD_SRTP); @@ -1408,10 +1402,10 @@ void __init iommu_free(struct acpi_drhd_unit *drhd) drhd->iommu = NULL; - if ( iommu->root_maddr != 0 ) + if ( iommu->root_page ) { - free_pgtable_maddr(iommu->root_maddr); - iommu->root_maddr = 0; + free_domheap_page(iommu->root_page); + iommu->root_page = NULL; } if ( iommu->reg ) @@ -1504,7 +1498,7 @@ int domain_context_mapping_one( spin_unlock(&iommu->lock); return -ENOMEM; } - context_entries = (struct context_entry *)map_vtd_domain_page(maddr); + context_entries = map_domain_page(maddr_to_mfn(maddr)); context = &context_entries[devfn]; old = (lctxt = *context).full; @@ -1521,7 +1515,7 @@ int domain_context_mapping_one( if ( !prev_dom ) { spin_unlock(&iommu->lock); - unmap_vtd_domain_page(context_entries); + unmap_domain_page(context_entries); dprintk(XENLOG_DEBUG VTDPREFIX, "no domain for did %u (nr_dom %u)\n", prev_did, cap_ndoms(iommu->cap)); @@ -1544,7 +1538,7 @@ int domain_context_mapping_one( { spin_unlock(&hd->arch.mapping_lock); spin_unlock(&iommu->lock); - unmap_vtd_domain_page(context_entries); + unmap_domain_page(context_entries); if ( prev_dom ) rcu_unlock_domain(prev_dom); return -ENOMEM; @@ -1564,7 +1558,7 @@ int domain_context_mapping_one( { unlock: spin_unlock(&iommu->lock); - unmap_vtd_domain_page(context_entries); + unmap_domain_page(context_entries); if ( prev_dom ) rcu_unlock_domain(prev_dom); return rc; @@ -1632,7 +1626,7 @@ int domain_context_mapping_one( set_bit(iommu->index, hd->arch.vtd.iommu_bitmap); - unmap_vtd_domain_page(context_entries); + unmap_domain_page(context_entries); if ( !seg && !rc ) rc = me_wifi_quirk(domain, bus, devfn, domid, pgd_maddr, mode); @@ -1864,13 +1858,13 @@ int domain_context_unmap_one( spin_unlock(&iommu->lock); return 0; } - context_entries = (struct context_entry *)map_vtd_domain_page(maddr); + context_entries = map_domain_page(maddr_to_mfn(maddr)); context = &context_entries[devfn]; if ( !context_present(*context) ) { spin_unlock(&iommu->lock); - unmap_vtd_domain_page(context_entries); + unmap_domain_page(context_entries); return 0; } @@ -1902,7 +1896,7 @@ int domain_context_unmap_one( rc = 0; spin_unlock(&iommu->lock); - unmap_vtd_domain_page(context_entries); + unmap_domain_page(context_entries); if ( !iommu->drhd->segment && !rc ) rc = me_wifi_quirk(domain, bus, devfn, DOMID_INVALID, 0, @@ -2101,7 +2095,7 @@ static int __must_check cf_check intel_iommu_map_page( return -ENOMEM; } - page = (struct dma_pte *)map_vtd_domain_page(pg_maddr); + page = map_domain_page(maddr_to_mfn(pg_maddr)); pte = &page[address_level_offset(dfn_to_daddr(dfn), level)]; old = *pte; @@ -2119,7 +2113,7 @@ static int __must_check cf_check intel_iommu_map_page( if ( !((old.val ^ new.val) & ~DMA_PTE_CONTIG_MASK) ) { spin_unlock(&hd->arch.mapping_lock); - unmap_vtd_domain_page(page); + unmap_domain_page(page); return 0; } @@ -2142,7 +2136,7 @@ static int __must_check cf_check intel_iommu_map_page( { struct page_info *pg = maddr_to_page(pg_maddr); - unmap_vtd_domain_page(page); + unmap_domain_page(page); new.val &= ~(LEVEL_MASK << level_to_offset_bits(level)); dma_set_pte_superpage(new); @@ -2151,7 +2145,7 @@ static int __must_check cf_check intel_iommu_map_page( flush_flags, false); BUG_ON(pg_maddr < PAGE_SIZE); - page = map_vtd_domain_page(pg_maddr); + page = map_domain_page(maddr_to_mfn(pg_maddr)); pte = &page[address_level_offset(dfn_to_daddr(dfn), level)]; *pte = new; iommu_sync_cache(pte, sizeof(*pte)); @@ -2162,7 +2156,7 @@ static int __must_check cf_check intel_iommu_map_page( } spin_unlock(&hd->arch.mapping_lock); - unmap_vtd_domain_page(page); + unmap_domain_page(page); *flush_flags |= IOMMU_FLUSHF_added; if ( dma_pte_present(old) ) @@ -2209,13 +2203,13 @@ static int __must_check cf_check intel_iommu_unmap_page( return pg_maddr ? -ENOMEM : 0; } - page = map_vtd_domain_page(pg_maddr); + page = map_domain_page(maddr_to_mfn(pg_maddr)); pte = &page[address_level_offset(addr, level)]; if ( !dma_pte_present(*pte) ) { spin_unlock(&hd->arch.mapping_lock); - unmap_vtd_domain_page(page); + unmap_domain_page(page); return 0; } @@ -2230,12 +2224,12 @@ static int __must_check cf_check intel_iommu_unmap_page( { struct page_info *pg = maddr_to_page(pg_maddr); - unmap_vtd_domain_page(page); + unmap_domain_page(page); pg_maddr = addr_to_dma_page_maddr(d, addr, level, flush_flags, false); BUG_ON(pg_maddr < PAGE_SIZE); - page = map_vtd_domain_page(pg_maddr); + page = map_domain_page(maddr_to_mfn(pg_maddr)); pte = &page[address_level_offset(addr, level)]; dma_clear_pte(*pte); iommu_sync_cache(pte, sizeof(*pte)); @@ -2247,7 +2241,7 @@ static int __must_check cf_check intel_iommu_unmap_page( spin_unlock(&hd->arch.mapping_lock); - unmap_vtd_domain_page(page); + unmap_domain_page(page); *flush_flags |= IOMMU_FLUSHF_modified; @@ -3052,7 +3046,7 @@ static void vtd_dump_page_table_level(paddr_t pt_maddr, int level, paddr_t gpa, if ( level < 1 ) return; - pt_vaddr = map_vtd_domain_page(pt_maddr); + pt_vaddr = map_domain_page(maddr_to_mfn(pt_maddr)); next_level = level - 1; for ( i = 0; i < PTE_NUM; i++ ) @@ -3077,7 +3071,7 @@ static void vtd_dump_page_table_level(paddr_t pt_maddr, int level, paddr_t gpa, dma_pte_write(*pte) ? 'w' : '-'); } - unmap_vtd_domain_page(pt_vaddr); + unmap_domain_page(pt_vaddr); } static void cf_check vtd_dump_page_tables(struct domain *d) @@ -3119,9 +3113,9 @@ static int fill_qpt(struct dma_pte *this, unsigned int level, if ( level ) { - next = map_vtd_domain_page(page_to_maddr(pgs[level])); + next = __map_domain_page(pgs[level]); rc = fill_qpt(next, level - 1, pgs); - unmap_vtd_domain_page(next); + unmap_domain_page(next); } } @@ -3131,9 +3125,9 @@ static int fill_qpt(struct dma_pte *this, unsigned int level, } else if ( level && !dma_pte_superpage(*pte) ) { - next = map_vtd_domain_page(dma_pte_addr(*pte)); + next = map_domain_page(maddr_to_mfn(dma_pte_addr(*pte))); rc = fill_qpt(next, level - 1, pgs); - unmap_vtd_domain_page(next); + unmap_domain_page(next); } } @@ -3204,9 +3198,9 @@ static int cf_check intel_iommu_quarantine_init(struct pci_dev *pdev, struct dma_pte *root; struct page_info *pgs[6] = {}; - root = map_vtd_domain_page(pdev->arch.vtd.pgd_maddr); + root = map_domain_page(maddr_to_mfn(pdev->arch.vtd.pgd_maddr)); rc = fill_qpt(root, level - 1, pgs); - unmap_vtd_domain_page(root); + unmap_domain_page(root); pdev->arch.leaf_mfn = page_to_mfn(pgs[0]); } diff --git a/xen/drivers/passthrough/vtd/iommu.h b/xen/drivers/passthrough/vtd/iommu.h index 29d350b23d..7c40f81408 100644 --- a/xen/drivers/passthrough/vtd/iommu.h +++ b/xen/drivers/passthrough/vtd/iommu.h @@ -19,6 +19,7 @@ #ifndef DRIVERS__PASSTHROUGH__VTD__IOMMU_H #define DRIVERS__PASSTHROUGH__VTD__IOMMU_H +#include <xen/domain_page.h> #include <xen/iommu.h> #include <asm/msi.h> @@ -366,8 +367,8 @@ struct iremap_entry { */ #define GET_IREMAP_ENTRY(maddr, index, entries, entry) \ do { \ - entries = (struct iremap_entry *)map_vtd_domain_page( \ - (maddr) + (( (index) >> IREMAP_ENTRY_ORDER ) << PAGE_SHIFT ) ); \ + entries = (struct iremap_entry *)map_domain_page(maddr_to_mfn( \ + (maddr) + (( (index) >> IREMAP_ENTRY_ORDER ) << PAGE_SHIFT ) ));\ entry = &entries[(index) % (1 << IREMAP_ENTRY_ORDER)]; \ } while(0) @@ -482,7 +483,7 @@ struct vtd_iommu { u64 ecap; spinlock_t lock; /* protect context */ spinlock_t register_lock; /* protect iommu register handling */ - u64 root_maddr; /* root entry machine address */ + struct page_info *root_page; /* root entry page */ nodeid_t node; struct msi_desc msi; struct acpi_drhd_unit *drhd; diff --git a/xen/drivers/passthrough/vtd/qinval.c b/xen/drivers/passthrough/vtd/qinval.c index 036f3e8505..eb37832363 100644 --- a/xen/drivers/passthrough/vtd/qinval.c +++ b/xen/drivers/passthrough/vtd/qinval.c @@ -18,6 +18,7 @@ */ +#include <xen/domain_page.h> #include <xen/sched.h> #include <xen/iommu.h> #include <xen/time.h> @@ -81,7 +82,7 @@ static struct qinval_entry *qi_map_entry(const struct vtd_iommu *iommu, { paddr_t base = iommu->qinval_maddr + ((index * sizeof(struct qinval_entry)) & PAGE_MASK); - struct qinval_entry *entries = map_vtd_domain_page(base); + struct qinval_entry *entries = map_domain_page(maddr_to_mfn(base)); return &entries[index % (PAGE_SIZE / sizeof(*entries))]; } @@ -111,7 +112,7 @@ static int __must_check queue_invalidate_context_sync(struct vtd_iommu *iommu, qinval_update_qtail(iommu, index); spin_unlock_irqrestore(&iommu->register_lock, flags); - unmap_vtd_domain_page(qinval_entry); + unmap_domain_page(qinval_entry); return invalidate_sync(iommu); } @@ -145,7 +146,7 @@ static int __must_check queue_invalidate_iotlb_sync(struct vtd_iommu *iommu, qinval_update_qtail(iommu, index); spin_unlock_irqrestore(&iommu->register_lock, flags); - unmap_vtd_domain_page(qinval_entry); + unmap_domain_page(qinval_entry); return invalidate_sync(iommu); } @@ -176,7 +177,7 @@ static int __must_check queue_invalidate_wait(struct vtd_iommu *iommu, qinval_update_qtail(iommu, index); spin_unlock_irqrestore(&iommu->register_lock, flags); - unmap_vtd_domain_page(qinval_entry); + unmap_domain_page(qinval_entry); /* Now we don't support interrupt method */ if ( sw ) @@ -277,7 +278,7 @@ int qinval_device_iotlb_sync(struct vtd_iommu *iommu, struct pci_dev *pdev, qinval_update_qtail(iommu, index); spin_unlock_irqrestore(&iommu->register_lock, flags); - unmap_vtd_domain_page(qinval_entry); + unmap_domain_page(qinval_entry); return dev_invalidate_sync(iommu, pdev, did); } @@ -305,7 +306,7 @@ static int __must_check queue_invalidate_iec_sync(struct vtd_iommu *iommu, qinval_update_qtail(iommu, index); spin_unlock_irqrestore(&iommu->register_lock, flags); - unmap_vtd_domain_page(qinval_entry); + unmap_domain_page(qinval_entry); ret = invalidate_sync(iommu); diff --git a/xen/drivers/passthrough/vtd/utils.c b/xen/drivers/passthrough/vtd/utils.c index 7c4d032f4f..5d365ea4e9 100644 --- a/xen/drivers/passthrough/vtd/utils.c +++ b/xen/drivers/passthrough/vtd/utils.c @@ -18,6 +18,7 @@ #include <xen/sched.h> #include <xen/delay.h> +#include <xen/domain_page.h> #include <xen/iommu.h> #include <xen/time.h> #include <xen/pci.h> @@ -99,38 +100,38 @@ void print_vtd_entries(struct vtd_iommu *iommu, int bus, int devfn, u64 gmfn) iommu->index, &PCI_SBDF(iommu->drhd->segment, bus, devfn), gmfn); - if ( iommu->root_maddr == 0 ) + if ( iommu->root_page == NULL ) { - printk(" iommu->root_maddr = 0\n"); + printk(" iommu->root_maddr = NULL\n"); return; } - root_entry = (struct root_entry *)map_vtd_domain_page(iommu->root_maddr); + root_entry = __map_domain_page(iommu->root_page); printk(" root_entry[%02x] = %"PRIx64"\n", bus, root_entry[bus].val); if ( !root_present(root_entry[bus]) ) { - unmap_vtd_domain_page(root_entry); + unmap_domain_page(root_entry); printk(" root_entry[%02x] not present\n", bus); return; } val = root_entry[bus].val; - unmap_vtd_domain_page(root_entry); - ctxt_entry = map_vtd_domain_page(val); + unmap_domain_page(root_entry); + ctxt_entry = map_domain_page(maddr_to_mfn(val)); val = ctxt_entry[devfn].lo; printk(" context[%02x] = %"PRIx64"_%"PRIx64"\n", devfn, ctxt_entry[devfn].hi, val); if ( !context_present(ctxt_entry[devfn]) ) { - unmap_vtd_domain_page(ctxt_entry); + unmap_domain_page(ctxt_entry); printk(" ctxt_entry[%02x] not present\n", devfn); return; } level = agaw_to_level(context_address_width(ctxt_entry[devfn])); - unmap_vtd_domain_page(ctxt_entry); + unmap_domain_page(ctxt_entry); if ( level != VTD_PAGE_TABLE_LEVEL_3 && level != VTD_PAGE_TABLE_LEVEL_4) { @@ -140,10 +141,10 @@ void print_vtd_entries(struct vtd_iommu *iommu, int bus, int devfn, u64 gmfn) do { - l = map_vtd_domain_page(val); + l = map_domain_page(maddr_to_mfn(val)); l_index = get_level_index(gmfn, level); pte.val = l[l_index]; - unmap_vtd_domain_page(l); + unmap_domain_page(l); printk(" l%u[%03x] = %"PRIx64" %c%c\n", level, l_index, pte.val, dma_pte_read(pte) ? 'r' : '-', dma_pte_write(pte) ? 'w' : '-'); @@ -204,7 +205,7 @@ void cf_check vtd_dump_iommu_info(unsigned char key) { /* This entry across page boundry */ if ( iremap_entries ) - unmap_vtd_domain_page(iremap_entries); + unmap_domain_page(iremap_entries); GET_IREMAP_ENTRY(iremap_maddr, i, iremap_entries, p); @@ -232,7 +233,7 @@ void cf_check vtd_dump_iommu_info(unsigned char key) print_cnt++; } if ( iremap_entries ) - unmap_vtd_domain_page(iremap_entries); + unmap_domain_page(iremap_entries); if ( iommu->intremap.num != print_cnt ) printk("Warning: Print %u IRTE (actually have %u)!\n", print_cnt, iommu->intremap.num); diff --git a/xen/drivers/passthrough/vtd/x86/ats.c b/xen/drivers/passthrough/vtd/x86/ats.c index 61052ef580..fed3588e8e 100644 --- a/xen/drivers/passthrough/vtd/x86/ats.c +++ b/xen/drivers/passthrough/vtd/x86/ats.c @@ -16,6 +16,7 @@ * Author: Allen Kay <allen.m.kay@intel.com> */ +#include <xen/domain_page.h> #include <xen/sched.h> #include <xen/iommu.h> #include <xen/time.h> @@ -83,17 +84,17 @@ static bool device_in_domain(const struct vtd_iommu *iommu, unsigned int tt; bool found = false; - if ( unlikely(!iommu->root_maddr) ) + if ( unlikely(!iommu->root_page) ) { ASSERT_UNREACHABLE(); return false; } - root_entry = map_vtd_domain_page(iommu->root_maddr); + root_entry = __map_domain_page(iommu->root_page); if ( !root_present(root_entry[pdev->bus]) ) goto out; - ctxt_entry = map_vtd_domain_page(root_entry[pdev->bus].val); + ctxt_entry = map_domain_page(maddr_to_mfn(root_entry[pdev->bus].val)); if ( context_domain_id(ctxt_entry[pdev->devfn]) != did ) goto out; @@ -104,10 +105,10 @@ static bool device_in_domain(const struct vtd_iommu *iommu, found = true; out: if ( root_entry ) - unmap_vtd_domain_page(root_entry); + unmap_domain_page(root_entry); if ( ctxt_entry ) - unmap_vtd_domain_page(ctxt_entry); + unmap_domain_page(ctxt_entry); return found; } diff --git a/xen/drivers/passthrough/vtd/x86/vtd.c b/xen/drivers/passthrough/vtd/x86/vtd.c index 76f12adc23..b0798dc6a1 100644 --- a/xen/drivers/passthrough/vtd/x86/vtd.c +++ b/xen/drivers/passthrough/vtd/x86/vtd.c @@ -36,13 +36,3 @@ * 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); -} -- 2.51.1 -- Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH v2 1/5] vtd: Drop (un)map_vtd_domain_page wrapper 2025-10-23 9:12 ` [PATCH v2 1/5] vtd: Drop (un)map_vtd_domain_page wrapper Teddy Astie @ 2025-10-23 10:04 ` Jan Beulich 0 siblings, 0 replies; 17+ messages in thread From: Jan Beulich @ 2025-10-23 10:04 UTC (permalink / raw) To: Teddy Astie; +Cc: xen-devel On 23.10.2025 11:12, Teddy Astie wrote: > Replace use of (un)map_vtd_domain_page with its general > equivalents. Also take the opportunity to make iommu->root_page > (previously root_maddr) use struct page_info instead of u64. free_pgtable_maddr() also goes away as it seems. > @@ -244,7 +245,7 @@ static unsigned int alloc_remap_entry(struct vtd_iommu *iommu, unsigned int nr) > { > /* This entry across page boundry */ > if ( iremap_entries ) > - unmap_vtd_domain_page(iremap_entries); > + unmap_domain_page(iremap_entries); Please can you also drop such redundant conditionals then? unmap_domain_page() may validly be called with NULL. Overall it looks as if this patch could do with splitting, as the unmap_vtd_domain_page() replacement is an entirely mechanical one (and accounts for a fair part of the patch). I'm not going to insist, though. > @@ -366,8 +367,8 @@ struct iremap_entry { > */ > #define GET_IREMAP_ENTRY(maddr, index, entries, entry) \ > do { \ > - entries = (struct iremap_entry *)map_vtd_domain_page( \ > - (maddr) + (( (index) >> IREMAP_ENTRY_ORDER ) << PAGE_SHIFT ) ); \ > + entries = (struct iremap_entry *)map_domain_page(maddr_to_mfn( \ > + (maddr) + (( (index) >> IREMAP_ENTRY_ORDER ) << PAGE_SHIFT ) ));\ > entry = &entries[(index) % (1 << IREMAP_ENTRY_ORDER)]; \ > } while(0) You drop casts elsewhere - why not here? Also, as you touch the 2nd of the lines, can you please also drop the excess blanks? And then, while only theoretically at risk of overflowing, the open-coded left shift may also want replacing by e.g. pfn_to_paddr(), i.e. something which incorporates a suitable cast to paddr_t. > --- a/xen/drivers/passthrough/vtd/qinval.c > +++ b/xen/drivers/passthrough/vtd/qinval.c > @@ -18,6 +18,7 @@ > */ > > > +#include <xen/domain_page.h> > #include <xen/sched.h> > #include <xen/iommu.h> > #include <xen/time.h> Please could you take the opportunity and also get rid of one of the two blank lines? > @@ -99,38 +100,38 @@ void print_vtd_entries(struct vtd_iommu *iommu, int bus, int devfn, u64 gmfn) > iommu->index, &PCI_SBDF(iommu->drhd->segment, bus, devfn), > gmfn); > > - if ( iommu->root_maddr == 0 ) > + if ( iommu->root_page == NULL ) > { > - printk(" iommu->root_maddr = 0\n"); > + printk(" iommu->root_maddr = NULL\n"); root_page here then as well? Jan ^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH v2 3/5] vtd: Collapse x86 subdirectory 2025-10-23 9:12 [PATCH v2 0/5] Various IOMMU related simplifications Teddy Astie ` (3 preceding siblings ...) 2025-10-23 9:12 ` [PATCH v2 1/5] vtd: Drop (un)map_vtd_domain_page wrapper Teddy Astie @ 2025-10-23 9:12 ` Teddy Astie 2025-10-23 10:17 ` Jan Beulich 2025-10-23 9:15 ` [PATCH v2 0/5] Various IOMMU related simplifications Teddy Astie 5 siblings, 1 reply; 17+ messages in thread From: Teddy Astie @ 2025-10-23 9:12 UTC (permalink / raw) To: xen-devel; +Cc: Teddy Astie The x86 subdirectory was originally meant to split x86-specific logic from general VT-d code. Today, Xen only supports VT-d on x86 and the code actually implemented in this subdirectory isn't x86-specific (e.g ATS code is not x86 specific). As ats.c is the only remaining file in this directory, and isn't x86 specific, move it up to vtd directory and remove the now empty x86 subdirectory. Signed-off-by: Teddy Astie <teddy.astie@vates.tech> --- v2: - reviewed commit description xen/drivers/passthrough/vtd/Makefile | 3 +-- xen/drivers/passthrough/vtd/{x86 => }/ats.c | 10 +++++----- xen/drivers/passthrough/vtd/x86/Makefile | 1 - 3 files changed, 6 insertions(+), 8 deletions(-) rename xen/drivers/passthrough/vtd/{x86 => }/ats.c (97%) delete mode 100644 xen/drivers/passthrough/vtd/x86/Makefile diff --git a/xen/drivers/passthrough/vtd/Makefile b/xen/drivers/passthrough/vtd/Makefile index fde7555fac..328a014016 100644 --- a/xen/drivers/passthrough/vtd/Makefile +++ b/xen/drivers/passthrough/vtd/Makefile @@ -1,5 +1,4 @@ -obj-$(CONFIG_X86) += x86/ - +obj-y += ats.o obj-y += iommu.o obj-y += dmar.o obj-y += utils.o diff --git a/xen/drivers/passthrough/vtd/x86/ats.c b/xen/drivers/passthrough/vtd/ats.c similarity index 97% rename from xen/drivers/passthrough/vtd/x86/ats.c rename to xen/drivers/passthrough/vtd/ats.c index fed3588e8e..3b7c4028a6 100644 --- a/xen/drivers/passthrough/vtd/x86/ats.c +++ b/xen/drivers/passthrough/vtd/ats.c @@ -23,11 +23,11 @@ #include <xen/pci.h> #include <xen/pci_regs.h> #include <asm/msi.h> -#include "../iommu.h" -#include "../dmar.h" -#include "../vtd.h" -#include "../extern.h" -#include "../../ats.h" +#include "iommu.h" +#include "dmar.h" +#include "vtd.h" +#include "extern.h" +#include "../ats.h" static LIST_HEAD(ats_dev_drhd_units); diff --git a/xen/drivers/passthrough/vtd/x86/Makefile b/xen/drivers/passthrough/vtd/x86/Makefile deleted file mode 100644 index 82b3904a91..0000000000 --- a/xen/drivers/passthrough/vtd/x86/Makefile +++ /dev/null @@ -1 +0,0 @@ -obj-y += ats.o \ No newline at end of file -- 2.51.1 -- Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech ^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH v2 3/5] vtd: Collapse x86 subdirectory 2025-10-23 9:12 ` [PATCH v2 3/5] vtd: Collapse x86 subdirectory Teddy Astie @ 2025-10-23 10:17 ` Jan Beulich 2025-10-23 12:23 ` Teddy Astie 0 siblings, 1 reply; 17+ messages in thread From: Jan Beulich @ 2025-10-23 10:17 UTC (permalink / raw) To: Teddy Astie; +Cc: xen-devel On 23.10.2025 11:12, Teddy Astie wrote: > The x86 subdirectory was originally meant to split x86-specific logic from > general VT-d code. Today, Xen only supports VT-d on x86 and the code actually > implemented in this subdirectory isn't x86-specific (e.g ATS code is not x86 > specific). > > As ats.c is the only remaining file in this directory, and isn't x86 specific, > move it up to vtd directory and remove the now empty x86 subdirectory. > > Signed-off-by: Teddy Astie <teddy.astie@vates.tech> > --- > v2: > - reviewed commit description > > xen/drivers/passthrough/vtd/Makefile | 3 +-- > xen/drivers/passthrough/vtd/{x86 => }/ats.c | 10 +++++----- > xen/drivers/passthrough/vtd/x86/Makefile | 1 - > 3 files changed, 6 insertions(+), 8 deletions(-) > rename xen/drivers/passthrough/vtd/{x86 => }/ats.c (97%) > delete mode 100644 xen/drivers/passthrough/vtd/x86/Makefile I should have remembered this when looking at v1 already: While some of your other changes go farther (and hence are likely preferable), this one I'd rather not see go in. I'd favor respective pieces of what's still pending from https://lists.xen.org/archives/html/xen-devel/2024-02/msg00983.html. First and foremost because ATS really is not only not x86-specific - it's not VT-d- specific either. Jan ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v2 3/5] vtd: Collapse x86 subdirectory 2025-10-23 10:17 ` Jan Beulich @ 2025-10-23 12:23 ` Teddy Astie 2025-10-23 12:26 ` Jan Beulich 0 siblings, 1 reply; 17+ messages in thread From: Teddy Astie @ 2025-10-23 12:23 UTC (permalink / raw) To: Jan Beulich; +Cc: xen-devel, Jason Andryuk Le 23/10/2025 à 12:20, Jan Beulich a écrit : > On 23.10.2025 11:12, Teddy Astie wrote: >> The x86 subdirectory was originally meant to split x86-specific logic from >> general VT-d code. Today, Xen only supports VT-d on x86 and the code actually >> implemented in this subdirectory isn't x86-specific (e.g ATS code is not x86 >> specific). >> >> As ats.c is the only remaining file in this directory, and isn't x86 specific, >> move it up to vtd directory and remove the now empty x86 subdirectory. >> >> Signed-off-by: Teddy Astie <teddy.astie@vates.tech> >> --- >> v2: >> - reviewed commit description >> >> xen/drivers/passthrough/vtd/Makefile | 3 +-- >> xen/drivers/passthrough/vtd/{x86 => }/ats.c | 10 +++++----- >> xen/drivers/passthrough/vtd/x86/Makefile | 1 - >> 3 files changed, 6 insertions(+), 8 deletions(-) >> rename xen/drivers/passthrough/vtd/{x86 => }/ats.c (97%) >> delete mode 100644 xen/drivers/passthrough/vtd/x86/Makefile > > I should have remembered this when looking at v1 already: While some of your > other changes go farther (and hence are likely preferable), this one I'd rather > not see go in. I'd favor respective pieces of what's still pending from > https://lists.xen.org/archives/html/xen-devel/2024-02/msg00983.html. First and > foremost because ATS really is not only not x86-specific - it's not VT-d- > specific either. CC-ing Jason Andryuk now reviewer of AMD-Vi code and likely interested with https://lists.xen.org/archives/html/xen-devel/2024-02/msg00983.html at least for the AMD part. I wasn't aware of this pending series. And some of my patches overlap with some of these ones, so I guess we need to complete it and then I rebase mine on top of it. > > Jan > -- Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v2 3/5] vtd: Collapse x86 subdirectory 2025-10-23 12:23 ` Teddy Astie @ 2025-10-23 12:26 ` Jan Beulich 0 siblings, 0 replies; 17+ messages in thread From: Jan Beulich @ 2025-10-23 12:26 UTC (permalink / raw) To: Teddy Astie; +Cc: xen-devel, Jason Andryuk On 23.10.2025 14:23, Teddy Astie wrote: > Le 23/10/2025 à 12:20, Jan Beulich a écrit : >> On 23.10.2025 11:12, Teddy Astie wrote: >>> The x86 subdirectory was originally meant to split x86-specific logic from >>> general VT-d code. Today, Xen only supports VT-d on x86 and the code actually >>> implemented in this subdirectory isn't x86-specific (e.g ATS code is not x86 >>> specific). >>> >>> As ats.c is the only remaining file in this directory, and isn't x86 specific, >>> move it up to vtd directory and remove the now empty x86 subdirectory. >>> >>> Signed-off-by: Teddy Astie <teddy.astie@vates.tech> >>> --- >>> v2: >>> - reviewed commit description >>> >>> xen/drivers/passthrough/vtd/Makefile | 3 +-- >>> xen/drivers/passthrough/vtd/{x86 => }/ats.c | 10 +++++----- >>> xen/drivers/passthrough/vtd/x86/Makefile | 1 - >>> 3 files changed, 6 insertions(+), 8 deletions(-) >>> rename xen/drivers/passthrough/vtd/{x86 => }/ats.c (97%) >>> delete mode 100644 xen/drivers/passthrough/vtd/x86/Makefile >> >> I should have remembered this when looking at v1 already: While some of your >> other changes go farther (and hence are likely preferable), this one I'd rather >> not see go in. I'd favor respective pieces of what's still pending from >> https://lists.xen.org/archives/html/xen-devel/2024-02/msg00983.html. First and >> foremost because ATS really is not only not x86-specific - it's not VT-d- >> specific either. > > CC-ing Jason Andryuk now reviewer of AMD-Vi code and likely interested > with https://lists.xen.org/archives/html/xen-devel/2024-02/msg00983.html > at least for the AMD part. > > I wasn't aware of this pending series. And some of my patches overlap > with some of these ones, so I guess we need to complete it and then I > rebase mine on top of it. It's going to be an intermix, I think. Your map/unmap changes are preferable to mine, for example. Jan ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v2 0/5] Various IOMMU related simplifications 2025-10-23 9:12 [PATCH v2 0/5] Various IOMMU related simplifications Teddy Astie ` (4 preceding siblings ...) 2025-10-23 9:12 ` [PATCH v2 3/5] vtd: Collapse x86 subdirectory Teddy Astie @ 2025-10-23 9:15 ` Teddy Astie 2025-10-23 14:35 ` Oleksii Kurochko 5 siblings, 1 reply; 17+ messages in thread From: Teddy Astie @ 2025-10-23 9:15 UTC (permalink / raw) To: Teddy Astie, xen-devel Cc: Jan Beulich, Andrew Cooper, Roger Pau Monné, Oleksii Kurochko, Community Manager, Anthony PERARD, Michal Orzel, Julien Grall, Stefano Stabellini Le 23/10/2025 à 11:12, Teddy Astie a écrit : > Various simplifications in the VT-d and IO-APIC code (mostly related to legacy ia64 code). > > No functional change intended. > > Changed in v2 : > - drop (un)map_vtd_domain_page wrapper instead of moving it > - drop deprecated and Intel-exclusive iommu_inclusive_mapping=<boolean> > - description and formatting changes > > Teddy Astie (5): > vtd: Drop (un)map_vtd_domain_page wrapper > vtd: Drop "iommu_inclusive_mapping" command-line option > vtd: Collapse x86 subdirectory > vtd: Remove IO_xAPIC_route_entry macro > x86/ioapic: Don't open-code 32-bits rte reads > > CHANGELOG.md | 2 + > docs/misc/xen-command-line.pandoc | 6 -- > xen/arch/x86/include/asm/io_apic.h | 1 + > xen/arch/x86/io_apic.c | 29 +++---- > xen/drivers/passthrough/vtd/Makefile | 3 +- > xen/drivers/passthrough/vtd/{x86 => }/ats.c | 21 ++--- > xen/drivers/passthrough/vtd/dmar.c | 2 +- > xen/drivers/passthrough/vtd/extern.h | 3 - > xen/drivers/passthrough/vtd/intremap.c | 34 ++++---- > xen/drivers/passthrough/vtd/iommu.c | 88 ++++++++++----------- > xen/drivers/passthrough/vtd/iommu.h | 7 +- > xen/drivers/passthrough/vtd/qinval.c | 13 +-- > xen/drivers/passthrough/vtd/utils.c | 25 +++--- > xen/drivers/passthrough/vtd/vtd.h | 3 - > xen/drivers/passthrough/vtd/x86/Makefile | 2 - > xen/drivers/passthrough/vtd/x86/vtd.c | 48 ----------- > 16 files changed, 108 insertions(+), 179 deletions(-) > rename xen/drivers/passthrough/vtd/{x86 => }/ats.c (92%) > delete mode 100644 xen/drivers/passthrough/vtd/x86/Makefile > delete mode 100644 xen/drivers/passthrough/vtd/x86/vtd.c > I forgot to add the CC-ed people -- Teddy Astie | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH v2 0/5] Various IOMMU related simplifications 2025-10-23 9:15 ` [PATCH v2 0/5] Various IOMMU related simplifications Teddy Astie @ 2025-10-23 14:35 ` Oleksii Kurochko 0 siblings, 0 replies; 17+ messages in thread From: Oleksii Kurochko @ 2025-10-23 14:35 UTC (permalink / raw) To: Teddy Astie, xen-devel Cc: Jan Beulich, Andrew Cooper, Roger Pau Monné, Community Manager, Anthony PERARD, Michal Orzel, Julien Grall, Stefano Stabellini [-- Attachment #1: Type: text/plain, Size: 2223 bytes --] On 10/23/25 11:15 AM, Teddy Astie wrote: > Le 23/10/2025 à 11:12, Teddy Astie a écrit : >> Various simplifications in the VT-d and IO-APIC code (mostly related to legacy ia64 code). I think these changes isn't very critical for the current stage of release, so I suggest to have them in 4.22. Thanks. ~ Oleksii >> >> No functional change intended. >> >> Changed in v2 : >> - drop (un)map_vtd_domain_page wrapper instead of moving it >> - drop deprecated and Intel-exclusive iommu_inclusive_mapping=<boolean> >> - description and formatting changes >> >> Teddy Astie (5): >> vtd: Drop (un)map_vtd_domain_page wrapper >> vtd: Drop "iommu_inclusive_mapping" command-line option >> vtd: Collapse x86 subdirectory >> vtd: Remove IO_xAPIC_route_entry macro >> x86/ioapic: Don't open-code 32-bits rte reads >> >> CHANGELOG.md | 2 + >> docs/misc/xen-command-line.pandoc | 6 -- >> xen/arch/x86/include/asm/io_apic.h | 1 + >> xen/arch/x86/io_apic.c | 29 +++---- >> xen/drivers/passthrough/vtd/Makefile | 3 +- >> xen/drivers/passthrough/vtd/{x86 => }/ats.c | 21 ++--- >> xen/drivers/passthrough/vtd/dmar.c | 2 +- >> xen/drivers/passthrough/vtd/extern.h | 3 - >> xen/drivers/passthrough/vtd/intremap.c | 34 ++++---- >> xen/drivers/passthrough/vtd/iommu.c | 88 ++++++++++----------- >> xen/drivers/passthrough/vtd/iommu.h | 7 +- >> xen/drivers/passthrough/vtd/qinval.c | 13 +-- >> xen/drivers/passthrough/vtd/utils.c | 25 +++--- >> xen/drivers/passthrough/vtd/vtd.h | 3 - >> xen/drivers/passthrough/vtd/x86/Makefile | 2 - >> xen/drivers/passthrough/vtd/x86/vtd.c | 48 ----------- >> 16 files changed, 108 insertions(+), 179 deletions(-) >> rename xen/drivers/passthrough/vtd/{x86 => }/ats.c (92%) >> delete mode 100644 xen/drivers/passthrough/vtd/x86/Makefile >> delete mode 100644 xen/drivers/passthrough/vtd/x86/vtd.c >> > I forgot to add the CC-ed people > > > -- > Teddy Astie | Vates XCP-ng Developer > > XCP-ng & Xen Orchestra - Vates solutions > > web:https://vates.tech > > [-- Attachment #2: Type: text/html, Size: 2905 bytes --] ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2025-11-19 14:26 UTC | newest] Thread overview: 17+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-10-23 9:12 [PATCH v2 0/5] Various IOMMU related simplifications Teddy Astie 2025-10-23 9:12 ` [PATCH v2 2/5] vtd: Drop "iommu_inclusive_mapping" command-line option Teddy Astie 2025-10-23 10:11 ` Jan Beulich 2025-10-23 9:12 ` [PATCH v2 4/5] vtd: Remove IO_xAPIC_route_entry macro Teddy Astie 2025-10-23 9:36 ` Jan Beulich 2025-10-23 9:12 ` [PATCH v2 5/5] x86/ioapic: Don't open-code 32-bits rte reads Teddy Astie 2025-11-19 10:34 ` Andrew Cooper 2025-11-19 11:02 ` [PATCH v2.1 " Teddy Astie 2025-11-19 14:26 ` Jan Beulich 2025-10-23 9:12 ` [PATCH v2 1/5] vtd: Drop (un)map_vtd_domain_page wrapper Teddy Astie 2025-10-23 10:04 ` Jan Beulich 2025-10-23 9:12 ` [PATCH v2 3/5] vtd: Collapse x86 subdirectory Teddy Astie 2025-10-23 10:17 ` Jan Beulich 2025-10-23 12:23 ` Teddy Astie 2025-10-23 12:26 ` Jan Beulich 2025-10-23 9:15 ` [PATCH v2 0/5] Various IOMMU related simplifications Teddy Astie 2025-10-23 14:35 ` Oleksii Kurochko
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.