litex-hub / linux-on-litex-rocket

Run 64-bit Linux on LiteX + RocketChip
BSD 2-Clause "Simplified" License
181 stars 18 forks source link

Booting linux panic on Arty A7-100T 【uart and irq error】 #41

Closed Jerryy959 closed 3 months ago

Jerryy959 commented 3 months ago

With booting Linux on rocket, i get the following error:

[    0.078624] chip_bus_sync_unlock: irq_bus_sync_unlock not set for irq 11
[    0.078691] desc->handle_irq: ffffffff8032c36c    (null)
[    0.078744] chip_bus_sync_unlock: irq_bus_sync_unlock not set for irq 11
[    0.078828] riscv-plic c000000.interrupt-controller: mapped 8 interrupts with 1 handlers for 2 contexts.
[    0.079086] LiteX SoC Controller driver initialized
[    0.109675] desc->handle_irq: ffffffff80061298    (null)
[    0.109769] chip_bus_sync_unlock: irq_bus_sync_unlock not set for irq 12
[    0.109924] 12004000.serial: ttyLXU0 at MMIO 0x0 (irq = 12, base_baud = 0) is a liteuart
[    0.110000] printk: legacy console [liteuart0] enabled
[    0.110000] printk: legacy console [liteuart0] enabled
[    0.110098] printk: legacy bootconsole [liteuart0] disabled
[    0.110098] printk: legacy bootconsole [liteuart0] disabled
[    0.112242] loop: module loaded
[    0.117337] desc->handle_irq: ffffffff80061298    (null)
[    0.117382] chip_bus_sync_unlock: irq_bus_sync_unlock not set for irq 13
[    0.117618] liteeth 12001000.mac eth0: irq 13 slots: tx 2 rx 2 size 2048
[    0.117858] NET: Registered PF_INET6 protocol family
[    0.118372] Segment Routing with IPv6
[    0.118425] In-situ OAM (IOAM) with IPv6
[    0.118480] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    0.118750] NET: Registered PF_PACKET protocol family
[    0.122773] clk: Disabling unused clocks
[    0.122819] **Warning: unable to open an initial console.**
[    0.124237] Freeing unused kernel image (initmem) memory: 2868K
[    0.124293] Run /init as init process
[    0.124324]   with arguments:
[    0.124353]     /init
[    0.124376]   with environment:
[    0.124407]     HOME=/
[    0.124431]     TERM=linux
[    0.124457]     ip=192.168.31.50:192.168.31.51:192.168.31.51:255.255.255.0::eth0:off:::
[    0.129896] plic_handlers: 1fb7d0
[    0.129921] plic_handlers: 1fb7f0
[    0.421657] **irq 12: nobody cared (try booting with the "irqpoll" option)**
[    0.421714] CPU: 0 PID: 55 Comm: init Not tainted 6.9.0 #77
[    0.421770] Call Trace:
[    0.421794] [<ffffffff80004ff6>] dump_backtrace+0x1c/0x24
[    0.421848] [<ffffffff805097e0>] show_stack+0x2c/0x38
[    0.421898] [<ffffffff80511650>] dump_stack_lvl+0x50/0x72
[    0.421952] [<ffffffff80511686>] dump_stack+0x14/0x1c
[    0.422002] [<ffffffff8050a722>] __report_bad_irq+0x3e/0xae
[    0.422058] [<ffffffff800603ae>] note_interrupt+0x21e/0x268
[    0.422114] [<ffffffff8005d372>] handle_irq_event+0xbe/0xca
[    0.422169] [<ffffffff80061336>] handle_fasteoi_irq+0x9e/0x242
[    0.422227] [<ffffffff8005c264>] generic_handle_domain_irq+0x1c/0x2a
[    0.422291] [<ffffffff8032c3fa>] plic_handle_irq+0x8e/0x10c
[    0.422346] [<ffffffff8005c264>] generic_handle_domain_irq+0x1c/0x2a
[    0.422410] [<ffffffff8032a15e>] riscv_intc_irq+0x26/0x60
[    0.422463] [<ffffffff805116ec>] handle_riscv_irq+0x4a/0x74
[    0.422519] [<ffffffff80519dea>] call_on_irq_stack+0x32/0x40
[    0.422576] handlers:
[    0.422598] [<(____ptrval____)>] liteuart_interrupt
[    0.422647] Disabling IRQ #12
[    0.422676] plic_handlers: 3dd0
[    0.422766] genirq: chip_bus_sync_unlock: irq_bus_sync_unlock not set for irq 12
```�

1. **Warning: unable to open an initial console.** shows there is no console initialed correctly.
2. **irq 12: nobody cared (try booting with the "irqpoll" option)** irq 12 nobody cared.

As https://github.com/enjoy-digital/litex/issues/1976#issuecomment-2143256295 mentioned, 
I used `litex-json2dts-linux` to generate my dts file as follows (on Arty A7-100T board):

/dts-v1/;

/ {

address-cells = <1>;

    #size-cells    = <1>;

    chosen {
        bootargs = "console=liteuart earlycon=liteuart,0x12004000 swiotlb=noforce rootwait root=/dev/ram0 ip=192.168.31.50:192.168.31.51:192.168.31.51:255.255.255.0::eth0:off::: irqpoll";
        linux,initrd-start = <0x81000000>;
        linux,initrd-end   = <0x81800000>;
    };

    sys_clk: pll {
        compatible = "fixed-clock";
        #clock-cells = <0>;
        clock-frequency  = <50000000>;
    };

    cpus {
        #address-cells = <1>;
        #size-cells    = <0>;
        timebase-frequency = <50000000>;

        CPU0: cpu@0 {
            device_type = "cpu";
            compatible = "riscv";
            riscv,isa = "rv64i2p0_mafdc";
            riscv,isa-base = "rv64i";
            riscv,isa-extensions = "i", "m", "a", "f", "d", "c", "zicsr", "zifencei", "zihpm";
            mmu-type = "riscv,sv39";
            reg = <0>;
            clock-frequency = <50000000>;
            status = "okay";

            d-cache-size = <16384>;
            d-cache-sets = <64>;
            d-cache-block-size = <64>;

            i-cache-size = <16384>;
            i-cache-sets = <64>;
            i-cache-block-size = <64>;

            d-tlb-size = <32>;
            d-tlb-sets = <1>;

            i-tlb-size = <32>;
            i-tlb-sets = <1>;

            hardware-exec-breakpoint-count = <1>;
            next-level-cache = <&memory>;
            riscv,pmpgranularity = <4>;
            riscv,pmpregions = <8>;
            tlb-split;

            L0: interrupt-controller {
                #address-cells = <0>;
                #interrupt-cells = <0x00000001>;
                interrupt-controller;
                compatible = "riscv,cpu-intc";
            };
        };

    };

    memory: memory@80000000 {
        device_type = "memory";
        reg = <0x80000000 0x10000000>;
    };

    reserved-memory {
        #address-cells = <1>;
        #size-cells    = <1>;
        ranges;

        opensbi@80000000 {
            reg = <0x80000000 0x200000>;
        };

    };

    soc {
        #address-cells = <1>;
        #size-cells    = <1>;
        compatible = "simple-bus";
        interrupt-parent = <&intc0>;
        ranges;

        soc_ctrl0: soc_controller@12000000 {
            compatible = "litex,soc-controller";
            reg = <0x12000000 0xc>;
            status = "okay";
        };

        lintc0: clint@2000000 {
            compatible = "riscv,clint0";
            interrupts-extended = <
                &L0 3 &L0 7>;
            reg = <0x2000000 0x10000>;
            reg-names = "control";
        };

        intc0: interrupt-controller@c000000 {
            compatible = "sifive,fu540-c000-plic", "sifive,plic-1.0.0";
            reg = <0xc000000 0x400000>;
            #address-cells = <0>;
            #interrupt-cells = <1>;
            interrupt-controller;
            interrupts-extended = <
                &L0 11 &L0 9>;
            riscv,ndev = <8>;

            reg-names = "control";
            riscv,max-priority = <7>;

        };

        dbg_ctl: debug-controller@0 {
            compatible = "sifive,debug-013", "riscv,debug-013";
            interrupts-extended = <
                &L0 0x3F>;
            reg = <0x0 0x1000>;
            reg-names = "control";
        };
        err_dev: error-device@3000 {
            compatible = "sifive,error0";
            reg = <0x3000 0x1000>;
        };
        ext_it: external-interrupts {
            interrupts = <1 2 3 4 5 6 7 8>;
        };
        rom: rom@10000 {
            compatible = "sifive,rom0";
            reg = <0x10000 0x10000>;
            reg-names = "mem";
        };

        **liteuart0: serial@12004000 {
            compatible = "litex,liteuart";
            reg = <0x12004000 0x100>;
            interrupts = <1>;
            interrupt-parent = <&intc0>;
            status = "okay";
        };**

        mac0: mac@12001000 {
            compatible = "litex,liteeth";
            reg = <0x12001000 0x7c>,
                  <0x12001800 0x0a>,
                  <0x30000000 0x2000>;
            reg-names = "mac", "mdio", "buffer";
            litex,rx-slots = <2>;
            litex,tx-slots = <2>;
            litex,slot-size = <2048>;
            interrupts = <3>;
            status = "okay";
        };

        leds: gpio@12002800 {
            compatible = "litex,gpio";
            reg = <0x12002800 0x4>;
            gpio-controller;
            #gpio-cells = <2>;
            litex,direction = "out";
            status = "disabled";
        };

    };

    aliases {

            serial0 = &liteuart0;

    }; };


How can i debug it ?
Jerryy959 commented 3 months ago

@gsomlo Hi, can u help me think about it ?

Jerryy959 commented 3 months ago

This issue can be closes as the problem has been solved.