Hi Jan,

On Sun, May 29, 2022 at 2:39 PM Jan Kiszka <[email protected]> wrote:
>
> On 29.05.22 12:53, Lad, Prabhakar wrote:
> > Hi Jan,
> >
> > On Sun, May 29, 2022 at 9:35 AM Jan Kiszka <[email protected]> wrote:
> >>
> >> On 28.05.22 21:13, Lad, Prabhakar wrote:
> >>> Hi Jan,
> >>>
> >>> On Sat, May 28, 2022 at 3:41 PM Jan Kiszka <[email protected]> wrote:
> >>>>
> >>>> On 28.05.22 15:22, Lad, Prabhakar wrote:
> >>>>> On Fri, May 27, 2022 at 6:07 AM Jan Kiszka <[email protected]> 
> >>>>> wrote:
> >>>>>>
> >>>>>> If that should be the case, you could use the JTAG to "trace" how far
> >>>>>> you get: Add an infinite loop at some point the setup should get along,
> >>>>>> and then check with the debugger if PC points to that address and if 
> >>>>>> EL2
> >>>>>> is active. With that, you could also check if the UART print-out is
> >>>>>> executed.
> >>>>>>
> >>>>> After tracing back I see it's looping infinitely somewhere in the
> >>>>> hypervisor.o file, below is the code where it repeatedly loops.
> >>>>>
> >>>>>     ffffc0209550:    b9400680     ldr    w0, [x20, #4]
> >>>>>     ffffc0209554:    b9403481     ldr    w1, [x4, #52]
> >>>>>     ffffc0209558:    6b00003f     cmp    w1, w0
> >>>>>     ffffc020955c:    540013a8     b.hi    ffffc02097d0 <entry+0x2d8>
> >>>>>     .....
> >>>>>     ffffc02097d0:    17ffff60     b    ffffc0209550 <entry+0x58>
> >>>>>
> >>>>> I haven't managed to find where exactly in the C file this is
> >>>>> happening yet. Any thoughts on what could be happening?
> >>>>>
> >>>>
> >>>> That's very likely
> >>>>
> >>>> while (entered_cpus < hypervisor_header.online_cpus)
> >>>>         cpu_relax();
> >>>>
> >>> Thanks for the pointer really appreciated.
> >>>
> >>>> Did you configure more CPUs than there are in the system?
> >>>>
> >>> No I haven't, I've set it up as cpus = 0x3f for 6 CPUs (2xa57 +
> >>> 4xa53). I don't know what was happening there when I removed the
> >>> infinite loop (which I used for break point) from entry.S that went
> >>> OK. There was also an issue with the debug uart driver which I've
> >>> fixed and able to get the prints now.
> >>>
> >>> So now moving forward I am seeing "Unhandled data read"!
> >>>
> >>> Looking at the address for Unhandled data read one belongs to GIC
> >>> (0xf102f00c) and the other one belongs to the debug uart (0xe6e88008).
> >>
> >> Regarding GICC access: Try setting gicc_base to 0xf102f000 in the root
> >> cell config.
> >>
> > Setting gicc_base to 0xf102f000 has solved the issue, I no longer get
> > unhandled data reads now.
> >
> >> Regarding the UART: Do you pass that address through to the root cell as
> >> well? It's generally fine to allow both hypervisor and one cell to
> >> access the UART in parallel. Otherwise, disable UART usage by the root
> >> cell prior to enabling Jailhouse.
> >>
> > No, I don't pass the UART address to the root cell as part of
> > mem_regions. I just have it as part of the header config as below:
> >
> >         .debug_console = {
> >             .address = 0xe6e88000,
> >             .size = 0x40,
> >             .type = JAILHOUSE_CON_TYPE_SCIFA,
> >             .flags = JAILHOUSE_CON_ACCESS_MMIO |
> >                  JAILHOUSE_CON_REGDIST_4,
> >         },
> >
> > By disabling the UART usage by the root cell did you mean to use
> > JAILHOUSE_CON_TYPE_NONE? I tried adding JAILHOUSE_CON_TYPE_NONE but I
>
> No, I meant
>
>  - stop using the UART as kernel console
>  - stop running a getty on the UART (the latter happens automatically
>    with systemd when doing the former)
>
Right, I'll give that a shot, by disabling after logging into (using
systemd) and then ssh the board to run the jailhouse enable command.

> > don't get anything on the console after enabling the root cell. I even
> > tried removing the entire debug_console{} from the root cell config
> > but still I don't see any output on console.
> >
> > If I update the size to 0x1000 as below and also include it as part of
> > mem_regions, I get to a state where I see the message "The Jailhouse
> > is opening" but the console seems to be frozen.
>
> Sorry, I missed one bit in the gic configuration pattern on some arm64
> targets (scan configs/arm64): you also need to set gicv_base to
> 0xf106f000, then it will work (crossing fingers...).
>
Thanks, after updating gicv_base to 0xf106f000 I get an "forbidden
access" error, looking at the address it belongs to ethernet
"e6800304" and this is configured in the memory regions

        /* AVB */ {
            .phys_start = 0xe6800000,
            .virt_start = 0xe6800000,
            .size = 0x800,
            .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE |
                JAILHOUSE_MEM_IO,
        },


root@hihope-rzg2m:~# ./hyp.sh
Reading configuration set:
  Root cell:     Renesas HopeRun HiHope RZ/G2M (renesas-r8a774a1.cell)
Overlapping memory regions inside cell: None
Overlapping memory regions with hypervisor: None
Missing resource interceptions for architecture arm64: None
root@hihope-rzg2m:~#
root@hihope-rzg2m:~#
root@hihope-rzg2m:~# jailhouse enable renesas-r8a774a1.cell
[   26.483603] entering.

Initializing Jailhouse hypervisor v0.12 (318-gcc2122a6-dirty) on CPU 1
Code location: 0x0000ffffc0200800
Page pool usage after early setup: mem 53/4063, remap 0/131072
Initializing processors:
 CPU 1... OK
 CPU 3... OK
 CPU 4... OK
 CPU 0... OK
 CPU 2... OK
 CPU 5... OK
Initializing unit: irqchip
Initializing unit: ARM SMMU v3
Initializing unit: ARM SMMU
Initializing unit: PVU IOMMU
Initializing unit: PCI
Page pool usage after late setup: mem 83/4063, remap 5/131072
:ctivFATAL: Inval[i d   M2M6I.O5 3r3e3a6d3,]  aedxdirtets.s
  e6800304, size: 4

FATAL: forbidden access (exception class 0x24)
Cell state before exception:
 pc: ffff8000107862e4   lr: ffff8000107864e4 spsr: 60000085     EL1
 sp: ffff800011dcae20  elr: ffff8000107862e4  esr: 24 1 1800006
 x0: ffff8000113ed304   x1: 00000000000002c0   x2: 30e3720f2aa97500
 x3: 000000000000003f   x4: 0000000000000002   x5: 00000000b7905800
 x6: ffff000077905906   x7: 2c00000016000000   x8: 0050147b02070001
 x9: 4e4f4f3300000000  x10: e70b6a912c4534e6  x11: 0050b18400e5e36c
x12: 0050c09b8291345d  x13: 09000000f1423a46  x14: 1a01100002000000
x15: 2c00000016000000  x16: 0000000000000002  x17: 0000000000000000
x18: 0000000000000000  x19: 0000000000000001  x20: 0000000000000000
x21: ffff0005c118a840  x22: ffff0005c118ab48  x23: ffff0005c29c84fe
x24: ffff0005c118a000  x25: 0000000000000106  x26: ffff8000113fd048
x27: ffff0005c2be5cc8  x28: ffff0005c118a000  x29: ffff800011dcae20

Parking CPU 3 (Cell: "Renesas HopeRun HiHope RZ/G2M")
[   26.577661] Unable to handle kernel NULL pointer dereference at
virtual address 0000000000000000
[   26.622512] Unable to handle kernel NULL pointer dereference at
virtual address 0000000000000000
[   26.622521] Mem abort info:
[   26.622525]   ESR = 0x86000004
[   26.622531]   EC = 0x21: IABT (current EL), IL = 32 bits
[   26.622535]   SET = 0, FnV = 0
[   26.622539]   EA = 0, S1PTW = 0
[   26.622547] user pgtable: 4k pages, 48-bit VAs, pgdp=00000006009da000
[   26.622551] [0000000000000000] pgd=0000000000000000, p4d=0000000000000000
[   26.622569] Internal error: Oops: 86000004 [#1] PREEMPT SMP
[   26.622574] Modules linked in: jailhouse(O)
[   26.622595] CPU: 3 PID: 247 Comm: systemd-journal Tainted: G
   O      5.10.31+ #34
[   26.622600] Hardware name: HopeRun HiHope RZ/G2M with sub board (DT)
[   26.622609] pstate: 60000085 (nZCv daIf -PAN -UAO -TCO BTYPE=--)
[   26.622623] pc : 0x0
[   26.622642] lr : ravb_start_xmit+0x40c/0x680
[   26.622646] sp : ffff800011dcae20
[   26.622650] x29: ffff800011dcae20 x28: ffff0005c118a000
[   26.622660] x27: ffff0005c2be5cc8 x26: ffff8000113fd048
[   26.622670] x25: 0000000000000106 x24: ffff0005c118a000
[   26.622681] x23: ffff0005c29c84fe x22: ffff0005c118ab48
[   26.622690] x21: ffff0005c118a840 x20: 0000000000000000
[   26.622699] x19: 0000000000000001 x18: 0000000000000000
[   26.622709] x17: 0000000000000000 x16: 0000000000000002
[   26.622718] x15: 2c00000016000000 x14: 1a01100002000000
[   26.622728] x13: 09000000f1423a46 x12: 0050c09b8291345d
[   26.622737] x11: 0050b18400e5e36c x10: e70b6a912c4534e6
[   26.622747] x9 : 4e4f4f3300000000 x8 : 0050147b02070001
[   26.622757] x7 : 2c00000016000000 x6 : ffff000077905906
[   26.622766] x5 : 00000000b7905800 x4 : 0000000000000002
[   26.622775] x3 : 000000000000003f x2 : 30e3720f2aa97500
[   26.622784] x1 : 00000000000002c0 x0 : ffff8000113ed304
[   26.622795] Call trace:
[   26.622802]  0x0
[   26.622814]  dev_hard_start_xmit+0xe8/0x188
[   26.622826]  sch_direct_xmit+0x12c/0x318
[   26.622834]  __qdisc_run+0x11c/0x5b8
[   26.622841]  __dev_queue_xmit+0x1e0/0x700
[   26.622847]  dev_queue_xmit+0x14/0x20
[   26.622860]  ip_finish_output2+0x260/0x5d0
[   26.622868]  __ip_finish_output+0x194/0x238
[   26.622876]  ip_output+0x104/0x1b0
[   26.622883]  ip_local_out+0x48/0x60
[   26.622891]  __ip_queue_xmit+0x124/0x398
[   26.622899]  ip_queue_xmit+0x14/0x20
[   26.622907]  __tcp_transmit_skb+0x4e8/0xb38
[   26.622913]  tcp_write_xmit+0x228/0x1090
[   26.622919]  __tcp_push_pending_frames+0x3c/0xd0
[   26.622928]  tcp_push+0xd8/0x180
[   26.622935]  tcp_sendmsg_locked+0x998/0xc10
[   26.622942]  tcp_sendmsg+0x38/0x60
[   26.622953]  inet_sendmsg+0x44/0x70
[   26.622964]  sock_sendmsg+0x1c/0x38
[   26.622977]  xprt_sock_sendmsg+0xf8/0x300
[   26.622987]  xs_tcp_send_request+0xbc/0x1d8
[   26.622994]  xprt_transmit+0xac/0x2e8
[   26.623001]  call_transmit+0x98/0xb0
[   26.623009]  __rpc_execute+0x80/0x390
[   26.623015]  rpc_execute+0x8c/0xb0
[   26.623023]  rpc_run_task+0x170/0x1d8
[   26.623035]  nfs4_call_sync_custom+0x14/0x40
[   26.623041]  nfs4_do_call_sync+0x68/0x90
[   26.623050]  _nfs4_proc_getattr+0xd0/0x100
[   26.623061]  nfs4_proc_getattr+0x70/0xb8
[   26.623072]  __nfs_revalidate_inode+0x148/0x288
[   26.623081]  nfs_revalidate_mapping+0x218/0x280
[   26.623089]  nfs_get_link+0x28/0x170
[   26.623101]  step_into+0x538/0x690
[   26.623108]  walk_component+0x70/0x1d0
[   26.623114]  link_path_walk.part.48+0x294/0x3b8
[   26.623120]  path_parentat+0x48/0xb0
[   26.623126]  filename_parentat+0x94/0x170
[   26.623132]  filename_create+0x4c/0x178
[   26.623138]  do_mkdirat+0x68/0x118
[   26.623144]  __arm64_sys_mkdirat+0x20/0x30
[   26.623157]  el0_svc_common.constprop.3+0x68/0x170
[   26.623165]  do_el0_svc+0x24/0x90
[   26.623173]  el0_svc+0x14/0x20
[   26.623179]  el0_sync_handler+0x90/0xb8
[   26.623187]  el0_sync+0x158/0x180
[   26.623203] Code: bad PC value
[   26.623225] ---[ end trace 87851f23e735f09b ]---
[   26.623232] Kernel panic - not syncing: Oops: Fatal exception in interrupt
[   26.623240] SMP: stopping secondary CPUs
[   26.623372] Kernel Offset: disabled
[   26.623380] CPU features: 0x0040022,21002004
[   26.623384] Memory Limit: none
[   27.001277] ---[ end Kernel panic - not syncing: Oops: Fatal
exception in interrupt ]---

Cheers,
Prabhakar

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/CA%2BV-a8vhKb7ic998w275ajCjXSC0QmsnutAkDK-csJmP9DYzrg%40mail.gmail.com.

Reply via email to