bhyve - windows7 installation

Rodney W. Grimes freebsd-rwg at pdx.rh.CN85.dnsmgr.net
Fri Mar 2 15:11:33 UTC 2018


> >>>>> Andriy Gapon <avg at FreeBSD.org> writes:
> 
>     > 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.
> 
> Thank you. I will try it.

Andriy,
Thanks for providing this patch, I tried to find the repository
it is in with google and did not, is this a private repository?

Either way would it be ok with you if I published, with attribution
of cource, your patch first from my people.freebsd.org/~rgrimes#bhyve
page, and possibly later from a wiki page?  I'll properly dress it
in "this has security implications" and enumerate what those are.

Thanks,

> lk
> 
>     > commit 74e0a8d1ae01c7aaabd7d965958b735c7cf18871
>     > Author: Andriy Gapon <avg at 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
> 
> 
> -- 
> A: Because it fouls the order in which people normally read text.
> Q: Why is top-posting such a bad thing?

Sorry for the middle posting :-)

> A: Top-posting.
> Q: What is the most annoying thing on usenet and in e-mail? 

-- 
Rod Grimes                                                 rgrimes at freebsd.org


More information about the freebsd-virtualization mailing list