qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] PCI: how handle multifunction / compound devices best?


From: Markus Armbruster
Subject: Re: [Qemu-devel] PCI: how handle multifunction / compound devices best?
Date: Mon, 04 Jul 2011 18:09:32 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Gerd Hoffmann <address@hidden> writes:

>   Hi folks,
>
> I'm still looking for a sane way to handle multifunction pci devices,
> specifically a EHCI USB controller with UHCI companion controllers.
>
> Here comes a small (incomplete[1]) two patch series to make the issue
> more clear.  The first patch adds a function which creates all devices
> with the properties set as needed.  The second patch adds a '-usb2'
> switch to windup this in a user-friendly way.
>
> Adding a -usb2 switch sucks though.  I'd prefer to have some way to
> create such devices via -device, but without asking the user to create
> all functions individually on the command line, i.e. have something
> along the lines of ...
>
>  qemu -device ich9-usb,slot=08
>
> ... instead of ...
>
>  qemu \
>   -device ich9-usb-ehci1,addr=08.7,multifunction=on,id=ehci \
>   -device 
> ich9-usb-uhci1,addr=08.0,multifunction=on,masterbus=ehci.0,firstport=0 \
>   -device 
> ich9-usb-uhci2,addr=08.1,multifunction=on,masterbus=ehci.0,firstport=2 \
>   -device 
> ich9-usb-uhci3,addr=08.2,multifunction=on,masterbus=ehci.0,firstport=4
>
> Suggestions?

This special case of composition is simple enough that some kind of
macro expansion could work.

A device defines a name, properties and a bunch of methods.

A device macro could define a name, properties (the macro parameters),
and an expansion.  Expansions could be as simple as a list of -device
where the property values can also be macro parameter names.

-device MACRO,... could then be replaced by MACRO's expansion with the
property values substituted.  Use to make -device ich9-usb,... expand
into its functions.

Just an idea; I'm not claiming this is the way to go.

Device macros destroy the 1:1 relationship between -device and device
tree nodes.  Or rather what's left of it: we already have a device that
expands into multiple devices, namely usb-storage.  But it's an ad hoc
hack, which has caused us some grief.



reply via email to

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