All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 12/12] riscv: Add QEMU virt board support
Date: Sat, 8 Sep 2018 02:14:36 +0300	[thread overview]
Message-ID: <20180908021436.6b00a19c@thinkpad> (raw)
In-Reply-To: <CAEUhbmWYG-9m5H-SUVbi5o8JVcRJ+DxSzsCrYgju2J1ktFaniw@mail.gmail.com>

Hi Bin,

On Fri, 7 Sep 2018 09:49:24 +0800
Bin Meng <bmeng.cn@gmail.com> wrote:

> Hi Tuomas,
> 
> On Fri, Sep 7, 2018 at 5:03 AM Tuomas Tynkkynen
> <tuomas.tynkkynen@iki.fi> wrote:
> >
> > Hi Bin,
> >
> > On 09/04/2018 12:31 PM, Bin Meng wrote:  
> > > Hi Lukas,
> > >
> > > On Tue, Sep 4, 2018 at 5:39 AM Auer, Lukas
> > > <lukas.auer@aisec.fraunhofer.de> wrote:  
> > >>
> > >> On Thu, 2018-08-30 at 00:54 -0700, Bin Meng wrote:  
> > >>> This adds QEMU RISC-V 'virt' board target support, with the
> > >>> hope of helping people easily test U-Boot on RISC-V.
> > >>>
> > >>> The QEMU virt machine models a generic RISC-V virtual machine
> > >>> with support for the VirtIO standard networking and block
> > >>> storage devices. It has CLINT, PLIC, 16550A UART devices in
> > >>> addition to VirtIO and it also uses device-tree to pass
> > >>> configuration information to guest software. It implements
> > >>> RISC-V privileged architecture spec v1.10.
> > >>>
> > >>> Both 32-bit and 64-bit builds are supported. Support is pretty
> > >>> much preliminary, only booting to U-Boot shell with the UART
> > >>> driver on a single core. Booting Linux is not supported yet.
> > >>>  
> > >>
> > >> For your information and to avoid duplicate work, I am working
> > >> on a patch set that improves RISC-V support in u-boot. I am
> > >> currently able to boot Linux on a multi-core setup in QEMU, but
> > >> they are not quite ready to submit yet.
> > >>  
> > >
> > > This is great! My next step is to work on virtio driver support in
> > > U-Boot as qemu-riscv virt machine has these devices but we don't
> > > have corresponding drivers in U-Boot.  
> > At some point I was working on porting the virtio stack from Linux
> > to U-Boot and IIRC got virtio-blk and virtio-net working on ARM.
> > But other things consumed my time and I never quite finished that
> > work. Let me know if you want to take a look.  
> 
> This is great. I just finished reading the virtio 1.0 spec and was
> about to start the work. My interest was to add virtio-blk and
> virtio-net driver to U-Boot too since they are most common devices
> (others are not used too much I believe). If you already have the
> drivers working, I can help to bring them upstream.

You can find my branch here:

https://github.com/dezgeg/u-boot/tree/virtio

It should work under qemu_arm64_defconfig as follows:

qemu-system-aarch64 -machine virt -cpu cortex-a57 -m 512 \
  -bios u-boot.bin -s -nographic \
  -netdev user,id=net0 -device virtio-net-device,netdev=net0 \
  -drive if=none,file=disk.img,id=disk0 \
  -device virtio-blk-device,drive=disk0

I tried with Fedora-Server-netinst-aarch64-28-1.1.iso I had lying
around and letting it auto-boot worked fine.

Also interrupting the boot and doing 'virtio scan; dhcp' gets a
successful DHCP lease from QEMU's internal server.

I took a brief look and these things still need work:

- Some of the virtio headers imported verbatim cause compiler
  warnings because we don't disable strict aliasing.

- Architectures need to import various definitions from Linux.
  At least PAGE_SIZE & PAGE_SHIFT and wmb() & rmb().
  (currently there are just gross hacks around this)

- Feature negotiation (needed for virtio-net to be able to
  set/get a MAC address) is not implemented yet.

- The virtio-pci transport is not implemented, only virtio-mmio.

- Error handling is missing in many places.

