From patchwork Mon Feb 14 10:14:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 543423 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 2204EC43217 for ; Mon, 14 Feb 2022 10:51:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349323AbiBNKvw (ORCPT ); Mon, 14 Feb 2022 05:51:52 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350045AbiBNKvJ (ORCPT ); Mon, 14 Feb 2022 05:51:09 -0500 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2079.outbound.protection.outlook.com [40.107.212.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD10688B10; Mon, 14 Feb 2022 02:15:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=enSIdfx7WpgJFhaqDune0tvZCjBwt6wsvtjte+oqxkt0j5B6cot3fZC5U/CJK4f5rwlwzKhoX7Yo3g1yQKWGSvC6imV/MsqthiwGHYgKX4ynSzo3N1AuHvZQZd9OLl1X6jR73bRxp6IQPcBWYr5lD983VUOTPNh1ouRFxk4EPCWROree3Zr1M0Px2GnhQnqSkWMJXycn7lacD9HxTNRzq5kHhDdy/LYI8wRxoRgNVtI3rHvvXboERRul1qX2htUGqYFqtFnQM8xNzJxySKCieAuSb/0WdT/juPxtzqdfTIRZGW75ePtVguHphLzL6ulXxMx6UeoGmUy031fcxZf0dw== 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=hNbkBH7B5iMPv0VrmuE3kbcImPmX9WR9+nNGVLrN2BU=; b=hTgBVdrq9KvZ6Er1fA1RFIBAEnOXm5L5iWKX1zdq7nQ5G990Rgs7LIgAne7YR1d4uYgIENb9ielUv0Mixrth/mui6nbPafb/Oibpo68kPsNOGCNaH0nLOrkHRKodTJYhteHqm/kt2tjB9sNMHKnWIcDNdPTR03VtV6IB1jUCENp6knWgofIMNnG9WRv39yRprtt0xOiZphKkuzshJVo2VqEs+bNfQhdIGon4aFCzSO7eiEF/BJLhm2443EHIfkPiRAiV5wLbOYUIaS5EvgucpBAnFiWb+Mbo2FmBSwTTY5XULyt19joLnunJof9ehgw5jGOjHf8cQ0UPNNlMrdpVKg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de 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=hNbkBH7B5iMPv0VrmuE3kbcImPmX9WR9+nNGVLrN2BU=; b=0QQXmH1KqBfIW9PL3UGfHI5W+XiTVrgY6cgb0RP7v+40UqsVtDvqDYvnkOnIKQb2czaiagGr8/TZMouxIpUtsRiWq4d8kOpr3trJk4toI5MaIB/zhOmCF57sUmwQD35CWjC9y5nVWI4PZHQoLvqOdStlZhYGDdRNz3z8+VVqB1o= Received: from DM6PR21CA0008.namprd21.prod.outlook.com (2603:10b6:5:174::18) by BY5PR12MB4145.namprd12.prod.outlook.com (2603:10b6:a03:212::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11; Mon, 14 Feb 2022 10:15:17 +0000 Received: from DM6NAM11FT027.eop-nam11.prod.protection.outlook.com (2603:10b6:5:174:cafe::37) by DM6PR21CA0008.outlook.office365.com (2603:10b6:5:174::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5017.6 via Frontend Transport; Mon, 14 Feb 2022 10:15:16 +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 DM6NAM11FT027.mail.protection.outlook.com (10.13.172.205) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 10:15:15 +0000 Received: from hr-amd.amd.com (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; Mon, 14 Feb 2022 04:15:10 -0600 From: Huang Rui To: Borislav Petkov , "Rafael J . Wysocki" , , , CC: , Randy Dunlap , Stephen Rothwell , Giovanni Gherdovich , Alex Deucher , "Deepak Sharma" , Jinzhou Su , Perry Yuan , Jassmine Meng , Huang Rui Subject: [PATCH 1/4] x86/acpi: Expand the CPPC MSR file to cover the whole CPPC implementation Date: Mon, 14 Feb 2022 18:14:47 +0800 Message-ID: <20220214101450.356047-2-ray.huang@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220214101450.356047-1-ray.huang@amd.com> References: <20220214101450.356047-1-ray.huang@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 869c178b-2ec3-470e-62ae-08d9efa2e4bc X-MS-TrafficTypeDiagnostic: BY5PR12MB4145:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FJQTZmikMe3o+nUNhi9AW+c4o8UU4H9fvILRFOcRWM8NWA/D1i+B7zPnfkvRkjbod9ucbu9yBeXOPO7hxP+SswuEGDvXB5OYkAygHzPWJBOctvadGc634XURwIbRofJrMzozx4nbkVkBIH/49PxTqlOSGFmhtzk2fDnsANxIhn36QatDM5ACDGhwLv2///Dj+rmn4nK5RMWLAyGc1fyk1riltMagfUX5g2tmzLQoumNTyNstxsD6iZmVNU05shiVcymJyngbtDEYlGvkE5G+uEpxs3cL2DWUopEwjC0Qr6t7nFwpzuxQdPOYMgSG61cwkiHOxi7RbnThlQYWkZ7ul+vTSRMXZ1DujDeSMrZZZ49sjIOjvhHkl4n0/BHVIM3hRIV9DXbKG5hdi7SinmOJBAy8G3EaVkEjDBf0kuV6XqA0I/NIZXq3aBR9dXemlPl4SO/8lJDj0PPWARkXHEg2qB5xhJUZq7s+z8xYg5auLfG+W7yjPHMawMaZWhk/HU0JYon8+WQHPYtvBAyecD07v8HmuMMNv6/PwoXyllB7li5NSNwg30RksdxKKgjwga0l86+7aKo0LPiYk1+Qp1vzWmylarrywfPGuKtYRfP32qp8n8WhFsN1e0O4xJRg5Dt/0pjjVReMbh8ZUMQkSi0zht+Koz+sT1SV8p1LtdBlolIMtOcuyws3Fdf5mKznk5vxQBvpII8JLRCP6nuR8FpL9g== 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)(36860700001)(47076005)(508600001)(2616005)(7696005)(83380400001)(82310400004)(336012)(426003)(186003)(1076003)(26005)(16526019)(356005)(4326008)(8676002)(86362001)(70586007)(40460700003)(70206006)(8936002)(5660300002)(2906002)(36756003)(6666004)(110136005)(316002)(54906003)(81166007)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2022 10:15:15.0146 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 869c178b-2ec3-470e-62ae-08d9efa2e4bc 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: DM6NAM11FT027.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4145 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Rename the cppc_msr.c to cppc.c in x86 ACPI, that expects to use this file to cover more function implementation for ACPI CPPC beside MSR helpers. Naming as "cppc" is more straightforward as one of the functionalities under ACPI subsystem. Signed-off-by: Huang Rui --- arch/x86/kernel/acpi/Makefile | 2 +- arch/x86/kernel/acpi/{cppc_msr.c => cppc.c} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename arch/x86/kernel/acpi/{cppc_msr.c => cppc.c} (96%) diff --git a/arch/x86/kernel/acpi/Makefile b/arch/x86/kernel/acpi/Makefile index cf340d85946a..fc17b3f136fe 100644 --- a/arch/x86/kernel/acpi/Makefile +++ b/arch/x86/kernel/acpi/Makefile @@ -3,7 +3,7 @@ obj-$(CONFIG_ACPI) += boot.o obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup_$(BITS).o obj-$(CONFIG_ACPI_APEI) += apei.o -obj-$(CONFIG_ACPI_CPPC_LIB) += cppc_msr.o +obj-$(CONFIG_ACPI_CPPC_LIB) += cppc.o ifneq ($(CONFIG_ACPI_PROCESSOR),) obj-y += cstate.o diff --git a/arch/x86/kernel/acpi/cppc_msr.c b/arch/x86/kernel/acpi/cppc.c similarity index 96% rename from arch/x86/kernel/acpi/cppc_msr.c rename to arch/x86/kernel/acpi/cppc.c index b961de569e7e..08d823d72586 100644 --- a/arch/x86/kernel/acpi/cppc_msr.c +++ b/arch/x86/kernel/acpi/cppc.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * cppc_msr.c: MSR Interface for CPPC + * cppc.c: CPPC Interface for x86 * Copyright (c) 2016, Intel Corporation. */ From patchwork Mon Feb 14 10:14:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 543424 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 5E05FC433F5 for ; Mon, 14 Feb 2022 10:51:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348955AbiBNKvr (ORCPT ); Mon, 14 Feb 2022 05:51:47 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350083AbiBNKvK (ORCPT ); Mon, 14 Feb 2022 05:51:10 -0500 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2068.outbound.protection.outlook.com [40.107.237.68]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7124A6D39D; Mon, 14 Feb 2022 02:15:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ay70GTvrHIT5vYSOhfujfd+oMaCe09tlsCP8hQ7GifGDgsMFBFXlkaMwvAE0Mngt4TO1z+wEhfkWVIYZDiPJfnVHNowSArFqiy3RVZP4eESaMd2SmK5W6Oon9Umw1IKeFECXFescOHNdXzd43kNKd2Fiq9Xi1qlAHzmfLiv9AROTYEqxxk0HgMI6a7tgNX+Mb/G32Dq/RuUaSA4r2wktNvZRMXV3rb1LPylOUhKOSUv/6v1yWU0Kv2+C4dCR8AG2EhPdg3hEDNrmqVGFgktbWSfIdH9SVCoowbeP7ivihkRHjVGzKnrOH3NV0GXML/TfVUDL7Q0JbQjdr85l3uv1PQ== 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=JfkqBk6TaZEpyz4CxeBo7+E5Pr+Td4vJVvuYHb5o1So=; b=ClmeX1lFKULTSQwxbdmQHEGtNp8zV/slhMQov5u4MWOMWLUOqNxi8FknL+2h6M6ORbHFAD2P/bckyO+rWkZs/m8qXsgVQpSVJJ1r2IuRDv4puUhkHYgQdSmNqdJ06GYcLnyHulRRAd9qjHgvRKeZlloHINA9S5x2M1uDrk3Achfgajpa3qHyKTM6JPgQ/pFVdzb1T5v4YAm8ji8GevKj7e/xktFec3VgmkAhvgb0s+XRJJh4oqP41u/BLWkOeKsnQp7idaouxyOqbn7ziyBi5H7CH8+YNnmm875xX8Uw2iQlg4TIeKjB4DnTJhgcEKXhoS+s2xpthGlJeWTkR9yvPw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de 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=JfkqBk6TaZEpyz4CxeBo7+E5Pr+Td4vJVvuYHb5o1So=; b=idAGQbcTt4+QETukzel5ySvoqNKrY02TFqr+OCQAbJVtOFYfaE64NLRStkj8w43Ypjp8+x+sYINh7NKshzr8aTO461/bUDpFKZHJdJzkUUioZJ4LAXb8RpNr2TAT0L8F//ts2Q3Je1dD4QJ8u/cdY6KrWpo47Xe7P1eGdylNCLU= Received: from DM5PR19CA0058.namprd19.prod.outlook.com (2603:10b6:3:116::20) by MN2PR12MB2974.namprd12.prod.outlook.com (2603:10b6:208:c1::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.12; Mon, 14 Feb 2022 10:15:19 +0000 Received: from DM6NAM11FT017.eop-nam11.prod.protection.outlook.com (2603:10b6:3:116:cafe::d) by DM5PR19CA0058.outlook.office365.com (2603:10b6:3:116::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.18 via Frontend Transport; Mon, 14 Feb 2022 10:15:19 +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 DM6NAM11FT017.mail.protection.outlook.com (10.13.172.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 10:15:18 +0000 Received: from hr-amd.amd.com (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; Mon, 14 Feb 2022 04:15:14 -0600 From: Huang Rui To: Borislav Petkov , "Rafael J . Wysocki" , , , CC: , Randy Dunlap , Stephen Rothwell , Giovanni Gherdovich , Alex Deucher , "Deepak Sharma" , Jinzhou Su , Perry Yuan , Jassmine Meng , Huang Rui Subject: [PATCH 2/4] x86, sched: Move AMD maximum frequency ratio setting function into x86 CPPC Date: Mon, 14 Feb 2022 18:14:48 +0800 Message-ID: <20220214101450.356047-3-ray.huang@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220214101450.356047-1-ray.huang@amd.com> References: <20220214101450.356047-1-ray.huang@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7c4133ca-e670-4b48-78a6-08d9efa2e702 X-MS-TrafficTypeDiagnostic: MN2PR12MB2974:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LQ0opLGkJMYd3UibTSHFag4QSqObOriRfeERmq92exhqS9J2U3UsNCXTuDiIZB5Db5SFjfHOWk/lhrEa1GKD9/qKoHxT/zYP7QSuUtA3ppNe+N4/EuzwU08sSsk7NdvU2K5HL5GXHZd/bjMQ0E800M8OscFk8Upo0YP9wv7FcVWIxONQ56W/AqioEekhBM/p8qGw0k86HmwMGMUqUqouHviEY7hoHu7VQIffm3geQOtG4sKa9QdoJAJRuwkyZePxRT4hvxC0uOsHcljwyEYq+xwhEgbbcycOWm44mHLd/HIWPlaJ14N3psyOXmB28xi3owKKHj0lZ5bXpnFRjc0EWTOgH4bK14rdFJ6CCyS6zp0lpxgIuh55doKXmQkUTZLtF4yrVT4tW6uklrEZRjqJ5cTmML2+Utsf3T3FGm3f3WowDY/3IVSZ/IUMCa7XFHoK30wyK2exVizr4dCoSAL+F3czE/vfwhbAZPEO+NXNmrddWghuhL4jdnlWMwze59fN4GE2G9ekFQC1lbM06tlhV4Is2ykkAww7lxfMIsctVSlh+svm8iMioyOjrajBP+h7yvdfzUgTtwtGVcuV2gOOxArTdrYkzufodndrWpcYf3eSYcAVtgbqfa15r9O9ld66n8zdTFBSs31Q6Wr1fLjR1liivqnsLQqCzLDfbJ5thzjW+e7ZsAURcHID9NjI9LNeuow493wTOAveOhnJQLfT+w== 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)(40470700004)(46966006)(82310400004)(356005)(316002)(110136005)(81166007)(2906002)(54906003)(8936002)(4326008)(8676002)(6666004)(70586007)(70206006)(5660300002)(86362001)(26005)(186003)(1076003)(36756003)(2616005)(16526019)(336012)(426003)(47076005)(7696005)(83380400001)(36860700001)(508600001)(40460700003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2022 10:15:18.8293 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7c4133ca-e670-4b48-78a6-08d9efa2e702 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: DM6NAM11FT017.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB2974 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org The AMD maximum frequency ratio setting function depends on CPPC, so the x86 CPPC implementation file is better space for this function. Signed-off-by: Huang Rui --- arch/x86/include/asm/topology.h | 9 +++++++ arch/x86/kernel/acpi/cppc.c | 40 ++++++++++++++++++++++++++++++ arch/x86/kernel/smpboot.c | 44 +-------------------------------- 3 files changed, 50 insertions(+), 43 deletions(-) diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h index 2f0b6be8eaab..168ade7d4007 100644 --- a/arch/x86/include/asm/topology.h +++ b/arch/x86/include/asm/topology.h @@ -226,4 +226,13 @@ void init_freq_invariance_cppc(void); #define init_freq_invariance_cppc init_freq_invariance_cppc #endif +#ifdef CONFIG_ACPI_CPPC_LIB +bool amd_set_max_freq_ratio(u64 *ratio); +#else +static inline bool amd_set_max_freq_ratio(u64 *ratio) +{ + return false; +} +#endif + #endif /* _ASM_X86_TOPOLOGY_H */ diff --git a/arch/x86/kernel/acpi/cppc.c b/arch/x86/kernel/acpi/cppc.c index 08d823d72586..f0be5058e3e3 100644 --- a/arch/x86/kernel/acpi/cppc.c +++ b/arch/x86/kernel/acpi/cppc.c @@ -6,6 +6,8 @@ #include #include +#include +#include /* Refer to drivers/acpi/cppc_acpi.c for the description of functions */ @@ -47,3 +49,41 @@ int cpc_write_ffh(int cpunum, struct cpc_reg *reg, u64 val) } return err; } + +bool amd_set_max_freq_ratio(u64 *ratio) +{ + struct cppc_perf_caps perf_caps; + u64 highest_perf, nominal_perf; + u64 perf_ratio; + int rc; + + if (!ratio) + return false; + + rc = cppc_get_perf_caps(0, &perf_caps); + if (rc) { + pr_debug("Could not retrieve perf counters (%d)\n", rc); + return false; + } + + highest_perf = amd_get_highest_perf(); + nominal_perf = perf_caps.nominal_perf; + + if (!highest_perf || !nominal_perf) { + pr_debug("Could not retrieve highest or nominal performance\n"); + return false; + } + + perf_ratio = div_u64(highest_perf * SCHED_CAPACITY_SCALE, nominal_perf); + /* midpoint between max_boost and max_P */ + perf_ratio = (perf_ratio + SCHED_CAPACITY_SCALE) >> 1; + if (!perf_ratio) { + pr_debug("Non-zero highest/nominal perf values led to a 0 ratio\n"); + return false; + } + + *ratio = perf_ratio; + arch_set_max_freq_ratio(false); + + return true; +} diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 617012f4619f..0718cc7649a4 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -2097,48 +2097,6 @@ static bool intel_set_max_freq_ratio(void) return true; } -#ifdef CONFIG_ACPI_CPPC_LIB -static bool amd_set_max_freq_ratio(void) -{ - struct cppc_perf_caps perf_caps; - u64 highest_perf, nominal_perf; - u64 perf_ratio; - int rc; - - rc = cppc_get_perf_caps(0, &perf_caps); - if (rc) { - pr_debug("Could not retrieve perf counters (%d)\n", rc); - return false; - } - - highest_perf = amd_get_highest_perf(); - nominal_perf = perf_caps.nominal_perf; - - if (!highest_perf || !nominal_perf) { - pr_debug("Could not retrieve highest or nominal performance\n"); - return false; - } - - perf_ratio = div_u64(highest_perf * SCHED_CAPACITY_SCALE, nominal_perf); - /* midpoint between max_boost and max_P */ - perf_ratio = (perf_ratio + SCHED_CAPACITY_SCALE) >> 1; - if (!perf_ratio) { - pr_debug("Non-zero highest/nominal perf values led to a 0 ratio\n"); - return false; - } - - arch_turbo_freq_ratio = perf_ratio; - arch_set_max_freq_ratio(false); - - return true; -} -#else -static bool amd_set_max_freq_ratio(void) -{ - return false; -} -#endif - static void init_counter_refs(void) { u64 aperf, mperf; @@ -2187,7 +2145,7 @@ static void init_freq_invariance(bool secondary, bool cppc_ready) if (!cppc_ready) { return; } - ret = amd_set_max_freq_ratio(); + ret = amd_set_max_freq_ratio(&arch_turbo_freq_ratio); } if (ret) { From patchwork Mon Feb 14 10:14:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 543425 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 8366FC433F5 for ; Mon, 14 Feb 2022 10:51:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239516AbiBNKvZ (ORCPT ); Mon, 14 Feb 2022 05:51:25 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350186AbiBNKvL (ORCPT ); Mon, 14 Feb 2022 05:51:11 -0500 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam08on20602.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e8d::602]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05294C084E; Mon, 14 Feb 2022 02:15:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ibRUknoPRS3g2WdDLxRvQllWlx0Easnulwix0zHZ0JR1vviFLkJTga4e6MPxnftYJL4d63D8XjMtqkqBeL9iioUBAOCnNlahdjuErt2PqYF/A19Wt7EZPX29Xb/n0jXFtkGj9E18hbon2QLd95ZpGN/AU7Ml/fbvXP/cB59bc4Lp+iYYtFvkZqgcwN3SpEDxiARa2JhVNxaElwMJpRGG2axpY7/hDCSz7Z6+n4i/IFtK82zIgGe/ScQl1zoJRtdF4Gh2Mu2uiQfQ6j9EbbKgfB2FswI61tgA0iTwkvfd5RcBhdqm6aonHZ4Ymf1749QhmTinpBAdM0knGJB+MPB1xQ== 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=RvYcUDPVfdmkbEVC7vT/3UsnY3wrJxo524uI4cbNrc0=; b=MXtYvuYLFYmKHk0CRMIcuqey3fVZKUBkQ+Kx7GsJ26fJm/LUuZYHcMTY/xQvqVCy0HDmhn6fczwfXufX0D1R7e0bWx9kcUQqA0LTl9z+2HUca+ghGDB0pFfeVCJ3ly23Aa7PFhP4EGwT10lrBGN0wETYak6C2daFffzj8wLg68pxaAqfeAYjvD6BxJc+gWC7JEQQCd0GUVgiIaEdxfqHnne99Uazc1rTC3WOTXYqvgvhH6CUf5fJ5hbc8nsHAP2WA4vzl2H/MQBTD2dltj9R1mDbsKT12AnGUaoonHk4Z2OoLoivLcGPlGD7m5xKJHEI3S4mkwaQe+lt8/aym0nkrQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de 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=RvYcUDPVfdmkbEVC7vT/3UsnY3wrJxo524uI4cbNrc0=; b=DFEeV4Kv/Dl6cOei5oSxUBTphAQBZQ5z65A08YfiAnyv3DE4sQ0RBbdVt6qYEzigW0SUy7BkpuSWMgGQtktZ0y19UBhhk9FiyKGpdX4sOlWOLMbrOY4dMHS72mIdZ33YsPeRn9QTT/7L5MIXExk/0kY7qRm1pZZOw82Jkf2fkXY= Received: from DM6PR01CA0013.prod.exchangelabs.com (2603:10b6:5:296::18) by PH7PR12MB5902.namprd12.prod.outlook.com (2603:10b6:510:1d6::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.18; Mon, 14 Feb 2022 10:15:24 +0000 Received: from DM6NAM11FT034.eop-nam11.prod.protection.outlook.com (2603:10b6:5:296:cafe::fc) by DM6PR01CA0013.outlook.office365.com (2603:10b6:5:296::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 10:15:24 +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 DM6NAM11FT034.mail.protection.outlook.com (10.13.173.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 10:15:22 +0000 Received: from hr-amd.amd.com (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; Mon, 14 Feb 2022 04:15:18 -0600 From: Huang Rui To: Borislav Petkov , "Rafael J . Wysocki" , , , CC: , Randy Dunlap , Stephen Rothwell , Giovanni Gherdovich , Alex Deucher , "Deepak Sharma" , Jinzhou Su , Perry Yuan , Jassmine Meng , Huang Rui Subject: [PATCH 3/4] x86, sched: Expose init_freq_invariance to topology header Date: Mon, 14 Feb 2022 18:14:49 +0800 Message-ID: <20220214101450.356047-4-ray.huang@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220214101450.356047-1-ray.huang@amd.com> References: <20220214101450.356047-1-ray.huang@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b775440e-79e0-4bb6-3ef1-08d9efa2e97a X-MS-TrafficTypeDiagnostic: PH7PR12MB5902:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: g+Zir3AG3IoOOs2p42gAqbTQMgRvjd3TOZdsZCGukIIZ7liAvEMpNY6IlLorp+bM5DypO7zRJ/bNy08/zbr4wWGlubti9kEnkt3MwOE3gofbO3e9ihAiBRdIL9Cuqxn4XGsJ2lYRivMqZkBn8NUw296fxIttXGJ4K2Wt0ebi23Qy+8Wv+zMWBds9yEz5wIZ++cwwPsCbQT8cPsGd4BxtS6EhHIaIpAxzNWsjsXu2DMnTnSV/j88E2Cu6zDZc6Omh+ySUjtbX7pjHvYRm4IFuK+B2LFIuTWzZ2ZHa6fXaxocABBItRbtf+Owa3mDrDxHC6lFpFO+rEyy+deGYT+fVnBmbTfNFN15tAbgqlWDzx0TDXJtQsTTkvRnD8UkvJmlcFI+2UmowAR4QTquIgTTs8qtjMHGVWuIE8KphKqCfxMv7ZeZcUl8eRI6IQgdgc9tIey3soPRLERjQv8/zQdyb1sbLz32cJVKyX037KNAw69PvLo7EwNpIY3saSq6uOOjFHnaRpvCOp1z/7RWJgJOO0UQRZnT9jUf6M8cQvXFu5fWPMQdDrtLxsI7LIh4Lj/yh7F6q/yLRMGP0+qfi8brlogBgMXe2HFQEM9shg9QLqylNtbc9VACfEf6f2Vrc0JzLUuuAcMZQUtHG2alvmu2Z2xTItVAhMUcS3X/TAo/oUrIUxb1pjKf3C57KgGZkhHGW2hyYbUVt/y8byCdN05XZOw== 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)(8936002)(4326008)(186003)(70206006)(2906002)(5660300002)(82310400004)(8676002)(70586007)(86362001)(36756003)(356005)(81166007)(16526019)(83380400001)(26005)(36860700001)(336012)(508600001)(40460700003)(2616005)(47076005)(1076003)(316002)(110136005)(54906003)(426003)(6666004)(7696005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2022 10:15:22.9541 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b775440e-79e0-4bb6-3ef1-08d9efa2e97a 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: DM6NAM11FT034.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5902 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org The function init_freq_invariance will be used on x86 CPPC, so expose it in the topology header. Signed-off-by: Huang Rui --- arch/x86/include/asm/topology.h | 4 ++++ arch/x86/kernel/smpboot.c | 8 +------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h index 168ade7d4007..c35005a03768 100644 --- a/arch/x86/include/asm/topology.h +++ b/arch/x86/include/asm/topology.h @@ -215,10 +215,14 @@ extern void arch_scale_freq_tick(void); #define arch_scale_freq_tick arch_scale_freq_tick extern void arch_set_max_freq_ratio(bool turbo_disabled); +void init_freq_invariance(bool secondary, bool cppc_ready); #else static inline void arch_set_max_freq_ratio(bool turbo_disabled) { } +static inline void init_freq_invariance(bool secondary, bool cppc_ready) +{ +} #endif #if defined(CONFIG_ACPI_CPPC_LIB) && defined(CONFIG_SMP) diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 0718cc7649a4..8f2ff9be0fcc 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -155,8 +155,6 @@ static inline void smpboot_restore_warm_reset_vector(void) *((volatile u32 *)phys_to_virt(TRAMPOLINE_PHYS_LOW)) = 0; } -static void init_freq_invariance(bool secondary, bool cppc_ready); - /* * Report back to the Boot Processor during boot time or to the caller processor * during CPU online. @@ -2125,7 +2123,7 @@ static void register_freq_invariance_syscore_ops(void) static inline void register_freq_invariance_syscore_ops(void) {} #endif -static void init_freq_invariance(bool secondary, bool cppc_ready) +void init_freq_invariance(bool secondary, bool cppc_ready) { bool ret = false; @@ -2222,8 +2220,4 @@ void arch_scale_freq_tick(void) pr_warn("Scheduler frequency invariance went wobbly, disabling!\n"); schedule_work(&disable_freq_invariance_work); } -#else -static inline void init_freq_invariance(bool secondary, bool cppc_ready) -{ -} #endif /* CONFIG_X86_64 */ From patchwork Mon Feb 14 10:14:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 542546 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 85D26C433EF for ; Mon, 14 Feb 2022 10:51:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348942AbiBNKv0 (ORCPT ); Mon, 14 Feb 2022 05:51:26 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350208AbiBNKvM (ORCPT ); Mon, 14 Feb 2022 05:51:12 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2056.outbound.protection.outlook.com [40.107.93.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4297BC0856; Mon, 14 Feb 2022 02:15:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zh+hPIfzNbiQ6Vb8LYU3i1MHmV4pFsbDd8mJlWwm/O7aagnGR1oizujm3NmvnaZTOLrKoJJ6b89p4F+OhCwNa0OKi2IvVQRwbZctjsUUPfMh3SEXROUlZ6O1+LcwYoJHTa3HbOM7XdxFgn3uOg6aBqn+51iQV46uritf0dckNEzZZD4kpdWBCLb407HER7vjvnmperjo8p8f3DsT82LrkTytrdxbH0uEIyRj2JYUqMUm34KYtkfav4UaxRSM/iwym9Csmkmw9HtztyzI214pJBtJbwjgg7m3VKvdoaoXbeLUqRlR6KJfuoDpqGfOnbYLov5rO4D+0WRoXP95vo9ALg== 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=sPUrtHrY6l9SV5qiNIJagpflLiCnn8P9tSXYd3+Fi44=; b=Z9AhIV3tGit7APptwF5opO0lE0wSWsSJ0nE6SWm3Wrm9V8OLuDduRlGge9KgJ5jzPzAmVLPsvJ6qCnned0Hh7ES93C8jQF/UaN3xSVbAmRhI1U4vX8e4rrYlHfFdQqSja0PLQcPLycQD/V65QcB66CUVEcXFbsjGfWIhq+rb3kpcVpHN0btk11EMOvkLY5DwPTapajNz8da4dYKs+8FB7E2LHQ2GZ305CSwBT6RN2yclXCKik7PPp7wniwa5/8Cp1dmp/df/pK8KiC6t0He95wQ+1V9B31nTCHW93h00dJYL3TfPT8eF3lsgetgwskSHSH8u8L5Emb+1+CZW4Fi2Mw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de 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=sPUrtHrY6l9SV5qiNIJagpflLiCnn8P9tSXYd3+Fi44=; b=rfC1/iZj4he2UFBvh8h7EX10XVDoi7sXz/Mr3xv99O6rK1s2CJdR+L+QUYb1VDjvqehPK5y7ON8Q8O6PV0jEvrsUnWR0LGETL8p3imnb9rBzGKsqu/FFRpSOvf4bcOEozNMVS31XbKVFDYo376Ta+uC9+6BaAX++Tz2+vZJixy0= Received: from DM6PR03CA0079.namprd03.prod.outlook.com (2603:10b6:5:333::12) by DM6PR12MB4299.namprd12.prod.outlook.com (2603:10b6:5:223::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11; Mon, 14 Feb 2022 10:15:27 +0000 Received: from DM6NAM11FT050.eop-nam11.prod.protection.outlook.com (2603:10b6:5:333:cafe::11) by DM6PR03CA0079.outlook.office365.com (2603:10b6:5:333::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 10:15:27 +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 DM6NAM11FT050.mail.protection.outlook.com (10.13.173.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.4975.11 via Frontend Transport; Mon, 14 Feb 2022 10:15:26 +0000 Received: from hr-amd.amd.com (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; Mon, 14 Feb 2022 04:15:22 -0600 From: Huang Rui To: Borislav Petkov , "Rafael J . Wysocki" , , , CC: , Randy Dunlap , Stephen Rothwell , Giovanni Gherdovich , Alex Deucher , "Deepak Sharma" , Jinzhou Su , Perry Yuan , Jassmine Meng , Huang Rui Subject: [PATCH 4/4] x86/acpi: Move init_freq_invariance_cppc into x86 CPPC Date: Mon, 14 Feb 2022 18:14:50 +0800 Message-ID: <20220214101450.356047-5-ray.huang@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220214101450.356047-1-ray.huang@amd.com> References: <20220214101450.356047-1-ray.huang@amd.com> MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d4bc049d-d84e-4457-9cc6-08d9efa2eb66 X-MS-TrafficTypeDiagnostic: DM6PR12MB4299:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ixNVc46Ycy0RI17lxDk01HNLxFQteUWguPCmVeahe0vq6DIvm1OGIIf73eFwCZu8fEwGFT6OdSsU9dgmvwSMH6HyG1jQfvsdnHbepG/x2azaSVEpSgIp15syHHC0I2QgQ5lIJjSEmvnsH8X2wkQ5AaRWheiVQhv1IhRmZP9jBopAJIZB+JIwWEpqZhGkXdCebRYQhMfnnvqB9j4Xx0nolS5V1uzMwd552JtNNK5xXzpIwUfGvbbUQy70s+kKjh09+gNeWr/2yKfSu9Q+C7BvMzjpRNf1NFQ9pE757MgMoePtkKrb24chtlj4dZSBcp74pKx4i6cJeSs8HgoLXo2PI7NZwywcZIALbxImyD8EwNKuZzchWhGjnFrZPFMlbad2/F6fsDJg1+45KwEERp5jqPMb8ZO4QRghyh3v3EA9JxdPShHl3ApgIJuU3a8I8t47h6HskqbBDwpp828EePWTcRXA1tmGCzmcg7fiNgYkV5GO8Z3+15fjwcQ6PLrONh69QsviAt0b0DF8ddohAzrf6synv5ch9tDWyz/junU46499quEIflLouQMeYNy2T4NlMHqUHnaJJWNFr5JvnKixfqd2oqixkQTuAHDKUgl2zweXjacMpe6qdhWFI+PavTKXp5dwsFkeBxWW9UQJH6MN2AmlPX0h4Gnq1HNhL8NnqXrblCFaZ6fWNBeeBhz32Fj1/dACMbZI6PdvZHvw2v9Z+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)(46966006)(36840700001)(40470700004)(36756003)(2906002)(2616005)(83380400001)(82310400004)(356005)(81166007)(8936002)(5660300002)(86362001)(40460700003)(508600001)(70586007)(47076005)(6666004)(36860700001)(4326008)(26005)(186003)(7696005)(16526019)(316002)(54906003)(110136005)(8676002)(70206006)(1076003)(336012)(426003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2022 10:15:26.1809 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d4bc049d-d84e-4457-9cc6-08d9efa2eb66 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: DM6NAM11FT050.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4299 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org The init_freq_invariance_cppc code actually doesn't need the SMP functionality. So setting the CONFIG_SMP as the check condition for init_freq_invariance_cppc may cause the confusion to misunderstand the CPPC. And the x86 CPPC file is better space to store the CPPC related functions, while the init_freq_invariance_cppc is out of smpboot, that means, the CONFIG_SMP won't be mandatory condition any more. And It's more clear than before. Signed-off-by: Huang Rui --- arch/x86/include/asm/topology.h | 4 +--- arch/x86/kernel/acpi/cppc.c | 14 ++++++++++++++ arch/x86/kernel/smpboot.c | 20 -------------------- 3 files changed, 15 insertions(+), 23 deletions(-) diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h index c35005a03768..9c73d62f7276 100644 --- a/arch/x86/include/asm/topology.h +++ b/arch/x86/include/asm/topology.h @@ -225,12 +225,10 @@ static inline void init_freq_invariance(bool secondary, bool cppc_ready) } #endif -#if defined(CONFIG_ACPI_CPPC_LIB) && defined(CONFIG_SMP) +#ifdef CONFIG_ACPI_CPPC_LIB void init_freq_invariance_cppc(void); #define init_freq_invariance_cppc init_freq_invariance_cppc -#endif -#ifdef CONFIG_ACPI_CPPC_LIB bool amd_set_max_freq_ratio(u64 *ratio); #else static inline bool amd_set_max_freq_ratio(u64 *ratio) diff --git a/arch/x86/kernel/acpi/cppc.c b/arch/x86/kernel/acpi/cppc.c index f0be5058e3e3..df1644d9b3b6 100644 --- a/arch/x86/kernel/acpi/cppc.c +++ b/arch/x86/kernel/acpi/cppc.c @@ -87,3 +87,17 @@ bool amd_set_max_freq_ratio(u64 *ratio) return true; } + +static DEFINE_MUTEX(freq_invariance_lock); + +void init_freq_invariance_cppc(void) +{ + static bool secondary; + + mutex_lock(&freq_invariance_lock); + + init_freq_invariance(secondary, true); + secondary = true; + + mutex_unlock(&freq_invariance_lock); +} diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 8f2ff9be0fcc..2ef14772dc04 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -83,10 +83,6 @@ #include #include -#ifdef CONFIG_ACPI_CPPC_LIB -#include -#endif - /* representing HT siblings of each logical CPU */ DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_sibling_map); EXPORT_PER_CPU_SYMBOL(cpu_sibling_map); @@ -2156,22 +2152,6 @@ void init_freq_invariance(bool secondary, bool cppc_ready) } } -#ifdef CONFIG_ACPI_CPPC_LIB -static DEFINE_MUTEX(freq_invariance_lock); - -void init_freq_invariance_cppc(void) -{ - static bool secondary; - - mutex_lock(&freq_invariance_lock); - - init_freq_invariance(secondary, true); - secondary = true; - - mutex_unlock(&freq_invariance_lock); -} -#endif - static void disable_freq_invariance_workfn(struct work_struct *work) { static_branch_disable(&arch_scale_freq_key);