All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Teddy Astie <teddy.astie@vates.tech>
Cc: xen-devel@lists.xenproject.org, Jan Beulich <jbeulich@suse.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>
Subject: Re: [XEN PATCH] x86/iommu: Conditionally compile platform-specific union entries
Date: Thu, 23 May 2024 11:52:45 +0200	[thread overview]
Message-ID: <Zk8R7YAhD9UHtVW6@macbook> (raw)
In-Reply-To: <2744240f42dadcb1edc69d0f921d5909fe0f63a2.1716455673.git.teddy.astie@vates.tech>

On Thu, May 23, 2024 at 09:19:53AM +0000, Teddy Astie wrote:
> If some platform driver isn't compiled in, remove its related union
> entries as they are not used.
> 
> Signed-off-by Teddy Astie <teddy.astie@vates.tech>
> ---
>  xen/arch/x86/include/asm/iommu.h | 4 ++++
>  xen/arch/x86/include/asm/pci.h   | 4 ++++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/xen/arch/x86/include/asm/iommu.h b/xen/arch/x86/include/asm/iommu.h
> index 8dc464fbd3..99180940c4 100644
> --- a/xen/arch/x86/include/asm/iommu.h
> +++ b/xen/arch/x86/include/asm/iommu.h
> @@ -42,17 +42,21 @@ struct arch_iommu
>      struct list_head identity_maps;
>  
>      union {
> +        #ifdef CONFIG_INTEL_IOMMU
>          /* 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 */
>          } vtd;
> +        #endif
> +        #ifdef CONFIG_AMD_IOMMU
>          /* AMD IOMMU */
>          struct {
>              unsigned int paging_mode;
>              struct page_info *root_table;
>          } amd;
> +        #endif
>      };
>  };
>  
> diff --git a/xen/arch/x86/include/asm/pci.h b/xen/arch/x86/include/asm/pci.h
> index fd5480d67d..842710f0dc 100644
> --- a/xen/arch/x86/include/asm/pci.h
> +++ b/xen/arch/x86/include/asm/pci.h
> @@ -22,12 +22,16 @@ struct arch_pci_dev {
>       */
>      union {
>          /* Subset of struct arch_iommu's fields, to be used in dom_io. */
> +        #ifdef CONFIG_INTEL_IOMMU
>          struct {
>              uint64_t pgd_maddr;
>          } vtd;
> +        #endif
> +        #ifdef CONFIG_AMD_IOMMU
>          struct {
>              struct page_info *root_table;
>          } amd;
> +        #endif
>      };

The #ifdef and #endif processor directives shouldn't be indented.

Would you mind adding /* CONFIG_{AMD,INTEL}_IOMMU */ comments in the
#endif directives?

I wonder if we could move the definitions of those structures to the
vendor specific headers, but that's more convoluted, and would require
including the iommu headers in pci.h

Thanks, Roger.


  reply	other threads:[~2024-05-23  9:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-23  9:19 [XEN PATCH] x86/iommu: Conditionally compile platform-specific union entries Teddy Astie
2024-05-23  9:52 ` Roger Pau Monné [this message]
2024-05-23 12:05   ` 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=Zk8R7YAhD9UHtVW6@macbook \
    --to=roger.pau@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=teddy.astie@vates.tech \
    --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.