Message ID | 71b61b52e7b789dc440dc65adf0efbc0165687aa.1596631037.git.michal.simek@xilinx.com |
---|---|
State | Superseded |
Delegated to: | Tom Rini |
Headers | show |
Series | firmware: psci: Do not bind driver if U-Boot runs in EL3 | expand |
On 05. 08. 20 14:37, Michal Simek wrote: > There is no reason to bind psci driver if U-Boot runs in EL3 because > SMC/HVC instructions can't be called. That's why detect this state and > don't let user to crash from prompt by performing reset or poweroff > commands (if enabled). > > Signed-off-by: Michal Simek <michal.simek@xilinx.com> > --- > > Maybe there is a better way how to do it. Maybe do it in probe instead of > bind. Feel free to comment but this doesn't look right behavior. > > U-Boot SPL 2020.10-rc1-00046-g5fade0c9d867 (Aug 05 2020 - 14:36:03 +0200) > PMUFW: v1.1 > Loading new PMUFW cfg obj (2024 bytes) > EL Level: EL3 > Multiboot: 0 > Trying to boot from MMC2 > spl: could not initialize mmc. error: -19 > Trying to boot from MMC1 > spl_load_image_fat_os: error reading image u-boot.bin, err - -2 > > U-Boot 2020.10-rc1-00046-g5fade0c9d867 (Aug 05 2020 - 14:36:03 +0200) > > Model: ZynqMP ZCU104 RevC > Board: Xilinx ZynqMP > DRAM: 2 GiB > PMUFW: v1.1 > EL Level: EL3 > Chip ID: zu7e > Multiboot: 0 > WDT: Started with servicing (60s timeout) > NAND: 0 MiB > MMC: mmc@ff170000: 0 > In: serial@ff000000 > Out: serial@ff000000 > Err: serial@ff000000 > Bootmode: LVL_SHFT_SD_MODE1 > Reset reason: EXTERNAL > Net: > ZYNQ GEM: ff0e0000, mdio bus ff0e0000, phyaddr 12, interface rgmii-id > eth0: ethernet@ff0e0000 > Hit any key to stop autoboot: 0 > ZynqMP> > ZynqMP> reset > resetting ... > "Synchronous Abort" handler, esr 0x5e000000 > elr: 0000000008000194 lr : 0000000008000220 (reloc) > elr: 000000007fec9194 lr : 000000007fec9220 > x0 : 0000000084000009 x1 : 0000000000000000 > x2 : 0000000000000000 x3 : 0000000000000000 > x4 : 0000000000000000 x5 : 0000000000000000 > x6 : 0000000000000000 x7 : 0000000000000000 > x8 : 000000007deaedb0 x9 : 000000000000000c > x10: 00000000000007c4 x11: 000000007deae92c > x12: 0000000000000006 x13: 000000000001869f > x14: 000000007deaedb0 x15: 0000000000000002 > x16: 000000007ff2af5c x17: 0000000000000000 > x18: 000000007deb8db0 x19: 0000000000000000 > x20: 000000007ffb0268 x21: 0000000000000000 > x22: 000000007debc600 x23: 0000000000000001 > x24: 000000007ffc7898 x25: 0000000000000000 > x26: 0000000000000000 x27: 0000000000000000 > x28: 000000007debc640 x29: 000000007deaeaf0 > > Code: 00000000 f9020000 00000000 d4000003 (f94003e4) > Resetting CPU ... > > ### ERROR ### Please RESET the board ### > > --- > drivers/firmware/psci.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c > index 23cf807591c4..1bef7eea56fc 100644 > --- a/drivers/firmware/psci.c > +++ b/drivers/firmware/psci.c > @@ -69,6 +69,9 @@ static int psci_probe(struct udevice *dev) > { > const char *method; > > + if (current_el() == 3) > + return -EINVAL; > + > method = ofnode_read_string(dev_ofnode(dev), "method"); > if (!method) { > pr_warn("missing \"method\" property\n"); > Just a note: #include <asm/system.h> is missing on latest. But let's discussed this before I send v2. Thanks, Michal
diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c index 23cf807591c4..1bef7eea56fc 100644 --- a/drivers/firmware/psci.c +++ b/drivers/firmware/psci.c @@ -69,6 +69,9 @@ static int psci_probe(struct udevice *dev) { const char *method; + if (current_el() == 3) + return -EINVAL; + method = ofnode_read_string(dev_ofnode(dev), "method"); if (!method) { pr_warn("missing \"method\" property\n");
There is no reason to bind psci driver if U-Boot runs in EL3 because SMC/HVC instructions can't be called. That's why detect this state and don't let user to crash from prompt by performing reset or poweroff commands (if enabled). Signed-off-by: Michal Simek <michal.simek@xilinx.com> --- Maybe there is a better way how to do it. Maybe do it in probe instead of bind. Feel free to comment but this doesn't look right behavior. U-Boot SPL 2020.10-rc1-00046-g5fade0c9d867 (Aug 05 2020 - 14:36:03 +0200) PMUFW: v1.1 Loading new PMUFW cfg obj (2024 bytes) EL Level: EL3 Multiboot: 0 Trying to boot from MMC2 spl: could not initialize mmc. error: -19 Trying to boot from MMC1 spl_load_image_fat_os: error reading image u-boot.bin, err - -2 U-Boot 2020.10-rc1-00046-g5fade0c9d867 (Aug 05 2020 - 14:36:03 +0200) Model: ZynqMP ZCU104 RevC Board: Xilinx ZynqMP DRAM: 2 GiB PMUFW: v1.1 EL Level: EL3 Chip ID: zu7e Multiboot: 0 WDT: Started with servicing (60s timeout) NAND: 0 MiB MMC: mmc@ff170000: 0 In: serial@ff000000 Out: serial@ff000000 Err: serial@ff000000 Bootmode: LVL_SHFT_SD_MODE1 Reset reason: EXTERNAL Net: ZYNQ GEM: ff0e0000, mdio bus ff0e0000, phyaddr 12, interface rgmii-id eth0: ethernet@ff0e0000 Hit any key to stop autoboot: 0 ZynqMP> ZynqMP> reset resetting ... "Synchronous Abort" handler, esr 0x5e000000 elr: 0000000008000194 lr : 0000000008000220 (reloc) elr: 000000007fec9194 lr : 000000007fec9220 x0 : 0000000084000009 x1 : 0000000000000000 x2 : 0000000000000000 x3 : 0000000000000000 x4 : 0000000000000000 x5 : 0000000000000000 x6 : 0000000000000000 x7 : 0000000000000000 x8 : 000000007deaedb0 x9 : 000000000000000c x10: 00000000000007c4 x11: 000000007deae92c x12: 0000000000000006 x13: 000000000001869f x14: 000000007deaedb0 x15: 0000000000000002 x16: 000000007ff2af5c x17: 0000000000000000 x18: 000000007deb8db0 x19: 0000000000000000 x20: 000000007ffb0268 x21: 0000000000000000 x22: 000000007debc600 x23: 0000000000000001 x24: 000000007ffc7898 x25: 0000000000000000 x26: 0000000000000000 x27: 0000000000000000 x28: 000000007debc640 x29: 000000007deaeaf0 Code: 00000000 f9020000 00000000 d4000003 (f94003e4) Resetting CPU ... ### ERROR ### Please RESET the board ### --- drivers/firmware/psci.c | 3 +++ 1 file changed, 3 insertions(+)