Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Oct 2025 11:58:01 -0400
From:      Mark Johnston <markj@freebsd.org>
To:        "Sean C. Farley" <scf@freebsd.org>
Cc:        freebsd-virtualization@freebsd.org
Subject:   Re: bhyve command-line option order
Message-ID:  <aQDoCeWY4FWhmrln@nuc>
In-Reply-To: <385a62cf-22ad-c1ed-13fe-1ac8c7ab1408@FreeBSD.org>
References:  <385a62cf-22ad-c1ed-13fe-1ac8c7ab1408@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On Thu, Oct 23, 2025 at 10:00:42PM -0400, Sean C. Farley wrote:
> I wrote a change to vm-bhyve[1] to be able to pass the options to bhyve in
> the correct order to use GPU passthru.  In the incorrect order, bhyve will
> return an error.  The question was raised:  Is it expected that bhyve will
> return an error depending upon the order of command-line arguments, or
> should it be handling this scenario?
> 
> The issue is when "-s 31, lpc" is presented to bhyve.  If it is passed prior
> to "-o pci.0.31.0.pcireg.vendor=host", then there is no error. However, if
> it is in the opposite order, this is returned:
> 
> $ bhyve ... -o pci.0.31.0.pcireg.vendor=host -s 31,lpc ...
> pci slot 0:31:0 already occupied!
> 
> I will be updating my PR to make things a bit easier regardless of the
> answer, but it would be nice to know if this is intended or not.

I don't really think it's intended, it's just an artifact of the way
option handling is implemented.  The -s option creates a PCI device and
raises an error if one already exists in the configuration tree.  The -o
option adds arbitrary configuration nodes and silently overwrites
existing nodes.

One solution which allows both orders would be to process -o options
after everything else.  It's hard to say whether that might break some
existing command-line invocations though.

One other option would be to make -s more permissive, but that would
make it easier to flub command-line invocations. 

> 
> Thank you.
> 
> Sean
>   1. https://github.com/freebsd/vm-bhyve/pull/56
> -- 
> scf@FreeBSD.org
> 



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