[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v13 49/60] i386/xen: handle HVMOP_get_param
From: |
David Woodhouse |
Subject: |
[PATCH v13 49/60] i386/xen: handle HVMOP_get_param |
Date: |
Thu, 23 Feb 2023 12:46:02 +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 1bb84d8019..ee58cc7376 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 v13 09/60] i386/xen: handle guest hypercalls, (continued)
- [PATCH v13 09/60] i386/xen: handle guest hypercalls, David Woodhouse, 2023/02/23
- [PATCH v13 25/60] i386/xen: implement HVMOP_set_evtchn_upcall_vector, David Woodhouse, 2023/02/23
- [PATCH v13 35/60] hw/xen: Implement EVTCHNOP_alloc_unbound, David Woodhouse, 2023/02/23
- [PATCH v13 45/60] i386/xen: Implement HYPERVISOR_grant_table_op and GNTTABOP_[gs]et_verson, David Woodhouse, 2023/02/23
- [PATCH v13 08/60] xen-platform: allow its creation with XEN_EMULATE mode, David Woodhouse, 2023/02/23
- [PATCH v13 07/60] xen-platform: exclude vfio-pci from the PCI platform unplug, David Woodhouse, 2023/02/23
- [PATCH v13 42/60] kvm/i386: Add xen-gnttab-max-frames property, David Woodhouse, 2023/02/23
- [PATCH v13 31/60] hw/xen: Implement EVTCHNOP_unmask, David Woodhouse, 2023/02/23
- [PATCH v13 36/60] hw/xen: Implement EVTCHNOP_bind_interdomain, David Woodhouse, 2023/02/23
- [PATCH v13 50/60] hw/xen: Add backend implementation of interdomain event channel support, David Woodhouse, 2023/02/23
- [PATCH v13 49/60] i386/xen: handle HVMOP_get_param,
David Woodhouse <=
- [PATCH v13 34/60] hw/xen: Implement EVTCHNOP_send, David Woodhouse, 2023/02/23
- [PATCH v13 16/60] i386/xen: manage and save/restore Xen guest long_mode setting, David Woodhouse, 2023/02/23
- [PATCH v13 29/60] hw/xen: Implement EVTCHNOP_status, David Woodhouse, 2023/02/23
- [PATCH v13 26/60] i386/xen: implement HVMOP_set_param, David Woodhouse, 2023/02/23
- [PATCH v13 14/60] xen: Permit --xen-domid argument when accel is KVM, David Woodhouse, 2023/02/23
- [PATCH v13 04/60] i386/kvm: Add xen-version KVM accelerator property and init KVM Xen support, David Woodhouse, 2023/02/23
- [PATCH v13 60/60] hw/xen: Subsume xen_be_register_common() into xen_be_init(), David Woodhouse, 2023/02/23
- [PATCH v13 43/60] hw/xen: Add xen_gnttab device for grant table emulation, David Woodhouse, 2023/02/23
- [PATCH v13 21/60] i386/xen: handle VCPUOP_register_vcpu_info, David Woodhouse, 2023/02/23
- [PATCH v13 02/60] xen: add CONFIG_XEN_BUS and CONFIG_XEN_EMU options for Xen emulation, David Woodhouse, 2023/02/23