[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 2/5] x86: Refactor microcode_update() hypercall with flags field
On 05.04.2024 14:11, Fouad Hilly wrote: > @@ -708,11 +712,13 @@ static long cf_check microcode_update_helper(void *data) > return ret; > } > > -int microcode_update(XEN_GUEST_HANDLE(const_void) buf, unsigned long len) > +int microcode_update(XEN_GUEST_HANDLE(const_void) buf, unsigned long len, > unsigned int flags) > { > int ret; > struct ucode_buf *buffer; > > + ucode_force_flag = (flags == XENPF_UCODE_FLAG_FORCE_SET)? 1: 0; No need for ?: when the lhs has type bool. But - do we really need to resort to parameter passing via static variables here? If it's unavoidable, its setting needs to move inside a locked region (with that region covering everything up to all consumption of the value). Further, to avoid the same issue again when another flag wants adding, you want to check that all other bits in the flags field are clear. > --- a/xen/arch/x86/include/asm/microcode.h > +++ b/xen/arch/x86/include/asm/microcode.h > @@ -22,7 +22,7 @@ struct cpu_signature { > DECLARE_PER_CPU(struct cpu_signature, cpu_sig); > > void microcode_set_module(unsigned int idx); > -int microcode_update(XEN_GUEST_HANDLE(const_void) buf, unsigned long len); > +int microcode_update(XEN_GUEST_HANDLE(const_void) buf, unsigned long len, > unsigned int flags); Nit: Too long line. > --- a/xen/include/public/platform.h > +++ b/xen/include/public/platform.h > @@ -99,6 +99,10 @@ struct xenpf_microcode_update { > /* IN variables. */ > XEN_GUEST_HANDLE(const_void) data;/* Pointer to microcode data */ > uint32_t length; /* Length of microcode data. */ > + uint32_t flags; /* Flags to be passed with ucode. */ > +/* Force to skip microcode version check when set */ > +#define XENPF_UCODE_FLAG_FORCE_NOT_SET 0 > +#define XENPF_UCODE_FLAG_FORCE_SET 1 > }; The safety of this growing of an existing stable ABI struct wants at least briefly mentioning in the description. > @@ -624,6 +628,10 @@ struct xenpf_ucode_revision { > typedef struct xenpf_ucode_revision xenpf_ucode_revision_t; > DEFINE_XEN_GUEST_HANDLE(xenpf_ucode_revision_t); > > +/* Hypercall to microcode_update with flags */ > +#define XENPF_microcode_update2 66 > + > + No double blank lines please. Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |