diff mbox series

[v4,06/30] xen: avoid generation of empty asm/iommu.h

Message ID a94aba19d32bbe8d2fa78d6d8931f9f0ca51160a.1707146506.git.oleksii.kurochko@gmail.com (mailing list archive)
State Superseded
Headers show
Series Enable build of full Xen for RISC-V | expand

Commit Message

Oleksii Kurochko Feb. 5, 2024, 3:32 p.m. UTC
asm/iommu.h shouldn't be included when CONFIG_HAS_PASSTHROUGH
isn't enabled.
As <asm/iommu.h> is ifdef-ed by CONFIG_HAS_PASSTHROUGH it should
be also ifdef-ed field "struct arch_iommu arch" in struct domain_iommu
as definition of arch_iommu is located in <asm/iommu.h>.

These amount of changes are enough to avoid generation of empty
asm/iommu.h for now.

Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
Changes in V4:
 - Update the commit message.
---
Changes in V3:
 - new patch.
---
 xen/include/xen/iommu.h | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Jan Beulich Feb. 12, 2024, 3:10 p.m. UTC | #1
On 05.02.2024 16:32, Oleksii Kurochko wrote:
> asm/iommu.h shouldn't

... need to ...

> be included when CONFIG_HAS_PASSTHROUGH
> isn't enabled.
> As <asm/iommu.h> is ifdef-ed by CONFIG_HAS_PASSTHROUGH it should
> be also ifdef-ed field "struct arch_iommu arch" in struct domain_iommu
> as definition of arch_iommu is located in <asm/iommu.h>.
> 
> These amount of changes are enough to avoid generation of empty
> asm/iommu.h for now.

I'm also inclined to insert "just" here, to make more obvious why e.g.
...

> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
> ---
> Changes in V4:
>  - Update the commit message.
> ---
> Changes in V3:
>  - new patch.
> ---
>  xen/include/xen/iommu.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
> index a21f25df9f..7aa6a77209 100644
> --- a/xen/include/xen/iommu.h
> +++ b/xen/include/xen/iommu.h
> @@ -337,7 +337,9 @@ extern int iommu_add_extra_reserved_device_memory(unsigned long start,
>  extern int iommu_get_extra_reserved_device_memory(iommu_grdm_t *func,
>                                                    void *ctxt);
>  
> +#ifdef CONFIG_HAS_PASSTHROUGH
>  #include <asm/iommu.h>
> +#endif
>  
>  #ifndef iommu_call
>  # define iommu_call(ops, fn, args...) ((ops)->fn(args))
> @@ -345,7 +347,9 @@ extern int iommu_get_extra_reserved_device_memory(iommu_grdm_t *func,
>  #endif
>  
>  struct domain_iommu {
> +#ifdef CONFIG_HAS_PASSTHROUGH
>      struct arch_iommu arch;
> +#endif
>  
>      /* iommu_ops */
>      const struct iommu_ops *platform_ops;

... this is left visible despite quite likely being meaningless without
HAS_PASSTHROUGH.

Then (happy to make the small edits while committing):
Acked-by: Jan Beulich <jbeulich@suse.com>

Jan
Oleksii Kurochko Feb. 14, 2024, 10:05 a.m. UTC | #2
On Mon, 2024-02-12 at 16:10 +0100, Jan Beulich wrote:
> On 05.02.2024 16:32, Oleksii Kurochko wrote:
> > asm/iommu.h shouldn't
> 
> ... need to ...
> 
> > be included when CONFIG_HAS_PASSTHROUGH
> > isn't enabled.
> > As <asm/iommu.h> is ifdef-ed by CONFIG_HAS_PASSTHROUGH it should
> > be also ifdef-ed field "struct arch_iommu arch" in struct
> > domain_iommu
> > as definition of arch_iommu is located in <asm/iommu.h>.
> > 
> > These amount of changes are enough to avoid generation of empty
> > asm/iommu.h for now.
> 
> I'm also inclined to insert "just" here, to make more obvious why
> e.g.
> ...
> 
> > Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
> > ---
> > Changes in V4:
> >  - Update the commit message.
> > ---
> > Changes in V3:
> >  - new patch.
> > ---
> >  xen/include/xen/iommu.h | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
> > index a21f25df9f..7aa6a77209 100644
> > --- a/xen/include/xen/iommu.h
> > +++ b/xen/include/xen/iommu.h
> > @@ -337,7 +337,9 @@ extern int
> > iommu_add_extra_reserved_device_memory(unsigned long start,
> >  extern int iommu_get_extra_reserved_device_memory(iommu_grdm_t
> > *func,
> >                                                    void *ctxt);
> >  
> > +#ifdef CONFIG_HAS_PASSTHROUGH
> >  #include <asm/iommu.h>
> > +#endif
> >  
> >  #ifndef iommu_call
> >  # define iommu_call(ops, fn, args...) ((ops)->fn(args))
> > @@ -345,7 +347,9 @@ extern int
> > iommu_get_extra_reserved_device_memory(iommu_grdm_t *func,
> >  #endif
> >  
> >  struct domain_iommu {
> > +#ifdef CONFIG_HAS_PASSTHROUGH
> >      struct arch_iommu arch;
> > +#endif
> >  
> >      /* iommu_ops */
> >      const struct iommu_ops *platform_ops;
> 
> ... this is left visible despite quite likely being meaningless
> without
> HAS_PASSTHROUGH.
> 
> Then (happy to make the small edits while committing):
I'll be happy with that. Thanks.

> Acked-by: Jan Beulich <jbeulich@suse.com>
Thanks for Ack.

~ Oleksii
diff mbox series

Patch

diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index a21f25df9f..7aa6a77209 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -337,7 +337,9 @@  extern int iommu_add_extra_reserved_device_memory(unsigned long start,
 extern int iommu_get_extra_reserved_device_memory(iommu_grdm_t *func,
                                                   void *ctxt);
 
+#ifdef CONFIG_HAS_PASSTHROUGH
 #include <asm/iommu.h>
+#endif
 
 #ifndef iommu_call
 # define iommu_call(ops, fn, args...) ((ops)->fn(args))
@@ -345,7 +347,9 @@  extern int iommu_get_extra_reserved_device_memory(iommu_grdm_t *func,
 #endif
 
 struct domain_iommu {
+#ifdef CONFIG_HAS_PASSTHROUGH
     struct arch_iommu arch;
+#endif
 
     /* iommu_ops */
     const struct iommu_ops *platform_ops;