All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] of: addr: Translate 'dma-ranges' for parent nodes missing 'dma-ranges'
@ 2021-04-30 13:16 Bin Meng
  2021-04-30 13:16 ` [PATCH v2 2/2] of: addr: Remove call to dev_count_cells() in of_get_address() Bin Meng
  2021-05-17  2:03 ` [PATCH v2 1/2] of: addr: Translate 'dma-ranges' for parent nodes missing 'dma-ranges' Bin Meng
  0 siblings, 2 replies; 9+ messages in thread
From: Bin Meng @ 2021-04-30 13:16 UTC (permalink / raw)
  To: u-boot

'dma-ranges' frequently exists without parent nodes having 'dma-ranges'.
While this is an error for 'ranges', this is fine because DMA capable
devices always have a translatable DMA address. Also, with no
'dma-ranges' at all, the assumption is that DMA addresses are 1:1 with
no restrictions unless perhaps the device itself has implicit
restrictions.

This keeps in sync with Linux kernel commit:

  81db12ee15cb: of/address: Translate 'dma-ranges' for parent nodes missing 'dma-ranges'

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

---

Changes in v2:
- rebase on top of Dario's revert patch:
  http://patchwork.ozlabs.org/project/uboot/patch/20210425141746.19115-6-dariobin at libero.it/
- drop commit "of: addr: Abort address translation for parent nodes missing 'ranges'",
  as the revert patch restores the abort behavior

 drivers/core/of_addr.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/core/of_addr.c b/drivers/core/of_addr.c
