Message ID | 20220321051528.20143-4-mchitale@ventanamicro.com |
---|---|
State | Superseded |
Headers | show |
Series | RISC-V Smstateen support | expand |
On Mon, Mar 21, 2022 at 10:46 AM Mayuresh Chitale <mchitale@ventanamicro.com> wrote: > > When mstateen registers are implemented, the AIA related > configurations need to be done in mstateen for the IMSIC > initialization to succeed. > > Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com> > --- > lib/sbi/sbi_hart.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c > index 9d0c435..f5c44e1 100644 > --- a/lib/sbi/sbi_hart.c > +++ b/lib/sbi/sbi_hart.c > @@ -80,6 +80,15 @@ static void mstatus_init(struct sbi_scratch *scratch) > mstateen_val |= (1UL << SMSTATEEN0_HSENVCFG); > else > mstateen_val &= ~(1UL << SMSTATEEN0_HSENVCFG); > + > + if (sbi_hart_has_feature(scratch, SBI_HART_HAS_AIA)) > + mstateen_val |= (1UL << SMSTATEEN0_AIA | > + 1UL << SMSTATEEN0_SVSLCT | > + 1UL << SMSTATEEN0_IMSIC); > + else > + mstateen_val &= ~(1UL << SMSTATEEN0_AIA | > + 1UL << SMSTATEEN0_SVSLCT | > + 1UL << SMSTATEEN0_IMSIC); This breaks compilation for RV32 because some the bits are at position > 31 Regards, Anup > csr_write(CSR_MSTATEEN0, mstateen_val); > } > > -- > 2.17.1 > > > -- > opensbi mailing list > opensbi@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/opensbi
diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c index 9d0c435..f5c44e1 100644 --- a/lib/sbi/sbi_hart.c +++ b/lib/sbi/sbi_hart.c @@ -80,6 +80,15 @@ static void mstatus_init(struct sbi_scratch *scratch) mstateen_val |= (1UL << SMSTATEEN0_HSENVCFG); else mstateen_val &= ~(1UL << SMSTATEEN0_HSENVCFG); + + if (sbi_hart_has_feature(scratch, SBI_HART_HAS_AIA)) + mstateen_val |= (1UL << SMSTATEEN0_AIA | + 1UL << SMSTATEEN0_SVSLCT | + 1UL << SMSTATEEN0_IMSIC); + else + mstateen_val &= ~(1UL << SMSTATEEN0_AIA | + 1UL << SMSTATEEN0_SVSLCT | + 1UL << SMSTATEEN0_IMSIC); csr_write(CSR_MSTATEEN0, mstateen_val); }
When mstateen registers are implemented, the AIA related configurations need to be done in mstateen for the IMSIC initialization to succeed. Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com> --- lib/sbi/sbi_hart.c | 9 +++++++++ 1 file changed, 9 insertions(+)