RBM33G - Enable NVMe - Kernel Panic

Hello,

I added an Toshiba RC100 NVMe to RBM33G. In RouterOS is detected and works ok.

Installed openwrt but does not have nvme driver yet. I compiled openwrt with CONFIG_BLK_DEV_NVME=y

and now I get a kernel panic while booting:

Can anyone point me to the right direction please?

 2.683492] CPU: 2 PID: 30 Comm: kworker/u8:2 Not tainted 4.14.75 #0
[    2.689833] Workqueue: nvme-wq nvme_reset_work
[    2.694259] task: 8fcf92c0 task.stack: 8fd1c000
[    2.698765] $ 0   : 00000000 00000001 80313a04 00010201
[    2.703975] $ 4   : 8fc3b0f0 00000000 8fd1dd28 00000000
[    2.709184] $ 8   : 00000020 00000000 00000078 00000400
[    2.714393] $12   : 000000c0 00000007 00000000 00000020
[    2.719603] $16   : 8fc3b0f0 80600000 8fed8c68 8fed8c68
[    2.724813] $20   : 80600000 8fc3b0f0 fffffff4 8fc3b000
[    2.730023] $24   : 000000a0 80058d08
[    2.735233] $28   : 8fd1c000 8fd1dd08 80600000 80312178
[    2.740445] Hi    : 00000003
[    2.743308] Lo    : 00000001
[    2.746174] epc   : 80313a04 nvme_pci_reg_read64+0x0/0x4
[    2.751462] ra    : 80312178 nvme_init_identify+0x84/0x88c
[    2.756920] Status: 11007c03 KERNEL EXL IE
[    2.761091] Cause : 50800024 (ExcCode 09)
[    2.765076] PrId  : 0001992f (MIPS 1004Kc)
[    2.769147] Modules linked in:
[    2.772191] Process kworker/u8:2 (pid: 30, threadinfo=8fd1c000, task=8fcf92c0, tls=00000000)
[    2.780583] Stack : 8fff0000 8fc3b048 8fc3b074 8fc3b084 805fc0a4 80600000 00000001 8fc3b000
[    2.788918]         80600000 8026d598 80690000 00000020 80600000 00000000 8fff0000 8fc3b048
[    2.797253]         8fed8c68 8fed8c68 80600000 8fc3b0f0 fffffff4 ac07f552 8fc3b148 8fc3b048
[    2.805587]         8fed8c68 8fed8c68 80600000 8fc3b0f0 fffffff4 80316050 81232df0 81232df0
[    2.813919]         92934f59 00000000 80600000 80057824 80600000 80052100 00000000 8fd0e880
[    2.822254]         ...
[    2.824692] Call Trace:
[    2.827127] [<80313a04>] nvme_pci_reg_read64+0x0/0x4
[    2.832071] [<80312178>] nvme_init_identify+0x84/0x88c
[    2.837192] [<80316050>] nvme_reset_work+0x710/0x17c8
[    2.842244] [<80045698>] process_one_work+0x258/0x400
[    2.847275] [<80045b90>] worker_thread+0x350/0x5b4
[    2.852056] [<8004b708>] kthread+0x130/0x144
[    2.856311] [<8000b0d8>] ret_from_kernel_thread+0x14/0x1c
[    2.861687] Code: 8fb0001c  03e00008  27bd0038 <000c000d> 27bdffb8  3c028059  2442f748  afbe0040  afb7003c
[    2.871413]
[    2.873009] ---[ end trace 60eb083112156e94 ]---
[    2.878765] Kernel panic - not syncing: Fatal exception
[    2.885080] Rebooting in 1 seconds..

Curious, were you able to resolve this? I'm also looking get this working. Thanks!

nvme_pci_reg_read64 use readq like this

static int nvme_pci_reg_read64(struct nvme_ctrl *ctrl, u32 off, u64 *val)
{
*val = readq(to_nvme_dev(ctrl)->bar + off);
return 0;
}

but this code compiled as below:
.text:000011E8 nvme_pci_reg_read64: # DATA XREF: .rodata:00004570↓o
.text:000011E8 break 0x3000

so, modify kernel source
drivers/nvme/host/pci.c

static int nvme_pci_reg_read64(struct nvme_ctrl *ctrl, u32 off, u64 *val)
{
*val = readq(to_nvme_dev(ctrl)->bar + off);
return 0;
}

to

static int nvme_pci_reg_read64(struct nvme_ctrl *ctrl, u32 off, u64 *val)
{
*val = lo_hi_readq(to_nvme_dev(ctrl)->bar + off);
return 0;
}

done.