Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[virtio][9p] Add VirtIO 9p device driver #399

Merged
merged 3 commits into from
Apr 2, 2024

Commits on Dec 26, 2023

  1. [virtio][v9p] Add the VirtIO 9p device driver

    This commit adds the VirtIO 9p device driver based on the VirtIO driver
    stack in LK, `dev/virtio`. The driver supports a subset of 9P2000.L
    protocol (https://github.com/chaos/diod/blob/master/protocol.md), which
    is able to perform basic file operations (fread, fwrite, dirread, etc.).
    The primary interface for sending and receiving the 9p messages is
    `virtio_9p_rpc`, which is handy and scalable.
    
    The driver is limited to communicate to the host with only one
    outstanding 9p message per device due to the simplified driver design.
    Basically that is enough for embedded environments when there is no
    massive file IO.
    
    Signed-off-by: Cody Wong <[email protected]>
    mob5566 committed Dec 26, 2023
    Configuration menu
    Copy the full SHA
    0392b03 View commit details
    Browse the repository at this point in the history
  2. [tests][v9p] Add an example test for VirtIO 9p device

    Add a simple test to validate basic functionalities of the VirtIO 9p
    device driver, `dev/virtio/9p`.
    
    For now the test attaches to the first v9p device and try to read the
    file `LICENSE` under the shared folder. Therefore, if you set the shared
    folder to the git root of `lk`, it will read the `LICENSE` of the
    littlekernel and dump it to the console after running `v9p_tests`.
    
    For example:
    
    ```
    starting internet servers
    starting app shell
    entering main console loop
    ] v9p_tests
    0x80013c08: 2f 2a 0a 20 2a 20 43 6f 70 79 72 69 67 68 74 20 |/*. * Copyright
    0x80013c18: 28 63 29 20 32 30 30 38 2d 32 30 31 35 20 54 72 |(c) 2008-2015 Tr
    0x80013c28: 61 76 69 73 20 47 65 69 73 65 6c 62 72 65 63 68 |avis Geiselbrech
    0x80013c38: 74 0a 20 2a 0a 20 2a 20 50 65 72 6d 69 73 73 69 |t. *. * Permissi
    0x80013c48: 6f 6e 20 69 73 20 68 65 72 65 62 79 20 67 72 61 |on is hereby gra
    ...
    ```
    
    Signed-off-by: Cody Wong <[email protected]>
    mob5566 committed Dec 26, 2023
    Configuration menu
    Copy the full SHA
    2983f16 View commit details
    Browse the repository at this point in the history
  3. [arm][v9p] Add v9p host dir sharing support for arm platform

     - Add the v9p support for arm platform.
     - Add an option `-f` to set the shared directory on the host machine to
       `do-qemuarm`.
     - For example, to use the v9p dir sharing, run the script as:
        ```
        # under `lk/` run the follow command will share the current
        # directory `lk/` within LK vm as VirtIO 9p device
        scripts/do-qemuarm -f .
        ```
    
    Signed-off-by: Cody Wong <[email protected]>
    mob5566 committed Dec 26, 2023
    Configuration menu
    Copy the full SHA
    d2445a6 View commit details
    Browse the repository at this point in the history