]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/log
mirror_ubuntu-zesty-kernel.git
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>
7 years agoUBUNTU: SAUCE: drm/ast: POST code for the new AST2500
Y.C. Chen [Fri, 17 Feb 2017 03:45:07 +0000 (14:45 +1100)]
UBUNTU: SAUCE: drm/ast: POST code for the new AST2500

BugLink: http://bugs.launchpad.net/bugs/1667424
This is used when the BMC isn't running any code and thus has
to be initialized by the host.

The code originates from Aspeed (Y.C. Chen) and has been cleaned
up for coding style purposes by BenH.

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: Rename ast_init_dram_2300 to ast_post_chip_2300
Benjamin Herrenschmidt [Fri, 17 Feb 2017 02:51:34 +0000 (13:51 +1100)]
UBUNTU: SAUCE: drm/ast: Rename ast_init_dram_2300 to ast_post_chip_2300

BugLink: http://bugs.launchpad.net/bugs/1667424
The function does more than initializing the DRAM and in turns
calls other functions to do the actual init. This will keeping
things more consistent with the upcoming AST2500 POST code.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: SAUCE: drm/ast: Factor mmc_test code in POST code
Benjamin Herrenschmidt [Sat, 18 Feb 2017 03:19:10 +0000 (14:19 +1100)]
UBUNTU: SAUCE: drm/ast: Factor mmc_test code in POST code

BugLink: http://bugs.launchpad.net/bugs/1667424
There's a some duplication for what's essentially copies of
two loops, so factor it. The upcoming AST2500 POST code adds
more of them. Also cleanup return types for the test functions,
most of them return a boolean, some return a u32.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: SAUCE: drm/ast: Fixed vram size incorrect issue on POWER
Y.C. Chen [Fri, 17 Feb 2017 02:56:47 +0000 (10:56 +0800)]
UBUNTU: SAUCE: drm/ast: Fixed vram size incorrect issue on POWER

BugLink: http://bugs.launchpad.net/bugs/1667424
The default value of VGA scratch may incorrect.
Should initial h/w before get vram info.

Signed-off-by: Y.C. Chen <yc_chen@aspeedtech.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: SAUCE: drm/ast: Base support for AST2500
Y.C. Chen [Fri, 17 Feb 2017 03:36:46 +0000 (14:36 +1100)]
UBUNTU: SAUCE: drm/ast: Base support for AST2500

BugLink: http://bugs.launchpad.net/bugs/1667424
Add detection and mode setting updates for AST2500 generation chip,
code originally from Aspeed and slightly reworked for coding style
mostly by Ben. This doesn't contain the BMC DRAM POST code which
is in a separate patch.

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 calculation of MCLK
Benjamin Herrenschmidt [Fri, 17 Feb 2017 02:57:30 +0000 (13:57 +1100)]
UBUNTU: SAUCE: drm/ast: Fix calculation of MCLK

BugLink: http://bugs.launchpad.net/bugs/1667424
Some braces were missing causing an incorrect calculation.

Y.C. Chen from Aspeed provided me with the right formula
which I tested on AST2400 and 2500.

The MCLK isn't currently used by the driver (it will eventually
to filter modes) so the issue isn't catastrophic.

Also make the printed value a bit more meaningful

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: SAUCE: drm/ast: Remove spurrious include
Benjamin Herrenschmidt [Fri, 17 Feb 2017 02:55:58 +0000 (13:55 +1100)]
UBUNTU: SAUCE: drm/ast: Remove spurrious include

BugLink: http://bugs.launchpad.net/bugs/1667424
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: SAUCE: drm/ast: const'ify mode setting tables
Benjamin Herrenschmidt [Fri, 17 Feb 2017 02:45:24 +0000 (13:45 +1100)]
UBUNTU: SAUCE: drm/ast: const'ify mode setting tables

BugLink: http://bugs.launchpad.net/bugs/1667424
And fix some comment alignment & space/tabs while at it

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: SAUCE: drm/ast: Handle configuration without P2A bridge
Russell Currey [Fri, 17 Feb 2017 03:33:01 +0000 (14:33 +1100)]
UBUNTU: SAUCE: drm/ast: Handle configuration without P2A bridge

