BAR and pci passthrough

G. Amanakis g_amanakis at yahoo.com
Sat Dec 12 13:06:15 UTC 2015


Changing
#define	PCIM_BAR_MEM_BASE	0xfffffffffffffff0ULL
to
#define	PCIM_BAR_MEM_BASE	0xfffffffffffff000ULL
in
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 strategy?

On December 2, 2015 11:54:03 PM GMT+01:00, Neel Natu <neelnatu at gmail.com> wrote:
>On Wed, Dec 2, 2015 at 3:13 AM, G. Amanakis via freebsd-virtualization
><freebsd-virtualization at freebsd.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.
>
>best
>Neel
>
>> --
>> Sent from my Android device with K-9 Mail. Please excuse my brevity.
>> _______________________________________________
>> freebsd-virtualization at freebsd.org mailing list
>> https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
>> To unsubscribe, send any mail to
>"freebsd-virtualization-unsubscribe at freebsd.org"

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.


More information about the freebsd-virtualization mailing list