[SLOF] [PATCH] broken_sc1: handle H_UNSUPPORTED as well

Thomas Huth thuth at redhat.com
Tue Apr 3 05:38:38 AEST 2018


On 02.04.2018 11:53, Nikunj A Dadhania wrote:
> Recently, found that when DAWR was disabled by linux kernel, the hcall started
> returning H_UNSUPPORTED, and VM did not boot up as broken_sc1 patched up SC
> calls falsely. Make sure we handle H_UNSUPPORTED as well.
> 
> CC: Michael Ellerman <michael at ellerman.id.au>
> CC: Aneesh Kumar K.V <aneesh.kumar at linux.vnet.ibm.com>
> Signed-off-by: Nikunj A Dadhania <nikunj at linux.vnet.ibm.com>
> ---
>  lib/libhvcall/brokensc1.c | 2 +-
>  lib/libhvcall/libhvcall.h | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/libhvcall/brokensc1.c b/lib/libhvcall/brokensc1.c
> index e6387e0..163ee30 100644
> --- a/lib/libhvcall/brokensc1.c
> +++ b/lib/libhvcall/brokensc1.c
> @@ -47,7 +47,7 @@ static int check_broken_sc1(void)
>  	 * supervisor mode.
>  	 */
>  	r = hcall(INS_SC1, H_SET_DABR, 0);
> -	if (r == H_SUCCESS || r == H_HARDWARE) {
> +	if (r == H_SUCCESS || r == H_HARDWARE || r == H_UNSUPPORTED) {
>  		/* All is fine */
>  		return 0;

Sounds like this is ok for now. But while you're at it, it's maybe
cleaner to revert the logic here:

	r = hcall(INS_SC1, H_SET_DABR, 0);
	if (r == H_PRIVILEGE)
		return 1;

	return 0;

We're using this check in kvm-unit-tests, too, and I think it makes more
sense to check for H_PRIVILEGE than the other way round.

 Thomas


More information about the SLOF mailing list