]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
Revert "powerpc/powernv: Add support to set power-shifting-ratio"
authorSeth Forshee <seth.forshee@canonical.com>
Wed, 4 Oct 2017 21:15:40 +0000 (16:15 -0500)
committerSeth Forshee <seth.forshee@canonical.com>
Wed, 4 Oct 2017 21:17:56 +0000 (16:17 -0500)
BugLink: http://bugs.launchpad.net/bugs/1721391
This reverts commit 4b9f824d82c09463a1f56ef6531f4e2fe85f9273.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Documentation/ABI/testing/sysfs-firmware-opal-psr [deleted file]
arch/powerpc/include/asm/opal-api.h
arch/powerpc/include/asm/opal.h
arch/powerpc/platforms/powernv/Makefile
arch/powerpc/platforms/powernv/opal-psr.c [deleted file]
arch/powerpc/platforms/powernv/opal-wrappers.S
arch/powerpc/platforms/powernv/opal.c

diff --git a/Documentation/ABI/testing/sysfs-firmware-opal-psr b/Documentation/ABI/testing/sysfs-firmware-opal-psr
deleted file mode 100644 (file)
index cc2ece7..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-What:          /sys/firmware/opal/psr
-Date:          August 2017
-Contact:       Linux for PowerPC mailing list <linuxppc-dev@ozlabs.org>
-Description:   Power-Shift-Ratio directory for Powernv P9 servers
-
-               Power-Shift-Ratio allows to provide hints the firmware
-               to shift/throttle power between different entities in
-               the system. Each attribute in this directory indicates
-               a settable PSR.
-
-What:          /sys/firmware/opal/psr/cpu_to_gpu_X
-Date:          August 2017
-Contact:       Linux for PowerPC mailing list <linuxppc-dev@ozlabs.org>
-Description:   PSR sysfs attributes for Powernv P9 servers
-
-               Power-Shift-Ratio between CPU and GPU for a given chip
-               with chip-id X. This file gives the ratio (0-100)
-               which is used by OCC for power-capping.
index 0cb7d110c0b44e800d6901d2c481a61a5d51eb88..b87305b22746b77a0e9a37a946adad935237f3e1 100644 (file)
 #define OPAL_IMC_COUNTERS_STOP                 151
 #define OPAL_GET_POWERCAP                      152
 #define OPAL_SET_POWERCAP                      153
-#define OPAL_GET_POWER_SHIFT_RATIO             154
-#define OPAL_SET_POWER_SHIFT_RATIO             155
 #define OPAL_PCI_SET_P2P                       157
 #define OPAL_LAST                              157
 
index 1531b593b6ddec3f9be9decb8a07472d35938622..1c80d256f5d5006303744992b2d874095cdcd66e 100644 (file)
@@ -275,8 +275,6 @@ int64_t opal_imc_counters_stop(uint32_t type, uint64_t cpu_pir);
 
 int opal_get_powercap(u32 handle, int token, u32 *pcap);
 int opal_set_powercap(u32 handle, int token, u32 pcap);
