From: Soren Brinkmann Date: Fri, 30 Sep 2016 18:30:21 +0000 (-0700) Subject: zynqmp: pm: Enable IPI IRQ when API version is probed X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=a76c3697a0e898c5d135194f7f31afd13b72ef81;p=project%2Fbcm63xx%2Fatf.git zynqmp: pm: Enable IPI IRQ when API version is probed The IPI hardware is secure and managed by ATF, nevertheless we deliver the IRQ to the rich OS. The IRQ is needed to receive PM callbacks. Enable the IPI interrupt when the rich OS probes the API version. Signed-off-by: Soren Brinkmann --- diff --git a/plat/xilinx/zynqmp/pm_service/pm_api_sys.c b/plat/xilinx/zynqmp/pm_service/pm_api_sys.c index 94160169..c7b8b9a7 100644 --- a/plat/xilinx/zynqmp/pm_service/pm_api_sys.c +++ b/plat/xilinx/zynqmp/pm_service/pm_api_sys.c @@ -396,7 +396,7 @@ enum pm_ret_status pm_register_notifier(enum pm_node_id nid, PM_PACK_PAYLOAD5(payload, PM_REGISTER_NOTIFIER, nid, event, wake, enable); - return pm_ipi_send(primary_proc, payload); + return pm_ipi_send_sync(primary_proc, payload, NULL, 0); } /** diff --git a/plat/xilinx/zynqmp/pm_service/pm_ipi.c b/plat/xilinx/zynqmp/pm_service/pm_ipi.c index 5fd9d550..df3b854d 100644 --- a/plat/xilinx/zynqmp/pm_service/pm_ipi.c +++ b/plat/xilinx/zynqmp/pm_service/pm_ipi.c @@ -248,3 +248,13 @@ unlock: return ret; } + +void pm_ipi_irq_enable(void) +{ + mmio_write_32(IPI_APU_IER, IPI_APU_IXR_PMU_0_MASK); +} + +void pm_ipi_irq_disable(void) +{ + mmio_write_32(IPI_APU_IDR, IPI_APU_IXR_PMU_0_MASK); +} diff --git a/plat/xilinx/zynqmp/pm_service/pm_ipi.h b/plat/xilinx/zynqmp/pm_service/pm_ipi.h index 108aef49..fefe89ab 100644 --- a/plat/xilinx/zynqmp/pm_service/pm_ipi.h +++ b/plat/xilinx/zynqmp/pm_service/pm_ipi.h @@ -40,5 +40,7 @@ enum pm_ret_status pm_ipi_send(const struct pm_proc *proc, enum pm_ret_status pm_ipi_send_sync(const struct pm_proc *proc, uint32_t payload[PAYLOAD_ARG_CNT], unsigned int *value, size_t count); +void pm_ipi_irq_enable(void); +void pm_ipi_irq_disable(void); #endif /* _PM_IPI_H_ */ diff --git a/plat/xilinx/zynqmp/pm_service/pm_svc_main.c b/plat/xilinx/zynqmp/pm_service/pm_svc_main.c index 34823757..8a4bba61 100644 --- a/plat/xilinx/zynqmp/pm_service/pm_svc_main.c +++ b/plat/xilinx/zynqmp/pm_service/pm_svc_main.c @@ -173,11 +173,19 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3, case PM_GET_API_VERSION: /* Check is PM API version already verified */ - if (pm_ctx.api_version == PM_VERSION) + if (pm_ctx.api_version == PM_VERSION) { SMC_RET1(handle, (uint64_t)PM_RET_SUCCESS | ((uint64_t)PM_VERSION << 32)); + } ret = pm_get_api_version(&pm_ctx.api_version); + /* + * Enable IPI IRQ + * assume the rich OS is OK to handle callback IRQs now. + * Even if we were wrong, it would not enable the IRQ in + * the GIC. + */ + pm_ipi_irq_enable(); SMC_RET1(handle, (uint64_t)ret | ((uint64_t)pm_ctx.api_version << 32));