From: Jan Beulich <jbeulich@suse.com>
To: Teddy Astie <teddy.astie@vates.tech>
Cc: "Stefano Stabellini" <sstabellini@kernel.org>,
"Julien Grall" <julien@xen.org>,
"Bertrand Marquis" <bertrand.marquis@arm.com>,
"Michal Orzel" <michal.orzel@amd.com>,
"Volodymyr Babchuk" <Volodymyr_Babchuk@epam.com>,
"Timothy Pearson" <tpearson@raptorengineering.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Roger Pau Monné" <roger@xenproject.org>,
"Lukasz Hawrylko" <lukasz@hawrylko.pl>,
"Daniel P. Smith" <dpsmith@apertussolutions.com>,
"Mateusz Mówka" <mateusz.mowka@intel.com>,
"Jason Andryuk" <jason.andryuk@amd.com>,
xen-devel@lists.xenproject.org
Subject: Re: [RFC PATCH v7 04/14] iommu: Move IOMMU domain related structures to (arch_)iommu_context
Date: Wed, 19 Aug 2026 17:15:20 +0200 [thread overview]
Message-ID: <f7d5cd81-ecf3-4075-9355-34c03cdbc644@suse.com> (raw)
In-Reply-To: <af6217ef3ce355cc873fd7aca128fb12feea3e55.1763569135.git.teddy.astie@vates.tech>
On 20.11.2025 12:09, Teddy Astie wrote:
> Preparatory work for IOMMU redesign.
>
> Introduce a new structure (arch_)iommu_context that will hold all
> per-IOMMU context related informations for the IOMMU drivers.
>
> Signed-off-by Teddy Astie <teddy.astie@vates.tech>
It's hard to see what feedback you're expecting here. For an RFC, I'm not
going to point out all the style issues. One remark, perhaps:
> --- a/xen/arch/arm/include/asm/iommu.h
> --- a/xen/arch/x86/include/asm/iommu.h
> +++ b/xen/arch/x86/include/asm/iommu.h
> @@ -31,22 +31,21 @@ typedef uint64_t daddr_t;
> #define dfn_to_daddr(dfn) __dfn_to_daddr(dfn_x(dfn))
> #define daddr_to_dfn(daddr) _dfn(__daddr_to_dfn(daddr))
>
> -struct arch_iommu
> -{
> - spinlock_t mapping_lock; /* io page table lock */
> - struct {
> - struct page_list_head list;
> - spinlock_t lock;
> - } pgtables;
> +struct iommu_context;
>
> +struct arch_iommu_context
> +{
> + struct page_list_head pgtables;
> struct list_head identity_maps;
>
> +
> + spinlock_t mapping_lock; /* io page table lock */
> +
> union {
> /* Intel VT-d */
> struct {
> uint64_t pgd_maddr; /* io page directory machine address */
> - unsigned int agaw; /* adjusted guest address width, 0 is level 2 30-bit */
> - unsigned long *iommu_bitmap; /* bitmap of iommu(s) that the domain uses */
> + unsigned long *iommu_bitmap; /* bitmap of iommu(s) that the context uses */
> } vtd;
> /* AMD IOMMU */
> struct {
> @@ -56,6 +55,24 @@ struct arch_iommu
> };
> };
>
> +struct arch_iommu
> +{
> + /* Queue for freeing pages */
> + struct page_list_head free_queue;
> +
> + union {
> + /* Intel VT-d */
> + struct {
> + unsigned int agaw; /* adjusted guest address width, 0 is level 2 30-bit */
> + } vtd;
> + /* AMD IOMMU */
> + struct {
> + unsigned int paging_mode;
> + struct guest_iommu *g_iommu;
> + };
> + };
> +};
> +
> extern struct iommu_ops iommu_ops;
>
> # include <asm/alternative.h>
> @@ -109,10 +126,10 @@ static inline void iommu_disable_x2apic(void)
> iommu_vcall(&iommu_ops, disable_x2apic);
> }
>
> -int iommu_identity_mapping(struct domain *d, p2m_access_t p2ma,
> - paddr_t base, paddr_t end,
> +int iommu_identity_mapping(struct domain *d, struct iommu_context *ctx,
> + p2m_access_t p2ma, paddr_t base, paddr_t end,
> unsigned int flag);
> -void iommu_identity_map_teardown(struct domain *d);
> +void iommu_identity_map_teardown(struct domain *d, struct iommu_context *ctx);
At the example of these: I think it shouldn't be necessary to pass both a
context and a domain into a function. The context likely should have a
back-pointer to the domain.
Jan
next prev parent reply other threads:[~2026-08-19 15:15 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-20 11:09 [RFC PATCH v7 00/14] IOMMU subsystem redesign and PV-IOMMU interface Teddy Astie
2025-11-20 11:09 ` [RFC PATCH v7 01/14] docs/designs: Add a design document for IOMMU subsystem redesign Teddy Astie
2025-11-20 11:09 ` [RFC PATCH v7 02/14] docs/designs: Add a design document for PV-IOMMU Teddy Astie
2025-11-20 11:09 ` [RFC PATCH v7 03/14] x86/domain: Defer domain iommu initialization Teddy Astie
2026-08-19 15:08 ` Jan Beulich
2026-08-20 10:10 ` Teddy Astie
2025-11-20 11:09 ` [RFC PATCH v7 04/14] iommu: Move IOMMU domain related structures to (arch_)iommu_context Teddy Astie
2026-08-19 15:15 ` Jan Beulich [this message]
2025-11-20 11:09 ` [RFC PATCH v7 05/14] iommu: Simplify quarantine logic Teddy Astie
2026-08-19 15:21 ` Jan Beulich
2025-11-20 11:09 ` [RFC PATCH v7 06/14] vtd: Remove MAP_ERROR_RECOVERY code path in domain_context_mapping_one Teddy Astie
2026-08-19 15:26 ` Jan Beulich
2025-11-20 11:09 ` [RFC PATCH v7 07/14] iommu: Simplify hardware did management Teddy Astie
2025-11-20 11:10 ` [RFC PATCH v7 08/14] iommu: Introduce redesigned IOMMU subsystem Teddy Astie
2025-11-20 11:10 ` [RFC PATCH v7 09/14] iommu: Provide 'X' debug key to dump IOMMU context infos Teddy Astie
2025-11-20 11:10 ` [RFC PATCH v7 10/14] amd/iommu: Introduce lookup implementation Teddy Astie
2025-11-20 11:10 ` [RFC PATCH v7 11/14] iommu: Introduce iommu_get_max_iova Teddy Astie
2025-11-20 11:10 ` [RFC PATCH v7 12/14] x86/iommu: Introduce IOMMU arena Teddy Astie
2025-11-20 11:10 ` [RFC PATCH v7 13/14] iommu: Introduce PV-IOMMU Teddy Astie
2025-11-20 11:10 ` [RFC PATCH v7 14/14] iommu: Introduce no-dma feature Teddy Astie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f7d5cd81-ecf3-4075-9355-34c03cdbc644@suse.com \
--to=jbeulich@suse.com \
--cc=Volodymyr_Babchuk@epam.com \
--cc=andrew.cooper3@citrix.com \
--cc=bertrand.marquis@arm.com \
--cc=dpsmith@apertussolutions.com \
--cc=jason.andryuk@amd.com \
--cc=julien@xen.org \
--cc=lukasz@hawrylko.pl \
--cc=mateusz.mowka@intel.com \
--cc=michal.orzel@amd.com \
--cc=roger@xenproject.org \
--cc=sstabellini@kernel.org \
--cc=teddy.astie@vates.tech \
--cc=tpearson@raptorengineering.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.