[PATCH] xen/x86: Constify the vCPU parameter for expand_xsave_states()

Julien Grall posted 1 patch 9 months ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20230802154705.84530-1-julien@xen.org
xen/arch/x86/include/asm/xstate.h | 2 +-
xen/arch/x86/xstate.c             | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
[PATCH] xen/x86: Constify the vCPU parameter for expand_xsave_states()
Posted by Julien Grall 9 months ago
From: Julien Grall <jgrall@amazon.com>

expand_xsave_states() is not meant to modify the vCPU. So the parameter
can be const.

Signed-off-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/x86/include/asm/xstate.h | 2 +-
 xen/arch/x86/xstate.c             | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/include/asm/xstate.h b/xen/arch/x86/include/asm/xstate.h
index 7ab0bdde89cf..c08c267884f0 100644
--- a/xen/arch/x86/include/asm/xstate.h
+++ b/xen/arch/x86/include/asm/xstate.h
@@ -100,7 +100,7 @@ int __must_check validate_xstate(const struct domain *d,
                                  uint64_t xcr0, uint64_t xcr0_accum,
                                  const struct xsave_hdr *hdr);
 int __must_check handle_xsetbv(u32 index, u64 new_bv);
-void expand_xsave_states(struct vcpu *v, void *dest, unsigned int size);
+void expand_xsave_states(const struct vcpu *v, void *dest, unsigned int size);
 void compress_xsave_states(struct vcpu *v, const void *src, unsigned int size);
 
 /* extended state init and cleanup functions */
diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index 92496f379546..3d566252eaa2 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -172,7 +172,7 @@ static void setup_xstate_comp(uint16_t *comp_offsets,
  * It is the callers responsibility to ensure that there is xsave state to
  * serialise, and that the provided buffer is exactly the right size.
  */
-void expand_xsave_states(struct vcpu *v, void *dest, unsigned int size)
+void expand_xsave_states(const struct vcpu *v, void *dest, unsigned int size)
 {
     const struct xsave_struct *xsave = v->arch.xsave_area;
     const void *src;
-- 
2.40.1
Re: [PATCH] xen/x86: Constify the vCPU parameter for expand_xsave_states()
Posted by Jan Beulich 9 months ago
On 02.08.2023 17:47, Julien Grall wrote:
> From: Julien Grall <jgrall@amazon.com>
> 
> expand_xsave_states() is not meant to modify the vCPU. So the parameter
> can be const.
> 
> Signed-off-by: Julien Grall <jgrall@amazon.com>

Acked-by: Jan Beulich <jbeulich@suse.com>
Re: [PATCH] xen/x86: Constify the vCPU parameter for expand_xsave_states()
Posted by Julien Grall 8 months, 4 weeks ago
Hi Jan,

On 03/08/2023 09:53, Jan Beulich wrote:
> On 02.08.2023 17:47, Julien Grall wrote:
>> From: Julien Grall <jgrall@amazon.com>
>>
>> expand_xsave_states() is not meant to modify the vCPU. So the parameter
>> can be const.
>>
>> Signed-off-by: Julien Grall <jgrall@amazon.com>
> 
> Acked-by: Jan Beulich <jbeulich@suse.com>

Thanks. I have committed the patch.

Cheers,

-- 
Julien Grall