All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] target-arm: implement arm_debug_target_el()
@ 2015-09-14 10:53 Sergey Fedorov
  2015-09-18 14:08 ` Peter Maydell
  0 siblings, 1 reply; 8+ messages in thread
From: Sergey Fedorov @ 2015-09-14 10:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: Sergey Fedorov, Peter Maydell

Implement debug exception routing according to ARM ARM D2.3.1 Pseudocode
description of routing debug exceptions.

Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
---
 target-arm/cpu.h | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/target-arm/cpu.h b/target-arm/cpu.h
index 31825d3..84d38b1 100644
--- a/target-arm/cpu.h
+++ b/target-arm/cpu.h
@@ -1692,7 +1692,22 @@ static inline int cpu_mmu_index(CPUARMState *env)
  */
 static inline int arm_debug_target_el(CPUARMState *env)
 {
-    return 1;
+    bool secure = arm_is_secure(env);
+    bool route_to_el2 = false;
+
+    if (arm_feature(env, ARM_FEATURE_EL2) && !secure) {
+        route_to_el2 = env->cp15.hcr_el2 & HCR_TGE ||
+                       env->cp15.mdcr_el2 & (1 << 8);
+    }
+
+    if (route_to_el2) {
+        return 2;
+    } else if (arm_feature(env, ARM_FEATURE_EL3) &&
+               !arm_el_is_aa64(env, 3) && secure) {
+        return 3;
+    } else {
+        return 1;
+    }
 }
 
 static inline bool aa64_generate_debug_exceptions(CPUARMState *env)
-- 
1.9.1

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

* Re: [Qemu-devel] [PATCH] target-arm: implement arm_debug_target_el()
  2015-09-14 10:53 [Qemu-devel] [PATCH] target-arm: implement arm_debug_target_el() Sergey Fedorov
@ 2015-09-18 14:08 ` Peter Maydell
  2015-09-18 14:11   ` Peter Maydell
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Maydell @ 2015-09-18 14:08 UTC (permalink / raw)
  To: Sergey Fedorov; +Cc: QEMU Developers

On 14 September 2015 at 11:53, Sergey Fedorov <serge.fdrv@gmail.com> wrote:
> Implement debug exception routing according to ARM ARM D2.3.1 Pseudocode
> description of routing debug exceptions.
>
> Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>



Applied to target-arm.next, thanks.

-- PMM

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

* Re: [Qemu-devel] [PATCH] target-arm: implement arm_debug_target_el()
  2015-09-18 14:08 ` Peter Maydell
@ 2015-09-18 14:11   ` Peter Maydell
  2015-09-18 15:57     ` Sergey Fedorov
  2015-10-16 12:08     ` Peter Maydell
  0 siblings, 2 replies; 8+ messages in thread
From: Peter Maydell @ 2015-09-18 14:11 UTC (permalink / raw)
  To: Sergey Fedorov; +Cc: QEMU Developers

On 18 September 2015 at 15:08, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 14 September 2015 at 11:53, Sergey Fedorov <serge.fdrv@gmail.com> wrote:
>> Implement debug exception routing according to ARM ARM D2.3.1 Pseudocode
>> description of routing debug exceptions.
>>
>> Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
>
>
>
> Applied to target-arm.next, thanks.

...except it doesn't compile, because we don't have an env->cp15.mdcr_el2.
Presumably there's some other patch this depends on which you haven't
submitted yet?

thanks
-- PMM

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

* Re: [Qemu-devel] [PATCH] target-arm: implement arm_debug_target_el()
  2015-09-18 14:11   ` Peter Maydell
