--- /dev/null
+From 0e16e4cfde70e1cf00f9fe3a8f601d10e73e0ec6 Mon Sep 17 00:00:00 2001
+From: Alex Deucher <alexander.deucher@amd.com>
+Date: Fri, 1 Aug 2014 20:05:29 +0200
+Subject: drm/radeon: use packet2 for nop on hawaii with old firmware
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Alex Deucher <alexander.deucher@amd.com>
+
+commit 0e16e4cfde70e1cf00f9fe3a8f601d10e73e0ec6 upstream.
+
+Older firmware didn't support the new nop packet.
+
+v2 (Andreas Boll):
+ - Drop usage of packet3 for new firmware
+
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Reviewed-by: Christian König <christian.koenig@amd.com> (v1)
+Signed-off-by: Andreas Boll <andreas.boll.dev@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/radeon/cik.c | 13 ++++++++++---
+ 1 file changed, 10 insertions(+), 3 deletions(-)
+
+--- a/drivers/gpu/drm/radeon/cik.c
++++ b/drivers/gpu/drm/radeon/cik.c
+@@ -7901,6 +7901,7 @@ restart_ih:
+ static int cik_startup(struct radeon_device *rdev)
+ {
+ struct radeon_ring *ring;
++ u32 nop;
+ int r;
+
+ /* enable pcie gen2/3 link */
+@@ -8034,9 +8035,15 @@ static int cik_startup(struct radeon_dev
+ }
+ cik_irq_set(rdev);
+
++ if (rdev->family == CHIP_HAWAII) {
++ nop = RADEON_CP_PACKET2;
++ } else {
++ nop = PACKET3(PACKET3_NOP, 0x3FFF);
++ }
++
+ ring = &rdev->ring[RADEON_RING_TYPE_GFX_INDEX];
+ r = radeon_ring_init(rdev, ring, ring->ring_size, RADEON_WB_CP_RPTR_OFFSET,
+- PACKET3(PACKET3_NOP, 0x3FFF));
++ nop);
+ if (r)
+ return r;
+
+@@ -8044,7 +8051,7 @@ static int cik_startup(struct radeon_dev
+ /* type-2 packets are deprecated on MEC, use type-3 instead */
+ ring = &rdev->ring[CAYMAN_RING_TYPE_CP1_INDEX];
+ r = radeon_ring_init(rdev, ring, ring->ring_size, RADEON_WB_CP1_RPTR_OFFSET,
+- PACKET3(PACKET3_NOP, 0x3FFF));
++ nop);
+ if (r)
+ return r;
+ ring->me = 1; /* first MEC */
+@@ -8055,7 +8062,7 @@ static int cik_startup(struct radeon_dev
+ /* type-2 packets are deprecated on MEC, use type-3 instead */
+ ring = &rdev->ring[CAYMAN_RING_TYPE_CP2_INDEX];
+ r = radeon_ring_init(rdev, ring, ring->ring_size, RADEON_WB_CP2_RPTR_OFFSET,
+- PACKET3(PACKET3_NOP, 0x3FFF));
++ nop);
+ if (r)
+ return r;
+ /* dGPU only have 1 MEC */
--- /dev/null
+From aee530cfecf4f3ec83b78406bac618cec35853f8 Mon Sep 17 00:00:00 2001
+From: Guenter Roeck <linux@roeck-us.net>
+Date: Wed, 13 Aug 2014 11:21:34 -0700
+Subject: firmware: Do not use WARN_ON(!spin_is_locked())
+
+From: Guenter Roeck <linux@roeck-us.net>
+
+commit aee530cfecf4f3ec83b78406bac618cec35853f8 upstream.
+
+spin_is_locked() always returns false for uniprocessor configurations
+in several architectures, so do not use WARN_ON with it.
+Use lockdep_assert_held() instead to also reduce overhead in
+non-debug kernels.
+
+Signed-off-by: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Matt Fleming <matt.fleming@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/firmware/efi/vars.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/drivers/firmware/efi/vars.c
++++ b/drivers/firmware/efi/vars.c
+@@ -481,7 +481,7 @@ EXPORT_SYMBOL_GPL(efivar_entry_remove);
+ */
+ static void efivar_entry_list_del_unlock(struct efivar_entry *entry)
+ {
+- WARN_ON(!spin_is_locked(&__efivars->lock));
++ lockdep_assert_held(&__efivars->lock);
+
+ list_del(&entry->list);
+ spin_unlock_irq(&__efivars->lock);
+@@ -507,7 +507,7 @@ int __efivar_entry_delete(struct efivar_
+ const struct efivar_operations *ops = __efivars->ops;
+ efi_status_t status;
+
+- WARN_ON(!spin_is_locked(&__efivars->lock));
++ lockdep_assert_held(&__efivars->lock);
+
+ status = ops->set_variable(entry->var.VariableName,
+ &entry->var.VendorGuid,
+@@ -667,7 +667,7 @@ struct efivar_entry *efivar_entry_find(e
+ int strsize1, strsize2;
+ bool found = false;
+
+- WARN_ON(!spin_is_locked(&__efivars->lock));
++ lockdep_assert_held(&__efivars->lock);
+
+ list_for_each_entry_safe(entry, n, head, list) {
+ strsize1 = ucs2_strsize(name, 1024);
+@@ -739,7 +739,7 @@ int __efivar_entry_get(struct efivar_ent
+ const struct efivar_operations *ops = __efivars->ops;
+ efi_status_t status;
+
+- WARN_ON(!spin_is_locked(&__efivars->lock));
++ lockdep_assert_held(&__efivars->lock);
+
+ status = ops->get_variable(entry->var.VariableName,
+ &entry->var.VendorGuid,
--- /dev/null
+From 9b29d3c6510407d91786c1cf9183ff4debb3473a Mon Sep 17 00:00:00 2001
+From: Joerg Roedel <jroedel@suse.de>
+Date: Tue, 5 Aug 2014 17:50:15 +0200
+Subject: iommu/amd: Fix cleanup_domain for mass device removal
+
+From: Joerg Roedel <jroedel@suse.de>
+
+commit 9b29d3c6510407d91786c1cf9183ff4debb3473a upstream.
+
+When multiple devices are detached in __detach_device, they
+are also removed from the domains dev_list. This makes it
+unsafe to use list_for_each_entry_safe, as the next pointer
+might also not be in the list anymore after __detach_device
+returns. So just repeatedly remove the first element of the
+list until it is empty.
+
+Tested-by: Marti Raudsepp <marti@juffo.org>
+Signed-off-by: Joerg Roedel <jroedel@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/iommu/amd_iommu.c | 10 ++++++----
+ 1 file changed, 6 insertions(+), 4 deletions(-)
+
+--- a/drivers/iommu/amd_iommu.c
++++ b/drivers/iommu/amd_iommu.c
+@@ -3227,14 +3227,16 @@ free_domains:
+
+ static void cleanup_domain(struct protection_domain *domain)
+ {
+- struct iommu_dev_data *dev_data, *next;
++ struct iommu_dev_data *entry;
+ unsigned long flags;
+
+ write_lock_irqsave(&amd_iommu_devtable_lock, flags);
+
+- list_for_each_entry_safe(dev_data, next, &domain->dev_list, list) {
+- __detach_device(dev_data);
+- atomic_set(&dev_data->bind, 0);
++ while (!list_empty(&domain->dev_list)) {
++ entry = list_first_entry(&domain->dev_list,
++ struct iommu_dev_data, list);
++ __detach_device(entry);
++ atomic_set(&entry->bind, 0);
+ }
+
+ write_unlock_irqrestore(&amd_iommu_devtable_lock, flags);
--- /dev/null
+From e7f9fa5498d91fcdc63d93007ba43f36b1a30538 Mon Sep 17 00:00:00 2001
+From: Joerg Roedel <jroedel@suse.de>
+Date: Tue, 5 Aug 2014 12:55:45 +0200
+Subject: iommu/vt-d: Defer domain removal if device is assigned to a driver
+
+From: Joerg Roedel <jroedel@suse.de>
+
+commit e7f9fa5498d91fcdc63d93007ba43f36b1a30538 upstream.
+
+When the BUS_NOTIFY_DEL_DEVICE event is received the device
+might still be attached to a driver. In this case the domain
+can't be released as the mappings might still be in use.
+
+Defer the domain removal in this case until we receivce the
+BUS_NOTIFY_UNBOUND_DRIVER event.
+
+Cc: Jiang Liu <jiang.liu@linux.intel.com>
+Cc: David Woodhouse <dwmw2@infradead.org>
+Signed-off-by: Joerg Roedel <jroedel@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/iommu/intel-iommu.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+--- a/drivers/iommu/intel-iommu.c
++++ b/drivers/iommu/intel-iommu.c
+@@ -3891,6 +3891,14 @@ static int device_notifier(struct notifi
+ action != BUS_NOTIFY_DEL_DEVICE)
+ return 0;
+
++ /*
++ * If the device is still attached to a device driver we can't
++ * tear down the domain yet as DMA mappings may still be in use.
++ * Wait for the BUS_NOTIFY_UNBOUND_DRIVER event to do that.
++ */
++ if (action == BUS_NOTIFY_DEL_DEVICE && dev->driver != NULL)
++ return 0;
++
+ domain = find_domain(dev);
+ if (!domain)
+ return 0;
--- /dev/null
+From c875d2c1b8083cd627ea0463e20bf22c2d7421ee Mon Sep 17 00:00:00 2001
+From: Alex Williamson <alex.williamson@redhat.com>
+Date: Thu, 3 Jul 2014 09:57:02 -0600
+Subject: iommu/vt-d: Exclude devices using RMRRs from IOMMU API domains
+
+From: Alex Williamson <alex.williamson@redhat.com>
+
+commit c875d2c1b8083cd627ea0463e20bf22c2d7421ee upstream.
+
+The user of the IOMMU API domain expects to have full control of
+the IOVA space for the domain. RMRRs are fundamentally incompatible
+with that idea. We can neither map the RMRR into the IOMMU API
+domain, nor can we guarantee that the device won't continue DMA with
+the area described by the RMRR as part of the new domain. Therefore
+we must prevent such devices from being used by the IOMMU API.
+
+Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
+Cc: David Woodhouse <dwmw2@infradead.org>
+Signed-off-by: Joerg Roedel <jroedel@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/iommu/intel-iommu.c | 49 +++++++++++++++++++++++++++++++++++---------
+ 1 file changed, 39 insertions(+), 10 deletions(-)
+
+--- a/drivers/iommu/intel-iommu.c
++++ b/drivers/iommu/intel-iommu.c
+@@ -2523,22 +2523,46 @@ static bool device_has_rmrr(struct devic
+ return false;
+ }
+
++/*
++ * There are a couple cases where we need to restrict the functionality of
++ * devices associated with RMRRs. The first is when evaluating a device for
++ * identity mapping because problems exist when devices are moved in and out
++ * of domains and their respective RMRR information is lost. This means that
++ * a device with associated RMRRs will never be in a "passthrough" domain.
++ * The second is use of the device through the IOMMU API. This interface
++ * expects to have full control of the IOVA space for the device. We cannot
++ * satisfy both the requirement that RMRR access is maintained and have an
++ * unencumbered IOVA space. We also have no ability to quiesce the device's
++ * use of the RMRR space or even inform the IOMMU API user of the restriction.
++ * We therefore prevent devices associated with an RMRR from participating in
++ * the IOMMU API, which eliminates them from device assignment.
++ *
++ * In both cases we assume that PCI USB devices with RMRRs have them largely
++ * for historical reasons and that the RMRR space is not actively used post
++ * boot. This exclusion may change if vendors begin to abuse it.
++ */
++static bool device_is_rmrr_locked(struct device *dev)
++{
++ if (!device_has_rmrr(dev))
++ return false;
++
++ if (dev_is_pci(dev)) {
++ struct pci_dev *pdev = to_pci_dev(dev);
++
++ if ((pdev->class >> 8) == PCI_CLASS_SERIAL_USB)
++ return false;
++ }
++
++ return true;
++}
++
+ static int iommu_should_identity_map(struct device *dev, int startup)
+ {
+
+ if (dev_is_pci(dev)) {
+ struct pci_dev *pdev = to_pci_dev(dev);
+
+- /*
+- * We want to prevent any device associated with an RMRR from
+- * getting placed into the SI Domain. This is done because
+- * problems exist when devices are moved in and out of domains
+- * and their respective RMRR info is lost. We exempt USB devices
+- * from this process due to their usage of RMRRs that are known
+- * to not be needed after BIOS hand-off to OS.
+- */
+- if (device_has_rmrr(dev) &&
+- (pdev->class >> 8) != PCI_CLASS_SERIAL_USB)
++ if (device_is_rmrr_locked(dev))
+ return 0;
+
+ if ((iommu_identity_mapping & IDENTMAP_AZALIA) && IS_AZALIA(pdev))
+@@ -4202,6 +4226,11 @@ static int intel_iommu_attach_device(str
+ int addr_width;
+ u8 bus, devfn;
+
++ if (device_is_rmrr_locked(dev)) {
++ dev_warn(dev, "Device is ineligible for IOMMU domain attach due to platform RMRR requirement. Contact your platform vendor.\n");
++ return -EPERM;
++ }
++
+ /* normally dev is not mapped */
+ if (unlikely(domain_context_mapped(dev))) {
+ struct dmar_domain *old_domain;
--- /dev/null
+From f8ca6ac00d2ba24c5557f08f81439cd3432f0802 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Salva=20Peir=C3=B3?= <speiro@ai2.upv.es>
+Date: Sat, 7 Jun 2014 11:41:44 -0300
+Subject: media: media-device: Remove duplicated memset() in media_enum_entities()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Salva Peiró <speiro@ai2.upv.es>
+
+commit f8ca6ac00d2ba24c5557f08f81439cd3432f0802 upstream.
+
+After the zeroing the whole struct struct media_entity_desc u_ent,
+it is no longer necessary to memset(0) its u_ent.name field.
+
+Signed-off-by: Salva Peiró <speiro@ai2.upv.es>
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/media/media-device.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+--- a/drivers/media/media-device.c
++++ b/drivers/media/media-device.c
+@@ -106,8 +106,6 @@ static long media_device_enum_entities(s
+ if (ent->name) {
+ strncpy(u_ent.name, ent->name, sizeof(u_ent.name));
+ u_ent.name[sizeof(u_ent.name) - 1] = '\0';
+- } else {
+- memset(u_ent.name, 0, sizeof(u_ent.name));
+ }
+ u_ent.type = ent->type;
+ u_ent.revision = ent->revision;
--- /dev/null
+From f17bc3f4707eb87bdb80b895911c551cdd606fbd Mon Sep 17 00:00:00 2001
+From: Philipp Zabel <p.zabel@pengutronix.de>
+Date: Mon, 26 May 2014 10:55:51 -0300
+Subject: media: mt9v032: fix hblank calculation
+
+From: Philipp Zabel <p.zabel@pengutronix.de>
+
+commit f17bc3f4707eb87bdb80b895911c551cdd606fbd upstream.
+
+Since (min_row_time - crop->width) can be negative, we have to do a signed
+comparison here. Otherwise max_t casts the negative value to unsigned int
+and sets min_hblank to that invalid value.
+
+Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/media/i2c/mt9v032.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/media/i2c/mt9v032.c
++++ b/drivers/media/i2c/mt9v032.c
+@@ -305,8 +305,8 @@ mt9v032_update_hblank(struct mt9v032 *mt
+
+ if (mt9v032->version->version == MT9V034_CHIP_ID_REV1)
+ min_hblank += (mt9v032->hratio - 1) * 10;
+- min_hblank = max_t(unsigned int, (int)mt9v032->model->data->min_row_time - crop->width,
+- (int)min_hblank);
++ min_hblank = max_t(int, mt9v032->model->data->min_row_time - crop->width,
++ min_hblank);
+ hblank = max_t(unsigned int, mt9v032->hblank, min_hblank);
+
+ return mt9v032_write(client, MT9V032_HORIZONTAL_BLANKING, hblank);
--- /dev/null
+From 3c4b422adb7694418848cefc2a4669d63192c649 Mon Sep 17 00:00:00 2001
+From: Paul Bolle <pebolle@tiscali.nl>
+Date: Wed, 16 Apr 2014 12:47:43 -0300
+Subject: media: sms: Remove CONFIG_ prefix from Kconfig symbols
+
+From: Paul Bolle <pebolle@tiscali.nl>
+
+commit 3c4b422adb7694418848cefc2a4669d63192c649 upstream.
+
+X-Patchwork-Delegate: mchehab@redhat.com
+Remove the CONFIG_ prefix from two Kconfig symbols in a dependency for
+SMS_SIANO_DEBUGFS. This prefix is invalid inside Kconfig files.
+
+Note that the current (common sense) dependency on SMS_USB_DRV and
+SMS_SDIO_DRV being equal ensures that SMS_SIANO_DEBUGFS will not
+violate its constraints. These constraint are that:
+- it should only be built if SMS_USB_DRV is set;
+- it can't be builtin if USB support is modular.
+
+So drop the dependency on SMS_USB_DRV, as it is unneeded.
+
+Fixes: 6c84b214284e ("[media] sms: fix randconfig building error")
+
+Reported-by: Martin Walch <walch.martin@web.de>
+Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/media/common/siano/Kconfig | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+--- a/drivers/media/common/siano/Kconfig
++++ b/drivers/media/common/siano/Kconfig
+@@ -22,8 +22,7 @@ config SMS_SIANO_DEBUGFS
+ bool "Enable debugfs for smsdvb"
+ depends on SMS_SIANO_MDTV
+ depends on DEBUG_FS
+- depends on SMS_USB_DRV
+- depends on CONFIG_SMS_USB_DRV = CONFIG_SMS_SDIO_DRV
++ depends on SMS_USB_DRV = SMS_SDIO_DRV
+
+ ---help---
+ Choose Y to enable visualizing a dump of the frontend
--- /dev/null
+From bd994ddb2a12a3ff48cd549ec82cdceaea9614df Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Date: Mon, 23 Jun 2014 18:00:22 -0300
+Subject: media: v4l: vb2: Fix stream start and buffer completion race
+
+From: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+
+commit bd994ddb2a12a3ff48cd549ec82cdceaea9614df upstream.
+
+videobuf2 stores the driver streaming state internally in the queue in
+the start_streaming_called variable. The state is set right after the
+driver start_stream operation returns, and checked in the
+vb2_buffer_done() function, typically called from the frame completion
+interrupt handler. A race condition exists if the hardware finishes
+processing the first frame before the start_stream operation returns.
+
+Fix this by setting start_streaming_called to 1 before calling the
+start_stream operation, and resetting it to 0 if the operation fails.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
+Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/media/v4l2-core/videobuf2-core.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/drivers/media/v4l2-core/videobuf2-core.c
++++ b/drivers/media/v4l2-core/videobuf2-core.c
+@@ -1750,12 +1750,14 @@ static int vb2_start_streaming(struct vb
+ __enqueue_in_driver(vb);
+
+ /* Tell the driver to start streaming */
++ q->start_streaming_called = 1;
+ ret = call_qop(q, start_streaming, q,
+ atomic_read(&q->owned_by_drv_count));
+- q->start_streaming_called = ret == 0;
+ if (!ret)
+ return 0;
+
++ q->start_streaming_called = 0;
++
+ dprintk(1, "driver refused to start streaming\n");
+ if (WARN_ON(atomic_read(&q->owned_by_drv_count))) {
+ unsigned i;
--- /dev/null
+From e51daefc228aa164adcc17fe8fce0f856ad0a1cc Mon Sep 17 00:00:00 2001
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Date: Wed, 21 May 2014 17:39:16 -0300
+Subject: media: v4l: vsp1: Remove the unneeded vsp1_video_buffer video field
+
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+
+commit e51daefc228aa164adcc17fe8fce0f856ad0a1cc upstream.
+
+The field is assigned but never read, remove it.
+
+This fixes a bug caused by the struct vb2_buffer field not being be the
+very first field of the vsp1_video_buffer buffer structure as required
+by videobuf2.
+
+Reported-by: Takanari Hayama <taki@igel.co.jp>
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/media/platform/vsp1/vsp1_video.c | 2 --
+ drivers/media/platform/vsp1/vsp1_video.h | 1 -
+ 2 files changed, 3 deletions(-)
+
+--- a/drivers/media/platform/vsp1/vsp1_video.c
++++ b/drivers/media/platform/vsp1/vsp1_video.c
+@@ -654,8 +654,6 @@ static int vsp1_video_buffer_prepare(str
+ if (vb->num_planes < format->num_planes)
+ return -EINVAL;
+
+- buf->video = video;
+-
+ for (i = 0; i < vb->num_planes; ++i) {
+ buf->addr[i] = vb2_dma_contig_plane_dma_addr(vb, i);
+ buf->length[i] = vb2_plane_size(vb, i);
+--- a/drivers/media/platform/vsp1/vsp1_video.h
++++ b/drivers/media/platform/vsp1/vsp1_video.h
+@@ -90,7 +90,6 @@ static inline struct vsp1_pipeline *to_v
+ }
+
+ struct vsp1_video_buffer {
+- struct vsp1_video *video;
+ struct vb2_buffer buf;
+ struct list_head queue;
+
--- /dev/null
+From 6174bac8c7ff73a86ae9a967d1c9cadc478023ae Mon Sep 17 00:00:00 2001
+From: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
+Date: Sun, 3 Aug 2014 14:54:05 +0530
+Subject: powerpc/cpufreq: Add pr_warn() on OPAL firmware failures
+
+From: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
+
+commit 6174bac8c7ff73a86ae9a967d1c9cadc478023ae upstream.
+
+Cpufreq depends on platform firmware to implement PStates. In case of
+platform firmware failure, cpufreq should not panic host kernel with
+BUG_ON(). Less severe pr_warn() will suffice.
+
+Add firmware_has_feature(FW_FEATURE_OPALv3) check to
+skip probing for device-tree on non-powernv platforms.
+
+Signed-off-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com>
+Acked-by: Gautham R. Shenoy <ego@linux.vnet.ibm.com>
+Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/cpufreq/powernv-cpufreq.c | 18 ++++++++++++++++--
+ 1 file changed, 16 insertions(+), 2 deletions(-)
+
+--- a/drivers/cpufreq/powernv-cpufreq.c
++++ b/drivers/cpufreq/powernv-cpufreq.c
+@@ -28,6 +28,7 @@
+ #include <linux/of.h>
+
+ #include <asm/cputhreads.h>
++#include <asm/firmware.h>
+ #include <asm/reg.h>
+ #include <asm/smp.h> /* Required for cpu_sibling_mask() in UP configs */
+
+@@ -98,7 +99,11 @@ static int init_powernv_pstates(void)
+ return -ENODEV;
+ }
+
+- WARN_ON(len_ids != len_freqs);
++ if (len_ids != len_freqs) {
++ pr_warn("Entries in ibm,pstate-ids and "
++ "ibm,pstate-frequencies-mhz does not match\n");
++ }
++
+ nr_pstates = min(len_ids, len_freqs) / sizeof(u32);
+ if (!nr_pstates) {
+ pr_warn("No PStates found\n");
+@@ -131,7 +136,12 @@ static unsigned int pstate_id_to_freq(in
+ int i;
+
+ i = powernv_pstate_info.max - pstate_id;
+- BUG_ON(i >= powernv_pstate_info.nr_pstates || i < 0);
++ if (i >= powernv_pstate_info.nr_pstates || i < 0) {
++ pr_warn("PState id %d outside of PState table, "
++ "reporting nominal id %d instead\n",
++ pstate_id, powernv_pstate_info.nominal);
++ i = powernv_pstate_info.max - powernv_pstate_info.nominal;
++ }
+
+ return powernv_freqs[i].frequency;
+ }
+@@ -321,6 +331,10 @@ static int __init powernv_cpufreq_init(v
+ {
+ int rc = 0;
+
++ /* Don't probe on pseries (guest) platforms */
++ if (!firmware_has_feature(FW_FEATURE_OPALv3))
++ return -ENODEV;
++
+ /* Discover pstates from device tree and init */
+ rc = init_powernv_pstates();
+ if (rc) {
--- /dev/null
+From 763fe0addb8fe15ccea67c0aebddc06f4bb25439 Mon Sep 17 00:00:00 2001
+From: Gavin Shan <gwshan@linux.vnet.ibm.com>
+Date: Wed, 6 Aug 2014 17:10:16 +1000
+Subject: powerpc/powernv: Fix IOMMU group lost
+
+From: Gavin Shan <gwshan@linux.vnet.ibm.com>
+
+commit 763fe0addb8fe15ccea67c0aebddc06f4bb25439 upstream.
+
+When we take full hotplug to recover from EEH errors, PCI buses
+could be involved. For the case, the child devices of involved
+PCI buses can't be attached to IOMMU group properly, which is
+caused by commit 3f28c5a ("powerpc/powernv: Reduce multi-hit of
+iommu_add_device()").
+
+When adding the PCI devices of the newly created PCI buses to
+the system, the IOMMU group is expected to be added in (C).
+(A) fails to bind the IOMMU group because bus->is_added is
+false. (B) fails because the device doesn't have binding IOMMU
+table yet. bus->is_added is set to true at end of (C) and
+pdev->is_added is set to true at (D).
+
+ pcibios_add_pci_devices()
+ pci_scan_bridge()
+ pci_scan_child_bus()
+ pci_scan_slot()
+ pci_scan_single_device()
+ pci_scan_device()
+ pci_device_add()
+ pcibios_add_device() A: Ignore
+ device_add() B: Ignore
+ pcibios_fixup_bus()
+ pcibios_setup_bus_devices()
+ pcibios_setup_device() C: Hit
+ pcibios_finish_adding_to_bus()
+ pci_bus_add_devices()
+ pci_bus_add_device() D: Add device
+
+If the parent PCI bus isn't involved in hotplug, the IOMMU
+group is expected to be bound in (B). (A) should fail as the
+sysfs entries aren't populated.
+
+The patch fixes the issue by reverting commit 3f28c5a and remove
+WARN_ON() in iommu_add_device() to allow calling the function
+even the specified device already has associated IOMMU group.
+
+Reported-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
+Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
+Acked-by: Wei Yang <weiyang@linux.vnet.ibm.com>
+Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/powerpc/kernel/iommu.c | 38 ++++++++++++++++--------------
+ arch/powerpc/platforms/powernv/pci-ioda.c | 2 -
+ 2 files changed, 22 insertions(+), 18 deletions(-)
+
+--- a/arch/powerpc/kernel/iommu.c
++++ b/arch/powerpc/kernel/iommu.c
+@@ -1120,37 +1120,41 @@ EXPORT_SYMBOL_GPL(iommu_release_ownershi
+ int iommu_add_device(struct device *dev)
+ {
+ struct iommu_table *tbl;
+- int ret = 0;
+
+- if (WARN_ON(dev->iommu_group)) {
+- pr_warn("iommu_tce: device %s is already in iommu group %d, skipping\n",
+- dev_name(dev),
+- iommu_group_id(dev->iommu_group));
++ /*
++ * The sysfs entries should be populated before
++ * binding IOMMU group. If sysfs entries isn't
++ * ready, we simply bail.
++ */
++ if (!device_is_registered(dev))
++ return -ENOENT;
++
++ if (dev->iommu_group) {
++ pr_debug("%s: Skipping device %s with iommu group %d\n",
++ __func__, dev_name(dev),
++ iommu_group_id(dev->iommu_group));
+ return -EBUSY;
+ }
+
+ tbl = get_iommu_table_base(dev);
+ if (!tbl || !tbl->it_group) {
+- pr_debug("iommu_tce: skipping device %s with no tbl\n",
+- dev_name(dev));
++ pr_debug("%s: Skipping device %s with no tbl\n",
++ __func__, dev_name(dev));
+ return 0;
+ }
+
+- pr_debug("iommu_tce: adding %s to iommu group %d\n",
+- dev_name(dev), iommu_group_id(tbl->it_group));
++ pr_debug("%s: Adding %s to iommu group %d\n",
++ __func__, dev_name(dev),
++ iommu_group_id(tbl->it_group));
+
+ if (PAGE_SIZE < IOMMU_PAGE_SIZE(tbl)) {
+- pr_err("iommu_tce: unsupported iommu page size.");
+- pr_err("%s has not been added\n", dev_name(dev));
++ pr_err("%s: Invalid IOMMU page size %lx (%lx) on %s\n",
++ __func__, IOMMU_PAGE_SIZE(tbl),
++ PAGE_SIZE, dev_name(dev));
+ return -EINVAL;
+ }
+
+- ret = iommu_group_add_device(tbl->it_group, dev);
+- if (ret < 0)
+- pr_err("iommu_tce: %s has not been added, ret=%d\n",
+- dev_name(dev), ret);
+-
+- return ret;
++ return iommu_group_add_device(tbl->it_group, dev);
+ }
+ EXPORT_SYMBOL_GPL(iommu_add_device);
+
+--- a/arch/powerpc/platforms/powernv/pci-ioda.c
++++ b/arch/powerpc/platforms/powernv/pci-ioda.c
+@@ -462,7 +462,7 @@ static void pnv_pci_ioda_dma_dev_setup(s
+
+ pe = &phb->ioda.pe_array[pdn->pe_number];
+ WARN_ON(get_dma_ops(&pdev->dev) != &dma_iommu_ops);
+- set_iommu_table_base(&pdev->dev, &pe->tce32_table);
++ set_iommu_table_base_and_group(&pdev->dev, &pe->tce32_table);
+ }
+
+ static int pnv_pci_ioda_dma_set_mask(struct pnv_phb *phb,
--- /dev/null
+From 36e7fdaa1a04fcf65b864232e1af56a51c7814d6 Mon Sep 17 00:00:00 2001
+From: Christian Borntraeger <borntraeger@de.ibm.com>
+Date: Tue, 5 Aug 2014 09:57:51 +0200
+Subject: s390/locking: Reenable optimistic spinning
+
+From: Christian Borntraeger <borntraeger@de.ibm.com>
+
+commit 36e7fdaa1a04fcf65b864232e1af56a51c7814d6 upstream.
+
+commit 4badad352a6bb202ec68afa7a574c0bb961e5ebc (locking/mutex: Disable
+optimistic spinning on some architectures) fenced spinning for
+architectures without proper cmpxchg.
+There is no need to disable mutex spinning on s390, though:
+The instructions CS,CSG and friends provide the proper guarantees.
+(We dont implement cmpxchg with locks).
+
+Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
+Cc: Ingo Molnar <mingo@kernel.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
+Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/s390/Kconfig | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/arch/s390/Kconfig
++++ b/arch/s390/Kconfig
+@@ -92,6 +92,7 @@ config S390
+ select ARCH_INLINE_WRITE_UNLOCK_IRQ
+ select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE
+ select ARCH_SAVE_PAGE_KEYS if HIBERNATION
++ select ARCH_SUPPORTS_ATOMIC_RMW
+ select ARCH_USE_CMPXCHG_LOCKREF
+ select ARCH_WANT_IPC_PARSE_VERSION
+ select BUILDTIME_EXTABLE_SORT
media-xc5000-fix-get_frequency.patch
media-xc4000-fix-get_frequency.patch
media-au0828-only-alt-setting-logic-when-needed.patch
+media-media-device-remove-duplicated-memset-in-media_enum_entities.patch
+media-mt9v032-fix-hblank-calculation.patch
+media-v4l-vsp1-remove-the-unneeded-vsp1_video_buffer-video-field.patch
+media-v4l-vb2-fix-stream-start-and-buffer-completion-race.patch
+media-sms-remove-config_-prefix-from-kconfig-symbols.patch
+iommu-vt-d-exclude-devices-using-rmrrs-from-iommu-api-domains.patch
+powerpc-powernv-fix-iommu-group-lost.patch
+iommu-vt-d-defer-domain-removal-if-device-is-assigned-to-a-driver.patch
+iommu-amd-fix-cleanup_domain-for-mass-device-removal.patch
+spi-orion-fix-incorrect-handling-of-cell-index-dt-property.patch
+spi-omap2-mcspi-configure-hardware-when-slave-driver-changes-mode.patch
+s390-locking-reenable-optimistic-spinning.patch
+powerpc-cpufreq-add-pr_warn-on-opal-firmware-failures.patch
+drm-radeon-use-packet2-for-nop-on-hawaii-with-old-firmware.patch
+firmware-do-not-use-warn_on-spin_is_locked.patch
--- /dev/null
+From 97ca0d6cc118716840ea443e010cb3d5f2d25eaf Mon Sep 17 00:00:00 2001
+From: "Mark A. Greer" <mgreer@animalcreek.com>
+Date: Tue, 1 Jul 2014 20:28:32 -0700
+Subject: spi: omap2-mcspi: Configure hardware when slave driver changes mode
+
+From: "Mark A. Greer" <mgreer@animalcreek.com>
+
+commit 97ca0d6cc118716840ea443e010cb3d5f2d25eaf upstream.
+
+Commit id 2bd16e3e23d9df41592c6b257c59b6860a9cc3ea
+(spi: omap2-mcspi: Do not configure the controller
+on each transfer unless needed) does its job too
+well so omap2_mcspi_setup_transfer() isn't called
+even when an SPI slave driver changes 'spi->mode'.
+The result is that the mode requested by the SPI
+slave driver never takes effect.
+
+Fix this by adding the 'mode' member to the
+omap2_mcspi_cs structure which holds the mode
+value that the hardware is configured for.
+When the SPI slave driver changes 'spi->mode'
+it will be different than the value of this new
+member and the SPI master driver will know that
+the hardware must be reconfigured (by calling
+omap2_mcspi_setup_transfer()).
+
+Fixes: 2bd16e3e23 (spi: omap2-mcspi: Do not configure the controller on each transfer unless needed)
+Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/spi/spi-omap2-mcspi.c | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+--- a/drivers/spi/spi-omap2-mcspi.c
++++ b/drivers/spi/spi-omap2-mcspi.c
+@@ -149,6 +149,7 @@ struct omap2_mcspi_cs {
+ void __iomem *base;
+ unsigned long phys;
+ int word_len;
++ u16 mode;
+ struct list_head node;
+ /* Context save and restore shadow register */
+ u32 chconf0, chctrl0;
+@@ -926,6 +927,8 @@ static int omap2_mcspi_setup_transfer(st
+
+ mcspi_write_chconf0(spi, l);
+
++ cs->mode = spi->mode;
++
+ dev_dbg(&spi->dev, "setup: speed %d, sample %s edge, clk %s\n",
+ speed_hz,
+ (spi->mode & SPI_CPHA) ? "trailing" : "leading",
+@@ -998,6 +1001,7 @@ static int omap2_mcspi_setup(struct spi_
+ return -ENOMEM;
+ cs->base = mcspi->base + spi->chip_select * 0x14;
+ cs->phys = mcspi->phys + spi->chip_select * 0x14;
++ cs->mode = 0;
+ cs->chconf0 = 0;
+ cs->chctrl0 = 0;
+ spi->controller_state = cs;
+@@ -1079,6 +1083,16 @@ static void omap2_mcspi_work(struct omap
+ cs = spi->controller_state;
+ cd = spi->controller_data;
+
++ /*
++ * The slave driver could have changed spi->mode in which case
++ * it will be different from cs->mode (the current hardware setup).
++ * If so, set par_override (even though its not a parity issue) so
++ * omap2_mcspi_setup_transfer will be called to configure the hardware
++ * with the correct mode on the first iteration of the loop below.
++ */
++ if (spi->mode != cs->mode)
++ par_override = 1;
++
+ omap2_mcspi_set_enable(spi, 0);
+ list_for_each_entry(t, &m->transfers, transfer_list) {
+ if (t->tx_buf == NULL && t->rx_buf == NULL && t->len) {
--- /dev/null
+From e06871cd2c92e5c65d7ca1d32866b4ca5dd4ac30 Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Date: Sun, 27 Jul 2014 23:53:19 +0200
+Subject: spi: orion: fix incorrect handling of cell-index DT property
+
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+
+commit e06871cd2c92e5c65d7ca1d32866b4ca5dd4ac30 upstream.
+
+In commit f814f9ac5a81 ("spi/orion: add device tree binding"), Device
+Tree support was added to the spi-orion driver. However, this commit
+reads the "cell-index" property, without taking into account the fact
+that DT properties are big-endian encoded.
+
+Since most of the platforms using spi-orion with DT have apparently
+not used anything but cell-index = <0>, the problem was not
+visible. But as soon as one starts using cell-index = <1>, the problem
+becomes clearly visible, as the master->bus_num gets a wrong value
+(actually it gets the value 0, which conflicts with the first bus that
+has cell-index = <0>).
+
+This commit fixes that by using of_property_read_u32() to read the
+property value, which does the appropriate endianness conversion when
+needed.
+
+Fixes: f814f9ac5a81 ("spi/orion: add device tree binding")
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+Acked-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/spi/spi-orion.c | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+--- a/drivers/spi/spi-orion.c
++++ b/drivers/spi/spi-orion.c
+@@ -346,8 +346,6 @@ static int orion_spi_probe(struct platfo
+ struct resource *r;
+ unsigned long tclk_hz;
+ int status = 0;
+- const u32 *iprop;
+- int size;
+
+ master = spi_alloc_master(&pdev->dev, sizeof(*spi));
+ if (master == NULL) {
+@@ -358,10 +356,10 @@ static int orion_spi_probe(struct platfo
+ if (pdev->id != -1)
+ master->bus_num = pdev->id;
+ if (pdev->dev.of_node) {
+- iprop = of_get_property(pdev->dev.of_node, "cell-index",
+- &size);
+- if (iprop && size == sizeof(*iprop))
+- master->bus_num = *iprop;
++ u32 cell_index;
++ if (!of_property_read_u32(pdev->dev.of_node, "cell-index",
++ &cell_index))
++ master->bus_num = cell_index;
+ }
+
+ /* we support only mode 0, and no options */