This is a note to let you know that I've just added the patch titled

    sparc: Set reboot-cmd using reboot data hypervisor call if available.

to the 3.0-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     sparc-set-reboot-cmd-using-reboot-data-hypervisor-call-if-available.patch
and it can be found in the queue-3.0 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <sta...@kernel.org> know about it.


>From 3551005cbfebbdaaccf92eda706bab61bc210caa Mon Sep 17 00:00:00 2001
From: "David S. Miller" <da...@davemloft.net>
Date: Mon, 1 Aug 2011 23:27:17 -0700
Subject: sparc: Set reboot-cmd using reboot data hypervisor call if available.


From: "David S. Miller" <da...@davemloft.net>

[ Upstream commit ea5e7447ea9d555558e0f13798f5143dd51a915a ]

Signed-off-by: David S. Miller <da...@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gre...@suse.de>
---
 arch/sparc/include/asm/hypervisor.h |    7 +++++++
 arch/sparc/kernel/ds.c              |   30 ++++++++++++++++++++++++++++--
 arch/sparc/kernel/hvcalls.S         |    7 +++++++
 arch/sparc/kernel/kernel.h          |    9 +++++++++
 arch/sparc/kernel/sstate.c          |    9 ++-------
 5 files changed, 53 insertions(+), 9 deletions(-)

--- a/arch/sparc/include/asm/hypervisor.h
+++ b/arch/sparc/include/asm/hypervisor.h
@@ -2927,6 +2927,13 @@ extern unsigned long sun4v_ncs_request(u
 #define HV_FAST_FIRE_GET_PERFREG       0x120
 #define HV_FAST_FIRE_SET_PERFREG       0x121
 
+#define HV_FAST_REBOOT_DATA_SET                0x172
+
+#ifndef __ASSEMBLY__
+extern unsigned long sun4v_reboot_data_set(unsigned long ra,
+                                          unsigned long len);
+#endif
+
 /* Function numbers for HV_CORE_TRAP.  */
 #define HV_CORE_SET_VER                        0x00
 #define HV_CORE_PUTCHAR                        0x01
--- a/arch/sparc/kernel/ds.c
+++ b/arch/sparc/kernel/ds.c
@@ -15,12 +15,15 @@
 #include <linux/reboot.h>
 #include <linux/cpu.h>
 
+#include <asm/hypervisor.h>
 #include <asm/ldc.h>
 #include <asm/vio.h>
 #include <asm/mdesc.h>
 #include <asm/head.h>
 #include <asm/irq.h>
 
+#include "kernel.h"
+
 #define DRV_MODULE_NAME                "ds"
 #define PFX DRV_MODULE_NAME    ": "
 #define DRV_MODULE_VERSION     "1.0"
@@ -828,18 +831,32 @@ void ldom_set_var(const char *var, const
        }
 }
 
+static char full_boot_str[256] __attribute__((aligned(32)));
+static int reboot_data_supported;
+
 void ldom_reboot(const char *boot_command)
 {
        /* Don't bother with any of this if the boot_command
         * is empty.
         */
        if (boot_command && strlen(boot_command)) {
-               char full_boot_str[256];
+               unsigned long len;
 
                strcpy(full_boot_str, "boot ");
                strcpy(full_boot_str + strlen("boot "), boot_command);
+               len = strlen(full_boot_str);
 
-               ldom_set_var("reboot-command", full_boot_str);
+               if (reboot_data_supported) {
+                       unsigned long ra = kimage_addr_to_ra(full_boot_str);
+                       unsigned long hv_ret;
+
+                       hv_ret = sun4v_reboot_data_set(ra, len);
+                       if (hv_ret != HV_EOK)
+                               pr_err("SUN4V: Unable to set reboot data "
+                                      "hv_ret=%lu\n", hv_ret);
+               } else {
+                       ldom_set_var("reboot-command", full_boot_str);
+               }
        }
        sun4v_mach_sir();
 }