BugLink: http://bugs.launchpad.net/bugs/1667424
The ast driver configures a window to enable access into BMC
memory space in order to read some configuration registers.

If this window is disabled, which it can be from the BMC side,
the ast driver can't function.

Closing this window is a necessity for security if a machine's
host side and BMC side are controlled by different parties;
i.e. a cloud provider offering machines "bare metal".

A recent patch went in to try to check if that window is open
but it does so by trying to access the registers in question
and testing if the result is 0xffffffff.

This method will trigger a PCIe error when the window is closed
which on some systems will be fatal (it will trigger an EEH
for example on POWER which will take out the device).

This patch improves this in two ways:

 - First, if the firmware has put properties in the device-tree
containing the relevant configuration information, we use these.

 - Otherwise, a bit in one of the SCU scratch registers (which
are readable via the VGA register space and writeable by the BMC)
will indicate if the BMC has closed the window. This bit has been
defined by Y.C Chen from Aspeed.

If the window is closed and the configuration isn't available from
the device-tree, some sane defaults are used. Those defaults are
hopefully sufficient for standard video modes used on a server.

Signed-off-by: Russell Currey <ruscur@russell.cc>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: SAUCE: powerpc/mm/hash: Always clear UPRT and Host Radix bits when setting...
Aneesh Kumar K.V [Wed, 22 Feb 2017 05:12:02 +0000 (10:42 +0530)]
UBUNTU: SAUCE: powerpc/mm/hash: Always clear UPRT and Host Radix bits when setting up CPU

BugLink: http://bugs.launchpad.net/bugs/1667116
We will set LPCR with correct value for radix during int. This make sure we
start with a sanitized value of LPCR. In case of kexec, cpus can have LPCR
value based on the previous translation mode we were running.

Fixes: fe036a0605d60 ("powerpc/64/kexec: Fix MMU cleanup on radix")
Cc: stable@vger.kernel.org # v4.9+
Acked-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agopowerpc/mm/radix: Skip ptesync in pte update helpers
Aneesh Kumar K.V [Thu, 9 Feb 2017 02:58:21 +0000 (08:28 +0530)]
powerpc/mm/radix: Skip ptesync in pte update helpers

BugLink: http://bugs.launchpad.net/bugs/1667116
We do them at the start of tlb flush, and we are sure a pte update will be
followed by a tlbflush. Hence we can skip the ptesync in pte update helpers.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Tested-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from linux-next commit 438e69b52be776c035aa2a851ccc1709033d729b)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agopowerpc/mm/radix: Use ptep_get_and_clear_full when clearing pte for full mm
Aneesh Kumar K.V [Thu, 9 Feb 2017 02:58:20 +0000 (08:28 +0530)]
powerpc/mm/radix: Use ptep_get_and_clear_full when clearing pte for full mm

BugLink: http://bugs.launchpad.net/bugs/1667116
This helps us to do some optimization for application exit case, where we can
skip the DD1 style pte update sequence.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Tested-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from linux-next commit f4894b80b1ddfef00d4d2e5c58613ccef358a1b2)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agopowerpc/mm/radix: Update pte update sequence for pte clear case
Aneesh Kumar K.V [Thu, 9 Feb 2017 02:58:19 +0000 (08:28 +0530)]
powerpc/mm/radix: Update pte update sequence for pte clear case

BugLink: http://bugs.launchpad.net/bugs/1667116
In the kernel we do follow the below sequence in different code paths.
pte = ptep_get_clear(ptep)
....
set_pte_at(ptep, pte)

We do that for mremap, autonuma protection update and softdirty clearing. This
implies our optimization to skip a tlb flush when clearing a pte update is
not valid, because for DD1 system that followup set_pte_at will be done witout
doing the required tlbflush. Fix that by always doing the dd1 style pte update
irrespective of new_pte value. In a later patch we will optimize the application
exit case.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Tested-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from linux-next commit ca94573b9c69d224e50e1084a2776772f4ea030d)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agopowerpc/mm: Update PROTFAULT handling in the page fault path
Aneesh Kumar K.V [Mon, 30 Jan 2017 16:12:59 +0000 (21:42 +0530)]
powerpc/mm: Update PROTFAULT handling in the page fault path

BugLink: http://bugs.launchpad.net/bugs/1667116
With radix, we can get page fault with DSISR_PROTFAULT value set in case of
PROT_NONE or autonuma mapping. The PROT_NONE case in handled by the vma check
where we consider the access bad. For autonuma we should fall through and fixup
the access mask correctly.

Without this patch we trigger the WARN_ON() on radix. This code moves that
WARN_ON() within a radix_enabled() check. I also moved the WARN_ON() outside
the if condition making it apply for all type of faults (exec/write/read). It
is also conditionalized for book3s, because BOOK3E can also get a PROTFAULT to
handle the D/I cache sync.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from linux-next commit 18061c17c8ecdbdbf1e7d1695ec44e7388b4f601)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agopowerpc/perf: Factor out event_alternative function
Madhavan Srinivasan [Sun, 12 Feb 2017 17:03:10 +0000 (22:33 +0530)]
powerpc/perf: Factor out event_alternative function

BugLink: http://bugs.launchpad.net/bugs/1667413
Factor out the power8 event_alternative function to share
the code with power9.

Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from linux-next commit efe881afdd9996ccbcd2a09c93b724f4ffc25991)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agopowerpc/perf: Add PM_INST_DISP event to Power9 event list
Madhavan Srinivasan [Sun, 12 Feb 2017 17:03:11 +0000 (22:33 +0530)]
powerpc/perf: Add PM_INST_DISP event to Power9 event list

BugLink: http://bugs.launchpad.net/bugs/1667413
Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from linux-next commit ac19670eb1798749121647bd9f0b403f52e31e6b)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agopowerpc/perf: Add alternative event table and function for power9
Madhavan Srinivasan [Sun, 12 Feb 2017 17:03:12 +0000 (22:33 +0530)]
powerpc/perf: Add alternative event table and function for power9

BugLink: http://bugs.launchpad.net/bugs/1667413
Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from linux-next commit a114aca57a59cd92189bf3795ac082a5e8fac0f1)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agopowerpc/perf: Use PM_INST_DISP for generic instructions sample
Madhavan Srinivasan [Sun, 12 Feb 2017 17:03:13 +0000 (22:33 +0530)]
powerpc/perf: Use PM_INST_DISP for generic instructions sample

BugLink: http://bugs.launchpad.net/bugs/1667413
Since PM_INST_CMPL may not provide right counts in all
sampling scenarios in power9 DD1, instead use PM_INST_DISP.
Patch also update generic instruction sampling with the same.

Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from linux-next commit 8a088542c8f8d0bb458e4db2c01a2534f1adaf47)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agopowerpc/perf: Use Instruction Counter value
Madhavan Srinivasan [Sun, 12 Feb 2017 17:03:14 +0000 (22:33 +0530)]
powerpc/perf: Use Instruction Counter value

BugLink: http://bugs.launchpad.net/bugs/1667413
Since PM_INST_DISP include speculative instruction,
based on the workload the dispatch count could vary
considerably. Hence as an alternative, for completed
instruction counting, program the PM_INST_DISP event
to the MMCR* but use Instruction Counter register value.

Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from linux-next commit 356d8ce3d0a4a1d7c8448c4d234121736ad3d471)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agopowerpc/perf: Add restrictions to PMC5 in power9 DD1
Madhavan Srinivasan [Sun, 12 Feb 2017 17:03:15 +0000 (22:33 +0530)]
powerpc/perf: Add restrictions to PMC5 in power9 DD1

BugLink: http://bugs.launchpad.net/bugs/1667413
PMC5 on POWER9 DD1 may not provide right counts in all
sampling scenarios, hence use PM_INST_DISP event instead
in PMC2 or PMC3 in preference.

Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit linux-next 8d911904f3ce412b20874a9c95f82009dcbb007c)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agopowerpc/perf: Avoid FAB_*_MATCH checks for power9
Madhavan Srinivasan [Mon, 13 Feb 2017 11:32:54 +0000 (17:02 +0530)]
powerpc/perf: Avoid FAB_*_MATCH checks for power9

BugLink: http://bugs.launchpad.net/bugs/1667413
Since power9 does not support FAB_*_MATCH bits in MMCR1,
avoid these checks for power9. For this, patch factor out
code in isa207_get_constraint() to retain these checks
only for power8.

Patch also updates the comment in power9-pmu raw event
encode layout to remove FAB_*_MATCH.

Finally for power9, patch adds additional check for
threshold events when adding the thresh mask and value in
isa207_get_constraint().

fixes: 7ffd948fae4c ('powerpc/perf: factor out power8 pmu functions')
fixes: 18201b204286 ('powerpc/perf: power9 raw event format encoding')
Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from linux-next commit 78a16d9fc1206e1a484b6ac96348756f3846bfea)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agopowerpc/perf: use is_kernel_addr macro in perf_get_misc_flags()
Madhavan Srinivasan [Sat, 24 Dec 2016 06:05:49 +0000 (11:35 +0530)]
powerpc/perf: use is_kernel_addr macro in perf_get_misc_flags()

BugLink: http://bugs.launchpad.net/bugs/1667413
Cleanup to use is_kernel_addr macro.

Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from linux-next commit a2391b35f1d9d5b51d43a9150c7239253565d5a6)
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agonet: qcom/emac: fix a sizeof() typo
Dan Carpenter [Mon, 13 Feb 2017 11:00:22 +0000 (14:00 +0300)]
net: qcom/emac: fix a sizeof() typo

We had intended to say "sizeof(u32)" but the "u" is missing.
Fortunately, sizeof(32) is also 4, so the original code still works.

Fixes: c4e7beea2192 ("net: qcom/emac: add ethtool support for reading hardware registers")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 2194bd1080210c6e85ea262cda9ad0135b3f3c87)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agonet: qcom/emac: add ethtool support for setting ring parameters
Timur Tabi [Wed, 8 Feb 2017 21:49:28 +0000 (15:49 -0600)]
net: qcom/emac: add ethtool support for setting ring parameters

Implement the set_ringparam method, which allows the user to specify
the size of the TX and RX descriptor rings.  The values are constrained
to the limits of the hardware.

Since the driver does not use separate queues for mini or jumbo frames,
attempts to set those values are rejected.

If the interface is already running when the setting is changed, then
the interface is reset.

Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 038b9404d4e2db4fbc03d5d2203abafc6e188528)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agonet: qcom/emac: add ethtool support for reading hardware registers
Timur Tabi [Wed, 8 Feb 2017 21:49:27 +0000 (15:49 -0600)]
net: qcom/emac: add ethtool support for reading hardware registers

Implement the get_regs_len and get_regs ethtool methods.  The driver
returns the values of selected hardware registers.

The make the register offsets known to emac_ethtool, the the register
offset macros are all combined into one header file.  They were
inexplicably and arbitrarily split between two files.

Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit c4e7beea21921733026b6a1bca0652c883d84680)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agonet: qcom/emac: fix semicolon.cocci warnings
Wu Fengguang [Tue, 7 Feb 2017 19:42:05 +0000 (03:42 +0800)]
net: qcom/emac: fix semicolon.cocci warnings

drivers/net/ethernet/qualcomm/emac/emac-ethtool.c:155:49-50: Unneeded semicolon

 Remove unneeded semicolon.

Generated by: scripts/coccinelle/misc/semicolon.cocci

CC: Timur Tabi <timur@codeaurora.org>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 3c19bd6c52d441893ba19b3418825b27cfa4fd9c)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agonet: qcom/emac: add ethool support for setting pause parameters
Timur Tabi [Mon, 6 Feb 2017 21:34:52 +0000 (15:34 -0600)]
net: qcom/emac: add ethool support for setting pause parameters

To support setting the pause parameters, the driver can no longer just
mirror the PHY.  The set_pauseparam feature allows the driver to
force the setting in the MAC, regardless of how the PHY is configured.
This means that we now need to maintain an internal state for pause
frame support, and so get_pauseparam also needs to be updated.

If the interface is already running when the setting is changed, then
the interface is reset.

Note that if the MAC is configured to enable RX pause frame support
(i.e. it transmits pause frames to throttle the other end), but the
PHY is configured to block those frames, then the feature will not work.

Also some buffer size initialization code into emac_init_adapter(),
so that it lives with similar code, including the initializtion of
pause frame support.

Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit b44700e975848a9a569a509244672ff886ec99b3)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agonet: qcom/emac: add an error interrupt handler for the sgmii
Timur Tabi [Fri, 27 Jan 2017 22:43:48 +0000 (16:43 -0600)]
net: qcom/emac: add an error interrupt handler for the sgmii

The SGMII (internal PHY) can report decode errors via an interrupt.  It
can also report autonegotiation status changes, but we don't need to track
those.  The SGMII can recover automatically from most decode errors, so
we only reset the interface if we get multiple consecutive errors.

It's possible for bogus decode errors to be reported while the link is
being brought up.  The interrupt is registered when the interface is
opened, and it's enabled after the link is up.

Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit fd0e97b806f0331df95f5fc58cdd488d169efb7f)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agonet: qcom/emac: remove extraneous wake-on-lan code
Timur Tabi [Fri, 27 Jan 2017 22:43:47 +0000 (16:43 -0600)]
net: qcom/emac: remove extraneous wake-on-lan code

The EMAC driver does not support wake-on-lan, but there is still
code left-over that partially enables it.  Remove that code and a few
macros that support it.

Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit e7e7454b40d290f6efb63c792c56c416922dcef8)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agonet: qcom/emac: do not call emac_mac_start twice
Timur Tabi [Fri, 27 Jan 2017 22:43:45 +0000 (16:43 -0600)]
net: qcom/emac: do not call emac_mac_start twice

emac_mac_start() uses information from the external PHY to program
the MAC, so it makes no sense to call it before the link is up.

Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 0f20276dd51bf4b74c7ba961c32fffb5a155fb1e)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agonet: qcom/emac: always use autonegotiation to configure the SGMII link
Timur Tabi [Fri, 27 Jan 2017 22:43:44 +0000 (16:43 -0600)]
net: qcom/emac: always use autonegotiation to configure the SGMII link

Regardless of how the external PHY is configured, the internal PHY
(the "SGMII" block) is capable of configuring the SGMII link automatically.
When the external PHY link comes up, regardless of how it is configured,
the SGMII link is configured automatically.

Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 3db5d555eaec44ee0e1c80194963c4256b23f6ee)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agonet: qcom/emac: display the phy driver info after we connect
Timur Tabi [Fri, 27 Jan 2017 22:43:43 +0000 (16:43 -0600)]
net: qcom/emac: display the phy driver info after we connect

The PHY driver is attached only when the driver calls
phy_connect_direct().  Calling phy_attached_print() to display
information about the PHY driver prior to that point is meaningless.
The interface can be brought down, a new PHY driver can be loaded,
and the interface then brought back up.  This is the correct time
to display information about the attached driver.

Since phy_attached_print() also prints information about the
interrupt, that needs to be set as well.

Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 9da34f27c13bfc8d13b5599808d815382ef41128)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agonet: qcom/emac: claim the irq only when the device is opened
Timur Tabi [Fri, 20 Jan 2017 23:21:04 +0000 (17:21 -0600)]
net: qcom/emac: claim the irq only when the device is opened

During reset, functions emac_mac_down() and emac_mac_up() are called,
so we don't want to free and claim the IRQ unnecessarily.  Move those
operations to open/close.

Signed-off-by: Timur Tabi <timur@codeaurora.org>
Reviewed-by: Lino Sanfilippo <LinoSanfilippo@gmx.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 4404323c6ac256c2a11d86fda65fbdb7d198ff8c)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agonet: qcom/emac: rename emac_phy to emac_sgmii and move it
Timur Tabi [Fri, 20 Jan 2017 23:21:03 +0000 (17:21 -0600)]
net: qcom/emac: rename emac_phy to emac_sgmii and move it

The EMAC has an internal PHY that is often called the "SGMII".  This
SGMII is also connected to an external PHY, which is managed by phylib.
These dual PHYs often cause confusion.  In this case, the data structure
for managing the SGMII was mis-named and located in the wrong header file.

Structure emac_phy is renamed to emac_sgmii to clearly indicate it applies
to the internal PHY only.  It also also moved from emac_phy.h (which
supports the external PHY) to emac_sgmii.h (where it belongs).

To keep the changes minimal, only the structure name is changed, not
the names of any variables of that type.

Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 41c1093f2e1a33f4bf38848b4b1526903c5052bb)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoRevert "net: qcom/emac: configure the external phy to allow pause frames"
Timur Tabi [Tue, 17 Jan 2017 22:31:19 +0000 (16:31 -0600)]
Revert "net: qcom/emac: configure the external phy to allow pause frames"

This reverts commit 3e884493448131179a5b7cae1ddca1028ffaecc8.

With commit 529ed1275263 ("net: phy: phy drivers should not set
SUPPORTED_[Asym_]Pause"), phylib now handles automatically enabling
pause frame support in the PHY, and the MAC driver should follow suit.

Since the EMAC driver driver does this,  we no longer need to force
pause frames support.

Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 8a43c052c7c1a7fd6cde46591deeb39be63a1223)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agonet: qcom/emac: add ethtool support
Timur Tabi [Mon, 9 Jan 2017 18:03:12 +0000 (12:03 -0600)]
net: qcom/emac: add ethtool support

Add support for some ethtool methods: get/set link settings, get/set
message level, get statistics, get link status, get ring params, get
pause params, and restart autonegotiation.

The code to collect the hardware statistics is moved into its own
function so that it can be used by "get statistics" method.

Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
(backported from commit 79f664edc1cf51a87d6681514ec89b6da5fef8e1)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: ubuntu: vbox -- Update to 5.1.14-dfsg-2
Seth Forshee [Thu, 23 Feb 2017 16:27:45 +0000 (10:27 -0600)]
UBUNTU: ubuntu: vbox -- Update to 5.1.14-dfsg-2

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoACPI/IORT: Fix iort_node_get_id() mapping entries indexing
Lorenzo Pieralisi [Thu, 5 Jan 2017 17:32:16 +0000 (17:32 +0000)]
ACPI/IORT: Fix iort_node_get_id() mapping entries indexing

Commit 618f535a6062 ("ACPI/IORT: Add single mapping function")
introduced a function (iort_node_get_id()) to retrieve ids for IORT
named components.

The iort_node_get_id() takes an index as input to refer to a specific
mapping entry in the named component IORT node mapping array.

For a mapping entry at a given index, iort_node_get_id() should return
the id value (through the id_out function parameter) and the IORT node
output_reference (through function return value) the given mapping entry
refers to.

Technically output_reference values may differ for different map
entries, (see diagram below - mapped id values may refer to different eg
IORT SMMU nodes; the kernel may not be able to handle different
output_reference values for a given named component but the IORT kernel
layer should still report the IORT mappings as reported by firmware) but
current code in iort_node_get_id() fails to use the index function
parameter to return the correct output_reference value (ie it always
returns the output_reference value of the first entry in the mapping
array whilst using the index correctly to retrieve the id value from the
respective entry).

|----------------------|
|     named component  |
|----------------------|
|      map entry[0]    |
|----------------------|
|       id value       |
| output_reference----------------> eg SMMU 1
|----------------------|
|      map entry[1]    |
|----------------------|
|       id value       |
| output_reference----------------> eg SMMU 2
|----------------------|
    .
    .
    .
|----------------------|
|      map entry[N]    |
|----------------------|
|       id value       |
| output_reference----------------> eg SMMU 1
|----------------------|

Consequently the iort_node_get_id() function always returns the IORT
node pointed at by the output_reference value of the first named
component mapping array entry, irrespective of the index parameter,
which is a bug.

Update the map array entry pointer computation in iort_node_get_id() to
take into account the index value, fixing the issue.

Fixes: 618f535a6062 ("ACPI/IORT: Add single mapping function")
Reported-by: Hanjun Guo <hanjun.guo@linaro.org>
Reviewed-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Hanjun Guo <hanjun.guo@linaro.org>
Cc: Sinan Kaya <okaya@codeaurora.org>
Cc: Tomasz Nowicki <tn@semihalf.com>
Cc: Nate Watterson <nwatters@codeaurora.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Signed-off-by: Will Deacon <will.deacon@arm.com>
(cherry picked from commit 030abd8a5d33057524c6c11c28d3191f3b5c63f6)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoarm64: Work around Falkor erratum 1003
Christopher Covington [Wed, 8 Feb 2017 20:08:37 +0000 (15:08 -0500)]
arm64: Work around Falkor erratum 1003

The Qualcomm Datacenter Technologies Falkor v1 CPU may allocate TLB entries
using an incorrect ASID when TTBRx_EL1 is being updated. When the erratum
is triggered, page table entries using the new translation table base
address (BADDR) will be allocated into the TLB using the old ASID. All
circumstances leading to the incorrect ASID being cached in the TLB arise
when software writes TTBRx_EL1[ASID] and TTBRx_EL1[BADDR], a memory
operation is in the process of performing a translation using the specific
TTBRx_EL1 being written, and the memory operation uses a translation table
descriptor designated as non-global. EL2 and EL3 code changing the EL1&0
ASID is not subject to this erratum because hardware is prohibited from
performing translations from an out-of-context translation regime.

Consider the following pseudo code.

  write new BADDR and ASID values to TTBRx_EL1

Replacing the above sequence with the one below will ensure that no TLB
entries with an incorrect ASID are used by software.

  write reserved value to TTBRx_EL1[ASID]
  ISB
  write new value to TTBRx_EL1[BADDR]
  ISB
  write new value to TTBRx_EL1[ASID]
  ISB

When the above sequence is used, page table entries using the new BADDR
value may still be incorrectly allocated into the TLB using the reserved
ASID. Yet this will not reduce functionality, since TLB entries incorrectly
tagged with the reserved ASID will never be hit by a later instruction.

Based on work by Shanker Donthineni <shankerd@codeaurora.org>

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
(cherry picked from commit 38fd94b0275c91071157a03cc27676909b23dcde)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: [Config] CONFIG_QCOM_FALKOR_ERRATUM_1003=y
dann frazier [Wed, 22 Feb 2017 20:16:18 +0000 (13:16 -0700)]
UBUNTU: [Config] CONFIG_QCOM_FALKOR_ERRATUM_1003=y

Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoarm64: arch_timer: document Hisilicon erratum 161010101
Ding Tianhong [Thu, 9 Feb 2017 17:00:34 +0000 (17:00 +0000)]
arm64: arch_timer: document Hisilicon erratum 161010101

Now that we have a workaround for Hisilicon erratum 161010101, notes
this in the arm64 silicon-errata document.

The new config option is too long to fit in the existing kconfig column,
so this is widened to accomodate it. At the same time, an existing
whitespace error is corrected, and the existing pattern of a line space
between vendors is enforced for recent additions.

Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
[Mark: split patch, reword commit message, rework table]
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
(cherry picked from commit 6e01398fe4505ac4ac963fe0ca44b25e46783fef)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoperf: add qcom l2 cache perf events driver
Neil Leeder [Tue, 7 Feb 2017 18:14:04 +0000 (13:14 -0500)]
perf: add qcom l2 cache perf events driver

Adds perf events support for L2 cache PMU.

The L2 cache PMU driver is named 'l2cache_0' and can be used
with perf events to profile L2 events such as cache hits
and misses on Qualcomm Technologies processors.

Reviewed-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Neil Leeder <nleeder@codeaurora.org>
[will: minimise nesting in l2_cache_associate_cpu_with_cluster]
[will: use kstrtoul for unsigned long, remove redunant .owner setting]
Signed-off-by: Will Deacon <will.deacon@arm.com>
(cherry picked from commit 21bdbb7102edeaebb5ec4ef530c8f442f7562c96)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
7 years agoUBUNTU: [Config] CONFIG_QCOM_L2_PMU=y
dann frazier [Wed, 22 Feb 2017 20:09:12 +0000 (13:09 -0700)]
UBUNTU: [Config] CONFIG_QCOM_L2_PMU=y

Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>