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: <ce69a49d-6221-458d-b0e5-0f3507f1aeac@samsung.com>
Date: Tue, 21 Jan 2025 22:42:05 +0100
From: Michal Wilczynski <m.wilczynski@...sung.com>
To: Krzysztof Kozlowski <krzk@...nel.org>
Cc: mturquette@...libre.com, sboyd@...nel.org, robh@...nel.org,
	krzk+dt@...nel.org, conor+dt@...nel.org, drew@...7.com, guoren@...nel.org,
	wefu@...hat.com, jassisinghbrar@...il.com, paul.walmsley@...ive.com,
	palmer@...belt.com, aou@...s.berkeley.edu, frank.binns@...tec.com,
	matt.coster@...tec.com, maarten.lankhorst@...ux.intel.com,
	mripard@...nel.org, tzimmermann@...e.de, airlied@...il.com, simona@...ll.ch,
	ulf.hansson@...aro.org, jszhang@...nel.org, p.zabel@...gutronix.de,
	m.szyprowski@...sung.com, linux-clk@...r.kernel.org,
	devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-riscv@...ts.infradead.org, dri-devel@...ts.freedesktop.org,
	linux-pm@...r.kernel.org
Subject: Re: [RFC v3 05/18] pmdomain: thead: Add power-domain driver for
 TH1520



On 1/21/25 11:02, Krzysztof Kozlowski wrote:
> On Mon, Jan 20, 2025 at 06:20:58PM +0100, Michal Wilczynski wrote:
>> The T-Head TH1520 SoC contains multiple power islands that can be
>> programmatically turned on and off using the AON (Always-On) protocol
>> and a hardware mailbox [1]. The relevant mailbox driver has already been
>> merged into the mainline kernel in commit 5d4d263e1c6b ("mailbox:
>> Introduce support for T-head TH1520 Mailbox driver");
>>
>> This commit introduces a power-domain driver for the TH1520 SoC, which
> 
> Please do not use "This commit/patch/change", but imperative mood. See
> longer explanation here:
> https://protect2.fireeye.com/v1/url?k=2123f702-40a8e22d-21227c4d-74fe485cbfe7-afb876722bdc8fc5&q=1&e=e5dabc89-5f0c-4819-9008-76faafc3c1bc&u=https%3A%2F%2Felixir.bootlin.com%2Flinux%2Fv5.17.1%2Fsource%2FDocumentation%2Fprocess%2Fsubmitting-patches.rst%23L95
> 
>> is using AON firmware protocol to communicate with E902 core through the
>> hardware mailbox. This way it can send power on/off commands to the E902
>> core.
> 
> ...
> 
>> diff --git a/drivers/pmdomain/thead/Makefile b/drivers/pmdomain/thead/Makefile
>> new file mode 100644
>> index 000000000000..adfdf5479c68
>> --- /dev/null
>> +++ b/drivers/pmdomain/thead/Makefile
>> @@ -0,0 +1,2 @@
>> +# SPDX-License-Identifier: GPL-2.0-only
>> +obj-$(CONFIG_TH1520_PM_DOMAINS)		+= th1520-pm-domains.o
>> diff --git a/drivers/pmdomain/thead/th1520-pm-domains.c b/drivers/pmdomain/thead/th1520-pm-domains.c
>> new file mode 100644
>> index 000000000000..d913ad40fb76
>> --- /dev/null
>> +++ b/drivers/pmdomain/thead/th1520-pm-domains.c
>> @@ -0,0 +1,174 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/*
>> + * Copyright (C) 2021 Alibaba Group Holding Limited.
>> + * Copyright (c) 2024 Samsung Electronics Co., Ltd.
>> + * Author: Michal Wilczynski <m.wilczynski@...sung.com>
>> + */
>> +
>> +#include <linux/firmware/thead/thead,th1520-aon.h>
>> +#include <linux/slab.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/pm_domain.h>
>> +
>> +#include <dt-bindings/firmware/thead,th1520-aon.h>
> 
> So here it is used... I don't understand why power domain is under
> firmware. Please move it to proper directory and name the file exactly
> the same as bindings doc which this belongs to.

The power-domain driver has no bindings doc. It's a child driver of the AON
node.

> 
> 
>> +
>> +struct th1520_power_domain {
>> +	struct th1520_aon_chan *aon_chan;
>> +	struct generic_pm_domain genpd;
>> +	u32 rsrc;
>> +};
>> +
>> +struct th1520_power_info {
>> +	const char *name;
>> +	u32 rsrc;
>> +};
>> +
>> +static const struct th1520_power_info th1520_pd_ranges[] = {
>> +	{ "vdec", TH1520_AON_VDEC_PD },
> 
> Why TH1520_AON_XXX aren't the indices?

These power-domain constants are defined by the AON firmware protocol,
which dictates the exact IDs (e.g., 1 for NPU). They are not just array
indices; we must use these specific values to communicate with the
firmware correctly. Using array indices starting with 1 would be
unusual.

> 
>> +	{ "npu", TH1520_AON_NPU_PD },
>> +	{ "venc", TH1520_AON_VENC_PD },
>> +	{ "gpu", TH1520_AON_GPU_PD },
>> +	{ "dsp0", TH1520_AON_DSP0_PD },
>> +	{ "dsp1", TH1520_AON_DSP1_PD }
>> +};
> 
> Best regards,
> Krzysztof
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