mbox series

[0/7] PCI support for UML

Message ID 20210223152707.408995-1-johannes@sipsolutions.net
Headers show
Series PCI support for UML | expand

Message

Johannes Berg Feb. 23, 2021, 3:27 p.m. UTC
Hi,

In order to simulate some devices and write tests completely
independent of real PCI devices, we continued the development
of time-travel and related bits, and are adding PCI support
here now.

The way it works is that it communicates with the outside (of
UML) with virtio, which we previously added using vhost-user,
and then offers a PCI bus to the inside system, where normal
PCI probing etc. happens, but all config space & IO accesses
are forwarded over virtio.

To enable that, add lib/logic_iomem, similar to logic_pio but
for iomem regions, this way, ioread/iowrite can be redirected
over the virtio device.

Since currently no official virtio device ID is assigned yet
a Kconfig option for that is required to be set to the value
you want to use locally for experimentation. Once we have an
official value we can change the default (currently -1 which
makes it non-functional) or remove the option entirely.

johannes

Comments

Johannes Berg Feb. 23, 2021, 9:24 p.m. UTC | #1
On Tue, 2021-02-23 at 16:27 +0100, Johannes Berg wrote:
> In order to simulate some devices and write tests completely
> independent of real PCI devices, we continued the development
> of time-travel and related bits, and are adding PCI support
> here now.
> 
> The way it works is that it communicates with the outside (of
> UML) with virtio, which we previously added using vhost-user,
> and then offers a PCI bus to the inside system, where normal
> PCI probing etc. happens, but all config space & IO accesses
> are forwarded over virtio.

I hadn't sent it out until now, but the userspace bits for all the time-
travel and PCI-over-vhost-user are here:

https://github.com/linux-test-project/usfstl/

If anyone has any suggestions on a good example PCI device that already
has a driver upstream I'd be interested - I looked for something simple
like LED or GPIO but no such thing I could find (that wasn't platform
dependent in some way). So far I've only implemented a virtual Intel
WiFi NIC, but that depends on a large body of code I can't publish. As
an example, it would be nice to write (and publish there) a simple PCI
device implementation. :)

johannes
Geert Uytterhoeven Feb. 24, 2021, 9:47 a.m. UTC | #2
Hi Johannes,

On Tue, Feb 23, 2021 at 10:24 PM Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Tue, 2021-02-23 at 16:27 +0100, Johannes Berg wrote:
> > In order to simulate some devices and write tests completely
> > independent of real PCI devices, we continued the development
> > of time-travel and related bits, and are adding PCI support
> > here now.
> >
> > The way it works is that it communicates with the outside (of
> > UML) with virtio, which we previously added using vhost-user,
> > and then offers a PCI bus to the inside system, where normal
> > PCI probing etc. happens, but all config space & IO accesses
> > are forwarded over virtio.
>
> I hadn't sent it out until now, but the userspace bits for all the time-
> travel and PCI-over-vhost-user are here:
>
> https://github.com/linux-test-project/usfstl/
>
> If anyone has any suggestions on a good example PCI device that already
> has a driver upstream I'd be interested - I looked for something simple
> like LED or GPIO but no such thing I could find (that wasn't platform
> dependent in some way). So far I've only implemented a virtual Intel
> WiFi NIC, but that depends on a large body of code I can't publish. As
> an example, it would be nice to write (and publish there) a simple PCI
> device implementation. :)

 bt8xxgpio?

Gr{oetje,eeting}s,

                        Geert
Johannes Berg Feb. 24, 2021, 2:35 p.m. UTC | #3
Hi,

> > If anyone has any suggestions on a good example PCI device that already
> > has a driver upstream I'd be interested - I looked for something simple
> > like LED or GPIO but no such thing I could find (that wasn't platform
> > dependent in some way). So far I've only implemented a virtual Intel
> > WiFi NIC, but that depends on a large body of code I can't publish. As
> > an example, it would be nice to write (and publish there) a simple PCI
> > device implementation. :)
> 
>  bt8xxgpio?

Yeah, that looks pretty good, thanks for the pointer!

johannes