diff options
author | 2015-12-08 20:07:04 +0000 | |
---|---|---|
committer | 2015-12-08 20:07:04 +0000 | |
commit | a72ee3f4d4a1afd58d91eb522bb2c3eff2ca9bef (patch) | |
tree | 5f790affde3e43758b49af08a6e1084948921296 /sys/dev/pv | |
parent | Set up an IDT vector for Xen callbacks (diff) | |
download | wireguard-openbsd-a72ee3f4d4a1afd58d91eb522bb2c3eff2ca9bef.tar.xz wireguard-openbsd-a72ee3f4d4a1afd58d91eb522bb2c3eff2ca9bef.zip |
Communicate the selected IDT vector to the Hypervisor
OK mlarkin, reyk
Diffstat (limited to 'sys/dev/pv')
-rw-r--r-- | sys/dev/pv/xen.c | 34 | ||||
-rw-r--r-- | sys/dev/pv/xenvar.h | 2 |
2 files changed, 36 insertions, 0 deletions
diff --git a/sys/dev/pv/xen.c b/sys/dev/pv/xen.c index cfa68c61dca..3a4e75f7012 100644 --- a/sys/dev/pv/xen.c +++ b/sys/dev/pv/xen.c @@ -27,6 +27,8 @@ #include <uvm/uvm_extern.h> +#include <machine/i82489var.h> + #include <dev/pv/pvvar.h> #include <dev/pv/xenreg.h> #include <dev/pv/xenvar.h> @@ -37,6 +39,7 @@ int xen_init_hypercall(struct xen_softc *); int xen_getversion(struct xen_softc *); int xen_getfeatures(struct xen_softc *); int xen_init_info_page(struct xen_softc *); +int xen_init_cbvec(struct xen_softc *); int xen_match(struct device *, void *, void *); void xen_attach(struct device *, struct device *, void *); @@ -87,6 +90,8 @@ xen_attach(struct device *parent, struct device *self, void *aux) if (xen_init_info_page(sc)) return; + + xen_init_cbvec(sc); } void @@ -399,3 +404,32 @@ xen_init_info_page(struct xen_softc *sc) sc->sc_ipg, pa); return (0); } + +int +xen_init_cbvec(struct xen_softc *sc) +{ + struct xen_hvm_param xhp; + + if ((sc->sc_features & XENFEAT_CBVEC) == 0) + return (ENOENT); + + xhp.domid = DOMID_SELF; + xhp.index = HVM_PARAM_CALLBACK_IRQ; + xhp.value = HVM_CALLBACK_VECTOR(LAPIC_XEN_VECTOR); + if (xen_hypercall(sc, hvm_op, 2, HVMOP_set_param, &xhp)) { + /* Will retry with the xspd(4) PCI interrupt */ + return (ENOENT); + } + DPRINTF("%s: registered callback IDT vector %d\n", + sc->sc_dev.dv_xname, LAPIC_XEN_VECTOR); + + sc->sc_cbvec = 1; + + return (0); +} + +void +xen_intr(void) +{ + /* stub */ +} diff --git a/sys/dev/pv/xenvar.h b/sys/dev/pv/xenvar.h index b5db26dbbc5..7c5d2446b3f 100644 --- a/sys/dev/pv/xenvar.h +++ b/sys/dev/pv/xenvar.h @@ -33,6 +33,8 @@ struct xen_softc { #define XENFEAT_CBVEC (1<<8) struct shared_info *sc_ipg; /* HYPERVISOR_shared_info */ + + int sc_cbvec; /* callback was installed */ }; extern struct xen_softc *xen_sc; |