index 9b77308182..a3af48fd88 100644
--- a/drivers/core/of_addr.c
+++ b/drivers/core/of_addr.c
@@ -192,9 +192,13 @@ static int of_translate_one(const struct device_node *parent,
 	 *
 	 * As far as we know, this damage only exists on Apple machines, so
 	 * This code is only enabled on powerpc. --gcl
+	 *
+	 * This quirk also applies for 'dma-ranges' which frequently exist in
+	 * child nodes without 'dma-ranges' in the parent nodes. --RobH
 	 */
 	ranges = of_get_property(parent, rprop, &rlen);
-	if (ranges == NULL && !of_empty_ranges_quirk(parent)) {
+	if (ranges == NULL && !of_empty_ranges_quirk(parent) &&
+	    strcmp(rprop, "dma-ranges")) {
 		debug("no ranges; cannot translate\n");
 		return 1;
 	}
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 2/2] of: addr: Remove call to dev_count_cells() in of_get_address()
  2021-04-30 13:16 [PATCH v2 1/2] of: addr: Translate 'dma-ranges' for parent nodes missing 'dma-ranges' Bin Meng
@ 2021-04-30 13:16 ` Bin Meng
  2021-04-30 18:13   ` Simon Glass
  2021-05-17  2:03 ` [PATCH v2 1/2] of: addr: Translate 'dma-ranges' for parent nodes missing 'dma-ranges' Bin Meng
  1 sibling, 1 reply; 9+ messages in thread
From: Bin Meng @ 2021-04-30 13:16 UTC (permalink / raw)
  To: u-boot

In of_get_address(), there is:

  dev_count_cells(dev, &na, &ns);

followed by:

  bus->count_cells(dev, &na, &ns);

but no codes in between use na/ns, hence the first call is useless.
By dropping the first call, dev_count_cells() is now useless too.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

---

Changes in v2:
- new patch: of: addr: Remove call to dev_count_cells() in of_get_address()

 drivers/core/of_addr.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/core/of_addr.c b/drivers/core/of_addr.c
index a3af48fd88..3fbc0a7afa 100644
--- a/drivers/core/of_addr.c
+++ b/drivers/core/of_addr.c
@@ -118,11 +118,6 @@ static struct of_bus *of_match_bus(struct device_node *np)
 	return NULL;
 }
 
-static void dev_count_cells(const struct device_node *np, int *nap, int *nsp)
-{
-	of_bus_default_count_cells(np, nap, nsp);
-}
-
 const __be32 *of_get_address(const struct device_node *dev, int index,
 			     u64 *size, unsigned int *flags)
 {
@@ -136,7 +131,6 @@ const __be32 *of_get_address(const struct device_node *dev, int index,
 	parent = of_get_parent(dev);
 	if (parent == NULL)
 		return NULL;
-	dev_count_cells(dev, &na, &ns);
 	bus = of_match_bus(parent);
 	bus->count_cells(dev, &na, &ns);
 	of_node_put(parent);
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 2/2] of: addr: Remove call to dev_count_cells() in of_get_address()
  2021-04-30 13:16 ` [PATCH v2 2/2] of: addr: Remove call to dev_count_cells() in of_get_address() Bin Meng
@ 2021-04-30 18:13   ` Simon Glass
  2021-05-01  1:22     ` Bin Meng
  2021-06-05 16:02     ` Simon Glass
  0 siblings, 2 replies; 9+ messages in thread
From: Simon Glass @ 2021-04-30 18:13 UTC (permalink / raw)
  To: u-boot

On Fri, 30 Apr 2021 at 07:17, Bin Meng <bmeng.cn@gmail.com> wrote:
>
> In of_get_address(), there is:
>
>   dev_count_cells(dev, &na, &ns);
>
> followed by:
>
>   bus->count_cells(dev, &na, &ns);
>
> but no codes in between use na/ns, hence the first call is useless.
> By dropping the first call, dev_count_cells() is now useless too.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>
> ---
>
> Changes in v2:
> - new patch: of: addr: Remove call to dev_count_cells() in of_get_address()
>
>  drivers/core/of_addr.c | 6 ------
>  1 file changed, 6 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

I wonder why this is now different from linux?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 2/2] of: addr: Remove call to dev_count_cells() in of_get_address()
  2021-04-30 18:13   ` Simon Glass
@ 2021-05-01  1:22     ` Bin Meng
  2021-06-05 16:02     ` Simon Glass
  1 sibling, 0 replies; 9+ messages in thread
From: Bin Meng @ 2021-05-01  1:22 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On Sat, May 1, 2021 at 2:14 AM Simon Glass <sjg@chromium.org> wrote:
>
> On Fri, 30 Apr 2021 at 07:17, Bin Meng <bmeng.cn@gmail.com> wrote:
> >
> > In of_get_address(), there is:
> >
> >   dev_count_cells(dev, &na, &ns);
> >
> > followed by:
> >
> >   bus->count_cells(dev, &na, &ns);
> >
> > but no codes in between use na/ns, hence the first call is useless.
> > By dropping the first call, dev_count_cells() is now useless too.
> >
> > Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> >
> > ---
> >
> > Changes in v2:
> > - new patch: of: addr: Remove call to dev_count_cells() in of_get_address()
> >
> >  drivers/core/of_addr.c | 6 ------
> >  1 file changed, 6 deletions(-)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
>
> I wonder why this is now different from linux?

With this patch, the code flow is the same as Linux.

Regards,
Bin

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 1/2] of: addr: Translate 'dma-ranges' for parent nodes missing 'dma-ranges'
  2021-04-30 13:16 [PATCH v2 1/2] of: addr: Translate 'dma-ranges' for parent nodes missing 'dma-ranges' Bin Meng
  2021-04-30 13:16 ` [PATCH v2 2/2] of: addr: Remove call to dev_count_cells() in of_get_address() Bin Meng
@ 2021-05-17  2:03 ` Bin Meng
  2021-06-04  6:11   ` Bin Meng
  1 sibling, 1 reply; 9+ messages in thread
From: Bin Meng @ 2021-05-17  2:03 UTC (permalink / raw)
  To: u-boot

Hi Simon,

On Fri, Apr 30, 2021 at 9:17 PM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> 'dma-ranges' frequently exists without parent nodes having 'dma-ranges'.
> While this is an error for 'ranges', this is fine because DMA capable
> devices always have a translatable DMA address. Also, with no
> 'dma-ranges' at all, the assumption is that DMA addresses are 1:1 with
> no restrictions unless perhaps the device itself has implicit
> restrictions.
>
> This keeps in sync with Linux kernel commit:
>
>   81db12ee15cb: of/address: Translate 'dma-ranges' for parent nodes missing 'dma-ranges'
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
>
> ---
>
> Changes in v2:
> - rebase on top of Dario's revert patch:
>   http://patchwork.ozlabs.org/project/uboot/patch/20210425141746.19115-6-dariobin at libero.it/

The above dependent patch is now in u-boot/master.

Could you please apply this series?

> - drop commit "of: addr: Abort address translation for parent nodes missing 'ranges'",
>   as the revert patch restores the abort behavior
>
>  drivers/core/of_addr.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>

Regards,
Bin

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/2] of: addr: Translate 'dma-ranges' for parent nodes missing 'dma-ranges'
  2021-05-17  2:03 ` [PATCH v2 1/2] of: addr: Translate 'dma-ranges' for parent nodes missing 'dma-ranges' Bin Meng
