[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH 10/21] i386/xen: handle guest hypercalls
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [RFC PATCH 10/21] i386/xen: handle guest hypercalls |
Date: |
Mon, 5 Dec 2022 23:11:19 +0100 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 |
On 5/12/22 18:31, David Woodhouse wrote:
From: Joao Martins <joao.m.martins@oracle.com>
This means handling the new exit reason for Xen but still
crashing on purpose. As we implement each of the hypercalls
we will then return the right return code.
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
[dwmw2: Add CPL to hypercall tracing, disallow hypercalls from CPL > 0]
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
---
target/i386/kvm/kvm.c | 5 +++++
target/i386/trace-events | 3 +++
target/i386/xen.c | 45 ++++++++++++++++++++++++++++++++++++++++
target/i386/xen.h | 1 +
4 files changed, 54 insertions(+)
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index 4b21d03250..6396d11f1e 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -5468,6 +5468,11 @@ int kvm_arch_handle_exit(CPUState *cs, struct kvm_run
*run)
assert(run->msr.reason == KVM_MSR_EXIT_REASON_FILTER);
ret = kvm_handle_wrmsr(cpu, run);
break;
+#ifdef CONFIG_XEN
CONFIG_XEN is set when the _host_ has Xen development files available.
IIUC here you want to check if Xen HVM guest support is enabled.
You might want to use a different CONFIG_XEN_xxx key, which itself
depends on CONFIG_XEN.
+ case KVM_EXIT_XEN:
+ ret = kvm_xen_handle_exit(cpu, &run->xen);
+ break;
+#endif
default:
fprintf(stderr, "KVM: unknown exit reason %d\n", run->exit_reason);
ret = -1;
diff --git a/target/i386/xen.h b/target/i386/xen.h
index d4903ecfa1..3537415d31 100644
--- a/target/i386/xen.h
+++ b/target/i386/xen.h
@@ -23,5 +23,6 @@
#define XEN_VERSION(maj, min) ((maj) << 16 | (min))
int kvm_xen_init(KVMState *s, uint32_t xen_version);
+int kvm_xen_handle_exit(X86CPU *cpu, struct kvm_xen_exit *exit);
#endif /* QEMU_I386_XEN_H */
- [RFC PATCH 07/21] xen-platform-pci: register xen-mmio as RAM for XEN_EMULATE, (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é <=
- 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, 2022/12/05