This patch didn't make mainline yet (3.15-rc6).

This is required for booting in the PowerNV (non-virtualized) platform in
little-endian mode.

Sources:
- 
https://github.com/torvalds/linux/commit/5072b7ba14de2b02b1d68f85dc5e81980e1818e7
- http://patchwork.ozlabs.org/patch/350461/

Signed-off-by: Mauricio Faria de Oliveira <mauri...@linux.vnet.ibm.com>
---
 ...el-powernv-calls-to-support-little-endian.patch |   94 ++++++++++++++++++++
 debian/patches/series                              |    1 +
 2 files changed, 95 insertions(+), 0 deletions(-)
 create mode 100644 
debian/patches/bugfix/powerpc/ppc64el-powernv-calls-to-support-little-endian.patch

diff --git 
a/debian/patches/bugfix/powerpc/ppc64el-powernv-calls-to-support-little-endian.patch
 
b/debian/patches/bugfix/powerpc/ppc64el-powernv-calls-to-support-little-endian.patch
new file mode 100644
index 0000000..815ff98
--- /dev/null
+++ 
b/debian/patches/bugfix/powerpc/ppc64el-powernv-calls-to-support-little-endian.patch
@@ -0,0 +1,94 @@
+https://github.com/torvalds/linux/commit/5072b7ba14de2b02b1d68f85dc5e81980e1818e7
+
+From 5072b7ba14de2b02b1d68f85dc5e81980e1818e7 Mon Sep 17 00:00:00 2001
+From: Benjamin Herrenschmidt <b...@kernel.crashing.org>
+Date: Wed, 21 Aug 2013 14:52:31 +1000
+Subject: [PATCH] powerpc/powernv: Add calls to support little endian
+
+Signed-off-by: Benjamin Herrenschmidt <b...@kernel.crashing.or>
+Forward-ported-by: Mauricio Faria de Oliveira <mauri...@linux.vnet.ibm.com>
+
+Index: linux-3.15-rc5/arch/powerpc/include/asm/opal.h
+===================================================================
+--- linux-3.15-rc5.orig/arch/powerpc/include/asm/opal.h        2014-05-09 
17:10:52.000000000 -0300
++++ linux-3.15-rc5/arch/powerpc/include/asm/opal.h     2014-05-19 
15:31:37.000000000 -0300
+@@ -154,6 +154,7 @@
+ #define OPAL_LPC_READ                         67
+ #define OPAL_LPC_WRITE                                68
+ #define OPAL_RETURN_CPU                               69
++#define OPAL_REINIT_CPUS                      70
+ #define OPAL_ELOG_READ                                71
+ #define OPAL_ELOG_WRITE                               72
+ #define OPAL_ELOG_ACK                         73
+@@ -725,6 +726,11 @@
+       uint64_t pestB[OPAL_PHB3_NUM_PEST_REGS];
+ };
+ 
++enum {
++      OPAL_REINIT_CPUS_HILE_BE        = (1 << 0),
++      OPAL_REINIT_CPUS_HILE_LE        = (1 << 1),
++};
++
+ typedef struct oppanel_line {
+       const char *    line;
+       uint64_t        line_len;
+@@ -849,6 +855,7 @@
+                           uint16_t *pci_error_type, uint16_t *severity);
+ int64_t opal_pci_poll(uint64_t phb_id);
+ int64_t opal_return_cpu(void);
++int64_t opal_reinit_cpus(uint64_t flags);
+ 
+ int64_t opal_xscom_read(uint32_t gcid, uint64_t pcb_addr, __be64 *val);
+ int64_t opal_xscom_write(uint32_t gcid, uint64_t pcb_addr, uint64_t val);
+Index: linux-3.15-rc5/arch/powerpc/platforms/powernv/opal-wrappers.S
+===================================================================
+--- linux-3.15-rc5.orig/arch/powerpc/platforms/powernv/opal-wrappers.S 
2014-05-09 17:10:52.000000000 -0300
++++ linux-3.15-rc5/arch/powerpc/platforms/powernv/opal-wrappers.S      
2014-05-19 15:31:37.000000000 -0300
+@@ -124,6 +124,7 @@
+ OPAL_CALL(opal_lpc_read,                      OPAL_LPC_READ);
+ OPAL_CALL(opal_lpc_write,                     OPAL_LPC_WRITE);
+ OPAL_CALL(opal_return_cpu,                    OPAL_RETURN_CPU);
++OPAL_CALL(opal_reinit_cpus,                   OPAL_REINIT_CPUS);
+ OPAL_CALL(opal_read_elog,                     OPAL_ELOG_READ);
+ OPAL_CALL(opal_send_ack_elog,                 OPAL_ELOG_ACK);
+ OPAL_CALL(opal_get_elog_size,                 OPAL_ELOG_SIZE);
+Index: linux-3.15-rc5/arch/powerpc/platforms/powernv/opal.c
+===================================================================
+--- linux-3.15-rc5.orig/arch/powerpc/platforms/powernv/opal.c  2014-05-09 
17:10:52.000000000 -0300
++++ linux-3.15-rc5/arch/powerpc/platforms/powernv/opal.c       2014-05-19 
15:31:37.000000000 -0300
+@@ -57,6 +57,21 @@
+ static uint64_t last_notified_mask = 0x0ul;
+ static atomic_t opal_notifier_hold = ATOMIC_INIT(0);
+ 
++static void opal_reinit_cores(void)
++{
++      /* Do the actual re-init, This will clobber all FPRs, VRs, etc...
++       *
++       * It will preserve non volatile GPRs and HSPRG0/1. It will
++       * also restore HIDs and other SPRs to their original value
++       * but it might clobber a bunch.
++       */
++#ifdef __BIG_ENDIAN__
++      opal_reinit_cpus(OPAL_REINIT_CPUS_HILE_BE);
++#else
++      opal_reinit_cpus(OPAL_REINIT_CPUS_HILE_LE);
++#endif
++}     
++
+ int __init early_init_dt_scan_opal(unsigned long node,
+                                  const char *uname, int depth, void *data)
+ {
+@@ -96,6 +111,13 @@
+               printk("OPAL V1 detected !\n");
+       }
+ 
++      /* Reinit all cores with the right endian */
++      opal_reinit_cores();
++
++      /* Restore some bits */
++      if (cur_cpu_spec->cpu_restore)
++              cur_cpu_spec->cpu_restore();
++
+       return 1;
+ }
+ 
diff --git a/debian/patches/series b/debian/patches/series
index c313b85..b232b9f 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -58,6 +58,7 @@ bugfix/arm/omap-musb-choice.patch
 bugfix/mips/disable-advansys.patch
 bugfix/arm/ixp4xx_iobe.patch
 bugfix/m68k/ethernat-kconfig.patch
+bugfix/powerpc/ppc64el-powernv-calls-to-support-little-endian.patch
 
 # Miscellaneous bug fixes
 bugfix/all/misc-bmp085-Enable-building-as-a-module.patch
-- 
1.7.1


-- 
To UNSUBSCRIBE, email to debian-kernel-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: 
https://lists.debian.org/1400966342-19173-6-git-send-email-mauri...@linux.vnet.ibm.com

Reply via email to