All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Dmitry Osipenko <digetx@gmail.com>
Cc: Nicolin Chen <nicoleotsuka@gmail.com>,
	joro@8bytes.org, krzk@kernel.org, vdumpa@nvidia.com,
	jonathanh@nvidia.com, linux-tegra@vger.kernel.org,
	iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/3] iommu/tegra-smmu: Rework .probe_device and .attach_dev
Date: Mon, 5 Oct 2020 12:27:43 +0200	[thread overview]
Message-ID: <20201005102743.GM425362@ulmo> (raw)
In-Reply-To: <1adede6e-ecbd-eea4-bd40-4969cd8719cc@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2870 bytes --]

On Mon, Oct 05, 2020 at 12:38:20PM +0300, Dmitry Osipenko wrote:
> 05.10.2020 12:16, Thierry Reding пишет:
> ...
> >> I think you meant regmap in regards to protecting IO accesses, but this
> >> is not what regmap is about if IO accesses are atomic by nature.
> > 
> > Then why is there regmap-mmio?
> 
> To protect programming sequences for example, actually that's the only
> real use-case I saw in kernel drivers once. In our case there are no
> sequences that require protection, at least I'm not aware about that.

True. But I'd still prefer to have a more formal mechanism of handing
out access to registers.

Either way, this isn't very relevant in the case of tegra20-devfreq
because there's really no reason for it to be a separate driver with
device tree lookup since it's all internal to the MC driver. The only
reason (unless I'm missing something) for that is to have the code
located in drivers/devfreq. We can do that without requiring DT lookup
either like we did for tegra-smmu/tegra-mc, or by directly copying the
code into drivers/memory.

It's become fairly common in recent years to group code by IP rather
than functionality. We nowadays have good tools to help with subsystem
wide refactoring that make it much less necessary for subsystem code to
be concentrated in a single directory.

> >> Secondly, you're missing that tegra30-devfreq driver will also need to
> >> perform the MC lookup [3] and then driver will no longer work for the
> >> older DTs if phandle becomes mandatory because these DTs do not have the
> >> MC phandle in the ACTMON node.
> >>
> >> [3]
> >> https://github.com/grate-driver/linux/commit/441d19281f9b3428a4db1ecb3a02e1ec02a8ad7f
> >>
> >> So we will need the fall back for T30/124 as well.
> > 
> > No, we don't need the fallback because this is new functionality which
> > can and should be gated on the existence of the new phandle. If there's
> > no phandle then we have no choice but to use the old code to ensure old
> > behaviour.
> 
> You just repeated what I was trying to say:)
> 
> Perhaps I spent a bit too much time touching that code to the point that
> lost feeling that there is a need to clarify everything in details.

I assumed that by "fall back" you meant the lookup-by-compatible. But
what I was talking about is the fall back to the current code which does
not use the MC device tree node at all. The latter is going to be
required to ensure that the code continues to work as-is. But the former
is not required because we have fall back code that already works with
old device trees. New code that is using the memory controller's timings
nodes can be gated on the existence of the phandle in DT and doing so is
not going to break backwards-compatibility.

But perhaps I was misunderstanding what you were trying to say.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Thierry Reding <thierry.reding@gmail.com>
To: Dmitry Osipenko <digetx@gmail.com>
Cc: linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org,
	krzk@kernel.org, jonathanh@nvidia.com,
	linux-tegra@vger.kernel.org
Subject: Re: [PATCH v3 2/3] iommu/tegra-smmu: Rework .probe_device and .attach_dev
Date: Mon, 5 Oct 2020 12:27:43 +0200	[thread overview]
Message-ID: <20201005102743.GM425362@ulmo> (raw)
In-Reply-To: <1adede6e-ecbd-eea4-bd40-4969cd8719cc@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2870 bytes --]

On Mon, Oct 05, 2020 at 12:38:20PM +0300, Dmitry Osipenko wrote:
> 05.10.2020 12:16, Thierry Reding пишет:
> ...
> >> I think you meant regmap in regards to protecting IO accesses, but this
> >> is not what regmap is about if IO accesses are atomic by nature.
> > 
> > Then why is there regmap-mmio?
> 
> To protect programming sequences for example, actually that's the only
> real use-case I saw in kernel drivers once. In our case there are no
> sequences that require protection, at least I'm not aware about that.

True. But I'd still prefer to have a more formal mechanism of handing
out access to registers.

