]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/log
mirror_ubuntu-artful-kernel.git
8 years agonvme: move chardev and sysfs interface to common code
Christoph Hellwig [Sat, 28 Nov 2015 14:40:19 +0000 (15:40 +0100)]
nvme: move chardev and sysfs interface to common code

BugLink: http://bugs.launchpad.net/bugs/1531539
For this we need to add a proper controller init routine and a list of
all controllers that is in addition to the list of PCIe controllers,
which stays in pci.c.  Note that we remove the sysfs device when the
last reference to a controller is dropped now - the old code would have
kept it around longer, which doesn't make much sense.

This requires a new ->reset_ctrl operation to implement controleller
resets, and a new ->write_reg32 operation that is required to implement
subsystem resets.  We also now store caches copied of the NVMe compliance
version and the flag if a controller is attached to a subsystem or not in
the generic controller structure now.

Signed-off-by: Christoph Hellwig <hch@lst.de>
[Fixes for pr merge]
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit f3ca80fc11c3af566eacd99cf821c1a48035c63b)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agonvme: move namespace scanning to common code
Christoph Hellwig [Sat, 28 Nov 2015 14:39:07 +0000 (15:39 +0100)]
nvme: move namespace scanning to common code

BugLink: http://bugs.launchpad.net/bugs/1531539
The namespace scanning code has been mostly generic already, we just
need to store a pointer to the tagset in the nvme_ctrl structure, and
add a method to check if a controller is I/O incapable.  The latter
will hopefully be replaced by a proper controller state machine soon.

Signed-off-by: Christoph Hellwig <hch@lst.de>
[Fixed pr conflicts]
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
(back ported from commit 5bae7f73d378a986671a3cad717c721b38f80d9e)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
 Conflicts:
drivers/nvme/host/pci.c

8 years agonvme: move the call to nvme_init_identify earlier
Christoph Hellwig [Fri, 16 Oct 2015 05:58:46 +0000 (07:58 +0200)]
nvme: move the call to nvme_init_identify earlier

BugLink: http://bugs.launchpad.net/bugs/1531539
We want to record the identify and CAP values even if no I/O queue
is available.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit ce4541f40a949cd9a9c9f308b1a6a86914ce6e1a)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agonvme: add a common helper to read Identify Controller data
Christoph Hellwig [Sat, 28 Nov 2015 14:37:52 +0000 (15:37 +0100)]
nvme: add a common helper to read Identify Controller data

BugLink: http://bugs.launchpad.net/bugs/1531539
And add the 64-bit register read operation for it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 7fd8930f26be4c9078684b2fef14da0503771bf2)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agonvme: move nvme_{enable,disable,shutdown}_ctrl to common code
Christoph Hellwig [Sat, 28 Nov 2015 14:03:49 +0000 (15:03 +0100)]
nvme: move nvme_{enable,disable,shutdown}_ctrl to common code

BugLink: http://bugs.launchpad.net/bugs/1531539
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 5fd4ce1b005bd6ede913763f65efae9af6f7f386)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agonvme: move remaining CC setup into nvme_enable_ctrl
Christoph Hellwig [Sat, 28 Nov 2015 14:01:09 +0000 (15:01 +0100)]
nvme: move remaining CC setup into nvme_enable_ctrl

BugLink: http://bugs.launchpad.net/bugs/1531539
Remove the calculation of all the bits written into the CC register into
nvme_enable_ctrl, so that they can be moved into the core NVMe driver in
the future.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 1b2eb374651f0496b86ed5f095d4c448bff214fa)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agonvme: add explicit quirk handling
Christoph Hellwig [Thu, 26 Nov 2015 09:07:41 +0000 (10:07 +0100)]
nvme: add explicit quirk handling

BugLink: http://bugs.launchpad.net/bugs/1531539
Add an enum for all workarounds not in the spec and identify the affected
controllers at probe time.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 106198edb74cdf3fe1aefa6ad1e199b58ab7c4cb)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agonvme: move block_device_operations and ns/ctrl freeing to common code
Christoph Hellwig [Thu, 26 Nov 2015 09:54:19 +0000 (10:54 +0100)]
nvme: move block_device_operations and ns/ctrl freeing to common code

BugLink: http://bugs.launchpad.net/bugs/1531539
This moves the block_device_operations over to common code mostly
as-is.  The only change is that the ns and ctrl refcounting got some
small refcounting to have wrappers around the kref_put operations.

