From: Fabien Chouteau <chouteau@adacore.com>
To: qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, agraf@suse.de
Subject: Re: [Qemu-devel] [PATCH] booke_206_tlbwe: Discard invalid bits in MAS2
Date: Tue, 15 May 2012 11:49:26 +0200 [thread overview]
Message-ID: <4FB226A6.6080008@adacore.com> (raw)
In-Reply-To: <1336570134-25343-1-git-send-email-chouteau@adacore.com>
Any comment?
On 05/09/2012 03:28 PM, Fabien Chouteau wrote:
> The size of EPN field in MAS2 depends on page size. This patch adds a
> mask to discard invalid bits in EPN field.
>
> Definition of EPN field from e500v2 RM:
> EPN Effective page number: Depending on page size, only the bits
> associated with a page boundary are valid. Bits that represent offsets
> within a page are ignored and should be cleared.
>
> There is a similar (but more complicated) definition in PowerISA V2.06.
>
> Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
> ---
> target-ppc/op_helper.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/target-ppc/op_helper.c b/target-ppc/op_helper.c
> index 4ef2332..6bc64ad 100644
> --- a/target-ppc/op_helper.c
> +++ b/target-ppc/op_helper.c
> @@ -4227,6 +4227,8 @@ void helper_booke206_tlbwe(void)
> uint32_t tlbncfg, tlbn;
> ppcmas_tlb_t *tlb;
> uint32_t size_tlb, size_ps;
> + target_ulong mask;
> +
>
> switch (env->spr[SPR_BOOKE_MAS0] & MAS0_WQ_MASK) {
> case MAS0_WQ_ALWAYS:
> @@ -4289,8 +4291,12 @@ void helper_booke206_tlbwe(void)
> tlb->mas1 |= (tlbncfg & TLBnCFG_MINSIZE) >> 12;
> }
>
> - /* XXX needs to change when supporting 64-bit e500 */
> - tlb->mas2 = env->spr[SPR_BOOKE_MAS2] & 0xffffffff;
> + /* Make a mask from TLB size to discard invalid bits in EPN field */
> + mask = ~(booke206_tlb_to_page_size(env, tlb) - 1);
> + /* Add a mask for page attributes */
> + mask |= MAS2_ACM | MAS2_VLE | MAS2_W | MAS2_I | MAS2_M | MAS2_G | MAS2_E;
> +
> + tlb->mas2 = env->spr[SPR_BOOKE_MAS2] & mask;
>
> if (!(tlbncfg & TLBnCFG_IPROT)) {
> /* no IPROT supported by TLB */
--
Fabien Chouteau
next prev parent reply other threads:[~2012-05-15 9:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-09 13:28 [Qemu-devel] [PATCH] booke_206_tlbwe: Discard invalid bits in MAS2 Fabien Chouteau
2012-05-15 9:49 ` Fabien Chouteau [this message]
2012-05-20 10:15 ` Alexander Graf
2012-05-20 10:18 ` [Qemu-devel] [Qemu-ppc] " Alexander Graf
2012-05-21 8:56 ` Fabien Chouteau
2012-05-21 9:08 ` Alexander Graf
2012-05-21 10:59 ` Fabien Chouteau
2012-05-21 11:11 ` Alexander Graf
2012-05-21 13:47 ` Fabien Chouteau
2012-05-21 13:57 ` Alexander Graf
2012-05-21 14:24 ` Fabien Chouteau
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=4FB226A6.6080008@adacore.com \
--to=chouteau@adacore.com \
--cc=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).