[PATCH v2] lib: utils/irqchip: Automatically delegate T-HEAD PLIC access

Anup Patel anup at brainfault.org
Thu Nov 4 07:36:01 PDT 2021


On Thu, Nov 4, 2021 at 7:54 PM Peter Korsgaard <peter at korsgaard.com> wrote:
>
> >>>>> "Anup" == Anup Patel <anup at brainfault.org> writes:
>
> Hi,
>
>  > On Mon, Oct 18, 2021 at 11:04 AM Samuel Holland <samuel at sholland.org> wrote:
>  >>
>  >> The T-HEAD PLIC implementation requires setting a delegation bit
>  >> to allow access from S-mode. Now that the T-HEAD PLIC has its own
>  >> compatible string, set this bit automatically from the PLIC driver,
>  >> instead of reaching into the PLIC's MMIO space from another driver.
>  >>
>  >> Signed-off-by: Samuel Holland <samuel at sholland.org>
>  >>
>  >> ---
>  >>
>  >> Changes in v2:
>  >> - Use the thead,c900-plic compatible instead of the D1 compatible.
>  >> - Also apply this change to other T-HEAD device tree examples.
>  >> - Remove the plic-delegate code from the thead,reset-sample driver.
>  >> - Drop the return value from thead_plic_plat_init().
>
>  > Looks good to me.
>
>  > Reviewed-by: Anup Patel <anup.patel at wdc.com>
>
>  > Applied this patch to the riscv/opensbi repo.
>
> ..
>
>  >> static const struct fdt_match irqchip_plic_match[] = {
>  >> { .compatible = "riscv,plic0" },
>  >> { .compatible = "sifive,plic-1.0.0" },
>  >> +       { .compatible = "thead,c900-plic",
>  >> +         .data = thead_plic_plat_init },
>  >> { },
>  >> };
>
> Sorry, old thread but I just noticed now that the thead,c900-plic
> compatible should ideally have been before the sifive one, so DTBs with
> both compatibles behave correctly (drivers are matched according to the
> order of the driver compatible, NOT the order of the compatible in the
> DTB).

Based on discussions on LKML, the T-HEAD PLIC is not compliant with
RISC-V PLIC (and SiFive PLIC) so SiFive compatible string should not
be used for any T-HEAD C9xx based board.

@Guo Ren I see that you have dropped the DT bindings patch in your
recent patch. You need to include the DT bindings patch in your kernel
series.

Regards,
Anup

>
> --
> Bye, Peter Korsgaard
>
> --
> opensbi mailing list
> opensbi at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi



More information about the opensbi mailing list