A new free_ctrl operation is added to allow the PCI driver to free
it's ressources on the final drop.

Signed-off-by: Christoph Hellwig <hch@lst.de>
[Moved the integrity and pr changes due to merge conflict]
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 1673f1f08c8876f3942b4fa5e8f6a40215f15a94)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agonvme: use the block layer for userspace passthrough metadata
Keith Busch [Fri, 23 Oct 2015 15:47:28 +0000 (09:47 -0600)]
nvme: use the block layer for userspace passthrough metadata

BugLink: http://bugs.launchpad.net/bugs/1531539
Use the integrity API to pass through metadata from userspace.  For PI
enabled devices this means that we now validate the reftag, which seems
like an unintentional ommission in the old code.

Thanks to Keith Busch for testing and fixes.

Signed-off-by: Christoph Hellwig <hch@lst.de>
[Skip metadata setup on admin commands]
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 0b7f1f26f95a51ab11d4dc0adee230212b3cd675)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agonvme: split __nvme_submit_sync_cmd
Christoph Hellwig [Fri, 20 Nov 2015 08:00:02 +0000 (09:00 +0100)]
nvme: split __nvme_submit_sync_cmd

BugLink: http://bugs.launchpad.net/bugs/1531539
Add a separate nvme_submit_user_cmd for commands that directly DMA
to or from userspace.  We'll add metadata support to that soon and
the common version would become too messy.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 4160982e7594481d6b7f90aa693638a37d20ea17)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agonvme: move nvme_setup_flush and nvme_setup_rw to common code
Christoph Hellwig [Fri, 16 Oct 2015 05:58:40 +0000 (07:58 +0200)]
nvme: move nvme_setup_flush and nvme_setup_rw to common code

BugLink: http://bugs.launchpad.net/bugs/1531539
And mark them inline so that we don't slow down the I/O submission path by
having to turn it into a forced out of line call.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 22944e9981db1e496d983298fd420a8c6b758c80)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agonvme: move nvme_error_status to common code
Christoph Hellwig [Fri, 16 Oct 2015 05:58:39 +0000 (07:58 +0200)]
nvme: move nvme_error_status to common code

BugLink: http://bugs.launchpad.net/bugs/1531539
And mark it inline so that we don't slow down the completion path by
having to turn it into a forced out of line call.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 15a190f7f57a2e46717490c35ac09882042a200b)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agonvme: factor out a nvme_unmap_data helper
Christoph Hellwig [Thu, 26 Nov 2015 09:51:23 +0000 (10:51 +0100)]
nvme: factor out a nvme_unmap_data helper

BugLink: http://bugs.launchpad.net/bugs/1531539
This is the counter part to nvme_map_data.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit d4f6c3aba5b496a2cb80a8e8e082ae51e46579f3)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agonvme: refactor nvme_queue_rq
Christoph Hellwig [Fri, 16 Oct 2015 05:58:38 +0000 (07:58 +0200)]
nvme: refactor nvme_queue_rq

BugLink: http://bugs.launchpad.net/bugs/1531539
This "backports" the structure I've used for the fabrics driver.  It
mostly started out as a cleanup so that I could actually understand
the code, but I think it also qualifies as a micro-optimization due
to the reduced time we hold q_lock and disable interrupts.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit ba1ca37ea4e320c108c356eb8c91ac652afc57dd)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agonvme: simplify nvme_setup_prps calling convention
Christoph Hellwig [Fri, 16 Oct 2015 05:58:37 +0000 (07:58 +0200)]
nvme: simplify nvme_setup_prps calling convention

BugLink: http://bugs.launchpad.net/bugs/1531539
Pass back a true/false value instead of the length which needs a compare
with the bytes in the request and drop the pointless gfp_t argument.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 69d2b571746d1c3fa10b7a0aa00859b296a98d12)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agonvme: split a new struct nvme_ctrl out of struct nvme_dev
Christoph Hellwig [Thu, 26 Nov 2015 09:06:56 +0000 (10:06 +0100)]
nvme: split a new struct nvme_ctrl out of struct nvme_dev

