Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plat-stm32mp1: remove registering to platform shared_resources driver #7169

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

etienne-lms
Copy link
Contributor

Since integration of the firewall framework in STM32MP1 platform drivers (mainly P-Rs #7066, #7102, #7107, #7108 and #7111), plat-stm32mp1/shared_resources.c driver is deprecated and needs to be removed.

This series removes the remaining calls to stm32mp_register_secure_xxx() and stm32mp_register_non_secure_xxx() platform functions from STM32 drivers. Once this P-R and P-R #7111 are both merged, we will be able to fully remove plat-stm32mp1/shared_resources.c source file.

* with status="okay" and secure-status="disabled" as IWDG assigned to
* non-secure world.
*/
if (!(fdt_get_status(fdt, node) & DT_STATUS_OK_SEC))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to manage this case. The firewall bus probe is already filtering out probe of non-secure peripherals, regardless of the secure-status.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to manage existing stm32mp15xx-dhcom-som.dtsi and stm32mp15xx-dhcor-som.dtsi based boards.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok but I don't know if it makes sense to support this. Maybe we should patch the DH and ST device trees and ask @jneuhauser to review?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this is not needed. IWDG driver is not probed for instances assigned to non-secure since implementation of stm32_etzpc.c driver (stm32_etzpc_dt_probe_bus()) so we don't need to check the status here. I'll simply remove this test.

} else {
stm32mp_register_secure_periph_iomem(iwdg->base.pa);

if (IS_ENABLED(CFG_WDT_SM_HANDLER)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, we don't support watchdog if we do not register it to the framework. We wouldn't want to start a wathcdog and never be able to ping it IMO

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. So you prefer we remove this condition and change the platform conf.mk to only enable CFG_STM32_IWDG when CFG_WDT_SM_HANDLER is enabled?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes or static assert? Whatever your choice

@@ -702,9 +687,7 @@ static TEE_Result initialize_pmic(const void *fdt, int pmic_node)
stm32mp_put_pmic();

if (dt_pmic_is_secure())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't fancy we rely of secure-status in dt_pmic_is_secure()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can address this in a dedicated P-R, it's out of the scope of this series that only intend to get rid of plat-stm32mp1/shared_resources.c.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've created #7172 to address that point.

@etienne-lms
Copy link
Contributor Author

I've addressed the current review comments and appended a minor commit to remove some deprecated useless lines in stm32_iwdg.c driver.

Copy link
Contributor

@GseoC GseoC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit drivers: stm32_iwdg: remove useless device list;
Missing end of "watchDOG" in commit message

* non-secure world.
*/
if (!(fdt_get_status(fdt, node) & DT_STATUS_OK_SEC))
if (!IS_ENABLED(CFG_WDT_SM_HANDLER)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to have a compile time restriction (static assert or rule in conf.mk) rather than a driver probing to do nothing. + we may face issue with firewall config when probing firewall bus without wanting to support this peripheral

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, i'll update plat-stm32mp*/conf.mk

@etienne-lms etienne-lms force-pushed the stm32-shres branch 3 times, most recently from 3bfa050 to 3ac0787 Compare December 11, 2024 15:26
@etienne-lms
Copy link
Contributor Author

I've updated the series (after few bad manipulations). @GseoC, may I squash the fixup commits?

@GseoC
Copy link
Contributor

GseoC commented Dec 12, 2024

Yes sure, please squash

Driver stm32_iwdg only aims at exposing an OP-TEE watchdog
service hence declare CFG_STM32_IWDG dependency on CFG_WDT and
CFG_WDT_SM_HANDLER in stm32mp1 platform configuration file.

Signed-off-by: Etienne Carriere <[email protected]>
Remove registering of STM32 IWDG driver to platform shared_resources
driver that is deprecated since integration of the firewall framework
in stm32mp1 platforms. Since this integration, OP-TEE only consider
IWDG secure instances hence remove the useless code for IWDG assigned
to non-secure world.

As watchdog drivers are only used when registering to OP-TEE watchdog
services (CFG_WDT_SM_HANDLER) simplify the code to always register
IWDG instance and assert CFG_WDT_SM_HANDLER is enabled when IWDG
driver is embedded.

Signed-off-by: Etienne Carriere <[email protected]>
STM32 watchdog driver does not manage several instances of IWDG hence
remove the useless code. To simplify code, remove stm32_iwdg_register()
local function.

Signed-off-by: Etienne Carriere <[email protected]>
Remove registering of STM32 RNG driver to shared_resources driver that
is deprecated since integration of the firewall framework and will soon
be removed.

Signed-off-by: Etienne Carriere <[email protected]>
Remove registering of STM32 UART driver to shared_resources driver that
is deprecated since integration of the firewall framework and will soon
be removed.

Signed-off-by: Etienne Carriere <[email protected]>
Remove registering of STM32 CRYP driver to shared_resources driver that
is deprecated since integration of the firewall framework and will soon
be removed.

Signed-off-by: Etienne Carriere <[email protected]>
Remove registering of STM32MP1 PMIC driver to shared_resources driver
that is deprecated since integration of the firewall framework and
will soon be removed.

Signed-off-by: Etienne Carriere <[email protected]>
@etienne-lms
Copy link
Contributor Author

Fixup commits squashed and series rebased.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants