Message ID | tencent_595E4C50085063265F9560B676806315EE06@qq.com |
---|---|
State | Changes Requested |
Headers | show |
Series | lib: sbi: Probe PMP locked entries and adjust first usable PMP index | expand |
On Fri, Dec 8, 2023 at 3:34 AM Yangyu Chen <cyy@cyyself.name> wrote: > > To further probe each PMP entry whether is locked or not, we should > detect the number of PMP entries first. > > Signed-off-by: Yangyu Chen <cyy@cyyself.name> > --- > lib/sbi/sbi_hart.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c > index 49d1454..eaa69ad 100644 > --- a/lib/sbi/sbi_hart.c > +++ b/lib/sbi/sbi_hart.c > @@ -868,6 +868,9 @@ static int hart_detect_features(struct sbi_scratch *scratch) > __check_csr_32(__csr + 0, __rdonly, __wrval, __field, __skip) \ > __check_csr_32(__csr + 32, __rdonly, __wrval, __field, __skip) > > + /* Detect number of PMP regions. At least PMPADDR0 should be implemented*/ > + __check_csr_64(CSR_PMPADDR0, true, 0, pmp_count, __pmp_count_probed); > +__pmp_count_probed: Add a newline here. > /** > * Detect the allowed address bits & granularity. At least PMPADDR0 > * should be implemented. > @@ -876,10 +879,7 @@ static int hart_detect_features(struct sbi_scratch *scratch) > if (val) { > hfeatures->pmp_gran = 1 << (sbi_ffs(val) + 2); > hfeatures->pmp_addr_bits = sbi_fls(val) + 1; > - /* Detect number of PMP regions. At least PMPADDR0 should be implemented*/ > - __check_csr_64(CSR_PMPADDR0, true, 0, pmp_count, __pmp_skip); > } > -__pmp_skip: Add a newline here as well. > /* Detect number of MHPM counters */ > __check_hpm_csr(CSR_MHPMCOUNTER3, mhpm_mask); > hfeatures->mhpm_bits = hart_mhpm_get_allowed_bits(); > -- > 2.43.0 > > > -- > opensbi mailing list > opensbi@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/opensbi Otherwise, it looks good to me. Reviewed-by: Anup Patel <anup@brainfault.org> Regards, Anup
diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c index 49d1454..eaa69ad 100644 --- a/lib/sbi/sbi_hart.c +++ b/lib/sbi/sbi_hart.c @@ -868,6 +868,9 @@ static int hart_detect_features(struct sbi_scratch *scratch) __check_csr_32(__csr + 0, __rdonly, __wrval, __field, __skip) \ __check_csr_32(__csr + 32, __rdonly, __wrval, __field, __skip) + /* Detect number of PMP regions. At least PMPADDR0 should be implemented*/ + __check_csr_64(CSR_PMPADDR0, true, 0, pmp_count, __pmp_count_probed); +__pmp_count_probed: /** * Detect the allowed address bits & granularity. At least PMPADDR0 * should be implemented. @@ -876,10 +879,7 @@ static int hart_detect_features(struct sbi_scratch *scratch) if (val) { hfeatures->pmp_gran = 1 << (sbi_ffs(val) + 2); hfeatures->pmp_addr_bits = sbi_fls(val) + 1; - /* Detect number of PMP regions. At least PMPADDR0 should be implemented*/ - __check_csr_64(CSR_PMPADDR0, true, 0, pmp_count, __pmp_skip); } -__pmp_skip: /* Detect number of MHPM counters */ __check_hpm_csr(CSR_MHPMCOUNTER3, mhpm_mask); hfeatures->mhpm_bits = hart_mhpm_get_allowed_bits();
To further probe each PMP entry whether is locked or not, we should detect the number of PMP entries first. Signed-off-by: Yangyu Chen <cyy@cyyself.name> --- lib/sbi/sbi_hart.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)