Re: [PATCH] ARM: multi_v7_defconfig: make USB_DWC3 as a module instead of built-in

From: Arnd Bergmann
Date: Tue Apr 04 2023 - 08:20:57 EST


On Tue, Apr 4, 2023, at 13:46, Roger Quadros wrote:
> On 04/04/2023 13:01, Krzysztof Kozlowski wrote:
>> On 04/04/2023 10:51, Arnd Bergmann wrote:
>>> On Tue, Apr 4, 2023, at 10:42, Roger Quadros wrote:
>>>> USB_DWC3 is not required for boot on most platforms make it
>>>> as a module instead of built-in.
>>>>
>>>> Signed-off-by: Roger Quadros <rogerq@xxxxxxxxxx>
>>>> ---
>>>
>>> Does this save a significant amount of vmlinux size? Since this
>
> vmlinux size reduces by ~529KB

That seems really high, so I had a look at what's going on.

Testing this on multi_v7_defconfig with gcc-13, I only see
163KB difference in (uncompressed) vmlinux file size, or 140KB
in the output of 'size vmlinux'. This still seems high, and
looking more closely I find that a lot of that is for either
Gadget mode or debugfs, while the driver itself is not all
that big (most of the host logic is in the xhci driver).

Turning off gadget mode altogether would save 248KB
in 'size vmlinux' output, but would also prevent us
from enabling gadget driver modules, which is not great
either.

I tried setting CONFIG_USB_GADGET=m, but that makes
DWC3 and DWC2 host-only and turns CHIPIDEA into a loadable
module, so we probably don't want to do that either:

-CONFIG_USB_EHCI_HCD_OMAP=y
+CONFIG_USB_EHCI_HCD_OMAP=m
-CONFIG_USB_DWC3_DUAL_ROLE=y
+CONFIG_USB_DWC3_HOST=y
+CONFIG_USB_DWC2_HOST=y
-CONFIG_USB_DWC2_DUAL_ROLE=y
-CONFIG_USB_CHIPIDEA=y
+CONFIG_USB_CHIPIDEA=m
-CONFIG_USB_ISP1761_UDC=y
-CONFIG_USB_ISP1760_DUAL_ROLE=y
+CONFIG_USB_ISP1760_HOST_ROLE=y

Arnd