[PATCHv2 1/1] powerpc: fix missing L2 cache size, etc in /sys/devices/system/cpu

2015-02-11 Thread Dave Olson
From: Dave Olson ol...@cumulusnetworks.com

Fix missing L2 cache in /sys/devices/system/cpu/cpu0/cache/index2/size
This appears to have been introduced in 2.6.29 by
93197a36a9c16a85fb24cf5a8639f7bf9af838a3.

This caused lscpu to error out on e500v2 devices, and probably others
 error: cannot open /sys/devices/system/cpu/cpu0/cache/index2/size: No such 
file or directory

Some embedded powerpc sysystems use cache-size in DTS for the unified L2 cache
size, not d-cache-size, so we need to allow for both DTS names.  Added a
new CACHE_TYPE_UNIFIED_D cache_type_info structure to handle this.

Patch is againt URL: 
git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc.git
master branch (which seems quite old, but is listed as the right branch in the 
current Linus
MAINTAINERS file; next is also old, test is newer, but I wasn't sure I 
should use that).
I can rebase, if desired.

Signed-off-by: Dave Olson ol...@cumulusnetworks.com

---

diff --git a/arch/powerpc/kernel/cacheinfo.c b/arch/powerpc/kernel/cacheinfo.c
index a3c684b..c3971bc 100644
--- a/arch/powerpc/kernel/cacheinfo.c
+++ b/arch/powerpc/kernel/cacheinfo.c
@@ -62,12 +62,22 @@ struct cache_type_info {
 };
 
 /* These are used to index the cache_type_info array. */
