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

From: Roger Quadros
Date: Tue Apr 04 2023 - 09:00:02 EST




On 04/04/2023 15:14, Arnd Bergmann wrote:
> 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.

It was based on the configuration we are using at TI.

(as built-in)

$ size vmlinux
text data bss dec hex filename
14616949 5285870 491776 20394595 1373263 vmlinux
$ ls -l vmlinux
-rwxrwxr-x 1 roger roger 120866544 Apr 4 15:54 vmlinux

(as module)

$ size vmlinux
text data bss dec hex filename
14550571 5258106 491776 20300453 135c2a5 vmlinux
$ ls -l vmlinux
-rwxrwxr-x 1 roger roger 120324528 Apr 4 15:52 vmlinux


$ diff built-in-config module-config
5547c5547
< CONFIG_USB_XHCI_PLATFORM=y
---
> CONFIG_USB_XHCI_PLATFORM=m
5614c5614
< CONFIG_USB_DWC3=y
---
> CONFIG_USB_DWC3=m


>
> 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

cheers,
-roger