From: Alexander Graf <agraf@suse.de>
To: qemu-ppc@nongnu.org
Cc: Scott Wood <scottwood@freescale.com>,
qemu-devel Developers <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [PATCH 6/8] PPC: booke: add tlbnps handling
Date: Sat, 21 Jan 2012 05:15:28 +0100 [thread overview]
Message-ID: <1327119330-29304-7-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1327119330-29304-1-git-send-email-agraf@suse.de>
When using MAV 2.0 TLB registers, we have another range of TLB registers
available to read the supported page sizes from.
Add SPR definitions for those and add a helper function that we can use
to receive such a bitmap even when using MAV 1.0.
Signed-off-by: Alexander Graf <agraf@suse.de>
---
target-ppc/cpu.h | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/target-ppc/cpu.h b/target-ppc/cpu.h
index 6f4cdde..1026254 100644
--- a/target-ppc/cpu.h
+++ b/target-ppc/cpu.h
@@ -1355,6 +1355,10 @@ static inline void cpu_clone_regs(CPUState *env, target_ulong newsp)
#define SPR_BOOKE_DVC2 (0x13F)
#define SPR_BOOKE_TSR (0x150)
#define SPR_BOOKE_TCR (0x154)
+#define SPR_BOOKE_TLB0PS (0x158)
+#define SPR_BOOKE_TLB1PS (0x159)
+#define SPR_BOOKE_TLB2PS (0x15A)
+#define SPR_BOOKE_TLB3PS (0x15B)
#define SPR_BOOKE_IVOR0 (0x190)
#define SPR_BOOKE_IVOR1 (0x191)
#define SPR_BOOKE_IVOR2 (0x192)
@@ -2116,6 +2120,27 @@ static inline ppcmas_tlb_t *booke206_get_tlbm(CPUState *env, const int tlbn,
return &env->tlb.tlbm[r];
}
+/* returns bitmap of supported page sizes for a given TLB */
+static inline uint32_t booke206_tlbnps(CPUState *env, const int tlbn)
+{
+ bool mav2 = false;
+ uint32_t ret = 0;
+
+ if (mav2) {
+ ret = env->spr[SPR_BOOKE_TLB0PS + tlbn];
+ } else {
+ uint32_t tlbncfg = env->spr[SPR_BOOKE_TLB0CFG + tlbn];
+ uint32_t min = (tlbncfg & TLBnCFG_MINSIZE) >> TLBnCFG_MINSIZE_SHIFT;
+ uint32_t max = (tlbncfg & TLBnCFG_MAXSIZE) >> TLBnCFG_MAXSIZE_SHIFT;
+ int i;
+ for (i = min; i <= max; i++) {
+ ret |= (1 << (i << 1));
+ }
+ }
+
+ return ret;
+}
+
#endif
extern void (*cpu_ppc_hypercall)(CPUState *);
--
1.6.0.2
next prev parent reply other threads:[~2012-01-21 4:15 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-21 4:15 [Qemu-devel] [PATCH 0/8] Make -cpu e500mc useful in TCG v2 Alexander Graf
2012-01-21 4:15 ` [Qemu-devel] [PATCH 1/8] PPC: Add IVOR 38-42 Alexander Graf
2012-01-21 4:15 ` [Qemu-devel] [PATCH 2/8] PPC: e500mc: add missing IVORs to bitmap Alexander Graf
2012-01-21 4:15 ` [Qemu-devel] [PATCH 3/8] PPC: e500: msync is 440 only, e500 has real sync Alexander Graf
2012-01-21 4:15 ` [Qemu-devel] [PATCH 4/8] PPC: rename msync to msync_4xx Alexander Graf
2012-01-21 4:15 ` [Qemu-devel] [PATCH 5/8] PPC: booke206: allow NULL raddr in ppcmas_tlb_check Alexander Graf
2012-01-21 4:15 ` Alexander Graf [this message]
2012-01-23 17:29 ` [Qemu-devel] [PATCH 6/8] PPC: booke: add tlbnps handling Scott Wood
2012-01-23 17:33 ` Alexander Graf
2012-01-21 4:15 ` [Qemu-devel] [PATCH 7/8] PPC: booke206: Check for min/max TLB entry size Alexander Graf
2012-01-23 17:32 ` Scott Wood
2012-01-23 17:33 ` Alexander Graf
2012-01-23 18:19 ` Scott Wood
2012-01-23 18:41 ` Alexander Graf
2012-01-23 18:49 ` Scott Wood
2012-01-23 20:03 ` Alexander Graf
2012-01-23 20:10 ` Scott Wood
2012-01-23 21:29 ` Alexander Graf
2012-01-23 21:41 ` Scott Wood
2012-01-21 4:15 ` [Qemu-devel] [PATCH 8/8] PPC: booke206: Implement tlbilx Alexander Graf
2012-01-21 20:04 ` Blue Swirl
2012-01-23 16:49 ` [Qemu-devel] [PATCH] " Alexander Graf
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=1327119330-29304-7-git-send-email-agraf@suse.de \
--to=agraf@suse.de \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=scottwood@freescale.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;
as well as URLs for NNTP newsgroup(s).