[PATCH-for-4.2,2/3] hw/usb/Kconfig: Add CONFIG_USB_EHCI_PCI
diff mbox series

Message ID 20190715095545.28545-3-philmd@redhat.com
State New
Headers show
Series
  • hw/Kconfig: PCI & USB fixes
Related show

Commit Message

Philippe Mathieu-Daudé July 15, 2019, 9:55 a.m. UTC
The USB_EHCI entry currently include PCI code. Since the EHCI
implementation is already split in sysbus/PCI, add a new
USB_EHCI_PCI. There are no logical changes, but the Kconfig
dependencies tree is cleaner.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/usb/Kconfig       | 9 ++++++---
 hw/usb/Makefile.objs | 5 +++--
 2 files changed, 9 insertions(+), 5 deletions(-)

Comments

BALATON Zoltan July 15, 2019, 10:54 a.m. UTC | #1
On Mon, 15 Jul 2019, Philippe Mathieu-Daudé wrote:
> The USB_EHCI entry currently include PCI code. Since the EHCI
> implementation is already split in sysbus/PCI, add a new
> USB_EHCI_PCI. There are no logical changes, but the Kconfig
> dependencies tree is cleaner.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> hw/usb/Kconfig       | 9 ++++++---
> hw/usb/Makefile.objs | 5 +++--
> 2 files changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/hw/usb/Kconfig b/hw/usb/Kconfig
> index 564305e283..495c6f2d48 100644
> --- a/hw/usb/Kconfig
> +++ b/hw/usb/Kconfig
> @@ -19,13 +19,16 @@ config USB_OHCI_PCI
>
> config USB_EHCI
>     bool
> -    default y if PCI_DEVICES
> -    depends on PCI
>     select USB
>
> +config USB_EHCI_PCI
> +    bool
> +    default y if PCI_DEVICES
> +    select USB_EHCI
> +
> config USB_EHCI_SYSBUS
>     bool
> -    select USB
> +    select USB_EHCI

Isn't this making USB_EHCI effectively the same as USB so maybe you don't 
need to keep that around any more. Can you just add select USB to 
USB_EHCI_PCI and USB_EHCI_SYSBUS and delete USB_EHCI?

Regards,
BALATON Zoltan
Thomas Huth July 15, 2019, 11:01 a.m. UTC | #2
On 15/07/2019 11.55, Philippe Mathieu-Daudé wrote:
> The USB_EHCI entry currently include PCI code. Since the EHCI
> implementation is already split in sysbus/PCI, add a new
> USB_EHCI_PCI. There are no logical changes, but the Kconfig
> dependencies tree is cleaner.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  hw/usb/Kconfig       | 9 ++++++---
>  hw/usb/Makefile.objs | 5 +++--
>  2 files changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/usb/Kconfig b/hw/usb/Kconfig
> index 564305e283..495c6f2d48 100644
> --- a/hw/usb/Kconfig
> +++ b/hw/usb/Kconfig
> @@ -19,13 +19,16 @@ config USB_OHCI_PCI
>  
>  config USB_EHCI
>      bool
> -    default y if PCI_DEVICES
> -    depends on PCI
>      select USB
>  
> +config USB_EHCI_PCI
> +    bool
> +    default y if PCI_DEVICES
> +    select USB_EHCI
> +
>  config USB_EHCI_SYSBUS
>      bool
> -    select USB
> +    select USB_EHCI
>  
>  config USB_XHCI
>      bool
> diff --git a/hw/usb/Makefile.objs b/hw/usb/Makefile.objs
> index 81688f6e70..303ac084a0 100644
> --- a/hw/usb/Makefile.objs
> +++ b/hw/usb/Makefile.objs
> @@ -6,8 +6,9 @@ common-obj-$(CONFIG_USB) += desc.o desc-msos.o
>  common-obj-$(CONFIG_USB_UHCI) += hcd-uhci.o
>  common-obj-$(CONFIG_USB_OHCI) += hcd-ohci.o
>  common-obj-$(CONFIG_USB_OHCI_PCI) += hcd-ohci-pci.o
> -common-obj-$(CONFIG_USB_EHCI) += hcd-ehci.o hcd-ehci-pci.o
> -common-obj-$(CONFIG_USB_EHCI_SYSBUS) += hcd-ehci.o hcd-ehci-sysbus.o
> +common-obj-$(CONFIG_USB_EHCI) += hcd-ehci.o
> +common-obj-$(CONFIG_USB_EHCI_PCI) += hcd-ehci-pci.o
> +common-obj-$(CONFIG_USB_EHCI_SYSBUS) += hcd-ehci-sysbus.o
>  common-obj-$(CONFIG_USB_XHCI) += hcd-xhci.o
>  common-obj-$(CONFIG_USB_XHCI_NEC) += hcd-xhci-nec.o
>  common-obj-$(CONFIG_USB_MUSB) += hcd-musb.o
> 

