From nobody Tue Aug 5 14:03:15 2025 X-Original-To: dev-commits-src-main@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 4bxFWS2gnPz63GtM; Tue, 05 Aug 2025 14:03:16 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bxFWR5XtBz3FQH; Tue, 05 Aug 2025 14:03:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754402595; 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=S091PNxp62pJ5Ef8SVchokWUfCZORtWNQHG685ptDlM=; b=mXCtTxJIqRIOBhgxQzOk3r9l7rVnD8yU3DZ5wjN5dr0I8hZMJ5rbBGfHfMKZjDi12cy/9X qAK1l0LQ5T912nFbarww2c0/wCXb8yh90oynWbxKuSc9jAOvM/D6ir6tqLTqVhXrd9MATr LDYdrM7qgezm8QngZ4jxnC5wlEnCBTBRWuRkijoBkfMB5UZdS0QhSYi/9ELadrPXWpzA3c KyeQh10ah7vpTeJ6Dz8nLYVflNhE4hXMzCO3NM7RAp1CQDi3mAXzfV4/4px414Jz5B7gay PV4Rvc8BZpzV9yNqMS7FXCb0trK3nGRi0LKyn8a0utA2a8ZDh7gtJ0Dv8yKPOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754402595; 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=S091PNxp62pJ5Ef8SVchokWUfCZORtWNQHG685ptDlM=; b=J3qORwKJszSw0aFD3fYhRuo7Q1YG9B7dmhdI6rthWwdl3kQDkYgTJ3qzEhErBoJCHzVfZj xtG8q5wVi2NCvsYRIWT3NICY2Y6baZUtOHiheML/OOVYZOHd1LoWph0/cCZEFhx93dZGOb 7mOaz7pVLCRAjRFdFBP85EmbXQshFk8bPBQaIh5ZNIFE+w22aJsb6bUHXYiSMaYpVOBR8W +ggcyAcn6+RlSAj+b7RNove+0kCcJgw91U839g+mhd6gFyQHuJl9nRbLEIirGHalnRiF2Y ArYXa5jq0V5shdVJyrcw9IIImeFyeL/oJlLjvybtwN2nrTLgxxjMySHQPyAVog== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1754402595; a=rsa-sha256; cv=none; b=D1DuPgr2MK5ykofYyG3dns9qtxyW89fUUxO5rit6gRBoScZIX3WpTbHSz/fcIRkTM8bi4r K1BexQreK//jSZkWjKKwWP4yjxJm8rGeOiKON+RJwNxmKuAIdo5T1pa6ysfAojrX56CP8J Yek7LnBgc5Q0MQQ4Yit3kFszH2NXq9UuAjjhPAylqleOY08ho4TFAaAVksFe09hDWlG4mc MCA5MArkWJAEUbw6r0EYGK7Ezpo15EqHmRPwh7x4D6Gzc5lUvmVUb6/kAmIvc5abKW4EMA iMUKLsOGe6ofiOY73PbG6qacOfXbNqRM7pVQMpOKFiBZ1tb6K3RwhmwCRFzsJw== 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 4bxFWR57rlzfK2; Tue, 05 Aug 2025 14:03:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 575E3FOD070565; Tue, 5 Aug 2025 14:03:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 575E3FBS070562; Tue, 5 Aug 2025 14:03:15 GMT (envelope-from git) Date: Tue, 5 Aug 2025 14:03:15 GMT Message-Id: <202508051403.575E3FBS070562@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Corvin =?utf-8?Q?K=C3=B6hne?= Subject: git: 9eddbaa5bba2 - main - bhyve: add GVT-d support for graphics gen 11 and newer List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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: 9eddbaa5bba20c1a276d4711a4e9271e5f200ee1 Auto-Submitted: auto-generated The branch main has been updated by corvink: URL: https://cgit.FreeBSD.org/src/commit/?id=9eddbaa5bba20c1a276d4711a4e9271e5f200ee1 commit 9eddbaa5bba20c1a276d4711a4e9271e5f200ee1 Author: Corvin Köhne AuthorDate: 2023-12-15 11:29:19 +0000 Commit: Corvin Köhne CommitDate: 2025-08-05 14:02:08 +0000 bhyve: add GVT-d support for graphics gen 11 and newer The BDSM (Base Data Stolen Memory) register changed. Older generations are using a 32 bit register. On newer generations a different register address is used and the size was changed to 64 bit to permit allocating graphics stolen memory above 4 GB. Bhyve has to detect that and properly emulate the correct register. Reviewed by: jhb, markj MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D45338 --- usr.sbin/bhyve/amd64/pci_gvt-d.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/usr.sbin/bhyve/amd64/pci_gvt-d.c b/usr.sbin/bhyve/amd64/pci_gvt-d.c index e506b75e77fe..630c5caf4b7b 100644 --- a/usr.sbin/bhyve/amd64/pci_gvt-d.c +++ b/usr.sbin/bhyve/amd64/pci_gvt-d.c @@ -33,6 +33,7 @@ #define PCI_VENDOR_INTEL 0x8086 #define PCIR_BDSM 0x5C /* Base of Data Stolen Memory register */ +#define PCIR_BDSM_GEN11 0xC0 #define PCIR_ASLS_CTL 0xFC /* Opregion start address register */ #define PCIM_BDSM_GSM_ALIGNMENT \ @@ -64,12 +65,37 @@ set_bdsm_gen3(struct pci_devinst *const pi, vm_paddr_t bdsm_gpa) return (0); } +static int +set_bdsm_gen11(struct pci_devinst *const pi, vm_paddr_t bdsm_gpa) +{ + struct passthru_softc *sc = pi->pi_arg; + uint64_t bdsm; + int error; + + bdsm = pci_host_read_config(passthru_get_sel(sc), PCIR_BDSM_GEN11, 8); + + /* Protect the BDSM register in PCI space. */ + pci_set_cfgdata32(pi, PCIR_BDSM_GEN11, + bdsm_gpa | (bdsm & (PCIM_BDSM_GSM_ALIGNMENT - 1))); + pci_set_cfgdata32(pi, PCIR_BDSM_GEN11 + 4, bdsm_gpa >> 32); + error = set_pcir_handler(sc, PCIR_BDSM_GEN11, 8, passthru_cfgread_emulate, + passthru_cfgwrite_emulate); + if (error) { + warnx("%s: Failed to setup handler for BDSM register!\n", __func__); + return (error); + } + + return (0); +} + struct igd_ops { int (*set_bdsm)(struct pci_devinst *const pi, vm_paddr_t bdsm_gpa); }; static const struct igd_ops igd_ops_gen3 = { .set_bdsm = set_bdsm_gen3 }; +static const struct igd_ops igd_ops_gen11 = { .set_bdsm = set_bdsm_gen11 }; + struct igd_device { uint32_t device_id; const struct igd_ops *ops; @@ -105,6 +131,17 @@ static const struct igd_device igd_devices[] = { INTEL_CML_IDS(IGD_DEVICE, &igd_ops_gen3), INTEL_GLK_IDS(IGD_DEVICE, &igd_ops_gen3), INTEL_CNL_IDS(IGD_DEVICE, &igd_ops_gen3), + INTEL_ICL_IDS(IGD_DEVICE, &igd_ops_gen11), + INTEL_EHL_IDS(IGD_DEVICE, &igd_ops_gen11), + INTEL_JSL_IDS(IGD_DEVICE, &igd_ops_gen11), + INTEL_TGL_IDS(IGD_DEVICE, &igd_ops_gen11), + INTEL_RKL_IDS(IGD_DEVICE, &igd_ops_gen11), + INTEL_ADLS_IDS(IGD_DEVICE, &igd_ops_gen11), + INTEL_ADLP_IDS(IGD_DEVICE, &igd_ops_gen11), + INTEL_ADLN_IDS(IGD_DEVICE, &igd_ops_gen11), + INTEL_RPLS_IDS(IGD_DEVICE, &igd_ops_gen11), + INTEL_RPLU_IDS(IGD_DEVICE, &igd_ops_gen11), + INTEL_RPLP_IDS(IGD_DEVICE, &igd_ops_gen11), }; static const struct igd_ops *