Message ID | 20201111200721.30551-9-paul@xen.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | viridian: add support for ExProcessorMasks | expand |
On 11.11.2020 21:07, Paul Durrant wrote: > --- a/xen/include/asm-x86/hvm/viridian.h > +++ b/xen/include/asm-x86/hvm/viridian.h > @@ -59,6 +59,14 @@ struct viridian_domain > { > union hv_guest_os_id guest_os_id; > union hv_vp_assist_page_msr hypercall_gpa; > + unsigned long hypercall_flags; > + > +#define _HCALL_spin_wait 0 > +#define _HCALL_flush 1 > +#define _HCALL_flush_ex 2 > +#define _HCALL_ipi 3 > +#define _HCALL_ipi_ex 4 I'd like to suggest for this to either be unsigned int until more than 32 bits are needed, or be using DECLARE_BITMAP() right away. Jan
> -----Original Message----- > From: Jan Beulich <jbeulich@suse.com> > Sent: 12 November 2020 09:23 > To: Paul Durrant <paul@xen.org> > Cc: Paul Durrant <pdurrant@amazon.com>; Wei Liu <wl@xen.org>; Andrew Cooper > <andrew.cooper3@citrix.com>; Roger Pau Monné <roger.pau@citrix.com>; xen-devel@lists.xenproject.org > Subject: Re: [PATCH 08/10] viridian: log initial invocation of each type of hypercall > > On 11.11.2020 21:07, Paul Durrant wrote: > > --- a/xen/include/asm-x86/hvm/viridian.h > > +++ b/xen/include/asm-x86/hvm/viridian.h > > @@ -59,6 +59,14 @@ struct viridian_domain > > { > > union hv_guest_os_id guest_os_id; > > union hv_vp_assist_page_msr hypercall_gpa; > > + unsigned long hypercall_flags; > > + > > +#define _HCALL_spin_wait 0 > > +#define _HCALL_flush 1 > > +#define _HCALL_flush_ex 2 > > +#define _HCALL_ipi 3 > > +#define _HCALL_ipi_ex 4 > > I'd like to suggest for this to either be unsigned int until > more than 32 bits are needed, or be using DECLARE_BITMAP() > right away. Ok. I may just go straight for the bitmap then. Paul > > Jan
diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c index e899dd1e9f55..670fec3a4870 100644 --- a/xen/arch/x86/hvm/viridian/viridian.c +++ b/xen/arch/x86/hvm/viridian/viridian.c @@ -930,6 +930,7 @@ int viridian_hypercall(struct cpu_user_regs *regs) { struct vcpu *curr = current; struct domain *currd = curr->domain; + struct viridian_domain *vd = currd->arch.hvm.viridian; int mode = hvm_guest_x86_mode(curr); unsigned long input_params_gpa, output_params_gpa; int rc = 0; @@ -957,6 +958,10 @@ int viridian_hypercall(struct cpu_user_regs *regs) switch ( input.call_code ) { case HVCALL_NOTIFY_LONG_SPIN_WAIT: + if ( !test_and_set_bit(_HCALL_spin_wait, &vd->hypercall_flags) ) + printk(XENLOG_G_INFO "d%d: VIRIDIAN HVCALL_NOTIFY_LONG_SPIN_WAIT\n", + currd->domain_id); + /* * See section 14.5.1 of the specification. */ @@ -965,22 +970,38 @@ int viridian_hypercall(struct cpu_user_regs *regs) case HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE: case HVCALL_FLUSH_VIRTUAL_ADDRESS_LIST: + if ( !test_and_set_bit(_HCALL_flush, &vd->hypercall_flags) ) + printk(XENLOG_G_INFO "%pd: VIRIDIAN HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE/LIST\n", + currd); + rc = hvcall_flush(&input, &output, input_params_gpa, output_params_gpa); break; case HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE_EX: case HVCALL_FLUSH_VIRTUAL_ADDRESS_LIST_EX: + if ( !test_and_set_bit(_HCALL_flush_ex, &vd->hypercall_flags) ) + printk(XENLOG_G_INFO "%pd: VIRIDIAN HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE/LIST_EX\n", + currd); + rc = hvcall_flush_ex(&input, &output, input_params_gpa, output_params_gpa); break; case HVCALL_SEND_IPI: + if ( !test_and_set_bit(_HCALL_ipi, &vd->hypercall_flags) ) + printk(XENLOG_G_INFO "%pd: VIRIDIAN HVCALL_SEND_IPI\n", + currd); + rc = hvcall_ipi(&input, &output, input_params_gpa, output_params_gpa); break; case HVCALL_SEND_IPI_EX: + if ( !test_and_set_bit(_HCALL_ipi_ex, &vd->hypercall_flags) ) + printk(XENLOG_G_INFO "%pd: VIRIDIAN HVCALL_SEND_IPI_EX\n", + currd); + rc = hvcall_ipi_ex(&input, &output, input_params_gpa, output_params_gpa); break; diff --git a/xen/include/asm-x86/hvm/viridian.h b/xen/include/asm-x86/hvm/viridian.h index cbf77d9c760b..d176c4b9153b 100644 --- a/xen/include/asm-x86/hvm/viridian.h +++ b/xen/include/asm-x86/hvm/viridian.h @@ -59,6 +59,14 @@ struct viridian_domain { union hv_guest_os_id guest_os_id; union hv_vp_assist_page_msr hypercall_gpa; + unsigned long hypercall_flags; + +#define _HCALL_spin_wait 0 +#define _HCALL_flush 1 +#define _HCALL_flush_ex 2 +#define _HCALL_ipi 3 +#define _HCALL_ipi_ex 4 + struct viridian_time_ref_count time_ref_count; struct viridian_page reference_tsc; };