- Resource cleanup in some places, like virtio-net which needs to
  remove live buffers from the RX virtqueue on shutdown and I haven't
  looked into how to do that.

- Lots of small things like removing debug/commented out code, wrong
  kerneldoc comments, dead/uneeded code etc. to be cleaned up.

Have fun and let me know if you have questions.

- Tuomas

  reply	other threads:[~2018-09-07 23:14 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-30  7:54 [U-Boot] [PATCH 00/12] riscv: Add QEMU virt board support Bin Meng
2018-08-30  7:54 ` [U-Boot] [PATCH 01/12] riscv: kconfig: Normalize architecture name spelling Bin Meng
2018-08-30  7:54 ` [U-Boot] [PATCH 02/12] riscv: Remove setup.h Bin Meng
2018-08-30  7:54 ` [U-Boot] [PATCH 03/12] riscv: bootm: Correct the 1st kernel argument to hart id Bin Meng
     [not found]   ` <752D002CFF5D0F4FA35C0100F1D73F3F6BCB9A4C@ATCPCS16.andestech.com>
2018-09-03  7:03     ` Rick Chen
2018-09-03 21:41   ` Auer, Lukas
2018-09-06  2:57     ` Bin Meng
2018-09-06 21:34       ` Auer, Lukas
2018-08-30  7:54 ` [U-Boot] [PATCH 04/12] riscv: Remove mach type Bin Meng
2018-08-30  7:54 ` [U-Boot] [PATCH 05/12] riscv: Move the linker script to the CPU root directory Bin Meng
2018-08-30  7:54 ` [U-Boot] [PATCH 06/12] riscv: Fix coding style issues in the linker script Bin Meng
2018-08-30  7:54 ` [U-Boot] [PATCH 07/12] riscv: Explicitly pass -march and -mabi to the compiler Bin Meng
2018-08-30  7:54 ` [U-Boot] [PATCH 08/12] riscv: Add a helper routine to print CPU information Bin Meng
2018-09-03 21:42   ` Auer, Lukas
2018-09-06  3:03     ` Bin Meng
2018-09-06 21:29       ` Auer, Lukas
2018-09-07  1:44         ` Bin Meng
2018-08-30  7:54 ` [U-Boot] [PATCH 09/12] riscv: Make start.S available for all targets Bin Meng
2018-08-30  7:54 ` [U-Boot] [PATCH 10/12] riscv: ae350: Clean up mixed tabs and spaces in the dts Bin Meng
2018-08-30  7:54 ` [U-Boot] [PATCH 11/12] riscv: kconfig: Select DM and OF_CONTROL Bin Meng
2018-08-30  7:54 ` [U-Boot] [PATCH 12/12] riscv: Add QEMU virt board support Bin Meng
2018-09-03 21:39   ` Auer, Lukas
2018-09-04  9:31     ` Bin Meng
2018-09-04 21:53       ` Auer, Lukas
     [not found]         ` <752D002CFF5D0F4FA35C0100F1D73F3F6BCBA74D@ATCPCS16.andestech.com>
2018-09-05  1:28           ` Rick Chen
2018-09-05  2:30             ` Rick Chen
2018-09-05  2:34             ` Bin Meng
2018-09-05  6:26               ` Rick Chen
2018-09-05  9:37               ` Auer, Lukas
2018-09-06  3:15                 ` Bin Meng
2018-09-06 22:21                   ` Auer, Lukas
2018-09-05  9:34             ` Auer, Lukas
2018-09-06  3:14               ` Bin Meng
2018-09-06 22:18                 ` Auer, Lukas
2018-09-06 21:03       ` Tuomas Tynkkynen
2018-09-07  1:49         ` Bin Meng
2018-09-07 23:14           ` Tuomas Tynkkynen [this message]
2018-09-08  1:28             ` Bin Meng
2018-09-10  0:16               ` Tuomas Tynkkynen
2018-09-10  1:23                 ` Bin Meng
     [not found] ` <752D002CFF5D0F4FA35C0100F1D73F3F6BCB9A09@ATCPCS16.andestech.com>
2018-09-03  6:45   ` [U-Boot] [PATCH 00/12] " Rick Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180908021436.6b00a19c@thinkpad \
    --to=tuomas.tynkkynen@iki.fi \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.