]> www.infradead.org Git - users/jedix/linux-maple.git/log
users/jedix/linux-maple.git
8 years agosparc64: Enable aggressive setting of PCIe MPS settings
chris hyser [Thu, 19 May 2016 20:05:47 +0000 (13:05 -0700)]
sparc64: Enable aggressive setting of PCIe MPS settings

This patch connects SPARC PCIe into the generic PCIe framework enabling
MPS and MRRS to be set aggressively subject to the standard command line
flags. To enable put "pci=pcie_bus_perf" on command line.

Orabug: 21149334

Signed-off-by: Chris Hyser <chris.hyser@oracle.com>
(cherry picked from commit 5e5b08ede2c5b6cbf39e20f91097ca2435ea286e)
(cherry picked from commit 8b9a1855f68978d437605b0267ba448399303511)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Allow redirection of MSI/MSI-X IRQs
chris hyser [Tue, 17 May 2016 16:39:25 +0000 (09:39 -0700)]
sparc64: Allow redirection of MSI/MSI-X IRQs

Allows redirection of MSI/MSI-X IRQs by finding appropriate MSIEQ and
re-routing its IRQ. Also handles driver IRQs sharing the same MSIEQ.
Affinity masks for all such shared interrupts as well as MSIQ IRQ
are modified. Note, based on the HW sharing this patch can change
related driver IRQs in an invisible manner. While confusing and not
desirable, this is an artifact of the HW design.

Orabug: 22749960

Signed-off-by: Chris Hyser <chris.hyser@oracle.com>
(cherry picked from commit 914901044c1a028185326eb1a3c8821cab8845be)
(cherry picked from commit 98069630a58903f6ec29aaf784f24b44c27a0db0)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: use COMMAND_LINE_SIZE for boot string
Allen Pais [Sat, 6 Feb 2016 05:14:23 +0000 (10:44 +0530)]
sparc64: use COMMAND_LINE_SIZE for boot string

    Orabug: 19722011

    original patch by Bob Picco

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Cc: Bob Picco <bob.picco@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
(cherry picked from commit 1a9bf6b57dbfcc4ec8e8d98bd20b7975f4b4934f)
(cherry picked from commit 017214c5742ee92e3270024c4cce1cecb793ac1c)

8 years agosparc64: crypto camellia opcode error fix
Allen Pais [Thu, 29 May 2014 11:18:33 +0000 (16:48 +0530)]
sparc64: crypto camellia opcode error fix

Orabug: 23128525

Signed-off-by: Allen Pais <allen.pais@oracle.com>
(cherry picked from commit fc1b755de4250245961b226da41d10f066467926)
(cherry picked from commit c6cb169240529eb974a5846e55e622001973b79f)
(cherry picked from commit 8d140eb4166d127dc0f64595ec17e441beb4b47c)

8 years agosparc64: node_random needs attention
bob picco [Thu, 28 Feb 2013 15:11:27 +0000 (10:11 -0500)]
sparc64: node_random needs attention

Seriously node_random will have to be hooked into sparc.

Orabug: 23128525

Signed-off-by: Bob Picco <bob.picco@oracle.com>
(cherry picked from commit 9c8ab6e8096ddf1814df8503cdd10ee83b4ddf9a)
(cherry picked from commit 640de4e021c24037420ddb4c52cc91b002d72ad7)

Conflicts:
kernel/fork.c
Signed-off-by: Allen Pais <allen.pais@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
(cherry picked from commit 07bb1228d250a4e3003ccf317da22c06310b8607)
(cherry picked from commit cdeddef5edf0de95cff6ca8c8b7efe94322492d7)

8 years agosparc64: nr_cpus and nodes_shift
bob picco [Mon, 18 Mar 2013 18:31:54 +0000 (14:31 -0400)]
sparc64: nr_cpus and nodes_shift

This is being done for M5 and the like.

To go beyond the NR_CPUS limit of 4064, the issue in cpu mondo -
init_cpu_send_mondo_info - needs to be addressed and appears possible.

Orabug: 23128525

Signed-off-by: Bob Picco <bob.picco@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
(cherry picked from commit d8ce9cc00181bfa65865c6d1624f0dcb3d048a7b)
(cherry picked from commit ce753fe5d10682939912242c9880935472f1e195)

Conflicts:
arch/sparc/Kconfig

Signed-off-by: Allen Pais <allen.pais@oracle.com>
(cherry picked from commit 48df0cc664ddfb2f03dc1afbb3ff01a3192c9723)
(cherry picked from commit fdb632ef6a250d24887003cc35b72744183c8642)

8 years agosparc64: struct adi_caps should use __u64, not u64
Khalid Aziz [Wed, 2 Mar 2016 20:03:53 +0000 (13:03 -0700)]
sparc64: struct adi_caps should use __u64, not u64

struct adi_caps uses u64 as the type for its field which is not
defined for include/uapi. Change it to __u64.

Orabug: 22713162

Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
(cherry picked from commit 4b47a697322066fcd6cf0f4637dece26da3525fc)

Conflicts:
include/uapi/linux/prctl.h

Signed-off-by: Allen Pais <allen.pais@oracle.com>
(cherry picked from commit 858864aea91eb7a1337cedd70a01ffb3fb5d898a)
(cherry picked from commit acf5580a66da8aae303a42af49de27d7500651cc)

8 years agoIPMI: Driver for Sparc T4/T5/T7 Platforms
Rob Gardner [Tue, 9 Feb 2016 22:38:05 +0000 (15:38 -0700)]
IPMI: Driver for Sparc T4/T5/T7 Platforms

Functional IPMI interface driver for Sparc T4/T5/T7. This will
probably also work for other platforms that use an iLOM channel
for IPMI services, including older and future ones, though these
have not been tested.

This driver provides the transport between the IPMI message layer
and the Sparc platform IPMI endpoint in iLOM. The Virtual Logical
Domain Channel (VLDC) driver claims the host endpoint, and we call
it to move data to/from iLOM. So there is an unusual dependency
on another loadable module which requires several compromises
until we work out a plan to restructure the VLDC driver to provide
a cleaner interface:

 * An artificial symbolic dependency on vldc is created so that
   "modprobe ipmi_si" will ensure that vldc is loaded also.

 * ipmi_vldc uses filp_open/kernel_read/kernel_write on device
   files provided by vldc, ie, /sys/class/vldc/ipmi/mode and
   /dev/vldc/ipmi.

Bug 22804422 has been created to deal with these issues.

Sending this driver upstream is on hold until we work out these
issues. Also, the vldc driver itself has not yet been sent upstream
and that is obviously a prerequisite.

Orabug: 22658348

Signed-off-by: Rob Gardner <rob.gardner@oracle.com>
(cherry picked from commit 6083e586b068ae159c8335adc2d210e7b7f66d27)
(cherry picked from commit 9944e6442b962c2945f2a59ef7c6ff81d0e95172)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
(cherry picked from commit e76d315b514e424a8623c51eaa526a6d2ac52a89)
(cherry picked from commit dfcab0a3eef7ebd4cc2fda9865f42ff114b46459)

9 years agoSPARC64: UEK4 LDOMS DOMAIN SERVICES UPDATE 4
Aaron Young [Thu, 2 Jun 2016 14:55:09 +0000 (10:55 -0400)]
SPARC64: UEK4 LDOMS DOMAIN SERVICES UPDATE 4

This update provides the following fixes for LDom domain services on UEK4.

1. DS service registration with major ver 0.
2. Kernel NULL pointer dereference in vlds driver at shutdown.

Signed-off-by: Aaron Young <aaron.young@oracle.com>
Reviewed-by: Liam Merwick <Liam.Merwick@oracle.com>
Orabug: 23292083,23504208

9 years agofix-up - add back include of linux/hugetlb.h
Chuck Anderson [Wed, 1 Jun 2016 00:58:52 +0000 (17:58 -0700)]
fix-up - add back include of linux/hugetlb.h

Orabug: 22729791

Commit:
5075a47f3765e778b45367ba4873c1bd08b21d0e
fix-up code base for v4.1.12-46 merge
should not have removed "#include <linux/hugetlb.h>"
Add it back in after applying adfc71b605:
    fix-up - add back include of linux/dtrace_os.h
so that it will merge with master.

Signed-off-by: Chuck Anderson <chuck.anderson@oracle.com>
9 years agofix-up - add back include of linux/dtrace_os.h
Chuck Anderson [Wed, 1 Jun 2016 00:47:25 +0000 (17:47 -0700)]
fix-up - add back include of linux/dtrace_os.h

Orabug: 22729791

Commit:
bd52d0fd57c96146f8d1838588753ab9dabcd2fe:
sparc64: Log warning for invalid hugepages boot param
removes "#include <linux/dtrace_os.h>" from arch/sparc/mm/fault_64.c.
That header file is needed by dtrace.  Add it back in.

Signed-off-by: Chuck Anderson <chuck.anderson@oracle.com>
9 years agofix-up code base for v4.1.12-46 merge
Chuck Anderson [Mon, 30 May 2016 10:03:02 +0000 (03:03 -0700)]
fix-up code base for v4.1.12-46 merge

Orabug: 22729791

Commit:
bd52d0fd57c96146f8d1838588753ab9dabcd2fe:
sparc64: Log warning for invalid hugepages boot param
Removes "#include <linux/dtrace_os.h>" from arch/sparc/mm/fault_64.c.

The topic/uek-4.1/sparc code base has:
    #include <linux/context_tracking.h>
    #include <linux/hugetlb.h>
    #include <linux/dtrace_os.h>

v4.1.12-46 has:
    #include <linux/context_tracking.h>
    #include <linux/dtrace_os.h>

Remove "#include <linux/hugetlb.h>" so that bd52d0fd57 will merge with
v4.1.12-46.

Signed-off-by: Chuck Anderson <chuck.anderson@oracle.com>
9 years agoSPARC64: UEK4 LDOMS DOMAIN SERVICES UPDATE 3
Aaron Young [Tue, 1 Mar 2016 15:47:02 +0000 (07:47 -0800)]
SPARC64: UEK4 LDOMS DOMAIN SERVICES UPDATE 3

  This update provides the following fix for LDom domain services on UEK4.

  1. Add an event to the vlds driver which is used to signal
  process(es) using libds that the vlds /dev devices have been updated.
  When it receives this event, libds will refresh/update it's internal
  list of vlds devices allowing the list to stay immediately up-to-date
  when vlds devices have changed. This event fixes some DR related libds
  problems found during regression testing due to libds internal vlds
  device list becoming stale.

Signed-off-by: Aaron Young <aaron.young@oracle.com>
Reviewed-by: Alexandre Chartre <Alexandre.Chartre@oracle.com>
  Orabug: 22853109

(cherry picked from commit 1722beeac0278656731b8f0da394fb2f6a0b17b3)
(cherry picked from commit 80d160e808f283c1438e8681eedfee287f53a955)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
9 years agoInterface to mark SR-IOV device ready for use by LDoms guest
Alexandre Chartre [Thu, 17 Mar 2016 10:31:24 +0000 (03:31 -0700)]
Interface to mark SR-IOV device ready for use by LDoms guest

Add a iov_ready file to all PCI devices (/sys/bus/pci/devices/*/iov_ready).
The iov_ready file is write only, and mapped to the pci_iov_dev_ready
hypervisor call, which is used to indicate that a PCI device is ready
or no longer ready to be shared with other domains

Write "1" to the file to indicate that the PCI device is ready.
For example:

  # echo 1 > /sys/bus/pci/devices/0001:03:00.0/iov_ready

Write "0" to the file to indicate that the PCI device is no longer ready.
For example:

  # echo 0 > /sys/bus/pci/devices/0001:03:00.0/iov_ready

Orabug: 22909608

Signed-off-by: Alexandre Chartre <alexandre.chartre@oracle.com>
Reviewed-by: Babu Moger <babu.moger@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
(cherry picked from commit 14f6e82264924f1db2cad628edae7964caa9c03e)

9 years agoMerge remote-tracking branch 'shaggy/kexec-uek4-sparc' into sparc
Allen Pais [Tue, 24 May 2016 05:31:28 +0000 (11:01 +0530)]
Merge remote-tracking branch 'shaggy/kexec-uek4-sparc' into sparc

Orabug: 21864391

Signed-off-by: Allen Pais <allen.pais@oracle.com>
9 years agosparc64: Log warning for invalid hugepages boot param
Vijay Kumar [Wed, 9 Mar 2016 19:48:38 +0000 (11:48 -0800)]
sparc64: Log warning for invalid hugepages boot param

When an invalid hugepage param is mentioned in kernel boot param,
appropriate warning should be logged to indicate if it's not
a) software supported
b) MMU support for xl_hugepagesz
c) xl_hugepagesz not in use

Signed-off-by: Bob Picco <bob.picco@oracle.com>
Signed-off-by: Vijay Kumar <vijay.ac.kumar@oracle.com>
Acked-by: Nitin Gupta <nitin.m.gupta@oracle.com>
Orabug: 22729791
Signed-off-by: Allen Pais <allen.pais@oracle.com>
9 years agosparc64: xl-hugepages
Vijay Kumar [Thu, 28 Apr 2016 17:27:43 +0000 (10:27 -0700)]
sparc64: xl-hugepages

Note: Resending this patch. There is no change in this patch since v1.

Jalap?no was verified repaired.

Now to find performance issues.

One performance issue is subordinate page table state (SPTS). The SPTS will
be tricky because of protection changes for COW and other. For example,
a 2Gb hugepage will have 1UL << (31-23) PMD entries. Do we want 256 IPI-s
for a hugepage TTE(pte) change?

Signed-off-by: Bob Picco <bpicco@meloft.net>
(cherry picked from commit ece059b2e2581a2dcda3fb1ca35cd31258f6ed03)

Conflicts:
    arch/sparc/include/asm/mmu_64.h
    arch/sparc/mm/fault_64.c

Signed-off-by: Vijay Kumar <vijay.ac.kumar@oracle.com>
Acked-by: Nitin Gupta <nitin.m.gupta@oracle.com>
Orabug: 22729791
Signed-off-by: Allen Pais <allen.pais@oracle.com>
9 years agosparc64: Fix I/O NUMA parsing and sysfs display code.
chris hyser [Fri, 1 Apr 2016 19:44:22 +0000 (12:44 -0700)]
sparc64: Fix I/O NUMA parsing and sysfs display code.

I/O NUMA node parsing has been broke since T5 and did not work on
T7. The code also did not correctly handle PCIe root complexes
crossbar connected to multiple memory/cpu NUMA nodes. Additionally,
the numa_node attributes displayed in sysfs were incorrect.

Example: T7-4 showing round-robin spread of multiply connected root
complexes.

[ 3723.288247] /pci@305: On NUMA node 0
[ 3723.363398] /pci@304: On NUMA node 2
[ 3723.437486] /pci@307: On NUMA node 0
[ 3723.510510] /pci@306: On NUMA node 2
[ 3723.582582] /pci@313: On NUMA node 0
[ 3723.655276] /pci@308: On NUMA node 2
[ 3723.728077] /pci@302: On NUMA node 0
[ 3723.800774] /pci@30a: On NUMA node 2
[ 3723.874895] /pci@309: On NUMA node 0
[ 3723.947089] /pci@301: On NUMA node 2
[ 3724.020218] /pci@30b: On NUMA node 1
[ 3724.092902] /pci@300: On NUMA node 3
[ 3724.167630] /pci@303: On NUMA node 1
[ 3724.240287] /pci@30c: On NUMA node 3
[ 3724.312245] /pci@312: On NUMA node 1
[ 3724.384857] /pci@30e: On NUMA node 3
[ 3724.457482] /pci@30d: On NUMA node 1
[ 3724.531679] /pci@310: On NUMA node 3
[ 3724.603621] /pci@30f: On NUMA node 1
[ 3724.675695] /pci@311: On NUMA node 3

Orabug: 22748961

Signed-off-by: Chris Hyser <chris.hyser@oracle.com>
9 years agosparc64: Set up core sibling list correctly for T7.
chris hyser [Thu, 7 Apr 2016 20:55:56 +0000 (13:55 -0700)]
sparc64: Set up core sibling list correctly for T7.

The important definition of core sibling is that some level of cache is shared.
The prior SPARC notion of socket was defined as highest level of shared cache.
On T7 platforms, the MD record now describes the CPUs that share the physical
socket and this is no longer tied to shared cache. This patch correctly
separates these two concepts.

Before:
[root@ca-sparc30 topology]# cat core_siblings_list
32-63,128-223

After:
[root@ca-sparc30 topology]# cat core_siblings_list
32-63

OraBug 22748950

Signed-off-by: Chris Hyser <chris.hyser@oracle.com>
9 years agosparc64: Fix CPU package information in /sys
chris hyser [Thu, 7 Apr 2016 19:12:05 +0000 (12:12 -0700)]
sparc64: Fix CPU package information in /sys

CPU package information in
/sys/bus/cpu/devices/cpu*/topology/physical_package_id
is inconisistent with the use by tools such as irqbalance. This patch
uses the socket ID to be consistent and useful.

Orabug: 22748950

Signed-off-by: Chris Hyser <chris.hyser@oracle.com>
9 years agosparc64: Add 3rd level cache info to /sys
chris hyser [Thu, 7 Apr 2016 19:32:48 +0000 (12:32 -0700)]
sparc64: Add 3rd level cache info to /sys

This patch pulls line size and cache size info from the machine description and
adds l3 caches files to /sys/bus/cpu/devices/cpu* directories. It also
structures the information in the same directory hierachy as x86 so that user
programs like irqbalance can find the needed information to work correctly.

> ls /sys/bus/cpu/devices/cpu*
clock_tick           l1_dcache_size       l2_cache_line_size  l3_cache_size
crash_notes          l1_icache_line_size  l2_cache_size       node0
l1_dcache_line_size  l1_icache_size       l3_cache_line_size  topology

Sample results on a T7-4:

> cat /sys/bus/cpu/devices/cpu*/l3*
64
8388608

/sys/bus/cpu/devices/cpu*/cache/index0/:
coherency_line_size  level  shared_cpu_list  shared_cpu_map  size  type

/sys/bus/cpu/devices/cpu*/cache/index1/:
coherency_line_size  level  shared_cpu_list  shared_cpu_map  size  type

/sys/bus/cpu/devices/cpu*/cache/index2/:
coherency_line_size  level  shared_cpu_list  shared_cpu_map  size  type

/sys/bus/cpu/devices/cpu*/cache/index3/:
coherency_line_size  level  shared_cpu_list  shared_cpu_map  size  type

cat /sys/bus/cpu/devices/cpu32/cache/index3/*
64
3
32-63,128-223
0,ffffffff,ffffffff,ffffffff,00000000,00000000,ffffffff,00000000
8388608
Unified

Orabug: 22748950

Signed-off-by: Chris Hyser <chris.hyser@oracle.com>
9 years agosparc64: Add lightweight syscall mechanism for lwp_info
Rob Gardner [Sun, 27 Mar 2016 22:39:13 +0000 (16:39 -0600)]
sparc64: Add lightweight syscall mechanism for lwp_info

This patch introduces a new "light weight" system call
mechanism which has the ability to retrieve small bits
of information and/or perform minor computations without
the need for a full blown save/switch/restore context.

Solaris provides _lwp_info(), which returns basically the
same information as getrusage(RUSAGE_THREAD) but much faster.
This is used extensively by the database code, and returns
the utime and stime for the calling thread.

(This patch also provides a fast getcpu function just as
a demonstration of how additional calls might be added.
Unlike x86, there is no unprivileged instruction to do this,
and so it is a fairly expensive system call.)

Orabug: 22952506

Signed-off-by: Rob Gardner <rob.gardner@oracle.com>
9 years agosparc64: correctly recognize sparc M8 cpu
Allen Pais [Mon, 16 Nov 2015 10:17:27 +0000 (15:47 +0530)]
sparc64: correctly recognize sparc M8 cpu

 This patch detects Sparc M8 cpu type.

Orabug: 23130139

Signed-off-by: Allen Pais <allen.pais@oracle.com>
(cherry picked from commit d3ae0cafd1576f4660c9b44fa08b4cecee04f8a8)

9 years agosparc64: correctly recognize Sonoma chips
Allen Pais [Tue, 19 Apr 2016 12:39:08 +0000 (18:09 +0530)]
sparc64: correctly recognize Sonoma chips

The following patch adds support for correctly
recognizing Sonoma chips.

cpu : Unknown SUN4V CPU
fpu : Unknown SUN4V FPU
pmu : Unknown SUN4V PMU

Orabug: 22088766

Signed-off-by: Allen Pais <allen.pais@oracle.com>
9 years agoarch/sparc: Sonoma epsc group patch
Joe Moriarty [Fri, 8 Apr 2016 18:29:21 +0000 (14:29 -0400)]
arch/sparc: Sonoma epsc group patch

Needed for Sonoma IB software support.

Orabug: 23055865
Signed-off-by: Joe Moriarty <joe.moriarty@oracle.com>
Acked-by: Babu Moger <babu.moger@oracle.com>
(cherry picked from commit bf199cb83bd83643b223a0504d2f41ed793812ef)

9 years agoarch/sparc: Sonoma piggyback patch
Joe Moriarty [Fri, 8 Apr 2016 18:26:12 +0000 (14:26 -0400)]
arch/sparc: Sonoma piggyback patch

Needed for Sonoma IB software support.

Orabug: 23055807
Signed-off-by: Joe Moriarty <joe.moriarty@oracle.com>
Acked-by: Karl Volz <karl.volz@oracle.com>
(cherry picked from commit a63fc712b3ceb2007ad5da3db6a5cae27d906208)

9 years agosparc64:piggback program generates a.out header with incorrect section sizes
Allen Pais [Tue, 29 Mar 2016 08:50:33 +0000 (14:20 +0530)]
sparc64:piggback program generates a.out header with incorrect section sizes

piggyback in uek for SPARC generates an a.out that has section sizes that are
too large.  This causes problems when booting with OpenBoot because OpenBoot
uses those sizes to map and copy the image to its specified VA and runs into
unmapped memory during the copies.

This is a minimal fix.

Orabug:21793535

Signed-off-by: Jose Marchesi <jose.marchesi@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
(cherry picked from commit bd99ee7ceffb1a472ccd8841dd7011d15e7fa258)

9 years agoAdd sun4v_wdt watchdog driver
wim.coekaerts@oracle.com [Fri, 29 Jan 2016 17:39:38 +0000 (09:39 -0800)]
Add sun4v_wdt watchdog driver

This driver adds sparc hypervisor watchdog support. The default
timeout is 60 seconds and the range is between 1 and
31536000 seconds. Both watchdog-resolution and
watchdog-max-timeout MD properties settings are supported.

Signed-off-by: Wim Coekaerts <wim.coekaerts@oracle.com>
Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
(cherry picked from commit eccc96426978c0fa963f8712077ecb6247f0e57e)

9 years agoRevert "Add sun4v_wdt watchdog driver"
Allen Pais [Tue, 19 Apr 2016 12:29:26 +0000 (17:59 +0530)]
Revert "Add sun4v_wdt watchdog driver"

This reverts commit d153ba1897b562594f98b91e12d62e69018ad990.

9 years agosparc/PCI: Fix for panic while enabling SR-IOV
Babu Moger [Mon, 21 Mar 2016 17:11:19 +0000 (10:11 -0700)]
sparc/PCI: Fix for panic while enabling SR-IOV

Orabug: 22659268

We noticed this panic while enabling SR-IOV in sparc.

ixgbe 0002:03:00.0 eth4: SR-IOV enabled with 2 VFs
ixgbe 0002:03:00.0: Multiqueue Enabled: Rx Queue count = 4,
Tx Queue count = 4
ixgbevf: Intel(R) 10 Gigabit PCI Express Virtual Function
Network Driver - version 2.12.1-k
ixgbevf: Copyright (c) 2009 - 2012 Intel Corporation.
Unable to handle kernel NULL pointer dereference
tsk->{mm,active_mm}->context = 000000000000160c
tsk->{mm,active_mm}->pgd = fff8000408238000
              \|/ ____ \|/
              "@'/ .. \`@"
              /_| \__/ |_\
                 \__U_/
modprobe(3335): Oops [#1]
CPU: 2 PID: 3335 Comm: modprobe Tainted: G           OE
4.1.12-32.el6uek.sparc64 #1
task: fff8000406f35ca0 ti: fff8000404630000 task.ti: fff8000404630000
TSTATE: 0000008411001606 TPC: 0000000000438ee0 TNPC: 0000000000438f0c
Y: 00000000 Tainted: G           OE
TPC: <dma_supported+0x20/0x80>
g0: 0000000080000001 g1: 0000000000000000 g2: 00000000ffffffff
g3: 0000000000000003
g4: fff8000406f35ca0 g5: fff800041896a000 g6: fff8000404630000
g7: 0000000000000000
o0: 0000000000000000 o1: 0000000000000300 o2: 000000000000000
1o3: 0000000000000004
o4: fff80004122160d8 o5: 0000000000e37ae5 sp: fff8000404632951
ret_pc: 00000000007215d0
RPC: <pci_enable_device+0x10/0x40>
l0: fff8000404410090 l1: fff800040441013e l2: 00000000007a768c
l3: 0000000000000001
l4: fff80004046331d8 l5: fff80004046331f0 l6: e000000000000000
l7: 0040000000000000
i0: fff8000404410090 i1: ffffffffffffffff i2: fff8000404410180
i3: 00000000004ace40
i4: 0000000000000000 i5: 2000000000000000 i6: fff8000404632a0
1i7: 0000000010550ea0
I7: <ixgbevf_probe+0x80/0x4c0 [ixgbevf]>
Call Trace:
 [0000000010550ea0] ixgbevf_probe+0x80/0x4c0 [ixgbevf]
 [00000000007229d4] local_pci_probe+0x34/0xa0
 [0000000000722ae8] pci_call_probe+0xa8/0xe0
 [0000000000722dd0] pci_device_probe+0x50/0x80
 [000000000079c1c0] really_probe+0x140/0x420
 [000000000079c4e4] driver_probe_device+0x44/0xa0
 [000000000079c5c8] __driver_attach+0x88/0xa0
 [000000000079a3cc] bus_for_each_dev+0x6c/0xa0
 [000000000079bd5c] driver_attach+0x1c/0x40
 [000000000079ae1c] bus_add_driver+0x17c/0x220
 [000000000079cd94] driver_register+0x74/0x120
 [0000000000722ebc] __pci_register_driver+0x3c/0x60
 [0000000010558048] ixgbevf_init_module+0x48/0x5c [ixgbevf]
 [0000000000426bb8] do_one_initcall+0xb8/0x200
 [00000000004e5f8c] do_init_module+0x4c/0x1c0
 [00000000004e6f48] load_module+0x5e8/0x780
Disabling lock debugging due to kernel taint
Caller[0000000010550ea0]: ixgbevf_probe+0x80/0x4c0 [ixgbevf]
Caller[00000000007229d4]: local_pci_probe+0x34/0xa0
Caller[0000000000722ae8]: pci_call_probe+0xa8/0xe0
Caller[0000000000722dd0]: pci_device_probe+0x50/0x80
Caller[000000000079c1c0]: really_probe+0x140/0x420
Caller[000000000079c4e4]: driver_probe_device+0x44/0xa0
Caller[000000000079c5c8]: __driver_attach+0x88/0xa0
Caller[000000000079a3cc]: bus_for_each_dev+0x6c/0xa0
Caller[000000000079bd5c]: driver_attach+0x1c/0x40
Caller[000000000079ae1c]: bus_add_driver+0x17c/0x220
Caller[000000000079cd94]: driver_register+0x74/0x120
Caller[0000000000722ebc]: __pci_register_driver+0x3c/0x60
Caller[0000000010558048]: ixgbevf_init_module+0x48/0x5c [ixgbevf]
Caller[0000000000426bb8]: do_one_initcall+0xb8/0x200
Caller[00000000004e5f8c]: do_init_module+0x4c/0x1c0
Caller[00000000004e6f48]: load_module+0x5e8/0x780
Caller[00000000004e7184]: SyS_init_module+0xa4/0xe0
Caller[0000000000406254]: linux_sparc_syscall+0x34/0x44
Caller[0000000000103490]: 0x103490
Instruction DUMP: 8530b020  80a64002  1860000c <c200625c>
840e4001  80a08001  02400009  90102001  c45e2088
Kernel panic - not syncing: Fatal exception
Press Stop-A (L1-A) to return to the boot prom
---[ end Kernel panic - not syncing: Fatal exception

Details:
Here is the call sequence
virtfn_add->__mlx4_init_one->dma_set_mask->dma_supported

The panic happened at line 760(file arch/sparc/kernel/iommu.c)

758 int dma_supported(struct device *dev, u64 device_mask)
759 {
760         struct iommu *iommu = dev->archdata.iommu;
761         u64 dma_addr_mask = iommu->dma_addr_mask;
762
763         if (device_mask >= (1UL << 32UL))
764                 return 0;
765
766         if ((device_mask & dma_addr_mask) == dma_addr_mask)
767                 return 1;
768
769 #ifdef CONFIG_PCI
770         if (dev_is_pci(dev))
771 return pci64_dma_supported(to_pci_dev(dev), device_mask);
772 #endif
773
774         return 0;
775 }
776 EXPORT_SYMBOL(dma_supported);

Same panic happened with Intel ixgbe driver also.

SR-IOV code looks for arch specific data while enabling
VFs. When VF device is added, driver probe function makes set
of calls to initialize the pci device. Because the VF device is
added different way than the normal PF device(which happens via
of_create_pci_dev for sparc), some of the arch specific initialization
does not happen for VF device.  That causes panic when archdata is
accessed.

To fix this, I have used already defined weak function
pcibios_setup_device to copy archdata from PF to VF.
Also verified the fix.

Signed-off-by: Babu Moger <babu.moger@oracle.com>
Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Reviewed-by: Ethan Zhao <ethan.zhao@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
(cherry picked from commit be81c7e3cc48d3ff8b26021be3fd49e997743cbc)

9 years agosparc64: enable "relaxed ordering" in IOMMU mappings
chris hyser [Thu, 4 Feb 2016 21:14:43 +0000 (13:14 -0800)]
sparc64: enable "relaxed ordering" in IOMMU mappings

Enable relaxed ordering for memory writes in IOMMU TSB entry from
dma_4v_map_page() and dma_4v_map_sg() when dma_attrs
DMA_ATTR_WEAK_ORDERING is set. This requires vPCI version 2.0 API.

Orabug: 19245907

Signed-off-by: Chris Hyser <chris.hyser@oracle.com>
(cherry picked from commit d61b9f04493d2a0508c58b6f663c86d6441e1c42)

9 years agosparc64: Enable PCI IOMMU version 2 API
chris hyser [Thu, 4 Feb 2016 20:07:03 +0000 (12:07 -0800)]
sparc64: Enable PCI IOMMU version 2 API

Enable Version 2 of the PCI IOMMU API needed for advanced features
such as PCI Relaxed Ordering and greater than 2 GB DMA address
space per root complex.

Signed-off-by: Chris Hyser <chris.hyser@oracle.com>
(cherry picked from commit f79d44785c80c5e626ee026e4e001f0c30958a82)

9 years agosunvnet: perf tracepoint invocations to trace LDC state machine
Sowmini Varadhan [Tue, 2 Feb 2016 18:41:56 +0000 (10:41 -0800)]
sunvnet: perf tracepoint invocations to trace LDC state machine

Use sunvnet perf trace macros to monitor LDC message exchange state.

Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 5fa4282fdb6d30937abcf1b1a9d367aaf472178a)

9 years agosunvnet: Add support for perf LDC event tracing
Sowmini Varadhan [Tue, 2 Feb 2016 18:41:55 +0000 (10:41 -0800)]
sunvnet: Add support for perf LDC event tracing

Add perf event macros for support of tracing and instrumentation
of LDC state machine

Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 61cf74d322a9d8ef172251e32c3008cf60964b70)

9 years agoLDoms CPU Hotplug - fix interrupt redistribution.
Bijan Mottahedeh [Fri, 29 Jan 2016 02:25:03 +0000 (18:25 -0800)]
LDoms CPU Hotplug - fix interrupt redistribution.

Orabug: 22623753

- Disable cpu timer only for hot-remove and not for hot-add
- Update interrupt affinities before interrupt redistribution
- Default to simple round-robin interrupt redistribution for ldoms

Signed-off-by: Bijan Mottahedeh <bijan.mottahedeh@oracle.com>
(cherry picked from commit 40110bd3bf1d2188719cca6f7a32df7d722f42be)
(cherry picked from commit 69910784aff4cad929ed7b15b744249da57ffc01)

9 years agoLDoms CPU Hotplug - dynamic mondo queue allocation.
Bijan Mottahedeh [Fri, 29 Jan 2016 00:48:15 +0000 (16:48 -0800)]
LDoms CPU Hotplug - dynamic mondo queue allocation.

Orabug: 22620474

- Allocate mondo queues for present cpus only at boot time
- Allocate mondo queues dynamically and with proper alignment at hot-add

Signed-off-by: Bijan Mottahedeh <bijan.mottahedeh@oracle.com>
(cherry picked from commit 41f763e66dcbdb72632cd0675e2990085e47a527)
(cherry picked from commit fb59288f6c4e17eca98a6a38512c0c05d55ac8e9)

9 years agosparc64: bypass iommu to use 64bit address space
Tushar Dave [Thu, 7 Jan 2016 23:24:26 +0000 (15:24 -0800)]
sparc64: bypass iommu to use 64bit address space

This patch is internal only not for UPSTREAM. This is a temporary
workaround based on UEK2 commit c1a12ed1d125
("sparc64: enable iommu bypass workaround for IB. This is temporary.")

Current design of sparc iommu is based on iommu V1 APIs which at max
can have 2G/8K DMA addresses. Due to this, kernel entity (e.g. i40e,
PSIF) requesting more than 2G/8K DMA addresses does not work at all.
This patch adds temporary workaround to remedy this issue by bypassing
iommu.

When 64bit iommu implementation is complete, this workaround will be
reverted.

Orabug: 21149316
Signed-off-by: Tushar Dave <tushar.n.dave@oracle.com>
(cherry picked from commit d751c5e1e6575b1dc119383045ba488e0d30de4d)
(cherry picked from commit 2ecc8426003036609fc447c3cf2dcf54139770cf)

9 years agovmcore: quiet zero PT_NOTE warning
Dave Kleikamp [Wed, 20 Jan 2016 19:42:07 +0000 (13:42 -0600)]
vmcore: quiet zero PT_NOTE warning

When creating a crashdump, this warning shows up on the console
for every offline cpu:

Warning: Zero PT_NOTE entries found

For an ldom, every possible inactive cpu shows up as offline, so let's
just print the warning once.

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
9 years agosparc64: call crash_kexec() directly from die_if_kernel()
Dave Kleikamp [Thu, 4 Feb 2016 16:43:48 +0000 (10:43 -0600)]
sparc64: call crash_kexec() directly from die_if_kernel()

A direct call to crash_kexec() here allows the crashing register state
to be saved to the PT_NOTE. When called from panic(), a new register
state is created which is less useful.

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
9 years agosparc: After kexec, ldc_bind needs to reset rx_head
Dave Kleikamp [Tue, 17 Nov 2015 22:05:51 +0000 (16:05 -0600)]
sparc: After kexec, ldc_bind needs to reset rx_head

Orabug: 21627005

Occasionally, the crash kernel will fail to configure a virtual disk
because the hypervisor leaves an old request in the rx queue even after
it is reconfigured in ldc_bind(). Fix this with a call to ldc_rx_reset().

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
9 years agosparc: add FORCE_MAX_ZONEORDER
Dave Kleikamp [Fri, 6 Mar 2015 19:53:34 +0000 (13:53 -0600)]
sparc: add FORCE_MAX_ZONEORDER

Allow for a memory allocation large enough to load a kernel for
kexec in contiguous memory.

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
9 years agoreserve memory for elfcorehdr
Dave Kleikamp [Thu, 11 Sep 2014 16:15:22 +0000 (09:15 -0700)]
reserve memory for elfcorehdr

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
9 years agosparc64: crash kernel may only use reserved memory
Dave Kleikamp [Thu, 11 Sep 2014 20:13:53 +0000 (15:13 -0500)]
sparc64: crash kernel may only use reserved memory

In order to preserve the memory state of the original kernel, the
crash kernel may only use the memory reserved for it.

kexec-tools passes the reserved memory through the HdrS structure.

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
9 years agosparc: add crash dump support
Dave Kleikamp [Mon, 7 Jul 2014 18:38:17 +0000 (11:38 -0700)]
sparc: add crash dump support

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
9 years agosparc64: handle booting kernel from shim
Dave Kleikamp [Sat, 24 May 2014 00:03:16 +0000 (19:03 -0500)]
sparc64: handle booting kernel from shim

original patch by Bob Picco

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Cc: Bob Picco <bob.picco@oracle.com>
9 years agosparc64: capture obp information during boot
Dave Kleikamp [Fri, 23 May 2014 22:56:41 +0000 (17:56 -0500)]
sparc64: capture obp information during boot

original patch by Bob Picco

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Cc: Bob Picco <bob.picco@oracle.com>
9 years agosparc64: restore prom_cif_stack
Dave Kleikamp [Fri, 20 Mar 2015 21:38:42 +0000 (16:38 -0500)]
sparc64: restore prom_cif_stack

Commit ef3e035c stopped using the firmware stack and thus stopped saving
it's location in p1275buf. However, kexec wants to be using the firmware
stack when launching the new kernel.

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
9 years agosparc64: define CONFIG_KEXEC
Dave Kleikamp [Wed, 21 May 2014 19:21:36 +0000 (14:21 -0500)]
sparc64: define CONFIG_KEXEC

original patch by Bob Picco

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Cc: Bob Picco <bob.picco@oracle.com>
9 years agosparc64: new files: kexec_shim.S and machine_kexec.c
Dave Kleikamp [Fri, 23 May 2014 21:49:04 +0000 (16:49 -0500)]
sparc64: new files: kexec_shim.S and machine_kexec.c

original patch by Bob Picco

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Cc: Bob Picco <bob.picco@oracle.com>
9 years agokexec: Make kimage_alloc_pages() available to arch code
Dave Kleikamp [Thu, 4 Feb 2016 17:45:22 +0000 (11:45 -0600)]
kexec: Make kimage_alloc_pages() available to arch code

The sparc64 code wants to call this directly.

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
9 years agosparc64: add and call reserve_crashkernel
Dave Kleikamp [Fri, 23 May 2014 21:39:00 +0000 (16:39 -0500)]
sparc64: add and call reserve_crashkernel

original patch by Bob Picco

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Cc: Bob Picco <bob.picco@oracle.com>
9 years agokexec: Add kimage_arch_load_normal_segment to generic code
Dave Kleikamp [Fri, 23 May 2014 21:25:51 +0000 (16:25 -0500)]
kexec: Add kimage_arch_load_normal_segment to generic code

original patch by Bob Picco

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Cc: Bob Picco <bob.picco@oracle.com>
9 years agosparc64: kexec support for head_64.S
Dave Kleikamp [Fri, 23 May 2014 21:14:36 +0000 (16:14 -0500)]
sparc64: kexec support for head_64.S

original patch by Bob Picco

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Cc: Bob Picco <bob.picco@oracle.com>
9 years agoAdd kexec parameters to HdrS
Dave Kleikamp [Thu, 11 Sep 2014 19:12:53 +0000 (14:12 -0500)]
Add kexec parameters to HdrS

kexec needs to pass some values to the to-be-executed kernel. Like
silo, it finds the HdrS structure and modifies it. Increment the
version to 0x0302.

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
9 years agokexec: Define KEXEC_ARCH_SPARC64
Dave Kleikamp [Wed, 21 May 2014 19:36:18 +0000 (14:36 -0500)]
kexec: Define KEXEC_ARCH_SPARC64

original patch by Bob Picco

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Cc: Bob Picco <bob.picco@oracle.com>
9 years agosparc64: add arch/sparc/include/asm/kexec.h
Dave Kleikamp [Wed, 21 May 2014 19:26:54 +0000 (14:26 -0500)]
sparc64: add arch/sparc/include/asm/kexec.h

original patch by Bob Picco

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Cc: Bob Picco <bob.picco@oracle.com>
9 years agosparc64: define KEXEC_BASE
Dave Kleikamp [Wed, 21 May 2014 19:17:50 +0000 (14:17 -0500)]
sparc64: define KEXEC_BASE

original patch by Bob Picco

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Cc: Bob Picco <bob.picco@oracle.com>
9 years agosparc64: add sparc64_elf_core_copy_regs
Dave Kleikamp [Wed, 21 May 2014 18:58:40 +0000 (13:58 -0500)]
sparc64: add sparc64_elf_core_copy_regs

original patch by Bob Picco

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Cc: Bob Picco <bob.picco@oracle.com>
9 years agosparc: add sun4v_mmu_unmap_perm_addr
Dave Kleikamp [Wed, 21 May 2014 18:54:10 +0000 (13:54 -0500)]
sparc: add sun4v_mmu_unmap_perm_addr

original patch by Bob Picco

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Cc: Bob Picco <bob.picco@oracle.com>
9 years agosparc: add pci_sun4v_msiq_tear_down
Dave Kleikamp [Wed, 21 May 2014 18:37:15 +0000 (13:37 -0500)]
sparc: add pci_sun4v_msiq_tear_down

original patch by Bob Picco

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Cc: Bob Picco <bob.picco@oracle.com>
9 years agosparc64: chip handler IRQ cookie checking
Dave Kleikamp [Wed, 21 May 2014 18:33:21 +0000 (13:33 -0500)]
sparc64: chip handler IRQ cookie checking

original patch by Bob Picco

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Cc: Bob Picco <bob.picco@oracle.com>
9 years agosparc64: check for stopped cpu in smp_boot_one_cpu
Dave Kleikamp [Wed, 21 May 2014 18:30:49 +0000 (13:30 -0500)]
sparc64: check for stopped cpu in smp_boot_one_cpu

original patch by Bob Picco

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Cc: Bob Picco <bob.picco@oracle.com>
9 years agosparc64: call set_irq_reqs around generic_smp_call_function_interrupt call
Dave Kleikamp [Fri, 23 Oct 2015 16:31:06 +0000 (11:31 -0500)]
sparc64: call set_irq_reqs around generic_smp_call_function_interrupt call

original patch by Bob Picco

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Cc: Bob Picco <bob.picco@oracle.com>
9 years agosparc64: Fix perf performance counter overflow calculation
Dave Aldridge [Fri, 29 Jan 2016 11:03:10 +0000 (03:03 -0800)]
sparc64: Fix perf performance counter overflow calculation

If sparc_perf_event_update() is called between performcnce counter
overflow interrupts then everything is fine and the total event
count calculation is correct. If however, the
sparc_perf_event_update() is only called when the performance counter
overflows, we do not take the counter wrap into consideration.
This leaves us with an incorrect value for the total event count.

This patch fixes this issue by taking the counter overflow situation
into consideration.

Orabug: 22607658

Signed-off-by: Dave Aldridge <david.j.aldridge@oracle.com>
(cherry picked from commit 6c89361408f964ad2c2c29200987aece3a7c222d)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
9 years agosparc64: Fix for perf event counts sometimes reported as negative numbers
Dave Aldridge [Thu, 21 Jan 2016 14:17:11 +0000 (06:17 -0800)]
sparc64: Fix for perf event counts sometimes reported as negative numbers

Use an unsigned number to prevent sign extension in the calculation
to work out the difference between the previous and the current
count obtained from the perfomance instrumentation counters.

Orabug: 22607658

Signed-off-by: Dave Aldridge <david.j.aldridge@oracle.com>
(cherry picked from commit b0fb8b78a2cc452512296ce5bec1fa927ebf867e)
(cherry picked from commit da8cc212a978a1f54cadadeaabed46d9d5f839b3)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
9 years agosparc64: Fix numa node distance initialization
Nitin Gupta [Wed, 6 Jan 2016 06:35:35 +0000 (22:35 -0800)]
sparc64: Fix numa node distance initialization

Orabug: 22495713

Currently, NUMA node distance matrix is initialized only
when a machine descriptor (MD) exists. However, sun4u
machines (e.g. Sun Blade 2500) do not have an MD and thus
distance values were left uninitialized. The initialization
is now moved such that it happens on both sun4u and sun4v.

Signed-off-by: Nitin Gupta <nitin.m.gupta@oracle.com>
Tested-by: Mikael Pettersson <mikpelinux@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 36beca6571c941b28b0798667608239731f9bc3a)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
9 years agosparc64: fix incorrect sign extension in sys_sparc64_personality
Dmitry V. Levin [Sat, 26 Dec 2015 23:13:27 +0000 (02:13 +0300)]
sparc64: fix incorrect sign extension in sys_sparc64_personality

The value returned by sys_personality has type "long int".
It is saved to a variable of type "int", which is not a problem
yet because the type of task_struct->pesonality is "unsigned int".
The problem is the sign extension from "int" to "long int"
that happens on return from sys_sparc64_personality.

For example, a userspace call personality((unsigned) -EINVAL) will
result to any subsequent personality call, including absolutely
harmless read-only personality(0xffffffff) call, failing with
errno set to EINVAL.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 525fd5a94e1be0776fa652df5c687697db508c91)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
9 years agosparc64: Add ADI capability to cpu capabilities
Khalid Aziz [Thu, 17 Dec 2015 17:33:50 +0000 (10:33 -0700)]
sparc64: Add ADI capability to cpu capabilities

Add ADI (Application Data Integrity) capability to cpu capabilities list.
ADI capability allows virtual addresses to be encoded with a tag in
bits 63-60. This tag serves as an access control key for the regions
of virtual address with ADI enabled and a key set on them. Hypervisor
encodes this capability as "adp" in "hwcap-list" property in machine
description.

Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 82924e542f20e645bc7de86e2889fe3fb0858566)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
9 years agosunvnet: Initialize network_header and transport_header in vnet_rx_one()
Sowmini Varadhan [Mon, 18 Jan 2016 21:12:09 +0000 (16:12 -0500)]
sunvnet: Initialize network_header and transport_header in vnet_rx_one()

vnet_fullcsum() accesses ip_hdr() and transport header to compute
the checksum for IPv4 packets, so these need to be initialized in
skb created in vnet_rx_one().

Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
9 years agoAdd support for polling to the sunhv serial driver.
Allen Pais [Thu, 28 Jan 2016 18:05:58 +0000 (23:35 +0530)]
Add support for polling to the sunhv serial driver.

Oragbug: 21793591

Signed-off-by: Greg Onufer <greg.onufer@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
9 years agoAdd sun4v_wdt watchdog driver
Wim Coekaerts [Sun, 24 Jan 2016 23:59:22 +0000 (15:59 -0800)]
Add sun4v_wdt watchdog driver

This driver adds sparc hypervisor watchdog support. Timeout is set in
milliseconds since that is the granularity supported and it honors
the settings of both the watchdog-resolution and watchdog-max-timeout
MD properties.

Note that most watchdog drivers use timeout in seconds. This driver
requires timeout_ms as a module parameter and time in ms.

In this driver, the default is 60000ms or 60 seconds.

This driver also modifies hvcalls.S and changes sun4v_mach0_set_watchdog
such that it allows for NULL to be passed as 2nd parameter. This removes
the need to pass &time_remaining which is not useful.

Signed-off-by: Wim Coekaerts <wim.coekaerts@oracle.com>
9 years agosparc64: Make memory allocations ATOMIC to fix lockdep warnings
Babu Moger [Tue, 19 Jan 2016 19:16:43 +0000 (11:16 -0800)]
sparc64: Make memory allocations ATOMIC to fix lockdep warnings

Orabug: 22392548

Memory allocations are done holding spin_unlock_irqrestore with
non atomic flags. This was caught by lockdep as  below.

Make these allocations ATOMIC as these functions are always
called while holding the lock.

------------[ cut here ]------------
WARNING: at kernel/lockdep.c:2649 lockdep_trace_alloc+0xc0/0xe8()
Modules linked in:
Call Trace:
 [000000000047a304] warn_slowpath_common+0x4c/0x6c
 [000000000047a340] warn_slowpath_null+0x1c/0x2c
 [00000000004b0c70] lockdep_trace_alloc+0xc0/0xe8
 [0000000000554b64] kmem_cache_alloc_trace+0x18/0x1a8
 [00000000004540c8] ds_add_service_provider+0x58/0x120
 [0000000000454204] ds_add_builtin_services+0x74/0xac
 [000000000045450c] ds_probe+0x2d0/0x448
 [0000000000450d54] vio_device_probe+0xb0/0xd4
 [0000000000736e08] driver_probe_device+0x13c/0x234
 [0000000000736f60] __driver_attach+0x60/0x8c
 [0000000000736440] bus_for_each_dev+0x4c/0x9c
 [0000000000736b18] driver_attach+0x1c/0x30
 [0000000000735c58] bus_add_driver+0xcc/0x260
 [00000000007373d4] driver_register+0xc0/0x170
 [0000000000451414] vio_register_driver+0x18/0x40
 [0000000000cd2db4] ds_init+0x140/0x170
---[ end trace 139ce121c98e96c9 ]---

Also fixed the deadlock scenario showed by lockdep.

=======================================================
[ INFO: possible circular locking dependency detected ]
2.6.39-uek2-bm #35
-------------------------------------------------------
ldoms-ds/526 is trying to acquire lock:
 (&(&ds->ds_lock)->rlock){-.-...}, at:
[<0000000000455000>] ds_callout_thread+0x148/0x594

but task is already holding lock:
 (ds_data_lock){......}, at:
[<0000000000454fe4>] ds_callout_thread+0x12c/0x594

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-> #1 (ds_data_lock){......}:
       [<00000000008fc1f0>] _raw_spin_lock_irqsave+0x38/0x78
       [<0000000000454538>] ds_probe+0x2fc/0x448
       [<0000000000450d54>] vio_device_probe+0xb0/0xd4
       [<0000000000736e08>] driver_probe_device+0x13c/0x234
       [<0000000000736f60>] __driver_attach+0x60/0x8c
       [<0000000000736440>] bus_for_each_dev+0x4c/0x9c
       [<0000000000736b18>] driver_attach+0x1c/0x30
       [<0000000000735c58>] bus_add_driver+0xcc/0x260
       [<00000000007373d4>] driver_register+0xc0/0x170
       [<0000000000451414>] vio_register_driver+0x18/0x40
       [<0000000000cd2db4>] ds_init+0x140/0x170
       [<0000000000426e30>] do_one_initcall+0x70/0x150
       [<0000000000cca218>] kernel_init+0x100/0x190
       [<000000000042b82c>] kernel_thread+0x38/0x50
       [<00000000008e8474>] rest_init+0x20/0xc8

-> #0 (&(&ds->ds_lock)->rlock){-.-...}:
       [<00000000004b4ac8>] lock_acquire+0xa4/0xbc
       [<00000000008fc1f0>] _raw_spin_lock_irqsave+0x38/0x78
       [<0000000000455000>] ds_callout_thread+0x148/0x594
       [<000000000049ce5c>] kthread+0x64/0x78
       [<000000000042b82c>] kernel_thread+0x38/0x50
       [<000000000049cf84>] kthreadd+0x114/0x168

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(ds_data_lock);
                               lock(&(&ds->ds_lock)->rlock);
                               lock(ds_data_lock);
  lock(&(&ds->ds_lock)->rlock);

 *** DEADLOCK ***

1 lock held by ldoms-ds/526:
 #0:  (ds_data_lock){......}, at:
[<0000000000454fe4>] ds_callout_thread+0x12c/0x594

stack backtrace:
Call Trace:
 [00000000004b1f54] print_circular_bug+0x2b4/0x2c4
 [00000000004b3d4c] __lock_acquire+0x1428/0x1c08
 [00000000004b4ac8] lock_acquire+0xa4/0xbc
 [00000000008fc1f0] _raw_spin_lock_irqsave+0x38/0x78
 [0000000000455000] ds_callout_thread+0x148/0x594
 [000000000049ce5c] kthread+0x64/0x78
 [000000000042b82c] kernel_thread+0x38/0x50
 [000000000049cf84] kthreadd+0x114/0x168

Signed-off-by: Babu Moger <babu.moger@oracle.com>
Signed-off-by: Aaron Young <aaron.young@oracle.com>
(cherry picked from commit a065c92b422de2d2c21f81bc6c189bac07f57e8b)

9 years agosunvnet: hack to work around Solaris VIO bug
Sowmini Varadhan [Thu, 21 Jan 2016 12:09:49 +0000 (04:09 -0800)]
sunvnet: hack to work around Solaris VIO bug

Orabug 21895216

port workaround used for Bug 20455702:

This patch works around a problem where Solaris drops packets bound for
physical NICs (i.e., off host) that are using LSO and do not have the VIO v7
descriptor flags VNET_PKT_HASH, VNET_PKT_HCK_IPV4_HDRCKSUM,
VNET_PKT_HCK_FULLCKSUM set along with VNET_PKT_IPV4_LSO.

This patch can't go upstream because it doesn't actually support output
hashing (all packets will hash to '0'). The full and IPv4 header checksum
computations caused by the flags are unnecessary for Linux, but only affect
destinations through the vswitch.
(cherry picked from commit 3839694e54df457997025775894f954ea3185aff)

9 years agosparc64: fix FP corruption in user copy functions
Rob Gardner [Wed, 23 Dec 2015 06:24:49 +0000 (23:24 -0700)]
sparc64: fix FP corruption in user copy functions

Short story: Exception handlers used by some copy_to_user() and
copy_from_user() functions do not diligently clean up floating point
register usage, and this can result in a user process seeing invalid
values in floating point registers. This sometimes makes the process
fail.

Long story: Several cpu-specific (NG4, NG2, U1, U3) memcpy functions
use floating point registers and VIS alignaddr/faligndata to
accelerate data copying when source and dest addresses don't align
well. Linux uses a lazy scheme for saving floating point registers; It
is not done upon entering the kernel since it's a very expensive
operation. Rather, it is done only when needed. If the kernel ends up
not using FP regs during the course of some trap or system call, then
it can return to user space without saving or restoring them.

The various memcpy functions begin their FP code with VISEntry (or a
variation thereof), which saves the FP regs. They conclude their FP
code with VISExit (or a variation) which essentially marks the FP regs
"clean", ie, they contain no unsaved values. fprs.FPRS_FEF is turned
off so that a lazy restore will be triggered when/if the user process
accesses floating point regs again.

The bug is that the user copy variants of memcpy, copy_from_user() and
copy_to_user(), employ an exception handling mechanism to detect faults
when accessing user space addresses, and when this handler is invoked,
an immediate return from the function is forced, and VISExit is not
executed, thus leaving the fprs register in an indeterminate state,
but often with fprs.FPRS_FEF set and one or more dirty bits. This
results in a return to user space with invalid values in the FP regs,
and since fprs.FPRS_FEF is on, no lazy restore occurs.

This bug affects copy_to_user() and copy_from_user() for NG4, NG2,
U3, and U1. All are fixed by using a new exception handler for those
loads and stores that are done during the time between VISEnter and
VISExit.

n.b. In NG4memcpy, the problematic code can be triggered by a copy
size greater than 128 bytes and an unaligned source address.  This bug
is known to be the cause of random user process memory corruptions
while perf is running with the callgraph option (ie, perf record -g).
This occurs because perf uses copy_from_user() to read user stacks,
and may fault when it follows a stack frame pointer off to an
invalid page. Validation checks on the stack address just obscure
the underlying problem.

Orabug: 22506897

Signed-off-by: Rob Gardner <rob.gardner@oracle.com>
Signed-off-by: Dave Aldridge <david.j.aldridge@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit a7c5724b5c17775ca8ea2fd9906d8a7e37337cce)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
9 years agosparc64: Don't set %pil in rtrap_nmi too early
Rob Gardner [Tue, 22 Dec 2015 04:48:03 +0000 (21:48 -0700)]
sparc64: Don't set %pil in rtrap_nmi too early

Commit 28a1f53 delays setting %pil to avoid potential
hardirq stack overflow in the common rtrap_irq path.
Setting %pil also needs to be delayed in the rtrap_nmi
path for the same reason.

Orabug: 22322473

Signed-off-by: Rob Gardner <rob.gardner@oracle.com>
Signed-off-by: Dave Aldridge <david.j.aldridge@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 1ca04a4ce0d5131471c5a1fac76899dc2d9d3f36)

9 years agosparc64: 'NULL' char after break when sysrq enabled
Vijay Kumar [Wed, 23 Dec 2015 10:28:30 +0000 (02:28 -0800)]
sparc64: 'NULL' char after break when sysrq enabled

When sysrq is triggered from console, serial driver for SUN hypervisor
console receives a console break and enables the sysrq. It expects a valid
sysrq char following with break. Meanwhile if driver receives 'NULL'
ASCII char then it disables sysrq and sysrq handler will never be invoked.

This fix skips calling uart sysrq handler when 'NULL' is received while sysrq
is enabled.

Orabug: 22456721

Signed-off-by: Vijay Kumar <vijay.ac.kumar@oracle.com>
Acked-by: Karl Volz <karl.volz@oracle.com>
(cherry picked from commit 30ae1c049f8720f93e2b36f084448f6dc370d30b)

9 years agosparc64: Fix numa distance values
Nitin Gupta [Mon, 2 Nov 2015 21:30:24 +0000 (16:30 -0500)]
sparc64: Fix numa distance values

Orabug: 21896119

Use machine descriptor (MD) to get node latency
values instead of just using default values.

Testing:
On an T5-8 system with:
 - total nodes = 8
 - self latencies = 0x26d18
 - latency to other nodes = 0x3a598
   => latency ratio = ~1.5

output of numactl --hardware

 - before fix:

node distances:
node   0   1   2   3   4   5   6   7
  0:  10  20  20  20  20  20  20  20
  1:  20  10  20  20  20  20  20  20
  2:  20  20  10  20  20  20  20  20
  3:  20  20  20  10  20  20  20  20
  4:  20  20  20  20  10  20  20  20
  5:  20  20  20  20  20  10  20  20
  6:  20  20  20  20  20  20  10  20
  7:  20  20  20  20  20  20  20  10

 - after fix:

node distances:
node   0   1   2   3   4   5   6   7
  0:  10  15  15  15  15  15  15  15
  1:  15  10  15  15  15  15  15  15
  2:  15  15  10  15  15  15  15  15
  3:  15  15  15  10  15  15  15  15
  4:  15  15  15  15  10  15  15  15
  5:  15  15  15  15  15  10  15  15
  6:  15  15  15  15  15  15  10  15
  7:  15  15  15  15  15  15  15  10

Signed-off-by: Nitin Gupta <nitin.m.gupta@oracle.com>
Reviewed-by: Chris Hyser <chris.hyser@oracle.com>
Reviewed-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 52708d690b8be132ba9d294464625dbbdb9fa5df)

9 years agosparc64: Fix segfaults and incorrect data collection by perf
Dave Aldridge [Wed, 16 Dec 2015 17:04:25 +0000 (09:04 -0800)]
sparc64: Fix segfaults and incorrect data collection by perf

There are two perf problems addressed by this commit:

1) Perf doesn't produce totally accurate call graphs for the user
   space processes being analyzed. This is because the kernel's
   space identifier is used to access the user stack when a
   privileged context is interrupted by irq15 (perf counter
   interrupt).

2) Spurious segfaults and bus errors occur in random processes,
   including perf itself. This is caused by the same situation as
   above, but if the perf counter interrupt arrives in the middle of
   handling a fault (ie, TLB miss, page fault, etc), the running
   thread's fault address and/or fault code (in thread_info) can be
   inadvertantly modified by a nested fault, which makes the fault
   unresolvable, and the process is killed with a signal.
   This inadvertant modification happens because perf interrupt
   processing can (and will) incur a fault itself while walking
   the user stack, and this can overwrite the fault information
   for the handler that was interrupted.

Orabug: 22350940

Signed-off-by: Dave Aldridge <david.j.aldridge@oracle.com>
Signed-off-by: Rob Gardner <rob.gardner@oracle.com>
(cherry picked from commit 21c8eb7e6a89f6be2a90ab8044ff64ceea8c2b36)

9 years agoldoms: VDS panics with regular file backend.
Bijan Mottahedeh [Mon, 14 Dec 2015 13:21:57 +0000 (05:21 -0800)]
ldoms: VDS panics with regular file backend.
ldoms: VIO FLUSH not implemented correctly.

Orabug 22365411
Orabug 22365429

Signed-off-by: Bijan Mottahedeh <bijan.mottahedeh@oracle.com>
Reviewed-by: Alexandre Chartre <alexandre.chartre@oracle.com>
(cherry picked from commit 7062cbbda41153660c72ef51920ed2714947593e)

9 years agoi40e: Temporary workaround for DMA map issue
Tushar Dave [Thu, 10 Dec 2015 01:16:25 +0000 (17:16 -0800)]
i40e: Temporary workaround for DMA map issue

This is a quick temporary workaround for Bug 22107931.

iommu DMA map failure occurs when i40e saturate iommu with large number
of DMA map requests. e.g. System running 128 CPUs can maximum have 256K-1
entries in iommu table considering 8K page size and 32bit iommu (i.e.
2^31/PAGE_SIZE). On this system, i40e driver by default has 128 Queue Pairs
(QP) per interface. For each Rx queues, i40e by default, allocates 512 Rx
buffers which generates 64K DMA map requests. Four i40e interfaces will
generates total of 256K DMA map requests. That is beyond iommu can
accommodate and therefor results into DMA map failure.

The correct fix would be that i40e driver should not saturate iommu
resources and graciously bailout when DMA map failure occurs.

However, due severity of the issue and complexity involved implementing
correct resolution, this patch provides quick temporary workaround by
just limiting number of QP not to exceed 32.

For the record, QP equals 32 chosen because QP has to be power of 2 and we
can't have QP equals 64 because in that case number of DMA map requests for
Rx and Tx will be 256K and iommu can only accommodate 256K-1.
i.e.
 64 RX queues * 512 RX buffers = 32K , for 4 interfaces = 128K
 64 TX queues * 512 TX buffers = 32K , for 4 interfaces = 128K

When an appropriate fix (as mentioned above) is ready, this quick temporary
workaround will be removed.

Note:this temporary workaround can have negative impact on i40e network
performance.

Signed-off-by: Tushar Dave <tushar.n.dave@oracle.com>
9 years ago SPARC64: UEK4 LDOMS DOMAIN SERVICES UPDATE 2
Aaron Young [Thu, 10 Dec 2015 14:39:54 +0000 (06:39 -0800)]
SPARC64: UEK4 LDOMS DOMAIN SERVICES UPDATE 2

    This update provides fixes for LDom domain services on UEK4.
    Including:

    1. Add control vlds device for non-device specific operations.
    2. Allocate larger LDC rx/tx queues based on MTU - same
       algorithm as Solaris.
    3. Fix default MTU for all ds devices to 4096 bytes.

Signed-off-by: Aaron Young <aaron.young@oracle.com>
    Orabug: 22347667
(cherry picked from commit f2cf5889f22fd3d1062a7fe985a6ab574eebdbf5)

9 years agoVCC panics after guest is deleted.
Bijan Mottahedeh [Wed, 9 Dec 2015 10:16:57 +0000 (02:16 -0800)]
VCC panics after guest is deleted.
VCC sends HUP instead of BREAK.

Orabug: 21086161

Signed-off-by: Bijan Mottahedeh <bijan.mottahedeh@oracle.com>
Reviewed-by: Alexandre Chartre <alexandre.chartre@oracle.com>
(cherry picked from commit 15102643e10a87e3f238d225b8459f08240cd014)

9 years agoDo not execute i40e_macaddr_init if the macaddr is default
Sowmini Varadhan [Thu, 3 Dec 2015 02:59:19 +0000 (18:59 -0800)]
Do not execute i40e_macaddr_init if the macaddr is default

Orabug 22302847

If the macaddr is not from Open Firmwre or IDPROM (i.e., defaults
macaddr was used) then do not call i40e_macaddr_init again, else
you will get a driver init failure like this:

[ 8127.050926] WARNING: CPU: 18 PID: 878 at kernel/irq/manage.c:1346
+__free_irq+0x9f/0x230()
[ 8127.050927] Trying to free already-free IRQ 177
 :
[ 8127.051005]  [<ffffffff810dd7ef>] __free_irq+0x9f/0x230
[ 8127.051006]  [<ffffffff810dda1d>] free_irq+0x4d/0xb0
[ 8127.051013]  [<ffffffffa043ddd0>] i40e_clear_interrupt_scheme+0xb0/0xc0
+[i40e]
[ 8127.051018]  [<ffffffffa044b538>] i40e_probe.part.64+0x1018/0x1320 [i40e]
[ 8127.051023]  [<ffffffff813dfc2f>] ? acpi_ut_remove_reference+0x2f/0x33
[ 8127.051026]  [<ffffffff813dc79a>] ? acpi_rs_get_prt_method_data+0x50/0x6d
[ 8127.051029]  [<ffffffff8170b2b6>] ? mutex_lock+0x16/0x37
[ 8127.051034]  [<ffffffff81057e3e>] ? mp_map_pin_to_irq+0xee/0x250
[ 8127.051035]  [<ffffffff81058044>] ? mp_map_gsi_to_irq+0xa4/0xd0
[ 8127.051038]  [<ffffffff8104e404>] ? acpi_register_gsi_ioapic+0x54/0x1d0
[ 8127.051043]  [<ffffffff815c577e>] ? pci_conf1_read+0xbe/0x120
[ 8127.051045]  [<ffffffff815c99e3>] ? raw_pci_read+0x23/0x40
[ 8127.051048]  [<ffffffff813676f0>] ? pci_bus_read_config_word+0xa0/0xb0
[ 8127.051053]  [<ffffffff813709f0>] ? do_pci_enable_device+0xf0/0x120
[ 8127.051057]  [<ffffffffa044b862>] i40e_probe+0x22/0x30 [i40e]
                                     :
(cherry picked from commit 05cc3e25f20a1264f3045bcfbb810f7bc94e736d)

9 years agodrivers/pci: Update the quirks for megaraid_sas adapter
Babu Moger [Thu, 3 Dec 2015 18:24:38 +0000 (10:24 -0800)]
drivers/pci: Update the quirks for megaraid_sas adapter

This megaraid_sas adapter does have a valid pci vpd information.
Earlier commit 5bf1badcd02f ("pci: Limit VPD length for megaraid_sas
adapter") changed the vpd length to 0x80. This change fixed the panic.
However, we found some options of the lspci does not work very well if
it cannot find the valid vpd tag(Example command "lspci -s 10:00.0 -vv").
It displays the error message and exits right away. Setting the length
to 0 fixes the problem.

Signed-off-by: Babu Moger <babu.moger@oracle.com>
Tested-by: Dmitry Klochkov <dmitry.klochkov@oracle.com>
Orabug: 22104511
(cherry picked from commit df139559cf34e64c478cb6255371a3fec964bdb3)

9 years agoperf bench numa: Fix to show proper convergence stats
Srikar Dronamraju [Wed, 24 Jun 2015 11:10:04 +0000 (16:40 +0530)]
perf bench numa: Fix to show proper convergence stats

With commit: e1e455f4f4d3 (perf tools: Work around lack of sched_getcpu
in glibc < 2.6), perf_bench numa mem with -c or -m option is not able to
correctly calculate convergence.

With the above commit, sched_getcpu always seems to return -1. The
intention of commit e1e455f was to add a sched_getcpu in glibc < 2.6.
Hence keep the sched_getcpu definition under an ifdef.

This regression happened occurred between v4.0 and v4.1

Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Vinson Lee <vlee@twitter.com>
Fixes: e1e455f4f4d3 ("perf tools: Work around lack of sched_getcpu in glibc < 2.6")
Link: http://lkml.kernel.org/r/20150624111004.GA5220@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
(cherry picked from commit 2b42b09b88c831ba4da2d669581dde371c38c2af)

Signed-off-by: Babu Moger <babu.moger@oracle.com>
Orabug:22175225
(cherry picked from commit 7e39c25e52d3f4e88d2c95fcc0af053ce009b8a6)

9 years agoALSA: pci: depend on ZONE_DMA
Dan Williams [Thu, 12 Nov 2015 20:13:57 +0000 (12:13 -0800)]
ALSA: pci: depend on ZONE_DMA

There are several sound drivers that 'select ZONE_DMA'.  This is
backwards as ZONE_DMA is an architecture capability exported to drivers.
Switch the polarity of the dependency to disable these drivers when the
architecture does not support ZONE_DMA.  This was discovered in the
context of testing/enabling devm_memremap_pages() which depends on
ZONE_DEVICE.  ZONE_DEVICE in turn depends on !ZONE_DMA.

Reported-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit 2db1a57986d37653583e67ccbf13082aadc8f25d)

Signed-off-by: Vijay Kumar <vijay.ac.kumar@oracle.com>
Orabug: 22107914
(cherry picked from commit 60b966d75f606b2c1830586eb6c66eca09cce8c9)

9 years agopci: Limit VPD length for megaraid_sas adapter
Babu Moger [Fri, 6 Nov 2015 22:11:01 +0000 (17:11 -0500)]
pci: Limit VPD length for megaraid_sas adapter

Reading or Writing of PCI VPD data causes system panic.
We saw this problem by running "lspci -vvv" in the beginning.
However this can be easily reproduced by running
 cat /sys/bus/devices/XX../vpd

VPD length has been set as 32768 by default. Accessing vpd
will trigger read/write of 32k. This causes problem as we
could read data beyond the VPD end tag. Behaviour is un-
predictable when this happens. I see some other adapter doing
similar quirks(commit bffadffd43d4 ("PCI: fix VPD limit quirk
for Broadcom 5708S"))

I see there is an attempt to fix this right way.
https://patchwork.ozlabs.org/patch/534843/ or
https://lkml.org/lkml/2015/10/23/97

Tried to fix it this way, but problem is I dont see the proper
start/end TAGs(at least for this adapter) at all. The data is
mostly junk or zeros. This patch fixes the issue by setting the
vpd length to 0x80.

Signed-off-by: Babu Moger <babu.moger@oracle.com>
Reviewed-by: Khalid Aziz <khalid.aziz@oracle.com>
Orabug: 22104511

Changes since v2 -> v3
Changed the vpd length from 0 to 0x80 which leaves the
option open for someone to read first few bytes.

Changes since v1 -> v2
Removed the changes in pci_id.h. Kept all the vendor
ids in quirks.c
(cherry picked from commit 8b95aa6b57dd64c4f36fa74026afe62de8c3afbb)

9 years ago SPARC64: UEK4 LDOMS DOMAIN SERVICES UPDATE 1
Aaron Young [Wed, 11 Nov 2015 14:24:54 +0000 (06:24 -0800)]
SPARC64: UEK4 LDOMS DOMAIN SERVICES UPDATE 1

    This update provides several fixes for LDoms on UEK4
    (i.e. fixes/updates for the ldoms UEK4 port done previously
    - See BUG 21644721) and updates for ldoms to work with Zeus.
    It also provides support for libpri which requires a HV call
    to retrieve the PRI from the SP and enhancements to the vlds
    driver to allow multiple process to register/use a service
    simultaneously - so multiple processes can use libpri at the
    same time.

Signed-off-by: Aaron Young <aaron.young@oracle.com>
    Orabug: 22185080
(cherry picked from commit f078f7f618c8c127d7562d946c630d106ed3b1b8)

9 years agoi40e: Look up MAC address in Open Firmware or IDPROM
Sowmini Varadhan [Wed, 4 Nov 2015 19:39:56 +0000 (14:39 -0500)]
i40e: Look up MAC address in Open Firmware or IDPROM

This is the i40e equivalent of commit c762dff24c06 ("ixgbe: Look up MAC
address in Open Firmware or IDPROM").

As with that fix, attempt to look up the MAC address in Open Firmware
on systems that support it, and use IDPROM on SPARC if no OF address
is found.

In the case of the i40e there is an assumption that the default mac
address has already been set up as the primary mac filter on probe,
so if this filter is obtained from the Open Firmware or IDPROM, an
explicit write is needed via i40e_aq_mac_address_write() and
i40e_aq_add_macvlan() invocation.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
(cherry picked from commit c7a3fd4e5d009b6b5bc90ee373aac232a7089068)

9 years agosparc64, vdso: update the CLOCK_MONOTONIC_COARSE clock
Nick Alcock [Mon, 2 Nov 2015 21:44:27 +0000 (21:44 +0000)]
sparc64, vdso: update the CLOCK_MONOTONIC_COARSE clock

In the significant rewrite involved in porting the SPARC vDSO code to
v4.1, the CLOCK_MONOTONIC_COARSE clock moved from being computed from
the CLOCK_REALTIME variable in the vvar page to being tracked by its own
vvar (mirroring a similar change done for x86): this vvar is maintained
in the same way, but is derived only once per jiffy tick rather than
every time clock_gettime() is called, which is likely faster under
sufficiently insane clock_gettime() than the way we did it in v3.0.

Unfortunately, the code to maintain this variable in
arch/sparc/kernel/vsyscall_gtod.c was never implemented, so
clock_gettime(CLOCK_MONOTONIC_COARSE) always returns zero. This is a
little coarser than the user would probably like.

Easily fixed by updating the relevant vvar in the same way as is done on
x86.

Reported-by: Wim Coekaerts <wim.coekaerts@oracle.com>
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Reviewed-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Tested-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Orabug: 22137842

9 years agosparc: Accommodate mem64_offset != mem_offset in pbm configuration
Allen Pais [Tue, 20 Oct 2015 18:42:59 +0000 (00:12 +0530)]
sparc: Accommodate mem64_offset != mem_offset in pbm configuration

PCI specs do not require mem_offset to be the same as mem64_offset.
This patch adds code to handle the cases where they are not the same
instead of panic'ing the kernel.

Orabug: 21826746

Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
9 years agoPCI: Restore pref MMIO allocation logic for host bridge without mmio64
Yinghai Lu [Thu, 8 Oct 2015 21:38:34 +0000 (14:38 -0700)]
PCI: Restore pref MMIO allocation logic for host bridge without mmio64

From 5b2854155 (PCI: Restrict 64-bit prefetchable bridge windows to 64-bit
resources), we change the logic for pref mmio allocation:
When bridge pref support mmio64, we will only put children pref
that support mmio64 into it, and will put children pref mmio32
into bridge's non-pref mmio32.

That could leave bridge pref bar not used when that pref bar is mmio64,
and children res only has mmio32.
Also could have allocation failure when non-pref mmio32 is not big
enough space for those children pref mmio32.

That is not rational when the host bridge does not 64bit mmio above 4g
at all.

The patch restore to old logic:
when host bridge does not have has_mem64, put children pref mmio64 and
pref mmio32 all under bridges pref bars.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Orabug: 21826746

Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
(cherry picked from commit 3317fa110f1c0c0f0a1d0f3ccd00d20319d76623)

9 years agoPCI: Only treat non-pref mmio64 as pref if host bridge has mmio64
Yinghai Lu [Thu, 8 Oct 2015 21:38:33 +0000 (14:38 -0700)]
PCI: Only treat non-pref mmio64 as pref if host bridge has mmio64

If host bridge does not have mmio64 above 4G, We don't need to
treat device non-pref mmio64 as as pref mmio64.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Orabug: 21826746

Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
(cherry picked from commit 7d9d19e4847c249d5eecd6f6e1316e86e597db24)

9 years agoPCI: Add has_mem64 for struct host_bridge
Yinghai Lu [Thu, 8 Oct 2015 21:38:32 +0000 (14:38 -0700)]
PCI: Add has_mem64 for struct host_bridge

Add has_mem64 for struct host_bridge, on root bus that does not support
mmio64 above 4g, will not set that.

We will use that info next two following patches:
1. Don't treat non-pref mmio64 as pref mmio, so will not put
   it under bridge's pref range when rescan the devices
2. will keep pref mmio64 and pref mmio32 under bridge pref bar.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Orabug: 21826746

Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
(cherry picked from commit a60c5ffaf17466433caac32fea9c45576ecdf5c4)

9 years agoPCI: Only treat non-pref mmio64 as pref if all bridges have MEM_64
Yinghai Lu [Thu, 8 Oct 2015 21:38:31 +0000 (14:38 -0700)]
PCI: Only treat non-pref mmio64 as pref if all bridges have MEM_64

If any bridge up to root only have 32bit pref mmio, We don't need to
treat device non-pref mmio64 as as pref mmio64.

We need to move pci_bridge_check_ranges calling early.
for parent bridges pref mmio BAR may not allocated by BIOS, res flags
is still 0, we need to have it correct set before we check them for
child device resources.

-v2: check all bus resources instead of just res[15].

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Orabug: 21826746

Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
(cherry picked from commit 3aa4594c75c6d3a9e72d54320705859f87ff8f7f)

9 years agoPCI: Check pref compatible bit for mem64 resource of PCIe device
Yinghai Lu [Thu, 8 Oct 2015 21:38:30 +0000 (14:38 -0700)]
PCI: Check pref compatible bit for mem64 resource of PCIe device

We still get "no compatible bridge window" warning on sparc T5-8
after we add support for 64bit resource parsing for root bus.

 PCI: scan_bus[/pci@300/pci@1/pci@0/pci@6] bus no 8
 PCI: Claiming 0000:00:01.0: Resource 15: 0000800100000000..00008004afffffff [220c]
 PCI: Claiming 0000:01:00.0: Resource 15: 0000800100000000..00008004afffffff [220c]
 PCI: Claiming 0000:02:04.0: Resource 15: 0000800100000000..000080012fffffff [220c]
 PCI: Claiming 0000:03:00.0: Resource 15: 0000800100000000..000080012fffffff [220c]
 PCI: Claiming 0000:04:06.0: Resource 14: 0000800100000000..000080010fffffff [220c]
 PCI: Claiming 0000:05:00.0: Resource 0: 0000800100000000..0000800100001fff [204]
 pci 0000:05:00.0: can't claim BAR 0 [mem 0x800100000000-0x800100001fff]: no compatible bridge window

All the bridges 64-bit resource have pref bit, but the device resource does not
have pref set, then we can not find parent for the device resource,
as we can not put non-pref mem under pref mem.

According to pcie spec errta
https://www.pcisig.com/specifications/pciexpress/base2/PCIe_Base_r2.1_Errata_08Jun10.pdf
page 13, in some case it is ok to mark some as pref.

Mark if the entire path from the host to the adapter is over PCI Express.
Then set pref compatible bit for claim/sizing/assign for 64bit mem resource
on that pcie device.

-v2: set pref for mmio 64 when whole path is PCI Express, according to David Miller.
-v3: don't set pref directly, change to UNDER_PREF, and set PREF before
     sizing and assign resource, and cleart PREF afterwards. requested by BenH.
-v4: use on_all_pcie_path device flag instead.

Fixes: commit d63e2e1f3df9 ("sparc/PCI: Clip bridge windows to fit in upstream windows")
Link: http://lkml.kernel.org/r/CAE9FiQU1gJY1LYrxs+ma5LCTEEe4xmtjRG0aXJ9K_Tsu+m9Wuw@mail.gmail.com
Reported-by: David Ahern <david.ahern@oracle.com>
Tested-by: David Ahern <david.ahern@oracle.com>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=81431
Tested-by: TJ <linux@iam.tj>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Orabug: 21826746

Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
(cherry picked from commit 35991cd9512c91fb98156f21174b1e9218daebe9)

9 years agoOF/PCI: Add IORESOURCE_MEM_64 for 64-bit resource
Yinghai Lu [Thu, 8 Oct 2015 21:38:29 +0000 (14:38 -0700)]
OF/PCI: Add IORESOURCE_MEM_64 for 64-bit resource

For device resource PREF bit setting under bridge 64-bit pref resource,
we need to make sure only set PREF for 64bit resource, so set
IORESOUCE_MEM_64 for 64bit resource during OF device resource flags
parsing.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=96261
Link: https://bugzilla.kernel.org/show_bug.cgi?id=96241
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: devicetree@vger.kernel.org
Orabug: 21826746

Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
(cherry picked from commit 97e654600ccd98d67e462f41e8c56ab55ef6a76b)

9 years agoPCI: kill wrong quirk about M7101
Yinghai Lu [Thu, 8 Oct 2015 21:38:26 +0000 (14:38 -0700)]
PCI: kill wrong quirk about M7101

Meelis reported that qla2000 driver does not get loaded on one sparc system.

schizo f00732d0: PCI host bridge to bus 0001:00
pci_bus 0001:00: root bus resource [io  0x7fe01000000-0x7fe01ffffff] (bus address [0x0000-0xffffff])
pci 0001:00:06.0: quirk: [io  0x7fe01000800-0x7fe0100083f] claimed by ali7101 ACPI
pci 0001:00:06.0: quirk: [io  0x7fe01000600-0x7fe0100061f] claimed by ali7101 SMB
pci 0001:00:07.0: can't claim BAR 0 [io  0x7fe01000000-0x7fe0100ffff]: address conflict with 0001:00:06.0 [io  0x7fe01000600-0x7fe0100061f]

So the quirk for M7101 claim the io range early.

According to spec with M7101 in M1543 page 103/104,
http://www.versalogic.com/Support/Downloads/pdf/ali1543.pdf
0xe0, and 0xe2 do not include address info for acpi/smb.

Kill wrong quirk about them.

Link: http://kodu.ut.ee/~mroos/dm/dm.v240
Link: http://kodu.ut.ee/~mroos/dm/dm.sb100
Reported-by: Meelis Roos <mroos@linux.ee>
Cc: Meelis Roos <mroos@linux.ee>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Orabug: 21826746

Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
(cherry picked from commit 283017f2528cd7d69a9c866150dd1248b8be4d81)

9 years agosparc/PCI: Keep resource idx order with bridge register number
Yinghai Lu [Thu, 8 Oct 2015 21:38:25 +0000 (14:38 -0700)]
sparc/PCI: Keep resource idx order with bridge register number

On one system found strang "no compatible bridge window" warning

PCI: Claiming 0000:00:01.0: Resource 14: 0002000100000000..000200010fffffff [10220c]
PCI: Claiming 0000:01:00.0: Resource 1: 0002000100000000..000200010000ffff [100214]
pci 0000:01:00.0: can't claim BAR 1 [mem 0x2000100000000-0x200010000ffff 64bit]: no compatible bridge window

and we already had pref_compat support that add extra pref bit for device
resource.

It turns out that pci_resource_compatible()/pci_up_path_over_pref_mem64()
just check resource with bridge pref mmio register idx 15, and we have put
resource to use mmio register idx 14 during of_scan_pci_bridge()
as the bridge does not mmio resource.

We already fix pci_up_path_over_pref_mem64() to check all bus resources.

And at the same time, this patch will make resource to consistent sequence
like other arch or directly from pci_read_bridge_bases(),
even non-pref mmio is missing, or out of ordering in firmware reporting.

So hold i = 1 for non pref mmio, and i =2 for pref mmio.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Orabug: 21826746

Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
(cherry picked from commit fa259d80c3d8c7ea9f9dd1f78f0292913a1ebd7e)

9 years agosparc/PCI: Add IORESOURCE_MEM_64 for 64-bit resource in OF parsing
Yinghai Lu [Thu, 8 Oct 2015 21:38:24 +0000 (14:38 -0700)]
sparc/PCI: Add IORESOURCE_MEM_64 for 64-bit resource in OF parsing

For device resource PREF bit setting under bridge 64-bit pref resource,
we need to make sure only set PREF for 64bit resource, so set
IORESOUCE_MEM_64 for 64bit resource during of device resource flags
parsing.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=96261
Link: https://bugzilla.kernel.org/show_bug.cgi?id=96241
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: sparclinux@vger.kernel.org
Orabug: 21826746

Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
(cherry picked from commit 16323876c6b2b5437c6c1ada805e22d4f63bbc5f)