BugLink: http://bugs.launchpad.net/bugs/1531539
The new struct nvme_ctrl will be used by the common NVMe code that sits
on top of struct request_queue and the new nvme_ctrl_ops abstraction.
It only contains the bare minimum required, which consists of values
sampled during controller probe, the admin queue pointer and a second
struct device pointer at the moment, but more will follow later.  Only
values that are not used in the I/O fast path should be moved to
struct nvme_ctrl so that drivers can optimize their cache line usage
easily.  That's also the reason why we have two device pointers as
the struct device is used for DMA mapping purposes.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 1c63dc66580d4bbb6d2b75bf184b5aa105ba5bdb)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agonvme: use vendor it from identify
Christoph Hellwig [Thu, 26 Nov 2015 08:59:44 +0000 (09:59 +0100)]
nvme: use vendor it from identify

BugLink: http://bugs.launchpad.net/bugs/1531539
Use the vendor ID from the identify data instead of the PCI device to
make the SCSI translation layer independent from the PCI driver.  The NVMe
spec defines them as having the same value for current PCIe devices.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 01fec28a6f3ba96d4f46a538eae089dd92189fd1)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agonvme: split nvme_trans_device_id_page
Christoph Hellwig [Thu, 26 Nov 2015 08:55:48 +0000 (09:55 +0100)]
nvme: split nvme_trans_device_id_page

BugLink: http://bugs.launchpad.net/bugs/1531539
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit bf7d3ebbd219d8ad948e812d03e1decfd96c97d0)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agonvme: use offset instead of a struct for registers
Christoph Hellwig [Fri, 20 Nov 2015 07:58:10 +0000 (08:58 +0100)]
nvme: use offset instead of a struct for registers

BugLink: http://bugs.launchpad.net/bugs/1531539
This makes life easier for future non-PCI drivers where access to the
registers might be more complicated.  Note that Linux drivers are
pretty evenly split between the two versions, and in fact the NVMe
driver already uses offsets for the doorbells.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Keith Busch <keith.busch@intel.com>
[Fixed CMBSZ offset]
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
(back ported from commit 7a67cbea653e444d04d7e850ab9631a14a196422)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
 Conflicts:
drivers/nvme/host/pci.c

8 years agonvme: split command submission helpers out of pci.c
Christoph Hellwig [Thu, 26 Nov 2015 08:08:36 +0000 (09:08 +0100)]
nvme: split command submission helpers out of pci.c

BugLink: http://bugs.launchpad.net/bugs/1531539
Create a new core.c and start by adding the command submission helpers
to it, which are already abstracted away from the actual hardware queues
by the block layer.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
(back ported from commit 21d34711e1b5970acfb22bddf1fefbfbd7e0123b)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
 Conflicts:
drivers/nvme/host/Makefile

8 years agonvme: move struct nvme_iod to pci.c
Christoph Hellwig [Fri, 16 Oct 2015 05:58:32 +0000 (07:58 +0200)]
nvme: move struct nvme_iod to pci.c

BugLink: http://bugs.launchpad.net/bugs/1531539
This structure is specific to the PCIe driver internals and should be moved
to pci.c.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 71bd150c71072014d98bff6dc2db3229306ece35)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoUBUNTU: [Config] CONFIG_BLK_DEV_NVME_SCSI=y
Tim Gardner [Mon, 1 Feb 2016 23:23:57 +0000 (16:23 -0700)]
UBUNTU: [Config] CONFIG_BLK_DEV_NVME_SCSI=y

BugLink: http://bugs.launchpad.net/bugs/1531539
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agoblk-mq: add a flags parameter to blk_mq_alloc_request
Christoph Hellwig [Thu, 26 Nov 2015 08:13:05 +0000 (09:13 +0100)]
blk-mq: add a flags parameter to blk_mq_alloc_request

BugLink: http://bugs.launchpad.net/bugs/1531539
We already have the reserved flag, and a nowait flag awkwardly encoded as
a gfp_t.  Add a real flags argument to make the scheme more extensible and
allow for a nicer calling convention.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 6f3b0e8bcf3cbb87a7459b3ed018d31d918df3f8)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agolightnvm: ensure that nvm_dev_ops can be used without CONFIG_NVM
Jens Axboe [Wed, 13 Jan 2016 20:04:11 +0000 (13:04 -0700)]
lightnvm: ensure that nvm_dev_ops can be used without CONFIG_NVM

