* [U-Boot] [PATCH 0/2] ARM: Introduce function to switch to hypervisor mode
@ 2016-07-27 3:35 Keerthy
2016-07-27 3:35 ` [U-Boot] [PATCH 1/2] " Keerthy
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Keerthy @ 2016-07-27 3:35 UTC (permalink / raw)
To: u-boot
On SoCs like DRA7, OMAP5 one cannot enable hypervisor mode directly from the
u-boot because the ROM code puts the chip to supervisor mode after it
jumps to boot loader.
Patch 1: Introduces a weak function which can be overridden specific to
SoCs to switch to hypervisor mode.
Patch 2: overrides weak function in patch 1 switch cpu to hypervisor
mode using the available ROM code hook early in the boot phase before
the boot loader checks for hypervisor mode on OMAP5 based SoCs.
Based on top of http://patchwork.dal.design.ti.com/patch/24937/.
Keerthy (2):
ARM: Introduce function to switch to hypervisor mode
ARM: OMAP5+: Override switch_to_hypervisor function
arch/arm/cpu/armv7/omap-common/lowlevel_init.S | 21 +++++++++++++++++++++
arch/arm/cpu/armv7/start.S | 15 +++++++++++++++
arch/arm/include/asm/system.h | 1 +
3 files changed, 37 insertions(+)
--
1.9.1
^ permalink raw reply [flat|nested] 10+ messages in thread* [U-Boot] [PATCH 1/2] ARM: Introduce function to switch to hypervisor mode 2016-07-27 3:35 [U-Boot] [PATCH 0/2] ARM: Introduce function to switch to hypervisor mode Keerthy @ 2016-07-27 3:35 ` Keerthy 2016-07-28 13:44 ` Tom Rini 2016-07-27 3:35 ` [U-Boot] [PATCH 2/2] ARM: OMAP5+: Override switch_to_hypervisor function Keerthy 2016-07-27 3:37 ` [U-Boot] [PATCH 0/2] ARM: Introduce function to switch to hypervisor mode Keerthy 2 siblings, 1 reply; 10+ messages in thread From: Keerthy @ 2016-07-27 3:35 UTC (permalink / raw) To: u-boot On some of the SoCs one cannot enable hypervisor mode directly from the u-boot because the ROM code puts the chip to supervisor mode after it jumps to boot loader. Hence introduce a weak function which can be overridden based on the SoC type and switch to hypervisor mode in a custom way. Cc: beagleboard-x15 at googlegroups.com Signed-off-by: Keerthy <j-keerthy@ti.com> --- arch/arm/cpu/armv7/start.S | 15 +++++++++++++++ arch/arm/include/asm/system.h | 1 + 2 files changed, 16 insertions(+) diff --git a/arch/arm/cpu/armv7/start.S b/arch/arm/cpu/armv7/start.S index 691e5d3..4fb3d58 100644 --- a/arch/arm/cpu/armv7/start.S +++ b/arch/arm/cpu/armv7/start.S @@ -17,6 +17,7 @@ #include <config.h> #include <asm/system.h> #include <linux/linkage.h> +#include <asm/armv7.h> /************************************************************************* * @@ -30,11 +31,20 @@ .globl reset .globl save_boot_params_ret + .global switch_to_hypervisor_ret reset: /* Allow the board to save important registers */ b save_boot_params save_boot_params_ret: +/* + * check for Hypervisor support + */ + mrc p15, 0, r0, c0, c1, 1 @ read ID_PFR1 + and r0, r0, #CPUID_ARM_VIRT_MASK @ mask virtualization bits + cmp r0, #(1 << CPUID_ARM_VIRT_SHIFT) + beq switch_to_hypervisor +switch_to_hypervisor_ret: /* * disable interrupts (FIQ and IRQ), also set the cpu to SVC32 mode, * except if in HYP mode already @@ -103,6 +113,11 @@ ENTRY(save_boot_params) ENDPROC(save_boot_params) .weak save_boot_params +ENTRY(switch_to_hypervisor) + b switch_to_hypervisor_ret +ENDPROC(switch_to_hypervisor) + .weak switch_to_hypervisor + /************************************************************************* * * cpu_init_cp15 diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h index 2bdc0be..d1a95b0 100644 --- a/arch/arm/include/asm/system.h +++ b/arch/arm/include/asm/system.h @@ -226,6 +226,7 @@ void __noreturn psci_system_reset(bool smc); * should use 'b' or 'bx' to return to save_boot_params_ret. */ void save_boot_params_ret(void); +void switch_to_hypervisor_ret(void); #define isb() __asm__ __volatile__ ("" : : : "memory") -- 1.9.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [U-Boot] [PATCH 1/2] ARM: Introduce function to switch to hypervisor mode 2016-07-27 3:35 ` [U-Boot] [PATCH 1/2] " Keerthy @ 2016-07-28 13:44 ` Tom Rini 0 siblings, 0 replies; 10+ messages in thread From: Tom Rini @ 2016-07-28 13:44 UTC (permalink / raw) To: u-boot On Wed, Jul 27, 2016 at 09:05:35AM +0530, Keerthy wrote: > On some of the SoCs one cannot enable hypervisor mode directly from the > u-boot because the ROM code puts the chip to supervisor mode after it > jumps to boot loader. Hence introduce a weak function which can be > overridden based on the SoC type and switch to hypervisor mode in a > custom way. > > Cc: beagleboard-x15 at googlegroups.com > Signed-off-by: Keerthy <j-keerthy@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com> -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160728/1a6a6854/attachment.sig> ^ permalink raw reply [flat|nested] 10+ messages in thread
* [U-Boot] [PATCH 2/2] ARM: OMAP5+: Override switch_to_hypervisor function 2016-07-27 3:35 [U-Boot] [PATCH 0/2] ARM: Introduce function to switch to hypervisor mode Keerthy 2016-07-27 3:35 ` [U-Boot] [PATCH 1/2] " Keerthy @ 2016-07-27 3:35 ` Keerthy 2016-07-28 13:44 ` Tom Rini 2016-07-27 3:37 ` [U-Boot] [PATCH 0/2] ARM: Introduce function to switch to hypervisor mode Keerthy 2 siblings, 1 reply; 10+ messages in thread From: Keerthy @ 2016-07-27 3:35 UTC (permalink / raw) To: u-boot Override the switch_to_hypervisor function to switch cpu to hypervisor mode using the available ROM code hook early in the boot phase before the boot loader checks for HYP mode. Based on the work done by Jonathan Bergsagel jbergsagel at ti.com. Cc: beagleboard-x15 at googlegroups.com Signed-off-by: Keerthy <j-keerthy@ti.com> Acked-by: Nishanth Menon <nm@ti.com> --- arch/arm/cpu/armv7/omap-common/lowlevel_init.S | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/arch/arm/cpu/armv7/omap-common/lowlevel_init.S b/arch/arm/cpu/armv7/omap-common/lowlevel_init.S index 5283135..c7707e5 100644 --- a/arch/arm/cpu/armv7/omap-common/lowlevel_init.S +++ b/arch/arm/cpu/armv7/omap-common/lowlevel_init.S @@ -23,7 +23,28 @@ ENTRY(save_boot_params) str r0, [r1] b save_boot_params_ret ENDPROC(save_boot_params) + +ENTRY(switch_to_hypervisor) +/* + * Switch to hypervisor mode + */ + adr r0, save_sp + str sp, [r0] + adr r1, restore_from_hyp + ldr r0, =0x102 +#ifdef CONFIG_TI_SECURE_DEVICE + b omap_smc_sec +#else + b omap_smc1 +#endif +restore_from_hyp: + adr r0, save_sp + ldr sp, [r0] #endif + b switch_to_hypervisor_ret +save_sp: + .word 0x0 +ENDPROC(switch_to_hypervisor) ENTRY(omap_smc1) PUSH {r4-r12, lr} @ save registers - ROM code may pollute -- 1.9.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [U-Boot] [PATCH 2/2] ARM: OMAP5+: Override switch_to_hypervisor function 2016-07-27 3:35 ` [U-Boot] [PATCH 2/2] ARM: OMAP5+: Override switch_to_hypervisor function Keerthy @ 2016-07-28 13:44 ` Tom Rini 0 siblings, 0 replies; 10+ messages in thread From: Tom Rini @ 2016-07-28 13:44 UTC (permalink / raw) To: u-boot On Wed, Jul 27, 2016 at 09:05:36AM +0530, Keerthy wrote: > Override the switch_to_hypervisor function to switch cpu to hypervisor > mode using the available ROM code hook early in the boot phase before > the boot loader checks for HYP mode. > > Based on the work done by Jonathan Bergsagel jbergsagel at ti.com. > > Cc: beagleboard-x15 at googlegroups.com > Signed-off-by: Keerthy <j-keerthy@ti.com> > Acked-by: Nishanth Menon <nm@ti.com> Reviewed-by: Tom Rini <trini@konsulko.com> -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160728/6d9c5785/attachment.sig> ^ permalink raw reply [flat|nested] 10+ messages in thread
* [U-Boot] [PATCH 0/2] ARM: Introduce function to switch to hypervisor mode 2016-07-27 3:35 [U-Boot] [PATCH 0/2] ARM: Introduce function to switch to hypervisor mode Keerthy 2016-07-27 3:35 ` [U-Boot] [PATCH 1/2] " Keerthy 2016-07-27 3:35 ` [U-Boot] [PATCH 2/2] ARM: OMAP5+: Override switch_to_hypervisor function Keerthy @ 2016-07-27 3:37 ` Keerthy 2016-07-28 12:08 ` Marek Vasut 2 siblings, 1 reply; 10+ messages in thread From: Keerthy @ 2016-07-27 3:37 UTC (permalink / raw) To: u-boot On Wednesday 27 July 2016 09:05 AM, Keerthy wrote: > On SoCs like DRA7, OMAP5 one cannot enable hypervisor mode directly from the > u-boot because the ROM code puts the chip to supervisor mode after it > jumps to boot loader. > > Patch 1: Introduces a weak function which can be overridden specific to > SoCs to switch to hypervisor mode. > > Patch 2: overrides weak function in patch 1 switch cpu to hypervisor > mode using the available ROM code hook early in the boot phase before > the boot loader checks for hypervisor mode on OMAP5 based SoCs. > > Based on top of http://patchwork.dal.design.ti.com/patch/24937/. Please ignore the above link. Based on: http://lists.denx.de/pipermail/u-boot/2016-June/258300.html > > Keerthy (2): > ARM: Introduce function to switch to hypervisor mode > ARM: OMAP5+: Override switch_to_hypervisor function > > arch/arm/cpu/armv7/omap-common/lowlevel_init.S | 21 +++++++++++++++++++++ > arch/arm/cpu/armv7/start.S | 15 +++++++++++++++ > arch/arm/include/asm/system.h | 1 + > 3 files changed, 37 insertions(+) > ^ permalink raw reply [flat|nested] 10+ messages in thread
* [U-Boot] [PATCH 0/2] ARM: Introduce function to switch to hypervisor mode 2016-07-27 3:37 ` [U-Boot] [PATCH 0/2] ARM: Introduce function to switch to hypervisor mode Keerthy @ 2016-07-28 12:08 ` Marek Vasut 2016-07-28 12:42 ` Keerthy 2016-07-28 13:44 ` Tom Rini 0 siblings, 2 replies; 10+ messages in thread From: Marek Vasut @ 2016-07-28 12:08 UTC (permalink / raw) To: u-boot On 07/27/2016 05:37 AM, Keerthy wrote: > > > On Wednesday 27 July 2016 09:05 AM, Keerthy wrote: >> On SoCs like DRA7, OMAP5 one cannot enable hypervisor mode directly >> from the >> u-boot because the ROM code puts the chip to supervisor mode after it >> jumps to boot loader. >> >> Patch 1: Introduces a weak function which can be overridden specific to >> SoCs to switch to hypervisor mode. >> >> Patch 2: overrides weak function in patch 1 switch cpu to hypervisor >> mode using the available ROM code hook early in the boot phase before >> the boot loader checks for hypervisor mode on OMAP5 based SoCs. >> >> Based on top of http://patchwork.dal.design.ti.com/patch/24937/. > > Please ignore the above link. > > Based on: > > http://lists.denx.de/pipermail/u-boot/2016-June/258300.html Please resubmit fixed patch. Also please add your full name as the author, otherwise the patches can not be applied. See ie. https://lwn.net/Articles/195643/ >> >> Keerthy (2): >> ARM: Introduce function to switch to hypervisor mode >> ARM: OMAP5+: Override switch_to_hypervisor function >> >> arch/arm/cpu/armv7/omap-common/lowlevel_init.S | 21 >> +++++++++++++++++++++ >> arch/arm/cpu/armv7/start.S | 15 +++++++++++++++ >> arch/arm/include/asm/system.h | 1 + >> 3 files changed, 37 insertions(+) >> -- Best regards, Marek Vasut ^ permalink raw reply [flat|nested] 10+ messages in thread
* [U-Boot] [PATCH 0/2] ARM: Introduce function to switch to hypervisor mode 2016-07-28 12:08 ` Marek Vasut @ 2016-07-28 12:42 ` Keerthy 2016-07-28 13:44 ` Tom Rini 1 sibling, 0 replies; 10+ messages in thread From: Keerthy @ 2016-07-28 12:42 UTC (permalink / raw) To: u-boot Hi Marek, On Thursday 28 July 2016 05:38 PM, Marek Vasut wrote: > On 07/27/2016 05:37 AM, Keerthy wrote: >> >> >> On Wednesday 27 July 2016 09:05 AM, Keerthy wrote: >>> On SoCs like DRA7, OMAP5 one cannot enable hypervisor mode directly >>> from the >>> u-boot because the ROM code puts the chip to supervisor mode after it >>> jumps to boot loader. >>> >>> Patch 1: Introduces a weak function which can be overridden specific to >>> SoCs to switch to hypervisor mode. >>> >>> Patch 2: overrides weak function in patch 1 switch cpu to hypervisor >>> mode using the available ROM code hook early in the boot phase before >>> the boot loader checks for hypervisor mode on OMAP5 based SoCs. >>> >>> Based on top of http://patchwork.dal.design.ti.com/patch/24937/. >> >> Please ignore the above link. >> >> Based on: >> >> http://lists.denx.de/pipermail/u-boot/2016-June/258300.html > > Please resubmit fixed patch. Also please add your full name as the > author, otherwise the patches can not be applied. > I will re-submit the patches with the correct link. Coming to the name. My full name is Keerthy and that is the name i have been using for the last 4-5 years in the mailing list. I do not have a surname. - Keerthy > See ie. https://lwn.net/Articles/195643/ > >>> >>> Keerthy (2): >>> ARM: Introduce function to switch to hypervisor mode >>> ARM: OMAP5+: Override switch_to_hypervisor function >>> >>> arch/arm/cpu/armv7/omap-common/lowlevel_init.S | 21 >>> +++++++++++++++++++++ >>> arch/arm/cpu/armv7/start.S | 15 +++++++++++++++ >>> arch/arm/include/asm/system.h | 1 + >>> 3 files changed, 37 insertions(+) >>> > > ^ permalink raw reply [flat|nested] 10+ messages in thread
* [U-Boot] [PATCH 0/2] ARM: Introduce function to switch to hypervisor mode 2016-07-28 12:08 ` Marek Vasut 2016-07-28 12:42 ` Keerthy @ 2016-07-28 13:44 ` Tom Rini 2016-07-29 6:21 ` Keerthy 1 sibling, 1 reply; 10+ messages in thread From: Tom Rini @ 2016-07-28 13:44 UTC (permalink / raw) To: u-boot On Thu, Jul 28, 2016 at 02:08:10PM +0200, Marek Vasut wrote: > On 07/27/2016 05:37 AM, Keerthy wrote: > > > > > > On Wednesday 27 July 2016 09:05 AM, Keerthy wrote: > >> On SoCs like DRA7, OMAP5 one cannot enable hypervisor mode directly > >> from the > >> u-boot because the ROM code puts the chip to supervisor mode after it > >> jumps to boot loader. > >> > >> Patch 1: Introduces a weak function which can be overridden specific to > >> SoCs to switch to hypervisor mode. > >> > >> Patch 2: overrides weak function in patch 1 switch cpu to hypervisor > >> mode using the available ROM code hook early in the boot phase before > >> the boot loader checks for hypervisor mode on OMAP5 based SoCs. > >> > >> Based on top of http://patchwork.dal.design.ti.com/patch/24937/. > > > > Please ignore the above link. > > > > Based on: > > > > http://lists.denx.de/pipermail/u-boot/2016-June/258300.html > > Please resubmit fixed patch. That's just a bad link in 0/2, nothing to resubmit. -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160728/176cc10d/attachment.sig> ^ permalink raw reply [flat|nested] 10+ messages in thread
* [U-Boot] [PATCH 0/2] ARM: Introduce function to switch to hypervisor mode 2016-07-28 13:44 ` Tom Rini @ 2016-07-29 6:21 ` Keerthy 0 siblings, 0 replies; 10+ messages in thread From: Keerthy @ 2016-07-29 6:21 UTC (permalink / raw) To: u-boot On Thursday 28 July 2016 07:14 PM, Tom Rini wrote: > On Thu, Jul 28, 2016 at 02:08:10PM +0200, Marek Vasut wrote: >> On 07/27/2016 05:37 AM, Keerthy wrote: >>> >>> >>> On Wednesday 27 July 2016 09:05 AM, Keerthy wrote: >>>> On SoCs like DRA7, OMAP5 one cannot enable hypervisor mode directly >>>> from the >>>> u-boot because the ROM code puts the chip to supervisor mode after it >>>> jumps to boot loader. >>>> >>>> Patch 1: Introduces a weak function which can be overridden specific to >>>> SoCs to switch to hypervisor mode. >>>> >>>> Patch 2: overrides weak function in patch 1 switch cpu to hypervisor >>>> mode using the available ROM code hook early in the boot phase before >>>> the boot loader checks for hypervisor mode on OMAP5 based SoCs. >>>> >>>> Based on top of http://patchwork.dal.design.ti.com/patch/24937/. >>> >>> Please ignore the above link. >>> >>> Based on: >>> >>> http://lists.denx.de/pipermail/u-boot/2016-June/258300.html >> >> Please resubmit fixed patch. > > That's just a bad link in 0/2, nothing to resubmit. Thanks for reviewing Tom! The series generated a compile error on a bunch of other defconfigs. I have fixed that and send a v2 with your Reviewed-by. > ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2016-07-29 6:21 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-07-27 3:35 [U-Boot] [PATCH 0/2] ARM: Introduce function to switch to hypervisor mode Keerthy 2016-07-27 3:35 ` [U-Boot] [PATCH 1/2] " Keerthy 2016-07-28 13:44 ` Tom Rini 2016-07-27 3:35 ` [U-Boot] [PATCH 2/2] ARM: OMAP5+: Override switch_to_hypervisor function Keerthy 2016-07-28 13:44 ` Tom Rini 2016-07-27 3:37 ` [U-Boot] [PATCH 0/2] ARM: Introduce function to switch to hypervisor mode Keerthy 2016-07-28 12:08 ` Marek Vasut 2016-07-28 12:42 ` Keerthy 2016-07-28 13:44 ` Tom Rini 2016-07-29 6:21 ` Keerthy
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox