Re: [PATCH 3/4] dma-mapping: introduce a dma_common_find_pages helper

2019-10-07 Thread Geert Uytterhoeven
se warnings in dma_common_free_remap()"). Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just

Re: [PATCH 3/4] dma-mapping: introduce a dma_common_find_pages helper

2019-10-02 Thread Geert Uytterhoeven
flags != VM_DMA_COHERENT) ... while this one checks area->flags? > + return NULL; > + return area->pages; > +} > + > static struct vm_struct *__dma_common_pages_remap(struct page **pages, > size_t size, pgprot_t prot, const void

[PATCH] iommu/ipmmu-vmsa: Only call platform_get_irq() when interrupt is mandatory

2019-10-01 Thread Geert Uytterhoeven
: 7723f4c5ecdb8d83 ("driver core: platform: Add an error message to platform_get_irq*()") Signed-off-by: Geert Uytterhoeven --- This is a fix for v5.4-rc1. --- drivers/iommu/ipmmu-vmsa.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/iommu/ipmmu-vmsa.c b/dri

Re: [PATCH] iommu/ipmmu-vmsa: Hook up r8a774b1 DT matching code

2019-09-26 Thread Geert Uytterhoeven
car_gen3_whitelist[] = { > { .soc_id = "r8a774c0", }, > + { .soc_id = "r8a774b1", }, Please preserve alphabetical sort order. > { .soc_id = "r8a7795", .revision = "ES3.*" }, > { .soc_id = "r8a77965", }, >

Re: [PATCH] dt-bindings: iommu: ipmmu-vmsa: Add r8a774b1 support

2019-09-26 Thread Geert Uytterhoeven
On Tue, Sep 24, 2019 at 9:41 AM Biju Das wrote: > Document RZ/G2N (R8A774B1) SoC bindings. > > Signed-off-by: Biju Das Reviewed-by: Geert Uytterhoeven Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux

Re: [PATCH v1 2/2] of: Let of_for_each_phandle fallback to non-negative cell_count

2019-09-17 Thread Geert Uytterhoeven
Hi Uwe, On Tue, Sep 17, 2019 at 2:25 PM Uwe Kleine-König wrote: > On Tue, Sep 17, 2019 at 11:25:46AM +, Peter Rosin wrote: > > On 2019-09-17 12:13, Uwe Kleine-König wrote: > > > On Tue, Sep 17, 2019 at 11:40:25AM +0200, Geert Uytterhoeven wrote: > > >> On Fri

Re: [PATCH v1 2/2] of: Let of_for_each_phandle fallback to non-negative cell_count

2019-09-17 Thread Geert Uytterhoeven
(kernel_init) from [] (ret_from_fork+0x14/0x2c) Exception stack(0xeb08dfb0 to 0xeb08dff8) dfa0: dfc0: dfe0: 0000 0013 0

[PATCH 2/2] iommu/ipmmu-vmsa: Disable cache snoop transactions on R-Car Gen3

2019-09-04 Thread Geert Uytterhoeven
comments to the register bit definitions, to make it clear they apply to R-Car Gen2 only. Signed-off-by: Hai Nguyen Pham [geert: Reword, add comments] Signed-off-by: Geert Uytterhoeven --- drivers/iommu/ipmmu-vmsa.c | 71 -- 1 file changed, 38 insertions(+), 33

[PATCH 0/2] iommu/ipmmu-vmsa: Disable cache snoop transactions on R-Car Gen3

2019-09-04 Thread Geert Uytterhoeven
H3 ES2.0 with QEMU+KVM and VFIO for EtherAVB. Thanks! Geert Uytterhoeven (1): iommu/ipmmu-vmsa: Move IMTTBCR_SL0_TWOBIT_* to restore sort order Hai Nguyen Pham (1): iommu/ipmmu-vmsa: Disable cache snoop transactions on R-Car Gen3 drivers/iommu/ipmmu-vmsa.c | 78

[PATCH 1/2] iommu/ipmmu-vmsa: Move IMTTBCR_SL0_TWOBIT_* to restore sort order

2019-09-04 Thread Geert Uytterhoeven
Signed-off-by: Geert Uytterhoeven --- drivers/iommu/ipmmu-vmsa.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c index 76a8ec343d53252e..1baabeaddc9cba1b 100644 --- a/drivers/iommu/ipmmu-vmsa.c +++ b/drivers/iommu/ip

Re: [PATCH 4/6] dma-mapping: remove arch_dma_mmap_pgprot

2019-08-16 Thread Geert Uytterhoeven
f-by: Christoph Hellwig > arch/m68k/Kconfig | 1 - > arch/m68k/include/asm/pgtable_mm.h | 3 +++ > arch/m68k/kernel/dma.c | 3 +-- Acked-by: Geert Uytterhoeven Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of

Re: [PATCH 6/6] driver core: initialize a default DMA mask for platform device

2019-08-16 Thread Geert Uytterhoeven
t; Note that the code looks a little odd with the various conditionals > because we have to support platform_device structures that are > statically allocated. > > Signed-off-by: Christoph Hellwig > --- > arch/m68k/kernel/dma.c | 9 --- Acked-by: Geert U

Re: [PATCH 8/8] dma-mapping: remove CONFIG_ARCH_NO_COHERENT_DMA_MMAP

2019-08-09 Thread Geert Uytterhoeven
a mapping > implementation including its own mmap method, which is handled by moving > the CONFIG_MMU check in dma_can_mmap so that is only applies to the > dma-direct case, just as the other ifdefs for it. > > Signed-off-by: Christoph Hellwig > arch/m68k/Kconfig | 1 - For m68k: A

Re: [PATCH 4/5] dma-mapping: provide a better default ->get_required_mask

2019-07-29 Thread Geert Uytterhoeven
1tmjbheu29agleynwbvzbsbb-rrh7yyun...@mail.gmail.com/ Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalist

Re: switch m68k to use the generic remapping DMA allocator v2

2019-07-08 Thread Geert Uytterhoeven
encies to properly build on sun3 > - updated a patch description to better explain why we are doing this Thanks, both applied and queued for v5.3. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In p

Re: [PATCH 1/2] m68k: use the generic dma coherent remap allocator

2019-07-01 Thread Geert Uytterhoeven
pgprot(_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_DIRTY); > - if (CPU_IS_040_OR_060) > - pgprot_val(pgprot) |= _PAGE_GLOBAL040 | _PAGE_NOCACHE_S; > - else > - pgprot_val(pgprot) |= _PAGE_NOCACHE030; > - addr = vmap(map, size, VM_MAP,

Re: [RFC] switch m68k to use the generic remapping DMA allocator

2019-06-25 Thread Geert Uytterhoeven
Hi Christoph, On Tue, Jun 25, 2019 at 9:35 AM Christoph Hellwig wrote: > On Tue, Jun 25, 2019 at 09:26:48AM +0200, Geert Uytterhoeven wrote: > > > > bloat-o-meter says: > > > > > > > > add/remove: 75/0 grow/shrink: 11/6 up/down: 4122/-82 (4040)

Re: [RFC] switch m68k to use the generic remapping DMA allocator

2019-06-25 Thread Geert Uytterhoeven
Hi Christoph, On Tue, Jun 25, 2019 at 8:33 AM Christoph Hellwig wrote: > On Mon, Jun 17, 2019 at 08:53:55PM +0200, Geert Uytterhoeven wrote: > > On Fri, Jun 14, 2019 at 12:21 PM Christoph Hellwig wrote: > > > can you take a look at the (untested) patches below? They convert

Re: [RFC] switch m68k to use the generic remapping DMA allocator

2019-06-24 Thread Geert Uytterhoeven
RE && !SUN3 in arch/m68k/Kconfig fixes the build. Alternatively, you could use: - select DMA_DIRECT_REMAP if MMU && !COLDFIRE + select DMA_DIRECT_REMAP if HAS_DMA && MMU && !COLDFIRE Gr{oetje,eeting}s, Geert -- Geert Uytterh

Re: [RFC] switch m68k to use the generic remapping DMA allocator

2019-06-17 Thread Geert Uytterhoeven
ays: add/remove: 75/0 grow/shrink: 11/6 up/down: 4122/-82 (4040) Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to jo

Re: [RFC PATCH v6 4/5] mmc: tmio: Use dma_max_mapping_size() instead of a workaround

2019-06-17 Thread Geert Uytterhoeven
Hi Shimoda-san, On Mon, Jun 17, 2019 at 6:54 AM Yoshihiro Shimoda wrote: > > From: Geert Uytterhoeven, Sent: Friday, June 14, 2019 4:27 PM > > On Fri, Jun 14, 2019 at 9:18 AM Christoph Hellwig wrote: > > > On Thu, Jun 13, 2019 at 10:35:44PM +0200, Geert Uytterhoeven wrot

Re: [RFC PATCH v6 4/5] mmc: tmio: Use dma_max_mapping_size() instead of a workaround

2019-06-14 Thread Geert Uytterhoeven
Hi Christoph, On Fri, Jun 14, 2019 at 9:18 AM Christoph Hellwig wrote: > On Thu, Jun 13, 2019 at 10:35:44PM +0200, Geert Uytterhoeven wrote: > > I'm always triggered by the use of min_t() and other casts: > > mmc->max_blk_size and mmc->max_blk_count

Re: [RFC PATCH v6 4/5] mmc: tmio: Use dma_max_mapping_size() instead of a workaround

2019-06-13 Thread Geert Uytterhoeven
ory, dma_max_mapping_size() can return a number that doesn't fit in 32-bit, and will be truncated (to e.g. 0), leading to max_req_size is zero? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge

[PATCH v4 2/6] iommu/ipmmu-vmsa: Prepare to handle 40-bit error addresses

2019-05-27 Thread Geert Uytterhoeven
On R-Car Gen3, the faulting virtual address is a 40-bit address, and comprised of two registers. Read the upper address part, and combine both parts, when running on a 64-bit system. Signed-off-by: Geert Uytterhoeven Reviewed-by: Simon Horman Reviewed-by: Yoshihiro Shimoda Tested

[PATCH v4 5/6] iommu/ipmmu-vmsa: Extract hardware context initialization

2019-05-27 Thread Geert Uytterhoeven
ipmmu_domain_init_context() takes care of (1) initializing the software domain, and (2) initializing the hardware context for the domain. Extract the code to initialize the hardware context into a new subroutine ipmmu_domain_setup_context(), to prepare for later reuse. Signed-off-by: Geert

[PATCH v4 6/6] iommu/ipmmu-vmsa: Add suspend/resume support

2019-05-27 Thread Geert Uytterhoeven
resume. Signed-off-by: Geert Uytterhoeven Reviewed-by: Yoshihiro Shimoda Tested-by: Yoshihiro Shimoda --- This patch takes a different approach than the BSP, which implements a bulk save/restore of all registers during system suspend/resume. v4: - Add Reviewed-by, Tested-by, v3: - No changes

[PATCH v4 1/6] iommu/ipmmu-vmsa: Link IOMMUs and devices in sysfs

2019-05-27 Thread Geert Uytterhoeven
all links are created, on both arm32 and arm64. Signed-off-by: Geert Uytterhoeven Reviewed-by: Laurent Pinchart Reviewed-by: Yoshihiro Shimoda Tested-by: Yoshihiro Shimoda --- v4: - Add Reviewed-by, Tested-by, v3: - Fix sysfs path typo in patch description, v2: - Add Reviewed-by. --- d

[PATCH v4 0/6] iommu/ipmmu-vmsa: Suspend/resume support and assorted cleanups

2019-05-27 Thread Geert Uytterhoeven
SCI checks. This has been tested on Salvator-XS with R-Car H3 ES2.0, with IPMMU suport for SATA enabled. To play safe, the resume operation has also been tested on R-Car M2-W. Is there anything still blocking the integration of this patch series? If not, please apply. Thanks! Geert Uytte

[PATCH v4 3/6] iommu/ipmmu-vmsa: Make IPMMU_CTX_MAX unsigned

2019-05-27 Thread Geert Uytterhoeven
Make the IPMMU_CTX_MAX constant unsigned, to match the type of ipmmu_features.number_of_contexts. This allows to use plain min() instead of type-casting min_t(). Signed-off-by: Geert Uytterhoeven Reviewed-by: Laurent Pinchart Reviewed-by: Simon Horman Reviewed-by: Yoshihiro Shimoda Tested

[PATCH v4 4/6] iommu/ipmmu-vmsa: Move num_utlbs to SoC-specific features

2019-05-27 Thread Geert Uytterhoeven
The maximum number of micro-TLBs per IPMMU instance is not fixed, but depends on the SoC type. Hence move it from struct ipmmu_vmsa_device to struct ipmmu_features, and set up the correct value for both R-Car Gen2 and Gen3 SoCs. Note that currently no code uses this value. Signed-off-by: Geert

[PATCH v3 3/6] iommu/ipmmu-vmsa: Make IPMMU_CTX_MAX unsigned

2019-04-24 Thread Geert Uytterhoeven
Make the IPMMU_CTX_MAX constant unsigned, to match the type of ipmmu_features.number_of_contexts. This allows to use plain min() instead of type-casting min_t(). Signed-off-by: Geert Uytterhoeven Reviewed-by: Laurent Pinchart Reviewed-by: Simon Horman --- v3: - Add Reviewed-by, v2: - Add

[PATCH v3 4/6] iommu/ipmmu-vmsa: Move num_utlbs to SoC-specific features

2019-04-24 Thread Geert Uytterhoeven
The maximum number of micro-TLBs per IPMMU instance is not fixed, but depends on the SoC type. Hence move it from struct ipmmu_vmsa_device to struct ipmmu_features, and set up the correct value for both R-Car Gen2 and Gen3 SoCs. Note that currently no code uses this value. Signed-off-by: Geert

[PATCH v3 0/6] iommu/ipmmu-vmsa: Suspend/resume support and assorted cleanups

2019-04-24 Thread Geert Uytterhoeven
r H3 ES2.0, with IPMMU suport for SATA enabled. To play safe, the resume operation has also been tested on R-Car M2-W. Thanks! Geert Uytterhoeven (6): iommu/ipmmu-vmsa: Link IOMMUs and devices in sysfs iommu/ipmmu-vmsa: Prepare to handle 40-bit error addresses iommu/ipmmu-vmsa: Make IPM

[PATCH v3 6/6] iommu/ipmmu-vmsa: Add suspend/resume support

2019-04-24 Thread Geert Uytterhoeven
resume. Signed-off-by: Geert Uytterhoeven --- This patch takes a different approach than the BSP, which implements a bulk save/restore of all registers during system suspend/resume. v3: - No changes, v2: - Drop PSCI checks. --- drivers/iommu/ipmmu-vmsa.c | 47

[PATCH v3 1/6] iommu/ipmmu-vmsa: Link IOMMUs and devices in sysfs

2019-04-24 Thread Geert Uytterhoeven
all links are created, on both arm32 and arm64. Signed-off-by: Geert Uytterhoeven Reviewed-by: Laurent Pinchart --- v3: - Fix sysfs path typo in patch description, v2: - Add Reviewed-by. --- drivers/iommu/ipmmu-vmsa.c | 24 +--- 1 file changed, 17 insertions(+), 7 deletions(

[PATCH v3 2/6] iommu/ipmmu-vmsa: Prepare to handle 40-bit error addresses

2019-04-24 Thread Geert Uytterhoeven
On R-Car Gen3, the faulting virtual address is a 40-bit address, and comprised of two registers. Read the upper address part, and combine both parts, when running on a 64-bit system. Signed-off-by: Geert Uytterhoeven Reviewed-by: Simon Horman --- Apart from this, the driver doesn't support 40

[PATCH v3 5/6] iommu/ipmmu-vmsa: Extract hardware context initialization

2019-04-24 Thread Geert Uytterhoeven
ipmmu_domain_init_context() takes care of (1) initializing the software domain, and (2) initializing the hardware context for the domain. Extract the code to initialize the hardware context into a new subroutine ipmmu_domain_setup_context(), to prepare for later reuse. Signed-off-by: Geert

Re: [PATCH v2 6/6] iommu/ipmmu-vmsa: Add suspend/resume support

2019-04-23 Thread Geert Uytterhoeven
Hi Simon, On Thu, Apr 11, 2019 at 10:39 AM Simon Horman wrote: > On Wed, Apr 03, 2019 at 08:21:48PM +0200, Geert Uytterhoeven wrote: > > During PSCI system suspend, R-Car Gen3 SoCs are powered down, and all > > IPMMU state is lost. Hence after s2ram, devices wired

Re: [PATCH v2 1/6] iommu/ipmmu-vmsa: Link IOMMUs and devices in sysfs

2019-04-23 Thread Geert Uytterhoeven
Hi Simon, On Thu, Apr 11, 2019 at 10:12 AM Simon Horman wrote: > On Thu, Apr 11, 2019 at 10:10:28AM +0200, Simon Horman wrote: > > On Wed, Apr 03, 2019 at 08:21:43PM +0200, Geert Uytterhoeven wrote: > > > As of commit 7af9a5fdb9e0ca33 ("iommu/ipmmu-vmsa: Use > > >

[PATCH v2 4/6] iommu/ipmmu-vmsa: Move num_utlbs to SoC-specific features

2019-04-03 Thread Geert Uytterhoeven
The maximum number of micro-TLBs per IPMMU instance is not fixed, but depends on the SoC type. Hence move it from struct ipmmu_vmsa_device to struct ipmmu_features, and set up the correct value for both R-Car Gen2 and Gen3 SoCs. Note that currently no code uses this value. Signed-off-by: Geert

[PATCH v2 3/6] iommu/ipmmu-vmsa: Make IPMMU_CTX_MAX unsigned

2019-04-03 Thread Geert Uytterhoeven
Make the IPMMU_CTX_MAX constant unsigned, to match the type of ipmmu_features.number_of_contexts. This allows to use plain min() instead of type-casting min_t(). Signed-off-by: Geert Uytterhoeven Reviewed-by: Laurent Pinchart --- v2: - Add Reviewed-by. --- drivers/iommu/ipmmu-vmsa.c | 5

[PATCH v2 0/6] iommu/ipmmu-vmsa: Suspend/resume support and assorted cleanups

2019-04-03 Thread Geert Uytterhoeven
also been tested on R-Car M2-W. Thanks! Geert Uytterhoeven (6): iommu/ipmmu-vmsa: Link IOMMUs and devices in sysfs iommu/ipmmu-vmsa: Prepare to handle 40-bit error addresses iommu/ipmmu-vmsa: Make IPMMU_CTX_MAX unsigned iommu/ipmmu-vmsa: Move num_utlbs to SoC-specific features iommu/

[PATCH v2 2/6] iommu/ipmmu-vmsa: Prepare to handle 40-bit error addresses

2019-04-03 Thread Geert Uytterhoeven
On R-Car Gen3, the faulting virtual address is a 40-bit address, and comprised of two registers. Read the upper address part, and combine both parts, when running on a 64-bit system. Signed-off-by: Geert Uytterhoeven --- Apart from this, the driver doesn't support 40-bit IOVA addresses yet. v2

[PATCH v2 5/6] iommu/ipmmu-vmsa: Extract hardware context initialization

2019-04-03 Thread Geert Uytterhoeven
ipmmu_domain_init_context() takes care of (1) initializing the software domain, and (2) initializing the hardware context for the domain. Extract the code to initialize the hardware context into a new subroutine ipmmu_domain_setup_context(), to prepare for later reuse. Signed-off-by: Geert

[PATCH v2 1/6] iommu/ipmmu-vmsa: Link IOMMUs and devices in sysfs

2019-04-03 Thread Geert Uytterhoeven
all links are created, on both arm32 and arm64. Signed-off-by: Geert Uytterhoeven Reviewed-by: Laurent Pinchart --- v2: - Add Reviewed-by. --- drivers/iommu/ipmmu-vmsa.c | 24 +--- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/iommu/ipmmu-vmsa.c b/dr

[PATCH v2 6/6] iommu/ipmmu-vmsa: Add suspend/resume support

2019-04-03 Thread Geert Uytterhoeven
resume. Signed-off-by: Geert Uytterhoeven --- This patch takes a different approach than the BSP, which implements a bulk save/restore of all registers during system suspend/resume. v2: - Drop PSCI checks. --- drivers/iommu/ipmmu-vmsa.c | 47 +- 1 file changed

Re: [PATCH/RFC] driver core: Postpone DMA tear-down until after devres release

2019-03-26 Thread Geert Uytterhoeven
; > devres_release_all(dev); > driver_sysfs_remove(dev); > dev->driver = NULL; > dev_set_drvdata(dev, NULL); > > We seem to be able to call arch_teardown_dma_ops() prior to > devres_release_all() if we reach probe_failed label. Yes, this looks like ano

Re: [PATCH] [v2] dma-mapping: work around clang bug

2019-03-07 Thread Geert Uytterhoeven
to handle 0 instead. > > Yes, good idea. > > > FWIW I'd be very tempted to fold in the second shift as "2ULL<<((n)-1)", > > but that may not be to everyone's taste. > > I like that. So shall we do this? > > /* > * Shifting '2' instead of '1' because of > * h

Re: [PATCH] dma-mapping: work around clang bug

2019-03-07 Thread Geert Uytterhoeven
t;((n)-1))-1) > << 1)) The second "-1" should be done on the final result, not on the intermediate value. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversa

Re: [PATCH 7/7] iommu/ipmmu-vmsa: Add suspend/resume support

2019-02-20 Thread Geert Uytterhoeven
Hi Laurent, On Wed, Feb 20, 2019 at 5:11 PM Laurent Pinchart wrote: > On Wed, Feb 20, 2019 at 05:05:49PM +0100, Geert Uytterhoeven wrote: > > On Wed, Feb 20, 2019 at 4:42 PM Laurent Pinchart wrote: > > > On Wed, Feb 20, 2019 at 04:05:31PM +0100, Geert Uytterhoeven wrote:

Re: [PATCH 7/7] iommu/ipmmu-vmsa: Add suspend/resume support

2019-02-20 Thread Geert Uytterhoeven
Hi Laurent, On Wed, Feb 20, 2019 at 4:42 PM Laurent Pinchart wrote: > On Wed, Feb 20, 2019 at 04:05:31PM +0100, Geert Uytterhoeven wrote: > > During PSCI system suspend, R-Car Gen3 SoCs are powered down, and all > > IPMMU state is lost. Hence after s2ram, devices wired

Re: [PATCH 6/7] iommu/ipmmu-vmsa: Extract hardware context initialization

2019-02-20 Thread Geert Uytterhoeven
Hi Laurent, On Wed, Feb 20, 2019 at 4:35 PM Laurent Pinchart wrote: > On Wed, Feb 20, 2019 at 04:05:30PM +0100, Geert Uytterhoeven wrote: > > ipmmu_domain_init_context() takes care of (1) initializing the software > > domain, and (2) initializing the hardware context

Re: [PATCH 3/7] iommu/ipmmu-vmsa: Prepare to handle 40-bit error addresses

2019-02-20 Thread Geert Uytterhoeven
Hi Laurent, On Wed, Feb 20, 2019 at 4:31 PM Laurent Pinchart wrote: > On Wed, Feb 20, 2019 at 04:05:27PM +0100, Geert Uytterhoeven wrote: > > On R-Car Gen3, the faulting virtual address is a 40-bit address, and > > comprised of two registers. Read the upper address part, and c

[PATCH 1/7] iommu/ipmmu-vmsa: Link IOMMUs and devices in sysfs

2019-02-20 Thread Geert Uytterhoeven
all links are created, on both arm32 and arm64. Signed-off-by: Geert Uytterhoeven --- drivers/iommu/ipmmu-vmsa.c | 24 +--- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c index 9a380c10655e182d..9f2b781e20a0e

[PATCH 7/7] iommu/ipmmu-vmsa: Add suspend/resume support

2019-02-20 Thread Geert Uytterhoeven
resume. To avoid overhead on platforms not needing it, the resume code has a build time dependency on sleep and PSCI support, and a runtime dependency on PSCI. Signed-off-by: Geert Uytterhoeven --- This patch takes a different approach than the BSP, which implements a bulk save/restore of all

[PATCH 0/7] iommu/ipmmu-vmsa: Suspend/resume support and assorted cleanups

2019-02-20 Thread Geert Uytterhoeven
for SATA enabled. To play safe, the resume operation has also been tested on R-Car M2-W, where it is currently not enabled due to the absence of PSCI in the firmware. Thanks for your comments! Geert Uytterhoeven (7): iommu/ipmmu-vmsa: Link IOMMUs and devices in sysfs iommu/ipmmu-vmsa: Call

[PATCH 2/7] iommu/ipmmu-vmsa: Call ipmmu_ctx_write_root() instead of open coding

2019-02-20 Thread Geert Uytterhoeven
There is a helper to write to the root IPMMU instance's registers, so let's use it. Signed-off-by: Geert Uytterhoeven --- drivers/iommu/ipmmu-vmsa.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c index

[PATCH 5/7] iommu/ipmmu-vmsa: Move num_utlbs to SoC-specific features

2019-02-20 Thread Geert Uytterhoeven
The maximum number of micro-TLBs per IPMMU instance is not fixed, but depends on the SoC type. Hence move it from struct ipmmu_vmsa_device to struct ipmmu_features, and set up the correct value for both R-Car Gen2 and Gen3 SoCs. Note that currently no code uses this value. Signed-off-by: Geert

[PATCH 6/7] iommu/ipmmu-vmsa: Extract hardware context initialization

2019-02-20 Thread Geert Uytterhoeven
ipmmu_domain_init_context() takes care of (1) initializing the software domain, and (2) initializing the hardware context for the domain. Extract the code to initialize the hardware context into a new subroutine ipmmu_context_init(), to prepare for later reuse. Signed-off-by: Geert Uytterhoeven

[PATCH 3/7] iommu/ipmmu-vmsa: Prepare to handle 40-bit error addresses

2019-02-20 Thread Geert Uytterhoeven
On R-Car Gen3, the faulting virtual address is a 40-bit address, and comprised of two registers. Read the upper address part, and combine both parts, when running on a 64-bit system. Signed-off-by: Geert Uytterhoeven --- Apart from this, the driver doesn't support 40-bit IOVA addresses yet

[PATCH 4/7] iommu/ipmmu-vmsa: Make IPMMU_CTX_MAX unsigned

2019-02-20 Thread Geert Uytterhoeven
Make the IPMMU_CTX_MAX constant unsigned, to match the type of ipmmu_features.number_of_contexts. This allows to use plain min() instead of type-casting min_t(). Signed-off-by: Geert Uytterhoeven --- drivers/iommu/ipmmu-vmsa.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff

[PATCH 0/3] iommu: Kerneldoc improvements

2019-02-20 Thread Geert Uytterhoeven
Hi Jörg, This series contains a fix for an incorrect kerneldoc parameter, and adds the missing kerneldoc for two recently added IOMMU methods. Thanks! Geert Uytterhoeven (3): iommu: Fix kerneldoc for iommu_ops.flush_iotlb_all() iommu: Document iommu_ops.iotlb_sync_map() iommu

[PATCH 3/3] iommu: Document iommu_ops.is_attach_deferred()

2019-02-20 Thread Geert Uytterhoeven
Add missing kerneldoc for iommu_ops.is_attach_deferred(). Fixes: e01d1913b0d08171 ("iommu: Add is_attach_deferred call-back to iommu-ops") Signed-off-by: Geert Uytterhoeven --- include/linux/iommu.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/linux/iommu.h b/inc

[PATCH 2/3] iommu: Document iommu_ops.iotlb_sync_map()

2019-02-20 Thread Geert Uytterhoeven
Add missing kerneldoc for iommu_ops.iotlb_sync_map(). Fixes: 1d7ae53b152dbc5b ("iommu: Introduce iotlb_sync_map callback") Signed-off-by: Geert Uytterhoeven --- include/linux/iommu.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/iommu.h b/include/linux/iom

[PATCH 1/3] iommu: Fix kerneldoc for iommu_ops.flush_iotlb_all()

2019-02-20 Thread Geert Uytterhoeven
While the API wrapper is called iommu_flush_tlb_all(), the actual iommu_ops method is called .flush_iotlb_all(), not .flush_tlb_all(). Fixes: add02cfdc9bc2987 ("iommu: Introduce Interface for IOMMU TLB Flushing") Signed-off-by: Geert Uytterhoeven --- include/linux/iommu.h | 2 +- 1 fi

[PATCH] iommu: Fix IOMMU debugfs fallout

2019-02-20 Thread Geert Uytterhoeven
, and removing the reference to and implementation of iommu_debugfs_new_driver_dir(). Fixes: bad614b24293ae46 ("iommu: Enable debugfs exposure of IOMMU driver internals") Signed-off-by: Geert Uytterhoeven --- drivers/iommu/iommu-debugfs.c | 23 --- 1 file changed, 4

[PATCH/RFC] driver core: Postpone DMA tear-down until after devres release

2019-02-07 Thread Geert Uytterhoeven
A allocation API, the allocated DMA memory will be freed using the direct DMA ops, while it may have been allocated using a custom DMA ops (iommu_dma_ops in this case). Fix this by reversing the order of the calls to devres_release_all() and arch_teardown_dma_ops(). Signed-off-by: Geert Uytterhoev

Re: [PATCH 3/4] iommu/of: Don't call iommu_ops->add_device directly

2018-12-20 Thread Geert Uytterhoeven
..3ed4db334341 100644 > --- a/drivers/iommu/iommu.c > +++ b/drivers/iommu/iommu.c > @@ -114,10 +114,14 @@ void iommu_device_unregister(struct iommu_device *iommu) > int iommu_probe_device(struct device *dev) > { > const struct iommu_ops *ops = dev->bus->iommu_ops;

Re: [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_*

2018-12-14 Thread Geert Uytterhoeven
Hi Christoph, On Fri, Dec 14, 2018 at 12:47 PM Christoph Hellwig wrote: > > On Fri, Dec 14, 2018 at 10:54:32AM +0100, Geert Uytterhoeven wrote: > > > - page = alloc_pages(flag, order); > > > + page = alloc_pages(flag | GFP_ZERO, order);

Re: [PATCH] iommu/ipmmu-vmsa: Hook up r8a774c0 DT matching code

2018-12-14 Thread Geert Uytterhoeven
On Thu, Dec 13, 2018 at 9:22 PM Fabrizio Castro wrote: > Support RZ/G2E (a.k.a. R8A774C0) IPMMU. > > Signed-off-by: Fabrizio Castro Reviewed-by: Geert Uytterhoeven Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge

Re: [PATCH] dt-bindings: iommu: ipmmu-vmsa: Add r8a774c0 support

2018-12-14 Thread Geert Uytterhoeven
On Thu, Dec 13, 2018 at 9:19 PM Fabrizio Castro wrote: > Document RZ/G2E (R8A774C0) SoC bindings. > > Signed-off-by: Fabrizio Castro Reviewed-by: Geert Uytterhoeven Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge

Re: [PATCH 1/2] dma-mapping: zero memory returned from dma_alloc_*

2018-12-14 Thread Geert Uytterhoeven
On Fri, Dec 14, 2018 at 10:54 AM Geert Uytterhoeven wrote: > On Fri, Dec 14, 2018 at 9:26 AM Christoph Hellwig wrote: > > If we want to map memory from the DMA allocator to userspace it must be > > zeroed at allocation time to prevent stale data leaks. We already do > >

Re: [PATCH 2/2] iommu/ipmmu-vmsa: add an array of slave devices whitelist

2018-11-28 Thread Geert Uytterhoeven
off-by: Yoshihiro Shimoda Reviewed-by: Geert Uytterhoeven One small comment below. > --- a/drivers/iommu/ipmmu-vmsa.c > +++ b/drivers/iommu/ipmmu-vmsa.c > @@ -773,8 +773,13 @@ static int ipmmu_init_platform_device(struct device *dev, > { /* sentinel */ } > }; > > +stati

Re: [PATCH 1/2] iommu/ipmmu-vmsa: Modify ipmmu_slave_whitelist() to check SoC revisions

2018-11-28 Thread Geert Uytterhoeven
shihiro Shimoda Reviewed-by: Geert Uytterhoeven One question below. > --- a/drivers/iommu/ipmmu-vmsa.c > +++ b/drivers/iommu/ipmmu-vmsa.c > @@ -771,11 +765,35 @@ static bool ipmmu_slave_whitelist(struct device *dev) > { /* sentinel */ } > }; > > +stat

Re: [PATCH] iommu/ipmmu-vmsa: Fix crash on early domain free

2018-11-07 Thread Geert Uytterhoeven
Hi Jörg, On Wed, Nov 7, 2018 at 4:34 PM Joerg Roedel wrote: > On Wed, Nov 07, 2018 at 01:22:52PM +, Robin Murphy wrote: > > On 2018-11-07 1:18 pm, Geert Uytterhoeven wrote: > > > Fix this by checking if the domain's context already exists, before > > > trying to d

[PATCH] iommu/ipmmu-vmsa: Fix crash on early domain free

2018-11-07 Thread Geert Uytterhoeven
kobject_put+0x60/0xe8 iommu_group_get_for_dev+0xa8/0x1f0 ipmmu_add_device+0x1c/0x40 of_iommu_configure+0x118/0x190 Fix this by checking if the domain's context already exists, before trying to destroy it. Signed-off-by: Geert Uytterhoeven --- drivers/iommu/ipmmu-vmsa.c | 3

Re: IOMMU breakage on arm64

2018-11-07 Thread Geert Uytterhoeven
Hi Robin, On Tue, Nov 6, 2018 at 9:20 PM Robin Murphy wrote: > On 2018-11-06 7:44 pm, Geert Uytterhoeven wrote: > > On Tue, Oct 23, 2018 at 1:40 AM Linux Kernel Mailing List > > wrote: > >> Commit: b4ebe6063204da58e48600b810a9

Re: [PATCH] of/device: Really only set bus DMA mask when appropriate

2018-11-07 Thread Geert Uytterhoeven
("of/device: Set bus DMA mask as appropriate") > Reported-by: Aaro Koskinen > Reported-by: Jean-Philippe Brucker > Signed-off-by: Robin Murphy Thanks, this fixes the problem I saw with IPMMU on Salvator-X(S). Tested-by: Geert Uytterhoeven Gr{oetje,eeting}s,

IOMMU breakage on arm64 (was: Re: dma-direct: implement complete bus_dma_mask handling)

2018-11-06 Thread Geert Uytterhoeven
u/arm-smmu-v3.c and drivers/iommu/arm-smmu.c need similar fixes. I didn't check all drivers, but e.g. drivers/iommu/amd_iommu.c has a similar check. Does the IOMMU work on other arm64 platforms in v4.20-rc1? Thanks for your comments! Gr{oetje,eeting}s, Geert -- Geert U

Re: [RFC PATCH 1/3] ARM: dma-mapping: update comment about handling dma_ops when detaching from IOMMU

2018-09-14 Thread Geert Uytterhoeven
_iommu_detach_device()") > Signed-off-by: Wolfram Sang Nice catch! Reviewed-by: Geert Uytterhoeven Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call m

Re: of_dma_request_slave_channel() failed ?

2018-09-14 Thread Geert Uytterhoeven
ut, because of this new iommu patch, keeping this feature > needs "big complicated patch", and we can get "small effect" I think. > Thus, I think this is the time to remove this feature. > Can you agree ? You're the rcar-sound expert ;-) If you think there's not much

[PATCH v2] drivers/vfio: Allow type-1 IOMMU instantiation with all ARM/ARM64 IOMMUs

2018-09-13 Thread Geert Uytterhoeven
64", like other architectures do. The feature is still restricted to ARM/ARM64 platforms with an IOMMU by the dependency on IOMMU_API. Signed-off-by: Geert Uytterhoeven --- Tested with sata_rcar on Renesas R-Car H3 ES2.0. This causes a trivial merge conflict with commit c01eaa95ad30897b ("Make

Re: of_dma_request_slave_channel() failed ?

2018-09-13 Thread Geert Uytterhoeven
Hi Robin, On Thu, Sep 13, 2018 at 12:12 PM Robin Murphy wrote: > On 13/09/18 10:00, Geert Uytterhoeven wrote: > [...] > > The main issue is that if of_dma_find_controller() fails, a DMA slave driver > > cannot distinguish between dmac not yet probed successfully, and dmac >

Re: of_dma_request_slave_channel() failed ?

2018-09-13 Thread Geert Uytterhoeven
Hi Mark, On Wed, Sep 12, 2018 at 5:51 PM Mark Brown wrote: > On Tue, Sep 11, 2018 at 11:43:47AM +0200, Geert Uytterhoeven wrote: > > So it seems the audio DMAC is deferred a second time, before the iommu > > driver > > probed. > > Shouldn't there be at least one m

Re: of_dma_request_slave_channel() failed ?

2018-09-13 Thread Geert Uytterhoeven
ly support" or "overkill support". > > After this patch, it needs DMA, otherwise, probe will be failed. > DT shouldn't have non-SSI modules if you want to use PIO mode. > > + /* use PIO mode */ > - playback = < >; > + playback =

Re: [PATCH] Iommu: ipmmu-vmsa: replace spin_lock_irqsave with spin_lock in ISR

2018-09-11 Thread Geert Uytterhoeven
CC linux-renesas-soc On Tue, Sep 11, 2018 at 5:01 PM jun qian wrote: > > As you are already in ISR, it is unnecessary to call spin_lock_irqsave. > > Signed-off-by: jun qian > --- > drivers/iommu/ipmmu-vmsa.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git

Re: of_dma_request_slave_channel() failed ?

2018-09-11 Thread Geert Uytterhoeven
00.dma-controller: ignoring dependency for device, assuming no driver rcar-dmac ec72.dma-controller: ignoring dependency for device, assuming no driver So it seems the audio DMAC is deferred a second time, before the iommu driver probed. subsys_initcall(ipmmu_init); calls platform_dr

Re: [PATCH] dma-mapping: fix return type of dma_set_max_seg_size()

2018-08-30 Thread Geert Uytterhoeven
On Wed, Aug 29, 2018 at 11:30 PM Niklas Söderlund wrote: > The function dma_set_max_seg_size() can return either 0 on success or > -EIO on error. Change its return type from unsigned int to int to > capture this. > > Signed-off-by: Niklas Söderlund Reviewed-by: Geert Uytterho

Re: [PATCH v1] iommu/ipmmu-vmsa: Don't register as BUS IOMMU if machine doesn't have IPMMU-VMSA

2018-08-27 Thread Geert Uytterhoeven
this ? If not, > could you please add it to your to-do list ? On the contrary: IOMMU_OF_DECLARE() has been removed. > > > ret = platform_driver_register(_driver); > > if (ret < 0) > > return ret; Gr{oetje,eeting}s,

Re: [PATCH v9 2/2] iommu/amd: Add basic debugfs infrastructure for AMD IOMMU

2018-08-27 Thread Geert Uytterhoeven
be enabled. If it is that bad, shouldn't this option be protected by some Kconfig trickery to avoid it being enabled in allmodconfig/allyesconfig builds? I forgot the way to do that, so some CCs added. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots o

Re: [PATCH 1/2] iommu/ipmmu-vmsa: Hook up R8A774A1 DT maching code

2018-08-23 Thread Geert Uytterhoeven
F_DECLARE(ipmmu_vmsa_iommu_of, "renesas,ipmmu-vmsa"); > +IOMMU_OF_DECLARE(ipmmu_r8a774a1_iommu_of, "renesas,ipmmu-r8a774a1"); > IOMMU_OF_DECLARE(ipmmu_r8a7795_iommu_of, "renesas,ipmmu-r8a7795"); > IOMMU_OF_DECLARE(ipmmu_r8a7796_iommu_of, "renesas,ipmmu-

Re: [PATCH] iommu/ipmmu-vmsa: convert to SPDX identifiers

2018-08-02 Thread Geert Uytterhoeven
On Thu, Aug 2, 2018 at 3:49 AM Kuninori Morimoto wrote: > From: Kuninori Morimoto > > Signed-off-by: Kuninori Morimoto Reviewed-by: Geert Uytterhoeven Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux

Re: use the generic dma-noncoherent code for sh V2

2018-07-30 Thread Geert Uytterhoeven
f all pieces to support DMA were ever upstreamed. See e.g. commit 219fb0c1436e4893 ("serial: sh-sci: Remove the platform data dma slave rx/tx channel IDs"). Perhaps Guennadi knows/remembers? Gr{oetje,eeting}s, Geert -- Geert Uytte

[PATCH/RFC] drivers/vfio: Allow type-1 IOMMU instantiation with Renesas IPMMU-VMSA

2018-07-25 Thread Geert Uytterhoeven
The Renesas IPMMU-VMSA driver is compatible with the notion of a type-1 IOMMU in VFIO. This patch allows guests to use the VFIO_IOMMU_TYPE1 API on hosts equipped with a Renesas VMSA-compatible IPMMU. Signed-off-by: Geert Uytterhoeven --- Lightly tested with sata_rcar on Renesas R-Car H3 ES2.0

[PATCH v2] iommu/ipmmu-vmsa: Fix allocation in atomic context

2018-07-25 Thread Geert Uytterhoeven
its own custom page table allocation implementation using GFP_ATOMIC, hence the spinlock was fine. Fix this by replacing the spinlock by a mutex, like the arm-smmu driver does. Fixes: f20ed39f53145e45 ("iommu/ipmmu-vmsa: Use the ARM LPAE page table allocator") Signed-off-by: Geert Uy

[PATCH] iommu/ipmmu-vmsa: Clarify supported platforms

2018-07-25 Thread Geert Uytterhoeven
The Renesas IPMMU-VMSA driver supports not just R-Car H2 and M2 SoCs, but also other R-Car Gen2 and R-Car Gen3 SoCs. Drop a superfluous "Renesas" while at it. Signed-off-by: Geert Uytterhoeven --- drivers/iommu/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)

Re: [PATCH 4/5] sh: split arch/sh/mm/consistent.c

2018-07-23 Thread Geert Uytterhoeven
-= PFN_PHYS(dev->dma_pfn_offset); > > ... here > > Is the s/-=/- intended? > > Snippets copied here below: > > > + *dma_handle = virt_to_phys(ret); > > + if (!WARN_ON(!dev)) > > + *dma_handle - PFN_PHYS(dev->dma_pfn_offset); > vs

[PATCH] iommu/ipmmu-vmsa: Fix allocation in atomic context

2018-07-20 Thread Geert Uytterhoeven
its own custom page table allocation implementation using GFP_ATOMIC, hence the spinlock was fine. Fix this by replacing the spinlock by a mutex, like the arm-smmu driver does. Fixes: f20ed39f53145e45 ("iommu/ipmmu-vmsa: Use the ARM LPAE page table allocator") Signed-off-by: Geert Uy

Re: [PATCH] iommu/ipmmu-vmsa: Document R-Car V3H and E3 IPMMU DT bindings

2018-06-06 Thread Geert Uytterhoeven
On Mon, May 21, 2018 at 4:41 PM, Magnus Damm wrote: > From: Magnus Damm > > Update the IPMMU DT binding documentation to include the compat strings > for the IPMMU devices included in the R-Car V3H and E3 SoCs. > > Signed-off-by: Magnus Damm Reviewed-by: Geert Uytterhoeven

Re: [PATCH v3 12/20] media: Remove depends on HAS_DMA in case of platform dependency

2018-05-07 Thread Geert Uytterhoeven
Hi Mauro, On Sat, May 5, 2018 at 2:47 PM, Mauro Carvalho Chehab <mchehab+sams...@kernel.org> wrote: > Em Tue, 17 Apr 2018 19:49:12 +0200 > Geert Uytterhoeven <ge...@linux-m68k.org> escreveu: > >> Remove dependencies on HAS_DMA where a Kconfig symbol depends on ano

<    1   2   3   4   >