All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
To: u-boot@lists.denx.de
Subject: [PATCH v3 09/12] dm: test: Add test case for dev_phys_to_bus()/dev_bus_to_phys()
Date: Mon, 21 Dec 2020 14:47:54 +0100	[thread overview]
Message-ID: <933235a25c702d2e9a03f3d151d8ab523d9a6c2e.camel@suse.de> (raw)
In-Reply-To: <CAPnjgZ1g3cmrTCe4+iNYdK4MwRxrP4oM91kVbqhQNHay0-LAJA@mail.gmail.com>

On Fri, 2020-12-18 at 19:28 -0700, Simon Glass wrote:
> On Tue, 15 Dec 2020 at 10:23, Nicolas Saenz Julienne
> <nsaenzjulienne@suse.de> wrote:
> > 
> > By reusing DT nodes already available in sandbox's test DT introduce a
> > test to validate dev_phys_to_bus()/dev_bus_to_phys().
> > 
> > Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
> > ---
> > ?test/dm/Makefile   |  1 +
> > ?test/dm/phys2bus.c | 36 ++++++++++++++++++++++++++++++++++++
> > ?2 files changed, 37 insertions(+)
> > ?create mode 100644 test/dm/phys2bus.c
> 
> Reviewed-by: Simon Glass <sjg@chromium.org>
> 
> comment below
> 
> > 
> > diff --git a/test/dm/Makefile b/test/dm/Makefile
> > index 5c52d8b6ea..ac86abaa88 100644
> > --- a/test/dm/Makefile
> > +++ b/test/dm/Makefile
> > @@ -16,6 +16,7 @@ obj-$(CONFIG_UT_DM) += test-uclass.o
> > 
> > ?obj-$(CONFIG_UT_DM) += core.o
> > ?obj-$(CONFIG_UT_DM) += read.o
> > +obj-$(CONFIG_UT_DM) += phys2bus.o
> > ?ifneq ($(CONFIG_SANDBOX),)
> > ?obj-$(CONFIG_ACPIGEN) += acpi.o
> > ?obj-$(CONFIG_ACPIGEN) += acpigen.o
> > diff --git a/test/dm/phys2bus.c b/test/dm/phys2bus.c
> > new file mode 100644
> > index 0000000000..06a045c168
> > --- /dev/null
> > +++ b/test/dm/phys2bus.c
> > @@ -0,0 +1,36 @@
> > +// SPDX-License-Identifier: GPL-2.0+
> > +/*
> > + * Copyright (c) 2020 Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
> > + */
> > +
> > +#include <common.h>
> > +#include <dm.h>
> > +#include <phys2bus.h>
> > +#include <dm/device.h>
> > +#include <dm/ofnode.h>
> > +#include <dm/root.h>
> > +#include <dm/test.h>
> > +#include <dm/uclass-internal.h>
> > +#include <test/ut.h>
> > +
> > +static int dm_test_phys_to_bus(struct unit_test_state *uts)
> > +{
> > +       struct udevice *dev;
> > +       ofnode node;
> > +
> > +       node = ofnode_path("/mmio-bus at 0");
> > +       ut_assert(ofnode_valid(node));
> > +       ut_assert(!uclass_get_device_by_ofnode(UCLASS_TEST_BUS, node, &dev));
> > +       /* In this case it should be transparent, no dma-ranges in parent bus */
> > +       ut_asserteq_ptr((void*)0xfffffULL, (void*)dev_phys_to_bus(dev, 0xfffff));
> 
> ut_asserteq_addr() might be better here? Not sure.

That function uses map_to_sysmem() under the hood, which AFAIR didn't play well
with these addresses.

Regards,
Nicolas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201221/3cd972b1/attachment.sig>

  reply	other threads:[~2020-12-21 13:47 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-15 17:23 [PATCH v3 00/12] Raspberry Pi 400/Compute Module 4 support Nicolas Saenz Julienne
2020-12-15 17:23 ` [PATCH v3 01/12] rpi: Add identifier for the new RPi400 Nicolas Saenz Julienne
2020-12-15 17:23 ` [PATCH v3 02/12] rpi: Add identifier for the new CM4 Nicolas Saenz Julienne
2020-12-15 17:23 ` [PATCH v3 03/12] pci: pcie-brcmstb: Fix inbound window configurations Nicolas Saenz Julienne
2020-12-15 17:23 ` [PATCH v3 04/12] dm: Introduce xxx_get_dma_range() Nicolas Saenz Julienne
2020-12-19  2:28   ` Simon Glass
2020-12-21 13:03     ` Nicolas Saenz Julienne
2020-12-21 16:47       ` Simon Glass
2020-12-15 17:23 ` [PATCH v3 05/12] dm: test: Add test case for dev_get_dma_ranges() Nicolas Saenz Julienne
2020-12-19  2:28   ` Simon Glass
2020-12-15 17:23 ` [PATCH v3 06/12] dm: Introduce DMA constraints into the core device model Nicolas Saenz Julienne
2020-12-19  2:28   ` Simon Glass
2020-12-15 17:23 ` [PATCH v3 07/12] dm: test: Add test case for dev->dma_offset Nicolas Saenz Julienne
2020-12-19  2:28   ` Simon Glass
2020-12-21 13:36     ` Nicolas Saenz Julienne
2020-12-15 17:23 ` [PATCH v3 08/12] dm: Introduce dev_phys_to_bus()/dev_bus_to_phys() Nicolas Saenz Julienne
2020-12-15 17:23 ` [PATCH v3 09/12] dm: test: Add test case for dev_phys_to_bus()/dev_bus_to_phys() Nicolas Saenz Julienne
2020-12-19  2:28   ` Simon Glass
2020-12-21 13:47     ` Nicolas Saenz Julienne [this message]
2020-12-21 16:47       ` Simon Glass
2020-12-15 17:23 ` [PATCH v3 10/12] xhci: translate virtual addresses into the bus's address space Nicolas Saenz Julienne
2020-12-19  2:28   ` Simon Glass
2020-12-21 13:51     ` Nicolas Saenz Julienne
2020-12-15 17:23 ` [PATCH v3 11/12] mmc: Introduce mmc_phys_to_bus()/mmc_bus_to_phys() Nicolas Saenz Julienne
2020-12-19  2:28   ` Simon Glass
2020-12-21 14:23     ` Nicolas Saenz Julienne
2020-12-21 16:47       ` Simon Glass
2020-12-21 19:52         ` Nicolas Saenz Julienne
2020-12-21 20:23           ` Simon Glass
2020-12-15 17:23 ` [PATCH v3 12/12] configs: rpi4: Enable DM_DMA across all RPi4 configurations Nicolas Saenz Julienne
2020-12-19  2:28   ` Simon Glass

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=933235a25c702d2e9a03f3d151d8ab523d9a6c2e.camel@suse.de \
    --to=nsaenzjulienne@suse.de \
    --cc=u-boot@lists.denx.de \
    /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.