Date: Fri, 2 Mar 2018 00:19:01 +0200 From: Andriy Gapon <avg@FreeBSD.org> To: "Rodney W. Grimes" <freebsd-rwg@pdx.rh.CN85.dnsmgr.net>, Ludovit Koren <ludovit.koren@gmail.com> Cc: freebsd-virtualization@freebsd.org Subject: Re: bhyve - windows7 installation Message-ID: <3ab0c15f-afb5-c880-91d1-ba09a5c8bbc9@FreeBSD.org> In-Reply-To: <201803011406.w21E62La025815@pdx.rh.CN85.dnsmgr.net> References: <86efl3j4y5.fsf@gmail.com> <201803011406.w21E62La025815@pdx.rh.CN85.dnsmgr.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On 01/03/2018 16:06, Rodney W. Grimes wrote: > Due to the design of the IOMMU you can only manage IO space in page > (4096 on x86) granually sizes. The device your trying to pass in > has a 1024 byte memory region that is part of a 4096 byte page that > may have other things in it. > > At this time bhyve does not have any way to deal with this, though some > other hypervisors have techniques that make this work. > > I do not have or know of any list of USB controller cards that > have 4k aligned and 4k sized BAR's. I have this local hack for that problem. It comes without any warranty and its use is completely at your own risk. commit 74e0a8d1ae01c7aaabd7d965958b735c7cf18871 Author: Andriy Gapon <avg@icyb.net.ua> Date: Fri Nov 17 20:17:57 2017 +0200 bhyve: allow BAR sizes that are not page aligned by rounding them up This is based on the assumption that drivers won't access the added space. diff --git a/usr.sbin/bhyve/pci_passthru.c b/usr.sbin/bhyve/pci_passthru.c index f314679d912b0..14c1384c6c8f8 100644 --- a/usr.sbin/bhyve/pci_passthru.c +++ b/usr.sbin/bhyve/pci_passthru.c @@ -563,13 +563,20 @@ cfginitbar(struct vmctx *ctx, struct passthru_softc *sc) size = bar.pbi_length; if (bartype != PCIBAR_IO) { - if (((base | size) & PAGE_MASK) != 0) { + if ((base & PAGE_MASK) != 0) { warnx("passthru device %d/%d/%d BAR %d: " - "base %#lx or size %#lx not page aligned\n", + "base %#lx not page aligned\n", sc->psc_sel.pc_bus, sc->psc_sel.pc_dev, - sc->psc_sel.pc_func, i, base, size); + sc->psc_sel.pc_func, i, base); return (-1); } + if ((size & PAGE_MASK) != 0) { + warnx("passthru device %d/%d/%d BAR %d: " + "size %#lx not page aligned\n", + sc->psc_sel.pc_bus, sc->psc_sel.pc_dev, + sc->psc_sel.pc_func, i, size); + size = round_page(size); + } } /* Cache information about the "real" BAR */ -- Andriy Gapon
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3ab0c15f-afb5-c880-91d1-ba09a5c8bbc9>