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-next>] [day] [month] [year] [list]
Message-ID: <741c1e35-648d-4c2f-a939-24bcbec93911@linaro.org>
Date:   Thu, 24 Aug 2023 10:27:59 +0200
From:   Neil Armstrong <neil.armstrong@...aro.org>
To:     Xianwei Zhao <xianwei.zhao@...ogic.com>,
        devicetree@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-amlogic@...ts.infradead.org, linux-kernel@...r.kernel.org
Cc:     Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Conor Dooley <conor+dt@...nel.org>,
        Kevin Hilman <khilman@...libre.com>
Subject: Re: [PATCH V2 2/6] soc: amlogic: add driver to support power parent
 node

Hi,

On 24/08/2023 07:59, Xianwei Zhao wrote:
> From: "xianwei.zhao" <xianwei.zhao@...ogic.com>
> 
> Some power domains depends on other domains, Such as Amlogic T7 SoC.
> Add parent node to support this case.
> 
> Signed-off-by: xianwei.zhao <xianwei.zhao@...ogic.com>
> ---
> V1 -> V2: None
> ---
>   drivers/genpd/amlogic/meson-secure-pwrc.c | 26 ++++++++++++++++++++++-
>   1 file changed, 25 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/genpd/amlogic/meson-secure-pwrc.c b/drivers/genpd/amlogic/meson-secure-pwrc.c
> index 5ac2437ab8ad..76527f4946b4 100644
> --- a/drivers/genpd/amlogic/meson-secure-pwrc.c
> +++ b/drivers/genpd/amlogic/meson-secure-pwrc.c
> @@ -19,10 +19,12 @@
>   
>   #define PWRC_ON		1
>   #define PWRC_OFF	0
> +#define PWRC_NO_PARENT  ((1UL << (sizeof(unsigned int) * 8)) - 1)

This is fishy, just use UINT_MAX

>   
>   struct meson_secure_pwrc_domain {
>   	struct generic_pm_domain base;
>   	unsigned int index;
> +	unsigned int parent;
>   	struct meson_secure_pwrc *pwrc;
>   };
>   
> @@ -34,6 +36,7 @@ struct meson_secure_pwrc {
>   
>   struct meson_secure_pwrc_domain_desc {
>   	unsigned int index;
> +	unsigned int parent;
>   	unsigned int flags;
>   	char *name;
>   	bool (*is_off)(struct meson_secure_pwrc_domain *pwrc_domain);
> @@ -90,8 +93,19 @@ static int meson_secure_pwrc_on(struct generic_pm_domain *domain)
>   {						\
>   	.name = #__name,			\
>   	.index = PWRC_##__name##_ID,		\
> -	.is_off = pwrc_secure_is_off,	\
> +	.is_off = pwrc_secure_is_off,		\
>   	.flags = __flag,			\
> +	.parent = PWRC_NO_PARENT,		\
> +}
> +
> +#define TOP_PD(__name, __flag, __parent)	\
> +[PWRC_##__name##_ID] =				\
> +{						\
> +	.name = #__name,			\
> +	.index = PWRC_##__name##_ID,		\
> +	.is_off = pwrc_secure_is_off,		\
> +	.flags = __flag,			\
> +	.parent = __parent,			\
>   }
>   
>   static struct meson_secure_pwrc_domain_desc a1_pwrc_domains[] = {
> @@ -202,6 +216,7 @@ static int meson_secure_pwrc_probe(struct platform_device *pdev)
>   
>   		dom->pwrc = pwrc;
>   		dom->index = match->domains[i].index;
> +		dom->parent = match->domains[i].parent;
>   		dom->base.name = match->domains[i].name;
>   		dom->base.flags = match->domains[i].flags;
>   		dom->base.power_on = meson_secure_pwrc_on;
> @@ -212,6 +227,15 @@ static int meson_secure_pwrc_probe(struct platform_device *pdev)
>   		pwrc->xlate.domains[i] = &dom->base;
>   	}
>   
> +	for (i = 0; i < match->count; i++) {
> +		struct meson_secure_pwrc_domain *dom = pwrc->domains;
> +
> +		if (!match->domains[i].name || match->domains[i].parent == PWRC_NO_PARENT)
> +			continue;
> +
> +		pm_genpd_add_subdomain(&dom[dom[i].parent].base, &dom[i].base);
> +	}
> +
>   	return of_genpd_add_provider_onecell(pdev->dev.of_node, &pwrc->xlate);
>   }
>   

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