All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: peter.maydell@linaro.org, groug@kaod.org
Cc: Bin Meng <bin.meng@windriver.com>,
	qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
	David Gibson <david@gibson.dropbear.id.au>
Subject: [PULL 19/19] target/ppc: Add E500 L2CSR0 write helper
Date: Wed, 10 Feb 2021 17:17:35 +1100	[thread overview]
Message-ID: <20210210061735.304384-20-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20210210061735.304384-1-david@gibson.dropbear.id.au>

From: Bin Meng <bin.meng@windriver.com>

Per EREF 2.0 [1] chapter 3.11.2:

The following bits in L2CSR0 (exists in the e500mc/e5500/e6500 core):

- L2FI  (L2 cache flash invalidate)
- L2FL  (L2 cache flush)
- L2LFC (L2 cache lock flash clear)

when set, a cache operation is initiated by hardware, and these bits
will be cleared when the operation is complete.

Since we don't model cache in QEMU, let's add a write helper to emulate
the cache operations completing instantly.

[1] https://www.nxp.com/files-static/32bit/doc/ref_manual/EREFRM.pdf

Signed-off-by: Bin Meng <bin.meng@windriver.com>

Message-Id: <1612925152-20913-1-git-send-email-bmeng.cn@gmail.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 target/ppc/cpu.h                |  6 ++++++
 target/ppc/translate_init.c.inc | 16 ++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/target/ppc/cpu.h b/target/ppc/cpu.h
index cb00210288..e73416da68 100644
--- a/target/ppc/cpu.h
+++ b/target/ppc/cpu.h
@@ -1919,6 +1919,7 @@ typedef PowerPCCPU ArchCPU;
 #define SPR_750FX_HID2        (0x3F8)
 #define SPR_Exxx_L1FINV0      (0x3F8)
 #define SPR_L2CR              (0x3F9)
+#define SPR_Exxx_L2CSR0       (0x3F9)
 #define SPR_L3CR              (0x3FA)
 #define SPR_750_TDCH          (0x3FA)
 #define SPR_IABR2             (0x3FA)
@@ -1974,6 +1975,11 @@ typedef PowerPCCPU ArchCPU;
 #define   L1CSR1_ICFI   0x00000002  /* Instruction Cache Flash Invalidate */
 #define   L1CSR1_ICE    0x00000001  /* Instruction Cache Enable */
 
+/* E500 L2CSR0 */
+#define E500_L2CSR0_L2FI    (1 << 21)   /* L2 cache flash invalidate */
+#define E500_L2CSR0_L2FL    (1 << 11)   /* L2 cache flush */
+#define E500_L2CSR0_L2LFC   (1 << 10)   /* L2 cache lock flash clear */
+
 /* HID0 bits */
 #define HID0_DEEPNAP        (1 << 24)           /* pre-2.06 */
 #define HID0_DOZE           (1 << 23)           /* pre-2.06 */
diff --git a/target/ppc/translate_init.c.inc b/target/ppc/translate_init.c.inc
index 9867d0a6e4..3ec45cbc19 100644
--- a/target/ppc/translate_init.c.inc
+++ b/target/ppc/translate_init.c.inc
@@ -1735,6 +1735,16 @@ static void spr_write_e500_l1csr1(DisasContext *ctx, int sprn, int gprn)
     tcg_temp_free(t0);
 }
 
+static void spr_write_e500_l2csr0(DisasContext *ctx, int sprn, int gprn)
+{
+    TCGv t0 = tcg_temp_new();
+
+    tcg_gen_andi_tl(t0, cpu_gpr[gprn],
+                    ~(E500_L2CSR0_L2FI | E500_L2CSR0_L2FL | E500_L2CSR0_L2LFC));
+    gen_store_spr(sprn, t0);
+    tcg_temp_free(t0);
+}
+
 static void spr_write_booke206_mmucsr0(DisasContext *ctx, int sprn, int gprn)
 {
     gen_helper_booke206_tlbflush(cpu_env, cpu_gpr[gprn]);
@@ -5029,6 +5039,12 @@ static void init_proc_e500(CPUPPCState *env, int version)
                  SPR_NOACCESS, SPR_NOACCESS,
                  &spr_read_generic, &spr_write_e500_l1csr1,
                  0x00000000);
+    if (version != fsl_e500v1 && version != fsl_e500v2) {
+        spr_register(env, SPR_Exxx_L2CSR0, "L2CSR0",
+                     SPR_NOACCESS, SPR_NOACCESS,
+                     &spr_read_generic, &spr_write_e500_l2csr0,
+                     0x00000000);
+    }
     spr_register(env, SPR_BOOKE_MCSRR0, "MCSRR0",
                  SPR_NOACCESS, SPR_NOACCESS,
                  &spr_read_generic, &spr_write_generic,
-- 
2.29.2



  parent reply	other threads:[~2021-02-10  6:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-10  6:17 [PULL 00/19] ppc-for-6.0 queue 20210210 David Gibson
2021-02-10  6:17 ` [PULL 01/19] spapr.c: use g_auto* with 'nodename' in CPU DT functions David Gibson
2021-02-10  6:17 ` [PULL 02/19] spapr.c: add 'name' property for hotplugged CPUs nodes David Gibson
2021-02-10  6:17 ` [PULL 03/19] spapr: Adjust firmware path of PCI devices David Gibson
2021-02-10  6:17 ` [PULL 04/19] target/ppc: Remove unused MMU definitions David Gibson
2021-02-10  6:17 ` [PULL 05/19] ppc/pnv: Add trace events for PCI event notification David Gibson
2021-02-10  6:17 ` [PULL 06/19] ppc/xive: Add firmware bit when dumping the ENDs David Gibson
2021-02-10  6:17 ` [PULL 07/19] ppc/pnv: Use skiboot addresses to load kernel and ramfs David Gibson
2021-02-10  6:17 ` [PULL 08/19] ppc/pnv: Simplify pnv_bmc_create() David Gibson
2021-02-10  6:17 ` [PULL 09/19] ppc/pnv: Discard internal BMC initialization when BMC is external David Gibson
2021-02-10  6:17 ` [PULL 10/19] ppc/pnv: Remove default disablement of the PNOR contents David Gibson
2021-02-10  6:17 ` [PULL 11/19] ppc/pnv: Introduce a LPC FW memory region attribute to map the PNOR David Gibson
2021-02-10  6:17 ` [PULL 12/19] spapr: move spapr_machine_using_legacy_numa() to spapr_numa.c David Gibson
2021-02-10  6:17 ` [PULL 13/19] spapr_numa.c: create spapr_numa_initial_nvgpu_numa_id() helper David Gibson
2021-02-10  6:17 ` [PULL 14/19] spapr_numa.c: fix ibm, max-associativity-domains calculation David Gibson
2021-02-10  6:17 ` [PULL 15/19] ppc/pnv: Set default RAM size to 1 GB David Gibson
2021-02-10  6:17 ` [PULL 16/19] hw/ppc: e500: Use a macro for the platform clock frequency David Gibson
2021-02-10  6:17 ` [PULL 17/19] hw/ppc: e500: Fill in correct <clock-frequency> for the serial nodes David Gibson
2021-02-10  6:17 ` [PULL 18/19] hw/net: fsl_etsec: Reverse the RCTRL.RSF logic David Gibson
2021-02-10  6:17 ` David Gibson [this message]
2021-02-10 15:42 ` [PULL 00/19] ppc-for-6.0 queue 20210210 Peter Maydell

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=20210210061735.304384-20-david@gibson.dropbear.id.au \
    --to=david@gibson.dropbear.id.au \
    --cc=bin.meng@windriver.com \
    --cc=groug@kaod.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.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.