Hi,
The patch below fakes pv drivers installation.
Version numbers are taken from FreeBSD sysutils/xe-guest-utilities.
With this xen allows reboot or shutdown OpenBSD guest.
Index: sys/dev/pv/xen.c
===================================================================
RCS file: /cvs/src/sys/dev/pv/xen.c,v
retrieving revision 1.71
diff -u -p -u -r1.71 xen.c
--- sys/dev/pv/xen.c 10 Jan 2017 17:16:39 -0000 1.71
+++ sys/dev/pv/xen.c 18 Jan 2017 18:05:27 -0000
@@ -35,6 +35,7 @@
#include <sys/signalvar.h>
#include <sys/malloc.h>
#include <sys/kernel.h>
+#include <sys/systm.h>
#include <sys/stdint.h>
#include <sys/device.h>
#include <sys/task.h>
@@ -75,6 +76,7 @@ void xen_disable_emulated_devices(struct
int xen_match(struct device *, void *, void *);
void xen_attach(struct device *, struct device *, void *);
void xen_deferred(struct device *);
+void xen_inform_host(struct xen_softc *);
void xen_control(void *);
void xen_hotplug(void *);
void xen_resume(struct device *);
@@ -194,6 +196,29 @@ xen_deferred(struct device *self)
xen_control, sc))
printf("%s: failed to setup shutdown control watch\n",
sc->sc_dev.dv_xname);
+ xen_inform_host(sc);
+}
+void
+xen_inform_host(struct xen_softc *sc)
+{
+ char *os_name;
+
+ /* Fake PV drivers version */
+ xs_setnum(sc, "attr/PVAddons", "MajorVersion", 6);
+ xs_setnum(sc, "attr/PVAddons", "MinorVersion", 2);
+ xs_setnum(sc, "attr/PVAddons", "MicroVersion", 0);
+ xs_setnum(sc, "attr/PVAddons", "BuildVersion", 76888);
+ xs_setnum(sc, "attr/PVAddons", "Installed", 1);
+
+ /* Set OS version */
+ snprintf(os_name, sizeof((char *)ostype) + sizeof((char *)osrelease),
+ "%s %s", ostype, osrelease);
+ xs_setprop(sc, "data", "os_name", (char *)os_name, strlen(os_name));
+ xs_setprop(sc, "data", "os_uname", (char *)osrelease,
strlen(osrelease));
+ xs_setprop(sc, "data", "os_distro", (char *)ostype, strlen(ostype));
+
+ /* Update xenstore */
+ xs_setnum(sc, "data", "updated", 1);
}
void