powerpc/rtas: dispatch partition migration requests to pseries
authorNathan Lynch <nathanl@linux.ibm.com>
Mon, 7 Dec 2020 21:51:47 +0000 (15:51 -0600)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 8 Dec 2020 10:40:59 +0000 (21:40 +1100)
sys_rtas() cannot call ibm,suspend-me directly in the same way it
handles other inputs. Instead it must dispatch the request to code
that can first perform the H_JOIN sequence before any call to
ibm,suspend-me can succeed. Over time kernel/rtas.c has accreted a fair
amount of platform-specific code to implement this.

Since a different, more robust implementation of the suspend sequence
is now in the pseries platform code, we want to dispatch the request
there.

Note that invoking ibm,suspend-me via the RTAS syscall is all but
deprecated; this change preserves ABI compatibility for old programs
while providing to them the benefit of the new partition suspend
implementation. This is a behavior change in that the kernel performs
the device tree update and firmware activation before returning, but
experimentation indicates this is tolerated fine by legacy user space.

Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20201207215200.1785968-16-nathanl@linux.ibm.com
arch/powerpc/include/asm/rtas.h
arch/powerpc/kernel/rtas.c
arch/powerpc/platforms/pseries/mobility.c

index fdefe6a974eb13a7678adbd1e6a38a4d546943ef..3b52d8574fcccbd2a014dccdc35f500a4fe326d3 100644 (file)
@@ -279,8 +279,13 @@ extern time64_t last_rtas_event;
 extern int clobbering_unread_rtas_event(void);
 extern int pseries_devicetree_update(s32 scope);
 extern void post_mobility_fixup(void);
+int rtas_syscall_dispatch_ibm_suspend_me(u64 handle);
 #else
 static inline int clobbering_unread_rtas_event(void) { return 0; }
+static inline int rtas_syscall_dispatch_ibm_suspend_me(u64 handle)
+{
+       return -EINVAL;
+}
 #endif
 
 #ifdef CONFIG_PPC_RTAS_DAEMON
index 3a740ae933f8f6a4597290e03bea8f166a846e0b..d4b048571728a88cfefe6d585cd7efb7b2dec272 100644 (file)
@@ -1272,7 +1272,7 @@ SYSCALL_DEFINE1(rtas, struct rtas_args __user *, uargs)
                int rc = 0;
                u64 handle = ((u64)be32_to_cpu(args.args[0]) << 32)
                              | be32_to_cpu(args.args[1]);
-               rc = rtas_ibm_suspend_me_unsafe(handle);
+               rc = rtas_syscall_dispatch_ibm_suspend_me(handle);
                if (rc == -EAGAIN)
                        args.rets[0] = cpu_to_be32(RTAS_NOT_SUSPENDABLE);
                else if (rc == -EIO)
index fe7e35cdc9d54d91a684fc5416ec39f470993b36..e670180f311d53631c1dae3c0c7b9030a265578e 100644 (file)
@@ -615,6 +615,11 @@ static int pseries_migrate_partition(u64 handle)
        return ret;
 }
 
+int rtas_syscall_dispatch_ibm_suspend_me(u64 handle)
+{
+       return pseries_migrate_partition(handle);
+}
+
 static ssize_t migration_store(struct class *class,
                               struct class_attribute *attr, const char *buf,
                               size_t count)