zynqmp: pm: Enable IPI IRQ when API version is probed
authorSoren Brinkmann <soren.brinkmann@xilinx.com>
Fri, 30 Sep 2016 18:30:21 +0000 (11:30 -0700)
committerSoren Brinkmann <soren.brinkmann@xilinx.com>
Wed, 16 Nov 2016 23:55:58 +0000 (15:55 -0800)
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 <soren.brinkmann@xilinx.com>
plat/xilinx/zynqmp/pm_service/pm_api_sys.c
plat/xilinx/zynqmp/pm_service/pm_ipi.c
plat/xilinx/zynqmp/pm_service/pm_ipi.h
plat/xilinx/zynqmp/pm_service/pm_svc_main.c

index 941601692299aa9ab80a25af57a8a1f3bd0f009c..c7b8b9a7de07cf998490a5c24a4a4c39f18eb62a 100644 (file)
@@ -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);
 }
 
 /**
index 5fd9d550d1bb6524b694ee78f9ce1eac3579b7ad..df3b854d83ef2a1b6a06ae7a19c6f65cee36f590 100644 (file)
@@ -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);
+}
index 108aef496114bf1b2dde8acbe1f870074c3a33f2..fefe89ab7c943e90d6f07451241266d82b78a6a6 100644 (file)
@@ -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_ */
index 34823757ad5b65da8c01b563b4a9e36ad5d8f622..8a4bba617beb5c0b8c1c5932514448d6168074ba 100644 (file)
@@ -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));