Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3179519imw; Mon, 11 Jul 2022 03:40:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tdxlfCzmm99qDOiwUmqekvfHlsbkVlUNUBAa29HxIx2v8NzGeGiIrzay3mVJdP0Ah22Nj3 X-Received: by 2002:a17:903:1c5:b0:16c:4b1f:c5f3 with SMTP id e5-20020a17090301c500b0016c4b1fc5f3mr4431713plh.88.1657536051819; Mon, 11 Jul 2022 03:40:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657536051; cv=none; d=google.com; s=arc-20160816; b=cgD5eGvObEH1CQyKOrJmzeHdm8necsfRr02y7VwvKwmEG9OMayMFlXfVO22mNyP7vB MhbrASNVFZxcZsoY85cYt3ItG8PWmbavBxjKN4qKGnZCjZ3+AFVeP4tRGwgqlOUWuxbu 5V2A8qRcLilEFvKyWBCY3oAWaH1DVuGRwVEX6mD+OUqBOw1aQuchosFw91lyY4AEkmdV SH0jeMCkn6WrDZ4m6RBQbboHCxnN7AnbTLvMCZH50+Mb3jTc9eHmuiuBT+R7q8zMp67n d+Byra4CO/xKEnOagW8JrVGPKSANzTrRBSoLdex4ScmjLzfOoAxoc7F6YMn6HF2jYCXO l72Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=woE53cHbHDyOtF8JmaGKyrugthtAliDZ4x/nJbOzPJk=; b=fCfGmjA44WJ/9aH0KN8s0950ZqdrsnnVZM1J4Hj/Mo5Gxb1OGlrB7OoTfscz18Rrpj 8m3w4E8TtUfrz0PebVx8i86D8Q0Znf2iwnZHb3ysoosXlhKzmP/QcWq9BJgB4g1Koy9L M/6C/XQMykKmTwnKeeoev6SmYqkKW6samOyEQgMTuwYIHzfHliVQIIxxm94WYwmA7o5n P67RI2TaWByljnRcOvuj1zqpvVJJBkTFtvsUcmXW/CzhZsGNV0Uzr3y6q8mgPvm5dTYc toBTsx+iKhnYm6GeA6iqzVHdvhX3Dm1rVUCzzMFsRbw4EF2EsPeDyb8Z2cNst1l8kaGv AhkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Levzabi4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s82-20020a632c55000000b0040cf84add25si10285363pgs.878.2022.07.11.03.40.39; Mon, 11 Jul 2022 03:40:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Levzabi4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232735AbiGKJd4 (ORCPT + 99 others); Mon, 11 Jul 2022 05:33:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232777AbiGKJdF (ORCPT ); Mon, 11 Jul 2022 05:33:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79DC4DFCD; Mon, 11 Jul 2022 02:17:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B689C61227; Mon, 11 Jul 2022 09:17:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93861C34115; Mon, 11 Jul 2022 09:17:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1657531067; bh=Vl9qchXDrnXIPpbdhnqUfVPKvvwM5SxL0Tt8mIXQMNQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Levzabi4wVbiJu168U9VGVvbIqQ51v1e9nZQvosVZ0dTZ4P3a/Pv147hAVQEsc+Xt GHheqmvKYnB9qrWQxuBCxrpOcvn+GmkO6o3HNKexYTEE5UBGb7TRU27QL8acGzboNO SaMdlNtBas9e+MH58Z7VjLtudgmV/Y6CWMgEwpoU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pierre Gondois , Sudeep Holla , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.18 085/112] ACPI: CPPC: Check _OSC for flexible address space Date: Mon, 11 Jul 2022 11:07:25 +0200 Message-Id: <20220711090551.984038787@linuxfoundation.org> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220711090549.543317027@linuxfoundation.org> References: <20220711090549.543317027@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre Gondois [ Upstream commit 0651ab90e4ade17f1d4f4367b70f6120480410f3 ] ACPI 6.2 Section 6.2.11.2 'Platform-Wide OSPM Capabilities': Starting with ACPI Specification 6.2, all _CPC registers can be in PCC, System Memory, System IO, or Functional Fixed Hardware address spaces. OSPM support for this more flexible register space scheme is indicated by the “Flexible Address Space for CPPC Registers” _OSC bit Otherwise (cf ACPI 6.1, s8.4.7.1.1.X), _CPC registers must be in: - PCC or Functional Fixed Hardware address space if defined - SystemMemory address space (NULL register) if not defined Add the corresponding _OSC bit and check it when parsing _CPC objects. Signed-off-by: Pierre Gondois Reviewed-by: Sudeep Holla Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- drivers/acpi/bus.c | 18 ++++++++++++++++++ drivers/acpi/cppc_acpi.c | 9 +++++++++ include/linux/acpi.h | 2 ++ 3 files changed, 29 insertions(+) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 3e58b613a2c4..9eca43d1d941 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -278,6 +278,20 @@ bool osc_sb_apei_support_acked; bool osc_pc_lpi_support_confirmed; EXPORT_SYMBOL_GPL(osc_pc_lpi_support_confirmed); +/* + * ACPI 6.2 Section 6.2.11.2 'Platform-Wide OSPM Capabilities': + * Starting with ACPI Specification 6.2, all _CPC registers can be in + * PCC, System Memory, System IO, or Functional Fixed Hardware address + * spaces. OSPM support for this more flexible register space scheme is + * indicated by the “Flexible Address Space for CPPC Registers” _OSC bit. + * + * Otherwise (cf ACPI 6.1, s8.4.7.1.1.X), _CPC registers must be in: + * - PCC or Functional Fixed Hardware address space if defined + * - SystemMemory address space (NULL register) if not defined + */ +bool osc_cpc_flexible_adr_space_confirmed; +EXPORT_SYMBOL_GPL(osc_cpc_flexible_adr_space_confirmed); + /* * ACPI 6.4 Operating System Capabilities for USB. */ @@ -321,6 +335,8 @@ static void acpi_bus_osc_negotiate_platform_control(void) } #endif + capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_CPC_FLEXIBLE_ADR_SPACE; + if (IS_ENABLED(CONFIG_SCHED_MC_PRIO)) capbuf[OSC_SUPPORT_DWORD] |= OSC_SB_CPC_DIVERSE_HIGH_SUPPORT; @@ -366,6 +382,8 @@ static void acpi_bus_osc_negotiate_platform_control(void) capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_PCLPI_SUPPORT; osc_sb_native_usb4_support_confirmed = capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_NATIVE_USB4_SUPPORT; + osc_cpc_flexible_adr_space_confirmed = + capbuf_ret[OSC_SUPPORT_DWORD] & OSC_SB_CPC_FLEXIBLE_ADR_SPACE; } kfree(context.ret.pointer); diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c index 34576ab0e2e1..840223c12540 100644 --- a/drivers/acpi/cppc_acpi.c +++ b/drivers/acpi/cppc_acpi.c @@ -746,6 +746,11 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr) if (gas_t->address) { void __iomem *addr; + if (!osc_cpc_flexible_adr_space_confirmed) { + pr_debug("Flexible address space capability not supported\n"); + goto out_free; + } + addr = ioremap(gas_t->address, gas_t->bit_width/8); if (!addr) goto out_free; @@ -768,6 +773,10 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr) gas_t->address); goto out_free; } + if (!osc_cpc_flexible_adr_space_confirmed) { + pr_debug("Flexible address space capability not supported\n"); + goto out_free; + } } else { if (gas_t->space_id != ACPI_ADR_SPACE_FIXED_HARDWARE || !cpc_ffh_supported()) { /* Support only PCC, SystemMemory, SystemIO, and FFH type regs. */ diff --git a/include/linux/acpi.h b/include/linux/acpi.h index d7136d13aa44..03465db16b68 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -574,6 +574,7 @@ acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context); #define OSC_SB_OSLPI_SUPPORT 0x00000100 #define OSC_SB_CPC_DIVERSE_HIGH_SUPPORT 0x00001000 #define OSC_SB_GENERIC_INITIATOR_SUPPORT 0x00002000 +#define OSC_SB_CPC_FLEXIBLE_ADR_SPACE 0x00004000 #define OSC_SB_NATIVE_USB4_SUPPORT 0x00040000 #define OSC_SB_PRM_SUPPORT 0x00200000 @@ -581,6 +582,7 @@ extern bool osc_sb_apei_support_acked; extern bool osc_pc_lpi_support_confirmed; extern bool osc_sb_native_usb4_support_confirmed; extern bool osc_sb_cppc_not_supported; +extern bool osc_cpc_flexible_adr_space_confirmed; /* USB4 Capabilities */ #define OSC_USB_USB3_TUNNELING 0x00000001 -- 2.35.1