]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/log
mirror_ubuntu-zesty-kernel.git
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>
8 years agoi2c: designware: Do not require clock when SSCN and FFCN are provided
Suravee Suthikulpanit [Mon, 4 Jan 2016 15:17:35 +0000 (09:17 -0600)]
i2c: designware: Do not require clock when SSCN and FFCN are provided

The current driver uses input clock source frequency to calculate
values for [SS|FS]_[HC|LC] registers. However, when booting ACPI, we do not
currently have a good way to provide the frequency information.
Instead, we can leverage the SSCN and FFCN ACPI methods, which can be used
to directly provide these values. So, the clock information should
no longer be required during probing.

However, since clk can be invalid, additional checks must be done where
we are making use of it.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Tested-by: Loc Ho <lho@apm.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
(cherry picked from commit b33af11de236fd6e25f3716182f008039ec68e93)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoclk: xgene: Fix divider with non-zero shift value
Loc Ho [Thu, 19 Nov 2015 19:20:30 +0000 (12:20 -0700)]
clk: xgene: Fix divider with non-zero shift value

The X-Gene clock driver missed the divider shift operation when
set the divider value.

Signed-off-by: Loc Ho <lho@apm.com>
Fixes: 308964caeebc ("clk: Add APM X-Gene SoC clock driver")
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
(cherry picked from commit 1382ea631ddddb634850a3795527db0feeff5aaf)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoirqchip/gic-v2m: acpi: Introducing GICv2m ACPI support
Suravee Suthikulpanit [Thu, 10 Dec 2015 16:55:30 +0000 (08:55 -0800)]
irqchip/gic-v2m: acpi: Introducing GICv2m ACPI support

This patch introduces gicv2m_acpi_init(), which uses information
in MADT GIC MSI frames structure to initialize GICv2m driver.
It also exposes gicv2m_init() function, which simplifies callers
to a single GICv2m init function.

Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
Tested-by: Duc Dang <dhdang@apm.com>
Acked-by: Rafael J. Wysocki <rjw@rjwysocki.net>
Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
(cherry picked from commit 0644b3daca28dcb320373ae20069c269c9386304)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoirqchip/gic-v2m: Refactor to prepare for ACPI support
Suravee Suthikulpanit [Thu, 10 Dec 2015 16:55:29 +0000 (08:55 -0800)]
irqchip/gic-v2m: Refactor to prepare for ACPI support

This patch replaces the struct device_node with struct fwnode_handle
since this structure is common between DT and ACPI.

It also refactors gicv2m_init_one() to prepare for ACPI support.
The only functional change is removing the node name from pr_info.

Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
(cherry picked from commit 4266ab1a8ff5715e48b2e89046305864650ce025)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoirqdomain: Introduce is_fwnode_irqchip helper
Suravee Suthikulpanit [Thu, 10 Dec 2015 16:55:28 +0000 (08:55 -0800)]
irqdomain: Introduce is_fwnode_irqchip helper

Since there will be several places checking if fwnode.type
is equal FWNODE_IRQCHIP, this patch adds a convenient function
for this purpose.

Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
(cherry picked from commit 75aba7b0e9ac416ca53c0c97680b8e9aedf09284)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoacpi: pci: Setup MSI domain for ACPI based pci devices
Suravee Suthikulpanit [Thu, 10 Dec 2015 16:55:27 +0000 (08:55 -0800)]
acpi: pci: Setup MSI domain for ACPI based pci devices

This patch introduces pci_msi_register_fwnode_provider() for irqchip
to register a callback, to provide a way to determine appropriate MSI
domain for a pci device.

It also introduces pci_host_bridge_acpi_msi_domain(), which returns
the MSI domain of the specified PCI host bridge with DOMAIN_BUS_PCI_MSI
bus token. Then, it is assigned to pci device.

Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Rafael J. Wysocki <rjw@rjwysocki.net>
Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
(cherry picked from commit 471036b2b895789c2305428fd879006468e4a758)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoUBUNTU: SAUCE: arm64: errata: Add -mpc-relative-literal-loads to erratum #843419...
Paolo Pisati [Mon, 25 Jan 2016 11:28:42 +0000 (12:28 +0100)]
UBUNTU: SAUCE: arm64: errata: Add -mpc-relative-literal-loads to erratum #843419 build flags

