[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <MW2PR2101MB10522065BF1835CE5D2B233AD7D20@MW2PR2101MB1052.namprd21.prod.outlook.com>
Date: Wed, 22 Apr 2020 20:04:08 +0000
From: Michael Kelley <mikelley@...rosoft.com>
To: vkuznets <vkuznets@...hat.com>
CC: KY Srinivasan <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Stephen Hemminger <sthemmin@...rosoft.com>,
"wei.liu@...nel.org" <wei.liu@...nel.org>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"mingo@...hat.com" <mingo@...hat.com>,
"bp@...en8.de" <bp@...en8.de>, "x86@...nel.org" <x86@...nel.org>,
"hpa@...or.com" <hpa@...or.com>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"sean.j.christopherson@...el.com" <sean.j.christopherson@...el.com>,
"wanpengli@...cent.com" <wanpengli@...cent.com>,
"jmattson@...gle.com" <jmattson@...gle.com>,
"joro@...tes.org" <joro@...tes.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>
Subject: RE: [PATCH 4/4] asm-generic/hyperv: Add definitions for
Get/SetVpRegister hypercalls
From: Michael Kelley Sent: Tuesday, April 21, 2020 8:50 AM
>
> From: Vitaly Kuznetsov <vkuznets@...hat.com> Sent: Tuesday, April 21, 2020 6:03 AM
> >
> > Michael Kelley <mikelley@...rosoft.com> writes:
> >
> > > Add definitions for GetVpRegister and SetVpRegister hypercalls, which
> > > are implemented for both x86 and ARM64.
> > >
> > > Signed-off-by: Michael Kelley <mikelley@...rosoft.com>
> > > ---
> > > include/asm-generic/hyperv-tlfs.h | 28 ++++++++++++++++++++++++++++
> > > 1 file changed, 28 insertions(+)
> > >
> > > diff --git a/include/asm-generic/hyperv-tlfs.h b/include/asm-generic/hyperv-tlfs.h
> > > index 1f92ef92eb56..29b60f5b6323 100644
> > > --- a/include/asm-generic/hyperv-tlfs.h
> > > +++ b/include/asm-generic/hyperv-tlfs.h
> > > @@ -141,6 +141,8 @@ struct ms_hyperv_tsc_page {
> > > #define HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE_EX 0x0013
> > > #define HVCALL_FLUSH_VIRTUAL_ADDRESS_LIST_EX 0x0014
> > > #define HVCALL_SEND_IPI_EX 0x0015
> > > +#define HVCALL_GET_VP_REGISTERS 0x0050
> > > +#define HVCALL_SET_VP_REGISTERS 0x0051
> > > #define HVCALL_POST_MESSAGE 0x005c
> > > #define HVCALL_SIGNAL_EVENT 0x005d
> > > #define HVCALL_RETARGET_INTERRUPT 0x007e
> > > @@ -439,4 +441,30 @@ struct hv_retarget_device_interrupt {
> > > struct hv_device_interrupt_target int_target;
> > > } __packed __aligned(8);
> > >
> > > +
> > > +/* HvGetVPRegister hypercall */
> >
> > Nit: 'HvGetVpRegisters' in TLFS
> >
> > > +struct hv_get_vp_register_input {
> >
> > Nit: I would also to name it 'hv_get_vp_registers_input' (plural, like
> > the hypercall).
> >
> > > + u64 partitionid;
> > > + u32 vpindex;
> > > + u8 inputvtl;
> > > + u8 padding[3];
> > > + u32 name0;
> > > + u32 name1;
> > > +} __packed;
> >
> > Isn't it a REP hypercall where we can we can pass a list? In that case
> > this should look like
> >
> > struct hv_get_vp_registers_input {
> > struct {
> > u64 partitionid;
> > u32 vpindex;
> > u8 inputvtl;
> > u8 padding[3];
> > } header;
> > struct {
> > u32 name0;
> > u32 name1;
> > } elem[];
> > } __packed;
> >
> > > +
> > > +struct hv_get_vp_register_output {
> >
> > Ditto.
I've sent out a new version, but didn't change
hv_get_vp_register_output except to make
it hv_get_vp_registers_output. The C compiler
wont' let me put a variable size array as the
only field in the struct.
> >
> > > + union {
> > > + struct {
> > > + u32 a;
> > > + u32 b;
> > > + u32 c;
> > > + u32 d;
> > > + } as32 __packed;
> > > + struct {
> > > + u64 low;
> > > + u64 high;
> > > + } as64 __packed;
> > > + };
> > > +};
> >
> > I'm wondering why you define both
> > HVCALL_GET_VP_REGISTERS/HVCALL_SET_VP_REGISTERS but only add 'struct
> > hv_get_vp_register_input' and not 'struct hv_set_vp_register_input'.
> >
> > The later should look similar, AFAIU it is:
> >
> > struct hv_set_vp_registers_input {
> > struct {
> > u64 partitionid;
> > u32 vpindex;
> > u8 inputvtl;
> > u8 padding[3];
> > } header;
> > struct {
> > u32 name;
> > u32 padding1;
> > u64 padding2; //not sure this is not a mistake in TLFS
The additional padding is not a mistake. Hyper-V wants
the register value to be aligned to 128 bits even though
it is described in the TLFS document as two 64 bit fields.
> > u64 regvallow;
> > u64 regvalhigh;
> > } elem[];
> > } __packed;
> >
> > > +
> > > #endif
> >
Michael
Powered by blists - more mailing lists