aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/pseries/mobility.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms/pseries/mobility.c')
-rw-r--r--arch/powerpc/platforms/pseries/mobility.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c
index 8f35d525cede..ceb18d349459 100644
--- a/arch/powerpc/platforms/pseries/mobility.c
+++ b/arch/powerpc/platforms/pseries/mobility.c
@@ -320,28 +320,34 @@ static ssize_t migrate_store(struct class *class, struct class_attribute *attr,
320{ 320{
321 u64 streamid; 321 u64 streamid;
322 int rc; 322 int rc;
323 int vasi_rc = 0;
324 323
325 rc = kstrtou64(buf, 0, &streamid); 324 rc = kstrtou64(buf, 0, &streamid);
326 if (rc) 325 if (rc)
327 return rc; 326 return rc;
328 327
329 do { 328 do {
330 rc = rtas_ibm_suspend_me(streamid, &vasi_rc); 329 rc = rtas_ibm_suspend_me(streamid);
331 if (!rc && vasi_rc == RTAS_NOT_SUSPENDABLE) 330 if (rc == -EAGAIN)
332 ssleep(1); 331 ssleep(1);
333 } while (!rc && vasi_rc == RTAS_NOT_SUSPENDABLE); 332 } while (rc == -EAGAIN);
334 333
335 if (rc) 334 if (rc)
336 return rc; 335 return rc;
337 if (vasi_rc)
338 return vasi_rc;
339 336
340 post_mobility_fixup(); 337 post_mobility_fixup();
341 return count; 338 return count;
342} 339}
343 340
341/*
342 * Used by drmgr to determine the kernel behavior of the migration interface.
343 *
344 * Version 1: Performs all PAPR requirements for migration including
345 * firmware activation and device tree update.
346 */
347#define MIGRATION_API_VERSION 1
348
344static CLASS_ATTR(migration, S_IWUSR, NULL, migrate_store); 349static CLASS_ATTR(migration, S_IWUSR, NULL, migrate_store);
350static CLASS_ATTR_STRING(api_version, S_IRUGO, __stringify(MIGRATION_API_VERSION));
345 351
346static int __init mobility_sysfs_init(void) 352static int __init mobility_sysfs_init(void)
347{ 353{
@@ -352,7 +358,13 @@ static int __init mobility_sysfs_init(void)
352 return -ENOMEM; 358 return -ENOMEM;
353 359
354 rc = sysfs_create_file(mobility_kobj, &class_attr_migration.attr); 360 rc = sysfs_create_file(mobility_kobj, &class_attr_migration.attr);
361 if (rc)
362 pr_err("mobility: unable to create migration sysfs file (%d)\n", rc);
355 363
356 return rc; 364 rc = sysfs_create_file(mobility_kobj, &class_attr_api_version.attr.attr);
365 if (rc)
366 pr_err("mobility: unable to create api_version sysfs file (%d)\n", rc);
367
368 return 0;
357} 369}
358machine_device_initcall(pseries, mobility_sysfs_init); 370machine_device_initcall(pseries, mobility_sysfs_init);