]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
arm: replace IS_PSCI_FN macro with more explicit versions
authorAntonios Motakis <antonios.motakis@huawei.com>
Thu, 12 May 2016 13:00:59 +0000 (15:00 +0200)
committerJan Kiszka <jan.kiszka@siemens.com>
Sun, 26 Jun 2016 07:16:28 +0000 (09:16 +0200)
The previous version of the macro allows for more false positives
than necessary.

Replace the macro with IS_PSCI_32 and IS_PSCI_UBOOT macros, that
explicitly check for the 32 bit PSCI IDs, and the PSCI 0.1 IDs
used by uboot. ARMv8 will need an additinal check for the IDs
of 64 bit PSCI functions.

Signed-off-by: Antonios Motakis <antonios.motakis@huawei.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
hypervisor/arch/arm/include/asm/psci.h
hypervisor/arch/arm/traps.c

index 43a9c656ebab4870a0399926110ac3e1285aabdd..dc8c00790fa78e9eecee9deb49ac4f7789ea70f7 100644 (file)
@@ -46,7 +46,8 @@
 #define PSCI_CPU_IS_ON         0
 #define PSCI_CPU_IS_OFF                1
 
-#define IS_PSCI_FN(hvc)                ((((hvc) >> 24) & 0x84) == 0x84)
+#define IS_PSCI_32(hvc)                (((hvc) >> 24) == 0x84)
+#define IS_PSCI_UBOOT(hvc)     (((hvc) >> 8) == 0x95c1ba)
 
 #define PSCI_INVALID_ADDRESS   0xffffffff
 
index 71246e934ef8d8c1e7d6f19903721871e731a693..ae0990f13749cf52bb017d5cdcda86a8ae833f45 100644 (file)
@@ -209,7 +209,7 @@ static int arch_handle_smc(struct trap_context *ctx)
 {
        unsigned long *regs = ctx->regs;
 
-       if (IS_PSCI_FN(regs[0]))
+       if (IS_PSCI_32(regs[0]) || IS_PSCI_UBOOT(regs[0]))
                regs[0] = psci_dispatch(ctx);
        else
                regs[0] = smc(regs[0], regs[1], regs[2], regs[3]);
@@ -223,7 +223,7 @@ static int arch_handle_hvc(struct trap_context *ctx)
 {
        unsigned long *regs = ctx->regs;
 
-       if (IS_PSCI_FN(regs[0]))
+       if (IS_PSCI_32(regs[0]) || IS_PSCI_UBOOT(regs[0]))
                regs[0] = psci_dispatch(ctx);
        else
                regs[0] = hypercall(regs[0], regs[1], regs[2]);