[Skiboot] [RFC PATCH v5 02/16] Add functions to initialize and start an ultravisor

Alexey Kardashevskiy aik at ozlabs.ru
Wed Mar 4 17:28:55 AEDT 2020



On 04/03/2020 16:19, Alexey Kardashevskiy wrote:
> 
> 
> On 28/02/2020 07:40, Ryan Grimm wrote:
>> Power 9 introduces a mode called ultravisor mode.
>>
>> init_uv looks for uv-src-address in the device tree and copies the image
>> to the address specified in "reg".
>>
>> start_ultravisor is called in load_and_boot_kernel with the pointer to
>> the system fdt.
>>
>> Every thread is sent to the ultravisor image and returns with UV mode
>> off.
>>
>> A minimal ultravisor could disable UV and PEF, instructions in commit
>> "skiboot.tcl: ultravisor support."
>>
>> [ maddy: Initial implementation]
>> [Signed-off-by: Madhavan Srinivasan <maddy at linux.vnet.ibm.com>
>> [ santosh: Initial implementation]
>> Signed-off-by: Santosh Sivaraj <santosh at fossix.org>
>> Signed-off-by: Ryan Grimm <grimm at us.ibm.com>
>>
>> ultravisor.c: use reserve
>> ---
>>  asm/misc.S           | 22 ++++++++++++
>>  core/init.c          |  6 ++++
>>  hw/Makefile.inc      |  2 +-
>>  hw/ultravisor.c      | 83 ++++++++++++++++++++++++++++++++++++++++++++
>>  include/processor.h  |  8 +++++
>>  include/ultravisor.h | 17 +++++++++
>>  6 files changed, 137 insertions(+), 1 deletion(-)
>>  create mode 100644 hw/ultravisor.c
>>  create mode 100644 include/ultravisor.h
>>
>> diff --git a/asm/misc.S b/asm/misc.S
>> index 647f60b2..f9dea492 100644
>> --- a/asm/misc.S
>> +++ b/asm/misc.S
>> @@ -255,3 +255,25 @@ enter_p9_pm_state:
>>  	mtspr	SPR_PSSCR,%r3
>>  	PPC_INST_STOP
>>  	b	.
>> +
>> +/*
>> + *  start_uv register usage:
>> + *
>> + *  r3 : UV base addr
>> + *  r4 : system fdt
>> + */
>> +.global start_uv
>> +start_uv:
>> +	mflr    %r0
>> +	std     %r0,16(%r1)
>> +	sync
>> +	/* flush caches, etc */
>> +	icbi    0,%r3
>> +	sync
>> +	isync
>> +	mtctr   %r3
>> +	mr      %r3,%r4
>> +	bctrl				/* branch to UV here */
>> +	ld      %r0,16(%r1)
>> +	mtlr    %r0
>> +	blr
> 
> 
> This is not going to work if skiboot is compiled with LITTLE_ENDIAN=1.


ah, no, uv fixes endianness. never mind, sorry for the noise.


-- 
Alexey


More information about the Skiboot mailing list