Message ID | 20240507-cm_probe-v1-3-11dbfd598f3c@flygoat.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | MIPS: cm: Probe GCR address from devicetree | expand |
On Tue, May 07, 2024 at 10:01:51AM +0100, Jiaxun Yang wrote: > Move mips_cm_probe after prom_init so we can use fdt functions > in mips_cm_probe to obtain essential information. > > Impat for all systems that may have CM in system: > - geneirc: Adjusted code to accommodate this change s/geneirc/generic > - Lantiq: No impact, CM configuration won't be changed at all > - ralink: Called mips_cm_probe on it's own, in prom_init->prom_soc_init > - malta: No impact, CM address comes from CP0_CMGCR Are you sure about this? This was one of the problematic part I met back when was trying to implement the feature. arch/mips/mti-malta/malta-init.c: prom_init() +-> mips_cpc_probe() +-> mips_cpc_phys_base() +-> mips_cm_present(): mips_gcr_base != NULL +-> read_gcr_cpc_status() +-> read_gcr_cpc_base() +-> write_gcr_cpc_base() So by moving mips_cm_probe() to being executed after prom_init() the calls-chain above will be broken since the mips_gcr_base will be left uninitialized. Do I miss something? Please, note originally the mips_cm_probe() invocation was right above the Malta's mips_cpc_probe(): 3af5a67c86a3 ("MIPS: Fix early CM probing") -Serge(y) > > Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> > --- > arch/mips/kernel/setup.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c > index 12a1a4ffb602..732579c8f4f8 100644 > --- a/arch/mips/kernel/setup.c > +++ b/arch/mips/kernel/setup.c > @@ -773,8 +773,8 @@ static void __init setup_rng_seed(void) > void __init setup_arch(char **cmdline_p) > { > cpu_probe(); > - mips_cm_probe(); > prom_init(); > + mips_cm_probe(); > > setup_early_fdc_console(); > #ifdef CONFIG_EARLY_PRINTK > > -- > 2.34.1 > >
在2024年5月8日五月 下午1:50,Serge Semin写道: > On Tue, May 07, 2024 at 10:01:51AM +0100, Jiaxun Yang wrote: >> Move mips_cm_probe after prom_init so we can use fdt functions >> in mips_cm_probe to obtain essential information. >> >> Impat for all systems that may have CM in system: > >> - geneirc: Adjusted code to accommodate this change > > s/geneirc/generic > >> - Lantiq: No impact, CM configuration won't be changed at all >> - ralink: Called mips_cm_probe on it's own, in prom_init->prom_soc_init > >> - malta: No impact, CM address comes from CP0_CMGCR > > Are you sure about this? This was one of the problematic part I met > back when was trying to implement the feature. > arch/mips/mti-malta/malta-init.c: > prom_init() > +-> mips_cpc_probe() > +-> mips_cpc_phys_base() > +-> mips_cm_present(): mips_gcr_base != NULL > +-> read_gcr_cpc_status() > +-> read_gcr_cpc_base() > +-> write_gcr_cpc_base() > > So by moving mips_cm_probe() to being executed after prom_init() the > calls-chain above will be broken since the mips_gcr_base will be left > uninitialized. Do I miss something? Hi Serge, Good catch! This is indeed a problem. I tried to dig a little bit and found that a possible solution is to move SMP initialization to device_tree_init(), as what generic platform did. I was able to test malta boot with this solution on my heavily patched QEMU, I can confirm that both CM-SMP and scache are working as expected. Will share my QEMU patches and configurations in next rev. Thanks - Jiaxun > > Please, note originally the mips_cm_probe() invocation was right > above the Malta's mips_cpc_probe(): > 3af5a67c86a3 ("MIPS: Fix early CM probing") > > -Serge(y) > >> >> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> >> --- >> arch/mips/kernel/setup.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c >> index 12a1a4ffb602..732579c8f4f8 100644 >> --- a/arch/mips/kernel/setup.c >> +++ b/arch/mips/kernel/setup.c >> @@ -773,8 +773,8 @@ static void __init setup_rng_seed(void) >> void __init setup_arch(char **cmdline_p) >> { >> cpu_probe(); >> - mips_cm_probe(); >> prom_init(); >> + mips_cm_probe(); >> >> setup_early_fdc_console(); >> #ifdef CONFIG_EARLY_PRINTK >> >> -- >> 2.34.1 >> >>
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index 12a1a4ffb602..732579c8f4f8 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -773,8 +773,8 @@ static void __init setup_rng_seed(void) void __init setup_arch(char **cmdline_p) { cpu_probe(); - mips_cm_probe(); prom_init(); + mips_cm_probe(); setup_early_fdc_console(); #ifdef CONFIG_EARLY_PRINTK
Move mips_cm_probe after prom_init so we can use fdt functions in mips_cm_probe to obtain essential information. Impat for all systems that may have CM in system: - geneirc: Adjusted code to accommodate this change - Lantiq: No impact, CM configuration won't be changed at all - ralink: Called mips_cm_probe on it's own, in prom_init->prom_soc_init - malta: No impact, CM address comes from CP0_CMGCR Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> --- arch/mips/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)