aboutsummaryrefslogtreecommitdiff
path: root/target/i386
diff options
context:
space:
mode:
authorJoao Martins <joao.m.martins@oracle.com>2018-09-28 13:17:47 -0400
committerDavid Woodhouse <dwmw@amazon.co.uk>2023-03-01 09:07:52 +0000
commitc6623cc3e785b806c6175c3e85a0ee4d6db4f7d4 (patch)
tree34e4b4c3cb26bdb94aec828d3b7ae057c5c5be5d /target/i386
parent8b57d5c523f8f1a650188ffa58939e1c5aaa6254 (diff)
downloadqemu-c6623cc3e785b806c6175c3e85a0ee4d6db4f7d4.zip
qemu-c6623cc3e785b806c6175c3e85a0ee4d6db4f7d4.tar.gz
qemu-c6623cc3e785b806c6175c3e85a0ee4d6db4f7d4.tar.bz2
i386/xen: handle HVMOP_get_param
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>
Diffstat (limited to 'target/i386')
-rw-r--r--target/i386/kvm/xen-emu.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/target/i386/kvm/xen-emu.c b/target/i386/kvm/xen-emu.c
index 75bcf7b..d2c88ef 100644
--- a/target/i386/kvm/xen-emu.c
+++ b/target/i386/kvm/xen-emu.c
@@ -765,6 +765,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)
{
@@ -809,6 +845,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;
}