-int opal_get_power_shift_ratio(u32 handle, int token, u32 *psr);
-int opal_set_power_shift_ratio(u32 handle, int token, u32 psr);
 
 /* Internal functions */
 extern int early_init_dt_scan_opal(unsigned long node, const char *uname,
@@ -356,7 +354,6 @@ static inline int opal_get_async_rc(struct opal_msg msg)
 void opal_wake_poller(void);
 
 void opal_powercap_init(void);
-void opal_psr_init(void);
 
 #endif /* __ASSEMBLY__ */
 
index 674ed1e8160aacd7d7184e5434131b198173d2ae..f9ec36d0e6845747d37ec4a158d43834a4f562f5 100644 (file)
@@ -2,7 +2,7 @@ obj-y                   += setup.o opal-wrappers.o opal.o opal-async.o idle.o
 obj-y                  += opal-rtc.o opal-nvram.o opal-lpc.o opal-flash.o
 obj-y                  += rng.o opal-elog.o opal-dump.o opal-sysparam.o opal-sensor.o
 obj-y                  += opal-msglog.o opal-hmi.o opal-power.o opal-irqchip.o
-obj-y                  += opal-kmsg.o opal-powercap.o opal-psr.o
+obj-y                  += opal-kmsg.o opal-powercap.o
 
 obj-$(CONFIG_SMP)      += smp.o subcore.o subcore-asm.o
 obj-$(CONFIG_PCI)      += pci.o pci-ioda.o npu-dma.o
diff --git a/arch/powerpc/platforms/powernv/opal-psr.c b/arch/powerpc/platforms/powernv/opal-psr.c
deleted file mode 100644 (file)
index 7313b7f..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * PowerNV OPAL Power-Shift-Ratio interface
- *
- * Copyright 2017 IBM Corp.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- */
-
-#define pr_fmt(fmt)     "opal-psr: " fmt
-
-#include <linux/of.h>
-#include <linux/kobject.h>
-#include <linux/slab.h>
-
-#include <asm/opal.h>
-
-DEFINE_MUTEX(psr_mutex);
-
-static struct kobject *psr_kobj;
-
-struct psr_attr {
-       u32 handle;
-       struct kobj_attribute attr;
-} *psr_attrs;
-
-static ssize_t psr_show(struct kobject *kobj, struct kobj_attribute *attr,
-                       char *buf)
-{
-       struct psr_attr *psr_attr = container_of(attr, struct psr_attr, attr);
-       struct opal_msg msg;
-       int psr, ret, token;
-
-       token = opal_async_get_token_interruptible();
-       if (token < 0) {
-               pr_devel("Failed to get token\n");
-               return token;
-       }
-
-       ret = mutex_lock_interruptible(&psr_mutex);
-       if (ret)
-               goto out_token;
-
-       ret = opal_get_power_shift_ratio(psr_attr->handle, token,
-                                           (u32 *)__pa(&psr));
-       switch (ret) {
-       case OPAL_ASYNC_COMPLETION:
-               ret = opal_async_wait_response(token, &msg);
-               if (ret) {
-                       pr_devel("Failed to wait for the async response\n");
-                       ret = -EIO;
-                       goto out;
-               }
-               ret = opal_error_code(opal_get_async_rc(msg));
-               if (!ret) {
-                       ret = sprintf(buf, "%u\n", be32_to_cpu(psr));
-                       if (ret < 0)
-                               ret = -EIO;
-               }
-               break;
-       case OPAL_SUCCESS:
-               ret = sprintf(buf, "%u\n", be32_to_cpu(psr));
-               if (ret < 0)
-                       ret = -EIO;
-               break;
-       default:
-               ret = opal_error_code(ret);
-       }
-
-out:
-       mutex_unlock(&psr_mutex);
-out_token:
-       opal_async_release_token(token);
-       return ret;
-}
-
-static ssize_t psr_store(struct kobject *kobj, struct kobj_attribute *attr,
-                        const char *buf, size_t count)
-{
-       struct psr_attr *psr_attr = container_of(attr, struct psr_attr, attr);
-       struct opal_msg msg;
-       int psr, ret, token;
-
-       ret = kstrtoint(buf, 0, &psr);
-       if (ret)
-               return ret;
-
-       token = opal_async_get_token_interruptible();
-       if (token < 0) {
-               pr_devel("Failed to get token\n");
-               return token;
-       }
-
-       ret = mutex_lock_interruptible(&psr_mutex);
-       if (ret)
-               goto out_token;
-
-       ret = opal_set_power_shift_ratio(psr_attr->handle, token, psr);
-       switch (ret) {
-       case OPAL_ASYNC_COMPLETION:
-               ret = opal_async_wait_response(token, &msg);
-               if (ret) {
-                       pr_devel("Failed to wait for the async response\n");
-                       ret = -EIO;
-                       goto out;
-               }
-               ret = opal_error_code(opal_get_async_rc(msg));
-               if (!ret)
-                       ret = count;
-               break;
-       case OPAL_SUCCESS:
-               ret = count;
-               break;
-       default:
-               ret = opal_error_code(ret);
-       }
-
-out:
-       mutex_unlock(&psr_mutex);
-out_token:
-       opal_async_release_token(token);
-       return ret;
-}
-
-void __init opal_psr_init(void)
-{
-       struct device_node *psr, *node;
-       int i = 0;
-
-       psr = of_find_compatible_node(NULL, NULL,
-                                     "ibm,opal-power-shift-ratio");
-       if (!psr) {
-               pr_devel("Power-shift-ratio node not found\n");
-               return;
-       }
-
-       psr_attrs = kcalloc(of_get_child_count(psr), sizeof(struct psr_attr),
-                           GFP_KERNEL);
-       if (!psr_attrs)
-               return;
-
-       psr_kobj = kobject_create_and_add("psr", opal_kobj);
-       if (!psr_kobj) {
-               pr_warn("Failed to create psr kobject\n");
-               goto out;
-       }
-
-       for_each_child_of_node(psr, node) {
-               if (of_property_read_u32(node, "handle",
-                                        &psr_attrs[i].handle))
-                       goto out_kobj;
-
-               sysfs_attr_init(&psr_attrs[i].attr.attr);
-               if (of_property_read_string(node, "label",
-                                           &psr_attrs[i].attr.attr.name))
-                       goto out_kobj;
-               psr_attrs[i].attr.attr.mode = 0664;
-               psr_attrs[i].attr.show = psr_show;
-               psr_attrs[i].attr.store = psr_store;
-               if (sysfs_create_file(psr_kobj, &psr_attrs[i].attr.attr)) {
-                       pr_devel("Failed to create psr sysfs file %s\n",
-                                psr_attrs[i].attr.attr.name);
-                       goto out_kobj;
-               }
-               i++;
-       }
-
-       return;
-out_kobj:
-       kobject_put(psr_kobj);
-out:
-       kfree(psr_attrs);
-}
index 09cc6ec92af72d3e8476673ca33b5324c1ebe647..139286c9880838bed77afafb5ea2dc1499332b23 100644 (file)
@@ -316,5 +316,3 @@ OPAL_CALL(opal_imc_counters_stop,           OPAL_IMC_COUNTERS_STOP);
 OPAL_CALL(opal_pci_set_p2p,                    OPAL_PCI_SET_P2P);
 OPAL_CALL(opal_get_powercap,                   OPAL_GET_POWERCAP);
 OPAL_CALL(opal_set_powercap,                   OPAL_SET_POWERCAP);
-OPAL_CALL(opal_get_power_shift_ratio,          OPAL_GET_POWER_SHIFT_RATIO);
-OPAL_CALL(opal_set_power_shift_ratio,          OPAL_SET_POWER_SHIFT_RATIO);
index f659edbc50567f6af9a16eab065964661da758bd..28323c75e672fec59e64703bff1d03b44f9698d4 100644 (file)
@@ -853,9 +853,6 @@ static int __init opal_init(void)
        /* Initialise OPAL powercap interface */
        opal_powercap_init();
 
-       /* Initialise OPAL Power-Shifting-Ratio interface */
-       opal_psr_init();
-
        return 0;
 }
 machine_subsys_initcall(powernv, opal_init);