From nobody Thu Jan 18 22:33:42 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 4TGHbB5K5Wz579QK; Thu, 18 Jan 2024 22:33:42 +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 4TGHbB4g5zz4DMH; Thu, 18 Jan 2024 22:33:42 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705617222; 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=J1EJkZAUad8LPRDFgaCps7f900bCAnO8uyGtzwp/MGE=; b=h65TQPzGb/RsgM/KkXhF5Oex5i0wo1GplsWkJ7Q1puV8UqhMeBN4KA3calJyZc4RPD+YUl z07QYmLNLLE03OVXNsk0kR6AinRF43lIhia5Qi0Z366XxBUWPYpVSDrmcZoahFQe5TBu6u iCQ360REH4ta7THSDBJE2645hlrnsopTeszqskI9oJmAoWmvFFNXQU+Bnpnk4yvbGYM4M/ vKXNDNTdl3gTrz6GDBuF3eluklvSscJToTt2LO7eBBnifJU+Tbf9SIEcZjCqataDRbj1Z3 9cv0Vo6C9XeIrVKqyKHBxjFAHr5XcXwUs6PplVz81QoBT8CZhJi5xmeUHgoH6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705617222; 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=J1EJkZAUad8LPRDFgaCps7f900bCAnO8uyGtzwp/MGE=; b=WQdkScx4q5a5rEFK6RMhm5pXrO+jnRD78wkLSscRFaBwIaN/TtuXHsQ4qFujmxcCJo8YCH WMw5Lazl4H8rm3u6RyntlDhmPTaVWab/mFNe9prbauFHwNtZOTVrAsZPWBbgEvxGKjP0/B JcZvkI1YRXdZMzGSgmyHQwJY/+aB8Nq+ogwlrAdD9UNBcCCw0n9Sqfah+sE6WhB/wmTI5L Z/QN42+nUuScI/4wH/do8xJHMVof/MpXr3v8ClyR6pQcJl0qTd8gEpHBwTMzVCbR60dfxq IO6lgGYDl7LIdAS2e0nZMdwjo3vafpxxsT1omW56ey9w8/FjWST29zWzwzQghQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1705617222; a=rsa-sha256; cv=none; b=BluEDXYFZF49OwRpCXToHcZX2yDV4QYf2Qi1eyCDdOxMbmWmSjBImz1UbnyJws3vyYkck8 wRcl4joZJbJnywkcZZ8FQRby+uS8uJKn5oi9xrDzUIa9dNApx+vrDs22MPg9lAes6GFtBK zQEAGiZrL6io5TUxiNDIfgpqskNRUB6v+PTMbsw3kjpnIRG6uKHjBtijHbJVizPsRmkK1i Okya23Wvyq1NXU6HbRIlPepR4na1GZq4dmiiN86P0ieY2/f3f0yOvLLqMn+trUhHcrQ9Ur YzxYHIhkda5PHiczVPGGFY0sGAWRORDoD7S74zkcqK7+q7poe05R0jhKcGMxWw== 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 4TGHbB3kXpzQq0; Thu, 18 Jan 2024 22:33:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 40IMXgpB007530; Thu, 18 Jan 2024 22:33:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40IMXgWO007527; Thu, 18 Jan 2024 22:33:42 GMT (envelope-from git) Date: Thu, 18 Jan 2024 22:33:42 GMT Message-Id: <202401182233.40IMXgWO007527@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 8ae27e114b28 - stable/14 - acpi: Only reserve resources enumerated via _CRS 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: jhb X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 8ae27e114b28153c0bf2884c8f7bfcdeb81494f9 Auto-Submitted: auto-generated The branch stable/14 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=8ae27e114b28153c0bf2884c8f7bfcdeb81494f9 commit 8ae27e114b28153c0bf2884c8f7bfcdeb81494f9 Author: John Baldwin AuthorDate: 2024-01-09 19:23:10 +0000 Commit: John Baldwin CommitDate: 2024-01-18 22:33:09 +0000 acpi: Only reserve resources enumerated via _CRS In particular, don't reserve resources added by drivers via other means (e.g. acpi_bus_alloc_gas which calls bus_alloc_resource right after adding the resource). The intention of reserved resources is to ensure that a resource range that a bus driver knows is assigned to a device is reserved by the system even if no driver is attached to the device. This prevents other "wildcard" resource requests from conflicting with these resources. For ACPI, the only resources the bus driver knows about for unattached devices are the resources returned from _CRS. All of these resources are already reserved now via acpi_reserve_resources called from acpi_probe_children. As such, remove the logic from acpi_set_resource to try to reserve resources when they are set. This permits RF_SHAREABLE to work with acpi_bus_alloc_gas without requiring hacks like the current one for CPU device resources in acpi_set_resource. Reported by: gallatin (RF_SHAREABLE not working) Diagnosed by: jrtc27 (cherry picked from commit c6a488511ab1fbae8d16264b9e83c85024c9e1ce) --- sys/dev/acpica/acpi.c | 36 ------------------------------------ sys/dev/acpica/acpivar.h | 1 - 2 files changed, 37 deletions(-) diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index 491eda40b6c4..0c77da80c27e 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -1376,11 +1376,9 @@ acpi_reserve_resources(device_t dev) struct resource_list_entry *rle; struct resource_list *rl; struct acpi_device *ad; - struct acpi_softc *sc; device_t *children; int child_count, i; - sc = device_get_softc(dev); if (device_get_children(dev, &children, &child_count) != 0) return; for (i = 0; i < child_count; i++) { @@ -1422,14 +1420,12 @@ acpi_reserve_resources(device_t dev) } } free(children, M_TEMP); - sc->acpi_resources_reserved = 1; } static int acpi_set_resource(device_t dev, device_t child, int type, int rid, rman_res_t start, rman_res_t count) { - struct acpi_softc *sc = device_get_softc(dev); struct acpi_device *ad = device_get_ivars(child); struct resource_list *rl = &ad->ad_rl; ACPI_DEVICE_INFO *devinfo; @@ -1485,38 +1481,6 @@ acpi_set_resource(device_t dev, device_t child, int type, int rid, /* Add the resource. */ end = (start + count - 1); resource_list_add(rl, type, rid, start, end, count); - - /* Don't reserve resources until the system resources are allocated. */ - if (!sc->acpi_resources_reserved) - return (0); - - /* Don't reserve system resources. */ - if (ACPI_ID_PROBE(dev, child, sysres_ids, NULL) <= 0) - return (0); - - /* - * Don't reserve IRQ resources. There are many sticky things to - * get right otherwise (e.g. IRQs for psm, atkbd, and HPET when - * using legacy routing). - */ - if (type == SYS_RES_IRQ) - return (0); - - /* - * Don't reserve resources for CPU devices. Some of these - * resources need to be allocated as shareable, but reservations - * are always non-shareable. - */ - if (device_get_devclass(child) == devclass_find("cpu")) - return (0); - - /* - * Reserve the resource. - * - * XXX: Ignores failure for now. Failure here is probably a - * BIOS/firmware bug? - */ - resource_list_reserve(rl, dev, child, type, &rid, start, end, count, 0); return (0); } diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h index 5be0939ee6bb..4d76a77cdbf8 100644 --- a/sys/dev/acpica/acpivar.h +++ b/sys/dev/acpica/acpivar.h @@ -55,7 +55,6 @@ struct acpi_softc { int acpi_enabled; int acpi_sstate; int acpi_sleep_disabled; - int acpi_resources_reserved; struct sysctl_ctx_list acpi_sysctl_ctx; struct sysctl_oid *acpi_sysctl_tree;