[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v12 49/60] i386/xen: handle HVMOP_get_param
From: |
David Woodhouse |
Subject: |
[PATCH v12 49/60] i386/xen: handle HVMOP_get_param |
Date: |
Mon, 20 Feb 2023 20:47:25 +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>
Reviewed-by: Paul Durrant <paul@xen.org>
---
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 7adb506692..6e23a277df 100644
--- a/target/i386/kvm/xen-emu.c
+++ b/target/i386/kvm/xen-emu.c
@@ -762,6 +762,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)
{
@@ -806,6 +842,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 v12 54/60] i386/xen: Implement HYPERVISOR_physdev_op, (continued)
- [PATCH v12 54/60] i386/xen: Implement HYPERVISOR_physdev_op, David Woodhouse, 2023/02/20
- [PATCH v12 31/60] hw/xen: Implement EVTCHNOP_unmask, David Woodhouse, 2023/02/20
- [PATCH v12 40/60] hw/xen: Support HVM_PARAM_CALLBACK_TYPE_GSI callback, David Woodhouse, 2023/02/20
- [PATCH v12 46/60] hw/xen: Implement GNTTABOP_query_size, David Woodhouse, 2023/02/20
- [PATCH v12 28/60] i386/xen: Add support for Xen event channel delivery to vCPU, David Woodhouse, 2023/02/20
- [PATCH v12 57/60] hw/xen: Support MSI mapping to PIRQ, David Woodhouse, 2023/02/20
- [PATCH v12 30/60] hw/xen: Implement EVTCHNOP_close, David Woodhouse, 2023/02/20
- [PATCH v12 26/60] i386/xen: implement HVMOP_set_param, David Woodhouse, 2023/02/20
- [PATCH v12 29/60] hw/xen: Implement EVTCHNOP_status, David Woodhouse, 2023/02/20
- [PATCH v12 23/60] i386/xen: handle VCPUOP_register_runstate_memory_area, David Woodhouse, 2023/02/20
- [PATCH v12 49/60] i386/xen: handle HVMOP_get_param,
David Woodhouse <=
- [PATCH v12 48/60] i386/xen: Reserve Xen special pages for console, xenstore rings, David Woodhouse, 2023/02/20
- [PATCH v12 11/60] i386/xen: implement HYPERVISOR_sched_op, SCHEDOP_shutdown, David Woodhouse, 2023/02/20
- [PATCH v12 14/60] xen: Permit --xen-domid argument when accel is KVM, David Woodhouse, 2023/02/20
- [PATCH v12 34/60] hw/xen: Implement EVTCHNOP_send, David Woodhouse, 2023/02/20
- [PATCH v12 52/60] hw/xen: Add basic ring handling to xenstore, David Woodhouse, 2023/02/20
- [PATCH v12 33/60] hw/xen: Implement EVTCHNOP_bind_ipi, David Woodhouse, 2023/02/20
- [PATCH v12 04/60] i386/kvm: Add xen-version KVM accelerator property and init KVM Xen support, David Woodhouse, 2023/02/20
- [PATCH v12 19/60] i386/xen: implement HYPERVISOR_hvm_op, David Woodhouse, 2023/02/20
- [PATCH v12 15/60] i386/xen: add pc_machine_kvm_type to initialize XEN_EMULATE mode, David Woodhouse, 2023/02/20
- [PATCH v12 25/60] i386/xen: implement HVMOP_set_evtchn_upcall_vector, David Woodhouse, 2023/02/20