Received: by 2002:ab2:644:0:b0:1ec:cbc4:63fb with SMTP id 4csp1140876lqn; Mon, 26 Feb 2024 08:47:46 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVjpMqLRV+q00x5D+e0uZEiNqZeb9XeMhEbq/HQS+l8+bV7D0aI44rRDTbaxC/o72JPJf72xptGR+qHpiaQqcNr5wXYhtKva5pGjSSDzw== X-Google-Smtp-Source: AGHT+IGkGE66qPLwxjLO7+UgbY2C0z2QO62J5HZyF+ndRcQDF13ixh+AaqZ/cqQgjQWPMx/5ln7K X-Received: by 2002:a17:902:e841:b0:1dc:abe9:8270 with SMTP id t1-20020a170902e84100b001dcabe98270mr2254136plg.26.1708966065798; Mon, 26 Feb 2024 08:47:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708966065; cv=pass; d=google.com; s=arc-20160816; b=KuIAmf/ISpE+rJkrnhokAdZWlve6buY/G3MNp6eChzWhnKbT5eoRZFr5UIoKYc51IR T1ZGfYAItlrz1zpe/goBbr6ZVgVD+f9757QPsKbbulGmNJDPhh191EIR6uhNBy7MaWxk AWq2xjcC0RSgxD9jYjhbcumcsHnpUQYryHI/GAdIs31npaM/OBS+rMS8opaI6i9HBp46 X2IFJommiyGRjsEi0ur5VaOo5zX+FesMmGqP4GMRZ7X8mcdDDclY+ln6jp7WnxtxIV6g 4IFUjmz8QMUV3V4U+DOlHlq+9yqykfCfeJs/5lMTT2pXfki+SDLatL67dxZnnSeRNiZY gXBQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=js50eI+cbhWERBxDwI/51ztGdqnVIEkB3Xj64/h+BuA=; fh=s5Fc0MEg8Xcp85xwyejK4S4zs7msQB7g1OY0X3YpOJg=; b=NFAKuOtY6BM4mTuud+jd68qj9y29BARs0dqDFcoYL9QHoAhpoSlmyyHJUum76s9mGB Qnkc6Sh7aNozvjO6tED9z1Z0UMgHuRY9uTrHQ91C/LKVbFWzt9dLiwGoDpqIpC1bTVjX DSrgc4QahpvLjbG1RFiEWWgtSx/e0rYaoAaf1P9mq+rxOtRC91bL8+qDjRKK2X3/fhM2 ayoS2Xp/KG8QoiLUE2htKNDYSHzVJv6NAbMlMVePCCD3hCLxKaHs6QFh5uBhjEoI1PC6 JqObc8ce3UaCoJEhifF2fHRMkqoct/TGaHsy4uBGOPd3o0BXvhCcNvG2y/VR9NAMfhnQ kZUw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-81932-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81932-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id o7-20020a170902d4c700b001dc8fca93f3si3170783plg.88.2024.02.26.08.47.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 08:47:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81932-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=rjwysocki.net); spf=pass (google.com: domain of linux-kernel+bounces-81932-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81932-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id F3778290A4E for ; Mon, 26 Feb 2024 16:47:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9DD5812E1E4; Mon, 26 Feb 2024 16:47:09 +0000 (UTC) Received: from cloudserver094114.home.pl (cloudserver094114.home.pl [79.96.170.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC7E912C81A; Mon, 26 Feb 2024 16:47:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=79.96.170.134 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708966026; cv=none; b=kpVvZJstz5Ip5+exIos4NhvBRirhMuRYUkAT9tbuw9LuHbMEi39qu5b7bI+/n4cmAGahqP3ktwvqKNXmSkCTCEasgZkGBPo31s5qqrNG/vFby0Jqr8w0scnO1IoxWvqvuNgyZvHOX+R1B4awnSd9kSqUlVxOAu8FrvxthFPPbvU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708966026; c=relaxed/simple; bh=H6jbNlhYPKxICX9pBOmoUAMwvEsvPiIS9SR2byJFPLg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gYAqqHcsh9wtym5F0CvQNmx0vqcb/gavkbweCrJ4Fzy7yaXcTKW9CtF82G25mtawTkm4/cCuW9RLTuglv4hlIsN4u7jKqbHrfjGM3p+3y7jwVzPyga80mHJFgfTG/wDdnNV22rCLdekOW7PXK43szPa3fAALpffub02Qsh9akEQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net; spf=pass smtp.mailfrom=rjwysocki.net; arc=none smtp.client-ip=79.96.170.134 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rjwysocki.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rjwysocki.net Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 5.4.0) id 109f2822a4f54781; Mon, 26 Feb 2024 17:46:55 +0100 Received: from kreacher.localnet (unknown [195.136.19.94]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cloudserver094114.home.pl (Postfix) with ESMTPSA id 4415566A4D4; Mon, 26 Feb 2024 17:46:55 +0100 (CET) From: "Rafael J. Wysocki" To: Linux ACPI , Jonathan Cameron Cc: LKML , Mika Westerberg , "Rafael J. Wysocki" , "Russell King (Oracle)" Subject: [PATCH v2 3/5] ACPI: scan: Make acpi_processor_add() check the device enabled bit Date: Mon, 26 Feb 2024 17:40:52 +0100 Message-ID: <3283809.44csPzL39Z@kreacher> In-Reply-To: <6021126.lOV4Wx5bFT@kreacher> References: <6021126.lOV4Wx5bFT@kreacher> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-CLIENT-IP: 195.136.19.94 X-CLIENT-HOSTNAME: 195.136.19.94 X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedvledrgedvgdeltdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvvefufffkjghfggfgtgesthfuredttddtjeenucfhrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqeenucggtffrrghtthgvrhhnpeektddvveeijeekveekvdffieffheeitdehkeekfeeiheffkefgledtheelhedvudenucffohhmrghinhepuhgvfhhirdhorhhgnecukfhppeduleehrddufeeirdduledrleegnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehinhgvthepudelhedrudefiedrudelrdelgedphhgvlhhopehkrhgvrggthhgvrhdrlhhotggrlhhnvghtpdhmrghilhhfrhhomhepfdftrghfrggvlhculfdrucghhihsohgtkhhifdcuoehrjhifsehrjhifhihsohgtkhhirdhnvghtqedpnhgspghrtghpthhtohepiedprhgtphhtthhopehlihhnuhigqdgrtghpihesvhhgvghrrdhkvghrnhgvlhdrohhrghdprhgtphhtthhopehjohhnrghthhgrnhdrtggrmhgvrhhonheshhhurgifvghirdgtohhmpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepmhhikhgrrdifvghsthgv rhgsvghrgheslhhinhhugidrihhnthgvlhdrtghomhdprhgtphhtthhopehrrghfrggvlheskhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugiesrghrmhhlihhnuhigrdhorhhgrdhukh X-DCC--Metrics: v370.home.net.pl 1024; Body=6 Fuz1=6 Fuz2=6 From: Rafael J. Wysocki Modify acpi_processor_add() return an error if _STA returns the enabled bit clear for the given processor device, so as to avoid using processors that don't decode their resources, as per the ACPI specification. [1] Link: https://uefi.org/specs/ACPI/6.5/06_Device_Configuration.html#sta-device-status # [1] Signed-off-by: Rafael J. Wysocki --- v1 -> v2: * Move acpi_device_is_enabled() to this patch. * Change patch ordering. * Do not check the "functional" _STA bit in acpi_device_is_present(). --- drivers/acpi/acpi_processor.c | 3 +++ drivers/acpi/internal.h | 1 + drivers/acpi/scan.c | 5 +++++ 3 files changed, 9 insertions(+) Index: linux-pm/drivers/acpi/internal.h =================================================================== --- linux-pm.orig/drivers/acpi/internal.h +++ linux-pm/drivers/acpi/internal.h @@ -121,6 +121,7 @@ int acpi_device_setup_files(struct acpi_ void acpi_device_remove_files(struct acpi_device *dev); void acpi_device_add_finalize(struct acpi_device *device); void acpi_free_pnp_ids(struct acpi_device_pnp *pnp); +bool acpi_device_is_enabled(const struct acpi_device *adev); bool acpi_device_is_present(const struct acpi_device *adev); bool acpi_device_is_battery(struct acpi_device *adev); bool acpi_device_is_first_physical_node(struct acpi_device *adev, Index: linux-pm/drivers/acpi/acpi_processor.c =================================================================== --- linux-pm.orig/drivers/acpi/acpi_processor.c +++ linux-pm/drivers/acpi/acpi_processor.c @@ -381,6 +381,9 @@ static int acpi_processor_add(struct acp struct device *dev; int result = 0; + if (!acpi_device_is_enabled(device)) + return -ENODEV; + pr = kzalloc(sizeof(struct acpi_processor), GFP_KERNEL); if (!pr) return -ENOMEM; Index: linux-pm/drivers/acpi/scan.c =================================================================== --- linux-pm.orig/drivers/acpi/scan.c +++ linux-pm/drivers/acpi/scan.c @@ -1945,6 +1945,11 @@ bool acpi_device_is_present(const struct return adev->status.present || adev->status.functional; } +bool acpi_device_is_enabled(const struct acpi_device *adev) +{ + return adev->status.present && adev->status.enabled; +} + static bool acpi_scan_handler_matching(struct acpi_scan_handler *handler, const char *idstr, const struct acpi_device_id **matchid)