drivers:intc_plic: fix plic PLIC_TRIG_LEVEL define mistake #67301
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe the bug
RISCV interrupt-controller PLIC driver each interrupt can entry once,
because in drivers/interrupt-controller/intc_plic.c Due to PLIC_TRIG_LEVEL define mistake case that in function plic_irq_handler no clean the claim register, the interrupt always in pending.
Reason
when compile c file, the BIT(n) is
#define BIT(n) (1UL << (n)
the PLIC_TRIG_LEVEL is defined to
((uint32_t)~BIT(0))
it equal to 0xfffffffe, not 0it will not clean the claim register, and I have printf the PLIC_TRIG_LEVEL, it equal 0xfffffffe.
Additional context
In nceplic100 pdf:
http://www.andestech.com/wp-content/uploads/AX45MP-1C-Rev.-5.0.0-Datasheet.pdf
Page 277 say:
These registers are read-only and indicate the configured interrupt trigger type of interrupt sources.
Every interrupt source occupies 1 bit. There are a total of 32 registers, each 32-bit wide, for 1023
interrupt sources. The location of the interrupt trigger type bit for interrupt source n (1 ≤ n ≤ 1023)
can be determined by the following equations