lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ce42149f-d92a-4f54-bff5-6ee9adbf0c19@amd.com>
Date: Tue, 27 Aug 2024 12:23:11 -0500
From: Mario Limonciello <mario.limonciello@....com>
To: Perry Yuan <perry.yuan@....com>, hdegoede@...hat.com,
 ilpo.jarvinen@...ux.intel.com, Borislav.Petkov@....com,
 kprateek.nayak@....com
Cc: Alexander.Deucher@....com, Xinmei.Huang@....com,
 bharathprabhu.perdoor@....com, poonam.aggrwal@....com, Li.Meng@....com,
 platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org,
 Xiaojian.Du@....com
Subject: Re: [PATCH 09/11] platform/x86/: hfi: add power management callback

On 8/27/2024 04:36, Perry Yuan wrote:
> From: Perry Yuan <Perry.Yuan@....com>
> 
> 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.
> 
> Signed-off-by: Perry Yuan <Perry.Yuan@....com>
Reviewed-by: Mario Limonciello <mario.limonciello@....com>
> ---
>   drivers/platform/x86/amd/hfi/hfi.c | 34 ++++++++++++++++++++++++++++++
>   1 file changed, 34 insertions(+)
> 
> diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/hfi/hfi.c
> index 57b642c4c522..c3da2edf8590 100644
> --- a/drivers/platform/x86/amd/hfi/hfi.c
> +++ b/drivers/platform/x86/amd/hfi/hfi.c
> @@ -304,6 +304,39 @@ static void amd_hfi_remove(struct platform_device *pdev)
>   	mutex_destroy(&dev->lock);
>   }
>   
> +static int amd_hfi_pm_resume(struct device *dev)
> +{
> +	int cpu, err;
> +
> +	for_each_present_cpu(cpu) {
> +		err = amd_hfi_set_state(cpu, true);
> +		if (err < 0) {
> +			dev_err(dev, "failed to enable workload class config: %d\n", err);
> +			return err;
> +		}
> +	}
> +
> +	return 0;
> +}
> +
> +static int amd_hfi_pm_suspend(struct device *dev)
> +{
> +	int err, cpu;
> +
> +	for_each_possible_cpu(cpu) {
> +		err = amd_hfi_set_state(cpu, false);
> +		if (err < 0) {
> +			dev_err(dev, "failed to disable workload class config: %d\n", err);
> +			return err;
> +		}
> +	}
> +
> +	return 0;
> +}
> +
> +static DEFINE_SIMPLE_DEV_PM_OPS(amd_hfi_pm_ops,
> +		amd_hfi_pm_suspend, amd_hfi_pm_resume);
> +
>   static int amd_set_hfi_ipcc_score(struct amd_hfi_cpuinfo *hfi_cpuinfo, int cpu)
>   {
>   	int i, *hfi_scores;
> @@ -569,6 +602,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,


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