qemu-arm
[Top][All Lists]
Advanced

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

Re: Re: [PATCH 1/3] hw/arm: Add EHCI/OHCI controllers to Allwinner R40 a


From: Gerd Hoffmann
Subject: Re: Re: [PATCH 1/3] hw/arm: Add EHCI/OHCI controllers to Allwinner R40 and Bananapi board
Date: Tue, 16 Jan 2024 11:13:37 +0100

On Mon, Jan 15, 2024 at 08:12:29AM -0800, Guenter Roeck wrote:
> On 1/15/24 03:02, Philippe Mathieu-Daudé wrote:
> > On 13/1/24 20:16, Guenter Roeck wrote:
> > > If machine USB support is not enabled, create unimplemented devices
> > > for the USB memory ranges to avoid crashes when booting Linux.
> > 
> > I never really understood the reason for machine_usb() and had on my
> > TODO to do some archeology research to figure it out since quite some
> > time. Having to map an UnimpDevice due to CLI options seems like an
> > anti-pattern when the device is indeed implemented in the repository.
> 
> Me not either. I copied the code from aw_a10_init(), trying to use the
> same pattern. I am perfectly fine with making it unconditional, but then
> I would argue that it should be unconditional for Allwinner A10 as well
> (not that I really care much, just for consistency).
> 
> The "-usb" option says "enable on-board USB host controller (if not
> enabled by default)". Unfortunately, that doesn't tell me much,
> and most specifically it doesn't tell me how to enable it by default.
> One option I can think of would be to enable it on the machine level,
> i.e., from bananapi_m2u.c, but then, again, I don't see if/how
> that is done for other boards. Any suggestions ?

The -usb switch is there as long as I remember (which goes back to qemu
0.1x days).  I suspect it was introduced in the early usb emulation
days, where usb emulation was more fragile and turning it on by default
didn't look like a good plan.

usb emulation in modern qemu should be stable enough that enabling it by
default should not be much of a problem.  ohci/uhci/ehci emulation is
somewhat expensive due to polling being wired into the hardware design,
but as long as there are no usb devices connected this should not be
much of a concern either as the guest drivers usually put the usb host
adapter to sleep in that case (which saves power on physical hardware
and stops the polling timer in qemu).

So, turning on usb support by default makes sense to me when emulating
boards, where guests expect the usb controllers being present at
specific MMIO addresses, so mapping UnimpDevice is not needed.

In case guests detect hardware via generated device tree / generated
ACPI tables / pci bus scan (i.e. arm virt + microvm + pc + q35) it IMHO
makes sense to keep current behavior.

take care,
  Gerd




reply via email to

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