From patchwork Tue Mar 1 12:49:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 547292 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE431C433FE for ; Tue, 1 Mar 2022 12:52:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234615AbiCAMw6 (ORCPT ); Tue, 1 Mar 2022 07:52:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232500AbiCAMw4 (ORCPT ); Tue, 1 Mar 2022 07:52:56 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2088.outbound.protection.outlook.com [40.107.93.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAA8C99EDF for ; Tue, 1 Mar 2022 04:52:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n3YwUd1C08akCeDUBGKG65y4eNqrKX6iprZGVvysPyFQUttmS4lZ0vtmCrdl6bxUCm3I1AfTS7ShmMEgCacSv1hUfUdCZ2M2ptHWwpssPzHbABAqMkoUY0TuwaPM5UavX9a7pFznqwFp8o13mtCsVJzrDXbkzxVZxBJM+lNTrbp93PEKUAYFaICjw23RmS+b36WMaHmD+KqBoEBwg7G0A1vq6azJsQF920WmRzhmbkXKbUaN7cV3XAGEsYvEXmSVBhzFxabFrldsVAdK3UGyosxaHkR38Eu0ICIbWoIt2wXOi9d+BOjhnXA05rJ/RIg/VuuHLMJXhYCMq2xFJtpQ3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qLTaHmlcaRqtqRwNxhXpiJj2uP0A0sBXEMVgOlVJU6U=; b=QsEYML/5QIoEuDmStN+9cFuLHSwQV5W2d8Fg9e2uy5uV0uUT63lqIU3v8wDNPXuLa+qxVZGcTQ7VtY0rnaLfgyQzdj2x0bbrnADSAXbYDFpbJnagbO4ajSUmSmVnkSPNjK7CLU0FlsLq82qmwQYPqR58tMaDQ+nT5UAhaRd6sXRg4t8w0d4LP8HCidoltGYznbnWOLdILPM0uF5fTt5DhyE3C3Dt5HBXkyRvFd0EDtFLs5GfqEtDfoLCqwToTTpq93b9hPKe8JOFhacYQs1HFSMR7dUYjQRs2I56fOgsJ3iFoE7wQkNZTSmL1AZC5ErNSL77b6Z5lYEKDmL5OFmsOg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=rjwysocki.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qLTaHmlcaRqtqRwNxhXpiJj2uP0A0sBXEMVgOlVJU6U=; b=yYTwO7CfjUiduzmhnztRSWBCoDEB519LeHbND5/KcYvVEJ8SsogRnNV4vs7MNT2pH2ATcagnuTLNMwxgJg+gSa5y/egBluy8fOr+dUhBgI8dPkyLBkcGS32Dwr140r03OggAKlo/FPEkxQTb5XLsCeER2hKce84VjYDk9FSkWFk= Received: from MWHPR18CA0051.namprd18.prod.outlook.com (2603:10b6:300:39::13) by DM6PR12MB2635.namprd12.prod.outlook.com (2603:10b6:5:45::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.26; Tue, 1 Mar 2022 12:52:12 +0000 Received: from CO1NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:300:39:cafe::16) by MWHPR18CA0051.outlook.office365.com (2603:10b6:300:39::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.26 via Frontend Transport; Tue, 1 Mar 2022 12:52:11 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT016.mail.protection.outlook.com (10.13.175.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5017.22 via Frontend Transport; Tue, 1 Mar 2022 12:52:11 +0000 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.18; Tue, 1 Mar 2022 06:52:07 -0600 From: Mario Limonciello To: "Rafael J . Wysocki" , CC: Mika Westerberg , , , , , "Mario Limonciello" Subject: [PATCH v4 1/3] ACPI: APEI: Adjust for acpi_run_osc logic changes Date: Tue, 1 Mar 2022 06:49:06 -0600 Message-ID: <20220301124908.1931221-1-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 943b0dad-5e55-41b9-a7a8-08d9fb824d79 X-MS-TrafficTypeDiagnostic: DM6PR12MB2635:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kNJk0of1Z+R4te474E/o1Q16rWcUd5ee7WE0Zz5Tq0rxm3VvtfG1HEqdhCNc1LZkq7ot9fQJx/EINIrpsKU7MUj3lWAvorQuNMW/xpMxCZ/PGpOqrsbh/bbF8o1NRedU21fmKrYzbjA25aki1JKfrzazLSLkAgOQNY+k6zm0NfO8qlBZwy6KkcW78NtHYnMKs3Oal/cP36mDi0qx1CQIVyM7bTW1wBPuN7zGg1UYHzZTXa8jffMoH81K2/V5HsV4J2qVgjfCxtZv0g0j/ZFp/Nbrixxni/rN0mQEpF8e1qQk5KtBdT8Zx4G+sJTPFPqQUzKZjCuKH7BO5i3X8u1u4KoMjyH/O4N7YgXuCuOfk91gbb32zbhJpTcgzPVQ3ETHamRIWyndyIbvxkqBdWvdnks1CnC7DCozU/xKrGgFWdPdAX3V/jOuywUXTlGv82jolw6h6gitau+vc0g8y002YmtbCFspn1sFU6SZGhXex/wNAEnbmLITBM/CJgXdmIpbidqGbYAqfTLb59b3IkMg1FbKV5Et8Ng0hoZeW45PJqxFr5RoAe8Dpl61wLCmuO+ifTgrw14vROZWKFDRuDNhvmsYVzM7lMO0I0vbbGoZeNnBsSwOWaSvx5YvLcbr5SJiHV1VB66pFWw3vDx2eCa3WE/sQYcqm1ED+gx5jTwnz1/GfmtQmGWZwbz7nyz+J9m35UoRjreZ30U6Y23zIjxK+Q== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(81166007)(426003)(336012)(356005)(47076005)(36756003)(2906002)(44832011)(40460700003)(2616005)(16526019)(186003)(26005)(1076003)(36860700001)(5660300002)(70586007)(70206006)(86362001)(4326008)(82310400004)(8936002)(508600001)(8676002)(83380400001)(54906003)(110136005)(316002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Mar 2022 12:52:11.1899 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 943b0dad-5e55-41b9-a7a8-08d9fb824d79 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2635 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org As this function calls the OSC with the OSC_QUERY_ENABLE set in OSC_QUERY_DWORD, ensure that it continues to operate the same if the function has returned AE_SUPPORT. Reviewed-by: Mika Westerberg Signed-off-by: Mario Limonciello --- v3->v4: * No changes drivers/acpi/apei/apei-base.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/acpi/apei/apei-base.c b/drivers/acpi/apei/apei-base.c index c7fdb12c3310..f7d1aa687fd9 100644 --- a/drivers/acpi/apei/apei-base.c +++ b/drivers/acpi/apei/apei-base.c @@ -780,6 +780,7 @@ int apei_osc_setup(void) { static u8 whea_uuid_str[] = "ed855e0c-6c90-47bf-a62a-26de0fc5ad5c"; acpi_handle handle; + acpi_status status; u32 capbuf[3]; struct acpi_osc_context context = { .uuid_str = whea_uuid_str, @@ -792,12 +793,12 @@ int apei_osc_setup(void) capbuf[OSC_SUPPORT_DWORD] = 1; capbuf[OSC_CONTROL_DWORD] = 0; - if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle)) - || ACPI_FAILURE(acpi_run_osc(handle, &context))) + if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle))) return -EIO; - else { - kfree(context.ret.pointer); - return 0; - } + status = acpi_run_osc(handle, &context); + if (status != AE_SUPPORT && status != AE_OK) + return -EIO; + kfree(context.ret.pointer); + return 0; } EXPORT_SYMBOL_GPL(apei_osc_setup); From patchwork Tue Mar 1 12:49:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 547617 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B93B3C433F5 for ; Tue, 1 Mar 2022 12:52:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234821AbiCAMw5 (ORCPT ); Tue, 1 Mar 2022 07:52:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234615AbiCAMw4 (ORCPT ); Tue, 1 Mar 2022 07:52:56 -0500 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam08on2087.outbound.protection.outlook.com [40.107.101.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE2F699EE2 for ; Tue, 1 Mar 2022 04:52:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ajUzbf/dciPmgBJPSKdcw7GNCJMgb5qCycwwLV3RddJ6xZVN0gHNXd0GPl2qyCgKdeYEng8HAxeXDXrgQyiSf51A8qgUU3te5xbu+Xtp7dLYMBQ7Lu7pfCTkwt1W7Vz5+Ntrl8ZgieXBqJJoxGEZ17zTrSIpoWENxjlykBaAY6OJf3sitxm4nx24234OO+NBqQEdoXZ6ea1hwJEdXSqVna/L8k9uZoRHTew/V4TxvFwgp3MowLkU3y13w2O7XqtAKLY8vVP0pyQLiD4xW3G2zAJEdddFjfJlD9Uj1xq1+dLj76G2CuEOsD7XzjiJ39Qi9j6kneJ4/zTZi7/M7gDcFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=r/XhbGxt4J+ZR9xQAFTF7NzE11yrUNjrYTFN6okxtd0=; b=He0/tf+Qy8uNLbTAb7QpfBJsEY9uA9zVjVa+jo7wmJMqB1TuRSqM6kzU0dwmr3/cYl2sjT/KTEyhYPOiPt/PX8IoMZ+pZyixqEGi4STsTkzzECYWIp92jKiH6oZvPNMaYRxAa+Y7GByh7UMGbfEea4QYsqyOzmHWCrQ/msweSYMhgLzioz0e3sY7xYNGgOYdpc68ZC+Z96QvdH/84PH9VqCuwrge2IxOCUJZr+nltnJzD6TBR8bDtT5sbgbn8WComDurjIHdGjb996XY+9nW8dma0YbmqIyZeReNoftMOIaF+aIJWswtlEcgIUoS5Fkvc7Z9Wm/HIJMs5Lpv8hHpsA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=rjwysocki.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=r/XhbGxt4J+ZR9xQAFTF7NzE11yrUNjrYTFN6okxtd0=; b=aebaMBMK51oS2pjCykFyFSbBu8uw+zYPiS461aqfFNsosya3Jo3EKoAnpKLIDK5ba/4s/iru0Myh+glIAVi0ZMgrMlj1VbIZ1AmSTSrdlFZRM91RsZ2IFlhXb1N+ywEhCE1vXU2aZtjBavduCYhDemCB1BZHZ1/yzKzE0UcM1Ow= Received: from MWHPR18CA0061.namprd18.prod.outlook.com (2603:10b6:300:39::23) by DS7PR12MB5717.namprd12.prod.outlook.com (2603:10b6:8:70::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.26; Tue, 1 Mar 2022 12:52:13 +0000 Received: from CO1NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:300:39:cafe::d5) by MWHPR18CA0061.outlook.office365.com (2603:10b6:300:39::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.26 via Frontend Transport; Tue, 1 Mar 2022 12:52:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT016.mail.protection.outlook.com (10.13.175.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5017.22 via Frontend Transport; Tue, 1 Mar 2022 12:52:12 +0000 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.18; Tue, 1 Mar 2022 06:52:08 -0600 From: Mario Limonciello To: "Rafael J . Wysocki" , CC: Mika Westerberg , , , , , "Mario Limonciello" Subject: [PATCH v4 2/3] ACPI: bus: Allow negotiating OSC capabilities Date: Tue, 1 Mar 2022 06:49:07 -0600 Message-ID: <20220301124908.1931221-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220301124908.1931221-1-mario.limonciello@amd.com> References: <20220301124908.1931221-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 75bafc98-4305-456a-74c3-08d9fb824e2c X-MS-TrafficTypeDiagnostic: DS7PR12MB5717:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3vjorvpvRYvU3/FZYDacbqP1ooWBwtK9XqrqdvOy5zaDXOACCiXDmOPoRuNeDGM7OA28k8ywaCHBarZWo5Lh46iEBu8lywp982gPuzWI/0/oBmIw/sRcgPC9bZg2XKpRT5P8uqZZbat8NNUyu2zKlwLcZ6RFeGc4kI5kFcGtWwBDIHpaZX9xExW+NXMrbvsV/Vm076Bnj6w3+tTZgA8eNB8GPlJCoQ4Bvuj9wp+248A00cSUzEFveQfi5Zb4XXdtqcDSIvTlWmzZlKkYcE/4Mjvj9G4QcBQgm/Y1Q67pazaBS7npBjtvxr6/hnLGXMIvApUSTxiWcOHIkTnEWIgzD81eg1plFTI8wg4q/Tsyr0oCaeqluOH6nm/w5EU1SbRa1oi9uRkOUs56vklUaiWG2CWKNAsONwXb2AElVGbDROI/5fayEzfHF82/HMKiU3MvaznF9yDL67FAHUOnnousSv8Z2jUOW/PxhsxLzr+RqbMM3zHkESyC3ihhuvaFZSrhQrZymgF1uJIBpABmkWbHtIra047yNf1iYhIqb0e0LWnXvgmPUg/ztIhPLnj/6e2/Lg7mMdSTr0dZs+sYPd/5R0Lk+u10ZsbKoF+QyWEOQSdmV+ln3OIzdT1uVSyJ1BcYjaLJkhABD8uf1Gf5lX8VYsIfzp9ERObBFcDFJV35igxZ5LWvwv/vUcNMReg2yucX/rGoSJ88PPPVECyEFkheCA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(36840700001)(46966006)(40460700003)(2906002)(356005)(81166007)(36756003)(36860700001)(83380400001)(47076005)(8936002)(44832011)(5660300002)(2616005)(1076003)(4326008)(186003)(426003)(316002)(8676002)(336012)(16526019)(70206006)(26005)(70586007)(86362001)(82310400004)(508600001)(54906003)(110136005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Mar 2022 12:52:12.3617 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 75bafc98-4305-456a-74c3-08d9fb824e2c X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5717 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Currently when capabilities have been masked by firmware during a negotiation with OSC_QUERY_ENABLE set they're silently ignored by the caller. If the caller calls `acpi_run_osc` again without query set and the same capabilities, then they instead get a failure possibly leading to downstream problems. So instead when query is set return AE_SUPPORT which callers can then use for determining that capabilities were masked. Signed-off-by: Mario Limonciello --- v3->v4: * Correct kernel doc for AE_OK/AE_SUPPORT not AE_OK/AE_SUCCESS drivers/acpi/bus.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 07f604832fd6..302619ad9d31 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -184,6 +184,18 @@ static void acpi_print_osc_error(acpi_handle handle, pr_debug("\n"); } +/** + * acpi_run_osc - Evaluate the _OSC method for a given ACPI handle + * @handle: ACPI handle containing _OSC to evaluate + * @context: A structure specifying UUID, revision, and buffer for data + * + * Used for negotiating with firmware the capabilities that will be used + * by the OSPM. Although the return type is acpi_status, the ACPI_SUCCESS + * macro can not be used to determine whether to free the buffer of + * returned data. + * + * The buffer must be freed when this function returns AE_OK or AE_SUPPORT. + */ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context) { acpi_status status; @@ -243,16 +255,19 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context) acpi_print_osc_error(handle, context, "_OSC invalid revision"); if (errors & OSC_CAPABILITIES_MASK_ERROR) { + acpi_print_osc_error(handle, context, "_OSC capabilities masked"); if (((u32 *)context->cap.pointer)[OSC_QUERY_DWORD] - & OSC_QUERY_ENABLE) - goto out_success; - status = AE_SUPPORT; - goto out_kfree; + & OSC_QUERY_ENABLE) { + status = AE_SUPPORT; + goto out_masked; + } } status = AE_ERROR; goto out_kfree; } -out_success: + + status = AE_OK; +out_masked: context->ret.length = out_obj->buffer.length; context->ret.pointer = kmemdup(out_obj->buffer.pointer, context->ret.length, GFP_KERNEL); @@ -260,7 +275,6 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context) status = AE_NO_MEMORY; goto out_kfree; } - status = AE_OK; out_kfree: kfree(output.pointer); From patchwork Tue Mar 1 12:49:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 547616 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48A12C433EF for ; Tue, 1 Mar 2022 12:52:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232500AbiCAMxF (ORCPT ); Tue, 1 Mar 2022 07:53:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234817AbiCAMxA (ORCPT ); Tue, 1 Mar 2022 07:53:00 -0500 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2040.outbound.protection.outlook.com [40.107.94.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6A0A99ED9 for ; Tue, 1 Mar 2022 04:52:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ldsykWY63y34kYgQXK3nQ8By9rOlps3bUZ/DBeipo66XpJRPtuhf0hlei3YK0rBnfj0J40hlT9VwZRnwop4PDAmfYNIkKwV1PL7QJKzBD6xAqRTS7zASd89EElIXuYZPQvfxQHrPsYUGqBu3nrAaKmEfvpGCnfJpsdEQCFAh7xFEbL3A6hwME24YJcB2E9xgkmOoPOeT4IiZzZU5c8evf8E5b56C4GtjwM4VPFtaC+QEDmS+EXZKoqs9ux5OcdgU0fHQwglNGaNpwaAaDJKfUhEyf/p71ELZ0p0PuiU8P32QAYYOKEC/7wrlFAz2kpSfm20ExRNpRCewEVi5y38L9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=inIVfV/M2oyk6iS0VTYlUHhAKyb0baVA9oL3d9sC6+s=; b=ltnftWQPf2V0Phx2h53Npx51wOqowSHcpLFoObd1OFyG4wp1Xw6EvRvBqdYRH3zffHyUZQTrxIE5euZFQbLZdDTLgqzqYzampFhrvf4trt+DF0zDDpFLppSK6kSmGvKjE38XTv+O8BoAo1lFce77yPkGVsF3c/L5jYZXeu249caPYVgp/N9IoHn1bAufsqJ85KWBcI8ARx/Mae5lCClfY4j5kPS87d72/FTOc0Tcy2dkjcQXj0NhoX6oii3CKXUa7Wnw8M3AbDI8b6wwBiKjY7XRQXnbaC3HBeS23q+cq2BwTUpOdlZHpVEzCPq5NA4cSitOmnNsH2Kl7u74tkuFhg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=rjwysocki.net smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=inIVfV/M2oyk6iS0VTYlUHhAKyb0baVA9oL3d9sC6+s=; b=EqtHwsJyDOkTE5WWpuVn+rzKV4+NO2SCcNLIdTTHdLGZkEb7S6BfdPozJUcQ1UkGY7rZhvxGtXZrMsrLWprswqeEf9ReVqVVR1iWdLS8rS76WhwhrHrZYfHzlWFSkIA22XwAwCqhzURXo0XAV3WqqUU5Lb3U4zyxKouPKtxbbwg= Received: from MWHPR18CA0063.namprd18.prod.outlook.com (2603:10b6:300:39::25) by MWHPR12MB1712.namprd12.prod.outlook.com (2603:10b6:300:112::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.25; Tue, 1 Mar 2022 12:52:14 +0000 Received: from CO1NAM11FT016.eop-nam11.prod.protection.outlook.com (2603:10b6:300:39:cafe::86) by MWHPR18CA0063.outlook.office365.com (2603:10b6:300:39::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.13 via Frontend Transport; Tue, 1 Mar 2022 12:52:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1NAM11FT016.mail.protection.outlook.com (10.13.175.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5017.22 via Frontend Transport; Tue, 1 Mar 2022 12:52:13 +0000 Received: from localhost.localdomain (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.18; Tue, 1 Mar 2022 06:52:08 -0600 From: Mario Limonciello To: "Rafael J . Wysocki" , CC: Mika Westerberg , , , , , "Mario Limonciello" Subject: [PATCH v4 3/3] ACPI: bus: For platform OSC negotiate capabilities Date: Tue, 1 Mar 2022 06:49:08 -0600 Message-ID: <20220301124908.1931221-3-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220301124908.1931221-1-mario.limonciello@amd.com> References: <20220301124908.1931221-1-mario.limonciello@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1acbb9e7-d9d9-4420-a43b-08d9fb824ee1 X-MS-TrafficTypeDiagnostic: MWHPR12MB1712:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SmNO1FOCFBpmVhQfQ5ccEedvtVyktZo85UEzrt+8sR6pjHzbcZLfdRUkhRCwLGgM9yHjVvmFhpCtwRNdcP3BCraWF9RRC0ZN0oej6OJdTZqUhY2kS30qYB09yfYP4Mvxj5fXn6HIK+vqTaXLnmjR/d4pmGregMDItnAn62QQQGkHTpBCO+BAJ5dK+d85/s0FPsBG/tATlxsTY1IpT11cgWlJFdPQfKMVk9kLDBrALQUMHAMk7QHLfKeZU+E/QShloCip+acei7PmPOaDAqSpsAu5qL0b+XWK2Y9oVoVySpBIbRSxeV4NJfd8n1yxWRoRFjGcE0mqzmKa5FlQEIiaDxAlB++n+U/WztFcw3lrYHme+Rg3v79cpjvKOEAarp5wWSKJMjKgU4o22PcYxo+m8TeKIVJdd2D8t2kRqg7mRU2JiGrr6oavfZswujHTvYDI3MOoE35ZKF3K6UfcyhlBRUuumyr0M+BAjmnX1SHz8EXFSrP+Xrr+24/dJAY0g2jIVVtJMM3C0JY0K+ExCHbUMRgVOMteW1zmyBtKLV2vRXsHZzX4O1zbYTFaUx4dTzccsQFA/+bPkmVnFman3VgQvE81dj4oDYCSa5cFbcEgHdQRMTYsojXfB51lLVw6ztJlhqrrOz6Yzz/WDVpBjQBOrfTgoqSLMJ6yfCs14uL3X6Qj746RoRIHi29qXJwKMAv7BGfyxrPyQKKO5RBXvw8iDA== X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230001)(4636009)(36840700001)(46966006)(40470700004)(54906003)(2616005)(356005)(110136005)(82310400004)(316002)(36860700001)(8936002)(2906002)(336012)(426003)(508600001)(47076005)(70586007)(44832011)(70206006)(40460700003)(81166007)(36756003)(16526019)(186003)(26005)(5660300002)(86362001)(1076003)(8676002)(4326008)(83380400001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Mar 2022 12:52:13.5647 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1acbb9e7-d9d9-4420-a43b-08d9fb824ee1 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT016.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1712 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org According to the ACPI 6.4 spec: It is strongly recommended that the OS evaluate _OSC with the Query Support Flag set until _OSC returns the Capabilities Masked bit clear, to negotiate the set of features to be granted to the OS for native support; a platform may require a specific combination of features to be supported natively by an OS before granting native control of a given feature. After negotiation with the query flag set, the OS should evaluate without it so that any negotiated values can be made effective to hardware. Currently the code sends the exact same values in both executions of the _OSC and this leads to some problems on some AMD platforms in certain configurations. The following notable capabilities are set by OSPM when query is enabled: * OSC_SB_PR3_SUPPORT * OSC_SB_PCLPI_SUPPORT * OSC_SB_NATIVE_USB4_SUPPORT The first call to the platform OSC returns back a masked capabilities error because the firmware did not acknowledge OSC_SB_PCLPI_SUPPORT but it acknolwedged the others. The second call to the platform _OSC without the query flag set then fails because the OSPM still sent the exact same values. This leads to not acknowledging OSC_SB_NATIVE_USB4_SUPPORT and later USB4 PCIe tunnels can't be authorized. This problem was first introduced by commit 159d8c274fd9 ("ACPI: Pass the same capabilities to the _OSC regardless of the query flag") which subtly adjusted the behavior from 719e1f5 ("ACPI: Execute platform _OSC also with query bit clear"). The _OSC was called exactly 2 times: * Once to query and request from firmware * Once to commit to firmware without query To fix this problem, continue to call the _OSC until the firmware has indicated that capabilities are no longer masked or after an arbitrary number of negotiation attempts. Furthermore, to avoid the problem that commit 159d8c274fd9 ("ACPI: Pass the same capabilities to the _OSC regardless of the query flag") introduced, explicitly mark support for CPC and CPPCv2 even if they were masked by the series of query calls due to table loading order on some systems. Fixes: 159d8c274fd9 ("ACPI: Pass the same capabilities to the _OSC regardless of the query flag") Signed-off-by: Mario Limonciello --- v3->v4: * Don't use ACPI_SUCCESS macro at all to avoid confusion on acpi_run_osc drivers/acpi/bus.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 302619ad9d31..c60c7c7e0149 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -308,6 +308,8 @@ static void acpi_bus_osc_negotiate_platform_control(void) .cap.pointer = capbuf, }; acpi_handle handle; + acpi_status status; + int i; capbuf[OSC_QUERY_DWORD] = OSC_QUERY_ENABLE; capbuf[OSC_SUPPORT_DWORD] = OSC_SB_PR3_SUPPORT; /* _PR3 is in use */ @@ -343,10 +345,34 @@ static void acpi_bus_osc_negotiate_platform_control(void) if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle))) return; - if (ACPI_FAILURE(acpi_run_osc(handle, &context))) + /* + * Check if bits were masked, we need to negotiate + * prevent potential endless loop by limited number of + * negotiation cycles. + */ + for (i = 0; i < 5; i++) { + status = acpi_run_osc(handle, &context); + if (status == AE_OK || status == AE_SUPPORT) { + capbuf_ret = context.ret.pointer; + capbuf[OSC_SUPPORT_DWORD] = capbuf_ret[OSC_SUPPORT_DWORD]; + kfree(context.ret.pointer); + } + if (status != AE_SUPPORT) + break; + } + if (ACPI_FAILURE(status)) return; - kfree(context.ret.pointer); + /* + * Avoid problems with BIOS dynamically loading tables by indicating + * support for CPPC even if it was masked. + */ +#ifdef CONFIG_X86 + if (boot_cpu_has(X86_FEATURE_HWP)) { + capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_CPC_SUPPORT; + capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_CPCV2_SUPPORT; + } +#endif /* Now run _OSC again with query flag clear */ capbuf[OSC_QUERY_DWORD] = 0;