From patchwork Thu Feb 29 07:32:01 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: 13576776 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2073.outbound.protection.outlook.com [40.107.102.73]) (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 327AD44C8D for ; Thu, 29 Feb 2024 07:32:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.102.73 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709191957; cv=fail; b=atBu8YRor8L3StrlVNx+eoP3kxkgYRQBQ34OZdY91dMEty8tvxxnypjBHoWQgGvM2MXW/qO9pVn3MBCR0Z+G75Lp5FCDW112UO/chKlh9pcN70xIJYXKSxHCYKUNr9i1IngUXG/t07VQFlPqztrsnGPICjiDAWo4dyPdtWuBi1U= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709191957; c=relaxed/simple; bh=vLOwQaqMzGk5VRG9lc2vZ6JCMIkNOzEypWMug3F2/k0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=U/XNOCxJQ3Ypc8wkQEwClvSd7l/fy/ScOi+BCkIosi7xfQd8DZIyfDR+WHajvdSY9J56nksjs+JVPPDA8qahYKP3tN35VQ5uqQpWObBM8aiiSc36W46vJtT3xR0MV0Tk8lgQ2YgwJ0HQE4jWJAbWPiMxiBiSvvxn2ETOkDp+qig= 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=MC0OKlmL; arc=fail smtp.client-ip=40.107.102.73 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="MC0OKlmL" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AZtK4Z2U6xVVch7bfirEU+waKYoK+MXFy6D10rfNNafxFUdLVe/OJXuU4Yy5yrZPf/6rpVkayH5+tJ6mCnOnx3bvuUBv+fqu5bnOQpnxTaJJZ7acDW1NjcgkJyMWu79LPhGLXhdQaaclsz22h+2N59KuU64hd6sRDpYVCv5yeKZNYRaGTT45dXC50UFdYb3JVO3HNW3CdqUYs7ITSJeD36X0ssafA603gX9ynODb679WAICAc21aaOhteJoJWhPhwBmfNanpYkbyKfGsAaur2i5shpRjdnOtvrp6tuPoWmbDnlF0mEqEaWWoR/4Saon1vZhCnY0DqnY1jTaw1mAhtw== 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=obSqyj1RYPWBEOWd6PdsMHmYOzbZ9xU3OdmON6JAgsg=; b=EoN0Exf31AtMvBA78jJn+t0bskQTJMgbBcpYzOhy7VIE+mdBt8SrHi+xgzGj3K3O+ygPb5ulCYCbuZWGZgdcD3pBnXSxfgWg8e6FqLZBNBo5rk10mQo//17xC1UrfDzfxKHjRoWOxoXIkjaEQzT8gy4a0MAcCc/1RlWhi1YnCYZjUOyu7dWQyXHV4nAU3+r2TXlJHnonNUH5xxZO4opPuHIHTKz4D/EaByd08WPKFPoieUM1Kx2pjSwPfCLxue/kp7PSijdZrhPo//eLqIN/GGer8YYh+DqixXcy8ydR4Tin5m6c/4YzFsD/cr/Xps4ML2AJUDTDtWSqVx0/g5KDNg== 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=obSqyj1RYPWBEOWd6PdsMHmYOzbZ9xU3OdmON6JAgsg=; b=MC0OKlmLi9q0UcqoOMsJIX1vZdRwmgUj8vh+xrPG43535IREvDdgheqs+TO7o4P4b4OkeU4f6/sNOsfI5hok6PdjTyWzVnUpNIY5rICtVotL2QeAqdMQgVsRRvtjzJ0xDEKqtuaLYbFYeIczRL/APv8TrSGvnTzK7iUEZcQrScc= Received: from MN2PR14CA0022.namprd14.prod.outlook.com (2603:10b6:208:23e::27) by SN7PR12MB6743.namprd12.prod.outlook.com (2603:10b6:806:26d::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.41; Thu, 29 Feb 2024 07:32:33 +0000 Received: from BL6PEPF0001AB4B.namprd04.prod.outlook.com (2603:10b6:208:23e:cafe::cf) by MN2PR14CA0022.outlook.office365.com (2603:10b6:208:23e::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.30 via Frontend Transport; Thu, 29 Feb 2024 07:32:32 +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 BL6PEPF0001AB4B.mail.protection.outlook.com (10.167.242.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7292.25 via Frontend Transport; Thu, 29 Feb 2024 07:32:32 +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; Thu, 29 Feb 2024 01:32:29 -0600 From: Shyam Sundar S K To: , CC: , , "Shyam Sundar S K" , Kuppuswamy Sathyanarayanan Subject: [PATCH v2 1/7] platform/x86/amd/pmf: Differentiate PMF ACPI versions Date: Thu, 29 Feb 2024 13:02:01 +0530 Message-ID: <20240229073207.4092698-2-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240229073207.4092698-1-Shyam-sundar.S-k@amd.com> References: <20240229073207.4092698-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: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB4B:EE_|SN7PR12MB6743:EE_ X-MS-Office365-Filtering-Correlation-Id: 78959bbc-a08f-4e25-b3f7-08dc38f897c6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +0RRATJJtSkN5D09Hs5+YGR5oVRjFnKnRxm/MZGhIo2SP10ZuBAv3L66FoJ6ZHA8oref92fhdgYA75OFJfIaNTfiOdY1lsE/Pvk3ju0pbjQoZeYx04ZYsNzDcVJgzq08rRwtMKMPK+1Vf7c6sJq45Ma8OzUzjjqJKvjNt0WTzR/oNXly0h/cUfFQxC2nlSK5S2vuDOxDvqwJyUUmP9rB6i5/TKM0vTsUBmpwNgU78iEHh7s3GFcltxjh9ekjqikgxertEK97HN28tB0JCcjDB+E3+G32Uwdzwe+4dnqEdBghroG68w6clfa0L2NawzAXb2OG+G+m6CoHK2/CktevQc7UlygcXnMWqmHcRRpueIT/8ruJAZCY3yE4+z+kvqFeYALZUg2QCK0xW8pxk1/ILfk7ranRnvbAiFGeqzZS94stJ4fZ9qw56UXTjpkAlF9P2zNmUmQ6AYc63xPluYS6huxtZzbMc/JOl5yG5uauIVk4RzpWDb2rp7oZas0K/kERkfwNS8F/Aw7Rbm5dXAxgCiTaIIhMlm/HBe6+IB38kWLPESxSUv75teqkHk049N7InagshEVmPfWqrVV5RCkZYLq4Z5Cg2j1ybfbak3U3KdTySYUZg7vDNot9Pl0em9zSBMgIPGq6Hyfm7c8ybBHziHdHqliizgwufnsejaciuMjLRpnrnudzd9IaVbi+Fp3zIQ3ElcTQXQDyG7w/dEoSyjvMiCq5ESNvCMRFrURNKDwFKKymQYwRWCUAT/TqBg4M 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);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Feb 2024 07:32:32.7788 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 78959bbc-a08f-4e25-b3f7-08dc38f897c6 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: BL6PEPF0001AB4B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6743 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 66cae1cca73c..e51ac981af73 100644 --- a/drivers/platform/x86/amd/pmf/pmf.h +++ b/drivers/platform/x86/amd/pmf/pmf.h @@ -231,6 +231,7 @@ struct amd_pmf_dev { u64 policy_addr; void *policy_base; bool smart_pc_enabled; + u16 pmf_if_version; }; struct apmf_sps_prop_granular { From patchwork Thu Feb 29 07:32:02 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: 13576777 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2069.outbound.protection.outlook.com [40.107.237.69]) (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 179FA44C9C for ; Thu, 29 Feb 2024 07:32:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709191958; cv=fail; b=nfHztCU/Egr8kkI2utgNnsCF3k0VUZQMa9WCtYaL3tMbtLzEvCDOMgOmzaSP86/vYOxiqLso8nFfNQ5Rs+yscZ1j8LOaEk+Gxs0o0OZmVqRyWYm03xDyOcH6aZZ2JZgfD7mUaATzajpksJ9VI4X9aiVk8MU8QGOkg0uBsDlLkWE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709191958; c=relaxed/simple; bh=VkuBDPfl0mrvDsu4wliRIEKfo6vqRbJbI8fShW/RECg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sEzdRqEgLw3HQbxZQszGalXQ78oHEe9LnD4U7VpWSDYfUxF6iYajE9EphYO918mOUHJVA4OfvQt4xuEGug8tairY3YYW0g9BDrv3EgQUaJIW0RE55/99sZN+aN5RhGX9AQ/XMDppUIJ8QyOBOgOQQYGqVhHLspUygTtEvV9ffQY= 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=2h/F4V3Q; arc=fail smtp.client-ip=40.107.237.69 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="2h/F4V3Q" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MMGNfkHGv6uoPXO18tg/UMG0gTX5H9E55a+jKeKEsSu/bdnX5z8jkxBOkXCuU5MTYfbB9EBiA+7y/UnmWn5747b+p/woxfRZnbGNdDEE1ns1GjZyH9YueizzGQBsZLYaWlrT1GCKIaHnLyRikEkVjsXCT2j45LqqcFispHbOSxbHkFZf7+a/AXNdoPAnD5P4zwWlbaUGuDqwgckkesYVz3UhsREYe476zMO6opbv+nfnXhR5U22RJu/Mp7+GRswuuC4zjiBBw7QwtkYnSpA6N26gEfZEKGbzkTEOMeWf7Cfy/xIdic14k3V4L72L1EZRaqx8zotDanP/KFmRPYJjug== 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=h9UeoSho8L6gBBpuA1IO1ksF9eB1d/J0aWgbxnz+35E=; b=Dy3FrpAf0MY5hB6+bN3njwlOrGE+kDM0fWeg8zm/4oj2YZo4hJnwSHATdVFjbrIgItc9FFxr6IO9bXcnVsRjJ199qRfMOuvfQ2keM0S5Vv7/yEcDmN7Hit+MGHg8Oxn3hwyFBBzYrmajh+rIJQ2618n/0Jai7iKu5BzTzFD+dL1eWZUL2r47EkorkoDYJKR1hlGLXjQxl4JaJ4cmDpt7McxjjxQme176z2tsj/gX3YBx45IBm7jA8B7ylFEF7PvvKJsUAKOODhOA6oLts3zMUUZDUGbuh4C6p/PC2UFt3+a0Gb7CIHdC71thVzkHY53xDor19vY1bRk87g7/5f/YCA== 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=h9UeoSho8L6gBBpuA1IO1ksF9eB1d/J0aWgbxnz+35E=; b=2h/F4V3QqOelpqwCMSZOEbaPu3IE1BoA7XYZXqeSs9z5UJI9H2t8cVYBbhdAbEp+zLDaeXMwc73Y5zNLAqEJzW9t3fPNmlzF2scpEFzT962zu8eswlftThscyGSA89PfcACuUuf9Tbj/20v6cBU5liLfnexqbsvxYgJIRVgXyC4= Received: from MN2PR14CA0027.namprd14.prod.outlook.com (2603:10b6:208:23e::32) by DS7PR12MB6190.namprd12.prod.outlook.com (2603:10b6:8:99::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.36; Thu, 29 Feb 2024 07:32:34 +0000 Received: from BL6PEPF0001AB4B.namprd04.prod.outlook.com (2603:10b6:208:23e:cafe::c8) by MN2PR14CA0027.outlook.office365.com (2603:10b6:208:23e::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.27 via Frontend Transport; Thu, 29 Feb 2024 07:32:34 +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 BL6PEPF0001AB4B.mail.protection.outlook.com (10.167.242.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7292.25 via Frontend Transport; Thu, 29 Feb 2024 07:32:34 +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; Thu, 29 Feb 2024 01:32:32 -0600 From: Shyam Sundar S K To: , CC: , , "Shyam Sundar S K" Subject: [PATCH v2 2/7] platform/x86/amd/pmf: Disable debugfs support for querying power thermals Date: Thu, 29 Feb 2024 13:02:02 +0530 Message-ID: <20240229073207.4092698-3-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240229073207.4092698-1-Shyam-sundar.S-k@amd.com> References: <20240229073207.4092698-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: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB4B:EE_|DS7PR12MB6190:EE_ X-MS-Office365-Filtering-Correlation-Id: 8b057431-c531-4706-ce44-08dc38f898e4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Aco2MRvAIZmt1rg9TUj5Una0LJxSVVOWIYwVDpSj0qWBfzPyHDxx2KG/0QaZs7TUaotanATQMHgSwrb7HLCu8A+9EUgqHmkV/VljjKgQRtkjsTlbwURlmKPdAPYlSaKCUeyg2c33O3spKb3XDZ6e/iXXZx58GGYoDADItOjMuHE3Zz/O8rr0znmDrxbKkv6bbs6rj1eyneUsakulkWCwhGLA0DmgSuZ00Zy1s0z2mBF8rPhDiBIbIK7/sxjHbdZctdMU2rw/ZR9DGqeKJn46bHuVeyl1T23palLnft7zCB/Ta7OAvur5+kcxflqkhW+Bz23kV+qlX9f8E2Y8Re2R+yICoKo/VxQhjMJf/Gyjtw5F9fRykMw3D7KSPUS/zAWvoiG0XrkNvcbkdQOxVFPWkY2nCay/uGuCf27imAkaRr4MqGfJTQ+saleeDBlsg6JYdFfhATMvljYgVu1ZmkRCgfMIg9JIPfIuVOanTB9zhV70lq3oLDEhyftV/0jR8nbPsQpd1StmDJQGOGoZgcsqHwGQJ/hSysUpfCL+PtHImbwarc/akEacusc3HFcN7U5wIfW5+FoB2JduIK422HgmpzeVgKPi2KzTn07ccapmC/HpEJ1/VWtCMlxJfYYR9pRy7LhCL9CRaFDPIGqAeq7hzDMfyhirRSYTTQujiyTEUucBBGfHZk1Bk6vU6LpBGvLyWlQw0ZofueCFP4Utgr6BwdjtkAWh/hxhSyVqw0X70FYrOAfGUtkMPtJEzBZkts2H 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);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Feb 2024 07:32:34.6694 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8b057431-c531-4706-ce44-08dc38f898e4 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: BL6PEPF0001AB4B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6190 The GET interface to receive the active power thermal information from the PMFW has been depricated. Hence drop the debugfs support from version2 onwards. 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 4f734e049f4a..2230bc2b1f59 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 e51ac981af73..4364af72a7a3 100644 --- a/drivers/platform/x86/amd/pmf/pmf.h +++ b/drivers/platform/x86/amd/pmf/pmf.h @@ -83,6 +83,8 @@ #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 Thu Feb 29 07:32:03 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: 13576778 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2052.outbound.protection.outlook.com [40.107.94.52]) (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 2819844C9C for ; Thu, 29 Feb 2024 07:32:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.52 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709191961; cv=fail; b=gWV2e5WRitZBC3ckXWMF5fYG1d+3HP/O3E9OUf6SwGS/ZPRI5CJf94j6mqBpEb7kTcA/Ix8zJT+7Riamg1ffS+xhXGSqHCy+tqHso2jY+vK3R/NZo1P0nEsOnhqvVX9E0NZIPFv5W6q+TwJoxm7fC+jZItms/sDnEvmtk4zmOXI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709191961; c=relaxed/simple; bh=CcjLFYAGsnjTF24Z8aLae+s6YnTYSBKEncipSigZJds=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fyFnwo54odUAxIrWNwRc9wFaOmc/KOjEwMB8uZFSFvdmvabzuPmremKS1LJlOAJrjkj33av2DbqEyVYy+6PAeU3Wfo9texwAy7Q8Wi92MDXpuM0M2J/mlzVpc6j9D2Na+lKjtX7axFBXQCHQivrBvCCXeRNxw0Ege8av1bPGiss= 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=gsFazs/7; arc=fail smtp.client-ip=40.107.94.52 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="gsFazs/7" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PchyYakZImJygylu2sW/yWF4S7PmB08jjBt+b5GzloyMBS97/B9Q6HPv+rjr0WyUVjhFPWaCYcxSYUaFQYONoiFAFpvJiRbn0TGHBLIUdL6FOhkS/+0ctWy2LSFfk1AMtC1YdE874+aUo0wYb/bQpR4s6xi7XiUrge4k31VSkuho1c2dJSPj/WYs+UmO9eoC0II32Vo+9lx/mNUx3WXzQ2wvO0zTEH6sUF+7hOMOwQnugSaiORNu1icXq+Db/0iA9a9u/15zkBLsn3EsmPuT+NrsqvjSM6g7z+hmoRtliGiU2nHx+S4cCrhObGV/jJOiTly7i8IEfRsCfkKOU6phcA== 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=MsHqzKrdKy5c1HTQUUE677ojkD29pktUNtetjI3LEC0=; b=CqjYDrsY+KMEQ/KCanxx6p6Xihm6kjKHDdER6fvAX7EzuqME5CxRx4WhiOszzmoTl0hJQHR+5/YyaUZO0jdAVwe9BdCt1EaNjCerGgCqffyjyELzPgz/UDjGGuzDJEWbO3Hxuh2IwZrsEl0audTjUG41kEz0B3L1wK2uETl5XMVZ+3kSQBNrhb8U4r6c/rpWwHZl8FfrRdTdYh23dgxJg3lLHfbR4XRV8EFEjUydqjHh5kMZwkNAPdJcppwG8IUZWdJB8Amuj2gl7EAarwbwUDhzcROWDyrv+lp73M/EZ+kpKoIcSR0Puhu6IKWF2PJn5QuhMylTyBaxA3DUWziU4Q== 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=MsHqzKrdKy5c1HTQUUE677ojkD29pktUNtetjI3LEC0=; b=gsFazs/7opcsxH4dn9vTPc1EqtA7vSjZ6duX3V7wFnYcm3ecOWVBLavy0KA9Vd30n4N1CKurZeROrny7pXa4Y9xlAsaeZg/4Dzv2y3qOayDbzNlJpORND3Y8YPV/resTW/8kJnucx0hXQx2u7ScOqac91GCFiyLUSXLTz6ae3IU= Received: from MN2PR14CA0025.namprd14.prod.outlook.com (2603:10b6:208:23e::30) by MN0PR12MB6319.namprd12.prod.outlook.com (2603:10b6:208:3c0::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.36; Thu, 29 Feb 2024 07:32:36 +0000 Received: from BL6PEPF0001AB4B.namprd04.prod.outlook.com (2603:10b6:208:23e:cafe::cc) by MN2PR14CA0025.outlook.office365.com (2603:10b6:208:23e::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.32 via Frontend Transport; Thu, 29 Feb 2024 07:32:36 +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 BL6PEPF0001AB4B.mail.protection.outlook.com (10.167.242.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7292.25 via Frontend Transport; Thu, 29 Feb 2024 07:32:36 +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; Thu, 29 Feb 2024 01:32:34 -0600 From: Shyam Sundar S K To: , CC: , , "Shyam Sundar S K" Subject: [PATCH v2 3/7] platform/x86/amd/pmf: Add support to get sbios requests in PMF driver Date: Thu, 29 Feb 2024 13:02:03 +0530 Message-ID: <20240229073207.4092698-4-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240229073207.4092698-1-Shyam-sundar.S-k@amd.com> References: <20240229073207.4092698-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: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB4B:EE_|MN0PR12MB6319:EE_ X-MS-Office365-Filtering-Correlation-Id: 4e04de02-fcea-459b-fb44-08dc38f89a15 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YDUJ+XuTrYVi/qtFXt+fcP3R6le2tyFm875WsVt3ujrStPtGQdnsyb9RTHiHyb65iS985xZL4SKapuFfr+1hsLUpYByNEcxT/abh9Z9TAhNjCvBg7/MHJVI/Rp7DcnQw6mj5LM3YM3isPhcLSddF+sHvPDvLmQ6DdQKp9jytZeI0nu3K6Puij5phHMKtcoMqNNsaCNvZ0W4+ZrhE7XZqHTuqeT2lILLx6YrUxXH3BkhsWkScYPCxhQSqrJn3Cqt6b90T6mKb8lSAUudQEU4nqD3ma8VNW0G33XOTXQtc0bqJaLLIoNg9lSXRKmyu8YA4VZ5DkdB79/y2vFkHk/hiMUx9QVfRkqmxlqL3OHePf49mBrz61o9xx0TRvp5F2GSYyof0K7B8Sbway1OyV02Qj3bdOOhR4Pe6znNpbEz661+3LepfgAf4qfnobHfYjaQoWSlCtMFcTHVadZrT4ge1QL0MYb1jBiSCTXJ0c3Aq5Fx5kXAzxfg2wvBpefQRoUjJ1jcnCEJ/4mn2RAII00D54CLQfW6RmoXGwkTurWniUzdGmrb9O2waGsYw4OPdy57azaAaZEWOqsLi0/5zWQuQKmMjH3x2Hxs1cDtd/kc1BF1Td5ATdabDpyA9BVdHLKjBD29/vYeO9BEf4Ywj2sHpXW4hUh78B2m4KUkC0UwnehLGgwvy4lHzCmnOB2AY2BVJokvjXye3P0RwNgUN5LADUT2yNZS0YvwE9/9aJOMySqevN8bHvWofr8pHJNrFRG2G 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);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Feb 2024 07:32:36.6382 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4e04de02-fcea-459b-fb44-08dc38f89a15 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: BL6PEPF0001AB4B.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6319 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 --- 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 4364af72a7a3..f11d2a348696 100644 --- a/drivers/platform/x86/amd/pmf/pmf.h +++ b/drivers/platform/x86/amd/pmf/pmf.h @@ -116,6 +116,18 @@ struct apmf_sbios_req { u8 skin_temp_hs2; } __packed; +struct apmf_sbios_req_v2 { + u16 size; + u32 pending_req; + u8 rsvd; + u32 update_ppt_pmf; + u32 update_ppt_pmf_apu_only; + u32 update_stt_min; + u8 update_stt_apu; + u8 update_stt_hs2; + u32 custom_policy[10]; +} __packed; + struct apmf_fan_idx { u16 size; u8 fan_ctl_mode; @@ -612,6 +624,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 Thu Feb 29 07:32:04 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: 13576779 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2081.outbound.protection.outlook.com [40.107.93.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A1F473A28D for ; Thu, 29 Feb 2024 07:32:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.81 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709191963; cv=fail; b=gB+MallvKpoPXY+sNDx/lPErPXMTJPcOaDU5VLOkB/Fkgn8h+lGzyWa97AvsWVA+oKizWzt+EoNpYsHAU84FiPlInw/sVCAiQkBd23UbhZk9MlEUs1jt7PiifoLaDqybMnmqtUdp4sU7yknJ7ICvYCY5cpoqCmWPjQHg7dUJoWs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709191963; c=relaxed/simple; bh=ST7Nwg1iFWCiGD0S7qbCKkhpj80BI/7zOfiiTOgp+Bw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=NDYf8yPj9sdXxIV8oTLTHdiK/Dfd2GngAx0x3nq3HXkjJVxy787cVLmsAFixB/8knMV7i5Be2Gl5me9SiUCGyrZImxFH+GhXX/0gWPaGZwmuBxbM1eSpZxcph6ehIucDO8bFK4VJsro82zr8fBRh+9JebPAbtjQNa+caphq4pEA= 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=ElSebhEW; arc=fail smtp.client-ip=40.107.93.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="ElSebhEW" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EiU7655J64f4/garXwmy6RxmnAszwejPvQ1YmOd7V3t2+LxlSO9x75qZu/wBi16b0BIkWBbsWizrONjTE2R32kEGhWPAs6ONmsBEiCxcCuJ+z/lH7Nx8QJwtYBy2cdAT5RprgbsiMFpvoiUATUWgGgieW8IMHBk1HbqpNsYJ0H1Pfa1VNfxj92h/nzGSoaRRaQR/rA4OWS8yik7SBWu21erxGuzWqzBqZtQT1Ty3LbZwA12spcFBbWEMvzVDr2c0dtaKuRNnI3yZoR4iO1VnsvJCtWcHqijbjdarDx6WroUQaFH32MmNzxRUf6jzghhSKQgS+sUFQ0sQ+nd+yO46yA== 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=J5SMekNnpez+YXFfCn1xq1+j6uJLxy1QHV+SH0933eA=; b=IP967jyb2MKFIR94b5zuO2iRaDy58IIPrHqqPfEpPpoCIgeKMftqbNXN7yzQwsK8DpsS6PO5CjJj2MYUdTSEFgdvhseLk57KQHc0iZUmCJkh2rp4yecN6HAQXDz4bpE4UNAxsmERIluY7EBKSKhE9EVInonf4j1iohPFTAGzCfmsYFrOrVjWyzxwJruR0F2I/DFDLRFt9082er8RK6LaOTIN27YIW+lssTL8ZGALQc9seXQcwNJRVKznkD3ykveQNPq7PgNGowUX8vB5Dn77c5sID/B0ombS++I/Y4wPdYhe4V39vLMSgbbQZvhYHnB8dFNQ6t4zv76EzIbN4Aum6Q== 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=J5SMekNnpez+YXFfCn1xq1+j6uJLxy1QHV+SH0933eA=; b=ElSebhEWaqSVWAa9yO14m1Ad1leuDM1DpJzSsP+jmOcOs5Uc7XURMfUsYR4M+DWj1+rwvrr+mIAxtpPuLLQd2cshFWrabS+nvK+SManjo4MZci8B2LEcO/GLdLTk5VX0TOyw62eL3AewSsUNV3CxaztTwDLFQuy0I4Qb8dGW3vQ= Received: from BL0PR03CA0010.namprd03.prod.outlook.com (2603:10b6:208:2d::23) by CH3PR12MB9080.namprd12.prod.outlook.com (2603:10b6:610:1a7::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.36; Thu, 29 Feb 2024 07:32:39 +0000 Received: from BL6PEPF0001AB4D.namprd04.prod.outlook.com (2603:10b6:208:2d:cafe::96) by BL0PR03CA0010.outlook.office365.com (2603:10b6:208:2d::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.28 via Frontend Transport; Thu, 29 Feb 2024 07:32: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 BL6PEPF0001AB4D.mail.protection.outlook.com (10.167.242.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7292.25 via Frontend Transport; Thu, 29 Feb 2024 07:32:38 +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; Thu, 29 Feb 2024 01:32:36 -0600 From: Shyam Sundar S K To: , CC: , , "Shyam Sundar S K" Subject: [PATCH v2 4/7] platform/x86/amd/pmf: Add support to notify sbios heart beat event Date: Thu, 29 Feb 2024 13:02:04 +0530 Message-ID: <20240229073207.4092698-5-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240229073207.4092698-1-Shyam-sundar.S-k@amd.com> References: <20240229073207.4092698-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: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB4D:EE_|CH3PR12MB9080:EE_ X-MS-Office365-Filtering-Correlation-Id: dba162bb-b61a-43f8-3409-08dc38f89b66 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Y+x/ZHqFkxHsQ6Ck71hvc+XkuCk1jZv4QFHK93ZaYSkTbw7gjUw9rCnORn/6vOsgXJJ8wXLKTMKzFybKT30DjnrL9E7Yf0LcsjHrpxNh1vmO+LyInLH9LT9U5YaSg7dV+7jr8PQMDScw+5U91eVRujkNp/qF3uO8cKH5oNrTJ0UCReg2pkBSIvWurioP81PofXPUcxLChSQCpkjDXd7om8qTBlXCLzUa16oU83f0OdltT6Hc6mnUrXe97/jxEg6r7k1Zlr2DnQZr+PLHXBZNfxWeFRZe5A4YYcl/tb6kS9qXFtTiX0zOKN8/KoZj2owAIUx9A+HjacUPp2UR8K+jjwSyMJKNO9l88b0b1oNvptOKVm1AEyC0SJnCCaNHbPbxKpJEUuKi7NYSAgCuLqB3O/SKflnHkZJ6rfZzvOBkTsO0PX2v1Ew9DkEGklcdV1OoZ7VhlXxWhYGt8rtDEBODqLUAaL5gks2csyKg7V9+xEMVWjoGoX+hNsnWtQhPvFiNu8WMbTrZDpLgZTMmbPiMo5jQsbYAbb6j9Ai4HUYntb41hqqamKNQj6TC5lr9Ec9MC6nT8IY4YrKFF1jkoXnE97ln6zNgR9kbm/cPB647OVMfgcGuAMnRBX2tyG0xZXAuqdVoPhBQTQeDDl5Zn89f3sFfNgFmjIL/XXjgK0DUVHArQqZZk68otltUduHFNprN18vdaQQ2IiArZ1Iud3IOFAvY8AQdY0zsM0XfRxyJSeWg6WcRrSC1g/U+d3qxiXR3 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);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Feb 2024 07:32:38.8729 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dba162bb-b61a-43f8-3409-08dc38f89b66 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: BL6PEPF0001AB4D.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB9080 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. 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 2230bc2b1f59..5e52eb32ab2b 100644 --- a/drivers/platform/x86/amd/pmf/core.c +++ b/drivers/platform/x86/amd/pmf/core.c @@ -300,6 +300,9 @@ static int amd_pmf_suspend_handler(struct device *dev) if (pdev->smart_pc_enabled) cancel_delayed_work_sync(&pdev->pb_work); + if (is_apmf_func_supported(pdev, APMF_FUNC_SBIOS_HEARTBEAT_V2)) + amd_pmf_notify_sbios_heartbeat_event_v2(pdev, ON_SUSPEND); + return 0; } @@ -317,6 +320,9 @@ static int amd_pmf_resume_handler(struct device *dev) if (pdev->smart_pc_enabled) schedule_delayed_work(&pdev->pb_work, msecs_to_jiffies(2000)); + if (is_apmf_func_supported(pdev, APMF_FUNC_SBIOS_HEARTBEAT_V2)) + amd_pmf_notify_sbios_heartbeat_event_v2(pdev, ON_RESUME); + return 0; } @@ -444,6 +450,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"); @@ -455,6 +463,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 f11d2a348696..5cad11369697 100644 --- a/drivers/platform/x86/amd/pmf/pmf.h +++ b/drivers/platform/x86/amd/pmf/pmf.h @@ -30,6 +30,7 @@ #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 */ @@ -85,6 +86,21 @@ #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; @@ -600,6 +616,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 Thu Feb 29 07:32:05 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: 13576780 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2040.outbound.protection.outlook.com [40.107.223.40]) (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 654703A28D for ; Thu, 29 Feb 2024 07:32:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709191966; cv=fail; b=E40FZVHJZCAm1PUcvMAcVbvK09uwxqomPqJ06o+AqEo7gSB2CVLoGbKvcHWvcrpBaie3xuEpT/62iFcZqfWCRgY8B7zGaNBhWnCl7xaP/tcJPD6GzZunVY/MuaC0n13JlfkyCdt0cbq6InXRToYtNTg2ENnoDsX0hTaA8vJXaOg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709191966; c=relaxed/simple; bh=NTVTPWI8B9V0fjDyUWHA25zH8HZS1K9pfJrfz5HuWIQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=e2K7hc1sBsE5lGnMuqfM30iZkMjdoyOXHS+7HkJyI6vE8bdQ1DuYKpir3N89ngsz1tqJ4EhntABfMtXQOUWLxw4wPLD+iLbk1+PP9w5cEeEp+jrGk3LOJDjlAQXk8PhOcCVKdnKjcRfGK5HrAnrc52O9pC5eSJwDMvtqLc83GUg= 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=apglNnNq; arc=fail smtp.client-ip=40.107.223.40 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="apglNnNq" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CVdWepe+xtCXUcCzSamgiZQXHNSvwTracpLuXewWEzcRS2Lk/MoYJzZvAcD9tlDX/SYMgE6BCMoLay9O/KZkbe2bOd6QrUrqswquEi1SlRUfQS2ECWi0YT+1rLGGjAhAIDqkB3JIAdEYAKgEXfu53n3AHKZ2SkMyr6gft7Pl1F5AJnranpHXhmF4paAG1zykwHaK5cvk7bB8LwJpDFr8+VF7VQCSgPJV50WHF3y6OMnws5+s/YacMSkKI7mGN57FKxsWdfDXUirs4qJcSbKj2I1e4xIYqbAgLgTpui6QDxAHeGfqtvTalUnDcduq40WDZeb7tVtF6VuRzmPomKdvJQ== 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=LyHAWqysauMKyrAycs49ESlARXYyvi2kDPqcMdH/hlM=; b=WfTngFyDHHfjIQR62sm5zxrPqoeYrywc4xtDL+8tcv/gu2EW49cDmEokpYUZA9BzgclBUVG9BmKn5NhJir1p0f31/9XVcAMsaMf/PPYvDZeYX24op2Y+KwRdvFUtWfxYP1iIFzPFbEHELFd7rcehooIQqLfcj+3mQxonAFxOU8QliYvm+6YlRp9d2AESDXm9s6jpeppTHBowVjN1pLLUq1mqCD3LU65H9W/bxzDsfKl71JfODGVwBQcw3HyQF5q8sCV2MhPPfKVSTGiuUXdqJatFZm9r27KY5NZS5kl6tr/redAI97Y8gF1iEoJ/4smMvHlDklP+4dFaCZqMnQSvWQ== 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=LyHAWqysauMKyrAycs49ESlARXYyvi2kDPqcMdH/hlM=; b=apglNnNq1Rbh84UwyQpH3PcUOs9667j9nK+X+RodBdzO5tm9FLqqS3pSo7C6mX56QZlL7KD03Qop2itRAr9WYrjP41MTy63guNKR8EygjmjUfJcpvsO5TMwTtVoOvVq3MbGOsQLee08i/iU71G1vbbWxTsG02Nw3di7EyDXgNnY= Received: from BL1P222CA0004.NAMP222.PROD.OUTLOOK.COM (2603:10b6:208:2c7::9) by BY5PR12MB4068.namprd12.prod.outlook.com (2603:10b6:a03:203::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.41; Thu, 29 Feb 2024 07:32:41 +0000 Received: from BL6PEPF0001AB4C.namprd04.prod.outlook.com (2603:10b6:208:2c7:cafe::d6) by BL1P222CA0004.outlook.office365.com (2603:10b6:208:2c7::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.29 via Frontend Transport; Thu, 29 Feb 2024 07:32:41 +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 BL6PEPF0001AB4C.mail.protection.outlook.com (10.167.242.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7292.25 via Frontend Transport; Thu, 29 Feb 2024 07:32: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; Thu, 29 Feb 2024 01:32:38 -0600 From: Shyam Sundar S K To: , CC: , , "Shyam Sundar S K" Subject: [PATCH v2 5/7] platform/x86/amd/pmf: Add support to get APTS index numbers for static slider Date: Thu, 29 Feb 2024 13:02:05 +0530 Message-ID: <20240229073207.4092698-6-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240229073207.4092698-1-Shyam-sundar.S-k@amd.com> References: <20240229073207.4092698-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: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB4C:EE_|BY5PR12MB4068:EE_ X-MS-Office365-Filtering-Correlation-Id: 525ae2a7-1f68-40b8-eaaa-08dc38f89cb1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PYZiKTiYijWNah/OxWZ/QwlqkDmy7zUnqzJVAJml6IxM5pVaR1yIt7z9+ZP5zd8gi8KKuSH+jt6YLcRsk6JhXzcagaOwTqdp6j6rpxQHtz1U0KRkrtAnlFu2e26GLY9FHg/X9fi9s88n7qaemEH7ACWxqHZzuf7da5ftC/jN+jI5QI5Q72pRU4C90eOX1S0yUHxBDi4QW//wQYejJLvAgCcEDzIYARPUnok/5Ry3wRW5pqrE4rCUX3xeacVL8Lim1An+HvHy9USEanoVVO5azLvRuHL5XnR7TfZqH+Jh1NUMPNFVwEO70rbprFaPHggPasRxjIjKjhOB7kUqntHUz8wJEy7blEdIrr32Eee7pfPgxIWzXKDo4eyFsxKM0SYpxYmv4Dia+Wmp2ND59lJowrZS61wq8H+wCsdktC4+P+acb5DvFFa7bsC/DfCGO2tAzGD06Oy/hx6dRMww7DQKBG4dDNyNj+Lat6RPgKIqthk7yr5S87erFiTEpvEVMzdd/FDb+GkZeUuW4JdCW3FcWbOpM4qe928lYSZQYXX6PZdyQxNAF/HEw4f086DLlaQmhiu2cBubHr7i6873P+KwUXaMHO9bNeHlRakciEu+8hCpy5S4DM+b7J+9HCS+CIZsh0m+heS9Etxa6e6lF4jJBpMJ0/xSkYaGkAz7Y/QCL1Z+qB/nuf5jLHmYaLW0NTtQA2OyFfK9HfE3wyqyH31DUS1xpkK2qp4q8PNwpOmscR79i8TimwcaH+xG5k2RKXV/ 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);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Feb 2024 07:32:41.0312 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 525ae2a7-1f68-40b8-eaaa-08dc38f89cb1 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: BL6PEPF0001AB4C.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4068 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. 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 5cad11369697..e1bcd9e80ab9 100644 --- a/drivers/platform/x86/amd/pmf/pmf.h +++ b/drivers/platform/x86/amd/pmf/pmf.h @@ -85,6 +85,7 @@ #define MAX_OPERATION_PARAMS 4 #define PMF_IF_V1 1 +#define PMF_IF_V2 2 struct sbios_hb_event_v2 { u16 size; @@ -224,6 +225,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; @@ -264,6 +273,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; @@ -285,6 +298,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; @@ -634,6 +657,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..e4bf685269bd 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 (mode) { + 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 Thu Feb 29 07:32:06 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: 13576781 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2072.outbound.protection.outlook.com [40.107.94.72]) (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 66A1D44C9B for ; Thu, 29 Feb 2024 07:32:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709191967; cv=fail; b=X8HTDzG1F7bRo8l76TPyWiHyHtzo87rClECL5fID30KKOKZojJi5NKU0SutzgvCEhcy1zdCFzoky7SLCC3WQ/mAdbz2noOEAOVVeKExdzpcmyRjRViPCbo/Ved9fBqbdnZC5Konp9HMtQKeli8/20c49aoYrGxD8eCtPxscBAuc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709191967; c=relaxed/simple; bh=PwGRLdWHigoHA24gwaEZLchGKDQq6iHZlwabxqs3/hs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=EzyVcBWZ8HpA9yyly7GwozzQGKZTyC/Fi2PxBelPNl3n5pLIlGFZlLL4JLAho85LpVXkDTE5lO0AoZP7frJ2MfajDt088iv6ujD9u910N9DhrnUxYCEDWlD1+inTZRy7kKH2oaYNJC9w/MdbqSxNbtELeE7DS0m4cNExsOwhaG0= 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=P566t3fh; arc=fail smtp.client-ip=40.107.94.72 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="P566t3fh" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RE/srVadtgB5FLME/ygnVfHIIRLxrGTcbGBc9Lz2E2FcvksoURlA9A1CPzvf4zdrZF+RwmQU8zR+d3Awy+Y5de/FWxFJCemCfqeWgXDzCzI4zkm3qjyA10KBXvG9ymAtId/6y/tvAaZeuGFZ/BsvdgauZAz64yY7Kil+9nCfVlDD963Z77YoK+yJnW2Q2xsUN8pWR2jFmCHMXQf8Ngm6AlzQgoN3c+Q3aVRt6QrlgTB6t7aje9a18pc3VpwlwE55G99l5dlji09MXyT8ClcVUbYc4cMWf30xSQ4mLg34RPaCrweh5Cw7JhhEWpjm63DfHl6sXmxHsVc5kV5vAA/zWg== 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=2YUI+VwLJruWbbXw/VNfGIFTQup/2Zoq6856nzyrlQU=; b=Tw/3dulIJYwpweLp8k9uocyNuUzl6QTiaH0Juklmaer5Ed4e5E1f+ld5328XBXnZQAL3yZQS1WLihM6coOA1twOR2gMFGi+7LwLFolYQoITg2vIE/izi+D/AAAgIJtEQK7OsdjbPNSbRFZfbN7n7HhLqD+tvgl4Znq9pUxz8Wc3aTmZ+FVD9ORF8yeTqv6zWmiITVy+DD/5sMo+7uHK/TBQ5J7Lp9jNDpSwxQwLP2GNH3QzV8MNjvYdO6NL7ZLrF9sB0MCVbsW0SCi9jWOzfw30lm+EI3jMmCfJfOfKvfPWcdyFWobEhUN+jJDRc9okgrxcJHvkB3z9+DqcXC241vw== 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=2YUI+VwLJruWbbXw/VNfGIFTQup/2Zoq6856nzyrlQU=; b=P566t3fhqNg5tFf1Me1yia485TT0DD+Nb71EIf3Z/Qy9It0Lu7arnCrOYQePLwsYG80V3Ee+kaIryrae1hlWRwuW16JEdmfVk3y+iqkc4NSb8vX3GOymAxlHRpj/wf5HxGPgUU9bXV9vqH/7pkt3tS5t78ZgPHIYn+RSQSDZy4A= Received: from BL1P222CA0029.NAMP222.PROD.OUTLOOK.COM (2603:10b6:208:2c7::34) by CH3PR12MB9251.namprd12.prod.outlook.com (2603:10b6:610:1bd::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.36; Thu, 29 Feb 2024 07:32:43 +0000 Received: from BL6PEPF0001AB4C.namprd04.prod.outlook.com (2603:10b6:208:2c7:cafe::3e) by BL1P222CA0029.outlook.office365.com (2603:10b6:208:2c7::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.28 via Frontend Transport; Thu, 29 Feb 2024 07:32: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 BL6PEPF0001AB4C.mail.protection.outlook.com (10.167.242.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7292.25 via Frontend Transport; Thu, 29 Feb 2024 07:32:43 +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; Thu, 29 Feb 2024 01:32:40 -0600 From: Shyam Sundar S K To: , CC: , , "Shyam Sundar S K" Subject: [PATCH v2 6/7] platform/x86/amd/pmf: Add support to get sps default APTS index values Date: Thu, 29 Feb 2024 13:02:06 +0530 Message-ID: <20240229073207.4092698-7-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240229073207.4092698-1-Shyam-sundar.S-k@amd.com> References: <20240229073207.4092698-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: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB4C:EE_|CH3PR12MB9251:EE_ X-MS-Office365-Filtering-Correlation-Id: 0433c8fd-8a46-4a51-c8ae-08dc38f89df3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9hTfVSnCwDrJwM+yyB82ba2le9GMxl14glz+pfKR3OtFksqnSPIhJmhpzWgy5V9+G8cz94OorAESOTePz2Ki/CAiIkSY/RkSbC6ICejJN8EQ6Tfr+zrZ9nKku4WOQmGBkADzoDnaxz6LhKdFX78qGvBVpjbsoEVt6H+V+OU4CncUKoV258K1xxsYvhzWTXkRHIZGL/N2IAR0vBCfW+AjnzE8KcQX9QDB7/qPghL/d90Ivs963Cyeiy4bMbjyDy3dqDRyYsqveTjSg2q4UVyyHczCDZ+Jq7o0DTJ8wetxkgXutINGm5zJDBihz5hkebKOcVbOjeOLrLxXbIrMO9EIiWprXiyh2E7gf/1hbmnkSR+RHdlVrFCjnJf9zIYlNTxIWFdk3zm62hn5/a2MICFyKDg6h51v/LxRS3kofptwQ6b8/ED9+rHqcs8YUzjGgfpzF1vd3Z8Lt/FUTL0KZIIaPVMdrk5MWRP3iPYeHgUtbhfClJKJ0a+lJYMQXudI7CrBclX6+zBDWOVNNTqMyYo1/Haxv1OPTOk+It74LJP1c+oTRcwslI7N4I/2vB226BiLysbvfeaFCRk/bnQYqUNriZXbqlJVtAN5lUVXGDIbhsqZKrAsig//7zpSGDs0N+nw+vyuvu2bQaANcCYnwTe2/sjYBW5e6qDZjavNLEH9RaSobZSSf1vE0iu9tzdDkPBIM4EbOcnAyAj3UWiA1NnCaDEISdcHL5JSH5acAa67zkYMt083QSUwZMbA8PVUvNAb 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);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Feb 2024 07:32:43.1405 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0433c8fd-8a46-4a51-c8ae-08dc38f89df3 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: BL6PEPF0001AB4C.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB9251 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 e1bcd9e80ab9..2d0601897f4a 100644 --- a/drivers/platform/x86/amd/pmf/pmf.h +++ b/drivers/platform/x86/amd/pmf/pmf.h @@ -87,6 +87,29 @@ #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; @@ -659,6 +682,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 e4bf685269bd..4683b0e6323c 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 Thu Feb 29 07:32:07 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: 13576782 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2072.outbound.protection.outlook.com [40.107.102.72]) (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 A576844C9B for ; Thu, 29 Feb 2024 07:32:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.102.72 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709191971; cv=fail; b=OeNrqsdqJsx3lnLehDWAIKkoQp5L/Jluzn0iS+H/w8C8Cu1NHkRhVkYHHM3uhWlfwCE9W63GPD4qm+U9l5pFLHaYbYJNAw0CM+qXY6lj6xH6ecNtKBZV/ktSY5e2qCMhXYC72m1UqoeM37HbXANl/zGwu3n+sjeLqegZmr6T/Kg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709191971; c=relaxed/simple; bh=bA0648WVEr2bBaWaDgz0cdWi6INH8m1hGyk+HkASNE4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Od98Ak1QLsGP0+EpkpbCqGumdGDaut+N4QeFkxK69iTmoPiT+vLkiD9hnPIoTDpJj4CqctWuQ/BeXTZCs2VuHbuxVwcGWjMJDrlqwWbf8V2Va1NPUyLebPd84a3iJydpouarEri64eJK1UJ+YuijKsLytT11AOvfR0hz7dlu4Hs= 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=iVKEZFyn; arc=fail smtp.client-ip=40.107.102.72 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="iVKEZFyn" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Nr26q6eBfsG8RdoUERKKnrVWbGfW1j+ndJPEc2QgAvrWO9a9wPgIIeRDmJZUnmviWkBKXi4GZL9unbtpM7WgaVvNe4bndgDidmNfVYXdS9SSX0+4m6P58LVklSjqasVqMxx3Ovx/+1yEBEtI4BBAG1lyYdnwKE26CdX1aqX7A4qKT4i5R5kmhE15ktBHIf3Pr3L7w53bzL0oUzKNKnTj+CyyvUZy2Y2Kl2wB495xB2Qm9Yet/UcIfDX+EodheGMQ00L650k1tx0yrU+KveZIw9S/kzr+yNwLErlkuCQPkqc5Ezrea0PCoGhcgdn8N5YUTRwmNKf9ZQIB8yQXgSJ4Iw== 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=7Ep+J25dw9DnIeiAX4PGnorlEO+HgYlcGea90kfnoDs=; b=Q1/F2FxllCZymA1nz1hsszd25QBsWPk9K8Z0/2R7DCIxdin9wthp0tP2dCoXi6a/DwkvHRg1RxC9CRiR8vqcMS/6z+VijathSCB7va2um0etHWvUx0nSYjSXKGIorZCr+NoJMXr5FkPRwuMmlag7lp+adTth1eMUUOf9E70IbBdTvB0WIDKvKFZrSNDrgo0NJpXjZkiks4z4Bsm0aKGlCh9RaUmKaIeEJlO7Il6seUfChSpiAtGDn5WyndYNoNmr4Q4jjUmIYezkCtBjQNvguR85HcPePVAiI8tlG7rsttayPksxQG6QTTgnFuKEp9L5bhnk0Omt0DqtoruGbxRHqw== 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=7Ep+J25dw9DnIeiAX4PGnorlEO+HgYlcGea90kfnoDs=; b=iVKEZFynSMXTZOLAleX6GpvdoJleq86VxdyQot3DPSK8m5eCUr17eXBUk/qPd257SMZzab7qu2l5qbC7CycvgzNUruBlEqFFcWxquk9dT4NCBGLB2MEGqmNJpigdW5Xa1TEM/Z3qz28ksklwbT3Nd2AbWOhXdmb9fYWotGOPASI= Received: from BL1P222CA0010.NAMP222.PROD.OUTLOOK.COM (2603:10b6:208:2c7::15) by PH8PR12MB7350.namprd12.prod.outlook.com (2603:10b6:510:216::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.41; Thu, 29 Feb 2024 07:32:46 +0000 Received: from BL6PEPF0001AB4C.namprd04.prod.outlook.com (2603:10b6:208:2c7:cafe::74) by BL1P222CA0010.outlook.office365.com (2603:10b6:208:2c7::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7339.32 via Frontend Transport; Thu, 29 Feb 2024 07:32: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 BL6PEPF0001AB4C.mail.protection.outlook.com (10.167.242.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7292.25 via Frontend Transport; Thu, 29 Feb 2024 07:32:45 +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; Thu, 29 Feb 2024 01:32:43 -0600 From: Shyam Sundar S K To: , CC: , , "Shyam Sundar S K" Subject: [PATCH v2 7/7] platform/x86/amd/pmf: Update sps power thermals according to the platform-profiles Date: Thu, 29 Feb 2024 13:02:07 +0530 Message-ID: <20240229073207.4092698-8-Shyam-sundar.S-k@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240229073207.4092698-1-Shyam-sundar.S-k@amd.com> References: <20240229073207.4092698-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: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB4C:EE_|PH8PR12MB7350:EE_ X-MS-Office365-Filtering-Correlation-Id: 797ffab4-b9b9-4891-8cfc-08dc38f89fbd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Lgc1P1kk4uZZ7IOjmMrwWRbjswnNZNb8ForEmFViuPCKtG1CIi2VzVWu2Ko611JUO4fchbEKEphtq7rLW8h+eMVstiAhOKSEoVI3tYhpiB49fuwD2O7rJMo+JJUN9C5ss5bFANFZTWx6/AvH7U/3MBGjv2SCgURrghlRey5ALmmHUo0uPqSfRSqi6vYLnhaPaTjtY+vw80MwgCESYhwONQ6fXhESstIzryJgTB2jUphn+vQMnJ2arnVlknpmBzUskdvh9wN+IYZi0RdLY9+5mbQrgF0v+vWWlcC8Oyi/LVN6VpBa+XNMCf3cM/T+eiM/71ptEgjQG88bEJW2y8NuizftmGHbQMb1EXNWBKpeEhP8BgZ/WAGYnGe7LBxFCqFNaWW9O7X1OkBtHwBhgY4jGvJsmniaKHWfL5ZvEJ73gjO6E2Y8hfhl0mU8kylOJk0o1mkAjKC5SL6vw2DZ3ka2kdSzJ0hJDbET/Sz0E/exDekLdHqXAdG6WuCo0YkCUewNOaBR7HW3n1Ydyh8vMPh0gQAZeJah5+YUWH5vgrYc36Zbl9sfxn1znjpApSDGqN5fpLFV5Su/bqESYkAZM5HLHGfOlps8qn3Ur7vrh7RNWDU4CQxHOo83R1BvSYdYJMgVVm9P+2rUfC3IOly2t/Dyt6cSeqT0FNCQX1KaebFhg2WuE5740x36NLPjHm2bWkCaU6jIc0CZMk0al8jeoSQulH1y2H5wt5gHvfT9s8LmElZXzL35WLvZfKL+VEwXn2En 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);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Feb 2024 07:32:45.5937 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 797ffab4-b9b9-4891-8cfc-08dc38f89fbd 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: BL6PEPF0001AB4C.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7350 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 2d0601897f4a..c95e43077c03 100644 --- a/drivers/platform/x86/amd/pmf/pmf.h +++ b/drivers/platform/x86/amd/pmf/pmf.h @@ -51,6 +51,8 @@ #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 4683b0e6323c..9cab4e8bace2 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;