x86/hvm: Add per-vcpu evtchn upcalls
PATCH 1/1 x86/hvm: Add per-vcpu evtchn upcalls
HVM guests have always been confined to using the domain callback via (see HVM_PARAM_CALLBACK_IRQ) to receive event notifications which is an IOAPIC vector and is only used if the event channel is bound to vcpu 0.
This patch adds a new HVM op allowing a guest to specify a local APIC vector to use as an upcall notification for a specific vcpu. This therefore allows a guest which sets a vector for a vcpu other than 0 to then bind event channels to that vcpu.
--- xen/arch/x86/hvm/hvm.c | 35 +++++++++++++++++++++++++++++++++++ xen/arch/x86/hvm/irq.c | 9 +++++++++ xen/include/asm-x86/hvm/vcpu.h | 1 + xen/include/public/hvm/hvm_op.h | 16 ++++++++++++++++ 4 files changed, 61 insertions(+)
xen/arch/x86/hvm/hvm.c +35 -0
@@ -5458,6 +5458,36 @@ static int hvmop_destroy_ioreq_server(return rc; } +static int hvmop_set_evtchn_upcall_vector ( +XEN_GUEST_HANDLE_PARAM (xen_hvm_set_evtchn_upcall_vector_t) uop) +{ +xen_hvm_set_evtchn_upcall_vector_t op; +struct domain *d; +struct vcpu *v; +int rc; + +if (copy_from_guest (&op, uop,1 ) ) +return -EFAULT ; + + d =rcu_lock_current_domain (); + + rc = -EINVAL ; +if ( !is_hvm_domain (d) ) + goto out; + +if ( op.vcpu >= d->max_vcpus || (v = d->vcpu[op.vcpu]) ==NULL ) + goto out; + +printk (XENLOG_G_INFO "%pv: %s %u\n" , v, __func__, op.vector); + + v->arch.hvm_vcpu.evtchn_upcall_vector = op.vector; + rc =0 ; + + out: +rcu_unlock_domain (d); +return rc; +} +#define HVMOP_op_mask 0xfflong do_hvm_op (unsigned long op,XEN_GUEST_HANDLE_PARAM (void ) arg)
@@ -5499,6 +5529,11 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg) guest_handle_cast(arg, xen_hvm_destroy_ioreq_server_t));break ; +case HVMOP_set_evtchn_upcall_vector: + rc =hvmop_set_evtchn_upcall_vector ( +guest_handle_cast (arg, xen_hvm_set_evtchn_upcall_vector_t)); +break ; +case HVMOP_set_param:case HVMOP_get_param: {
xen/arch/x86/hvm/irq.c +9 -0
@@ -152,6 +152,13 @@ void hvm_isa_irq_deassert(spin_unlock (&d->arch.hvm_domain.irq_lock); } +static void hvm_set_upcall_irq (struct vcpu *v) +{ +uint8_t vector = v->arch.hvm_vcpu.evtchn_upcall_vector; + +vlapic_set_irq (vcpu_vlapic (v), vector,0 ); +} +static void hvm_set_callback_irq_level (struct vcpu *v) {struct domain *d = v->domain;
@@ -220,6 +227,8 @@ void hvm_assert_evtchn_irq(struct vcpu *v)if (is_hvm_pv_evtchn_vcpu (v) )vcpu_kick (v); +else if ( v->arch.hvm_vcpu.evtchn_upcall_vector !=0 ) +hvm_set_upcall_irq (v);else if ( v->vcpu_id ==0 )hvm_set_callback_irq_level (v); }
xen/include/asm-x86/hvm/vcpu.h +1 -0
@@ -160,6 +160,7 @@ struct hvm_vcpu { } u;struct tasklet assert_evtchn_irq_tasklet; +u8 evtchn_upcall_vector;struct nestedvcpu nvcpu;
xen/include/public/hvm/hvm_op.h +16 -0
@@ -369,6 +369,22 @@ DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_ioreq_server_state_t);#endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */ +/* +* HVMOP_set_evtchn_upcall_vector: Set a <vector> that should be used for event +* channel upcalls on the specified <vcpu>. If set, +* this vector will be used in preference to the +* domain callback via (see HVM_PARAM_CALLBACK_IRQ) +* and hence allows HVM guests to bind event +* event channels to a vcpu other than 0. +*/ +#define HVMOP_set_evtchn_upcall_vector 23 +struct xen_hvm_set_evtchn_upcall_vector { +uint32_t vcpu; +uint8_t vector; +}; +typedef struct xen_hvm_set_evtchn_upcall_vector xen_hvm_set_evtchn_upcall_vector_t ; +DEFINE_XEN_GUEST_HANDLE (xen_hvm_set_evtchn_upcall_vector_t); +#endif /* __XEN_PUBLIC_HVM_HVM_OP_H__ */ /*
Signature · 1 line
1.7.10.4
Quoted 9 lines · Paul Durrant
HVM guests have always been confined to using the domain callback via (see
HVM_PARAM_CALLBACK_IRQ) to receive event notifications which is an IOAPIC vector and is only used if the event channel is bound to vcpu 0.
This patch adds a new HVM op allowing a guest to specify a local APIC vector to use as an upcall notification for a specific vcpu. This therefore allows a guest which sets a vector for a vcpu other than 0 to then bind event channels to that vcpu.
Quoted 3 lines
Signed-off-by Paul Durrant <[email protected]>Cc Keir Fraser <[email protected]>Cc Jan Beulich <[email protected]>
Substantially more minimal changes than I would have guessed!
Quoted 22 lines
--- xen/arch/x86/hvm/hvm.c | 35 +++++++++++++++++++++++++++++++++++ xen/arch/x86/hvm/irq.c | 9 +++++++++ xen/include/asm-x86/hvm/vcpu.h | 1 + xen/include/public/hvm/hvm_op.h | 16 ++++++++++++++++ 4 files changed, 61 insertions(+)xen/arch/x86/hvm/hvm.c +7
-0@@ -5458,6 +5458,36 @@ static int hvmop_destroy_ioreq_server(return rc; } +static int hvmop_set_evtchn_upcall_vector ( +XEN_GUEST_HANDLE_PARAM (xen_hvm_set_evtchn_upcall_vector_t) uop) +{ +xen_hvm_set_evtchn_upcall_vector_t op; +struct domain *d; +struct vcpu *v; +int rc;
xen/arch/x86/hvm/hvm.c static int hvmop_destroy_ioreq_server( · line 5477
Quoted 10 lines
xen/arch/x86/hvm/hvm.c +10
-0+ +if (copy_from_guest (&op, uop,1 ) ) +return -EFAULT ; + + d =rcu_lock_current_domain (); + + rc = -EINVAL ; +if ( !is_hvm_domain (d) ) + goto out; +
ENOENT, to help differentiate the various failures.
xen/arch/x86/hvm/hvm.c static int hvmop_destroy_ioreq_server( · line 5480
Quoted 3 lines
xen/arch/x86/hvm/hvm.c +3
-0+if ( op.vcpu >= d->max_vcpus || (v = d->vcpu[op.vcpu]) ==NULL ) + goto out; +
Need to verify that op.vector > 0xf. The first 16 vectors are not valid for delivery via the LAPIC.
Quoted 69 lines
xen/arch/x86/hvm/hvm.c +15
-0+printk (XENLOG_G_INFO "%pv: %s %u\n" , v, __func__, op.vector); + + v->arch.hvm_vcpu.evtchn_upcall_vector = op.vector; + rc =0 ; + + out: +rcu_unlock_domain (d); +return rc; +} +#define HVMOP_op_mask 0xfflong do_hvm_op (unsigned long op,XEN_GUEST_HANDLE_PARAM (void ) arg)@@ -5499,6 +5529,11 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg) guest_handle_cast(arg, xen_hvm_destroy_ioreq_server_t));break ; +case HVMOP_set_evtchn_upcall_vector: + rc =hvmop_set_evtchn_upcall_vector ( +guest_handle_cast (arg, xen_hvm_set_evtchn_upcall_vector_t)); +break ; +case HVMOP_set_param:case HVMOP_get_param: {xen/arch/x86/hvm/irq.c +9
-0@@ -152,6 +152,13 @@ void hvm_isa_irq_deassert(spin_unlock (&d->arch.hvm_domain.irq_lock); } +static void hvm_set_upcall_irq (struct vcpu *v) +{ +uint8_t vector = v->arch.hvm_vcpu.evtchn_upcall_vector; + +vlapic_set_irq (vcpu_vlapic (v), vector,0 ); +} +static void hvm_set_callback_irq_level (struct vcpu *v) {struct domain *d = v->domain;@@ -220,6 +227,8 @@ void hvm_assert_evtchn_irq(struct vcpu *v)if (is_hvm_pv_evtchn_vcpu (v) )vcpu_kick (v); +else if ( v->arch.hvm_vcpu.evtchn_upcall_vector !=0 ) +hvm_set_upcall_irq (v);else if ( v->vcpu_id ==0 )hvm_set_callback_irq_level (v); }xen/include/asm-x86/hvm/vcpu.h +1
-0@@ -160,6 +160,7 @@ struct hvm_vcpu { } u;struct tasklet assert_evtchn_irq_tasklet; +u8 evtchn_upcall_vector;struct nestedvcpu nvcpu;xen/include/public/hvm/hvm_op.h +0
-0
xen/include/public/hvm/hvm_op.h DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_ioreq_server_state_t); · line 370
Quoted 2 lines
xen/include/public/hvm/hvm_op.h +0
-0@@ -369,6 +369,22 @@ DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_ioreq_server_state_t);#endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */
This new hvmop looks like it should live in an x86 specific section.
xen/include/public/hvm/hvm_op.h DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_ioreq_server_state_t); · line 383
Quoted 13 lines
xen/include/public/hvm/hvm_op.h +12
-0+/* +* HVMOP_set_evtchn_upcall_vector: Set a <vector> that should be used for event +* channel upcalls on the specified <vcpu>. If set, +* this vector will be used in preference to the +* domain callback via (see HVM_PARAM_CALLBACK_IRQ) +* and hence allows HVM guests to bind event +* event channels to a vcpu other than 0. +*/ +#define HVMOP_set_evtchn_upcall_vector 23 +struct xen_hvm_set_evtchn_upcall_vector { +uint32_t vcpu; +uint8_t vector;
Is it plausible that a device model might want to call this hypercall on a domain which it controls? I don't believe so, but the question is worth considering with a view to adding a domid parameter before the API is set in stone.
~Andrew
Quoted 7 lines
xen/include/public/hvm/hvm_op.h +4
-0+}; +typedef struct xen_hvm_set_evtchn_upcall_vector xen_hvm_set_evtchn_upcall_vector_t ; +DEFINE_XEN_GUEST_HANDLE (xen_hvm_set_evtchn_upcall_vector_t); +#endif /* __XEN_PUBLIC_HVM_HVM_OP_H__ */ /*
Quoted 17 lines
-----Original Message-----
From: Andrew Cooper
Sent: 06 November 2014 15:02
To: Paul Durrant; [email protected]
Cc: Keir (Xen.org); Jan Beulich
Subject: Re: [Xen-devel] [PATCH] x86/hvm: Add per-vcpu evtchn upcallsQuoted 9 lines · Paul Durrant
HVM guests have always been confined to using the domain callback via (see
HVM_PARAM_CALLBACK_IRQ) to receive event notifications which is an IOAPIC vector and is only used if the event channel is bound to vcpu 0.
This patch adds a new HVM op allowing a guest to specify a local APIC vector to use as an upcall notification for a specific vcpu. This therefore allows a guest which sets a vector for a vcpu other than 0 to then bind event channels to that vcpu.
Quoted 6 lines
Quoted 3 lines
Signed-off-by Paul Durrant <[email protected]>Cc Keir Fraser <[email protected]>Cc Jan Beulich <[email protected]>Substantially more minimal changes than I would have guessed!
Yep :-) most of the change needed is guest-side.
Quoted 28 lines
Quoted 2 lines
--- xen/arch/x86/hvm/hvm.c | 35+++++++++++++++++++++++++++++++++++
Quoted 10 lines
xen/arch/x86/hvm/irq.c | 9 +++++++++ xen/include/asm-x86/hvm/vcpu.h | 1 + xen/include/public/hvm/hvm_op.h | 16 ++++++++++++++++ 4 files changed, 61 insertions(+)xen/arch/x86/hvm/hvm.c +0
-0xen/arch/x86/hvm/hvm.c static int hvmop_destroy_ioreq_server( · line 5462
Quoted 5 lines
xen/arch/x86/hvm/hvm.c +2
-0@@ -5458,6 +5458,36 @@ static int hvmop_destroy_ioreq_server(return rc; } +static int hvmop_set_evtchn_upcall_vector ( + XEN_GUEST_HANDLE_PARAM(xen_hvm_set_evtchn_upcall_vector_t)uop)
Quoted 9 lines
xen/arch/x86/hvm/hvm.c +9
-0+{ +xen_hvm_set_evtchn_upcall_vector_t op; +struct domain *d; +struct vcpu *v; +int rc; + +if (copy_from_guest (&op, uop,1 ) ) +return -EFAULT ; +
Quoted 9 lines
xen/arch/x86/hvm/hvm.c static int hvmop_destroy_ioreq_server( · line 5477
Quoted 6 lines
xen/arch/x86/hvm/hvm.c +6
-0+ d =rcu_lock_current_domain (); + + rc = -EINVAL ; +if ( !is_hvm_domain (d) ) + goto out; +ENOENT, to help differentiate the various failures.
Sure.
Quoted 6 lines
xen/arch/x86/hvm/hvm.c static int hvmop_destroy_ioreq_server( · line 5480
Quoted 3 lines
xen/arch/x86/hvm/hvm.c +3
-0+if ( op.vcpu >= d->max_vcpus || (v = d->vcpu[op.vcpu]) ==NULL ) + goto out; +Need to verify that op.vector >
0xf. The first 16 vectors are not valid for delivery via the LAPIC.
Good point. I'll add that check.
Quoted 76 lines
Quoted 4 lines
xen/arch/x86/hvm/hvm.c +3
-0+printk (XENLOG_G_INFO "%pv: %s %u\n" , v, __func__, op.vector); + + v->arch.hvm_vcpu.evtchn_upcall_vector = op.vector;xen/arch/x86/hvm/hvm.c static int hvmop_destroy_ioreq_server(
Quoted 10 lines
xen/arch/x86/hvm/hvm.c +7
-0+ rc =0 ; + + out: +rcu_unlock_domain (d); +return rc; +} +#define HVMOP_op_mask 0xff long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void)arg)
xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,
Quoted 1 line
xen/arch/x86/hvm/hvm.c +0
-0@@ -5499,6 +5529,11 @@ long do_hvm_op(unsigned long op,
XEN_GUEST_HANDLE_PARAM(void)arg)xen/include/asm-
Quoted 39 lines
xen/arch/x86/hvm/hvm.c +5
-0guest_handle_cast(arg, xen_hvm_destroy_ioreq_server_t));break ; +case HVMOP_set_evtchn_upcall_vector: + rc =hvmop_set_evtchn_upcall_vector ( +guest_handle_cast (arg, xen_hvm_set_evtchn_upcall_vector_t)); +break ; +case HVMOP_set_param:case HVMOP_get_param: {xen/arch/x86/hvm/irq.c +9
-0@@ -152,6 +152,13 @@ void hvm_isa_irq_deassert(spin_unlock (&d->arch.hvm_domain.irq_lock); } +static void hvm_set_upcall_irq (struct vcpu *v) +{ +uint8_t vector = v->arch.hvm_vcpu.evtchn_upcall_vector; + +vlapic_set_irq (vcpu_vlapic (v), vector,0 ); +} +static void hvm_set_callback_irq_level (struct vcpu *v) {struct domain *d = v->domain;@@ -220,6 +227,8 @@ void hvm_assert_evtchn_irq(struct vcpu *v)if (is_hvm_pv_evtchn_vcpu (v) )vcpu_kick (v); +else if ( v->arch.hvm_vcpu.evtchn_upcall_vector !=0 ) +hvm_set_upcall_irq (v);else if ( v->vcpu_id ==0 )hvm_set_callback_irq_level (v); }xen/include/asm- renamed from xen/include/asm-x86/hvm/vcpu.h +0
-0
x86/hvm/vcpu.hReview
Quoted 12 lines
index 01e0665..edd4523 100644
xen/include/asm-x86/hvm/vcpu.h +1
-0@@ -160,6 +160,7 @@ struct hvm_vcpu { } u;struct tasklet assert_evtchn_irq_tasklet; +u8 evtchn_upcall_vector;struct nestedvcpu nvcpu;(quoted diff) +0
-0
b/xen/include/public/hvm/hvm_op.hxen/include/public/hvm/hvm_op.h
Quoted 4 lines
index eeb0a60..33ccf45 100644
xen/include/public/hvm/hvm_op.h +0
-0@@ -369,6 +369,22 @@
DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_ioreq_server_state_t);Quoted 1 line
Quoted 4 lines
Quoted 1 line
#endif /*
defined(__XEN__)||defined(__XEN_TOOLS__)*/This new hvmop looks like it should live in an x86 specific section.
Hmm. Aren't HVM ops essentially x86 specific anyway? There's certainly x86-ness all over the header.
Quoted 4 lines
Quoted 3 lines
+/*
+ *HVMOP_set_evtchn_upcall_vector: Set a <vector> that should be usedfor event
Quoted 15 lines
xen/include/public/hvm/hvm_op.h DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_ioreq_server_state_t); · line 383
Quoted 10 lines
+ * channel upcalls on the specified <vcpu>. If set, + * this vector will be used in preference to the + * domain callback via (see HVM_PARAM_CALLBACK_IRQ) + * and hence allows HVM guests to bind event + * event channels to a vcpu other than 0.+ */
xen/include/public/hvm/hvm_op.h +4
-0+#define HVMOP_set_evtchn_upcall_vector 23 +struct xen_hvm_set_evtchn_upcall_vector { +uint32_t vcpu; +uint8_t vector;Is it plausible that a device model might want to call this hypercall on a domain which it controls? I don't believe so, but the question is worth considering with a view to adding a domid parameter before the API is set in stone.
No, I don't think it's useful outside guest context. I'm open to adding a domid if anyone else thinks otherwise though.
Paul
Quoted 12 lines
~Andrew
xen/include/public/hvm/hvm_op.h
Quoted 2 lines
xen/include/public/hvm/hvm_op.h +2
-0+}; +typedef struct xen_hvm_set_evtchn_upcall_vector
xen_hvm_set_evtchn_upcall_vector_t;Quoted 5 lines
xen/include/public/hvm/hvm_op.h +2
-0+DEFINE_XEN_GUEST_HANDLE (xen_hvm_set_evtchn_upcall_vector_t); +#endif /* __XEN_PUBLIC_HVM_HVM_OP_H__ */ /*
Quoted 143 lines · Paul Durrant
Quoted 17 lines
-----Original Message-----
From: Andrew Cooper
Sent: 06 November 2014 15:02
To: Paul Durrant; [email protected]
Cc: Keir (Xen.org); Jan Beulich
Subject: Re: [Xen-devel] [PATCH] x86/hvm: Add per-vcpu evtchn upcallsQuoted 9 lines · Paul Durrant
HVM guests have always been confined to using the domain callback via (see
HVM_PARAM_CALLBACK_IRQ) to receive event notifications which is an IOAPIC vector and is only used if the event channel is bound to vcpu 0.
This patch adds a new HVM op allowing a guest to specify a local APIC vector to use as an upcall notification for a specific vcpu. This therefore allows a guest which sets a vector for a vcpu other than 0 to then bind event channels to that vcpu.Quoted 5 lines
Quoted 3 lines
Signed-off-by Paul Durrant <[email protected]>Cc Keir Fraser <[email protected]>Cc Jan Beulich <[email protected]>Substantially more minimal changes than I would have guessed!
Yep :-) most of the change needed is guest-side.
Quoted 19 lines
Quoted 2 lines
--- xen/arch/x86/hvm/hvm.c | 35+++++++++++++++++++++++++++++++++++
Quoted 10 lines
xen/arch/x86/hvm/irq.c | 9 +++++++++ xen/include/asm-x86/hvm/vcpu.h | 1 + xen/include/public/hvm/hvm_op.h | 16 ++++++++++++++++ 4 files changed, 61 insertions(+)xen/arch/x86/hvm/hvm.c +0
-0xen/arch/x86/hvm/hvm.c static int hvmop_destroy_ioreq_server( · line 5462
Quoted 5 lines
xen/arch/x86/hvm/hvm.c +2
-0@@ -5458,6 +5458,36 @@ static int hvmop_destroy_ioreq_server(return rc; } +static int hvmop_set_evtchn_upcall_vector ( + XEN_GUEST_HANDLE_PARAM(xen_hvm_set_evtchn_upcall_vector_t)uop)
Quoted 17 lines
Quoted 5 lines
xen/arch/x86/hvm/hvm.c +5
-0+{ +xen_hvm_set_evtchn_upcall_vector_t op; +struct domain *d; +struct vcpu *v; +int rc;xen/arch/x86/hvm/hvm.c static int hvmop_destroy_ioreq_server( · line 5477
Quoted 10 lines
xen/arch/x86/hvm/hvm.c +10
-0+ +if (copy_from_guest (&op, uop,1 ) ) +return -EFAULT ; + + d =rcu_lock_current_domain (); + + rc = -EINVAL ; +if ( !is_hvm_domain (d) ) + goto out; +ENOENT, to help differentiate the various failures.
Sure.
Quoted 5 lines
xen/arch/x86/hvm/hvm.c static int hvmop_destroy_ioreq_server( · line 5480
Quoted 3 lines
xen/arch/x86/hvm/hvm.c +3
-0+if ( op.vcpu >= d->max_vcpus || (v = d->vcpu[op.vcpu]) ==NULL ) + goto out; +Need to verify that op.vector >
0xf. The first 16 vectors are not valid for delivery via the LAPIC.Good point. I'll add that check.
Quoted 74 lines
xen/arch/x86/hvm/hvm.c static int hvmop_destroy_ioreq_server(
Quoted 13 lines
xen/arch/x86/hvm/hvm.c +10
-0+printk (XENLOG_G_INFO "%pv: %s %u\n" , v, __func__, op.vector); + + v->arch.hvm_vcpu.evtchn_upcall_vector = op.vector; + rc =0 ; + + out: +rcu_unlock_domain (d); +return rc; +} +#define HVMOP_op_mask 0xff long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void)arg)
xen/arch/x86/hvm/hvm.c long do_hvm_op(unsigned long op,
Quoted 1 line
xen/arch/x86/hvm/hvm.c +0
-0@@ -5499,6 +5529,11 @@ long do_hvm_op(unsigned long op,
XEN_GUEST_HANDLE_PARAM(void)arg)xen/include/asm-
Quoted 39 lines
xen/arch/x86/hvm/hvm.c +5
-0guest_handle_cast(arg, xen_hvm_destroy_ioreq_server_t));break ; +case HVMOP_set_evtchn_upcall_vector: + rc =hvmop_set_evtchn_upcall_vector ( +guest_handle_cast (arg, xen_hvm_set_evtchn_upcall_vector_t)); +break ; +case HVMOP_set_param:case HVMOP_get_param: {xen/arch/x86/hvm/irq.c +9
-0@@ -152,6 +152,13 @@ void hvm_isa_irq_deassert(spin_unlock (&d->arch.hvm_domain.irq_lock); } +static void hvm_set_upcall_irq (struct vcpu *v) +{ +uint8_t vector = v->arch.hvm_vcpu.evtchn_upcall_vector; + +vlapic_set_irq (vcpu_vlapic (v), vector,0 ); +} +static void hvm_set_callback_irq_level (struct vcpu *v) {struct domain *d = v->domain;@@ -220,6 +227,8 @@ void hvm_assert_evtchn_irq(struct vcpu *v)if (is_hvm_pv_evtchn_vcpu (v) )vcpu_kick (v); +else if ( v->arch.hvm_vcpu.evtchn_upcall_vector !=0 ) +hvm_set_upcall_irq (v);else if ( v->vcpu_id ==0 )hvm_set_callback_irq_level (v); }xen/include/asm- renamed from xen/include/asm-x86/hvm/vcpu.h +0
-0
x86/hvm/vcpu.hReview
Quoted 12 lines
index 01e0665..edd4523 100644
xen/include/asm-x86/hvm/vcpu.h +1
-0@@ -160,6 +160,7 @@ struct hvm_vcpu { } u;struct tasklet assert_evtchn_irq_tasklet; +u8 evtchn_upcall_vector;struct nestedvcpu nvcpu;(quoted diff) +0
-0
b/xen/include/public/hvm/hvm_op.hxen/include/public/hvm/hvm_op.h
Quoted 4 lines
index eeb0a60..33ccf45 100644
xen/include/public/hvm/hvm_op.h +0
-0@@ -369,6 +369,22 @@
DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_ioreq_server_state_t);
Quoted 4 lines
Quoted 3 lines
xen/include/public/hvm/hvm_op.h DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_ioreq_server_state_t); · line 370
Quoted 1 line
xen/include/public/hvm/hvm_op.h +0
-0#endif /* defined(__XEN__) || defined(__XEN_TOOLS__) */ This new hvmop looks like it should live in an x86 specific section.
Hmm. Aren't HVM ops essentially x86 specific anyway? There's certainly x86-ness all over the header.
ARM uses some of the HVM ops, but I would agree that most of them are x86.
Quoted 18 lines
Quoted 4 lines
xen/include/public/hvm/hvm_op.h line 371
Quoted 3 lines
xen/include/public/hvm/hvm_op.h +2
-0+/* +* HVMOP_set_evtchn_upcall_vector: Set a <vector> that should be used for event
Quoted 14 lines
xen/include/public/hvm/hvm_op.h DEFINE_XEN_GUEST_HANDLE(xen_hvm_set_ioreq_server_state_t); · line 383
Quoted 10 lines
xen/include/public/hvm/hvm_op.h +10
-0+* channel upcalls on the specified <vcpu>. If set, +* this vector will be used in preference to the +* domain callback via (see HVM_PARAM_CALLBACK_IRQ) +* and hence allows HVM guests to bind event +* event channels to a vcpu other than 0. +*/ +#define HVMOP_set_evtchn_upcall_vector 23 +struct xen_hvm_set_evtchn_upcall_vector { +uint32_t vcpu; +uint8_t vector;Is it plausible that a device model might want to call this hypercall on a domain which it controls? I don't believe so, but the question is worth considering with a view to adding a domid parameter before the API is set in stone.
Quoted 3 lines
No, I don't think it's useful outside guest context. I'm open to adding a domid if anyone else thinks otherwise though.
Paul
More "double checking that this has at least been considered". I admit that I can't think of a plausible reason why this hypercall would be valid to use on anything other than DOMID_SELF.
~Andrew