This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to enable a shared directory between the booted guest OS on Morello FVP and the host linux machine

Hi,

I want to experiment with capability enabled LLVM - but would like to have a shared directory  between the Morello FVP  and the host linux. Please could you give some more detailed instructions on this, sorry if I have missed anything obvious in the documentation. 

Thanks,

Andy

Parents
  • Hi, 

    the latest Dec 2020 maintenance release now includes support for virtio_p9 - however I'm still having some issues, and have missed something obvious ... I tried Poky by (appropriately setting -C board.virtio_p9.root_path=/home/morello/SHARED in run_model.sh) and running the command below after a fresh install of FVP and rebuilding the board support. 

    ./run-scripts/run_model.sh -m ~/FVP_Morello/models/Linux64_GCC-6.4/FVP_Morello -f poky

    then after boot and log in to the model ...

    root@morello-fvp:~# mount -t 9p -o trans=virtio,version=9p2000.L FM /mnt/HOST
    [ 646.303364] 9pnet_virtio: no channels available for device FM
    mount: mounting FM on /mnt/HOST failed: No such file or directory

    My host (ubuntu20.04.1 LTS) lsmod | grep virtio
    9pnet_virtio 20480 0
    9pnet 81920 2 9p,9pnet_virtio
    virtio_input 16384 0

    Thanks,

    Andy

Reply
  • Hi, 

    the latest Dec 2020 maintenance release now includes support for virtio_p9 - however I'm still having some issues, and have missed something obvious ... I tried Poky by (appropriately setting -C board.virtio_p9.root_path=/home/morello/SHARED in run_model.sh) and running the command below after a fresh install of FVP and rebuilding the board support. 

    ./run-scripts/run_model.sh -m ~/FVP_Morello/models/Linux64_GCC-6.4/FVP_Morello -f poky

    then after boot and log in to the model ...

    root@morello-fvp:~# mount -t 9p -o trans=virtio,version=9p2000.L FM /mnt/HOST
    [ 646.303364] 9pnet_virtio: no channels available for device FM
    mount: mounting FM on /mnt/HOST failed: No such file or directory

    My host (ubuntu20.04.1 LTS) lsmod | grep virtio
    9pnet_virtio 20480 0
    9pnet 81920 2 9p,9pnet_virtio
    virtio_input 16384 0

    Thanks,

    Andy

Children
  • As far as I know, neither TF-A's FDT nor edk2-platform's DSDT include a description for the device and so the OS does not know it exists. You could try patching your TF-A's morello-fvp.dts to include it based on developer.arm.com/.../Morello-Platform-Model-notes-and-limitations. 

  • Hi Andy,

    To enable and use the virtio P9 device you need to follow the steps below:

    1- Enable the following kernel build flags.

    CONFIG_NET_9P
    CONFIG_NET_9P_VIRTIO
    CONFIG_9P_FS
    CONFIG_9P_FS_POSIX_ACL
    CONFIG_9P_FSCACHE
    CONFIG_9P_FS_SECURITY

    2 - Add the following configuration to your DTS:

    virtio_p9@1c1A0000 {
           compatible = "virtio,mmio";
           reg = <0x0 0x1c1a0000 0x0 0x200>;
           interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
    };

    3 - Rebuild everything

    4 - Follow the instructions on how to use the virtio P9 located in the Fast Models Reference Manual 11.13

    I hope this helps!

    Regards,

    Mauricio

  • Hi,

    apologies - it's my first time delving into FVPs into any detail, so I'd appreciate a few more pointers if you can spare the time ...

    STEP 1 - are talking about the host linux, or the guest linux hosted via the FVP? 

    STEP 2 ...

    I'm using instructions from https://git.morello-project.org/morello/docs/-/blob/morello/mainline/user-guide.rst

    Given that it is bitbake based ... then I need to do something like?

     devtool modify trusted-firmware-a

    Add the appropriate DTS configuration to  dtsi file(s)  in the trusted-firmware-a tree, any pointers on which one(s)?

    STEP 3

    bitbake trusted-firmware-a

    bitbake core-image-minimal

    STEP 4 seems clear - is chmod 777 myHostLinuxDirectory

    still required for the host linux directory that is pointed to by the root_path configuration parameter passed to the FVP? 

    On the FVP, after trying out these steps, I get the same error as before ...

    Also using

    find /proc/device-tree/ -type f -exec head {} + | grep virtio

    to determine if the virtio_p9 is loaded,  ... so far no luck ... despite a few attempts.

    Thanks,

    Andy

  • Hi Andy,

    Apologies for my brief summary on how to enable the virtio_p9. The changes are only applied to the guest OS, the one running on the FVP. Please follow the steps below under the morello_workspace poky directory structure:

    1 - Add the build kernel flags below to <path to workspace>morello_workspace/bsp/build-poky/tmp-poky/work/morello_fvp-poky-linux/linux-yocto/5.4.51+gitAUTOINC+caafbdfe38_fed60f1c8e-r0/defconfig

    CONFIG_NET_9P=y
    CONFIG_NET_9P_VIRTIO=y
    CONFIG_9P_FS=y
    CONFIG_9P_FS_POSIX_ACL=y
    CONFIG_PCI=y
    CONFIG_VIRTIO_PCI=y
    CONFIG_9P_FSCACHE=y
    CONFIG_9P_FS_SECURITY=y

    2 - Add the virtio_p9 configuration shown below to <path to workspace>morello_workspace/bsp/build-poky/tmp-poky/work/morello_fvp-poky-linux/trusted-firmware-a/1.0+gitAUTOINC+746e7e322f-r0/git/fdts/morello-fvp.dts

    virtio_p9@1c1A0000 {
           compatible = "virtio,mmio";
           reg = <0x0 0x1c1a0000 0x0 0x200>;
           interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>;
    };

    3 - Recompile TFA:

          bitbake trusted-firmware-a -C compile

    4 - Recompile linux-yocto:

         bitbake linux-yocto -C compile

    5 - Recreate the images: (You might get a few warnings showing that some tfa and linux have been modified)

        bitbake core-image-minimal

    6 - Add to <path to workspace>morello_workspace/run-scripts/run_model.sh the following model parameter (at around line 371)

      -C "board.virtio_p9.root_path=$PWD/shared_folder"

    7 - Before launching the model create a folder on the host named shared_folder

      mkdir <path to workspace>morello_workspace/shared_folder

      **On the morello_workspace you should have the following folders: bsp docs run-scripts shared_folder

    8 - Launch the model

      ./run-scripts/run_model.sh -m <path to fvp executable> -f poky

    9 - On the model, when Poky finishes booting, log in as root and on the guest terminal, create and mount the shared folder as follows:

      mkdir shared_folder

      mount -t 9p -o trans=virtio,version=9p2000.L FM shared_folder

    10 - Try to create a file from the guest terminal on the shared_folder and then reading it from the host shared folder. Try the other way round.

    Although this might not be the optimal solution, I have made it work on a poky build.

    I hope this temporary solution helps for now while we're looking into adding it to the repository.

    Best regards,

    Mauricio

  • Many many thanks, that was very easy to follow first time. For the benefit of others -  a minor thing, if you've executed a

    devtool modify trusted-firmware-a

    then you will obviously need to update the dts file ... something like

    <morello workspace>/bsp/build-poky/workspace/sources/trusted-firmware-a/fdts/morello-fvp.dts