@ 2015-09-18 15:57     ` Sergey Fedorov
  2015-09-18 16:15       ` Sergey Fedorov
  2015-10-16 12:08     ` Peter Maydell
  1 sibling, 1 reply; 8+ messages in thread
From: Sergey Fedorov @ 2015-09-18 15:57 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers



On 18.09.2015 17:11, Peter Maydell wrote:
> On 18 September 2015 at 15:08, Peter Maydell <peter.maydell@linaro.org> wrote:
>> On 14 September 2015 at 11:53, Sergey Fedorov <serge.fdrv@gmail.com> wrote:
>>> Implement debug exception routing according to ARM ARM D2.3.1 Pseudocode
>>> description of routing debug exceptions.
>>>
>>> Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
>>
>>
>> Applied to target-arm.next, thanks.
> ...except it doesn't compile, because we don't have an env->cp15.mdcr_el2.
> Presumably there's some other patch this depends on which you haven't
> submitted yet?
>

Hm... I'll check it :)

Best,
Sergey

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

* Re: [Qemu-devel] [PATCH] target-arm: implement arm_debug_target_el()
  2015-09-18 15:57     ` Sergey Fedorov
@ 2015-09-18 16:15       ` Sergey Fedorov
  2015-09-18 16:35         ` Peter Maydell
  0 siblings, 1 reply; 8+ messages in thread
From: Sergey Fedorov @ 2015-09-18 16:15 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers

On 18.09.2015 18:57, Sergey Fedorov wrote:
> On 18.09.2015 17:11, Peter Maydell wrote:
>> On 18 September 2015 at 15:08, Peter Maydell <peter.maydell@linaro.org> wrote:
>>> On 14 September 2015 at 11:53, Sergey Fedorov <serge.fdrv@gmail.com> wrote:
>>>> Implement debug exception routing according to ARM ARM D2.3.1 Pseudocode
>>>> description of routing debug exceptions.
>>>>
>>>> Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
>>>
>>> Applied to target-arm.next, thanks.
>> ...except it doesn't compile, because we don't have an env->cp15.mdcr_el2.
>> Presumably there's some other patch this depends on which you haven't
>> submitted yet?
>>
> Hm... I'll check it :)

Sorry, I forgot to check that, but actually this patch depends on
another two patches in my local repository. Should I prepare MDCR_EL2
patch suitable for mainline or I can just remove this check from
arm_debug_target_el()?

Best,
Sergey

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

* Re: [Qemu-devel] [PATCH] target-arm: implement arm_debug_target_el()
  2015-09-18 16:15       ` Sergey Fedorov
@ 2015-09-18 16:35         ` Peter Maydell
  2015-09-19 13:28           ` Edgar E. Iglesias
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Maydell @ 2015-09-18 16:35 UTC (permalink / raw)
  To: Sergey Fedorov; +Cc: Edgar Iglesias, QEMU Developers

On 18 September 2015 at 17:15, Sergey Fedorov <serge.fdrv@gmail.com> wrote:
> On 18.09.2015 18:57, Sergey Fedorov wrote:
>> On 18.09.2015 17:11, Peter Maydell wrote:
>>> On 18 September 2015 at 15:08, Peter Maydell <peter.maydell@linaro.org> wrote:
>>>> On 14 September 2015 at 11:53, Sergey Fedorov <serge.fdrv@gmail.com> wrote:
>>>>> Implement debug exception routing according to ARM ARM D2.3.1 Pseudocode
>>>>> description of routing debug exceptions.
>>>>>
>>>>> Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
>>>>
>>>> Applied to target-arm.next, thanks.
>>> ...except it doesn't compile, because we don't have an env->cp15.mdcr_el2.
>>> Presumably there's some other patch this depends on which you haven't
>>> submitted yet?
>>>
>> Hm... I'll check it :)
>
> Sorry, I forgot to check that, but actually this patch depends on
> another two patches in my local repository. Should I prepare MDCR_EL2
> patch suitable for mainline or I can just remove this check from
> arm_debug_target_el()?

Edgar, do you have a MDCR_EL2 implementation in your tree?

Otherwise, yes, Sergey, you should provide an MDCR_EL2/HDCR patch
for mainline I think. It should be fairly easy as it just needs
to be readable/writable and have the correct access checks.
Don't forget to provide the AArch32 interface as well as the AArch64
one, and the "RES0 if EL3 but not EL2" version.
(See Edgar's recent patches in master for VMPIDR_EL2, VTCR_EL2,
etc for examples.)

thanks
-- PMM

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

* Re: [Qemu-devel] [PATCH] target-arm: implement arm_debug_target_el()
  2015-09-18 16:35         ` Peter Maydell