@ 2021-06-04  6:11   ` Bin Meng
  2021-06-05 13:39     ` Simon Glass
  2021-06-05 16:02     ` Simon Glass
  0 siblings, 2 replies; 9+ messages in thread
From: Bin Meng @ 2021-06-04  6:11 UTC (permalink / raw)
  To: Simon Glass, U-Boot Mailing List

On Mon, May 17, 2021 at 10:03 AM Bin Meng <bmeng.cn@gmail.com> wrote:
>
> Hi Simon,
>
> On Fri, Apr 30, 2021 at 9:17 PM Bin Meng <bmeng.cn@gmail.com> wrote:
> >
> > 'dma-ranges' frequently exists without parent nodes having 'dma-ranges'.
> > While this is an error for 'ranges', this is fine because DMA capable
> > devices always have a translatable DMA address. Also, with no
> > 'dma-ranges' at all, the assumption is that DMA addresses are 1:1 with
> > no restrictions unless perhaps the device itself has implicit
> > restrictions.
> >
> > This keeps in sync with Linux kernel commit:
> >
> >   81db12ee15cb: of/address: Translate 'dma-ranges' for parent nodes missing 'dma-ranges'
> >
> > Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> > Reviewed-by: Simon Glass <sjg@chromium.org>
> >
> > ---
> >
> > Changes in v2:
> > - rebase on top of Dario's revert patch:
> >   http://patchwork.ozlabs.org/project/uboot/patch/20210425141746.19115-6-dariobin@libero.it/
>
> The above dependent patch is now in u-boot/master.
>
> Could you please apply this series?
>

Ping?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/2] of: addr: Translate 'dma-ranges' for parent nodes missing 'dma-ranges'
  2021-06-04  6:11   ` Bin Meng
@ 2021-06-05 13:39     ` Simon Glass
  2021-06-05 16:02     ` Simon Glass
  1 sibling, 0 replies; 9+ messages in thread
From: Simon Glass @ 2021-06-05 13:39 UTC (permalink / raw)
  To: Bin Meng; +Cc: U-Boot Mailing List

Hi Bin,

On Fri, 4 Jun 2021 at 00:11, Bin Meng <bmeng.cn@gmail.com> wrote:
>
> On Mon, May 17, 2021 at 10:03 AM Bin Meng <bmeng.cn@gmail.com> wrote:
> >
> > Hi Simon,
> >
> > On Fri, Apr 30, 2021 at 9:17 PM Bin Meng <bmeng.cn@gmail.com> wrote:
> > >
> > > 'dma-ranges' frequently exists without parent nodes having 'dma-ranges'.
> > > While this is an error for 'ranges', this is fine because DMA capable
> > > devices always have a translatable DMA address. Also, with no
> > > 'dma-ranges' at all, the assumption is that DMA addresses are 1:1 with
> > > no restrictions unless perhaps the device itself has implicit
> > > restrictions.
> > >
> > > This keeps in sync with Linux kernel commit:
> > >
> > >   81db12ee15cb: of/address: Translate 'dma-ranges' for parent nodes missing 'dma-ranges'
> > >
> > > Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> > > Reviewed-by: Simon Glass <sjg@chromium.org>
> > >
> > > ---
> > >
> > > Changes in v2:
> > > - rebase on top of Dario's revert patch:
> > >   http://patchwork.ozlabs.org/project/uboot/patch/20210425141746.19115-6-dariobin@libero.it/
> >
> > The above dependent patch is now in u-boot/master.
> >
> > Could you please apply this series?
> >
>
> Ping?

OK I am taking a look.

