Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 02 Mar 2018 20:01:55 +0100
From:      Ludovit Koren <ludovit.koren@gmail.com>
To:        Andriy Gapon <avg@FreeBSD.org>
Cc:        "Rodney W. Grimes" <freebsd-rwg@pdx.rh.CN85.dnsmgr.net>, freebsd-virtualization@freebsd.org
Subject:   Re: bhyve - windows7 installation
Message-ID:  <86h8py1eu4.fsf@gmail.com>
In-Reply-To: <3ab0c15f-afb5-c880-91d1-ba09a5c8bbc9@FreeBSD.org> (Andriy Gapon's message of "Fri, 2 Mar 2018 00:19:01 %2B0200")
References:  <86efl3j4y5.fsf@gmail.com> <201803011406.w21E62La025815@pdx.rh.CN85.dnsmgr.net> <3ab0c15f-afb5-c880-91d1-ba09a5c8bbc9@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
>>>>> Andriy Gapon <avg@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.

    > 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 */

Hi,

I applied the patch and I got the following error for usb in windows:

This device cannot find enough free resources that it can use. (Code 12)

If you want to use this device, you will need to disable one of the other devices on this system.


I don't know how to proceed....

thanks

regards,

lk



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86h8py1eu4.fsf>