All of lore.kernel.org
 help / color / mirror / Atom feed
From: Helge Deller <deller@gmx.de>
To: linux-parisc@vger.kernel.org,
	James Bottomley <James.Bottomley@hansenpartnership.com>,
	John David Anglin <dave.anglin@bell.net>
Subject: [PATCH] parisc: Add alternative prefetchw() on 32-bit CPUs
Date: Sun, 25 Sep 2022 08:41:28 +0200	[thread overview]
Message-ID: <Yy/4GF75gFz86ZAH@p100> (raw)

Add the ALT_COND_RUN_ON_PA1X alternative conditional to nop
out a 64-bit ldd instruction in prefetchw() when running on 32-bit CPUs.

Signed-off-by: Helge Deller <deller@gmx.de>

diff --git a/arch/parisc/include/asm/alternative.h b/arch/parisc/include/asm/alternative.h
index 0ec54f43d6d2..8b94aa4f1bd7 100644
--- a/arch/parisc/include/asm/alternative.h
+++ b/arch/parisc/include/asm/alternative.h
@@ -9,6 +9,7 @@
 #define ALT_COND_NO_SPLIT_TLB	0x08	/* if split_tlb == 0  */
 #define ALT_COND_NO_IOC_FDC	0x10	/* if I/O cache does not need flushes */
 #define ALT_COND_RUN_ON_QEMU	0x20	/* if running on QEMU */
+#define ALT_COND_RUN_ON_PA1X	0x40	/* if running on PA1.x CPU */

 #define INSN_PxTLB	0x02		/* modify pdtlb, pitlb */
 #define INSN_NOP	0x08000240	/* nop */
diff --git a/arch/parisc/include/asm/prefetch.h b/arch/parisc/include/asm/prefetch.h
index 6e63f720024d..ea898362dfc0 100644
--- a/arch/parisc/include/asm/prefetch.h
+++ b/arch/parisc/include/asm/prefetch.h
@@ -17,6 +17,8 @@
 #define __ASM_PARISC_PREFETCH_H

 #ifndef __ASSEMBLY__
+#include <asm/alternative.h>
+
 #ifdef CONFIG_PREFETCH

 #define ARCH_HAS_PREFETCH
@@ -35,7 +37,9 @@ static inline void prefetch(const void *addr)
 #define ARCH_HAS_PREFETCHW
 static inline void prefetchw(const void *addr)
 {
-	__asm__("ldd 0(%0), %%r0" : : "r" (addr));
+	__asm__("ldd 0(%0), %%r0"
+		ALTERNATIVE(ALT_COND_RUN_ON_PA1X, INSN_NOP)
+		: : "r" (addr));
 }
 #endif /* CONFIG_PA20 */

diff --git a/arch/parisc/kernel/alternative.c b/arch/parisc/kernel/alternative.c
index daa1e9047275..276904ab7265 100644
--- a/arch/parisc/kernel/alternative.c
+++ b/arch/parisc/kernel/alternative.c
@@ -33,6 +33,7 @@ void __init_or_module apply_alternatives(struct alt_instr *start,
 		((cache_info.dc_size == 0) ? ALT_COND_NO_DCACHE : 0) |
 		((cache_info.ic_size == 0) ? ALT_COND_NO_ICACHE : 0) |
 		(running_on_qemu ? ALT_COND_RUN_ON_QEMU : 0) |
+		((boot_cpu_data.cpu_type < pcxu) ? ALT_COND_RUN_ON_PA1X : 0) |
 		((split_tlb == 0) ? ALT_COND_NO_SPLIT_TLB : 0) |
 		/*
 		 * If the PDC_MODEL capabilities has Non-coherent IO-PDIR bit

                 reply	other threads:[~2022-09-25  6:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=Yy/4GF75gFz86ZAH@p100 \
    --to=deller@gmx.de \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=dave.anglin@bell.net \
    --cc=linux-parisc@vger.kernel.org \
    /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.