[SLOF] [PATCH v2] broken_sc1: check for H_PRIVILEGE
Alexey Kardashevskiy
aik at ozlabs.ru
Wed Apr 4 12:39:08 AEST 2018
On 3/4/18 2:21 pm, 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.
>
> Instead of checking for various returns, check if its not in privilege mode and
> patch sc1 in that case.
>
> 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>
Thanks, applied.
> ---
> lib/libhvcall/brokensc1.c | 10 +++++-----
> lib/libhvcall/libhvcall.h | 1 +
> 2 files changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/lib/libhvcall/brokensc1.c b/lib/libhvcall/brokensc1.c
> index e6387e0..d97ae77 100644
> --- a/lib/libhvcall/brokensc1.c
> +++ b/lib/libhvcall/brokensc1.c
> @@ -47,13 +47,13 @@ static int check_broken_sc1(void)
> * supervisor mode.
> */
> r = hcall(INS_SC1, H_SET_DABR, 0);
> - if (r == H_SUCCESS || r == H_HARDWARE) {
> - /* All is fine */
> - return 0;
> + if (r == H_PRIVILEGE) {
> + /* We found a broken sc1 host! */
> + return 1;
> }
>
> - /* We found a broken sc1 host! */
> - return 1;
> + /* All is fine */
> + return 0;
> }
>
> int patch_broken_sc1(void *start, void *end, uint32_t *test_ins)
> diff --git a/lib/libhvcall/libhvcall.h b/lib/libhvcall/libhvcall.h
> index 3fa4398..caa4d6d 100644
> --- a/lib/libhvcall/libhvcall.h
> +++ b/lib/libhvcall/libhvcall.h
> @@ -3,6 +3,7 @@
>
> #define H_SUCCESS 0
> #define H_HARDWARE -1
> +#define H_PRIVILEGE -3 /* Caller not privileged */
>
> #define H_GET_TCE 0x1C
> #define H_PUT_TCE 0x20
>
--
Alexey
More information about the SLOF
mailing list