1
0
Fork 0
Commit Graph

5 Commits (redonkable)

Author SHA1 Message Date
Franck LENORMAND 2ccb9a596a SSI-87: firmware: imx: Add APIs required for secvio
The Security Violation module requires SC API for the SECO, RM, MISC
and IRQ.

This patch does:
 - imx-scu-irq: Allow reuse of imx_scu_irq_get_status
 - seco:
    - Add imx_sc_seco_secvio_enable
    - Add imx_sc_seco_secvio_config
    - Add imx_sc_seco_secvio_dgo_config

Signed-off-by: Franck LENORMAND <franck.lenormand@nxp.com>
2020-03-13 17:11:58 +01:00
Robin Gong 936c74516d MLK-22984 firmware: imx: imx-scu-irq: fix RCU complains after M4 partition reset
Use blocking_notifier_chain instead of atomic_notifier_chain, otherwise
below RCU complains would come out since unregister/register_virtio_device
()will issue mbox message (mbox_send_message() is blocking) again after
received M4 partition reset. Actually, no need atomic for notifier which
is so tough for user since this notifier is called in worker instead of
interrupt handler directly.

[  389.706645] i2c-rpmsg virtio0.rpmsg-i2c-channel.-1.2: i2c rpmsg driver is removed
[  389.767362] Wait for remote ready timeout, use first_notify.
[  389.774084] ------------[ cut here ]------------
[  389.778729] WARNING: CPU: 0 PID: 397 at kernel/rcu/tree_plugin.h:293 rcu_note_context_switch+0x34/0x338
[  389.788131] Modules linked in:
[  389.791195] CPU: 0 PID: 397 Comm: kworker/0:13 Not tainted 5.4.0-rc5-02977-g08f78722f07b #26
[  389.799633] Hardware name: Freescale i.MX8DXL Phantom MEK (DT)
[  389.805481] Workqueue: events imx_scu_irq_work_handler
[  389.810626] pstate: 20000085 (nzCv daIf -PAN -UAO)
[  389.815422] pc : rcu_note_context_switch+0x34/0x338
[  389.820307] lr : __schedule+0x98/0x548
[  389.824054] sp : ffff800013e7b770
[  389.827362] x29: ffff800013e7b770 x28: 0000000000000000
[  389.832679] x27: 0000000000000000 x26: 0000000000000100
[  389.837997] x25: ffff0000299f6e00 x24: ffff80001112fdc8
[  389.843312] x23: ffff800011f298c8 x22: ffff800011af4018
[  389.848628] x21: 0000000000000000 x20: ffff0000299f6e00
[  389.853945] x19: ffff00002afdd840 x18: ffff80001188ca18
[  389.859262] x17: 0000000000000000 x16: 0000000000000000
[  389.864579] x15: 0000000090008000 x14: ffff800012473000
[  389.869896] x13: ffff800012470000 x12: 0000000000000100
[  389.875212] x11: ffff0000297b9980 x10: 0000000000000001
[  389.880529] x9 : 0000000000000228 x8 : 0000000000000220
[  389.885846] x7 : 0000000000000035 x6 : ffff00002afd6418
[  389.891162] x5 : 0000000000002000 x4 : 0000000000002000
[  389.896479] x3 : 0000000000000000 x2 : ffff8000194dc000
[  389.901798] x1 : 0000000000000001 x0 : 0000000000000001
[  389.907115] Call trace:
[  389.909561]  rcu_note_context_switch+0x34/0x338
[  389.914094]  __schedule+0x98/0x548
[  389.917499]  schedule+0x40/0xe0
[  389.920643]  schedule_timeout+0x144/0x268
[  389.924659]  wait_for_completion_timeout+0x94/0x128
[  389.929543]  mbox_send_message+0x9c/0x120
[  389.933554]  imx_rpmsg_notify+0x5c/0x68
[  389.937397]  virtqueue_notify+0x20/0x50
[  389.941233]  rpmsg_probe+0x274/0x318
[  389.944811]  virtio_dev_probe+0x16c/0x228
[  389.948830]  really_probe+0xd4/0x308
[  389.952404]  driver_probe_device+0x54/0xe8
[  389.956507]  __device_attach_driver+0x80/0xb8
[  389.960868]  bus_for_each_drv+0x78/0xc8
[  389.964705]  __device_attach+0xd4/0x130
[  389.968549]  device_initial_probe+0x10/0x18
[  389.972735]  bus_probe_device+0x90/0x98
[  389.976574]  device_add+0x3f0/0x638
[  389.980067]  register_virtio_device+0xb0/0x108
[  389.984514]  imx_rpmsg_restore+0x120/0x170
[  389.988615]  imx_rpmsg_partition_notify+0x3c/0x60
[  389.993325]  notifier_call_chain+0x54/0x90
[  389.997424]  atomic_notifier_call_chain+0x38/0x58
[  390.002133]  imx_scu_irq_work_handler+0x80/0xd8
[  390.006669]  process_one_work+0x1e0/0x358
[  390.010681]  worker_thread+0x40/0x488
[  390.014349]  kthread+0x118/0x120
[  390.017580]  ret_from_fork+0x10/0x18
[  390.021157] ---[ end trace 7205c5eaadacce06 ]---
[  390.025926] virtio_rpmsg_bus virtio0: rpmsg host is online

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
2019-11-25 15:46:50 +08:00
Anson Huang faa4898632 firmware: imx: make sure MU irq can wake up system from suspend mode
IRQF_NO_SUSPEND flag is set for MU IRQ of IPC work, but with this
flag set, IRQD_WAKEUP_ARMED flag will NOT be set during
suspend_device_irq() phase, then when MU IRQ arrives, it will NOT
wake up system from suspend.

