aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikunj A Dadhania <nikunj@linux.vnet.ibm.com>2018-04-03 09:51:42 +0530
committerAlexey Kardashevskiy <aik@ozlabs.ru>2018-04-04 12:34:45 +1000
commitc2a331f275b8e8e6c049eb7d61c03c7dbb39f2a4 (patch)
treed92e1bbfdbe0dd29a96db5ae7b7afff1bfd88d1d
parent8128b8e3ea76f8fcfdde6605bfa25fcdc13a5ab7 (diff)
downloadSLOF-c2a331f275b8e8e6c049eb7d61c03c7dbb39f2a4.zip
SLOF-c2a331f275b8e8e6c049eb7d61c03c7dbb39f2a4.tar.gz
SLOF-c2a331f275b8e8e6c049eb7d61c03c7dbb39f2a4.tar.bz2
broken_sc1: check for H_PRIVILEGE
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@ellerman.id.au> CC: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
-rw-r--r--lib/libhvcall/brokensc1.c10
-rw-r--r--lib/libhvcall/libhvcall.h1
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