lkml.org 
[lkml]   [2022]   [Mar]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
SubjectRe: [PATCH v2 3/4] clocksource/drivers/exynos_mct: Support local-timer-index property
From
On 11/03/2022 12:35, Vincent Whitchurch wrote:
> On Tue, Mar 08, 2022 at 03:57:55PM +0100, Krzysztof Kozlowski wrote:
>> On 08/03/2022 15:24, Vincent Whitchurch wrote:
>>> diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_mct.c
>>> index f29c812b70c9..5f8b516614eb 100644
>>> --- a/drivers/clocksource/exynos_mct.c
>>> +++ b/drivers/clocksource/exynos_mct.c
>>> @@ -33,7 +33,7 @@
>>> #define EXYNOS4_MCT_G_INT_ENB EXYNOS4_MCTREG(0x248)
>>> #define EXYNOS4_MCT_G_WSTAT EXYNOS4_MCTREG(0x24C)
>>> #define _EXYNOS4_MCT_L_BASE EXYNOS4_MCTREG(0x300)
>>> -#define EXYNOS4_MCT_L_BASE(x) (_EXYNOS4_MCT_L_BASE + (0x100 * x))
>>> +#define EXYNOS4_MCT_L_BASE(x) (_EXYNOS4_MCT_L_BASE + (0x100 * (x)))
>>> #define EXYNOS4_MCT_L_MASK (0xffffff00)
>>>
>>> #define MCT_L_TCNTB_OFFSET (0x00)
>>> @@ -75,6 +75,7 @@ enum {
>>> static void __iomem *reg_base;
>>> static unsigned long clk_rate;
>>> static unsigned int mct_int_type;
>>> +static unsigned int mct_local_idx;
>>
>> No more static variables. This was wrong design, happens, but let's not
>> grow the list.
>>
>> I propose to conditionally (depending on property samsung,frc-shared)
>> assign .resume callback to NULL or exynos4_frc_resume. The init can
>> receive an argument whether to call frc_start().
>
> Could we just add the skip-write-register-if-already-started change in
> exynos4_mct_frc_start() uncondtionally? Perhaps it could be in a
> separate patch too? I was probably being over-cautious when I did it
> conditionally on mct_local_idx. Doing it uncondtionally would make it
> easier to remove the global variable.
>
> On my system the FRC is actually started long before Linux, and I assume
> it's similar on other chips.

+Cc Marek,

Maybe we could skip it, I don't know. It could be enabled by early boot
code or by trusted firmware. This would require more testing, on few
different platforms.

On my Exynos5422 HC1 board the MCT is not running upon boot. The
EXYNOS4_MCT_G_TCON starts with a reset value (0x0).

>
>>
>>> static int mct_irqs[MCT_NR_IRQS];
>>>
>>> struct mct_clock_event_device {
>>> @@ -157,6 +158,17 @@ static void exynos4_mct_frc_start(void)
>>> u32 reg;
>>>
>>> reg = readl_relaxed(reg_base + EXYNOS4_MCT_G_TCON);
>>> +
>>> + /*
>>> + * If the FRC is already running, we don't need to start it again. We
>>> + * could probably just do this on all systems, but, to avoid any risk
>>> + * for regressions, we only do it on systems where it's absolutely
>>> + * necessary (i.e., on systems where writes to the global registers
>>> + * need to be avoided).
>>> + */
>>> + if (mct_local_idx && (reg & MCT_G_TCON_START))
>>
>> This contradicts your intentions in commit #2 msg, where you described
>> that A53 will be started first.
>
> Yes, you're right. The case of the FRC not being running when the A5
> starts up is only ever hit in our simulation environment where we are
> able to start Linux on the A5 directly, without having to go via the
> A53.
>
>> 1. If A53 is always started first, is it possible to be here from A5?
>> 2. If above is possible, how do you handle locking? For example:
>> a. A53 started with some delay, entered exynos4_mct_frc_start() pass
>> this check;
>> b. A5 gets to exynos4_mct_frc_start(), check is still false, so A5
>> enables the FRC,
>> c. A53 also enables the FRC.
>
> The A5 is normally started from Linux on the A53 (using the remoteproc
> framework). This is long after exynos4_mct_frc_start() has been called
> on the A53.

If it is 100% like this, let's make it explicit - if it is A53 (lack of
dedicated property), let's start it. If it A5 (property present), skip it.

Let's wait for Marek thoughts, he was digging the MCT a lot.


Best regards,
Krzysztof

\
 
 \ /
  Last update: 2022-03-11 13:52    [W:0.067 / U:0.372 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site