Skip to content

Conversation

@GseoC
Copy link
Contributor

@GseoC GseoC commented Jan 9, 2026

This P-R adds a stm32 debug access PTA that allows the REE to check the debug configuration that is inaccessible to it. This will allow to use debug peripherals in the REE without unexpected errors or firewall exceptions.

Edit:
Link to kernel patchset

@GseoC GseoC force-pushed the debug_pta branch 2 times, most recently from 20c97e9 to deeaa34 Compare January 9, 2026 14:26
@GseoC
Copy link
Contributor Author

GseoC commented Jan 9, 2026

Reworked to not expose BSEC registers to the PTA.

Comments addressed, thank you.

{ 0xdd05bc8b, 0x9f3b, 0x49f0, \
{ 0xb6, 0x49, 0x01, 0xaa, 0x10, 0xc1, 0xc2, 0x10 } }

enum stm32_pta_dbg_profile {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion:

	/* Debug support from external debug port */
	PTA_STM32_DEBUG_PERIPHERAL_DBG_PROFILE = 0,
	/* Hardware Debug Port (HDP) support (internal signals observation) */
	PTA_STM32_DEBUG_HDP_DBG_PROFILE = 1,

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'll rephrase but ok

bool stm32_bsec_hdp_is_enabled(void);

/*
* Return true if coresight peripheral can be used.
Copy link
Contributor

Choose a reason for hiding this comment

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

IIUC:

Suggested change
* Return true if coresight peripheral can be used.
* Return true if coresight is accessible from the external debug port.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, it's related the their use (ETM/ETR being able to trace etc...). External debug port is enabled with less.

case PTA_STM32_DEBUG_CMD_GRANT_DBG_ACCESS:
return pta_dbg_grant_dbg_access(param_types, params);
default:
break;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
break;
return TEE_ERROR_NOT_IMPLEMENTED;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It breaks to the error return but I'm not against this.

@GseoC
Copy link
Contributor Author

GseoC commented Jan 12, 2026

Comments addressed

@GseoC
Copy link
Contributor Author

GseoC commented Jan 12, 2026

Comment addressed

Copy link
Contributor

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

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

Reviewed-by: Etienne Carriere <[email protected]> with remain review comment addressed.

GseoC added 2 commits January 12, 2026 15:24
Add the debug access PTA that is responsible of validating whether
a given debug profile is configured or not. This basically means that
the debug configuration should allow (at least!) access to the debug
peripherals requiring the debug profile being checked.

For now, as it is specific to BSEC, only embed the PTA if the BSEC support
is embedded as well.

Signed-off-by: Gatien Chevallier <[email protected]>
Reviewed-by: Etienne Carriere <[email protected]>
In order to handle request on the debug configuration, default enable
CFG_STM32_DEBUG_ACCESS_PTA to embed the debug access PTA.

Signed-off-by: Gatien Chevallier <[email protected]>
Reviewed-by: Etienne Carriere <[email protected]>
@GseoC
Copy link
Contributor Author

GseoC commented Jan 12, 2026

Comment addressed and tag applied, thank you

Copy link
Contributor

@tbourgoi tbourgoi left a comment

Choose a reason for hiding this comment

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

some comments on missing new lines at the end of the new files

*/
#define PTA_STM32_DEBUG_CMD_GRANT_DBG_ACCESS 0x0

#endif /* __PTA_STM32MP_DEBUG_ACCESS_H */
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add an empty line at the end of the file

.flags = PTA_DEFAULT_FLAGS | TA_FLAG_CONCURRENT |
TA_FLAG_DEVICE_ENUM,
.open_session_entry_point = pta_dbg_access_open_session,
.invoke_command_entry_point = pta_dbg_access_invoke_cmd);
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto, new line is appreciated

@GseoC
Copy link
Contributor Author

GseoC commented Jan 13, 2026

Hello @tbourgoi, I do have new lines at the end of the files. They just don't show up on the Github interface

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.

3 participants