From nobody Tue Dec 03 00:51:20 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 4Y2MXn25q7z5fH5W; Tue, 03 Dec 2024 00:51:21 +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 4Y2MXm6N7bz4TJ5; Tue, 3 Dec 2024 00:51:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733187080; 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=ymYYx5brmbqRNVbRMnqMKGyjSn+uqzEU65ahC8NP+JA=; b=sOFFjnU9/8YiTMcFHvQL8LQpWP6dg9Zu49xVbnKwnfegyCghFNhaY4qQU4T7um2y0h1PaD HAskt96B+4nSW0u4RNHByihQ/hjjfihOKoLISAUMOwvmrzcrtOWZpOU0mWEIyvNh+EVOKo AHusjI15OowyiufKrJe1S9/rTdWsrJc0Ko3H3GN8+CwB5//YrPZVdun7wl1pruoHQudEm4 2oxXmLy1nH3VOIgV04VuO1Z9YnnXZEgDUjxrn+pRnmgPYM6x6wbRct2MO3ucvM+72UAFcR IFVFUSFnjfDALNR3K950WyKWnxAsvNEFguJ9dzXMxdpdXRtrsuM92SqmJXOWvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733187080; 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=ymYYx5brmbqRNVbRMnqMKGyjSn+uqzEU65ahC8NP+JA=; b=kbeq8vOsLgdp8pFCfE7KLTL2SD2N28/ZKYGgoRWFn7a7hUR7HkCUoi4yHJCCIeu/ZUQgXE gYSTVPzHthkwyVis1UwEKgLdOMTIQMCS/767eMkmmVAbM6B7AwRw4zCO3IDq0/Fc7gvQS1 R/U0BWxSBTF65sNU+an6Yg11ECxNdT5HLcfHG/mji8QjCIwR75eb7qT87t/ebFQlZxYB9V /zC73AN9lRJmCirptDVEV17efpheczixQmzNxFSJQ6s1dekBEVsxaTx5WSZ4eIpiVfoXWJ f4q72V3+/CgkC0HSe3YjY1LVJDGvxGcyGSdEjvyDyoAazVslo5RH5tIX5zrF3A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733187080; a=rsa-sha256; cv=none; b=co8bJeCbvXH3hRo5SxAFvlvsd4Pve9fwizAjsoivUwYa8HEcT/5oyaPOYsCUSyYqsfBrXc kaSHCDXjCkPYQ1k356F6CS+kdlHoo9GQdBhXODMphmzaQruBZvUG3eqqG+jpDXO+JAuFGY jN1/LoOm4AtQ6SB6i5zxA89k0AVQsU79+VXfzMcs4QEoJ7YkmQ26IbVCSYnqZwCvWqLZX0 +IVpkMjMyCYTNq/VsjkZyYKgI1soy/dfITazUTcPTFhnpxFoizPGITWGnkSB7geGO6RzPG Gd8wQlY62QNn4ZEQW1mx13akDAEFy2byDacDtO+Aj8L1KAK91iKrB6ADopU6SA== 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 4Y2MXm5rWrz117C; Tue, 3 Dec 2024 00:51:20 +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 4B30pKmN016060; Tue, 3 Dec 2024 00:51:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B30pKXd016057; Tue, 3 Dec 2024 00:51:20 GMT (envelope-from git) Date: Tue, 3 Dec 2024 00:51:20 GMT Message-Id: <202412030051.4B30pKXd016057@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: d5adab0e7824 - stable/14 - dmar: set acpi ivar domain on identify() 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: d5adab0e7824d45fbf364b227b01180ff92c049e Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d5adab0e7824d45fbf364b227b01180ff92c049e commit d5adab0e7824d45fbf364b227b01180ff92c049e Author: Konstantin Belousov AuthorDate: 2024-10-25 05:38:25 +0000 Commit: Konstantin Belousov CommitDate: 2024-12-03 00:39:22 +0000 dmar: set acpi ivar domain on identify() (cherry picked from commit 3f0289ea7f66c82656a43edf6527055fd27d225d) --- sys/x86/iommu/intel_drv.c | 60 ++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/sys/x86/iommu/intel_drv.c b/sys/x86/iommu/intel_drv.c index b21c8460e830..dd2a3d1a631f 100644 --- a/sys/x86/iommu/intel_drv.c +++ b/sys/x86/iommu/intel_drv.c @@ -160,6 +160,27 @@ dmar_count_iter(ACPI_DMAR_HEADER *dmarh, void *arg) return (1); } +/* Remapping Hardware Static Affinity Structure lookup */ +struct rhsa_iter_arg { + uint64_t base; + u_int proxim_dom; +}; + +static int +dmar_rhsa_iter(ACPI_DMAR_HEADER *dmarh, void *arg) +{ + struct rhsa_iter_arg *ria; + ACPI_DMAR_RHSA *adr; + + if (dmarh->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) { + ria = arg; + adr = (ACPI_DMAR_RHSA *)dmarh; + if (adr->BaseAddress == ria->base) + ria->proxim_dom = adr->ProximityDomain; + } + return (1); +} + int dmar_rmrr_enable = 1; static int dmar_enable = 0; @@ -168,6 +189,7 @@ dmar_identify(driver_t *driver, device_t parent) { ACPI_TABLE_DMAR *dmartbl; ACPI_DMAR_HARDWARE_UNIT *dmarh; + struct rhsa_iter_arg ria; ACPI_STATUS status; int i, error; @@ -217,7 +239,15 @@ dmar_identify(driver_t *driver, device_t parent) i, (uintmax_t)dmarh->Address, error); device_delete_child(parent, dmar_devs[i]); dmar_devs[i] = NULL; + continue; } + + ria.base = dmarh->Address; + ria.proxim_dom = -1; + dmar_iterate_tbl(dmar_rhsa_iter, &ria); + acpi_set_domain(dmar_devs[i], ria.proxim_dom == -1 ? + ACPI_DEV_DOMAIN_UNKNOWN : + acpi_map_pxm_to_vm_domainid(ria.proxim_dom)); } } @@ -326,34 +356,12 @@ dmar_print_caps(device_t dev, struct dmar_unit *unit, DMAR_ECAP_IRO(unit->hw_ecap)); } -/* Remapping Hardware Static Affinity Structure lookup */ -struct rhsa_iter_arg { - uint64_t base; - u_int proxim_dom; -}; - -static int -dmar_rhsa_iter(ACPI_DMAR_HEADER *dmarh, void *arg) -{ - struct rhsa_iter_arg *ria; - ACPI_DMAR_RHSA *adr; - - if (dmarh->Type == ACPI_DMAR_TYPE_HARDWARE_AFFINITY) { - ria = arg; - adr = (ACPI_DMAR_RHSA *)dmarh; - if (adr->BaseAddress == ria->base) - ria->proxim_dom = adr->ProximityDomain; - } - return (1); -} - static int dmar_attach(device_t dev) { struct dmar_unit *unit; ACPI_DMAR_HARDWARE_UNIT *dmaru; struct iommu_msi_data *dmd; - struct rhsa_iter_arg ria; uint64_t timeout; int disable_pmr; int i, error; @@ -381,13 +389,7 @@ dmar_attach(device_t dev) if (bootverbose) dmar_print_caps(dev, unit, dmaru); dmar_quirks_post_ident(unit); - unit->memdomain = -1; - ria.base = unit->base; - ria.proxim_dom = -1; - dmar_iterate_tbl(dmar_rhsa_iter, &ria); - if (ria.proxim_dom != -1) - unit->memdomain = acpi_map_pxm_to_vm_domainid(ria.proxim_dom); - + unit->memdomain = acpi_get_domain(dev); timeout = dmar_get_timeout(); TUNABLE_UINT64_FETCH("hw.iommu.dmar.timeout", &timeout); dmar_update_timeout(timeout);