Re: bhyve passthru problem

From: Corvin Köhne <corvink_at_FreeBSD.org>
Date: Mon, 17 Jun 2024 06:21:24 UTC
On Fri, 2024-06-14 at 17:50 +1000, Peter Grehan wrote:
> > I don't know why bhyve validates the BAR size. The commit adding
> > this
> > check is old [1] and doesn't explain it. What bhyve could do is
> > rounding up the BAR size to a full page size when allocating memory
> > for
> > the BAR.
> > 
> > [1] https://github.com/freebsd/freebsd-
> > src/commit/7a902ec0eccc752c9c38533ed123121eaaea1225
> 
>   At the time, BIOSs would often place device BARs of less than a
> page 
> size in the same physical page. Since EPT only gives page
> granularity, 
> this would result in all those devices being available to the guest
> even 
> if they hadn't been passed through.
> 
> later,
> 
> Peter.
> 
> 

Thanks for the explanation!

What can we do about it? Does FreeBSD remaps BARs if they aren't page
aligned? If not, can we verify that the page is only used by a specific
device?


-- 
Kind regards,
Corvin