From nobody Fri Jun 16 06:14:16 2023 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 4Qj84n1ZnJz4fGJD; Fri, 16 Jun 2023 06:14:17 +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 4Qj84n17bCz3qkR; Fri, 16 Jun 2023 06:14:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686896057; 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=549bD7md6+ILFVfgDjMbRQpJ2QhIqjRw/c9GCOeVNLw=; b=f1T+unZ/pDcygdNlrPU0y4t+lKJKqaX5nHw9HjnWlUC3fkG4brE/uTwWQMST0OGc+nHD2E ogl8Ku3Km9PWgt2Vufq0NPxZ3jdY/1LF3TIHYX+ZROzhqqKEHBrFYujgVZbDTIMumlyEpL aH51O+PwprzTJncRtjYe+RGxeCjjjlPAYBf+BKayTmIqZLl/qg4zVH+4zyHCjHSDQ8i3QP hKzbfmOd3dvqaeIvYG+Vxmnir3stX5j/gx3388/IVAAUbw52BMs4hMUmtFl3ag8bKuoAiw c/FniHDtCY10GXl1/pxfZz49qZrWaCKHEiULirnkXmp7O01ETGavhFDuQoxdnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1686896057; 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=549bD7md6+ILFVfgDjMbRQpJ2QhIqjRw/c9GCOeVNLw=; b=YP9IwKzth8JdwVdJqYYlMhxfzOrXT+0lI1gHl0NV7/k4sPgxs7vkpYHgYiZAzm25ub8usG JyL3jMWgl+r/2b2a9WYr0QYg2p8Z1Af2ftBDqKutYwFPyh2qY32c3sT5pUnHSUjJCEc5fH UIXN9+8hu8/eRFz4p7RXTeYEMDde+7xx3+R32FOn+lCBaaFEaJNQxJVvW1GjKj7HM9bGo2 Aang2D65Dcc3+aBMI1jKjpIQvwSQ6owUM3OhJ8PgCTCl8eNe8/279fjXfYx20f6PIRnPlC 9CM8/IzHwnBs4xzW3BICqgy+VgC760B2nnhSAMOGvB5BIKFUEHimGRE4HFVr4w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1686896057; a=rsa-sha256; cv=none; b=tgaeEjlL3N9j2+Cu6TEn2u0doaafAPBeoBMmYCIhC1wN3bKyxE2ox1KqHLWMYbo/3FfmMo KxRtlB5BnuFO4cqcc+4cfyJrjJsBeHBeExhSvEFhPdFRxQbWv0ZmTPSkTYu/fsJJisQgci DWjouQHfxrc+nZmdbQ7nv4VqDrCF5Wp6u2ohcMDpPnMO79/giTHXEHNvluEhx0anUfKIYL p4J2GsmDNDxCnszY8RXrOxqNVPJaZR4LXoZHVZEwwodcvh6Bc94yWLsF7rMEO6KRFKrOn8 Vb6dQGJwdHLr3Gk6eD5md1RUb+ckXr6Zr0wWQWtPM8W1TLu1OKwvgp/oEA7Ugg== 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 4Qj84m73lZzGy6; Fri, 16 Jun 2023 06:14:16 +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 35G6EGsG035173; Fri, 16 Jun 2023 06:14:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35G6EGmd035172; Fri, 16 Jun 2023 06:14:16 GMT (envelope-from git) Date: Fri, 16 Jun 2023 06:14:16 GMT Message-Id: <202306160614.35G6EGmd035172@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Corvin=20K=C3=B6hne?= Subject: git: d9fa7c113df2 - main - bhyve: emulate graphics stolen memory register 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: corvink X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d9fa7c113df254b237e5a573d0567eb686e5fcde Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=d9fa7c113df254b237e5a573d0567eb686e5fcde commit d9fa7c113df254b237e5a573d0567eb686e5fcde Author: Corvin Köhne AuthorDate: 2023-05-11 09:18:56 +0000 Commit: Corvin Köhne CommitDate: 2023-06-16 05:54:27 +0000 bhyve: emulate graphics stolen memory register This register contains a host physical address. This address is meaningless for the guest. We have to emulate it and set it to a valid guest physical address. Reviewed by: markj MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D40060 --- usr.sbin/bhyve/pci_gvt-d.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/pci_gvt-d.c b/usr.sbin/bhyve/pci_gvt-d.c index 9c5b0906ec29..3109bc06be82 100644 --- a/usr.sbin/bhyve/pci_gvt-d.c +++ b/usr.sbin/bhyve/pci_gvt-d.c @@ -23,6 +23,8 @@ #define PCI_VENDOR_INTEL 0x8086 +#define PCIR_BDSM 0x5C /* Base of Data Stolen Memory register */ + #define PCIM_BDSM_GSM_ALIGNMENT \ 0x00100000 /* Graphics Stolen Memory is 1 MB aligned */ @@ -96,6 +98,7 @@ gvt_d_setup_gsm(struct pci_devinst *const pi) struct passthru_softc *sc; struct passthru_mmio_mapping *gsm; size_t sysctl_len; + uint32_t bdsm; int error; sc = pi->pi_arg; @@ -156,7 +159,12 @@ gvt_d_setup_gsm(struct pci_devinst *const pi) "Warning: Unable to reuse host address of Graphics Stolen Memory. GPU passthrough might not work properly."); } - return (0); + bdsm = read_config(passthru_get_sel(sc), PCIR_BDSM, 4); + pci_set_cfgdata32(pi, PCIR_BDSM, + gsm->gpa | (bdsm & (PCIM_BDSM_GSM_ALIGNMENT - 1))); + + return (set_pcir_handler(sc, PCIR_BDSM, 4, passthru_cfgread_emulate, + passthru_cfgwrite_emulate)); } static int