[Skiboot] [RFC PATCH 9/9] OPAL V4: local vm_map/unmap operations

Gautham R Shenoy ego at linux.vnet.ibm.com
Wed May 6 15:53:10 AEST 2020


Hello Nicholas,

On Sat, May 02, 2020 at 09:36:49PM +1000, Nicholas Piggin wrote:
> This implements vm_map/unmap API that an OS can provide. The per-CPU
> areas are advertised by OPAL_FIND_VM_AREA so page tables can be allocated
> ahead of time.
> 
> The ops must not sleep or cause IPIs.
> 
> This allows skiboot to run entirely in virtual mode and not have to
> drop to real mode to cope with vm_map().
> 
> Signed-off-by: Nicholas Piggin <npiggin at gmail.com>


[..snip..]


> @@ -519,6 +525,37 @@ void os_printf(uint32_t log_level, const char *str)
>  	os_ops.os_printf(log_level, str);
>  }
> 
> +int64_t os_vm_map(uint64_t ea, uint64_t pa, uint64_t flags)
> +{
> +	struct cpu_thread *cpu = this_cpu();
> +	uint64_t msr = mfmsr();
> +	int64_t ret;
> +
> +	if (msr != cpu->opal_call_msr)
> +		mtmsrd(cpu->opal_call_msr, 0);
> +
> +	ret = os_ops.os_vm_map(ea, pa, flags);
> +
> +	if (msr != cpu->opal_call_msr)
> +		mtmsrd(cpu->opal_call_msr, 0);

Should this be mtmsrd(msr, 0) , so that we return with the msr value
that was set by someone up in the call stack ?



> +
> +	return ret;
> +}
> +
> +void os_vm_unmap(uint64_t ea)
> +{
> +	struct cpu_thread *cpu = this_cpu();
> +	uint64_t msr = mfmsr();
> +
> +	if (msr != cpu->opal_call_msr)
> +		mtmsrd(cpu->opal_call_msr, 0);
> +
> +	os_ops.os_vm_unmap(ea);
> +
> +	if (msr != cpu->opal_call_msr)
> +		mtmsrd(cpu->opal_call_msr, 0);

Ditto ?

> +}
> +
>  void add_opal_node(void)
>  {
>  	uint64_t base, entry, size;
> diff --git a/core/vm.c b/core/vm.c
> index b2830fccf..2ecfaeb44 100644

[..snip..]

--
Thanks and Regards
gautham.


More information about the Skiboot mailing list