Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp4951294ybl; Mon, 26 Aug 2019 19:32:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqwq0kZ++ye/bQmkYu+RPHeUWpoIRKwzKsf6bnGM1yuDqCp95Ai+FvXaGVXjKkUFP3ZK6JXF X-Received: by 2002:aa7:8602:: with SMTP id p2mr10474418pfn.138.1566873170702; Mon, 26 Aug 2019 19:32:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566873170; cv=none; d=google.com; s=arc-20160816; b=DJNrGZNSrcT7lIhUZuNUu1A5awYnXpY0KMWJXEzCS+R9qh7sR8sLdeVI/lo3iSFqr9 7paNjTbXCEm3QMfiUCyrvar1zQOB02L6tYhGH5ZlBZ9DyAj+iqVtpjeqJVwcYvd4Pzw4 Y2za94J73X5SeXjg/g+wAlD7MQUnCXAzL/vHCBPQvICc2zQlOIzavTqQYXVPif0zfQAR 13fgfzc1gl2+//fhBHQPnFjEOEtjUvbLPFf1OMFWjFWUJMtPbMAJq6eyDJHT9I92Tgl/ i/IZF83K1ZISPuVDZYE5VN+y/uuPOS86VfKtwBdGjEswER79if155TCD8Y0B0TmyJg4k 5DyQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject:reply-to; bh=ySf8YTYMsVP8iamqAEphzE0BR0aETXvL0kY9WW3W6kY=; b=sxRbOBVx7L0Y4qBRBh7KQ1MrqmpNe3Rjeo4l5n4fG/3FdIneBKMlnfXVizayG5sVZX SAkLVMOqEO7a7HY0B1MiMKOyRtVRdJF1ZLVQpPEx4y2O6WGamwbO7IFfFRAB+hhEhM75 B23jyGYwlv8xzr65aB2/FAkBmofiVyOg9BNmV0BAENItWGNTo6+pOYqG2xYhSF+b2eOh mUTet8YSCelK3siI6ZvgI2HPb3wWbu7YmlwzI20B2uXVFb5C3ugrk6MjlwpqJddmjaiT Cwh68ODKU7t3UxoCB46Hhsr6k3YQ77f74VhXu3MgqTs9n0okaHz/WrKaRob2c6nPmyhf EaWg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 16si10746825pgw.559.2019.08.26.19.32.33; Mon, 26 Aug 2019 19:32:50 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728676AbfH0Cb1 (ORCPT + 99 others); Mon, 26 Aug 2019 22:31:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55460 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728457AbfH0Cb0 (ORCPT ); Mon, 26 Aug 2019 22:31:26 -0400 Received: from mail-io1-f72.google.com (mail-io1-f72.google.com [209.85.166.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1563CC009DE8 for ; Tue, 27 Aug 2019 02:31:26 +0000 (UTC) Received: by mail-io1-f72.google.com with SMTP id x9so25266887ior.9 for ; Mon, 26 Aug 2019 19:31:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:subject:to:cc:references:from :organization:message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=ySf8YTYMsVP8iamqAEphzE0BR0aETXvL0kY9WW3W6kY=; b=Rd53snyOMlP9URAkiStSwZX8MAZXlyPDwJA4xYNYZXCcxUm3BHqGl9BYi3OlL+X0A7 NcKJNcXRDd7oTf55+z4xJ2/HCHLgyCQWBsyjPOr2DdDdzERbZ0AN563IwkpJPaY3A/DI fVpSwOlZ5gKk9QOJ+n/gilFF2rcsemTmzazYAGSIMrDi8oQLQpYI68JaWrl1HpavMXyP M0Zo09mE2BtlLHBsugIH5usJCGv7zOSwnyEiUgl5GA0XL4Zidiqy6uBCz1Uo/JJzYjRL KWbu4R+TQi7fS3eitvC8JZoN5bMztkQOWagqn49RZ/6a9dUSD2Ya0P8GHjdyyPKC3cVm 4ouA== X-Gm-Message-State: APjAAAUAWYV73JQDeH4OtOoH3SAlDwSHIk+S8xZVX8rbLWoU1D8L6JTV v1w7L0kqFcMkmi69+G2VvKJ7nI0GFl0hrtjx8XX0ZRFyGXg5c1ID+kLfSA9R7Rbrt+Yu9HU4m0J Th23IvON8kZxM0ewAHPWcZ9Sy X-Received: by 2002:a5e:c101:: with SMTP id v1mr13090739iol.231.1566873085458; Mon, 26 Aug 2019 19:31:25 -0700 (PDT) X-Received: by 2002:a5e:c101:: with SMTP id v1mr13090725iol.231.1566873085224; Mon, 26 Aug 2019 19:31:25 -0700 (PDT) Received: from masetto.ahs3 (c-67-165-232-89.hsd1.co.comcast.net. [67.165.232.89]) by smtp.gmail.com with ESMTPSA id z9sm19383904ior.79.2019.08.26.19.31.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 26 Aug 2019 19:31:24 -0700 (PDT) Reply-To: ahs3@redhat.com Subject: Re: [PATCH v2] ACPI / CPPC: do not require the _PSD method when using CPPC To: "Rafael J. Wysocki" Cc: ACPI Devel Maling List , Linux Kernel Mailing List , "Rafael J . Wysocki" , Len Brown References: <20190826223047.13146-1-ahs3@redhat.com> From: Al Stone Organization: Red Hat, Inc. Message-ID: <38f21587-f5c9-c831-d7ff-707974178d7f@redhat.com> Date: Mon, 26 Aug 2019 20:31:23 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/26/19 5:02 PM, Rafael J. Wysocki wrote: > On Tue, Aug 27, 2019 at 12:30 AM Al Stone wrote: >> >> 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. >> >> v2: >> -- verified simple check for AE_NOT_FOUND was sufficient >> -- simplified return status check per Rafael's suggestion >> >> Signed-off-by: Al Stone >> Cc: Rafael J. Wysocki >> Cc: Len Brown >> --- >> drivers/acpi/cppc_acpi.c | 10 ++++++---- >> 1 file changed, 6 insertions(+), 4 deletions(-) >> >> diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c >> index 15f103d7532b..7a946f1944ab 100644 >> --- a/drivers/acpi/cppc_acpi.c >> +++ b/drivers/acpi/cppc_acpi.c >> @@ -365,10 +365,12 @@ 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); >> - if (ACPI_FAILURE(status)) >> - return -ENODEV; >> + if (acpi_has_method(handle, "_PSD")) { > > This doesn't look necessary any more. Probably true. I'll look back through acpi_evaluate_object_typed(). >> + status = acpi_evaluate_object_typed(handle, "_PSD", NULL, >> + &buffer, ACPI_TYPE_PACKAGE); >> + if (status == AE_NOT_FOUND) /* _PSD is optional */ >> + return 0; > > And what about the other possible errors? Argh. My apologies. I was not paying attention. I'll correct this and send proper code tomorrow. Really sorry for the noise :(... >> + } >> >> psd = buffer.pointer; >> if (!psd || psd->package.count != 1) { >> -- >> 2.21.0 >> -- ciao, al ----------------------------------- Al Stone Software Engineer Red Hat, Inc. ahs3@redhat.com -----------------------------------