linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] A few fixes to DTL buffer access over debugfs
@ 2018-09-27  8:10 Naveen N. Rao
  2018-09-27  8:10 ` [PATCH 1/2] powerpc/pseries: Fix DTL buffer registration Naveen N. Rao
  2018-09-27  8:10 ` [PATCH 2/2] powerpc/pseries: Fix how we iterate over the DTL entries Naveen N. Rao
  0 siblings, 2 replies; 4+ messages in thread
From: Naveen N. Rao @ 2018-09-27  8:10 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev

Two trivial fixes to DTL buffer access over debugfs when 
CONFIG_VIRT_CPU_ACCOUNTING_NATIVE is not set.

- Naveen

Naveen N. Rao (2):
  powerpc/pseries: Fix DTL buffer registration
  powerpc/pseries: Fix how we iterate over the DTL entries

 arch/powerpc/platforms/pseries/dtl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.19.0

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

* [PATCH 1/2] powerpc/pseries: Fix DTL buffer registration
  2018-09-27  8:10 [PATCH 0/2] A few fixes to DTL buffer access over debugfs Naveen N. Rao
@ 2018-09-27  8:10 ` Naveen N. Rao
  2018-10-04  6:14   ` [1/2] " Michael Ellerman
  2018-09-27  8:10 ` [PATCH 2/2] powerpc/pseries: Fix how we iterate over the DTL entries Naveen N. Rao
  1 sibling, 1 reply; 4+ messages in thread
From: Naveen N. Rao @ 2018-09-27  8:10 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev

When CONFIG_VIRT_CPU_ACCOUNTING_NATIVE is not set, we register the DTL
buffer for a cpu when the associated file under powerpc/dtl in debugfs
is opened. When doing so, we need to set the size of the buffer being
registered in the second u32 word of the buffer. This needs to be in big
endian, but we are not doing the conversion resulting in the below error
showing up in dmesg:

	dtl_start: DTL registration for cpu 0 (hw 0) failed with -4

Fix this in the obvious manner.

Fixes: 7c105b63bd98 ("powerpc: Add CONFIG_CPU_LITTLE_ENDIAN kernel config option.")
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
 arch/powerpc/platforms/pseries/dtl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/dtl.c b/arch/powerpc/platforms/pseries/dtl.c
index 18014cdeb590..c762689e0eb3 100644
--- a/arch/powerpc/platforms/pseries/dtl.c
+++ b/arch/powerpc/platforms/pseries/dtl.c
@@ -149,7 +149,7 @@ static int dtl_start(struct dtl *dtl)
 
 	/* Register our dtl buffer with the hypervisor. The HV expects the
 	 * buffer size to be passed in the second word of the buffer */
-	((u32 *)dtl->buf)[1] = DISPATCH_LOG_BYTES;
+	((u32 *)dtl->buf)[1] = cpu_to_be32(DISPATCH_LOG_BYTES);
 
 	hwcpu = get_hard_smp_processor_id(dtl->cpu);
 	addr = __pa(dtl->buf);
-- 
2.19.0

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

* [PATCH 2/2] powerpc/pseries: Fix how we iterate over the DTL entries
  2018-09-27  8:10 [PATCH 0/2] A few fixes to DTL buffer access over debugfs Naveen N. Rao
  2018-09-27  8:10 ` [PATCH 1/2] powerpc/pseries: Fix DTL buffer registration Naveen N. Rao
@ 2018-09-27  8:10 ` Naveen N. Rao
  1 sibling, 0 replies; 4+ messages in thread
From: Naveen N. Rao @ 2018-09-27  8:10 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev

When CONFIG_VIRT_CPU_ACCOUNTING_NATIVE is not set, we look up dtl_idx in
the lppaca to determine the number of entries in the buffer. Since
lppaca is in big endian, we need to do an endian conversion before using
this in our calculation to determine the number of entries in the
buffer. Without this, we do not iterate over the existing entries in the
DTL buffer properly.

Fixes: 7c105b63bd98 ("powerpc: Add CONFIG_CPU_LITTLE_ENDIAN kernel config option.")
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
 arch/powerpc/platforms/pseries/dtl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/dtl.c b/arch/powerpc/platforms/pseries/dtl.c
index c762689e0eb3..ef6595153642 100644
--- a/arch/powerpc/platforms/pseries/dtl.c
+++ b/arch/powerpc/platforms/pseries/dtl.c
@@ -184,7 +184,7 @@ static void dtl_stop(struct dtl *dtl)
 
 static u64 dtl_current_index(struct dtl *dtl)
 {
-	return lppaca_of(dtl->cpu).dtl_idx;
+	return be64_to_cpu(lppaca_of(dtl->cpu).dtl_idx);
 }
 #endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */
 
-- 
2.19.0

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

* Re: [1/2] powerpc/pseries: Fix DTL buffer registration
  2018-09-27  8:10 ` [PATCH 1/2] powerpc/pseries: Fix DTL buffer registration Naveen N. Rao
@ 2018-10-04  6:14   ` Michael Ellerman
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Ellerman @ 2018-10-04  6:14 UTC (permalink / raw)
  To: Naveen N. Rao; +Cc: linuxppc-dev

On Thu, 2018-09-27 at 08:10:57 UTC, "Naveen N. Rao" wrote:
> When CONFIG_VIRT_CPU_ACCOUNTING_NATIVE is not set, we register the DTL
> buffer for a cpu when the associated file under powerpc/dtl in debugfs
> is opened. When doing so, we need to set the size of the buffer being
> registered in the second u32 word of the buffer. This needs to be in big
> endian, but we are not doing the conversion resulting in the below error
> showing up in dmesg:
> 
> 	dtl_start: DTL registration for cpu 0 (hw 0) failed with -4
> 
> Fix this in the obvious manner.
> 
> Fixes: 7c105b63bd98 ("powerpc: Add CONFIG_CPU_LITTLE_ENDIAN kernel config option.")
> Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>

Series applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/db787af1b8a6b4be428ee2ea7d409d

cheers

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

end of thread, other threads:[~2018-10-04  6:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-27  8:10 [PATCH 0/2] A few fixes to DTL buffer access over debugfs Naveen N. Rao
2018-09-27  8:10 ` [PATCH 1/2] powerpc/pseries: Fix DTL buffer registration Naveen N. Rao
2018-10-04  6:14   ` [1/2] " Michael Ellerman
2018-09-27  8:10 ` [PATCH 2/2] powerpc/pseries: Fix how we iterate over the DTL entries Naveen N. Rao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).