public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Dhaval Sharma" <dhaval@rivosinc.com>
To: devel@edk2.groups.io
Subject: [edk2-devel] [PATCH v1 1/1] UefiCpuPkg: Add cache operations support for Arch proto
Date: Mon, 29 Jan 2024 09:31:16 +0530	[thread overview]
Message-ID: <20240129040116.296175-2-dhaval@rivosinc.com> (raw)
In-Reply-To: <20240129040116.296175-1-dhaval@rivosinc.com>

With CMO operations available for RISC-V, utilize them in CPU
Architecture protocol.

Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com>
Gerd Hoffmann <kraxel@redhat.com>
Laszlo Ersek <lersek@redhat.com>
Rahul Kumar <rahul1.kumar@intel.com>
Ray Ni <ray.ni@intel.com>
Sunil VL <sunilvl@ventanamicro.com>
Andrei Warkentin <andrei.warkentin@intel.com>
devel@edk2.groups.io
---
 UefiCpuPkg/CpuDxeRiscV64/CpuDxe.h |  1 +
 UefiCpuPkg/CpuDxeRiscV64/CpuDxe.c | 14 ++++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/UefiCpuPkg/CpuDxeRiscV64/CpuDxe.h b/UefiCpuPkg/CpuDxeRiscV64/CpuDxe.h
index 68e6d038b66e..d4d67778eb1c 100644
--- a/UefiCpuPkg/CpuDxeRiscV64/CpuDxe.h
+++ b/UefiCpuPkg/CpuDxeRiscV64/CpuDxe.h
@@ -17,6 +17,7 @@
 #include <Library/BaseRiscVSbiLib.h>
 #include <Library/BaseRiscVMmuLib.h>
 #include <Library/BaseLib.h>
+#include <Library/CacheMaintenanceLib.h>
 #include <Library/CpuExceptionHandlerLib.h>
 #include <Library/DebugLib.h>
 #include <Library/UefiBootServicesTableLib.h>
diff --git a/UefiCpuPkg/CpuDxeRiscV64/CpuDxe.c b/UefiCpuPkg/CpuDxeRiscV64/CpuDxe.c
index 2af3b6223450..c6bae100a9e4 100644
--- a/UefiCpuPkg/CpuDxeRiscV64/CpuDxe.c
+++ b/UefiCpuPkg/CpuDxeRiscV64/CpuDxe.c
@@ -90,6 +90,20 @@ CpuFlushCpuDataCache (
   IN EFI_CPU_FLUSH_TYPE     FlushType
   )
 {
+  switch (FlushType) {
+    case EfiCpuFlushTypeWriteBack:
+      WriteBackDataCacheRange ((VOID *)(UINTN)Start, (UINTN)Length);
+      break;
+    case EfiCpuFlushTypeInvalidate:
+      InvalidateDataCacheRange ((VOID *)(UINTN)Start, (UINTN)Length);
+      break;
+    case EfiCpuFlushTypeWriteBackInvalidate:
+      WriteBackInvalidateDataCacheRange ((VOID *)(UINTN)Start, (UINTN)Length);
+      break;
+    default:
+      return EFI_INVALID_PARAMETER;
+  }
+
   return EFI_SUCCESS;
 }
 
-- 
2.39.2



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114673): https://edk2.groups.io/g/devel/message/114673
Mute This Topic: https://groups.io/mt/104025802/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  reply	other threads:[~2024-01-29  4:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-29  4:01 [edk2-devel] [PATCH v1 0/1] Add cache operations support for CPU Arch proto Dhaval Sharma
2024-01-29  4:01 ` Dhaval Sharma [this message]
2024-01-30  5:52   ` [edk2-devel] [PATCH v1 1/1] UefiCpuPkg: Add cache operations support for " Sunil V L

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-list 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=20240129040116.296175-2-dhaval@rivosinc.com \
    --to=devel@edk2.groups.io \
    /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