kernel: bump 4.19 to 4.19.93
authorHauke Mehrtens <hauke@hauke-m.de>
Sat, 4 Jan 2020 22:45:20 +0000 (23:45 +0100)
committerHauke Mehrtens <hauke@hauke-m.de>
Sat, 4 Jan 2020 23:43:36 +0000 (00:43 +0100)
Refreshed all patches.

The patch hack-4.19/550-loop-better-discard-for-block-devices.patch was
replaced with an new version of the patch from:
https://lore.kernel.org/patchwork/patch/1153625/
https://lore.kernel.org/patchwork/patch/1153626/

Compile-tested on: ipq40xx, lantiq
Runtime-tested on: ipq40xx, lantiq

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
26 files changed:
include/kernel-version.mk
target/linux/ath79/patches-4.19/910-unaligned_access_hacks.patch
target/linux/brcm2708/patches-4.19/950-0032-lan78xx-Enable-LEDs-and-auto-negotiation.patch
target/linux/brcm2708/patches-4.19/950-0120-lan78xx-Read-initial-EEE-status-from-DT.patch
target/linux/brcm2708/patches-4.19/950-0127-net-lan78xx-Disable-TCP-Segmentation-Offload-TSO.patch
target/linux/brcm2708/patches-4.19/950-0128-lan78xx-Move-enabling-of-EEE-into-PHY-init-code.patch
target/linux/brcm2708/patches-4.19/950-0261-lan78xx-Debounce-link-events-to-minimize-poll-storm.patch
target/linux/brcm2708/patches-4.19/950-0318-lan78xx-EEE-support-is-now-a-PHY-property.patch
target/linux/brcm2708/patches-4.19/950-0415-lan78xx-use-default-alignment-for-rx-buffers.patch
target/linux/brcm2708/patches-4.19/950-0429-Bluetooth-Check-key-sizes-only-when-Secure-Simple-Pa.patch
target/linux/brcm2708/patches-4.19/950-0465-mmc-sdhci-Mask-spurious-interrupts.patch
target/linux/brcm2708/patches-4.19/950-0603-media-vb2-set-reqbufs-create_bufs-capabilities.patch
target/linux/brcm2708/patches-4.19/950-0638-hid-usb-Add-device-quirks-for-Freeway-Airmouse-T3-an.patch
target/linux/brcm2708/patches-4.19/950-0777-spidev-Completely-disable-the-DT-warning.patch
target/linux/generic/hack-4.19/550-loop-Report-EOPNOTSUPP-properly.patch [new file with mode: 0644]
target/linux/generic/hack-4.19/550-loop-better-discard-for-block-devices.patch [deleted file]
target/linux/generic/hack-4.19/551-loop-Better-discard-support-for-block-devices.patch [new file with mode: 0644]
target/linux/generic/hack-4.19/721-phy_packets.patch
target/linux/generic/hack-4.19/902-debloat_proc.patch
target/linux/generic/pending-4.19/130-add-linux-spidev-compatible-si3210.patch
target/linux/generic/pending-4.19/203-kallsyms_uncompressed.patch
target/linux/generic/pending-4.19/630-packet_socket_type.patch
target/linux/generic/pending-4.19/655-increase_skb_pad.patch
target/linux/generic/pending-4.19/670-ipv6-allow-rejecting-with-source-address-failed-policy.patch
target/linux/ipq806x/patches-4.19/0063-4-ip806x-tsense-rework-driver.patch
target/linux/ipq806x/patches-4.19/080-ARM-dts-qcom-add-gpio-ranges-property.patch

index 60acf61..40b5f5c 100644 (file)
@@ -8,11 +8,11 @@ endif
 
 LINUX_VERSION-4.9 = .207
 LINUX_VERSION-4.14 = .162
-LINUX_VERSION-4.19 = .91
+LINUX_VERSION-4.19 = .93
 
 LINUX_KERNEL_HASH-4.9.207 = ca86637e7b5bec65eeb7da695824e0e8aca5ba52eb742885f0b7241977400124
 LINUX_KERNEL_HASH-4.14.162 = f65170224cd4359ce8b2793b492bd8127abdd0b91350484e001bce13f0c98b4b
-LINUX_KERNEL_HASH-4.19.91 = f403c3dee12ded0af1889c78871abf7a531a978ba423f1ca772de702a92c3447
+LINUX_KERNEL_HASH-4.19.93 = 2af5d23f82a8bf69a6e4d8407579293b7beeebd3054dc464d48bdb5d2d7f5834
 
 remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1))))
 sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1)))))))
