]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/log
mirror_ubuntu-zesty-kernel.git
8 years agolightnvm: refactor end_io functions for sync
Matias Bjørling [Tue, 12 Jan 2016 06:49:21 +0000 (07:49 +0100)]
lightnvm: refactor end_io functions for sync

BugLink: http://bugs.launchpad.net/bugs/1531539
To implement sync I/O support within the LightNVM core, the end_io
functions are refactored to take an end_io function pointer instead of
testing for initialized media manager, followed by calling its end_io
function.

Sync I/O can then be implemented using a callback that signal I/O
completion. This is similar to the logic found in blk_to_execute_io().
By implementing it this way, the underlying device I/Os submission logic
is abstracted away from core, targets, and media managers.

Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 91276162de9476b8ff32d9452e849210e5dd09e9)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agolightnvm: refactor rqd ppa list into set/free
Matias Bjørling [Tue, 12 Jan 2016 06:49:20 +0000 (07:49 +0100)]
lightnvm: refactor rqd ppa list into set/free

BugLink: http://bugs.launchpad.net/bugs/1531539
A device may be driven in single, double or quad plane mode. In that
case, the rqd must have either one, two, or four PPAs set for a single
PPA sent to the device. Refactor this logic into their own
functions to be shared by program/erase/read in the core.

Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit abd805ec9f51f37db9da63dda44c3f4b4ae8ad57)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agolightnvm: move ppa erase logic to core
Matias Bjørling [Tue, 12 Jan 2016 06:49:19 +0000 (07:49 +0100)]
lightnvm: move ppa erase logic to core

BugLink: http://bugs.launchpad.net/bugs/1531539
A device may function in single, dual or quad plane mode. The gennvm
media manager manages this with explicit helpers. They convert a single
ppa to 1, 2 or 4 separate ppas in a ppa list. To aid implementation of
recovery and system blocks, this functionality can be moved directly
into the core.

Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 069368e91879a3a640cfae4bdc1f9f8cc99c93a0)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agolightnvm: unlock rq and free ppa_list on submission fail
Wenwei Tao [Tue, 12 Jan 2016 06:49:18 +0000 (07:49 +0100)]
lightnvm: unlock rq and free ppa_list on submission fail

BugLink: http://bugs.launchpad.net/bugs/1531539
When rrpc_write_ppalist_rq and rrpc_read_ppalist_rq succeed, we setup
rq correctly, but nvm_submit_io may afterward fail since it cannot
allocate request or nvme_nvm_command, we return error but forget to
cleanup the previous work.

Signed-off-by: Wenwei Tao <ww.tao0320@gmail.com>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit c27278bddd75a3ee755c8e83c6bcc3fdd7271ef6)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agolightnvm: add check after mempool allocation
Javier Gonzalez [Tue, 12 Jan 2016 06:49:17 +0000 (07:49 +0100)]
lightnvm: add check after mempool allocation

BugLink: http://bugs.launchpad.net/bugs/1531539
The mempool allocation might fail. Make sure to return error when it
does, instead of causing a kernel panic.

Signed-off-by: Javier Gonzalez <javier@cnexlabs.com>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 3bfbc6adbc5031e8a5907baa5beb27b41637742a)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agolightnvm: fix incorrect nr_free_blocks stat
Chao Yu [Tue, 12 Jan 2016 06:49:16 +0000 (07:49 +0100)]
lightnvm: fix incorrect nr_free_blocks stat

BugLink: http://bugs.launchpad.net/bugs/1531539
When initing bad block list in gennvm_block_bb, once we move bad block
from free_list to bb_list, we should maintain both stat info
nr_free_blocks and nr_bad_blocks. So this patch fixes to add missing
operation related to nr_free_blocks.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit bdded1552085b12d23c9be76147d2e96647a098f)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agolightnvm: fix bio submission issue
Wenwei Tao [Tue, 12 Jan 2016 06:49:15 +0000 (07:49 +0100)]
lightnvm: fix bio submission issue

BugLink: http://bugs.launchpad.net/bugs/1531539
Put bio when submission fails, since we get it
before submission. And return error when backend
device driver doesn't provide a submit_io method,
thus we can end IO properly.

Signed-off-by: Wenwei Tao <ww.tao0320@gmail.com>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 3cd485b1f8e25a6534eb4c542e7eba1b944fbaaf)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoUBUNTU: postinst -- detect symlinks correctly
Andy Whitcroft [Sun, 31 Jan 2016 14:30:07 +0000 (14:30 +0000)]
UBUNTU: postinst -- detect symlinks correctly

BugLink: http://bugs.launchpad.net/bugs/1536810
Signed-off-by: Andy Whitcroft <apw@canonical.com>
8 years agoRevert "UBUNTU: SAUCE: dm: introduce a target_ioctl op to allow target specific ioctls"
Andy Whitcroft [Mon, 1 Feb 2016 10:25:14 +0000 (10:25 +0000)]
Revert "UBUNTU: SAUCE: dm: introduce a target_ioctl op to allow target specific ioctls"

This reverts commit fac8e7e04e5649ff40cb920385c95c7449a4f6f9.

BugLink: http://bugs.launchpad.net/bugs/1538618
Signed-off-by: Andy Whitcroft <apw@canonical.com>
8 years agopowerpc/pseries: Limit EPOW reset event warnings
Vipin K Parashar [Tue, 1 Dec 2015 11:13:42 +0000 (16:43 +0530)]
powerpc/pseries: Limit EPOW reset event warnings

BugLink: http://bugs.launchpad.net/bugs/1539102
Kernel prints respective warnings about various EPOW events for
user information/action after parsing EPOW interrupts. At times
below EPOW reset event warning is seen to be flooding kernel log
over a period of time.

May 25 03:46:34 alp kernel: Non critical power or cooling issue cleared
May 25 03:46:52 alp kernel: Non critical power or cooling issue cleared
May 25 03:53:48 alp kernel: Non critical power or cooling issue cleared
May 25 03:55:46 alp kernel: Non critical power or cooling issue cleared
May 25 03:56:34 alp kernel: Non critical power or cooling issue cleared
May 25 03:59:04 alp kernel: Non critical power or cooling issue cleared
May 25 04:02:01 alp kernel: Non critical power or cooling issue cleared

These EPOW reset events are spurious in nature and are triggered by
firmware without an actual EPOW event being reset. This patch avoids these
multiple EPOW reset warnings by using a counter variable. This variable
is incremented every time an EPOW event is reported. Upon receiving a EPOW
reset event the same variable is checked to filter out spurious events and
decremented accordingly.

This patch also improves log messages to better describe EPOW event being
reported. Merged adjacent log messages into single one to reduce number of
lines printed per event.

Signed-off-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
Signed-off-by: Vipin K Parashar <vipin@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
(cherry picked from commit b4af279a7cba5cc1f665485e8ecdf272f1ba0cc5)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoUBUNTU: Start new release
Tim Gardner [Fri, 29 Jan 2016 15:07:06 +0000 (08:07 -0700)]
UBUNTU: Start new release

Ignore: yes
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoUBUNTU: Ubuntu-4.4.0-2.16
Andy Whitcroft [Thu, 28 Jan 2016 13:59:45 +0000 (13:59 +0000)]
UBUNTU: Ubuntu-4.4.0-2.16

Signed-off-by: Andy Whitcroft <apw@canonical.com>
8 years agoUBUNTU: SAUCE: dm: introduce a target_ioctl op to allow target specific ioctls
Andy Whitcroft [Wed, 27 Jan 2016 16:05:32 +0000 (16:05 +0000)]
UBUNTU: SAUCE: dm: introduce a target_ioctl op to allow target specific ioctls

In e56f81e0b01e "dm: refactor ioctl handling" the target specific ioctl
operation was removed in favour of providing a mapping to the underlying
device, to which ioctls are all assumed to apply.  This prevents targets
from having target specific ioctls.

Introduce a new target_ioctl callback which (if present) is offered the
command and arguments for processing.  This callback can return -ENOTTY
to indicate the ioctl should be passed on to the underlying device as
normal.

