]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/log
mirror_ubuntu-zesty-kernel.git
7 years agoUBUNTU: [Config] linux-tools-common depends on lsb-release
Tim Gardner [Wed, 1 Mar 2017 18:09:30 +0000 (11:09 -0700)]
UBUNTU: [Config] linux-tools-common depends on lsb-release

BugLink: http://bugs.launchpad.net/bugs/1667571
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoof/irq: improve error report on irq discovery process failure
Guilherme G. Piccoli [Mon, 5 Dec 2016 13:59:16 +0000 (11:59 -0200)]
of/irq: improve error report on irq discovery process failure

BugLink: http://bugs.launchpad.net/bugs/1668382
On PowerPC machines some PCI slots might not have level triggered
interrupts capability (also know as level signaled interrupts),
leading of_irq_parse_pci() to complain by presenting error messages
on the kernel log - in this case, the properties "interrupt-map" and
"interrupt-map-mask" are not present on device's node in the device
tree.

This patch introduces a different message for this specific case,
and also reduces its level from error to warning. Besides, we warn
(once) that possibly some PCI slots on the system have no level
triggered interrupts available.
We changed some error return codes too on function of_irq_parse_raw()
in order other failure's cases can be presented in a more precise way.

Before this patch, when an adapter was plugged in a slot without level
interrupts capabilitiy on PowerPC, we saw a generic error message
like this:

    [54.239] pci 002d:70:00.0: of_irq_parse_pci() failed with rc=-22

Now, with this applied, we see the following specific message:

    [16.154] pci 0014:60:00.1: of_irq_parse_pci: no interrupt-map found,
    INTx interrupts not available

Finally, we standardize the error path in of_irq_parse_raw() by always
taking the fail path instead of returning directly from the loop.

Signed-off-by: Guilherme G. Piccoli <gpiccoli@linux.vnet.ibm.com>
Signed-off-by: Rob Herring <robh@kernel.org>
(cherry picked from commit f1aa54840657fe822b026ab56b75088e08c92362)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoLinux 4.10.1
Greg Kroah-Hartman [Sun, 26 Feb 2017 10:09:33 +0000 (11:09 +0100)]
Linux 4.10.1

BugLink: http://bugs.launchpad.net/bugs/1668993
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoxfs: clear delalloc and cache on buffered write failure
Brian Foster [Fri, 17 Feb 2017 01:19:12 +0000 (17:19 -0800)]
xfs: clear delalloc and cache on buffered write failure

BugLink: http://bugs.launchpad.net/bugs/1668993
commit fa7f138ac4c70dc00519c124cf7cd4862a0a5b0e upstream.

The buffered write failure handling code in
xfs_file_iomap_end_delalloc() has a couple minor problems. First, if
written == 0, start_fsb is not rounded down and it fails to kill off a
delalloc block if the start offset is block unaligned. This results in a
lingering delalloc block and broken delalloc block accounting detected
at unmount time. Fix this by rounding down start_fsb in the unlikely
event that written == 0.

Second, it is possible for a failed overwrite of a delalloc extent to
leave dirty pagecache around over a hole in the file. This is because is
possible to hit ->iomap_end() on write failure before the iomap code has
attempted to allocate pagecache, and thus has no need to clean it up. If
the targeted delalloc extent was successfully written by a previous
write, however, then it does still have dirty pages when ->iomap_end()
punches out the underlying blocks. This ultimately results in writeback
over a hole. To fix this problem, unconditionally punch out the
pagecache from XFS before the associated delalloc range.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agortlwifi: rtl_usb: Fix for URB leaking when doing ifconfig up/down
Michael Schenk [Thu, 26 Jan 2017 17:25:04 +0000 (11:25 -0600)]
rtlwifi: rtl_usb: Fix for URB leaking when doing ifconfig up/down

BugLink: http://bugs.launchpad.net/bugs/1668993
commit 575ddce0507789bf9830d089557d2199d2f91865 upstream.

In the function rtl_usb_start we pre-allocate a certain number of urbs
for RX path but they will not be freed when calling rtl_usb_stop. This
results in leaking urbs when doing ifconfig up and down. Eventually,
the system has no available urbs.

Signed-off-by: Michael Schenk <michael.schenk@albis-elcon.com>
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoblock: fix double-free in the failure path of cgwb_bdi_init()
Tejun Heo [Wed, 8 Feb 2017 20:19:07 +0000 (15:19 -0500)]
block: fix double-free in the failure path of cgwb_bdi_init()

BugLink: http://bugs.launchpad.net/bugs/1668993
commit 5f478e4ea5c5560b4e40eb136991a09f9389f331 upstream.

When !CONFIG_CGROUP_WRITEBACK, bdi has single bdi_writeback_congested
at bdi->wb_congested.  cgwb_bdi_init() allocates it with kzalloc() and
doesn't do further initialization.  This usually works fine as the
reference count gets bumped to 1 by wb_init() and the put from
wb_exit() releases it.

However, when wb_init() fails, it puts the wb base ref automatically
freeing the wb and the explicit kfree() in cgwb_bdi_init() error path
ends up trying to free the same pointer the second time causing a
double-free.

Fix it by explicitly initilizing the refcnt to 1 and putting the base
ref from cgwb_bdi_destroy().

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Fixes: a13f35e87140 ("writeback: don't embed root bdi_writeback_congested in bdi_writeback")
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoACPICA: Linuxize: Restore and fix Intel compiler build
Lv Zheng [Wed, 8 Feb 2017 03:00:01 +0000 (11:00 +0800)]
ACPICA: Linuxize: Restore and fix Intel compiler build

BugLink: http://bugs.launchpad.net/bugs/1668993
commit ffab9188e444854882dbc291500d576d6bad7b7b upstream.

ACPICA commit b59347d0b8b676cb555fe8da5cad08fcd4eeb0d3

The following commit cleans up compiler specific inclusions:

  Commit: 9fa1cebdbfff3db8953cebca8ee327d75edefc40
  Subject: ACPICA: OSL: Cleanup the inclusion order of the compiler-specific headers

But breaks one thing due to the following old issue:

 Buidling Linux kernel with Intel compiler originally depends on acgcc.h
 not acintel.h.

So after making Intel compiler build working in ACPICA upstream by
correctly using acintel.h, it becomes unable to build Linux kernel using
Intel compiler as there is no acintel.h in the kernel source tree.

This patch releases acintel.h to Linux kernel and fixes its inclusion in
acenv.h.

Fixes: 9fa1cebdbfff (ACPICA: OSL: Cleanup the inclusion order of the compiler-specific headers)
Link: https://github.com/acpica/acpica/commit/b59347d0
Tested-by: Stepan M Mishura <stepan.m.mishura@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agonetfilter: nf_ct_helper: warn when not applying default helper assignment
Jiri Kosina [Wed, 1 Feb 2017 20:01:54 +0000 (21:01 +0100)]
netfilter: nf_ct_helper: warn when not applying default helper assignment

BugLink: http://bugs.launchpad.net/bugs/1668993
commit dfe75ff8ca74f54b0fa5a326a1aa9afa485ed802 upstream.

Commit 3bb398d925 ("netfilter: nf_ct_helper: disable automatic helper
assignment") is causing behavior regressions in firewalls, as traffic
handled by conntrack helpers is now by default not passed through even
though it was before due to missing CT targets (which were not necessary
before this commit).

The default had to be switched off due to security reasons [1] [2] and
therefore should stay the way it is, but let's be friendly to firewall
admins and issue a warning the first time we're in situation where packet
would be likely passed through with the old default but we're likely going
to drop it on the floor now.

Rewrite the code a little bit as suggested by Linus, so that we avoid
spaghettiing the code even more -- namely the whole decision making
process regarding helper selection (either automatic or not) is being
separated, so that the whole logic can be simplified and code (condition)
duplication reduced.

[1] https://cansecwest.com/csw12/conntrack-attack.pdf
[2] https://home.regit.org/netfilter-en/secure-use-of-helpers/

Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agogoldfish: Sanitize the broken interrupt handler
Thomas Gleixner [Wed, 15 Feb 2017 10:11:51 +0000 (11:11 +0100)]
goldfish: Sanitize the broken interrupt handler

BugLink: http://bugs.launchpad.net/bugs/1668993
commit 6cf18e6927c0b224f972e3042fb85770d63cb9f8 upstream.

This interrupt handler is broken in several ways:

  - It loops forever when the op code is not decodeable

  - It never returns IRQ_HANDLED because the only way to exit the loop
    returns IRQ_NONE unconditionally.

The whole concept of this is broken. Creating devices in an interrupt
handler is beyond any point of sanity.

Make it at least behave halfways sane so accidental users do not have to
deal with a hard to debug lockup.

Fixes: e809c22b8fb028 ("goldfish: add the goldfish virtual bus")
Reported-by: Gabriel C <nix.or.die@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agox86/platform/goldfish: Prevent unconditional loading
Thomas Gleixner [Wed, 15 Feb 2017 10:11:50 +0000 (11:11 +0100)]
x86/platform/goldfish: Prevent unconditional loading

BugLink: http://bugs.launchpad.net/bugs/1668993
commit 47512cfd0d7a8bd6ab71d01cd89fca19eb2093eb upstream.

The goldfish platform code registers the platform device unconditionally
which causes havoc in several ways if the goldfish_pdev_bus driver is
enabled:

 - Access to the hardcoded physical memory region, which is either not
   available or contains stuff which is completely unrelated.

 - Prevents that the interrupt of the serial port can be requested

 - In case of a spurious interrupt it goes into a infinite loop in the
   interrupt handler of the pdev_bus driver (which needs to be fixed
   seperately).

Add a 'goldfish' command line option to make the registration opt-in when
the platform is compiled in.

I'm seriously grumpy about this engineering trainwreck, which has seven
SOBs from Intel developers for 50 lines of code. And none of them figured
out that this is broken. Impressive fail!

Fixes: ddd70cf93d78 ("goldfish: platform device for x86")
Reported-by: Gabriel C <nix.or.die@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoUSB: serial: console: fix uninitialised spinlock
Johan Hovold [Wed, 8 Feb 2017 17:53:08 +0000 (18:53 +0100)]
USB: serial: console: fix uninitialised spinlock

BugLink: http://bugs.launchpad.net/bugs/1668993
commit 14816b16fa0adac24f82492f18fa62c55acabbbe upstream.

Since commit 4a510969374a ("tty: Make tty_files_lock per-tty") a new
tty_struct spin lock is taken in the tty release path, but the
USB-serial-console hack was never updated hence leaving the lock of its
"fake" tty uninitialised. This was eventually detected by lockdep.

Make sure to initialise the new lock also for the fake tty to address
this regression.

Yes, this code is a mess, but cleaning it up is left for another day.

Fixes: 4a510969374a ("tty: Make tty_files_lock per-tty")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoUSB: serial: ark3116: fix register-accessor error handling
Johan Hovold [Thu, 12 Jan 2017 13:56:09 +0000 (14:56 +0100)]
USB: serial: ark3116: fix register-accessor error handling

BugLink: http://bugs.launchpad.net/bugs/1668993
commit 9fef37d7cf170522fb354d6d0ea6de09b9b16678 upstream.

The current implementation failed to detect short transfers, something
which could lead to bits of the uninitialised heap transfer buffer
leaking to user space.

Fixes: 149fc791a452 ("USB: ark3116: Setup some basic infrastructure for new ark3116 driver.")
Fixes: f4c1e8d597d1 ("USB: ark3116: Make existing functions 16450-aware and add close and release functions.")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoUSB: serial: opticon: fix CTS retrieval at open
Johan Hovold [Fri, 13 Jan 2017 12:21:08 +0000 (13:21 +0100)]
USB: serial: opticon: fix CTS retrieval at open

BugLink: http://bugs.launchpad.net/bugs/1668993
commit 2eee05020a0e7ee7c04422cbacdb07859e45dce6 upstream.

The opticon driver used a control request at open to trigger a CTS
status notification to be sent over the bulk-in pipe. When the driver
was converted to using the generic read implementation, an inverted test
prevented this request from being sent, something which could lead to
TIOCMGET reporting an incorrect CTS state.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 7a6ee2b02751 ("USB: opticon: switch to generic read implementation")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoUSB: serial: spcp8x5: fix modem-status handling
Johan Hovold [Thu, 12 Jan 2017 13:56:21 +0000 (14:56 +0100)]
USB: serial: spcp8x5: fix modem-status handling

BugLink: http://bugs.launchpad.net/bugs/1668993
commit 5ed8d41023751bdd3546f2fe4118304357efe8d2 upstream.

Make sure to detect short control transfers and return zero on success
when retrieving the modem status.

This fixes the TIOCMGET implementation which since e1ed212d8593 ("USB:
spcp8x5: add proper modem-status support") has returned TIOCM_LE on
successful retrieval, and avoids leaking bits from the stack on short
transfers.

This also fixes the carrier-detect implementation which since the above
mentioned commit unconditionally has returned true.

Fixes: e1ed212d8593 ("USB: spcp8x5: add proper modem-status support")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoUSB: serial: ftdi_sio: fix line-status over-reporting
Johan Hovold [Thu, 2 Feb 2017 16:38:35 +0000 (17:38 +0100)]
USB: serial: ftdi_sio: fix line-status over-reporting

BugLink: http://bugs.launchpad.net/bugs/1668993
commit a6bb1e17a39818b01b55d8e6238b4b5f06d55038 upstream.

FTDI devices use a receive latency timer to periodically empty the
receive buffer and report modem and line status (also when the buffer is
empty).

When a break or error condition is detected the corresponding status
flags will be set on a packet with nonzero data payload and the flags
are not updated until the break is over or further characters are
received.

In order to avoid over-reporting break and error conditions, these flags
must therefore only be processed for packets with payload.

This specifically fixes the case where after an overrun, the error
condition is continuously reported and NULL-characters inserted until
further data is received.

Reported-by: Michael Walle <michael@walle.cc>
Fixes: 72fda3ca6fc1 ("USB: serial: ftd_sio: implement sysrq handling on
break")
Fixes: 166ceb690750 ("USB: ftdi_sio: clean up line-status handling")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoUSB: serial: ftdi_sio: fix extreme low-latency setting
Johan Hovold [Wed, 25 Jan 2017 14:35:20 +0000 (15:35 +0100)]
USB: serial: ftdi_sio: fix extreme low-latency setting

BugLink: http://bugs.launchpad.net/bugs/1668993
commit c6dce2626606ef16434802989466636bc28c1419 upstream.

Since commit 557aaa7ffab6 ("ft232: support the ASYNC_LOW_LATENCY
flag") the FTDI driver has been using a receive latency-timer value of
1 ms instead of the device default of 16 ms.

The latency timer is used to periodically empty a non-full receive
buffer, but a status header is always sent when the timer expires
including when the buffer is empty. This means that a two-byte bulk
message is received every millisecond also for an otherwise idle port as
long as it is open.

Let's restore the pre-2009 behaviour which reduces the rate of the
status messages to 1/16th (e.g. interrupt frequency drops from 1 kHz to
62.5 Hz) by not setting ASYNC_LOW_LATENCY by default.

Anyone willing to pay the price for the minimum-latency behaviour should
set the flag explicitly instead using the TIOCSSERIAL ioctl or a tool
such as setserial (e.g. setserial /dev/ttyUSB0 low_latency).

Note that since commit 0cbd81a9f6ba ("USB: ftdi_sio: remove
tty->low_latency") the ASYNC_LOW_LATENCY flag has no other effects but
to set a minimal latency timer.

Reported-by: Antoine Aubert <a.aubert@overkiz.com>
Fixes: 557aaa7ffab6 ("ft232: support the ASYNC_LOW_LATENCY flag")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoUSB: serial: ftdi_sio: fix modem-status error handling
Johan Hovold [Thu, 12 Jan 2017 13:56:11 +0000 (14:56 +0100)]
USB: serial: ftdi_sio: fix modem-status error handling

BugLink: http://bugs.launchpad.net/bugs/1668993
commit 427c3a95e3e29e65f59d99aaf320d7506f3eed57 upstream.

Make sure to detect short responses when fetching the modem status in
order to avoid parsing uninitialised buffer data and having bits of it
leak to user space.

Note that we still allow for short 1-byte responses.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoUSB: serial: cp210x: add new IDs for GE Bx50v3 boards
Ken Lin [Fri, 3 Feb 2017 20:00:24 +0000 (04:00 +0800)]
USB: serial: cp210x: add new IDs for GE Bx50v3 boards

BugLink: http://bugs.launchpad.net/bugs/1668993
commit 9a593656def0dc2f6c227851e8e602077267a5f1 upstream.

Add new USB IDs for cp2104/5 devices on Bx50v3 boards due to the design
change.

Signed-off-by: Ken Lin <yungching0725@gmail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoUSB: serial: mos7840: fix another NULL-deref at open
Johan Hovold [Thu, 9 Feb 2017 11:11:41 +0000 (12:11 +0100)]
USB: serial: mos7840: fix another NULL-deref at open

BugLink: http://bugs.launchpad.net/bugs/1668993
commit 5182c2cf2a9bfb7f066ef0bdd2bb6330b94dd74e upstream.

Fix another NULL-pointer dereference at open should a malicious device
lack an interrupt-in endpoint.

Note that the driver has a broken check for an interrupt-in endpoint
which means that an interrupt URB has never even been submitted.

Fixes: 3f5429746d91 ("USB: Moschip 7840 USB-Serial Driver")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agotty: serial: msm: Fix module autoload
Javier Martinez Canillas [Mon, 2 Jan 2017 14:57:20 +0000 (11:57 -0300)]
tty: serial: msm: Fix module autoload

BugLink: http://bugs.launchpad.net/bugs/1668993
commit abe81f3b8ed2996e1712d26d38ff6b73f582c616 upstream.

If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.

Export the module alias information using the MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/tty/serial/msm_serial.ko | grep alias
$

After this patch:

$ modinfo drivers/tty/serial/msm_serial.ko | grep alias
alias:          of:N*T*Cqcom,msm-uartdmC*
alias:          of:N*T*Cqcom,msm-uartdm
alias:          of:N*T*Cqcom,msm-uartC*
alias:          of:N*T*Cqcom,msm-uart

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agonet: socket: fix recvmmsg not returning error from sock_error
Maxime Jayat [Tue, 21 Feb 2017 17:35:51 +0000 (18:35 +0100)]
net: socket: fix recvmmsg not returning error from sock_error

BugLink: http://bugs.launchpad.net/bugs/1668993
[ Upstream commit e623a9e9dec29ae811d11f83d0074ba254aba374 ]

Commit 34b88a68f26a ("net: Fix use after free in the recvmmsg exit path"),
changed the exit path of recvmmsg to always return the datagrams
variable and modified the error paths to set the variable to the error
code returned by recvmsg if necessary.

However in the case sock_error returned an error, the error code was
then ignored, and recvmmsg returned 0.

Change the error path of recvmmsg to correctly return the error code
of sock_error.

The bug was triggered by using recvmmsg on a CAN interface which was
not up. Linux 4.6 and later return 0 in this case while earlier
releases returned -ENETDOWN.

Fixes: 34b88a68f26a ("net: Fix use after free in the recvmmsg exit path")
Signed-off-by: Maxime Jayat <maxime.jayat@mobile-devices.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoip: fix IP_CHECKSUM handling
Paolo Abeni [Tue, 21 Feb 2017 08:33:18 +0000 (09:33 +0100)]
ip: fix IP_CHECKSUM handling

BugLink: http://bugs.launchpad.net/bugs/1668993
[ Upstream commit ca4ef4574f1ee5252e2cd365f8f5d5bafd048f32 ]

The skbs processed by ip_cmsg_recv() are not guaranteed to
be linear e.g. when sending UDP packets over loopback with
MSGMORE.
Using csum_partial() on [potentially] the whole skb len
is dangerous; instead be on the safe side and use skb_checksum().

Thanks to syzkaller team to detect the issue and provide the
reproducer.

v1 -> v2:
 - move the variable declaration in a tighter scope

Fixes: ad6f939ab193 ("ip: Add offset parameter to ip_cmsg_recv")
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoptr_ring: fix race conditions when resizing
Michael S. Tsirkin [Sun, 19 Feb 2017 05:17:17 +0000 (07:17 +0200)]
ptr_ring: fix race conditions when resizing

BugLink: http://bugs.launchpad.net/bugs/1668993
[ Upstream commit e71695307114335be1ed912f4a347396c2ed0e69 ]

Resizing currently drops consumer lock.  This can cause entries to be
reordered, which isn't good in itself.  More importantly, consumer can
detect a false ring empty condition and block forever.

Further, nesting of consumer within producer lock is problematic for
tun, since it produces entries in a BH, which causes a lock order
reversal:

       CPU0                    CPU1
       ----                    ----
  consume:
  lock(&(&r->consumer_lock)->rlock);
                               resize:
                               local_irq_disable();
                               lock(&(&r->producer_lock)->rlock);
                               lock(&(&r->consumer_lock)->rlock);
  <Interrupt>
  produce:
  lock(&(&r->producer_lock)->rlock);

To fix, nest producer lock within consumer lock during resize,
and keep consumer lock during the whole swap operation.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Cc: stable@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>
Acked-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agonet/mlx5: Fix static checker warnings
Or Gerlitz [Thu, 8 Dec 2016 10:58:45 +0000 (12:58 +0200)]
net/mlx5: Fix static checker warnings

BugLink: http://bugs.launchpad.net/bugs/1668019
For some reason, sparse doesn't like using an expression of type (!x)
with a bitwise | and &.  In order to mitigate that, we use a local variable.

This removes the following sparse complaints on the core driver
(and similar ones on the IB driver too):

drivers/net/ethernet/mellanox/mlx5/core/srq.c:83:9: warning: dubious: !x & y
drivers/net/ethernet/mellanox/mlx5/core/srq.c:96:9: warning: dubious: !x & y
drivers/net/ethernet/mellanox/mlx5/core/port.c:59:9: warning: dubious: !x & y
drivers/net/ethernet/mellanox/mlx5/core/vport.c:561:9: warning: dubious: !x & y

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Matan Barak <matanb@mellanox.com>
Reported-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
(cherry picked from commit a61d5ce9cc56e2e41bbb1ad62ca7a16d7e7567bd)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agonet/mlx5: E-Switch, Enlarge the FDB size for the switchdev mode
Or Gerlitz [Tue, 20 Dec 2016 10:38:05 +0000 (12:38 +0200)]
net/mlx5: E-Switch, Enlarge the FDB size for the switchdev mode

BugLink: http://bugs.launchpad.net/bugs/1668019
The E-Switch FDB size was hard coded to 8k. Change it to be

  min(max eswitch table size, max flow counters * num flow groups)

where the max values are read from the firmware and the number of
flow groups is hard-coded as before this change.

We don't know upfront the division of flows to group. This setup allows
each group to be of size up to the where we want to support (we mandate
pairing of flows with counters for offloading). Thus, we don't expect
multiple occurences for a group which in turn adds steering hops.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Tested-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
(cherry picked from commit 264d7bf3c1cfd3a128d621b367f57b81d038ba10)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agonet/mlx5e: Support SRIOV TC encapsulation offloads for IPv6 tunnels
Or Gerlitz [Sun, 11 Dec 2016 19:28:28 +0000 (21:28 +0200)]
net/mlx5e: Support SRIOV TC encapsulation offloads for IPv6 tunnels

BugLink: http://bugs.launchpad.net/bugs/1668019
Add the missing parts for offloading IPv6 tunnels. This includes
route and neigh lookups and construnction of the IPv6 tunnel headers.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Hadar Hen Zion <hadarh@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
(cherry picked from commit ce99f6b97fcdcb4e7f6f7e2fe5e5fe6c65585cab)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agonet/mlx5e: Maximize ip tunnel key usage on the TC offloading path
Or Gerlitz [Tue, 3 Jan 2017 17:03:00 +0000 (19:03 +0200)]
net/mlx5e: Maximize ip tunnel key usage on the TC offloading path

BugLink: http://bugs.launchpad.net/bugs/1668019
Use more fields out of the tunnel key (e.g the tunnel source IP address)
provided by upper layers for the route lookup done on the encap offload path.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Hadar Hen Zion <hadarh@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
(cherry picked from commit 9a941117fb761dcfb4f698f1f67340484b781b90)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agonet/mlx5e: Use the full tunnel key info for encapsulation offload house-keeping
Or Gerlitz [Thu, 5 Jan 2017 14:43:29 +0000 (16:43 +0200)]
net/mlx5e: Use the full tunnel key info for encapsulation offload house-keeping

BugLink: http://bugs.launchpad.net/bugs/1668019
Currently we use subset of the input tunnel key fields (id, ip daddr,
dst port) which are provided by upper layers to indentify flows that should
go through the same encapsulation and maintain the HW encapsulation table.

This is redundant and can get us wrong.

Instead, keep a copy of the ip tunnel info provided by the user
through TC and have the tunnel key part as the key to our internal hash.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Hadar Hen Zion <hadarh@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
(cherry picked from commit 76f7444dd5a4349af40e4c67e4b995d4ae3c5c92)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agonet/mlx5e: TC ipv4 tunnel encap offload cosmetic changes
Or Gerlitz [Wed, 21 Dec 2016 15:31:18 +0000 (17:31 +0200)]
net/mlx5e: TC ipv4 tunnel encap offload cosmetic changes

BugLink: http://bugs.launchpad.net/bugs/1668019
Move around some settings of variables as pre-step to make things
more robust and clear for the ipv6 case in down-stream patch.
This patch doesn't change any functionality.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Hadar Hen Zion <hadarh@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
(back ported from commit 75c33da827365afa6f3d708ad1f7abe18e0ba4a3)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Conflicts:
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c

7 years agonet/mlx5e: Add TC offloads matching on IPv6 encapsulation headers
Or Gerlitz [Sun, 11 Dec 2016 10:20:53 +0000 (12:20 +0200)]
net/mlx5e: Add TC offloads matching on IPv6 encapsulation headers

BugLink: http://bugs.launchpad.net/bugs/1668019
Enhance the parsing of offloaded TC rules to set HW matching on outer
IPv6 encapsulation headers. This effectively adds support for TC tunnel
key release action (decapsulation) of SRIOV offloads over IPv6 tunnels.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Hadar Hen Zion <hadarh@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
(cherry picked from commit 19f4440141af8cd9b2f280ec38476baa86dc87f9)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agonet/mlx5: Use exact encap header size for the FW input buffer
Or Gerlitz [Sun, 11 Dec 2016 10:15:08 +0000 (12:15 +0200)]
net/mlx5: Use exact encap header size for the FW input buffer

BugLink: http://bugs.launchpad.net/bugs/1668019
The current code is allocating the max encap size supported by
the firmware and not the size requested by the caller, fix that.

Also, spare a warning when the size of the encapsulation headers
is bigger from what is supported by the firmware.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Hadar Hen Zion <hadarh@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
(cherry picked from commit 073ff3c8e6acdd6bae91a037e6f2d0edeed4165d)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoIB/mlx5: Enable Eth VFs to query their min-inline value for user-space
Or Gerlitz [Wed, 30 Nov 2016 18:33:33 +0000 (20:33 +0200)]
IB/mlx5: Enable Eth VFs to query their min-inline value for user-space

BugLink: http://bugs.launchpad.net/bugs/1668019
For some mlx5 HW models (CX4, CX4Lx), the VF driver needs to put part
of the packet headers on the TX descriptor so the e-switch can do proper
matching and steering. This is called "min-inline", it's advertized to
the VF by the FW and also enforced on them by the HW, such that if they
don't obey, their packets are dropped.

SRIOV VF libmlx5 instances should take into account the min-inline
value of their vports. For that end, we provide this value through
the vendor response part of init_ucontext command.

The min inline value is reported in a way which will let newer libmlx5
instances realize that they are running over an older kernel and act
accordingly (e.g apply some educated guess).

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Matan Barak <matanb@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
(cherry picked from commit 7898489880f55a9c3a954cd5660a0fb4fd81b625)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agonet/mlx5: Push min-inline mode resolution helper into the core
Or Gerlitz [Wed, 30 Nov 2016 18:23:51 +0000 (20:23 +0200)]
net/mlx5: Push min-inline mode resolution helper into the core

BugLink: http://bugs.launchpad.net/bugs/1668019
So we can use that from the IB driver too in downstream patches.

This patch doesn't change any functionality.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
(cherry picked from commit 8c7245a60ef8f8c4a427349690c5a141cfed6217)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agonet/sched: cls_bpf: Reflect HW offload status
Or Gerlitz [Thu, 16 Feb 2017 08:31:16 +0000 (10:31 +0200)]
net/sched: cls_bpf: Reflect HW offload status

BugLink: http://bugs.launchpad.net/bugs/1668019
BPF classifier support for the "in hw" offloading flags.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Amir Vadai <amir@vadai.me>
Acked-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 5cecb6cc008148b4afc51f7bacfa753e1a957483)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agonet/sched: cls_u32: Reflect HW offload status
Or Gerlitz [Thu, 16 Feb 2017 08:31:15 +0000 (10:31 +0200)]
net/sched: cls_u32: Reflect HW offload status

BugLink: http://bugs.launchpad.net/bugs/1668019
U32 support for the "in hw" offloading flags.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Amir Vadai <amir@vadai.me>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 24d3dc6d27eae19f422a5e216e25d3a16628d4ff)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agonet/sched: cls_matchall: Reflect HW offloading status
Or Gerlitz [Thu, 16 Feb 2017 08:31:14 +0000 (10:31 +0200)]
net/sched: cls_matchall: Reflect HW offloading status

BugLink: http://bugs.launchpad.net/bugs/1668019
Matchall support for the "in hw" offloading flags.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Amir Vadai <amir@vadai.me>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit c7d2b2f5eebe6e76efc11cfd7a600c0748234f3a)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agonet/sched: cls_flower: Reflect HW offload status
Or Gerlitz [Thu, 16 Feb 2017 08:31:13 +0000 (10:31 +0200)]
net/sched: cls_flower: Reflect HW offload status

BugLink: http://bugs.launchpad.net/bugs/1668019
Flower support for the "in hw" offloading flags.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Amir Vadai <amir@vadai.me>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 55593960d0d88c6d80b7b3a615dbe09de85f2541)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agonet/sched: Reflect HW offload status
Or Gerlitz [Thu, 16 Feb 2017 08:31:12 +0000 (10:31 +0200)]
net/sched: Reflect HW offload status

BugLink: http://bugs.launchpad.net/bugs/1668019
Currently there is no way of querying whether a filter is
offloaded to HW or not when using "both" policy (where none
of skip_sw or skip_hw flags are set by user-space).

Add two new flags, "in hw" and "not in hw" such that user
space can determine if a filter is actually offloaded to
hw or not. The "in hw" UAPI semantics was chosen so it's
similar to the "skip hw" flag logic.

If none of these two flags are set, this signals running
over older kernel.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Reviewed-by: Amir Vadai <amir@vadai.me>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit e696028acc458aa3d43ad899371a963eb28336d8)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agonet/sched: cls_matchall: Dump the classifier flags
Or Gerlitz [Thu, 16 Feb 2017 08:31:11 +0000 (10:31 +0200)]
net/sched: cls_matchall: Dump the classifier flags

BugLink: http://bugs.launchpad.net/bugs/1668019
The classifier flags are not dumped to user-space, do that.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Acked-by: Yotam Gigi <yotamg@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 7a335adad8b06778c0876aa5a5eb8954cd835bf5)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agonet/sched: cls_flower: Properly handle classifier flags dumping
Or Gerlitz [Thu, 16 Feb 2017 08:31:10 +0000 (10:31 +0200)]
net/sched: cls_flower: Properly handle classifier flags dumping

BugLink: http://bugs.launchpad.net/bugs/1668019
Dump the classifier flags only if non zero and make sure to check
the return status of the handler that puts them into the netlink msg.

Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 749e6720d2ee10d5221d5d7b8cee8ac5d1cd690e)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agonet/sched: cls_flower: Disallow duplicate internal elements
Paul Blakey [Mon, 16 Jan 2017 08:45:13 +0000 (10:45 +0200)]
net/sched: cls_flower: Disallow duplicate internal elements

BugLink: http://bugs.launchpad.net/bugs/1668019
Flower currently allows having the same filter twice with the same
priority. Actions (and statistics update) will always execute on the
first inserted rule leaving the second rule unused.
This patch disallows that.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit a3308d8fd1f58c67aaae52d9468791c2082ab2c7)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoUBUNTU: SAUCE: Tools: hv: vss: Thaw the filesystem and continue after freeze fails
Alex Ng [Mon, 27 Feb 2017 18:55:08 +0000 (13:55 -0500)]
UBUNTU: SAUCE: Tools: hv: vss: Thaw the filesystem and continue after freeze fails

BugLink: http://bugs.launchpad.net/bugs/1470250
If a FREEZE operation takes too long, the driver may time out and move on
to another  operation. The daemon is unaware of this and attempts to
notify the driver that the FREEZE succeeded. This results in an error from
the driver and the daemon leaves the filesystem in frozen state.

Fix this by thawing the filesystem and continuing.

Signed-off-by: Alex Ng <alexng@messages.microsoft.com>
Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Fixed expander hotplug for SMART family
Raghava Aditya Renukunta [Wed, 22 Feb 2017 15:23:13 +0000 (07:23 -0800)]
scsi: aacraid: Fixed expander hotplug for SMART family

BugLink: http://bugs.launchpad.net/bugs/1668726
Current driver Hotplug processing code skips over Enclosure channel,
therefore any addition/removal of expander enclosure is not processed.
Additionally device addition code relies on older device type, which
prevents the hotplug of adapter expanders.

Fixed by removing code that skips over Enclosure channels and using the
latest device type for addition or removal or enclosure expanders.

Fixes: 6223a39fe6fbbeef (scsi: aacraid: Added support for hotplug)
Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: Dave Carroll <david.carroll@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit a56e574067c20d01d8fc74863fa187dd66da7b94)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Update driver version
Raghava Aditya Renukunta [Thu, 16 Feb 2017 20:51:24 +0000 (12:51 -0800)]
scsi: aacraid: Update driver version

BugLink: http://bugs.launchpad.net/bugs/1668726
Updated driver version to 50792

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: David Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit 0662cc968aceaca34848e63f431e585f4f71f746)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Fix a potential spinlock double unlock bug
Raghava Aditya Renukunta [Thu, 16 Feb 2017 20:51:23 +0000 (12:51 -0800)]
scsi: aacraid: Fix a potential spinlock double unlock bug

BugLink: http://bugs.launchpad.net/bugs/1668726
The driver does not unlock the reply  queue spin lock after handling SMART
adapter events. Instead it might attempt to unlock an already unlocked
spin lock.

Fixed by making sure the driver locks the spin lock before freeing it.

Thank you dan for finding this issue out.

Fixes: 6223a39fe6fbbeef (scsi: aacraid: Added support for hotplug)
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: David Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit d844752e1801099f92c178845f56412861a2b4af)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Save adapter fib log before an IOP reset
Raghava Aditya Renukunta [Thu, 16 Feb 2017 20:51:22 +0000 (12:51 -0800)]
scsi: aacraid: Save adapter fib log before an IOP reset

BugLink: http://bugs.launchpad.net/bugs/1668726
Currently  the adapter firmware does not save outstanding I/O's log
information  when an IOP reset is triggered. This is problematic when
trying to root cause and debug issues.

Fixed by adding sync command to trigger I/O log file save in the adapter
firmware before issuing an IOP reset.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: David Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit 09624645e1e85df8d68b04de6e0607d696268333)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Reorder Adapter status check
Raghava Aditya Renukunta [Thu, 16 Feb 2017 20:51:21 +0000 (12:51 -0800)]
scsi: aacraid: Reorder Adapter status check

BugLink: http://bugs.launchpad.net/bugs/1668726
The driver currently checks the SELF_TEST_FAILED first and then
KERNEL_PANIC next. Under error conditions(boot code failure) both
SELF_TEST_FAILED and KERNEL_PANIC can be set at the same time.

The driver has the capability to reset the controller on an KERNEL_PANIC,
but not on SELF_TEST_FAILED.

Fixed by first checking KERNEL_PANIC and then the others.

Cc: stable@vger.kernel.org
Fixes: e8b12f0fb835223752 ([SCSI] aacraid: Add new code for PMC-Sierra's SRC base controller family)
Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: David Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit c421530bf848604e97d0785a03b3fe2c62775083)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Skip IOP reset on controller panic(SMART Family)
Raghava Aditya Renukunta [Thu, 16 Feb 2017 20:51:20 +0000 (12:51 -0800)]
scsi: aacraid: Skip IOP reset on controller panic(SMART Family)

BugLink: http://bugs.launchpad.net/bugs/1668726
When the SMART family of controller panic (KERNEL_PANIC) , they do not
honor IOP resets. So better to skip it and directly perform a IWBR reset.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: David Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit 146aa1786d4978795cab5347d810e00236dea1c3)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Decrease adapter health check interval
Raghava Aditya Renukunta [Thu, 16 Feb 2017 20:51:19 +0000 (12:51 -0800)]
scsi: aacraid: Decrease adapter health check interval

BugLink: http://bugs.launchpad.net/bugs/1668726
Currently driver checks the health status of the adapter once every 24
hours. When that happens the driver becomes dependent on the kernel to
figure out if the  adapter is misbehaving. This might take some time
(when the adapter is idle). The driver currently has support to
restart/recover the controller when it fails, and decreasing the time
interval will help.

Fixed by decreasing check interval from 24 hours to 1 minute

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: David Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit 11da1b7c4856de05e00f50f54efe2f5349214d5b)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Reload offlined drives after controller reset
Raghava Aditya Renukunta [Thu, 16 Feb 2017 20:51:18 +0000 (12:51 -0800)]
scsi: aacraid: Reload offlined drives after controller reset

BugLink: http://bugs.launchpad.net/bugs/1668726
During the IOP reset stress testing, it was found that the drives can be
marked offline when the adapter controller crashes and IO's are running
in parallel. When the controller  does come back from the reset, the drive
that is marked offline is not exposed.

Fixed by removing and adding drives that are marked offline. In addition
invoke a scsi host bus rescan to capture any additional configuration
changes.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: David Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit a2d0321dd532901ea64118ed5a752fa6e447d1da)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Skip wellness sync on controller failure
Raghava Aditya Renukunta [Thu, 16 Feb 2017 20:51:17 +0000 (12:51 -0800)]
scsi: aacraid: Skip wellness sync on controller failure

BugLink: http://bugs.launchpad.net/bugs/1668726
aac_command_thread checks on the health of controller periodically,
using aac_check_health. If the status is an error state KERNEL_PANIC or
anything else. The driver will attempt to restart the adapter, but the
response is not checked in aac_command_thread. This allows the periodic
sync to go thru and lead the driver to a hung state.

Fixed by terminating the periodic loop(intended per original design),
if the controller is not restored to a healthy state.

Cc: stable@vger.kernel.org
Fixes: 3d77d8404478353358 (scsi: aacraid: Added support for periodic wellness sync)
Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: David Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit 849ac6a591bf7b5777fdb6ce65030f32a7c73e1a)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Fix sync fibs time out on controller reset
Raghava Aditya Renukunta [Thu, 16 Feb 2017 20:51:16 +0000 (12:51 -0800)]
scsi: aacraid: Fix sync fibs time out on controller reset

BugLink: http://bugs.launchpad.net/bugs/1668726
After controller shutdown, all sync fibs time out due to not knowing
about the switch to INT-x mode

Fixed by replacing aac_src_access_devreg() to aac_set_intx_mode() call.

Cc: stable@vger.kernel.org
Fixes: 495c021767bd78c998 (aacraid: MSI-x support)
Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: David Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit a7e2c642844cfefd570cb54a8d9fe7b85605311b)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Added sysfs for driver version
Raghava Aditya Renukunta [Thu, 16 Feb 2017 20:51:15 +0000 (12:51 -0800)]
scsi: aacraid: Added sysfs for driver version

BugLink: http://bugs.launchpad.net/bugs/1668726
Added support to retrieve driver version from a new sysfs variable called
driver_version. It makes it easier for the user to figure out the driver
version that is currently running.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: David Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit 30202e067a81754cb78cb823b7ce7e7cddd040e2)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Fix memory leak in fib init path
Raghava Aditya Renukunta [Thu, 16 Feb 2017 20:51:14 +0000 (12:51 -0800)]
scsi: aacraid: Fix memory leak in fib init path

BugLink: http://bugs.launchpad.net/bugs/1668726
aac_fib_map_free frees misaligned fib dma memory, additionally it does not
free up the whole memory.

Fixed by changing the  code to free up the correct and full memory
allocation.

Cc: stable@vger.kernel.org
Fixes: e8b12f0fb835223 ([SCSI] aacraid: Add new code for PMC-Sierra's SRC based controller family)
Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: David Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit 1bff5abca65d4b9761fcc992ab6288243220003d)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Prevent E3 lockup when deleting units
Raghava Aditya Renukunta [Thu, 16 Feb 2017 20:51:13 +0000 (12:51 -0800)]
scsi: aacraid: Prevent E3 lockup when deleting units

BugLink: http://bugs.launchpad.net/bugs/1668726
Arrconf management utility at times sends fibs with AdapterProcessed set
in its fibs. This causes the controller to panic and lockup.

Fixed by failing the commands that have AdapterProcessed set in its flag.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: David Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit a0c6143e95c5b9e1f2d83e005e4e86ed3dc6096f)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Fix for excessive prints on EEH
Raghava Aditya Renukunta [Thu, 16 Feb 2017 20:51:12 +0000 (12:51 -0800)]
scsi: aacraid: Fix for excessive prints on EEH

BugLink: http://bugs.launchpad.net/bugs/1668726
This issue showed up on a kdump debug(single CPU on powerkvm), when EEH
errors rendered the adapter unusable. The driver correctly detected the
issue and attempted to restart the controller, in doing so the driver
attempted to read the status registers of the controller. This triggered
additional eeh errors which continued for a good 6 minutes.

Fixed by returning without waiting when EEH error is reported.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: David Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit 16ae9dd35d374182ce955063100fce66a9974e74)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Use correct channel number for raw srb
Raghava Aditya Renukunta [Thu, 16 Feb 2017 20:51:11 +0000 (12:51 -0800)]
scsi: aacraid: Use correct channel number for raw srb

BugLink: http://bugs.launchpad.net/bugs/1668726
The channel being used for raw srb commands is retrieved from the utility
sent fibs and is converted into physical channel id. The driver does not
need to to do this since the management utility sends the correct channel
id in the first place and in addition the driver sets inaccurate
information in the cmd sent to the firmware and gets an invalid response.

Fixed by using channel id from srb command.

Cc: stable@vger.kernel.org
Fixes: 423400e64d377c0 ("scsi: aacraid: Include HBA direct interface")
Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: David Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit f3ef4a74dc3712ef0ce60d652aa87b1ba70cb2a4)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Fix camel case
Raghava Aditya Renukunta [Thu, 16 Feb 2017 20:51:10 +0000 (12:51 -0800)]
scsi: aacraid: Fix camel case

BugLink: http://bugs.launchpad.net/bugs/1668726
Replaced camel case with snake case for init supported options.

Suggested-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: David Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit 1c68856e6ea8abd714415e52ef88943c022e24f0)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: avoid open-coded upper_32_bits
Arnd Bergmann [Tue, 7 Feb 2017 12:59:30 +0000 (13:59 +0100)]
scsi: aacraid: avoid open-coded upper_32_bits

BugLink: http://bugs.launchpad.net/bugs/1668726
Shifting a dma_addr_t right by 32 bits causes a compile-time warning
when that type is only 32 bit wide:

drivers/scsi/aacraid/src.c: In function 'aac_src_start_adapter':
drivers/scsi/aacraid/src.c:414:29: error: right shift count >= width of type [-Werror=shift-count-overflow]

This changes the driver to use the predefined macros consistently,
including one correct but open-coded upper_32_bits() instance.

Fixes: d1ef4da8487f ("scsi: aacraid: added support for init_struct_8")
Fixes: 423400e64d37 ("scsi: aacraid: Include HBA direct interface")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit 80a94bb357813901e61f2dc80deae2015c50fdcd)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: rcode is unsigned and should be signed int
Colin Ian King [Tue, 7 Feb 2017 11:51:29 +0000 (11:51 +0000)]
scsi: aacraid: rcode is unsigned and should be signed int

BugLink: http://bugs.launchpad.net/bugs/1668726
aac_fib_send can return -ve error returns and hence rcode should be
signed. Currently the rcode >= 0 check is always true and -ve errors are
not being checked.

Thanks to Dan Carpenter for spotting my original broken fix to this
issue.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit 76291469772fb932523c2e0003848934cd29e7cb)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: update version
Raghava Aditya Renukunta [Thu, 2 Feb 2017 23:53:38 +0000 (15:53 -0800)]
scsi: aacraid: update version

BugLink: http://bugs.launchpad.net/bugs/1668726
Update the driver version to 50740

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Dave Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit 96f6a6134766de0d42a98c7758736dde16e0add5)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Change Driver Version Prefix
Raghava Aditya Renukunta [Thu, 2 Feb 2017 23:53:37 +0000 (15:53 -0800)]
scsi: aacraid: Change Driver Version Prefix

BugLink: http://bugs.launchpad.net/bugs/1668726
Change the aacraid driver prefix from 1.2-1 to 1.2.1

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Dave Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit 0ba8fdae311fa2a862304aef2483a1b590104be0)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Update copyrights
Raghava Aditya Renukunta [Thu, 2 Feb 2017 23:53:36 +0000 (15:53 -0800)]
scsi: aacraid: Update copyrights

BugLink: http://bugs.launchpad.net/bugs/1668726
Added new copyright messages

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Dave Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit f4babba0af362481e470fb493ea269c2bcd9e9fb)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Retrieve HBA host information ioctl
Raghava Aditya Renukunta [Thu, 2 Feb 2017 23:53:35 +0000 (15:53 -0800)]
scsi: aacraid: Retrieve HBA host information ioctl

BugLink: http://bugs.launchpad.net/bugs/1668726
Added a new ioctl interface to retrieve the host device information.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Dave Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit c799d519bf088c0c5deb481b0190990417ace1bc)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Added ioctl to trigger IOP/IWBR reset
Raghava Aditya Renukunta [Thu, 2 Feb 2017 23:53:34 +0000 (15:53 -0800)]
scsi: aacraid: Added ioctl to trigger IOP/IWBR reset

BugLink: http://bugs.launchpad.net/bugs/1668726
Added a new ioctl interface to trigger an IOP or IWBR reset from ioctl.
Primary used by management utility to trigger resets.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Dave Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit 09867a0e34d20864c3b4b1e49f688470c3f8bdc2)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Added new IWBR reset
Raghava Aditya Renukunta [Thu, 2 Feb 2017 23:53:33 +0000 (15:53 -0800)]
scsi: aacraid: Added new IWBR reset

BugLink: http://bugs.launchpad.net/bugs/1668726
Added a new IWBR soft reset type, reworked the IOP reset interface for
a bit.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Dave Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit 3136432956501f071891c3d4b6194feb2df924a5)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: VPD 83 type3 support
Raghava Aditya Renukunta [Thu, 2 Feb 2017 23:53:32 +0000 (15:53 -0800)]
scsi: aacraid: VPD 83 type3 support

BugLink: http://bugs.launchpad.net/bugs/1668726
This patch adds support to retrieve the unique identifier data (VPD page
83 type3) for Logical drives created on SmartIOC 2000 products. In
addition  added a sysfs device structure to expose the id information.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Dave Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit 999b3ffc0f3b12bb9eeafabaa88176bb7acb84a1)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Added support to abort cmd and reset lun
Raghava Aditya Renukunta [Thu, 2 Feb 2017 23:53:31 +0000 (15:53 -0800)]
scsi: aacraid: Added support to abort cmd and reset lun

BugLink: http://bugs.launchpad.net/bugs/1668726
Added task management command support to abort any timed out commands
in case of a eh_abort call and to reset lun's in case of eh_reset call.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Dave Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit 954b2b5ac76d6bde80974c0779d36f054e036aa5)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Add task management functionality
Raghava Aditya Renukunta [Thu, 2 Feb 2017 23:53:30 +0000 (15:53 -0800)]
scsi: aacraid: Add task management functionality

BugLink: http://bugs.launchpad.net/bugs/1668726
Added support to send out task management commands.

[mkp: removed // fibsize... ]

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Dave Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit ab5d129f93c91fff74100bcd898d605da461f4a6)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Include HBA direct interface
Raghava Aditya Renukunta [Thu, 2 Feb 2017 23:53:29 +0000 (15:53 -0800)]
scsi: aacraid: Include HBA direct interface

BugLink: http://bugs.launchpad.net/bugs/1668726
Added support to send direct pasthru srb commands from management utilty
to the  controller.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Dave Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit 423400e64d377c0d8a2459795420681177e51e74)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Added support for hotplug
Raghava Aditya Renukunta [Thu, 2 Feb 2017 23:53:28 +0000 (15:53 -0800)]
scsi: aacraid: Added support for hotplug

BugLink: http://bugs.launchpad.net/bugs/1668726
Added support for drive hotplug add and removal

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Dave Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit 6223a39fe6fbbeef0877a56dc427a6351f22ef6c)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Added support to set QD of attached drives
Raghava Aditya Renukunta [Thu, 2 Feb 2017 23:53:27 +0000 (15:53 -0800)]
scsi: aacraid: Added support to set QD of attached drives

BugLink: http://bugs.launchpad.net/bugs/1668726
Added support to set qd of drives in slave_configure.This only works for
HBA1000 attached drives.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Dave Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit a052865fe2871a3888dbb4ecf8c5dcab77a19ae8)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Retrieve Queue Depth from Adapter FW
Raghava Aditya Renukunta [Thu, 2 Feb 2017 23:53:26 +0000 (15:53 -0800)]
scsi: aacraid: Retrieve Queue Depth from Adapter FW

BugLink: http://bugs.launchpad.net/bugs/1668726
Retrieved queue depth from fw and saved it for future use.
Only applicable for HBA1000 drives.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Dave Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit 71a91ca4f9838433a92f5d4e3d80955a753bda88)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Added support for periodic wellness sync
Raghava Aditya Renukunta [Thu, 2 Feb 2017 23:53:25 +0000 (15:53 -0800)]
scsi: aacraid: Added support for periodic wellness sync

BugLink: http://bugs.launchpad.net/bugs/1668726
This patch adds a new functions that periodically sync the time of host
to the adapter. In addition also informs the adapter that the driver is
alive and kicking. Only applicable to the HBA1000 and SMARTIOC2000.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Dave Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit 3d77d84044783533581eec7b6229df1154c0b55f)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Reworked aac_command_thread
Raghava Aditya Renukunta [Thu, 2 Feb 2017 23:53:24 +0000 (15:53 -0800)]
scsi: aacraid: Reworked aac_command_thread

BugLink: http://bugs.launchpad.net/bugs/1668726
Reworked aac_command_thread into aac_process_events

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Dave Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit 113156bcea9ef1e6b3bafc53e64f7812c356b21b)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Added support for read medium error
Raghava Aditya Renukunta [Thu, 2 Feb 2017 23:53:23 +0000 (15:53 -0800)]
scsi: aacraid: Added support for read medium error

BugLink: http://bugs.launchpad.net/bugs/1668726
This patch processes Raw IO read medium errors.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Dave Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit f956a669bf1c2a7b273f753023717d630222d2cc)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Added support for response path
Raghava Aditya Renukunta [Thu, 2 Feb 2017 23:53:22 +0000 (15:53 -0800)]
scsi: aacraid: Added support for response path

BugLink: http://bugs.launchpad.net/bugs/1668726
This patch enables the driver to actually process the I/O, or srb replies
from adapter. In addition to any HBA1000 or SmartIOC2000 adapter events.

Signed-off-by: Raghava Aditya Renukunta <raghavaaditya.renukunta@microsemi.com>
Signed-off-by: Dave Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit 3ffd6c5a74d916a10afada8b679df8c964c1479b)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Process Error for response I/O
Raghava Aditya Renukunta [Thu, 2 Feb 2017 23:53:21 +0000 (15:53 -0800)]
scsi: aacraid: Process Error for response I/O

BugLink: http://bugs.launchpad.net/bugs/1668726
Make sure that the driver processes error conditions even in the fast
response path for response from the adapter.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Dave Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit 4ec57fb4edaec523f0f78a0449a3b063749ac58b)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Reworked scsi command submission path
Raghava Aditya Renukunta [Thu, 2 Feb 2017 23:53:20 +0000 (15:53 -0800)]
scsi: aacraid: Reworked scsi command submission path

BugLink: http://bugs.launchpad.net/bugs/1668726
Moved the READ and WRITE switch cases to the top. Added a  default
case to the switch case and replaced duplicate scsi result value with a
macro.

The idea is that since most of scsi commands we care about performance
wise are read or write, we need to process them first.

Internally the compiler (GCC) converts a switch case into either a jump
table or a bunch of if else conditions, so placing the often used read,
write cases at the top is an effort in optimization.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Dave Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit c4e2fbca374b9797276061840dc95708adf512ed)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Retrieve and update the device types
Raghava Aditya Renukunta [Thu, 2 Feb 2017 23:53:19 +0000 (15:53 -0800)]
scsi: aacraid: Retrieve and update the device types

BugLink: http://bugs.launchpad.net/bugs/1668726
This patch adds support to retrieve the type of each adapter connected
device. Applicable to HBA1000 and SmartIOC2000 products

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Dave Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit c83b11e31cf9151974dd78e97af31c0fd07927cb)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Added sa firmware support
Raghava Aditya Renukunta [Thu, 2 Feb 2017 23:53:18 +0000 (15:53 -0800)]
scsi: aacraid: Added sa firmware support

BugLink: http://bugs.launchpad.net/bugs/1668726
sa_firmware adds the capability to differentiate the new SmartIOC family
of adapters from the series 8 and below.

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Dave Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit d503e2fde2b6cea168cf1151b2ab52df3f47be88)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: added support for init_struct_8
Raghava Aditya Renukunta [Thu, 2 Feb 2017 23:53:17 +0000 (15:53 -0800)]
scsi: aacraid: added support for init_struct_8

BugLink: http://bugs.launchpad.net/bugs/1668726
This  patch lays the groundwork for supporting the new HBA-1000 controller
family.A new INIT structure INIT_STRUCT_8 has been added which allows for a
variable size for MSI-x vectors among other things,  and is used for both
Series-8, HBA-1000 and SmartIOC-2000.

Signed-off-by: Raghava Aditya Renukunta <raghavaaditya.renukunta@microsemi.com>
Signed-off-by: Dave Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit d1ef4da8487fa698ab619a14b8ab6394bb5156ca)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Added aacraid.h include guard
Raghava Aditya Renukunta [Thu, 2 Feb 2017 23:53:16 +0000 (15:53 -0800)]
scsi: aacraid: Added aacraid.h include guard

BugLink: http://bugs.launchpad.net/bugs/1668726
Added aacraid.h include guard

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Dave Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit 24b043cb6150c21ac02d8edc5c2ba08a0d589ea0)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoscsi: aacraid: Remove duplicate irq management code
Raghava Aditya Renukunta [Thu, 2 Feb 2017 23:53:15 +0000 (15:53 -0800)]
scsi: aacraid: Remove duplicate irq management code

BugLink: http://bugs.launchpad.net/bugs/1668726
Removed duplicate code that for acquiring and releasing irqs

Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Signed-off-by: Dave Carroll <David.Carroll@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from linux-next commit d3e19175004583c65361e96da424175b99c3e715)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: SAUCE: powerpc/fadump: set an upper limit for boot memory size (V2)
Hari Bathini [Wed, 1 Mar 2017 12:55:27 +0000 (05:55 -0700)]
UBUNTU: SAUCE: powerpc/fadump: set an upper limit for boot memory size (V2)

BugLink: http://bugs.launchpad.net/bugs/1655241
http://patchwork.ozlabs.org/patch/732136

By default, 5% of system RAM is reserved for preserving boot memory.
Alternatively, a user can specify the amount of memory to reserve.
See Documentation/powerpc/firmware-assisted-dump.txt for details. In
addition to the memory reserved for preserving boot memory, some more
memory is reserved, to save HPTE region, CPU state data and ELF core
headers.

Memory Reservation during first kernel looks like below:

  Low memory                                        Top of memory
  0      boot memory size                                       |
  |           |                       |<--Reserved dump area -->|
  V           V                       |   Permanent Reservation V
  +-----------+----------/ /----------+---+----+-----------+----+
  |           |                       |CPU|HPTE|  DUMP     |ELF |
  +-----------+----------/ /----------+---+----+-----------+----+
        |                                           ^
        |                                           |
        \                                           /
         -------------------------------------------
          Boot memory content gets transferred to
          reserved area by firmware at the time of
          crash

This implicitly means that the sum of the sizes of boot memory, CPU
state data, HPTE region, DUMP preserving area and ELF core headers
can't be greater than the total memory size. But currently, a user is
allowed to specify any value as boot memory size. So, the above rule
is violated when a boot memory size around 50% of the total available
memory is specified. As the kernel is not handling this currently, it
may lead to undefined behavior. Fix it by setting an upper limit for
boot memory size to 25% of the total available memory. Also, instead
of using memblock_end_of_DRAM(), which doesn't take the holes, if any,
in the memory layout into account, use memblock_phys_mem_size() to
calculate the percentage of total available memory.

Signed-off-by: Hari Bathini <hbathini@linux.vnet.ibm.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agoRevert "UBUNTU: SAUCE: powerpc/fadump: set an upper limit for boot memory size"
Tim Gardner [Wed, 1 Mar 2017 12:54:02 +0000 (05:54 -0700)]
Revert "UBUNTU: SAUCE: powerpc/fadump: set an upper limit for boot memory size"

This reverts commit bcbdcee5a065dc03defbfcd4a61bcefaf28d8503.

BugLink: https://bugs.launchpad.net/bugs/1655241
Revert in favor of V2

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
7 years agopci/hotplug/pnv-php: Disable MSI and PCI device properly
Gavin Shan [Wed, 15 Feb 2017 23:22:34 +0000 (10:22 +1100)]
pci/hotplug/pnv-php: Disable MSI and PCI device properly

BugLink: http://bugs.launchpad.net/bugs/1667599
pnv_php_disable_irq() can be called in two paths: Bailing path in
pnv_php_enable_irq() or releasing slot. The MSI (or MSIx) interrupts
is disabled unconditionally in pnv_php_disable_irq(). It's wrong
because that might be enabled by drivers other than pnv-php.

This disables MSI (or MSIx) interrupts and the PCI device only if
it was enabled by pnv-php. In the error path of pnv_php_enable_irq(),
we rely on the newly added parameter @disable_device. In the path
of releasing slot, @pnv_php->irq is checked.

Cc: <stable@vger.kernel.org> # v4.9+
Fixes: 360aebd85a4c ("drivers/pci/hotplug: Support surprise hotplug in powernv driver")
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from linux-next commit 49f4b08e61547a5ccd2db551d994c4503efe5666)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agopci/hotplug/pnv-php: Disable surprise hotplug capability on conflicts
Gavin Shan [Wed, 15 Feb 2017 23:22:33 +0000 (10:22 +1100)]
pci/hotplug/pnv-php: Disable surprise hotplug capability on conflicts

BugLink: http://bugs.launchpad.net/bugs/1667599
The root port or PCIe switch downstream port might have been associated
with driver other than pnv-php. The MSI or MSIx might also have been
enabled by that driver (e.g. pcieport_drv). Attempt to enable MSI incurs
below backtrace:

 PowerPC PowerNV PCI Hotplug Driver version: 0.1
 ------------[ cut here ]------------
 WARNING: CPU: 19 PID: 1004 at drivers/pci/msi.c:1071 \
                              __pci_enable_msi_range+0x84/0x4e0
 NIP [c000000000665c34] __pci_enable_msi_range+0x84/0x4e0
 LR [c000000000665c24] __pci_enable_msi_range+0x74/0x4e0
 Call Trace:
 [c000000384d67600] [c000000000665c24] __pci_enable_msi_range+0x74/0x4e0
 [c000000384d676e0] [d00000000aa31b04] pnv_php_register+0x564/0x5a0 [pnv_php]
 [c000000384d677c0] [d00000000aa31658] pnv_php_register+0xb8/0x5a0 [pnv_php]
 [c000000384d678a0] [d00000000aa31658] pnv_php_register+0xb8/0x5a0 [pnv_php]
 [c000000384d67980] [d00000000aa31dfc] pnv_php_init+0x60/0x98 [pnv_php]
 [c000000384d679f0] [c00000000000cfdc] do_one_initcall+0x6c/0x1d0
 [c000000384d67ab0] [c000000000b92354] do_init_module+0x94/0x254
 [c000000384d67b40] [c00000000019719c] load_module+0x258c/0x2c60
 [c000000384d67d30] [c000000000197bb0] SyS_finit_module+0xf0/0x170
 [c000000384d67e30] [c00000000000b184] system_call+0x38/0xe0

This fixes the issue by skipping enabling the surprise hotplug
capability if the MSI or MSIx on the PCI slot's upstream port has
been enabled by other driver.

Cc: <stable@vger.kernel.org> # v4.9+
Fixes: 360aebd85a4c ("drivers/pci/hotplug: Support surprise hotplug in powernv driver")
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Tested-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from linux-next commit 303529d6ef1293513c2c73c9ab86489eebb37d08)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agopci/hotplug/pnv-php: Remove WARN_ON() in pnv_php_put_slot()
Gavin Shan [Wed, 15 Feb 2017 23:22:32 +0000 (10:22 +1100)]
pci/hotplug/pnv-php: Remove WARN_ON() in pnv_php_put_slot()

BugLink: http://bugs.launchpad.net/bugs/1667599
The WARN_ON() causes unnecessary backtrace when putting the parent
slot, which is likely to be NULL.

 WARNING: CPU: 2 PID: 1071 at drivers/pci/hotplug/pnv_php.c:85 \
                              pnv_php_release+0xcc/0x150 [pnv_php]
    :
 Call Trace:
 [c0000003bc007c10] [d00000000ad613c4] pnv_php_release+0x144/0x150 [pnv_php]
 [c0000003bc007c40] [c0000000006641d8] pci_hp_deregister+0x238/0x330
 [c0000003bc007cd0] [d00000000ad61440] pnv_php_unregister_one+0x70/0xa0 [pnv_php]
 [c0000003bc007d10] [d00000000ad614c0] pnv_php_unregister+0x50/0x80 [pnv_php]
 [c0000003bc007d40] [d00000000ad61e84] pnv_php_exit+0x50/0xcb4 [pnv_php]
 [c0000003bc007d70] [c00000000019499c] SyS_delete_module+0x1fc/0x2a0
 [c0000003bc007e30] [c00000000000b184] system_call+0x38/0xe0

Cc: <stable@vger.kernel.org> # v4.8+
Fixes: 66725152fb9f ("PCI/hotplug: PowerPC PowerNV PCI hotplug driver")
Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Tested-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from linux-next commit 36c7c9da40c408a71e5e6bfe12e57dcf549a296d)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: [Config] Enforce CONFIG_MOVABLE_NODE=y for ppc64el
Seth Forshee [Fri, 24 Feb 2017 20:27:21 +0000 (14:27 -0600)]
UBUNTU: [Config] Enforce CONFIG_MOVABLE_NODE=y for ppc64el

BugLink: http://bugs.launchpad.net/bugs/1667081
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agopowerpc/mm: unstub radix__vmemmap_remove_mapping()
Reza Arbab [Mon, 16 Jan 2017 19:07:46 +0000 (13:07 -0600)]
powerpc/mm: unstub radix__vmemmap_remove_mapping()

BugLink: http://bugs.launchpad.net/bugs/1667081
Use remove_pagetable() and friends for radix vmemmap removal.

We do not require the special-case handling of vmemmap done in the x86
versions of these functions. This is because vmemmap_free() has already
freed the mapped pages, and calls us with an aligned address range.

So, add a few failsafe WARNs, but otherwise the code to remove physical
mappings is already sufficient for vmemmap.

Signed-off-by: Reza Arbab <arbab@linux.vnet.ibm.com>
Acked-by: Balbir Singh <bsingharora@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit 0d0a4bc2a6f7de19cb0256a55891955961d70b1c)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agopowerpc/mm: add radix__remove_section_mapping()
Reza Arbab [Mon, 16 Jan 2017 19:07:45 +0000 (13:07 -0600)]
powerpc/mm: add radix__remove_section_mapping()

BugLink: http://bugs.launchpad.net/bugs/1667081
Tear down and free the four-level page tables of physical mappings
during memory hotremove.

Borrow the basic structure of remove_pagetable() and friends from the
identically-named x86 functions. Reduce the frequency of tlb flushes and
page_table_lock spinlocks by only doing them in the outermost function.
There was some question as to whether the locking is needed at all.
Leave it for now, but we could consider dropping it.

Memory must be offline to be removed, thus not in use. So there
shouldn't be the sort of concurrent page walking activity here that
might prompt us to use RCU.

Signed-off-by: Reza Arbab <arbab@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit 4b5d62ca17a1cd2ffc8399e1d1c3ebbabf16e78f)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agopowerpc/mm: add radix__create_section_mapping()
Reza Arbab [Mon, 16 Jan 2017 19:07:44 +0000 (13:07 -0600)]
powerpc/mm: add radix__create_section_mapping()

BugLink: http://bugs.launchpad.net/bugs/1667081
Wire up memory hotplug page mapping for radix. Share the mapping
function already used by radix_init_pgtable().

Signed-off-by: Reza Arbab <arbab@linux.vnet.ibm.com>
Acked-by: Balbir Singh <bsingharora@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit 6cc27341b21a81052f36c137bc44cf55f83e46ff)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agopowerpc/mm: refactor radix physical page mapping
Reza Arbab [Mon, 16 Jan 2017 19:07:43 +0000 (13:07 -0600)]
powerpc/mm: refactor radix physical page mapping

BugLink: http://bugs.launchpad.net/bugs/1667081
Move the page mapping code in radix_init_pgtable() into a separate
function that will also be used for memory hotplug.

The current goto loop progressively decreases its mapping size as it
covers the tail of a range whose end is unaligned. Change this to a for
loop which can do the same for both ends of the range.

Signed-off-by: Reza Arbab <arbab@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit b5200ec9edf038459619fce9988842efa751a2c5)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agopowerpc/powernv: Use OPAL call for TCE kill on NVLink2
Alistair Popple [Tue, 10 Jan 2017 04:41:44 +0000 (15:41 +1100)]
powerpc/powernv: Use OPAL call for TCE kill on NVLink2

BugLink: http://bugs.launchpad.net/bugs/1667081
Add detection of NPU2 PHBs. NPU2/NVLink2 has a different register
layout for the TCE kill register therefore TCE invalidation should be
done via the OPAL call rather than using the register directly as it
is for PHB3 and NVLink1. This changes TCE invalidation to use the OPAL
call in the case of a NPU2 PHB model.

Signed-off-by: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit 616badd2fb499320d3ac3b54462f55dededd0e0f)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agopowerpc/powernv: Initialise nest mmu
Alistair Popple [Wed, 14 Dec 2016 02:36:51 +0000 (13:36 +1100)]
powerpc/powernv: Initialise nest mmu

BugLink: http://bugs.launchpad.net/bugs/1667081
POWER9 contains an off core mmu called the nest mmu (NMMU). This is
used by other hardware units on the chip to translate virtual
addresses into real addresses. The unit attempting an address
translation provides the majority of the context required for the
translation request except for the base address of the partition table
(ie. the PTCR) which needs to be programmed into the NMMU.

This patch adds a call to OPAL to set the PTCR for the nest mmu in
opal_init().

Signed-off-by: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit 1d0761d2557d1540727723e4f05395d53321d555)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: SAUCE: KVM: PPC: Book3S: Ratelimit copy data failure error messages
Vipin K Parashar [Thu, 16 Feb 2017 17:10:26 +0000 (22:40 +0530)]
UBUNTU: SAUCE: KVM: PPC: Book3S: Ratelimit copy data failure error messages

BugLink: http://bugs.launchpad.net/bugs/1667416
kvm_ppc_mmu_book3s_32/64 xlat() logs "KVM can't copy data" error
upon failing to copy user data to kernel space. This floods kernel
log once such fails occur in short time period. Ratelimit this
error to avoid flooding kernel logs upon copy data failures.

Signed-off-by: Vipin K Parashar <vipin@linux.vnet.ibm.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: [Config] Disable experimental IMA options
Seth Forshee [Fri, 24 Feb 2017 15:46:53 +0000 (09:46 -0600)]
UBUNTU: [Config] Disable experimental IMA options

BugLink: http://bugs.launchpad.net/bugs/1667490
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: SAUCE: drm/ast: Call open_key before enable_mmio in POST code
Y.C. Chen [Wed, 22 Feb 2017 04:14:19 +0000 (15:14 +1100)]
UBUNTU: SAUCE: drm/ast: Call open_key before enable_mmio in POST code

BugLink: http://bugs.launchpad.net/bugs/1667424
open_key enables access the registers used by enable_mmio

Signed-off-by: Y.C. Chen <yc_chen@aspeedtech.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: SAUCE: drm/ast: Fix test for VGA enabled
Y.C. Chen [Wed, 22 Feb 2017 04:10:50 +0000 (15:10 +1100)]
UBUNTU: SAUCE: drm/ast: Fix test for VGA enabled

BugLink: http://bugs.launchpad.net/bugs/1667424
The test to see if VGA was already enabled is doing an unnecessary
second test from a register that may or may not have been initialized
to a valid value. Remove it.

Signed-off-by: Y.C. Chen <yc_chen@aspeedtech.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>