diff mbox series

[v5,6/7] xen/asm-generic: ifdef inclusion of <asm/mem_access.h>

Message ID d42a34866edc70a12736b5c6976aa1b44b4ebd8a.1701453087.git.oleksii.kurochko@gmail.com (mailing list archive)
State Superseded
Headers show
Series Introduce generic headers | expand

Commit Message

Oleksii Kurochko Dec. 1, 2023, 8:48 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>
---
Changes in V5:
 - Added dependencies for "Config MEM_ACCESS" to be sure that randconfig will not
   turn on the config.
---
Changes in V4:
 - Nothing changed. Only rebase.
---
Changes in V3:
 - Remove unnecessary comment.
---
 xen/arch/arm/p2m.c                    | 1 +
 xen/arch/arm/traps.c                  | 1 +
 xen/arch/ppc/include/asm/mem_access.h | 5 -----
 xen/common/Kconfig                    | 2 +-
 xen/include/xen/mem_access.h          | 2 ++
 5 files changed, 5 insertions(+), 6 deletions(-)
 delete mode 100644 xen/arch/ppc/include/asm/mem_access.h

Comments

Jan Beulich Dec. 4, 2023, 8:46 a.m. UTC | #1
On 01.12.2023 21:48, Oleksii Kurochko wrote:
> --- a/xen/common/Kconfig
> +++ b/xen/common/Kconfig
> @@ -87,7 +87,7 @@ config MEM_ACCESS_ALWAYS_ON
>  config MEM_ACCESS
>  	def_bool MEM_ACCESS_ALWAYS_ON
>  	prompt "Memory Access and VM events" if !MEM_ACCESS_ALWAYS_ON
> -	depends on HVM
> +	depends on HVM && (ARM || X86)

While - unlike for GRANT_TABLE - I view going this route as an option, I
still think it wants doing without explicitly naming architectures here.
There wants to be a HAS_MEM_ACCESS, selected by Arm's Kconfig and by
MEM_ACCESS_ALWAYS_ON (which in turn x86 selects). This could then also
replace the HVM dependency here - x86 ought to select MEM_ACCESS_ALWAYS_ON
only when HVM is enabled.

Jan
Oleksii Kurochko Dec. 4, 2023, 9:36 a.m. UTC | #2
On Mon, 2023-12-04 at 09:46 +0100, Jan Beulich wrote:
> On 01.12.2023 21:48, Oleksii Kurochko wrote:
> > --- a/xen/common/Kconfig
> > +++ b/xen/common/Kconfig
> > @@ -87,7 +87,7 @@ config MEM_ACCESS_ALWAYS_ON
> >  config MEM_ACCESS
> >  	def_bool MEM_ACCESS_ALWAYS_ON
> >  	prompt "Memory Access and VM events" if
> > !MEM_ACCESS_ALWAYS_ON
> > -	depends on HVM
> > +	depends on HVM && (ARM || X86)
> 
> While - unlike for GRANT_TABLE - I view going this route as an
> option, I
> still think it wants doing without explicitly naming architectures
> here.
> There wants to be a HAS_MEM_ACCESS, selected by Arm's Kconfig and by
> MEM_ACCESS_ALWAYS_ON (which in turn x86 selects). This could then
> also
> replace the HVM dependency here - x86 ought to select
> MEM_ACCESS_ALWAYS_ON
> only when HVM is enabled.
Thanks.

It will be definetely better to introduce HAS_MEM_ACCESS.


~ Oleksii
diff mbox series

Patch

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index b991b76ce4..2465c266e9 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -7,6 +7,7 @@ 
 #include <asm/event.h>
 #include <asm/flushtlb.h>
 #include <asm/guest_walk.h>
+#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 3784e8276e..37a457f4b1 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -35,6 +35,7 @@ 
 #include <asm/cpufeature.h>
 #include <asm/event.h>
 #include <asm/hsr.h>
+#include <asm/mem_access.h>
 #include <asm/mmio.h>
 #include <asm/regs.h>
 #include <asm/smccc.h>
diff --git a/xen/arch/ppc/include/asm/mem_access.h b/xen/arch/ppc/include/asm/mem_access.h
deleted file mode 100644
index e7986dfdbd..0000000000
--- a/xen/arch/ppc/include/asm/mem_access.h
+++ /dev/null
@@ -1,5 +0,0 @@ 
-/* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __ASM_PPC_MEM_ACCESS_H__
-#define __ASM_PPC_MEM_ACCESS_H__
-
-#endif /* __ASM_PPC_MEM_ACCESS_H__ */
diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 13e26ca06f..d84e395a0b 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -87,7 +87,7 @@  config MEM_ACCESS_ALWAYS_ON
 config MEM_ACCESS
 	def_bool MEM_ACCESS_ALWAYS_ON
 	prompt "Memory Access and VM events" if !MEM_ACCESS_ALWAYS_ON
-	depends on HVM
+	depends on HVM && (ARM || X86)
 	---help---
 
 	  Framework to configure memory access types for guests and receive
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