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

core: interrupt: rename .add handler to .configure + minor inline comment changes #7267

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

Conversation

etienne-lms
Copy link
Contributor

Rename field add of struct itr_ops to configure for consistency since that handler is used the configure the interrupt. Update existing interrupt drivers accordingly.

That configure handler is not required for interrupt providers which consumer only use the DT to get and configure their interrupts (with interrupt_dt_get_by_*() and interrupt_create_handler()). Therefore change itr_chip_is_valid() to not enforce its support but add back that constraint for the interrupt main controller.

Plus few minor changes in inline comments in interrupt.h and interrupt.c.

@@ -132,8 +138,7 @@ static inline bool itr_chip_is_valid(struct itr_chip *chip)
is_unpaged((void *)chip->ops) &&
chip->ops->mask && is_unpaged(chip->ops->mask) &&
chip->ops->unmask && is_unpaged(chip->ops->unmask) &&
chip->ops->enable && chip->ops->disable &&
chip->ops->add;
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 rather have a separate version of itr_chip_is_valid() for the DT use case, for clarity and consistent checking.

@etienne-lms
Copy link
Contributor Author

I've rebased the series to fix the merge conflict.
I've appended a commit to address #7267 (comment).

chip->ops->add(chip, itr_num, type, prio);
if (!chip->ops->configure) {
EMSG("No configure handler in itr_chip %s", chip->name);
return TEE_ERROR_NOT_IMPLEMENTED;
Copy link
Contributor

Choose a reason for hiding this comment

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

add_configure_handler() below should handle this error.

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! Thanks.

@jenswi-linaro
Copy link
Contributor

Reviewed-by: Jens Wiklander <[email protected]>

@etienne-lms etienne-lms force-pushed the itr-fix branch 2 times, most recently from 2e7403f to 91c272c Compare February 14, 2025 10:37
@etienne-lms
Copy link
Contributor Author

etienne-lms commented Feb 14, 2025

I've slightly modified the content of commits "core: interrupt: rename .add handler to .configure" and
"core: interrupt: itr_chip may not require configure handler" regarding the previously reviewed series to have each commit do only what's it's expecting to (renaming then removing a constraint.). Therefore I've not yet applied your review tag on those 2 commits.

Aside there their content changed, the resulting diff, once both applied, is inline comments update (and spelling fixes):

  * Handlers @enable, @disable, @mask and @unmask are mandated. Handlers
- * @mask and @unmask have unpaged memory contrainsts. See itr_chip_is_valid().
+ * @mask and @unmask have unpaged memory constraints. These requirements are
+ * verified by itr_chip_init() and itr_chip_dt_only_init().
  *
- * Handler @configure is needed for interrupt provider which do not rely on
- * DT for consumer interrupt configuration, that is interrupt consumer using
+ * Handler @configure is needed for interrupt providers which do not rely on
+ * DT for consumers interrupt configuration, that is interrupt consumers using
  * interrupt_configure() or friends (interrupt_add_handler(),
  * interrupt_add_configure_handler(), interrupt_add_handler_with_chip(),
  * etc...).

@jenswi-linaro
Copy link
Contributor

Looks good if you remove

# Conflicts:
#	core/include/kernel/interrupt.h

from the commit message in "core: interrupt: itr_chip may not require configure handler"

@etienne-lms
Copy link
Contributor Author

Right, sorry, i'll fix.

Rename field add of struct itr_ops to configure for consistency
since that handler is used the configure the interrupt. Update
existing interrupt drivers accordingly.

By the way fix inline comment spelling typo (s/contrainsts/constraints/).

Signed-off-by: Etienne Carriere <[email protected]>
Reviewed-by: Jens Wiklander <[email protected]>
The configure handler in struct itr_ops is not required for interrupt
providers which consumers only use the DT to get and configure their
interrupts (with interrupt_dt_get_by_*() and interrupt_create_handler()).
Therefore change itr_chip_is_valid() to not enforce its support
but add back that constraint for the interrupt main controller.

Add an itr_chip_dt_only_init() helper function for interrupt
controllers which consumers only use the DT to configure their
interrupt, that is such controllers do not need a configure handler.

itr_chip_is_valid() is not called outside interrupt.c where it is
used in itr_chip_init() and itr_chip_dt_only_init() so make it a local
function.

Signed-off-by: Etienne Carriere <[email protected]>
Reviewed-by: Jens Wiklander <[email protected]>
Add an inline comment telling struct itr_chip:dt_get_irq handler is
needed only when interrupt consumer manually get configuration
information from the DT to later configure the interrupt. The
aim of this change is to clarify this handler is not needed for
interrupt provider registered with interrupt_register_provider()
and which consumer rely on interrupt_dt_get_by_*() to configure
their interrupts.

Signed-off-by: Etienne Carriere <[email protected]>
Reviewed-by: Jens Wiklander <[email protected]>
Clarify inline comment in interrupt_create_handler() to explicit that
this function request add_configure_handler() to not configure the
interrupt (since it's already configured from interrupt_dt_get_by_*()
API functions).

Signed-off-by: Etienne Carriere <[email protected]>
Reviewed-by: Jens Wiklander <[email protected]>
Fix inline description of itr_num argument for interrupt_set_affinity()
and interrupt_set_wake().

Fixes: b2d6db2 ("core: interrupt: helper function for raise_pi, raise_sgi, set_affinity")
Signed-off-by: Etienne Carriere <[email protected]>
Reviewed-by: Jens Wiklander <[email protected]>
@etienne-lms
Copy link
Contributor Author

Commit log fixed and review tags applied.

Failure of CI Qemu build/run on arm64 host seems unrelated to this change but it's strange it fails on this P-R (systematic over 3 recent series udpate) while I saw a recently updated P-R that successfully passed all CI tests.

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