To fix this issue, pm_system_wakeup() is called in general MU IRQ
handler to make sure system can be waked up when MU IRQ arrives.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
2019-11-25 15:46:49 +08:00
Anson Huang a0b14e6585 firmware: imx: SCU irq should ONLY be enabled after SCU IPC is ready
The imx_scu_irq_group_enable() is normally called during module driver
probe phase to enable SCU group irq, if SCU IPC is NOT ready, below
dump will show out:

[    0.933001] Hardware name: Freescale i.MX8QXP MEK (DT)
[    0.938129] pstate: 60000005 (nZCv daif -PAN -UAO)
[    0.942907] pc : imx_scu_call_rpc+0x114/0x158
[    0.947251] lr : imx_scu_irq_group_enable+0x74/0xc4
[    0.952113] sp : ffff00001005bae0
[    0.955415] x29: ffff00001005bae0 x28: ffff0000111bb0a0
[    0.960712] x27: ffff00001140b000 x26: ffff00001111068c
[    0.966011] x25: ffff0000111bb100 x24: 0000000000000000
[    0.971311] x23: ffff0000113d9cd8 x22: 0000000000000001
[    0.976610] x21: 0000000000000001 x20: ffff80083b51a410
[    0.981909] x19: ffff000011259000 x18: 0000000000000480
[    0.987209] x17: 000000000023ffb8 x16: 0000000000000010
[    0.992508] x15: 000000000000023f x14: ffffffffffffffff
[    0.997807] x13: 0000000000000018 x12: 0000000000000030
[    1.003107] x11: 0000000000000003 x10: 0101010101010101
[    1.008406] x9 : ffffffffffffffff x8 : 7f7f7f7f7f7f7f7f
[    1.013706] x7 : fefefeff646c606d x6 : 0000000000000000
[    1.019005] x5 : ffff0000112596c8 x4 : 0000000000000008
[    1.024304] x3 : 0000000000000003 x2 : 0000000000000001
[    1.029604] x1 : ffff00001005bb58 x0 : 0000000000000000
[    1.034905] Call trace:
[    1.037341]  imx_scu_call_rpc+0x114/0x158
[    1.041334]  imx_scu_irq_group_enable+0x74/0xc4
[    1.045856]  imx_sc_wdt_probe+0x24/0x150
[    1.049766]  platform_drv_probe+0x4c/0xb0
[    1.053762]  really_probe+0x1f8/0x2c8
[    1.057407]  driver_probe_device+0x58/0xfc
[    1.061490]  device_driver_attach+0x68/0x70
[    1.065660]  __driver_attach+0x94/0xdc
[    1.069397]  bus_for_each_dev+0x64/0xc0
[    1.073220]  driver_attach+0x20/0x28
[    1.076782]  bus_add_driver+0x148/0x1fc
[    1.080601]  driver_register+0x68/0x120
[    1.084424]  __platform_driver_register+0x4c/0x54
[    1.089120]  imx_sc_wdt_driver_init+0x18/0x20
[    1.093463]  do_one_initcall+0x58/0x1b8
[    1.097287]  kernel_init_freeable+0x1cc/0x288
[    1.101630]  kernel_init+0x10/0x100
[    1.105101]  ret_from_fork+0x10/0x18
[    1.108669] ---[ end trace 9e03302114457de9 ]---
[    1.113296] enable irq failed, group 1, mask 1, ret -22

To avoid such scenario, return -EPROBE_DEFER in imx_scu_irq_group_enable()
API if SCU IPC is NOT ready, then module driver which calls this API
in probe phase will defer probe after SCU IPC ready.

Fixes: 851826c756 ("firmware: imx: enable imx scu general irq function")
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2019-05-20 09:12:20 +08:00
Anson Huang 851826c756 firmware: imx: enable imx scu general irq function
The System Controller Firmware (SCFW) controls RTC, thermal
and WDOG etc., these resources' interrupt function are managed
by SCU. When any IRQ pending, SCU will notify Linux via MU general
interrupt channel #3, and Linux kernel needs to call SCU APIs
to get IRQ status and notify each module to handle the interrupt.

Since there is no data transmission for SCU IRQ notification, so
doorbell mode is used for this MU channel, and SCU driver will
use notifier mechanism to broadcast to every module which registers
the SCU block notifier.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>
2019-04-11 15:31:02 +08:00