GCC6 (and Linaro's 2015.12 snapshot of GCC5) has a new default that uses
adrp/ldr or adrp/add to address literal pools. When CONFIG_ARM64_ERRATUM_843419
is enabled, modules built with this toolchain fail to load:

  [ 2.156817] module libahci: unsupported RELA relocation: 275

Longterm, this will likely be superseded by -mfix-cortex-a53-843419, which
should disable this optimization in the future.

Cc: stable at vger.kernel.org
Fixes: df057cc7b4fa ("arm64: errata: add module build workaround for erratum #843419")
BugLink: http://bugs.launchpad.net/bugs/1533009
Suggested-by: Christophe Lyon <christophe.lyon at linaro.org>
Signed-off-by: dann frazier <dann.frazier at canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoe1000e: Fix msi-x interrupt automask
Benjamin Poirier [Mon, 9 Nov 2015 23:50:21 +0000 (15:50 -0800)]
e1000e: Fix msi-x interrupt automask

Since the introduction of 82574 support in e1000e, the driver has worked
on the assumption that msi-x interrupt generation is automatically
disabled after each irq. As it turns out, this is not the case.
Currently, rx interrupts can fire multiple times before and during napi
processing. This can be a problem for users because frames that arrive
in a certain window (after adapter->clean_rx() but before
napi_complete_done() has cleared NAPI_STATE_SCHED) generate an interrupt
which does not lead to napi_schedule(). These frames sit in the rx queue
until another frame arrives (a tcp retransmit for example).

While the EIAC and CTRL_EXT registers are properly configured for irq
automask, the modification of IAM in e1000_configure_msix() is what
prevents automask from working as intended.

This patch removes that erroneous write and fixes interrupt rearming for
tx interrupts. It also clears IAME from CTRL_EXT. This is not strictly
necessary for operation of the driver but it is to avoid disruption from
potential programs that access the registers directly, like `ethregs -c`.

Reported-by: Frank Steiner <steiner-reg@bio.ifi.lmu.de>
Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 0a8047ac68e50e4ccbadcfc6b6b070805b976885)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoe1000e: Do not write lsc to ics in msi-x mode
Benjamin Poirier [Mon, 9 Nov 2015 23:50:20 +0000 (15:50 -0800)]
e1000e: Do not write lsc to ics in msi-x mode

In msi-x mode, there is no handler for the lsc interrupt so there is no
point in writing that to ics now that we always assume Other interrupts
are caused by lsc.

Reviewed-by: Jasna Hodzic <jhodzic@ucdavis.edu>
Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit a61cfe4ffad7864a07e0c74969ca7ceb77ab2f1f)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoe1000e: Do not read ICR in Other interrupt
Benjamin Poirier [Mon, 9 Nov 2015 23:50:19 +0000 (15:50 -0800)]
e1000e: Do not read ICR in Other interrupt

Removes the ICR read in the other interrupt handler, uses EIAC to
autoclear the Other bit from ICR and IMS. This allows us to avoid
interference with Rx and Tx interrupts in the Other interrupt handler.

The information read from ICR is not needed. IMS is configured such that
the only interrupt cause that can trigger the Other interrupt is Link
Status Change.

Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 16ecba59bc333d6282ee057fb02339f77a880beb)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoe1000e: Remove unreachable code
Benjamin Poirier [Mon, 9 Nov 2015 23:50:18 +0000 (15:50 -0800)]
e1000e: Remove unreachable code

msi-x interrupts are not shared so there's no need to check if the
interrupt was really from this adapter.

Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 4d432f67ff004dc387ba307d418d0eae4fa9dc13)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoe1000e: Switch e1000e_up to void, drop code checking for error result
Alexander Duyck [Tue, 27 Oct 2015 23:59:31 +0000 (16:59 -0700)]
e1000e: Switch e1000e_up to void, drop code checking for error result

The function e1000e_up always returns 0.  As such we can convert it to a
void and just ignore the results.  This allows us to drop some code in a
couple spots as we no longer need to worry about non-zero return values.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 386164d9b36b1f6f1396978110de85c7e186491d)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoe1000e: initial support for i219-LM (3)
Raanan Avargil [Tue, 20 Oct 2015 14:13:01 +0000 (17:13 +0300)]
e1000e: initial support for i219-LM (3)

i219-LM (3) is a LOM that will be available on systems with the
Lewisburg Platform Controller Hub (PCH) chipset from Intel.
This patch provides the initial support for the device.

Signed-off-by: Raanan Avargil <raanan.avargil@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit f3ed935de059b83394c3ecf2c64c93b57c8915fe)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoe1000e: Increase timeout of polling bit RSPCIPHY
Raanan Avargil [Thu, 15 Oct 2015 12:59:49 +0000 (15:59 +0300)]
e1000e: Increase timeout of polling bit RSPCIPHY

Due to timing changes to the ME firmware in Skylake, this timer
needs to be increased to 300ms.

