Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1084679ybn; Tue, 24 Sep 2019 14:30:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqzvh5KlJ4OR3G2KjA7m7KcSrNSe8jWdSJct8ncuvWtq5yjVIfTgEXBlRsM49AB8T/cxjaYl X-Received: by 2002:a5d:5111:: with SMTP id s17mr4426222wrt.59.1569360624118; Tue, 24 Sep 2019 14:30:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569360624; cv=none; d=google.com; s=arc-20160816; b=H1XgGWqnmoWtre7IVIOUgQjm5r7c/llNRvVb+cbWPAQPLR7aLJKjSqHJYEMhCqIyrD h/joXmtsfBas1wxQx8/b6m1ex/GUIh0OUD/LisR4J3x5UfaxrSXEEcRF+vuXaThBDdXk 2DyL4gbbb7QZMPeqMB8LQmT4CMUA7tSLSqVvZlCBsz/PncVwgmWQLevU5Riz1EgTc6GO CDscIfINPeiwHBESmAcNZgeiuctsMqkB9cKLd0aIA/SA1h5bBK4tlnlJhi784wtgP/IZ RWyxeA0PlYF1ft57S5O0qtYUthcaKLc+U4dRPMYo3zomsmcemLL2Y3Y99q7Pe3eTKYNQ wjTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+SMx81fOaB0jfz+P3rx0EHKdkgObe5NX4ZL5FROdeVc=; b=nm+GSBjBd/M5cq77I+S8gC9GF6+pfIA1Fcg63twCELoE5K9ZuIjK+O1zz9wR5aaEl/ 2IeSKqDZsWk0QKaUegwIEoi06+pyO67CxNnkILhI16h4esWeTtCI7ZQljyDEMSVJNBfk sHXvCA1jRbWRC5yC2enDAbA+0RfQmPzgDGtUdmoD45GklTIXRMc7tWQB9Nat7LoP4Rvn NKgSHAqsyqhredKgRRZN3YJkeEqq3Mtc0Ryj0L66Ww0gjdKWMxzzeM05t85UM3ZtTXyV uZf6l4jef9bXaauFwxYM+9gB8uQj5eFf1xxas8kKbi8TTBHMkpEGqWGPzXusr8Msc1K+ Wgsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GfzC9g2N; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v26si1526193eja.230.2019.09.24.14.30.00; Tue, 24 Sep 2019 14:30:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GfzC9g2N; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438108AbfIVTdX (ORCPT + 99 others); Sun, 22 Sep 2019 15:33:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:44120 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391046AbfIVSri (ORCPT ); Sun, 22 Sep 2019 14:47:38 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7F21521D6C; Sun, 22 Sep 2019 18:47:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569178058; bh=9zoyOyktiRtH8YkllJBaaJyXkixplE8SKeCBP01NexQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GfzC9g2NaboETv1fBV0LgIlZzx7OwPeIPg8fuEeBzjK/weVbe7gfukscibrtTN5W0 DOujdq6O2/UUQUSkzXI3Tt6y8rkejtYwJmW+PfcRF4DlZY3RhK12tNUHae8RuXJt+3 v87BYntb0e/gPwGesv8qntCO1oWT5h028w2OvDHs= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Al Stone , "Rafael J . Wysocki" , Sasha Levin , linux-acpi@vger.kernel.org Subject: [PATCH AUTOSEL 5.3 134/203] ACPI / CPPC: do not require the _PSD method Date: Sun, 22 Sep 2019 14:42:40 -0400 Message-Id: <20190922184350.30563-134-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190922184350.30563-1-sashal@kernel.org> References: <20190922184350.30563-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Stone [ Upstream commit 4c4cdc4c63853fee48c02e25c8605fb65a6c9924 ] According to the ACPI 6.3 specification, the _PSD method is optional when using CPPC. The underlying assumption is that each CPU can change frequency independently from all other CPUs; _PSD is provided to tell the OS that some processors can NOT do that. However, the acpi_get_psd() function returns ENODEV if there is no _PSD method present, or an ACPI error status if an error occurs when evaluating _PSD, if present. This makes _PSD mandatory when using CPPC, in violation of the specification, and only on Linux. This has forced some firmware writers to provide a dummy _PSD, even though it is irrelevant, but only because Linux requires it; other OSPMs follow the spec. We really do not want to have OS specific ACPI tables, though. So, correct acpi_get_psd() so that it does not return an error if there is no _PSD method present, but does return a failure when the method can not be executed properly. This allows _PSD to be optional as it should be. Signed-off-by: Al Stone Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/cppc_acpi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c index 15f103d7532b0..3b2525908dd8c 100644 --- a/drivers/acpi/cppc_acpi.c +++ b/drivers/acpi/cppc_acpi.c @@ -365,8 +365,10 @@ static int acpi_get_psd(struct cpc_desc *cpc_ptr, acpi_handle handle) union acpi_object *psd = NULL; struct acpi_psd_package *pdomain; - status = acpi_evaluate_object_typed(handle, "_PSD", NULL, &buffer, - ACPI_TYPE_PACKAGE); + status = acpi_evaluate_object_typed(handle, "_PSD", NULL, + &buffer, ACPI_TYPE_PACKAGE); + if (status == AE_NOT_FOUND) /* _PSD is optional */ + return 0; if (ACPI_FAILURE(status)) return -ENODEV; -- 2.20.1