From patchwork Sat Nov 30 14:06:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 846867 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2067.outbound.protection.outlook.com [40.107.223.67]) (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 ACCC51AAE24; Sat, 30 Nov 2024 14:08:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.67 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732975683; cv=fail; b=M9X7Svz3w1KNiIMwncbwzaxslRQJPEKYpjPXECbpqmurbNFxM+sMgpX3+8HHuCCcqw8YXc2IjCLGTPgDXkYzKEB0SxqT7zij+5zbpGsWA/+96nyDvLfd2dhKq+FAcNPCVXsSSstXIIZfDZpDF5ML7Th0tzmmTHwICb8dLqkLXwY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732975683; c=relaxed/simple; bh=IOvZRKAPWNZC84/xYTtOAnd86sJc053Z0HhsqFxH+/c=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=d7NKq11233XsCOlbFZWfUsXCsz2hxJGWHyYvD/dk1JC7rtcEJRjsBTp8SolJLzUlZVeH5h8sigTMhovYyxycb7C5i0k4vrZzq51KSD/1u7nY/IUivJNVOnQw+czH5N84QHLPsDTCajlrZ+sV/f/Z+R8EoSNuXWbOnSaBw8nk3c0= 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=isD6464r; arc=fail smtp.client-ip=40.107.223.67 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="isD6464r" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=RWpY9YiPFhzFyZz6SsUiJQCkGGbrgbfHCXIRrDsLHRjgiU1UgwtQ1x9bsvJCJUuES9G3Gc7qiQgTUqZtkr3E9pzmsVBqEmPUpYTcw4A5Gr930ekkWB08OD1/bn+WCDGh8iG5cs6L3ng/3yvpX5IzfQ3u2NRjtxtc7IGaz1UvV6HeU9wm9NQWlOAhwilkUPCkpC1kRypu3C85VwtKd+tNT9M8ic/sKAutWQ1GpO/NbhJxoFSl7a+i+V0CgEGsjarUmPp/RGRB8J7hmQb++OAcYCGeKpVbCa1yIcJid5/aTsXbnIOb89UcDa4gm+Qor6vDhmwbAEHRIJz1cZ3Z+yK7Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=9rQuoDc8UaCkJTYhrzlrm3g5L3+wEqX60J51gCi0g+c=; b=BUHlwp59lrO2NEi3MvMvhD2ULF6jycDBsIFPXqkt8CkWqhM0A2nVrjBzGPUHU0cQs6T/b/kcg5j3cIhfLDrCoawu5HqvuSnUM67TCaSI3Trtjg6jUT5DV0W5xu3Rbqsb4NNOGWq+gkmiUbpLQ1kIlpWZGa4dZFLnBXIGtFMULP99X/dt4eGnjC/mXAEX8eRYEvEvMVvTT1dQ/Aat+G/IH5tTu6jUPwvEzVhkf1F5QleFmhhFM5Pwf0Y3QQmCuM0u98ze1/CilDVDVHNoHiP0Te0/9oMqCeMd9x7Xy9tvxoPsuv6VkjVy+m2LcF93S9Vtz5pITwedD50eCaE0Vc0Ofw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=alien8.de 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=9rQuoDc8UaCkJTYhrzlrm3g5L3+wEqX60J51gCi0g+c=; b=isD6464rh4xxaNLI9TJ/3ImFvE3laZYB7lw269Knf9zUXV42bYibLCg9vcFk3PRcIQ26io/wQDkEcBPhpuFY0tDZ5exRtYLP6cIOlMbIQPRJkLqQVRx0hwQHefdbb5HkBzRl2s/Bq4vtdKyTH9vK8xaf3jFnL9DGenZ90aMsgxs= Received: from SN6PR04CA0081.namprd04.prod.outlook.com (2603:10b6:805:f2::22) by CH3PR12MB8329.namprd12.prod.outlook.com (2603:10b6:610:12e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Sat, 30 Nov 2024 14:07:54 +0000 Received: from SA2PEPF000015CC.namprd03.prod.outlook.com (2603:10b6:805:f2:cafe::81) by SN6PR04CA0081.outlook.office365.com (2603:10b6:805:f2::22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8207.14 via Frontend Transport; Sat, 30 Nov 2024 14:07:54 +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 SA2PEPF000015CC.mail.protection.outlook.com (10.167.241.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8230.7 via Frontend Transport; Sat, 30 Nov 2024 14:07:54 +0000 Received: from AUS-P9-MLIMONCI.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.39; Sat, 30 Nov 2024 08:07:52 -0600 From: Mario Limonciello To: Borislav Petkov CC: Thomas Gleixner , Ingo Molnar , "Dave Hansen" , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "H . Peter Anvin" , "Rafael J . Wysocki" , "Gautham R . Shenoy" , Mario Limonciello , Perry Yuan , Brijesh Singh , Peter Zijlstra , Li RongQing , "open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , "open list:ACPI" , "open list:AMD PSTATE DRIVER" , Pawan Gupta , Perry Yuan Subject: [PATCH v7 08/12] platform/x86: hfi: add power management callback Date: Sat, 30 Nov 2024 08:06:59 -0600 Message-ID: <20241130140703.557-9-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241130140703.557-1-mario.limonciello@amd.com> References: <20241130140703.557-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-pm@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: SA2PEPF000015CC:EE_|CH3PR12MB8329:EE_ X-MS-Office365-Filtering-Correlation-Id: 59a76525-df0e-4b74-1e6c-08dd1148626e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 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8fLf02eWUTHkxt/4fOKqWw8cXPZn2swmuC65CUqmcROaBLVtBqbSos3Y4Ml0ZaaO5jdZGhe4BVUtbHcbjtZdWEHzHSWdFxyxYsn6YZ7YN/pfIIKj6Nvqqk0s5C07ZkHy+pXT0UTVAV2sBxwnMkmsTr1tG19yxUnHWRKbFGcFWRGDry0Poj689VCYfRGfmAG+4KJZEZd18z+DOkdx9rZ0bvHipIFSvystHuIKORVb78/Yf6s9BbkjXjSF5Xr3RmYSdhbYmPR8zztpqHRBsqCu1CPS5t/f3ZJz9Z+FVUgMalgj2Td/Asbsh4FjN/AymC3qJv5QL7rCupfq3VL73OB8TB6ddV9nvTMd5XGLCd7RWFAyGstVSU9TtTMZ894wl+fVTEGQk3je6kVVA5v0en0br5kbxZDys+VpKyW0sxnUX38xklgVRkpzy9IKk05LaBWMi9u9Ww7qpCPi5URIwSFOckOO2xA2KF 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:(13230040)(82310400026)(376014)(7416014)(36860700013)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2024 14:07:54.2398 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 59a76525-df0e-4b74-1e6c-08dd1148626e 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: SA2PEPF000015CC.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8329 From: Perry Yuan Introduces power management callbacks for the `amd_hfi` driver. Specifically, the `suspend` and `resume` callbacks have been added to handle the necessary operations during system low power states and wake-up. Reviewed-by: Gautham R. Shenoy Signed-off-by: Perry Yuan Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello --- drivers/platform/x86/amd/hfi/hfi.c | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/hfi/hfi.c index 922a9ff0d447a..80ccc50ee0914 100644 --- a/drivers/platform/x86/amd/hfi/hfi.c +++ b/drivers/platform/x86/amd/hfi/hfi.c @@ -380,6 +380,38 @@ static int amd_hfi_metadata_parser(struct platform_device *pdev, return ret; } +static int amd_hfi_pm_resume(struct device *dev) +{ + int ret, cpu; + + for_each_online_cpu(cpu) { + ret = amd_hfi_set_state(cpu, true); + if (ret < 0) { + dev_err(dev, "failed to enable workload class config: %d\n", ret); + return ret; + } + } + + return 0; +} + +static int amd_hfi_pm_suspend(struct device *dev) +{ + int ret, cpu; + + for_each_online_cpu(cpu) { + ret = amd_hfi_set_state(cpu, false); + if (ret < 0) { + dev_err(dev, "failed to disable workload class config: %d\n", ret); + return ret; + } + } + + return 0; +} + +static DEFINE_SIMPLE_DEV_PM_OPS(amd_hfi_pm_ops, amd_hfi_pm_suspend, amd_hfi_pm_resume); + static const struct acpi_device_id amd_hfi_platform_match[] = { {"AMDI0104", 0}, { } @@ -428,6 +460,7 @@ static struct platform_driver amd_hfi_driver = { .driver = { .name = AMD_HFI_DRIVER, .owner = THIS_MODULE, + .pm = &amd_hfi_pm_ops, .acpi_match_table = ACPI_PTR(amd_hfi_platform_match), }, .probe = amd_hfi_probe,