diff mbox series

[v3] xen/asm-generic: ifdef inclusion of <asm/mem_access.h>

Message ID 371c5dd29fa974ca27db1f720f17fb0ffdd667a0.1699974488.git.oleksii.kurochko@gmail.com (mailing list archive)
State New, archived
Headers show
Series [v3] xen/asm-generic: ifdef inclusion of <asm/mem_access.h> | expand

Commit Message

Oleksii Kurochko Nov. 14, 2023, 3:13 p.m. UTC
ifdefing inclusion of <asm/mem_access.h> in <xen/mem_access.h>
allows to avoid generation of empty <asm/mem_access.h> header
for the case when !CONFIG_MEM_ACCESS.

For Arm it was explicitly added inclusion of <asm/mem_access.h> for p2m.c
and traps.c because they require some functions from <asm/mem_access.h> which
aren't available in case of !CONFIG_MEM_ACCESS.

Suggested-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>

---
This patch was part of patch series:
https://lore.kernel.org/xen-devel/cover.1699633310.git.oleksii.kurochko@gmail.com/

The patch series hasn't been reviewed all yet so send this path
separately.
---
 xen/arch/arm/p2m.c           | 6 ++++++
 xen/arch/arm/traps.c         | 6 ++++++
 xen/include/xen/mem_access.h | 2 ++
 3 files changed, 14 insertions(+)

Comments

Jan Beulich Nov. 14, 2023, 5:19 p.m. UTC | #1
On 14.11.2023 16:13, Oleksii Kurochko wrote:
> ifdefing inclusion of <asm/mem_access.h> in <xen/mem_access.h>
> allows to avoid generation of empty <asm/mem_access.h> header
> for the case when !CONFIG_MEM_ACCESS.
> 
> For Arm it was explicitly added inclusion of <asm/mem_access.h> for p2m.c
> and traps.c because they require some functions from <asm/mem_access.h> which
> aren't available in case of !CONFIG_MEM_ACCESS.
> 
> Suggested-by: Jan Beulich <jbeulich@suse.com>
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
> 
> ---
> This patch was part of patch series:
> https://lore.kernel.org/xen-devel/cover.1699633310.git.oleksii.kurochko@gmail.com/
> 
> The patch series hasn't been reviewed all yet so send this path
> separately.
> ---
>  xen/arch/arm/p2m.c           | 6 ++++++
>  xen/arch/arm/traps.c         | 6 ++++++
>  xen/include/xen/mem_access.h | 2 ++
>  3 files changed, 14 insertions(+)

Also drop PPC's then dead header, please.

> --- a/xen/arch/arm/p2m.c
> +++ b/xen/arch/arm/p2m.c
> @@ -11,6 +11,12 @@
>  #include <asm/event.h>
>  #include <asm/flushtlb.h>
>  #include <asm/guest_walk.h>
> +/*
> + * Inclusion of <asm/mem_acces.h> in <xen/mem_access.h> is #ifdef-ed with
> + * CONFIG_MEM_ACCESS so in case of !CONFIG_MEM_ACCESS will cause a compilation
> + * issue "implicit declaration of functions 'p2m_mem_access*'.
> + */
> +#include <asm/mem_access.h>

Personally I'm against such comments (they simply don't scale), but this
is Arm code, so Arm folks will need to judge.

Jan
Oleksii Kurochko Nov. 15, 2023, 9:11 a.m. UTC | #2
On Tue, 2023-11-14 at 18:19 +0100, Jan Beulich wrote:
> On 14.11.2023 16:13, Oleksii Kurochko wrote:
> > ifdefing inclusion of <asm/mem_access.h> in <xen/mem_access.h>
> > allows to avoid generation of empty <asm/mem_access.h> header
> > for the case when !CONFIG_MEM_ACCESS.
> > 
> > For Arm it was explicitly added inclusion of <asm/mem_access.h> for
> > p2m.c
> > and traps.c because they require some functions from
> > <asm/mem_access.h> which
> > aren't available in case of !CONFIG_MEM_ACCESS.
> > 
> > Suggested-by: Jan Beulich <jbeulich@suse.com>
> > Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
> > 
> > ---
> > This patch was part of patch series:
> > https://lore.kernel.org/xen-devel/cover.1699633310.git.oleksii.kurochko@gmail.com/
> > 
> > The patch series hasn't been reviewed all yet so send this path
> > separately.
> > ---
> >  xen/arch/arm/p2m.c           | 6 ++++++
> >  xen/arch/arm/traps.c         | 6 ++++++
> >  xen/include/xen/mem_access.h | 2 ++
> >  3 files changed, 14 insertions(+)
> 
> Also drop PPC's then dead header, please.
Sure. Missed that. I'll do that.
> 
> > --- a/xen/arch/arm/p2m.c
> > +++ b/xen/arch/arm/p2m.c
> > @@ -11,6 +11,12 @@
> >  #include <asm/event.h>
> >  #include <asm/flushtlb.h>
> >  #include <asm/guest_walk.h>
> > +/*
> > + * Inclusion of <asm/mem_acces.h> in <xen/mem_access.h> is #ifdef-
> > ed with
> > + * CONFIG_MEM_ACCESS so in case of !CONFIG_MEM_ACCESS will cause a
> > compilation
> > + * issue "implicit declaration of functions 'p2m_mem_access*'.
> > + */
> > +#include <asm/mem_access.h>
> 
> Personally I'm against such comments (they simply don't scale), but
> this
> is Arm code, so Arm folks will need to judge.
The comment can be removed. Probably it is enough to have an
explanation in the commit message.


Thanks.

~ Oleksii
diff mbox series

Patch

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index de32a2d638..9050c72acf 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -11,6 +11,12 @@ 
 #include <asm/event.h>
 #include <asm/flushtlb.h>
 #include <asm/guest_walk.h>
+/*
+ * Inclusion of <asm/mem_acces.h> in <xen/mem_access.h> is #ifdef-ed with
+ * CONFIG_MEM_ACCESS so in case of !CONFIG_MEM_ACCESS will cause a compilation
+ * issue "implicit declaration of functions 'p2m_mem_access*'.
+ */
+#include <asm/mem_access.h>
 #include <asm/page.h>
 #include <asm/traps.h>
 
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index ce89f16404..5e39b26272 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -35,6 +35,12 @@ 
 #include <asm/cpufeature.h>
 #include <asm/event.h>
 #include <asm/hsr.h>
+/*
+ * Inclusion of <asm/mem_acces.h> in <xen/mem_access.h> is #ifdef-ed with
+ * CONFIG_MEM_ACCESS so in case of !CONFIG_MEM_ACCESS will cause a compilation
+ * issue "implicit declaration of functions 'p2m_mem_access*.
+ */
+#include <asm/mem_access.h>
 #include <asm/mmio.h>
 #include <asm/regs.h>
 #include <asm/smccc.h>
diff --git a/xen/include/xen/mem_access.h b/xen/include/xen/mem_access.h
index 4e4811680d..87d93b31f6 100644
--- a/xen/include/xen/mem_access.h
+++ b/xen/include/xen/mem_access.h
@@ -33,7 +33,9 @@ 
  */
 struct vm_event_st;
 
+#ifdef CONFIG_MEM_ACCESS
 #include <asm/mem_access.h>
+#endif
 
 /*
  * Additional access types, which are used to further restrict