Signed-off-by: Raanan Avargil <raanan.avargil@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit d17c7868b2f8e329dcee4ecd2f5d16cfc9b26ac8)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoe1000e: fix division by zero on jumbo MTUs
Dmitry Fleytman [Tue, 13 Oct 2015 09:48:18 +0000 (12:48 +0300)]
e1000e: fix division by zero on jumbo MTUs

This patch fixes possible division by zero in receive
interrupt handler when working without adaptive interrupt
moderation.

The adaptive interrupt moderation mechanism is typically
disabled on jumbo MTUs.

Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Leonid Bloch <leonid@daynix.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit b77ac46bbae862dcb3f51296825c940404c69b0f)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoe1000: Elementary checkpatch warnings and checks removed
Janusz Wolak [Mon, 28 Sep 2015 21:40:19 +0000 (23:40 +0200)]
e1000: Elementary checkpatch warnings and checks removed

Signed-off-by: Janusz Wolak <januszvdm@gmail.com>
Acked-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 13a87c124ec8a717b557cd8bc08693af021c8812)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoe1000: get rid of duplicate exit path
Jean Sacren [Sat, 19 Sep 2015 11:08:47 +0000 (05:08 -0600)]
e1000: get rid of duplicate exit path

By using goto statement, we can achieve sharing the same exit path so
that code duplication could be minimized.

Signed-off-by: Jean Sacren <sakiwit@gmail.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit c619581a7903fadccb900d1d497d2366fdf7da9d)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoe1000: fix kernel-doc argument being missing
Jean Sacren [Sat, 19 Sep 2015 11:08:46 +0000 (05:08 -0600)]
e1000: fix kernel-doc argument being missing

Due to historical reason, 'phy_data' has never been included in the
kernel doc. Fix it so that the requirement could be fulfilled.

Signed-off-by: Jean Sacren <sakiwit@gmail.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit f03fed668a9193036db0258229af87e9ba46ed5e)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoe1000e: clean up the local variable
Jean Sacren [Sat, 19 Sep 2015 11:08:42 +0000 (05:08 -0600)]
e1000e: clean up the local variable

The local variable 'ret' doesn't serve much purpose so we might as well
clean it up.

Signed-off-by: Jean Sacren <sakiwit@gmail.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 5a5e889c80cef7513a40143ee1e474acccdee13b)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoe1000: fix a typo in the comment
Jean Sacren [Sat, 19 Sep 2015 11:08:41 +0000 (05:08 -0600)]
e1000: fix a typo in the comment

Use 'That' to replace 'The' so that the comment would make sense.

Signed-off-by: Jean Sacren <sakiwit@gmail.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit b6fad9f9fc5d4deb1cb50173bd729de26570fbbe)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoe1000: clean up the checking logic
Jean Sacren [Sat, 19 Sep 2015 11:08:40 +0000 (05:08 -0600)]
e1000: clean up the checking logic

The checking logic needed some clean-up work, so we rewrite it by
checking for break first. With that change in place, we can even move
the second check for goto statement outside of the loop.

As this is merely a cleanup, no functional change is involved. The
questionable 'tmp != 0xFF' is intentionally left alone.

Mark Rustad and Alexander Duyck contributed to this patch.

CC: Mark Rustad <mark.d.rustad@intel.com>
CC: Alex Duyck <aduyck@mirantis.com>
Signed-off-by: Jean Sacren <sakiwit@gmail.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 4e01f3a802b5910b25814e1d0fd05907edffed6f)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoe1000: Remove checkpatch coding style errors
Janusz Wolak [Thu, 17 Sep 2015 21:34:29 +0000 (23:34 +0200)]
e1000: Remove checkpatch coding style errors

Signed-off-by: Janusz Wolak <januszvdm@gmail.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit a48954c88b5a9ec0a8323fff1d47a6affba31d61)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoe1000: fix data race between tx_ring->next_to_clean
Dmitriy Vyukov [Tue, 8 Sep 2015 08:52:44 +0000 (10:52 +0200)]
e1000: fix data race between tx_ring->next_to_clean

e1000_clean_tx_irq cleans buffers and sets tx_ring->next_to_clean,
then e1000_xmit_frame reuses the cleaned buffers. But there are no
memory barriers when buffers gets recycled, so the recycled buffers
can be corrupted.

Use smp_store_release to update tx_ring->next_to_clean and
smp_load_acquire to read tx_ring->next_to_clean to properly
hand off buffers from e1000_clean_tx_irq to e1000_xmit_frame.

The data race was found with KernelThreadSanitizer (KTSAN).

Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 9eab46b7cb8d0b0dcf014bf7b25e0e72b9e4d929)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoe1000: make eeprom read/write scheduler friendly
Joern Engel [Thu, 23 Jul 2015 21:54:34 +0000 (14:54 -0700)]
e1000: make eeprom read/write scheduler friendly

Code was responsible for ~150ms scheduler latencies.

Signed-off-by: Joern Engel <joern@logfs.org>
Signed-off-by: Spencer Baugh <sbaugh@catern.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit e09b89069ff9e3877bdbca8e64da05cde88bc3a2)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoixgbe: Make ATR recognize IPv6 extended headers
Mark Rustad [Wed, 9 Dec 2015 22:55:37 +0000 (14:55 -0800)]
ixgbe: Make ATR recognize IPv6 extended headers

BugLink: http://bugs.launchpad.net/bugs/1536473
Right now ATR is not handling IPv6 extended headers, so ATR is not
being performed on such packets. Fix that by skipping extended
headers when they are present. This also fixes a problem where
the ATR code was not checking that the inner protocol was actually
TCP before setting up the signature rules. Since the protocol check
is intimately involved with the extended header processing as well,
this all gets fixed together.

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit e19dcdeb3527e996a96ea49d86cccce768b1079a)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoixgbe: Fix MDD events generated when FCoE+SRIOV are enabled
Neerav Parikh [Wed, 9 Dec 2015 06:13:58 +0000 (22:13 -0800)]
ixgbe: Fix MDD events generated when FCoE+SRIOV are enabled

BugLink: http://bugs.launchpad.net/bugs/1536473
When FCoE is enabled with SR-IOV on the X550 NIC the hardware
generates MDD events.

This patch fixes these by setting the expected values in the
Tx context descriptors for FCoE/FIP frames and adding a flush
after writing the RDLEN register.

Signed-off-by: Neerav Parikh <neerav.parikh@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 8b75451be1fc05b6ee3f9d0eaea0006d60caff89)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoixgbe: Fix to get FDMI HBA attributes information with X550
Usha Ketineni [Tue, 8 Dec 2015 12:01:18 +0000 (04:01 -0800)]
ixgbe: Fix to get FDMI HBA attributes information with X550

BugLink: http://bugs.launchpad.net/bugs/1536473
Check whether the FCOE support is enabled for the devices to get the
 FDMI HBA attributes information instead of checking each device id.
Also, add Model string information for X550.

Signed-off-by: Usha Ketineni <usha.k.ketineni@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit b262a9a772eae649159fd2480992713a2dd2b3d3)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoixgbe: Correct handling of any outer UDP checksum setting
Mark Rustad [Fri, 4 Dec 2015 19:26:43 +0000 (11:26 -0800)]
ixgbe: Correct handling of any outer UDP checksum setting

BugLink: http://bugs.launchpad.net/bugs/1536473
If an outer UDP checksum is set, pass the skb up with CHECKSUM_NONE
so that the stack will check the checksum. Do not increment an
error counter, because we don't know that there is an actual error.

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit d469251bfd06d15289c9dd5dd60b8ebf65785b03)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoixgbe: do not call check_link for ethtool in ixgbe_get_settings()
Emil Tantilov [Thu, 3 Dec 2015 23:20:06 +0000 (15:20 -0800)]
ixgbe: do not call check_link for ethtool in ixgbe_get_settings()

BugLink: http://bugs.launchpad.net/bugs/1536473
In ixgbe_get_settings() the link status and speed of the interface
are determined based on a read from the LINKS register via the call
to mac.ops.check.link(). This can cause issues where external drivers
may end up with unknown speed when calling ethtool_get_setings().

Instead of calling the mac.ops.check_link() we can report the speed
from the adapter structure which is populated by the driver.

Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit 0e4d422f5f7249324ac8d1b8e12772e530787a66)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoixgbe: fix broken PFC with X550
Vasu Dev [Mon, 23 Nov 2015 18:31:25 +0000 (10:31 -0800)]
ixgbe: fix broken PFC with X550

BugLink: http://bugs.launchpad.net/bugs/1536473
PFC is configuration is skipped for X550 devices due to a incorrect
device id check, fixing that to include X550 PFC configuration.

Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit cb78cf12d6e90f57f6e7d090867ef19b6a189dde)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoixgbe: use correct FCoE DDP max check
Vasu Dev [Mon, 23 Nov 2015 18:31:01 +0000 (10:31 -0800)]
ixgbe: use correct FCoE DDP max check

BugLink: http://bugs.launchpad.net/bugs/1536473
Use fcoe_ddp_xid from netdev as this is correctly set for different
device IDs to avoid DDP skip error on X550 as "xid=0x20b out-of-range"

Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit f10166aba2def9bc6443290231c60f7e2f70129b)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>