From nobody Tue Dec 03 00:51:19 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 4Y2MXm1WTbz5fGjn; Tue, 03 Dec 2024 00:51:20 +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 4Y2MXl6X0mz4TLL; Tue, 3 Dec 2024 00:51:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733187079; 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=HhcJoV7+tEE9yKk0TJ2bhXk8Jr9nTe4t/gspF6XCXEQ=; b=R/Rmvhb3PnUx9C83uJanv7bBA0NHXYeyJrca/K7jgsiH5YQQI9ZLafRCgYdc/FrDWddsk8 j+DW9E3sgqToaXSRwAM83zSJJRdZy41h7r13JuD/4UTmrdCdrsToe/cG0vc+WQEK+PR68x fMUq9XP+a2js3o/xdCksPzf/lnBjpcaOOyaBFXP09Qd3g5TSGW1n0xJKLukTT2aEIuLqDP 6O037lfce1s0XTakmQncCkdhCU+U3UpHNta7eAQS5ZSD2/LlXbdB6NHOB9dS9cD70GLAG2 AZ4gkYZulCUmNrK7M8CUrB9oSQQsEHjtbfi1xqJY/aBHtiC5sKZ/yDNSrqJWFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733187079; 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=HhcJoV7+tEE9yKk0TJ2bhXk8Jr9nTe4t/gspF6XCXEQ=; b=ALM4bkuoENRaEq/NHVm0Ah0sjDIh0NQJXVudt+x2Pv7TdwkyH9ywKhI5bUjD2XnpztVwLV IpXr1UIXP2b1faItjgVynelFsHNfLWSAox7+UdJ2WuqMCYa4yqaJMnRuOswpDnvaFkYATg 5eq2qUGyNutv/u1rtut8Aslp/1FWOaDVKEKgaHHlTcjAi9kABAh2r+JmZcT36WUA/75wB5 DZU+Om0256loon7UhzcIZNlPgd2filAYqV3vYBYtHdYog4NpA37ip4ficKyfYiIt2bu2MI sVW6VmWSHU+abfpZdFCkDFn/2JM61P+UWsBYBF0hLbUB0aSidzKatBQA+u/HVw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733187079; a=rsa-sha256; cv=none; b=gmk5zrAl/Mq2HV298bPAHa8geui5Va0gumtd0b/PWG+MLbaEjcI5vm/ojYLk+MklN1ocXc w0voW9qqrxeWLURusYcwrt+oalbC7w1parqUjMOsxHCZ7eytoyhqxQUJQ84XUG2anr4jrp tIOUQ+YbrfXawLr4PGwHD9nPTlYgPGMNG14xGsgwg8Fc+ywJyRaPiMjmKsEYJDPd3wDJHm 3TEqowItzxjPqQOj8sbxDqcQhnxvJ+4/ou8nA7PKpdwnCyJETTXW3Ll8IxYBhYu55eJRwV Gn4GFmule3Nqg2cMIjm8fUe0uvQihxTOhR1A8VVGvBcHUIbIew8TXZpC1XkuPQ== 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 4Y2MXl5GKXz10nC; Tue, 3 Dec 2024 00:51:19 +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 4B30pJSs016012; Tue, 3 Dec 2024 00:51:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B30pJjf016009; Tue, 3 Dec 2024 00:51:19 GMT (envelope-from git) Date: Tue, 3 Dec 2024 00:51:19 GMT Message-Id: <202412030051.4B30pJjf016009@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: dc75bb826441 - stable/14 - acpica: add domain ivar 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: dc75bb826441630c9d3934044172b9b97873d532 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=dc75bb826441630c9d3934044172b9b97873d532 commit dc75bb826441630c9d3934044172b9b97873d532 Author: Konstantin Belousov AuthorDate: 2024-10-26 10:12:37 +0000 Commit: Konstantin Belousov CommitDate: 2024-12-03 00:39:22 +0000 acpica: add domain ivar (cherry picked from commit 7dd1f0dcd134de52c5ace8da5876b3bd518cee7e) --- sys/dev/acpica/acpi.c | 43 +++++++++++++++++++++---------------------- sys/dev/acpica/acpi_pci.c | 28 +++++++++++++++++++++++++++- sys/dev/acpica/acpivar.h | 9 ++++++++- 3 files changed, 56 insertions(+), 24 deletions(-) diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 45b6146b6308..cbb454a52099 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -137,6 +137,7 @@ static bus_child_location_t acpi_child_location_method; static bus_hint_device_unit_t acpi_hint_device_unit; static bus_get_property_t acpi_bus_get_prop; static bus_get_device_path_t acpi_get_device_path; +static bus_get_domain_t acpi_get_domain_method; static acpi_id_probe_t acpi_device_id_probe; static acpi_evaluate_object_t acpi_device_eval_obj; @@ -211,7 +212,7 @@ static device_method_t acpi_methods[] = { DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), DEVMETHOD(bus_hint_device_unit, acpi_hint_device_unit), DEVMETHOD(bus_get_cpus, acpi_get_cpus), - DEVMETHOD(bus_get_domain, acpi_get_domain), + DEVMETHOD(bus_get_domain, acpi_get_domain_method), DEVMETHOD(bus_get_property, acpi_bus_get_prop), DEVMETHOD(bus_get_device_path, acpi_get_device_path), @@ -809,6 +810,7 @@ acpi_add_child(device_t bus, u_int order, const char *name, int unit) if ((ad = malloc(sizeof(*ad), M_ACPIDEV, M_NOWAIT | M_ZERO)) == NULL) return (NULL); + ad->ad_domain = ACPI_DEV_DOMAIN_UNKNOWN; resource_list_init(&ad->ad_rl); child = device_add_child_ordered(bus, order, name, unit); @@ -1045,6 +1047,9 @@ acpi_read_ivar(device_t dev, device_t child, int index, uintptr_t *result) case ACPI_IVAR_FLAGS: *(int *)result = ad->ad_flags; break; + case ACPI_IVAR_DOMAIN: + *(int *)result = ad->ad_domain; + break; case ISA_IVAR_VENDORID: case ISA_IVAR_SERIAL: case ISA_IVAR_COMPATID: @@ -1089,6 +1094,9 @@ acpi_write_ivar(device_t dev, device_t child, int index, uintptr_t value) case ACPI_IVAR_FLAGS: ad->ad_flags = (int)value; break; + case ACPI_IVAR_DOMAIN: + ad->ad_domain = (int)value; + break; default: panic("bad ivar write request (%d)", index); return (ENOENT); @@ -1287,29 +1295,16 @@ acpi_get_cpus(device_t dev, device_t child, enum cpu_sets op, size_t setsize, } } -/* - * Fetch the NUMA domain for the given device 'dev'. - * - * If a device has a _PXM method, map that to a NUMA domain. - * Otherwise, pass the request up to the parent. - * If there's no matching domain or the domain cannot be - * determined, return ENOENT. - */ -int -acpi_get_domain(device_t dev, device_t child, int *domain) +static int +acpi_get_domain_method(device_t dev, device_t child, int *domain) { - int d; + int error; - d = acpi_pxm_parse(child); - if (d >= 0) { - *domain = d; + error = acpi_read_ivar(dev, child, ACPI_IVAR_DOMAIN, + (uintptr_t *)domain); + if (error == 0 && *domain != ACPI_DEV_DOMAIN_UNKNOWN) return (0); - } - if (d == -1) - return (ENOENT); - - /* No _PXM node; go up a level */ - return (bus_generic_get_domain(dev, child, domain)); + return (ENOENT); } /* @@ -2303,7 +2298,7 @@ acpi_probe_child(ACPI_HANDLE handle, UINT32 level, void *context, void **status) ACPI_HANDLE h; device_t bus, child; char *handle_str; - int order; + int d, order; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); @@ -2411,6 +2406,10 @@ acpi_probe_child(ACPI_HANDLE handle, UINT32 level, void *context, void **status) } AcpiOsFree(devinfo); } + + d = acpi_pxm_parse(child); + if (d >= 0) + ad->ad_domain = d; break; } } diff --git a/sys/dev/acpica/acpi_pci.c b/sys/dev/acpica/acpi_pci.c index a1ac3499662d..6411af02ee58 100644 --- a/sys/dev/acpica/acpi_pci.c +++ b/sys/dev/acpica/acpi_pci.c @@ -93,6 +93,7 @@ static int acpi_pci_set_powerstate_method(device_t dev, device_t child, int state); static void acpi_pci_update_device(ACPI_HANDLE handle, device_t pci_child); static bus_dma_tag_t acpi_pci_get_dma_tag(device_t bus, device_t child); +static int acpi_pci_get_domain(device_t dev, device_t child, int *domain); static device_method_t acpi_pci_methods[] = { /* Device interface */ @@ -108,7 +109,7 @@ static device_method_t acpi_pci_methods[] = { DEVMETHOD(bus_get_device_path, acpi_pci_get_device_path), DEVMETHOD(bus_get_cpus, acpi_get_cpus), DEVMETHOD(bus_get_dma_tag, acpi_pci_get_dma_tag), - DEVMETHOD(bus_get_domain, acpi_get_domain), + DEVMETHOD(bus_get_domain, acpi_pci_get_domain), /* PCI interface */ DEVMETHOD(pci_alloc_devinfo, acpi_pci_alloc_devinfo), @@ -206,6 +207,31 @@ acpi_pci_get_device_path(device_t bus, device_t child, const char *locator, stru return (pci_get_device_path_method(bus, child, locator, sb)); } +/* + * Fetch the NUMA domain for the given device 'dev'. + * + * If a device has a _PXM method, map that to a NUMA domain. + * Otherwise, pass the request up to the parent. + * If there's no matching domain or the domain cannot be + * determined, return ENOENT. + */ +static int +acpi_pci_get_domain(device_t dev, device_t child, int *domain) +{ + int d; + + d = acpi_pxm_parse(child); + if (d >= 0) { + *domain = d; + return (0); + } + if (d == -1) + return (ENOENT); + + /* No _PXM node; go up a level */ + return (bus_generic_get_domain(dev, child, domain)); +} + /* * PCI power manangement */ diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h index a8bd9ec33cb7..80ea18e782ac 100644 --- a/sys/dev/acpica/acpivar.h +++ b/sys/dev/acpica/acpivar.h @@ -86,6 +86,7 @@ struct acpi_device { void *ad_private; int ad_flags; int ad_cls_class; + int ad_domain; ACPI_BUFFER dsd; /* Device Specific Data */ const ACPI_OBJECT *dsd_pkg; @@ -269,6 +270,12 @@ extern int acpi_override_isa_irq_polarity; #define ACPI_IVAR_UNUSED 0x101 /* Unused/reserved. */ #define ACPI_IVAR_PRIVATE 0x102 #define ACPI_IVAR_FLAGS 0x103 +#define ACPI_IVAR_DOMAIN 0x104 + +/* + * ad_domain NUMA domain special value. + */ +#define ACPI_DEV_DOMAIN_UNKNOWN (-1) /* * Accessor functions for our ivars. Default value for BUS_READ_IVAR is @@ -294,6 +301,7 @@ static __inline void varp ## _set_ ## var(device_t dev, type t) \ __ACPI_BUS_ACCESSOR(acpi, handle, ACPI, HANDLE, ACPI_HANDLE) __ACPI_BUS_ACCESSOR(acpi, private, ACPI, PRIVATE, void *) __ACPI_BUS_ACCESSOR(acpi, flags, ACPI, FLAGS, int) +__ACPI_BUS_ACCESSOR(acpi, domain, ACPI, DOMAIN, int) void acpi_fake_objhandler(ACPI_HANDLE h, void *data); static __inline device_t @@ -594,7 +602,6 @@ int acpi_pxm_parse(device_t dev); */ int acpi_map_pxm_to_vm_domainid(int pxm); bus_get_cpus_t acpi_get_cpus; -bus_get_domain_t acpi_get_domain; #ifdef __aarch64__ /*