qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] ppcmas_tlb_check: Fix effective address comparison
@ 2012-05-07 16:41 Fabien Chouteau
  2012-05-07 16:43 ` Alexander Graf
  0 siblings, 1 reply; 3+ messages in thread
From: Fabien Chouteau @ 2012-05-07 16:41 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-ppc, agraf

Use size mask in both operands of effective address comparison.
This is the expected as the size of EPN field in MAS2 depends on page
size.

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/helper.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target-ppc/helper.c b/target-ppc/helper.c
index e97e496..adb96a0 100644
--- a/target-ppc/helper.c
+++ b/target-ppc/helper.c
@@ -1320,7 +1320,7 @@ int ppcmas_tlb_check(CPUPPCState *env, ppcmas_tlb_t *tlb,
     }
 
     /* Check effective address */
-    if ((address & mask) != (tlb->mas2 & MAS2_EPN_MASK)) {
+    if ((address & mask) != (tlb->mas2 & MAS2_EPN_MASK & mask)) {
         return -1;
     }
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] ppcmas_tlb_check: Fix effective address comparison
  2012-05-07 16:41 [Qemu-devel] [PATCH] ppcmas_tlb_check: Fix effective address comparison Fabien Chouteau
@ 2012-05-07 16:43 ` Alexander Graf
  2012-05-07 16:45   ` Fabien Chouteau
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Graf @ 2012-05-07 16:43 UTC (permalink / raw)
  To: Fabien Chouteau; +Cc: qemu-ppc, qemu-devel


On 07.05.2012, at 18:41, Fabien Chouteau wrote:

> Use size mask in both operands of effective address comparison.
> This is the expected as the size of EPN field in MAS2 depends on page
> size.
> 
> 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.

Would it make sense to do this at tlbwe time? That path is a bit less hot that the tlb check :).


Alex

> 
> Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
> ---
> target-ppc/helper.c |    2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target-ppc/helper.c b/target-ppc/helper.c
> index e97e496..adb96a0 100644
> --- a/target-ppc/helper.c
> +++ b/target-ppc/helper.c
> @@ -1320,7 +1320,7 @@ int ppcmas_tlb_check(CPUPPCState *env, ppcmas_tlb_t *tlb,
>     }
> 
>     /* Check effective address */
> -    if ((address & mask) != (tlb->mas2 & MAS2_EPN_MASK)) {
> +    if ((address & mask) != (tlb->mas2 & MAS2_EPN_MASK & mask)) {
>         return -1;
>     }
> 
> -- 
> 1.7.9.5
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] ppcmas_tlb_check: Fix effective address comparison
  2012-05-07 16:43 ` Alexander Graf
@ 2012-05-07 16:45   ` Fabien Chouteau
  0 siblings, 0 replies; 3+ messages in thread
From: Fabien Chouteau @ 2012-05-07 16:45 UTC (permalink / raw)
  To: Alexander Graf; +Cc: qemu-ppc, qemu-devel

On 05/07/2012 06:43 PM, Alexander Graf wrote:
> 
> On 07.05.2012, at 18:41, Fabien Chouteau wrote:
> 
>> Use size mask in both operands of effective address comparison.
>> This is the expected as the size of EPN field in MAS2 depends on page
>> size.
>>
>> 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.
> 
> Would it make sense to do this at tlbwe time? That path is a bit less hot that the tlb check :).

Why not, I'll check that tomorrow.

Thanks,


-- 
Fabien Chouteau

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-05-07 16:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-07 16:41 [Qemu-devel] [PATCH] ppcmas_tlb_check: Fix effective address comparison Fabien Chouteau
2012-05-07 16:43 ` Alexander Graf
2012-05-07 16:45   ` Fabien Chouteau

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).