From patchwork Tue Dec 5 06:35:31 2023
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: "Meng, Li \(Jassmine\)"
X-Patchwork-Id: 750434
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com
header.b="sheI7+c7"
Received: from NAM12-DM6-obe.outbound.protection.outlook.com
(mail-dm6nam12on2061.outbound.protection.outlook.com [40.107.243.61])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB55E181;
Mon, 4 Dec 2023 22:38:00 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
b=fiJ7AnFm95ia8TYf4hdS1yP4Pn2x8gxHU9c62DXBlgCJ88d98mCILgRpXzzHqjamqyJe0MxV64UUhG9KwozUihcE6tTu6nl3d/DK+7rPPgW07qgnxFMIzaTn1P640iZW4gXlmMiI26BU7Ey2OKJmQjwEUCD1ZwSnMp6mWLB1MhpZ9ELqT/Dn7S0m5ejdhtSypcdlyayIsIAbf6GfMR19xqCk7CAGmg9ly8wrc0Gy1XDIEDEWPCRPYRrqA47YrA57QFTKSivvAGWGqFnjnHzi1twxcFO/Vzo4kvSW5KXsrfZHU23D9/zlNGPtw8+OIWWMIodDKt9dPa5VcLx1ls1AbQ==
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=0K3iglNj3vwJ20tywpL1THaFmailc2x+KGl5whUNK0c=;
b=f2dudYM8lyEq2CZUE8lnVAGHQLee4nOAvjOF1Hlbk/cPzw1JnyOekFoNZDozNh5oU7VO1/2m4KmKCgmgkYr8y8UKvk0AIrVp5Y3441PsP1DypX2AhfU6jhmhzAC54+P+TT3fjWQwTeTfIk3P2gbSc0MaCPC+oRxS6lrb6GRiCQ+9Y9rUzKNUL1ssHG+8g7TrYwLQJ3UoOPw0CnJO2jDhQ4fEnW2zuGaANPA+/UX6i4vBm4m/cUOYUlCIsA42uoes3MT/o26hpYAWrY7YJ0huNVKnQoANEqEdiiEP2y6iicrWe+R0RVp7bPO42ISs7F/6gVIwmf8Tk/HTGPhLjHxE/A==
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=0K3iglNj3vwJ20tywpL1THaFmailc2x+KGl5whUNK0c=;
b=sheI7+c7qono7o/yvLv645PWcCgzDl/F9lQUNZITbI710w3D67a7Y1KuOhGrtpdVrZY50h1IdsjfJ/C9QbRkXF2LPdlecbqLjnLfMdrR20+J2oe6XGrvp9wjCtWp9MDrCrJvAHYLrs+Fsd4Zcnt3GHMaTWCnvyttweqL07sVY0Q=
Received: from DM6PR04CA0029.namprd04.prod.outlook.com (2603:10b6:5:334::34)
by SA1PR12MB8919.namprd12.prod.outlook.com (2603:10b6:806:38e::8) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.33; Tue, 5 Dec
2023 06:37:55 +0000
Received: from DS3PEPF000099E2.namprd04.prod.outlook.com
(2603:10b6:5:334:cafe::b3) by DM6PR04CA0029.outlook.office365.com
(2603:10b6:5:334::34) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.33 via Frontend
Transport; Tue, 5 Dec 2023 06:37:55 +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
DS3PEPF000099E2.mail.protection.outlook.com (10.167.17.201) with Microsoft
SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
15.20.7068.20 via Frontend Transport; Tue, 5 Dec 2023 06:37:55 +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.34; Tue, 5 Dec
2023 00:37:33 -0600
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 , Perry Yuan
Subject: [PATCH V12 1/7] x86: Drop CPU_SUP_INTEL from SCHED_MC_PRIO for the
expansion.
Date: Tue, 5 Dec 2023 14:35:31 +0800
Message-ID: <20231205063537.872834-2-li.meng@amd.com>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20231205063537.872834-1-li.meng@amd.com>
References: <20231205063537.872834-1-li.meng@amd.com>
Precedence: bulk
X-Mailing-List: linux-acpi@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: DS3PEPF000099E2:EE_|SA1PR12MB8919:EE_
X-MS-Office365-Filtering-Correlation-Id: 5ec48524-b0cc-476d-19b6-08dbf55cb6df
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: +QlshRnKDpcyiMa/ucaHkXbOEsAMGfjSHPwSq71i4xP61Id45mqiRR0zXeTekEh4tqxiphng1SXPaOyOrmfm4bSfobkh31f3MjizDrOarsBDgJtzVzSoRo6EaCuHlmVuO29fP70MQgd+vtAmlPpmVRoAvQ4AfE1yKwwNHI/QdHly6YbcbV8Bqriqx/nY4+7gi5MYTj7r8imOYiQrZ13dnpso4ue/d85DdlJpWbya/YtVWVxUWIJgG4ekn+3nlHstUe3govakgaYyzUuYYhTr/qqJndG3Msht+tDu/wONBb0EMBf7l4qZvaB7YA9XijW/WQBpmbgnshkp9qpFfpM7CkSoL4F+YXsep83uNrBVu7fo9W0PGTq8hC529Ca4TmD4htLNvO+dLR95Q5b9iH4t6j4EQXjvsMdsQu5i2GrfZjbxTxcyAKcqOs6zgsANMaboEKjkHlXR8GBetjSxhiEPwVvhLm+zL5a+9byNOKBAetBOHCOj1RXNMGF5NgIfWtzm6cSQ0INWL47/iP9hCwvpfQMTumtduiPHQYGAaK9EUxPpM58akusxeexQBi5BBoqk6/JPMDF5SlVKniotTK4ie5stBJytgUKB4O9llL23dzwSLnfL9H9v++IbmeSm/B/mGADjddXYDUVr4ExkEm1M/eGJ07EsalkiPkh9AjnYnwps6u7/SOa+4i7R2MCPAtvbcHgV/8C8ctJyWFLQ32NpRN0Kc15eH1YOeFLWvquyYqC38JBorO39+OOJSaVrFUGFvoxShQAP4kYNoIEqIWt0Rw==
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)(396003)(376002)(39860400002)(136003)(230922051799003)(451199024)(82310400011)(1800799012)(64100799003)(186009)(36840700001)(46966006)(40470700004)(81166007)(47076005)(356005)(82740400003)(426003)(83380400001)(40480700001)(26005)(336012)(16526019)(2616005)(7696005)(1076003)(36860700001)(478600001)(40460700003)(70586007)(70206006)(54906003)(6636002)(110136005)(316002)(8936002)(8676002)(4326008)(2906002)(41300700001)(36756003)(86362001)(5660300002)(7416002)(4744005)(36900700001);
DIR:OUT; SFP:1101;
X-OriginatorOrg: amd.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Dec 2023 06:37:55.5990 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: 5ec48524-b0cc-476d-19b6-08dbf55cb6df
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: DS3PEPF000099E2.namprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8919
amd-pstate driver also uses SCHED_MC_PRIO, so decouple the requirement
of CPU_SUP_INTEL from the dependencies to allow compilation in kernels
without Intel CPU support.
Tested-by: Oleksandr Natalenko
Reviewed-by: Mario Limonciello
Reviewed-by: Huang Rui
Reviewed-by: Perry Yuan
Signed-off-by: Meng Li
Acked-by: Borislav Petkov (AMD)
---
arch/x86/Kconfig | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 3762f41bb092..3e57773f946a 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1054,8 +1054,9 @@ config SCHED_MC
config SCHED_MC_PRIO
bool "CPU core priorities scheduler support"
- depends on SCHED_MC && CPU_SUP_INTEL
- select X86_INTEL_PSTATE
+ depends on SCHED_MC
+ select X86_INTEL_PSTATE if CPU_SUP_INTEL
+ select X86_AMD_PSTATE if CPU_SUP_AMD && ACPI
select CPU_FREQ
default y
help
From patchwork Tue Dec 5 06:35:32 2023
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: "Meng, Li \(Jassmine\)"
X-Patchwork-Id: 751164
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com
header.b="3h06xNYB"
Received: from NAM12-MW2-obe.outbound.protection.outlook.com
(mail-mw2nam12on2060.outbound.protection.outlook.com [40.107.244.60])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88625127;
Mon, 4 Dec 2023 22:38:05 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
b=QN/7LR06pscAwohFv0wY3olpXghnggHJCSJZqXJhWH4cpBOwX8l8eR7or0u+NIpFiv+xODQ7PWfmGMyDWSM7VzjQUOzvbxjBKZL4k1SZKqcXPl/Pvu7spm+0rQeMZjD/S+g7WBWGgszuYRZD6KUgOPp841yOI7FEfucyPUoqvHxH6J9ZpwXHc7Egz2NitEj+MfYCBCUnYXS/UbzeDnUXUBMoYm9wkf8XAhgmhi+xYSquh+c5iU14z2+Qc7E1vIG6qrYyqte756EQlb29dPdNQfi3xFPnPXiQUqFIvtRmlYSmGnB30YDbeIBQeiMc3i9o+/NWYKhwcN0v9GzptIkOUA==
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=NDN7qozXIHo1m/GwVQvM3/83gkcNy5S4f7NMi2axIKs=;
b=DDxPzLJOBN740YTVjqfUbXDiABYFZi5S28SVued6oUQn0ryl9Dzgf88rlJg6ArCqJfLEK3/Iruz5Zfgd4thV88Ob2RXfnF9YmE5HfB66w2qrGJMqQFyC46smirEqXPjQMOYl0GZP2mWnZO1qFV+j424APFUtGUzpCOcykn64GNqmb8r6SiMoKnJnZcwC43NzQ+ROYTwaZU8Mq7umkxJJ+tYuoaiCi98iO3czonC/YxhPmUoTw71bPH8HTLFxtfSxnQo9w0O6952bCkmDFZ2ruvaqmy0Kr4GwgCCSzaL5iS8C/BHQh+BbY2f1iZHGPTiC8oUAfQYvPukFfSF+tbzjjw==
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=NDN7qozXIHo1m/GwVQvM3/83gkcNy5S4f7NMi2axIKs=;
b=3h06xNYBXNemOaWsCrHytjrEOjC0K7TqROj4RA0e27e6higZtpbw84ePqY6eoe0sZc3rX+FtqaUbdhiVfum5dw+Fn4XXaKR7xEaJONGBRB+FnkwLaEngDcTdPxHQn3tDoowX4Sfao1lceDV/8vAoYhyAuYKa+lHF6xgkuKSulDM=
Received: from CH0PR03CA0069.namprd03.prod.outlook.com (2603:10b6:610:cc::14)
by DS7PR12MB6358.namprd12.prod.outlook.com (2603:10b6:8:95::22) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.34; Tue, 5 Dec
2023 06:38:03 +0000
Received: from DS3PEPF000099DC.namprd04.prod.outlook.com
(2603:10b6:610:cc:cafe::90) by CH0PR03CA0069.outlook.office365.com
(2603:10b6:610:cc::14) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.34 via Frontend
Transport; Tue, 5 Dec 2023 06:38:02 +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
DS3PEPF000099DC.mail.protection.outlook.com (10.167.17.198) with Microsoft
SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
15.20.7068.20 via Frontend Transport; Tue, 5 Dec 2023 06:38:02 +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.34; Tue, 5 Dec
2023 00:37:55 -0600
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 , Wyes Karny
, Perry Yuan
Subject: [PATCH V12 2/7] acpi: cppc: Add get the highest performance cppc
control
Date: Tue, 5 Dec 2023 14:35:32 +0800
Message-ID: <20231205063537.872834-3-li.meng@amd.com>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20231205063537.872834-1-li.meng@amd.com>
References: <20231205063537.872834-1-li.meng@amd.com>
Precedence: bulk
X-Mailing-List: linux-acpi@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: DS3PEPF000099DC:EE_|DS7PR12MB6358:EE_
X-MS-Office365-Filtering-Correlation-Id: cee5df21-9030-4f15-7602-08dbf55cbb32
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: Z5MNp1HAUP5HtK9lCx24Izz8KSVAEiNWuePMFMEme2G3GbqdJ2l2T/PvoMvrnuAg6AEglMdgY/Ft0pvzAb1MI40iN4QcQ0RzOC73PfDaeNJJQyvWsBmGDxXyCpmYrEyal6bWIUsBcHAkelp0Eqh5uTAwWmGnpqGL5RIxsByEku4R62BpV/gmQ2x5x7zHK+j/ZIQpKO6mhlxDOIDMWlAU8BbhXzKhuzW3LEHnGtNVvc4aWWG9/UE4tGeErk2nSANgpjfQ7I3BuvYGswnEDabaNMEmVi7SVoW5CdNXtobLHptOAlCEBtn7rg2a3mm2x67Vl/Ln3EHxm0Tup9JgTko4IhOX+hPKXiCyFzsyWReYGLFFticxAlcbz2wCR5UlZnP98dFlJ6mHCYf/T+8KHncP0feKIQkhHAoM9gtyt2BYQ043oAYDeDZsUpWfhOnpUP5x8BraVASBREIn3JCXp/8vFmXuestnh4W6lPry/3sBnaNd7xFmILgOV4/+pCYhPlrw3Pf7RYmxikvOBTqU7Lk1CxJvlU/e8ftynkicQrZZNAnMnfd3sP7w6h9H+erobbv7GHswQ1cAFi7rZiDxNU9MILVTyABHq9D2UIivDjZlRgDcFfR7PPy4WUwIXnm2kZXtDqz8ryCG7kNOemuSrlWng615zmMAsSYqWPI07pr0NQYvI1ovwQVVwoYhGvD4IymTPK9s23Q3EHr1TGe2UdiiuTKC2NkE+VyARPS3VUIS8CwyaA/J30fM0I4LOjJ8PMM/Nc5aNVjTLnKb+yQQpixGROxqtCBvJjivoLtQY7FgFJo=
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)(39860400002)(346002)(230922051799003)(64100799003)(451199024)(186009)(1800799012)(82310400011)(46966006)(36840700001)(40470700004)(40480700001)(40460700003)(478600001)(7696005)(1076003)(966005)(2616005)(47076005)(6666004)(16526019)(26005)(81166007)(8936002)(8676002)(426003)(336012)(6636002)(110136005)(54906003)(4326008)(70206006)(70586007)(316002)(7416002)(36756003)(82740400003)(41300700001)(356005)(5660300002)(2906002)(36860700001)(86362001)(15583001)(36900700001);
DIR:OUT; SFP:1101;
X-OriginatorOrg: amd.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Dec 2023 06:38:02.8718 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: cee5df21-9030-4f15-7602-08dbf55cbb32
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: DS3PEPF000099DC.namprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6358
Add support for getting the highest performance to the
generic CPPC driver. This enables downstream drivers
such as amd-pstate to discover and use these values.
Please refer to the ACPI_Spec for details on continuous
performance control of CPPC.
Tested-by: Oleksandr Natalenko
Reviewed-by: Mario Limonciello
Reviewed-by: Wyes Karny
Reviewed-by: Perry Yuan
Acked-by: Huang Rui
Signed-off-by: Meng Li
Link: https://uefi.org/specs/ACPI/6.5/08_Processor_Configuration_and_Control.html?highlight=cppc#highest-performance
---
drivers/acpi/cppc_acpi.c | 13 +++++++++++++
include/acpi/cppc_acpi.h | 5 +++++
2 files changed, 18 insertions(+)
diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c
index 7ff269a78c20..ad388a0e8484 100644
--- a/drivers/acpi/cppc_acpi.c
+++ b/drivers/acpi/cppc_acpi.c
@@ -1154,6 +1154,19 @@ int cppc_get_nominal_perf(int cpunum, u64 *nominal_perf)
return cppc_get_perf(cpunum, NOMINAL_PERF, nominal_perf);
}
+/**
+ * cppc_get_highest_perf - Get the highest performance register value.
+ * @cpunum: CPU from which to get highest performance.
+ * @highest_perf: Return address.
+ *
+ * Return: 0 for success, -EIO otherwise.
+ */
+int cppc_get_highest_perf(int cpunum, u64 *highest_perf)
+{
+ return cppc_get_perf(cpunum, HIGHEST_PERF, highest_perf);
+}
+EXPORT_SYMBOL_GPL(cppc_get_highest_perf);
+
/**
* cppc_get_epp_perf - Get the epp register value.
* @cpunum: CPU from which to get epp preference value.
diff --git a/include/acpi/cppc_acpi.h b/include/acpi/cppc_acpi.h
index 6126c977ece0..c0b69ffe7bdb 100644
--- a/include/acpi/cppc_acpi.h
+++ b/include/acpi/cppc_acpi.h
@@ -139,6 +139,7 @@ struct cppc_cpudata {
#ifdef CONFIG_ACPI_CPPC_LIB
extern int cppc_get_desired_perf(int cpunum, u64 *desired_perf);
extern int cppc_get_nominal_perf(int cpunum, u64 *nominal_perf);
+extern int cppc_get_highest_perf(int cpunum, u64 *highest_perf);
extern int cppc_get_perf_ctrs(int cpu, struct cppc_perf_fb_ctrs *perf_fb_ctrs);
extern int cppc_set_perf(int cpu, struct cppc_perf_ctrls *perf_ctrls);
extern int cppc_set_enable(int cpu, bool enable);
@@ -165,6 +166,10 @@ static inline int cppc_get_nominal_perf(int cpunum, u64 *nominal_perf)
{
return -ENOTSUPP;
}
+static inline int cppc_get_highest_perf(int cpunum, u64 *highest_perf)
+{
+ return -ENOTSUPP;
+}
static inline int cppc_get_perf_ctrs(int cpu, struct cppc_perf_fb_ctrs *perf_fb_ctrs)
{
return -ENOTSUPP;
From patchwork Tue Dec 5 06:35:33 2023
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: "Meng, Li \(Jassmine\)"
X-Patchwork-Id: 750433
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com
header.b="HpcSQGQt"
Received: from NAM11-DM6-obe.outbound.protection.outlook.com
(mail-dm6nam11on2040.outbound.protection.outlook.com [40.107.223.40])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B8CF11F;
Mon, 4 Dec 2023 22:38:12 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
b=F7zOfO4nQhxUtk6XkeotEUT9s15Sn1og0bPszRz5uEbiuNa5Mv10Q44VrtgTrcy6x1gtIoUA5obrpJ/l5skQ24pTBvpIFdfcAcCuopiUS+06lsprlzWzU+ye1gEFNTzaFNjKALV90IckfSgvPLCdEWCViJ3DdP1wJRZoRg3qrai2A0EUdZCpnumHT+MiHYLpJ4sbbhcoMvpm2L/B3guPgVPsXNq5k9IadRdis0PqQRfNcIC90FEkFls0MNTuGc8qzQEDaVsLVJHlTDNlb5gMu78Fl7aiMFpq1jNaqtdhXC6RntYAYsGZZqs3ef+4ARUSekkSvyqY6wwXjFFb7187lQ==
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=XmBnlY6CcyhnNSPEQizfeQBw6AAo8AGdk2azpcvOOtI=;
b=cwy950MQvrdHrw54aP4sccJnWHItwY+spWm9OxLC9tekGll83SMzhcPwCwL+MioNbKgXBtQh97gOtRgeU+r9LcUrCl3v4b//Z6FZrSIxSG3bFdIcshYHWWsgEK3pLT++iMqPQCJdHC4F9r3WuEhV6GZLlDI9t8lzFxu31QOXZ1qyfiAphq7SGejb7IVDDoHXk4VlnOOCnFPpGifcuxyfHdxbJ5AtuqgSqVQOE4iv1YKiZR/ZNiM2IarzLd+zsNWYoMdViLGWOxJIWSI1lx+15viZkUhzRIMa37rGcZmeTX0wDoUGlL0xuTWrOR9BOGKsGKACuwRSkqQgi0uiwpPtPA==
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=XmBnlY6CcyhnNSPEQizfeQBw6AAo8AGdk2azpcvOOtI=;
b=HpcSQGQtPE49C0hKx5WqrReny63oxu626y7NCmqORsVzAwa/tEYhKyYDdQnur4pwDZmK6/cSqRxiDTQIl+9H4Y6JzCefFQ+e34ezZZ/eDnvWb+i/j1wTYH7SF8K06gqBSR2qGK8s5TCNcWd2CzUqUTW9OONS/jtcRvBgq9xvyBA=
Received: from DM6PR14CA0039.namprd14.prod.outlook.com (2603:10b6:5:18f::16)
by LV8PR12MB9110.namprd12.prod.outlook.com (2603:10b6:408:18b::18) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.34; Tue, 5 Dec
2023 06:38:08 +0000
Received: from DS3PEPF000099DE.namprd04.prod.outlook.com
(2603:10b6:5:18f:cafe::54) by DM6PR14CA0039.outlook.office365.com
(2603:10b6:5:18f::16) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.34 via Frontend
Transport; Tue, 5 Dec 2023 06:38:08 +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
DS3PEPF000099DE.mail.protection.outlook.com (10.167.17.200) with Microsoft
SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
15.20.7068.20 via Frontend Transport; Tue, 5 Dec 2023 06:38:08 +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.34; Tue, 5 Dec
2023 00:38:02 -0600
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 , Wyes Karny
Subject: [PATCH V12 3/7] cpufreq: amd-pstate: Enable amd-pstate preferred core
supporting.
Date: Tue, 5 Dec 2023 14:35:33 +0800
Message-ID: <20231205063537.872834-4-li.meng@amd.com>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20231205063537.872834-1-li.meng@amd.com>
References: <20231205063537.872834-1-li.meng@amd.com>
Precedence: bulk
X-Mailing-List: linux-acpi@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: DS3PEPF000099DE:EE_|LV8PR12MB9110:EE_
X-MS-Office365-Filtering-Correlation-Id: 25a1e611-1d87-4f8a-ffd6-08dbf55cbe80
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: U1qel9esVviiLMdEAPp63phYwKg9aZsB+LpCG0UVVPWM+VrJNdY5z3E5Ux6ubZRMYQLjoLAZB4E06BLej93qujWwr24dZUzY3OF0EdDIq58PCxZby1evURSODWGU/LUL8cq2d2OKdTgWnALQsKDrYc6WWSPRhS8EP2lYhGLAxULS5reZlxd7NQLJSshWbpwk57c0ESJTWaqgTqxR3QsRE/O2XoQkz16yE4fb+0xA+vxgbpSZiik1S9SjIp3w7cET1nwkjU7lhXadbBKqgzgyPfgiP7wNcrnzuAH415Jdw8sBG7OhLxOCubnZWdSyYMDAcKPkDQTy4smwRpLB0lXBUkdn/zZhAh4khM72E03xZJGE5kp+MdgMpDmcY+LDjowOaBiJok8oPvo/jhgtlG/5SH5/wGaWsD14NuV+8ji+Um+0HPMcOi7Cm/ybm8dFOvSmtq+eFLwkCLBwJJSUGVysPcJ6JAx14ejIe9LCa/DMsXO1Jpk9w8hQaGU11LUwsHEsxa3CI8zFrxaHRvXRuFc2jQhkrI+pVhrr9vd9t5A/06nS5mofDSEMk7FwiB4IzEdeM0zSnHdEZEyn8H1lT8pJUe+A9zXGupYHeZmBCBPrBCa+RXx1dpVYDQkrTlpX5ilX1rJDCveLhJlN04GWXjMEAqZ0KTRLngrKe0m2NUaeHZkA7FJAzU1lIfT8X/3zGKicXj3Q+0cjcX+UvwBlL6dY8FqpMXw6rnm+UP1CxfBX+fQf6iQwpclhmcnkYluaVUkA/QgiV4olcAxqrfVxod9/Gw==
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)(136003)(396003)(346002)(376002)(39860400002)(230922051799003)(1800799012)(451199024)(186009)(82310400011)(64100799003)(36840700001)(46966006)(40470700004)(40480700001)(40460700003)(478600001)(7696005)(1076003)(2616005)(81166007)(47076005)(6666004)(16526019)(26005)(8936002)(8676002)(426003)(336012)(6636002)(110136005)(54906003)(4326008)(70206006)(70586007)(83380400001)(316002)(7416002)(5660300002)(36756003)(356005)(82740400003)(41300700001)(2906002)(36860700001)(86362001)(36900700001);
DIR:OUT; SFP:1101;
X-OriginatorOrg: amd.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Dec 2023 06:38:08.4041 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: 25a1e611-1d87-4f8a-ffd6-08dbf55cbe80
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: DS3PEPF000099DE.namprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9110
amd-pstate driver utilizes the functions and data structures
provided by the ITMT architecture to enable the scheduler to
favor scheduling on cores which can be get a higher frequency
with lower voltage. We call it amd-pstate preferrred core.
Here sched_set_itmt_core_prio() is called to set priorities and
sched_set_itmt_support() is called to enable ITMT feature.
amd-pstate driver uses the highest performance value to indicate
the priority of CPU. The higher value has a higher priority.
The initial core rankings are set up by amd-pstate when the
system boots.
Add a variable hw_prefcore in cpudata structure. It will check
if the processor and power firmware support preferred core
feature.
Add one new early parameter `disable` to allow user to disable
the preferred core.
Only when hardware supports preferred core and user set `enabled`
in early parameter, amd pstate driver supports preferred core featue.
Tested-by: Oleksandr Natalenko
Reviewed-by: Huang Rui
Reviewed-by: Wyes Karny
Reviewed-by: Mario Limonciello
Co-developed-by: Perry Yuan
Signed-off-by: Perry Yuan
Signed-off-by: Meng Li
---
drivers/cpufreq/amd-pstate.c | 131 ++++++++++++++++++++++++++++++++---
include/linux/amd-pstate.h | 4 ++
2 files changed, 127 insertions(+), 8 deletions(-)
diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index 1f6186475715..9c2790753f99 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -37,6 +37,7 @@
#include
#include
#include
+#include
#include
#include
@@ -49,6 +50,7 @@
#define AMD_PSTATE_TRANSITION_LATENCY 20000
#define AMD_PSTATE_TRANSITION_DELAY 1000
+#define AMD_PSTATE_PREFCORE_THRESHOLD 166
/*
* TODO: We need more time to fine tune processors with shared memory solution
@@ -64,6 +66,7 @@ static struct cpufreq_driver amd_pstate_driver;
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;
/*
* AMD Energy Preference Performance (EPP)
@@ -297,13 +300,14 @@ static int pstate_init_perf(struct amd_cpudata *cpudata)
if (ret)
return ret;
- /*
- * TODO: Introduce AMD specific power feature.
- *
- * CPPC entry doesn't indicate the highest performance in some ASICs.
+ /* For platforms that do not support the preferred core feature, the
+ * highest_pef may be configured with 166 or 255, to avoid max frequency
+ * calculated wrongly. we take the AMD_CPPC_HIGHEST_PERF(cap1) value as
+ * the default max perf.
*/
- highest_perf = amd_get_highest_perf();
- if (highest_perf > AMD_CPPC_HIGHEST_PERF(cap1))
+ if (cpudata->hw_prefcore)
+ highest_perf = AMD_PSTATE_PREFCORE_THRESHOLD;
+ else
highest_perf = AMD_CPPC_HIGHEST_PERF(cap1);
WRITE_ONCE(cpudata->highest_perf, highest_perf);
@@ -324,8 +328,9 @@ static int cppc_init_perf(struct amd_cpudata *cpudata)
if (ret)
return ret;
- highest_perf = amd_get_highest_perf();
- if (highest_perf > cppc_perf.highest_perf)
+ if (cpudata->hw_prefcore)
+ highest_perf = AMD_PSTATE_PREFCORE_THRESHOLD;
+ else
highest_perf = cppc_perf.highest_perf;
WRITE_ONCE(cpudata->highest_perf, highest_perf);
@@ -706,6 +711,80 @@ static void amd_perf_ctl_reset(unsigned int cpu)
wrmsrl_on_cpu(cpu, MSR_AMD_PERF_CTL, 0);
}
+/*
+ * Set amd-pstate preferred core enable can't be done directly from cpufreq callbacks
+ * due to locking, so queue the work for later.
+ */
+static void amd_pstste_sched_prefcore_workfn(struct work_struct *work)
+{
+ sched_set_itmt_support();
+}
+static DECLARE_WORK(sched_prefcore_work, amd_pstste_sched_prefcore_workfn);
+
+/*
+ * Get the highest performance register value.
+ * @cpu: CPU from which to get highest performance.
+ * @highest_perf: Return address.
+ *
+ * Return: 0 for success, -EIO otherwise.
+ */
+static int amd_pstate_get_highest_perf(int cpu, u32 *highest_perf)
+{
+ int ret;
+
+ if (boot_cpu_has(X86_FEATURE_CPPC)) {
+ u64 cap1;
+
+ ret = rdmsrl_safe_on_cpu(cpu, MSR_AMD_CPPC_CAP1, &cap1);
+ if (ret)
+ return ret;
+ WRITE_ONCE(*highest_perf, AMD_CPPC_HIGHEST_PERF(cap1));
+ } else {
+ u64 cppc_highest_perf;
+
+ ret = cppc_get_highest_perf(cpu, &cppc_highest_perf);
+ if (ret)
+ return ret;
+ WRITE_ONCE(*highest_perf, cppc_highest_perf);
+ }
+
+ return (ret);
+}
+
+#define CPPC_MAX_PERF U8_MAX
+
+static void amd_pstate_init_prefcore(struct amd_cpudata *cpudata)
+{
+ int ret, prio;
+ u32 highest_perf;
+
+ ret = amd_pstate_get_highest_perf(cpudata->cpu, &highest_perf);
+ if (ret)
+ return;
+
+ cpudata->hw_prefcore = true;
+ /* check if CPPC preferred core feature is enabled*/
+ if (highest_perf < CPPC_MAX_PERF)
+ prio = (int)highest_perf;
+ else {
+ pr_debug("AMD CPPC preferred core is unsupported!\n");
+ cpudata->hw_prefcore = false;
+ return;
+ }
+
+ if (!amd_pstate_prefcore)
+ return;
+
+ /*
+ * The priorities can be set regardless of whether or not
+ * sched_set_itmt_support(true) has been called and it is valid to
+ * update them at any time after it has been called.
+ */
+ sched_set_itmt_core_prio(prio, cpudata->cpu);
+
+ schedule_work(&sched_prefcore_work);
+}
+
static int amd_pstate_cpu_init(struct cpufreq_policy *policy)
{
int min_freq, max_freq, nominal_freq, lowest_nonlinear_freq, ret;
@@ -727,6 +806,8 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy)
cpudata->cpu = policy->cpu;
+ amd_pstate_init_prefcore(cpudata);
+
ret = amd_pstate_init_perf(cpudata);
if (ret)
goto free_cpudata1;
@@ -877,6 +958,17 @@ static ssize_t show_amd_pstate_highest_perf(struct cpufreq_policy *policy,
return sysfs_emit(buf, "%u\n", perf);
}
+static ssize_t show_amd_pstate_hw_prefcore(struct cpufreq_policy *policy,
+ char *buf)
+{
+ bool hw_prefcore;
+ struct amd_cpudata *cpudata = policy->driver_data;
+
+ hw_prefcore = READ_ONCE(cpudata->hw_prefcore);
+
+ return sysfs_emit(buf, "%s\n", str_enabled_disabled(hw_prefcore));
+}
+
static ssize_t show_energy_performance_available_preferences(
struct cpufreq_policy *policy, char *buf)
{
@@ -1074,18 +1166,27 @@ static ssize_t status_store(struct device *a, struct device_attribute *b,
return ret < 0 ? ret : count;
}
+static ssize_t prefcore_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ return sysfs_emit(buf, "%s\n", str_enabled_disabled(amd_pstate_prefcore));
+}
+
cpufreq_freq_attr_ro(amd_pstate_max_freq);
cpufreq_freq_attr_ro(amd_pstate_lowest_nonlinear_freq);
cpufreq_freq_attr_ro(amd_pstate_highest_perf);
+cpufreq_freq_attr_ro(amd_pstate_hw_prefcore);
cpufreq_freq_attr_rw(energy_performance_preference);
cpufreq_freq_attr_ro(energy_performance_available_preferences);
static DEVICE_ATTR_RW(status);
+static DEVICE_ATTR_RO(prefcore);
static struct freq_attr *amd_pstate_attr[] = {
&amd_pstate_max_freq,
&amd_pstate_lowest_nonlinear_freq,
&amd_pstate_highest_perf,
+ &amd_pstate_hw_prefcore,
NULL,
};
@@ -1093,6 +1194,7 @@ static struct freq_attr *amd_pstate_epp_attr[] = {
&amd_pstate_max_freq,
&amd_pstate_lowest_nonlinear_freq,
&amd_pstate_highest_perf,
+ &amd_pstate_hw_prefcore,
&energy_performance_preference,
&energy_performance_available_preferences,
NULL,
@@ -1100,6 +1202,7 @@ static struct freq_attr *amd_pstate_epp_attr[] = {
static struct attribute *pstate_global_attributes[] = {
&dev_attr_status.attr,
+ &dev_attr_prefcore.attr,
NULL
};
@@ -1151,6 +1254,8 @@ static int amd_pstate_epp_cpu_init(struct cpufreq_policy *policy)
cpudata->cpu = policy->cpu;
cpudata->epp_policy = 0;
+ amd_pstate_init_prefcore(cpudata);
+
ret = amd_pstate_init_perf(cpudata);
if (ret)
goto free_cpudata1;
@@ -1568,7 +1673,17 @@ static int __init amd_pstate_param(char *str)
return amd_pstate_set_driver(mode_idx);
}
+
+static int __init amd_prefcore_param(char *str)
+{
+ if (!strcmp(str, "disable"))
+ amd_pstate_prefcore = false;
+
+ return 0;
+}
+
early_param("amd_pstate", amd_pstate_param);
+early_param("amd_prefcore", amd_prefcore_param);
MODULE_AUTHOR("Huang Rui ");
MODULE_DESCRIPTION("AMD Processor P-state Frequency Driver");
diff --git a/include/linux/amd-pstate.h b/include/linux/amd-pstate.h
index 6ad02ad9c7b4..68fc1bd8d851 100644
--- a/include/linux/amd-pstate.h
+++ b/include/linux/amd-pstate.h
@@ -52,6 +52,9 @@ struct amd_aperf_mperf {
* @prev: Last Aperf/Mperf/tsc count value read from register
* @freq: current cpu frequency value
* @boost_supported: check whether the Processor or SBIOS supports boost mode
+ * @hw_prefcore: check whether HW supports preferred core featue.
+ * Only when hw_prefcore and early prefcore param are true,
+ * AMD P-State driver supports preferred core featue.
* @epp_policy: Last saved policy used to set energy-performance preference
* @epp_cached: Cached CPPC energy-performance preference value
* @policy: Cpufreq policy value
@@ -85,6 +88,7 @@ struct amd_cpudata {
u64 freq;
bool boost_supported;
+ bool hw_prefcore;
/* EPP feature related attributes*/
s16 epp_policy;
From patchwork Tue Dec 5 06:35:34 2023
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: "Meng, Li \(Jassmine\)"
X-Patchwork-Id: 751163
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com
header.b="RCcgVCZp"
Received: from NAM04-MW2-obe.outbound.protection.outlook.com
(mail-mw2nam04on2075.outbound.protection.outlook.com [40.107.101.75])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41485FA;
Mon, 4 Dec 2023 22:38:40 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
b=X3GQdh+uSW3faHocWNy4KklZRhulo6Vf8/tofS4cNZz7BOgmPXqR3YaOXLTNVXAXacqESxSCLKXl49N0k1GvaIeUbe6nBO4/wiTVlabJj9xvehIPrV3uzsWOFxS72Baj+ItV2buiwlp2nSYYgKRbkKROv/ulFRWrgFqunF6n18b00+I1vnBAYNsYjTARwpmSOpOtBSOZzlUj3cpsGqgOi72JNyUs7Rs7WeEazF/mec+o9PxOrHbcZTYID0wXB6Wp9JnZcilIlt6agPGv8XT9PFIbMFtgLh3AyhfDePaTaeP3JsixKKBflJj1hUWoFNidaeRG7K/9PG0Pz24mXfXEOw==
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=Y5Mk/Pmr691XK7NaMy3vWvMLF4PXHaH5/AChBpT75o0=;
b=hYX4zDDB767sM6jbJvnSyv1XTQ+5WPznoX2QpuLtCa9d1iHiz7e5rQG3s7gIgL1X0XZL3YuWL1dphh16ZyBCQIEjLmD+pkcwEc1KH6Q+Kp4AM25nvgWZEFT/LSZP0sd9JYriPoke30G52Rn147C9lzAXRaNbhp31LSpMbjvCQ5Yo0Wno9Ud43Q/qSQe/WFryoJuKwwUg+QVj9NxZavtMmBuCovS7Tdmz2dUOKHO4uQHbfyl4guyI03A69Xw5gZTvM77wNFo4JQFJbEl0rZQWMhx6dMZhpBjcs0y9WCpvxnPLRHeg9JGAV44i2ynHNoYt2N1Ecynxqb+b99YaHTDuaA==
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=Y5Mk/Pmr691XK7NaMy3vWvMLF4PXHaH5/AChBpT75o0=;
b=RCcgVCZp/Di8takhWu53HNlM0E4PZgIR14XfhvGW59+b/qG+hMRomRp4Y1wu1CIxIo4oxj0hXccIjZaQrekvFYflm8o8zA8v0FoCV5W18adqV/lR/oO28t3rJA3gsAaeUow3COim90k1Mn+xPkGSPqnKv2ABJjFszdIjr3cYLRU=
Received: from CH0P220CA0019.NAMP220.PROD.OUTLOOK.COM (2603:10b6:610:ef::26)
by CH3PR12MB9316.namprd12.prod.outlook.com (2603:10b6:610:1ce::21) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.34; Tue, 5 Dec
2023 06:38:37 +0000
Received: from DS3PEPF000099DB.namprd04.prod.outlook.com
(2603:10b6:610:ef:cafe::9a) by CH0P220CA0019.outlook.office365.com
(2603:10b6:610:ef::26) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.34 via Frontend
Transport; Tue, 5 Dec 2023 06:38:37 +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
DS3PEPF000099DB.mail.protection.outlook.com (10.167.17.197) with Microsoft
SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
15.20.7068.20 via Frontend Transport; Tue, 5 Dec 2023 06:38:36 +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.34; Tue, 5 Dec
2023 00:38:08 -0600
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 , Perry Yuan
Subject: [PATCH V12 4/7] cpufreq: Add a notification message that the highest
perf has changed
Date: Tue, 5 Dec 2023 14:35:34 +0800
Message-ID: <20231205063537.872834-5-li.meng@amd.com>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20231205063537.872834-1-li.meng@amd.com>
References: <20231205063537.872834-1-li.meng@amd.com>
Precedence: bulk
X-Mailing-List: linux-acpi@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: DS3PEPF000099DB:EE_|CH3PR12MB9316:EE_
X-MS-Office365-Filtering-Correlation-Id: a566373c-4b6b-4f7f-f900-08dbf55ccf83
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: i9a90ojb7EjoYOtm4M6sBW9Z4jxcGG4YZw/oBRFC1ExXfsaBkR9v06WSQa/fjp+Ih0dKlr8ZTAtqcAe+BvqM+34zxq+mc1bZGsZG1ek5yy1iPhEgOZI2xoLNUJJ0no9F4Ze82K65KFj6l9UG8cCuIYTwxaKpQDPmR7kjpFWlDClHD/wrvmqcalMuxtwt/LjGRJceesvxKvqTkGleJcDRQHsiFkMaXqAxHTo2QmLpg0bgmP6ZQephEOGewhQ/tOMMpTwfwmp7Xedfdt3MwEQKmm2ElOm+BmWOSedpaNAWs7XPRWNXFd5Plkqe41mtFOS6Ir4PwqcGSmuIyLTPsmr5kvvejftF7UF7E1bN1Zq0dgT9J3swXod0X70roFGznQUjyuaDz2VFD2m/yrZLKdlawqcW4Nt8QQ3P7Bb9v0+FcMCrmw7luQ2ydZ+Bfa2bb4Gggeh4dfvqc0xdiTAtxjlDDMxjS3iqKvbua/wc76nPHn/P6Nm5zhKKMKdx/Siq4CEKm6Xvgw2X67AhD1AYHHv+JOYM4L7tjqCftxI3w/GsJk/8A8BcsUOG+WwuZwgDVvKpbQKNr8KODf2r2GB+aEQHuLr2K8zYPbEWT2dYaW2IUjuMQemdqC+TTjzqczPZxYRTAAKsDkis85ctsVOa69lecl2wK8Ko+ZEKe8iYrVc7xdB6ZqZ5qBJTn4cex4ZS7vRtirMcAqjlu3hjqKb43zxYbIYoLs40WRqN4tfur+Ejal+VHBXgcUMzXwzOfJB30gOit3O9hJ6Jp8F13VynpwOOiAImr+Fjz6mlU3boa7fPSrI=
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)(376002)(39860400002)(396003)(136003)(230922051799003)(82310400011)(1800799012)(64100799003)(451199024)(186009)(40470700004)(46966006)(36840700001)(26005)(478600001)(966005)(83380400001)(336012)(16526019)(47076005)(7696005)(6666004)(356005)(81166007)(426003)(1076003)(40480700001)(82740400003)(36756003)(2616005)(316002)(110136005)(6636002)(54906003)(70586007)(70206006)(36860700001)(5660300002)(4326008)(86362001)(2906002)(8936002)(8676002)(40460700003)(7416002)(41300700001)(15650500001)(226483002)(36900700001);
DIR:OUT; SFP:1101;
X-OriginatorOrg: amd.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Dec 2023 06:38:36.9604 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: a566373c-4b6b-4f7f-f900-08dbf55ccf83
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: DS3PEPF000099DB.namprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB9316
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
Reviewed-by: Perry Yuan
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 934d35f570b7..14a4cbc6dd05 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);
From patchwork Tue Dec 5 06:35:35 2023
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: "Meng, Li \(Jassmine\)"
X-Patchwork-Id: 750432
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com
header.b="X/ZJZTu0"
Received: from NAM12-MW2-obe.outbound.protection.outlook.com
(mail-mw2nam12on2069.outbound.protection.outlook.com [40.107.244.69])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62C4DFA;
Mon, 4 Dec 2023 22:38:47 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
b=db7fXzZmHGBj4JzHvTB2OybK9k3vpsbXFXnOrEu7VXXl8G8sNbL2WMMQ5uZc/EFG4UcJKQP5P0aujo/6CkK3Uyfih+RjJE0f51Q8zFhXMpjygkOdrUq4Hy3sT97Hp0BIM3sgsJTt08g3Oz4dHNpLo1HlwP3/JIBcZgLWE/UBSU9gqvLy2BJco7GyHMNBwTT5usreiPmTY5diaDz5KVLtD5+VOaNSZeKEceAUA0i/TmYot1sEX13EnI3ctg7ig2hwyZN524S0Zqs/HY9hc3DIysu0i25tayTYXUbSyaBMf5RxzOLkp0i+MwXC7LHFD63/Y6x5h2vYT/mZ40aMqtA2tQ==
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=uMYtSO2yqTYknGk2emCdrHmVUTNSN/FwK651HavA2lg=;
b=A1iY5BvthSRishLwc5EM8ENNBHLWa4Dfmmb9K20eflvQT4zJ1DwRVmjltZbZtIHUEiN6oFOb7+VUb+QLTPz/r22VhYPbYs1qdIAwUxFnFb8Y3CIpYqV2ej1/SObhn19ZWMQwR+m4jg4ZWhwo8QKvPV50dEnG4czrblI7Z9XpYIA/XkYa3DR64O1K5LZKChrzu9gQe+h3BNm6hkQhjGjrQ0Af8/7TXKCLt4sO1MlqpjGygblmlFxs61gaq0rH3Hs25M2njwX81Pzq7mM8HjuW7fFLHba6BG8e3q9ZHjrP1MT5wdwiT0LEfvLx0gT5+thHwkdKjpR9vJWgA91DUg8VgQ==
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=uMYtSO2yqTYknGk2emCdrHmVUTNSN/FwK651HavA2lg=;
b=X/ZJZTu0X4hqPoCRnr+qovatInuzNApq9LtK7P6kIw9y+S5dm5pW0Yl8dwQvGhFDdT78aAnomZpQ+OEk2D0u26Z7ruXkLwlSwdstMEC4UrX9rCTnG0g1p1s5XBByYXc5xiipgXpcP5vTzsmCgCQSpzXWEhTjbzX/IhGI6l4CQzo=
Received: from SJ0PR13CA0131.namprd13.prod.outlook.com (2603:10b6:a03:2c6::16)
by DM6PR12MB4878.namprd12.prod.outlook.com (2603:10b6:5:1b8::24) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.34; Tue, 5 Dec
2023 06:38:44 +0000
Received: from DS3PEPF000099DC.namprd04.prod.outlook.com
(2603:10b6:a03:2c6:cafe::b3) by SJ0PR13CA0131.outlook.office365.com
(2603:10b6:a03:2c6::16) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.24 via Frontend
Transport; Tue, 5 Dec 2023 06:38:43 +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
DS3PEPF000099DC.mail.protection.outlook.com (10.167.17.198) with Microsoft
SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
15.20.7068.20 via Frontend Transport; Tue, 5 Dec 2023 06:38:43 +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.34; Tue, 5 Dec
2023 00:38:36 -0600
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 , Wyes Karny
, Perry Yuan
Subject: [PATCH V12 5/7] cpufreq: amd-pstate: Update amd-pstate preferred core
ranking dynamically
Date: Tue, 5 Dec 2023 14:35:35 +0800
Message-ID: <20231205063537.872834-6-li.meng@amd.com>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20231205063537.872834-1-li.meng@amd.com>
References: <20231205063537.872834-1-li.meng@amd.com>
Precedence: bulk
X-Mailing-List: linux-acpi@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: DS3PEPF000099DC:EE_|DM6PR12MB4878:EE_
X-MS-Office365-Filtering-Correlation-Id: c6eec0ee-db89-4d84-e7c8-08dbf55cd366
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: /EO0TywmF4gYbKb42J95K3WJfbzRPiMb9dWE4no8Maby6cGXqgSID4+V0oz7HGUNmw4YJVWznQjehHXy6O0P4QMN9D59j1TlbDIoZnLx3qMzw0u7ulSxcUC+sWSnUsQnLiWitWzXKZJGi/MopbnCVnEn1QhIWIwuoTfZpAKyBmSa7EeKojtEilHsb+I+blI0wusifsuaX/N3+osGGoljWu6yohZwjlJWFNkuS8fJqnXV5FkdLTyVVTV5mBCS1RUzBKXoHPI/KUEM2gHGUV+5i2IEbErPYQtHW5G7P1NR7AGoFBP06Ani7UGqHNcDhDPp5IVyzTKhlmKnHkiupxc5d9Rv5Q65+32o0E8ZdPxonI+EjW+CY4xFlxVI8DiICwPRhnHCytB93GpnHGwaVEylJdgt8Bn1Z0eQUPnAvx2lhh/f5ZNT1+gGZjoEZJ3ZYpft/6mx9ZNDMybajeldBY/xkCOMDolNcHJT8FaHGNe6SJC22wQt5FhumaFncErHtT3+MYpx4lyd83WrXsiCxZKn9LzE3WA2nrmtIDORTfkNexRX5zwwG72fVYSulq6/C5x0OKfDBQ1j02HBhU9BgP+kejazeDHTFkwUDj91dTk90sm23xmAk20q5FzOmPlmDm0n+J4M0QCSAEfoHYnotJxBz0rK+1xhYVFiY+CX7vXjX/ppg/EbJ6jMm/Y/rnat+xOMMBQRxL4yQZ56birwwuhaCiQP9lQqHRJvClrHsq//AeM/IJC1M3VJRP2yanHtJeFNeW4s3VGuxNPUW2nRQSAIJw==
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)(1800799012)(186009)(82310400011)(64100799003)(451199024)(46966006)(36840700001)(40470700004)(36860700001)(40480700001)(7696005)(478600001)(110136005)(54906003)(6636002)(356005)(81166007)(70586007)(70206006)(316002)(26005)(16526019)(47076005)(2616005)(1076003)(83380400001)(4326008)(8676002)(8936002)(426003)(336012)(82740400003)(40460700003)(5660300002)(7416002)(2906002)(66899024)(15650500001)(41300700001)(86362001)(36756003)(36900700001);
DIR:OUT; SFP:1101;
X-OriginatorOrg: amd.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Dec 2023 06:38:43.4652 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: c6eec0ee-db89-4d84-e7c8-08dbf55cd366
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: DS3PEPF000099DC.namprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4878
Preferred core rankings can be changed dynamically by the
platform based on the workload and platform conditions and
accounting for thermals and aging.
When this occurs, cpu priority need to be set.
Tested-by: Oleksandr Natalenko
Reviewed-by: Mario Limonciello
Reviewed-by: Wyes Karny
Reviewed-by: Huang Rui
Reviewed-by: Perry Yuan
Signed-off-by: Meng Li
---
drivers/cpufreq/amd-pstate.c | 44 ++++++++++++++++++++++++++++++++++++
include/linux/amd-pstate.h | 6 +++++
2 files changed, 50 insertions(+)
diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index 9c2790753f99..25f0fb53d320 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -315,6 +315,7 @@ static int pstate_init_perf(struct amd_cpudata *cpudata)
WRITE_ONCE(cpudata->nominal_perf, AMD_CPPC_NOMINAL_PERF(cap1));
WRITE_ONCE(cpudata->lowest_nonlinear_perf, AMD_CPPC_LOWNONLIN_PERF(cap1));
WRITE_ONCE(cpudata->lowest_perf, AMD_CPPC_LOWEST_PERF(cap1));
+ WRITE_ONCE(cpudata->prefcore_ranking, AMD_CPPC_HIGHEST_PERF(cap1));
WRITE_ONCE(cpudata->min_limit_perf, AMD_CPPC_LOWEST_PERF(cap1));
return 0;
}
@@ -339,6 +340,7 @@ static int cppc_init_perf(struct amd_cpudata *cpudata)
WRITE_ONCE(cpudata->lowest_nonlinear_perf,
cppc_perf.lowest_nonlinear_perf);
WRITE_ONCE(cpudata->lowest_perf, cppc_perf.lowest_perf);
+ WRITE_ONCE(cpudata->prefcore_ranking, cppc_perf.highest_perf);
WRITE_ONCE(cpudata->min_limit_perf, cppc_perf.lowest_perf);
if (cppc_state == AMD_PSTATE_ACTIVE)
@@ -785,6 +787,32 @@ static void amd_pstate_init_prefcore(struct amd_cpudata *cpudata)
schedule_work(&sched_prefcore_work);
}
+static void amd_pstate_update_highest_perf(unsigned int cpu)
+{
+ struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
+ struct amd_cpudata *cpudata = policy->driver_data;
+ u32 prev_high = 0, cur_high = 0;
+ int ret;
+
+ if ((!amd_pstate_prefcore) || (!cpudata->hw_prefcore))
+ goto free_cpufreq_put;
+
+ ret = amd_pstate_get_highest_perf(cpu, &cur_high);
+ if (ret)
+ goto free_cpufreq_put;
+
+ prev_high = READ_ONCE(cpudata->prefcore_ranking);
+ if (prev_high != cur_high) {
+ WRITE_ONCE(cpudata->prefcore_ranking, cur_high);
+
+ if (cur_high < CPPC_MAX_PERF)
+ sched_set_itmt_core_prio((int)cur_high, cpu);
+ }
+
+free_cpufreq_put:
+ cpufreq_cpu_put(policy);
+}
+
static int amd_pstate_cpu_init(struct cpufreq_policy *policy)
{
int min_freq, max_freq, nominal_freq, lowest_nonlinear_freq, ret;
@@ -958,6 +986,17 @@ static ssize_t show_amd_pstate_highest_perf(struct cpufreq_policy *policy,
return sysfs_emit(buf, "%u\n", perf);
}
+static ssize_t show_amd_pstate_prefcore_ranking(struct cpufreq_policy *policy,
+ char *buf)
+{
+ u32 perf;
+ struct amd_cpudata *cpudata = policy->driver_data;
+
+ perf = READ_ONCE(cpudata->prefcore_ranking);
+
+ return sysfs_emit(buf, "%u\n", perf);
+}
+
static ssize_t show_amd_pstate_hw_prefcore(struct cpufreq_policy *policy,
char *buf)
{
@@ -1176,6 +1215,7 @@ cpufreq_freq_attr_ro(amd_pstate_max_freq);
cpufreq_freq_attr_ro(amd_pstate_lowest_nonlinear_freq);
cpufreq_freq_attr_ro(amd_pstate_highest_perf);
+cpufreq_freq_attr_ro(amd_pstate_prefcore_ranking);
cpufreq_freq_attr_ro(amd_pstate_hw_prefcore);
cpufreq_freq_attr_rw(energy_performance_preference);
cpufreq_freq_attr_ro(energy_performance_available_preferences);
@@ -1186,6 +1226,7 @@ static struct freq_attr *amd_pstate_attr[] = {
&amd_pstate_max_freq,
&amd_pstate_lowest_nonlinear_freq,
&amd_pstate_highest_perf,
+ &amd_pstate_prefcore_ranking,
&amd_pstate_hw_prefcore,
NULL,
};
@@ -1194,6 +1235,7 @@ static struct freq_attr *amd_pstate_epp_attr[] = {
&amd_pstate_max_freq,
&amd_pstate_lowest_nonlinear_freq,
&amd_pstate_highest_perf,
+ &amd_pstate_prefcore_ranking,
&amd_pstate_hw_prefcore,
&energy_performance_preference,
&energy_performance_available_preferences,
@@ -1538,6 +1580,7 @@ static struct cpufreq_driver amd_pstate_driver = {
.suspend = amd_pstate_cpu_suspend,
.resume = amd_pstate_cpu_resume,
.set_boost = amd_pstate_set_boost,
+ .update_highest_perf = amd_pstate_update_highest_perf,
.name = "amd-pstate",
.attr = amd_pstate_attr,
};
@@ -1552,6 +1595,7 @@ static struct cpufreq_driver amd_pstate_epp_driver = {
.online = amd_pstate_epp_cpu_online,
.suspend = amd_pstate_epp_suspend,
.resume = amd_pstate_epp_resume,
+ .update_highest_perf = amd_pstate_update_highest_perf,
.name = "amd-pstate-epp",
.attr = amd_pstate_epp_attr,
};
diff --git a/include/linux/amd-pstate.h b/include/linux/amd-pstate.h
index 68fc1bd8d851..d21838835abd 100644
--- a/include/linux/amd-pstate.h
+++ b/include/linux/amd-pstate.h
@@ -39,11 +39,16 @@ struct amd_aperf_mperf {
* @cppc_req_cached: cached performance request hints
* @highest_perf: the maximum performance an individual processor may reach,
* assuming ideal conditions
+ * For platforms that do not support the preferred core feature, the
+ * highest_pef may be configured with 166 or 255, to avoid max frequency
+ * calculated wrongly. we take the fixed value as the highest_perf.
* @nominal_perf: the maximum sustained performance level of the processor,
* assuming ideal operating conditions
* @lowest_nonlinear_perf: the lowest performance level at which nonlinear power
* savings are achieved
* @lowest_perf: the absolute lowest performance level of the processor
+ * @prefcore_ranking: the preferred core ranking, the higher value indicates a higher
+ * priority.
* @max_freq: the frequency that mapped to highest_perf
* @min_freq: the frequency that mapped to lowest_perf
* @nominal_freq: the frequency that mapped to nominal_perf
@@ -73,6 +78,7 @@ struct amd_cpudata {
u32 nominal_perf;
u32 lowest_nonlinear_perf;
u32 lowest_perf;
+ u32 prefcore_ranking;
u32 min_limit_perf;
u32 max_limit_perf;
u32 min_limit_freq;
From patchwork Tue Dec 5 06:35:36 2023
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: "Meng, Li \(Jassmine\)"
X-Patchwork-Id: 751162
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com
header.b="z0BoXvjK"
Received: from NAM11-CO1-obe.outbound.protection.outlook.com
(mail-co1nam11on2083.outbound.protection.outlook.com [40.107.220.83])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E56D8A4;
Mon, 4 Dec 2023 22:38:50 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
b=G90IBLspjdghZPfsyIv2ObUE1Cbhzjun12ZJTDTRFhyORlN6S3J7PFFOVhE2f1/fLyMOdDcms7Cs1WijJ7j8aklb1HtgaF+rfs7M7U8jaPyscDkDlxuVamnG0jcA7glb6lH2sIUNBHHxlE5LX/ifI8IvBd3h5c4i/wxf2PaOKU7tgmSMtdLG+JPBi2qqhGDcqETPrGxux9YUdoYLWW0Q4QCU8DVZpWsZQTs54WHawPG6jABkLPt/HeXUg1fwV70CAFBOKNgUjsA4IUTT0pNpVY0S+GsZPjgJTSvluGoT8fP4QLJN1zE1Bk4+aHiGn/McldYf/wj7WgmmSFF/6M9qPQ==
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=CkcLPe+OdQhX1JrIwqUungjFDn7/6QsByHrqLs7zL9M=;
b=n94zQtlk2ZHTaEMhmoTVbSJumSaKAkj6FNwpUnoD33MFM92jCUllHhFrEKTJB8BcB0j62KwSzLHDAwfADeEKJqGdWCL0qnFLVqU/Zo/HLcd2bI/f2r4PBVChcyoOXtzHYxHinCjvcUz3WMWH6nnJGXEj76zfpHydVmmmRv+JcigX+R4njQDxd/NSQXcwmyyX14YtWZ2BiD4b3nxs0Uh2shJvkWa/6JnypplvX76dK7b6tJKGjOL0QjmPIfn3RzXEDkrrE0KChdXr0TOX20i+oYIlt79DDoXLPqUy95UlxJU8JpfAY5P6SSJ6yN+r6ppeILJXlxli6vmZ8VQPmaj7OQ==
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=CkcLPe+OdQhX1JrIwqUungjFDn7/6QsByHrqLs7zL9M=;
b=z0BoXvjK8ZLfTEpjkWqAyOLIspFx5KxVp+iVN2sHdi9L9fmmXoW/QNdA1+2YtqWHUyZPaMaSVwvGacNdQ4r/jKayVhyyG07FKOrc5STHtMDyxF3ssgq+gDJ5ybOs3/UmaVwTUsTulYZviqRg1QR1uUcECFWY30ga6AZ3TvGqj2w=
Received: from CH0P220CA0024.NAMP220.PROD.OUTLOOK.COM (2603:10b6:610:ef::16)
by LV3PR12MB9188.namprd12.prod.outlook.com (2603:10b6:408:19b::15) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.34; Tue, 5 Dec
2023 06:38:48 +0000
Received: from DS3PEPF000099DB.namprd04.prod.outlook.com
(2603:10b6:610:ef:cafe::58) by CH0P220CA0024.outlook.office365.com
(2603:10b6:610:ef::16) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.34 via Frontend
Transport; Tue, 5 Dec 2023 06:38:48 +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
DS3PEPF000099DB.mail.protection.outlook.com (10.167.17.197) with Microsoft
SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
15.20.7068.20 via Frontend Transport; Tue, 5 Dec 2023 06:38:48 +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.34; Tue, 5 Dec
2023 00:38:42 -0600
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 , Wyes Karny
, Perry Yuan
Subject: [PATCH V12 6/7] Documentation: amd-pstate: introduce amd-pstate
preferred core
Date: Tue, 5 Dec 2023 14:35:36 +0800
Message-ID: <20231205063537.872834-7-li.meng@amd.com>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20231205063537.872834-1-li.meng@amd.com>
References: <20231205063537.872834-1-li.meng@amd.com>
Precedence: bulk
X-Mailing-List: linux-acpi@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: DS3PEPF000099DB:EE_|LV3PR12MB9188:EE_
X-MS-Office365-Filtering-Correlation-Id: 9393f710-805d-4e63-45c6-08dbf55cd62a
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: cFg2p5jH+GHpyNNroDt23A1+crrHhIDl3tLy3vrewCnkuQ4HBRJrSlPl3eYXLf/4MyDab0KN3h5nERv2EapXHU1MI5MCgcjk7nZGOrB4dTyADcFA3T9qmVjWssgI8aih8RDQ01LMEwjWmeLVuDu3nJCROX8H4mEq/u468yST8TXxeMxS1aDy3tisjXN2vNT+dSKrPaLZvNDDlbv9WfHjxCekPbwGCGTgXz1oBnDfHDXkW8M6RJdi9+4pdDpn/uJXTdpFWTbEiIm7vnnxVNfoI8xU9yww2awco5k7y1yRhqoAwlxkqUq4DM2aN9qu+grjELpptsM5pH9cfLAlbwltXL7+jC4jGHtTQ6f29m5myS6sUJxFrahghzzfhart7r/WPEtVWtsI/B3J2m9A5yDW7piVjYDNKjX/BBuHkA8WwNsEmJ5OM8GHl+nisp7XlOGWWMJ4oQbuyWoS0UZuTCyN7/rzBaoqwRTEtKSwoqddGx7uWRSC8Utvtw6YaYNW4s9HblJFF7rfbi0FhkZcsob41oP3cTqrhmuKjID7hhuTiJdG+Y9WS7RVnsAFMsuBW6czpjXi3nTFvgLXoBHu8FNfBIuEUwjG3Em388PseXeNA6YzcQ/gTCY5+rHWgf0s8lOJJD0WeOSf6DAovkoWXWdqhwWoLH4WIygV6VSgxPeMMPkmgEyR9nXuQZzmft6dCenCDmaJK7k3SJVznFG5wNQVu41msRZTILE5fyeOwdtDFq1dVYzPGRHkE4UfpMQtU45eDmeFocRR8JvjNMT//QqqkA==
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)(39860400002)(376002)(346002)(396003)(136003)(230922051799003)(186009)(64100799003)(82310400011)(1800799012)(451199024)(36840700001)(46966006)(40470700004)(7416002)(40480700001)(36860700001)(2906002)(110136005)(316002)(6636002)(54906003)(86362001)(70206006)(70586007)(36756003)(41300700001)(8676002)(8936002)(4326008)(356005)(47076005)(5660300002)(82740400003)(81166007)(83380400001)(478600001)(40460700003)(426003)(16526019)(336012)(26005)(1076003)(7696005)(6666004)(2616005)(36900700001);
DIR:OUT; SFP:1101;
X-OriginatorOrg: amd.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Dec 2023 06:38:48.0541 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: 9393f710-805d-4e63-45c6-08dbf55cd62a
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: DS3PEPF000099DB.namprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR12MB9188
Introduce amd-pstate preferred core.
check preferred core state set by the kernel parameter:
$ cat /sys/devices/system/cpu/amd-pstate/prefcore
Tested-by: Oleksandr Natalenko
Reviewed-by: Wyes Karny
Reviewed-by: Mario Limonciello
Reviewed-by: Huang Rui
Reviewed-by: Perry Yuan
Signed-off-by: Meng Li
---
Documentation/admin-guide/pm/amd-pstate.rst | 59 ++++++++++++++++++++-
1 file changed, 57 insertions(+), 2 deletions(-)
diff --git a/Documentation/admin-guide/pm/amd-pstate.rst b/Documentation/admin-guide/pm/amd-pstate.rst
index 1cf40f69278c..0b832ff529db 100644
--- a/Documentation/admin-guide/pm/amd-pstate.rst
+++ b/Documentation/admin-guide/pm/amd-pstate.rst
@@ -300,8 +300,8 @@ platforms. The AMD P-States mechanism is the more performance and energy
efficiency frequency management method on AMD processors.
-AMD Pstate Driver Operation Modes
-=================================
+``amd-pstate`` Driver Operation Modes
+======================================
``amd_pstate`` CPPC has 3 operation modes: autonomous (active) mode,
non-autonomous (passive) mode and guided autonomous (guided) mode.
@@ -353,6 +353,48 @@ is activated. In this mode, driver requests minimum and maximum performance
level and the platform autonomously selects a performance level in this range
and appropriate to the current workload.
+``amd-pstate`` Preferred Core
+=================================
+
+The core frequency is subjected to the process variation in semiconductors.
+Not all cores are able to reach the maximum frequency respecting the
+infrastructure limits. Consequently, AMD has redefined the concept of
+maximum frequency of a part. This means that a fraction of cores can reach
+maximum frequency. To find the best process scheduling policy for a given
+scenario, OS needs to know the core ordering informed by the platform through
+highest performance capability register of the CPPC interface.
+
+``amd-pstate`` preferred core enables the scheduler to prefer scheduling on
+cores that can achieve a higher frequency with lower voltage. The preferred
+core rankings can dynamically change based on the workload, platform conditions,
+thermals and ageing.
+
+The priority metric will be initialized by the ``amd-pstate`` driver. The ``amd-pstate``
+driver will also determine whether or not ``amd-pstate`` preferred core is
+supported by the platform.
+
+``amd-pstate`` driver will provide an initial core ordering when the system boots.
+The platform uses the CPPC interfaces to communicate the core ranking to the
+operating system and scheduler to make sure that OS is choosing the cores
+with highest performance firstly for scheduling the process. When ``amd-pstate``
+driver receives a message with the highest performance change, it will
+update the core ranking and set the cpu's priority.
+
+``amd-pstate`` Preferred Core Switch
+=================================
+Kernel Parameters
+-----------------
+
+``amd-pstate`` peferred core`` has two states: enable and disable.
+Enable/disable states can be chosen by different kernel parameters.
+Default enable ``amd-pstate`` preferred core.
+
+``amd_prefcore=disable``
+
+For systems that support ``amd-pstate`` preferred core, the core rankings will
+always be advertised by the platform. But OS can choose to ignore that via the
+kernel parameter ``amd_prefcore=disable``.
+
User Space Interface in ``sysfs`` - General
===========================================
@@ -385,6 +427,19 @@ control its functionality at the system level. They are located in the
to the operation mode represented by that string - or to be
unregistered in the "disable" case.
+``prefcore``
+ Preferred core state of the driver: "enabled" or "disabled".
+
+ "enabled"
+ Enable the ``amd-pstate`` preferred core.
+
+ "disabled"
+ Disable the ``amd-pstate`` preferred core
+
+
+ This attribute is read-only to check the state of preferred core set
+ by the kernel parameter.
+
``cpupower`` tool support for ``amd-pstate``
===============================================
From patchwork Tue Dec 5 06:35:37 2023
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: "Meng, Li \(Jassmine\)"
X-Patchwork-Id: 750431
Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com
header.b="SOnE5Sjq"
Received: from NAM12-BN8-obe.outbound.protection.outlook.com
(mail-bn8nam12on2061.outbound.protection.outlook.com [40.107.237.61])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BBE3CE;
Mon, 4 Dec 2023 22:39:13 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
b=ANb5qXLGqqVPq95NhlT5hi7nGBtMc83ChGRK9Q+IkZLdKSf8/Cq3lC+rHd/XbCtkbQtLdz1jMb7qHwKJ80dU2i+S7Hj4iuTw0WfoH2xOClxPvXojjJIZReT85Txr38gK3uaTAFK/sxOCKIB7LOOflGue7q7shEfjbaCfbIHbKHw4tQC0RSlZqB39mhdgY96lV4mLoJ6+ESvgygQTCIpO4WHkr56a565lTsK63LX6Se6Weo1odrrYRzWG/GdHkKPbpDa2MOIcf9ur2AfKSFqzp1Owuz3EbboeEQJja6g+jX+ZvhmS/iCHas6fA3rZflSpJk6rfL5tTvp38+KXxRJIVQ==
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=85oIARnE+wv1JlIuF15E0Tk1ufYqSyfbk9En7YmPpPE=;
b=QHAIEceIwM3w+iagBUhTs6satzuGfgjrd56k9GyLh3mJHr+kVDABTItFiUJyY66YdnZolWKCgR12Bl2gC9iYbBk9OJRP5IQzCkTnI/sKURT6i0Iq0sN7sVOLhD5mZuOEMvvNJpVRWNni8jEXDU0u9aLfvf/V0xl32zSi0UzJhsTP6cw9rdoaSHoXJY7+gNBVmNeVkVlAlhqwxgyfr/MBvqC/G3qCdDg6aTutaGksj6WdMd9Rk0f9lwmOW0N1cutYPQyRzlzRrhoOubkPqQr50U43GFNrQ/e2j5BZv2+EpXPQ7lxYND6FbfkVONcxPsuaxyzEMkCmRobt+2ZvQjht6Q==
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=85oIARnE+wv1JlIuF15E0Tk1ufYqSyfbk9En7YmPpPE=;
b=SOnE5SjqmRTWugGUqBjwo9HJ+rlPkdc5v41jXRklVsZT+VLedSgx1S1/4N3WCS/jgCg5ook21aeRZdREuWUrH1qTTfKcckZO5qOJV13p7er/xm4vEBh5ilNSVeyjmKMbrsBK/FEi7MFLfdh+7Czp18nnjoG1JVdzTWHNgVFrcCE=
Received: from CH2PR14CA0021.namprd14.prod.outlook.com (2603:10b6:610:60::31)
by SN7PR12MB6838.namprd12.prod.outlook.com (2603:10b6:806:266::18)
with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.34; Tue, 5 Dec
2023 06:39:10 +0000
Received: from DS3PEPF000099DB.namprd04.prod.outlook.com
(2603:10b6:610:60:cafe::17) by CH2PR14CA0021.outlook.office365.com
(2603:10b6:610:60::31) with Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.33 via Frontend
Transport; Tue, 5 Dec 2023 06:39:10 +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
DS3PEPF000099DB.mail.protection.outlook.com (10.167.17.197) with Microsoft
SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
15.20.7068.20 via Frontend Transport; Tue, 5 Dec 2023 06:39:10 +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.34; Tue, 5 Dec
2023 00:38:48 -0600
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 , Wyes Karny
, Perry Yuan
Subject: [PATCH V12 7/7] Documentation: introduce amd-pstate preferrd core
mode kernel command line options
Date: Tue, 5 Dec 2023 14:35:37 +0800
Message-ID: <20231205063537.872834-8-li.meng@amd.com>
X-Mailer: git-send-email 2.34.1
In-Reply-To: <20231205063537.872834-1-li.meng@amd.com>
References: <20231205063537.872834-1-li.meng@amd.com>
Precedence: bulk
X-Mailing-List: linux-acpi@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: DS3PEPF000099DB:EE_|SN7PR12MB6838:EE_
X-MS-Office365-Filtering-Correlation-Id: e2469d75-a601-4cbe-908b-08dbf55ce368
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: gcfHcQ99jB6TCLHtAH+cVAiYpTvoDh1DNWnEWTa4V9y04sfvkeZ8YXQlFBjNQIqCE7ntKzdBLYroDUoVjX7D1RjXtok3m/tUboz2z716raOJBTHdIisGuYMlrxbdI15XQ9xTSJm6Tbwe5OfcHm6+QqG1qiMYYLJ1NxvvX+mJS/y7mOThEWjWqp3xjZUxw5Lj6Q9fISEEijGDyY9uhwqgyUw6dYFr7F2/NcbjGFGJFopzd1lFQrlJctANlHie/kqCEgxtLqFN06XaAUyEk7jlxl9zcjRIcWv9/WpFWymBBFnfGEPjWT49V7/Sl7xS1/6kPrpIddkliEOXJlnbyNgtp0CVhHi3no07yPK0ZXGOvM096U8jPBl0FYPSV19ZmLIAFerx5W0GuPungOgIIYaAcSKRnGzv6O1kPApQx9sNHM/dbHUTYIJkrIPCsZa1KvMnlU5j+KD8tzOZBU0aibeay20JxSdWQh3u1dPJ8N0aRiu1bWqO1fLzGTgRGR7edS9C/U8N5ALezmz+Tp5A4WoE4L6zwqEhV9UYQ3uOlPs5X1h9s1RVhnToehq4ZYWdnGgX2+Ay6c/K3RJMxxHLexqYbpDowdH6flK83875OsH07k94LuOyYqpNH1FAC/o+IKA0Ej0k/UVjntzEkLLLgBPHvmNkDJ/95ou+G5dauD9Imo2DU0W/5sVXwnMEwo07XcLTtQLp5zTbBxyMntr5PCedIeRHR8Bic0NrK1FUf2l8LaP3QaveXR085Lm5ofo2N7jqiARvoWApLf2TJfOji8vysdQCNtgqTUmyvY4ageUl3TFGO+UAP+5Wjz+xIbWonaYh
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)(136003)(39860400002)(346002)(230922051799003)(64100799003)(451199024)(1800799012)(82310400011)(186009)(40470700004)(36840700001)(46966006)(40460700003)(54906003)(8676002)(86362001)(8936002)(6636002)(316002)(4326008)(478600001)(70586007)(110136005)(70206006)(36756003)(41300700001)(2906002)(5660300002)(7416002)(36860700001)(81166007)(356005)(47076005)(26005)(426003)(2616005)(1076003)(7696005)(82740400003)(83380400001)(16526019)(336012)(6666004)(40480700001)(36900700001)(14943795004);
DIR:OUT; SFP:1101;
X-OriginatorOrg: amd.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Dec 2023 06:39:10.3196 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: e2469d75-a601-4cbe-908b-08dbf55ce368
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: DS3PEPF000099DB.namprd04.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6838
amd-pstate driver support enable/disable preferred core.
Default enabled on platforms supporting amd-pstate preferred core.
Disable amd-pstate preferred core with
"amd_prefcore=disable" added to the kernel command line.
Signed-off-by: Meng Li
Reviewed-by: Mario Limonciello
Reviewed-by: Wyes Karny
Reviewed-by: Huang Rui
Reviewed-by: Perry Yuan
Tested-by: Oleksandr Natalenko
---
Documentation/admin-guide/kernel-parameters.txt | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 65731b060e3f..cbfa63a87e4a 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -363,6 +363,11 @@
selects a performance level in this range and appropriate
to the current workload.
+ amd_prefcore=
+ [X86]
+ disable
+ Disable amd-pstate preferred core.
+
amijoy.map= [HW,JOY] Amiga joystick support
Map of devices attached to JOY0DAT and JOY1DAT
Format: ,