Patchwork [2/9] target-ppc: Handle memory-forced I/O controller access

login
register
mail settings
Submitter Alexander Graf
Date June 17, 2011, 2:43 p.m.
Message ID <1308321844-11699-3-git-send-email-agraf@suse.de>
Download mbox | patch
Permalink /patch/100819/
State New
Headers show

Comments

Alexander Graf - June 17, 2011, 2:43 p.m.
From: Hervé Poussineau <hpoussin@reactos.org>

On at least the PowerPC 601, a direct-store (T=1) with bus unit ID 0x07F
is special-cased as memory-forced I/O controller access. It is supposed
to be checked immediately if T=1, bypassing all protection mechanisms
and acting cache-inhibited and global.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>

Simplified by avoiding reindentation. Added explanatory comments.

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
 target-ppc/helper.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
Andreas Färber - June 17, 2011, 7:34 p.m.
Am 17.06.2011 um 16:43 schrieb Alexander Graf:

> From: Hervé Poussineau <hpoussin@reactos.org>
>
> On at least the PowerPC 601, a direct-store (T=1) with bus unit ID  
> 0x07F
> is special-cased as memory-forced I/O controller access. It is  
> supposed
> to be checked immediately if T=1, bypassing all protection mechanisms
> and acting cache-inhibited and global.
>
> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
>
> Simplified by avoiding reindentation. Added explanatory comments.
>
> Cc: Alexander Graf <agraf@suse.de>
> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
> Signed-off-by: Alexander Graf <agraf@suse.de>

Feel free to remove the Cc: after adding a corresponding Sob or  
similar line.
Alexander Graf - June 17, 2011, 10:59 p.m.
On 17.06.2011, at 21:34, Andreas Färber wrote:

> Am 17.06.2011 um 16:43 schrieb Alexander Graf:
> 
>> From: Hervé Poussineau <hpoussin@reactos.org>
>> 
>> On at least the PowerPC 601, a direct-store (T=1) with bus unit ID 0x07F
>> is special-cased as memory-forced I/O controller access. It is supposed
>> to be checked immediately if T=1, bypassing all protection mechanisms
>> and acting cache-inhibited and global.
>> 
>> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
>> 
>> Simplified by avoiding reindentation. Added explanatory comments.
>> 
>> Cc: Alexander Graf <agraf@suse.de>
>> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
>> Signed-off-by: Alexander Graf <agraf@suse.de>
> 
> Feel free to remove the Cc: after adding a corresponding Sob or similar line.

Hrm - I usually just use git am -s for the sob line. If you find the CC irritating, please just pass it to git send-email --cc and omit it from the patch. It's more or less unuseful information anyways :)


Alex
Andreas Färber - June 18, 2011, 11:15 a.m.
Am 18.06.2011 um 00:59 schrieb Alexander Graf:

> On 17.06.2011, at 21:34, Andreas Färber wrote:
>
>> Am 17.06.2011 um 16:43 schrieb Alexander Graf:
>>
>>> From: Hervé Poussineau <hpoussin@reactos.org>
>>>
>>> On at least the PowerPC 601, a direct-store (T=1) with bus unit ID  
>>> 0x07F
>>> is special-cased as memory-forced I/O controller access. It is  
>>> supposed
>>> to be checked immediately if T=1, bypassing all protection  
>>> mechanisms
>>> and acting cache-inhibited and global.
>>>
>>> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
>>>
>>> Simplified by avoiding reindentation. Added explanatory comments.
>>>
>>> Cc: Alexander Graf <agraf@suse.de>
>>> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
>>> Signed-off-by: Alexander Graf <agraf@suse.de>
>>
>> Feel free to remove the Cc: after adding a corresponding Sob or  
>> similar line.
>
> Hrm - I usually just use git am -s for the sob line. If you find the  
> CC irritating, please just pass it to git send-email --cc and omit  
> it from the patch. It's more or less unuseful information anyways :)

Ah, didn't know that option. I always used git am, followed by git  
commit --amend -s, at which point one can edit the commit message.

--cc becomes unhandy in a series of ~35, when not all patches concern  
everyone and to avoid forgetting CCs.

Andreas
Alexander Graf - June 18, 2011, 11:19 a.m.
On 18.06.2011, at 13:15, Andreas Färber wrote:

> Am 18.06.2011 um 00:59 schrieb Alexander Graf:
> 
>> On 17.06.2011, at 21:34, Andreas Färber wrote:
>> 
>>> Am 17.06.2011 um 16:43 schrieb Alexander Graf:
>>> 
>>>> From: Hervé Poussineau <hpoussin@reactos.org>
>>>> 
>>>> On at least the PowerPC 601, a direct-store (T=1) with bus unit ID 0x07F
>>>> is special-cased as memory-forced I/O controller access. It is supposed
>>>> to be checked immediately if T=1, bypassing all protection mechanisms
>>>> and acting cache-inhibited and global.
>>>> 
>>>> Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
>>>> 
>>>> Simplified by avoiding reindentation. Added explanatory comments.
>>>> 
>>>> Cc: Alexander Graf <agraf@suse.de>
>>>> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
>>>> Signed-off-by: Alexander Graf <agraf@suse.de>
>>> 
>>> Feel free to remove the Cc: after adding a corresponding Sob or similar line.
>> 
>> Hrm - I usually just use git am -s for the sob line. If you find the CC irritating, please just pass it to git send-email --cc and omit it from the patch. It's more or less unuseful information anyways :)
> 
> Ah, didn't know that option. I always used git am, followed by git commit --amend -s, at which point one can edit the commit message.

I see - that's pretty annoying when it comes to applying patch sets though, no? :)

> --cc becomes unhandy in a series of ~35, when not all patches concern everyone and to avoid forgetting CCs.

That's where taste differs :). Avi usually even drops the automatic CCs and manually adds --cc for the whole patch set to people it concerns. I somewhat sympathize with this approach. Who wants patch 16/35 when he doesn't get all the others, especially not 00/35? I certainly prefer to get the full set in my inbox instead of just the patches that relate explicitly to me.


Alex

Patch

diff --git a/target-ppc/helper.c b/target-ppc/helper.c
index cf2a368..2944b06 100644
--- a/target-ppc/helper.c
+++ b/target-ppc/helper.c
@@ -949,8 +949,24 @@  static inline int get_segment(CPUState *env, mmu_ctx_t *ctx,
             ret = -3;
         }
     } else {
+        target_ulong sr;
         LOG_MMU("direct store...\n");
         /* Direct-store segment : absolutely *BUGGY* for now */
+
+        /* Direct-store implies a 32-bit MMU.
+         * Check the Segment Register's bus unit ID (BUID).
+         */
+        sr = env->sr[eaddr >> 28];
+        if ((sr & 0x1FF00000) >> 20 == 0x07f) {
+            /* Memory-forced I/O controller interface access */
+            /* If T=1 and BUID=x'07F', the 601 performs a memory access
+             * to SR[28-31] LA[4-31], bypassing all protection mechanisms.
+             */
+            ctx->raddr = ((sr & 0xF) << 28) | (eaddr & 0x0FFFFFFF);
+            ctx->prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC;
+            return 0;
+        }
+
         switch (type) {
         case ACCESS_INT:
             /* Integer load/store : only access allowed */