@@ -1237,6 +1254,15 @@ static struct vio_driver ds_driver = {
 
 static int __init ds_init(void)
 {
+       unsigned long hv_ret, major, minor;
+
+       hv_ret = sun4v_get_version(HV_GRP_REBOOT_DATA, &major, &minor);
+       if (hv_ret == HV_EOK) {
+               pr_info("SUN4V: Reboot data supported (maj=%lu,min=%lu).\n",
+                       major, minor);
+               reboot_data_supported = 1;
+       }
+
        kthread_run(ds_thread, NULL, "kldomd");
 
        return vio_register_driver(&ds_driver);
--- a/arch/sparc/kernel/hvcalls.S
+++ b/arch/sparc/kernel/hvcalls.S
@@ -798,3 +798,10 @@ ENTRY(sun4v_niagara2_setperf)
        retl
         nop
 ENDPROC(sun4v_niagara2_setperf)
+
+ENTRY(sun4v_reboot_data_set)
+       mov     HV_FAST_REBOOT_DATA_SET, %o5
+       ta      HV_FAST_TRAP
+       retl
+        nop
+ENDPROC(sun4v_reboot_data_set)
--- a/arch/sparc/kernel/kernel.h
+++ b/arch/sparc/kernel/kernel.h
@@ -4,6 +4,8 @@
 #include <linux/interrupt.h>
 
 #include <asm/traps.h>
+#include <asm/head.h>
+#include <asm/io.h>
 
 /* cpu.c */
 extern const char *sparc_pmu_type;
@@ -14,6 +16,13 @@ extern int ncpus_probed;
 /* setup_64.c */
 struct seq_file;
 extern void cpucap_info(struct seq_file *);
+
+static inline unsigned long kimage_addr_to_ra(const char *p)
+{
+       unsigned long val = (unsigned long) p;
+
+       return kern_base + (val - KERNBASE);
+}
 #endif
 
 #ifdef CONFIG_SPARC32
--- a/arch/sparc/kernel/sstate.c
+++ b/arch/sparc/kernel/sstate.c
@@ -14,14 +14,9 @@
 #include <asm/head.h>
 #include <asm/io.h>
 
-static int hv_supports_soft_state;
-
-static unsigned long kimage_addr_to_ra(const char *p)
-{
-       unsigned long val = (unsigned long) p;
+#include "kernel.h"
 
-       return kern_base + (val - KERNBASE);
-}
+static int hv_supports_soft_state;
 
 static void do_set_sstate(unsigned long state, const char *msg)
 {


Patches currently in stable-queue which might be from da...@davemloft.net are

queue-3.0/ipv4-send-gratuitous-arp-for-secondary-ip-addresses-also.patch
queue-3.0/ipv4-constrain-ufo-fragment-sizes-to-multiples-of-8-bytes.patch
queue-3.0/sparc-detect-and-handle-ultrasparc-t3-cpu-types.patch
queue-3.0/bonding-fix-string-comparison-errors.patch
queue-3.0/sparc-use-popc-if-possible-for-hweight-routines.patch
queue-3.0/drivers-net-niu.c-adjust-array-index.patch
queue-3.0/sparc-set-reboot-cmd-using-reboot-data-hypervisor-call-if-available.patch
queue-3.0/net-audit-drivers-to-identify-those-needing-iff_tx_skb_sharing-cleared.patch
queue-3.0/sparc-size-mondo-queues-more-sanely.patch
queue-3.0/sparc-don-t-leave-sparc_pmu_type-null-on-sun4v.patch
queue-3.0/ipv4-use-rt_tos-after-some-rt_tos-conversions.patch
queue-3.0/net-cap-number-of-elements-for-sendmmsg.patch
queue-3.0/sch_sfq-fix-sfq_enqueue.patch
queue-3.0/sparc-sanitize-cpu-feature-detection-and-reporting.patch
queue-3.0/sparc-use-popc-when-possible-for-ffs-__ffs-ffz.patch
queue-3.0/sparc-add-t3-sun4v-cpu-type-and-hypervisor-group-defines.patch
queue-3.0/net-fix-security_socket_sendmsg-bypass-problem.patch
queue-3.0/sparc-use-hweight64-in-popc-emulation.patch
queue-3.0/0002-net-Compute-protocol-sequence-numbers-and-fragment-I.patch
queue-3.0/sparc-add-some-missing-hypervisor-api-groups.patch
queue-3.0/fix-cdc-phonet-build.patch
queue-3.0/sparc-minor-tweaks-to-niagara-page-copy-clear.patch
queue-3.0/ipv4-fix-the-reusing-of-routing-cache-entries.patch
queue-3.0/ipv6-make-fragment-identifications-less-predictable.patch
queue-3.0/sis190-rx-filter-init-is-needed-for-mac-address-change.patch
queue-3.0/net-adjust-array-index.patch
queue-3.0/sparc-access-kernel-tsb-using-physical-addressing-when-possible.patch
queue-3.0/net-allow-netif_carrier-to-be-called-safely-from-irq.patch
queue-3.0/sparc-fix-build-with-debug_pagealloc-enabled.patch
queue-3.0/icmp-fix-regression-in-nexthop-resolution-during-replies.patch
queue-3.0/xfrm-fix-key-lengths-for-rfc3686-ctr-aes.patch
queue-3.0/0001-crypto-Move-md5_transform-to-lib-md5.c.patch
queue-3.0/gre-fix-improper-error-handling.patch
queue-3.0/net-add-iff_skb_tx_shared-flag-to-priv_flags.patch
queue-3.0/r8169-add-support-for-d-link-530t-rev-c1-kernel-bug-38862.patch
queue-3.0/sparc-don-t-do-expensive-hypervisor-pcr-write-unless-necessary.patch
queue-3.0/net-sendmmsg-should-only-return-an-error-if-no-messages-were-sent.patch
queue-3.0/mpt2sas-fixed-big-indian-issues-on-32-bit-ppc.patch

_______________________________________________
stable mailing list
stable@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/stable

Reply via email to