diff options
Diffstat (limited to 'usr/src/uts/i86pc/io/xsvc/xsvc.c')
-rw-r--r-- | usr/src/uts/i86pc/io/xsvc/xsvc.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/usr/src/uts/i86pc/io/xsvc/xsvc.c b/usr/src/uts/i86pc/io/xsvc/xsvc.c index 2b797dc904..1e1939d42c 100644 --- a/usr/src/uts/i86pc/io/xsvc/xsvc.c +++ b/usr/src/uts/i86pc/io/xsvc/xsvc.c @@ -42,6 +42,9 @@ #include <sys/sysmacros.h> #include <sys/ddidevmap.h> #include <sys/avl.h> +#ifdef __xpv +#include <sys/hypervisor.h> +#endif #include <sys/xsvc.h> @@ -828,9 +831,22 @@ xsvc_devmap(dev_t dev, devmap_cookie_t dhp, offset_t off, size_t len, } #endif - pfn = btop(off); +#ifdef __xpv + /* + * we won't allow guest OSes to devmap mfn/pfns. Maybe we'll relax + * this some later when there is a good reason. + */ + if (!DOMAIN_IS_INITDOMAIN(xen_info)) { + return (-1); + } + /* we will always treat this as a foreign MFN */ + pfn = xen_assign_pfn(btop(off)); +#else + pfn = btop(off); +#endif /* always work with whole pages */ + off_align = P2ALIGN(off, PAGESIZE); psize = P2ROUNDUP(off + len, PAGESIZE) - off_align; @@ -866,7 +882,10 @@ xsvc_devmap(dev_t dev, devmap_cookie_t dhp, offset_t off, size_t len, } *maplen = psize; - /* Is this is not memory, go through devmem_setup */ + /* + * If this is not memory (or a foreign MFN in i86xpv), go through + * devmem_setup. + */ } else { if ((err = devmap_devmem_setup(dhp, state->xs_dip, NULL, 0, off_align, psize, PROT_ALL, 0, &xsvc_device_attr)) < 0) { |