index 7784801..dba7df5 100644 (file)
        list_for_each_entry(p, head, list) {
 --- a/net/ipv4/route.c
 +++ b/net/ipv4/route.c
-@@ -448,7 +448,7 @@ static struct neighbour *ipv4_neigh_look
+@@ -449,7 +449,7 @@ static struct neighbour *ipv4_neigh_look
        else if (skb)
                pkey = &ip_hdr(skb)->daddr;
  
        return neigh_create(&arp_tbl, pkey, dev);
 --- a/net/ipv4/tcp_output.c
 +++ b/net/ipv4/tcp_output.c
-@@ -444,48 +444,53 @@ static void tcp_options_write(__be32 *pt
+@@ -447,48 +447,53 @@ static void tcp_options_write(__be32 *pt
        u16 options = opts->options;    /* mungable copy */
  
        if (unlikely(OPTION_MD5 & options)) {
        }
  
        if (unlikely(opts->num_sack_blocks)) {
-@@ -493,16 +498,17 @@ static void tcp_options_write(__be32 *pt
+@@ -496,16 +501,17 @@ static void tcp_options_write(__be32 *pt
                        tp->duplicate_sack : tp->selective_acks;
                int this_sack;
  
                }
  
                tp->rx_opt.dsack = 0;
-@@ -515,13 +521,14 @@ static void tcp_options_write(__be32 *pt
+@@ -518,13 +524,14 @@ static void tcp_options_write(__be32 *pt
  
                if (foc->exp) {
                        len = TCPOLEN_EXP_FASTOPEN_BASE + foc->len;
index 847d8f5..e635ca6 100644 (file)
@@ -14,7 +14,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
 
 --- a/drivers/net/usb/lan78xx.c
 +++ b/drivers/net/usb/lan78xx.c
-@@ -2475,6 +2475,11 @@ static int lan78xx_reset(struct lan78xx_
+@@ -2476,6 +2476,11 @@ static int lan78xx_reset(struct lan78xx_
        int ret = 0;
        unsigned long timeout;
        u8 sig;
@@ -26,7 +26,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
  
        ret = lan78xx_read_reg(dev, HW_CFG, &buf);
        buf |= HW_CFG_LRST_;
-@@ -2528,6 +2533,9 @@ static int lan78xx_reset(struct lan78xx_
+@@ -2529,6 +2534,9 @@ static int lan78xx_reset(struct lan78xx_
  
        ret = lan78xx_read_reg(dev, HW_CFG, &buf);
        buf |= HW_CFG_MEF_;
@@ -36,7 +36,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
        ret = lan78xx_write_reg(dev, HW_CFG, buf);
  
        ret = lan78xx_read_reg(dev, USB_CFG0, &buf);
-@@ -2583,6 +2591,9 @@ static int lan78xx_reset(struct lan78xx_
+@@ -2584,6 +2592,9 @@ static int lan78xx_reset(struct lan78xx_
                        buf |= MAC_CR_AUTO_DUPLEX_ | MAC_CR_AUTO_SPEED_;
                }
        }
index a1a9fa6..01dc355 100644 (file)
@@ -15,7 +15,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
 
 --- a/drivers/net/usb/lan78xx.c
 +++ b/drivers/net/usb/lan78xx.c
-@@ -2657,6 +2657,22 @@ static int lan78xx_open(struct net_devic
+@@ -2658,6 +2658,22 @@ static int lan78xx_open(struct net_devic
  
        netif_dbg(dev, ifup, dev->net, "phy initialised successfully");
  
index 1e3944b..ef1bbaa 100644 (file)
@@ -37,7 +37,7 @@ Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
  static int lan78xx_read_reg(struct lan78xx_net *dev, u32 index, u32 *data)
  {
        u32 *buf = kmalloc(sizeof(u32), GFP_KERNEL);
-@@ -3011,8 +3020,14 @@ static int lan78xx_bind(struct lan78xx_n
+@@ -3012,8 +3021,14 @@ static int lan78xx_bind(struct lan78xx_n
        if (DEFAULT_RX_CSUM_ENABLE)
                dev->net->features |= NETIF_F_RXCSUM;
  
index a1dfb00..9b5e492 100644 (file)
@@ -16,7 +16,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
 
 --- a/drivers/net/usb/lan78xx.c
 +++ b/drivers/net/usb/lan78xx.c
-@@ -2189,6 +2189,22 @@ static int lan78xx_phy_init(struct lan78
+@@ -2190,6 +2190,22 @@ static int lan78xx_phy_init(struct lan78
        mii_adv = (u32)mii_advertise_flowctrl(dev->fc_request_control);
        phydev->advertising |= mii_adv_to_ethtool_adv_t(mii_adv);
  
@@ -39,7 +39,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
        if (phydev->mdio.dev.of_node) {
                u32 reg;
                int len;
-@@ -2666,22 +2682,6 @@ static int lan78xx_open(struct net_devic
+@@ -2667,22 +2683,6 @@ static int lan78xx_open(struct net_devic
  
        netif_dbg(dev, ifup, dev->net, "phy initialised successfully");
  
index 761b6dc..b552cc0 100644 (file)
@@ -28,7 +28,7 @@ See: https://github.com/raspberrypi/linux/issues/2447
  static int lan78xx_read_reg(struct lan78xx_net *dev, u32 index, u32 *data)
  {
        u32 *buf = kmalloc(sizeof(u32), GFP_KERNEL);
-@@ -3824,7 +3829,12 @@ static int lan78xx_probe(struct usb_inte
+@@ -3825,7 +3830,12 @@ static int lan78xx_probe(struct usb_inte
        dev->pipe_intr = usb_rcvintpipe(dev->udev,
                                        dev->ep_intr->desc.bEndpointAddress &
                                        USB_ENDPOINT_NUMBER_MASK);
index 7d4bab5..d147ce9 100644 (file)
@@ -15,7 +15,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
 
 --- a/drivers/net/usb/lan78xx.c
 +++ b/drivers/net/usb/lan78xx.c
-@@ -2194,7 +2194,7 @@ static int lan78xx_phy_init(struct lan78
+@@ -2195,7 +2195,7 @@ static int lan78xx_phy_init(struct lan78
        mii_adv = (u32)mii_advertise_flowctrl(dev->fc_request_control);
        phydev->advertising |= mii_adv_to_ethtool_adv_t(mii_adv);
  
index 9608504..f5313ae 100644 (file)
@@ -12,7 +12,7 @@ in both dwc_otg and in ipv6 processing.
 
 --- a/drivers/net/usb/lan78xx.c
 +++ b/drivers/net/usb/lan78xx.c
-@@ -3258,7 +3258,7 @@ static int rx_submit(struct lan78xx_net
+@@ -3259,7 +3259,7 @@ static int rx_submit(struct lan78xx_net
        size_t size = dev->rx_urb_size;
        int ret = 0;
  
index 28c7450..7bbee63 100644 (file)
@@ -21,7 +21,7 @@ Cc: stable@vger.kernel.org
 
 --- a/net/bluetooth/hci_conn.c
 +++ b/net/bluetooth/hci_conn.c
-@@ -1272,8 +1272,13 @@ int hci_conn_check_link_mode(struct hci_
+@@ -1280,8 +1280,13 @@ int hci_conn_check_link_mode(struct hci_
                        return 0;
        }
  
index 1aa0a17..fd5cb52 100644 (file)
@@ -16,7 +16,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
 
 --- a/drivers/mmc/host/sdhci.c
 +++ b/drivers/mmc/host/sdhci.c
-@@ -2937,6 +2937,10 @@ static irqreturn_t sdhci_irq(int irq, vo
+@@ -2935,6 +2935,10 @@ static irqreturn_t sdhci_irq(int irq, vo
                        result = IRQ_WAKE_THREAD;
                }
  
index 52f999e..bd99cba 100644 (file)
@@ -152,7 +152,7 @@ Minor modifications required on the backport
        return __put_v4l2_format32(&p64->format, &p32->format);
 --- a/drivers/media/v4l2-core/v4l2-ioctl.c
 +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
-@@ -1879,7 +1879,7 @@ static int v4l_reqbufs(const struct v4l2
+@@ -1882,7 +1882,7 @@ static int v4l_reqbufs(const struct v4l2
        if (ret)
                return ret;
  
@@ -161,7 +161,7 @@ Minor modifications required on the backport
  
        return ops->vidioc_reqbufs(file, fh, p);
  }
-@@ -1920,7 +1920,7 @@ static int v4l_create_bufs(const struct
+@@ -1923,7 +1923,7 @@ static int v4l_create_bufs(const struct
        if (ret)
                return ret;
  
index 8c00945..3320097 100644 (file)
@@ -33,7 +33,7 @@ Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
  #define USB_VENDOR_ID_BELKIN          0x050d
  #define USB_DEVICE_ID_FLIP_KVM                0x3201
  
-@@ -1192,6 +1195,9 @@
+@@ -1193,6 +1196,9 @@
  #define USB_VENDOR_ID_XAT     0x2505
  #define USB_DEVICE_ID_XAT_CSR 0x0220
  
@@ -53,7 +53,7 @@ Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
        { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_MULTI_TOUCH), HID_QUIRK_MULTI_INPUT },
        { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE), HID_QUIRK_ALWAYS_POLL },
        { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE2), HID_QUIRK_ALWAYS_POLL },
-@@ -174,6 +175,7 @@ static const struct hid_device_id hid_qu
+@@ -175,6 +176,7 @@ static const struct hid_device_id hid_qu
        { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET), HID_QUIRK_MULTI_INPUT },
        { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD2, USB_DEVICE_ID_SMARTJOY_DUAL_PLUS), HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT },
        { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_QUAD_USB_JOYPAD), HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT },
index 70959de..c320527 100644 (file)
@@ -22,7 +22,7 @@ Signed-off-by: Phil Elwell <phil@raspberrypi.org>
 
 --- a/drivers/spi/spidev.c
 +++ b/drivers/spi/spidev.c
-@@ -725,6 +725,7 @@ static int spidev_probe(struct spi_devic
+@@ -728,6 +728,7 @@ static int spidev_probe(struct spi_devic
         * compatible string, it is a Linux implementation thing
         * rather than a description of the hardware.
         */
diff --git a/target/linux/generic/hack-4.19/550-loop-Report-EOPNOTSUPP-properly.patch b/target/linux/generic/hack-4.19/550-loop-Report-EOPNOTSUPP-properly.patch
new file mode 100644 (file)
index 0000000..023de00
--- /dev/null
@@ -0,0 +1,41 @@
+From 2e864386e62e702a343be2507062ee08d5dfc810 Mon Sep 17 00:00:00 2001
+From: Evan Green <evgreen@chromium.org>
+Date: Thu, 14 Nov 2019 15:50:07 -0800
+Subject: loop: Report EOPNOTSUPP properly
+
+Properly plumb out EOPNOTSUPP from loop driver operations, which may
+get returned when for instance a discard operation is attempted but not
+supported by the underlying block device. Before this change, everything
+was reported in the log as an I/O error, which is scary and not
+helpful in debugging.
+
+Signed-off-by: Evan Green <evgreen@chromium.org>
+Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
+Reviewed-by: Bart Van Assche <bvanassche@acm.org>
+---
+ drivers/block/loop.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+--- a/drivers/block/loop.c
++++ b/drivers/block/loop.c
+@@ -460,7 +460,7 @@ static void lo_complete_rq(struct reques
+       if (!cmd->use_aio || cmd->ret < 0 || cmd->ret == blk_rq_bytes(rq) ||
+           req_op(rq) != REQ_OP_READ) {
+               if (cmd->ret < 0)
+-                      ret = BLK_STS_IOERR;
++                      ret = errno_to_blk_status(cmd->ret);
+               goto end_io;
+       }
+@@ -1904,7 +1904,10 @@ static void loop_handle_cmd(struct loop_
+  failed:
+       /* complete non-aio request */
+       if (!cmd->use_aio || ret) {
+-              cmd->ret = ret ? -EIO : 0;
++              if (ret == -EOPNOTSUPP)
++                      cmd->ret = ret;
++              else
++                      cmd->ret = ret ? -EIO : 0;
+               blk_mq_complete_request(rq);
+       }
+ }
diff --git a/target/linux/generic/hack-4.19/550-loop-better-discard-for-block-devices.patch b/target/linux/generic/hack-4.19/550-loop-better-discard-for-block-devices.patch
deleted file mode 100644 (file)
index 9701d94..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-From: Evan Green <evgreen@chromium.org>
-Subject: [PATCH v5 0/2] loop: Better discard for block devices
-Date: Mon,  6 May 2019 11:27:35 -0700
-Message-Id: <20190506182736.21064-2-evgreen@chromium.org>
-
-This series addresses some errors seen when using the loop
-device directly backed by a block device.
-
-The first change titled "loop: Better discard for block devices"
-plumbs out the correct error message, and the second change prevents
-the error from occurring in many cases.
-
-The errors look like this:
-[   90.880875] print_req_error: I/O error, dev loop5, sector 0
-
-The errors occur when trying to do a discard or write zeroes operation
-on a loop device backed by a block device that does not support write zeroes.
-Firstly, the error itself is incorrectly reported as I/O error, but is
-actually EOPNOTSUPP. The first patch plumbs out EOPNOTSUPP to properly
-report the error.
-
-The second patch called "loop: Better discard support for block devices"
-prevents these errors from occurring by mirroring the zeroing capabilities
-of the underlying block device into the loop device.
-Before this change, discard was always reported as being supported, and
-the loop device simply turns around and does an fallocate operation on the
-backing device. After this change, backing block devices that do support
-zeroing will continue to work as before, and continue to get all the
-benefits of doing that. Backing devices that do not support zeroing will
-fail earlier, avoiding hitting the loop device at all and ultimately
-avoiding this error in the logs.
-
-I can also confirm that this fixes test block/003 in the blktests, when
-running blktests on a loop device backed by a block device.
-
-Signed-off-by: Evan Green <evgreen@chromium.org>
-Reviewed-by: Ming Lei <ming.lei@redhat.com>
-Reviewed-by: Bart Van Assche <bvanassche@acm.org>
-Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
-Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
-Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
----
-
---- a/drivers/block/loop.c
-+++ b/drivers/block/loop.c
-@@ -416,19 +416,14 @@ out_free_page:
-       return ret;
- }
--static int lo_discard(struct loop_device *lo, struct request *rq, loff_t pos)
-+static int lo_discard(struct loop_device *lo, struct request *rq,
-+              int mode, loff_t pos)
- {
--      /*
--       * We use punch hole to reclaim the free space used by the
--       * image a.k.a. discard. However we do not support discard if
--       * encryption is enabled, because it may give an attacker
--       * useful information.
--       */
-       struct file *file = lo->lo_backing_file;
--      int mode = FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE;
-+      struct request_queue *q = lo->lo_queue;
-       int ret;
--      if ((!file->f_op->fallocate) || lo->lo_encrypt_key_size) {
-+      if (!blk_queue_discard(q)) {
-               ret = -EOPNOTSUPP;
-               goto out;
-       }
-@@ -457,7 +452,9 @@ static void lo_complete_rq(struct reques
-       if (!cmd->use_aio || cmd->ret < 0 || cmd->ret == blk_rq_bytes(rq) ||
-           req_op(rq) != REQ_OP_READ) {
--              if (cmd->ret < 0)
-+              if (cmd->ret == -EOPNOTSUPP)
-+                      ret = BLK_STS_NOTSUPP;
-+              else if (cmd->ret < 0)
-                       ret = BLK_STS_IOERR;
-               goto end_io;
-       }
-@@ -597,8 +594,13 @@ static int do_req_filebacked(struct loop
-       case REQ_OP_FLUSH:
-               return lo_req_flush(lo, rq);
-       case REQ_OP_DISCARD:
-+              return lo_discard(lo, rq,
-+                      FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE, pos);
-+
-       case REQ_OP_WRITE_ZEROES:
--              return lo_discard(lo, rq, pos);
-+              return lo_discard(lo, rq,
-+                      FALLOC_FL_ZERO_RANGE | FALLOC_FL_KEEP_SIZE, pos);
-+
-       case REQ_OP_WRITE:
-               if (lo->transfer)
-                       return lo_write_transfer(lo, rq, pos);
-@@ -853,6 +855,21 @@ static void loop_config_discard(struct l
-       struct file *file = lo->lo_backing_file;
-       struct inode *inode = file->f_mapping->host;
-       struct request_queue *q = lo->lo_queue;
-+      struct request_queue *backingq;
-+
-+      /*
-+       * If the backing device is a block device, mirror its zeroing
-+       * capability. REQ_OP_DISCARD translates to a zero-out even when backed
-+       * by block devices to keep consistent behavior with file-backed loop
-+       * devices.
-+       */
-+      if (S_ISBLK(inode->i_mode) && !lo->lo_encrypt_key_size) {
-+              backingq = bdev_get_queue(inode->i_bdev);
-+              blk_queue_max_discard_sectors(q,
-+                      backingq->limits.max_write_zeroes_sectors);
-+
-+              blk_queue_max_write_zeroes_sectors(q,
-+                      backingq->limits.max_write_zeroes_sectors);
-       /*
-        * We use punch hole to reclaim the free space used by the
-@@ -860,22 +877,24 @@ static void loop_config_discard(struct l
-        * encryption is enabled, because it may give an attacker
-        * useful information.
-        */
--      if ((!file->f_op->fallocate) ||
--          lo->lo_encrypt_key_size) {
-+      } else if ((!file->f_op->fallocate) || lo->lo_encrypt_key_size) {
-               q->limits.discard_granularity = 0;
-               q->limits.discard_alignment = 0;
-               blk_queue_max_discard_sectors(q, 0);
-               blk_queue_max_write_zeroes_sectors(q, 0);
--              blk_queue_flag_clear(QUEUE_FLAG_DISCARD, q);
--              return;
--      }
--      q->limits.discard_granularity = inode->i_sb->s_blocksize;
--      q->limits.discard_alignment = 0;
-+      } else {
-+              q->limits.discard_granularity = inode->i_sb->s_blocksize;
-+              q->limits.discard_alignment = 0;
--      blk_queue_max_discard_sectors(q, UINT_MAX >> 9);
--      blk_queue_max_write_zeroes_sectors(q, UINT_MAX >> 9);
--      blk_queue_flag_set(QUEUE_FLAG_DISCARD, q);
-+              blk_queue_max_discard_sectors(q, UINT_MAX >> 9);
-+              blk_queue_max_write_zeroes_sectors(q, UINT_MAX >> 9);
-+      }
-+
-+      if (q->limits.max_write_zeroes_sectors)
-+              blk_queue_flag_set(QUEUE_FLAG_DISCARD, q);
-+      else
-+              blk_queue_flag_clear(QUEUE_FLAG_DISCARD, q);
- }
- static void loop_unprepare_queue(struct loop_device *lo)
-@@ -1894,7 +1913,10 @@ static void loop_handle_cmd(struct loop_
-  failed:
-       /* complete non-aio request */
-       if (!cmd->use_aio || ret) {
--              cmd->ret = ret ? -EIO : 0;
-+              if (ret == -EOPNOTSUPP)
-+                      cmd->ret = ret;
-+              else
-+                      cmd->ret = ret ? -EIO : 0;
-               blk_mq_complete_request(rq);
-       }
- }
diff --git a/target/linux/generic/hack-4.19/551-loop-Better-discard-support-for-block-devices.patch b/target/linux/generic/hack-4.19/551-loop-Better-discard-support-for-block-devices.patch
new file mode 100644 (file)
index 0000000..ac393e5
--- /dev/null
@@ -0,0 +1,101 @@
+From 3117c3f45edbcc269baaebd3d13f39b7bf884aa6 Mon Sep 17 00:00:00 2001
+From: Evan Green <evgreen@chromium.org>
+Date: Thu, 14 Nov 2019 15:50:08 -0800
+Subject: loop: Better discard support for block devices
+
+If the backing device for a loop device is itself a block device,
+then mirror the "write zeroes" capabilities of the underlying
+block device into the loop device. Copy this capability into both
+max_write_zeroes_sectors and max_discard_sectors of the loop device.
+
+The reason for this is that REQ_OP_DISCARD on a loop device translates
+into blkdev_issue_zeroout(), rather than blkdev_issue_discard(). This
+presents a consistent interface for loop devices (that discarded data
+is zeroed), regardless of the backing device type of the loop device.
+There should be no behavior change for loop devices backed by regular
+files.
+
+This change fixes blktest block/003, and removes an extraneous
+error print in block/013 when testing on a loop device backed
+by a block device that does not support discard.
+
+Signed-off-by: Evan Green <evgreen@chromium.org>
+Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
+Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
+---
+ drivers/block/loop.c | 40 +++++++++++++++++++++++++++++-----------
+ 1 file changed, 29 insertions(+), 11 deletions(-)
+
+--- a/drivers/block/loop.c
++++ b/drivers/block/loop.c
+@@ -426,11 +426,12 @@ static int lo_fallocate(struct loop_devi
+        * information.
+        */
+       struct file *file = lo->lo_backing_file;
++      struct request_queue *q = lo->lo_queue;
+       int ret;
+       mode |= FALLOC_FL_KEEP_SIZE;
+-      if ((!file->f_op->fallocate) || lo->lo_encrypt_key_size) {
++      if (!blk_queue_discard(q)) {
+               ret = -EOPNOTSUPP;
+               goto out;
+       }
+@@ -863,6 +864,21 @@ static void loop_config_discard(struct l
+       struct file *file = lo->lo_backing_file;
+       struct inode *inode = file->f_mapping->host;
+       struct request_queue *q = lo->lo_queue;
++      struct request_queue *backingq;
++
++      /*
++       * If the backing device is a block device, mirror its zeroing
++       * capability. REQ_OP_DISCARD translates to a zero-out even when backed
++       * by block devices to keep consistent behavior with file-backed loop
++       * devices.
++       */
++      if (S_ISBLK(inode->i_mode) && !lo->lo_encrypt_key_size) {
++              backingq = bdev_get_queue(inode->i_bdev);
++              blk_queue_max_discard_sectors(q,
++                      backingq->limits.max_write_zeroes_sectors);
++
++              blk_queue_max_write_zeroes_sectors(q,
++                      backingq->limits.max_write_zeroes_sectors);
+       /*
+        * We use punch hole to reclaim the free space used by the
+@@ -870,22 +886,24 @@ static void loop_config_discard(struct l
+        * encryption is enabled, because it may give an attacker
+        * useful information.
+        */
+-      if ((!file->f_op->fallocate) ||
+-          lo->lo_encrypt_key_size) {
++      } else if ((!file->f_op->fallocate) || lo->lo_encrypt_key_size) {
+               q->limits.discard_granularity = 0;
+               q->limits.discard_alignment = 0;
+               blk_queue_max_discard_sectors(q, 0);
+               blk_queue_max_write_zeroes_sectors(q, 0);
+-              blk_queue_flag_clear(QUEUE_FLAG_DISCARD, q);
+-              return;
+-      }
+-      q->limits.discard_granularity = inode->i_sb->s_blocksize;
+-      q->limits.discard_alignment = 0;
++      } else {
++              q->limits.discard_granularity = inode->i_sb->s_blocksize;
++              q->limits.discard_alignment = 0;
+-      blk_queue_max_discard_sectors(q, UINT_MAX >> 9);
+-      blk_queue_max_write_zeroes_sectors(q, UINT_MAX >> 9);
+-      blk_queue_flag_set(QUEUE_FLAG_DISCARD, q);
++              blk_queue_max_discard_sectors(q, UINT_MAX >> 9);
++              blk_queue_max_write_zeroes_sectors(q, UINT_MAX >> 9);
++      }
++
++      if (q->limits.max_write_zeroes_sectors)
++              blk_queue_flag_set(QUEUE_FLAG_DISCARD, q);
++      else
++              blk_queue_flag_clear(QUEUE_FLAG_DISCARD, q);
+ }
+ static void loop_unprepare_queue(struct loop_device *lo)
index e9c0930..b6cbef1 100644 (file)
@@ -56,7 +56,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
   */
 --- a/include/linux/skbuff.h
 +++ b/include/linux/skbuff.h
-@@ -2545,6 +2545,10 @@ static inline int pskb_trim(struct sk_bu
+@@ -2547,6 +2547,10 @@ static inline int pskb_trim(struct sk_bu
        return (len < skb->len) ? __pskb_trim(skb, len) : 0;
  }
  
@@ -67,7 +67,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  /**
   *    pskb_trim_unique - remove end from a paged unique (not cloned) buffer
   *    @skb: buffer to alter
-@@ -2676,16 +2680,6 @@ static inline struct sk_buff *dev_alloc_
+@@ -2678,16 +2682,6 @@ static inline struct sk_buff *dev_alloc_
  }
  
  
index f562c9f..3ee7fda 100644 (file)
@@ -393,7 +393,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  }
 --- a/net/ipv4/route.c
 +++ b/net/ipv4/route.c
-@@ -410,6 +410,9 @@ static struct pernet_operations ip_rt_pr
+@@ -411,6 +411,9 @@ static struct pernet_operations ip_rt_pr
  
  static int __init ip_rt_proc_init(void)
  {
index b00fb8e..3a42182 100644 (file)
@@ -8,7 +8,7 @@ Signed-off-by: Giuseppe Lippolis <giu.lippolis@gmail.com>
 
 --- a/drivers/spi/spidev.c
 +++ b/drivers/spi/spidev.c
-@@ -669,6 +669,7 @@ static const struct of_device_id spidev_
+@@ -672,6 +672,7 @@ static const struct of_device_id spidev_
        { .compatible = "lineartechnology,ltc2488" },
        { .compatible = "ge,achc" },
        { .compatible = "semtech,sx1301" },
index 6f0adb5..9230279 100644 (file)
@@ -75,7 +75,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        output_label("kallsyms_token_table");
        off = 0;
        for (i = 0; i < 256; i++) {
-@@ -500,6 +504,9 @@ static void *find_token(unsigned char *s
+@@ -502,6 +506,9 @@ static void *find_token(unsigned char *s
  {
        int i;
  
@@ -85,7 +85,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        for (i = 0; i < len - 1; i++) {
                if (str[i] == token[0] && str[i+1] == token[1])
                        return &str[i];
-@@ -572,6 +579,9 @@ static void optimize_result(void)
+@@ -574,6 +581,9 @@ static void optimize_result(void)
  {
        int i, best;
  
@@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        /* using the '\0' symbol last allows compress_symbols to use standard
         * fast string functions */
        for (i = 255; i >= 0; i--) {
-@@ -754,6 +764,8 @@ int main(int argc, char **argv)
+@@ -756,6 +766,8 @@ int main(int argc, char **argv)
                                absolute_percpu = 1;
                        else if (strcmp(argv[i], "--base-relative") == 0)
                                base_relative = 1;
index 70cf88d..7c4ab32 100644 (file)
@@ -30,7 +30,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  #define PACKET_FANOUT_LB              1
 --- a/net/packet/af_packet.c
 +++ b/net/packet/af_packet.c
-@@ -1789,6 +1789,7 @@ static int packet_rcv_spkt(struct sk_buf
+@@ -1790,6 +1790,7 @@ static int packet_rcv_spkt(struct sk_buf
  {
        struct sock *sk;
        struct sockaddr_pkt *spkt;
@@ -38,7 +38,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  
        /*
         *      When we registered the protocol we saved the socket in the data
-@@ -1796,6 +1797,7 @@ static int packet_rcv_spkt(struct sk_buf
+@@ -1797,6 +1798,7 @@ static int packet_rcv_spkt(struct sk_buf
         */
  
        sk = pt->af_packet_priv;
@@ -46,7 +46,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  
        /*
         *      Yank back the headers [hope the device set this
-@@ -1808,7 +1810,7 @@ static int packet_rcv_spkt(struct sk_buf
+@@ -1809,7 +1811,7 @@ static int packet_rcv_spkt(struct sk_buf
         *      so that this procedure is noop.
         */
  
@@ -55,7 +55,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
                goto out;
  
        if (!net_eq(dev_net(dev), sock_net(sk)))
-@@ -2036,12 +2038,12 @@ static int packet_rcv(struct sk_buff *sk
+@@ -2037,12 +2039,12 @@ static int packet_rcv(struct sk_buff *sk
        unsigned int snaplen, res;
        bool is_drop_n_account = false;
  
@@ -71,7 +71,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        if (!net_eq(dev_net(dev), sock_net(sk)))
                goto drop;
  
-@@ -2167,12 +2169,12 @@ static int tpacket_rcv(struct sk_buff *s
+@@ -2168,12 +2170,12 @@ static int tpacket_rcv(struct sk_buff *s
        BUILD_BUG_ON(TPACKET_ALIGN(sizeof(*h.h2)) != 32);
        BUILD_BUG_ON(TPACKET_ALIGN(sizeof(*h.h3)) != 48);
  
@@ -87,7 +87,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        if (!net_eq(dev_net(dev), sock_net(sk)))
                goto drop;
  
-@@ -3258,6 +3260,7 @@ static int packet_create(struct net *net
+@@ -3259,6 +3261,7 @@ static int packet_create(struct net *net
        mutex_init(&po->pg_vec_lock);
        po->rollover = NULL;
        po->prot_hook.func = packet_rcv;
@@ -95,7 +95,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
  
        if (sock->type == SOCK_PACKET)
                po->prot_hook.func = packet_rcv_spkt;
-@@ -3869,6 +3872,16 @@ packet_setsockopt(struct socket *sock, i
+@@ -3870,6 +3873,16 @@ packet_setsockopt(struct socket *sock, i
                po->xmit = val ? packet_direct_xmit : dev_queue_xmit;
                return 0;
        }
@@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
        default:
                return -ENOPROTOOPT;
        }
-@@ -3921,6 +3934,13 @@ static int packet_getsockopt(struct sock
+@@ -3922,6 +3935,13 @@ static int packet_getsockopt(struct sock
        case PACKET_VNET_HDR:
                val = po->has_vnet_hdr;
                break;
index b5f7fad..94e325b 100644 (file)
@@ -9,7 +9,7 @@ Signed-off-by: Felix Fietkau <nbd@nbd.name>
 
 --- a/include/linux/skbuff.h
 +++ b/include/linux/skbuff.h
-@@ -2509,7 +2509,7 @@ static inline int pskb_network_may_pull(
+@@ -2511,7 +2511,7 @@ static inline int pskb_network_may_pull(
   * NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8)
   */
  #ifndef NET_SKB_PAD
index 114595b..c35aca8 100644 (file)
@@ -118,8 +118,8 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
 +static int            ip6_pkt_policy_failed_out(struct net *net, struct sock *sk, struct sk_buff *skb);
  static void           ip6_link_failure(struct sk_buff *skb);
  static void           ip6_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,
-                                          struct sk_buff *skb, u32 mtu);
-@@ -326,6 +328,18 @@ static const struct rt6_info ip6_prohibi
+                                          struct sk_buff *skb, u32 mtu,
+@@ -328,6 +330,18 @@ static const struct rt6_info ip6_prohibi
        .rt6i_flags     = (RTF_REJECT | RTF_NONEXTHOP),
  };
  
@@ -138,7 +138,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  static const struct rt6_info ip6_blk_hole_entry_template = {
        .dst = {
                .__refcnt       = ATOMIC_INIT(1),
-@@ -904,6 +918,7 @@ static const int fib6_prop[RTN_MAX + 1]
+@@ -906,6 +920,7 @@ static const int fib6_prop[RTN_MAX + 1]
        [RTN_BLACKHOLE] = -EINVAL,
        [RTN_UNREACHABLE] = -EHOSTUNREACH,
        [RTN_PROHIBIT]  = -EACCES,
@@ -146,7 +146,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
        [RTN_THROW]     = -EAGAIN,
        [RTN_NAT]       = -EINVAL,
        [RTN_XRESOLVE]  = -EINVAL,
-@@ -941,6 +956,10 @@ static void ip6_rt_init_dst_reject(struc
+@@ -943,6 +958,10 @@ static void ip6_rt_init_dst_reject(struc
                rt->dst.output = ip6_pkt_prohibit_out;
                rt->dst.input = ip6_pkt_prohibit;
                break;
@@ -157,7 +157,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
        case RTN_THROW:
        case RTN_UNREACHABLE:
        default:
-@@ -3781,6 +3800,17 @@ static int ip6_pkt_prohibit_out(struct n
+@@ -3789,6 +3808,17 @@ static int ip6_pkt_prohibit_out(struct n
        return ip6_pkt_drop(skb, ICMPV6_ADM_PROHIBITED, IPSTATS_MIB_OUTNOROUTES);
  }
  
@@ -175,7 +175,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  /*
   *    Allocate a dst for local (unicast / anycast) address.
   */
-@@ -4228,7 +4258,8 @@ static int rtm_to_fib6_config(struct sk_
+@@ -4236,7 +4266,8 @@ static int rtm_to_fib6_config(struct sk_
        if (rtm->rtm_type == RTN_UNREACHABLE ||
            rtm->rtm_type == RTN_BLACKHOLE ||
            rtm->rtm_type == RTN_PROHIBIT ||
@@ -185,7 +185,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
                cfg->fc_flags |= RTF_REJECT;
  
        if (rtm->rtm_type == RTN_LOCAL)
-@@ -5076,6 +5107,8 @@ static int ip6_route_dev_notify(struct n
+@@ -5084,6 +5115,8 @@ static int ip6_route_dev_notify(struct n
  #ifdef CONFIG_IPV6_MULTIPLE_TABLES
                net->ipv6.ip6_prohibit_entry->dst.dev = dev;
                net->ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(dev);
@@ -194,7 +194,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
                net->ipv6.ip6_blk_hole_entry->dst.dev = dev;
                net->ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(dev);
  #endif
-@@ -5087,6 +5120,7 @@ static int ip6_route_dev_notify(struct n
+@@ -5095,6 +5128,7 @@ static int ip6_route_dev_notify(struct n
                in6_dev_put_clear(&net->ipv6.ip6_null_entry->rt6i_idev);
  #ifdef CONFIG_IPV6_MULTIPLE_TABLES
                in6_dev_put_clear(&net->ipv6.ip6_prohibit_entry->rt6i_idev);
@@ -202,7 +202,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
                in6_dev_put_clear(&net->ipv6.ip6_blk_hole_entry->rt6i_idev);
  #endif
        }
-@@ -5281,6 +5315,15 @@ static int __net_init ip6_route_net_init
+@@ -5289,6 +5323,15 @@ static int __net_init ip6_route_net_init
        net->ipv6.ip6_blk_hole_entry->dst.ops = &net->ipv6.ip6_dst_ops;
        dst_init_metrics(&net->ipv6.ip6_blk_hole_entry->dst,
                         ip6_template_metrics, true);
@@ -218,7 +218,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  #endif
  
        net->ipv6.sysctl.flush_delay = 0;
-@@ -5299,6 +5342,8 @@ out:
+@@ -5307,6 +5350,8 @@ out:
        return ret;
  
  #ifdef CONFIG_IPV6_MULTIPLE_TABLES
@@ -227,7 +227,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  out_ip6_prohibit_entry:
        kfree(net->ipv6.ip6_prohibit_entry);
  out_ip6_null_entry:
-@@ -5319,6 +5364,7 @@ static void __net_exit ip6_route_net_exi
+@@ -5327,6 +5372,7 @@ static void __net_exit ip6_route_net_exi
  #ifdef CONFIG_IPV6_MULTIPLE_TABLES
        kfree(net->ipv6.ip6_prohibit_entry);
        kfree(net->ipv6.ip6_blk_hole_entry);
@@ -235,7 +235,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  #endif
        dst_entries_destroy(&net->ipv6.ip6_dst_ops);
  }
-@@ -5395,6 +5441,9 @@ void __init ip6_route_init_special_entri
+@@ -5403,6 +5449,9 @@ void __init ip6_route_init_special_entri
        init_net.ipv6.ip6_prohibit_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev);
        init_net.ipv6.ip6_blk_hole_entry->dst.dev = init_net.loopback_dev;
        init_net.ipv6.ip6_blk_hole_entry->rt6i_idev = in6_dev_get(init_net.loopback_dev);
index 7092552..951145b 100644 (file)
@@ -13,7 +13,7 @@
  #include <linux/nvmem-consumer.h>
  #include <linux/io.h>
  #include <linux/interrupt.h>
-@@ -210,9 +212,8 @@
+@@ -210,9 +212,8 @@ static void tsens_scheduler_fn(struct wo
        struct tsens_device *tmdev = container_of(work, struct tsens_device,
                                        tsens_work);
        unsigned int threshold, threshold_low, code, reg, sensor, mask;
@@ -24,7 +24,7 @@
  
        ret = regmap_read(tmdev->map, STATUS_CNTL_8064, &reg);
        if (ret)
-@@ -261,9 +262,8 @@
+@@ -261,9 +262,8 @@ static void tsens_scheduler_fn(struct wo
                if (upper_th_x || lower_th_x) {
                        /* Notify user space */
                        schedule_work(&tmdev->sensor[0].notify_work);
@@ -35,7 +35,7 @@
                }
        }
        regmap_write(tmdev->map, STATUS_CNTL_8064, reg & mask);
-@@ -372,40 +372,55 @@
+@@ -372,40 +372,55 @@ static int init_ipq8064(struct tsens_dev
  static int calibrate_ipq8064(struct tsens_device *tmdev)
  {
        int i;
index 04cb9b3..06d29e8 100644 (file)
@@ -60,7 +60,7 @@ will be executed twice with the same parameters for the same pinctrl.
 
 --- a/arch/arm/boot/dts/qcom-ipq8064.dtsi
 +++ b/arch/arm/boot/dts/qcom-ipq8064.dtsi
-@@ -625,6 +625,7 @@
+@@ -656,6 +656,7 @@
                        reg = <0x800000 0x4000>;
  
                        gpio-controller;