From: Jisheng Zhang <jszhang@kernel.org>
To: Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>
Cc: Guo Ren <guoren@kernel.org>,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH v3 2/2] riscv: errata: thead: use pa based instructions for CMO
Date: Thu, 12 Oct 2023 22:14:56 +0800 [thread overview]
Message-ID: <20231012141456.4078-3-jszhang@kernel.org> (raw)
In-Reply-To: <20231012141456.4078-1-jszhang@kernel.org>
T-HEAD CPUs such as C906/C910/C920 support phy address based CMO, use
them so that we don't need to convert to virt address.
Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
---
arch/riscv/errata/thead/errata.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/arch/riscv/errata/thead/errata.c b/arch/riscv/errata/thead/errata.c
index 3fefeb1b456e..632557f36b19 100644
--- a/arch/riscv/errata/thead/errata.c
+++ b/arch/riscv/errata/thead/errata.c
@@ -58,9 +58,9 @@ static bool errata_probe_pbmt(unsigned int stage,
* | 31 - 25 | 24 - 20 | 19 - 15 | 14 - 12 | 11 - 7 | 6 - 0 |
* 0000000 11001 00000 000 00000 0001011
*/
-#define THEAD_inval_A0 ".long 0x0265000b"
-#define THEAD_clean_A0 ".long 0x0255000b"
-#define THEAD_flush_A0 ".long 0x0275000b"
+#define THEAD_inval_A0 ".long 0x02a5000b"
+#define THEAD_clean_A0 ".long 0x0295000b"
+#define THEAD_flush_A0 ".long 0x02b5000b"
#define THEAD_SYNC_S ".long 0x0190000b"
#define THEAD_CMO_OP(_op, _start, _size, _cachesize) \
@@ -79,23 +79,17 @@ asm volatile("mv a0, %1\n\t" \
static void thead_errata_cache_inv(phys_addr_t paddr, size_t size)
{
- void *vaddr = phys_to_virt(paddr);
-
- THEAD_CMO_OP(inval, vaddr, size, riscv_cbom_block_size);
+ THEAD_CMO_OP(inval, paddr, size, riscv_cbom_block_size);
}
static void thead_errata_cache_wback(phys_addr_t paddr, size_t size)
{
- void *vaddr = phys_to_virt(paddr);
-
- THEAD_CMO_OP(clean, vaddr, size, riscv_cbom_block_size);
+ THEAD_CMO_OP(clean, paddr, size, riscv_cbom_block_size);
}
static void thead_errata_cache_wback_inv(phys_addr_t paddr, size_t size)
{
- void *vaddr = phys_to_virt(paddr);
-
- THEAD_CMO_OP(flush, vaddr, size, riscv_cbom_block_size);
+ THEAD_CMO_OP(flush, paddr, size, riscv_cbom_block_size);
}
static const struct riscv_nonstd_cache_ops thead_errata_cmo_ops = {
--
2.40.1
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
WARNING: multiple messages have this Message-ID (diff)
From: Jisheng Zhang <jszhang@kernel.org>
To: Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>
Cc: Guo Ren <guoren@kernel.org>,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: [PATCH v3 2/2] riscv: errata: thead: use pa based instructions for CMO
Date: Thu, 12 Oct 2023 22:14:56 +0800 [thread overview]
Message-ID: <20231012141456.4078-3-jszhang@kernel.org> (raw)
In-Reply-To: <20231012141456.4078-1-jszhang@kernel.org>
T-HEAD CPUs such as C906/C910/C920 support phy address based CMO, use
them so that we don't need to convert to virt address.
Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
---
arch/riscv/errata/thead/errata.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/arch/riscv/errata/thead/errata.c b/arch/riscv/errata/thead/errata.c
index 3fefeb1b456e..632557f36b19 100644
--- a/arch/riscv/errata/thead/errata.c
+++ b/arch/riscv/errata/thead/errata.c
@@ -58,9 +58,9 @@ static bool errata_probe_pbmt(unsigned int stage,
* | 31 - 25 | 24 - 20 | 19 - 15 | 14 - 12 | 11 - 7 | 6 - 0 |
* 0000000 11001 00000 000 00000 0001011
*/
-#define THEAD_inval_A0 ".long 0x0265000b"
-#define THEAD_clean_A0 ".long 0x0255000b"
-#define THEAD_flush_A0 ".long 0x0275000b"
+#define THEAD_inval_A0 ".long 0x02a5000b"
+#define THEAD_clean_A0 ".long 0x0295000b"
+#define THEAD_flush_A0 ".long 0x02b5000b"
#define THEAD_SYNC_S ".long 0x0190000b"
#define THEAD_CMO_OP(_op, _start, _size, _cachesize) \
@@ -79,23 +79,17 @@ asm volatile("mv a0, %1\n\t" \
static void thead_errata_cache_inv(phys_addr_t paddr, size_t size)
{
- void *vaddr = phys_to_virt(paddr);
-
- THEAD_CMO_OP(inval, vaddr, size, riscv_cbom_block_size);
+ THEAD_CMO_OP(inval, paddr, size, riscv_cbom_block_size);
}
static void thead_errata_cache_wback(phys_addr_t paddr, size_t size)
{
- void *vaddr = phys_to_virt(paddr);
-
- THEAD_CMO_OP(clean, vaddr, size, riscv_cbom_block_size);
+ THEAD_CMO_OP(clean, paddr, size, riscv_cbom_block_size);
}
static void thead_errata_cache_wback_inv(phys_addr_t paddr, size_t size)
{
- void *vaddr = phys_to_virt(paddr);
-
- THEAD_CMO_OP(flush, vaddr, size, riscv_cbom_block_size);
+ THEAD_CMO_OP(flush, paddr, size, riscv_cbom_block_size);
}
static const struct riscv_nonstd_cache_ops thead_errata_cmo_ops = {
--
2.40.1
next prev parent reply other threads:[~2023-10-12 14:27 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-12 14:14 [PATCH v3 0/2] riscv: errata: thead: use riscv_nonstd_cache_ops for CMO Jisheng Zhang
2023-10-12 14:14 ` Jisheng Zhang
2023-10-12 14:14 ` [PATCH v3 1/2] " Jisheng Zhang
2023-10-12 14:14 ` Jisheng Zhang
2023-10-12 14:36 ` Conor Dooley
2023-10-12 14:36 ` Conor Dooley
2023-10-12 14:14 ` Jisheng Zhang [this message]
2023-10-12 14:14 ` [PATCH v3 2/2] riscv: errata: thead: use pa based instructions " Jisheng Zhang
2023-10-12 14:21 ` [PATCH v3 0/2] riscv: errata: thead: use riscv_nonstd_cache_ops " Jisheng Zhang
2023-10-12 14:21 ` Jisheng Zhang
2023-10-12 14:36 ` Conor Dooley
2023-10-12 14:36 ` Conor Dooley
2023-10-12 14:40 ` Jisheng Zhang
2023-10-12 14:40 ` Jisheng Zhang
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=20231012141456.4078-3-jszhang@kernel.org \
--to=jszhang@kernel.org \
--cc=aou@eecs.berkeley.edu \
--cc=guoren@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
/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.