Hi all,

 

I’m trying to add support for 9p to the riscv-fs platform (configs/example/gem5_library/riscv-fs.py) similar to the way it was done for arm systems using the def attach_9p function (configs/common/FSConfig.py).

Summary:

 

When trying to mount on the guest I get an error

mount -t 9p -o trans=virtio,version=9p2000.L,aname=/gem5rundir/m5out/9p/share gem5 /mnt/9p

mount: mounting gem5 on /mnt/9p failed: No such file or directory

 

The reason seems to be that VirtIO9PDiod device is not set up correctly under my Platform or Linux so that Linux can find the gem5 tag used for sharing.

 

Details:

I created my own board, which derives from the RiscvBoard and overwrites the function:

 

class COSRiscvBoard(RiscvBoard):

    @overrides(AbstractSystemBoard)

    def _setup_io_devices(self) -> None:

        super()._setup_io_devices()

        self.add_riscv_9p()

    def add_riscv_9p(self):

        print(f"Function _setup_board Adding 9p device to platform")

        self.viopci = PciVirtIO(pci_bus=0, pci_dev=1, # Hardcoded for the platform, Ethernet in RiscV Board is 0

                               pci_func=0, InterruptPin=1,

                               InterruptLine=1)

        self.viopci.vio = VirtIO9PDiod()

        viodir = os.path.realpath(os.path.join(m5.options.outdir, "9p"))

        self.viopci.vio.root = os.path.join(viodir, "share")

        self.viopci.vio.socketPath = os.path.join(viodir, "socket")

        os.makedirs(self.viopci.vio.root, exist_ok=True)

        if os.path.exists(self.viopci.vio.socketPath):

            os.remove(self.viopci.vio.socketPath)

 

        self.viopci.host = self.platform.pci_host

        self.viopci.pio = self.iobus.mem_side_ports

        self.viopci.dma = self.iobus.cpu_side_ports

 

I rebuilt the Linux with virtio9p support as described in http://old.gem5.org/WA-gem5.html under guest system requirements. During boot I see the new attached virtio-pci device (in Addition to the Ethernet device of the platfrom).

[    1.824575] pci-host-generic 30000000.pci: host bridge /soc/pci ranges:

[    1.825257] pci-host-generic 30000000.pci:   No bus range found for /soc/pci, using [bus 00-ff]

[    1.826709] pci-host-generic 30000000.pci:       IO 0x002f000000..0x002f00ffff -> 0x0000000000

[    1.827637] pci-host-generic 30000000.pci:      MEM 0x0040000000..0x007fffffff -> 0x0000000000

[    1.899228] pci-host-generic 30000000.pci: ECAM at [mem 0x30000000-0x3fffffff] for [bus 00-ff]

[    1.902419] pci-host-generic 30000000.pci: PCI host bridge to bus 0000:00

[    1.902923] pci_bus 0000:00: root bus resource [bus 00-ff]

[    1.903470] pci_bus 0000:00: root bus resource [io  0x0000-0xffff]

[    1.904121] pci_bus 0000:00: root bus resource [mem 0x40000000-0x7fffffff] (bus address [0x00000000-0x3fffffff])

[    1.905119] pci 0000:00:00.0: [8086:1075] type 00 class 0x020000

[    1.906011] pci 0000:00:00.0: reg 0x10: [mem 0x40000000-0x4001ffff]

[    1.906941] pci 0000:00:00.0: reg 0x30: [mem 0x40000000-0x400007ff pref]

[    1.911587] pci 0000:00:01.0: [1af4:1000] type 00 class 0xff0000

[    1.912321] pci 0000:00:01.0: reg 0x10: [io  0x0000-0x001f]

[    1.913207] pci 0000:00:01.0: reg 0x30: [mem 0x40000000-0x400007ff pref]

[    1.923427] pci 0000:00:00.0: BAR 0: assigned [mem 0x40000000-0x4001ffff]

[    1.924118] pci 0000:00:00.0: BAR 6: assigned [mem 0x40020000-0x400207ff pref]

[    1.924809] pci 0000:00:01.0: BAR 6: assigned [mem 0x40020800-0x40020fff pref]

[    1.925486] pci 0000:00:01.0: BAR 0: assigned [io  0x0000-0x001f]

 

However I get an error when loading the virtio-pci driver

[    1.939684] virtio-pci 0000:00:01.0: enabling device (0000 -> 0001)

[    1.940263] virtio-pci 0000:00:01.0: virtio_pci: leaving for legacy driver

[    1.940742] virtio-pci: probe of 0000:00:01.0 failed with error -12

There is also no device that provides the gem5 tag under /sys/bus/virtio/drivers/9pnet_virtio/virtio<n>/mount_tag files (https://www.kernel.org/doc/Documentation/filesystems/9p.txt)

root@UCanLinux:~ # ls /sys/bus/virtio/drivers/9pnet_virtio/

bind    module  uevent  unbind

I also checked that diod is in the path and I get message that it was started.

 

Anyone an idea why it is not working or what I can try to run it again

 

Best Regards,

 

Thilo

_______________________________________________
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org

Reply via email to