BugLink: http://bugs.launchpad.net/bugs/1531539
null_blk defines an empty version of this ops structure if CONFIG_NVM
isn't set, but it doesn't know the type. Move those bits out of the
protection of CONFIG_NVM in the main lightnvm include.

Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit a7fd9a4f3e8179bab31e4637236ebb0e0b7867c6)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agolightnvm: introduce factory reset
Matias Bjørling [Tue, 12 Jan 2016 06:49:39 +0000 (07:49 +0100)]
lightnvm: introduce factory reset

BugLink: http://bugs.launchpad.net/bugs/1531539
Now that a device can be managed using the system blocks, a method to
reset the device is necessary as well. This patch introduces logic to
reset the device easily to factory state and exposes it through an
ioctl.

The ioctl takes the following flags:

  NVM_FACTORY_ERASE_ONLY_USER
      By default all blocks, except host-reserved blocks are erased upon
      factory reset. Instead of this, only erase host-reserved blocks.
  NVM_FACTORY_RESET_HOST_BLKS
      Mark host-reserved blocks to be erased and set their type to free.
  NVM_FACTORY_RESET_GRWN_BBLKS
      Mark "grown bad blocks" to be erased and set their type to free.

Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 8b4970c41f88ad772771f87b1c82c395248a84d8)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agolightnvm: use system block for mm initialization
Matias Bjørling [Tue, 12 Jan 2016 06:49:38 +0000 (07:49 +0100)]
lightnvm: use system block for mm initialization

BugLink: http://bugs.launchpad.net/bugs/1531539
Use system block information to register the appropriate media manager.
This enables the LightNVM subsystem to instantiate a media manager
selected by the user, instead of relying on automatic detection by each
media manager loaded in the kernel.

A device must now be initialized before it can proceed to initialize its
media manager. Upon initialization, the configured media manager is
automatically initialized as well.

Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit b769207678176d590ea61ce7a64c9100925668b7)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agolightnvm: introduce ioctl to initialize device
Matias Bjørling [Tue, 12 Jan 2016 06:49:37 +0000 (07:49 +0100)]
lightnvm: introduce ioctl to initialize device

BugLink: http://bugs.launchpad.net/bugs/1531539
Based on the previous patch, we now introduce an ioctl to initialize the
device using nvm_init_sysblock and create the necessary system blocks.
The user may specify the media manager that they wish to instantiate on
top. Default from user-space will be "gennvm".

Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 5569615424613aa006005f18b03a3a12738a47d7)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agolightnvm: core on-disk initialization
Matias Bjørling [Tue, 12 Jan 2016 06:49:36 +0000 (07:49 +0100)]
lightnvm: core on-disk initialization

BugLink: http://bugs.launchpad.net/bugs/1531539
An Open-Channel SSD shall be initialized before use. To initialize, we
define an on-disk format, that keeps a small set of metadata to bring up
the media manager on top of the device.

The initial step is introduced to allow a user to format the disks for a
given media manager. During format, a system block is stored on one to
three separate luns on the device. Each lun has the system block
duplicated. During initialization, the system block can be retrieved and
the appropriate media manager can initialized.

The on-disk format currently covers (struct nvm_system_block):

 - Magic value "NVMS".
 - Monotonic increasing sequence number.
 - The physical block erase count.
 - Version of the system block format.
 - Media manager type.
 - Media manager superblock physical address.

The interface provides three functions to manage the system block:

 int nvm_init_sysblock(struct nvm_dev *, struct nvm_sb_info *)
 int nvm_get_sysblock(struct nvm *dev, struct nvm_sb_info *)
 int nvm_update_sysblock(struct nvm *dev, struct nvm_sb_info *)

Each implement a part of the logic to manage the system block. The
initialization creates the first system blocks and mark them on the
device. Get retrieves the latest system block by scanning all pages in
the associated system blocks. The update sysblock writes new metadata
and allocates new block if necessary.

Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit e3eb3799f7e0d0924ceeba672ab271865de2802d)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agolightnvm: introduce mlc lower page table mappings
Matias Bjørling [Tue, 12 Jan 2016 06:49:35 +0000 (07:49 +0100)]
lightnvm: introduce mlc lower page table mappings

BugLink: http://bugs.launchpad.net/bugs/1531539
NAND MLC memories have both lower and upper pages. When programming,
both of these must be written, before data can be read. However,
these lower and upper pages might not placed at even and odd flash
pages, but can be skipped. Therefore each flash memory has its lower
pages defined, which can then be used when programming and to know when
padding are necessary.

