lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAhV-H5uoDjBRYpK_e7Z+vrcqLAbLXhEbEQP_aJ9f3aTdA+-eQ@mail.gmail.com>
Date: Wed, 19 Nov 2025 12:28:36 +0800
From: Huacai Chen <chenhuacai@...nel.org>
To: Yao Zi <ziyao@...root.org>
Cc: Huacai Chen <chenhuacai@...ngson.cn>, Arnd Bergmann <arnd@...db.de>, f@...root.org, 
	loongarch@...ts.linux.dev, linux-arch@...r.kernel.org, 
	Xuefeng Li <lixuefeng@...ngson.cn>, Guo Ren <guoren@...nel.org>, 
	Xuerui Wang <kernel@...0n.name>, Jiaxun Yang <jiaxun.yang@...goat.com>, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH V2 04/14] LoongArch: Adjust boot & setup for 32BIT/64BIT

On Wed, Nov 19, 2025 at 1:09 AM Yao Zi <ziyao@...root.org> wrote:
>
> On Tue, Nov 18, 2025 at 07:27:18PM +0800, Huacai Chen wrote:
> > Adjust boot & setup for both 32BIT and 64BIT, including: efi header
> > definition, MAX_IO_PICS definition, kernel entry and environment setup
> > routines, etc.
> >
> > Signed-off-by: Jiaxun Yang <jiaxun.yang@...goat.com>
> > Signed-off-by: Huacai Chen <chenhuacai@...ngson.cn>
> > ---
> >  arch/loongarch/include/asm/addrspace.h |  2 +-
> >  arch/loongarch/include/asm/irq.h       |  5 ++++
> >  arch/loongarch/kernel/efi-header.S     |  4 +++
> >  arch/loongarch/kernel/efi.c            |  4 ++-
> >  arch/loongarch/kernel/env.c            |  9 ++++--
> >  arch/loongarch/kernel/head.S           | 39 +++++++++++---------------
> >  arch/loongarch/kernel/relocate.c       |  9 +++++-
> >  7 files changed, 45 insertions(+), 27 deletions(-)
> >
>
> ...
>
> > diff --git a/arch/loongarch/kernel/env.c b/arch/loongarch/kernel/env.c
> > index 23bd5ae2212c..3e8a25eb901b 100644
> > --- a/arch/loongarch/kernel/env.c
> > +++ b/arch/loongarch/kernel/env.c
> > @@ -68,18 +68,23 @@ static int __init fdt_cpu_clk_init(void)
> >
> >       np = of_get_cpu_node(0, NULL);
> >       if (!np)
> > -             return -ENODEV;
> > +             goto fallback;
> >
> >       clk = of_clk_get(np, 0);
> >       of_node_put(np);
> >
> >       if (IS_ERR(clk))
> > -             return -ENODEV;
> > +             goto fallback;
> >
> >       cpu_clock_freq = clk_get_rate(clk);
> >       clk_put(clk);
> >
> >       return 0;
> > +
> > +fallback:
> > +     cpu_clock_freq = 200 * 1000 * 1000;
>
> Why pick 200MHz here? And shouldn't the clock being always provided in
> devicetree if it's necessary for kernel to function?
>
> Per the schema for LoongArch CPUs (loongarch/cpus.yaml), "clocks"
> property is also described as mandantory, thus I don't think such
> fallback makes sense.
Yes, "clocks" is mandatory in theory, but sometimes is missing in
practice, at least in QEMU. On the other hand, if "clocks" really
always exist, then the error checking in fdt_cpu_clk_init() can also
be removed. So the fallback makes sense.

Why pick 200MHz? That is because we assume the constant timer is
100MHz (which is true for all real machines), 200MHz is the minimal
multiple of 100MHz, it is more reasonable than 0MHz.

Huacai
>
> > +
> > +     return -ENODEV;
> >  }
> >  late_initcall(fdt_cpu_clk_init);
>
> Best regards,
> Yao Zi
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