From nobody Thu Jan 18 22:33:47 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 4TGHbJ42cfz579QP; Thu, 18 Jan 2024 22:33:48 +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 4TGHbJ0hqcz4Dhh; Thu, 18 Jan 2024 22:33:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705617228; 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=mH2I3tyT9gLznUJLZX6PjGMdvXcvSJP5EXLtpKszmjQ=; b=F/Ml9kCMA2bqmw4xPqdjeklj3LEJB8yrrxGsukIdeYUKrUc5XLWMh/DpLHPUSFSVL4Z1GI ONNUyuEPlxJeJjbN/sEmB7YJ80dkRogvpTPggAXWKIB+mOw+Wr1aFqG5ZL4zbDk08WQXzX eDrW79XNqD8S7Ke97R1AnBTi1LhMs7tcKAGYzLKCIjfXjwFZ+xas0QQn2E/po2nokiMFS9 cv9hwTHkjcEy9vsN6lTMUwpilzFBFP0+DtPIgTUpD1GE2iEgTeWq55mPZbhtFItwrvG/5x +a1MG+Jr3HMfxZylub93FTHerslgcVszFoa/1dQ/z/Sakj250c9+NqNj4ioaDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705617228; 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=mH2I3tyT9gLznUJLZX6PjGMdvXcvSJP5EXLtpKszmjQ=; b=RB4rHo1X2O32D928zQxRyurnSjDNJUWpSATh0pvMOzPj/UbYOoIwGyRwJ3EzgQbYxz5V3L Reb89//V7xMnZX7s9+npHwxJIQENNcS7sYVUxWi34HpO2DKgyShxB30rLbeEXZ7xanGbH5 Nq7nK34It15ehhqlo3o2wTs+W7O7CcvhlXZHqpbePxVFHDXMJk2ORxRwxHvklXbXmKk4vd jC+pNYNf0K2c80TJsdE/gootTW+nRLg5Z+RnG6atpCS2DgCnukwG+rIm25WpeiAfkGSLes 9t14/whYgPUMxmlF4RaCCiRZx1WsDFJ5U6mksrNX1stkPkHkaIFNrngGjA/8kw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1705617228; a=rsa-sha256; cv=none; b=J84oIoq60zUXTdjOmtIkIN534zLpetZwLlqb2Gq91l1hT76j9FevKRPUZR8PvH1EN8xB3n tBhR/Jk9k5YaRWZfQ8T6zNHKaXwhLo9qUUv51gdYN14O77Jvphx8QAs/pH2cScUzRpTopg uDuQnDiMxHZUat8yrjrNnkPI3Whx/k/M8guasDjp4r+M3Is16dxjGkcUNZP96uTnBOl4sp rTcCbnk0v2jKJ4LVp81L1ZFm+ek/qUlXmfTXhoqW/Fe72g2FuhL2EMa/x2qJn0pGhAKvup eq+luVkzT+jsCETV7+jmSQFRoMZx1l8c4abbh2VNOHtrtlGqxP2jTnzgGXSJUw== 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 4TGHbH6vX7zQsV; Thu, 18 Jan 2024 22:33:47 +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 40IMXlCP007675; Thu, 18 Jan 2024 22:33:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40IMXl8J007672; Thu, 18 Jan 2024 22:33:47 GMT (envelope-from git) Date: Thu, 18 Jan 2024 22:33:47 GMT Message-Id: <202401182233.40IMXl8J007672@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: 468fb2f4f2c6 - stable/13 - 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/13 X-Git-Reftype: branch X-Git-Commit: 468fb2f4f2c611e12de40b8661db629a2b63dd01 Auto-Submitted: auto-generated The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=468fb2f4f2c611e12de40b8661db629a2b63dd01 commit 468fb2f4f2c611e12de40b8661db629a2b63dd01 Author: John Baldwin AuthorDate: 2024-01-09 19:23:10 +0000 Commit: John Baldwin CommitDate: 2024-01-18 22:33:14 +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 d0d2f9ddc1cd..ca88acb60966 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -1277,11 +1277,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++) { @@ -1323,14 +1321,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; @@ -1386,38 +1382,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 896fc0c5a224..362538e47bfc 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;