From patchwork Wed Mar 6 11:44:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Sundar S K X-Patchwork-Id: 13583963 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 734565FDB1 for ; Wed, 6 Mar 2024 11:44:43 +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=1709725485; cv=fail; b=RdNJ6d8KZItcpnf+NpfEAQDAiD1rdDtmprnEdgzG+VZU9g2vB5fbWwXfEAU25q+HWSXpbHTku1r0loYZJyFTBb6M2K2CcBIavJo9bVuiJMenvygCNmveYeGJoN05npNAhyVssA5i8Ab3J1PZwQrKd8Efn/8NpeDz2QH2kLuMnZ0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709725485; c=relaxed/simple; bh=LsW72JN15++Ld3HfFxMCyAsxL33E/+M/vPtB/ABvvFw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=kCu/h4JuqUew5+mVEr56w0lmxv6bgaP3hUwxRYUyUr8WJxNbCNHqluJjGBrW6Sxw6jCmWYi/3wDDyel8/FXbe8TbrPWM33VO8BPGLJ+oNa85CqAwwLlPeQiivQS4MBIdwT+M3V1KXmE4WCiAx7OuOGSZ6x9jNft83876OryeiVM= 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=O0phM3Ov; 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="O0phM3Ov" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PLVjog2FUFwtdQmdSj9LO4k/40gXD173Loz0pzRlxwMazg2PV+bZgUme34gAW/0BHzYQ3KYQ2Amja4B1XTizikV1DQoAHz82HiQrLSaBMChrKcD0DGG9oQJiUGU9kWawfMSZ2S5Ktqq8f7cOvTwsM1EJ2UmQHOnXvdvQzu6ePEF8iJ+fao9/6mMGnv9TtQgO5q+/FIlGbil73yC79QcAJCNpcyMjy9dTLuxw9EamS+tBOp4AttmBsPojfqjPX5+Oh/dz5xNDKnPrg3kjmLeszw52q9d94LzqqPwdgls6jm25jJxgfAho2J6fuAR5AmG8jz7NtjWzMIZLW74rf/vlsQ== 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=L3ikSXXyQyGsRGhuDbdBb2kssRlYKBKUm3pPbOaZ/CQ=; b=AyEo3Fp9ieGXHyr3P3dDYVaZssv4fjlydae6rR/bcomf9UViMa4EY5O6me6zLpzpCckJyfoscvXwXuga3pm76oWNkwgGKVFGoROUWEO6Q+BfTuKJxUHwt5z0XRWhkrVleQpRnDZH3Ar4CF91q3LXy3JrYFIFjLq6fTzbdm5auNlLoQHAv6sLjoeVhei/4kgm8TdQobhcZOfZmiigEVS3SNWwaxlTihT6lZs4cB2LuMN3YtrtxE00dG/7+zEQssaj+/cFM8hyHdxofpONzEP/Yzxl/QFH8Po7xLA/Ch+4K68m1ocOmFV3h0ZFrtO7Ju7k6zS/FqlqBNDZCwPmhdYRZA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.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=L3ikSXXyQyGsRGhuDbdBb2kssRlYKBKUm3pPbOaZ/CQ=; b=O0phM3Ov3vpt56EW168o4gEdoxVla4DhV5GP7vkMmv4X2Hdipi/08m+uClKMUBVARh1n/9DK5rHkpf4jX+TOLIUdhMf69KPjGmOgOx+BDSkNaWyUs/1uHFkIUIVO8tb2IdL3fMfDnxEJRnlBWLOEEViGw0sxwegbUphBlxsOCFs= Received: from SJ0PR03CA0078.namprd03.prod.outlook.com (2603:10b6:a03:331::23) by DM3PR12MB9413.namprd12.prod.outlook.com (2603:10b6:8:1af::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.39; Wed, 6 Mar 2024 11:44:39 +0000 Received: from MWH0EPF000989EA.namprd02.prod.outlook.com (2603:10b6:a03:331:cafe::10) by SJ0PR03CA0078.outlook.office365.com (2603:10b6:a03:331::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.24 via Frontend Transport; Wed, 6 Mar 2024 11:44:39 +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 MWH0EPF000989EA.mail.protection.outlook.com (10.167.241.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7362.11 via Frontend Transport; Wed, 6 Mar 2024 11:44:39 +0000 Received: from jatayu.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.35; Wed, 6 Mar 2024 05:44:36 -0600 From: Shyam Sundar S K To: , CC: , , "Shyam Sundar S K" , Kuppuswamy Sathyanarayanan Subject: [PATCH v3 1/7] platform/x86/amd/pmf: Differentiate PMF ACPI versions Date: Wed, 6 Mar 2024 17:14:09 +0530 Message-ID: <20240306114415.3267603-2-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240306114415.3267603-1-Shyam-sundar.S-k@amd.com> References: <20240306114415.3267603-1-Shyam-sundar.S-k@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@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: MWH0EPF000989EA:EE_|DM3PR12MB9413:EE_ X-MS-Office365-Filtering-Correlation-Id: f6fb15e0-9c45-4d48-6bef-08dc3dd2ce6c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: shr/t0C4U+HmiGMs6TE8tVc10AMcZdmG5Qrvgi6tW7TrDK6Ai22x+gGkQqORyUHNN/7PQJb3a/s0KnT2ygn1e/FV7DW+EnqxSW/ImihmJa0WEkoKk3OWhSVnvJSg5zyy0Ro4ikUXYQfP74lEYmegMgd/xd0FGdf51yCFc5jbJxozgG7YAmzXB0wH7dNst60YBhqShGOWc+zFGsNRW2yUeCuHG1kDLa1SWPpAAO2YXH7Jt5TJ+mw+ndOUv6+WUEvfqvFPJxJazknYIiacMwi9dlCR53EJy18loZJw/bxcqXBq56645FS19pmm1f/HvUXMGyvJ0Qfl6gabOYUEY9zAJIA2JdB8awNcBFZ8RiyGOSf09RXBR0Ybd7K3s27VNGIO329oFMQC3VLoeTgdRXJbL2lYeKBOl2wmTceA4naMyDaRGGqW6g23VtJXV1IfXkqagicMMMIa3EJRjMDgOAWLrOVJyIF7m4uOGEGWqSl8O8RAO5Qc/sZE4HGD1xjSedI78orjo5h58+htMrhrTSmYuam3X5ruYOsR+0xmW/BzO0pW7nZhEoVOFpQtrrH6u6Pjfc+Ry2RMOESqKmQC4uq+C+UwXmBPCJqLdivnrkt+gUUtIsDQUzQ5ZCdRFPIrHsedQcw9HI0BlyWWOCZJECTdBBEhDQ1YhNJSdW8A7XyrKcz7azGTMFZUI+3IWS8rrIYdeVspolrUY38gjiSN1vfJ8CJzp3auiM+knE8wLr2//hqOmE4hoGjHj4gWxu/8CaUs 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)(376005)(82310400014)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2024 11:44:39.3843 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f6fb15e0-9c45-4d48-6bef-08dc3dd2ce6c 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: MWH0EPF000989EA.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR12MB9413 For family 1AH, certain PMF features have been enhanced - leading to a newer APMF (AMD PMF) spec (BIOS and PMF driver interface) called v2. This information would be fed into the if_version field of the verify_interface method of the APMF call from the BIOS. Use this information to store the version number to differentiate between v1 or v2 and also store the information into the PMF private data structure, as this information would be required for further code branching to support the latest silicon. Reviewed-by: Kuppuswamy Sathyanarayanan Co-developed-by: Patil Rajesh Reddy Signed-off-by: Patil Rajesh Reddy Signed-off-by: Shyam Sundar S K --- drivers/platform/x86/amd/pmf/acpi.c | 6 ++++-- drivers/platform/x86/amd/pmf/pmf.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/amd/pmf/acpi.c b/drivers/platform/x86/amd/pmf/acpi.c index f2eb07ef855a..1f287a147c57 100644 --- a/drivers/platform/x86/amd/pmf/acpi.c +++ b/drivers/platform/x86/amd/pmf/acpi.c @@ -218,8 +218,10 @@ static int apmf_if_verify_interface(struct amd_pmf_dev *pdev) return err; pdev->supported_func = output.supported_functions; - dev_dbg(pdev->dev, "supported functions:0x%x notifications:0x%x\n", - output.supported_functions, output.notification_mask); + dev_dbg(pdev->dev, "supported functions:0x%x notifications:0x%x version:%u\n", + output.supported_functions, output.notification_mask, output.version); + + pdev->pmf_if_version = output.version; return 0; } diff --git a/drivers/platform/x86/amd/pmf/pmf.h b/drivers/platform/x86/amd/pmf/pmf.h index 0c90805dc85b..2f23ced7da66 100644 --- a/drivers/platform/x86/amd/pmf/pmf.h +++ b/drivers/platform/x86/amd/pmf/pmf.h @@ -235,6 +235,7 @@ struct amd_pmf_dev { u64 policy_addr; void __iomem *policy_base; bool smart_pc_enabled; + u16 pmf_if_version; }; struct apmf_sps_prop_granular { From patchwork Wed Mar 6 11:44:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Sundar S K X-Patchwork-Id: 13583964 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2058.outbound.protection.outlook.com [40.107.220.58]) (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 284FF5FDB1 for ; Wed, 6 Mar 2024 11:44:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.58 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709725487; cv=fail; b=NqDwAtorZUVRbsdDqINtxRhnee+VbiohvYX8FzZRfvkWNaxC9j+Gc/n434bT5RLwQPJrz0GLMtRvtnVc9/aBNgiDBVa8CGIexB9mDcvGCczNwiUH+ZELdS0WDTIBL9ZI2ktuGP/WEK9+MzHBQIDqU+GV4ZB8x2Uhin4rebDdIK0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709725487; c=relaxed/simple; bh=lW24easOLoXi3pXkwvLjfjw33Qv4IbESKS6du9ghKfc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=klFWAYsFYyx8GLy9scVqqfkjb+J9kz3baGKcGZ5nIwv6X6zGR8VXLJP7fDuGUmUFAhpLD2ZqFv45qIwkoeIbNMq1Nd24U/f2efFliA8rgjB1zAS12McDsTo0yCBIT0b2EsoX/IpYExIl/Le/HonePqezGzYnKT2FBlIH7xNz55s= 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=CjzMnuf/; arc=fail smtp.client-ip=40.107.220.58 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="CjzMnuf/" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gU4qBDpXr1BoEpnXqgJL7VEu2rAx13jYVeVFBEv2z3TSKALUNWXB0pJoXTbkI1QVFoqeXKm33lgaXJ7xOgJbdsAnc8sAd31m9QfgL2hhEjC7jP7ehbl1jPQuHkRJyPS+C3YqNOxsHlLtwRjoVZ3UaW/yrUFghLf+AXrvucV4uqVaXPga6ZvAXf3URcqoQ65/7eztXmemp31G1pN9rsRgEYy4e7G2871BNFVf3O5QMnul1gkc2tUpUc/B+AdFyoEAm11LCO6qECtUGEF4hNbK/SF8YmBKBprVWx13b/qw0O/cHHqjvxQ0qsTWUa6lpbwtSU1VTtgWjFNGW0c6XqhnPA== 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=g1wx/XA0nJFCYNuOL34vmmWUxyNPrfl967aWQyjQtlU=; b=VCZt2evlG463Pu9X3rWtMzV9MPXBwppWvYpnCcsg6G8sQ24zlFVJDZNQFhd8XvbKphIlu74/OsdLGhrTFaDd+0pXvFPsIiXjLzrR0Zpw1iBnWmnNZf8XKp4U9khFXTQZ7QUPAVaiJFpbkvJnD3Sf5X7TsajT4+vGrMzRvzI+/mUqta6XNAvSU6O+7NiKOgP1XW4S9kFTqfQcQNmVN8v8enjFQxTKRiQR4a9Hy6bLqU9MHam+X7/9ZIarriZjWU/pZ1YMJsumbkTjMyNm+m+n/2oPMLsBYgp4OcCuxszAXjBarngInd/lvTEOO3b05uOzg/EtW4LycC7OQyHAsJa/+Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.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=g1wx/XA0nJFCYNuOL34vmmWUxyNPrfl967aWQyjQtlU=; b=CjzMnuf/V56/zuUXg5QoOtsVVBJlnRSOkgv6R+LhKvEdDhVsSI94ia70ESaXWpoH6IikIYNtLupln5uqXEMaR4q8Onwoe+/6mR++kHwbusShQ2Lc5srT1bziDaHE9K+F5AietsQL6V1coasoNhNiukN27NWITDEBaUbJGodG054= Received: from SJ0PR13CA0216.namprd13.prod.outlook.com (2603:10b6:a03:2c1::11) by IA1PR12MB8309.namprd12.prod.outlook.com (2603:10b6:208:3fe::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.39; Wed, 6 Mar 2024 11:44:42 +0000 Received: from MWH0EPF000989E6.namprd02.prod.outlook.com (2603:10b6:a03:2c1:cafe::77) by SJ0PR13CA0216.outlook.office365.com (2603:10b6:a03:2c1::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.24 via Frontend Transport; Wed, 6 Mar 2024 11:44:42 +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 MWH0EPF000989E6.mail.protection.outlook.com (10.167.241.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7362.11 via Frontend Transport; Wed, 6 Mar 2024 11:44:41 +0000 Received: from jatayu.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.35; Wed, 6 Mar 2024 05:44:38 -0600 From: Shyam Sundar S K To: , CC: , , "Shyam Sundar S K" , Kuppuswamy Sathyanarayanan Subject: [PATCH v3 2/7] platform/x86/amd/pmf: Disable debugfs support for querying power thermals Date: Wed, 6 Mar 2024 17:14:10 +0530 Message-ID: <20240306114415.3267603-3-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240306114415.3267603-1-Shyam-sundar.S-k@amd.com> References: <20240306114415.3267603-1-Shyam-sundar.S-k@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@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: MWH0EPF000989E6:EE_|IA1PR12MB8309:EE_ X-MS-Office365-Filtering-Correlation-Id: ba6455a9-f853-4aba-9f53-08dc3dd2cfd4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BprBWocnUiICIn5ZTHixyyUAU0KTUMYJ6Q/CempLb6NDwXJugmmK1vhI7RhzaOt/BN80jQVPFIdKDDzZ/PJZ7FxW1xNCMaYjEXU+bZd/7mww3okGznweJF8jscctmu1q6qxkqysz/qaCTXL0rdzrZQzJNm/OVczaBl30w0Fj7qAPyd2mqgFWxS7apI5T0XuqfvxQktuft/2o51lq8g3TWCIxXVsmB6Dqy2G4vImt07iKytZhO9dvZmNngS+Ornf51MQf6TG/CSMrdk/KVF3/1dX8OnUKs5c1+DCy0FaSfWATSEHZ/1r/6r69CY8hq7fn6Vh5zRlgGckwXXoA9h0j8j8eIJtJfi1jjesDLdhe/iyu95LSG8JsegFvG/umAe3dwtFL1m/on48nsFzQs5WjUId5MIvQJyS/kf/mGKVRLMuhE3j7jf02CazeJEIzhpmIKca/BojNbNbVw+zfKMMYEFCWkq81oOPZKGB885vKJMI1XYuKu9NVm6+EB1QP0F3vA5fO1aDNb2YyZ9EjEqQGjNvZW/GEpWVQNjb6CgGUFPxXwjPtwwnHeX11cAgZYf9NlUDRODZB5p77t7SXPwcfAQEOpPB3Ute/NDq9qlgsJ1Iy5YjtvqwTbBut/PoA9U4nXW+rdu4WJWKLMKQIN1yS9NWm2qVOfBN/rOXMksL4iuRpDhX2/59qH2AEYVdcDYgjtt8HDKFU4kQ6mAoq6uKcoMpoPCWdeJIcun3ObS4cwL27orlqnCYw3Ywi7OoKA4z9 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)(36860700004)(376005)(82310400014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2024 11:44:41.7606 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ba6455a9-f853-4aba-9f53-08dc3dd2cfd4 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: MWH0EPF000989E6.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB8309 The GET interface to receive the active power thermal information from the PMFW has been depricated. Hence drop the debugfs support from version2 onwards. Reviewed-by: Kuppuswamy Sathyanarayanan Co-developed-by: Patil Rajesh Reddy Signed-off-by: Patil Rajesh Reddy Signed-off-by: Shyam Sundar S K --- drivers/platform/x86/amd/pmf/core.c | 5 +++-- drivers/platform/x86/amd/pmf/pmf.h | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/amd/pmf/core.c b/drivers/platform/x86/amd/pmf/core.c index feaa09f5b35a..a6bdde4f1c68 100644 --- a/drivers/platform/x86/amd/pmf/core.c +++ b/drivers/platform/x86/amd/pmf/core.c @@ -113,8 +113,9 @@ static void amd_pmf_dbgfs_unregister(struct amd_pmf_dev *dev) static void amd_pmf_dbgfs_register(struct amd_pmf_dev *dev) { dev->dbgfs_dir = debugfs_create_dir("amd_pmf", NULL); - debugfs_create_file("current_power_limits", 0644, dev->dbgfs_dir, dev, - ¤t_power_limits_fops); + if (dev->pmf_if_version == PMF_IF_V1) + debugfs_create_file("current_power_limits", 0644, dev->dbgfs_dir, dev, + ¤t_power_limits_fops); } int amd_pmf_get_power_source(void) diff --git a/drivers/platform/x86/amd/pmf/pmf.h b/drivers/platform/x86/amd/pmf/pmf.h index 2f23ced7da66..51e31d008ef9 100644 --- a/drivers/platform/x86/amd/pmf/pmf.h +++ b/drivers/platform/x86/amd/pmf/pmf.h @@ -87,6 +87,8 @@ struct cookie_header { #define TA_OUTPUT_RESERVED_MEM 906 #define MAX_OPERATION_PARAMS 4 +#define PMF_IF_V1 1 + /* AMD PMF BIOS interfaces */ struct apmf_verify_interface { u16 size; From patchwork Wed Mar 6 11:44:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Sundar S K X-Patchwork-Id: 13583965 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2053.outbound.protection.outlook.com [40.107.95.53]) (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 3123E7F7FC for ; Wed, 6 Mar 2024 11:44:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.95.53 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709725490; cv=fail; b=gMnBLPIX/+ssM4ENhLEWFavKZu7f1BpH8jDgDGEKItvdH3sxtrSVfw/30mAL7Ax+GzWdpttItB0Zg9qDw6FXanFaz0MoTv8xEW47vn8NuToRNIbtdVjIhy5rP91+E502qa76sJ9WCE3d9GAtCa9vPVbSZRpiWXUAVr4Rp0w+ugI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709725490; c=relaxed/simple; bh=y4c2+AxEtfx09B3hhbtgox9ddKz8sgXmRUyxgXdZpKE=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gQRdva/p+m52m9GleL4w9zRGo54bhLXRleMAqtFCRwzGj7ikSB3i3MNLlOv2DURs/Cl1aTB5cX+WqQ0uK5NmTmL49MWbuUIRgjUZ4pA/lBQWz9xghtkNyFb/Oy3TJYs54Kim4onDNI0JeDUYLweNKLi/EUt29G4CDDPblZu554Y= 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=yCgqaOtl; arc=fail smtp.client-ip=40.107.95.53 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="yCgqaOtl" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VQPLKEglbdd45FO2pxnzGGLdRebJIyknM+7mZxTvrY7H2Fk1iRN+NFfAhJzTLPflLQU1XeJX1rnJbrN19ksvt/wWS6xhS4pwtMnn4WgOQwAnDNW4iV+Ubfqh0wsqHd5SupTl0UBziVdmMgMC2MDi9wTRHt66bREYnpmekb2pBo/5nC+ZT5tNgB9tRcoNbilU2Ul2EVksQhWIfYUhrTMDsw0s6HgtQT7tvjzrE6FoYwhP394JldrjAg7Tn4h6uKQHeyZOFYiUByE6+jSIuuTjro+Tc8L7L32nAW0fNIZZwhV3QavDxtWYW2zLbYiQ9jP8SVaoa0wuSHYKlCPlo3QsVA== 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=tMGkxrGt6h27oo1gCH0hflHilJsFK4RHFhjdEu69EHk=; b=FWJG5rBdZQfxH42q3i56olP0XRMtYTpLpv6iTJNBqozsnFAdpEmJuBaytVO6fw8BNLMFM9tC9s8O5aGr7yoePCUN4iQbug11U5/AimposSJO29A1kAxgvfVL9DkclWeVs4BUN55Z9f7XmkvtS3hzUD4v2ZIxq8gHSY+U+8nX9G16+s5cWPb4paGaCqn6dz4imiCmQu7EQfLbpcwhJ+lzBnqbEj+QecAppapQz7kTPO86RpDSZhQ2A09YYLdkKv7Wo/zxL2BRTKYWCYQG6qUFn3m4/MsgiOPfT+4JJUtdqyP6C5qZt0GZvU4hdypDbfFI18uu/sLEdFB7r1hZXmXmrw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.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=tMGkxrGt6h27oo1gCH0hflHilJsFK4RHFhjdEu69EHk=; b=yCgqaOtl79u4W6zxWIdvVjIASMmN7jYoXwyyD8RaUqR/DsbX5sB4yJOW491F7NN/1gT+MWO9MZ1kR2Lx/6HAuV/LsEsMRMZ444O/4aLpkuZOIP9pJshesqdrCL+0fJ/OC7hWoRDJkEF8YD8XjQ16D3S3lmxD26GG/x5g9PYlNO8= Received: from SN1PR12CA0066.namprd12.prod.outlook.com (2603:10b6:802:20::37) by SJ2PR12MB7846.namprd12.prod.outlook.com (2603:10b6:a03:4c9::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.24; Wed, 6 Mar 2024 11:44:45 +0000 Received: from MWH0EPF000989E8.namprd02.prod.outlook.com (2603:10b6:802:20:cafe::73) by SN1PR12CA0066.outlook.office365.com (2603:10b6:802:20::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.39 via Frontend Transport; Wed, 6 Mar 2024 11:44:45 +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 MWH0EPF000989E8.mail.protection.outlook.com (10.167.241.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7362.11 via Frontend Transport; Wed, 6 Mar 2024 11:44:44 +0000 Received: from jatayu.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.35; Wed, 6 Mar 2024 05:44:41 -0600 From: Shyam Sundar S K To: , CC: , , "Shyam Sundar S K" Subject: [PATCH v3 3/7] platform/x86/amd/pmf: Add support to get sbios requests in PMF driver Date: Wed, 6 Mar 2024 17:14:11 +0530 Message-ID: <20240306114415.3267603-4-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240306114415.3267603-1-Shyam-sundar.S-k@amd.com> References: <20240306114415.3267603-1-Shyam-sundar.S-k@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@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: MWH0EPF000989E8:EE_|SJ2PR12MB7846:EE_ X-MS-Office365-Filtering-Correlation-Id: e8e0b7ad-12b1-467a-fe3d-08dc3dd2d1a4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0sOXSSIL4qOuyYoQUUu6Vl4plNA+FIUyYImJfvuZ13JhyhJ1/XMoD29EDH1/eHtK3WA2A6G3XR0ghMUa1A8YTIaCIV4e7YOX265a9WKbTGTgGgQkq2AQaJeDfx3DLyL7qYFkAJkVWA8jeG6Rh9zYkk9HRnM9SW37FPL80931EkH72Dp/iuw9DqX4+B+xyp9cxgOAkLb3/QHdZOspyE21mMYlmcBw7VZY4kl6YcAKPApcAzRxwX3onlcNNcSGF/rKa7md0YDwgi4UMQAwKOnr4En2VmXCTct7nTM8zTjObH6Hie+3oyI553/VW8CwDDG/R5y3liDpSCNjBw4h4cKJbEubswpFC66siWuHr1O9Aiz2ZSlhC0bL/UMDs7wQeeHme6xCtvZ1JH1RMqi+0PD9t+GMsDbjZGIbvqum9ORGhJb9UlQ2HTVmfsL7kN2RJEyrfbAa2gLrOwG8qldMPJdwN7gMdqO5zGgSPrf4EjUfFyyHV3Z/KYxsE/0HgJSh9OsKTmst+Vr1cL4mAr+UlBpMWwFCpcLBO2Qyt19qGfdTOg3ZVc76S5c3+HtLCYs0mc4NbiDbm5/n2IFaexeIT76qHV9g4wzUWTk3AZvqfSygp+Me6ZljIuf7kKYghSODtqMfziWW9r4OnfWaFhKQpRHMBNP7jg5DrxutpNbSibbxdTTl9dNNHD8I14nQCpUdqSwyb9Qp0byosXPc+14nMhTPhUJ7HQphqkgD5DmoWjRBkWOpPIk56OXO3cNNzRwJM+8S 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)(36860700004)(376005)(82310400014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2024 11:44:44.7882 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e8e0b7ad-12b1-467a-fe3d-08dc3dd2d1a4 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: MWH0EPF000989E8.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB7846 Update the APMF function index 2 for family 1Ah, that gets the information of SBIOS requests (like the pending requests from BIOS, custom notifications, updation of power limits etc). Co-developed-by: Patil Rajesh Reddy Signed-off-by: Patil Rajesh Reddy Signed-off-by: Shyam Sundar S K Reviewed-by: Kuppuswamy Sathyanarayanan --- drivers/platform/x86/amd/pmf/acpi.c | 5 +++++ drivers/platform/x86/amd/pmf/pmf.h | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/drivers/platform/x86/amd/pmf/acpi.c b/drivers/platform/x86/amd/pmf/acpi.c index 1f287a147c57..13af83b187ac 100644 --- a/drivers/platform/x86/amd/pmf/acpi.c +++ b/drivers/platform/x86/amd/pmf/acpi.c @@ -166,6 +166,11 @@ int apmf_get_auto_mode_def(struct amd_pmf_dev *pdev, struct apmf_auto_mode *data return apmf_if_call_store_buffer(pdev, APMF_FUNC_AUTO_MODE, data, sizeof(*data)); } +int apmf_get_sbios_requests_v2(struct amd_pmf_dev *pdev, struct apmf_sbios_req_v2 *req) +{ + return apmf_if_call_store_buffer(pdev, APMF_FUNC_SBIOS_REQUESTS, req, sizeof(*req)); +} + int apmf_get_sbios_requests(struct amd_pmf_dev *pdev, struct apmf_sbios_req *req) { return apmf_if_call_store_buffer(pdev, APMF_FUNC_SBIOS_REQUESTS, diff --git a/drivers/platform/x86/amd/pmf/pmf.h b/drivers/platform/x86/amd/pmf/pmf.h index 51e31d008ef9..aeaaff290bff 100644 --- a/drivers/platform/x86/amd/pmf/pmf.h +++ b/drivers/platform/x86/amd/pmf/pmf.h @@ -120,6 +120,18 @@ struct apmf_sbios_req { u8 skin_temp_hs2; } __packed; +struct apmf_sbios_req_v2 { + u16 size; + u32 pending_req; + u8 rsd; + u32 ppt_pmf; + u32 ppt_pmf_apu_only; + u32 stt_min_limit; + u8 skin_temp_apu; + u8 skin_temp_hs2; + u32 custom_policy[10]; +} __packed; + struct apmf_fan_idx { u16 size; u8 fan_ctl_mode; @@ -621,6 +633,7 @@ void amd_pmf_init_auto_mode(struct amd_pmf_dev *dev); void amd_pmf_deinit_auto_mode(struct amd_pmf_dev *dev); void amd_pmf_trans_automode(struct amd_pmf_dev *dev, int socket_power, ktime_t time_elapsed_ms); int apmf_get_sbios_requests(struct amd_pmf_dev *pdev, struct apmf_sbios_req *req); +int apmf_get_sbios_requests_v2(struct amd_pmf_dev *pdev, struct apmf_sbios_req_v2 *req); void amd_pmf_update_2_cql(struct amd_pmf_dev *dev, bool is_cql_event); int amd_pmf_reset_amt(struct amd_pmf_dev *dev); From patchwork Wed Mar 6 11:44:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Sundar S K X-Patchwork-Id: 13583966 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2045.outbound.protection.outlook.com [40.107.92.45]) (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 01DB97FBA0 for ; Wed, 6 Mar 2024 11:44:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709725492; cv=fail; b=E1msDVFKqGIp8XqEtPpTbpzexhyZ+c4Uz27Nst74rLZoCjoA2A/QF3QHINlVht56NhJm3Pn5LY+/FbGpPzMmpeuVWs2cCWoRrUYg7E6IN0tJLEbGg7yhNgZq4P+gVd9A3PMXJ8vDi2LajbWhB4nv/RmQJFX8RaIJU23srSEHaq0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709725492; c=relaxed/simple; bh=BaGx0CwHotXvGYM5uP3cdo3z2teHSXZaq7UHfjNGT7Q=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YuXnHt7dbdev6p1NpT1/VPHhH3IUpVQEPH8WIG7EJqm9+zJsekhyCDA71qn+Zc1WVl1ievgfS0gCOEPLUqeMYLIlg+UlT8OdO+UiZGentszL7Pu/bnLrxPw2dzcwy2wUzuSejHpvIeTgPsx5tF5CH4xAnLSHmFGkOMjQwQ1As6E= 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=nGnDOecY; arc=fail smtp.client-ip=40.107.92.45 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="nGnDOecY" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xw5FXP3xmYnxfTZhNYmGIo/sd1LTp9xJa0y3CzS/JhAZ4k1RMXW2ts0Tpe7IjqEIFhLTTbVEZRaH8LazY2NSaeZ+L1yRibOjXDtK8iIJtwWyZd8Jzna7K9mSVXeYU4bOpoZClHNzSkNlWQ44vKYLs0qEpU9fcPQ2AuevAf2n30SKGcbKhXHRcfh+EtUWU8hn4C/Gha+5iTZtN7wz/H70rMJbWmqLXDd0wWhnvDtK9tN3wVdHzwH01U9CRMxzeFD9s/NJ/RD6SIeCgLRyr+7YGNwMV2YwGu4T4xYti1YHkcVtIThMr6HyyFKsXdhp+FDG0+TGpBbzTUxnl2+lG2Hkhg== 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=qyQ71t5FCRgxZgnTsaidr+RjgO1PEEKH7y8O+DYuk1c=; b=hqoE+iXucik0MGOVGvoFuXb9MjlPpF4yhCwSnFc3lTBOBLaUNxvQm5TG9y9HnsCFLCxTIBu0UPJ+fvDx/IEBejV49OxbgvdSt9YCrYRhOshgF74ZEZybFyVEDobWVOHnjyklvHTDQ6dpyhJiFI7geIC+14m//7+1Xsx1mM7Q04GU0Dl/wwx70aL86TMR5u6TUQSZV53ot2Xky3uBNzHvAPIUWNeu0c84OclUydT0gn0AVWgASPMLqpbGCw4ryHwxyu+AORjuuqGlWTLJYIiULQT2DuFqpaB1iMyDfX6Xo/woOYrlPbUQ1M4X/9wUGs8B/wkl7ndaGar/Oy+V30gMCQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.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=qyQ71t5FCRgxZgnTsaidr+RjgO1PEEKH7y8O+DYuk1c=; b=nGnDOecYYI6XC8y898Rp9BzIbuolCEFxWQExrqRxq91fsMiT9iTIERzGktRLRHNGJyUuHVOiCq0ziLZNZy7mNe9mgPvIJuGZYdFq1sPlpH4LBN4fye5ImYd01rtg5T04+JEkfBkwdz4DnMVj8xRfHI2xPtmJQXAEVvp/YA2Tzu8= Received: from SJ0PR03CA0184.namprd03.prod.outlook.com (2603:10b6:a03:2ef::9) by PH7PR12MB5711.namprd12.prod.outlook.com (2603:10b6:510:1e2::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.24; Wed, 6 Mar 2024 11:44:47 +0000 Received: from MWH0EPF000989E7.namprd02.prod.outlook.com (2603:10b6:a03:2ef:cafe::b2) by SJ0PR03CA0184.outlook.office365.com (2603:10b6:a03:2ef::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.32 via Frontend Transport; Wed, 6 Mar 2024 11:44:46 +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 MWH0EPF000989E7.mail.protection.outlook.com (10.167.241.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7362.11 via Frontend Transport; Wed, 6 Mar 2024 11:44:46 +0000 Received: from jatayu.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.35; Wed, 6 Mar 2024 05:44:43 -0600 From: Shyam Sundar S K To: , CC: , , "Shyam Sundar S K" , Kuppuswamy Sathyanarayanan Subject: [PATCH v3 4/7] platform/x86/amd/pmf: Add support to notify sbios heart beat event Date: Wed, 6 Mar 2024 17:14:12 +0530 Message-ID: <20240306114415.3267603-5-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240306114415.3267603-1-Shyam-sundar.S-k@amd.com> References: <20240306114415.3267603-1-Shyam-sundar.S-k@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@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: MWH0EPF000989E7:EE_|PH7PR12MB5711:EE_ X-MS-Office365-Filtering-Correlation-Id: 7f38cf1d-6cee-4949-acb7-08dc3dd2d2b5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mRl9ZS+Sri1QJky43tHyVS1qHDq30rt4VU/gbK+scaI1jPwWBf7NB2s8zDY4wDCatVz365fJOfwyeCXKd/2tF4mFPG4XQ074ATnLFREZuELO+wK5HVY+ybsc5/aX7tiYGPr3R6rPDus1vlELXofLoB5+HdtKRGzhwX3iagxeQ/NWxODlIlba0WJ8xp4G9BgUuXwnhvZhs1t7XUDXiRuc1XJg7kWsSI75UFze/w2WiyjaD6K3H9Tit+PU4wlEWbkMr6RVnv+VDzS3aWaycI6ULyDLrfAvc/vWCSauMk1q/UXLufDp4/YbusXK5xTWJfg49wVf+t7x3FHk3H/Vl+OzOmMeStLq++SvogLbk0pCiqdlzQJcXHp+Gb5d/hQ/bMhMvB0tL/PqBDqLvncGona+XmwIdMttWYd6SfxFiiMlO7KbBXVBNtYb7OXZEKBdY4j2X7qf3Q5fSqmk8+GI/22TFrpRMwrIDNCfb+rwnCTGSn7ST+mY3dIBqiqXHSy8iq2bPGpKH1783m6fGQVAXy9keCzzaE/xCAjSV7dffsVSj6sAILGd6vuc8+WgNXzyrxmfecixqkvSBBiwhwWFONcsbnmVjPFV/rfd2YzaLMMZgYWz79kUmygfSk+X4ZJGmVNEr753JH1b658MNBP+3zIs6piWt9QQDkhPEGTEcp8L+VHtHPVCCiIovojZZDKJOy6VxIlRtei9YzYXaRCe/Ss4ZPe3lq0IjGYouNR7t4M7TaMZl4LaUv6Vfex01RRRQV8g 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)(36860700004)(82310400014)(376005);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2024 11:44:46.5596 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7f38cf1d-6cee-4949-acb7-08dc3dd2d2b5 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: MWH0EPF000989E7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5711 Add support for newer revision of the heart beat notify events. This event is used to notify to the OEM BIOS on driver load/unload/suspend/resume scenarios. If OEM BIOS does not receive the heart beat event from PMF driver, OEM BIOS shall conclude that PMF driver is no more active and BIOS will update to the legacy system power thermals. Reviewed-by: Kuppuswamy Sathyanarayanan Co-developed-by: Patil Rajesh Reddy Signed-off-by: Patil Rajesh Reddy Signed-off-by: Shyam Sundar S K --- drivers/platform/x86/amd/pmf/acpi.c | 41 +++++++++++++++++++++++++++-- drivers/platform/x86/amd/pmf/core.c | 10 +++++++ drivers/platform/x86/amd/pmf/pmf.h | 17 ++++++++++++ 3 files changed, 66 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/amd/pmf/acpi.c b/drivers/platform/x86/amd/pmf/acpi.c index 13af83b187ac..f0360eea81e6 100644 --- a/drivers/platform/x86/amd/pmf/acpi.c +++ b/drivers/platform/x86/amd/pmf/acpi.c @@ -140,6 +140,43 @@ static void apmf_sbios_heartbeat_notify(struct work_struct *work) kfree(info); } +int amd_pmf_notify_sbios_heartbeat_event_v2(struct amd_pmf_dev *dev, u8 flag) +{ + struct sbios_hb_event_v2 args = { }; + struct acpi_buffer params; + union acpi_object *info; + + args.size = sizeof(args); + + switch (flag) { + case ON_LOAD: + args.load = 1; + break; + case ON_UNLOAD: + args.unload = 1; + break; + case ON_SUSPEND: + args.suspend = 1; + break; + case ON_RESUME: + args.resume = 1; + break; + default: + dev_dbg(dev->dev, "Failed to send v2 heartbeat event, flag:0x%x\n", flag); + return -EINVAL; + } + + params.length = sizeof(args); + params.pointer = &args; + + info = apmf_if_call(dev, APMF_FUNC_SBIOS_HEARTBEAT_V2, ¶ms); + if (!info) + return -EIO; + + kfree(info); + return 0; +} + int apmf_update_fan_idx(struct amd_pmf_dev *pdev, bool manual, u32 idx) { union acpi_object *info; @@ -327,7 +364,7 @@ void apmf_acpi_deinit(struct amd_pmf_dev *pmf_dev) { acpi_handle ahandle = ACPI_HANDLE(pmf_dev->dev); - if (pmf_dev->hb_interval) + if (pmf_dev->hb_interval && pmf_dev->pmf_if_version == PMF_IF_V1) cancel_delayed_work_sync(&pmf_dev->heart_beat); if (is_apmf_func_supported(pmf_dev, APMF_FUNC_AUTO_MODE) && @@ -351,7 +388,7 @@ int apmf_acpi_init(struct amd_pmf_dev *pmf_dev) goto out; } - if (pmf_dev->hb_interval) { + if (pmf_dev->hb_interval && pmf_dev->pmf_if_version == PMF_IF_V1) { /* send heartbeats only if the interval is not zero */ INIT_DELAYED_WORK(&pmf_dev->heart_beat, apmf_sbios_heartbeat_notify); schedule_delayed_work(&pmf_dev->heart_beat, 0); diff --git a/drivers/platform/x86/amd/pmf/core.c b/drivers/platform/x86/amd/pmf/core.c index a6bdde4f1c68..53c0f61e5c5f 100644 --- a/drivers/platform/x86/amd/pmf/core.c +++ b/drivers/platform/x86/amd/pmf/core.c @@ -299,6 +299,9 @@ static int amd_pmf_suspend_handler(struct device *dev) kfree(pdev->buf); + if (is_apmf_func_supported(pdev, APMF_FUNC_SBIOS_HEARTBEAT_V2)) + amd_pmf_notify_sbios_heartbeat_event_v2(pdev, ON_SUSPEND); + return 0; } @@ -313,6 +316,9 @@ static int amd_pmf_resume_handler(struct device *dev) return ret; } + if (is_apmf_func_supported(pdev, APMF_FUNC_SBIOS_HEARTBEAT_V2)) + amd_pmf_notify_sbios_heartbeat_event_v2(pdev, ON_RESUME); + return 0; } @@ -435,6 +441,8 @@ static int amd_pmf_probe(struct platform_device *pdev) amd_pmf_dbgfs_register(dev); amd_pmf_init_features(dev); apmf_install_handler(dev); + if (is_apmf_func_supported(dev, APMF_FUNC_SBIOS_HEARTBEAT_V2)) + amd_pmf_notify_sbios_heartbeat_event_v2(dev, ON_LOAD); dev_info(dev->dev, "registered PMF device successfully\n"); @@ -446,6 +454,8 @@ static void amd_pmf_remove(struct platform_device *pdev) struct amd_pmf_dev *dev = platform_get_drvdata(pdev); amd_pmf_deinit_features(dev); + if (is_apmf_func_supported(dev, APMF_FUNC_SBIOS_HEARTBEAT_V2)) + amd_pmf_notify_sbios_heartbeat_event_v2(dev, ON_UNLOAD); apmf_acpi_deinit(dev); amd_pmf_dbgfs_unregister(dev); mutex_destroy(&dev->lock); diff --git a/drivers/platform/x86/amd/pmf/pmf.h b/drivers/platform/x86/amd/pmf/pmf.h index aeaaff290bff..bcd1ae71109e 100644 --- a/drivers/platform/x86/amd/pmf/pmf.h +++ b/drivers/platform/x86/amd/pmf/pmf.h @@ -34,6 +34,7 @@ struct cookie_header { #define APMF_FUNC_STATIC_SLIDER_GRANULAR 9 #define APMF_FUNC_DYN_SLIDER_AC 11 #define APMF_FUNC_DYN_SLIDER_DC 12 +#define APMF_FUNC_SBIOS_HEARTBEAT_V2 16 /* Message Definitions */ #define SET_SPL 0x03 /* SPL: Sustained Power Limit */ @@ -89,6 +90,21 @@ struct cookie_header { #define PMF_IF_V1 1 +struct sbios_hb_event_v2 { + u16 size; + u8 load; + u8 unload; + u8 suspend; + u8 resume; +} __packed; + +enum sbios_hb_v2 { + ON_LOAD, + ON_UNLOAD, + ON_SUSPEND, + ON_RESUME, +}; + /* AMD PMF BIOS interfaces */ struct apmf_verify_interface { u16 size; @@ -609,6 +625,7 @@ int amd_pmf_get_power_source(void); int apmf_install_handler(struct amd_pmf_dev *pmf_dev); int apmf_os_power_slider_update(struct amd_pmf_dev *dev, u8 flag); int amd_pmf_set_dram_addr(struct amd_pmf_dev *dev, bool alloc_buffer); +int amd_pmf_notify_sbios_heartbeat_event_v2(struct amd_pmf_dev *dev, u8 flag); /* SPS Layer */ int amd_pmf_get_pprof_modes(struct amd_pmf_dev *pmf); From patchwork Wed Mar 6 11:44:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Shyam Sundar S K X-Patchwork-Id: 13583967 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2071.outbound.protection.outlook.com [40.107.244.71]) (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 374457F7FC for ; Wed, 6 Mar 2024 11:44:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.244.71 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709725492; cv=fail; b=a+2e8sPZW1780ABcbIvnXnsTCsDzFHchdeWoQh8vEG6oGVAj8VYbHndjjInAIOp5tqI3mX9ZPtIAaPL1OGeX+tyN4/FfE2x25RIb+nGH8xAC+clhpQbZ7GdrpMS9uoSmgX4IiJgsOjvrDgDD3mYMwro2lNuxJgjY7xpk2LUlYh4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709725492; c=relaxed/simple; bh=3zav3Vz94J8sPtNtpP6f5P5lbRj8j9meBeLd18aHE9A=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nSqGr11ahnfbh/I1yTdkEiH/RUEWT5fEr6dClNV3/Zc3fJ1Q4ZQtkmdi58953KdBsidoXCxhpl8OsXSoaYxDM76R6hDJ7rnSWo+2iNjz/9zTmrVfYFEf/Jx3Ct85c84/uYOSHfwGFusiZzxyPGnciwn2NT9lQKo1pRaZXmD5RPQ= 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=rw1mQTyt; arc=fail smtp.client-ip=40.107.244.71 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="rw1mQTyt" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V9hqBaSX9CDNCQawqSN79ERtzGNbhpB1odxyA1IgSOb1O7g70KwD1wSxWQ3VNYj+oOVQujb3oxdIISrVvXGJ2bH5oVUmBRJxjTTVyuD0YeLR33565+s3I7SVWum2jBjf4+prvwEY93ys9OlmqH3on7QOURd576LQnyPreTQj/XTqi9IY2lAq9rrwjlWKfSL/UnN5+QHrncvZ2cLQrIc/Fz15q3JmspGxnWdH6FhGgH2+2IXnD2SFwTJnSVF3z3M0auwGJaeSHI8VRNbDMvs775xXb9Qsl7HXGwgKw/5FPu+V60Qn9NTIuc+9DWSatmWzJ4S7QIWvSxcNY8mzFBE5aQ== 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=eCpQ93dd8pGpwT8rnePjtJrVEmmlWfXRkRxIFKNYwvU=; b=iePaTm89wQF2mFFPsc0rdIygpYhwrlfGMhj0vREWwYeZJKEofmw9yZgXavTSnvRHV1mcTvPzFTdlfFgcneznORuNeB65z2rE2kTBGbWBtxx038et2Akjk+olJt0Ey1/e48KWxoN7iCama+wMoe0lCjIHrI5o5HQ/GjCNW69zBHCEAnTOCPBJtxAv4jZArFRVzngqE74ZqMWq81BbanKftmJsbEJFZhAKBw+84SZ7jJK5lsmjqCPHRrsgir7QdMJnnf9rkiqCa5Qobw6P1OgDvqwZHOOymzxcNoGK2CnlgZwwM/PZjEIsR4dFZEQf91PjvWgYZdZ8v2TAci3c9KTg7g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.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=eCpQ93dd8pGpwT8rnePjtJrVEmmlWfXRkRxIFKNYwvU=; b=rw1mQTytR7gqE8cEEDRdeT5ryZtxzgjgBxkWqsFLSE4Vi5L13ZXTUATXxQXiGOfIl8DsWWY3BYhyZBv86cXI7wSQU3BnlP7jxEgOyalXuScLVTi2S2DaAAXc/yyPIBMDbEfkY983o0uzN7LRlr2dNsvJUzsfZ1bPm7ZH9w0bgls= Received: from BYAPR03CA0019.namprd03.prod.outlook.com (2603:10b6:a02:a8::32) by DM6PR12MB4233.namprd12.prod.outlook.com (2603:10b6:5:210::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.24; Wed, 6 Mar 2024 11:44:49 +0000 Received: from MWH0EPF000989E5.namprd02.prod.outlook.com (2603:10b6:a02:a8:cafe::ac) by BYAPR03CA0019.outlook.office365.com (2603:10b6:a02:a8::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.39 via Frontend Transport; Wed, 6 Mar 2024 11:44:49 +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 MWH0EPF000989E5.mail.protection.outlook.com (10.167.241.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7362.11 via Frontend Transport; Wed, 6 Mar 2024 11:44:48 +0000 Received: from jatayu.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.35; Wed, 6 Mar 2024 05:44:46 -0600 From: Shyam Sundar S K To: , CC: , , "Shyam Sundar S K" Subject: [PATCH v3 5/7] platform/x86/amd/pmf: Add support to get APTS index numbers for static slider Date: Wed, 6 Mar 2024 17:14:13 +0530 Message-ID: <20240306114415.3267603-6-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240306114415.3267603-1-Shyam-sundar.S-k@amd.com> References: <20240306114415.3267603-1-Shyam-sundar.S-k@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@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: MWH0EPF000989E5:EE_|DM6PR12MB4233:EE_ X-MS-Office365-Filtering-Correlation-Id: 35e94f96-0186-4948-fe18-08dc3dd2d3f5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BKJbUIZG6GmRqVDNJcVIMCQRZGdRTkjOYChTe/VlngScmLtIWf7f3Lw1MyplOAugytxKqNUjm1amQ+Bn+DKGIJCLSyhAG0ewmVipLkJkNIyJLxp9guYf8PUKzmBxOjygxwaQxIJbECTKNFy/DmiIHJsjyH2sGxKelvJ9ucZ0VRU2C+wN8i2z6PVdd3pVF+3QF/KWCIXzLAD2Kcun01NGFBeBa7f+FXf2OQWpfQkmFLphH+jLwzw447QOrWIfOoTXtoCFtCdk2UdHVYuWMy/Xp9v0brA7cpwBqgTR92oi4nz4wYx7ykqLqTf3K1caMOPnp78W3x5CpIzbS1vGGBZoNNG+yq6q3c+FeAdwfKGC52vNu6IHwuSei0QpFF+qaNEOULhyHi5xDXtMq0bZre8FB2TNtNSJghS+SSc/4qmWs9a+aBRwBET6Hy4ZWoNZEg6//KwJoazMI1zbvGZRAuAQ3jxDqkOE/e+drrwJuZcaXwWpiWiOTX2hgJyn5lZ8LM9/LACZSonoFWszWfzT5X/V0CyC+xzavE6DUI1ZnHbDbXBgYFG3qUjSpugnZNH2bMEpxpiQX0GrR6JmHqenLDtKyHswyNB6qbyKxlwLOZ4TvuDBHqQlRQutnfYs3lqTDDMWI7PBazpbfoWrpxNq3idvhiIJ5Fu9QLz/pvHwOfqLCOwux8PwK07EgYEOpBdaZfnIEvLgyJ+/M+6dSrW55QBtaEbixlSEWkVkH7siHYm5fdKAg6jURVK8FYG7EmGF33Pm 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)(36860700004)(376005)(82310400014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2024 11:44:48.6589 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 35e94f96-0186-4948-fe18-08dc3dd2d3f5 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: MWH0EPF000989E5.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4233 APMF spec has a newer section called the APTS (AMD Performance and Thermal State) information, where each slider/power mode is associated with an index number. Add support to get these indices for the Static Slider. Reviewed-by: Ilpo Järvinen Co-developed-by: Patil Rajesh Reddy Signed-off-by: Patil Rajesh Reddy Signed-off-by: Shyam Sundar S K --- drivers/platform/x86/amd/pmf/acpi.c | 10 ++++++ drivers/platform/x86/amd/pmf/pmf.h | 25 +++++++++++++ drivers/platform/x86/amd/pmf/sps.c | 56 ++++++++++++++++++++++++++++- 3 files changed, 90 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/amd/pmf/acpi.c b/drivers/platform/x86/amd/pmf/acpi.c index f0360eea81e6..82dafe74fc6d 100644 --- a/drivers/platform/x86/amd/pmf/acpi.c +++ b/drivers/platform/x86/amd/pmf/acpi.c @@ -96,6 +96,16 @@ int is_apmf_func_supported(struct amd_pmf_dev *pdev, unsigned long index) return !!(pdev->supported_func & BIT(index - 1)); } +int apmf_get_static_slider_granular_v2(struct amd_pmf_dev *pdev, + struct apmf_static_slider_granular_output_v2 *data) +{ + if (!is_apmf_func_supported(pdev, APMF_FUNC_STATIC_SLIDER_GRANULAR)) + return -EINVAL; + + return apmf_if_call_store_buffer(pdev, APMF_FUNC_STATIC_SLIDER_GRANULAR, + data, sizeof(*data)); +} + int apmf_get_static_slider_granular(struct amd_pmf_dev *pdev, struct apmf_static_slider_granular_output *data) { diff --git a/drivers/platform/x86/amd/pmf/pmf.h b/drivers/platform/x86/amd/pmf/pmf.h index bcd1ae71109e..44ac22098d79 100644 --- a/drivers/platform/x86/amd/pmf/pmf.h +++ b/drivers/platform/x86/amd/pmf/pmf.h @@ -89,6 +89,7 @@ struct cookie_header { #define MAX_OPERATION_PARAMS 4 #define PMF_IF_V1 1 +#define PMF_IF_V2 2 struct sbios_hb_event_v2 { u16 size; @@ -228,6 +229,14 @@ enum power_modes { POWER_MODE_MAX, }; +enum power_modes_v2 { + POWER_MODE_BEST_PERFORMANCE, + POWER_MODE_BALANCED, + POWER_MODE_BEST_POWER_EFFICIENCY, + POWER_MODE_ENERGY_SAVE, + POWER_MODE_V2_MAX, +}; + struct amd_pmf_dev { void __iomem *regbase; void __iomem *smu_virt_addr; @@ -268,6 +277,10 @@ struct amd_pmf_dev { u16 pmf_if_version; }; +struct apmf_sps_prop_granular_v2 { + u8 power_states[POWER_SOURCE_MAX][POWER_MODE_V2_MAX]; +} __packed; + struct apmf_sps_prop_granular { u32 fppt; u32 sppt; @@ -289,6 +302,16 @@ struct amd_pmf_static_slider_granular { struct apmf_sps_prop_granular prop[POWER_SOURCE_MAX][POWER_MODE_MAX]; }; +struct apmf_static_slider_granular_output_v2 { + u16 size; + struct apmf_sps_prop_granular_v2 sps_idx; +} __packed; + +struct amd_pmf_static_slider_granular_v2 { + u16 size; + struct apmf_sps_prop_granular_v2 sps_idx; +}; + struct os_power_slider { u16 size; u8 slider_event; @@ -643,6 +666,8 @@ const char *amd_pmf_source_as_str(unsigned int state); int apmf_update_fan_idx(struct amd_pmf_dev *pdev, bool manual, u32 idx); int amd_pmf_set_sps_power_limits(struct amd_pmf_dev *pmf); +int apmf_get_static_slider_granular_v2(struct amd_pmf_dev *dev, + struct apmf_static_slider_granular_output_v2 *data); /* Auto Mode Layer */ int apmf_get_auto_mode_def(struct amd_pmf_dev *pdev, struct apmf_auto_mode *data); diff --git a/drivers/platform/x86/amd/pmf/sps.c b/drivers/platform/x86/amd/pmf/sps.c index 33e23e25c8b1..0cf38bdae7a4 100644 --- a/drivers/platform/x86/amd/pmf/sps.c +++ b/drivers/platform/x86/amd/pmf/sps.c @@ -10,9 +10,26 @@ #include "pmf.h" +static struct amd_pmf_static_slider_granular_v2 config_store_v2; static struct amd_pmf_static_slider_granular config_store; #ifdef CONFIG_AMD_PMF_DEBUG +static const char *slider_v2_as_str(unsigned int state) +{ + switch (state) { + case POWER_MODE_BEST_PERFORMANCE: + return "Best Performance"; + case POWER_MODE_BALANCED: + return "Balanced"; + case POWER_MODE_BEST_POWER_EFFICIENCY: + return "Best Power Efficiency"; + case POWER_MODE_ENERGY_SAVE: + return "Energy Save"; + default: + return "Unknown Power Mode"; + } +} + static const char *slider_as_str(unsigned int state) { switch (state) { @@ -63,10 +80,44 @@ static void amd_pmf_dump_sps_defaults(struct amd_pmf_static_slider_granular *dat pr_debug("Static Slider Data - END\n"); } + +static void amd_pmf_dump_sps_defaults_v2(struct amd_pmf_static_slider_granular_v2 *data) +{ + unsigned int i, j; + + pr_debug("Static Slider APTS state index data - BEGIN"); + pr_debug("size: %u\n", data->size); + + for (i = 0; i < POWER_SOURCE_MAX; i++) + for (j = 0; j < POWER_MODE_V2_MAX; j++) + pr_debug("%s %s: %u\n", amd_pmf_source_as_str(i), slider_v2_as_str(j), + data->sps_idx.power_states[i][j]); + + pr_debug("Static Slider APTS state index data - END\n"); +} #else static void amd_pmf_dump_sps_defaults(struct amd_pmf_static_slider_granular *data) {} +static void amd_pmf_dump_sps_defaults_v2(struct amd_pmf_static_slider_granular_v2 *data) {} #endif +static void amd_pmf_load_defaults_sps_v2(struct amd_pmf_dev *dev) +{ + struct apmf_static_slider_granular_output_v2 output; + unsigned int i, j; + + memset(&config_store_v2, 0, sizeof(config_store_v2)); + apmf_get_static_slider_granular_v2(dev, &output); + + config_store_v2.size = output.size; + + for (i = 0; i < POWER_SOURCE_MAX; i++) + for (j = 0; j < POWER_MODE_V2_MAX; j++) + config_store_v2.sps_idx.power_states[i][j] = + output.sps_idx.power_states[i][j]; + + amd_pmf_dump_sps_defaults_v2(&config_store_v2); +} + static void amd_pmf_load_defaults_sps(struct amd_pmf_dev *dev) { struct apmf_static_slider_granular_output output; @@ -256,7 +307,10 @@ int amd_pmf_init_sps(struct amd_pmf_dev *dev) dev->current_profile = PLATFORM_PROFILE_BALANCED; if (is_apmf_func_supported(dev, APMF_FUNC_STATIC_SLIDER_GRANULAR)) { - amd_pmf_load_defaults_sps(dev); + if (dev->pmf_if_version == PMF_IF_V2) + amd_pmf_load_defaults_sps_v2(dev); + else + amd_pmf_load_defaults_sps(dev); /* update SPS balanced power mode thermals */ amd_pmf_set_sps_power_limits(dev); From patchwork Wed Mar 6 11:44:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Sundar S K X-Patchwork-Id: 13583968 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2057.outbound.protection.outlook.com [40.107.102.57]) (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 E1AE07F7FC for ; Wed, 6 Mar 2024 11:44:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.102.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709725495; cv=fail; b=YP654zy/n/z5/feIPUtrvoAmWsl5cXsyqwBuhRvO/YO5rFVTG/jN6NkRQ30Zq5mfZiTe2hkL2cuotS42e8EVAj9dnz8IvFNsSMo6mZFvAWRjww+qLKli1/3hWtRdh+1sR2a6X/felfSGSXikOzIUNfdGPm+4SfyY8YAXzuA5ZiE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709725495; c=relaxed/simple; bh=gZ9cnY6mocY3R1Lt4kbjkvz3N+58zRCENipgTaWbFxI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QARYBtjxxEzA+OoL/Fj5N07jVqCgYktS7EYP88oErt9WmGlXb/Ad82zqjYLJE0TyZS4XROzYz5ohJurT3DfFMHFmWVM4RpjO101fUOKV5XDj3kFa4bFwPdz+IK25/lsP9RWRJIr9u606eXkVGrVs2KMEo7N65hEPYFbnLPfA2gU= 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=jIeol4VE; arc=fail smtp.client-ip=40.107.102.57 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="jIeol4VE" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IA4X8W0iAH7HLubsor8br6XFb5DKPL+R4d0yYKhgDkct3NmzSm5ZamwW3XQ3wLp2HCKukhqAs6OyrC2LvLf4LAvmPW7+FVTM8uUV8UhfPkFzl5PDaE/cVxs3tgxr2inZi4LuZF/Kj/+LAjMUPosHi/jI553BcY60bzahAOIMA+tRjXCp4seAHWqddVXslyG9iL/ByNXqn3AmCbSVJ8VRWz6GLZzsPmdIlx51VnlVu4UgPKG7Q7BXcSfQWQ8QLJi+T5cbMWrVXPNo/FDpvqOK+f3tikSyhKIqVHXnROAZZLelfOXeAr8ifCVVdfX7YoTLEaof/+ORGusmAORo/Ja4KA== 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=Glv+WKqnyE4YULH1UJKIl0tgwUSxJCJxRF084CNQaJU=; b=in//FzpWbWK+l3YwjaPZmiRZNIu3KOJmS6fhIb6eVrcfIynbhhd8lUHIZR1/RaYI89Hc3CmomUrXGU70KvLnilt2L9qxANj8dKj1R8UbX3hHSoTqNRvw62/1G81situMWO8S0x/9aM6/rUt4Lo/y8YohCvi3UfptkafsAj2ae1a0BMlt0YPJ7x7WtuMaYxCxxEIVojHXaVjIkK3lvld7fZmrTt2dUeyeqkiyUds+ajx6oEdoswNpHLsI1vlnfRkUzbeVPpUfFmFAcXhRcXtKNDXRAySSF+XY+rzZK6SK8bOBSJYAS79Oqe3jtC1F5IElCgsdXiyNwMxLZLHWdRlIhA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.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=Glv+WKqnyE4YULH1UJKIl0tgwUSxJCJxRF084CNQaJU=; b=jIeol4VEFHHkr4YG8jiQG5VNGbVOl5lNX9b1+nFVNGOuTbCNokn5WP4Qr2vQXH2tGc0ixUtVDRdFx+Vfh7K2LV3cD34ITi1lnAAMwtnrfqSDRoVF6Yk8MZW6xd9QrmYHwuyzuW3EfueSW+UFxeVAYR71sD4yqy6Hrunff/hz42M= Received: from SJ0PR13CA0232.namprd13.prod.outlook.com (2603:10b6:a03:2c1::27) by DS0PR12MB8561.namprd12.prod.outlook.com (2603:10b6:8:166::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.24; Wed, 6 Mar 2024 11:44:51 +0000 Received: from MWH0EPF000989E6.namprd02.prod.outlook.com (2603:10b6:a03:2c1:cafe::e9) by SJ0PR13CA0232.outlook.office365.com (2603:10b6:a03:2c1::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.23 via Frontend Transport; Wed, 6 Mar 2024 11:44: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 MWH0EPF000989E6.mail.protection.outlook.com (10.167.241.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7362.11 via Frontend Transport; Wed, 6 Mar 2024 11:44:51 +0000 Received: from jatayu.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.35; Wed, 6 Mar 2024 05:44:48 -0600 From: Shyam Sundar S K To: , CC: , , "Shyam Sundar S K" Subject: [PATCH v3 6/7] platform/x86/amd/pmf: Add support to get sps default APTS index values Date: Wed, 6 Mar 2024 17:14:14 +0530 Message-ID: <20240306114415.3267603-7-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240306114415.3267603-1-Shyam-sundar.S-k@amd.com> References: <20240306114415.3267603-1-Shyam-sundar.S-k@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@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: MWH0EPF000989E6:EE_|DS0PR12MB8561:EE_ X-MS-Office365-Filtering-Correlation-Id: ad005ab0-750e-4188-5a4c-08dc3dd2d566 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AnHu3vm2YPUx8UvzGxpLB9blFMPsJ3f1A8kx+/ie9/YBaIwCN+n6y/0Jm8+HReGuksZflod5OD7Lw5Q5uDIeZ0MwnpTKaLUHUtkzu01DFLW2fdTcm7WxlsSiZ5tcbimlW+ccNMVLbwtA45ve3BIfK+UUarvcQlfS0BeNtLl8umf78wGo2uV9Uh5iNp0rksMj2IoYqxPLxz2cF8a15GnFdkR68CQQqBrbNP/SugGDZwzFt+wU03teEXtiKCK16Je5w68Xn7LhrQWz1+x/0mfbhjkUSajg1JAP40emJb4oWEsI/5hB/AJcP4xWHfNeIoCiEAUEoIfhjC0XaJufAPT00gsuh9DdULLuX8U+zI7XBLHvH2izxrt4yFJSFc5Ya5b4cnxox6XajyiD0IEDCf/spx7R+uSndzKRJ5s1bC1G20fJswuovd1zyB6tNMlL8dcEXklyUSPYojRaRmGeyEPeRvT/R7yE3bMgtVn+mnDNiI/oL0pKitrgJnMUjwzX8MBAmL9vcN4dmJEany/tM59+4vm/gkVO3H5GXQ3ODSFLakwTMPiWw0YmQHfiTZoxcMg28uzv/uLvN785AuDdiW691LDCmPBvpn1AMACdyvBZn1TZOh93xHFURjxtAySb0RE87+C5/TcOpsrv/OXTs+/jCacP/F/E3IiWGf2sEVDUSo9skc5jxd8sgd0wDZ/vNB7N49Z5U32lJuhW3kGXRHjRlJjExEjm/Fi0n5e65aURH/yIiCQmfmqj+eUAPXcY1hEd 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)(36860700004)(376005)(82310400014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2024 11:44:51.0730 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ad005ab0-750e-4188-5a4c-08dc3dd2d566 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: MWH0EPF000989E6.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB8561 During the driver probe, the default cache values for the static slider would be obtained by evaluating the APTS method. Add support to use these values as the thermal settings to be updated on the system based on the changing platform-profiles. Co-developed-by: Patil Rajesh Reddy Signed-off-by: Patil Rajesh Reddy Signed-off-by: Shyam Sundar S K --- drivers/platform/x86/amd/pmf/acpi.c | 74 +++++++++++++++++++++++++++++ drivers/platform/x86/amd/pmf/pmf.h | 25 ++++++++++ drivers/platform/x86/amd/pmf/sps.c | 51 +++++++++++++++++++- 3 files changed, 148 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/amd/pmf/acpi.c b/drivers/platform/x86/amd/pmf/acpi.c index 82dafe74fc6d..d0cf46e2fc8e 100644 --- a/drivers/platform/x86/amd/pmf/acpi.c +++ b/drivers/platform/x86/amd/pmf/acpi.c @@ -90,12 +90,86 @@ static int apmf_if_call_store_buffer(struct amd_pmf_dev *pdev, int fn, void *des return err; } +static union acpi_object *apts_if_call(struct amd_pmf_dev *pdev, u32 state_index) +{ + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; + acpi_handle ahandle = ACPI_HANDLE(pdev->dev); + struct acpi_object_list apts_if_arg_list; + union acpi_object apts_if_args[3]; + acpi_status status; + + apts_if_arg_list.count = 3; + apts_if_arg_list.pointer = &apts_if_args[0]; + + apts_if_args[0].type = ACPI_TYPE_INTEGER; + apts_if_args[0].integer.value = 1; + apts_if_args[1].type = ACPI_TYPE_INTEGER; + apts_if_args[1].integer.value = state_index; + apts_if_args[2].type = ACPI_TYPE_INTEGER; + apts_if_args[2].integer.value = 0; + + status = acpi_evaluate_object(ahandle, "APTS", &apts_if_arg_list, &buffer); + if (ACPI_FAILURE(status)) { + dev_err(pdev->dev, "APTS state_idx:%u call failed\n", state_index); + kfree(buffer.pointer); + return NULL; + } + + return buffer.pointer; +} + +static int apts_if_call_store_buffer(struct amd_pmf_dev *pdev, + u32 index, void *data, size_t out_sz) +{ + union acpi_object *info; + size_t size; + int err = 0; + + info = apts_if_call(pdev, index); + if (!info) + return -EIO; + + if (info->type != ACPI_TYPE_BUFFER) { + dev_err(pdev->dev, "object is not a buffer\n"); + err = -EINVAL; + goto out; + } + + size = *(u16 *)info->buffer.pointer; + if (info->buffer.length < size) { + dev_err(pdev->dev, "buffer smaller than header size %u < %zu\n", + info->buffer.length, size); + err = -EINVAL; + goto out; + } + + if (size < out_sz) { + dev_err(pdev->dev, "buffer too small %zu\n", size); + err = -EINVAL; + goto out; + } + + memcpy(data, info->buffer.pointer, out_sz); +out: + kfree(info); + return err; +} + int is_apmf_func_supported(struct amd_pmf_dev *pdev, unsigned long index) { /* If bit-n is set, that indicates function n+1 is supported */ return !!(pdev->supported_func & BIT(index - 1)); } +int apts_get_static_slider_granular_v2(struct amd_pmf_dev *pdev, + struct amd_pmf_apts_granular_output *data, u32 apts_idx) +{ + if (!is_apmf_func_supported(pdev, APMF_FUNC_STATIC_SLIDER_GRANULAR)) + return -EINVAL; + + return apts_if_call_store_buffer(pdev, apts_idx, data, sizeof(*data)); +} + int apmf_get_static_slider_granular_v2(struct amd_pmf_dev *pdev, struct apmf_static_slider_granular_output_v2 *data) { diff --git a/drivers/platform/x86/amd/pmf/pmf.h b/drivers/platform/x86/amd/pmf/pmf.h index 44ac22098d79..10d5f8cef27e 100644 --- a/drivers/platform/x86/amd/pmf/pmf.h +++ b/drivers/platform/x86/amd/pmf/pmf.h @@ -91,6 +91,29 @@ struct cookie_header { #define PMF_IF_V1 1 #define PMF_IF_V2 2 +#define APTS_MAX_STATES 16 + +/* APTS PMF BIOS Interface */ +struct amd_pmf_apts_output { + u16 table_version; + u32 fan_table_idx; + u32 pmf_ppt; + u32 ppt_pmf_apu_only; + u32 stt_min_limit; + u8 stt_skin_temp_limit_apu; + u8 stt_skin_temp_limit_hs2; +} __packed; + +struct amd_pmf_apts_granular_output { + u16 size; + struct amd_pmf_apts_output val; +} __packed; + +struct amd_pmf_apts_granular { + u16 size; + struct amd_pmf_apts_output val[APTS_MAX_STATES]; +}; + struct sbios_hb_event_v2 { u16 size; u8 load; @@ -668,6 +691,8 @@ int apmf_update_fan_idx(struct amd_pmf_dev *pdev, bool manual, u32 idx); int amd_pmf_set_sps_power_limits(struct amd_pmf_dev *pmf); int apmf_get_static_slider_granular_v2(struct amd_pmf_dev *dev, struct apmf_static_slider_granular_output_v2 *data); +int apts_get_static_slider_granular_v2(struct amd_pmf_dev *pdev, + struct amd_pmf_apts_granular_output *data, u32 apts_idx); /* Auto Mode Layer */ int apmf_get_auto_mode_def(struct amd_pmf_dev *pdev, struct apmf_auto_mode *data); diff --git a/drivers/platform/x86/amd/pmf/sps.c b/drivers/platform/x86/amd/pmf/sps.c index 0cf38bdae7a4..96bd2140302c 100644 --- a/drivers/platform/x86/amd/pmf/sps.c +++ b/drivers/platform/x86/amd/pmf/sps.c @@ -12,6 +12,7 @@ static struct amd_pmf_static_slider_granular_v2 config_store_v2; static struct amd_pmf_static_slider_granular config_store; +static struct amd_pmf_apts_granular apts_config_store; #ifdef CONFIG_AMD_PMF_DEBUG static const char *slider_v2_as_str(unsigned int state) @@ -95,11 +96,55 @@ static void amd_pmf_dump_sps_defaults_v2(struct amd_pmf_static_slider_granular_v pr_debug("Static Slider APTS state index data - END\n"); } + +static void amd_pmf_dump_apts_sps_defaults(struct amd_pmf_apts_granular *info) +{ + int i; + + pr_debug("Static Slider APTS index default values data - BEGIN"); + + for (i = 0; i < APTS_MAX_STATES; i++) { + pr_debug("Table Version[%d] = %u\n", i, info->val[i].table_version); + pr_debug("Fan Index[%d] = %u\n", i, info->val[i].fan_table_idx); + pr_debug("PPT[%d] = %u\n", i, info->val[i].pmf_ppt); + pr_debug("PPT APU[%d] = %u\n", i, info->val[i].ppt_pmf_apu_only); + pr_debug("STT Min[%d] = %u\n", i, info->val[i].stt_min_limit); + pr_debug("STT APU[%d] = %u\n", i, info->val[i].stt_skin_temp_limit_apu); + pr_debug("STT HS2[%d] = %u\n", i, info->val[i].stt_skin_temp_limit_hs2); + } + + pr_debug("Static Slider APTS index default values data - END"); +} #else static void amd_pmf_dump_sps_defaults(struct amd_pmf_static_slider_granular *data) {} static void amd_pmf_dump_sps_defaults_v2(struct amd_pmf_static_slider_granular_v2 *data) {} +static void amd_pmf_dump_apts_sps_defaults(struct amd_pmf_apts_granular *info) {} #endif +static void amd_pmf_load_apts_defaults_sps_v2(struct amd_pmf_dev *pdev) +{ + struct amd_pmf_apts_granular_output output; + struct amd_pmf_apts_output *ps; + int i; + + memset(&apts_config_store, 0, sizeof(apts_config_store)); + + ps = apts_config_store.val; + + for (i = 0; i < APTS_MAX_STATES; i++) { + apts_get_static_slider_granular_v2(pdev, &output, i); + ps[i].table_version = output.val.table_version; + ps[i].fan_table_idx = output.val.fan_table_idx; + ps[i].pmf_ppt = output.val.pmf_ppt; + ps[i].ppt_pmf_apu_only = output.val.ppt_pmf_apu_only; + ps[i].stt_min_limit = output.val.stt_min_limit; + ps[i].stt_skin_temp_limit_apu = output.val.stt_skin_temp_limit_apu; + ps[i].stt_skin_temp_limit_hs2 = output.val.stt_skin_temp_limit_hs2; + } + + amd_pmf_dump_apts_sps_defaults(&apts_config_store); +} + static void amd_pmf_load_defaults_sps_v2(struct amd_pmf_dev *dev) { struct apmf_static_slider_granular_output_v2 output; @@ -307,10 +352,12 @@ int amd_pmf_init_sps(struct amd_pmf_dev *dev) dev->current_profile = PLATFORM_PROFILE_BALANCED; if (is_apmf_func_supported(dev, APMF_FUNC_STATIC_SLIDER_GRANULAR)) { - if (dev->pmf_if_version == PMF_IF_V2) + if (dev->pmf_if_version == PMF_IF_V2) { amd_pmf_load_defaults_sps_v2(dev); - else + amd_pmf_load_apts_defaults_sps_v2(dev); + } else { amd_pmf_load_defaults_sps(dev); + } /* update SPS balanced power mode thermals */ amd_pmf_set_sps_power_limits(dev); From patchwork Wed Mar 6 11:44:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shyam Sundar S K X-Patchwork-Id: 13583969 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2066.outbound.protection.outlook.com [40.107.92.66]) (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 603B87F7FC for ; Wed, 6 Mar 2024 11:44:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.66 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709725498; cv=fail; b=smfZZx++aj398XYPoobBHdF59SUlRZj+5VIEhAa4gX/lKrgpyGujZ5sm+e5BKZcM0V8uT1FkBk3gJZtP78n2tEUuiHg8POk2mqozqv8JdT36jZ4VS1wJ6lIww/ZLgIkP+5K1mm1SiJkp+tgWl+JSkdHJL2XgZcNg7tXm18/DgdA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709725498; c=relaxed/simple; bh=Z9iRPIdy/NAVVwWcCW1qijo7a8gtUtoAp2oDkbAkTeA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XdILGBYd/IwwBL+8R2aM1R0eknSp5wZybjKd/pGABUCSVJv7OBfxHG/+hQI4pif8i2v+MAEJKr0brFk71Agwz8CNv77+ArhKjUze5l7ju5d7JzmoeBC45sHlVWrydzDj8zuWgTPdjNvqlUVjNA32p60dx6B70scVLXOfId9LGpY= 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=p5T+Ae6E; arc=fail smtp.client-ip=40.107.92.66 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="p5T+Ae6E" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kkpYK9ot1jE7IaFHMcuU4rCIIuAjFN9mXiHQaxo5OIt3spXTJ711WXs/S3jPQwFqePNorPgMBceJDo116DR6ZKwlD7jiwh40ulbnmtCxBE9opUEDFADhoJQrE+josoT2NhMG7LnwKMQaXVhtDJuqJoFInmkA7FgCys3PP85yVQyDho3yyBPNHIy0OwPA2tswAfU4c0jVJy1u3ySPgOvTBzgJI8ZiptBqdEvTobYd1pRd8XUikuc9d2PbWQRRN0VRdI3W/FIAuEXZ9ZCn8/1BeJZ5zhKKzqamH2DBw1wBtuptgqPgSOZX4hi1FTY5E4pN3JzoqGr72XFamSn//xzgiQ== 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=s2cSVgjYU8H9IHLMijfdL8mGInnrpihKEiQp66Ee+Nk=; b=VYIc/HTaMEzXUe6uoVeevuPucnT3xUy2HdKWQnaUBhftca1qFqSOMoaH+1ley8tkmw6Igcmwhe9c7RXauDkscAs+FivKSzo/cJnBuGzGoSIHnNOcoIZ7eKgzDnDwB0g0jN7iIZg5G72fbUhaK9vM064n+K93Fw9GH4YsIAWaaSb/8tYc2K5kMsTKinZp16A89MaNKasnK5dRJYI8SRGvSRdMN7ZsgHAotHy10jE4MALhwoLNSfsQAnscFbYiKpCpHJmfGlKjVSk542HqSo7GZ+MoPdx78XBEWF41YswNzWc718mV7zNnEHkBtG4l0dnhsrBVKYX2WQ6dtMnR1Jl8Lw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=redhat.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=s2cSVgjYU8H9IHLMijfdL8mGInnrpihKEiQp66Ee+Nk=; b=p5T+Ae6E19vJpH/KEBQmIFw3BlpgKUN83RnXZ5KoDFKO8B0RyjbbxpjTvirln84bTYZofHJXo3h6Ca7m0L/sEWeLsSzxjU16SnZL+YUKzYOyAFp1rrlBVmWOZ5AMUXWSMKpAf+RbBoXpCTrY75+D1znVdGPlBWt7YsfFpOpEIDk= Received: from SJ0PR13CA0230.namprd13.prod.outlook.com (2603:10b6:a03:2c1::25) by DM4PR12MB6424.namprd12.prod.outlook.com (2603:10b6:8:be::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.24; Wed, 6 Mar 2024 11:44:53 +0000 Received: from MWH0EPF000989E6.namprd02.prod.outlook.com (2603:10b6:a03:2c1:cafe::a7) by SJ0PR13CA0230.outlook.office365.com (2603:10b6:a03:2c1::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.23 via Frontend Transport; Wed, 6 Mar 2024 11:44:53 +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 MWH0EPF000989E6.mail.protection.outlook.com (10.167.241.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7362.11 via Frontend Transport; Wed, 6 Mar 2024 11:44:53 +0000 Received: from jatayu.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.35; Wed, 6 Mar 2024 05:44:50 -0600 From: Shyam Sundar S K To: , CC: , , "Shyam Sundar S K" Subject: [PATCH v3 7/7] platform/x86/amd/pmf: Update sps power thermals according to the platform-profiles Date: Wed, 6 Mar 2024 17:14:15 +0530 Message-ID: <20240306114415.3267603-8-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240306114415.3267603-1-Shyam-sundar.S-k@amd.com> References: <20240306114415.3267603-1-Shyam-sundar.S-k@amd.com> Precedence: bulk X-Mailing-List: platform-driver-x86@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: MWH0EPF000989E6:EE_|DM4PR12MB6424:EE_ X-MS-Office365-Filtering-Correlation-Id: 924e0d1a-a743-497a-d4a0-08dc3dd2d6a5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Vk2ELKAQH+T29NSxk0+FpmBHurunpVfz5MzLWaddbFwmUww2+/kl/ou5pwLmiFaiH0WHGpTwSH8MGl16mlOHg3WzLvI+xq+M6IL8ulehW6cNXxemoGaF3/jbeLcGQqGRGiNh1er0HT4D81aciC3Hl57p66Ftwl3kRIQzoE15REHnbPmNa4h77PW7YXUVoJfkyP+Tu+9LhPhvoGBOre9ozwZh7pipT77m8n0CdD/egL2Bq99kUVm631bgIu1zzmJUnQqGl1rtboABqyBjLn0LdvjRrLKF/Lwt43IKpB350FwPO9bACdgpoY5j0RhgrqDAS/2Gz2nBIlOBihXmSn49JuwoWMl29zs+8wORGmN1QJKwvqeDHHnMmr/AJ9kvJdydHgI8SAO+coC0BEaPIC3cVKYuN20wFT3vFenKQhK9WQttfzr3SaJB2HtgQ2JiYNatwohrDRIii/WjDnp18ETkImtax6CJRJVGV0QYq0QqeCEZeqM/AG3Iim7dOCs5wdl7ffNyhkVEqXV1Y/ETYMJHRZpkiw4MiBh+Yw8fmMdGILigJPV57MmirZYL4+RG2e5bySluWnq4QrjxfDMO0x4mdPZJYrXRU57sso0rbNL/D1C/TKLk0vc5aGuw1jDufIpuLrpt+epyr87PByd+iuWuYajTpVxqYgmIIYBunTVxag5HF46rW4AgFNVmq4dDx3gWOoWFbYkQtDsa8bzAAROROJjWxV/CcNAi7lhj2WUU9OwmfwaT8Kv6RovKF8Auq/qZ 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)(82310400014)(36860700004)(376005);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Mar 2024 11:44:53.1667 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 924e0d1a-a743-497a-d4a0-08dc3dd2d6a5 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: MWH0EPF000989E6.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6424 Update power thermals according to the platform-profiles selected by the user. Co-developed-by: Patil Rajesh Reddy Signed-off-by: Patil Rajesh Reddy Signed-off-by: Shyam Sundar S K --- drivers/platform/x86/amd/pmf/pmf.h | 2 ++ drivers/platform/x86/amd/pmf/sps.c | 42 ++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/drivers/platform/x86/amd/pmf/pmf.h b/drivers/platform/x86/amd/pmf/pmf.h index 10d5f8cef27e..907e046c3c96 100644 --- a/drivers/platform/x86/amd/pmf/pmf.h +++ b/drivers/platform/x86/amd/pmf/pmf.h @@ -55,6 +55,8 @@ struct cookie_header { #define GET_STT_LIMIT_APU 0x20 #define GET_STT_LIMIT_HS2 0x21 #define SET_P3T 0x23 /* P3T: Peak Package Power Limit */ +#define SET_PMF_PPT 0x25 +#define SET_PMF_PPT_APU_ONLY 0x26 /* OS slider update notification */ #define DC_BEST_PERF 0 diff --git a/drivers/platform/x86/amd/pmf/sps.c b/drivers/platform/x86/amd/pmf/sps.c index 96bd2140302c..92f7fb22277d 100644 --- a/drivers/platform/x86/amd/pmf/sps.c +++ b/drivers/platform/x86/amd/pmf/sps.c @@ -190,6 +190,19 @@ static void amd_pmf_load_defaults_sps(struct amd_pmf_dev *dev) amd_pmf_dump_sps_defaults(&config_store); } +static void amd_pmf_update_slider_v2(struct amd_pmf_dev *dev, int idx) +{ + amd_pmf_send_cmd(dev, SET_PMF_PPT, false, apts_config_store.val[idx].pmf_ppt, NULL); + amd_pmf_send_cmd(dev, SET_PMF_PPT_APU_ONLY, false, + apts_config_store.val[idx].ppt_pmf_apu_only, NULL); + amd_pmf_send_cmd(dev, SET_STT_MIN_LIMIT, false, + apts_config_store.val[idx].stt_min_limit, NULL); + amd_pmf_send_cmd(dev, SET_STT_LIMIT_APU, false, + apts_config_store.val[idx].stt_skin_temp_limit_apu, NULL); + amd_pmf_send_cmd(dev, SET_STT_LIMIT_HS2, false, + apts_config_store.val[idx].stt_skin_temp_limit_hs2, NULL); +} + void amd_pmf_update_slider(struct amd_pmf_dev *dev, bool op, int idx, struct amd_pmf_static_slider_granular *table) { @@ -222,6 +235,32 @@ void amd_pmf_update_slider(struct amd_pmf_dev *dev, bool op, int idx, } } +static int amd_pmf_update_sps_power_limits_v2(struct amd_pmf_dev *pdev, int pwr_mode) +{ + int src, index; + + src = amd_pmf_get_power_source(); + + switch (pwr_mode) { + case POWER_MODE_PERFORMANCE: + index = config_store_v2.sps_idx.power_states[src][POWER_MODE_BEST_PERFORMANCE]; + amd_pmf_update_slider_v2(pdev, index); + break; + case POWER_MODE_BALANCED_POWER: + index = config_store_v2.sps_idx.power_states[src][POWER_MODE_BALANCED]; + amd_pmf_update_slider_v2(pdev, index); + break; + case POWER_MODE_POWER_SAVER: + index = config_store_v2.sps_idx.power_states[src][POWER_MODE_BEST_POWER_EFFICIENCY]; + amd_pmf_update_slider_v2(pdev, index); + break; + default: + return -EINVAL; + } + + return 0; +} + int amd_pmf_set_sps_power_limits(struct amd_pmf_dev *pmf) { int mode; @@ -230,6 +269,9 @@ int amd_pmf_set_sps_power_limits(struct amd_pmf_dev *pmf) if (mode < 0) return mode; + if (pmf->pmf_if_version == PMF_IF_V2) + return amd_pmf_update_sps_power_limits_v2(pmf, mode); + amd_pmf_update_slider(pmf, SLIDER_OP_SET, mode, NULL); return 0;