]> www.infradead.org Git - users/jedix/linux-maple.git/log
users/jedix/linux-maple.git
8 years agosparc: Implement watchdog_nmi_enable and watchdog_nmi_disable
Babu Moger [Thu, 13 Oct 2016 17:36:48 +0000 (10:36 -0700)]
sparc: Implement watchdog_nmi_enable and watchdog_nmi_disable

Implement functions watchdog_nmi_enable and watchdog_nmi_disable
to enable/disable nmi watchdogs. Sparc uses arch specific nmi watchdog
handler. Currently, we do not have a way to enable/disable nmi watchdog
dynamically. With these patches we can enable or disable arch
specific nmi watchdogs using proc or sysctl interface.

Example commands.
To enable: echo 1 >  /proc/sys/kernel/nmi_watchdog
To disable: echo 0 >  /proc/sys/kernel/nmi_watchdog

It can also achieved using the sysctl parameter kernel.nmi_watchdog

Orabug: 24796651

Signed-off-by: Babu Moger <babu.moger@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit 43e96774e0a338e883e9ced9e717424df126b153)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Setup a scheduling domain for highest level cache.
Atish Patra [Thu, 20 Oct 2016 00:33:29 +0000 (18:33 -0600)]
sparc64: Setup a scheduling domain for highest level cache.

Individual scheduler domain should consist different hierarchy
consisting of cores sharing similar property. Currently, no
scheduler domain is defined separately for the cores that shares
the last level cache. As a result, the scheduler fails to take
advantage of cache locality while migrating tasks during load
balancing.

Here are the cpu masks currently present for sparc that are/can
be used in scheduler domain construction.
cpu_core_map : set based on the cores that shares l1 cache.
core_core_sib_map : is set based on the socket id or max cache id.
The prior SPARC notion of socket was defined as highest level of
shared cache. However, the MD record on T7 platforms now describes
the CPUs that share the physical socket and this is no longer tied
to shared cache.

That's why a separate cpu mask needs to be created that truly
represent highest level of shared cache for all platforms.

Modified after cherry picked from upstream commit.
d624716b6c67e60681180786564b92ddb521148a
The implementation is largely based on Chris's patches.

Signed-off-by: Atish Patra <atish.patra@oracle.com>
Reviewed-by: Chris Hyser <chris.hyser@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 1e655ca52bb2727471f20cf4d8f62b4b9f69e6fc)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agoSPARC64: PORT LDMVSW DRIVER TO UEK4
Allen Pais [Mon, 30 May 2016 07:42:15 +0000 (13:12 +0530)]
SPARC64: PORT LDMVSW DRIVER TO UEK4

      Port of the new ldmvsw (Ldoms Virtual Switch) driver to UEK4.
      This code has already been submitted and accepted
      into the mainline Linux kernel.

      The ldmvsw is very similar in function to the existing sunvnet driver. The
      sunvnet driver is therefore split to put the code common to both drivers
      into the kernel for use by both drivers when loaded (see sunvnet_common.c/h).

Orabug: 23215917

Signed-off-by: Aaron Young <aaron.young@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
(cherry picked from commit 361afffe35368dc23d2c9df6d7797ccf9af8fe57)

8 years agoSPARC64: Fix bad FP register calculation
Rob Gardner [Sun, 1 Nov 2015 23:51:34 +0000 (16:51 -0700)]
SPARC64: Fix bad FP register calculation

An additional problem was found in handle_ldf_stq
after adding the fix for the SIGFPE on no-fault
load.  The calculation for freg is incorrect when
a single precision load is being handled. This
causes %f1 to be seen as %f32 etc, and the incorrect
register ends up being overwritten.  This code
sequence demonstrates the problem:
ldd [%g1], %f32         ! g1 = valid address
lda [%i3] ASI_PNF, %f1  ! i3 = invalid address
std %f32, [%g1] ! %f32 is mangled
This is corrected by basing the freg calculation on
the load size.

Orabug: 24942761

Signed-off-by: Rob Gardner <rob.gardner@oracle.com>
Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
8 years agoSPARC64: Respect no-fault ASI for floating exceptions
Rob Gardner [Fri, 30 Oct 2015 19:18:00 +0000 (13:18 -0600)]
SPARC64: Respect no-fault ASI for floating exceptions

Floating point load instructions using ASI_PNF or other
no-fault ASIs should never cause a SIGFPE. A store-quad
instruction should naturally fault if a non-quad register
is given, but this constraint should not apply to loads,
which may be single precision, double, or quad, and the
only constraint should be that the target register type
be appropriate for the precision of the load. A bug in
handle_ldf_stq() unnecessarily restricts no-fault loads
to quad registers, and causes a floating point exception
if one is not given. This restriction is removed.

Orabug: 24942761

Signed-off-by: Rob Gardner <rob.gardner@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
8 years agosparc64: Fixes NUMA node cpulist sysfs file in single NUMA node case.
Thomas Tai [Fri, 2 Sep 2016 19:18:19 +0000 (12:18 -0700)]
sparc64: Fixes NUMA node cpulist sysfs file in single NUMA node case.

Forward port 23175351 to UEK4

The sysfs file /sys/devices/system/node/node0/cpulist is incorrect in the
single node case on sun4v machines as the machine description record in this
case does not contain any NUMA information. A default list from 0 to NR_CPUS
was used prior. This file is read by utilities such as 'numactl --hardware'
and lscpu to show CPU-to-node assignment.

