]> www.infradead.org Git - users/jedix/linux-maple.git/log
users/jedix/linux-maple.git
8 years agoMerge branch topic/uek-4.1/rpm-build of git://ca-git.us.oracle.com/linux-uek into... v4.1.12-92
Chuck Anderson [Thu, 9 Mar 2017 04:34:31 +0000 (20:34 -0800)]
Merge branch topic/uek-4.1/rpm-build of git://ca-git.us.oracle.com/linux-uek into uek/uek-4.1

* topic/uek-4.1/rpm-build:
  config: enable simple framebuffer driver for OL6
  fm10k: Add driver to the kernel config for UEK4

8 years agoMerge branch topic/uek-4.1/sparc of git://ca-git.us.oracle.com/linux-uek into uek...
Chuck Anderson [Thu, 9 Mar 2017 04:24:57 +0000 (20:24 -0800)]
Merge branch topic/uek-4.1/sparc of git://ca-git.us.oracle.com/linux-uek into uek/uek-4.1

* topic/uek-4.1/sparc: (32 commits)
  sparc: fix kernel panic caused by vio handshake
  sparc64: Add sensible read values for /proc/<pid>/sparc_adi
  sparc64: Add ability to set the mcde state for a process
  sparc64: Add proc files specific to ADI
  sparc64: add mcd_on_by_default
  Revert "sparc: fix intermittent LDom hang waiting for vdc_port_up"
  sparc64: Add support for ADI (Application Data Integrity)
  sparc64: Add support for ADI register fields, ASIs and traps
  mm: Add functions to support extra actions on swap in/out
  signals, sparc: Add signal codes for ADI violations
  sparc64: shut down to OBP correctly
  sparc64: fix for user probes in high memory
  sparc64: Use online cpus instead of present cpus during hotplug.
  sparc64: Update cpumaps correctly during hotplug.
  sparc: fix intermittent LDom hang waiting for vdc_port_up
  arch/sparc: Add a dedicated clear_page and clear_user_page for M7
  sparc64: perf: Enable dynamic tracepoints when using perf probe
  SPARC64: UEK4 LDOMS DOMAIN SERVICES UPDATE 7
  arch/sparc: Fix indexing msi_msiqid_table and msi_irq_table
  arch/sparc: Clear msi_msiqid_table during teardown
  ...

8 years agoMerge branch 'topic/uek-4.1/drivers' of git://ca-git.us.oracle.com/linux-uek into...
Chuck Anderson [Thu, 9 Mar 2017 04:16:08 +0000 (20:16 -0800)]
Merge branch 'topic/uek-4.1/drivers' of git://ca-git.us.oracle.com/linux-uek into uek/uek-4.1

* topic/uek-4.1/drivers: (200 commits)
  scsi: megaraid-sas: request irqs later
  scsi: megaraid_sas: add in missing white spaces in error messages text
  scsi: megaraid_sas: fix macro MEGASAS_IS_LOGICAL to avoid regression
  scsi: megaraid_sas: driver version upgrade
  scsi: megaraid_sas: Do not set MPI2_TYPE_CUDA for JBOD FP path for FW which does not support JBOD sequence map
  scsi: megaraid_sas: Send SYNCHRONIZE_CACHE for VD to firmware
  scsi: megaraid_sas: Do not fire DCMDs during PCI shutdown/detach
  scsi: megaraid_sas: Send correct PhysArm to FW for R1 VD downgrade
  scsi: megaraid_sas: For SRIOV enabled firmware, ensure VF driver waits for 30secs before reset
  scsi: megaraid_sas: Fix data integrity failure for JBOD (passthrough) devices
  scsi: megaraid_sas: clean function declarations in megaraid_sas_base.c up
  scsi: megaraid_sas: add in missing white space in error message text
  scsi: megaraid_sas: Fix the search of first memory bar
  scsi: megaraid_sas: Use memdup_user() rather than duplicating its implementation
  megaraid_sas: Fix probing cards without io port
  megaraid_sas: Do not fire MR_DCMD_PD_LIST_QUERY to controllers which do not support it
  megaraid_sas: Downgrade two success messages to info
  megaraid_sas: driver version upgrade
  megaraid_sas: task management code optimizations
  megaraid_sas: call ISR function to clean up pending replies in OCR path
  ...

8 years agoMerge branch topic/uek-4.1/upstream-cherry-picks of git://ca-git.us.oracle.com/linux...
Chuck Anderson [Thu, 9 Mar 2017 04:00:03 +0000 (20:00 -0800)]
Merge branch topic/uek-4.1/upstream-cherry-picks of git://ca-git.us.oracle.com/linux-uek into uek/uek-4.1

* topic/uek-4.1/upstream-cherry-picks: (280 commits)
  dm btree: fix bufio buffer leaks in dm_btree_del() error path
  ipv4: keep skb->dst around in presence of IP options
  ip6_gre: fix ip6gre_err() invalid reads
  watchdog: hpwdt: changed maintainer information
  watchdog: hpwdt: add support for iLO5
  watchdog: hpwdt: remove email address from doc
  watchdog: hpwdt: Adjust documentation to match latest kernel module parameters.
  hpwdt: use nmi_panic() when kernel panics in NMI handler
  panic: change nmi_panic from macro to function
  watchdog/hpwdt: Fix build on certain configs
  watchdog/hpwdt: Create stack frame in asminline_call()
  x86/asm: Add C versions of frame pointer macros
  x86/asm: Clean up frame pointer macros
  watchdog: hpwdt: HP rebranding
  panic, x86: Allow CPUs to save registers even if looping in NMI context
  watchdog: hpwdt: Add support for WDIOC_SETOPTIONS
  kvm: fix page struct leak in handle_vmon
  bnx2: use READ_ONCE() instead of barrier()
  bnx2: Wait for in-flight DMA to complete at probe stage
  bnx2: fix locking when netconsole is used
  ...

8 years agoMerge branch topic/uek-4.1/stable-cherry-picks of git://ca-git.us.oracle.com/linux...
Chuck Anderson [Thu, 9 Mar 2017 03:44:09 +0000 (19:44 -0800)]
Merge branch topic/uek-4.1/stable-cherry-picks of git://ca-git.us.oracle.com/linux-uek into uek/uek-4.1

* topic/uek-4.1/stable-cherry-picks:
  btrfs: trimming some start_transaction() code away
  dm flakey: fix reads to be issued if drop_writes configured

8 years agosparc: fix kernel panic caused by vio handshake
Thomas Tai [Mon, 13 Feb 2017 14:50:05 +0000 (06:50 -0800)]
sparc: fix kernel panic caused by vio handshake

During hours long reboot test, the primary prints out multiple TX trigger
errors followed by a VIO handshake panic. The TX trigger error happens
because the primary ldmvsw detects that the ldc channel is down. In this
situation, the ldc operation is aborted, the tx and rx queue are then
flushed. The problem is that the rx queue may contain a LDC_EVENT_RESET
sent by the guest. It causes the primary to think that the ldc channel
is not in reset state. When the guest comes up again, the handshake is
out of sequence and thus causes handshake panic.

The TX trigger error would not have happened if the LDC_EVENT_RESET was
received before the TX checked the ldc link state. This is the reason
why the panic happens intermittently.

This patch checks for the connection reset and changes the ldc state to
reset. The reset logic is taken from existing vnet_event_napi() ldc_ctrl:
code path.

Orabug: 23476613
Orabug: 25064864

Signed-off-by: Thomas Tai <thomas.tai@oracle.com>
Reviewed-by: Shannon Nelson <shannon.nelson@oracle.com>
8 years agosparc64: Add sensible read values for /proc/<pid>/sparc_adi
Khalid Aziz [Fri, 2 Dec 2016 19:45:37 +0000 (12:45 -0700)]
sparc64: Add sensible read values for /proc/<pid>/sparc_adi

This patch makes value read from /proc/<pid>/sparc_adi consistent
across platforms that support ADi and ones that do not. When ADI is
not available for a process either due to process being an anonymous
process on an ADI-capable platform or the process is running on a
non-ADI platform, a read from /proc/<pid>/sparc_adi always reads a
value of -1. This patch updates the documentation file as well with
the values for sparc_adi proc file.

Orabug: 25173120

Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Add ability to set the mcde state for a process
Eric Snowberg [Thu, 17 Nov 2016 21:27:36 +0000 (13:27 -0800)]
sparc64: Add ability to set the mcde state for a process

turn off version checking (PSTATE.mcde) to avoid tripping over ADI
versions in flux.  This has been partially remedied by using non-faulting
loads.

However, there is still a need to turn off PSTATE.mcde in memory dump
functions.  This is to determine if an address is readable.  If the
address is unreadable, the dump shows the memory contents as "********"
instead of a 4-byte hex value.

Orabug: 25130002

Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com>
Reviewed-by: Khalid Aziz <khalid.aziz@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Add proc files specific to ADI
Khalid Aziz [Wed, 16 Nov 2016 23:43:13 +0000 (16:43 -0700)]
sparc64: Add proc files specific to ADI

This patch adds /proc/sys/kernel/mcd_on_by_default and
/proc/<pid>/sparc_adi files. These files allow userspace access to
change ADI parameters.

Orabug: 22713162

Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: add mcd_on_by_default
Chuck Anderson [Sat, 18 Feb 2017 06:15:35 +0000 (22:15 -0800)]
sparc64: add mcd_on_by_default

Add the global variable mcd_on_by_default and support for the kernel boot arg
"mcd_on_by_default" which causes mcd_on_by_default = 1 if the kernel is
adi_capable().

Based on the code in commit:
    sparc64: Enable Application Data Integrity for m7 and newer processors
Required by commit:
    sparc64: Add proc files specific to ADI

Orabug: 22713162
Signed-off-by: Chuck Anderson <chuck.anderson@oracle.com>
8 years agoRevert "sparc: fix intermittent LDom hang waiting for vdc_port_up"
Chuck Anderson [Sat, 18 Feb 2017 04:59:43 +0000 (20:59 -0800)]
Revert "sparc: fix intermittent LDom hang waiting for vdc_port_up"

This reverts commit 94ac2958dd26064af74f49a966e3b7e3bd4dccfe.

Orabug: 25409637

8 years agosparc64: Add support for ADI (Application Data Integrity)
Khalid Aziz [Wed, 15 Feb 2017 19:57:59 +0000 (12:57 -0700)]
sparc64: Add support for ADI (Application Data Integrity)

ADI is a new feature supported on SPARC M7 and newer processors to allow
hardware to catch rogue accesses to memory. ADI is supported for data
fetches only and not instruction fetches. An app can enable ADI on its
data pages, set version tags on them and use versioned addresses to
access the data pages. Upper bits of the address contain the version
tag. On M7 processors, upper four bits (bits 63-60) contain the version
tag. If a rogue app attempts to access ADI enabled data pages, its
access is blocked and processor generates an exception. Please see
Documentation/sparc/adi.txt for further details.

This patch extends mprotect to enable ADI (TSTATE.mcde), enable/disable
MCD (Memory Corruption Detection) on selected memory ranges, enable
TTE.mcd in PTEs, return ADI parameters to userspace and save/restore ADI
version tags on page swap out/in or migration. It also adds handlers for
traps related to MCD. ADI is not enabled by default for any task. A task
must explicitly enable ADI on a memory range and set version tag for ADI
to be effective for the task.

This initial implementation supports saving and restoring one tag per
page. A page must use same version tag across the entire page for the
tag to survive swap and migration. Swap swupport infrastructure in this
patch allows for this capability to be expanded to store/restore more
than one tag per page in future.

This is a backport of patch sent upstream and brings UEK code closer to
upstream patch v6.

Orabug: 22713162

Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
Cc: Khalid Aziz <khalid@gonehiking.org>
8 years agosparc64: Add support for ADI register fields, ASIs and traps
Khalid Aziz [Wed, 18 Jan 2017 17:59:26 +0000 (10:59 -0700)]
sparc64: Add support for ADI register fields, ASIs and traps

SPARC M7 processor adds new control register fields, ASIs and a new
trap to support the ADI (Application Data Integrity) feature. This
patch adds definitions for these register fields, ASIs and a handler
for the new precise memory corruption detected trap.

This is a backport of patch sent upstream and brings UEK code in sync
with upstream patch v6.

Orabug: 22713162

Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
Cc: Khalid Aziz <khalid@gonehiking.org>
8 years agomm: Add functions to support extra actions on swap in/out
Khalid Aziz [Wed, 18 Jan 2017 17:36:21 +0000 (10:36 -0700)]
mm: Add functions to support extra actions on swap in/out

If a processor supports special metadata for a page, for example ADI
version tags on SPARC M7, this metadata must be saved when the page is
swapped out. The same metadata must be restored when the page is swapped
back in. This patch adds two new architecture specific functions -
arch_do_swap_page() to be called when a page is swapped in,
arch_unmap_one() to be called when a page is being unmapped for swap
out.

This is a backport of patch sent upstream and brings UEK code in sync
with upstream patch v6.

Orabug: 22713162

Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
Cc: Khalid Aziz <khalid@gonehiking.org>
8 years agosignals, sparc: Add signal codes for ADI violations
Khalid Aziz [Thu, 5 Jan 2017 18:46:54 +0000 (11:46 -0700)]
signals, sparc: Add signal codes for ADI violations

SPARC M7 processor introduces a new feature - Application Data
Integrity (ADI). ADI allows MMU to  catch rogue accesses to memory.
When a rogue access occurs, MMU blocks the access and raises an
exception. In response to the exception, kernel sends the offending
task a SIGSEGV with si_code that indicates the nature of exception.
This patch adds three new signal codes specific to ADI feature:

1. ADI is not enabled for the address and task attempted to access
   memory using ADI
2. Task attempted to access memory using wrong ADI tag and caused
   a deferred exception.
3. Task attempted to access memory using wrong ADI Ttag and caused
   a precise exception.

This is a backport of patch sent upstream and brings UEK code closer to
upstream patch v6.

Orabug: 22713162

Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
Cc: Khalid Aziz <khalid@gonehiking.org>
8 years agosparc64: shut down to OBP correctly
Larry Bassel [Thu, 12 Jan 2017 16:29:49 +0000 (09:29 -0700)]
sparc64: shut down to OBP correctly

Orabug: 23467092

The command "shutdown -h -H now" should shut the system down to the
OBP, however the machine was being powered off in the LDOM case.

In the LDOM case, the "reboot-command" variable must be set to
the string "noop" and then ldom_reboot() must be called.
This will make the OBP ignore the setting of "auto-boot?" after it
completes the reset. This causes the system to stop at the ok prompt.

Signed-off-by: Larry Bassel <larry.bassel@oracle.com>
Reviewed-by: Shannon Nelson <shannon.nelson@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: fix for user probes in high memory
Eric Saint-Etienne [Mon, 30 Jan 2017 12:27:49 +0000 (04:27 -0800)]
sparc64: fix for user probes in high memory

Orabug 25428066

When returning from the user probe code into userspace process, PC & NPC are
truncated to 32 bits.

As a result of shared libraries get loaded very high in the virtual address
space of the process, placing a user probe inside a shared library makes the
kernel return into the process at the wrong address, causing it to seg'fault
most of the time.

This patch prevents truncating PC and NPC.

Signed-off-by: Eric Saint Etienne <eric.saint.etienne@oracle.com>
Reviewed-by: David Aldridge <david.j.aldridge@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Use online cpus instead of present cpus during hotplug.
Atish Patra [Mon, 23 Jan 2017 21:40:35 +0000 (14:40 -0700)]
sparc64: Use online cpus instead of present cpus during hotplug.

As per the hotplug documentation, online cpu maps should be
updated if cpu hotplug happens via sysfs. Thus, all other
cpu maps should be updated basd on the online cpus instead
of present cpus. The following example illustrates the issue
if cpu maps are updated based on present cpus.

Before the fix on a T7-2:

[root@ca-sparc64 hackbench]#
cat /sys/devices/system/cpu/cpu0/topology/thread_siblings_list
0-7
[root@ca-sparc64 hackbench]# echo 0 > /sys/devices/system/cpu/cpu0/online
[root@ca-sparc64 hackbench]# echo 0 > /sys/devices/system/cpu/cpu2/online
[root@ca-sparc64 hackbench]#
cat /sys/devices/system/cpu/cpu1/topology/thread_siblings_list
1,3-7
[root@ca-sparc64 hackbench]#
cat /sys/devices/system/cpu/cpu1/topology/core_siblings_list
1,3-255

[root@ca-sparc64 hackbench]# echo 1 > /sys/devices/system/cpu/cpu2/online
[root@ca-sparc64 hackbench]#
cat /sys/devices/system/cpu/cpu1/topology/core_siblings_list
0-255
[root@ca-sparc64 hackbench]#
cat /sys/devices/system/cpu/cpu1/topology/thread_siblings_list
0-7
This is wrong because cpu0 is still offline.

After the fix:
[root@ca-sparc64 hackbench]#
cat /sys/devices/system/cpu/cpu1/topology/core_siblings_list
1-255
[root@ca-sparc64 hackbench]#
cat /sys/devices/system/cpu/cpu1/topology/thread_siblings_list
1-7

Orabug: 25472256

Signed-off-by: Atish Patra <atish.patra@oracle.com>
Reviewed-by: Chris Hyser <chris.hyser@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Update cpumaps correctly during hotplug.
Atish Patra [Mon, 23 Jan 2017 21:39:24 +0000 (14:39 -0700)]
sparc64: Update cpumaps correctly during hotplug.

Currently,numa_cpu_mask is not updated when cpus are
hotplugged resulting incorrect number of cpus reported
by lscpu/numactl. Moreover, cpu_core_sib_cache_map is
also not cleared when cpu goes offline.

Update both the masks correctly whenever cpu goes online/
offline.

Orabug: 25144324

Signed-off-by: Atish Patra <atish.patra@oracle.com>
Reviewed-by: Allen Pais <allen.pais@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc: fix intermittent LDom hang waiting for vdc_port_up
Thomas Tai [Tue, 17 Jan 2017 19:43:32 +0000 (11:43 -0800)]
sparc: fix intermittent LDom hang waiting for vdc_port_up

When an LDom boots, sunvdc probes the disk using the LDC channel.
If the channel was previously configured, we need to wait for
the channel state to change from UP to RESETTING so that the
seqid is properly reset in the primary. Otherwise the primary
will expect that the ldc packet contains a seqid other than 0.

Also disable ldc hypervisor interrupt before calling vio_port_up,
because interrupts can happen once ldc_bind is called. disabling the
interrupt ensures everything is configured before getting an interrupt
request.

orabug: 25409637

Signed-off-by: Thomas Tai <thomas.tai@oracle.com>
Reviewed-By: Liam Merwick <Liam.Merwick@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agoarch/sparc: Add a dedicated clear_page and clear_user_page for M7
Babu Moger [Wed, 18 Jan 2017 01:21:44 +0000 (17:21 -0800)]
arch/sparc: Add a dedicated clear_page and clear_user_page for M7

Adding a dedicated clear_page and clear_user_page for M7.
Avoids multiple checks which are really not required.
This eliminates about 30 instructions for each call.
Seen about 3 to 4 percent latency reduction in some cases.

Orabug: 25456049

Signed-off-by: Babu Moger <babu.moger@oracle.com>
Reviewed-by: Rob Gardner <rob.gardner@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: perf: Enable dynamic tracepoints when using perf probe
Dave Aldridge [Wed, 25 Jan 2017 10:30:13 +0000 (02:30 -0800)]
sparc64: perf: Enable dynamic tracepoints when using perf probe

This commit enables the use of dynamic tracepoints (kprobes) when
using the perf probe command.

Orabug: 24925615

Signed-off-by: Dave Aldridge <david.j.aldridge@oracle.com>
Signed-off-by: Eric Saint Etienne <eric.saint.etienne@oracle.com>
Reviewed-by: Rob Gardner <rob.gardner@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agoSPARC64: UEK4 LDOMS DOMAIN SERVICES UPDATE 7
Aaron Young [Wed, 18 Jan 2017 14:42:01 +0000 (09:42 -0500)]
SPARC64: UEK4 LDOMS DOMAIN SERVICES UPDATE 7

This update fixes the following issues for LDom domain services on UEK4:

1. Kernel watchdog panic when unbinding guest domains. This panic was
   due to the ds driver accessing a freed data structure out of ds_remove().

2. "no service registered for UNREG_REQ handle" error messages on the console
   when ldmd is restarted.

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>
Orabug: 2540840625366664
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agoarch/sparc: Fix indexing msi_msiqid_table and msi_irq_table
Babu Moger [Fri, 13 Jan 2017 17:49:23 +0000 (09:49 -0800)]
arch/sparc: Fix indexing msi_msiqid_table and msi_irq_table

Orabug: 25391918

Couple of indexing fixes.
1. Fix indexing pbm->msi_msiqid_table. It is initialized
   based off of pbm->msi_first(not pbm->msiq_first as previously done).
   Here is how it is initialized(Look at in sparc64_setup_msi_irq)
   pbm->msi_msiqid_table[msi - pbm->msi_first] = msiqid;

2. In set_related_affinity, we dont need to subtract msi_first as
   the loop is indexed from 0 to size of the table.

(cherry picked from uek2 commit 57d31847c9f2011314de8ea98c06616f91c5dbb8)

Signed-off-by: Babu Moger <babu.moger@oracle.com>
Tested-by: Dmitry Klochkov <dmitry.klochkov@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agoarch/sparc: Clear msi_msiqid_table during teardown
Babu Moger [Fri, 13 Jan 2017 17:39:01 +0000 (09:39 -0800)]
arch/sparc: Clear msi_msiqid_table during teardown

Orabug: 25391918

teardown_msi_irq needs to clear msi_msiqid_table in PBM.

(cherry picked from uek2 commit 77264d74588ae4c59682c561707471a4accfed2a)

Signed-off-by: Babu Moger <babu.moger@oracle.com>
Tested-by: Dmitry Klochkov <dmitry.klochkov@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Skip flushing TLBs if there are no mm_users
Sanath Kumar [Wed, 11 Jan 2017 15:35:46 +0000 (09:35 -0600)]
sparc64: Skip flushing TLBs if there are no mm_users

Orabug: 25379970

Saves time when smp_flush_tlb_page/smp_flush_tlb_pending
is called during do_exit(...). Without this patch, killing
processes had performance bottle neck in these functions
due to unnecessary xcalls made to flush TLBs.

Reviewed-by: Nitin Gupta <nitin.m.gupta@oracle.com>
Signed-off-by: Bob Picco <bob.picco@oracle.com
Signed-off-by: Henry Willard <henry.willard@oracle.com>
Signed-off-by: Sanath Kumar <sanath.s.kumar@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64:This fixes the numa_node attributes displayed in sysfs.
Allen Pais [Wed, 11 Jan 2017 09:11:16 +0000 (14:41 +0530)]
sparc64:This fixes the numa_node attributes displayed in sysfs.

Orabug: 22748961

Signed-off-by: Chris Hyser <chris.hyser@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Zero pages on allocation for mondo and error queues.
Liam R. Howlett [Thu, 5 Jan 2017 20:58:41 +0000 (15:58 -0500)]
sparc64: Zero pages on allocation for mondo and error queues.

Error queues use a non-zero first word to detect if the queues are full.
Using pages that have not been zeroed may result in false positive
overflow events.  These queues are set up once during boot so zeroing
all mondo and error queue pages is safe.

Note that this does not always occur because the page allocation for
these queues is so early in the boot cycle that higher number CPUs get
fresh pages.  It is only when traps are serviced with lower number CPUs
who were given already used pages that this issue is exposed.

orabug: 23054018

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Don't panic on user mode non-resumable errors
Liam R. Howlett [Thu, 22 Dec 2016 02:57:42 +0000 (21:57 -0500)]
sparc64: Don't panic on user mode non-resumable errors

Send a SIGBUS to the offending process on all userspace non-resumable
traps.  This prevents userspace applications from creating a kernel
panic.  The siginfo will return the code BUS_ADRERR and a valid address
if possible.

orabug: 23054018

Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: affine strand irq stacks
Allen Pais [Fri, 2 Dec 2016 08:08:10 +0000 (13:38 +0530)]
sparc64: affine strand irq stacks

    Like the subject says let us NUMA affine the per strand softirq and
    hardirq stacks.

    This has been boot tested on T7-4 and T4-1.

    Ported to UEK4

Orabug: 23050718

Signed-off-by: Bob Picco <bob.picco@oracle.com>
Signed-off-by: Chris Hyser <chris.hyser@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Handle extremely large kernel TLB range flushes more gracefully.
David S. Miller [Thu, 27 Oct 2016 16:04:54 +0000 (09:04 -0700)]
sparc64: Handle extremely large kernel TLB range flushes more gracefully.

When the vmalloc area gets fragmented, and because the firmware
mapping area sits between where modules live and the vmalloc area, we
can sometimes receive requests for enormous kernel TLB range flushes.

When this happens the cpu just spins flushing billions of pages and
this triggers the NMI watchdog and other problems.

We took care of this on the TSB side by doing a linear scan of the
table once we pass a certain threshold.

Do something similar for the TLB flush, however we are limited by
the TLB flush facilities provided by the different chip variants.

First of all we use an (mostly arbitrary) cut-off of 256K which is
about 32 pages.  This can be tuned in the future.

The huge range code path for each chip works as follows:

1) On spitfire we flush all non-locked TLB entries using diagnostic
   acceses.

2) On cheetah we use the "flush all" TLB flush.

3) On sun4v/hypervisor we do a TLB context flush on context 0, which
   unlike previous chips does not remove "permanent" or locked
   entries.

We could probably do something better on spitfire, such as limiting
the flush to kernel TLB entries or even doing range comparisons.
However that probably isn't worth it since those chips are old and
the TLB only had 64 entries.

Orabug: 25499527

Reported-by: James Clarke <jrtc27@jrtc27.com>
Tested-by: James Clarke <jrtc27@jrtc27.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit a74ad5e660a9ee1d071665e7e8ad822784a2dc7f)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Fix illegal relative branches in hypervisor patched TLB cross-call code.
David S. Miller [Wed, 26 Oct 2016 17:20:14 +0000 (10:20 -0700)]
sparc64: Fix illegal relative branches in hypervisor patched TLB cross-call code.

Just like the non-cross-call TLB flush handlers, the cross-call ones need
to avoid doing PC-relative branches outside of their code blocks.

Orabug: 25499527

Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit a236441bb69723032db94128761a469030c3fe6d)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Fix instruction count in comment for __hypervisor_flush_tlb_pending.
David S. Miller [Wed, 26 Oct 2016 17:08:22 +0000 (10:08 -0700)]
sparc64: Fix instruction count in comment for __hypervisor_flush_tlb_pending.

Noticed by James Clarke.

Orabug: 25499527

Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 830cda3f9855ff092b0e9610346d110846fc497c)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Handle extremely large kernel TSB range flushes sanely.
David S. Miller [Wed, 26 Oct 2016 02:43:17 +0000 (19:43 -0700)]
sparc64: Handle extremely large kernel TSB range flushes sanely.

If the number of pages we are flushing is more than twice the number
of entries in the TSB, just scan the TSB table for matches rather
than probing each and every page in the range.

Based upon a patch and report by James Clarke.

Orabug: 25499527

Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 849c498766060a16aad5b0e0d03206726e7d2fa4)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc64: Fix illegal relative branches in hypervisor patched TLB code.
David S. Miller [Tue, 25 Oct 2016 23:23:26 +0000 (16:23 -0700)]
sparc64: Fix illegal relative branches in hypervisor patched TLB code.

When we copy code over to patch another piece of code, we can only use
PC-relative branches that target code within that piece of code.

Such PC-relative branches cannot be made to external symbols because
the patch moves the location of the code and thus modifies the
relative address of external symbols.

Use an absolute jmpl to fix this problem.

Orabug: 25499527

Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit b429ae4d5b565a71dfffd759dfcd4f6c093ced94)
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agoSPARC64: UEK4 LDOMS DOMAIN SERVICES UPDATE 6
Aaron Young [Tue, 20 Dec 2016 19:51:25 +0000 (14:51 -0500)]
SPARC64: UEK4 LDOMS DOMAIN SERVICES UPDATE 6

This update fixes the following issues for LDom domain services on UEK4:

1. Error messages displayed on the console when guest domains are stopped
   such as:

ldc_print: id=0x11 flags=0x7 state=CONNECTED cstate=0x0 hsstate=0x10
        rx_h=0x2b40 rx_t=0x2b40 rx_n=512
        tx_h=0x4440 tx_t=0x4440 tx_n=512
        rcv_nxt=635 snd_nxt=723
ds-3: ds_disconnect_service_client: failed to send UNREG_REQ for handle
700000001 (1)

2. CPU DR related problems including 'length too big' errors and hangs. With
   these new fixes, >256 vcpus can be successfully added/removed from a guest
   domain. As part of this fix, a new scheme for reusing event data memory
   buffers was implemented.

Signed-off-by: Aaron Young <Aaron.Young@oracle.com>
Reviewed-By: Liam Merwick <Liam.Merwick@oracle.com>
Orabug: 2317193524848179
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agosparc: Optimized memset, memcpy, copy_to_user, copy_from_user for M7
Babu Moger [Fri, 2 Dec 2016 22:16:23 +0000 (14:16 -0800)]
sparc: Optimized memset, memcpy, copy_to_user, copy_from_user for M7

New algorithm that takes advantage of the M7 block init store
ASI, ie, overlapping pipelines and miss buffer filling.
Full details in code comments.

Ported from following UEK2 commits.
http://ca-git.us.oracle.com/?p=linux-uek-2.6.39-sparc.git;a=commit;h=c58ef937e442830c362d1ab20a35a1c61b409827
http://ca-git.us.oracle.com/?p=linux-uek-2.6.39-sparc.git;a=commit;h=322d6f95ade517f4e180545f23fa731b2d748b33
http://ca-git.us.oracle.com/?p=linux-uek-2.6.39-sparc.git;a=commit;h=bc0b4ae6b87fbb28bd816320d22ae6c6a2393865

Orabug: 25120741

Signed-off-by: Babu Moger <babu.moger@oracle.com>
Reviewed-by: Rob Gardner <rob.gardner@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
8 years agobtrfs: trimming some start_transaction() code away
Alexandru Moise [Thu, 27 Aug 2015 23:53:45 +0000 (23:53 +0000)]
btrfs: trimming some start_transaction() code away