BugLink: http://bugs.launchpad.net/bugs/1538618
Signed-off-by: Andy Whitcroft <apw@canonical.com>
8 years agoUBUNTU: SAUCE: hv: hv_set_ifconfig -- convert to python3
Andy Whitcroft [Thu, 28 Jan 2016 12:03:00 +0000 (12:03 +0000)]
UBUNTU: SAUCE: hv: hv_set_ifconfig -- convert to python3

From 15.10 onwards python2 is no longer the default python and is no longer
installed by default.  Switch to python3 which is.  This delta is much
larger than the nominal changes as inconsistent spacing is now an error.
I have also corrected the use of loose strings as comments.

BugLink: http://bugs.launchpad.net/bugs/1506521
Signed-off-by: Andy Whitcroft <apw@canonical.com>
8 years agocxlflash: a couple off by one bugs
Dan Carpenter [Wed, 2 Dec 2015 23:26:28 +0000 (17:26 -0600)]
cxlflash: a couple off by one bugs

The "> MAX_CONTEXT" should be ">= MAX_CONTEXT".  Otherwise we go one
step beyond the end of the cfg->ctx_tbl[] array.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Manoj Kumar <manoj@linux.vnet.ibm.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Acked-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit e37390bee6fe7dfbe507a9d50cdc11344b53fa08)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoRevert "UBUNTU: SAUCE: (noup) cxlflash: a couple off by one bugs"
Tim Gardner [Wed, 27 Jan 2016 16:41:12 +0000 (09:41 -0700)]
Revert "UBUNTU: SAUCE: (noup) cxlflash: a couple off by one bugs"

This reverts commit c8433a26b0dec49938c6007de4b232ad30af8616.

Reverting in favor of upstream e37390bee6fe7dfbe507a9d50cdc11344b53fa08

Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoplatform:x86: Add Intel Telemetry Debugfs interfaces
Souvik Kumar Chakravarty [Tue, 12 Jan 2016 10:35:14 +0000 (16:05 +0530)]
platform:x86: Add Intel Telemetry Debugfs interfaces

BugLink: http://bugs.launchpad.net/bugs/1520457
This implements debugfs interfaces for reading the telemetry
samples from SSRAM and configuring firmware trace verbosity.
Interface created under /sys/kernel/debug/telemetry
soc_states: SoC Device and Low Power States
pss_info: Info from the Primary SubSystem
ioss_info: Info from IO SubSusytem
pss_trace_verbosity: Read/Modify PSS F/W trace verbosity
ioss_trace_verbosity: Read/Modify IOSS F/W trace verbosity.

Signed-off-by: Souvik Kumar Chakravarty <souvik.k.chakravarty@intel.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
(cherry picked from commit 87bee290998d062937eecf40ad409480e7281b0e)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoplatform:x86: Add Intel telemetry platform driver
Souvik Kumar Chakravarty [Tue, 12 Jan 2016 10:31:39 +0000 (16:01 +0530)]
platform:x86: Add Intel telemetry platform driver

BugLink: http://bugs.launchpad.net/bugs/1520457
Telemetry platform driver implements the telemetry interfaces.
Currently it supports ApolloLake. It uses the PUNIT and PMC IPC
interfaces to configure the telemetry samples to read.
The samples are read from a Secure SRAM region.

Signed-off-by: Souvik Kumar Chakravarty <souvik.k.chakravarty@intel.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
(cherry picked from commit 9d16b482b059d784137881f3ec4bb121c5a2e6ee)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoplatform:x86: Add Intel telemetry platform device
Souvik Kumar Chakravarty [Tue, 12 Jan 2016 10:32:54 +0000 (16:02 +0530)]
platform:x86: Add Intel telemetry platform device

BugLink: http://bugs.launchpad.net/bugs/1520457
Telemetry Device is created by the pmc_ipc driver. Resources
are populated according SSRAM region as indicated by the BIOS tables.

Signed-off-by: Souvik Kumar Chakravarty <souvik.k.chakravarty@intel.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
(cherry picked from commit 48c1917088ba00af25a0afc13de7403d6a80b06d)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agointel_pmc_ipc: update acpi resource structure for Punit
Qipeng Zha [Fri, 11 Dec 2015 14:44:59 +0000 (22:44 +0800)]
intel_pmc_ipc: update acpi resource structure for Punit

BugLink: http://bugs.launchpad.net/bugs/1520457
BIOS restructure exported memory resources for Punit
in acpi table, So update resources for Punit.

Signed-off-by: Qipeng Zha <qipeng.zha@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
(cherry picked from commit 8cc7fb4a6523d4bdda87bba61f4dc742d3b5ba39)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoplatform/x86: Add Intel Telemetry Core Driver
Souvik Kumar Chakravarty [Tue, 12 Jan 2016 10:30:33 +0000 (16:00 +0530)]
platform/x86: Add Intel Telemetry Core Driver

BugLink: http://bugs.launchpad.net/bugs/1520457
Intel PM Telemetry is a software mechanism via which various SoC
PM and performance related parameters like PM counters, firmware
trace verbosity, the status of different devices inside the SoC, etc.
can be monitored and analyzed. The different samples that may be
monitored can be configured at runtime via exported APIs.

This patch adds the telemetry core driver that implements basic
exported APIs.

Signed-off-by: Souvik Kumar Chakravarty <souvik.k.chakravarty@intel.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
(cherry picked from commit 378f956e3f93b7862d89f93411953758491b42cc)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agointel_punit_ipc: add NULL check for input parameters
Qipeng Zha [Fri, 8 Jan 2016 10:32:27 +0000 (18:32 +0800)]
intel_punit_ipc: add NULL check for input parameters

BugLink: http://bugs.launchpad.net/bugs/1520457
intel_punit_ipc_command() maybe called when in or out
data pointers are NULL.

Signed-off-by: Qipeng Zha <qipeng.zha@intel.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
(cherry picked from commit 3fae75740faff4c6a66be7131838fda3ae92e280)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoplatform:x86: add Intel P-Unit mailbox IPC driver
Qipeng Zha [Fri, 11 Dec 2015 14:45:00 +0000 (22:45 +0800)]
platform:x86: add Intel P-Unit mailbox IPC driver

BugLink: http://bugs.launchpad.net/bugs/1520457
This driver provides support for P-Unit mailbox IPC on Intel platforms.
The heart of the P-Unit is the Foxton microcontroller and its firmware,
which provide mailbox interface for power management usage.

Signed-off-by: Qipeng Zha <qipeng.zha@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
(cherry picked from commit fdca4f16f57da76a8e68047923588a87d1c01f0a)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoUBUNTU: [Config] CONFIG_INTEL_PUNIT_IPC=m, CONFIG_INTEL_TELEMETRY=m
Tim Gardner [Wed, 27 Jan 2016 13:26:42 +0000 (06:26 -0700)]
UBUNTU: [Config] CONFIG_INTEL_PUNIT_IPC=m, CONFIG_INTEL_TELEMETRY=m

BugLink: http://bugs.launchpad.net/bugs/1520457
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoUBUNTU: [Config] disable ARCH_ZX (ZTE ZX Soc)
Paolo Pisati [Wed, 27 Jan 2016 11:01:37 +0000 (12:01 +0100)]
UBUNTU: [Config] disable ARCH_ZX (ZTE ZX Soc)

Disable support for the ZTE ZX Soc that was oopings when probed upon boot.

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoUBUNTU: [Config] MFD_TPS65217=y && REGULATOR_TPS65217=y
Paolo Pisati [Wed, 27 Jan 2016 11:01:36 +0000 (12:01 +0100)]
UBUNTU: [Config] MFD_TPS65217=y && REGULATOR_TPS65217=y

Boot essential for the BBB (MFD_TPS65217 and its regulator REGULATOR_TPS65217)

Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agodrm/i915/skl: Disable coarse power gating up until F0
Mika Kuoppala [Mon, 7 Dec 2015 16:29:44 +0000 (18:29 +0200)]
drm/i915/skl: Disable coarse power gating up until F0

BugLink: http://bugs.launchpad.net/bugs/1527462
There is conflicting info between E0 and F0 steppings
for this workarounds. Trust more authoritative source and
be conservative and extend also for F0.

This prevents numerous (>50) gpu hangs with SKL GT4e
during piglit run.

References: HSD: gen9lp/2134184
Cc: Sagar Arun Kamble <sagar.a.kamble@intel.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: Sagar Arun Kamble <sagar.a.kamble@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1449505785-20812-1-git-send-email-mika.kuoppala@intel.com
(cherry picked from commit 6686ece19f7446f0e29c77d9e0402e1d0ce10c48)
Cc: stable@vger.kernel.org # v4.3+
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
(cherry picked from commit 344df9809f4521c8c11d67c5ef18764b54358950)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agodrm/i915/skl: Add SKL GT4 PCI IDs
Mika Kuoppala [Fri, 6 Nov 2015 12:11:16 +0000 (14:11 +0200)]
drm/i915/skl: Add SKL GT4 PCI IDs

BugLink: http://bugs.launchpad.net/bugs/1527462
Add Skylake Intel Graphics GT4 PCI IDs

v2: Rebase

Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1446811876-303-1-git-send-email-mika.kuoppala@intel.com
(back ported from commit 15620206ae87ba9643ffa6f5ddb5471be7192006)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Conflicts:
drivers/gpu/drm/i915/i915_drv.c

8 years agodrm/i915: WaRsDisableCoarsePowerGating
Sagar Arun Kamble [Sat, 12 Sep 2015 04:47:51 +0000 (10:17 +0530)]
drm/i915: WaRsDisableCoarsePowerGating

BugLink: http://bugs.launchpad.net/bugs/1527462
WaRsDisableCoarsePowerGating: Coarse Power Gating (CPG) needs to be
disabled for platforms prior to BXT B0 and SKL GT3/GT4 till E0.

v2: Added GT3/GT4 Check.

Change-Id: Ia3c4c16e050c88d3e259f601054875c812d69c3a
Signed-off-by: Sagar Arun Kamble <sagar.a.kamble@intel.com>
Reviewed-by: Alex Dai <yu.dai@intel.com>
[danvet: Align continuation properly.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
(back ported from commit f2d2fe95072acd5404f8051b8bf1195c61a47fb5)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Conflicts:
drivers/gpu/drm/i915/intel_pm.c

8 years agoperf/x86/intel/uncore: Remove hard coding of PMON box control MSR offset
Harish Chegondi [Mon, 7 Dec 2015 22:32:31 +0000 (14:32 -0800)]
perf/x86/intel/uncore: Remove hard coding of PMON box control MSR offset

BugLink: http://bugs.launchpad.net/bugs/1461360
Call uncore_pci_box_ctl() function to get the PMON box control MSR offset
instead of hard coding the offset. This would allow us to use this
snbep_uncore_pci_init_box() function for other PCI PMON devices whose box
control MSR offset is different from SNBEP_PCI_PMON_BOX_CTL.

Signed-off-by: Harish Chegondi <harish.chegondi@intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andi Kleen <andi.kleen@intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Harish Chegondi <harish.chegondi@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Lukasz Anaczkowski <lukasz.anaczkowski@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Link: http://lkml.kernel.org/r/872e8ef16cfc38e5ff3b45fac1094e6f1722e4ad.1449470704.git.harish.chegondi@intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
(cherry picked from commit dae25530a44ad9e6523495ebc8b37bb0a1640490)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoperf/x86/intel/uncore: Add Knights Landing uncore PMU support
Harish Chegondi [Mon, 7 Dec 2015 22:32:32 +0000 (14:32 -0800)]
perf/x86/intel/uncore: Add Knights Landing uncore PMU support

BugLink: http://bugs.launchpad.net/bugs/1461360
Knights Landing uncore performance monitoring (perfmon) is derived from
Haswell-EP uncore perfmon with several differences. One notable difference
is in PCI device IDs. Knights Landing uses common PCI device ID for
multiple instances of an uncore PMU device type. In Haswell-EP, each
instance of a PMU device type has a unique device ID.

Knights Landing uncore components that have performance monitoring units
are UBOX, CHA, EDC, MC, M2PCIe, IRP and PCU. Perfmon registers in EDC, MC,
IRP, and M2PCIe reside in the PCIe configuration space. Perfmon registers
in UBOX, CHA and PCU are accessed via the MSR interface.

For more details, please refer to the public document:

  https://software.intel.com/sites/default/files/managed/15/8d/IntelXeonPhi%E2%84%A2x200ProcessorPerformanceMonitoringReferenceManual_Volume1_Registers_v0%206.pdf

Signed-off-by: Harish Chegondi <harish.chegondi@intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andi Kleen <andi.kleen@intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Harish Chegondi <harish.chegondi@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Lukasz Anaczkowski <lukasz.anaczkowski@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Link: http://lkml.kernel.org/r/8ac513981264c3eb10343a3f523f19cc5a2d12fe.1449470704.git.harish.chegondi@intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
(cherry picked from commit 77af0037de0a280eeabc632890de871f062ea7be)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoperf/x86/intel: Add perf core PMU support for Intel Knights Landing
Harish Chegondi [Mon, 7 Dec 2015 22:28:18 +0000 (14:28 -0800)]
perf/x86/intel: Add perf core PMU support for Intel Knights Landing

BugLink: http://bugs.launchpad.net/bugs/1461360
Knights Landing core is based on Silvermont core with several differences.
Like Silvermont, Knights Landing has 8 pairs of LBR MSRs. However, the
LBR MSRs addresses match those of the Xeon cores' first 8 pairs of LBR MSRs
Unlike Silvermont, Knights Landing supports hyperthreading. Knights Landing
offcore response events config register mask is different from that of the
Silvermont.

This patch was developed based on a patch from Andi Kleen.

For more details, please refer to the public document:

  https://software.intel.com/sites/default/files/managed/15/8d/IntelXeonPhi%E2%84%A2x200ProcessorPerformanceMonitoringReferenceManual_Volume1_Registers_v0%206.pdf

Signed-off-by: Harish Chegondi <harish.chegondi@intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andi Kleen <andi.kleen@intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Harish Chegondi <harish.chegondi@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Lukasz Anaczkowski <lukasz.anaczkowski@intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Link: http://lkml.kernel.org/r/d14593c7311f78c93c9cf6b006be843777c5ad5c.1449517401.git.harish.chegondi@intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
(cherry picked from commit 1e7b93906249a7ccca730be03168ace15f95709e)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agokeys, trusted: seal with a TPM2 authorization policy
Jarkko Sakkinen [Sat, 31 Oct 2015 15:53:44 +0000 (17:53 +0200)]
keys, trusted: seal with a TPM2 authorization policy

BugLink: http://bugs.launchpad.net/bugs/1398274
TPM2 supports authorization policies, which are essentially
combinational logic statements repsenting the conditions where the data
can be unsealed based on the TPM state. This patch enables to use
authorization policies to seal trusted keys.

Two following new options have been added for trusted keys:

* 'policydigest=': provide an auth policy digest for sealing.
* 'policyhandle=': provide a policy session handle for unsealing.

If 'hash=' option is supplied after 'policydigest=' option, this
will result an error because the state of the option would become
mixed.

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Tested-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Acked-by: Peter Huewe <peterhuewe@gmx.de>
(cherry picked from commit 5beb0c435bdde35a09376566b0e28f7df87c9f68)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agokeys, trusted: select hash algorithm for TPM2 chips
Jarkko Sakkinen [Thu, 5 Nov 2015 19:43:06 +0000 (21:43 +0200)]
keys, trusted: select hash algorithm for TPM2 chips

BugLink: http://bugs.launchpad.net/bugs/1398274
Added 'hash=' option for selecting the hash algorithm for add_key()
syscall and documentation for it.

Added entry for sm3-256 to the following tables in order to support
TPM_ALG_SM3_256:

* hash_algo_name
* hash_digest_size

Includes support for the following hash algorithms:

* sha1
* sha256
* sha384
* sha512
* sm3-256

Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Tested-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: James Morris <james.l.morris@oracle.com>
Reviewed-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Acked-by: Peter Huewe <peterhuewe@gmx.de>
(cherry picked from commit 5ca4c20cfd37bac6486de040e9951b3b34755238)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agokeys, trusted: fix: *do not* allow duplicate key options
Jarkko Sakkinen [Sat, 12 Dec 2015 11:19:52 +0000 (13:19 +0200)]
keys, trusted: fix: *do not* allow duplicate key options

BugLink: http://bugs.launchpad.net/bugs/1398274
The trusted keys option parsing allows specifying the same option
multiple times. The last option value specified is used.

This is problematic because:

* No gain.
* This makes complicated to specify options that are dependent on other
  options.

This patch changes the behavior in a way that option can be specified
only once.

Reported-by: James Morris James Morris <jmorris@namei.org>
Reviewed-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Acked-by: Peter Huewe <peterhuewe@gmx.de>
(cherry picked from commit 5208cc83423dde06924121a85368c721a27ca555)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoi2c: designware: Convert to use unified device property API
Mika Westerberg [Mon, 30 Nov 2015 15:11:44 +0000 (17:11 +0200)]
i2c: designware: Convert to use unified device property API

BugLink: http://bugs.launchpad.net/bugs/1533035
With ACPI _DSD (introduced in ACPI v5.1) it is now possible to pass device
configuration information from ACPI in addition to DT. In order to support
this, convert the driver to use the unified device property accessors
instead of DT specific.

Change to ordering a bit so that we first try platform data and if that's
not available look from device properties. ACPI *CNT methods are then used
as last resort to override everything else.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Acked-by: Wolfram Sang <wsa@the-dreams.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 4c5301abbf81f4351416cec1e8a02647d96e6fd1)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agomfd: intel-lpss: Pass HSUART configuration via properties
Andy Shevchenko [Mon, 30 Nov 2015 15:11:43 +0000 (17:11 +0200)]
mfd: intel-lpss: Pass HSUART configuration via properties

BugLink: http://bugs.launchpad.net/bugs/1533035
The HS-UART host controller driver needs to know certain properties like
width of the register set if it cannot get that information from ACPI or
DT. In order to support non-ACPI systems we pass this information to the
driver via device properties.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit ec14c5395dfbc1d40a49c9f19d2bfde6739d89d5)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agomfd: intel-lpss: Pass SDA hold time to I2C host controller driver
Mika Westerberg [Mon, 30 Nov 2015 15:11:42 +0000 (17:11 +0200)]
mfd: intel-lpss: Pass SDA hold time to I2C host controller driver

BugLink: http://bugs.launchpad.net/bugs/1533035
Intel Skylake the LPSS I2C pad circuit has internal delays that require
programming non-zero SDA hold time for the I2C host controller. If this is
not done communication to slave devices may fail with arbitration lost
errors like the one seen below taken from Lenovo Yoga 900:

  i2c_hid i2c-SYNA2B29:00: Fetching the HID descriptor
  i2c_hid i2c-SYNA2B29:00: __i2c_hid_command: cmd=20 00
  i2c_designware i2c_designware.1: i2c_dw_handle_tx_abort: lost arbitration

To fix this we follow what the Windows driver is doing and pass the default
SDA hold time of 230 ns to all Intel Skylake host controllers. This still
allows the platform to override these values by passing special ACPI
methods SSCN and FMCN.

Reported-by: Kevin Fenzi <kevin@scrye.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 028af5941dd870afd5eb6a95c39f25564dcca79a)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agomfd: intel-lpss: Add support for passing device properties
Mika Westerberg [Mon, 30 Nov 2015 15:11:41 +0000 (17:11 +0200)]
mfd: intel-lpss: Add support for passing device properties

BugLink: http://bugs.launchpad.net/bugs/1533035
If the boot firmware does not support ACPI we need a way to pass device
configuration information to the drivers. The unified device properties API
already supports passing platform data via properties so let's take
advantage of that and allow probe drivers to pass set of properties to the
host controller driver.

In order to do that we need to be able to modify the MFD cell corresponding
the host controller, so make the core driver to take copy of the cell
instead of using it directly. Then we can assign info->pset to the
resulting copy of a cell and let the MFD core to assign that to the
resulting device.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit e15ad2154b6166804fc04487e0398c9aef9e7c97)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agomfd: core: propagate device properties to sub devices drivers
Andy Shevchenko [Mon, 30 Nov 2015 15:11:40 +0000 (17:11 +0200)]
mfd: core: propagate device properties to sub devices drivers

BugLink: http://bugs.launchpad.net/bugs/1533035
In the similar way like we do for the platform data we propagate the device
properties. For example, in case of Intel LPSS drivers we may provide a
specific property to tell the actual device driver an additional information
such as platform name.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 4d215cabc784990df11fbcca7af70adf53c9ff17)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agodriver core: Do not overwrite secondary fwnode with NULL if it is set
Mika Westerberg [Mon, 30 Nov 2015 15:11:39 +0000 (17:11 +0200)]
driver core: Do not overwrite secondary fwnode with NULL if it is set

BugLink: http://bugs.launchpad.net/bugs/1533035
If multiple devices share single firmware node like it is case with MFD
devices, the same firmware node (ACPI) is assigned to all of them. The
function also modifies the shared firmware node in order to preserve
secondary firmware node of the device in question.

If the new device which is sharing the firmware node does not have
secondary node it will be NULL which will be assigned to the secondary node
of the shared firmware node losing all built-in properties.

Prevent this by setting the secondary firmware node only if the replacement
is non-NULL.

Print also warning if someone tries to overwrite secondary node that has
already been assigned.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 55f89a8a4538803195395bdf347cbba51dcb1906)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agodriver core: platform: Add support for built-in device properties
Mika Westerberg [Mon, 30 Nov 2015 15:11:38 +0000 (17:11 +0200)]
driver core: platform: Add support for built-in device properties

BugLink: http://bugs.launchpad.net/bugs/1533035
Make it possible to pass built-in device properties to platform device
drivers. This is useful if the system does not have any firmware interface
like Device Tree or ACPI which provides these.

Properties associated with the platform device will be automatically
released when the corresponding device is removed.

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 00bbc1d8e46a92ce7bd80622cf4b09c3b727a741)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agodevice property: Take a copy of the property set
Mika Westerberg [Mon, 30 Nov 2015 15:11:37 +0000 (17:11 +0200)]
device property: Take a copy of the property set

BugLink: http://bugs.launchpad.net/bugs/1533035
It is convenient if the property set associated with the device secondary
firmware node is a copy of the original. This allows passing property set
from a stack for example for devices created dynamically. This also ties
the property set lifetime to the associated device.

Because of that we provide new function device_remove_property_set() that
is used to disassociate and release memory allocated for the property set.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 13141e1cb842ad6286c1cfa9a6b7c1577478d03b)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agodevice property: Fallback to secondary fwnode if primary misses the property
Andy Shevchenko [Mon, 30 Nov 2015 15:11:36 +0000 (17:11 +0200)]
device property: Fallback to secondary fwnode if primary misses the property

BugLink: http://bugs.launchpad.net/bugs/1533035
The struct fwnode has notion of secondary fwnode. This is supposed to used
as fallback if the primary firmware interface (DT, ACPI) does not have the
property in question.

However, the current implementation never checks the secondary node which
prevents one to add default "built-in" properties to devices.

This patch adds fallback to the secondary fwnode if the primary fwnode
returns that the property does not exists.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 362c0b30249e8639489b428ff5acc4a9d81c087f)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agodevice property: return -EINVAL when property isn't found in ACPI
Andy Shevchenko [Mon, 30 Nov 2015 15:11:35 +0000 (17:11 +0200)]
device property: return -EINVAL when property isn't found in ACPI

BugLink: http://bugs.launchpad.net/bugs/1533035
Change return code to be in align with OF and built-in device properties error
codes. In particular -EINVAL means property is not found.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 3c60f1149a2fee9ac4ef3cc27bd830e3bd8d2654)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agodevice property: improve readability of macros
Andy Shevchenko [Mon, 30 Nov 2015 15:11:34 +0000 (17:11 +0200)]
device property: improve readability of macros

BugLink: http://bugs.launchpad.net/bugs/1533035
There is no functional change.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 1d656fb757c17e48a8a01bd576d14918701ba55c)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agodevice property: helper macros for property entry creation
Heikki Krogerus [Mon, 30 Nov 2015 15:11:33 +0000 (17:11 +0200)]
device property: helper macros for property entry creation

BugLink: http://bugs.launchpad.net/bugs/1533035
Marcos for easier creation of build-in property entries.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit a85f420475334caed12b057ddcaa0b58e0b1ebb7)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agodevice property: keep single value inplace
Andy Shevchenko [Mon, 30 Nov 2015 15:11:32 +0000 (17:11 +0200)]
device property: keep single value inplace

BugLink: http://bugs.launchpad.net/bugs/1533035
We may save a lot of lines of code and space by keeping single values inside
the struct property_entry. Refactor the implementation to do so.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 66586baba56679baa2da1a10a96ccf15b1e96b95)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agodevice property: refactor built-in properties support
Andy Shevchenko [Mon, 30 Nov 2015 15:11:31 +0000 (17:11 +0200)]
device property: refactor built-in properties support

BugLink: http://bugs.launchpad.net/bugs/1533035
Instead of using the type and nval fields we will use length (in bytes) of the
value. The sanity check is done in the accessors.

The built-in property accessors are split in the same way such as device tree.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 318a1971826103ecf560875b17236dd4a93e8c88)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agodevice property: rename helper functions
Andy Shevchenko [Mon, 30 Nov 2015 15:11:30 +0000 (17:11 +0200)]
device property: rename helper functions

BugLink: http://bugs.launchpad.net/bugs/1533035
To be in align with the rest of fwnode types we rename the built-in property
set ones, i.e.
is_pset() -> is_pset_node()
to_pset() -> to_pset_node()

There is no functional change.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 61f5e294b89a90e8520c9eaf9a4af787db8911ea)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agodevice property: always check for fwnode type
Andy Shevchenko [Mon, 30 Nov 2015 15:11:29 +0000 (17:11 +0200)]
device property: always check for fwnode type

BugLink: http://bugs.launchpad.net/bugs/1533035
Currently the property accessors unconditionally fall back to built-in property
set as a last resort. Make this strict and return an error in case the type of
fwnode is unknown.

This is actually a follow up to the commit 4fa7508e9f1c (device property:
Return -ENXIO if there is no suitable FW interface).

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit e3f9e299bf94298ddd8beb63c0786a4d7766dc86)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoUBUNTU: SAUCE: KVM: PPC: Book3S HV: Fix soft lockups in KVM on HMI for time base...
Mahesh Salgaonkar [Thu, 14 Jan 2016 03:15:28 +0000 (08:45 +0530)]
UBUNTU: SAUCE: KVM: PPC: Book3S HV: Fix soft lockups in KVM on HMI for time base errors

BugLink: http://bugs.launchpad.net/bugs/1537881
https://lists.ozlabs.org/pipermail/linuxppc-dev/2016-January/138011.html

When secondaries are napping in kvm_unsplit_nap() with hwthread_req = 1,
the HMI goes ignored even though subcores are already exited the guest.
Hence HMI keeps waking up secondaries from nap in a loop and secondaries
always go back to nap since no vcore is assigned to them. This makes
impossible for primary thread to get hold of secondary threads resulting
into a soft lockup in KVM path.

This patch fixes this by adding a HMI check just before the thread goes
to unsplit nap.

Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoUBUNTU: SAUCE: powerpc/book3s: Fix TB corruption in guest exit path on HMI interrupt.
Mahesh Salgaonkar [Thu, 14 Jan 2016 03:15:04 +0000 (08:45 +0530)]
UBUNTU: SAUCE: powerpc/book3s: Fix TB corruption in guest exit path on HMI interrupt.

BugLink: http://bugs.launchpad.net/bugs/1537881
https://lists.ozlabs.org/pipermail/linuxppc-dev/2016-January/138010.html

When a guest is assigned to a core it converts the host Timebase (TB)
into guest TB by adding guest timebase offset before entering into
guest. During guest exit it restores the guest TB to host TB. This means
under certain conditions (Guest migration) host TB and guest TB can differ.

When we get an HMI for TB related issues the opal HMI handler would
try fixing errors and restore the correct host TB value. With no guest
running, we don't have any issues. But with guest running on the core
we run into TB corruption issues.

If we get an HMI while in the guest, the current HMI handler invokes opal
hmi handler before forcing guest to exit. The guest exit path subtracts
the guest TB offset from the current TB value which may have already
been restored with host value by opal hmi handler. This leads to incorrect
host and guest TB values.

With split-core, things become more complex. With split-core, TB also gets
split and each subcore gets its own TB register. When a hmi handler fixes
a TB error and restores the TB value, it affects all the TB values of
sibling subcores on the same core. On TB errors all the thread in the core
gets HMI. With existing code, the individual threads call opal hmi handle
independently which can easily throw TB out of sync if we have guest
running on subcores. Hence we will need to co-ordinate with all the
threads before making opal hmi handler call followed by TB resync.

This patch introduces a sibling subcore state structure (shared by all
threads in the core) in paca which holds information about whether sibling
subcores are in Guest mode or host mode. An array in_guest[] of size
MAX_SUBCORE_PER_CORE=4 is used to maintain the state of each subcore.
The subcore id is used as index into in_guest[] array. Only primary
thread entering/exiting the guest is responsible to set/unset its
designated array element.

On TB error, we get HMI interrupt on every thread on the core. Upon HMI,
this patch will now force guest to vacate the core/subcore. Primary
thread from each subcore will then turn off its respective bit
from the above bitmap during the guest exit path just after the
guest->host partition switch is complete.

All other threads that have just exited the guest OR were already in host
will wait until all other subcores clears their respective bit.
Once all the subcores turn off their respective bit, all threads will
will make call to opal hmi handler.

It is not necessary that opal hmi handler would resync the TB value for
every HMI interrupts. It would do so only for the HMI caused due to
TB errors. For rest, it would not touch TB value. Hence to make things
simpler, primary thread would call TB resync explicitly once for each
core immediately after opal hmi handler instead of subtracting guest
offset from TB. TB resync call will restore the TB with host value.
Thus we can be sure about the TB state.

One of the primary threads exiting the guest will take up the
responsibility of calling TB resync. It will use one of the top bits
(bit 63) from subcore state flags bitmap to make the decision. The first
primary thread (among the subcores) that is able to set the bit will
have to call the TB resync. Rest all other threads will wait until TB
resync is complete.  Once TB resync is complete all threads will then
proceed.

Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoUBUNTU: SAUCE: Powernv: Remove the usage of PACAR1 from opal wrappers
Mahesh Salgaonkar [Thu, 14 Jan 2016 03:14:58 +0000 (08:44 +0530)]
UBUNTU: SAUCE: Powernv: Remove the usage of PACAR1 from opal wrappers

BugLink: http://bugs.launchpad.net/bugs/1537881
https://lists.ozlabs.org/pipermail/linuxppc-dev/2016-January/138009.html

OPAL_CALL wrapper code sticks the r1 (stack pointer) into PACAR1 purely
for debugging purpose only. The power7_wakeup* functions relies on stack
pointer saved in PACAR1. Any opal call made using opal wrapper (directly
or in-directly) before we fall through power7_wakeup*, then it ends up
replacing r1 in PACAR1(r13) leading to kernel panic. So far we don't see
any issues because we have never made any opal calls using OPAL wrapper
before power7_wakeup*. But the subsequent HMI patch would need to invoke
C calls during cpu wakeup/idle path that in-directly makes opal call using
opal wrapper. This patch facilitates the subsequent HMI patch by removing
usage of PACAR1 from opal call wrapper.

Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoUBUNTU: SAUCE: (no-up): apparmor: fix for failed mediation of socket that is being...
John Johansen [Tue, 26 Jan 2016 00:10:11 +0000 (18:10 -0600)]
UBUNTU: SAUCE: (no-up): apparmor: fix for failed mediation of socket that is being shutdown

BugLink: http://bugs.launchpad.net/bugs/1446906
This is a horrendous HACK, that is a temporary fix until typesplitting
can land.

Store off the path reference on connection to make up for the path
being wiped out on socket shutdown.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Reviewed-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoUBUNTU: [Config] Add pvpanic to virtual flavour
Tim Gardner [Tue, 26 Jan 2016 01:40:04 +0000 (18:40 -0700)]
UBUNTU: [Config] Add pvpanic to virtual flavour

BugLink: http://bugs.launchpad.net/bugs/1537923
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: IS_ENABLED() is not appropriate for boolean kconfig option
Bruce Allan [Wed, 9 Dec 2015 01:20:49 +0000 (17:20 -0800)]
fm10k: IS_ENABLED() is not appropriate for boolean kconfig option

BugLink: http://bugs.launchpad.net/bugs/1536475
Tri-states need 'if IS_ENABLED()', booleans should use 'ifdef'.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 0d722ec8bf46cb6547d10e8c5d9b8b6498bc7f97)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: cleanup mailbox code comments etc
Bruce Allan [Wed, 9 Dec 2015 01:20:44 +0000 (17:20 -0800)]
fm10k: cleanup mailbox code comments etc

BugLink: http://bugs.launchpad.net/bugs/1536475
Cleanup a number of issues with function header comments, lower-case
acronyms (i.e. FIFO, TLV), duplicate comments and a stubbed-out header
comment for fm10k_sm_mbx_init.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit f632fed30f8e0c1b5c9de209f00145f516e7ad37)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: use true/false for boolean get_host_state
Bruce Allan [Tue, 8 Dec 2015 23:51:11 +0000 (15:51 -0800)]
fm10k: use true/false for boolean get_host_state

BugLink: http://bugs.launchpad.net/bugs/1536475
Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit f355bb51794af64ef583c259469a778e606d95bb)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: remove unused struct element
Bruce Allan [Tue, 8 Dec 2015 23:51:04 +0000 (15:51 -0800)]
fm10k: remove unused struct element

BugLink: http://bugs.launchpad.net/bugs/1536475
Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit e6f244d484793e0ce80101eb4a523ff08ad73172)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: constify fm10k_mac_ops, fm10k_iov_ops and fm10k_info structures
Bruce Allan [Tue, 8 Dec 2015 23:50:39 +0000 (15:50 -0800)]
fm10k: constify fm10k_mac_ops, fm10k_iov_ops and fm10k_info structures

BugLink: http://bugs.launchpad.net/bugs/1536475
These structures never change so declare them as const.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit f329ad732b21dc86d477b47300805dd16178f9ca)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: address operator not needed when declaring function pointers
Bruce Allan [Tue, 8 Dec 2015 23:50:34 +0000 (15:50 -0800)]
fm10k: address operator not needed when declaring function pointers

BugLink: http://bugs.launchpad.net/bugs/1536475
Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 4e458cfb226bf9a0e211895370f06838495b2e97)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: use ether_addr_equal instead of memcmp
Jacob Keller [Mon, 16 Nov 2015 23:33:34 +0000 (15:33 -0800)]
fm10k: use ether_addr_equal instead of memcmp

BugLink: http://bugs.launchpad.net/bugs/1536475
When comparing MAC addresses, use ether_addr_equal instead of memcmp to
ETH_ALEN length. Found and replaced using the following sed:

 sed -e 's/memcmp\x28\(.*\), ETH_ALEN\x29/!ether_addr_equal\x28\1\x29/'

Reported-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 6186ddf06dd270a09ca08cc3c182d4cd58cf0218)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: Cleanup exception handling for changing queues
Alexander Duyck [Tue, 10 Nov 2015 17:40:30 +0000 (09:40 -0800)]
fm10k: Cleanup exception handling for changing queues

BugLink: http://bugs.launchpad.net/bugs/1536475
This patch is meant to cleanup the exception handling for the paths where
we reset the interrupts and then reconfigure them.  In all of these paths
we had very different levels of exception handling.  I have updated the
driver so that all of the paths should result in a similar state if we
fail.

Specifically the driver will now unload the mailbox interrupt, free the
queue vectors and MSI-X, and then detach the interface.

In addition for any of the PCIe related resets I have added a check with
the hw_ready function to just make sure the registers are in a readable
state prior to reopening the interface.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Reviewed-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 09f8a82b6abbff279f41ac2892707d3f0f32d00c)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: correctly pack TLV structures and explain reasoning
Jacob Keller [Mon, 9 Nov 2015 22:04:08 +0000 (14:04 -0800)]
fm10k: correctly pack TLV structures and explain reasoning

BugLink: http://bugs.launchpad.net/bugs/1536475
The TLV format for little endian structures is actually 4 byte aligned
copy. To this end, we need to add an additional __aligned(4) marker
along with __packed to ensure that these structures are actually 4 byte
aligned and packed correctly. Use of just __packed will not work as this
will result in 1byte alignment which is incorrect. Add a comment
explaining the reasoning behind why these structures need the special
treatment.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 8c2a029c7eff14510fed04cef2848c6d21ed92dd)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: don't initialize fm10k_workqueue at global level
Bruce Allan [Tue, 3 Nov 2015 19:35:02 +0000 (11:35 -0800)]
fm10k: don't initialize fm10k_workqueue at global level

BugLink: http://bugs.launchpad.net/bugs/1536475
Cleans up checkpatch GLOBAL_INITIALIZERS error

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 07146e2ea8d878d3bfb8d7d3424350d447e0166f)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: initialize xps at driver load
Jacob Keller [Thu, 29 Oct 2015 20:43:40 +0000 (13:43 -0700)]
fm10k: initialize xps at driver load

BugLink: http://bugs.launchpad.net/bugs/1536475
Similar to ixgbe and i40e, initialize XPS on driver load so that we can
take advantage of this kernel feature.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 504b0fdf92bfb28b88b79fe3bf356b840b2e555c)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: cleanup overly long lines
Bruce Allan [Thu, 29 Oct 2015 00:19:56 +0000 (17:19 -0700)]
fm10k: cleanup overly long lines

BugLink: http://bugs.launchpad.net/bugs/1536475
Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 3d02b3df733af0531789fff3fc999f9ca843b66e)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: cleanup namespace pollution
Bruce Allan [Thu, 29 Oct 2015 00:19:51 +0000 (17:19 -0700)]
fm10k: cleanup namespace pollution

BugLink: http://bugs.launchpad.net/bugs/1536475
Make functions that should be static.  While we're at it, fix the function
header comment for fm10k_tlv_attr_nest_stop(), and update the copyright
header for fm10k_pf.h, fm10k_tlv.c and fm10k_tlv.h.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit bb269e8bb5ab5015574cf44af6233278af629bcb)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: use BIT() macro instead of open-coded bit-shifting
Bruce Allan [Thu, 29 Oct 2015 00:19:45 +0000 (17:19 -0700)]
fm10k: use BIT() macro instead of open-coded bit-shifting

BugLink: http://bugs.launchpad.net/bugs/1536475
Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 3e515645b198ac60f493822f9193dd8107e1b8d0)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: whitespace cleanups
Bruce Allan [Thu, 29 Oct 2015 00:19:40 +0000 (17:19 -0700)]
fm10k: whitespace cleanups

BugLink: http://bugs.launchpad.net/bugs/1536475
Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit a4fcad656e1100bdda9b0b752b93a1a276810469)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: do not inline fm10k_iov_select_vid()
Bruce Allan [Wed, 28 Oct 2015 23:04:40 +0000 (16:04 -0700)]
fm10k: do not inline fm10k_iov_select_vid()

BugLink: http://bugs.launchpad.net/bugs/1536475
The function declaration does not need to be 'inline'd here.

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit e214d85b4a0c358c5aefa45d72bb00138fbcb6ac)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: Cleanup exception handling for mailbox interrupt
Alexander Duyck [Tue, 27 Oct 2015 23:59:18 +0000 (16:59 -0700)]
fm10k: Cleanup exception handling for mailbox interrupt

BugLink: http://bugs.launchpad.net/bugs/1536475
This patch addresses two issues.

First is the fact that the fm10k_mbx_free_irq was assuming msix_entries was
valid and that will not always be the case.  As such we need to add a check
for if it is NULL.

Second is the fact that we weren't freeing the IRQ if the mailbox API
returned an error on trying to connect.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Reviewed-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit e00e23bceba48a8f0c94fefe26948404cbd43d0a)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: Cleanup MSI-X interrupts in case of failure
Alexander Duyck [Tue, 27 Oct 2015 23:59:12 +0000 (16:59 -0700)]
fm10k: Cleanup MSI-X interrupts in case of failure

BugLink: http://bugs.launchpad.net/bugs/1536475
If the q_vector allocation fails we should free the resources associated
with the MSI-X vector table.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Reviewed-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 587731e684dcf3522215194a02357d26b9bc7277)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: conditionally compile DCB and DebugFS support
Jacob Keller [Tue, 27 Oct 2015 19:51:09 +0000 (12:51 -0700)]
fm10k: conditionally compile DCB and DebugFS support

BugLink: http://bugs.launchpad.net/bugs/1536475
Rather than wrapping fm10k_dcbnl.c and fm10k_debugfs.c support with
 #ifdef blocks, just conditionally include the .o files in the Makefile.
Also, since we're modifying it, update the copyright year on the
Makefile.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 5682366cecd1d40cb63f6a88dbe53349cb97e173)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: bump driver version
Jacob Keller [Mon, 26 Oct 2015 21:38:40 +0000 (14:38 -0700)]
fm10k: bump driver version

BugLink: http://bugs.launchpad.net/bugs/1536475
We haven't bumped the driver version in a while despite many fixes being
pulled in from the out-of-tree Sourceforge driver. Update the version to
match.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit e3b6e95d070cbca5e82279fea99e2dba8e38f960)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: consistently refer to VLANs and VLAN IDs
Jacob Keller [Mon, 2 Nov 2015 20:10:22 +0000 (12:10 -0800)]
fm10k: consistently refer to VLANs and VLAN IDs

BugLink: http://bugs.launchpad.net/bugs/1536475
Instead of using lowercase vlan, vid, or VID, always use VLAN or VLAN ID
in comments when referring to VLANs. The original driver code was
consistent, but recent patches have not been as consistent with this
naming scheme.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit aa502b4a2425a269787fbe2c3a91054d5e648a64)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: remove namespace pollution of fm10k_iov_msg_data_pf
Jacob Keller [Mon, 26 Oct 2015 23:32:06 +0000 (16:32 -0700)]
fm10k: remove namespace pollution of fm10k_iov_msg_data_pf

BugLink: http://bugs.launchpad.net/bugs/1536475
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit b80b1a51a19d613751d032fe213d7802d945f300)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: remove unnecessary else block from if statements with return
Jacob Keller [Mon, 26 Oct 2015 23:32:05 +0000 (16:32 -0700)]
fm10k: remove unnecessary else block from if statements with return

BugLink: http://bugs.launchpad.net/bugs/1536475
Improve code style by removing the unnecessary else block of an if
statement which immediately returns.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 4ab0f79bf313b16d4038b94d861ec2184d347c6d)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: do not use CamelCase
Jacob Keller [Mon, 26 Oct 2015 23:32:04 +0000 (16:32 -0700)]
fm10k: do not use CamelCase

BugLink: http://bugs.launchpad.net/bugs/1536475
Avoid the use of CamelCase for some variable names that previously
slipped through review.

Reported-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 40423dd2a56ab95c41b69d9dd910199a0acfd5c5)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: use ether_addr_copy to copy MAC address
Jacob Keller [Mon, 26 Oct 2015 23:32:02 +0000 (16:32 -0700)]
fm10k: use ether_addr_copy to copy MAC address

BugLink: http://bugs.launchpad.net/bugs/1536475
Use the ether_addr_copy function instead of copying byte-by-byte in a
for-loop by hand.

Reported-by: Bruce Allan <bruce.w.allan@intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit f0cf5c98981353563b929801100c30071f0eeefb)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: TRIVIAL cleanup order at top of fm10k_xmit_frame
Jacob Keller [Fri, 16 Oct 2015 17:57:11 +0000 (10:57 -0700)]
fm10k: TRIVIAL cleanup order at top of fm10k_xmit_frame

BugLink: http://bugs.launchpad.net/bugs/1536475
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 03d13a51fb4494f3bf47f65e2be00e56c36d2b63)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: TRIVIAL fix typo of hardware
Jacob Keller [Fri, 16 Oct 2015 17:57:10 +0000 (10:57 -0700)]
fm10k: TRIVIAL fix typo of hardware

BugLink: http://bugs.launchpad.net/bugs/1536475
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit c7bc952349c39d8ec7b1a7f6ef403be2a08d5e86)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: change default Tx ITR to 25usec
Jacob Keller [Fri, 16 Oct 2015 17:57:09 +0000 (10:57 -0700)]
fm10k: change default Tx ITR to 25usec

BugLink: http://bugs.launchpad.net/bugs/1536475
The current default ITR for Tx is overly restrictive. Using a simple
netperf TCP_STREAM test, we top out at about 10Gb/s for a single thread
when running using 1500 byte frames. By reducing the ITR value to 25usec
(up to 40K interrupts a second from 10K), we are able to achieve 36Gb/s
for a single thread TCP stream test.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit dbf4284886c59a17dc0081cee39039ac2a546078)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: use macro for default Tx and Rx ITR values
Jacob Keller [Fri, 16 Oct 2015 17:57:08 +0000 (10:57 -0700)]
fm10k: use macro for default Tx and Rx ITR values

BugLink: http://bugs.launchpad.net/bugs/1536475
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 436ea956bffd9974bc41ae9bd99930e29d9c807d)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: Update adaptive ITR algorithm
Jacob Keller [Fri, 16 Oct 2015 17:57:07 +0000 (10:57 -0700)]
fm10k: Update adaptive ITR algorithm

BugLink: http://bugs.launchpad.net/bugs/1536475
The existing adaptive ITR algorithm is overly restrictive. It throttles
incorrectly for various traffic rates, and does not produce good
performance. The algorithm now allows for more interrupts per second,
and does some calculation to help improve for smaller packet loads. In
addition, take into account the new itr_scale from the hardware which
indicates how much to scale due to PCIe link speed.

Reported-by: Matthew Vick <matthew.vick@intel.com>
Reported-by: Alex Duyck <alexander.duyck@gmail.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 242722dd3d0af32703d4ebb4af63c92a2c85b835)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: introduce ITR_IS_ADAPTIVE macro
Jacob Keller [Fri, 16 Oct 2015 17:57:06 +0000 (10:57 -0700)]
fm10k: introduce ITR_IS_ADAPTIVE macro

BugLink: http://bugs.launchpad.net/bugs/1536475
Define a macro for identifying when the itr value is dynamic or
adaptive. The concept was taken from i40e. This helps make clear what
the check is, and reduces the line length to something more reasonable
in a few places.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 584373f5b98aed81ff5a432d91b6e16d7554a5c9)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: Add support for ITR scaling based on PCIe link speed
Jacob Keller [Fri, 16 Oct 2015 17:57:05 +0000 (10:57 -0700)]
fm10k: Add support for ITR scaling based on PCIe link speed

BugLink: http://bugs.launchpad.net/bugs/1536475
The Intel Ethernet Switch FM10000 Host Interface interrupt throttle
timers are based on the PCIe link speed. Because of this, the value
being programmed into the ITR registers must be scaled accordingly.

For the PF, this is as simple as reading the PCIe link speed and storing
the result. However, in the case of SR-IOV, the VF's interrupt throttle
timers are based on the link speed of the PF. However, the VF is unable
to get the link speed information from its configuration space, so the
PF must inform it of what scale to use.

Rather than pass this scale via mailbox message, take advantage of
unused bits in the TDLEN register to pass the scale. It is the
responsibility of the PF to program this for the VF while setting up the
VF queues and the responsibility of the VF to get the information
accordingly. This is preferable because it allows the VF to set up the
interrupts properly during initialization and matches how the MAC
address is passed in the TDBAL/TDBAH registers.

Since we're modifying fm10k_type.h, we may as well also update the
copyright year.

Reported-by: Matthew Vick <matthew.vick@intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 20076fa18571e2e274f51a2012ff5ef5c82e93a5)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: rename mbx_tx_oversized statistic to mbx_tx_dropped
Jacob Keller [Fri, 16 Oct 2015 17:57:03 +0000 (10:57 -0700)]
fm10k: rename mbx_tx_oversized statistic to mbx_tx_dropped

BugLink: http://bugs.launchpad.net/bugs/1536475
Originally this statistic was renamed because the method of dropping was
called "drop_oversized_messages", but this logic has changed much, and
this counter does actually represent messages which we failed to
transmit for a number of reasons. Rename the counter back to tx_dropped
since this is when it will increment, and it is less confusing.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 5680ea692407ce5113f3391c2e6b5dbe6eec84d8)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: add statistics for actual DWORD count of mbmem mailbox
Jacob Keller [Fri, 16 Oct 2015 17:57:02 +0000 (10:57 -0700)]
fm10k: add statistics for actual DWORD count of mbmem mailbox

BugLink: http://bugs.launchpad.net/bugs/1536475
A previous bug was uncovered by addition of a debug stat to indicate the
actual number of DWORDS we pulled from the mbmem. It turned out this was
not the same as the tx_dwords counter. While the previous bug fix should
have corrected this in all cases, add some debug stats that count the
number of DWORDs pushed or pulled from the mbmem. A future debugger may
take advantage of this statistic for debugging purposes. Since we're
modifying fm10k_mbx.h, update the copyright year as well.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 17d39fac0888bfd624f61f758c8cce60632a3394)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: explicitly typecast vlan values to u16
Jacob Keller [Fri, 16 Oct 2015 17:57:01 +0000 (10:57 -0700)]
fm10k: explicitly typecast vlan values to u16

BugLink: http://bugs.launchpad.net/bugs/1536475
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit cdf32c94bd3569d4e46b8f993e0fd8e45d438d18)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: Correct typecast in fm10k_update_xc_addr_pf
Jacob Keller [Fri, 16 Oct 2015 17:57:00 +0000 (10:57 -0700)]
fm10k: Correct typecast in fm10k_update_xc_addr_pf

BugLink: http://bugs.launchpad.net/bugs/1536475
Since the resultant data type of the mac_update.mac_upper field is u16,
it does not make sense to typecast u8 variables to u32 first. Since
we're modifying fm10k_pf.c, also update the copyright year.

Reported-by: Matthew Vick <matthew.vick@intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 9d4955b45888b1b7c9f2a954cf6aa1269904bb98)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: reinitialize queuing scheme after calling init_hw
Jacob Keller [Fri, 16 Oct 2015 17:56:59 +0000 (10:56 -0700)]
fm10k: reinitialize queuing scheme after calling init_hw

BugLink: http://bugs.launchpad.net/bugs/1536475
The init_hw function may fail, and in the case of VFs, it might change
the number of maximum queues available. Thus, for every flow which
checks init_hw, we need to ensure that we clear the queue scheme before,
and initialize it after. The fm10k_io_slot_reset path will end up
triggering a reset so fm10k_reinit needs this change. The
fm10k_io_error_detected and fm10k_io_resume also need to properly clear
and reinitialize the queue scheme.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 875328e4bce696e85edcda3c4b0ec80fd525e3a3)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: always check init_hw for errors
Jacob Keller [Fri, 16 Oct 2015 17:56:58 +0000 (10:56 -0700)]
fm10k: always check init_hw for errors

BugLink: http://bugs.launchpad.net/bugs/1536475
A recent change modified init_hw in some flows the function may fail on
VF devices. For example, if a VF doesn't yet own its own queues.
However, many callers of init_hw didn't bother to check the error code.
Other callers checked but only displayed diagnostic messages without
actually handling the consequences.

Fix this by (a) always returning and preventing the netdevice from going
up, and (b) printing the diagnostic in every flow for consistency. This
should resolve an issue where VF drivers would attempt to come up
before the PF has finished assigning queues.

In addition, change the dmesg output to explicitly show the actual
function that failed, instead of combining reset_hw and init_hw into a
single check, to help for future debugging.

Fixes: 1d568b0f6424 ("fm10k: do not assume VF always has 1 queue")
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 1343c65f70ee1b1f968a08b30e1836a4e37116cd)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: reset max_queues on init_hw_vf failure
Jacob Keller [Fri, 16 Oct 2015 17:56:57 +0000 (10:56 -0700)]
fm10k: reset max_queues on init_hw_vf failure

BugLink: http://bugs.launchpad.net/bugs/1536475
VF drivers must detect how many queues are available. Previously, the
driver assumed that each VF has at minimum 1 queue. This assumption is
incorrect, since it is possible that the PF has not yet assigned the
queues to the VF by the time the VF checks. To resolve this, we added a
check first to ensure that the first queue is infact owned by the VF at
init_hw_vf time. However, the code flow did not reset hw->mac.max_queues
to 0. In some cases, such as during reinit flows, we call init_hw_vf
without clearing the previous value of hw->mac.max_queues. Due to this,
when init_hw_vf errors out, if its error code is not properly handled
the VF driver may still believe it has queues which no longer belong to
it. Fix this by clearing the hw->mac.max_queues on exit due to errors.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 0e8d5b5975401c83641efd5d4595e6cdbe9e9e2f)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: set netdev features in one location
Jacob Keller [Fri, 16 Oct 2015 17:56:56 +0000 (10:56 -0700)]
fm10k: set netdev features in one location

BugLink: http://bugs.launchpad.net/bugs/1536475
Don't change netdev hw_features later in fm10k_probe, instead set all
values inside fm10k_alloc_netdev. To do so, we need to know the MAC type
(whether it is PF or VF) in order to determine what to do. This helps
ensure that all logic regarding features is co-located.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit e0244903d4a6a27f9f1e8b46b89afa4130aa9164)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: use napi_schedule_irqoff()
Alexander Duyck [Tue, 29 Sep 2015 22:19:56 +0000 (15:19 -0700)]
fm10k: use napi_schedule_irqoff()

BugLink: http://bugs.launchpad.net/bugs/1536475
The fm10k_msix_clean_rings function runs from hard interrupt context or
with interrupts already disabled in netpoll.

It can use napi_schedule_irqoff() instead of napi_schedule()

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit de125aaecf3f06984dd32335f1e6a41c80b71011)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: Fix handling of NAPI budget when multiple queues are enabled per vector
Alexander Duyck [Tue, 22 Sep 2015 21:35:35 +0000 (14:35 -0700)]
fm10k: Fix handling of NAPI budget when multiple queues are enabled per vector

BugLink: http://bugs.launchpad.net/bugs/1536475
This patch corrects an issue in which the polling routine would increase
the budget for Rx to at least 1 per queue if multiple queues were present.
This would result in Rx packets being processed when the budget was 0 which
is meant to indicate that no Rx can be handled.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 9f872986479b6e0543eb5c615e5f9491bb04e5c1)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: Correct MTU for jumbo frames
Jacob Keller [Tue, 25 Aug 2015 20:49:11 +0000 (13:49 -0700)]
fm10k: Correct MTU for jumbo frames

BugLink: http://bugs.launchpad.net/bugs/1536475
Based on hardware testing, the host interface supports up to 15368 bytes
as the maximum frame size. To determine the correct MTU, we subtract 8
for the internal switch tag, 14 for the L2 header, and 4 for the
appended FCS header, resulting in 15342 bytes of payload for our maximum
MTU on jumbo frames.

Signed-off-by: Matthew Vick <matthew.vick@intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Acked-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 8c7ee6d2cacc7794a91875ef5fd8284b4a900d8c)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agofm10k: do not assume VF always has 1 queue
Jacob Keller [Tue, 25 Aug 2015 00:27:24 +0000 (17:27 -0700)]
fm10k: do not assume VF always has 1 queue

BugLink: http://bugs.launchpad.net/bugs/1536475
It is possible that the PF has not yet assigned resources to the VF.
Although rare, this could result in the VF attempting to read queues it
does not own and result in FUM or THI faults in the PF. To prevent this,
check queue 0 before we continue in init_hw_vf.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 1340181fe435ccb8ca2f996b8680bd9566860619)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>