From nobody Fri Jan 14 14:20:42 2022 X-Original-To: dev-commits-src-branches@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 0B2D3195DC1A; Fri, 14 Jan 2022 14:20:45 +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 4Jb3P66j54z3Lrw; Fri, 14 Jan 2022 14:20:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642170044; 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=0I6Uh4EFSQF/GbjOQiOlTc7i1tUxEicECuZRyfIPYvY=; b=kbaILOaCJAQ7PlUaSivnNvtiQnRzdX4xNuDMm3EckujyMiC2fLcbKSiVBo2WiN/pUUsK3T Z+CGPBKNfDUIhQfakYKSbZcXx9JZf+Qn29IoMCkuEY57s7UsN0wrlX9qNs8l995Ezpq+Ph ErYKG9hCRkQhB8otT/rbebUr94XWbAJ0w7aZuWQa/DHdu6JrIg4fOV0tuQpYz4foYFxjJ9 GkQvp0iXg+bI/f9leUg6Z9b1yFlfuDozB5UEF3CAwOlpCVgKvKeTPxzbHS5+yjbdZAMV96 an+oSSRCZ3pRTwEgup6dSrbyczYda5cvPUORBpRBrws0dARHA5JKw0zplU9IqA== 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 8AE9E153A2; Fri, 14 Jan 2022 14:20:42 +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 20EEKgsF088019; Fri, 14 Jan 2022 14:20:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20EEKgtF088018; Fri, 14 Jan 2022 14:20:42 GMT (envelope-from git) Date: Fri, 14 Jan 2022 14:20:42 GMT Message-Id: <202201141420.20EEKgtF088018@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Emmanuel Vadot Subject: git: 6448a0a51a81 - stable/13 - bhyve: keep physical and virtual COMMAND reg in sync List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 6448a0a51a81846764f56afb5d83a2245f139d37 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642170044; 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=0I6Uh4EFSQF/GbjOQiOlTc7i1tUxEicECuZRyfIPYvY=; b=Y8dhJLJjI6VsGjJ5RaWSAGDbKAsfk1VlM+ys8fAY2AlXPVGk1gwLTCZ49HT1R/up5/mGLX KOEgL/fsb9M9ufzWJxVaoHvUjbXQ3Fp1eGBX8dBuQzSSVpxDBzb41x4DFOgtkF7sSoF670 JOy2JixJJXSgGBFC1EMlNdgskcjv+/8aFpm70kvH/pDUDUamD+oLz+1jcNQAsYAi9t50mm sdYY4Xiy3WMhqbhDqMB/nAbhhZlxcQj04oAOoTDPvJheZmCuxsBSsfnx/P1i1no0qKqoMT 7q8LrUdZylp3K3meXQWHfz1z8t+EB4/jyvgN1JDvhgYOsDNA7o4iPjX92k0o4A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642170044; a=rsa-sha256; cv=none; b=cD+zZyI1qhdABtvkNlAUglQKp3pSoMF/UuIG0SuS5eomJ1cgDWPFh7klJS5plUk6pht2v+ dG/7Fene9je6YgSYEWkO2PgD7R6pRehpVJQvL5gVbxJpoZYH1wsV/VNtuM8csQIMCAJdrx GpWk49d3ZgspUuUOy4wg16Q5zzwCWvtkSMlxcrZbvthVGN1F93xNsKPSVo+6TOwOn/fS3J Q2lwo2sSrq27NpN7WCBKVrBlgT5lPpF0CSRFqgebTnRZvNwSLyugE7xxk90ddJmaf0I4bO C7Eh99GpXqxBYoxj6rnuXZTaHBnRsSJ2O+IKSW8YVcTkCv8LicmTXGEqlLus8A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=6448a0a51a81846764f56afb5d83a2245f139d37 commit 6448a0a51a81846764f56afb5d83a2245f139d37 Author: Corvin Köhne AuthorDate: 2021-11-22 15:26:03 +0000 Commit: Emmanuel Vadot CommitDate: 2022-01-14 14:18:08 +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 (cherry picked from commit 2eb2079554f4d54c4283410b4ee1aca549b29616) --- 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 eeb01e61b658..8c48f522562d 100644 --- a/usr.sbin/bhyve/pci_passthru.c +++ b/usr.sbin/bhyve/pci_passthru.c @@ -594,8 +594,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)); /* * We need to do this after PCIR_COMMAND got possibly updated, e.g.,