In order to fix this issue, the numa_cpumask_lookup_table is cleared at
bootup. Whenever an extra cpu is bringup via __cpu_up, the corresponding
cpu mask is set in the numa_cpumask_lookup_table.

Orabug: 24500614
Orabug: 22546851

Signed-off-by: Chris Hyser <chris.hyser@oracle.com>
Signed-off-by: Thomas Tai <thomas.tai@oracle.com>
8 years agosparc64: Cleans up PRIQ error and debugging messages.
chris hyser [Fri, 23 Sep 2016 16:27:07 +0000 (09:27 -0700)]
sparc64: Cleans up PRIQ error and debugging messages.

Given that the lowest level arch dependent interrupt routines cannot actually
propagate any error back to the calling driver in the case of irq
request/enable/disable and setting affinity, PRIQ error messages need to
communicate failures in a more traceable way. The original error messages which
were more for internal debugging than regular usage have also been improved as
well as made controllable via a command line parameter priq=dbg.

Orabug: 24010412

Signed-off-by: Chris Hyser <chris.hyser@oracle.com>
(cherry picked from commit 89c31d4dd664cd2edc1f6d14aa62c75acfb0d172)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc: Remove console spam during kdump
Dave Kleikamp [Fri, 17 Jun 2016 14:51:04 +0000 (09:51 -0500)]
sparc: Remove console spam during kdump

Before executing the crash kernel, the panicking kernel cleans up the
irq state of the machine. This code contains a warning when cleaning up
unbound MSIs. Repeating this warning for each one floods the console and
can cause a waiting thread to time out before the other cpus have
completed.

This patch removes the warning and increases the time allowed for all
the cpus to complete the machine_capture_other_strands() function.

orabug: 23585248

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
(cherry picked from commit 30e77b09b134b3ec049b01cfd8754c774da493b9)
(cherry picked from commit 67657418d64c3cee2945370614c38d4516fb0ea1)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: kdump: set crashing_cpu for panic
Dave Kleikamp [Mon, 27 Jun 2016 16:30:17 +0000 (11:30 -0500)]
sparc64: kdump: set crashing_cpu for panic

crashing_cpu was only being set in die_if_kernel() but not when a
crash dump is initiated from panic(). Move the initialization to
machine_crash_shutdown().

Also call bust_spinlocks() from die_if_kernel() to get rid of a warning
in smp_call_function_many(). It's already called in the panic path.

Orabug: 23585248

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
(cherry picked from commit 1b588be700fac73edd07c015ff53aecba5d92bec)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc: kexec: Don't mess with the tl register
Dave Kleikamp [Thu, 23 Jun 2016 19:04:30 +0000 (14:04 -0500)]
sparc: kexec: Don't mess with the tl register

I meddled with things I didn't fully understand while implementing commit
b43bc8f0 - "sparc64: add missing code for crash_setup_regs()"

I had changed the tl register in order to read tstate, tpc, etc. without
really knowing what I was doing. This can be a disaster if the crashing
thread takes another interrupt. Currently, the crash utitility doesn't
even use those values. They are found on the stack instead.

Orabug: 23585248

Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
(cherry picked from commit 80eb7e28d3c719bbe3af56de5a5a8c68b764dbb9)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: VDS should try indefinitely to allocate IO pages
Bijan Mottahedeh [Fri, 21 Oct 2016 08:10:55 +0000 (04:10 -0400)]
sparc64: VDS should try indefinitely to allocate IO pages

Orabug: 24924152

Signed-off-by: Bijan Mottahedeh <bijan.mottahedeh@oracle.com>
Reviewd-by: Alexandre Chartre <alexandre.chartre@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Use block layer BIO-based interface for VDC IO requests
Bijan Mottahedeh [Mon, 10 Oct 2016 07:10:59 +0000 (03:10 -0400)]
sparc64: Use block layer BIO-based interface for VDC IO requests

Orabug: 24823012

Signed-off-by: Bijan Mottahedeh <bijan.mottahedeh@oracle.com>
Reviewed-by: Alexandre Chartre <alexandre.chartre@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Enable virtual disk protocol out of order execution
Bijan Mottahedeh [Sun, 12 Jun 2016 15:39:52 +0000 (08:39 -0700)]
sparc64: Enable virtual disk protocol out of order execution

Orabug: 24815498

Signed-off-by: Bijan Mottahedeh <bijan.mottahedeh@oracle.com>
Reviewed-by: Alexandre Chartre <alexandre.chartre@oracle.com>
Reviewed-by: Chris Hyser <Chris.Hyser@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agoipmi: Fix NULL pointer access and double free panic.
Atish Patra [Tue, 20 Sep 2016 19:13:33 +0000 (12:13 -0700)]
ipmi: Fix NULL pointer access and double free panic.

Orabug: 24697944

In case of a ldom/hardware not supporting ldc, ipmi_si module
will set the smi interface pointer to NULL after ldc channel
detection failure. However, ipmi_si module will crash during
unload due to absence of NULL check.

Add the smi interface null check and assign the workqueue to
NULL during cleanup to avoid double free panic.

Signed-off-by: Atish Patra <atish.patra@oracle.com>
Reviewed-by: David Aldridge <david.j.aldridge@oracle.com>
Reviewed-by: Vijay Kumar <vijay.ac.kumar@oracle.com>
Reviewed-by: Rob Gardner <rob.gardner@oracle.com>
(cherry picked from commit f2546771efb0c6402a5ea65dac9c5dbce18150e6)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agoipmi: Update ipmi driver as per new vldc interface
Atish Patra [Thu, 16 Jun 2016 21:38:08 +0000 (14:38 -0700)]
ipmi: Update ipmi driver as per new vldc interface

Orabug: 23748821

Currently, ipmi driver fakes it self as a userland process
to access ipmi vldc channel.

This patch uses new cleaner vldc kernel interface that is added
for ipmi driver.

Signed-off-by: Atish Patra <atish.patra@oracle.com>
Reviewed-by: Rob Gardner <rob.gardner@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
(cherry picked from commit 7a0d1deac3289130680a5ab1626c609b76c9f053)

8 years agoipmi: Fix ipmi driver for ilom reset scenario
Rob Gardner [Wed, 9 Sep 2015 19:18:54 +0000 (13:18 -0600)]
ipmi: Fix ipmi driver for ilom reset scenario

Orabug: 24407542

IPMI driver will have a stale vldc file pointer if ILOM resets.
Thus, IPMI drivers failed to work after the reset is complete.
IPMI driver need to close that file pointer and open another after
ilom reset is complete.

This is achieved by trying to open vldc file in every 15 seconds
in a process context. As vldc or ldc can not detect a ILOM reset,
this is the best possible approach for the problem.

This is based on Rob's patch for mc reset fix.
Signed-off-by: Atish Patra <atish.patra@oracle.com>
Reviewed-by: Rob Gardner <rob.gardner@oracle.com>
(cherry picked from commit cf5139791a8241fcab1f59c1da0a9058def661f2)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: vcc fixes
Allen Pais [Thu, 22 Sep 2016 11:09:52 +0000 (16:39 +0530)]
sparc64: vcc fixes

Orabug: 24653154

Signed-off-by: Aaron Young <aaron.young@oracle.com>
Reviewed-By: Bijan Mottahedeh <Bijan.Mottahedeh@oracle.com>
Reviewed-By: Liam Merwick <Liam.Merwick@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
(cherry picked from commit ef9086623414761b55a23d18dfc8565e7d1d7659)

8 years agosparc64: Fix kernel panic due to erroneous #ifdef surrounding pmd_write()
Tom Hromatka [Thu, 6 Oct 2016 16:00:15 +0000 (09:00 -0700)]
sparc64: Fix kernel panic due to erroneous #ifdef surrounding pmd_write()

Synonym created.
Grant succeeded.
kernel BUG at include/asm-generic/pgtable.h:576!
              \|/ ____ \|/
              "@'/ .. \`@"
              /_| \__/ |_\
                 \__U_/
