[PATCH v1 5/7] xen/x86: move declaration from mem_access.h to altp2m.h

Penny Zheng posted 7 patches 5 days, 22 hours ago
Only 5 patches received!
[PATCH v1 5/7] xen/x86: move declaration from mem_access.h to altp2m.h
Posted by Penny Zheng 5 days, 22 hours ago
Memory access and ALTP2M are two seperate features, and each could be
controlled via VM_EVENT or ALTP2M. In order to avoid implicit declaration
when ALTP2M=y and VM_EVENT=n on compiling hvm.o/altp2m.o, we move declaration
of the following functions from <asm/mem_access.h> to <asm/altp2m.h>:
- p2m_set_suppress_ve
- p2m_set_suppress_ve_multi
- p2m_get_suppress_ve
Potential error on altp2m.c also breaks Misra Rule 8.4.

Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
---
v3 -> v4:
- new commit
---
 xen/arch/x86/include/asm/altp2m.h     | 10 ++++++++++
 xen/arch/x86/include/asm/mem_access.h | 10 ----------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/include/asm/altp2m.h b/xen/arch/x86/include/asm/altp2m.h
index 8ecd74f363..9c1ac3cc26 100644
--- a/xen/arch/x86/include/asm/altp2m.h
+++ b/xen/arch/x86/include/asm/altp2m.h
@@ -46,6 +46,16 @@ void altp2m_vcpu_destroy(struct vcpu *v);
 int altp2m_vcpu_enable_ve(struct vcpu *v, gfn_t gfn);
 void altp2m_vcpu_disable_ve(struct vcpu *v);
 
+int p2m_set_suppress_ve(struct domain *d, gfn_t gfn, bool suppress_ve,
+                        unsigned int altp2m_idx);
+
+struct xen_hvm_altp2m_suppress_ve_multi;
+int p2m_set_suppress_ve_multi(struct domain *d,
+                              struct xen_hvm_altp2m_suppress_ve_multi *sve);
+
+int p2m_get_suppress_ve(struct domain *d, gfn_t gfn, bool *suppress_ve,
+                        unsigned int altp2m_idx);
+
 #else
 
 static inline bool altp2m_is_eptp_valid(const struct domain *d,
diff --git a/xen/arch/x86/include/asm/mem_access.h b/xen/arch/x86/include/asm/mem_access.h
index 1a52a10322..257ed33de1 100644
--- a/xen/arch/x86/include/asm/mem_access.h
+++ b/xen/arch/x86/include/asm/mem_access.h
@@ -34,16 +34,6 @@ bool p2m_mem_access_emulate_check(struct vcpu *v,
 /* Sanity check for mem_access hardware support */
 bool p2m_mem_access_sanity_check(const struct domain *d);
 
-int p2m_set_suppress_ve(struct domain *d, gfn_t gfn, bool suppress_ve,
-                        unsigned int altp2m_idx);
-
-struct xen_hvm_altp2m_suppress_ve_multi;
-int p2m_set_suppress_ve_multi(struct domain *d,
-                              struct xen_hvm_altp2m_suppress_ve_multi *sve);
-
-int p2m_get_suppress_ve(struct domain *d, gfn_t gfn, bool *suppress_ve,
-                        unsigned int altp2m_idx);
-
 #endif /*__ASM_X86_MEM_ACCESS_H__ */
 
 /*
-- 
2.34.1
Re: [PATCH v1 5/7] xen/x86: move declaration from mem_access.h to altp2m.h
Posted by Jan Beulich 5 days, 16 hours ago
On 13.11.2025 04:16, Penny Zheng wrote:
> Memory access and ALTP2M are two seperate features, and each could be
> controlled via VM_EVENT or ALTP2M. In order to avoid implicit declaration
> when ALTP2M=y and VM_EVENT=n on compiling hvm.o/altp2m.o, we move declaration
> of the following functions from <asm/mem_access.h> to <asm/altp2m.h>:
> - p2m_set_suppress_ve
> - p2m_set_suppress_ve_multi
> - p2m_get_suppress_ve
> Potential error on altp2m.c also breaks Misra Rule 8.4.
> 
> Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>

This looks to be independent of all earlier changes, and hence could go in ahead
of any of them?

Jan
RE: [PATCH v1 5/7] xen/x86: move declaration from mem_access.h to altp2m.h
Posted by Penny, Zheng 14 hours ago
[Public]

> -----Original Message-----
> From: Jan Beulich <jbeulich@suse.com>
> Sent: Thursday, November 13, 2025 5:35 PM
> To: Penny, Zheng <penny.zheng@amd.com>
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>; Roger Pau Monné
> <roger.pau@citrix.com>; Tamas K Lengyel <tamas@tklengyel.com>; Alexandru
> Isaila <aisaila@bitdefender.com>; Petre Pircalabu <ppircalabu@bitdefender.com>;
> xen-devel@lists.xenproject.org
> Subject: Re: [PATCH v1 5/7] xen/x86: move declaration from mem_access.h to
> altp2m.h
>
> On 13.11.2025 04:16, Penny Zheng wrote:
> > Memory access and ALTP2M are two seperate features, and each could be
> > controlled via VM_EVENT or ALTP2M. In order to avoid implicit
> > declaration when ALTP2M=y and VM_EVENT=n on compiling hvm.o/altp2m.o,
> > we move declaration of the following functions from <asm/mem_access.h> to
> <asm/altp2m.h>:
> > - p2m_set_suppress_ve
> > - p2m_set_suppress_ve_multi
> > - p2m_get_suppress_ve
> > Potential error on altp2m.c also breaks Misra Rule 8.4.
> >
> > Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
>
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
>

Thx


> This looks to be independent of all earlier changes, and hence could go in ahead of
> any of them?

Yes, it could.

>
> Jan
Re: [PATCH v1 5/7] xen/x86: move declaration from mem_access.h to altp2m.h
Posted by Jason Andryuk 2 hours ago
On 2025-11-18 06:09, Penny, Zheng wrote:
> [Public]
> 
>> -----Original Message-----
>> From: Jan Beulich <jbeulich@suse.com>
>> Sent: Thursday, November 13, 2025 5:35 PM
>> To: Penny, Zheng <penny.zheng@amd.com>
>> Cc: Andrew Cooper <andrew.cooper3@citrix.com>; Roger Pau Monné
>> <roger.pau@citrix.com>; Tamas K Lengyel <tamas@tklengyel.com>; Alexandru
>> Isaila <aisaila@bitdefender.com>; Petre Pircalabu <ppircalabu@bitdefender.com>;
>> xen-devel@lists.xenproject.org
>> Subject: Re: [PATCH v1 5/7] xen/x86: move declaration from mem_access.h to
>> altp2m.h
>>
>> On 13.11.2025 04:16, Penny Zheng wrote:
>>> Memory access and ALTP2M are two seperate features, and each could be
>>> controlled via VM_EVENT or ALTP2M. In order to avoid implicit
>>> declaration when ALTP2M=y and VM_EVENT=n on compiling hvm.o/altp2m.o,
>>> we move declaration of the following functions from <asm/mem_access.h> to
>> <asm/altp2m.h>:
>>> - p2m_set_suppress_ve
>>> - p2m_set_suppress_ve_multi
>>> - p2m_get_suppress_ve
>>> Potential error on altp2m.c also breaks Misra Rule 8.4.
>>>
>>> Signed-off-by: Penny Zheng <Penny.Zheng@amd.com>
>>
>> Reviewed-by: Jan Beulich <jbeulich@suse.com>
>>
> 
> Thx

Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>