From patchwork Fri Oct 13 03:31:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Meng Li X-Patchwork-Id: 152284 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1641870vqb; Thu, 12 Oct 2023 20:33:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFRnBITUbqKqmWoF5lJYMVymvuvdxMaFcBhd6pd6wNL+cIetkUF95O0PVqKM1Ezel7FY4TH X-Received: by 2002:a17:902:d512:b0:1bf:349f:b85c with SMTP id b18-20020a170902d51200b001bf349fb85cmr28603121plg.1.1697168002189; Thu, 12 Oct 2023 20:33:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1697168002; cv=pass; d=google.com; s=arc-20160816; b=TxVdn78JWdnOzaq6I1CEB9DiHuv2Bky4+f2kbrUaXOdZMUwr2ewW1TXmmjJVBLu1Zu l2wXcro6hl6PC9M51Sa17bhhgr43WbHzM1AfkZcXg1RlNglZHDbV1lshcw7o08F/YUDl u+4+KD3EAt772RBg2W7n8HqsgYbSpda1dQXYdKve+RLB14NM5bORDMfUaCA9cTKQ8Py7 JeGWRk5H2Tg+JeHcVAU6734gnrUnKOIIR58GIwXZ+V03s1DhDdyPeLV6d6GfVVdd21eS Oy6Gm8AxYjgYrb7J7MMm3S4zB2p5lQ9GjlRaXr+982Sab9ruUvZzkcpDtVYcYqlj2cim OEFg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=iEG57ub2uyja18iSbeWFZGvSQXhoZh8gCxORPlmvouA=; fh=hGvksXpWJomenCq+IRP0QZoot/B1Zo6LHbgOlSKBIRE=; b=BaHwNabJf5+QFFK4GqCS1t58BfEV+jMQy2egfF8JV2G1245xDyzgAWnAsPB6s+0YfO gLNZTaCkvaX+Raq8HtY7vKYm6EwLvNUYMRm0sW0A8XkfkhowJ7GN5MZ35aDYOh1kfu9G kke1vyHP1aan3HVmZLRfaykkxJahnUmYAnnK8yk5B1IhwPiv55Si0mjAEo9OnwUNvc9o rz0vafQifWEdpdGnjs07nL0Qu6PWPQsfp5BvTAPaYIpQ0Y0RpW/EEUJxQc7NgjI0/LnR KWmQdBBcPLFCQOWQ09xUlbolzJlF6TyOLMwhXBqtpRKxcHPPEB83jKfTL1z4r5Du2+H0 6FNQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=aLKA2DOv; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id u1-20020a17090341c100b001c43cd8b2d5si3747428ple.592.2023.10.12.20.33.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Oct 2023 20:33:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=aLKA2DOv; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 7DB8883BDCCB; Thu, 12 Oct 2023 20:33:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229687AbjJMDcq (ORCPT + 19 others); Thu, 12 Oct 2023 23:32:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229617AbjJMDcf (ORCPT ); Thu, 12 Oct 2023 23:32:35 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2061.outbound.protection.outlook.com [40.107.220.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14F40D6; Thu, 12 Oct 2023 20:32:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ikr1HFhKdZ8cZ3ZgWeXe1Moks0t1hNvTjKYSu4gqcwW5Nr5gbVZw6BioRJ5kWmckts87VZ7+wli9vqRk8XyfhjjXPpMp+vwdbEAqXfst/2e0IMoFzidfDFnqST0Q93ap8EU20oOFQUO/JfWP4DgM5gm15Q+c6nfQborn934enG0vo7nUasYxNLCrkPoKTuq2G8bL+FpLeNmETOmaoNLNYzT1rHr4utnkUFxRknc4s0tM4qNGSk2LywTWFsoog/vT3owfsk5iXAAymLvtq5xXm82y4H00iUQlKOw3fx+PsIFL4fAysgt9fjTi4KxhL5vYrfs4R5/JSXTBPa714q/7Rg== 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=iEG57ub2uyja18iSbeWFZGvSQXhoZh8gCxORPlmvouA=; b=TWHTzZR3QK7mI8DGwKdISaQ/5FFu402gYbAx+1eSpsdNdSpnyKxHTnp3OBwwqc1Td3oTrx8k+82Hv3Yn4uhVndpdxSl1IhvgT52aHt0fiH7QOAtslBJueJOuSFe+j4y3/+1p/FgEOUEzojdWiOnJANDW/2rYKDhXplKeAkKJX9fdS7kzPJIhTwwZK7Lu0TJ1Sas211HNa4/zTSImeFjNWcsliEkNXIGKT266nTZDLXzTIBDLPFIOaOl0EtqmEL/ssw1lqZOH5S2gMU1CrWIu5w4ZntPOlmUsHGU6tXmq/zHqCUoDAuAeZwQNdLI6cbv5MN2YcFKjghyMKqzQTotAfQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com 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=iEG57ub2uyja18iSbeWFZGvSQXhoZh8gCxORPlmvouA=; b=aLKA2DOvup3QuopDNO4o4tNiHNffadZFrhrB4f0r87SJ/VKfslnCJ71lubG5wYr2FLQg7CV9p4GOMcgSbeaxz/JiG5L6trOePDDm4czd9ZJwvRyT1zMy6jQJ+FbrMpF39HnoYDySGfcJfrZlWKh38XvQzXLUtFTkGF3Jca0Vwas= Received: from BY5PR03CA0011.namprd03.prod.outlook.com (2603:10b6:a03:1e0::21) by MN0PR12MB5739.namprd12.prod.outlook.com (2603:10b6:208:372::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38; Fri, 13 Oct 2023 03:32:22 +0000 Received: from CO1PEPF000042A7.namprd03.prod.outlook.com (2603:10b6:a03:1e0:cafe::fd) by BY5PR03CA0011.outlook.office365.com (2603:10b6:a03:1e0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.30 via Frontend Transport; Fri, 13 Oct 2023 03:32: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; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000042A7.mail.protection.outlook.com (10.167.243.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Fri, 13 Oct 2023 03:32:16 +0000 Received: from jasmine-meng.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.2507.27; Thu, 12 Oct 2023 22:32:09 -0500 From: Meng Li To: "Rafael J . Wysocki" , Huang Rui CC: , , , , Shuah Khan , , "Nathan Fontenot" , Deepak Sharma , Alex Deucher , Mario Limonciello , Shimmer Huang , "Perry Yuan" , Xiaojian Du , Viresh Kumar , Borislav Petkov , "Oleksandr Natalenko" , Meng Li Subject: [RESEND PATCH V9 4/7] cpufreq: Add a notification message that the highest perf has changed Date: Fri, 13 Oct 2023 11:31:15 +0800 Message-ID: <20231013033118.3759311-5-li.meng@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231013033118.3759311-1-li.meng@amd.com> References: <20231013033118.3759311-1-li.meng@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-TrafficTypeDiagnostic: CO1PEPF000042A7:EE_|MN0PR12MB5739:EE_ X-MS-Office365-Filtering-Correlation-Id: cc68bdfa-33ff-4735-6dbb-08dbcb9cff74 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eTr2drDvk+J48en6baqm5XhVLIHIxB2BL8vBlBLVX7G4/fR8sFteZh4i2F8ol6FgUzLYTN8jKjRs9RSMlKWM50BOilIbydPCev8Dz6VNVIN7MVb+LbxJye1T/kNBymBU41YjoASRatkYj1NViqCkZ7A0qz7D6WfvDNM+ueJXMPlKhoZcQnu54o4gdFGFE2523qWOzHjTwQ86doLwTD7+WhQtoNsBYfDjun7nZ5Yf8AKZAlcGa1yttQdnZxK/eNecpaXZACIwyuzminP6MCaRt+TyK3Sqnm7Bv3Jwgnt0NG4/WRKvC7tcdSrg4chtiKiAK515IjwOlQzDrkULmPcZtyaVCPb6rQ/j8ANUFHgtKetZebRQZQ+cUbRGS1Ih9CqomfVq/p4nXdMLgOed4yqtJiGhI/7aiM6QxmB+IsGhv3fJMc0BGO/pOlkxEO9xElKtBYFq1KWjzlVAO7dwAYdbzCiptrBcMzVtj+eYTj8egZw9im1QsEPynDHsQz3wqBzz1f+8lxH+yJ4+n5YsdQkeTzlcccu6jP4hRxPQaKwgyszBdiGDzTkRE8tm/1qvGQ+7y8meldiWnXfcTohQ0O9dHpWSyuA1cYrCiImC23Wfsf3zJz6dBWB3khggsNq6DeihpYHVIeYR13XnwJxUrRQUzKMxQ0H/r9USZQnddxHYH8YNkyHytq9p2U4+WQw7fYQJU50mTn93mQZ+5q6XuHMJeuUNNA7tr6tf+XWR5K0LPNtQsLzg/pH4AHyQx52mIk4Rv8iLBJBymwDrREsN9/7I1dqqJukbdPlD72Kc1gV3Pzw= 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:(13230031)(4636009)(346002)(39860400002)(396003)(136003)(376002)(230922051799003)(82310400011)(64100799003)(1800799009)(186009)(451199024)(46966006)(40470700004)(36840700001)(40480700001)(2616005)(2906002)(70586007)(26005)(16526019)(356005)(47076005)(426003)(336012)(82740400003)(83380400001)(81166007)(4326008)(8936002)(8676002)(36860700001)(5660300002)(110136005)(70206006)(7416002)(6636002)(6666004)(7696005)(316002)(1076003)(478600001)(966005)(54906003)(40460700003)(15650500001)(41300700001)(36756003)(86362001)(226483002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2023 03:32:16.2651 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cc68bdfa-33ff-4735-6dbb-08dbcb9cff74 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: CO1PEPF000042A7.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5739 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 12 Oct 2023 20:33:17 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779609635007361183 X-GMAIL-MSGID: 1779609635007361183 ACPI 6.5 section 8.4.6.1.1.1 specifies that Notify event 0x85 can be emmitted to cause the the OSPM to re-evaluate the highest performance register. Add support for this event. Tested-by: Oleksandr Natalenko Reviewed-by: Mario Limonciello Reviewed-by: Huang Rui Signed-off-by: Meng Li Link: https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html#processor-device-notification-values --- drivers/acpi/processor_driver.c | 6 ++++++ drivers/cpufreq/cpufreq.c | 13 +++++++++++++ include/linux/cpufreq.h | 5 +++++ 3 files changed, 24 insertions(+) diff --git a/drivers/acpi/processor_driver.c b/drivers/acpi/processor_driver.c index 4bd16b3f0781..29b2fb68a35d 100644 --- a/drivers/acpi/processor_driver.c +++ b/drivers/acpi/processor_driver.c @@ -27,6 +27,7 @@ #define ACPI_PROCESSOR_NOTIFY_PERFORMANCE 0x80 #define ACPI_PROCESSOR_NOTIFY_POWER 0x81 #define ACPI_PROCESSOR_NOTIFY_THROTTLING 0x82 +#define ACPI_PROCESSOR_NOTIFY_HIGEST_PERF_CHANGED 0x85 MODULE_AUTHOR("Paul Diefenbaugh"); MODULE_DESCRIPTION("ACPI Processor Driver"); @@ -83,6 +84,11 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data) acpi_bus_generate_netlink_event(device->pnp.device_class, dev_name(&device->dev), event, 0); break; + case ACPI_PROCESSOR_NOTIFY_HIGEST_PERF_CHANGED: + cpufreq_update_highest_perf(pr->id); + acpi_bus_generate_netlink_event(device->pnp.device_class, + dev_name(&device->dev), event, 0); + break; default: acpi_handle_debug(handle, "Unsupported event [0x%x]\n", event); break; diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 4bc15634d49c..e66b040b0c61 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -2717,6 +2717,19 @@ void cpufreq_update_limits(unsigned int cpu) } EXPORT_SYMBOL_GPL(cpufreq_update_limits); +/** + * cpufreq_update_highest_perf - Update highest performance for a given CPU. + * @cpu: CPU to update the highest performance for. + * + * Invoke the driver's ->update_highest_perf callback if present + */ +void cpufreq_update_highest_perf(unsigned int cpu) +{ + if (cpufreq_driver->update_highest_perf) + cpufreq_driver->update_highest_perf(cpu); +} +EXPORT_SYMBOL_GPL(cpufreq_update_highest_perf); + /********************************************************************* * BOOST * *********************************************************************/ diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 1c5ca92a0555..f62257b2a42f 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -235,6 +235,7 @@ int cpufreq_get_policy(struct cpufreq_policy *policy, unsigned int cpu); void refresh_frequency_limits(struct cpufreq_policy *policy); void cpufreq_update_policy(unsigned int cpu); void cpufreq_update_limits(unsigned int cpu); +void cpufreq_update_highest_perf(unsigned int cpu); bool have_governor_per_policy(void); bool cpufreq_supports_freq_invariance(void); struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy); @@ -263,6 +264,7 @@ static inline bool cpufreq_supports_freq_invariance(void) return false; } static inline void disable_cpufreq(void) { } +static inline void cpufreq_update_highest_perf(unsigned int cpu) { } #endif #ifdef CONFIG_CPU_FREQ_STAT @@ -380,6 +382,9 @@ struct cpufreq_driver { /* Called to update policy limits on firmware notifications. */ void (*update_limits)(unsigned int cpu); + /* Called to update highest performance on firmware notifications. */ + void (*update_highest_perf)(unsigned int cpu); + /* optional */ int (*bios_limit)(int cpu, unsigned int *limit);