[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 20/21] i386/xen: implement HYPERVISOR_event_channel_op
From: |
David Woodhouse |
Subject: |
[RFC PATCH 20/21] i386/xen: implement HYPERVISOR_event_channel_op |
Date: |
Mon, 5 Dec 2022 17:31:36 +0000 |
From: Joao Martins <joao.m.martins@oracle.com>
Additionally set XEN_INTERFACE_VERSION to most recent in order to
exercise both event_channel_op and event_channel_op_compat.
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
---
target/i386/xen.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/target/i386/xen.c b/target/i386/xen.c
index 21146204e1..f3cc240bff 100644
--- a/target/i386/xen.c
+++ b/target/i386/xen.c
@@ -16,11 +16,14 @@
#include "trace.h"
#include "sysemu/sysemu.h"
+#define __XEN_INTERFACE_VERSION__ 0x00040400
+
#include "standard-headers/xen/version.h"
#include "standard-headers/xen/memory.h"
#include "standard-headers/xen/hvm/hvm_op.h"
#include "standard-headers/xen/hvm/params.h"
#include "standard-headers/xen/vcpu.h"
+#include "standard-headers/xen/event_channel.h"
#define PAGE_OFFSET 0xffffffff80000000UL
#define PAGE_SHIFT 12
@@ -436,6 +439,43 @@ static int kvm_xen_hcall_vcpu_op(struct kvm_xen_exit
*exit, X86CPU *cpu,
return err ? HCALL_ERR : 0;
}
+static int kvm_xen_hcall_evtchn_op_compat(struct kvm_xen_exit *exit,
+ X86CPU *cpu, uint64_t arg)
+{
+ struct evtchn_op *op = gva_to_hva(CPU(cpu), arg);
+ int err = -ENOSYS;
+
+ if (!op) {
+ goto err;
+ }
+
+ switch (op->cmd) {
+ default:
+ exit->u.hcall.result = err;
+ return 0;
+ }
+err:
+ exit->u.hcall.result = err;
+ return err ? HCALL_ERR : 0;
+}
+
+static int kvm_xen_hcall_evtchn_op(struct kvm_xen_exit *exit,
+ int cmd, uint64_t arg)
+{
+ int err = -ENOSYS;
+
+ switch (cmd) {
+ case EVTCHNOP_init_control:
+ /* FIFO ABI */
+ default:
+ exit->u.hcall.result = err;
+ return 0;
+ }
+
+ exit->u.hcall.result = err;
+ return err ? HCALL_ERR : 0;
+}
+
static int __kvm_xen_handle_exit(X86CPU *cpu, struct kvm_xen_exit *exit)
{
uint16_t code = exit->u.hcall.input;
@@ -449,6 +489,12 @@ static int __kvm_xen_handle_exit(X86CPU *cpu, struct
kvm_xen_exit *exit)
case HVMOP_set_evtchn_upcall_vector:
return kvm_xen_hcall_evtchn_upcall_vector(exit, cpu,
exit->u.hcall.params[0]);
+ case __HYPERVISOR_event_channel_op_compat:
+ return kvm_xen_hcall_evtchn_op_compat(exit, cpu,
+ exit->u.hcall.params[0]);
+ case __HYPERVISOR_event_channel_op:
+ return kvm_xen_hcall_evtchn_op(exit, exit->u.hcall.params[0],
+ exit->u.hcall.params[1]);
case __HYPERVISOR_vcpu_op:
return kvm_xen_hcall_vcpu_op(exit, cpu,
exit->u.hcall.params[0],
--
2.35.3
- Re: [RFC PATCH 12/21] i386/xen: set shared_info page, (continued)
- [RFC PATCH 21/21] i386/xen: implement HYPERVISOR_sched_op, David Woodhouse, 2022/12/05
- [RFC PATCH 10/21] i386/xen: handle guest hypercalls, David Woodhouse, 2022/12/05
- Re: [RFC PATCH 10/21] i386/xen: handle guest hypercalls, Philippe Mathieu-Daudé, 2022/12/05
- Re: [RFC PATCH 10/21] i386/xen: handle guest hypercalls, David Woodhouse, 2022/12/05
- Re: [RFC PATCH 10/21] i386/xen: handle guest hypercalls, Philippe Mathieu-Daudé, 2022/12/06
- Re: [RFC PATCH 10/21] i386/xen: handle guest hypercalls, David Woodhouse, 2022/12/06
- Re: [RFC PATCH 10/21] i386/xen: handle guest hypercalls, Philippe Mathieu-Daudé, 2022/12/06
- Re: [RFC PATCH 10/21] i386/xen: handle guest hypercalls, David Woodhouse, 2022/12/06
- Re: [RFC PATCH 10/21] i386/xen: handle guest hypercalls, Alex Bennée, 2022/12/06
[RFC PATCH 20/21] i386/xen: implement HYPERVISOR_event_channel_op,
David Woodhouse <=