From: Alexander Graf <agraf@suse.de>
To: qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org
Subject: [Qemu-devel] [PATCH 05/10] PPC: Properly emulate L1CSR0 and L1CSR1
Date: Mon, 20 Jan 2014 00:44:32 +0100 [thread overview]
Message-ID: <1390175077-5717-6-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1390175077-5717-1-git-send-email-agraf@suse.de>
There are 2 L1 cache control registers - one for data (L1CSR0) and
one for instructions (L1CSR1).
Emulate both of them well enough to give the guest the illusion that
it could actually do anything about its caches.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
target-ppc/cpu.h | 12 ++++++++++++
target-ppc/translate_init.c | 14 +++++++++++---
2 files changed, 23 insertions(+), 3 deletions(-)
diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h
index 15abad4..30b328d 100644
--- a/target-ppc/cpu.h
+++ b/target-ppc/cpu.h
@@ -1708,6 +1708,18 @@ static inline int cpu_mmu_index (CPUPPCState *env)
/* External Input Interrupt Directed to Guest State */
#define EPCR_EXTGS (1 << 31)
+#define L1CSR0_CPE 0x00010000 /* Data Cache Parity Enable */
+#define L1CSR0_CUL 0x00000400 /* (D-)Cache Unable to Lock */
+#define L1CSR0_DCLFR 0x00000100 /* D-Cache Lock Flash Reset */
+#define L1CSR0_DCFI 0x00000002 /* Data Cache Flash Invalidate */
+#define L1CSR0_DCE 0x00000001 /* Data Cache Enable */
+
+#define L1CSR1_CPE 0x00010000 /* Instruction Cache Parity Enable */
+#define L1CSR1_ICUL 0x00000400 /* I-Cache Unable to Lock */
+#define L1CSR1_ICLFR 0x00000100 /* I-Cache Lock Flash Reset */
+#define L1CSR1_ICFI 0x00000002 /* Instruction Cache Flash Invalidate */
+#define L1CSR1_ICE 0x00000001 /* Instruction Cache Enable */
+
/*****************************************************************************/
/* PowerPC Instructions types definitions */
enum {
diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 403ce7a..7322116 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -1448,7 +1448,16 @@ static void spr_write_e500_l1csr0 (void *opaque, int sprn, int gprn)
{
TCGv t0 = tcg_temp_new();
- tcg_gen_andi_tl(t0, cpu_gpr[gprn], ~256);
+ tcg_gen_andi_tl(t0, cpu_gpr[gprn], L1CSR0_DCE | L1CSR0_CPE);
+ gen_store_spr(sprn, t0);
+ tcg_temp_free(t0);
+}
+
+static void spr_write_e500_l1csr1(void *opaque, int sprn, int gprn)
+{
+ TCGv t0 = tcg_temp_new();
+
+ tcg_gen_andi_tl(t0, cpu_gpr[gprn], L1CSR1_ICE | L1CSR1_CPE);
gen_store_spr(sprn, t0);
tcg_temp_free(t0);
}
@@ -4566,10 +4575,9 @@ static void init_proc_e500 (CPUPPCState *env, int version)
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_e500_l1csr0,
0x00000000);
- /* XXX : not implemented */
spr_register(env, SPR_Exxx_L1CSR1, "L1CSR1",
SPR_NOACCESS, SPR_NOACCESS,
- &spr_read_generic, &spr_write_generic,
+ &spr_read_generic, &spr_write_e500_l1csr1,
0x00000000);
spr_register(env, SPR_BOOKE_MCSRR0, "MCSRR0",
SPR_NOACCESS, SPR_NOACCESS,
--
1.8.1.4
next prev parent reply other threads:[~2014-01-19 23:44 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-19 23:44 [Qemu-devel] [PATCH 00/10] PPC: e500: Use u-boot as firmware Alexander Graf
2014-01-19 23:44 ` [Qemu-devel] [PATCH 01/10] PPC: Make all e500 CPUs SVR aware Alexander Graf
2014-01-19 23:44 ` [Qemu-devel] [PATCH 02/10] PPC: Add definitions for GIVORs Alexander Graf
2014-01-19 23:44 ` [Qemu-devel] [PATCH 03/10] PPC: Add stub emulation for HDBCR0 Alexander Graf
2014-01-19 23:44 ` [Qemu-devel] [PATCH 04/10] PPC: Add L1CFG1 SPR emulation Alexander Graf
2014-01-23 0:15 ` [Qemu-devel] [Qemu-ppc] " Scott Wood
2014-01-19 23:44 ` Alexander Graf [this message]
2014-01-19 23:44 ` [Qemu-devel] [PATCH 06/10] PPC: Add dcbtls emulation Alexander Graf
2014-01-19 23:44 ` [Qemu-devel] [PATCH 07/10] PPC: guts: Add emulation of a few more registers Alexander Graf
2014-01-23 0:08 ` [Qemu-devel] [Qemu-ppc] " Scott Wood
2014-01-23 11:34 ` Alexander Graf
2014-01-23 21:22 ` Scott Wood
2014-01-19 23:44 ` [Qemu-devel] [PATCH 08/10] PPC: e500: Expose kernel load address in dt Alexander Graf
2014-01-19 23:44 ` [Qemu-devel] [PATCH 09/10] PPC: Add u-boot firmware for e500 Alexander Graf
2014-01-20 0:17 ` Peter Maydell
2014-01-20 10:04 ` Alexander Graf
2014-01-23 0:13 ` Scott Wood
2014-01-19 23:44 ` [Qemu-devel] [PATCH 10/10] PPC: e500: Move to u-boot as firmware Alexander Graf
2014-01-23 0:23 ` Scott Wood
2014-01-23 10:40 ` Alexander Graf
2014-01-23 22:22 ` Scott Wood
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=1390175077-5717-6-git-send-email-agraf@suse.de \
--to=agraf@suse.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).