From nobody Tue Jan 9 16:47:44 2024 X-Original-To: dev-commits-src-all@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 4T8cL83Cqqz55rxF; Tue, 9 Jan 2024 16:47:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4T8cL82VQ5z4Ccs; Tue, 9 Jan 2024 16:47:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704818864; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8t9x56yqE3Zp7BDGnUTLmIXZydxf+uLeoIeUSL6ni5Y=; b=ibEogFFtViXnwesAq11D/S81s7ljSD4P/BqAYYed4i/9Us56UhFkugM+aq5AN/fElAE6rD mw+gLFW2Kd8Mtb4viB0MopUrzoor904fwYvhnZqqyNN1C99FsDyYtpQXVqTkb9juZZB21Y gouXh3puh3P9iH03b9H9K95jx7fw8gcFYPG57N0MdSBek0VZvVyGVVwLL4mVr/+VgTUEBV TBQ9MT7t8puOSgAFfPh/Xc47fYShLTFcHN1JxRRlZha1UbTY9q935chmp+PgNv3FZtSBlW 6wtE6bzBniUcizaJq7PBB8y5AuQFxsrhPaPTY+io245Deq8u6nBRiiztwxD9WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704818864; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8t9x56yqE3Zp7BDGnUTLmIXZydxf+uLeoIeUSL6ni5Y=; b=imYpkVDN0KfarrGJ303NQFkWCuVYiItJretzvupuY+Ih55aUdqER9RB32hF6zKOKUipw7Y jfEBqc0eulq8tgof9/QE3nTSL/9QgghNpk3K5/jp0A4KPgWK7KHE/jDAIO+V+fokf61cSD 2v/8t4z+V9OJ36XMYJ21nrEO1+x8697gJjGJqwL4U4hhivITApxEBQrCnbiPW7BOEF58kk 8JcPDxRlDrd74OFFycl5vagHGl3rRx0ASsqDSj3sNYgQgPdGZldG5oIE8no7iqesbf6Jt7 g0EX5RmE/HKNOJkj8ec5NyevAbcXswgaKYta3DYEPGKQN/B68zoCXpNafC1qNg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704818864; a=rsa-sha256; cv=none; b=qlaDsDITaTUSGlWYyTyBFxYnXYWGFMN2I+LO87hOh6bnsP9Btf/a2JE2GKJitpkCAvzRhN zaH3LdOrDdSsN37W79uZx1WvLJa1VdlO7UlkdO14dH3560Zau1BQwl0fKEIa/agfJbzAH6 f1DHiorTOC6hx0ft71+QZmwWz55F9Xe/F3jPpf+kbVaIjDU4JdBdq5kNCZ4rdU4yp3GSFW sO2WOLyW3A1uleY2NqaX3AObHSGlXszz/NENQKRJOBwa3+8m4vK0OT7ZWPTbUsNuDRczax P89xYb/CINIX/rNBX1+4AQeTQIcXPtUU3vcCopMk9YdpDTIXxc5DRi+KXtvC1Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4T8cL81Zvjzxyg; Tue, 9 Jan 2024 16:47:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 409Gli9D061872; Tue, 9 Jan 2024 16:47:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 409GliOi061869; Tue, 9 Jan 2024 16:47:44 GMT (envelope-from git) Date: Tue, 9 Jan 2024 16:47:44 GMT Message-Id: <202401091647.409GliOi061869@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Christos Margiolis Subject: git: a00a507e2d5f - stable/13 - vmrun.sh: allow device name arguments in pci-passthru option List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a00a507e2d5f4f5de7e7bbafc6df419a1565da24 Auto-Submitted: auto-generated The branch stable/13 has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=a00a507e2d5f4f5de7e7bbafc6df419a1565da24 commit a00a507e2d5f4f5de7e7bbafc6df419a1565da24 Author: Christos Margiolis AuthorDate: 2024-01-02 18:20:42 +0000 Commit: Christos Margiolis CommitDate: 2024-01-09 16:47:36 +0000 vmrun.sh: allow device name arguments in pci-passthru option This is more intuitive than having to run `pciconf -l` and figure out the bus/slot/func entry manually. Reviewed by: markj Sponsored by; The FreeBSD Foundation MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43270 (cherry picked from commit 2ee77056d2d4f9d43bd316ce6dc91bf5e4b0848b) --- share/examples/bhyve/vmrun.sh | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/share/examples/bhyve/vmrun.sh b/share/examples/bhyve/vmrun.sh index d2cc371e472f..323d8e22a041 100755 --- a/share/examples/bhyve/vmrun.sh +++ b/share/examples/bhyve/vmrun.sh @@ -62,7 +62,7 @@ usage() { echo " [-L ]" echo " [-m ]" \ "[-n ]" - echo " [-p ]" + echo " [-p ]" echo " [-P ] [-t ] " echo "" echo " -h: display this help message" @@ -87,8 +87,8 @@ usage() { echo " -m: memory size (default: ${DEFAULT_MEMSIZE})" echo " -n: network adapter emulation type" \ "(default: ${DEFAULT_NIC})" - echo " -p: pass-through a host PCI device at bus/slot/func" \ - "(e.g. 10/0/0)" + echo " -p: pass-through a host PCI device (e.g ppt0 or" \ + "bus/slot/func)" echo " -P: UEFI GOP VNC port (default: ${DEFAULT_VNCPORT})" echo " -t: tap device for virtio-net (default: $DEFAULT_TAPDEV)" echo " -T: Enable tablet device (for UEFI GOP)" @@ -351,10 +351,21 @@ while [ 1 ]; do i=0 while [ $i -lt $pass_total ] ; do - eval "pass=\$pass_dev${i}" - devargs="$devargs -s $nextslot:0,passthru,${pass} " - nextslot=$(($nextslot + 1)) - i=$(($i + 1)) + eval "pass=\$pass_dev${i}" + bsfform="$(echo "${pass}" | grep "^[0-9]\+/[0-9]\+/[0-9]\+$")" + if [ -z "${bsfform}" ]; then + bsf="$(pciconf -l "${pass}" 2>/dev/null)" + if [ $? -ne 0 ]; then + errmsg "${pass} is not a host PCI device" + exit 1 + fi + bsf="$(echo "${bsf}" | awk -F: '{print $2"/"$3"/"$4}')" + else + bsf="${pass}" + fi + devargs="$devargs -s $nextslot:0,passthru,${bsf} " + nextslot=$(($nextslot + 1)) + i=$(($i + 1)) done efiargs=""