Looks cleaner this way, indeed.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Thomas Huth July 15, 2019, 11:03 a.m. UTC | #3
On 15/07/2019 12.54, BALATON Zoltan wrote:
> On Mon, 15 Jul 2019, Philippe Mathieu-Daudé wrote:
>> The USB_EHCI entry currently include PCI code. Since the EHCI
>> implementation is already split in sysbus/PCI, add a new
>> USB_EHCI_PCI. There are no logical changes, but the Kconfig
>> dependencies tree is cleaner.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>> hw/usb/Kconfig       | 9 ++++++---
>> hw/usb/Makefile.objs | 5 +++--
>> 2 files changed, 9 insertions(+), 5 deletions(-)
>>
>> diff --git a/hw/usb/Kconfig b/hw/usb/Kconfig
>> index 564305e283..495c6f2d48 100644
>> --- a/hw/usb/Kconfig
>> +++ b/hw/usb/Kconfig
>> @@ -19,13 +19,16 @@ config USB_OHCI_PCI
>>
>> config USB_EHCI
>>     bool
>> -    default y if PCI_DEVICES
>> -    depends on PCI
>>     select USB
>>
>> +config USB_EHCI_PCI
>> +    bool
>> +    default y if PCI_DEVICES
>> +    select USB_EHCI
>> +
>> config USB_EHCI_SYSBUS
>>     bool
>> -    select USB
>> +    select USB_EHCI
> 
> Isn't this making USB_EHCI effectively the same as USB so maybe you
> don't need to keep that around any more. Can you just add select USB to
> USB_EHCI_PCI and USB_EHCI_SYSBUS and delete USB_EHCI?

If you want to compile without USB_EHCI_PCI and without USB_EHCI_SYSBUS,
but with USB (e.g. due to XHCI), I think we should not include
hcd-ehci.o file in the build. So I think it's fine that we have a
separate config switch for this file.

 Thomas
BALATON Zoltan July 15, 2019, 11:10 a.m. UTC | #4
On Mon, 15 Jul 2019, Thomas Huth wrote:
> On 15/07/2019 12.54, BALATON Zoltan wrote:
>> On Mon, 15 Jul 2019, Philippe Mathieu-Daudé wrote:
>>> The USB_EHCI entry currently include PCI code. Since the EHCI
>>> implementation is already split in sysbus/PCI, add a new
>>> USB_EHCI_PCI. There are no logical changes, but the Kconfig
>>> dependencies tree is cleaner.
>>>
>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>>> ---
>>> hw/usb/Kconfig?????? | 9 ++++++---
>>> hw/usb/Makefile.objs | 5 +++--
>>> 2 files changed, 9 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/hw/usb/Kconfig b/hw/usb/Kconfig
>>> index 564305e283..495c6f2d48 100644
>>> --- a/hw/usb/Kconfig
>>> +++ b/hw/usb/Kconfig
>>> @@ -19,13 +19,16 @@ config USB_OHCI_PCI
>>>
>>> config USB_EHCI
>>> ??? bool
>>> -??? default y if PCI_DEVICES
>>> -??? depends on PCI
>>> ??? select USB
>>>
>>> +config USB_EHCI_PCI
>>> +??? bool
>>> +??? default y if PCI_DEVICES
>>> +??? select USB_EHCI
>>> +
>>> config USB_EHCI_SYSBUS
>>> ??? bool
>>> -??? select USB
>>> +??? select USB_EHCI
>>
>> Isn't this making USB_EHCI effectively the same as USB so maybe you
>> don't need to keep that around any more. Can you just add select USB to
>> USB_EHCI_PCI and USB_EHCI_SYSBUS and delete USB_EHCI?
>
> If you want to compile without USB_EHCI_PCI and without USB_EHCI_SYSBUS,
> but with USB (e.g. due to XHCI), I think we should not include
> hcd-ehci.o file in the build. So I think it's fine that we have a
> separate config switch for this file.

So shouldn't build depend on either USB_EHCI_PCI or USB_EHCI_SYSBUS 
selected then?