This patch implements the lower page definition in the specification,
and exposes it through a simple lookup table at dev->lptbl.

Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit ca5927e7ab5307965104ca58bbb29d110b1d4545)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agolightnvm: add mccap support
Matias Bjørling [Tue, 12 Jan 2016 06:49:34 +0000 (07:49 +0100)]
lightnvm: add mccap support

BugLink: http://bugs.launchpad.net/bugs/1531539
Some flash media has extended capabilities, such as programming SLC
pages on MLC/TLC flash, erase/program suspend, scramble and encryption.
MCCAP is introduced to detect support for these capabilities in the
command set.

Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit f9a9995072904f2d67d649545f17f81e00f4985e)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agolightnvm: manage open and closed blocks separately
Javier González [Tue, 12 Jan 2016 06:49:33 +0000 (07:49 +0100)]
lightnvm: manage open and closed blocks separately

BugLink: http://bugs.launchpad.net/bugs/1531539
LightNVM targets need to know the state of the flash block when doing
flash optimizations. An example is implementing a write buffer to
respect the flash page size. Currently, block state is not accounted
for; the media manager only differentiates among free, bad and in-use
blocks.

This patch adds the logic in the generic media manager to enable
targets manage blocks into open and close separately, and it implements
such management in rrpc. It also adds a set of flags to describe the
state of the block (open, closed, free, bad).

In order to avoid taking two locks (nvm_lun and rrpc_lun) consecutively,
we introduce lockless get_/put_block primitives so that the open and
close list locks and future common logic is handled within the nvm_lun
lock.

Signed-off-by: Javier González <javier@cnexlabs.com>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit ff0e498bfa185fad5e86c4c7a2db4f9648d2344f)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agolightnvm: fix missing grown bad block type
Matias Bjørling [Tue, 12 Jan 2016 06:49:32 +0000 (07:49 +0100)]
lightnvm: fix missing grown bad block type

BugLink: http://bugs.launchpad.net/bugs/1531539
The get/set bad block interface defines good block, factory bad block,
grown bad block, device reserved block, and host reserved block.
Unfortunately the grown bad block was missing, leaving the offsets wrong
for device and host side reserved blocks.

This patch adds the missing type and corrects the offsets.

Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit b5d4acd4cbf5029a2616084d9e9f392046d53a37)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agolightnvm: reference rrpc lun in rrpc block
Javier González [Tue, 12 Jan 2016 06:49:31 +0000 (07:49 +0100)]
lightnvm: reference rrpc lun in rrpc block

BugLink: http://bugs.launchpad.net/bugs/1531539
Currently, a rrpc block only points to its nvm_lun. If a user wants to
find the associated rrpc lun, it will have to calculate the index and
look it up manually. By referencing the rrpc lun directly, this step can
be omitted, at the cost of a larger memory footprint.

This is important for upcoming patches that implement write buffering in
rrpc.

Signed-off-by: Javier González <javier@cnexlabs.com>
Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit d7a64d275b39e19c010cdfd8728cc64f14b59bda)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agolightnvm: introduce nvm_submit_ppa
Matias Bjørling [Tue, 12 Jan 2016 06:49:30 +0000 (07:49 +0100)]
lightnvm: introduce nvm_submit_ppa

BugLink: http://bugs.launchpad.net/bugs/1531539
Internal logic for both core and media managers, does not have a
backing bio for issuing I/Os. Introduce nvm_submit_ppa to allow raw
I/Os to be submitted to the underlying device driver.

The function request the device, ppa, data buffer and its length and
will submit the I/O synchronously to the device. The return value may
therefore be used to detect any errors regarding the issued I/O.

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

BugLink: http://bugs.launchpad.net/bugs/1531539
Instead of passing request error into the LightNVM modules, incorporate
it into the nvm_rq.

Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 72d256ecc5d0c8cbcc0bd5c6d983b434df556cb4)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agolightnvm: support multiple ppas in nvm_erase_ppa
Matias Bjørling [Tue, 12 Jan 2016 06:49:28 +0000 (07:49 +0100)]
lightnvm: support multiple ppas in nvm_erase_ppa

BugLink: http://bugs.launchpad.net/bugs/1531539
Sometimes a user want to erase multiple PPAs at the same time. Extend
nvm_erase_ppa to take multiple ppas and number of ppas to be erased.

Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 81e681d3f7424fc2f03b6269e15c63131473c98f)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agolightnvm: move the pages per block check out of the loop
Wenwei Tao [Tue, 12 Jan 2016 06:49:27 +0000 (07:49 +0100)]
lightnvm: move the pages per block check out of the loop

