U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mayuresh Chitale <mchitale@ventanamicro.com>
To: u-boot@lists.denx.de
Cc: "Mayuresh Chitale" <mchitale@ventanamicro.com>,
	"Bin Meng" <bmeng.cn@gmail.com>, "Tom Rini" <trini@konsulko.com>,
	"Łukasz Stelmach" <l.stelmach@samsung.com>,
	"Leo Yu-Chi Liang" <ycliang@andestech.com>
Subject: [PATCH v1 3/3] board: qemu-riscv: Override enable_caches
Date: Tue, 20 Aug 2024 09:37:52 +0000	[thread overview]
Message-ID: <20240820093800.5436-4-mchitale@ventanamicro.com> (raw)
In-Reply-To: <20240820093800.5436-1-mchitale@ventanamicro.com>

Define enable_caches function for the qemu-riscv board which probes for
the cbom-block-size dt property when RISCV_ISA_ZICBOM is enabled. Also
add flush_dcache_range and invalidate_dcache_range functions which use
the corresponding CBO ops.

Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
---
 board/emulation/qemu-riscv/qemu-riscv.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/board/emulation/qemu-riscv/qemu-riscv.c b/board/emulation/qemu-riscv/qemu-riscv.c
index e5193e31e3..1795d2f831 100644
--- a/board/emulation/qemu-riscv/qemu-riscv.c
+++ b/board/emulation/qemu-riscv/qemu-riscv.c
@@ -14,6 +14,7 @@
 #include <usb.h>
 #include <virtio_types.h>
 #include <virtio.h>
+#include <asm/cache.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -70,3 +71,18 @@ void *board_fdt_blob_setup(int *err)
 	/* Stored the DTB address there during our init */
 	return (void *)(ulong)gd->arch.firmware_fdt_addr;
 }
+
+void enable_caches(void)
+{
+	riscv_zicbom_init();
+}
+
+void flush_dcache_range(unsigned long start, unsigned long end)
+{
+	cbo_flush(start, end);
+}
+
+void invalidate_dcache_range(unsigned long start, unsigned long end)
+{
+	cbo_inval(start, end);
+}
-- 
2.34.1


  parent reply	other threads:[~2024-08-20  9:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-20  9:37 [PATCH v1 0/3] Risc-V cache operations Mayuresh Chitale
2024-08-20  9:37 ` [PATCH v1 1/3] riscv: Add support for defining instructions Mayuresh Chitale
2024-08-20  9:37 ` [PATCH v1 2/3] riscv: cache: Add CBO instructions Mayuresh Chitale
2024-08-20 12:14   ` Heinrich Schuchardt
2024-08-21  9:11     ` Mayuresh Chitale
2024-08-21  9:57     ` Conor Dooley
2024-08-21 10:03       ` Conor.Dooley
2024-08-21 16:04         ` Mayuresh Chitale
2024-08-21 15:57       ` Mayuresh Chitale
2024-08-21 16:09         ` Conor Dooley
2024-08-20  9:37 ` Mayuresh Chitale [this message]
2024-08-20 12:12   ` [PATCH v1 3/3] board: qemu-riscv: Override enable_caches Heinrich Schuchardt
2024-08-21  9:11     ` Mayuresh Chitale
2024-08-21  9:21       ` Heinrich Schuchardt

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=20240820093800.5436-4-mchitale@ventanamicro.com \
    --to=mchitale@ventanamicro.com \
    --cc=bmeng.cn@gmail.com \
    --cc=l.stelmach@samsung.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=ycliang@andestech.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox