]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 6 Apr 2017 07:45:09 +0000 (09:45 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 6 Apr 2017 07:45:09 +0000 (09:45 +0200)
added patches:
arm-dts-bcm5301x-correct-gic_ppi-interrupt-flags.patch
blk-ensure-users-for-current-bio_list-can-see-the-full-list.patch
blk-improve-order-of-bio-handling-in-generic_make_request.patch
mips-lantiq-fix-cascaded-irq-setup.patch

queue-4.10/arm-dts-bcm5301x-correct-gic_ppi-interrupt-flags.patch [new file with mode: 0644]
queue-4.10/blk-ensure-users-for-current-bio_list-can-see-the-full-list.patch [new file with mode: 0644]
queue-4.10/blk-improve-order-of-bio-handling-in-generic_make_request.patch [new file with mode: 0644]
queue-4.10/mips-lantiq-fix-cascaded-irq-setup.patch [new file with mode: 0644]
queue-4.10/pci-thunder-pem-add-legacy-firmware-support-for-cavium-thunderx-host-controller.patch [deleted file]
queue-4.10/series

diff --git a/queue-4.10/arm-dts-bcm5301x-correct-gic_ppi-interrupt-flags.patch b/queue-4.10/arm-dts-bcm5301x-correct-gic_ppi-interrupt-flags.patch
new file mode 100644 (file)
index 0000000..8d53886
--- /dev/null
@@ -0,0 +1,48 @@
+From 0c2bf9f95983fe30aa2f6463cb761cd42c2d521a Mon Sep 17 00:00:00 2001
+From: Jon Mason <jon.mason@broadcom.com>
+Date: Thu, 2 Mar 2017 19:21:32 -0500
+Subject: ARM: dts: BCM5301X: Correct GIC_PPI interrupt flags
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Jon Mason <jon.mason@broadcom.com>
+
+commit 0c2bf9f95983fe30aa2f6463cb761cd42c2d521a upstream.
+
+GIC_PPI flags were misconfigured for the timers, resulting in errors
+like:
+[    0.000000] GIC: PPI11 is secure or misconfigured
+
+Changing them to being edge triggered corrects the issue
+
+Suggested-by: Rafał Miłecki <rafal@milecki.pl>
+Signed-off-by: Jon Mason <jon.mason@broadcom.com>
+Fixes: d27509f1 ("ARM: BCM5301X: add dts files for BCM4708 SoC")
+Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
+Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/boot/dts/bcm5301x.dtsi |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/arch/arm/boot/dts/bcm5301x.dtsi
++++ b/arch/arm/boot/dts/bcm5301x.dtsi
+@@ -66,14 +66,14 @@
+               timer@20200 {
+                       compatible = "arm,cortex-a9-global-timer";
+                       reg = <0x20200 0x100>;
+-                      interrupts = <GIC_PPI 11 IRQ_TYPE_LEVEL_HIGH>;
++                      interrupts = <GIC_PPI 11 IRQ_TYPE_EDGE_RISING>;
+                       clocks = <&periph_clk>;
+               };
+               local-timer@20600 {
+                       compatible = "arm,cortex-a9-twd-timer";
+                       reg = <0x20600 0x100>;
+-                      interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_HIGH>;
++                      interrupts = <GIC_PPI 13 IRQ_TYPE_EDGE_RISING>;
+                       clocks = <&periph_clk>;
+               };
diff --git a/queue-4.10/blk-ensure-users-for-current-bio_list-can-see-the-full-list.patch b/queue-4.10/blk-ensure-users-for-current-bio_list-can-see-the-full-list.patch
new file mode 100644 (file)
index 0000000..1f391f1
--- /dev/null
@@ -0,0 +1,197 @@
+From f5fe1b51905df7cfe4fdfd85c5fb7bc5b71a094f Mon Sep 17 00:00:00 2001
+From: NeilBrown <neilb@suse.com>
+Date: Fri, 10 Mar 2017 17:00:47 +1100
+Subject: blk: Ensure users for current->bio_list can see the full list.
+
+From: NeilBrown <neilb@suse.com>
+
+commit f5fe1b51905df7cfe4fdfd85c5fb7bc5b71a094f upstream.
+
+Commit 79bd99596b73 ("blk: improve order of bio handling in generic_make_request()")
+changed current->bio_list so that it did not contain *all* of the
+queued bios, but only those submitted by the currently running
+make_request_fn.
+
+There are two places which walk the list and requeue selected bios,
+and others that check if the list is empty.  These are no longer
+correct.
+
+So redefine current->bio_list to point to an array of two lists, which
+contain all queued bios, and adjust various code to test or walk both
+lists.
+
+Signed-off-by: NeilBrown <neilb@suse.com>
+Fixes: 79bd99596b73 ("blk: improve order of bio handling in generic_make_request()")
+Signed-off-by: Jens Axboe <axboe@fb.com>
+Cc: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ block/bio.c         |   12 +++++++++---
+ block/blk-core.c    |   30 ++++++++++++++++++------------
+ drivers/md/dm.c     |   29 ++++++++++++++++-------------
+ drivers/md/raid10.c |    3 ++-
+ 4 files changed, 45 insertions(+), 29 deletions(-)
+
+--- a/block/bio.c
++++ b/block/bio.c
+@@ -376,10 +376,14 @@ static void punt_bios_to_rescuer(struct
+       bio_list_init(&punt);
+       bio_list_init(&nopunt);
+-      while ((bio = bio_list_pop(current->bio_list)))
++      while ((bio = bio_list_pop(&current->bio_list[0])))
+               bio_list_add(bio->bi_pool == bs ? &punt : &nopunt, bio);
++      current->bio_list[0] = nopunt;
+-      *current->bio_list = nopunt;
++      bio_list_init(&nopunt);
++      while ((bio = bio_list_pop(&current->bio_list[1])))
++              bio_list_add(bio->bi_pool == bs ? &punt : &nopunt, bio);
++      current->bio_list[1] = nopunt;
+       spin_lock(&bs->rescue_lock);
+       bio_list_merge(&bs->rescue_list, &punt);
+@@ -466,7 +470,9 @@ struct bio *bio_alloc_bioset(gfp_t gfp_m
+                * we retry with the original gfp_flags.
+                */
+-              if (current->bio_list && !bio_list_empty(current->bio_list))
++              if (current->bio_list &&
++                  (!bio_list_empty(&current->bio_list[0]) ||
++                   !bio_list_empty(&current->bio_list[1])))
+                       gfp_mask &= ~__GFP_DIRECT_RECLAIM;
+               p = mempool_alloc(bs->bio_pool, gfp_mask);
+--- a/block/blk-core.c
++++ b/block/blk-core.c
+@@ -1977,7 +1977,14 @@ end_io:
+  */
+ blk_qc_t generic_make_request(struct bio *bio)
+ {
+-      struct bio_list bio_list_on_stack;
++      /*
++       * bio_list_on_stack[0] contains bios submitted by the current
++       * make_request_fn.
++       * bio_list_on_stack[1] contains bios that were submitted before
++       * the current make_request_fn, but that haven't been processed
++       * yet.
++       */
++      struct bio_list bio_list_on_stack[2];
+       blk_qc_t ret = BLK_QC_T_NONE;
+       if (!generic_make_request_checks(bio))
+@@ -1994,7 +2001,7 @@ blk_qc_t generic_make_request(struct bio
+        * should be added at the tail
+        */
+       if (current->bio_list) {
+-              bio_list_add(current->bio_list, bio);
++              bio_list_add(&current->bio_list[0], bio);
+               goto out;
+       }
+@@ -2013,18 +2020,17 @@ blk_qc_t generic_make_request(struct bio
+        * bio_list, and call into ->make_request() again.
+        */
+       BUG_ON(bio->bi_next);
+-      bio_list_init(&bio_list_on_stack);
+-      current->bio_list = &bio_list_on_stack;
++      bio_list_init(&bio_list_on_stack[0]);
++      current->bio_list = bio_list_on_stack;
+       do {
+               struct request_queue *q = bdev_get_queue(bio->bi_bdev);
+               if (likely(blk_queue_enter(q, false) == 0)) {
+-                      struct bio_list hold;
+                       struct bio_list lower, same;
+                       /* Create a fresh bio_list for all subordinate requests */
+-                      hold = bio_list_on_stack;
+-                      bio_list_init(&bio_list_on_stack);
++                      bio_list_on_stack[1] = bio_list_on_stack[0];
++                      bio_list_init(&bio_list_on_stack[0]);
+                       ret = q->make_request_fn(q, bio);
+                       blk_queue_exit(q);
+@@ -2034,19 +2040,19 @@ blk_qc_t generic_make_request(struct bio
+                        */
+                       bio_list_init(&lower);
+                       bio_list_init(&same);
+-                      while ((bio = bio_list_pop(&bio_list_on_stack)) != NULL)
++                      while ((bio = bio_list_pop(&bio_list_on_stack[0])) != NULL)
+                               if (q == bdev_get_queue(bio->bi_bdev))
+                                       bio_list_add(&same, bio);
+                               else
+                                       bio_list_add(&lower, bio);
+                       /* now assemble so we handle the lowest level first */
+-                      bio_list_merge(&bio_list_on_stack, &lower);
+-                      bio_list_merge(&bio_list_on_stack, &same);
+-                      bio_list_merge(&bio_list_on_stack, &hold);
++                      bio_list_merge(&bio_list_on_stack[0], &lower);
++                      bio_list_merge(&bio_list_on_stack[0], &same);
++                      bio_list_merge(&bio_list_on_stack[0], &bio_list_on_stack[1]);
+               } else {
+                       bio_io_error(bio);
+               }
+-              bio = bio_list_pop(current->bio_list);
++              bio = bio_list_pop(&bio_list_on_stack[0]);
+       } while (bio);
+       current->bio_list = NULL; /* deactivate */
+--- a/drivers/md/dm.c
++++ b/drivers/md/dm.c
+@@ -986,26 +986,29 @@ static void flush_current_bio_list(struc
+       struct dm_offload *o = container_of(cb, struct dm_offload, cb);
+       struct bio_list list;
+       struct bio *bio;
++      int i;
+       INIT_LIST_HEAD(&o->cb.list);
+       if (unlikely(!current->bio_list))
+               return;
+-      list = *current->bio_list;
+-      bio_list_init(current->bio_list);
+-
+-      while ((bio = bio_list_pop(&list))) {
+-              struct bio_set *bs = bio->bi_pool;
+-              if (unlikely(!bs) || bs == fs_bio_set) {
+-                      bio_list_add(current->bio_list, bio);
+-                      continue;
++      for (i = 0; i < 2; i++) {
++              list = current->bio_list[i];
++              bio_list_init(&current->bio_list[i]);
++
++              while ((bio = bio_list_pop(&list))) {
++                      struct bio_set *bs = bio->bi_pool;
++                      if (unlikely(!bs) || bs == fs_bio_set) {
++                              bio_list_add(&current->bio_list[i], bio);
++                              continue;
++                      }
++
++                      spin_lock(&bs->rescue_lock);
++                      bio_list_add(&bs->rescue_list, bio);
++                      queue_work(bs->rescue_workqueue, &bs->rescue_work);
++                      spin_unlock(&bs->rescue_lock);
+               }
+-
+-              spin_lock(&bs->rescue_lock);
+-              bio_list_add(&bs->rescue_list, bio);
+-              queue_work(bs->rescue_workqueue, &bs->rescue_work);
+-              spin_unlock(&bs->rescue_lock);
+       }
+ }
+--- a/drivers/md/raid10.c
++++ b/drivers/md/raid10.c
+@@ -974,7 +974,8 @@ static void wait_barrier(struct r10conf
+                                   !conf->barrier ||
+                                   (atomic_read(&conf->nr_pending) &&
+                                    current->bio_list &&
+-                                   !bio_list_empty(current->bio_list)),
++                                   (!bio_list_empty(&current->bio_list[0]) ||
++                                    !bio_list_empty(&current->bio_list[1]))),
+                                   conf->resync_lock);
+               conf->nr_waiting--;
+               if (!conf->nr_waiting)
diff --git a/queue-4.10/blk-improve-order-of-bio-handling-in-generic_make_request.patch b/queue-4.10/blk-improve-order-of-bio-handling-in-generic_make_request.patch
new file mode 100644 (file)
index 0000000..4ec693e
--- /dev/null
@@ -0,0 +1,117 @@
+From 79bd99596b7305ab08109a8bf44a6a4511dbf1cd Mon Sep 17 00:00:00 2001
+From: NeilBrown <neilb@suse.com>
+Date: Wed, 8 Mar 2017 07:38:05 +1100
+Subject: blk: improve order of bio handling in generic_make_request()
+
+From: NeilBrown <neilb@suse.com>
+
+commit 79bd99596b7305ab08109a8bf44a6a4511dbf1cd upstream.
+
+To avoid recursion on the kernel stack when stacked block devices
+are in use, generic_make_request() will, when called recursively,
+queue new requests for later handling.  They will be handled when the
+make_request_fn for the current bio completes.
+
+If any bios are submitted by a make_request_fn, these will ultimately
+be handled seqeuntially.  If the handling of one of those generates
+further requests, they will be added to the end of the queue.
+
+This strict first-in-first-out behaviour can lead to deadlocks in
+various ways, normally because a request might need to wait for a
+previous request to the same device to complete.  This can happen when
+they share a mempool, and can happen due to interdependencies
+particular to the device.  Both md and dm have examples where this happens.
+
+These deadlocks can be erradicated by more selective ordering of bios.
+Specifically by handling them in depth-first order.  That is: when the
+handling of one bio generates one or more further bios, they are
+handled immediately after the parent, before any siblings of the
+parent.  That way, when generic_make_request() calls make_request_fn
+for some particular device, we can be certain that all previously
+submited requests for that device have been completely handled and are
+not waiting for anything in the queue of requests maintained in
+generic_make_request().
+
+An easy way to achieve this would be to use a last-in-first-out stack
+instead of a queue.  However this will change the order of consecutive
+bios submitted by a make_request_fn, which could have unexpected consequences.
+Instead we take a slightly more complex approach.
+A fresh queue is created for each call to a make_request_fn.  After it completes,
+any bios for a different device are placed on the front of the main queue, followed
+by any bios for the same device, followed by all bios that were already on
+the queue before the make_request_fn was called.
+This provides the depth-first approach without reordering bios on the same level.
+
+This, by itself, it not enough to remove all deadlocks.  It just makes
+it possible for drivers to take the extra step required themselves.
+
+To avoid deadlocks, drivers must never risk waiting for a request
+after submitting one to generic_make_request.  This includes never
+allocing from a mempool twice in the one call to a make_request_fn.
+
+A common pattern in drivers is to call bio_split() in a loop, handling
+the first part and then looping around to possibly split the next part.
+Instead, a driver that finds it needs to split a bio should queue
+(with generic_make_request) the second part, handle the first part,
+and then return.  The new code in generic_make_request will ensure the
+requests to underlying bios are processed first, then the second bio
+that was split off.  If it splits again, the same process happens.  In
+each case one bio will be completely handled before the next one is attempted.
+
+With this is place, it should be possible to disable the
+punt_bios_to_recover() recovery thread for many block devices, and
+eventually it may be possible to remove it completely.
+
+Ref: http://www.spinics.net/lists/raid/msg54680.html
+Tested-by: Jinpu Wang <jinpu.wang@profitbricks.com>
+Inspired-by: Lars Ellenberg <lars.ellenberg@linbit.com>
+Signed-off-by: NeilBrown <neilb@suse.com>
+Signed-off-by: Jens Axboe <axboe@fb.com>
+Cc: Jack Wang <jinpu.wang@profitbricks.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ block/blk-core.c |   25 +++++++++++++++++++++----
+ 1 file changed, 21 insertions(+), 4 deletions(-)
+
+--- a/block/blk-core.c
++++ b/block/blk-core.c
+@@ -2019,17 +2019,34 @@ blk_qc_t generic_make_request(struct bio
+               struct request_queue *q = bdev_get_queue(bio->bi_bdev);
+               if (likely(blk_queue_enter(q, false) == 0)) {
++                      struct bio_list hold;
++                      struct bio_list lower, same;
++
++                      /* Create a fresh bio_list for all subordinate requests */
++                      hold = bio_list_on_stack;
++                      bio_list_init(&bio_list_on_stack);
+                       ret = q->make_request_fn(q, bio);
+                       blk_queue_exit(q);
+-                      bio = bio_list_pop(current->bio_list);
++                      /* sort new bios into those for a lower level
++                       * and those for the same level
++                       */
++                      bio_list_init(&lower);
++                      bio_list_init(&same);
++                      while ((bio = bio_list_pop(&bio_list_on_stack)) != NULL)
++                              if (q == bdev_get_queue(bio->bi_bdev))
++                                      bio_list_add(&same, bio);
++                              else
++                                      bio_list_add(&lower, bio);
++                      /* now assemble so we handle the lowest level first */
++                      bio_list_merge(&bio_list_on_stack, &lower);
++                      bio_list_merge(&bio_list_on_stack, &same);
++                      bio_list_merge(&bio_list_on_stack, &hold);
+               } else {
+-                      struct bio *bio_next = bio_list_pop(current->bio_list);
+-
+                       bio_io_error(bio);
+-                      bio = bio_next;
+               }
++              bio = bio_list_pop(current->bio_list);
+       } while (bio);
+       current->bio_list = NULL; /* deactivate */
diff --git a/queue-4.10/mips-lantiq-fix-cascaded-irq-setup.patch b/queue-4.10/mips-lantiq-fix-cascaded-irq-setup.patch
new file mode 100644 (file)
index 0000000..424efb3
--- /dev/null
@@ -0,0 +1,104 @@
+From 6c356eda225e3ee134ed4176b9ae3a76f793f4dd Mon Sep 17 00:00:00 2001
+From: Felix Fietkau <nbd@nbd.name>
+Date: Thu, 19 Jan 2017 12:28:22 +0100
+Subject: MIPS: Lantiq: Fix cascaded IRQ setup
+
+From: Felix Fietkau <nbd@nbd.name>
+
+commit 6c356eda225e3ee134ed4176b9ae3a76f793f4dd upstream.
+
+With the IRQ stack changes integrated, the XRX200 devices started
+emitting a constant stream of kernel messages like this:
+
+[  565.415310] Spurious IRQ: CAUSE=0x1100c300
+
+This is caused by IP0 getting handled by plat_irq_dispatch() rather than
+its vectored interrupt handler, which is fixed by commit de856416e714
+("MIPS: IRQ Stack: Fix erroneous jal to plat_irq_dispatch").
+
+Fix plat_irq_dispatch() to handle non-vectored IPI interrupts correctly
+by setting up IP2-6 as proper chained IRQ handlers and calling do_IRQ
+for all MIPS CPU interrupts.
+
+Signed-off-by: Felix Fietkau <nbd@nbd.name>
+Acked-by: John Crispin <john@phrozen.org>
+Cc: linux-mips@linux-mips.org
+Patchwork: https://patchwork.linux-mips.org/patch/15077/
+[james.hogan@imgtec.com: tweaked commit message]
+Signed-off-by: James Hogan <james.hogan@imgtec.com>
+Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/mips/lantiq/irq.c |   36 ++++++++++++++++--------------------
+ 1 file changed, 16 insertions(+), 20 deletions(-)
+
+--- a/arch/mips/lantiq/irq.c
++++ b/arch/mips/lantiq/irq.c
+@@ -269,6 +269,11 @@ static void ltq_hw5_irqdispatch(void)
+ DEFINE_HWx_IRQDISPATCH(5)
+ #endif
++static void ltq_hw_irq_handler(struct irq_desc *desc)
++{
++      ltq_hw_irqdispatch(irq_desc_get_irq(desc) - 2);
++}
++
+ #ifdef CONFIG_MIPS_MT_SMP
+ void __init arch_init_ipiirq(int irq, struct irqaction *action)
+ {
+@@ -313,23 +318,19 @@ static struct irqaction irq_call = {
+ asmlinkage void plat_irq_dispatch(void)
+ {
+       unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM;
+-      unsigned int i;
++      int irq;
+-      if ((MIPS_CPU_TIMER_IRQ == 7) && (pending & CAUSEF_IP7)) {
+-              do_IRQ(MIPS_CPU_TIMER_IRQ);
+-              goto out;
+-      } else {
+-              for (i = 0; i < MAX_IM; i++) {
+-                      if (pending & (CAUSEF_IP2 << i)) {
+-                              ltq_hw_irqdispatch(i);
+-                              goto out;
+-                      }
+-              }
++      if (!pending) {
++              spurious_interrupt();
++              return;
+       }
+-      pr_alert("Spurious IRQ: CAUSE=0x%08x\n", read_c0_status());
+-out:
+-      return;
++      pending >>= CAUSEB_IP;
++      while (pending) {
++              irq = fls(pending) - 1;
++              do_IRQ(MIPS_CPU_IRQ_BASE + irq);
++              pending &= ~BIT(irq);
++      }
+ }
+ static int icu_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw)
+@@ -354,11 +355,6 @@ static const struct irq_domain_ops irq_d
+       .map = icu_map,
+ };
+-static struct irqaction cascade = {
+-      .handler = no_action,
+-      .name = "cascade",
+-};
+-
+ int __init icu_of_init(struct device_node *node, struct device_node *parent)
+ {
+       struct device_node *eiu_node;
+@@ -390,7 +386,7 @@ int __init icu_of_init(struct device_nod
+       mips_cpu_irq_init();
+       for (i = 0; i < MAX_IM; i++)
+-              setup_irq(i + 2, &cascade);
++              irq_set_chained_handler(i + 2, ltq_hw_irq_handler);
+       if (cpu_has_vint) {
+               pr_info("Setting up vectored interrupts\n");
diff --git a/queue-4.10/pci-thunder-pem-add-legacy-firmware-support-for-cavium-thunderx-host-controller.patch b/queue-4.10/pci-thunder-pem-add-legacy-firmware-support-for-cavium-thunderx-host-controller.patch
deleted file mode 100644 (file)
index af73fe0..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-From 9abb27c7594a62bbf6385e20b7f5a90b4eceae2f Mon Sep 17 00:00:00 2001
-From: Tomasz Nowicki <tn@semihalf.com>
-Date: Thu, 23 Mar 2017 17:10:16 -0500
-Subject: PCI: thunder-pem: Add legacy firmware support for Cavium ThunderX host controller
-
-From: Tomasz Nowicki <tn@semihalf.com>
-
-commit 9abb27c7594a62bbf6385e20b7f5a90b4eceae2f upstream.
-
-During early days of PCI quirks support, ThunderX firmware did not provide
-PNP0c02 node with PCI configuration space and PEM-specific register ranges.
-This means that for legacy FW we are not reserving these resources and
-cannot gather PEM-specific resources for further PEM initialization.
-
-To support already deployed legacy FW, calculate PEM-specific ranges and
-provide resources reservation as fallback scenario into PEM driver when we
-could not gather PEM reg base from ACPI tables.
-
-Tested-by: Robert Richter <rrichter@cavium.com>
-Signed-off-by: Tomasz Nowicki <tn@semihalf.com>
-Signed-off-by: Vadim Lomovtsev <Vadim.Lomovtsev@caviumnetworks.com>
-Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-Acked-by: Robert Richter <rrichter@cavium.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
----
- drivers/pci/host/pci-thunder-pem.c |   56 +++++++++++++++++++++++++++++++++++--
- 1 file changed, 54 insertions(+), 2 deletions(-)
-
---- a/drivers/pci/host/pci-thunder-pem.c
-+++ b/drivers/pci/host/pci-thunder-pem.c
-@@ -14,6 +14,7 @@
-  * Copyright (C) 2015 - 2016 Cavium, Inc.
-  */
-+#include <linux/bitfield.h>
- #include <linux/kernel.h>
- #include <linux/init.h>
- #include <linux/of_address.h>
-@@ -319,6 +320,50 @@ static int thunder_pem_init(struct devic
- #if defined(CONFIG_ACPI) && defined(CONFIG_PCI_QUIRKS)
-+#define PEM_RES_BASE          0x87e0c0000000UL
-+#define PEM_NODE_MASK         GENMASK(45, 44)
-+#define PEM_INDX_MASK         GENMASK(26, 24)
-+#define PEM_MIN_DOM_IN_NODE   4
-+#define PEM_MAX_DOM_IN_NODE   10
-+
-+static void thunder_pem_reserve_range(struct device *dev, int seg,
-+                                    struct resource *r)
-+{
-+      resource_size_t start = r->start, end = r->end;
-+      struct resource *res;
-+      const char *regionid;
-+
-+      regionid = kasprintf(GFP_KERNEL, "PEM RC:%d", seg);
-+      if (!regionid)
-+              return;
-+
-+      res = request_mem_region(start, end - start + 1, regionid);
-+      if (res)
-+              res->flags &= ~IORESOURCE_BUSY;
-+      else
-+              kfree(regionid);
-+
-+      dev_info(dev, "%pR %s reserved\n", r,
-+               res ? "has been" : "could not be");
-+}
-+
-+static void thunder_pem_legacy_fw(struct acpi_pci_root *root,
-+                               struct resource *res_pem)
-+{
-+      int node = acpi_get_node(root->device->handle);
-+      int index;
-+
-+      if (node == NUMA_NO_NODE)
-+              node = 0;
-+
-+      index = root->segment - PEM_MIN_DOM_IN_NODE;
-+      index -= node * PEM_MAX_DOM_IN_NODE;
-+      res_pem->start = PEM_RES_BASE | FIELD_PREP(PEM_NODE_MASK, node) |
-+                                      FIELD_PREP(PEM_INDX_MASK, index);
-+      res_pem->end = res_pem->start + SZ_16M - 1;
-+      res_pem->flags = IORESOURCE_MEM;
-+}
-+
- static int thunder_pem_acpi_init(struct pci_config_window *cfg)
- {
-       struct device *dev = cfg->parent;
-@@ -332,9 +377,16 @@ static int thunder_pem_acpi_init(struct
-               return -ENOMEM;
-       ret = acpi_get_rc_resources(dev, "CAVA02B", root->segment, res_pem);
-+
-+      /*
-+       * If we fail to gather resources it means that we run with old
-+       * FW where we need to calculate PEM-specific resources manually.
-+       */
-       if (ret) {
--              dev_err(dev, "can't get rc base address\n");
--              return ret;
-+              thunder_pem_legacy_fw(root, res_pem);
-+              /* Reserve PEM-specific resources and PCI configuration space */
-+              thunder_pem_reserve_range(dev, root->segment, res_pem);
-+              thunder_pem_reserve_range(dev, root->segment, &cfg->res);
-       }
-       return thunder_pem_init(dev, cfg, res_pem);
index 80c812f41177da53ec1dcd72fb53a7e109c0259d..b2998180a453d6cd744672c86fd474fad5b973a4 100644 (file)
@@ -32,7 +32,6 @@ scsi-scsi_dh_alua-check-scsi_device_get-return-value.patch
 scsi-scsi_dh_alua-ensure-that-alua_activate-calls-the-completion-function.patch
 pci-iproc-save-host-bridge-window-resource-in-struct-iproc_pcie.patch
 pci-thunder-pem-use-cavium-assigned-hardware-id-for-thunderx-host-controller.patch
-pci-thunder-pem-add-legacy-firmware-support-for-cavium-thunderx-host-controller.patch
 alsa-seq-fix-race-during-fifo-resize.patch
 alsa-hda-fix-a-problem-for-lineout-on-a-dell-aio-machine.patch
 asoc-atmel-classd-fix-audio-clock-rate.patch
@@ -70,3 +69,7 @@ mm-rmap-fix-huge-file-mmap-accounting-in-the-memcg-stats.patch
 mm-workingset-fix-premature-shadow-node-shrinking-with-cgroups.patch
 mm-hugetlb-use-pte_present-instead-of-pmd_present-in-follow_huge_pmd.patch
 drm-armada-fix-compile-fail.patch
+arm-dts-bcm5301x-correct-gic_ppi-interrupt-flags.patch
+mips-lantiq-fix-cascaded-irq-setup.patch
+blk-improve-order-of-bio-handling-in-generic_make_request.patch
+blk-ensure-users-for-current-bio_list-can-see-the-full-list.patch