On Saturday, December 12, 2015 02:04:17 PM G. Amanakis via
> #define PCIM_BAR_MEM_BASE 0xfffffffffffffff0ULL
> #define PCIM_BAR_MEM_BASE 0xfffffffffffff000ULL
> sys/dev/PCI/pcireg.h makes the min size of a memory BAR equal to 0x1000 or
> 4096 bytes and it lets me passthrough the device. Any objections to this
This constant defines the spec as implemented in hardware. You will break
real hardware on bare metal if you make this change. As Neel notes, this is
hard to fix properly. The proper fix is to modify the ppt(4) driver so that
it asks the PCI bus to allocate a full page for BARs that are smaller than a
page. Unfortunately the PCI bus driver doesn't currently provide a way to do
that. Even if it did it would not necessarily always work since the device
may be behind a PCI-PCI bridge whose windows can't grow due to existing
allocations of adjacent addresses. Alternatively the hypervisor could trap
all accesses to this page and only permit accesses to the range that contains
the BAR, but that would be quite slow.
> On December 2, 2015 11:54:03 PM GMT+01:00, Neel Natu <neeln...@gmail.com>
> >On Wed, Dec 2, 2015 at 3:13 AM, G. Amanakis via freebsd-virtualization
> ><firstname.lastname@example.org> wrote:
> >> I am facing the following problem:
> >> on a X9SCM with an E3-1220Lv2 I am trying to passthrough the
> >onboard usb controllers. I disable the usb module from the kernel
> >config and using pptdev the controllers are assigned to ppt devices.
> >However running bhyve on FreeBSD 10.2 with:
> >> sudo bhyve -AI -H -P -s 0:0,hostbridge -s 1:0,lpc -s
> >2:0,virtio-net,tap0 -s 3:0,virtio-blk,./linux.img -s
> >4:0,passthru,0/29/0 -l com1,stdio -c 2 -m 2048M linuxguest
> >> returns :
> >> passthru device 0/29/0 BAR 0: base 0xdf823000 or size 0x400 not
> >page aligned
> >> The problem probably that the length of the bar is smaller and not
> >aligned with the pagesize. Could the length of the BAR be modified in
> >order to perform the pci passthrough?
> >Yes, that's correct - the size of the BAR is not a multiple of the
> >page size which leads to the error. If this BAR is mapped into the
> >guest's address space then it will "leak" an additional 3K into the
> >guest (since the minimum nested mapping is 4KB in size).
> >It is hard to fix this in the general case if you want to truly
> >passthrough the BAR to the guest.
> >> --
> >> Sent from my Android device with K-9 Mail. Please excuse my brevity.
> >> _______________________________________________
> >> email@example.com mailing list
> >> https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
> >> To unsubscribe, send any mail to
firstname.lastname@example.org mailing list
To unsubscribe, send any mail to