From nobody Mon Nov 22 15:30:30 2021 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 781E01890305; Mon, 22 Nov 2021 15:30:31 +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 4HyWS72Kjlz4rBF; Mon, 22 Nov 2021 15:30:31 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 0D4512522F; Mon, 22 Nov 2021 15:30:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1AMFUUbJ079856; Mon, 22 Nov 2021 15:30:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AMFUUJn079855; Mon, 22 Nov 2021 15:30:30 GMT (envelope-from git) Date: Mon, 22 Nov 2021 15:30:30 GMT Message-Id: <202111221530.1AMFUUJn079855@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 2eb2079554f4 - main - bhyve: keep physical and virtual COMMAND reg in sync 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: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2eb2079554f4d54c4283410b4ee1aca549b29616 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=2eb2079554f4d54c4283410b4ee1aca549b29616 commit 2eb2079554f4d54c4283410b4ee1aca549b29616 Author: Corvin Köhne AuthorDate: 2021-11-22 15:26:03 +0000 Commit: Emmanuel Vadot CommitDate: 2021-11-22 15:26:03 +0000 bhyve: keep physical and virtual COMMAND reg in sync On startup all virtual BARs are registered. Additionally, the encoding bit in the virtual cmd register is set. After that, the passthru emulation overwrites the virtual cmd register with the physical one. This could lead to a mismatch between registered BARs and the encoding bits in the cmd register. Instead of writing the physical to the virtual cmd register, write the virtual to the physical cmd register to solve this issue. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D32687 Sponsored by: Beckhoff Automation GmbH & Co. KG --- usr.sbin/bhyve/pci_passthru.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.sbin/bhyve/pci_passthru.c b/usr.sbin/bhyve/pci_passthru.c index 29142749abb4..ed5d880ea8d1 100644 --- a/usr.sbin/bhyve/pci_passthru.c +++ b/usr.sbin/bhyve/pci_passthru.c @@ -593,8 +593,8 @@ cfginit(struct vmctx *ctx, struct pci_devinst *pi, int bus, int slot, int func) goto done; } - pci_set_cfgdata16(pi, PCIR_COMMAND, read_config(&sc->psc_sel, - PCIR_COMMAND, 2)); + write_config(&sc->psc_sel, PCIR_COMMAND, 2, + pci_get_cfgdata16(pi, PCIR_COMMAND)); error = 0; /* success */ done: