hw/xen: Add xen_xenstore device for xenstore emulation

Just the basic shell, with the event channel hookup. It only dumps the
buffer for now; a real ring implmentation will come in a subsequent patch.

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Paul Durrant <paul@xen.org>
This commit is contained in:
David Woodhouse 2022-12-23 17:39:23 +00:00
parent 794fba23a5
commit c08f5d0e53
6 changed files with 288 additions and 0 deletions

View file

@ -27,6 +27,7 @@
#include "hw/i386/kvm/xen_overlay.h"
#include "hw/i386/kvm/xen_evtchn.h"
#include "hw/i386/kvm/xen_gnttab.h"
#include "hw/i386/kvm/xen_xenstore.h"
#include "hw/xen/interface/version.h"
#include "hw/xen/interface/sched.h"
@ -179,6 +180,9 @@ int kvm_xen_init(KVMState *s, uint32_t hypercall_msr)
return ret;
}
/* The page couldn't be overlaid until KVM was initialized */
xen_xenstore_reset();
return 0;
}
@ -789,6 +793,9 @@ static bool handle_get_param(struct kvm_xen_exit *exit, X86CPU *cpu,
case HVM_PARAM_STORE_PFN:
hp.value = XEN_SPECIAL_PFN(XENSTORE);
break;
case HVM_PARAM_STORE_EVTCHN:
hp.value = xen_xenstore_get_port();
break;
default:
return false;
}
@ -1383,6 +1390,11 @@ int kvm_xen_soft_reset(void)
return err;
}
err = xen_xenstore_reset();
if (err) {
return err;
}
return 0;
}