[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v8 48/58] i386/xen: handle HVMOP_get_param
From: |
David Woodhouse |
Subject: |
[PATCH v8 48/58] i386/xen: handle HVMOP_get_param |
Date: |
Fri, 20 Jan 2023 13:13:33 +0000 |
From: Joao Martins <joao.m.martins@oracle.com>
Which is used to fetch xenstore PFN and port to be used
by the guest. This is preallocated by the toolstack when
guest will just read those and use it straight away.
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
---
target/i386/kvm/xen-emu.c | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/target/i386/kvm/xen-emu.c b/target/i386/kvm/xen-emu.c
index 5346a269a5..2cbad20c6b 100644
--- a/target/i386/kvm/xen-emu.c
+++ b/target/i386/kvm/xen-emu.c
@@ -755,6 +755,42 @@ out:
return true;
}
+static bool handle_get_param(struct kvm_xen_exit *exit, X86CPU *cpu,
+ uint64_t arg)
+{
+ CPUState *cs = CPU(cpu);
+ struct xen_hvm_param hp;
+ int err = 0;
+
+ /* No need for 32/64 compat handling */
+ qemu_build_assert(sizeof(hp) == 16);
+
+ if (kvm_copy_from_gva(cs, arg, &hp, sizeof(hp))) {
+ err = -EFAULT;
+ goto out;
+ }
+
+ if (hp.domid != DOMID_SELF && hp.domid != xen_domid) {
+ err = -ESRCH;
+ goto out;
+ }
+
+ switch (hp.index) {
+ case HVM_PARAM_STORE_PFN:
+ hp.value = XEN_SPECIAL_PFN(XENSTORE);
+ break;
+ default:
+ return false;
+ }
+
+ if (kvm_copy_to_gva(cs, arg, &hp, sizeof(hp))) {
+ err = -EFAULT;
+ }
+out:
+ exit->u.hcall.result = err;
+ return true;
+}
+
static int kvm_xen_hcall_evtchn_upcall_vector(struct kvm_xen_exit *exit,
X86CPU *cpu, uint64_t arg)
{
@@ -799,6 +835,9 @@ static bool kvm_xen_hcall_hvm_op(struct kvm_xen_exit *exit,
X86CPU *cpu,
case HVMOP_set_param:
return handle_set_param(exit, cpu, arg);
+ case HVMOP_get_param:
+ return handle_get_param(exit, cpu, arg);
+
default:
return false;
}
--
2.39.0
- [PATCH v8 47/58] i386/xen: Reserve Xen special pages for console, xenstore rings, (continued)
- [PATCH v8 47/58] i386/xen: Reserve Xen special pages for console, xenstore rings, David Woodhouse, 2023/01/20
- [PATCH v8 32/58] hw/xen: Implement EVTCHNOP_bind_ipi, David Woodhouse, 2023/01/20
- [PATCH v8 43/58] hw/xen: Support mapping grant frames, David Woodhouse, 2023/01/20
- [PATCH v8 55/58] hw/xen: Implement emulated PIRQ hypercall support, David Woodhouse, 2023/01/20
- [PATCH v8 42/58] hw/xen: Add xen_gnttab device for grant table emulation, David Woodhouse, 2023/01/20
- [PATCH v8 11/58] i386/xen: implement HYPERVISOR_sched_op, SCHEDOP_shutdown, David Woodhouse, 2023/01/20
- [PATCH v8 41/58] kvm/i386: Add xen-gnttab-max-frames property, David Woodhouse, 2023/01/20
- [PATCH v8 51/58] hw/xen: Add basic ring handling to xenstore, David Woodhouse, 2023/01/20
- [PATCH v8 26/58] hw/xen: Add xen_evtchn device for event channel emulation, David Woodhouse, 2023/01/20
- [PATCH v8 48/58] i386/xen: handle HVMOP_get_param,
David Woodhouse <=
- [PATCH v8 24/58] i386/xen: implement HVMOP_set_evtchn_upcall_vector, David Woodhouse, 2023/01/20
- [PATCH v8 17/58] i386/xen: implement XENMEM_add_to_physmap_batch, David Woodhouse, 2023/01/20
- [PATCH v8 02/58] xen: add CONFIG_XEN_BUS and CONFIG_XEN_EMU options for Xen emulation, David Woodhouse, 2023/01/20
- [PATCH v8 50/58] hw/xen: Add xen_xenstore device for xenstore emulation, David Woodhouse, 2023/01/20
- [PATCH v8 20/58] i386/xen: handle VCPUOP_register_vcpu_info, David Woodhouse, 2023/01/20