Either way, this isn't very relevant in the case of tegra20-devfreq
because there's really no reason for it to be a separate driver with
device tree lookup since it's all internal to the MC driver. The only
reason (unless I'm missing something) for that is to have the code
located in drivers/devfreq. We can do that without requiring DT lookup
either like we did for tegra-smmu/tegra-mc, or by directly copying the
code into drivers/memory.

It's become fairly common in recent years to group code by IP rather
than functionality. We nowadays have good tools to help with subsystem
wide refactoring that make it much less necessary for subsystem code to
be concentrated in a single directory.

> >> Secondly, you're missing that tegra30-devfreq driver will also need to
> >> perform the MC lookup [3] and then driver will no longer work for the
> >> older DTs if phandle becomes mandatory because these DTs do not have the
> >> MC phandle in the ACTMON node.
> >>
> >> [3]
> >> https://github.com/grate-driver/linux/commit/441d19281f9b3428a4db1ecb3a02e1ec02a8ad7f
> >>
> >> So we will need the fall back for T30/124 as well.
> > 
> > No, we don't need the fallback because this is new functionality which
> > can and should be gated on the existence of the new phandle. If there's
> > no phandle then we have no choice but to use the old code to ensure old
> > behaviour.
> 
> You just repeated what I was trying to say:)
> 
> Perhaps I spent a bit too much time touching that code to the point that
> lost feeling that there is a need to clarify everything in details.

I assumed that by "fall back" you meant the lookup-by-compatible. But
what I was talking about is the fall back to the current code which does
not use the MC device tree node at all. The latter is going to be
required to ensure that the code continues to work as-is. But the former
is not required because we have fall back code that already works with
old device trees. New code that is using the memory controller's timings
nodes can be gated on the existence of the phandle in DT and doing so is
not going to break backwards-compatibility.

But perhaps I was misunderstanding what you were trying to say.

Thierry

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 156 bytes --]

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

  reply	other threads:[~2020-10-05 10:27 UTC|newest]

