All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@kaod.org>
To: qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Cc: "Christophe Leroy" <christophe.leroy@c-s.fr>,
	"Cédric Le Goater" <clg@kaod.org>,
	"Daniel Henrique Barboza" <danielhb413@gmail.com>,
	"Greg Kurz" <groug@kaod.org>,
	"David Gibson" <david@gibson.dropbear.id.au>
Subject: [PATCH 7/8] ppc/ppc405: Introduce a store helper for SPR_40x_PID
Date: Wed, 22 Dec 2021 07:40:24 +0100	[thread overview]
Message-ID: <20211222064025.1541490-8-clg@kaod.org> (raw)
In-Reply-To: <20211222064025.1541490-1-clg@kaod.org>

The PID SPR of the 405 CPU contains the translation ID of the TLB
which is a 8-bit field. Enforce the mask with a store helper.

Cc: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 target/ppc/spr_tcg.h   | 1 +
 target/ppc/cpu_init.c  | 2 +-
 target/ppc/translate.c | 8 ++++++++
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/target/ppc/spr_tcg.h b/target/ppc/spr_tcg.h
index 64cf5302cb86..89ff111724dc 100644
--- a/target/ppc/spr_tcg.h
+++ b/target/ppc/spr_tcg.h
@@ -89,6 +89,7 @@ void spr_write_40x_dbcr0(DisasContext *ctx, int sprn, int gprn);
 void spr_write_40x_sler(DisasContext *ctx, int sprn, int gprn);
 void spr_write_40x_tcr(DisasContext *ctx, int sprn, int gprn);
 void spr_write_40x_tsr(DisasContext *ctx, int sprn, int gprn);
+void spr_write_40x_pid(DisasContext *ctx, int sprn, int gprn);
 void spr_write_booke_tcr(DisasContext *ctx, int sprn, int gprn);
 void spr_write_booke_tsr(DisasContext *ctx, int sprn, int gprn);
 void spr_read_403_pbr(DisasContext *ctx, int gprn, int sprn);
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
index b5e2fde9ec4d..9ef9a1a5ddd5 100644
--- a/target/ppc/cpu_init.c
+++ b/target/ppc/cpu_init.c
@@ -1454,7 +1454,7 @@ static void register_405_sprs(CPUPPCState *env)
     /* MMU */
     spr_register(env, SPR_40x_PID, "PID",
                  SPR_NOACCESS, SPR_NOACCESS,
-                 &spr_read_generic, &spr_write_generic,
+                 &spr_read_generic, &spr_write_40x_pid,
                  0x00000000);
     spr_register(env, SPR_4xx_CCR0, "CCR0",
                  SPR_NOACCESS, SPR_NOACCESS,
diff --git a/target/ppc/translate.c b/target/ppc/translate.c
index eb45f679d34f..cb8ab4d67635 100644
--- a/target/ppc/translate.c
+++ b/target/ppc/translate.c
@@ -890,6 +890,14 @@ void spr_write_40x_tsr(DisasContext *ctx, int sprn, int gprn)
     gen_helper_store_40x_tsr(cpu_env, cpu_gpr[gprn]);
 }
 
+void spr_write_40x_pid(DisasContext *ctx, int sprn, int gprn)
+{
+    TCGv t0 = tcg_temp_new();
+    tcg_gen_andi_tl(t0, cpu_gpr[gprn], 0xFF);
+    gen_store_spr(SPR_40x_PID, t0);
+    tcg_temp_free(t0);
+}
+
 void spr_write_booke_tcr(DisasContext *ctx, int sprn, int gprn)
 {
     gen_icount_io_start(ctx);
-- 
2.31.1



  parent reply	other threads:[~2021-12-22  7:19 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-22  6:40 [PATCH 0/8] ppc/ppc405: Fixes Cédric Le Goater
2021-12-22  6:40 ` [PATCH 1/8] target/ppc: Print out literal exception names in logs Cédric Le Goater
2021-12-22 10:00   ` Fabiano Rosas
2021-12-23  4:25   ` David Gibson
2021-12-23 21:32   ` Richard Henderson
2021-12-22  6:40 ` [PATCH 2/8] ppc/ppc4xx: Convert printfs() Cédric Le Goater
2021-12-23  4:26   ` David Gibson
2021-12-22  6:40 ` [PATCH 3/8] ppc/ppc405: Activate MMU logs Cédric Le Goater
2021-12-23 21:34   ` Richard Henderson
2021-12-24 12:57     ` BALATON Zoltan
2021-12-24 19:57       ` Richard Henderson
2021-12-22  6:40 ` [PATCH 4/8] ppc/ppc405: Restore TCR and STR write handlers Cédric Le Goater
2021-12-23 21:36   ` Richard Henderson
2021-12-22  6:40 ` [PATCH 5/8] ppc/ppc405: Rework ppc_40x_timers_init() to use a PowerPCCPU Cédric Le Goater
2021-12-23 21:41   ` Richard Henderson
2021-12-22  6:40 ` [PATCH 6/8] ppc/ppc405: Fix timer initialization Cédric Le Goater
2021-12-23 21:43   ` Richard Henderson
2021-12-22  6:40 ` Cédric Le Goater [this message]
2021-12-23 21:44   ` [PATCH 7/8] ppc/ppc405: Introduce a store helper for SPR_40x_PID Richard Henderson
2021-12-22  6:40 ` [PATCH 8/8] ppc/ppc405: Dump specific registers Cédric Le Goater
2021-12-23 21:47   ` Richard Henderson

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=20211222064025.1541490-8-clg@kaod.org \
    --to=clg@kaod.org \
    --cc=christophe.leroy@c-s.fr \
    --cc=danielhb413@gmail.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=groug@kaod.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.