All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH kernel] powerpc/powernv: Fix it_ops::get() callback to return in cpu endian
@ 2017-02-21  2:38 Alexey Kardashevskiy
  2017-02-21  2:52 ` David Gibson
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Alexey Kardashevskiy @ 2017-02-21  2:38 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Alexey Kardashevskiy, David Gibson

The iommu_table_ops callbacks are declared CPU endian as they take and
return "unsigned long"; underlying hardware tables are big-endian.

However get() was missing be64_to_cpu(), this adds the missing conversion.

The only caller of this is crash dump at arch/powerpc/kernel/iommu.c,
iommu_table_clear() which only compares TCE to zero so this change
should not cause behavioral change.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 arch/powerpc/platforms/powernv/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
index c6d554fe585c..3f7f267a3d04 100644
--- a/arch/powerpc/platforms/powernv/pci.c
+++ b/arch/powerpc/platforms/powernv/pci.c
@@ -758,7 +758,7 @@ void pnv_tce_free(struct iommu_table *tbl, long index, long npages)
 
 unsigned long pnv_tce_get(struct iommu_table *tbl, long index)
 {
-	return *(pnv_tce(tbl, index - tbl->it_offset));
+	return be64_to_cpu(*(pnv_tce(tbl, index - tbl->it_offset)));
 }
 
 struct iommu_table *pnv_pci_table_alloc(int nid)
-- 
2.11.0

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

* Re: [PATCH kernel] powerpc/powernv: Fix it_ops::get() callback to return in cpu endian
  2017-02-21  2:38 [PATCH kernel] powerpc/powernv: Fix it_ops::get() callback to return in cpu endian Alexey Kardashevskiy
@ 2017-02-21  2:52 ` David Gibson
  2017-02-21 22:26 ` Gavin Shan
  2017-03-21 11:36 ` [kernel] " Michael Ellerman
  2 siblings, 0 replies; 4+ messages in thread
From: David Gibson @ 2017-02-21  2:52 UTC (permalink / raw)
  To: Alexey Kardashevskiy; +Cc: linuxppc-dev

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

On Tue, Feb 21, 2017 at 01:38:54PM +1100, Alexey Kardashevskiy wrote:
> The iommu_table_ops callbacks are declared CPU endian as they take and
> return "unsigned long"; underlying hardware tables are big-endian.
> 
> However get() was missing be64_to_cpu(), this adds the missing conversion.
> 
> The only caller of this is crash dump at arch/powerpc/kernel/iommu.c,
> iommu_table_clear() which only compares TCE to zero so this change
> should not cause behavioral change.
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  arch/powerpc/platforms/powernv/pci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c
> index c6d554fe585c..3f7f267a3d04 100644
> --- a/arch/powerpc/platforms/powernv/pci.c
> +++ b/arch/powerpc/platforms/powernv/pci.c
> @@ -758,7 +758,7 @@ void pnv_tce_free(struct iommu_table *tbl, long index, long npages)
>  
>  unsigned long pnv_tce_get(struct iommu_table *tbl, long index)
>  {
> -	return *(pnv_tce(tbl, index - tbl->it_offset));
> +	return be64_to_cpu(*(pnv_tce(tbl, index - tbl->it_offset)));
>  }
>  
>  struct iommu_table *pnv_pci_table_alloc(int nid)

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

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

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

* Re: [PATCH kernel] powerpc/powernv: Fix it_ops::get() callback to return in cpu endian
  2017-02-21  2:38 [PATCH kernel] powerpc/powernv: Fix it_ops::get() callback to return in cpu endian Alexey Kardashevskiy
  2017-02-21  2:52 ` David Gibson
@ 2017-02-21 22:26 ` Gavin Shan
  2017-03-21 11:36 ` [kernel] " Michael Ellerman
  2 siblings, 0 replies; 4+ messages in thread
From: Gavin Shan @ 2017-02-21 22:26 UTC (permalink / raw)
  To: Alexey Kardashevskiy; +Cc: linuxppc-dev, David Gibson

On Tue, Feb 21, 2017 at 01:38:54PM +1100, Alexey Kardashevskiy wrote:
>The iommu_table_ops callbacks are declared CPU endian as they take and
>return "unsigned long"; underlying hardware tables are big-endian.
>
>However get() was missing be64_to_cpu(), this adds the missing conversion.
>
>The only caller of this is crash dump at arch/powerpc/kernel/iommu.c,
>iommu_table_clear() which only compares TCE to zero so this change
>should not cause behavioral change.
>
>Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>

Acked-by: Gavin Shan <gwshan@linux.vnet.ibm.com>

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

* Re: [kernel] powerpc/powernv: Fix it_ops::get() callback to return in cpu endian
  2017-02-21  2:38 [PATCH kernel] powerpc/powernv: Fix it_ops::get() callback to return in cpu endian Alexey Kardashevskiy
  2017-02-21  2:52 ` David Gibson
  2017-02-21 22:26 ` Gavin Shan
@ 2017-03-21 11:36 ` Michael Ellerman
  2 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2017-03-21 11:36 UTC (permalink / raw)
  To: Alexey Kardashevskiy, linuxppc-dev; +Cc: Alexey Kardashevskiy, David Gibson

On Tue, 2017-02-21 at 02:38:54 UTC, Alexey Kardashevskiy wrote:
> The iommu_table_ops callbacks are declared CPU endian as they take and
> return "unsigned long"; underlying hardware tables are big-endian.
> 
> However get() was missing be64_to_cpu(), this adds the missing conversion.
> 
> The only caller of this is crash dump at arch/powerpc/kernel/iommu.c,
> iommu_table_clear() which only compares TCE to zero so this change
> should not cause behavioral change.
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> Acked-by: Gavin Shan <gwshan@linux.vnet.ibm.com>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/81d5fe1a3b1acfaadc7921d08609e0

cheers

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

end of thread, other threads:[~2017-03-21 11:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-21  2:38 [PATCH kernel] powerpc/powernv: Fix it_ops::get() callback to return in cpu endian Alexey Kardashevskiy
2017-02-21  2:52 ` David Gibson
2017-02-21 22:26 ` Gavin Shan
2017-03-21 11:36 ` [kernel] " Michael Ellerman

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.