From: Marc Zyngier <marc.zyngier@arm.com>
To: Tony Lindgren <tony@atomide.com>
Cc: Dave Martin <dave.martin@linaro.org>,
linux-omap@vger.kernel.org,
Russell King - ARM Linux <linux@arm.linux.org.uk>,
linux-arm-kernel@lists.infradead.org,
Nicolas Pitre <nico@fluxnic.net>
Subject: Re: [PATCH v2 2/7] ARM: virt: allow the kernel to be entered in HYP mode
Date: Sat, 06 Oct 2012 12:18:23 +0200 [thread overview]
Message-ID: <6d3553bfe8a2d1ac88cab852100616a7@localhost> (raw)
In-Reply-To: <20121005200822.GQ3874@atomide.com>
[-- Attachment #1: Type: text/plain, Size: 2281 bytes --]
Hi Tony,
On Fri, 5 Oct 2012 13:08:22 -0700, Tony Lindgren <tony@atomide.com> wrote:
> Hi,
>
> * Marc Zyngier <marc.zyngier@arm.com> [120907 10:04]:
>> From: Dave Martin <dave.martin@linaro.org>
>>
>> This patch does two things:
>>
>> * Ensure that asynchronous aborts are masked at kernel entry.
>> The bootloader should be masking these anyway, but this reduces
>> the damage window just in case it doesn't.
>>
>> * Enter svc mode via exception return to ensure that CPU state is
>> properly serialised. This does not matter when switching from
>> an ordinary privileged mode ("PL1" modes in ARMv7-AR rev C
>> parlance), but it potentially does matter when switching from a
>> another privileged mode such as hyp mode.
>>
>> This should allow the kernel to boot safely either from svc mode or
>> hyp mode, even if no support for use of the ARM Virtualization
>> Extensions is built into the kernel.
>>
>> Signed-off-by: Dave Martin <dave.martin@linaro.org>
>> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
>
> Just bisected this down in linux-next for breaking booting of
> my omap2420 ARMv6 based n8x0..
>
>> --- a/arch/arm/kernel/head.S
>> +++ b/arch/arm/kernel/head.S
>> @@ -83,8 +83,12 @@ ENTRY(stext)
>> THUMB( .thumb ) @ switch to Thumb now.
>> THUMB(1: )
>>
>> - setmode PSR_F_BIT | PSR_I_BIT | SVC_MODE, r9 @ ensure svc mode
>> - @ and irqs disabled
>> +#ifdef CONFIG_ARM_VIRT_EXT
>> + bl __hyp_stub_install
>> +#endif
>> + @ ensure svc mode and all interrupts masked
>> + safe_svcmode_maskall r9
>> +
>> mrc p15, 0, r9, c0, c0 @ get processor id
>> bl __lookup_processor_type @ r5=procinfo r9=cpuid
>> movs r10, r5 @ invalid processor (r5=0)?
>
> ..and looks like undoing this part fixes it. Any ideas?
>
> I quickly tried disabling ARCH_OMAP3 and ARCH_OMAP4 so it's
> ARMv6 but that does not help.
If you compiled for v6 only, we can safely exclude __hyp_stub_install, and
I assume that you get past the decompressor.
If so, that indicates some side effect of the safe_svcmode_maskall macro,
and I suspect the "movs pc, lr" bit.
Can you try the attached patch? It basically falls back to the previous
behaviour if not entered in HYP mode.
Thanks,
M.
--
Fast, cheap, reliable. Pick two.
[-- Attachment #2: setmode.patch --]
[-- Type: text/plain, Size: 672 bytes --]
diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
index 658a15d..b21b97f 100644
--- a/arch/arm/include/asm/assembler.h
+++ b/arch/arm/include/asm/assembler.h
@@ -254,16 +254,17 @@
mov lr , \reg
and lr , lr , #MODE_MASK
cmp lr , #HYP_MODE
- orr \reg , \reg , #PSR_A_BIT | PSR_I_BIT | PSR_F_BIT
+ orr \reg , \reg , #PSR_I_BIT | PSR_F_BIT
bic \reg , \reg , #MODE_MASK
orr \reg , \reg , #SVC_MODE
THUMB( orr \reg , \reg , #PSR_T_BIT )
- msr spsr_cxsf, \reg
- adr lr, BSYM(2f)
bne 1f
+ orr \reg, \reg, #PSR_A_BIT
+ adr lr, BSYM(2f)
+ msr spsr_cxsf, \reg
__MSR_ELR_HYP(14)
__ERET
-1: movs pc, lr
+1: msr cpsr_c, \reg
2:
.endm
[-- Attachment #3: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/7] ARM: virt: allow the kernel to be entered in HYP mode
Date: Sat, 06 Oct 2012 12:18:23 +0200 [thread overview]
Message-ID: <6d3553bfe8a2d1ac88cab852100616a7@localhost> (raw)
In-Reply-To: <20121005200822.GQ3874@atomide.com>
Hi Tony,
On Fri, 5 Oct 2012 13:08:22 -0700, Tony Lindgren <tony@atomide.com> wrote:
> Hi,
>
> * Marc Zyngier <marc.zyngier@arm.com> [120907 10:04]:
>> From: Dave Martin <dave.martin@linaro.org>
>>
>> This patch does two things:
>>
>> * Ensure that asynchronous aborts are masked at kernel entry.
>> The bootloader should be masking these anyway, but this reduces
>> the damage window just in case it doesn't.
>>
>> * Enter svc mode via exception return to ensure that CPU state is
>> properly serialised. This does not matter when switching from
>> an ordinary privileged mode ("PL1" modes in ARMv7-AR rev C
>> parlance), but it potentially does matter when switching from a
>> another privileged mode such as hyp mode.
>>
>> This should allow the kernel to boot safely either from svc mode or
>> hyp mode, even if no support for use of the ARM Virtualization
>> Extensions is built into the kernel.
>>
>> Signed-off-by: Dave Martin <dave.martin@linaro.org>
>> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
>
> Just bisected this down in linux-next for breaking booting of
> my omap2420 ARMv6 based n8x0..
>
>> --- a/arch/arm/kernel/head.S
>> +++ b/arch/arm/kernel/head.S
>> @@ -83,8 +83,12 @@ ENTRY(stext)
>> THUMB( .thumb ) @ switch to Thumb now.
>> THUMB(1: )
>>
>> - setmode PSR_F_BIT | PSR_I_BIT | SVC_MODE, r9 @ ensure svc mode
>> - @ and irqs disabled
>> +#ifdef CONFIG_ARM_VIRT_EXT
>> + bl __hyp_stub_install
>> +#endif
>> + @ ensure svc mode and all interrupts masked
>> + safe_svcmode_maskall r9
>> +
>> mrc p15, 0, r9, c0, c0 @ get processor id
>> bl __lookup_processor_type @ r5=procinfo r9=cpuid
>> movs r10, r5 @ invalid processor (r5=0)?
>
> ..and looks like undoing this part fixes it. Any ideas?
>
> I quickly tried disabling ARCH_OMAP3 and ARCH_OMAP4 so it's
> ARMv6 but that does not help.
If you compiled for v6 only, we can safely exclude __hyp_stub_install, and
I assume that you get past the decompressor.
If so, that indicates some side effect of the safe_svcmode_maskall macro,
and I suspect the "movs pc, lr" bit.
Can you try the attached patch? It basically falls back to the previous
behaviour if not entered in HYP mode.
Thanks,
M.
--
Fast, cheap, reliable. Pick two.
-------------- next part --------------
diff --git a/arch/arm/include/asm/assembler.h b/arch/arm/include/asm/assembler.h
index 658a15d..b21b97f 100644
--- a/arch/arm/include/asm/assembler.h
+++ b/arch/arm/include/asm/assembler.h
@@ -254,16 +254,17 @@
mov lr , \reg
and lr , lr , #MODE_MASK
cmp lr , #HYP_MODE
- orr \reg , \reg , #PSR_A_BIT | PSR_I_BIT | PSR_F_BIT
+ orr \reg , \reg , #PSR_I_BIT | PSR_F_BIT
bic \reg , \reg , #MODE_MASK
orr \reg , \reg , #SVC_MODE
THUMB( orr \reg , \reg , #PSR_T_BIT )
- msr spsr_cxsf, \reg
- adr lr, BSYM(2f)
bne 1f
+ orr \reg, \reg, #PSR_A_BIT
+ adr lr, BSYM(2f)
+ msr spsr_cxsf, \reg
__MSR_ELR_HYP(14)
__ERET
-1: movs pc, lr
+1: msr cpsr_c, \reg
2:
.endm
next prev parent reply other threads:[~2012-10-06 10:18 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-07 16:55 [PATCH v2 0/7] Allow the kernel to be booted in HYP mode Marc Zyngier
2012-09-07 16:55 ` [PATCH v2 1/7] ARM: opcodes: add __ERET/__MSR_ELR_HYP instruction encoding Marc Zyngier
2012-09-07 16:55 ` [PATCH v2 2/7] ARM: virt: allow the kernel to be entered in HYP mode Marc Zyngier
2012-10-05 20:08 ` Tony Lindgren
2012-10-05 20:08 ` Tony Lindgren
2012-10-05 23:09 ` Russell King - ARM Linux
2012-10-05 23:09 ` Russell King - ARM Linux
2012-10-05 23:23 ` Tony Lindgren
2012-10-05 23:23 ` Tony Lindgren
2012-10-05 23:50 ` Tony Lindgren
2012-10-05 23:50 ` Tony Lindgren
2012-10-06 1:32 ` Nicolas Pitre
2012-10-06 1:32 ` Nicolas Pitre
2012-10-06 3:06 ` Tony Lindgren
2012-10-06 3:06 ` Tony Lindgren
2012-10-06 10:18 ` Marc Zyngier [this message]
2012-10-06 10:18 ` Marc Zyngier
2012-10-06 14:06 ` Nicolas Pitre
2012-10-06 14:06 ` Nicolas Pitre
2012-10-06 14:44 ` Tony Lindgren
2012-10-06 14:44 ` Tony Lindgren
2012-10-06 14:47 ` Marc Zyngier
2012-10-06 14:47 ` Marc Zyngier
2012-10-06 14:42 ` Tony Lindgren
2012-10-06 14:42 ` Tony Lindgren
2012-10-06 15:32 ` Nicolas Pitre
2012-10-06 15:32 ` Nicolas Pitre
2012-10-06 15:40 ` Tony Lindgren
2012-10-06 15:40 ` Tony Lindgren
2012-10-06 16:06 ` Marc Zyngier
2012-10-06 16:06 ` Marc Zyngier
2012-10-06 15:42 ` Russell King - ARM Linux
2012-10-06 15:42 ` Russell King - ARM Linux
2012-10-06 16:00 ` Tony Lindgren
2012-10-06 16:00 ` Tony Lindgren
2012-10-08 11:01 ` Dave Martin
2012-10-08 11:01 ` Dave Martin
2012-10-08 11:33 ` Marc Zyngier
2012-10-08 11:33 ` Marc Zyngier
2012-10-08 20:36 ` Tony Lindgren
2012-10-08 20:36 ` Tony Lindgren
2012-10-08 11:33 ` Dave Martin
2012-10-08 11:33 ` Dave Martin
2012-09-07 16:55 ` [PATCH v2 3/7] ARM: zImage/virt: hyp mode entry support for the zImage loader Marc Zyngier
2012-09-07 16:55 ` [PATCH v2 4/7] ARM: virt: Update documentation for hyp mode entry support Marc Zyngier
2012-09-07 16:55 ` [PATCH v2 5/7] ARM: virt: Add boot-time diagnostics Marc Zyngier
2012-09-07 16:55 ` [PATCH v2 6/7] ARM: virt: Add CONFIG_ARM_VIRT_EXT option Marc Zyngier
2012-09-07 16:55 ` [PATCH v2 7/7] ARM: virt: arch_timers: enable access to physical timers Marc Zyngier
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=6d3553bfe8a2d1ac88cab852100616a7@localhost \
--to=marc.zyngier@arm.com \
--cc=dave.martin@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=nico@fluxnic.net \
--cc=tony@atomide.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 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.