@ 2015-09-19 13:28           ` Edgar E. Iglesias
  0 siblings, 0 replies; 8+ messages in thread
From: Edgar E. Iglesias @ 2015-09-19 13:28 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Sergey Fedorov, QEMU Developers

On Fri, Sep 18, 2015 at 05:35:07PM +0100, Peter Maydell wrote:
> On 18 September 2015 at 17:15, Sergey Fedorov <serge.fdrv@gmail.com> wrote:
> > On 18.09.2015 18:57, Sergey Fedorov wrote:
> >> On 18.09.2015 17:11, Peter Maydell wrote:
> >>> On 18 September 2015 at 15:08, Peter Maydell <peter.maydell@linaro.org> wrote:
> >>>> On 14 September 2015 at 11:53, Sergey Fedorov <serge.fdrv@gmail.com> wrote:
> >>>>> Implement debug exception routing according to ARM ARM D2.3.1 Pseudocode
> >>>>> description of routing debug exceptions.
> >>>>>
> >>>>> Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
> >>>>
> >>>> Applied to target-arm.next, thanks.
> >>> ...except it doesn't compile, because we don't have an env->cp15.mdcr_el2.
> >>> Presumably there's some other patch this depends on which you haven't
> >>> submitted yet?
> >>>
> >> Hm... I'll check it :)
> >
> > Sorry, I forgot to check that, but actually this patch depends on
> > another two patches in my local repository. Should I prepare MDCR_EL2
> > patch suitable for mainline or I can just remove this check from
> > arm_debug_target_el()?
> 
> Edgar, do you have a MDCR_EL2 implementation in your tree?
> 
> Otherwise, yes, Sergey, you should provide an MDCR_EL2/HDCR patch
> for mainline I think. It should be fairly easy as it just needs
> to be readable/writable and have the correct access checks.
> Don't forget to provide the AArch32 interface as well as the AArch64
> one, and the "RES0 if EL3 but not EL2" version.
> (See Edgar's recent patches in master for VMPIDR_EL2, VTCR_EL2,
> etc for examples.)

Hi,

Sorry, no, I only have a dummy for MDCR_EL2.. Would be great if Sergey has
something ready.

Best regards,
Edgar

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

* Re: [Qemu-devel] [PATCH] target-arm: implement arm_debug_target_el()
  2015-09-18 14:11   ` Peter Maydell
  2015-09-18 15:57     ` Sergey Fedorov
@ 2015-10-16 12:08     ` Peter Maydell
  1 sibling, 0 replies; 8+ messages in thread
From: Peter Maydell @ 2015-10-16 12:08 UTC (permalink / raw)
  To: Sergey Fedorov; +Cc: QEMU Developers

On 18 September 2015 at 15:11, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 18 September 2015 at 15:08, Peter Maydell <peter.maydell@linaro.org> wrote:
>> On 14 September 2015 at 11:53, Sergey Fedorov <serge.fdrv@gmail.com> wrote:
>>> Implement debug exception routing according to ARM ARM D2.3.1 Pseudocode
>>> description of routing debug exceptions.
>>>
>>> Signed-off-by: Sergey Fedorov <serge.fdrv@gmail.com>
>>
>>
>>
>> Applied to target-arm.next, thanks.
>
> ...except it doesn't compile, because we don't have an env->cp15.mdcr_el2.

Reapplied, now we have an mdcr_el2 for it to use.

-- PMM

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

end of thread, other threads:[~2015-10-16 12:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-14 10:53 [Qemu-devel] [PATCH] target-arm: implement arm_debug_target_el() Sergey Fedorov
2015-09-18 14:08 ` Peter Maydell
2015-09-18 14:11   ` Peter Maydell
2015-09-18 15:57     ` Sergey Fedorov
2015-09-18 16:15       ` Sergey Fedorov
2015-09-18 16:35         ` Peter Maydell
2015-09-19 13:28           ` Edgar E. Iglesias
2015-10-16 12:08     ` Peter Maydell

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.