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: <8124a8f7-23c0-4773-aec2-0a3f70ee7e11@linaro.org>
Date: Mon, 5 Feb 2024 12:03:28 +0100
From: Krzysztof Kozlowski <krzysztof.kozlowski@...aro.org>
To: Peter Griffin <peter.griffin@...aro.org>
Cc: arnd@...db.de, linux@...ck-us.net, wim@...ux-watchdog.org,
 alim.akhtar@...sung.com, jaewon02.kim@...sung.com,
 semen.protsenko@...aro.org, kernel-team@...roid.com,
 tudor.ambarus@...aro.org, andre.draszik@...aro.org, saravanak@...gle.com,
 willmcvicker@...gle.com, linux-fsd@...la.com,
 linux-watchdog@...r.kernel.org, devicetree@...r.kernel.org,
 linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
 linux-samsung-soc@...r.kernel.org
Subject: Re: [PATCH v2 1/2] soc: samsung: exynos-pmu: Add regmap support for
 SoCs that protect PMU regs

On 01/02/2024 12:29, Peter Griffin wrote:
>>>       int ret;
>>>
>>>       pmu_base_addr = devm_platform_ioremap_resource(pdev, 0);
>>> @@ -137,6 +333,35 @@ static int exynos_pmu_probe(struct platform_device *pdev)
>>>                       GFP_KERNEL);
>>>       if (!pmu_context)
>>>               return -ENOMEM;
>>> +
>>> +     res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>> +     if (!res)
>>> +             return -ENODEV;
>>> +
>>> +     pmuregmap_config.max_register = resource_size(res) -
>>> +                                  pmuregmap_config.reg_stride;
>>> +
>>> +     if (of_device_is_compatible(np, "google,gs101-pmu")) {
>>
>> No compatibles inside the probe. Use driver match data. This applies to
>> all drivers in all subsystems.
> 
> Noted, will fix in v3.
> 
>>
>>> +             pmuregmap_config.reg_read = tensor_sec_reg_read;
>>> +             pmuregmap_config.reg_write = tensor_sec_reg_write;
>>> +             pmuregmap_config.reg_update_bits = tensor_sec_update_bits;
>>
>> No, regmap_config should be const and please use match data.
> 
> Are you sure you want the regmap_config struct const?
> 
> In my draft v3 I have implemented it so far having a regmap_smccfg
> struct which sets all the configuration apart from max_register field
> (used by gs101) and a regmap_mmiocfg struct (used by all other
> exynos-pmu SoCs). The choice over which regmap_config to register is
> made via match data exynos_pmu_data flag 'pmu_secure' which is set
> only for gs101. That avoids having to define exynos_pmu_data structs
> for the other exynos SoCs that currently don't really need them
> (exynos7, exynos850, exynos5443, exyno5410 etc).
> 
> But I still wish to set at runtime the regmap_config.max_register
> field based on the resource size coming from DT. Having the structs
> const would prohibit that and mean we need to specify many more
> regmap_config structs where the only difference is the max_register
> field.
> 
> Is the above approach acceptable for you?

Having it non-const is one more step of supporting only one instance of
PMU device, but we already rely on such design choice, so I guess it is
fine. If ever needed, this can be easily converted to devm_kmemdup...


Best regards,
Krzysztof


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