oracle_8114_cdb(8114): Kernel bad sw trap 5 [#1]
CPU: 120 PID: 8114 Comm: oracle_8114_cdb Not tainted
4.1.12-61.7.1.el6uek.rc1.sparc64 #1
task: fff8400700a24d60 ti: fff8400700bc4000 task.ti: fff8400700bc4000
TSTATE: 0000004411e01607 TPC: 00000000004609f8 TNPC: 00000000004609fc Y:
00000005    Not tainted
TPC: <gup_huge_pmd+0x198/0x1e0>
g0: 000000000001c000 g1: 0000000000ef3954 g2: 0000000000000000 g3:
0000000000000001
g4: fff8400700a24d60 g5: fff8001fa5c10000 g6: fff8400700bc4000 g7:
0000000000000720
o0: 0000000000bc5058 o1: 0000000000000240 o2: 0000000000006000 o3:
0000000000001c00
o4: 0000000000000000 o5: 0000048000080000 sp: fff8400700bc6ab1 ret_pc:
00000000004609f0
RPC: <gup_huge_pmd+0x190/0x1e0>
l0: fff8400700bc74fc l1: 0000000000020000 l2: 0000000000002000 l3:
0000000000000000
l4: fff8001f93250950 l5: 000000000113f800 l6: 0000000000000004 l7:
0000000000000000
i0: fff8400700ca46a0 i1: bd0000085e800453 i2: 000000026a0c4000 i3:
000000026a0c6000
i4: 0000000000000001 i5: fff800070c958de8 i6: fff8400700bc6b61 i7:
0000000000460dd0
I7: <gup_pud_range+0x170/0x1a0>
Call Trace:
 [0000000000460dd0] gup_pud_range+0x170/0x1a0
 [0000000000460e84] get_user_pages_fast+0x84/0x120
 [00000000006f5a18] iov_iter_get_pages+0x98/0x240
 [00000000005fa744] do_direct_IO+0xf64/0x1e00
 [00000000005fbbc0] __blockdev_direct_IO+0x360/0x15a0
 [00000000101f74fc] ext4_ind_direct_IO+0xdc/0x400 [ext4]
 [00000000101af690] ext4_ext_direct_IO+0x1d0/0x2c0 [ext4]
 [00000000101af86c] ext4_direct_IO+0xec/0x220 [ext4]
 [0000000000553bd4] generic_file_read_iter+0x114/0x140
 [00000000005bdc2c] __vfs_read+0xac/0x100
 [00000000005bf254] vfs_read+0x54/0x100
 [00000000005bf368] SyS_pread64+0x68/0x80

Orabug: 24665642

Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Initialize xl_hugepage_shift to 0
Nitin Gupta [Tue, 30 Aug 2016 18:39:09 +0000 (11:39 -0700)]
sparc64: Initialize xl_hugepage_shift to 0

Currently, this global is incorrectly initialized
to the default hugepage size (HPAGE_SHIFT) which
causes non-8M hugepages fail to initialize.

Orabug: 24439278

Signed-off-by: Nitin Gupta <nitin.m.gupta@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64:mm/hugetlb: Set correct huge_pte_count index for 8M hugepages
Vijay Kumar [Sun, 2 Oct 2016 21:40:18 +0000 (15:40 -0600)]
sparc64:mm/hugetlb: Set correct huge_pte_count index for 8M hugepages

Both set_huge_pte_at(...) and huge_ptep_get_and_clear(...)
call real_hugepage_size_to_pte_count_idx(hugepage_size) when adjusting
huge_pte_count. For 8MB/4MB the huge_pte_count index computed is 1(one).
This is incorrect because this index is for xl_hugepages. So the tsb
grow code in the mm fault path does not grow the tsb for 8MB/4MB
hugepages.

Signed-off-by: Bob Picco <bob.picco@oracle.com>
Signed-off-by: Vijay Kumar <vijay.ac.kumar@oracle.com>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Tested-by: Mike Kravetz <mike.kravetz@oracle.com>
Orabug: 24490586
(cherry picked from commit c928d6fccaa59bd4b6cffc904144fa67a4726ff6)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Fix accounting issues used to size TSBs
Mike Kravetz [Thu, 22 Sep 2016 16:44:27 +0000 (09:44 -0700)]
sparc64: Fix accounting issues used to size TSBs

Orabug: 24478985

As pages are allocated by a task, counters in the mm and mm_context
structures are used to track these allocations.  These counters are
then used to size the task's TSBs.  This patch addresses issues where
counts are not maintained properly, and TSBs of the incorrect size
are created for the task.

- hugetlb pages are not included in a task's RSS calculations.  However,
  the routine do_sparc64_fault() calculates the size of base TSB block
  by subtracting total size of hugetlb pages from RSS.  Since hugetlb
  size is likely larger than RSS, a negative value is passed as an
  unsigned value to the routine which allocates the TSB block.  The
  'negative unsigned' value appears as a really big value and results in
  a maximum sized base TSB being allocated.  This is the case for almost
  all tasks using hugetlb pages.

  THP pages are also counted in huge_pte_count[MM_PTES_HUGE].  And
  unlike hugetlb pages, THP pages are included in a task's RSS.
  Therefore, both hugetlb and THP can not be counted for in
  huge_pte_count[MM_PTES_HUGE].

  Add a new counter thp_pte_count for THP pages, and use this value for
  adjusting RSS to size the base TSB.

- In order to save memory, THP makes use of a huge zero page.  This huge
  zero page does not count against a task's RSS, but it does consume TSB
  entries.  Therefore, count huge zero page entries in
  huge_pte_count[MM_PTES_HUGE].

- Accounting of THP pages is done in the routine set_pmd_at().
  Unfortunately, this does not catch the case where a THP page is split.
  To handle this case, decrement the count in pmdp_invalidate().
  pmdp_invalidate is only called when splitting a THP.  However, 'sanity
  checks' are added in case it is ever called for other purposes.

- huge_pte_count[MM_PTES_HUGE] tracks the number of HPAGE_SIZE (8M) pages
  used by the task.  This value is used to size the TSB for HPAGE_SIZE
  pages.  However, for each HPAGE_SIZE (8M) there are two REAL_HPAGE_SIZE
  (4M) pages.  The TSB contains an entry for each REAL_HPAGE_SIZE page.
  Therefore, the number of REAL_HPAGE_SIZE pages used by the task should
  be used to size the MM_PTES_HUGE TSB.  A new compile time constant
  REAL_HPAGE_PER_HPAGE is used to multiply huge_pte_count[MM_PTES_HUGE]
  before sizing the TSB.

Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
Reviewed-by: Vijay Kumar <vijay.ac.kumar@oracle.com>
Tested-by: Vijay Kumar <vijay.ac.kumar@oracle.com>
(cherry picked from commit 417fc85e759b6d4c4602fbdbdd5375ec5ddf2cb0)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Fix irq stack bootmem allocation.
Atish Patra [Thu, 15 Sep 2016 20:54:41 +0000 (14:54 -0600)]
sparc64: Fix irq stack bootmem allocation.

Currently, irq stack bootmem is allocated for all possible cpus
before nr_cpus value changes the list of possible cpus. As a result,
there is unnecessary wastage of bootmemory.

Move the irq stack bootmem allocation so that it happens after
possible cpu list is modified based on nr_cpus value.

Orabug: 23050718

Signed-off-by: Atish Patra <atish.patra@oracle.com>
Reviewed-by: Bob Picco <bob.picco@oracle.com>
Reviewed-by: Vijay Kumar <vijay.ac.kumar@oracle.com>
(cherry picked from commit d192d0743aa6dbca0991900c490c06111b4bd86c)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Fix cpu_possible_mask if nr_cpus is set
Atish Patra [Thu, 15 Sep 2016 20:54:40 +0000 (14:54 -0600)]
sparc64: Fix cpu_possible_mask if nr_cpus is set

Orabug: 23297558

If kernel boot parameter nr_cpus is set, it should define the number
of CPUs that can ever be available in the system i.e.
cpu_possible_mask. setup_nr_cpu_ids() overrides the nr_cpu_ids based
on the cpu_possible_mask during kernel initialization. If
cpu_possible_mask is not set based on the nr_cpus value, earlier part
of the kernel would be initialized using nr_cpus value leading to a
kernel crash.

Set cpu_possible_mask based on nr_cpus value. Thus setup_nr_cpu_ids()
becomes redundant and does not corrupt nr_cpu_ids value.

Signed-off-by: Atish Patra <atish.patra@oracle.com>
Reviewed-by: Bob Picco <bob.picco@oracle.com>
Reviewed-by: Vijay Kumar <vijay.ac.kumar@oracle.com>
(cherry picked from commit f539e5b332d8d969301bc43f076d905569c2b12c)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Fix PMD check during page table walk
Nitin Gupta [Thu, 25 Aug 2016 18:16:50 +0000 (11:16 -0700)]
sparc64: Fix PMD check during page table walk

Currently check for PMD_HUGE during page table
walk uses incorrect instruction sequence:

 be,pt           %xcc, 700f;
   andcc          REG1, REG2, %g0;

This sequence is incorrect since branch decision is
made *before* 'andcc' in the delay slot is executed.

Orabug: 24353511

Signed-off-by: Nitin Gupta <nitin.m.gupta@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agovldc driver: provide kernel driver interfaces1
Allen Pais [Tue, 13 Sep 2016 05:55:51 +0000 (11:25 +0530)]
vldc driver: provide kernel driver interfaces1

Orabug: 24601126

Forward port 22804422 to UEK4-QU3 - VLDC driver should expose
services...

Signed-off-by: Aaron Young <aaron.young@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Fix sentinel page table entry for 16G
Nitin Gupta [Thu, 25 Aug 2016 18:33:27 +0000 (11:33 -0700)]
sparc64: Fix sentinel page table entry for 16G

Currently no page table trimming is done for 16G pages
so _PAGE_PMD_HUGE must not be set for 16G. Also, for
this size, trimming would be done at PUD level, so
this flag should not be set anyways.

Orabug: 24353511

Signed-off-by: Nitin Gupta <nitin.m.gupta@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Trim page tables for 2G pages
Nitin Gupta [Thu, 2 Jun 2016 22:14:42 +0000 (15:14 -0700)]
sparc64: Trim page tables for 2G pages

Currently mapping a 2G page requires 256*1024 PTE entries.
This results in large amounts of RAM to be used just for
storing page tables. We now use 256 PMD entries to map a
2G page which is much more space efficient.

Orabug: 23109070

Signed-off-by: Nitin Gupta <nitin.m.gupta@oracle.com>
(cherry picked from commit d3c88b8f27645c14cbb220570e5945abb0989d19)
(cherry picked from commit 768096d7916fefc497f397b0675455a754ee8a5b)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Trim page tables at PMD for hugepages
Nitin Gupta [Fri, 27 May 2016 21:58:13 +0000 (14:58 -0700)]
sparc64: Trim page tables at PMD for hugepages

For PMD aligned (8M) hugepages, we currently allocate
all four page table levels which is wasteful. We now
allocate till PMD level only which saves memory usage
from page tables.

Orabug: 22630259

Signed-off-by: Nitin Gupta <nitin.m.gupta@oracle.com>
(cherry picked from commit 5d2c7930a4d3bf3ca560048052d638d7efa67e36)
(cherry picked from commit abefebd73e204979661a818ac31cf455d110a672)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agovcc driver fixes
Allen Pais [Thu, 8 Sep 2016 06:01:31 +0000 (11:31 +0530)]
vcc driver fixes

Orabug:24319080 - hang on a mutex out of vcc_open()
Orabug:24326005 - UEK4 kernel panic tty_ldisc_flush vcc_close

Signed-off-by: Aaron Young <aaron.young@oracle.com>
Reviewed-By: Bijan Mottahedeh <Bijan.Mottahedeh@oracle.com>
Reviewed-By: Liam Merwick <Liam.Merwick@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agoLDOMS DOMAIN SERVICES UPDATE 5
Allen Pais [Thu, 8 Sep 2016 05:59:59 +0000 (11:29 +0530)]
LDOMS DOMAIN SERVICES UPDATE 5

Orabug: 24601099

Signed-off-by: Aaron Young <aaron.young@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Support reserving memory with memmap=xxx$yyy
Larry Bassel [Wed, 31 Aug 2016 15:08:37 +0000 (09:08 -0600)]
sparc64: Support reserving memory with memmap=xxx$yyy

The kernel commandline parameter memmap= was supported
on several other architectures but not on SPARC (it was
being ignored on SPARC).

Add support for the memmap=xxx$yyy commandline parameter
(sparc64/UEK4 only). The patch is based on the existing
code for the "tile" architecture.

There are other types of memmap= commandlines which
are only supported on x86 that are e820-specific.
These were not implemented.

Orabug: 22662762

Signed-off-by: Larry Bassel <larry.bassel@oracle.com>
Reviewed-by: Khalid Aziz <khalid.aziz@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc: Harden signal return frame checks.
David S. Miller [Sun, 29 May 2016 04:21:31 +0000 (21:21 -0700)]
sparc: Harden signal return frame checks.

    Orabug: 23303740

    [ Upstream commit d11c2a0de2824395656cf8ed15811580c9dd38aa ]

    All signal frames must be at least 16-byte aligned, because that is
    the alignment we explicitly create when we build signal return stack
    frames.

    All stack pointers must be at least 8-byte aligned.

Signed-off-by: David S. Miller <davem@davemloft.net>
    Conflicts:

    arch/sparc/kernel/signal32.c - modified patch context so that it would apply

Signed-off-by: Larry Bassel <larry.bassel@oracle.com>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64:Support User Probes for Sparc
Allen Pais [Fri, 26 Aug 2016 09:09:27 +0000 (14:39 +0530)]
sparc64:Support User Probes for Sparc

Orabug: 23523685 Support User Probes in OLS / uek4.1

Signed-off-by: Eric Saint-Etienne <eric.saint.etienne@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Use HW supported number of context ID bits
Sanath Kumar [Thu, 11 Aug 2016 23:01:31 +0000 (18:01 -0500)]
sparc64: Use HW supported number of context ID bits

Orabug: 24449941

Number of context IDs supported by the hardware
is reported via machine descriptor for sun4v
systems. For systems > T3, 16 bits are used
to represent context ID in the HW. For these
systems the context ID wrap around happens if
there are more that 65536 processes running
simultaneously. For systems older than that
13 bits are used and the context ID wraps around
if there are 8192 processes running simultaneously.

Reviewed-by: Babu Moger <babu.moger@oracle.com>
Acked-by: Rob Gardner <rob.gardner@oracle.com>
Signed-off-by: Sanath Kumar <sanath.s.kumar@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Fix return from trap window fill crashes.
David S. Miller [Sun, 29 May 2016 03:41:12 +0000 (20:41 -0700)]
sparc64: Fix return from trap window fill crashes.

We must handle data access exception as well as memory address unaligned
exceptions from return from trap window fill faults, not just normal
TLB misses.

Otherwise we can get an OOPS that looks like this:

ld-linux.so.2(36808): Kernel bad sw trap 5 [#1]
CPU: 1 PID: 36808 Comm: ld-linux.so.2 Not tainted 4.6.0 #34
task: fff8000303be5c60 ti: fff8000301344000 task.ti: fff8000301344000
TSTATE: 0000004410001601 TPC: 0000000000a1a784 TNPC: 0000000000a1a788 Y: 00000002    Not tainted
TPC: <do_sparc64_fault+0x5c4/0x700>
g0: fff8000024fc8248 g1: 0000000000db04dc g2: 0000000000000000 g3: 0000000000000001
g4: fff8000303be5c60 g5: fff800030e672000 g6: fff8000301344000 g7: 0000000000000001
o0: 0000000000b95ee8 o1: 000000000000012b o2: 0000000000000000 o3: 0000000200b9b358
o4: 0000000000000000 o5: fff8000301344040 sp: fff80003013475c1 ret_pc: 0000000000a1a77c
RPC: <do_sparc64_fault+0x5bc/0x700>
l0: 00000000000007ff l1: 0000000000000000 l2: 000000000000005f l3: 0000000000000000
l4: fff8000301347e98 l5: fff8000024ff3060 l6: 0000000000000000 l7: 0000000000000000
i0: fff8000301347f60 i1: 0000000000102400 i2: 0000000000000000 i3: 0000000000000000
i4: 0000000000000000 i5: 0000000000000000 i6: fff80003013476a1 i7: 0000000000404d4c
I7: <user_rtt_fill_fixup+0x6c/0x7c>
Call Trace:
 [0000000000404d4c] user_rtt_fill_fixup+0x6c/0x7c

The window trap handlers are slightly clever, the trap table entries for them are
composed of two pieces of code.  First comes the code that actually performs
the window fill or spill trap handling, and then there are three instructions at
the end which are for exception processing.

The userland register window fill handler is:

add %sp, STACK_BIAS + 0x00, %g1; \
ldxa [%g1 + %g0] ASI, %l0; \
mov 0x08, %g2; \
mov 0x10, %g3; \
ldxa [%g1 + %g2] ASI, %l1; \
mov 0x18, %g5; \
ldxa [%g1 + %g3] ASI, %l2; \
ldxa [%g1 + %g5] ASI, %l3; \
add %g1, 0x20, %g1; \
ldxa [%g1 + %g0] ASI, %l4; \
ldxa [%g1 + %g2] ASI, %l5; \
ldxa [%g1 + %g3] ASI, %l6; \
ldxa [%g1 + %g5] ASI, %l7; \
add %g1, 0x20, %g1; \
ldxa [%g1 + %g0] ASI, %i0; \
ldxa [%g1 + %g2] ASI, %i1; \
ldxa [%g1 + %g3] ASI, %i2; \
ldxa [%g1 + %g5] ASI, %i3; \
add %g1, 0x20, %g1; \
ldxa [%g1 + %g0] ASI, %i4; \
ldxa [%g1 + %g2] ASI, %i5; \
ldxa [%g1 + %g3] ASI, %i6; \
ldxa [%g1 + %g5] ASI, %i7; \
restored; \
retry; nop; nop; nop; nop; \
b,a,pt %xcc, fill_fixup_dax; \
b,a,pt %xcc, fill_fixup_mna; \
b,a,pt %xcc, fill_fixup;

And the way this works is that if any of those memory accesses
generate an exception, the exception handler can revector to one of
those final three branch instructions depending upon which kind of
exception the memory access took.  In this way, the fault handler
doesn't have to know if it was a spill or a fill that it's handling
the fault for.  It just always branches to the last instruction in
the parent trap's handler.

For example, for a regular fault, the code goes:

winfix_trampoline:
rdpr %tpc, %g3
or %g3, 0x7c, %g3
wrpr %g3, %tnpc
done

All window trap handlers are 0x80 aligned, so if we "or" 0x7c into the
trap time program counter, we'll get that final instruction in the
trap handler.

On return from trap, we have to pull the register window in but we do
this by hand instead of just executing a "restore" instruction for
several reasons.  The largest being that from Niagara and onward we
simply don't have enough levels in the trap stack to fully resolve all
possible exception cases of a window fault when we are already at
trap level 1 (which we enter to get ready to return from the original
trap).

This is executed inline via the FILL_*_RTRAP handlers.  rtrap_64.S's
code branches directly to these to do the window fill by hand if
necessary.  Now if you look at them, we'll see at the end:

    ba,a,pt    %xcc, user_rtt_fill_fixup;
    ba,a,pt    %xcc, user_rtt_fill_fixup;
    ba,a,pt    %xcc, user_rtt_fill_fixup;

And oops, all three cases are handled like a fault.

This doesn't work because each of these trap types (data access
exception, memory address unaligned, and faults) store their auxiliary
info in different registers to pass on to the C handler which does the
real work.

So in the case where the stack was unaligned, the unaligned trap
handler sets up the arg registers one way, and then we branched to
the fault handler which expects them setup another way.

So the FAULT_TYPE_* value ends up basically being garbage, and
randomly would generate the backtrace seen above.

Orabug: 24671126

Reported-by: Nick Alcock <nix@esperi.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Take ctx_alloc_lock properly in hugetlb_setup().
David S. Miller [Wed, 25 May 2016 19:51:20 +0000 (12:51 -0700)]
sparc64: Take ctx_alloc_lock properly in hugetlb_setup().

On cheetahplus chips we take the ctx_alloc_lock in order to
modify the TLB lookup parameters for the indexed TLBs, which
are stored in the context register.

This is called with interrupts disabled, however ctx_alloc_lock
is an IRQ safe lock, therefore we must take acquire/release it
properly with spin_{lock,unlock}_irq().

Orabug: 24671126

Reported-by: Meelis Roos <mroos@linux.ee>
Tested-by: Meelis Roos <mroos@linux.ee>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Fix sparc64_set_context stack handling.
David S. Miller [Tue, 1 Mar 2016 05:25:32 +0000 (00:25 -0500)]
sparc64: Fix sparc64_set_context stack handling.

Like a signal return, we should use synchronize_user_stack() rather
than flush_user_windows().

Orabug: 24671126

Reported-by: Ilya Malakhov <ilmalakhovthefirst@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: vds kernel BUG at fs/buffer.c:1269!
Bijan Mottahedeh [Thu, 28 Jul 2016 15:34:18 +0000 (11:34 -0400)]
sparc64: vds kernel BUG at fs/buffer.c:1269!

Orabug: 24376791

Interrupts must be enabled before the fini call.

Signed-off-by: Bijan Mottahedeh <bijan.mottahedeh@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Virtual disk IO should handle VDS module removal and reinsertion
Bijan Mottahedeh [Mon, 11 Jul 2016 13:23:25 +0000 (09:23 -0400)]
sparc64: Virtual disk IO should handle VDS module removal and reinsertion

Orabug: 24319792

Virtual disk IO should handle mdodule removal and reinsertion while IO
is active between clients and the server.

Signed-off-by: Bijan Mottahedeh <bijan.mottahedeh@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: support for identifying Sonoma 2 systems
Joe Moriarty [Wed, 15 Jun 2016 14:29:18 +0000 (10:29 -0400)]
sparc64: support for identifying Sonoma 2 systems

Needed for Sonoma 2 software support

Orabug: 22960812
Signed-off-by: Joe Moriarty <joe.moriarty@oracle.com>
Acked-by: Allen Pais <allen.pais@oracle.com>
(cherry picked from commit 8a9b7d9b25a3ad54bc41294f93ce814038f01c70)
(cherry picked from commit a8ce3853635573a42e49df9c8b7e87bf35656561)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosonoma:correctly recognize sonoma cpu type
Allen Pais [Wed, 11 May 2016 13:26:53 +0000 (18:56 +0530)]
sonoma:correctly recognize sonoma cpu type

Orabug: 23041920

Signed-off-by: Allen Pais <allen.pais@oracle.com>
Signed-off-by: Joe Moriarty <joe.moriarty@oracle.com>
(cherry picked from commit 72eaed0f66615fe000a63feb7350ba51bf040e06)
(cherry picked from commit 70a67f6bfc281c92e9422b1672d0cae30da178df)

8 years agosparc64: Set VDS workqueue max_active argument to 0
Bijan Mottahedeh [Thu, 9 Jun 2016 19:36:53 +0000 (15:36 -0400)]
sparc64: Set VDS workqueue max_active argument to 0

Orabug: 23565322

Based on

https://www.kernel.org/doc/Documentation/workqueue.txt

The recommended value for max_active is 0:

max_active:

max_active determines the maximum number of execution contexts per
CPU which can be assigned to the work items of a wq.  For example,
with @max_active of 16, at most 16 work items of the wq can be
executing at the same time per CPU.

Currently, for a bound wq, the maximum limit for @max_active is 512
and the default value used when 0 is specified is 256.  For an unbound
wq, the limit is higher of 512 and 4 * num_possible_cpus().  These
values are chosen sufficiently high such that they are not the
limiting factor while providing protection in runaway cases.

The number of active work items of a wq is usually regulated by the
users of the wq, more specifically, by how many work items the users
may queue at the same time.  Unless there is a specific need for
throttling the number of active work items, specifying '0' is
recommended.

Signed-off-by: Bijan Mottahedeh <bijan.mottahedeh@oracle.com>
Reviewed-by: Liam Merwick <Liam.Merwick@oracle.com>
Reviewed-by: Alexandre Chartre <alexandre.chartre@oracle.com>
(cherry picked from commit b584786e611e8e8a28830386e8b3db8874d794c5)
(cherry picked from commit f2559a96b70562267f01d5bb62ef44aa9f0c0cd8)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Reduce TLB flushes during hugepte changes
Nitin Gupta [Thu, 26 May 2016 21:56:19 +0000 (14:56 -0700)]
sparc64: Reduce TLB flushes during hugepte changes

During hugepage map/unmap, TSB and TLB flushes are currently
issued at every PAGE_SIZE'd boundary which is unnecessary.
We now issue the flush at REAL_HPAGE_SIZE boundaries only.

Without this patch workloads which unmap a large hugepage
backed VMA region get CPU lockups due to excessive TLB
flush calls.

Orabug: 23071722

Signed-off-by: Nitin Gupta <nitin.m.gupta@oracle.com>
(cherry picked from commit b42a694198cca38e8cdb3f601266bf591ba3291d)
(cherry picked from commit fdc7f39ae632a9ec0114c59090131d2db7dd7682)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: kernel panic -- vds_bh_reset
Bijan Mottahedeh [Thu, 5 May 2016 09:10:45 +0000 (02:10 -0700)]
sparc64: kernel panic -- vds_bh_reset

Orabug: 23199936

The panic is an assertion failure in fs/buffer.c:1269

static inline void check_irqs_on(void)
{
         *** BUG_ON(irqs_disabled()); ***
}

The vds reset path calls the backend fini routine which eventually calls
the file close interface:

         vds_vio_lock(vio, flags);
         vds_be_fini(port);

vds_vio_lock() grabs a spin lock and disables local irqs and thus
the eventual assertion failure.

The fix is to add a new r/w mutex to protect backend state and move the
vds_vio_lock() call after vds_be_fini().

Signed-off-by: Bijan Mottahedeh <bijan.mottahedeh@oracle.com>
Reviewed-by: Liam Merwick <Liam.Merwick@oracle.com>
(cherry picked from commit 6e33112afcdd654ada7c9414a1c4d83278533911)
(cherry picked from commit e62908110662f009f2449df5faae496ac43a1d65)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agovds_blk_rw() should check bio_alloc() NULL return value
Bijan Mottahedeh [Tue, 15 Mar 2016 09:21:51 +0000 (02:21 -0700)]
vds_blk_rw() should check bio_alloc() NULL return value

Orabug: 22934031

Signed-off-by: Bijan Mottahedeh <bijan.mottahedeh@oracle.com>
(cherry picked from commit fec4ca1085a268c38a4a12c6119322aaf2f87698)
(cherry picked from commit d590a3711158228194ea31da0f1fea612bd13c05)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosunvdc: don't dereference port->disk before disk probe finishes
Dwight Engen [Fri, 16 Jan 2015 22:19:39 +0000 (17:19 -0500)]
sunvdc: don't dereference port->disk before disk probe finishes

If the backing file for a vdisk is not present in the service domain an
ldc reset can occur during the initial port/disk probing. The ldc reset
logic was dereferencing port->disk, which may not have been setup yet.
Guard against this case.

Orabug: 20362258

Signed-off-by: Chris Hyser <chris.hyser@oracle.com>
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
(cherry picked from commit cd6d3705da958b5db625272eb8733ab79a045f87)
(cherry picked from commit bee156ac9cad00f6a39417217c454085645c3d62)
(cherry picked from commit 476306db27c9a6bcd2e8012047ba06a0af16b734)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: This patch adds PRIQ support.
chris hyser [Tue, 17 May 2016 20:05:35 +0000 (13:05 -0700)]
sparc64: This patch adds PRIQ support.

This patch supports INT_A through INT_D interrupts as described
by the Open Firmware device tree as well as MSI vectors registered
by PCIe drivers. pci=nomsi may not work though frankly that makes no
sense on a SPARC machine.

The command line parameter priq=off reverts to prior MSIEQ interrupt
mechanism.

OraBug: 22748924

Signed-off-by: Bob Picco <bob.picco@oracle.com>
Signed-off-by: Chris Hyser <chris.hyser@oracle.com>
(cherry picked from commit d4c668861f91dfe6f5fa1a809218a8c46dc76c9b)
(cherry picked from commit c47c2d2a53856b25843e07c78f42f45a17661d2c)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
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>