From patchwork Tue Feb 6 04:33:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13546625 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2080.outbound.protection.outlook.com [40.107.237.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C36FD79935; Tue, 6 Feb 2024 04:34:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.80 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707194101; cv=fail; b=RmCqZZVV8aYUlbLNQtA/58VMdxV0N87NuWgSFM/hSZK6L5Vw6hwYJuhphM5hz5y0T7LmWt5xosl7iXV3uJohRW3aO/9TApdEY93WDnnU71nlYGC/0pSz1V/cFIHIDwqRJvVJ4OPugylMXhcMaWZsFeUycLDTZj9LMfriLxSMgvA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707194101; c=relaxed/simple; bh=parJunbqZZM7FLADqKwaaiZMdZ97E7FxPQ3zim1LUl0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LM7qzJQJO9cQtCI8Ej+HDL6UlhV8VCcO5NRWkMIOIV6yMFoNF3Bi4iTY8J48BjysMe55HsDuYWT3wG8AZmsiBQMaV1RkZV1DDnJReMxzyGTIMfiFXJRTbO7QnlsHYZsnIyuqYYTbEq2nPbjJ1m10wsatHlzYdQdjZFGFu9Zj3bE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=VaL7QWev; arc=fail smtp.client-ip=40.107.237.80 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="VaL7QWev" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gKpApr81BZq/rb6IzTxorzWpNjTBR8c0cmOsABROpxJGa4yAGwV+Dce1rm69puyctCpmsw3q/NQ7rDi5eYipJGKNqyjmGgEfJTCz8i4kEjETBw7XcN2NdOSJF+FWVgkWEWIv4NVPL2pRmjcgLjNKkMLow/omojZMPsJcfHO5Ww93b+JMCjy1fjLsiqP7BQcsKmX1mBe5ZHgkB4mWst7VJEKP1tr3cGa9OmFcRWUVxvFP5+g6eLRDpXQT/YW/WZFqgoT6vup2RAZDzoQfnlCiiS1c626qmKuF/LVahzWMH0MwefEtPDx9S75IBu8hQpFSvcanwI1/qARxinH99hoQlA== 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=K1QpCmGfGhowPUaMtKNBh5csgXHDS1etmh/Yo0jzAQY=; b=mX9/y5Evjv2q8VONKXWO15SEX95AHsjncrqBNnF9IJ6meRdoWMpZnA1Bct40cVfghJJUkJywwbtx77h0WDPpM1ydiQmq7OSlSH8zsk5GEcXNv1Cfl/dmWa+xVC/zXQynlBrzeCozBhALh/VQiXfOE2EWz5//qI0F+KcK+2cRxcScVGJhIbtt9ZsDpUOrli+E0cXpdovXezwkAPPN/K8aGbUG/PBfMlJrWUn+mUeFLBIQw4V2grl5g4b1BmTa4GOiclqxjH1IBHeLvTU6HBLdB3N+Xavozxl2Njhf4S30iZbpgK5NmfFTMS7Zt1KjNIO7XfDKvnacaWNbLvo51toodQ== 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 (0) 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=K1QpCmGfGhowPUaMtKNBh5csgXHDS1etmh/Yo0jzAQY=; b=VaL7QWev5WJr8HlUtHsQfhgQqPDfM2wFuFtF8gGGSQxyieMxxxSg39ceRHmyaMY0EIvnRUBpyoUc4v0hyjb1YxdlzflcBxXlHpXKbQsQUZ0wmKPaoKmbS/Fug8AQFGlRNzZtuWj/montl4QXdz70jZ68y/vflZa2+ylrGeGsvr0= Received: from BN0PR02CA0022.namprd02.prod.outlook.com (2603:10b6:408:e4::27) by MN0PR12MB6246.namprd12.prod.outlook.com (2603:10b6:208:3c2::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.12; Tue, 6 Feb 2024 04:34:51 +0000 Received: from BN1PEPF00004680.namprd03.prod.outlook.com (2603:10b6:408:e4:cafe::97) by BN0PR02CA0022.outlook.office365.com (2603:10b6:408:e4::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.36 via Frontend Transport; Tue, 6 Feb 2024 04:34:51 +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 BN1PEPF00004680.mail.protection.outlook.com (10.167.243.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7249.19 via Frontend Transport; Tue, 6 Feb 2024 04:34:51 +0000 Received: from pyuan-Chachani-VN.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.34; Mon, 5 Feb 2024 22:34:46 -0600 From: Perry Yuan To: , , , , , CC: , , , , , Subject: [PATCH v4 1/6] ACPI: CPPC: enable AMD CPPC V2 support for family 17h processors Date: Tue, 6 Feb 2024 12:33:54 +0800 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: BN1PEPF00004680:EE_|MN0PR12MB6246:EE_ X-MS-Office365-Filtering-Correlation-Id: 26e52835-77d1-49e6-8cd2-08dc26ccf59a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UQfvcweOwcgw+nSCJo5EfVItlQ9EKjeThTRSqX7M/HQqGcWu1pnXImYyboNv3S7U0vwQowtMshnRxWpl66q13Br93bqPMOHedt8Lh4mDE8SjYKjb4s9u1WbztcffNBn74dCPJ/yItZkLcNTEUSaCKvPB44CxCvVcSuyJkNmULIiOenEo4ZNP5ucTqKgQ+LYsGKhe66kxvg+EJaNgO31k47tpd86Yq19Fta66UUtGmccAeGGf1QFIKp3sJ2bI6S+q24JUI8DUxjTBQnzyUYT0Og4Di/bL6OlJ+CFumJaXlWJgur1cB1XmCH1z5HFnQKjfLE+41Xgbfoi2rZtOgZuhrNlVqb366ORFThXNVcKjtKKn5h5jhA9p+wMj/n3Jybolo9uUomGE1UcvElLmnbLpEy0YVB2b7sZIM6EK88qyKcp1s/aaAQCnLpjabgTmnv3SYS6fI/Q0VGKYMm0mdGuVnD7o7jO/HEpY7fHvweEAr8nZ+D8UR+13fzfWN5yXAzwcTogp5+mV/MMOvUYaBZWmAcrRr+L8qedlSOcge5p6bHI6bYT57eV3SugLUb1T50WCnDJC02Zxo3IrEcnSQB+tW0ogqU50AQngMhhtOzP+KRh2KxoyB6PkSZlFDA7VaMVmNX+xKH26O8zwBtOoUuq6eNd9IWTzxkFVdb0MZ8uDtr9bXmqsY9onCzwb409EPYIz/3bniKsESgkNsZUbPo9aFH7091x7EY1FMolQVGuLZ15GOyQwVbdN0rnHUC/m+aG2ryY3KAIe0CaPk06N1P8nEg== 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)(376002)(136003)(346002)(39860400002)(396003)(230922051799003)(230273577357003)(82310400011)(186009)(1800799012)(451199024)(64100799003)(46966006)(40470700004)(36840700001)(478600001)(41300700001)(966005)(82740400003)(83380400001)(40480700001)(36860700001)(40460700003)(356005)(81166007)(47076005)(7696005)(336012)(16526019)(6636002)(6666004)(86362001)(54906003)(5660300002)(316002)(36756003)(110136005)(8936002)(44832011)(4326008)(26005)(8676002)(426003)(2906002)(70206006)(70586007)(2616005)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2024 04:34:51.5029 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 26e52835-77d1-49e6-8cd2-08dc26ccf59a 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: BN1PEPF00004680.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6246 As there are some AMD processors which only support CPPC V2 firmware and BIOS implementation, the amd_pstate driver will be failed to load when system booting with below kernel warning message: [ 0.477523] amd_pstate: the _CPC object is not present in SBIOS or ACPI disabled To make the amd_pstate driver can be loaded on those TR40 processors, it needs to match x86_model from 0x30 to 0x7F for family 17H. With the change, the system can load amd_pstate driver as expected. Reviewed-by: Mario Limonciello Reported-by: Gino Badouri Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218171 Fixes: fbd74d1689 ("ACPI: CPPC: Fix enabling CPPC on AMD systems with shared memory") Signed-off-by: Perry Yuan --- arch/x86/kernel/acpi/cppc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/acpi/cppc.c b/arch/x86/kernel/acpi/cppc.c index 8d8752b44f11..ff8f25faca3d 100644 --- a/arch/x86/kernel/acpi/cppc.c +++ b/arch/x86/kernel/acpi/cppc.c @@ -20,7 +20,7 @@ bool cpc_supported_by_cpu(void) (boot_cpu_data.x86_model >= 0x20 && boot_cpu_data.x86_model <= 0x2f))) return true; else if (boot_cpu_data.x86 == 0x17 && - boot_cpu_data.x86_model >= 0x70 && boot_cpu_data.x86_model <= 0x7f) + boot_cpu_data.x86_model >= 0x30 && boot_cpu_data.x86_model <= 0x7f) return true; return boot_cpu_has(X86_FEATURE_CPPC); } From patchwork Tue Feb 6 04:33:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13546626 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2061.outbound.protection.outlook.com [40.107.93.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C1D017A736; Tue, 6 Feb 2024 04:35:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.61 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707194106; cv=fail; b=fw7uFfcJVTm3/RyjfnnrWB3iHzSWmuOlIqJcEHwLpaj8u521jdUJByL6qAPK0No0Mymo7tiaj6OoOocuJE0ZBzk+D4QbRHScraMP/1Ipx0lUFVIS6D4OdjRl0nPlKUPFMw+tUOY/xdtIeS4IQU1cOzRfiJztpP2LzDD+NEWiCdo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707194106; c=relaxed/simple; bh=a7HUM9GDkpRgPggDObzXxL1tRHl/EW7CtZAkMKBnLBw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NZOmnia32+PSoxO5oTaAbZHGNsy2Psd10SvJoiWrmaXArNdgphkqnPIOSjm7O2kKptg9lyyDQUWu27hw8sDaPEcHHjttdo3zDYffDJWlr5FhjEUu84SNQUgrEahak1xIjrvztgASXytktYX/YhdLD5Ga1TTU0f1G3UFcubNZa2k= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=XzZx1I3i; arc=fail smtp.client-ip=40.107.93.61 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="XzZx1I3i" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AaGiQDuOMGWTFYDPI+vBVT/kJKyQXBME+rD6TwjuhA9nYPnH8PI0BkxXy6rm5jwJkJ1rzHezdzXgtjWuhBex0N9Z0RwQzrV4M12X3hI1bcEyGYpx2g8cmmbzMAVcHiD5yqW5D/KjbAJUBkRJ2hF1km5JmxuiM7y3fA1o+ITXoO7m+rEtQ4HlX+vzQaoHnpL8dn4U5O5fNHqeYuNz1SU2zo+PJS4FSmYjDIlp0Aebl/ErO3lRMjq3+F1e8DgqlxMXNOXgoUHZgbbULoQYRABwvkEB82u55kjGTeqol7Jz92Y+j7n8GTMXTq4hF1cMXfhz/Nq3Hj7sL4xpNk4jnV4diw== 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=wFgA1+hhdAvzSZ0OZkDcArmwSqv0z4KqbobNxKdpI6o=; b=CyUqpA/x30AGKY7JJfL2IwUEVpPvX9+J8ObCftPOeFLA9ILKaVYJClSmEQVzznuszxXKmNw3H/gnxs7IMIDPnm6xMMkn4ahhDiIsGZicF1DZHR7ZRqOsxMwlNM19TlXbx+8M+Cb1kTKtzbqOPvgPjyEEfLdmooiIORkPIoWx1Xjlz7QnsUW/Ty37Ll7xKdb+Vx+EAr9Rr4iKwkQXeB2WZPPS62DNbU6IHiVZGCAUw8rL8YyO0iCC2ZIradGW3ezbIClOK/0WdEMgso0wx8kYHh82S+LkEIXvw5fKCfVh+SurN2mjfXksXSp7qFH9G4XyLsmxf1Ef7xzbmYthzdPiEg== 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 (0) 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=wFgA1+hhdAvzSZ0OZkDcArmwSqv0z4KqbobNxKdpI6o=; b=XzZx1I3iRiyF61wIURd++Q4oWbo4x3Y/tH2yapB5kyntOqM243E4I4jZE3rmjNdpd8a1pDAYaqvhYxLiXgmM4YST+Fc6xf604/LG7RFMraSAt1ub+KVaiUVXzUiR06awjrLGQhJzBU/ywjS/e0yOhh1VU0q/nTsYdy6fNxw1tH4= Received: from BN9PR03CA0280.namprd03.prod.outlook.com (2603:10b6:408:f5::15) by PH8PR12MB7327.namprd12.prod.outlook.com (2603:10b6:510:215::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.15; Tue, 6 Feb 2024 04:35:00 +0000 Received: from BN1PEPF0000467F.namprd03.prod.outlook.com (2603:10b6:408:f5:cafe::e5) by BN9PR03CA0280.outlook.office365.com (2603:10b6:408:f5::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.36 via Frontend Transport; Tue, 6 Feb 2024 04:35:00 +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 BN1PEPF0000467F.mail.protection.outlook.com (10.167.243.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7249.19 via Frontend Transport; Tue, 6 Feb 2024 04:35:00 +0000 Received: from pyuan-Chachani-VN.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.34; Mon, 5 Feb 2024 22:34:49 -0600 From: Perry Yuan To: , , , , , CC: , , , , , Subject: [PATCH v4 2/6] cpufreq:amd-pstate: fix the nominal freq value set Date: Tue, 6 Feb 2024 12:33:55 +0800 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: BN1PEPF0000467F:EE_|PH8PR12MB7327:EE_ X-MS-Office365-Filtering-Correlation-Id: b8bde978-d09e-4aaf-c7c7-08dc26ccfab9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zkHdkeW8qnHahGxo8HD3ppSzpEW9OZwjVnN5kUlpGpKBI8nW69IcgJwStTguQQNGerbYo46m9oKgdVhmhudBmMWxAF1ua/E1CJGK1anAO1ZsoeAXQhZHO1cIb8E6KPb2taJNJQHW0zUkHiZ0a7ZkkUsJPHcMgOxHrFNDectg5haZTficpkwKgKWkuudFHfNbUbLf6UAqMC2sCH0qn40nvH2yQzjA9hEn28eo5BONvY+rNPfPwxQba6lX5rKdg9EQtauBi/zgLDX20AGWWwmFQmyzGBDHSjeWsGi/pckWy5Si/tWeIhI0zaZwBVlIyZ9xVzX4eOBrhC9d+34J/LS0zQWQfbnNaYbO3fy1NE9A/YDjbb3I3JMm+fp3O3xfWNjNA7FW7jIhA/FY3945ZR60YcTC6ob3uJdC5ojUctB8qbKLH/ohlDWpcyNFECQCF7/HOuO2WW6tLGFsK9+sxMHcEariWG9QXECEHvsdJ6P+cTzRuhpX2PkwGa7sAwvegp4pVCz4xjdsN5/eaWqul6lKiOxMABYK83XUP3yiI6VNucjZdY7gUq21BQt/9u1wkfSu50bhW1MY8upLC830px+f5BVs9xMU/UU7lHAuikzUviQMwHIflAgqQjVQkxi1QZXvcus/V2jb4zriim2Lkw+NbcwG1mzmcYtF1D32iElsNllzl/YRbI3xLFHaLk+zf9cfqahJlWK/9NuXl8LJ0EW7gfKC25erXHsn3iPpVclj/ISSRKmzJJjbJ+/PbuVmP18doO09jc5Zq8FqLXmFThiCMA== 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)(376002)(346002)(136003)(39860400002)(396003)(230922051799003)(186009)(451199024)(82310400011)(64100799003)(1800799012)(46966006)(40470700004)(36840700001)(478600001)(16526019)(26005)(426003)(336012)(2906002)(2616005)(82740400003)(356005)(41300700001)(83380400001)(8936002)(54906003)(6666004)(4326008)(36860700001)(8676002)(110136005)(70206006)(6636002)(316002)(81166007)(44832011)(70586007)(7696005)(5660300002)(86362001)(47076005)(40480700001)(40460700003)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2024 04:35:00.0962 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b8bde978-d09e-4aaf-c7c7-08dc26ccfab9 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: BN1PEPF0000467F.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7327 Address an untested error where the nominal_freq was returned in KHz instead of the correct MHz units, this oversight led to a wrong nominal_freq set and resued, it will cause the max frequency of core to be initialized with a wrong frequency value. Cc: stable@vger.kernel.org Fixes: ec437d71db7 ("cpufreq: amd-pstate: Introduce a new AMD P-State driver to support future processors") Reviewed-by: Mario Limonciello Signed-off-by: Perry Yuan --- drivers/cpufreq/amd-pstate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 08e112444c27..ac7faa98a450 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -640,8 +640,7 @@ static int amd_get_nominal_freq(struct amd_cpudata *cpudata) if (ret) return ret; - /* Switch to khz */ - return cppc_perf.nominal_freq * 1000; + return cppc_perf.nominal_freq; } static int amd_get_lowest_nonlinear_freq(struct amd_cpudata *cpudata) From patchwork Tue Feb 6 04:33:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13546627 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7AB987C0A4; Tue, 6 Feb 2024 04:35:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707194108; cv=fail; b=NwYPzpJdsiD2yxIfPKIqYi/xg2zdZIrja+Jup4zcHc9lq/3KYd5d+prPbSw7eGqO2TkLPtGrnT+QiP2HbtNT1DHa1OQuy+/mIXwm3j681lzxzVcbAk2XZvQVcEQAk2goIT9jEclnUGiu6XFlerBcuqw7WThCzERK/jRoR0tlYik= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707194108; c=relaxed/simple; bh=i0/3Y1RcrmO1kxZ8mQEqBybxtj69hjageTPfY0V6nOk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jckYEpEF4ie7OT005Sl8y+7pKPxvy7fXADSDBz8O7gBfnD0LenG0Q0WjEGiBgiXy0lubfZpT89pGC6Rf0bwS+thvUmhNOMJv6J8C9ZcM2M/LyDs3OKOIimEi8+5RZHy8Bui3hZaqpxSq/Gyhx+VBc0786saxIi/vZ2ztkMvyg14= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=vu2TjO2N; arc=fail smtp.client-ip=40.107.236.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="vu2TjO2N" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jbxir7c0d4nAuIOKhxcHp0v4eriIMT8fMbaDst1zS87CoVtsj6p6VwSwgG+qJMzY5DnAG0ng/sK05prWkb6JoKoIjsDO0cP9RZu9f1vwrs9Xo4m4EuGU0v77146HfqX0/s5m7GGhuQSUgQQkCiVC0xBOnS4CupcKVHhxG30aL3ZwqKCJW/SJWoK6rM7ZvngeN0sD1ubYP6AapsRBztCdfKsadcRB7QEmd+bZawnJpRVGMe76DCnmsYi7H3PmMpDkpAlHT5Bj4TbLPOg1er37Jo2TWQgf4RmGgNfBDREmZxoHJ/ul9AXPrOD9cw8iYYFCYQrN91/obn7rzvhysrMxiQ== 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=xJsNScROKFRLlT8Fo4CMnc5T+PlU3Oq4bkHlyx0RmNQ=; b=a6OOAoakK8M4dZDVlCynV35ZAuORwVbZIHJ+MnJt4/+ARdnbyWHfNQxDCr6SQMM0DNvONC8a3XuBNfemnxCqgVTTgJN7ETuehgufNhZfXGJ/nMvGxLts5f3Y1YSVIzvmJNoh+eYMeO1Cww4B2nLbRj22KdfiIiVdraD3W2VL7uaNeIjoXU/cvKpcXZeMZjv/0QGXTNiEWI/r7PNxn2JFY1J34SfRrr1i0qXRflWnRO0wn0iwDXKB+Y3PCfUDZjsJvJjFG5XzjeZg0dI8j4P2z26cBEAgfu1ylW8C+8dVhceQcKrewGjJaIVtlmvZLP0FzYgnrER3XRpI7EIBpRWMAQ== 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 (0) 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=xJsNScROKFRLlT8Fo4CMnc5T+PlU3Oq4bkHlyx0RmNQ=; b=vu2TjO2NkQjyV97BpZ8LrAjfXSAhFd9w5oW300y/KnXCFp0GWqe1J4qC/Wjs2NEN3lZlorSJS+PMXqOz/haatc+3L0n7EM/GsytjL+whoUodvbJibvThE/p2aCX+P1Oeo1iSmwrf59uJ9KdlWVzHmN24F5aslJdm/lWPJmCVlEQ= Received: from BN9PR03CA0320.namprd03.prod.outlook.com (2603:10b6:408:112::25) by DM4PR12MB5866.namprd12.prod.outlook.com (2603:10b6:8:65::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.11; Tue, 6 Feb 2024 04:35:04 +0000 Received: from BN1PEPF00004685.namprd03.prod.outlook.com (2603:10b6:408:112:cafe::18) by BN9PR03CA0320.outlook.office365.com (2603:10b6:408:112::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.36 via Frontend Transport; Tue, 6 Feb 2024 04:35:03 +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 BN1PEPF00004685.mail.protection.outlook.com (10.167.243.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7249.19 via Frontend Transport; Tue, 6 Feb 2024 04:35:03 +0000 Received: from pyuan-Chachani-VN.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.34; Mon, 5 Feb 2024 22:34:59 -0600 From: Perry Yuan To: , , , , , CC: , , , , , Subject: [PATCH v4 3/6] cpufreq:amd-pstate: initialize nominal_freq of each cpudata Date: Tue, 6 Feb 2024 12:33:56 +0800 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: BN1PEPF00004685:EE_|DM4PR12MB5866:EE_ X-MS-Office365-Filtering-Correlation-Id: bcba361d-0d50-480f-8b7a-08dc26ccfcce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /04dHBIbwP7TO1rf98sovBySimeBPJ0JbdekWIMYcMqNiHuYSStcWykIKyiQ0RmsQ5ViDUnSOKUetYI5FqHKdVkzut0YZzHNpnAL244DG2tsFzz4XABs59mUjroscz7vjzm3iknB/FJBPk+06wrrRjehIHylRXbSwdlA5wRKe6RjYSnXHKCkwE9oxMwQCVR171EOG4KZYXPuUYj5r9uYB/IdbiCz3aiffDHgEgSFDog+E47jTYYd7Q9mhSeBskVtoPfurtvUwyDd/q3LgWGRyYOIwPTusYVmNh6ml1EqwFssJUV07dMEq2uJ2MFV2RsUCUeQHujfs0XZfH9CUfcAghu8ZE6bvjUQejAmjHmuqnc6d3VGSa136/dAyhQUEZ4GLPTs8h8nr6qMCsYMvyGxyJ4O13K3lcRIME7vqYBqe8vgNfy/0KlpfU3Z3n1I1w7FiCb75mMz05wXKeXDzF68PbaUeplVRlhUBKIqCKFE8ZgvA2vIqmKwWmrn/wvczGKlMwSN0EdMENMsZoQ9bQGb1sXvNNjPDRaBD3RNMrjIMq0FGxecVWNowm8Iyb6R4OVQM9Nzi18o3+tEukC/xGjndTVB+Skbggl7HLOqznwkOJSlxDcTgtZSOS34MYfcqx9KKiO8P5q3tLyvwrZ2A0PDiENveg040ys5OByDYcWX10Dup6rvMBe0rI7JmzrXnGxOwJaZWLSJZPZifUDVuP/dpmMC5jQHqTLAMKIObLRB+Q5ydYtyI2QYqtfaTc8AeXqr+UcgBeIwTAnqfPD8Ch60aw== 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)(376002)(396003)(39860400002)(136003)(346002)(230922051799003)(64100799003)(451199024)(186009)(1800799012)(82310400011)(46966006)(36840700001)(40470700004)(36756003)(26005)(2616005)(7696005)(83380400001)(6666004)(426003)(86362001)(81166007)(41300700001)(36860700001)(82740400003)(356005)(336012)(16526019)(47076005)(478600001)(8936002)(4326008)(8676002)(40460700003)(40480700001)(5660300002)(70206006)(316002)(44832011)(70586007)(110136005)(2906002)(54906003)(6636002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2024 04:35:03.6033 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bcba361d-0d50-480f-8b7a-08dc26ccfcce 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: BN1PEPF00004685.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5866 Optimizes the process of retrieving the nominal frequency by utilizing 'cpudata->nominal_freq' instead of repeatedly accessing the cppc_acpi interface. To enhance efficiency and reduce the CPU load, shifted to using 'cpudata->nominal_freq'. It allows for the nominal frequency to be accessed directly from the cached data in 'cpudata' of each CPU. It will also slightly reduce the frequency change latency while using pstate driver passive mode. Reviewed-by: Mario Limonciello Signed-off-by: Perry Yuan --- drivers/cpufreq/amd-pstate.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index ac7faa98a450..ea8681ea3bad 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -619,7 +619,7 @@ static int amd_get_max_freq(struct amd_cpudata *cpudata) if (ret) return ret; - nominal_freq = cppc_perf.nominal_freq; + nominal_freq = READ_ONCE(cpudata->nominal_freq); nominal_perf = READ_ONCE(cpudata->nominal_perf); max_perf = READ_ONCE(cpudata->highest_perf); @@ -654,7 +654,7 @@ static int amd_get_lowest_nonlinear_freq(struct amd_cpudata *cpudata) if (ret) return ret; - nominal_freq = cppc_perf.nominal_freq; + nominal_freq = READ_ONCE(cpudata->nominal_freq); nominal_perf = READ_ONCE(cpudata->nominal_perf); lowest_nonlinear_perf = cppc_perf.lowest_nonlinear_perf; @@ -848,13 +848,14 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy) goto free_cpudata1; min_freq = amd_get_min_freq(cpudata); - max_freq = amd_get_max_freq(cpudata); nominal_freq = amd_get_nominal_freq(cpudata); + cpudata->nominal_freq = nominal_freq; + max_freq = amd_get_max_freq(cpudata); lowest_nonlinear_freq = amd_get_lowest_nonlinear_freq(cpudata); - if (min_freq < 0 || max_freq < 0 || min_freq > max_freq) { - dev_err(dev, "min_freq(%d) or max_freq(%d) value is incorrect\n", - min_freq, max_freq); + if (min_freq < 0 || max_freq < 0 || min_freq > max_freq || nominal_freq == 0) { + dev_err(dev, "min_freq(%d) or max_freq(%d) or nominal_freq(%d) is incorrect\n", + min_freq, max_freq, nominal_freq); ret = -EINVAL; goto free_cpudata1; } @@ -893,7 +894,6 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy) cpudata->min_freq = min_freq; cpudata->max_limit_freq = max_freq; cpudata->min_limit_freq = min_freq; - cpudata->nominal_freq = nominal_freq; cpudata->lowest_nonlinear_freq = lowest_nonlinear_freq; policy->driver_data = cpudata; @@ -1310,12 +1310,13 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy) goto free_cpudata1; min_freq = amd_get_min_freq(cpudata); - max_freq = amd_get_max_freq(cpudata); nominal_freq = amd_get_nominal_freq(cpudata); + cpudata->nominal_freq = nominal_freq; + max_freq = amd_get_max_freq(cpudata); lowest_nonlinear_freq = amd_get_lowest_nonlinear_freq(cpudata); - if (min_freq < 0 || max_freq < 0 || min_freq > max_freq) { - dev_err(dev, "min_freq(%d) or max_freq(%d) value is incorrect\n", - min_freq, max_freq); + if (min_freq < 0 || max_freq < 0 || min_freq > max_freq || nominal_freq == 0) { + dev_err(dev, "min_freq(%d) or max_freq(%d) or nominal_freq(%d) is incorrect\n", + min_freq, max_freq, nominal_freq); ret = -EINVAL; goto free_cpudata1; } @@ -1328,7 +1329,6 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy) /* Initial processor data capability frequencies */ cpudata->max_freq = max_freq; cpudata->min_freq = min_freq; - cpudata->nominal_freq = nominal_freq; cpudata->lowest_nonlinear_freq = lowest_nonlinear_freq; policy->driver_data = cpudata; From patchwork Tue Feb 6 04:33:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13546628 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2065.outbound.protection.outlook.com [40.107.100.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5D3AF7CF3D; Tue, 6 Feb 2024 04:35:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.100.65 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707194112; cv=fail; b=MO9K8MruiZLnOuLDKyY0hJYm38VJyDBbWkhBHfufdI12ImpShSiMJ47LHOkiSUSnfr4bWMyfKHK3C9wQ94IgljkaIrYdcn81VX8W1XNhNox6uf+n3nSjeGiBnIURKbEEtUSvAk86Wb7fkyQCHrabOWwljyen6AJraImlU1j+s7k= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707194112; c=relaxed/simple; bh=bWnyWjWQFuMjC204Y8elk5xFuwTMRESzd8hyhx49RVs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=N9xXq8BYTk7CtRWHQPSglzeyfb8+vNeTPVfsPAdsB2b/D10c0riW5G/RrLba38cXd7qyugHsR0vsm5c1w8rWgPKktN7IVmWJRm5rIH8VwVAzAmC7iBVSCHztr8uv1NEHkJO5Lax8jDG/Ca5eh1hvNY3skSmS6ho1rzFAa3QaKDc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=RSlp91+q; arc=fail smtp.client-ip=40.107.100.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="RSlp91+q" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cIgAp1Sd66SbZRwVpQpseA/yVErNKKZa+B/Xwf7PWPFS/x9zHoGXMRiendxfn2VZ7aUu9GzBlJ+8qcR+G9g5LOMiyBpqdzdzklYQ+29YWlXke2IXTmc7jMFaw9A5aN4G/vZ5q3F9mvgmCC6npISemthwDs0NeM+UyvGwgtD/MYStHiZRVh2cFbhF3QmdKi3WUtVJh9Pap0cdVo1V4r9aVbjLNbEFqwM8QL1nnOI1hKLB3CqosgILwHa12K1F6V9WdSo0ShCvWnfI4MeN2RIcUweB14dGi2yRtsqKZ1redSYo3cNadojze7OHVLBUStXaxjd5iPYzMvuUQ5Wi+1D2oQ== 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=vdJ95iUPa8vjYVWMej24FSv5Oggyfd92h8+N+k2OMLY=; b=ZSDF/KzmDVlwjeNcDjfRs6Nz0t1Vr+L5iw1lhX2vnSp6UJ+EbJgv8flvXC14iU8AFAuZV1b6S2mM4YFwUmLLatQCgpRUCqEaaGIJ9R85TD9o1oPXx+h3tD3iR1K6L/l0DIq101OXU2fgx5Yk2VhziM1x2l/SM6SVo6S9K1bB2U/F/PPvwR6flIxFDUKpMlIAfzmMvsIMCkc+dYRmPrsnTHu7eBz7OErCFo3Imp+1WVM3P59YFbXdwRvtoVM7Tr3TTH6t+U0vO/FQdJ4kh+zrNmg694TqG/1Cbjm+lzpeGQYkxUjpsj5zzo623LI240YMyVB1LS0kQzT5ZXzT7nCl1w== 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 (0) 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=vdJ95iUPa8vjYVWMej24FSv5Oggyfd92h8+N+k2OMLY=; b=RSlp91+qZaB+LomysvRptdTvqke70GKY3yf4icBMsvJFv/v6tkMJi9GXxR55+KK0qubtIM3Yoxr0xpOolxrGdNb53WddfEIX+4YiHaYkyt+gsk6mDRGZk/F4crBwZIfP8PBl1yyUoCmJK9/E8Qi4BlWppn+TPqBDuuw7gUpwrNE= Received: from BN9PR03CA0281.namprd03.prod.outlook.com (2603:10b6:408:f5::16) by IA1PR12MB7615.namprd12.prod.outlook.com (2603:10b6:208:428::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.17; Tue, 6 Feb 2024 04:35:06 +0000 Received: from BN1PEPF0000467F.namprd03.prod.outlook.com (2603:10b6:408:f5:cafe::b1) by BN9PR03CA0281.outlook.office365.com (2603:10b6:408:f5::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.36 via Frontend Transport; Tue, 6 Feb 2024 04:35:06 +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 BN1PEPF0000467F.mail.protection.outlook.com (10.167.243.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7249.19 via Frontend Transport; Tue, 6 Feb 2024 04:35:06 +0000 Received: from pyuan-Chachani-VN.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.34; Mon, 5 Feb 2024 22:35:03 -0600 From: Perry Yuan To: , , , , , CC: , , , , , Subject: [PATCH v4 4/6] cpufreq:amd-pstate: get pstate transition delay and latency value from ACPI tables Date: Tue, 6 Feb 2024 12:33:57 +0800 Message-ID: <4e21b25ed21e3718cade07d3f72eef1a96cd7135.1707193566.git.perry.yuan@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: BN1PEPF0000467F:EE_|IA1PR12MB7615:EE_ X-MS-Office365-Filtering-Correlation-Id: 4e3ae7c0-af13-428b-ffe2-08dc26ccfe5d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IYXBwKZt3W41Qr+BNLqFrP7UKNW6L9PxMnpqecDwB8xxdRzbCSvs5IXNEcxmW34YIKjvUDVi05pTNROgmfi+ysF7NV6l5SzKetSbM3lr+r5NBLQQVREr03XBWSZWLvtyxu77GE9lwXw+B8rLHxIF4OaIusek2J3nrmvzBAq2XrlnTGFxdx7eaX1WwmYtL0N5V+yt3i7qjT4U8VAdccV5zDvsYA6YyGJQgL8pJGhrvTmvKu/6RI7QyF10l12zU1tzCnaSEDMTHIhz4caXmywIuzccjn+7G5kbhy1qS9+aM5c3loNasdRw5mENIaAO2nBtTXOeIyQhy/Bm3CQ335R2LxstcfbfdJ4CoJF5nMi7AQsUHWuOh2DE7mVp/gYDrNCT2xyBtPIcXg9pb5wsrj6OZOfp0d9HV5bAnxTHW1C6WwTCrycrVg//8DS322szbEbkXHGBJQcajKNglQflNkN6bw+LdwBrLgMjFNgwRhdwjaGFdTkO5MCnTO7qWV/uJUCvsQbuAJQzhjx5jrKpcOF8kqGSRiNjPRXBGYvJuIgYeKxEGwBJoGkjKk/1Z2aXzP+xf1Dunjcqu/nCpOA+lG++bdzMViSSpsGQ5fPubR2OuF0IkwCmuG2230EowRcix1zZ6V0L6HZ9xvlbH+QPWNbmNVrsXJJ0kS3x1HhYYpIAo1/wP6Vq5raIIj7bTP8mSb7NAOc3dqyC0XeteW31Fziz6EHGvzQVpMLICXcCiU56Ijcv5ORGX+Q9ItOe4dtVvBAbceaQg4Bh5DEQG/J2mKtoDQ== 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)(376002)(136003)(396003)(346002)(39860400002)(230922051799003)(186009)(82310400011)(1800799012)(64100799003)(451199024)(40470700004)(46966006)(36840700001)(40460700003)(40480700001)(44832011)(2906002)(41300700001)(5660300002)(86362001)(83380400001)(336012)(426003)(47076005)(16526019)(82740400003)(356005)(81166007)(2616005)(6666004)(7696005)(36756003)(54906003)(6636002)(110136005)(478600001)(316002)(26005)(36860700001)(4326008)(8676002)(8936002)(70586007)(70206006)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2024 04:35:06.2056 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4e3ae7c0-af13-428b-ffe2-08dc26ccfe5d 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: BN1PEPF0000467F.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB7615 make pstate driver initially retrieve the P-state transition delay and latency values from the BIOS ACPI tables which has more reasonable delay and latency values according to the platform design and requirements. Previously there values were hardcoded at specific value which may have conflicted with platform and it might not reflect the most accurate or optimized setting for the processor. [054h 0084 8] Preserve Mask : FFFFFFFF00000000 [05Ch 0092 8] Write Mask : 0000000000000001 [064h 0100 4] Command Latency : 00000FA0 [068h 0104 4] Maximum Access Rate : 0000EA60 [06Ch 0108 2] Minimum Turnaround Time : 0000 Reviewed-by: Mario Limonciello Signed-off-by: Perry Yuan --- drivers/cpufreq/amd-pstate.c | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index ea8681ea3bad..77effc3caf6c 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -820,6 +820,36 @@ static void amd_pstate_update_limits(unsigned int cpu) mutex_unlock(&amd_pstate_driver_lock); } +/** + * Get pstate transition delay time from ACPI tables that firmware set + * instead of using hardcode value directly. + */ +static u32 amd_pstate_get_transition_delay_us(unsigned int cpu) +{ + u32 transition_delay_ns; + + transition_delay_ns = cppc_get_transition_latency(cpu); + if (transition_delay_ns == CPUFREQ_ETERNAL) + return AMD_PSTATE_TRANSITION_DELAY; + + return transition_delay_ns / NSEC_PER_USEC; +} + +/** + * Get pstate transition latency value from ACPI tables that firmware set + * instead of using hardcode value directly. + */ +static u32 amd_pstate_get_transition_latency(unsigned int cpu) +{ + u32 transition_latency; + + transition_latency = cppc_get_transition_latency(cpu); + if (transition_latency == CPUFREQ_ETERNAL) + return AMD_PSTATE_TRANSITION_LATENCY; + + return transition_latency; +} + static int amd_pstate_cpu_init(struct cpufreq_policy *policy) { int min_freq, max_freq, nominal_freq, lowest_nonlinear_freq, ret; @@ -860,8 +890,8 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy) goto free_cpudata1; } - policy->cpuinfo.transition_latency = AMD_PSTATE_TRANSITION_LATENCY; - policy->transition_delay_us = AMD_PSTATE_TRANSITION_DELAY; + policy->cpuinfo.transition_latency = amd_pstate_get_transition_latency(policy->cpu); + policy->transition_delay_us = amd_pstate_get_transition_delay_us(policy->cpu); policy->min = min_freq; policy->max = max_freq; From patchwork Tue Feb 6 04:33:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13546629 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2059.outbound.protection.outlook.com [40.107.93.59]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE5807CF34; Tue, 6 Feb 2024 04:35:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.59 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707194113; cv=fail; b=i53pGv4nCLYfv+aFKn7peRpWCEWD1aF08+laxvDBhZImWitwnEHeXvKTuOqRfBirGM5/e7QpCog4w8TtG2LzY0JqVTfN3euC2vifACV+fImd+5YRTXsKMiDjkP/rw/PL5lVjRx3tD/D739egjn5fPVOCLp5ckrz+umW8YYMdxxA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707194113; c=relaxed/simple; bh=/faDvRJteyXqZPRAcoZKXoQ2KPMAH3/GzFGupp3EFhk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BVRosd9K9nhJosDCs19WKC75uc07Hn0Xb1xVNmGKUicSc2bxmyLGp1I1d/NzYBGE9lZ2GFZatcphz8rh42TSQcK+KxQcNseA2JxtxevCMQIz6BJwohHU0SkFOcscTHzvigc8zUh9xz9SdGjjkuVlFMSdjoCpqqld3VyrDFNefoA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=rbCNEpqy; arc=fail smtp.client-ip=40.107.93.59 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="rbCNEpqy" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ps44N/vaezdmvveS911U1uw/hkJGstDiPFDQBStFkspnDTjRx9WhvSxGFHsozC+TE9aZOuDjH1nyPg9p9nNR32gbR6XN77nSSbyTkLz9fqmspJQONqyGFSXQNrWMUy2u/zprzieB/xTCaIr3LYULPUX+RW0cekpPepWVBi6vxT6idDoyZRVIXCSZx/aHEgcoanhcx9fZvJFIQ+pCin9VGtFqsojQ8Q13PCYlnfNx71BJqtW8ldNCXYeBq4H/11P28Cw66RCiUrFBLrQ6cEgOm7npXcLOrsXTzeel6qfwWRAzA9apTe9CsbAlFOmx3IjTNPxUuKwMyfSJpF7iWqCfpQ== 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=Gy9SNyIn/2SjYTda9oDK5zWZekhmoOyMuf9jAWZS5R8=; b=EuBvrnGHPN8Y0trs7hF48OatyU8ko1TbHdDDmVxlPko4+FYuvaWwx3cPyCaVBl4D84sj72oCP7oo/dnpvIKURl5Cfn/mJJ0MONA+7rH9+Cvm0Pq/Y2dRaS1imZu7u/yEJaHoalXWAXNmuZzcwd3M2AdmujbsjakQDBJ3vioP5gZNvIaZvUrA7s0kls7tvKL4YH/zef78YpOpgp6UHN20gxiDrC0selH/IMf4dFLEaNFI6Vtdg6MqFibP3nMmZKMwKkjl98kgGrK1eJnCJtH941VyP3IbhMCAfBcI9ebH4mbYz7Cd1yZ9ISwqGYAVH1K29yI0N1LVxc2iTUMEd5n6Yg== 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 (0) 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=Gy9SNyIn/2SjYTda9oDK5zWZekhmoOyMuf9jAWZS5R8=; b=rbCNEpqyA23ZjzLwznZzje9OvK6Ubrg5e+6kXVIqEbcuhw1e9CsBeUVYyqjPYZisRdZVskfOlWE7pbJkJKGGBnb6Vybm2mEdLQZvdTGAX02xhUKfA8fSmWSHdfh4zyMYktxB4n6awZEjirh/hA5qIOPOp/glyUj0hwFcF18nUYI= Received: from BN9PR03CA0468.namprd03.prod.outlook.com (2603:10b6:408:139::23) by DM6PR12MB4060.namprd12.prod.outlook.com (2603:10b6:5:216::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.17; Tue, 6 Feb 2024 04:35:09 +0000 Received: from BN1PEPF00004682.namprd03.prod.outlook.com (2603:10b6:408:139:cafe::39) by BN9PR03CA0468.outlook.office365.com (2603:10b6:408:139::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.36 via Frontend Transport; Tue, 6 Feb 2024 04:35:09 +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 BN1PEPF00004682.mail.protection.outlook.com (10.167.243.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7249.19 via Frontend Transport; Tue, 6 Feb 2024 04:35:09 +0000 Received: from pyuan-Chachani-VN.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.34; Mon, 5 Feb 2024 22:35:06 -0600 From: Perry Yuan To: , , , , , CC: , , , , , Subject: [PATCH v4 5/6] cppc_acpi: print error message if CPPC is unsupported Date: Tue, 6 Feb 2024 12:33:58 +0800 Message-ID: <2343f6c652bbcfad9cb462b5fd05fdb49e833e1f.1707193566.git.perry.yuan@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: BN1PEPF00004682:EE_|DM6PR12MB4060:EE_ X-MS-Office365-Filtering-Correlation-Id: 6f0e3f35-e52b-4d0f-695b-08dc26cd0027 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PpQpXRSZHlzgtLwU9U94rLAwZq217DlN98NSDD7YayEL07P3Rzgpz0GueOevTJa5mul4h8Uzt+hkLQpzYv/0gNK/f17Hend2HS8GpFoNeICSWLOqoTSmmD2AXFAn7EAAuVVNwUGius38UQsRzenStn/6fbQ06Vm28dmIc6Wbx1ilwxA8fSYoeMeGhLMADx9/WpH8hsI4nkeX/2/1Al6Km+Gp8WlvUmhqTNNxLVAxwYPESdSS9N7zB2zzvKixQkm10QC9/53VwyNbyp/hxRCgdzLRRS5g99c6LFGZkf4DOXvt0DHm3ZD7yw85Kyz0yGYcHJ3K6clBrPigFVoGaD5T80G29CUfPoRLeCCQjhIU1bWPVjd8HVu2fIHEnV0d3LH5lPdS5obchgz4yz8kPS3RAnX9dop+1+BhnAasmAxhsDWgWzdgWPmpytfNs0e8D7+cwSYnJ7+DinDtfry5B/b/Xr5NAimDEONBS3aLkpuBNHC563sKzRlTeSDhfqStq3HRv1aQBhdrbI8gEPVbdJToUV2+KCRX1J5ei90BB2GmL1Zl3SDN45LiMBwIjPbOjXCN+YeiOVHG0gNnRYMgRiQebbd/UEJgTFsHEhoeS3KMFusUG4x6XHif2FYb43e4nNdGyHr2eoMFq4NgeDdLtRfGA7G7xjbRBxv2dDKbzjpU8YKStQMA74UYKRI0XBgDEiQMnsHjUbJy1StuxRparnSSBo231APO8CpigeBWPz9MXGa0EyCu9uiSVOqrph8u99WMr3AbvSd3k0x6vsa1MXoalg== 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)(376002)(39860400002)(346002)(396003)(136003)(230922051799003)(1800799012)(451199024)(186009)(64100799003)(82310400011)(36840700001)(46966006)(40470700004)(2616005)(47076005)(26005)(16526019)(336012)(41300700001)(15650500001)(82740400003)(426003)(83380400001)(81166007)(36860700001)(6666004)(316002)(8936002)(7696005)(478600001)(8676002)(110136005)(5660300002)(70586007)(2906002)(6636002)(356005)(70206006)(4326008)(54906003)(44832011)(86362001)(40480700001)(40460700003)(36756003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2024 04:35:09.2033 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6f0e3f35-e52b-4d0f-695b-08dc26cd0027 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: BN1PEPF00004682.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4060 to be more clear what is wrong with CPPC when pstate driver failed to load which has dependency on the CPPC capabilities. Add one more debug message to notify user if CPPC is not supported by the CPU, then it will be easy to find out what need to fix for pstate driver loading issue. [ 0.477523] amd_pstate: the _CPC object is not present in SBIOS or ACPI disabled Above message is not clear enough to verify whether CPPC is not supported. Reviewed-by: Mario Limonciello Signed-off-by: Perry Yuan --- drivers/acpi/cppc_acpi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c index a50e70abdf19..e23a84f4a50a 100644 --- a/drivers/acpi/cppc_acpi.c +++ b/drivers/acpi/cppc_acpi.c @@ -679,8 +679,10 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr) if (!osc_sb_cppc2_support_acked) { pr_debug("CPPC v2 _OSC not acked\n"); - if (!cpc_supported_by_cpu()) + if (!cpc_supported_by_cpu()) { + pr_debug("CPPC is not supported by the CPU\n"); return -ENODEV; + } } /* Parse the ACPI _CPC table for this CPU. */ From patchwork Tue Feb 6 04:33:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yuan, Perry" X-Patchwork-Id: 13546630 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2081.outbound.protection.outlook.com [40.107.237.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E756E7E58D; Tue, 6 Feb 2024 04:35:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.81 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707194117; cv=fail; b=Ipe2ockk9fRbMkIvlEG+HcDa9etySKXldI3UBaIA9VB1tyemd6jNSjJZXilhfGNu50JuROWYWu/fUMqAihjebbwNn6FoTJEzU+H0YyJpCFJyqAsC1zWWTyE3LC0ZGVN5quM+T6uNX5sorILVf/fvqHZgtriuTxjNyOUhoQbk1GY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707194117; c=relaxed/simple; bh=yFZGkb+nRoq0JoaT8GKqmAGB/Kd+cT88vdHLdm4yW3U=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=o3AY430x1sAYHfm7SR59+pLOOSaKuCtMjgiZ0+0Pc4zRv3OeIyE8aQzIkjV7Hn9tuu5aqm3p87WDpebA1hBfUakIDMMr40I3Psf2jMCqDHOHeFxmeDMWsUY0/f6JIdiNiaLEQY4/YafLnoKiquW5LQlmr2P0xL67Wee692d6kZQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=QYs2xghh; arc=fail smtp.client-ip=40.107.237.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="QYs2xghh" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FaCGlJybLIYuG+NoE3KqX5vu0rc3hEorGna4yeywjblvidI1n+jtCJpRuq4igojSBEy9W49PTpC38NPmZ7nUnreJwOmaWCdO92VKfyZknnfDCUEkhdIKsCMexXaBxzfaEB9qnYufta0RbRR9vfvmpHsx2seXFofjaGykyjHgglQyiWYx9NK9lRh2S4Xvj/wt+fSonCNeBOJ9wXbKBn8twnF5I8iS4GLNBUjAxFwWBK3mPSf82J70t5gyowKi1oao+/CISr1HGm73jZq0SfGU5Bt14q0z8g12TDFOZkIzysf7peCnze5qaMMqqwpCnKD7bD91++SmZ3cJ1nhw535dHA== 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=d43De3TJ6JcZtU9BWyXSYwH8Lq9zu3gPn5XD/lIBskA=; b=oWoTIt3BLnqoMez3c3++0N98wwXVyFH6/qz0wbvfGDZXtruICiSiGRWHjO9U/07tgPXAGkqruHF6wa/Lz+auJsrSd+20IHBPd+hAjDodMIiWVh9IMJMIMWlfZT9lgvJFoqOnZxxJDGzHg6rsYfT5tgxyQ4BpFrSG6WSEftE/dDrABQ3PZ6f+ZzBbScyaeIlNKWvMQDg6+3aZ4wHZI9G1ovfok09DGoj/5sfhkM9okfrTa4LaWN7AEF2+mceSfcvo6I+WwAjbFzmZFeqfjDW0EobngOq6kr+qPDdlC5+Ub98hfCo4Em5hDnD4BkmT8Ol7/Enq/OqJmbYYHPQvtfuBRg== 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 (0) 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=d43De3TJ6JcZtU9BWyXSYwH8Lq9zu3gPn5XD/lIBskA=; b=QYs2xghho6aAFAgu7YOYg3PUdsEtNjHCrxQ3/B9SNX4sksjv8AFIyyw8E0U/mnk6antR6mgXEesRxvfw9ZYXtoZINjpS7wnNs6rqWVbDKi8T2HTL6hSaHx/wdINKqY9TNmKLsdhG6aWwRLqPRb5LWHKuZ0PgjBnHIQnmk/j8zUY= Received: from BN9P221CA0024.NAMP221.PROD.OUTLOOK.COM (2603:10b6:408:10a::23) by BN9PR12MB5081.namprd12.prod.outlook.com (2603:10b6:408:132::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.17; Tue, 6 Feb 2024 04:35:12 +0000 Received: from BN1PEPF00004684.namprd03.prod.outlook.com (2603:10b6:408:10a:cafe::c) by BN9P221CA0024.outlook.office365.com (2603:10b6:408:10a::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.36 via Frontend Transport; Tue, 6 Feb 2024 04:35: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; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN1PEPF00004684.mail.protection.outlook.com (10.167.243.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7249.19 via Frontend Transport; Tue, 6 Feb 2024 04:35:12 +0000 Received: from pyuan-Chachani-VN.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.34; Mon, 5 Feb 2024 22:35:09 -0600 From: Perry Yuan To: , , , , , CC: , , , , , Subject: [PATCH v4 6/6] cpufreq:amd-pstate: add quirk for the pstate CPPC capabilities missing Date: Tue, 6 Feb 2024 12:33:59 +0800 Message-ID: <4626a4aff50921be3b7a0345ae51e5aa246504d0.1707193566.git.perry.yuan@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: BN1PEPF00004684:EE_|BN9PR12MB5081:EE_ X-MS-Office365-Filtering-Correlation-Id: 92c55f9e-6c1b-4e32-88fd-08dc26cd021a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: T/3+VZP7exaBvwMgbHhivHO2Eduj6fp5spj4kgupEXzESj3B+JyEqXErLWc4P/qTObaPES5RLkG/LkLUwK9I7KtZs+QkoKWNi1bWrkdgpFvDydfxc/Q6e7CkOsdOJdQ64o9Ga89F0JQmuzILjc/6yIrsMGtRuSc0CNmC/qI8inOC5oDYDIJTWDe+BX89B+8R7TAKMPnfZ3MmWAfGa95kkUry2PCFSuXI4PcrYTTiHYoIj/+Xvf4Zitvl7iKU/ezIc7r+R0vwJd9/Rq4bwRcW1F/RcMvl6S1jy/MwR2TP49RCo2cGmU2eAW5Iq9c9Bxn9S2VcLYCwWaywmb1Vc4s/CUC61kx9y5PhwdLCe1jvtDdFkIUctXAg4CDD7Uhxgu0MgU2fHeoKYjtJh56cg9JC1VhOdnqkjsb6mZXX6SYQyC4VRuFQkKz9cL1yTamZ+M6a0zvWzWiTZaIvGK/+Ol/CFxngpc9kTyDhlSMWsditPOikunSOCnywXXFudGVzvCUYVbnSH07BdDSR+n81lejtcxcbX9yCiK7+JOMITIn4ID/PazxQ0ZV8sb/yOxnc8JM7LaQyrJ5kBscTxzamikif9Tv2jnFaksgli2yazhU+BWA+Y4+J/nVmR6kHucUjum4PjTvHeYPOu0mxcfKjjUW1PFkTf2u/15DVmk/T+iH3pAPIEYbvWN2A1HdNLGcE870zHvfgXfffnFtBki0TWPHBtUfR6DI4GEYxEfzckUGGcwdPUbMDtnIyOuIAYZAjmuaX7mLyhVw9pptjkhYD4T2ssg== 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)(396003)(136003)(346002)(39860400002)(376002)(230922051799003)(1800799012)(82310400011)(186009)(451199024)(64100799003)(46966006)(36840700001)(40470700004)(70206006)(40480700001)(40460700003)(41300700001)(6666004)(2616005)(36860700001)(6636002)(316002)(478600001)(26005)(16526019)(7696005)(54906003)(47076005)(426003)(336012)(70586007)(110136005)(83380400001)(44832011)(82740400003)(81166007)(2906002)(8676002)(8936002)(36756003)(356005)(86362001)(5660300002)(4326008)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2024 04:35:12.4743 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 92c55f9e-6c1b-4e32-88fd-08dc26cd021a 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: BN1PEPF00004684.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5081 Add quirks table to get CPPC capabilities issue fixed by providing correct perf or frequency values while driver loading. If CPPC capabilities are not defined in the ACPI tables or wrongly defined by platform firmware, it needs to use quick to get those issues fixed with correct workaround values to make pstate driver can be loaded even though there are CPPC capabilities errors. The workaround will match the broken BIOS which lack of CPPC capabilities nominal_freq and lowest_freq definition in the ACPI table. $ cat /sys/devices/system/cpu/cpu0/acpi_cppc/lowest_freq 0 $ cat /sys/devices/system/cpu/cpu0/acpi_cppc/nominal_freq 0 Signed-off-by: Perry Yuan --- drivers/cpufreq/amd-pstate.c | 59 ++++++++++++++++++++++++++++++++++-- include/linux/amd-pstate.h | 6 ++++ 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 77effc3caf6c..874d8b663790 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -67,6 +67,7 @@ static struct cpufreq_driver amd_pstate_epp_driver; static int cppc_state = AMD_PSTATE_UNDEFINED; static bool cppc_enabled; static bool amd_pstate_prefcore = true; +static struct quirk_entry *quirks; /* * AMD Energy Preference Performance (EPP) @@ -111,6 +112,43 @@ static unsigned int epp_values[] = { typedef int (*cppc_mode_transition_fn)(int); +static struct quirk_entry quirk_amd_7k62 = { + .nominal_freq = 2600, + .lowest_freq = 550, +}; + +static int __init dmi_matched_7k62_bios_bug(const struct dmi_system_id *dmi) +{ + /** + * match the broken bios for family 17h, model 31h processor + * broken BIOS lack of nominal_freq and lowest_freq capabilities + * definition in ACPI tables + */ + if (boot_cpu_data.x86 == 0x17 && boot_cpu_data.x86_model == 0x31 && + boot_cpu_has(X86_FEATURE_ZEN2)) { + quirks = dmi->driver_data; + pr_info("hardware type %s found\n", dmi->ident); + return 1; + } + + + return 0; +} + +static const struct dmi_system_id amd_pstate_quirks_table[] __initconst = { + { + .callback = dmi_matched_7k62_bios_bug, + .ident = "AMD EPYC 7K62", + .matches = { + DMI_MATCH(DMI_BIOS_VERSION, "5.14"), + DMI_MATCH(DMI_BIOS_RELEASE, "12/12/2019"), + }, + .driver_data = &quirk_amd_7k62, + }, + {} +}; +MODULE_DEVICE_TABLE(dmi, amd_pstate_quirks_table); + static inline int get_mode_idx_from_str(const char *str, size_t size) { int i; @@ -600,13 +638,19 @@ static void amd_pstate_adjust_perf(unsigned int cpu, static int amd_get_min_freq(struct amd_cpudata *cpudata) { struct cppc_perf_caps cppc_perf; + u32 lowest_freq; int ret = cppc_get_perf_caps(cpudata->cpu, &cppc_perf); if (ret) return ret; + if (quirks && quirks->lowest_freq) + lowest_freq = quirks->lowest_freq; + else + lowest_freq = cppc_perf.lowest_freq; + /* Switch to khz */ - return cppc_perf.lowest_freq * 1000; + return lowest_freq * 1000; } static int amd_get_max_freq(struct amd_cpudata *cpudata) @@ -635,12 +679,18 @@ static int amd_get_max_freq(struct amd_cpudata *cpudata) static int amd_get_nominal_freq(struct amd_cpudata *cpudata) { struct cppc_perf_caps cppc_perf; + u32 nominal_freq; int ret = cppc_get_perf_caps(cpudata->cpu, &cppc_perf); if (ret) return ret; - return cppc_perf.nominal_freq; + if (quirks && quirks->nominal_freq) + nominal_freq = quirks->nominal_freq; + else + nominal_freq = cppc_perf.nominal_freq; + + return nominal_freq; } static int amd_get_lowest_nonlinear_freq(struct amd_cpudata *cpudata) @@ -1672,6 +1722,11 @@ static int __init amd_pstate_init(void) if (cpufreq_get_current_driver()) return -EEXIST; + quirks = NULL; + + /* check if this machine need CPPC quirks */ + dmi_check_system(amd_pstate_quirks_table); + switch (cppc_state) { case AMD_PSTATE_UNDEFINED: /* Disable on the following configs by default: diff --git a/include/linux/amd-pstate.h b/include/linux/amd-pstate.h index d21838835abd..7b2cbb892fd9 100644 --- a/include/linux/amd-pstate.h +++ b/include/linux/amd-pstate.h @@ -124,4 +124,10 @@ static const char * const amd_pstate_mode_string[] = { [AMD_PSTATE_GUIDED] = "guided", NULL, }; + +struct quirk_entry { + u32 nominal_freq; + u32 lowest_freq; +}; + #endif /* _LINUX_AMD_PSTATE_H */