Regards,
Simon

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 2/2] of: addr: Remove call to dev_count_cells() in of_get_address()
  2021-04-30 18:13   ` Simon Glass
  2021-05-01  1:22     ` Bin Meng
@ 2021-06-05 16:02     ` Simon Glass
  1 sibling, 0 replies; 9+ messages in thread
From: Simon Glass @ 2021-06-05 16:02 UTC (permalink / raw)
  To: Bin Meng; +Cc: U-Boot Mailing List, Simon Glass

Hi Simon,

On Sat, May 1, 2021 at 2:14 AM Simon Glass <sjg@chromium.org> wrote:
>
> On Fri, 30 Apr 2021 at 07:17, Bin Meng <bmeng.cn@gmail.com> wrote:
> >
> > In of_get_address(), there is:
> >
> >   dev_count_cells(dev, &na, &ns);
> >
> > followed by:
> >
> >   bus->count_cells(dev, &na, &ns);
> >
> > but no codes in between use na/ns, hence the first call is useless.
> > By dropping the first call, dev_count_cells() is now useless too.
> >
> > Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> >
> > ---
> >
> > Changes in v2:
> > - new patch: of: addr: Remove call to dev_count_cells() in of_get_address()
> >
> >  drivers/core/of_addr.c | 6 ------
> >  1 file changed, 6 deletions(-)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
>
> I wonder why this is now different from linux?

With this patch, the code flow is the same as Linux.

Regards,
Bin

Applied to u-boot-dm, thanks!

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/2] of: addr: Translate 'dma-ranges' for parent nodes missing 'dma-ranges'
  2021-06-04  6:11   ` Bin Meng
  2021-06-05 13:39     ` Simon Glass
@ 2021-06-05 16:02     ` Simon Glass
  1 sibling, 0 replies; 9+ messages in thread
From: Simon Glass @ 2021-06-05 16:02 UTC (permalink / raw)
  To: Simon Glass; +Cc: U-Boot Mailing List, Bin Meng

Hi Bin,

On Fri, 4 Jun 2021 at 00:11, Bin Meng <bmeng.cn@gmail.com> wrote:
>
> On Mon, May 17, 2021 at 10:03 AM Bin Meng <bmeng.cn@gmail.com> wrote:
> >
> > Hi Simon,
> >
> > On Fri, Apr 30, 2021 at 9:17 PM Bin Meng <bmeng.cn@gmail.com> wrote:
> > >
> > > 'dma-ranges' frequently exists without parent nodes having 'dma-ranges'.
> > > While this is an error for 'ranges', this is fine because DMA capable
> > > devices always have a translatable DMA address. Also, with no
> > > 'dma-ranges' at all, the assumption is that DMA addresses are 1:1 with
> > > no restrictions unless perhaps the device itself has implicit
> > > restrictions.
> > >
> > > This keeps in sync with Linux kernel commit:
> > >
> > >   81db12ee15cb: of/address: Translate 'dma-ranges' for parent nodes missing 'dma-ranges'
> > >
> > > Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> > > Reviewed-by: Simon Glass <sjg@chromium.org>
> > >
> > > ---
> > >
> > > Changes in v2:
> > > - rebase on top of Dario's revert patch:
> > >   http://patchwork.ozlabs.org/project/uboot/patch/20210425141746.19115-6-dariobin@libero.it/
> >
> > The above dependent patch is now in u-boot/master.
> >
> > Could you please apply this series?
> >
>
> Ping?

OK I am taking a look.

Regards,
Simon

Applied to u-boot-dm, thanks!

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-06-05 16:02 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-30 13:16 [PATCH v2 1/2] of: addr: Translate 'dma-ranges' for parent nodes missing 'dma-ranges' Bin Meng
2021-04-30 13:16 ` [PATCH v2 2/2] of: addr: Remove call to dev_count_cells() in of_get_address() Bin Meng
2021-04-30 18:13   ` Simon Glass
2021-05-01  1:22     ` Bin Meng
2021-06-05 16:02     ` Simon Glass
2021-05-17  2:03 ` [PATCH v2 1/2] of: addr: Translate 'dma-ranges' for parent nodes missing 'dma-ranges' Bin Meng
2021-06-04  6:11   ` Bin Meng
2021-06-05 13:39     ` Simon Glass
2021-06-05 16:02     ` Simon Glass

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.