Regards,
BALATON Zoltan
Thomas Huth July 15, 2019, 11:19 a.m. UTC | #5
On 15/07/2019 13.10, BALATON Zoltan wrote:
> On Mon, 15 Jul 2019, Thomas Huth wrote:
>> On 15/07/2019 12.54, BALATON Zoltan wrote:
>>> On Mon, 15 Jul 2019, Philippe Mathieu-Daudé wrote:
>>>> The USB_EHCI entry currently include PCI code. Since the EHCI
>>>> implementation is already split in sysbus/PCI, add a new
>>>> USB_EHCI_PCI. There are no logical changes, but the Kconfig
>>>> dependencies tree is cleaner.
>>>>
>>>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>>>> ---
>>>> hw/usb/Kconfig?????? | 9 ++++++---
>>>> hw/usb/Makefile.objs | 5 +++--
>>>> 2 files changed, 9 insertions(+), 5 deletions(-)
>>>>
>>>> diff --git a/hw/usb/Kconfig b/hw/usb/Kconfig
>>>> index 564305e283..495c6f2d48 100644
>>>> --- a/hw/usb/Kconfig
>>>> +++ b/hw/usb/Kconfig
>>>> @@ -19,13 +19,16 @@ config USB_OHCI_PCI
>>>>
>>>> config USB_EHCI
>>>> ??? bool
>>>> -??? default y if PCI_DEVICES
>>>> -??? depends on PCI
>>>> ??? select USB
>>>>
>>>> +config USB_EHCI_PCI
>>>> +??? bool
>>>> +??? default y if PCI_DEVICES
>>>> +??? select USB_EHCI
>>>> +
>>>> config USB_EHCI_SYSBUS
>>>> ??? bool
>>>> -??? select USB
>>>> +??? select USB_EHCI
>>>
>>> Isn't this making USB_EHCI effectively the same as USB so maybe you
>>> don't need to keep that around any more. Can you just add select USB to
>>> USB_EHCI_PCI and USB_EHCI_SYSBUS and delete USB_EHCI?
>>
>> If you want to compile without USB_EHCI_PCI and without USB_EHCI_SYSBUS,
>> but with USB (e.g. due to XHCI), I think we should not include
>> hcd-ehci.o file in the build. So I think it's fine that we have a
>> separate config switch for this file.
> 
> So shouldn't build depend on either USB_EHCI_PCI or USB_EHCI_SYSBUS
> selected then?

Boards that have a hard-wired sysbus EHCI device already select it, e.g.
EXYNOS4 in hw/arm/Kconfig. EHCI on a PCI card is optional, so it is only
marked with "default y if PCI_DEVICES" - which you can override in your
config if you don't need it.

 Thomas
Paolo Bonzini July 15, 2019, 11:20 a.m. UTC | #6
On 15/07/19 13:10, BALATON Zoltan wrote:
>>
>> If you want to compile without USB_EHCI_PCI and without USB_EHCI_SYSBUS,
>> but with USB (e.g. due to XHCI), I think we should not include
>> hcd-ehci.o file in the build. So I think it's fine that we have a
>> separate config switch for this file.
> 
> So shouldn't build depend on either USB_EHCI_PCI or USB_EHCI_SYSBUS
> selected then?

No, USB_EHCI is never selected by the user.  The board or default-config
file selects either USB_EHCI_PCI or USB_EHCI_SYSBUS, which brings in
USB_EHCI, which brings in USB, which (optionally) brings in the USB devices.

Paolo

Patch
diff mbox series

diff --git a/hw/usb/Kconfig b/hw/usb/Kconfig
index 564305e283..495c6f2d48 100644
--- a/hw/usb/Kconfig
+++ b/hw/usb/Kconfig
@@ -19,13 +19,16 @@  config USB_OHCI_PCI
 
 config USB_EHCI
     bool
-    default y if PCI_DEVICES
-    depends on PCI
     select USB
 
+config USB_EHCI_PCI
+    bool
+    default y if PCI_DEVICES
+    select USB_EHCI
+
 config USB_EHCI_SYSBUS
     bool
-    select USB
+    select USB_EHCI
 
 config USB_XHCI
     bool
diff --git a/hw/usb/Makefile.objs b/hw/usb/Makefile.objs
index 81688f6e70..303ac084a0 100644
--- a/hw/usb/Makefile.objs
+++ b/hw/usb/Makefile.objs
@@ -6,8 +6,9 @@  common-obj-$(CONFIG_USB) += desc.o desc-msos.o
 common-obj-$(CONFIG_USB_UHCI) += hcd-uhci.o
 common-obj-$(CONFIG_USB_OHCI) += hcd-ohci.o
 common-obj-$(CONFIG_USB_OHCI_PCI) += hcd-ohci-pci.o
-common-obj-$(CONFIG_USB_EHCI) += hcd-ehci.o hcd-ehci-pci.o
-common-obj-$(CONFIG_USB_EHCI_SYSBUS) += hcd-ehci.o hcd-ehci-sysbus.o
+common-obj-$(CONFIG_USB_EHCI) += hcd-ehci.o
+common-obj-$(CONFIG_USB_EHCI_PCI) += hcd-ehci-pci.o
+common-obj-$(CONFIG_USB_EHCI_SYSBUS) += hcd-ehci-sysbus.o
 common-obj-$(CONFIG_USB_XHCI) += hcd-xhci.o
 common-obj-$(CONFIG_USB_XHCI_NEC) += hcd-xhci-nec.o
 common-obj-$(CONFIG_USB_MUSB) += hcd-musb.o