All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: Krzysztof Kozlowski <krzk@kernel.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Rob Herring <robh+dt@kernel.org>,
	devicetree@vger.kernel.org, kernel test robot <lkp@intel.com>,
	linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
	zhuyinbo <zhuyinbo@loongson.cn>
Cc: oe-kbuild-all@lists.linux.dev, Jianmin Lv <lvjianmin@loongson.cn>,
	Liu Peibao <liupeibao@loongson.cn>,
	wanghongliang@loongson.cn, loongson-kernel@lists.loongnix.cn
Subject: Re: [PATCH v13 2/2] clk: clk-loongson2: add clock controller driver support
Date: Tue, 14 Mar 2023 17:26:21 -0700	[thread overview]
Message-ID: <c9e0e9b838cc046637059e771755f995.sboyd@kernel.org> (raw)
In-Reply-To: <6ff60914-0c39-9916-2e3a-a906b4cdef0d@kernel.org>

Quoting Krzysztof Kozlowski (2023-03-13 23:49:40)
> On 13/03/2023 19:20, Stephen Boyd wrote:
> >>>> The CONFIG_64BIT not enabled in your config file, I will add a depend on 
> >>>> "CONFIG_64BIT" in my clock driver to fix this compile error.
> >>>
> >>> Do you need to use readq() here? Can you read two 32-bit registers with
> >>> readl() and put them together for a 64-bit number?
> >>
> >> If the platform supports 64-bit reads and these are actually one
> >> register, then readq makes sense - code is more readable, smaller, more
> >> efficient.
> >>
> > 
> > Please read the section in Documentation/driver-api/device-io.rst about
> > hi_lo_readq() and <linux/io-64-nonatomic-lo-hi.h>. We shouldn't need to
> > restrict the driver to CONFIG_64BIT. Instead, include one of these
> > header files to get the IO access primitives.
> 
> These primitives are for 32bit access. Quoting: "on 32-bit
> architectures". What's the point of them if the code *will never* run on
> 32-bit?

They're there to make drivers portable.

> It will be a fake choice of linux/io-64-nonatomic-lo-hi.h or
> linux/io-64-nonatomic-hi-lo.h misleading users to think this was tested
> on 32-bit.
> 

I don't think anyone is really going to care that it hasn't been tested.
It's not like the Linux kernel driver is the source of truth for
integrating IP blocks into different architectures. If it's wrong
someone will fix it when they try to use the hardware on 32-bit systems.

Can the register handle being read/written with two 32-bit accesses? I
still don't think we've had any answer to that question. If so, pick the
one that makes the most sense and move on.

In Linux, we try to write portable drivers. This way anyone can compile
the driver on any host architecture with whatever compiler they're
using. Otherwise, they have to download a cross compiler for the target
architecture to simply build test the code. Also, the Linux kernel is
fairly portable. We try to limit architecture specific code to arch/ and
so anything in drivers/ is ideally portable code.

  reply	other threads:[~2023-03-15  0:26 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-07 11:50 [PATCH v13 1/2] dt-bindings: clock: add loongson-2 boot clock index Yinbo Zhu
2023-03-07 11:50 ` [PATCH v13 2/2] clk: clk-loongson2: add clock controller driver support Yinbo Zhu
2023-03-08 12:16   ` kernel test robot
2023-03-09  2:58     ` zhuyinbo
2023-03-09  3:18       ` zhuyinbo
2023-03-09  6:09         ` Krzysztof Kozlowski
2023-03-09  6:27           ` zhuyinbo
2023-03-09  6:37             ` Krzysztof Kozlowski
2023-03-09  6:09       ` Krzysztof Kozlowski
2023-03-09 23:47       ` Stephen Boyd
2023-03-10  8:42         ` Krzysztof Kozlowski
2023-03-13 18:20           ` Stephen Boyd
2023-03-14  1:07             ` zhuyinbo
2023-03-14  6:49             ` Krzysztof Kozlowski
2023-03-15  0:26               ` Stephen Boyd [this message]
2023-03-07 12:47 ` [PATCH v13 1/2] dt-bindings: clock: add loongson-2 boot clock index Krzysztof Kozlowski
2023-03-08  1:35   ` zhuyinbo
2023-03-08  8:37     ` Krzysztof Kozlowski
2023-03-08  9:24       ` zhuyinbo
2023-03-08 10:38         ` Krzysztof Kozlowski
2023-03-09  1:43           ` zhuyinbo
2023-03-09  6:25             ` Krzysztof Kozlowski
2023-03-09 12:44               ` zhuyinbo
2023-03-09 16:12                 ` Krzysztof Kozlowski
2023-03-10  2:07                   ` zhuyinbo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c9e0e9b838cc046637059e771755f995.sboyd@kernel.org \
    --to=sboyd@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liupeibao@loongson.cn \
    --cc=lkp@intel.com \
    --cc=loongson-kernel@lists.loongnix.cn \
    --cc=lvjianmin@loongson.cn \
    --cc=mturquette@baylibre.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=robh+dt@kernel.org \
    --cc=wanghongliang@loongson.cn \
    --cc=zhuyinbo@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.