From: Samuel Holland Date: Mon, 13 Jun 2022 01:03:54 +0000 (-0500) Subject: lib: utils/irqchip: Add wrapper for T-HEAD PLIC delegation X-Git-Tag: v1.1~11 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5e5675874ca042fe977ffb27afcfa06cadc84b8b;p=platform%2Fkernel%2Fopensbi.git lib: utils/irqchip: Add wrapper for T-HEAD PLIC delegation The delegation bit is lost along with the rest of the PLIC state when the CPU power domain in the Allwinner D1 is powered down, so the PLIC needs to be re-delegated to S-mode during the hart resume path. Reviewed-by: Anup Patel Signed-off-by: Samuel Holland --- diff --git a/include/sbi_utils/irqchip/fdt_irqchip_plic.h b/include/sbi_utils/irqchip/fdt_irqchip_plic.h index f158b02..98d4de5 100644 --- a/include/sbi_utils/irqchip/fdt_irqchip_plic.h +++ b/include/sbi_utils/irqchip/fdt_irqchip_plic.h @@ -17,4 +17,6 @@ void fdt_plic_context_save(bool smode, u32 *enable, u32 *threshold); void fdt_plic_context_restore(bool smode, const u32 *enable, u32 threshold); +void thead_plic_restore(void); + #endif diff --git a/lib/utils/irqchip/fdt_irqchip_plic.c b/lib/utils/irqchip/fdt_irqchip_plic.c index 89b12d4..a6e185c 100644 --- a/lib/utils/irqchip/fdt_irqchip_plic.c +++ b/lib/utils/irqchip/fdt_irqchip_plic.c @@ -151,6 +151,13 @@ static void thead_plic_plat_init(struct plic_data *pd) writel_relaxed(BIT(0), (char *)pd->addr + THEAD_PLIC_CTRL_REG); } +void thead_plic_restore(void) +{ + struct plic_data *plic = plic_hartid2data[current_hartid()]; + + thead_plic_plat_init(plic); +} + static const struct fdt_match irqchip_plic_match[] = { { .compatible = "riscv,plic0" }, { .compatible = "sifive,plic-1.0.0" },