BugLink: http://bugs.launchpad.net/bugs/1531539
There is no need to check whether dev's pages per block is
beyond rrpc support every time we init a lun, we only need
to check it once before enter the lun init loop.

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 4b79beb4c36d697e940e9f70d72399c71230a418)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agolightnvm: sectors first in ppa list
Matias Bjørling [Tue, 12 Jan 2016 06:49:26 +0000 (07:49 +0100)]
lightnvm: sectors first in ppa list

BugLink: http://bugs.launchpad.net/bugs/1531539
The Westlake controller requires that the PPA list has sectors defined
sequentially. Currently, the PPA list is created with planes first, then
sectors. Change this to sectors first, then planes.

Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 556755e941837ebc4b4859dd7f74f2ed2dd00fc7)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agolightnvm: fix locking and mempool in rrpc_lun_gc
Wenwei Tao [Tue, 12 Jan 2016 06:49:25 +0000 (07:49 +0100)]
lightnvm: fix locking and mempool in rrpc_lun_gc

BugLink: http://bugs.launchpad.net/bugs/1531539
This patch fix two issues in rrpc_lun_gc

1. prio_list is protected by rrpc_lun's lock not nvm_lun's, so
acquire rlun's lock instead of lun's before operate on the list.

2. we delete block from prio_list before allocating gcb, but gcb
allocation may fail, we end without putting it back to the list,
this makes the block won't get reclaimed in the future. To solve
this issue, delete block after gcb allocation.

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 b262924be03d5d2ae735bc9a4b37eb2c613f61f8)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agolightnvm: put block back to gc list on its reclaim fail
Wenwei Tao [Tue, 12 Jan 2016 06:49:24 +0000 (07:49 +0100)]
lightnvm: put block back to gc list on its reclaim fail

BugLink: http://bugs.launchpad.net/bugs/1531539
We delete a block from the gc list before reclaim it, so
put it back to the list on its reclaim fail, otherwise
this block will not get reclaimed and be programmable
in the future.

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 d0ca798f960ad7d86f5186fe312c131d00563eb7)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agolightnvm: check bi_error in gc
Wenwei Tao [Tue, 12 Jan 2016 06:49:23 +0000 (07:49 +0100)]
lightnvm: check bi_error in gc

BugLink: http://bugs.launchpad.net/bugs/1531539
We should check last io completion status before
starting another one.

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 2b11c1b24e50a26d435f1d59955f1268053623b7)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agolightnvm: return the get_bb_tbl return value
Matias Bjørling [Tue, 12 Jan 2016 06:49:22 +0000 (07:49 +0100)]
lightnvm: return the get_bb_tbl return value

BugLink: http://bugs.launchpad.net/bugs/1531539
During get_bb_tbl, a callback is used to allow an user-specific scan
function to be called. The callback may return an error, and in that
case, the return value is overridden. However, the callback error is
needed when the fault is a user error and not a kernel error. For
example, when a user tries to initialize the same device twice. The
get_bb_tbl callback should be able to communicate this.

Signed-off-by: Matias Bjørling <m@bjorling.me>
Signed-off-by: Jens Axboe <axboe@fb.com>
(cherry picked from commit 22513215b83d62a7f5e3494209b69d4d8c266ab8)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
8 years agolightnvm: refactor end_io functions for sync
Matias Bjørling [Tue, 12 Jan 2016 06:49:21 +0000 (07:49 +0100)]
lightnvm: refactor end_io functions for sync

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This reverts commit fac8e7e04e5649ff40cb920385c95c7449a4f6f9.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This reverts commit c8433a26b0dec49938c6007de4b232ad30af8616.

Reverting in favor of upstream e37390bee6fe7dfbe507a9d50cdc11344b53fa08

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

v2: Rebase

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

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

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

v2: Added GT3/GT4 Check.

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

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

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

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

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

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

For more details, please refer to the public document:

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

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

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

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

For more details, please refer to the public document:

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

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

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

Two following new options have been added for trusted keys:

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

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

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

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

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

* hash_algo_name
* hash_digest_size

Includes support for the following hash algorithms:

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

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

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

This is problematic because:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

There is no functional change.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
(cherry picked from commit f632fed30f8e0c1b5c9de209f00145f516e7ad37)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>