diff mbox series

[XEN,v2,1/3] vm_event: rework inclusions to use arch-indipendent header

Message ID 6ef8207eee081e2c9a3914a14025077fc72b19e6.1692275359.git.nicola.vetrini@bugseng.com (mailing list archive)
State New, archived
Headers show
Series xen: fix inclusions and static storage duration | expand

Commit Message

Nicola Vetrini Aug. 17, 2023, 12:39 p.m. UTC
The arch-specific header <asm/vm_event.h> should be included by the
common header <xen/vm_event.h>, so that the latter can be included
in the source files.

This also resolves violations of MISRA C:2012 Rule 8.4 that were
caused by declarations for
'vm_event_{fill_regs,set_registers,monitor_next_interrupt}'
in <asm/vm_event.h> not being visible when
defining functions in 'xen/arch/x86/vm_event.c'

Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
---
Changes in v2:
- Include the arch-specific header in the common one, and only include
  the latter in source files.

The following functions have been mainly touched by the following commits,
but the present commit does not solve a problem introduced by one of them per se, except perhaps the first one mentioned, which is why I didn't put a Fixes tag in this v2:
- 975efd3baa8d ("introduce VM_EVENT_FLAG_SET_REGISTERS")
- adc75eba8b15 ("x86/vm_event: consolidate hvm_event_fill_regs and p2m_vm_event_fill_regs")
- 9864841914c2 ("x86/vm_event: add support for VM_EVENT_REASON_INTERRUPT")
---
 xen/arch/arm/include/asm/vm_event.h | 1 -
 xen/arch/arm/vm_event.c             | 2 +-
 xen/arch/x86/vm_event.c             | 2 +-
 xen/include/xen/vm_event.h          | 1 +
 4 files changed, 3 insertions(+), 3 deletions(-)

Comments

Stefano Stabellini Aug. 17, 2023, 6 p.m. UTC | #1
On Thu, 17 Aug 2023, Nicola Vetrini wrote:
> The arch-specific header <asm/vm_event.h> should be included by the
> common header <xen/vm_event.h>, so that the latter can be included
> in the source files.
> 
> This also resolves violations of MISRA C:2012 Rule 8.4 that were
> caused by declarations for
> 'vm_event_{fill_regs,set_registers,monitor_next_interrupt}'
> in <asm/vm_event.h> not being visible when
> defining functions in 'xen/arch/x86/vm_event.c'
> 
> Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
> Changes in v2:
> - Include the arch-specific header in the common one, and only include
>   the latter in source files.
> 
> The following functions have been mainly touched by the following commits,
> but the present commit does not solve a problem introduced by one of them per se, except perhaps the first one mentioned, which is why I didn't put a Fixes tag in this v2:
> - 975efd3baa8d ("introduce VM_EVENT_FLAG_SET_REGISTERS")
> - adc75eba8b15 ("x86/vm_event: consolidate hvm_event_fill_regs and p2m_vm_event_fill_regs")
> - 9864841914c2 ("x86/vm_event: add support for VM_EVENT_REASON_INTERRUPT")
> ---
>  xen/arch/arm/include/asm/vm_event.h | 1 -
>  xen/arch/arm/vm_event.c             | 2 +-
>  xen/arch/x86/vm_event.c             | 2 +-
>  xen/include/xen/vm_event.h          | 1 +
>  4 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/xen/arch/arm/include/asm/vm_event.h b/xen/arch/arm/include/asm/vm_event.h
> index abe7db1970ca..4d861373b38d 100644
> --- a/xen/arch/arm/include/asm/vm_event.h
> +++ b/xen/arch/arm/include/asm/vm_event.h
> @@ -20,7 +20,6 @@
>  #define __ASM_ARM_VM_EVENT_H__
>  
>  #include <xen/sched.h>
> -#include <xen/vm_event.h>
>  #include <public/domctl.h>
>  
>  static inline int vm_event_init_domain(struct domain *d)
> diff --git a/xen/arch/arm/vm_event.c b/xen/arch/arm/vm_event.c
> index ba99f56eb20c..ccfd25bbbca9 100644
> --- a/xen/arch/arm/vm_event.c
> +++ b/xen/arch/arm/vm_event.c
> @@ -8,7 +8,7 @@
>   */
>  
>  #include <xen/sched.h>
> -#include <asm/vm_event.h>
> +#include <xen/vm_event.h>
>  
>  void vm_event_fill_regs(vm_event_request_t *req)
>  {
> diff --git a/xen/arch/x86/vm_event.c b/xen/arch/x86/vm_event.c
> index 7027c08a926b..e6c7ad5337dd 100644
> --- a/xen/arch/x86/vm_event.c
> +++ b/xen/arch/x86/vm_event.c
> @@ -20,7 +20,7 @@
>  
>  #include <xen/sched.h>
>  #include <xen/mem_access.h>
> -#include <asm/vm_event.h>
> +#include <xen/vm_event.h>
>  
>  /* Implicitly serialized by the domctl lock. */
>  int vm_event_init_domain(struct domain *d)
> diff --git a/xen/include/xen/vm_event.h b/xen/include/xen/vm_event.h
> index 92811d9110e5..9a86358b42ae 100644
> --- a/xen/include/xen/vm_event.h
> +++ b/xen/include/xen/vm_event.h
> @@ -25,6 +25,7 @@
>  
>  #include <xen/sched.h>
>  #include <public/vm_event.h>
> +#include <asm/vm_event.h>
>  
>  struct vm_event_domain
>  {
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/xen/arch/arm/include/asm/vm_event.h b/xen/arch/arm/include/asm/vm_event.h
index abe7db1970ca..4d861373b38d 100644
--- a/xen/arch/arm/include/asm/vm_event.h
+++ b/xen/arch/arm/include/asm/vm_event.h
@@ -20,7 +20,6 @@ 
 #define __ASM_ARM_VM_EVENT_H__
 
 #include <xen/sched.h>
-#include <xen/vm_event.h>
 #include <public/domctl.h>
 
 static inline int vm_event_init_domain(struct domain *d)
diff --git a/xen/arch/arm/vm_event.c b/xen/arch/arm/vm_event.c
index ba99f56eb20c..ccfd25bbbca9 100644
--- a/xen/arch/arm/vm_event.c
+++ b/xen/arch/arm/vm_event.c
@@ -8,7 +8,7 @@ 
  */
 
 #include <xen/sched.h>
-#include <asm/vm_event.h>
+#include <xen/vm_event.h>
 
 void vm_event_fill_regs(vm_event_request_t *req)
 {
diff --git a/xen/arch/x86/vm_event.c b/xen/arch/x86/vm_event.c
index 7027c08a926b..e6c7ad5337dd 100644
--- a/xen/arch/x86/vm_event.c
+++ b/xen/arch/x86/vm_event.c
@@ -20,7 +20,7 @@ 
 
 #include <xen/sched.h>
 #include <xen/mem_access.h>
-#include <asm/vm_event.h>
+#include <xen/vm_event.h>
 
 /* Implicitly serialized by the domctl lock. */
 int vm_event_init_domain(struct domain *d)
diff --git a/xen/include/xen/vm_event.h b/xen/include/xen/vm_event.h
index 92811d9110e5..9a86358b42ae 100644
--- a/xen/include/xen/vm_event.h
+++ b/xen/include/xen/vm_event.h
@@ -25,6 +25,7 @@ 
 
 #include <xen/sched.h>
 #include <public/vm_event.h>
+#include <asm/vm_event.h>
 
 struct vm_event_domain
 {