Orabug: 25615755

Just call kmem_cache_zalloc() instead of calling kmem_cache_alloc().
We're just initializing most fields to 0, false and NULL later on
_anyway_, so to make the code mode readable and potentially gain
a bit of performance (completely untested claim), we should fill our
btrfs_trans_handle with zeros on allocation then just initialize
those five remaining fields (not counting the list_heads) as normal.

Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: Alexandru Moise <00moses.alexander00@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
(cherry picked from commit f2f767e7345dfe56102d6809f647ba38a238f718)
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
 Conflicts:
fs/btrfs/transaction.c

8 years agoscsi: megaraid-sas: request irqs later
Tomas Henzl [Tue, 1 Nov 2016 16:32:02 +0000 (17:32 +0100)]
scsi: megaraid-sas: request irqs later

Orabug: 25568930

It is not good when an irq arrives before driver structures are
allocated.

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 18103efcacee0563d57c3b7af8d849faae62a117)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: megaraid_sas: add in missing white spaces in error messages text
Colin Ian King [Sat, 12 Nov 2016 16:25:24 +0000 (16:25 +0000)]
scsi: megaraid_sas: add in missing white spaces in error messages text

Orabug: 25568930

A couple of dev_printk messages spans two lines and the literal string
is missing a white space between words. Add the white space.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 644da3c39aaa9fac630ecb2657b43adf0c8e97fc)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: megaraid_sas: fix macro MEGASAS_IS_LOGICAL to avoid regression
Sumit Saxena [Wed, 9 Nov 2016 10:59:42 +0000 (02:59 -0800)]
scsi: megaraid_sas: fix macro MEGASAS_IS_LOGICAL to avoid regression

Orabug: 25568930

This patch will fix regression caused by commit 1e793f6fc0db ("scsi:
megaraid_sas: Fix data integrity failure for JBOD (passthrough)
devices").

The problem was that the MEGASAS_IS_LOGICAL macro did not have braces
and as a result the driver ended up exposing a lot of non-existing SCSI
devices (all SCSI commands to channels 1,2,3 were returned as
SUCCESS-DID_OK by driver).

[mkp: clarified patch description]

Fixes: 1e793f6fc0db920400574211c48f9157a37e3945
Reported-by: Jens Axboe <axboe@kernel.dk>
CC: stable@vger.kernel.org
Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Tested-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Tested-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 5e5ec1759dd663a1d5a2f10930224dd009e500e8)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: megaraid_sas: driver version upgrade
Kashyap Desai [Fri, 21 Oct 2016 13:33:36 +0000 (06:33 -0700)]
scsi: megaraid_sas: driver version upgrade

Orabug: 25568930

Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit fd3e165ac8be7bfbc47318e7b720458a5d5d6227)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: megaraid_sas: Do not set MPI2_TYPE_CUDA for JBOD FP path for FW which does...
Kashyap Desai [Fri, 21 Oct 2016 13:33:35 +0000 (06:33 -0700)]
scsi: megaraid_sas: Do not set MPI2_TYPE_CUDA for JBOD FP path for FW which does not support JBOD sequence map

Orabug: 25568930

CC: stable@vger.kernel.org
Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit d5573584429254a14708cf8375c47092b5edaf2c)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: megaraid_sas: Send SYNCHRONIZE_CACHE for VD to firmware
Kashyap Desai [Fri, 21 Oct 2016 13:33:33 +0000 (06:33 -0700)]
scsi: megaraid_sas: Send SYNCHRONIZE_CACHE for VD to firmware

Orabug: 25568930

Until now the megaraid_sas driver has reported successful completion on
SYNCHRONIZE_CACHE commands without sending them down to the controller.
The controller firmware has been responsible for taking care of flushing
disk caches for all drives that belong to a Virtual Disk at the time of
system reboot/shutdown.

There may have been a reason to avoid sending SYNCHRONIZE_CACHE to a VD
in the past but that no longer appears to be valid.

Older versions of MegaRaid firmware (Gen2 and Gen2.5) set the WCE bit
for Virtual Disks but the firmware does not report correct completion
status for a SYNCHRONIZE_CACHE command. As a result, we must use another
method to identify whether it is safe to send the command to the
controller. We use the canHandleSyncCache firmware flag in the scratch
pad register at offset 0xB4.

New SYNCHRONIZE_CACHE behavior:

IF 'JBOD'

Driver sends SYNCHRONIZE_CACHE command to the firmware
Firmware sends SYNCHRONIZE_CACHE to drive
Firmware obtains status from drive and returns same status back to driver

ELSEIF 'VirtualDisk'

IF firmware supports new API bit called canHandleSyncCache
Driver sends SYNCHRONIZE_CACHE command to the firmware
Firmware does not send SYNCHRONIZE_CACHE to drives
Firmware returns SUCCESS
ELSE
Driver does not send SYNCHRONIZE_CACHE command to the firmware
Driver return SUCCESS for that command
ENDIF
ENDIF

[mkp: edited patch description]

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit d0fc91d67c59068ce6d42e41ce66a4c471e5bc74)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: megaraid_sas: Do not fire DCMDs during PCI shutdown/detach
Kashyap Desai [Fri, 21 Oct 2016 13:33:31 +0000 (06:33 -0700)]
scsi: megaraid_sas: Do not fire DCMDs during PCI shutdown/detach

Orabug: 25568930

This patch addresses the issue of driver firing DCMDs in PCI
shutdown/detach path irrespective of firmware state.  Driver will now
check whether firmware is in operational state or not before firing
DCMDs. If firmware is in unrecoverable state or does not become
operational within specfied time, driver will skip firing DCMDs.

[mkp: fixed typos]

Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Shivasharan Srikanteshwara <shivasharan.srikanteshwara@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit a1dfd62c1ebce71a62f5de002c694d5a22fb32a1)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: megaraid_sas: Send correct PhysArm to FW for R1 VD downgrade
Kashyap Desai [Fri, 21 Oct 2016 13:33:30 +0000 (06:33 -0700)]
scsi: megaraid_sas: Send correct PhysArm to FW for R1 VD downgrade

Orabug: 25568930

This patch fixes the issue of wrong PhysArm was sent to firmware for R1
VD downgrade.

Signed-off-by: Kiran Kumar Kasturi <kiran-kumar.kasturi@broadcom.com>
Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit b3e3827bdd329da1c1b5697e74dfcaf51b65885c)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: megaraid_sas: For SRIOV enabled firmware, ensure VF driver waits for 30secs...
Kashyap Desai [Fri, 21 Oct 2016 13:33:29 +0000 (06:33 -0700)]
scsi: megaraid_sas: For SRIOV enabled firmware, ensure VF driver waits for 30secs before reset

Orabug: 25568930

For SRIOV enabled firmware, if there is a OCR(online controller reset)
possibility driver set the convert flag to 1, which is not happening if
there are outstanding commands even after 180 seconds.  As driver does
not set convert flag to 1 and still making the OCR to run, VF(Virtual
function) driver is directly writing on to the register instead of
waiting for 30 seconds. Setting convert flag to 1 will cause VF driver
will wait for 30 secs before going for reset.

CC: stable@vger.kernel.org
Signed-off-by: Kiran Kumar Kasturi <kiran-kumar.kasturi@broadcom.com>
Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 18e1c7f68a5814442abad849abe6eacbf02ffd7c)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: megaraid_sas: Fix data integrity failure for JBOD (passthrough) devices
Kashyap Desai [Fri, 21 Oct 2016 13:33:32 +0000 (06:33 -0700)]
scsi: megaraid_sas: Fix data integrity failure for JBOD (passthrough) devices

Orabug: 25568930

Commit 02b01e010afe ("megaraid_sas: return sync cache call with
success") modified the driver to successfully complete SYNCHRONIZE_CACHE
commands without passing them to the controller. Disk drive caches are
only explicitly managed by controller firmware when operating in RAID
mode. So this commit effectively disabled writeback cache flushing for
any drives used in JBOD mode, leading to data integrity failures.

[mkp: clarified patch description]

Fixes: 02b01e010afeeb49328d35650d70721d2ca3fd59
CC: stable@vger.kernel.org
Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 1e793f6fc0db920400574211c48f9157a37e3945)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: megaraid_sas: clean function declarations in megaraid_sas_base.c up
Baoyou Xie [Sun, 18 Sep 2016 12:07:59 +0000 (20:07 +0800)]
scsi: megaraid_sas: clean function declarations in megaraid_sas_base.c up

Orabug: 25568930

We get a few warnings when building kernel with W=1:
drivers/scsi/megaraid/megaraid_sas_fusion.c:281:1: warning: no previous prototype for 'megasas_free_cmds_fusion' [-Wmissing-prototypes]
drivers/scsi/megaraid/megaraid_sas_fusion.c:714:1: warning: no previous prototype for 'megasas_ioc_init_fusion' [-Wmissing-prototypes]
....

In fact, these functions are declared in
drivers/scsi/megaraid/megaraid_sas_base.c, but should be declared in a
header file, thus can be recognized in other file.

So this patch adds the declarations into
drivers/scsi/megaraid/megaraid_sas_fusion.h.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 2f3e77323d3159cb6c2a002fa6c58ba22e7c837e)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: megaraid_sas: add in missing white space in error message text
Colin Ian King [Mon, 12 Sep 2016 12:42:12 +0000 (13:42 +0100)]
scsi: megaraid_sas: add in missing white space in error message text

Orabug: 25568930

A dev_printk message spans two lines and the literal string is missing a
white space between words. Add the white space.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 4086eae52beab7808b8aa1a9f7d4095eebc247c7)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: megaraid_sas: Fix the search of first memory bar
Christophe JAILLET [Sun, 21 Aug 2016 08:28:25 +0000 (10:28 +0200)]
scsi: megaraid_sas: Fix the search of first memory bar

Orabug: 25568930

The 2nd parameter of 'find_first_bit' is the number of bits to search.
In this case, we are passing 'sizeof(unsigned long)' which is likely to
be 4.

It is likely that the number of bits in a long was expected here, so use
BITS_PER_LONG instead.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 51f9039ffd751dee54fe26609df645bfd128b1d0)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
drivers/scsi/megaraid/megaraid_sas_base.c

8 years agoscsi: megaraid_sas: Use memdup_user() rather than duplicating its implementation
Markus Elfring [Sun, 21 Aug 2016 08:39:04 +0000 (10:39 +0200)]
scsi: megaraid_sas: Use memdup_user() rather than duplicating its implementation

Orabug: 25568930

Reuse existing functionality from memdup_user() instead of keeping
duplicate source code.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 709ab231f8b4417411147dd9730928ba214d5c31)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agomegaraid_sas: Fix probing cards without io port
Yinghai Lu [Sat, 6 Aug 2016 06:37:34 +0000 (23:37 -0700)]
megaraid_sas: Fix probing cards without io port

Orabug: 25568930

Found one megaraid_sas HBA probe fails,

[  187.235190] scsi host2: Avago SAS based MegaRAID driver
[  191.112365] megaraid_sas 0000:89:00.0: BAR 0: can't reserve [io  0x0000-0x00ff]
[  191.120548] megaraid_sas 0000:89:00.0: IO memory region busy!

and the card has resource like,
[  125.097714] pci 0000:89:00.0: [1000:005d] type 00 class 0x010400
[  125.104446] pci 0000:89:00.0: reg 0x10: [io  0x0000-0x00ff]
[  125.110686] pci 0000:89:00.0: reg 0x14: [mem 0xce400000-0xce40ffff 64bit]
[  125.118286] pci 0000:89:00.0: reg 0x1c: [mem 0xce300000-0xce3fffff 64bit]
[  125.125891] pci 0000:89:00.0: reg 0x30: [mem 0xce200000-0xce2fffff pref]

that does not io port resource allocated from BIOS, and kernel can not
assign one as io port shortage.

The driver is only looking for MEM, and should not fail.

It turns out megasas_init_fw() etc are using bar index as mask.  index 1
is used as mask 1, so that pci_request_selected_regions() is trying to
request BAR0 instead of BAR1.

Fix all related reference.

Fixes: b6d5d8808b4c ("megaraid_sas: Use lowest memory bar for SR-IOV VF support")
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Acked-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit e7f851684efb3377e9c93aca7fae6e76212e5680)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agomegaraid_sas: Do not fire MR_DCMD_PD_LIST_QUERY to controllers which do not support it
Sumit Saxena [Fri, 8 Jul 2016 10:30:16 +0000 (03:30 -0700)]
megaraid_sas: Do not fire MR_DCMD_PD_LIST_QUERY to controllers which do not support it

Orabug: 25568930

There was an issue reported by Lucz Geza on Dell Perc 6i. As per issue
reported, megaraid_sas driver goes into an infinite error reporting loop
as soon as there is a change in the status of one of the
arrays (degrade, resync online etc ).  Below are the error logs reported
continuously-

Jun 25 08:49:30 ns8 kernel: [  757.757017] megaraid_sas 0000:02:00.0: DCMD failed/not supported by firmware: megasas_get_pd_list 4115
Jun 25 08:49:30 ns8 kernel: [  757.778017] megaraid_sas 0000:02:00.0: DCMD failed/not supported by firmware: megasas_get_pd_list 4115
Jun 25 08:49:30 ns8 kernel: [  757.799017] megaraid_sas 0000:02:00.0: DCMD failed/not supported by firmware: megasas_get_pd_list 4115
Jun 25 08:49:30 ns8 kernel: [  757.820018] megaraid_sas 0000:02:00.0: DCMD failed/not supported by firmware: megasas_get_pd_list 4115
Jun 25 08:49:30 ns8 kernel: [  757.841018] megaraid_sas 0000:02:00.0: DCMD failed/not supported by firmware: megasas_get_pd_list 4115

This issue is very much specific to controllers which do not support
DCMD- MR_DCMD_PD_LIST_QUERY.  In case of any hotplugging/rescanning of
drives, AEN thread will be scheduled by driver and fire DCMD-
MR_DCMD_PD_LIST_QUERY and if this DCMD is failed then driver will fail
this event processing and will not go ahead for further events. This
will cause infinite loop of same event getting retried infinitely and
causing above mentioned logs.

Fix for this problem is: not to fire DCMD MR_DCMD_PD_LIST_QUERY for
controllers which do not support it and send DCMD SUCCESS status to AEN
function so that it can go ahead with other event processing.

Reported-by: Lucz Geza <geza@lucz.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit d9083160c2f6ee456ea867ea2279c1fc6124e56f)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agomegaraid_sas: Downgrade two success messages to info
Andy Lutomirski [Tue, 3 May 2016 17:24:31 +0000 (10:24 -0700)]
megaraid_sas: Downgrade two success messages to info

Orabug: 25568930

I actually read the error messages in my logs, and successful
initialization is not an error.

Arguably these log lines could be deleted entirely.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 13f307711b127d30fcf333a04365a217baf9ca2b)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agomegaraid_sas: driver version upgrade
Sumit Saxena [Fri, 15 Apr 2016 07:23:33 +0000 (00:23 -0700)]
megaraid_sas: driver version upgrade

Orabug: 25568930

Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 54c4042852a85713a7bdd8436cc63762049fbb39)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agomegaraid_sas: task management code optimizations
Sumit Saxena [Fri, 15 Apr 2016 07:23:32 +0000 (00:23 -0700)]
megaraid_sas: task management code optimizations

Orabug: 25568930

This patch will do code optmization for task management functions.
Below are key changes:

1. Remove reset_device hook as it was not being used and driver was
setting this to NULL.

2. Create wrapper functions for task abort and target reset and inside
   these functions adapter specific calls be made. e.g. fusion adapters
   support task abort and target reset so task abort and target reset
   should be issued to fusion adapters only and for MFI adapters, print
   a message saying feature not supported.

Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit bd23d4abe5edf09dfba086d44b7972cf73c14b0b)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
drivers/scsi/megaraid/megaraid_sas_base.c

8 years agomegaraid_sas: call ISR function to clean up pending replies in OCR path
Sumit Saxena [Fri, 15 Apr 2016 07:23:31 +0000 (00:23 -0700)]
megaraid_sas: call ISR function to clean up pending replies in OCR path

Orabug: 25568930

In OCR path, before calling chip reset calls function
megasas_wait_for_outstanding_fusion to check reason for OCR. In case of
firmware FAULT initiated OCR and DCMD timeout initiated timeout, driver
will clear any outstanding reply (yet to be processed by driver) in
reply queues before going for chip reset. This code is added to handle a
scenario when IO timeout initiated adapter reset and management
application initiated adapter reset (by sending command to FAULT
firmware) happens simultaneously since adapter reset function is
safe-guarded by reset_mutex so only thread will be doing controller
reset. Consider IO timeout thread gets mutex and proceeds with adapter
reset process after disabling interrupts and by the time management
application has fired command to firmware to do adapter reset and the
same command is completed by firmware but since interrupts are disabled,
driver will not get completion and the same command will be in
outstanding/pending commands list of driver and refires same command
from IO timeout thread after chip reset which will again FAULT firmware
and eventually causes kill adapter.

Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 64d0b8e4a6f7e9a3c366c2df93ec1f003d180ca3)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agomegaraid_sas: reduce memory footprints in kdump mode
Sumit Saxena [Fri, 15 Apr 2016 07:23:30 +0000 (00:23 -0700)]
megaraid_sas: reduce memory footprints in kdump mode

Orabug: 25568930

This patch will reduce memory footprints of megaraid_sas driver when
booted in kdump mode.  Driver will not allocate memory for optional and
perfromance oriented features.  Below are key changes done in
megaraid_sas driver to do this:

1. Limit Controller's queue depth to 100 in kdump mode.

2. Do not allocate memory for system info buffer and PD info buffer.

3. Disable performance oriented features e.g. Disable RDPQ mode, disable
   dual queue depth, restrict to single MSI-x vector.

Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Hannes Reinicke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit c3e385a1b985a9202ba7fbd0bdbdcb909905d00c)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agomegaraid_sas: add missing curly braces in ioctl handler
Arnd Bergmann [Mon, 14 Mar 2016 14:29:45 +0000 (15:29 +0100)]
megaraid_sas: add missing curly braces in ioctl handler

Orabug: 25568930

gcc-6 found a dubious indentation in the megasas_mgmt_fw_ioctl
function:

drivers/scsi/megaraid/megaraid_sas_base.c: In function 'megasas_mgmt_fw_ioctl':
drivers/scsi/megaraid/megaraid_sas_base.c:6658:4: warning: statement is indented as if it were guarded by... [-Wmisleading-indentation]
    kbuff_arr[i] = NULL;
    ^~~~~~~~~
drivers/scsi/megaraid/megaraid_sas_base.c:6653:3: note: ...this 'if' clause, but it is not
   if (kbuff_arr[i])
   ^~

The code is actually correct, as there is no downside in clearing a NULL
pointer again.

This clarifies the code and avoids the warning by adding extra curly
braces.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 90dc9d98f01b ("megaraid_sas : MFI MPT linked list corruption fix")
Reviewed-by: Hannes Reinecke <hare@suse.com>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 3deb9438d34a09f6796639b652a01d110aca9f75)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
8 years agodm btree: fix bufio buffer leaks in dm_btree_del() error path
Joe Thornber [Thu, 10 Dec 2015 14:37:53 +0000 (14:37 +0000)]
dm btree: fix bufio buffer leaks in dm_btree_del() error path

Orabug: 25550785

If dm_btree_del()'s call to push_frame() fails, e.g. due to
btree_node_validator finding invalid metadata, the dm_btree_del() error
path must unlock all frames (which have active dm-bufio buffers) that
were pushed onto the del_stack.

Otherwise, dm_bufio_client_destroy() will BUG_ON() because dm-bufio
buffers have leaked, e.g.:
  device-mapper: bufio: leaked buffer 3, hold count 1, list 0

Signed-off-by: Joe Thornber <ejt@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Cc: stable@vger.kernel.org
(cherry picked from commit ed8b45a3679eb49069b094c0711b30833f27c734)
Signed-off-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
8 years agoipv4: keep skb->dst around in presence of IP options
Eric Dumazet [Sat, 4 Feb 2017 19:16:52 +0000 (11:16 -0800)]
ipv4: keep skb->dst around in presence of IP options

Andrey Konovalov got crashes in __ip_options_echo() when a NULL skb->dst
is accessed.

ipv4_pktinfo_prepare() should not drop the dst if (evil) IP options
are present.

We could refine the test to the presence of ts_needtime or srr,
but IP options are not often used, so let's be conservative.

Thanks to syzkaller team for finding this bug.

Fixes: d826eb14ecef ("ipv4: PKTINFO doesnt need dst reference")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 34b2cef20f19c87999fff3da4071e66937db9644)

Orabug: 25543766
CVE: CVE-2017-5970
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
8 years agompt3sas: Don't spam logs if logging level is 0
Johannes Thumshirn [Wed, 3 Aug 2016 13:00:18 +0000 (15:00 +0200)]
mpt3sas: Don't spam logs if logging level is 0

In _scsih_io_done() we test if the ioc->logging_level does _not_ have
the MPT_DEBUG_REPLY bit set and if it hasn't we print the debug
messages. This unfortunately is the wrong way around.

Note, the actual bug is older than af0094115 but this commit removed the
CONFIG_SCSI_MPT3SAS_LOGGING Kconfig option which hid the bug.

Fixes: af0094115 'mpt2sas, mpt3sas: Remove SCSI_MPTXSAS_LOGGING entry from Kconfig'
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Acked-by: Chaitra P B <chaitra.basappa@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 0d667f72b2a20bbac72bec0ab11467fc70bb0f1f)

Orabug: 25512724

Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
8 years agoip6_gre: fix ip6gre_err() invalid reads
Eric Dumazet [Sun, 5 Feb 2017 07:18:55 +0000 (23:18 -0800)]
ip6_gre: fix ip6gre_err() invalid reads

Andrey Konovalov reported out of bound accesses in ip6gre_err()

If GRE flags contains GRE_KEY, the following expression
*(((__be32 *)p) + (grehlen / 4) - 1)

accesses data ~40 bytes after the expected point, since
grehlen includes the size of IPv6 headers.

Let's use a "struct gre_base_hdr *greh" pointer to make this
code more readable.

p[1] becomes greh->protocol.
grhlen is the GRE header length.

Fixes: c12b395a4664 ("gre: Support GRE over IPv6")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 7892032cfe67f4bde6fc2ee967e45a8fbaf33756)

Orabug: 25510593
CVE: CVE-2017-5897
]dhaval.giani@oracle.com: Added header to fix compile error]
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
Reviewed-by: John Haxby <john.haxby@oracle.com>
8 years agowatchdog: hpwdt: changed maintainer information
Jimmy Vance [Thu, 10 Nov 2016 20:25:27 +0000 (15:25 -0500)]
watchdog: hpwdt: changed maintainer information

Orabug: 25505543

Signed-off-by: Jimmy Vance <jimmy.vance@hpe.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
(cherry picked from commit 4cfccbdaa234b6564326ed3bf18c38f73693fe14)
Signed-off-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
8 years agowatchdog: hpwdt: add support for iLO5
Brian Boylston [Mon, 26 Sep 2016 18:57:14 +0000 (13:57 -0500)]
watchdog: hpwdt: add support for iLO5

Orabug: 25505543

iLO5 will offer the same watchdog timer as previous generations, but the
PCI subsystem vendor ID will be PCI_VENDOR_ID_HP_3PAR (0x1590) instead of
PCI_VENDOR_ID_HP (0x103c).  Add 0x1590 to the whitelist and be more
specific when ignoring the 103c,1979 device.

Signed-off-by: Brian Boylston <brian.boylston@hpe.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
(cherry picked from commit fc113d54e9d7ef3296cdf2eff49c8ca0a3e5a482)
Signed-off-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
8 years agowatchdog: hpwdt: remove email address from doc
Brian Boylston [Wed, 25 May 2016 16:20:15 +0000 (11:20 -0500)]
watchdog: hpwdt: remove email address from doc

Orabug: 25505543

Remove Tom's email address from the documentation

Signed-off-by: Brian Boylston <brian.boylston@hpe.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
(cherry picked from commit 0215efc02e32d0a806ad13be7e43c6784428b334)
Signed-off-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
8 years agowatchdog: hpwdt: Adjust documentation to match latest kernel module parameters.
Nigel Croxon [Wed, 6 Apr 2016 18:40:05 +0000 (14:40 -0400)]
watchdog: hpwdt: Adjust documentation to match latest kernel module parameters.

Orabug: 25505543

Adjust documentation to match latest kernel module parameters.

Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
(cherry picked from commit 84df082cad236a6ec70df1fbbf3d8dcb5c5f994e)
Signed-off-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
8 years agohpwdt: use nmi_panic() when kernel panics in NMI handler
Hidehiro Kawai [Tue, 22 Mar 2016 21:27:24 +0000 (14:27 -0700)]
hpwdt: use nmi_panic() when kernel panics in NMI handler

Orabug: 25505543

Commit 1717f2096b54 ("panic, x86: Fix re-entrance problem due to panic
on NMI") introduced nmi_panic() which prevents concurrent and recursive
execution of panic().  It also saves registers for the crash dump on x86
by later commit 58c5661f2144 ("panic, x86: Allow CPUs to save registers
even if looping in NMI context").

hpwdt driver can call panic() from NMI handler, so replace it with
nmi_panic().  Also, do some cleanups.

Signed-off-by: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
Cc: Thomas Mingarelli <thomas.mingarelli@hpe.com>
Cc: Wim Van Sebroeck <wim@iguana.be>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit abc514c58059ca6f02df41798e828ffd864f1d21)
Signed-off-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
8 years agopanic: change nmi_panic from macro to function
Hidehiro Kawai [Tue, 22 Mar 2016 21:27:17 +0000 (14:27 -0700)]
panic: change nmi_panic from macro to function

Orabug: 25505543

Commit 1717f2096b54 ("panic, x86: Fix re-entrance problem due to panic
on NMI") and commit 58c5661f2144 ("panic, x86: Allow CPUs to save
registers even if looping in NMI context") introduced nmi_panic() which
prevents concurrent/recursive execution of panic().  It also saves
registers for the crash dump on x86.

However, there are some cases where NMI handlers still use panic().
This patch set partially replaces them with nmi_panic() in those cases.

Even this patchset is applied, some NMI or similar handlers (e.g.  MCE
handler) continue to use panic().  This is because I can't test them
well and actual problems won't happen.  For example, the possibility
that normal panic and panic on MCE happen simultaneously is very low.

This patch (of 3):

Convert nmi_panic() to a proper function and export it instead of
exporting internal implementation details to modules, for obvious
reasons.

Signed-off-by: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
Acked-by: Borislav Petkov <bp@suse.de>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Cc: Javi Merino <javi.merino@arm.com>
Cc: Gobinda Charan Maji <gobinda.cemk07@gmail.com>
Cc: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit ebc41f20d77f6ad91f1f2d2af5147dc9bb6b5eea)
Signed-off-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
8 years agowatchdog/hpwdt: Fix build on certain configs
Ingo Molnar [Thu, 25 Feb 2016 07:27:27 +0000 (08:27 +0100)]
watchdog/hpwdt: Fix build on certain configs

Orabug: 25505543

Fix the following build failure:

  drivers/watchdog/hpwdt.c:359:5: error: expected â€˜)’ before â€˜FRAME_BEGIN’

which occurs because hpwdt.c relied on indirect inclusion to get asm/frame.h
definitions - but some (mostly randconfig) configs did not provide that.

Include <asm/frame.h> explicitly.

Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Bernd Petrovitsch <bernd@petrovitsch.priv.at>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Chris J Arges <chris.j.arges@canonical.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Pedro Alves <palves@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Wim Van Sebroeck <wim@iguana.be>
Cc: linux-watchdog@vger.kernel.org
Cc: live-patching@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
(cherry picked from commit 1923f3d02768bd904dfe5607f3f93c3008b8db61)
Signed-off-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
8 years agowatchdog/hpwdt: Create stack frame in asminline_call()
Josh Poimboeuf [Thu, 21 Jan 2016 22:49:31 +0000 (16:49 -0600)]
watchdog/hpwdt: Create stack frame in asminline_call()

Orabug: 25505543

asminline_call() is a callable non-leaf function which doesn't honor
CONFIG_FRAME_POINTER, which can result in bad stack traces.

Create a stack frame when CONFIG_FRAME_POINTER is enabled.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Bernd Petrovitsch <bernd@petrovitsch.priv.at>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Chris J Arges <chris.j.arges@canonical.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Pedro Alves <palves@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Wim Van Sebroeck <wim@iguana.be>
Cc: linux-watchdog@vger.kernel.org
Cc: live-patching@vger.kernel.org
Link: http://lkml.kernel.org/r/60de3cfb6f16d413bfb923036cc87fec132df735.1453405861.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
(cherry picked from commit 5c1d5f283a855a5fe6b4f122054d85072b97ae4a)
Signed-off-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
8 years agox86/asm: Add C versions of frame pointer macros
Josh Poimboeuf [Fri, 18 Dec 2015 12:39:19 +0000 (06:39 -0600)]
x86/asm: Add C versions of frame pointer macros

Orabug: 25505543

Add C versions of the frame pointer macros which can be used to
create a stack frame in inline assembly.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Bernd Petrovitsch <bernd@petrovitsch.priv.at>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Chris J Arges <chris.j.arges@canonical.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Pedro Alves <palves@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/f6786a282bf232ede3e2866414eae3cf02c7d662.1450442274.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
(cherry picked from commit ec5186557abbe711dfd34e1863735dfecb0602cc)
Signed-off-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
8 years agox86/asm: Clean up frame pointer macros
Josh Poimboeuf [Fri, 18 Dec 2015 12:39:18 +0000 (06:39 -0600)]
x86/asm: Clean up frame pointer macros

Orabug: 25505543

Conflicts:
arch/x86/include/asm/frame.h

The asm macros for setting up and restoring the frame pointer
aren't currently being used.  However, they will be needed soon
to help asm functions to comply with stacktool.

Rename FRAME/ENDFRAME to FRAME_BEGIN/FRAME_END for more
symmetry.  Also make the code more readable and improve the
comments.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Bernd Petrovitsch <bernd@petrovitsch.priv.at>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Chris J Arges <chris.j.arges@canonical.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Pedro Alves <palves@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/3f488a8e3bfc8ac7d4d3d350953e664e7182b044.1450442274.git.jpoimboe@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
(cherry picked from commit 997963edd912a6d77d68b2bbc19f40ce8facabd7)
Signed-off-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
8 years agowatchdog: hpwdt: HP rebranding
Mingarelli, Thomas [Mon, 14 Dec 2015 20:22:09 +0000 (20:22 +0000)]
watchdog: hpwdt: HP rebranding

Orabug: 25505543

This patch is for the rebranding changes for the corporate split at HP.
There are no functional changes with this patch.

Signed-off-by: Tom Mingarelli <thomas.mingarelli@hpe.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
(cherry picked from commit ca22e79f5667faf7f6ed238e04075aeff936bbab)
Signed-off-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
8 years agopanic, x86: Allow CPUs to save registers even if looping in NMI context
Hidehiro Kawai [Mon, 14 Dec 2015 10:19:10 +0000 (11:19 +0100)]
panic, x86: Allow CPUs to save registers even if looping in NMI context

Orabug: 25505543

Currently, kdump_nmi_shootdown_cpus(), a subroutine of crash_kexec(),
sends an NMI IPI to CPUs which haven't called panic() to stop them,
save their register information and do some cleanups for crash dumping.
However, if such a CPU is infinitely looping in NMI context, we fail to
save its register information into the crash dump.

For example, this can happen when unknown NMIs are broadcast to all
CPUs as follows:

  CPU 0                             CPU 1
  ===========================       ==========================
  receive an unknown NMI
  unknown_nmi_error()
    panic()                         receive an unknown NMI
      spin_trylock(&panic_lock)     unknown_nmi_error()
      crash_kexec()                   panic()
                                        spin_trylock(&panic_lock)
                                        panic_smp_self_stop()
                                          infinite loop
        kdump_nmi_shootdown_cpus()
          issue NMI IPI -----------> blocked until IRET
                                          infinite loop...

Here, since CPU 1 is in NMI context, the second NMI from CPU 0 is
blocked until CPU 1 executes IRET. However, CPU 1 never executes IRET,
so the NMI is not handled and the callback function to save registers is
never called.

In practice, this can happen on some servers which broadcast NMIs to all
CPUs when the NMI button is pushed.

To save registers in this case, we need to:

  a) Return from NMI handler instead of looping infinitely
  or
  b) Call the callback function directly from the infinite loop

Inherently, a) is risky because NMI is also used to prevent corrupted
data from being propagated to devices.  So, we chose b).

This patch does the following:

1. Move the infinite looping of CPUs which haven't called panic() in NMI
   context (actually done by panic_smp_self_stop()) outside of panic() to
   enable us to refer pt_regs. Please note that panic_smp_self_stop() is
   still used for normal context.

2. Call a callback of kdump_nmi_shootdown_cpus() directly to save
   registers and do some cleanups after setting waiting_for_crash_ipi which
   is used for counting down the number of CPUs which handled the callback

Signed-off-by: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Aaron Tomlin <atomlin@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Baoquan He <bhe@redhat.com>
Cc: Chris Metcalf <cmetcalf@ezchip.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: David Hildenbrand <dahi@linux.vnet.ibm.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Eric Biederman <ebiederm@xmission.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Gobinda Charan Maji <gobinda.cemk07@gmail.com>
Cc: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Cc: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Javi Merino <javi.merino@arm.com>
Cc: Jiang Liu <jiang.liu@linux.intel.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: kexec@lists.infradead.org
Cc: linux-doc@vger.kernel.org
Cc: lkml <linux-kernel@vger.kernel.org>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Seth Jennings <sjenning@redhat.com>
Cc: Stefan Lippers-Hollmann <s.l-h@gmx.de>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ulrich Obergfell <uobergfe@redhat.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Link: http://lkml.kernel.org/r/20151210014628.25437.75256.stgit@softrs
[ Cleanup comments, fixup formatting. ]
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
(cherry picked from commit 58c5661f2144c089bbc2e5d87c9ec1dc1d2964fe)
Signed-off-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
8 years agowatchdog: hpwdt: Add support for WDIOC_SETOPTIONS
Jean Delvare [Sun, 21 Jun 2015 07:32:33 +0000 (09:32 +0200)]
watchdog: hpwdt: Add support for WDIOC_SETOPTIONS

Orabug: 25505543

WDIOC_SETOPTIONS makes it possible to disable and re-enable the
watchdog timer while the hpwdt driver is loaded.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
(cherry picked from commit 46c80b20d07e9309677d81e1226dc30a055b63b7)
Signed-off-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
8 years agodrivers/misc/hpilo: Changes to support new security states in iLO5 FW
Rusk, Mark [Mon, 19 Sep 2016 19:50:01 +0000 (19:50 +0000)]
drivers/misc/hpilo: Changes to support new security states in iLO5 FW

Orabug: 25505535

Changes to support new security states of the iLO5 firmware.

- use BAR5 for CCB's for iLO5
- simplification of error handling

Signed-off-by: Mark Rusk <mark.rusk@hpe.com>
Signed-off-by: David Altobelli <david.altobelli@hpe.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit c9fef1cc3dd3677633e6fd6ea5bd7ef3b741fab3)
Signed-off-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Reviewed-by: Brian Maly <brian.maly@oracle.com>
8 years agomisc: hpilo: Change e-mail address from hp.com to hpe.com
Masanari Iida [Fri, 18 Sep 2015 03:32:13 +0000 (12:32 +0900)]
misc: hpilo: Change e-mail address from hp.com to hpe.com

Orabug: 25505535

This patch changes maintainer's email address from
hp.com to hpe.com in hpilo.c.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Acked-by: David Altobelli <david.altobelli@hpe.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 6b1eb1450269cadfe992465db9941fc42f3bc688)
Signed-off-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Reviewed-by: Brian Maly <brian.maly@oracle.com>
8 years agomisc: hpilo: Add min and max value of module parameter in description
Masanari Iida [Fri, 18 Sep 2015 03:32:12 +0000 (12:32 +0900)]
misc: hpilo: Add min and max value of module parameter in description

Orabug: 25505535

This patch add minimum and maximum value of module parameter
max_ccb in hpilo.c.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 7a56f329c719d296f6b721d0ff10a6048fa94555)
Signed-off-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Reviewed-by: Brian Maly <brian.maly@oracle.com>
8 years agoscsi: aacraid: Fix INTx/MSI-x issue with older controllers
Dave Carroll [Thu, 9 Feb 2017 18:04:47 +0000 (11:04 -0700)]
scsi: aacraid: Fix INTx/MSI-x issue with older controllers

commit 78cbccd3bd68 ("aacraid: Fix for KDUMP driver hang")

caused a problem on older controllers which do not support MSI-x (namely
ASR3405,ASR3805). This patch conditionalizes the previous patch to
controllers which support MSI-x

Cc: <stable@vger.kernel.org> # v4.7+
Fixes: 78cbccd3bd68 ("aacraid: Fix for KDUMP driver hang")
Reported-by: Arkadiusz Miskiewicz <a.miskiewicz@gmail.com>
Signed-off-by: Dave Carroll <david.carroll@microsemi.com>
Reviewed-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 8af8e1c22f9994bb1849c01d66c24fe23f9bc9a0)

Orabug: 25505509
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
8 years agoscsi: aacraid: remove wildcard for series 9 controllers
Kevin Barnett [Thu, 8 Dec 2016 16:29:29 +0000 (10:29 -0600)]
scsi: aacraid: remove wildcard for series 9 controllers

Controllers with this PCI ID never shipped outside of
PMCS/Microsemi. Remove the ID from the aacraid driver. smartpqi is the
correct driver for these controllers.

[mkp: patch description]

Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Signed-off-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit ae2aae2421983f6f68eb7c4692624bc43ea50712)

Orabug: 25505509
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
8 years agoscsi: aacraid: mark aac_src_select_comm() static
Baoyou Xie [Sun, 4 Sep 2016 06:47:10 +0000 (14:47 +0800)]
scsi: aacraid: mark aac_src_select_comm() static

We get 1 warning when building kernel with W=1:
drivers/scsi/aacraid/src.c:616:5: warning: no previous prototype for 'aac_src_select_comm' [-Wmissing-prototypes]

In fact, this function is only used in the file in which it is declared
and don't need a declaration, but can be made static.  so this patch
marks this function with 'static'.

Signed-off-by: Baoyou Xie <baoyou.xie@linaro.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Dave Carroll <david.carroll@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit a44199eee7fdd2791b39da88938e6de6f5058632)

Orabug: 25505509
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
8 years agoaacraid: use kmemdup
Muhammad Falak R Wani [Thu, 19 May 2016 14:08:33 +0000 (19:38 +0530)]
aacraid: use kmemdup

Use kmemdup when some other buffer is immediately copied into allocated
region. It replaces call to allocation followed by memcpy, by a single
call to kmemdup.

Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
Reviewed-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 22e9f5a61666ed1145a09fbe49ac1a6f2ae7be8e)

Orabug: 25505509
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
8 years agoaacraid: do not activate events on non-SRC adapters
Hannes Reinecke [Wed, 18 May 2016 08:16:51 +0000 (10:16 +0200)]
aacraid: do not activate events on non-SRC adapters

Only SRC-based adapters support the AifReqEvent function, so there is no
point in trying to activate it on older, non-SRC based adapters.  Doing
so lead to crashes on older adapters.

Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.com>
Reviewed-by: Raghava Aditya Renukunta <RaghavaAaditya.Renukunta@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 787ab6e97024926f38773287d9f98a9b330bce23)

Orabug: 25505509
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
 Conflicts:
drivers/scsi/aacraid/linit.c

8 years agoaacraid: Fix for KDUMP driver hang
Raghava Aditya Renukunta [Tue, 26 Apr 2016 06:32:37 +0000 (23:32 -0700)]
aacraid: Fix for KDUMP driver hang

When KDUMP is triggered the driver first talks to the firmware in INTX
mode, but the adapter firmware is still in MSIX mode. Therefore the first
driver command hangs since the driver is waiting for an INTX response and
firmware gives a MSIX response. If when the OS is installed on a RAID
drive created by the adapter KDUMP will hang since the driver does not
receive a response in sync mode.

Fixed by: Change the firmware to INTX mode if it is in MSIX mode before
sending the first sync command.

Cc: stable@vger.kernel.org
Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 78cbccd3bd683c295a44af8050797dc4a41376ff)

Orabug: 25505509
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
8 years agoaacraid: Remove code to needlessly complete fib
Raghava Aditya Renukunta [Tue, 26 Apr 2016 06:32:26 +0000 (23:32 -0700)]
aacraid: Remove code to needlessly complete fib

Currently driver completes double completed or spurious interrupted fibs.
This  is not necessary and causes the SCSI mid layer to issue aborts and
resets, since completing a fib  prematurely might trigger a race condition
resulting in the driver not calling the scsi_done callback.

Fixed by removing the call to fib complete.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit eef76f16295d34d7fab6994b82dda60ce002f91d)

Orabug: 25505509
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
8 years agoaacraid: Log firmware AIF messages
Raghava Aditya Renukunta [Tue, 26 Apr 2016 06:32:09 +0000 (23:32 -0700)]
aacraid: Log firmware AIF messages

Firmware AIF messages about cache loss and data recovery are being missed
by the driver since currently they are not captured but rather let go.
This patch to capture those messages and log them for the user.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 9cb62fa24e0d22dbe991c315d6c454a341ea3f76)

Orabug: 25505509
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
8 years agoaacraid: Fix for aac_command_thread hang
Raghava Aditya Renukunta [Tue, 26 Apr 2016 06:31:57 +0000 (23:31 -0700)]
aacraid: Fix for aac_command_thread hang

Typically under error conditions, it is possible for aac_command_thread()
to miss the wakeup from kthread_stop() and go back to sleep, causing it
to hang aac_shutdown.

In the observed scenario, the adapter is not functioning correctly and so
aac_fib_send() never completes (or time-outs depending on how it was
called). Shortly after aac_command_thread() starts it performs
aac_fib_send(SendHostTime) which hangs. When aac_probe_one
/aac_get_adapter_info send time outs, kthread_stop is called which breaks
the command thread out of it's hang.

The code will still go back to sleep in schedule_timeout() without
checking kthread_should_stop() so it causes aac_probe_one to hang until
the schedule_timeout() which is 30 minutes.

Fixed by: Adding another kthread_should_stop() before schedule_timeout()
Cc: stable@vger.kernel.org
Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit fc4bf75ea300a5e62a2419f89dd0e22189dd7ab7)
Orabug: 25505509
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
8 years agoaacraid: Disable MSI mode for series 6, 7, 8 cards
Raghava Aditya Renukunta [Tue, 26 Apr 2016 06:31:43 +0000 (23:31 -0700)]
aacraid: Disable MSI mode for series 6, 7, 8 cards

As the firmware for series 6, 7, 8 cards does not support msi, remove it
in the driver

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit e4d5c4e238999ba0b68618a91eec33e7079cdbd4)

Orabug: 25505509
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
8 years agoaacraid: Relinquish CPU during timeout wait
Raghava Aditya Renukunta [Tue, 26 Apr 2016 06:31:26 +0000 (23:31 -0700)]
aacraid: Relinquish CPU during timeout wait

aac_fib_send has a special function case for initial commands during
driver initialization using wait < 0(pseudo sync mode). In this case,
the command does not sleep but rather spins checking for timeout.This
loop is calls cpu_relax() in an attempt to allow other processes/threads
to use the CPU, but this function does not relinquish the CPU and so the
command will hog the processor. This was observed in a KDUMP
"crashkernel" and that prevented the "command thread" (which is
responsible for completing the command from being timed out) from
starting because it could not get the CPU.

Fixed by replacing "cpu_relax()" call with "schedule()"
Cc: stable@vger.kernel.org
Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Orabug: 25505509
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 07beca2be24cc710461c0b131832524c9ee08910)
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
8 years agoaacraid: Start adapter after updating number of MSIX vectors
Raghava Aditya Renukunta [Tue, 26 Apr 2016 06:31:12 +0000 (23:31 -0700)]
aacraid: Start adapter after updating number of MSIX vectors

The adapter has to be started after updating the number of MSIX Vectors

Fixes: ecc479e00db8 (aacraid: Set correct MSIX count for EEH recovery)
Cc: stable@vger.kernel.org
Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 116d77fea02e2a5aded7d29ba4c692774cb339f1)

Orabug: 25505509
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
8 years agoaacraid: Fix incorrectly named MACRO
Raghava Aditya Renukunta [Tue, 26 Apr 2016 06:31:03 +0000 (23:31 -0700)]
aacraid: Fix incorrectly named MACRO

Suggested-by: Seymour, Shane M <shane.seymour@hpe.com>
Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit a6cd4549af54ee1ba70a77661499828ea5a2bb3c)

Orabug: 25505509
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
8 years agoaacraid: Removed unnecessary checks for NULL
Raghava Aditya Renukunta [Tue, 26 Apr 2016 06:30:55 +0000 (23:30 -0700)]
aacraid: Removed unnecessary checks for NULL

Current driver checks for NULL return from aac_fib_alloc_tag, but it not
possible for it to return NULL.

Fixed by: Remove all the checks for NULL returns from aac_fib_alloc_tag

Suggested-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit da31df8c7285910ee8c8629d901b34a480ab0005)

Orabug: 25505509
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
8 years agoaacraid: add missing curly braces
Arnd Bergmann [Mon, 14 Mar 2016 14:29:43 +0000 (15:29 +0100)]
aacraid: add missing curly braces

gcc-6 warns about obviously wrong indentation for newly added code in
aac_slave_configure():

drivers/scsi/aacraid/linit.c: In function 'aac_slave_configure':
drivers/scsi/aacraid/linit.c:458:3: warning: statement is indented as if it were guarded by... [-Wmisleading-indentation]
   sdev->tagged_supported = 1;
   ^~~~
drivers/scsi/aacraid/linit.c:455:4: note: ...this 'else' clause, but it is not

gcc is correct, and evidently this was meant to be within the curly
braces that should have been there to start with. This patch adds them,
which avoids the warning and makes it clear what was intended here.

Nothing changes in behavior because in the 'if' block, the
sdev->tagged_supported flag is known to be set already.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 6bf3b630d0a7 ("aacraid: SCSI blk tag support")
Reviewed-by: Raghava Aditya Renukunta <raghavaaditya.renukunta@pmcs.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 548f0e65a38f36976260a63ff4acfa9f3b17307d)

Orabug: 25505509
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
8 years agoaacraid: SCSI blk tag support
Raghava Aditya Renukunta [Wed, 3 Feb 2016 23:05:59 +0000 (15:05 -0800)]
aacraid: SCSI blk tag support

The method to allocate and free FIB's in the present code utilizes
spinlocks. Multiple IO's have to wait on the spinlock to acquire or free
fibs creating a performance bottleneck.

An alternative solution would be to use block layer tags to keep track
of the fibs allocated and freed. To this end aac_fib_alloc_tag was
created to utilize the blk layer tags to plug into the Fib pool.These
functions are used exclusively in the IO path. 8 fibs are reserved for
the use of AIF management software and utilize the previous spinlock
based implementations.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@pmcs.com>
Reviewed-by: Shane Seymour <shane.seymour@hpe.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 6bf3b630d0a733b74f7167a1cfac457358e67074)

Orabug: 25505509
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
8 years agoaacraid: Fix character device re-initialization
Raghava Aditya Renukunta [Wed, 3 Feb 2016 23:06:07 +0000 (15:06 -0800)]
aacraid: Fix character device re-initialization

During EEH PCI hotplug activity kernel unloads and loads the driver,
causing character device to be unregistered(aac_remove_one).When the
driver is loaded back using aac_probe_one the character device needs
to be registered again for the AIF management tools to work.

Fixed by adding code to register character device in aac_probe_one if
it is unregistered in aac_remove_one.

Signed-off-by: Raghava Aditya Renukunta <raghavaaditya.renukunta@pmcs.com>
Reviewed-by: Shane Seymour <shane.seymour@hpe.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit b9fb54b425e14658959bbc753452aaaf4d11d6fa)

Orabug: 25505509
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
8 years agoaacraid: Fix AIF triggered IOP_RESET
Raghava Aditya Renukunta [Wed, 3 Feb 2016 23:06:06 +0000 (15:06 -0800)]
aacraid: Fix AIF triggered IOP_RESET

while driver removal is in progress or PCI shutdown is invoked, driver
kills AIF aacraid thread, but IOCTL requests from the management tools
re-start AIF thread leading to IOP_RESET.

Fixed by setting adapter_shutdown flag when PCI shutdown is invoked.

Signed-off-by: Raghava Aditya Renukunta <raghavaaditya.renukunta@pmcs.com>
Reviewed-by: Shane Seymour <shane.seymour@hpe.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit fbd185986ebafaeac900a1af1829fed2bf03242e)

Orabug: 25505509
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
8 years agoaacraid: Created new mutex for ioctl path
Raghava Aditya Renukunta [Wed, 3 Feb 2016 23:06:05 +0000 (15:06 -0800)]
aacraid: Created new mutex for ioctl path

aac_mutex was used to create protect the ioctl path for only the compat
path, it would be make more sense to place mutex in aac_do_ioctl, which
is the main ioctl function call that handles all ioctl commands.

Created new mutex ioctl_mutex in struct aac_dev to protect switch case
in aac_do_ioctl and removed aac_mutex from aac_cfg_ioctl and
aac_compat_do_ioctl

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@pmcs.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 222a9fb376df0f4aec32493a3fb5d18fa56979f2)

Orabug: 25505509
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>
8 years agoaacraid: Fundamental reset support for Series 7
Raghava Aditya Renukunta [Wed, 3 Feb 2016 23:06:04 +0000 (15:06 -0800)]
aacraid: Fundamental reset support for Series 7

Series 7 does not support PCI hot reset used by EEH.

Enabled fundamental reset only for Series 7

Signed-off-by: Raghava Aditya Renukunta <raghavaaditya.renukunta@pmcs.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit 6b93b7dd85dc0788eedc6ad30ff0b01ad9d4c657)

Orabug: 25505509
Signed-off-by: Dhaval Giani <dhaval.giani@oracle.com>