[Public]

> -----Original Message-----
> From: Grygorii Strashko <[email protected]>
> Sent: Thursday, November 27, 2025 5:45 AM
> To: Penny, Zheng <[email protected]>; [email protected]
> Cc: Huang, Ray <[email protected]>; Jan Beulich <[email protected]>;
> Andrew Cooper <[email protected]>; Roger Pau MonnĂ©
> <[email protected]>; Anthony PERARD <[email protected]>; Juergen
> Gross <[email protected]>
> Subject: Re: [PATCH v4 02/24] xen: consolidate cpuid library
>
>
>
> On 21.11.25 12:57, Penny Zheng wrote:
> > There are some cpuid library functions only referenced in
> > XEN_DOMCTL_get{,set}_cpu_policy-case, and shall be wrapped with
> > CONFIG_MGMT_HYPERCALLS later, otherwise they will become unreachable
> > when MGMT_HYPERCALLS=n, and hence violate Misra 2.1
> > - x86_cpu_policy_clear_out_of_range_leaves
> >    - zero_leaves
> > - x86_cpuid_copy_to_buffer
> >    - copy_leaf_to_buffer
> > - x86_cpuid_copy_from_buffer
> > We seperate these functions by moving other functions to a new file
> > named cpuid-generic.c, and modify related Makefile-s to retain same 
> > behavior.
> >
> > Signed-off-by: Penny Zheng <[email protected]>
> > ---
> > v3 -> v4:
> > - new commit
> > ---
> >   tools/fuzz/cpu-policy/Makefile               |   2 +-
> >   tools/fuzz/x86_instruction_emulator/Makefile |  10 +-
> >   tools/libs/guest/Makefile.common             |   2 +-
> >   tools/tests/cpu-policy/Makefile              |   2 +-
> >   tools/tests/x86_emulator/Makefile            |   2 +-
> >   xen/lib/x86/Makefile                         |   1 +
> >   xen/lib/x86/cpuid-generic.c                  | 273 +++++++++++++++++++
> >   xen/lib/x86/cpuid.c                          | 260 ------------------
> >   8 files changed, 283 insertions(+), 269 deletions(-)
> >   create mode 100644 xen/lib/x86/cpuid-generic.c
>
> It seems this patch is not required prerequisite, at least definitely not for 
> Patch 3.
>

It is the pre-requisite for commit " xen/x86: wrap x86-specific domctl-op with 
CONFIG_MGMT_HYPERCALLS ", We want to guard new cpuid.o with MGMT_HYPERCALLS 
there. Without the split, fwis, I could not think a better way to avoid 
functions like x86_cpuid_copy_to{,from}_buffer becoming unreachable when 
MGMT_HYPERCALLS=n.

> In general, i think it can be removed from this series and sent as follow up 
> patch.
>
> --
> Best regards,
> -grygorii

Reply via email to