Hi Cornelia, On Tue, May 16, 2023 at 3:26 AM Cornelia Huck <cohuck@xxxxxxxxxx> wrote: > > On Wed, May 03 2023, Jing Zhang <jingzhangos@xxxxxxxxxx> wrote: > > > Since reset() and val are not used for idreg in sys_reg_desc, they would > > be used with other purposes for idregs. > > The callback reset() would be used to return KVM sanitised id register > > values. The u64 val would be used as mask for writable fields in idregs. > > Only bits with 1 in val are writable from userspace. > > > > Signed-off-by: Jing Zhang <jingzhangos@xxxxxxxxxx> > > --- > > arch/arm64/kvm/id_regs.c | 44 +++++++++++++++++++---------- > > arch/arm64/kvm/sys_regs.c | 59 +++++++++++++++++++++++++++------------ > > arch/arm64/kvm/sys_regs.h | 10 ++++--- > > 3 files changed, 77 insertions(+), 36 deletions(-) > > > > (...) > > > diff --git a/arch/arm64/kvm/sys_regs.h b/arch/arm64/kvm/sys_regs.h > > index e88fd77309b2..21869319f6e1 100644 > > --- a/arch/arm64/kvm/sys_regs.h > > +++ b/arch/arm64/kvm/sys_regs.h > > @@ -65,12 +65,12 @@ struct sys_reg_desc { > > const struct sys_reg_desc *); > > > > /* Initialization for vcpu. */ > > Maybe be a bit more verbose here? > > /* Initialization for vcpu. Return initialized value, or KVM sanitized > value for id registers. */ Sure. Thanks. > > > - void (*reset)(struct kvm_vcpu *, const struct sys_reg_desc *); > > + u64 (*reset)(struct kvm_vcpu *, const struct sys_reg_desc *); > > > > /* Index into sys_reg[], or 0 if we don't need to save it. */ > > int reg; > > > > - /* Value (usually reset value) */ > > + /* Value (usually reset value), or write mask for idregs */ > > u64 val; > > > > /* Custom get/set_user functions, fallback to generic if NULL */ > Jing