Thread overview: 132+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-30  8:42 [PATCH v3 0/3] iommu/tegra-smmu: Add PCI support Nicolin Chen
2020-09-30  8:42 ` Nicolin Chen
2020-09-30  8:42 ` [PATCH v3 1/3] memory: tegra: Add devm_tegra_get_memory_controller() Nicolin Chen
2020-09-30  8:42   ` Nicolin Chen
2020-09-30  9:07   ` Krzysztof Kozlowski
2020-09-30  9:07     ` Krzysztof Kozlowski
2020-09-30  9:41     ` Nicolin Chen
2020-09-30  9:41       ` Nicolin Chen
2020-09-30 10:27       ` Krzysztof Kozlowski
2020-09-30 10:27         ` Krzysztof Kozlowski
2020-09-30 14:41   ` Dmitry Osipenko
2020-09-30 14:41     ` Dmitry Osipenko
2020-09-30 14:45     ` Krzysztof Kozlowski
2020-09-30 14:45       ` Krzysztof Kozlowski
2020-09-30 15:22       ` Dmitry Osipenko
2020-09-30 15:22         ` Dmitry Osipenko
2020-09-30 15:23   ` Thierry Reding
2020-09-30 15:23     ` Thierry Reding
2020-09-30 15:27     ` Dmitry Osipenko
2020-09-30 15:27       ` Dmitry Osipenko
2020-09-30 15:53     ` Dmitry Osipenko
2020-09-30 15:53       ` Dmitry Osipenko
2020-09-30 16:03       ` Thierry Reding
2020-09-30 16:03         ` Thierry Reding
2020-09-30 16:06         ` Dmitry Osipenko
2020-09-30 16:06           ` Dmitry Osipenko
2020-09-30 16:15           ` Thierry Reding
2020-09-30 16:15             ` Thierry Reding
2020-09-30 16:26             ` Dmitry Osipenko
2020-09-30 16:26               ` Dmitry Osipenko
2020-09-30 16:38               ` Thierry Reding
2020-09-30 16:38                 ` Thierry Reding
2020-09-30 17:32                 ` Dmitry Osipenko
2020-09-30 17:32                   ` Dmitry Osipenko
2020-09-30  8:42 ` [PATCH v3 2/3] iommu/tegra-smmu: Rework .probe_device and .attach_dev Nicolin Chen
2020-09-30  8:42   ` Nicolin Chen
2020-09-30  9:21   ` Krzysztof Kozlowski
2020-09-30  9:21     ` Krzysztof Kozlowski
2020-09-30  9:40     ` Nicolin Chen
2020-09-30  9:40       ` Nicolin Chen
2020-09-30 10:19       ` Krzysztof Kozlowski
2020-09-30 10:19         ` Krzysztof Kozlowski
2020-09-30 14:41   ` Dmitry Osipenko
2020-09-30 14:41     ` Dmitry Osipenko
2020-09-30 15:09   ` Dmitry Osipenko
2020-09-30 15:09     ` Dmitry Osipenko
2020-09-30 20:51     ` Nicolin Chen
2020-09-30 20:51       ` Nicolin Chen
2020-09-30 15:31   ` Thierry Reding
2020-09-30 15:31     ` Thierry Reding
2020-09-30 15:36     ` Dmitry Osipenko
2020-09-30 15:36       ` Dmitry Osipenko
2020-09-30 16:06       ` Thierry Reding
2020-09-30 16:06         ` Thierry Reding
2020-09-30 16:25         ` Dmitry Osipenko
2020-09-30 16:25           ` Dmitry Osipenko
2020-09-30 16:47           ` Thierry Reding
2020-09-30 16:47             ` Thierry Reding
2020-10-01  2:11             ` Dmitry Osipenko
2020-10-01  2:11               ` Dmitry Osipenko
2020-10-01  7:58               ` Thierry Reding
2020-10-01  7:58                 ` Thierry Reding
2020-10-01 19:04                 ` Dmitry Osipenko
2020-10-01 19:04                   ` Dmitry Osipenko
2020-10-05  9:16                   ` Thierry Reding
2020-10-05  9:16                     ` Thierry Reding
2020-10-05  9:38                     ` Dmitry Osipenko
2020-10-05  9:38                       ` Dmitry Osipenko
2020-10-05 10:27                       ` Thierry Reding [this message]
2020-10-05 10:27                         ` Thierry Reding
2020-09-30 16:10       ` Thierry Reding
2020-09-30 16:10         ` Thierry Reding
2020-09-30 16:29         ` Dmitry Osipenko
2020-09-30 16:29           ` Dmitry Osipenko
2020-10-01  7:59           ` Thierry Reding
2020-10-01  7:59             ` Thierry Reding
2020-09-30 20:36     ` Nicolin Chen
2020-09-30 20:36       ` Nicolin Chen
2020-09-30 21:24       ` Dmitry Osipenko
2020-09-30 21:24         ` Dmitry Osipenko
2020-09-30 21:32         ` Nicolin Chen
2020-09-30 21:32           ` Nicolin Chen
2020-09-30 21:56           ` Dmitry Osipenko
2020-09-30 21:56             ` Dmitry Osipenko
2020-10-01  1:26             ` Nicolin Chen
2020-10-01  1:26               ` Nicolin Chen
2020-10-01  2:06               ` Dmitry Osipenko
2020-10-01  2:06                 ` Dmitry Osipenko
2020-10-01  2:48                 ` Nicolin Chen
2020-10-01  2:48                   ` Nicolin Chen
2020-10-01  4:04                   ` Dmitry Osipenko
2020-10-01  4:04                     ` Dmitry Osipenko
2020-10-01 10:23                   ` Thierry Reding
2020-10-01 10:23                     ` Thierry Reding
2020-10-01 11:04                     ` Nicolin Chen
2020-10-01 11:04                       ` Nicolin Chen
2020-10-01 20:33                       ` Dmitry Osipenko
2020-10-01 20:33                         ` Dmitry Osipenko
2020-10-02  1:07                         ` Nicolin Chen
2020-10-02  1:07                           ` Nicolin Chen
2020-10-02  1:55                           ` Dmitry Osipenko
2020-10-02  1:55                             ` Dmitry Osipenko
2020-10-02  2:54                             ` Nicolin Chen
2020-10-02  2:54                               ` Nicolin Chen
2020-10-05  7:24                             ` Thierry Reding
2020-10-05  7:24                               ` Thierry Reding
2020-10-05  7:13                         ` Thierry Reding
2020-10-05  7:13                           ` Thierry Reding
2020-10-05  8:14                           ` Dmitry Osipenko
2020-10-05  8:14                             ` Dmitry Osipenko
2020-10-05  9:31                             ` Thierry Reding
2020-10-05  9:31                               ` Thierry Reding
2020-10-01  9:54                 ` Thierry Reding
2020-10-01  9:54                   ` Thierry Reding
2020-10-01  9:51               ` Thierry Reding
2020-10-01  9:51                 ` Thierry Reding
2020-10-01 10:33                 ` Nicolin Chen
2020-10-01 10:33                   ` Nicolin Chen
2020-10-01 10:42                   ` Thierry Reding
2020-10-01 10:42                     ` Thierry Reding
2020-10-01  9:47       ` Thierry Reding
2020-10-01  9:47         ` Thierry Reding
2020-10-01 10:46       ` Thierry Reding
2020-10-01 10:46         ` Thierry Reding
2020-10-02  1:29         ` Nicolin Chen
2020-10-02  1:29           ` Nicolin Chen
2020-09-30  8:42 ` [PATCH v3 3/3] iommu/tegra-smmu: Add PCI support Nicolin Chen
2020-09-30  8:42   ` Nicolin Chen
2020-09-30 14:53   ` Dmitry Osipenko
2020-09-30 14:53     ` Dmitry Osipenko
2020-09-30 20:03     ` Nicolin Chen
2020-09-30 20:03       ` Nicolin Chen

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=20201005102743.GM425362@ulmo \
    --to=thierry.reding@gmail.com \
    --cc=digetx@gmail.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jonathanh@nvidia.com \
    --cc=joro@8bytes.org \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=nicoleotsuka@gmail.com \
    --cc=vdumpa@nvidia.com \
    /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.