From nobody Tue Jan 9 19:29:02 2024 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 4T8gwG5bDdz56M3C; Tue, 9 Jan 2024 19:29:02 +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 4T8gwG4lWbz4hqH; Tue, 9 Jan 2024 19:29:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704828542; 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=0jCaV/7D0MkQNYRHoVvhqPIXTTw5Er1RpfQ2+JUiJRc=; b=THYzobzwTTBqQND9RwxM6bskUrZPfpf9Xfv5mXlMKhHpqDVRCBN79Hl3rY+aj5Jq2YYkef /xBAOTp/UzIYIILoludm4vQMusAQdiqUayBeGZbYLUXrVCEJZdRA3/8THckxxzLso89tTF DFE+/z8POnfgCDPsnD0uvPCKGQkj7SRNEF0LkN5UzFRSavkn8EJrCbuOz6gZkDbligQetx 77/Vb3pL1x7CJoJq8fR6dJ+n2ou3XnEoV+KXiCE8juGO2Jj6yrZpsQQRvDk5JBh6ad74Fy 6UePZxq3+5QWBLUdYbL13Yr85E7SEoQtZeqeTT0N1D4dmqICpyfEBh0J7L0ZFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1704828542; 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=0jCaV/7D0MkQNYRHoVvhqPIXTTw5Er1RpfQ2+JUiJRc=; b=FDQYqXYnU6JPbTWZBCe1z7597Gca8oHZcRuHnA0iiw6JZb6v3qEg0kM58YreApOfddrZX0 S/0O6h3ZDCqKemsr9pCDsR+JCsDT+VX2MiMkoTa/tNRdQauzn51+GBP+0rtfbgjzCV5RO6 klgYHMwykexawkVATfOGrsHt1uTLCArUfFWpVQFWBqz9o8UydTtPVp7TRXq9+M/f/9dbuZ 2yTxFbw/dIng7GItz4uL6CtP5ctK0PQHqnAY/bJtSrthDERzulobwAM6+hgvjBtSvA6neR DGSr7TvR2Z9NnsHpqedp3Bg8qZsQKVKYFEPs7xf+ynJZLKhXTRWkX7O+PN++kA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1704828542; a=rsa-sha256; cv=none; b=MX8og5tIBGHUtIeEXHzcKny7yxz6GsBf2PYDPcDmLMqODD5MVOM8d5dd1Ep/i3M9wxrWcI QdnlJDi6y7SJs7ya9UYu83bZOIR4xO9VSW2GCvu4cUbBmNSSWdq/es2rqeGhmzwFIg5nk4 0qKfG+nur9j5vBRNX5s52RZZgOG3K5RD6+0EAaeIbCqGrQuT2I9idjFnHMO7LItrZBYeou Uf0AIqm4DQQfRbq1wVUsOpM1ltXQ5TrUKwWw80Gh1iOTFhOupcYzxQ/V1kcMHgAUcNzAIc cTz87m8fpXxuMMRwpwLfHO7mRIxPa859hbEAkzdV0ukQiDvaAfas4DCErPdRlA== 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 4T8gwG3pmlz13fP; Tue, 9 Jan 2024 19:29:02 +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 409JT2Tj032975; Tue, 9 Jan 2024 19:29:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 409JT2F2032972; Tue, 9 Jan 2024 19:29:02 GMT (envelope-from git) Date: Tue, 9 Jan 2024 19:29:02 GMT Message-Id: <202401091929.409JT2F2032972@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: c6a488511ab1 - main - acpi: Only reserve resources enumerated via _CRS 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: c6a488511ab1fbae8d16264b9e83c85024c9e1ce Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c6a488511ab1fbae8d16264b9e83c85024c9e1ce commit c6a488511ab1fbae8d16264b9e83c85024c9e1ce Author: John Baldwin AuthorDate: 2024-01-09 19:23:10 +0000 Commit: John Baldwin CommitDate: 2024-01-09 19:23:10 +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 --- 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 22d2b10ff905..9196c446ae80 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;