From nobody Fri Nov 7 15:34:41 2025 X-Original-To: freebsd-virtualization@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4d335b4qgKz6G5VZ for ; Fri, 07 Nov 2025 15:34:43 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4d335b45WWz3T5n; Fri, 07 Nov 2025 15:34:43 +0000 (UTC) (envelope-from scf@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1762529683; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2Oas8iLOlWBUIKviDgz3p74cokXvP+PGNqyDRrNQkJ4=; b=RUBdpR8iqGZiDClsoPqVYlxPRWljceB7bsPwQAL+LjUWFldcyDOZRSLAFidA5+6syEUtz3 pspbp+Eout9FdCDvnPM0lmi0sr+zj9bw0qhPQzMlGUFrVW3R7+8T8QJulUbBQrYZO30dlv aSs/30LDYR0uk3MlfeFkEUX69rIcLttYeGASC5XyQXiC34GMpTS5YOngQeCD8f8tivpvzw aQw0vZ0PDL8BdzcdRwb/S7AlkVFRPirBOpr6tc1XQsuH65jtGqpuswC1jXJWIaHAwgp1ZK hrk3PG3QVJ7iSrO/ZLL08pCsjvZd3zPGHA0q2F2jR0tR814c7e/mXgXQxugP0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1762529683; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=2Oas8iLOlWBUIKviDgz3p74cokXvP+PGNqyDRrNQkJ4=; b=k83yfmTf01G+D6l+c5xcmUjz/jGAoy5TEQGSwy6wGbqtez28AavoBG9fznOKt1tfsTuX8x c2i23blt4Y5YZ/7xfWskFSg7+ddZH724pz2UU9MkaRKyO1aNXWQJxqiMaOVDJdZbfaybw0 YSkgiyQXWCAQBo1Hf5zGkWkRv2PNWw2fh1jyDTZ0G0OxKvBaBzv8rlrN01umb6IwfHofvM 2oVj7mAGnUmJUtclkgBjR729Bohiip7UxoDfv+5k+uKBw45cnWMIU/n2h1eiyZvXFCX7sx Kqur5Kkm1BXdCZVznD6k2L9roIuE5UWjtQdY+o957DyK1msiUjzqw/pjUioxnQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1762529683; a=rsa-sha256; cv=none; b=aPMFQLtL51PSA1XGfk5+i/hl8vL5dftRT8wjZHFLdYwDAJkBn8GGBSmHOwNSSNxuhlNKK3 kwukxHeIDlAWVL1E5TsHlxE36AbEthviEmZwJsteEuD7pYQzzwvHxUSR7n1NvySM99RCWd xJhtHtMnVAunl+7tHXcLFCPS3l3CYdeK9CNl6ToMOG39oK2HMywg1GUVqidZ+KSCoy05jE ogp2XwwUhAkTBVHebR4VLk1FLQ56Rh0jnhhES0pTsQG2qWlptIIwaAxwvKLjrrGeUa3KC2 E1a8Vp/TPCB7MeVkpTigBnwh1+u+hsgZc7GlhSR+a9lpdVBrLNnEWYzopO4RlQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from farley.org (farley.org [104.129.130.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature ECDSA (prime256v1) client-digest SHA256) (Client CN "mail.farley.org", Issuer "Farley.org Intermediate CA" (not verified)) (Authenticated sender: scf/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4d335b2LRWz3hR; Fri, 07 Nov 2025 15:34:43 +0000 (UTC) (envelope-from scf@FreeBSD.org) Received: from thor.farley.org (thor.farley.org [192.168.1.5]) by farley.org (8.18.1/8.18.1) with ESMTPS id 5A7FYf1v031000 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Fri, 7 Nov 2025 10:34:41 -0500 (EST) (envelope-from scf@FreeBSD.org) Date: Fri, 7 Nov 2025 10:34:41 -0500 (EST) From: "Sean C. Farley" To: Mark Johnston cc: freebsd-virtualization@freebsd.org Subject: Re: bhyve command-line option order In-Reply-To: Message-ID: <68ef3bf0-22f8-7e23-4ec8-4e405b5e6daf@FreeBSD.org> References: <385a62cf-22ad-c1ed-13fe-1ac8c7ab1408@FreeBSD.org> List-Id: Discussion List-Archive: https://lists.freebsd.org/archives/freebsd-virtualization List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: freebsd-virtualization@freebsd.org Sender: owner-freebsd-virtualization@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Spam-Status: No, score=-1.0 required=4.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=4.0.2 X-Spam-Checker-Version: SpamAssassin 4.0.2 (2025-08-27) on mail.farley.org On Tue, 28 Oct 2025, Mark Johnston wrote: > 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. That is what I suspected from glancing at the bhyve code. I will just align my PR to work with the current bhyve behavior, which will not cause any problems whether the behavior changes later or not. Thank you. Sean 1. https://github.com/freebsd/vm-bhyve/pull/56 -- scf@FreeBSD.org