Re: [PATCH v1 0/4] arm64: Kconfig: Update ARCH_EXYNOS select configs

From: Krzysztof Kozlowski
Date: Mon Sep 27 2021 - 04:08:21 EST


On 25/09/2021 04:17, Saravana Kannan wrote:
> On Tue, Sep 21, 2021 at 1:25 AM Krzysztof Kozlowski
> <krzysztof.kozlowski@xxxxxxxxxxxxx> wrote:
>>
>> On 21/09/2021 10:11, Lee Jones wrote:
>>> On Tue, 21 Sep 2021, Krzysztof Kozlowski wrote:
>>>
>>>> On 20/09/2021 21:03, Will McVicker wrote:
>>>>> This patch series tries to address the issue of ARCH_EXYNOS force selecting
>>>>> a handful of drivers without allowing the vendor to override any of the
>>>>> default configs. This takes away from the flexibilty of compiling a generic
>>>>> kernel with exynos kernel modules. For example, it doesn't allow vendors to
>>>>> modularize these drivers out of the core kernel in order to share a generic
>>>>> kernel image across multiple devices that require device-specific kernel
>>>>> modules.
>>>>
>>>> You do not address the issue in these patches. The problem you describe
>>>> is that drivers are not modules and you are not changing them into modules.
>>>
>>> The wording is unfortunate. The reason for this change doesn't have
>>> much to do with kernel modules.
>>>
>>> Let's go back in time 18 months or so when Greg KH submitted this [0]
>>> patch, which you Acked. Greg was trying to solve the problem of not
>>> having to enable ARCH_EXYNOS on kernels which are designed to be
>>> platform agnostic (sometimes called Generic Kernels). For some reason
>>> SERIAL_SAMSUNG is the only symbol with these dependencies, so the
>>> solution seemed simple and straight forward at the time.
>>>
>>> However, For sound reasons Geert NACKed the patch.
>>>
>>> Quoting from [1] he says:
>>>
>>> "A generic kernel will include Samsung SoC support, hence
>>> PLAT_SAMSUNG or ARCH_EXYNOS will be enabled."
>>
>> Yes, it's correct reasoning. There is also one more use-case -
>> non-upstreamed (out of tree) platform which wants to use Exynos-specific
>> drivers. Something like was happening with Apple M1 except that it got
>> upstreamed and we do not care much about out-of-tree.
>>
>>>
>>> However, since the entry for ARCH_EXYNOS *insists* on building-in a
>>> bunch of other symbols (via 'select') which will be unused in most
>>> cases, this is not a currently acceptable approach for many Generic
>>> Kernels due to size constraints.
>>
>> In the mainline kernel there is no such use case. If you want to have
>> Exynos-whatever-driver (e.g. SERIAL_SAMSUNG or S3C RTC), you should
>> select ARCH_EXYNOS because otherwise it does not make any sense. Zero
>> sense. Such kernel won't work.
>>
>> It makes sense only if there is some other work, hidden here, where
>> someone might want to have SERIAL_SAMSUNG or S3C RTC without
>> ARCH_EXYNOS. Although GKI is not that work because GKI kernel will
>> select ARCH_EXYNOS. It must select ARCH_EXYNOS if it wants to support
>> Exynos platforms.
>>
>> Therefore I expect first to bring this "some other work, hidden here" to
>> broader audience, so we can review its use case.
>>
>>>
>>> What this patch does is migrates those symbols from being 'select'ed
>>> (always built-in with no recourse) to 'default y'. Where the former
>>> cannot be over-ridden, but the latter can be via a vendor's
>>> defconfig/fragment.
>>
>> It cannot be overridden by vendor fragment because options are not
>> visible. You cannot change them.
>>
>> The patch does nothing in this regard (making them selectable/possible
>> to disable), which is why I complained.
>>
>>>
>>> I doubt many (any?) of these symbols can be converted to kernel
>>> modules anyway, as they are required very early on in the boot
>>> sequence.
>>
>> True, some could, some not. Also some platforms are set up via
>> bootloader, so actually could "survive" till module is loaded from some
>> initrd.
>
> Hi Krzysztof,
>
> I was trying to chime in, but the discussion got spread out across all
> the patches. Since the cover letter seems to have everyone, I thought
> I'd reply here. Hope you don't mind. I'll try to respond/chime in on
> the various topics that were raised across the patches.
>
> Yes, the next patch series would To/Cc folks correctly. William simply
> forgot to use the --to-cover and --cc-cover options when using git
> send-email.
>
> I agree with you that it doesn't make sense to have ARCH_EXYNOS
> enabled but to have all the clock drivers exynos compiled out. Then
> one obviously can't boot an exynos platform using that kernel.

If downstream kernel does not use any upstream platforms (e.g.
Exynos5433 or Exynos7) and has its own drivers for everything, then
downstream does not even need ARCH_EXYNOS. Just disable it.

> I think
> William is going to send out a new patch series with a few drivers
> modularized. That'll ensure all the common exynos clock code is
> modularized and we have a few examples of exynos clock modules.

If it works on supported Exynos platforms: awesome!
If it does not work: not that good. I understand that downstream or
vendor do not want to mainline their SoC drivers and SoC support. Either
because HW is too new (do not disclose it) or it is too old (lost
interest). It's their right, they do not have to work with mainline on
this. However changing mainline kernel in such a case to affect it so
you can use your non-upstreamed drivers is wrong.

Affecting upstream platforms just because vendor/downstream does not
want to mainline some code is unacceptable. Please upstream your drivers
and DTS.

Everyone else are working like this. NXP, Renesas, Xilinx, TI, Rockchip,
AllWinner. Samsung or Google is not special to receive an exception for
this.

>
> Speaking of modules, a fully modularized generic ARM64 kernel where
> everything is modularized out and we only load the necessary modules
> is a great goal. And this is where I can chime in the most since I
> wrote fw_devlink and tested this out. Such a kernel is not
> hypothetical. IIRC hikey960 can already do this. There's an upstream
> amlogic(?) board that can do this (Kevin Hilman has done that). A more
> complex/recent/powerful, but downstream example is the Pixel 5 -- it
> has a fully modular kernel. 320+ modules! Including interrupt
> controllers, timers, pinctrl and clocks.

Awesome! I am in, if it works. :)

> I can assure you any of the framework code related to pulling off
> booting a fully modular ARM64 kernel is already upstreamed
> (fw_devlink, irq framework changes, etc) or sent upstream (timer -- by
> a SoC vendor, etc) and being worked on. As for fw_devlink, I've
> extended it way past what GKI or Android would need. It would have
> been super trivial if all I wanted to do was support Android devices.
> I've also upstreamed changes that improve module loading time for all
> ARM64 modules. All of this and more upstream work came out of GKI and
> our push to be upstream first -- so I think it's reasonable to say the
> GKI effort helps and cares to get more work upstreamed.

Except UFS driver and recent Linaro work on Exynos850, none of these
apply to the vendor discussed here.

> Speaking of GKI, let's not speak of it. It really doesn't matter.
> Android is just yet another distribution (albeit a very popular one).
> The part that's relevant to upstream/all the other distributions is
> the fully modular generic ARM64 kernel and that's what we should focus
> on.
>
> In that context, I think William's attempts are reasonable and I think
> he'll be glad to fix up any technical issues that people point out. So
> hopefully we can focus on that?

Yes, we can focus on that. In technical issues, I do not agree to
affecting negatively supported platforms just because downstream/vendor
does not want to send upstream its drivers.

Please upstream your drivers. By "your" I mean all the drivers which you
want to enable after disabling ARCH_EXYNOS mainline drivers.

Best regards,
Krzysztof