From 316db2aebbaca9996bbb22aa8ebc7cc60230de45 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sat, 8 Feb 2014 15:06:43 -0800 Subject: [PATCH] 3.12-stable patches added patches: ib-qib-fix-qp-check-when-looping-back-to-from-qp1.patch mtd-mxc_nand-remove-duplicated-ecc_stats-counting.patch ore-fix-wrong-math-in-allocation-of-per-device-bio.patch spi-bcm63xx-don-t-substract-prepend-length-from-total-length.patch spidev-fix-hang-when-transfer_one_message-fails.patch spi-pxa2xx-initialize-dma-channels-to-1-to-prevent-inadvertent-match.patch xtensa-xtfpga-fix-definitions-of-platform-devices.patch --- ...-check-when-looping-back-to-from-qp1.patch | 46 ++++++ ...remove-duplicated-ecc_stats-counting.patch | 30 ++++ ...math-in-allocation-of-per-device-bio.patch | 132 ++++++++++++++++++ queue-3.12/series | 7 + ...act-prepend-length-from-total-length.patch | 33 +++++ ...ls-to-1-to-prevent-inadvertent-match.patch | 38 +++++ ...hang-when-transfer_one_message-fails.patch | 43 ++++++ ...-fix-definitions-of-platform-devices.patch | 73 ++++++++++ 8 files changed, 402 insertions(+) create mode 100644 queue-3.12/ib-qib-fix-qp-check-when-looping-back-to-from-qp1.patch create mode 100644 queue-3.12/mtd-mxc_nand-remove-duplicated-ecc_stats-counting.patch create mode 100644 queue-3.12/ore-fix-wrong-math-in-allocation-of-per-device-bio.patch create mode 100644 queue-3.12/spi-bcm63xx-don-t-substract-prepend-length-from-total-length.patch create mode 100644 queue-3.12/spi-pxa2xx-initialize-dma-channels-to-1-to-prevent-inadvertent-match.patch create mode 100644 queue-3.12/spidev-fix-hang-when-transfer_one_message-fails.patch create mode 100644 queue-3.12/xtensa-xtfpga-fix-definitions-of-platform-devices.patch diff --git a/queue-3.12/ib-qib-fix-qp-check-when-looping-back-to-from-qp1.patch b/queue-3.12/ib-qib-fix-qp-check-when-looping-back-to-from-qp1.patch new file mode 100644 index 00000000000..3d1686e1eed --- /dev/null +++ b/queue-3.12/ib-qib-fix-qp-check-when-looping-back-to-from-qp1.patch @@ -0,0 +1,46 @@ +From 6e0ea9e6cbcead7fa8c76e3e3b9de4a50c5131c5 Mon Sep 17 00:00:00 2001 +From: Ira Weiny +Date: Wed, 18 Dec 2013 08:41:37 -0800 +Subject: IB/qib: Fix QP check when looping back to/from QP1 + +From: Ira Weiny + +commit 6e0ea9e6cbcead7fa8c76e3e3b9de4a50c5131c5 upstream. + +The GSI QP type is compatible with and should be allowed to send data +to/from any UD QP. This was found when testing ibacm on the same node +as an SA. + +Reviewed-by: Mike Marciniszyn +Signed-off-by: Ira Weiny +Signed-off-by: Roland Dreier +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/infiniband/hw/qib/qib_ud.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +--- a/drivers/infiniband/hw/qib/qib_ud.c ++++ b/drivers/infiniband/hw/qib/qib_ud.c +@@ -57,13 +57,20 @@ static void qib_ud_loopback(struct qib_q + struct qib_sge *sge; + struct ib_wc wc; + u32 length; ++ enum ib_qp_type sqptype, dqptype; + + qp = qib_lookup_qpn(ibp, swqe->wr.wr.ud.remote_qpn); + if (!qp) { + ibp->n_pkt_drops++; + return; + } +- if (qp->ibqp.qp_type != sqp->ibqp.qp_type || ++ ++ sqptype = sqp->ibqp.qp_type == IB_QPT_GSI ? ++ IB_QPT_UD : sqp->ibqp.qp_type; ++ dqptype = qp->ibqp.qp_type == IB_QPT_GSI ? ++ IB_QPT_UD : qp->ibqp.qp_type; ++ ++ if (dqptype != sqptype || + !(ib_qib_state_ops[qp->state] & QIB_PROCESS_RECV_OK)) { + ibp->n_pkt_drops++; + goto drop; diff --git a/queue-3.12/mtd-mxc_nand-remove-duplicated-ecc_stats-counting.patch b/queue-3.12/mtd-mxc_nand-remove-duplicated-ecc_stats-counting.patch new file mode 100644 index 00000000000..a987d33f203 --- /dev/null +++ b/queue-3.12/mtd-mxc_nand-remove-duplicated-ecc_stats-counting.patch @@ -0,0 +1,30 @@ +From 0566477762f9e174e97af347ee9c865f908a5647 Mon Sep 17 00:00:00 2001 +From: Michael Grzeschik +Date: Fri, 29 Nov 2013 14:14:29 +0100 +Subject: mtd: mxc_nand: remove duplicated ecc_stats counting + +From: Michael Grzeschik + +commit 0566477762f9e174e97af347ee9c865f908a5647 upstream. + +The ecc_stats.corrected count variable will already be incremented in +the above framework-layer just after this callback. + +Signed-off-by: Michael Grzeschik +Signed-off-by: Brian Norris +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/mtd/nand/mxc_nand.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/mtd/nand/mxc_nand.c ++++ b/drivers/mtd/nand/mxc_nand.c +@@ -676,7 +676,6 @@ static int mxc_nand_correct_data_v2_v3(s + ecc_stat >>= 4; + } while (--no_subpages); + +- mtd->ecc_stats.corrected += ret; + pr_debug("%d Symbol Correctable RS-ECC Error\n", ret); + + return ret; diff --git a/queue-3.12/ore-fix-wrong-math-in-allocation-of-per-device-bio.patch b/queue-3.12/ore-fix-wrong-math-in-allocation-of-per-device-bio.patch new file mode 100644 index 00000000000..005616acaf0 --- /dev/null +++ b/queue-3.12/ore-fix-wrong-math-in-allocation-of-per-device-bio.patch @@ -0,0 +1,132 @@ +From aad560b7f63b495f48a7232fd086c5913a676e6f Mon Sep 17 00:00:00 2001 +From: Boaz Harrosh +Date: Thu, 21 Nov 2013 17:58:08 +0200 +Subject: ore: Fix wrong math in allocation of per device BIO + +From: Boaz Harrosh + +commit aad560b7f63b495f48a7232fd086c5913a676e6f upstream. + +At IO preparation we calculate the max pages at each device and +allocate a BIO per device of that size. The calculation was wrong +on some unaligned corner cases offset/length combination and would +make prepare return with -ENOMEM. This would be bad for pnfs-objects +that would in that case IO through MDS. And fatal for exofs were it +would fail writes with EIO. + +Fix it by doing the proper math, that will work in all cases. (I +ran a test with all possible offset/length combinations this time +round). + +Also when reading we do not need to allocate for the parity units +since we jump over them. + +Also lower the max_io_length to take into account the parity pages +so not to allocate BIOs bigger than PAGE_SIZE + +Signed-off-by: Boaz Harrosh +Signed-off-by: Greg Kroah-Hartman + +--- + fs/exofs/ore.c | 37 +++++++++++++++++++++++++------------ + include/scsi/osd_ore.h | 1 + + 2 files changed, 26 insertions(+), 12 deletions(-) + +--- a/fs/exofs/ore.c ++++ b/fs/exofs/ore.c +@@ -103,7 +103,7 @@ int ore_verify_layout(unsigned total_com + + layout->max_io_length = + (BIO_MAX_PAGES_KMALLOC * PAGE_SIZE - layout->stripe_unit) * +- layout->group_width; ++ (layout->group_width - layout->parity); + if (layout->parity) { + unsigned stripe_length = + (layout->group_width - layout->parity) * +@@ -286,7 +286,8 @@ int ore_get_rw_state(struct ore_layout + if (length) { + ore_calc_stripe_info(layout, offset, length, &ios->si); + ios->length = ios->si.length; +- ios->nr_pages = (ios->length + PAGE_SIZE - 1) / PAGE_SIZE; ++ ios->nr_pages = ((ios->offset & (PAGE_SIZE - 1)) + ++ ios->length + PAGE_SIZE - 1) / PAGE_SIZE; + if (layout->parity) + _ore_post_alloc_raid_stuff(ios); + } +@@ -536,6 +537,7 @@ void ore_calc_stripe_info(struct ore_lay + u64 H = LmodS - G * T; + + u32 N = div_u64(H, U); ++ u32 Nlast; + + /* "H - (N * U)" is just "H % U" so it's bound to u32 */ + u32 C = (u32)(H - (N * U)) / stripe_unit + G * group_width; +@@ -568,6 +570,10 @@ void ore_calc_stripe_info(struct ore_lay + si->length = T - H; + if (si->length > length) + si->length = length; ++ ++ Nlast = div_u64(H + si->length + U - 1, U); ++ si->maxdevUnits = Nlast - N; ++ + si->M = M; + } + EXPORT_SYMBOL(ore_calc_stripe_info); +@@ -583,13 +589,16 @@ int _ore_add_stripe_unit(struct ore_io_s + int ret; + + if (per_dev->bio == NULL) { +- unsigned pages_in_stripe = ios->layout->group_width * +- (ios->layout->stripe_unit / PAGE_SIZE); +- unsigned nr_pages = ios->nr_pages * ios->layout->group_width / +- (ios->layout->group_width - +- ios->layout->parity); +- unsigned bio_size = (nr_pages + pages_in_stripe) / +- ios->layout->group_width; ++ unsigned bio_size; ++ ++ if (!ios->reading) { ++ bio_size = ios->si.maxdevUnits; ++ } else { ++ bio_size = (ios->si.maxdevUnits + 1) * ++ (ios->layout->group_width - ios->layout->parity) / ++ ios->layout->group_width; ++ } ++ bio_size *= (ios->layout->stripe_unit / PAGE_SIZE); + + per_dev->bio = bio_kmalloc(GFP_KERNEL, bio_size); + if (unlikely(!per_dev->bio)) { +@@ -609,8 +618,12 @@ int _ore_add_stripe_unit(struct ore_io_s + added_len = bio_add_pc_page(q, per_dev->bio, pages[pg], + pglen, pgbase); + if (unlikely(pglen != added_len)) { +- ORE_DBGMSG("Failed bio_add_pc_page bi_vcnt=%u\n", +- per_dev->bio->bi_vcnt); ++ /* If bi_vcnt == bi_max then this is a SW BUG */ ++ ORE_DBGMSG("Failed bio_add_pc_page bi_vcnt=0x%x " ++ "bi_max=0x%x BIO_MAX=0x%x cur_len=0x%x\n", ++ per_dev->bio->bi_vcnt, ++ per_dev->bio->bi_max_vecs, ++ BIO_MAX_PAGES_KMALLOC, cur_len); + ret = -ENOMEM; + goto out; + } +@@ -1098,7 +1111,7 @@ int ore_truncate(struct ore_layout *layo + size_attr->attr = g_attr_logical_length; + size_attr->attr.val_ptr = &size_attr->newsize; + +- ORE_DBGMSG("trunc(0x%llx) obj_offset=0x%llx dev=%d\n", ++ ORE_DBGMSG2("trunc(0x%llx) obj_offset=0x%llx dev=%d\n", + _LLU(oc->comps->obj.id), _LLU(obj_size), i); + ret = _truncate_mirrors(ios, i * ios->layout->mirrors_p1, + &size_attr->attr); +--- a/include/scsi/osd_ore.h ++++ b/include/scsi/osd_ore.h +@@ -102,6 +102,7 @@ struct ore_striping_info { + unsigned unit_off; + unsigned cur_pg; + unsigned cur_comp; ++ unsigned maxdevUnits; + }; + + struct ore_io_state; diff --git a/queue-3.12/series b/queue-3.12/series index 12129aa0525..f0b1506afb2 100644 --- a/queue-3.12/series +++ b/queue-3.12/series @@ -31,3 +31,10 @@ compat-fix-sys_fanotify_mark.patch fs-compat-fix-parameter-handling-for-compat-readv-writev-syscalls.patch fs-compat-fix-lookup_dcookie-parameter-handling.patch tile-remove-compat_sys_lookup_dcookie-declaration-to-fix-compile-error.patch +mtd-mxc_nand-remove-duplicated-ecc_stats-counting.patch +ore-fix-wrong-math-in-allocation-of-per-device-bio.patch +xtensa-xtfpga-fix-definitions-of-platform-devices.patch +ib-qib-fix-qp-check-when-looping-back-to-from-qp1.patch +spi-bcm63xx-don-t-substract-prepend-length-from-total-length.patch +spidev-fix-hang-when-transfer_one_message-fails.patch +spi-pxa2xx-initialize-dma-channels-to-1-to-prevent-inadvertent-match.patch diff --git a/queue-3.12/spi-bcm63xx-don-t-substract-prepend-length-from-total-length.patch b/queue-3.12/spi-bcm63xx-don-t-substract-prepend-length-from-total-length.patch new file mode 100644 index 00000000000..c2d5f158e9c --- /dev/null +++ b/queue-3.12/spi-bcm63xx-don-t-substract-prepend-length-from-total-length.patch @@ -0,0 +1,33 @@ +From 86b3bde003e6bf60ccb9c09b4115b8a2f533974c Mon Sep 17 00:00:00 2001 +From: Jonas Gorski +Date: Tue, 17 Dec 2013 21:42:07 +0100 +Subject: spi/bcm63xx: don't substract prepend length from total length + +From: Jonas Gorski + +commit 86b3bde003e6bf60ccb9c09b4115b8a2f533974c upstream. + +The spi command must include the full message length including any +prepended writes, else transfers larger than 256 bytes will be +incomplete. + +Signed-off-by: Jonas Gorski +Acked-by: Florian Fainelli +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/spi/spi-bcm63xx.c | 2 -- + 1 file changed, 2 deletions(-) + +--- a/drivers/spi/spi-bcm63xx.c ++++ b/drivers/spi/spi-bcm63xx.c +@@ -169,8 +169,6 @@ static int bcm63xx_txrx_bufs(struct spi_ + transfer_list); + } + +- len -= prepend_len; +- + init_completion(&bs->done); + + /* Fill in the Message control register */ diff --git a/queue-3.12/spi-pxa2xx-initialize-dma-channels-to-1-to-prevent-inadvertent-match.patch b/queue-3.12/spi-pxa2xx-initialize-dma-channels-to-1-to-prevent-inadvertent-match.patch new file mode 100644 index 00000000000..5ad77f30387 --- /dev/null +++ b/queue-3.12/spi-pxa2xx-initialize-dma-channels-to-1-to-prevent-inadvertent-match.patch @@ -0,0 +1,38 @@ +From 483c319188c74e82b29a0ed7a7fa7065570f2193 Mon Sep 17 00:00:00 2001 +From: Mika Westerberg +Date: Mon, 13 Jan 2014 11:17:04 +0200 +Subject: spi/pxa2xx: initialize DMA channels to -1 to prevent inadvertent match + +From: Mika Westerberg + +commit 483c319188c74e82b29a0ed7a7fa7065570f2193 upstream. + +Commit cddb339badb0 (spi/pxa2xx: convert to dma_request_slave_channel_compat()) +converted the driver to use ACPI provided DMA helpers but it forgot to +initialize the platform data for the channels to -1. Failing to do so will +result inadvertent match in the filter function because 0 is a valid +channel number. + +Prevent this from happening by initializing both platform data channels +correctly to -1. + +Fixes: cddb339badb0 (spi/pxa2xx: convert to dma_request_slave_channel_compat()) +Signed-off-by: Mika Westerberg +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/spi/spi-pxa2xx.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/spi/spi-pxa2xx.c ++++ b/drivers/spi/spi-pxa2xx.c +@@ -1070,6 +1070,8 @@ pxa2xx_spi_acpi_get_pdata(struct platfor + + pdata->num_chipselect = 1; + pdata->enable_dma = true; ++ pdata->tx_chan_id = -1; ++ pdata->rx_chan_id = -1; + + return pdata; + } diff --git a/queue-3.12/spidev-fix-hang-when-transfer_one_message-fails.patch b/queue-3.12/spidev-fix-hang-when-transfer_one_message-fails.patch new file mode 100644 index 00000000000..a4c79e2215f --- /dev/null +++ b/queue-3.12/spidev-fix-hang-when-transfer_one_message-fails.patch @@ -0,0 +1,43 @@ +From e120cc0dcf2880a4c5c0a6cb27b655600a1cfa1d Mon Sep 17 00:00:00 2001 +From: Daniel Santos +Date: Sun, 5 Jan 2014 17:39:26 -0600 +Subject: spidev: fix hang when transfer_one_message fails + +From: Daniel Santos + +commit e120cc0dcf2880a4c5c0a6cb27b655600a1cfa1d upstream. + +This corrects a problem in spi_pump_messages() that leads to an spi +message hanging forever when a call to transfer_one_message() fails. +This failure occurs in my MCP2210 driver when the cs_change bit is set +on the last transfer in a message, an operation which the hardware does +not support. + +Rationale +Since the transfer_one_message() returns an int, we must presume that it +may fail. If transfer_one_message() should never fail, it should return +void. Thus, calls to transfer_one_message() should properly manage a +failure. + +Fixes: ffbbdd21329f3 (spi: create a message queueing infrastructure) +Signed-off-by: Daniel Santos +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/spi/spi.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/spi/spi.c ++++ b/drivers/spi/spi.c +@@ -600,7 +600,9 @@ static void spi_pump_messages(struct kth + ret = master->transfer_one_message(master, master->cur_msg); + if (ret) { + dev_err(&master->dev, +- "failed to transfer one message from queue\n"); ++ "failed to transfer one message from queue: %d\n", ret); ++ master->cur_msg->status = ret; ++ spi_finalize_current_message(master); + return; + } + } diff --git a/queue-3.12/xtensa-xtfpga-fix-definitions-of-platform-devices.patch b/queue-3.12/xtensa-xtfpga-fix-definitions-of-platform-devices.patch new file mode 100644 index 00000000000..4b57c295b68 --- /dev/null +++ b/queue-3.12/xtensa-xtfpga-fix-definitions-of-platform-devices.patch @@ -0,0 +1,73 @@ +From a558d99263936b8a67d4eff8918745a77bfd8c31 Mon Sep 17 00:00:00 2001 +From: Max Filippov +Date: Wed, 25 Dec 2013 05:20:36 +0400 +Subject: xtensa: xtfpga: fix definitions of platform devices + +From: Max Filippov + +commit a558d99263936b8a67d4eff8918745a77bfd8c31 upstream. + +Remove __initdata attribute, as the devices may be used after init +sections are freed. + +Signed-off-by: Max Filippov +Signed-off-by: Greg Kroah-Hartman + +--- + arch/xtensa/platforms/xtfpga/setup.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +--- a/arch/xtensa/platforms/xtfpga/setup.c ++++ b/arch/xtensa/platforms/xtfpga/setup.c +@@ -194,7 +194,7 @@ void __init platform_calibrate_ccount(vo + * Ethernet -- OpenCores Ethernet MAC (ethoc driver) + */ + +-static struct resource ethoc_res[] __initdata = { ++static struct resource ethoc_res[] = { + [0] = { /* register space */ + .start = OETH_REGS_PADDR, + .end = OETH_REGS_PADDR + OETH_REGS_SIZE - 1, +@@ -212,7 +212,7 @@ static struct resource ethoc_res[] __ini + }, + }; + +-static struct ethoc_platform_data ethoc_pdata __initdata = { ++static struct ethoc_platform_data ethoc_pdata = { + /* + * The MAC address for these boards is 00:50:c2:13:6f:xx. + * The last byte (here as zero) is read from the DIP switches on the +@@ -222,7 +222,7 @@ static struct ethoc_platform_data ethoc_ + .phy_id = -1, + }; + +-static struct platform_device ethoc_device __initdata = { ++static struct platform_device ethoc_device = { + .name = "ethoc", + .id = -1, + .num_resources = ARRAY_SIZE(ethoc_res), +@@ -236,13 +236,13 @@ static struct platform_device ethoc_devi + * UART + */ + +-static struct resource serial_resource __initdata = { ++static struct resource serial_resource = { + .start = DUART16552_PADDR, + .end = DUART16552_PADDR + 0x1f, + .flags = IORESOURCE_MEM, + }; + +-static struct plat_serial8250_port serial_platform_data[] __initdata = { ++static struct plat_serial8250_port serial_platform_data[] = { + [0] = { + .mapbase = DUART16552_PADDR, + .irq = DUART16552_INTNUM, +@@ -255,7 +255,7 @@ static struct plat_serial8250_port seria + { }, + }; + +-static struct platform_device xtavnet_uart __initdata = { ++static struct platform_device xtavnet_uart = { + .name = "serial8250", + .id = PLAT8250_DEV_PLATFORM, + .dev = { -- 2.47.2