-#define CACHE_TYPE_UNIFIED 0
-#define CACHE_TYPE_INSTRUCTION 1
-#define CACHE_TYPE_DATA2
+#define CACHE_TYPE_UNIFIED 0 /* cache-size, cache-block-size, etc. */
+#define CACHE_TYPE_UNIFIED_D   1 /* d-cache-size, d-cache-block-size, etc */
+#define CACHE_TYPE_INSTRUCTION 2
+#define CACHE_TYPE_DATA3
 
 static const struct cache_type_info cache_type_info[] = {
{
+   /* Embedded systems that use cache-size, cache-block-size,
+* etc. for the Unified (typically L2) cache. */
+   .name= Unified,
+   .size_prop   = cache-size,
+   .line_size_props = { cache-line-size,
+cache-block-size, },
+   .nr_sets_prop= cache-sets,
+   },
+   {
/* PowerPC Processor binding says the [di]-cache-*
 * must be equal on unified caches, so just use
 * d-cache properties. */
@@ -293,7 +303,8 @@ static struct cache *cache_find_first_sibling(struct cache 
*cache)
 {
struct cache *iter;
 
-   if (cache-type == CACHE_TYPE_UNIFIED)
+   if (cache-type == CACHE_TYPE_UNIFIED ||
+   cache-type == CACHE_TYPE_UNIFIED_D)
return cache;
 
list_for_each_entry(iter, cache_list, list)
@@ -324,13 +335,31 @@ static bool cache_node_is_unified(const struct 
device_node *np)
return of_get_property(np, cache-unified, NULL);
 }
 
+/*
+ * Handle unified caches that have two different types of tags.  Most embedded
+ * use cache-size, etc. for the unified cache size, but open firmware systems
+ * use d-cache-size, etc.   Since they all appear to be consistent, check on
+ * initialization for which type we are, and use the appropriate structure.
+ */
 static struct cache *__cpuinit cache_do_one_devnode_unified(struct device_node 
*node, int level)
 {
struct cache *cache;
+   int ucache;
 
pr_debug(creating L%d ucache for %s\n, level, node-full_name);
 
-   cache = new_cache(CACHE_TYPE_UNIFIED, level, node);
+   if (of_get_property(node,
+   cache_type_info[CACHE_TYPE_UNIFIED_D].size_prop, NULL)) {
+   ucache = CACHE_TYPE_UNIFIED_D;
+   } else {
+   ucache = CACHE_TYPE_UNIFIED; /* assume embedded */
+   if (of_get_property(node,
+   cache_type_info[CACHE_TYPE_UNIFIED].size_prop, NULL) ==
+   NULL)
+   printk(KERN_WARNING Unified cache property missing\n);
+   }
+
+   cache = new_cache(ucache, level, node);
 
return cache;
 }
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

ld: unrecognised emulation mode: -T

2015-02-11 Thread luigi burdo
Sorry for this email . but im facing this error 
when try to build the kernel 3.19 

  ld: unrecognised emulation mode: -T 


before with 3.19rc7 everything was build right without issues .

Im using the Ubuntu Mate 14.04 on Quad G5 
Gcc 4.8.2 

Thanks and sorry 
Luigi Burdo


  ___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[git pull] Please pull mpe/linux.git powerpc-3.20-1 tag

2015-02-11 Thread Michael Ellerman
Hi Linus,

Please pull powerpc updates for 3.20:

The following changes since commit b7392d2247cfe6771f95d256374f1a8e6a6f48d6:

  Linux 3.19-rc2 (2014-12-28 16:49:37 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/mpe/linux.git 
tags/powerpc-3.20-1

for you to fetch changes up to a6130ed253a931d2169c26ab0958d81b0dce4d6e:

  cxl: Add missing return statement after handling AFU errror (2015-02-06 
11:17:27 +1100)


powerpc updates for 3.20

Including:

- Update of all defconfigs
- Addition of a bunch of config options to modernise our defconfigs
- Some PS3 updates from Geoff
- Optimised memcmp for 64 bit from Anton
- Fix for kprobes that allows 'perf probe' to work from Naveen
- Several cxl updates from Ian  Ryan
- Expanded support for the '24x7' PMU from Cody  Sukadev
- Freescale updates from Scott:
  Highlights include 8xx optimizations, some more work on datapath device
   tree content, e300 machine check support, t1040 corenet error reporting,
   and various cleanups and fixes.


Alessio Igor Bogani (2):
  powerpc/85xx: Add support for Emerson/Artesyn MVME2500.
  powerpc: dts: pq3/85xx: Fix GPIO address

Alexandru-Cezar Sardan (1):
  perf/powerpc: reset event hw state when adding it to the PMU

Andreas Ruprecht (1):
  powerpc/lib: Do not include string.o in obj-y twice

Andy Fleming (1):
  powerpc/config: Enable MDIO support

Anshuman Khandual (2):
  powerpc/pseries: All events of EPOW_SYSTEM_SHUTDOWN must initiate shutdown
  selftests/powerpc: Make git ignore all binaries in powerpc test suite

Anton Blanchard (7):
  powerpc: Enable on demand governor on ppc64_defconfig
  powerpc: Enable CONFIG_SATA_AHCI on pseries and ppc64 defconfigs
  powerpc: Enable KSM on pseries and ppc64 defconfigs
  powerpc: Enable overlayfs on pseries and ppc64 defconfigs
  powerpc: Enable various container features on pseries defconfigs.
  powerpc: Add 64bit optimised memcmp
  selftests/powerpc: Add memcmp testcase

Arseny Solokha (2):
  powerpc/mm: bail out early when flushing TLB page
  powerpc/mm: Warn on flushing tlb page in kernel context

Brian Norris (1):
  powerpc: defconfigs: add MTD_SPI_NOR (new dependency for M25P80)

Cody P Schafer (7):
  powerpc/pseries: relocate config DTL so kconfig nests properly
  perf: provide sysfs_show for struct perf_pmu_events_attr
  perf: add PMU_EVENT_ATTR_STRING() helper
  powerpc/perf/hv-24x7: parse catalog and populate sysfs with events
  powerpc/perf/{hv-gpci, hv-common}: generate requests with counters 
annotated
  powerpc/perf/hv-gpci: add the remaining gpci requests
  powerpc/perf/hv-24x7: Document sysfs event description entries

Colin Ian King (1):
  cxl: remove redundant increment of hwirq

Cyril Bur (1):
  powerpc/pseries: Fix endian problems with LE migration

Emil Medve (5):
  powerpc: Replace cpumask_weight(cpu_possible_mask) with 
num_possible_cpus()
  powerpc/dts: Remove T4240 emulator support
  powerpc: Remove duplicate tlbcam_index declarations
  dt/bindings: b/qman: Fix the alloc-ranges in the example(s)
  dt/bindings: b/qman: Add phandle to the portals

Esben Haabendal (1):
  powerpc: Add machine_check cpu function for e300c3 cpus

Gavin Shan (8):
  powerpc/kernel: Avoid memory corruption at early stage
  powerpc/eeh: Fix missed PE#0 on P7IOC
  powerpc/eeh: Introduce flag EEH_PE_REMOVED
  powerpc/eeh: Allow to set maximal frozen times
  powerpc/powernv: Remove pnv_pci_probe_mode()
  powerpc/powernv: Separate function for OPAL IRQ setup
  powerpc/powernv: Don't alloc IRQ map if necessary
  powerpc/kernel: Avoid initializing device-tree pointer twice

Geoff Levand (5):
  powerpc/ps3: Add empty repository highmem routines
  powerpc/ps3: Add ps3_mm_set_repository_highmem
  powerpc/ps3: Write highmem info to repository
  powerpc/ps3: Fix vuart sparse warnings
  powerpc/ps3: Fix sys-manager-core sparse warnings

Ian Munsie (8):
  cxl: Fix leaking interrupts if attach process fails
  cxl: Early return from cxl_handle_fault for a shut down context
  cxl: Disable AFU debug flag
  cxl: Disable SPAP register when freeing SPA
  cxl: Add tracepoints
  cxl: Export optional AFU configuration record in sysfs
  cxl: Fail AFU initialisation if an invalid configuration record is found
  cxl: Add missing return statement after handling AFU errror

Joel Stanley (1):
  powerpc/powernv: Add OPAL soft-poweroff routine

Kim Phillips (2):
  powerpc/mm: fix undefined reference to `.__kernel_map_pages' on FSL PPC64
  powerpc/fsl_pci: Fix pci stack build bug with FRAME_WARN

Kumar Gala (2):
  powerpc/mpc85xx: Create dts components for the FSL QorIQ DPAA BMan
  powerpc/mpc85xx: Create dts 

Re: [PATCH V4] powerpc, powernv: Add OPAL platform event driver

2015-02-11 Thread Vipin K Parashar


On 02/11/2015 10:32 AM, Stewart Smith wrote:

Vipin K Parashar vi...@linux.vnet.ibm.com writes:

(1) Environmental and Power Warning (EPOW)
(2) Delayed Power Off (DPO)
The user interface for this driver is /dev/opal_event character
device file where the user space clients can poll and read for
new opal platform events. The expected sequence of events driven
from user space should be like the following.

(1) Open the character device file
(2) Poll on the file for POLLIN event
(3) When unblocked, must attempt to read OPAL_PLAT_EVENT_MAX_SIZE size
(4) Kernel driver will pass at most one opal_plat_event structure
(5) Poll again for more new events

A few thoughts from discussing with Michael and Joel:
- not convinced that a chardev is the most ideal way to notify
   userspace. It seems like yet-another powerpc specific notification
   mechanism, which isn't ideal.
- netlink probably isn't right either (although maybe *sligthtly*
   better?)
- it seems that the standard way is ACPI, so I wonder if we could emit
   an ACPI event and essentially fake having ACPI... that would make all
   existing userspace just work, right?
   Looking at acpi_bus_generate_netlink_event call in
   drivers/acpi/button.c it looks possible that we may be able to
   (relatively simply) do that?
Thanks Stewart, i will explore more about ACPI and will also try to see 
if we could use it to throw

events to guests.

- What do UPSs do? It would seem that some common this is what's about
   to happen to your power would almost *have* to exist somewhat
   generically?
UPS class tells about UPS status with system. FSP sends mbox messages 
with UPS status along with
UPS status bit which tells exactly as to what change is there in UPS 
status like UPS installed, UPS battery low, UPS removed (By passed). We 
plan to add support for these UPS events in skiboot to provide more

UPS details.

I strongly advocate for anything that doesn't require custom userspace
that's OPAL/POWER specific (that we then have to get into distros etc etc

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [QUESTION,RFC] cacheable_memcpy() versus memcpy() == 8% improvment on FTP throughput

2015-02-11 Thread Benjamin Herrenschmidt
On Wed, 2015-02-11 at 08:53 +0100, leroy christophe wrote:
 In powerpc32 architecture there is a function called cacheable_memcpy() 
 which does same thing as memcpy() but using dcbz/dcbt instructions for 
 an optimised copy (just like __copy_tofrom_user())
 What seems strange is that it is almost nowhere used (only used in 
 drivers/net/ethernet/ibm/emac/core.c)
 
 For a try I replaced all memcpy() in include/linux/skbuff.h and 
 net/core/skbuff.c by cacheable_memcpy() and I got around 8% improvement 
 on FTP throughput on MPC885.
 
 What could be done to generalise the use of cacheable_memcpy() instead 
 of memcpy() whenever possible ?
 Indeed, in order to use cacheable_memcpy(), we need
 * The destination to be cacheable
 * The source and destination to not overlap on the same cachelines
 
 Could we check, when calling memcpy(), whether the destination is 
 cacheable or not, and if yes redirect the call to cacheable_memcpy() ?
 How can we check that ?

Additionally we could have a P8 implementation that uses unaligned
vectors. Adding Anton to the CC list.

Cheers,
Ben.


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH 3/3] powerpc: Enable HAVE_ARCH_SECCOMP_FILTER

2015-02-11 Thread Bogdan Purcareata
Signed-off-by: Bogdan Purcareata bogdan.purcare...@freescale.com
---
 arch/powerpc/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index a2a168e..72f363e 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -104,6 +104,7 @@ config PPC
select HAVE_EFFICIENT_UNALIGNED_ACCESS if !CPU_LITTLE_ENDIAN
select HAVE_KPROBES
select HAVE_ARCH_KGDB
+   select HAVE_ARCH_SECCOMP_FILTER
select HAVE_KRETPROBES
select HAVE_ARCH_TRACEHOOK
select HAVE_MEMBLOCK
-- 
2.1.4

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH 2/3] powerpc: Relax secure computing on syscall entry trace

2015-02-11 Thread Bogdan Purcareata
The secure_computing_strict will just force the kernel to panic on
secure_computing failure. Once SECCOMP_FILTER support is enabled in the kernel,
syscalls can be denied without system failure.

Signed-off-by: Bogdan Purcareata bogdan.purcare...@freescale.com
---
 arch/powerpc/kernel/ptrace.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index d82fd0b..d41faab 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -1772,7 +1772,9 @@ long do_syscall_trace_enter(struct pt_regs *regs)
 
user_exit();
 
-   secure_computing_strict(regs-gpr[0]);
+   /* Do the secure computing check first; failures should be fast. */
+   if (secure_computing(regs-gpr[0]) == -1)
+   return -1L;
 
if (test_thread_flag(TIF_SYSCALL_TRACE) 
tracehook_report_syscall_entry(regs)) {
-- 
2.1.4

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [RFC][PATCH 1/3] powerpc: Don't force ENOSYS as error on syscall fail

2015-02-11 Thread Purcareata Bogdan

On 11.02.2015 05:04, Michael Ellerman wrote:

On Mon, 2015-02-09 at 07:55 +, Bogdan Purcareata wrote:

In certain scenarios - e.g. seccomp filtering with ERRNO as default action -
the system call fails for other reasons than the syscall not being available.
The seccomp filter can be configured to store a user-defined error code on
return from a blacklisted syscall.

The RFC is this: are there currently any user-space scenarios where it is
required that the system call return ENOSYS as error code on failure, no matter
the circumstances? I don't want to break userspace requirements. I have not
added code to force this error code in situations different than
secure_computing failure, in order to keep overhead at a minimum.

Signed-off-by: Bogdan Purcareata bogdan.purcare...@freescale.com
---
  arch/powerpc/kernel/entry_32.S | 3 ++-
  arch/powerpc/kernel/entry_64.S | 2 +-
  2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 59848e5..52e48dd 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -425,7 +425,8 @@ END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX)
b   1b
  #endif  /* CONFIG_44x */

-66:li  r3,-ENOSYS
+66:
+#  li  r3,-ENOSYS
b   ret_from_syscall

.globl  ret_from_fork
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index e6bfe8e..80db02e 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -269,7 +269,7 @@ syscall_dotrace:
b   .Lsyscall_dotrace_cont

  syscall_enosys:
-   li  r3,-ENOSYS
+#  li  r3,-ENOSYS
b   syscall_exit


So what happens if you call this with a syscall number that's out of bounds?


As far as my current understanding goes, the call will return with -1 
with a errno that's undefined (or I've not seen it be defined anywhere).


I've thought more about this, and I guess the best option would be to 
move setting -ENOSYS as errno from the syscall entry assembly to 
do_syscall_trace_enter (as opposed to eliminating it at all). I was a 
little reluctant to do this at first in order to keep overhead to a 
minimum, but it's certainly not an option to change behavior if the 
syscall number is out of bounds.


v2 to come shortly.

Thanks,
Bogdan P.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH v2 0/3] powerpc: Enable seccomp filter support

2015-02-11 Thread Bogdan Purcareata
Add the missing pieces in order to enable SECCOMP_FILTER on PowerPC
architectures, and enable this support.

Testing has been pursued using libseccomp with the latest ppc support patches
[1], on Freescale platforms for both ppc and ppc64. ppc64le support is
untested.

[1] https://groups.google.com/forum/#!topic/libseccomp/ktR-bQr1tGw

v2:
- move setting ENOSYS from syscall entry assembly to do_syscall_trace_enter

Bogdan Purcareata (3):
  powerpc: Don't force ENOSYS as error on syscall fail
  powerpc: Relax secure computing on syscall entry trace
  powerpc: Enable HAVE_ARCH_SECCOMP_FILTER

 arch/powerpc/Kconfig   | 1 +
 arch/powerpc/kernel/entry_32.S | 2 +-
 arch/powerpc/kernel/entry_64.S | 1 -
 arch/powerpc/kernel/ptrace.c   | 8 ++--
 4 files changed, 8 insertions(+), 4 deletions(-)

-- 
2.1.4

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH v2 1/3] powerpc: Don't force ENOSYS as error on syscall fail

2015-02-11 Thread Bogdan Purcareata
In certain scenarios - e.g. seccomp filtering with ERRNO as default action -
the system call fails for other reasons than the syscall not being available.
The seccomp filter can be configured to store a user-defined error code on
return from a blacklisted syscall. Don't always set ENOSYS on
do_syscall_trace_enter failure.

v2:
- move setting ENOSYS as errno from the syscall entry assembly to
  do_syscall_trace_enter, only in the specific case

Signed-off-by: Bogdan Purcareata bogdan.purcare...@freescale.com
---
 arch/powerpc/kernel/entry_32.S | 2 +-
 arch/powerpc/kernel/entry_64.S | 1 -
 arch/powerpc/kernel/ptrace.c   | 4 +++-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 10a0935..d2c58a3 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -425,7 +425,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_NEED_PAIRED_STWCX)
b   1b
 #endif  /* CONFIG_44x */
 
-66:li  r3,-ENOSYS
+66:
b   ret_from_syscall
 
.globl  ret_from_fork
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 194e46d..0111e04 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -269,7 +269,6 @@ syscall_dotrace:
b   .Lsyscall_dotrace_cont
 
 syscall_enosys:
-   li  r3,-ENOSYS
b   syscall_exit

 syscall_exit_work:
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index f21897b..d82fd0b 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -1775,13 +1775,15 @@ long do_syscall_trace_enter(struct pt_regs *regs)
secure_computing_strict(regs-gpr[0]);
 
if (test_thread_flag(TIF_SYSCALL_TRACE) 
-   tracehook_report_syscall_entry(regs))
+   tracehook_report_syscall_entry(regs)) {
/*
 * Tracing decided this syscall should not happen.
 * We'll return a bogus call number to get an ENOSYS
 * error, but leave the original number in regs-gpr[0].
 */
ret = -1L;
+   syscall_set_return_value(current, regs, -ENOSYS, 0);
+   }
 
if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
trace_sys_enter(regs, regs-gpr[0]);
-- 
2.1.4

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH 2/2] opal: Add message notifier unregister function

2015-02-11 Thread Anshuman Khandual
On 02/11/2015 11:57 AM, Neelesh Gupta wrote:
 Provide an unregister interface for the opal message notifiers
 to be called when not needed like during driver unload/remove.

Why only for unload/remove, you can also use it in cases where you need
to abort because of any other error soon after successful registration
for an OPAL message. 

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH v2 1/2] opal: Fix the overflow of message notifiers head array

2015-02-11 Thread Anshuman Khandual
On 02/11/2015 11:57 AM, Neelesh Gupta wrote:
 Fixes the condition check of incoming message type which can
 otherwise shoot beyond the message notifiers head array.
 
 Signed-off-by: Neelesh Gupta neele...@linux.vnet.ibm.com
 Reviewed-by: Vasant Hegde hegdevas...@linux.vnet.ibm.com
Reviewed-by: Anshuman Khandual khand...@linux.vnet.ibm.com

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH V4] powerpc, powernv: Add OPAL platform event driver

2015-02-11 Thread Stewart Smith
Vipin K Parashar vi...@linux.vnet.ibm.com writes:
 - What do UPSs do? It would seem that some common this is what's about
to happen to your power would almost *have* to exist somewhat
generically?
 UPS class tells about UPS status with system. FSP sends mbox messages 
 with UPS status along with
 UPS status bit which tells exactly as to what change is there in UPS 
 status like UPS installed, UPS battery low, UPS removed (By passed). We 
 plan to add support for these UPS events in skiboot to provide more
 UPS details.

I was thinking of UPSs on systems other than IBM FSP based POWER
systems like if I went down the street and bought one for $100 and
plugged it into my x86 desktop.

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH 1/3] powerpc/powernv: only register log if OPAL supports doing so

2015-02-11 Thread Stewart Smith
Correct use of REGISTER/UNREGISTER is to check if the token exists
before calling. If we don't we get a OPAL: Called with bad token 101 !
error, which is harmless but may be alarming to some.

Signed-off-by: Stewart Smith stew...@linux.vnet.ibm.com
---
 arch/powerpc/platforms/powernv/opal.c |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/powernv/opal.c 
b/arch/powerpc/platforms/powernv/opal.c
index f10b9ec..84ff20c 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -665,6 +665,9 @@ static void __init opal_dump_region_init(void)
uint64_t size;
int rc;
 
+   if (!opal_check_token(OPAL_REGISTER_DUMP_REGION))
+   return;
+
/* Register kernel log buffer */
addr = log_buf_addr_get();
size = log_buf_len_get();
@@ -795,7 +798,8 @@ void opal_shutdown(void)
}
 
/* Unregister memory dump region */
-   opal_unregister_dump_region(OPAL_DUMP_REGION_LOG_BUF);
+   if (opal_check_token(OPAL_UNREGISTER_DUMP_REGION))
+   opal_unregister_dump_region(OPAL_DUMP_REGION_LOG_BUF);
 }
 
 /* Export this so that test modules can use it */
-- 
1.7.10.4

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH v2 1/3] powerpc: Don't force ENOSYS as error on syscall fail

2015-02-11 Thread Michael Ellerman
On Wed, 2015-02-11 at 08:36 +, Bogdan Purcareata wrote:
 In certain scenarios - e.g. seccomp filtering with ERRNO as default action -
 the system call fails for other reasons than the syscall not being available.
 The seccomp filter can be configured to store a user-defined error code on
 return from a blacklisted syscall. Don't always set ENOSYS on
 do_syscall_trace_enter failure.
 
 v2:
 - move setting ENOSYS as errno from the syscall entry assembly to
   do_syscall_trace_enter, only in the specific case

 diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
 index 194e46d..0111e04 100644
 --- a/arch/powerpc/kernel/entry_64.S
 +++ b/arch/powerpc/kernel/entry_64.S
 @@ -269,7 +269,6 @@ syscall_dotrace:
   b   .Lsyscall_dotrace_cont
  
  syscall_enosys:
 - li  r3,-ENOSYS
   b   syscall_exit


This still looks wrong to me.

On 64 bit we do:

CURRENT_THREAD_INFO(r11, r1)
ld  r10,TI_FLAGS(r11)
andi.   r11,r10,_TIF_SYSCALL_DOTRACE
bne syscall_dotrace
.Lsyscall_dotrace_cont:
cmpldi  0,r0,NR_syscalls
bge-syscall_enosys
...

syscall_enosys:
li  r3,-ENOSYS
b   .Lsyscall_exit


Your patch removes the load of ENOSYS.

Which means if we're not doing syscall tracing, and we get an out-of-bounds
syscall number, we'll return with something random on r3. Won't we?

The 32-bit code looks more or less similar, although the label has a different
name.

cheers



___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH 0/3] Silence OPAL called with invalid token errors

2015-02-11 Thread Stewart Smith
If OPAL firmware is called with an invalid token, that is, one that
the current running firmware does not support, it dumps an error into
its log. For three calls we were making in Linux, we were not adequately
checking that the current firmware supported them, so could get
this warning spuriously.

Stewart Smith (3):
  powerpc/powernv: only register log if OPAL supports doing so
  powerpc/powernv: only call OPAL_ELOG_RESEND if firmware supports it
  powerpc/powernv: only call OPAL_RESEND_DUMP if firmware supports it

 arch/powerpc/platforms/powernv/opal-dump.c |3 ++-
 arch/powerpc/platforms/powernv/opal-elog.c |3 ++-
 arch/powerpc/platforms/powernv/opal.c  |6 +-
 3 files changed, 9 insertions(+), 3 deletions(-)

-- 
1.7.10.4

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH 2/3] powerpc/powernv: only call OPAL_ELOG_RESEND if firmware supports it

2015-02-11 Thread Stewart Smith
Otherwise firmware complains: OPAL: Called with bad token 74 !
as not all OPAL systems have the ability to resend error logs.

Signed-off-by: Stewart Smith stew...@linux.vnet.ibm.com
---
 arch/powerpc/platforms/powernv/opal-elog.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/powernv/opal-elog.c 
b/arch/powerpc/platforms/powernv/opal-elog.c
index 518fe95..38ce757 100644
--- a/arch/powerpc/platforms/powernv/opal-elog.c
+++ b/arch/powerpc/platforms/powernv/opal-elog.c
@@ -313,7 +313,8 @@ int __init opal_elog_init(void)
}
 
/* We are now ready to pull error logs from opal. */
-   opal_resend_pending_logs();
+   if (opal_check_token(OPAL_ELOG_RESEND))
+   opal_resend_pending_logs();
 
return 0;
 }
-- 
1.7.10.4

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH 3/3] powerpc/powernv: only call OPAL_RESEND_DUMP if firmware supports it

2015-02-11 Thread Stewart Smith
Not all OPAL platforms support resending system dumps, so check
that current firmware supports it first. Otherwise we get firmware
complaining:
OPAL: Called with bad token 91 !

Signed-off-by: Stewart Smith stew...@linux.vnet.ibm.com
---
 arch/powerpc/platforms/powernv/opal-dump.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/powernv/opal-dump.c 
b/arch/powerpc/platforms/powernv/opal-dump.c
index 23260f7..5aa9c1c 100644
--- a/arch/powerpc/platforms/powernv/opal-dump.c
+++ b/arch/powerpc/platforms/powernv/opal-dump.c
@@ -452,5 +452,6 @@ void __init opal_platform_dump_init(void)
return;
}
 
-   opal_dump_resend_notification();
+   if (opal_check_token(OPAL_DUMP_RESEND))
+   opal_dump_resend_notification();
 }
-- 
1.7.10.4

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev