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>
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>
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>
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>
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>
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.
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>
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>
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.
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.
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>
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>
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>
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>
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>
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>
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.
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
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>
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:
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:
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>