[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v5 49/52] i386/xen: handle HVMOP_get_param
From: |
David Woodhouse |
Subject: |
[RFC PATCH v5 49/52] i386/xen: handle HVMOP_get_param |
Date: |
Fri, 30 Dec 2022 12:12:32 +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 83ab96724e..08db4c0d9b 100644
--- a/target/i386/kvm/xen-emu.c
+++ b/target/i386/kvm/xen-emu.c
@@ -707,6 +707,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)
{
@@ -751,6 +787,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.35.3
- [RFC PATCH v5 32/52] hw/xen: Implement EVTCHNOP_bind_virq, (continued)
- [RFC PATCH v5 32/52] hw/xen: Implement EVTCHNOP_bind_virq, David Woodhouse, 2022/12/30
- [RFC PATCH v5 28/52] i386/xen: Add support for Xen event channel delivery to vCPU, David Woodhouse, 2022/12/30
- [RFC PATCH v5 14/52] hw/xen: Add xen_overlay device for emulating shared xenheap pages, David Woodhouse, 2022/12/30
- [RFC PATCH v5 17/52] i386/xen: implement HYPERVISOR_memory_op, David Woodhouse, 2022/12/30
- [RFC PATCH v5 23/52] i386/xen: handle VCPUOP_register_runstate_memory_area, David Woodhouse, 2022/12/30
- [RFC PATCH v5 24/52] i386/xen: implement HYPERVISOR_event_channel_op, David Woodhouse, 2022/12/30
- [RFC PATCH v5 35/52] hw/xen: Implement EVTCHNOP_alloc_unbound, David Woodhouse, 2022/12/30
- [RFC PATCH v5 16/52] i386/xen: manage and save/restore Xen guest long_mode setting, David Woodhouse, 2022/12/30
- [RFC PATCH v5 26/52] i386/xen: implement HVMOP_set_param, David Woodhouse, 2022/12/30
- [RFC PATCH v5 41/52] hw/xen: Support HVM_PARAM_CALLBACK_TYPE_PCI_INTX callback, David Woodhouse, 2022/12/30
- [RFC PATCH v5 49/52] i386/xen: handle HVMOP_get_param,
David Woodhouse <=
- [RFC PATCH v5 09/52] hw/xen_backend: refactor xen_be_init(), David Woodhouse, 2022/12/30
- [RFC PATCH v5 05/52] i386/kvm: handle Xen HVM cpuid leaves, David Woodhouse, 2022/12/30
- [RFC PATCH v5 31/52] hw/xen: Implement EVTCHNOP_unmask, David Woodhouse, 2022/12/30
- [RFC PATCH v5 07/52] xen-platform: exclude vfio-pci from the PCI platform unplug, David Woodhouse, 2022/12/30
- [RFC PATCH v5 40/52] hw/xen: Support HVM_PARAM_CALLBACK_TYPE_GSI callback, David Woodhouse, 2022/12/30
- [RFC PATCH v5 22/52] i386/xen: handle VCPUOP_register_vcpu_time_info, David Woodhouse, 2022/12/30
- [RFC PATCH v5 45/52] i386/xen: Implement HYPERVISOR_grant_table_op and GNTTABOP_[gs]et_verson, David Woodhouse, 2022/12/30
- [RFC PATCH v5 33/52] hw/xen: Implement EVTCHNOP_bind_ipi, David Woodhouse, 2022/12/30
- [RFC PATCH v5 47/52] i386/xen: handle PV timer hypercalls, David Woodhouse, 2022/12/30
- [RFC PATCH v5 04/52] i386/kvm: Add xen-version KVM accelerator property and init KVM Xen support, David Woodhouse, 2022/12/30