[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-discuss] versatilepb default network adapter

From: Peter Maydell
Subject: Re: [Qemu-discuss] versatilepb default network adapter
Date: Mon, 10 Jul 2017 13:55:50 +0100

On 10 July 2017 at 13:34, Tom Cook <address@hidden> wrote:
> I'm using the qemu versatilepb machine to emulate a raspberry pi for
> testing purposes.
> I'm starting qemu with this commandline:
> qemu-system-arm -kernel ./qemu-rpi-kernel/kernel-qemu-4.1.13-jessie \
>     -cpu arm1176 -m 256 -M versatilepb \
>     -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw console=tty0
> console=/dev/ttyAMA3,115200" \
>     -hda image.qcow2 -serial stdio -monitor none
> This comes up with a working NAT network interface.  I want to modify
> the network configuration.  I've tried adding `-netdev
> tap,helper=...,id=hn0 -device virtio-net-pci,netdev=hn0,id=nic1` to
> the command-line, and it boots but there is no ethernet adapter.

This usually means your kernel doesn't have PCI support or
doesn't have virtio-net compiled into it (usual giveaway
is lack of relevant PCI probing and virtio-net probing
info in the kernel boot log).

> I think I've tried pretty well every network device listed by `-device
> ?` now and they all fall into two categories: either the required bus
> isn't present in the machine (usb and virtio-bus) or as above, they
> boot with no ethernet adapter.
> I think I could probably get some of the PCI adapters working by
> sorting out the appropriate kernel modules in the guest, but before I
> do that, it seem to me that whatever the default adapter is should
> work - but I can't figure out what it is.  The guest uses the `smc91x`
> driver for it, but `-device ?` doesn't list any smc91x network
> adapters (it does list a smc91c111 under 'Uncategorized devices', but
> trying to use it results in:
> qemu-system-arm: Option '-device smc91c111' cannot be handled by this machine

This is because the versatilepb board's smc91c111 is a built in
device (it's like a network chip soldered to the board in hardware,
not like a PCI device that the user can plug in). So it's always
present, and you can't add a second one with -device (same as you
can't plug in a second network chip directly to a hardware board).

Unfortunately you here run into an awkward problem with QEMU's
command line syntax. We have two mechanisms for configuring
 (1) new-style -device + -netdev
 (2) old-style -net
You can't mix the two, but the built-in ethernet devices don't
work with -netdev, so you have to use -net to configure them.

So you have two choices here:
(1) figure out the -net syntax for tap networking and use it
with the built-in ethernet device
(2) ignore the built-in ethernet device and get your guest
kernel to work with virtio-net, which you can configure with
the -device/-netdev syntax

virtio-net will be rather more efficient, incidentally, because
it doesn't have to stuff all the network data through an
emulated device register 32 bits at a time.

-- PMM

reply via email to

[Prev in Thread] Current Thread [Next in Thread]