From 6d4eb4a9f4dec9b696fc731b5d3cbd48e888b065 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Sun, 5 Jul 2020 23:38:57 -0400 Subject: [PATCH] Fixes for 4.14 Signed-off-by: Sasha Levin --- ...tc-u32-key-values-and-masks-natively.patch | 348 ++++++++++++++++++ ...ned-conversion-for-fetching-timestam.patch | 39 ++ ...-sun4i-hdmi-remove-extra-hpd-polling.patch | 50 +++ ..._meter-fix-potential-memory-leak-in-.patch | 47 +++ ...ke-sure-the-overt-mask-is-set-correc.patch | 67 ++++ ...-0x78-as-scl-stuck-low-status-for-pc.patch | 43 +++ queue-4.14/series | 7 + ...vblk-vqs-in-error-path-of-virtblk_pr.patch | 36 ++ 8 files changed, 637 insertions(+) create mode 100644 queue-4.14/cxgb4-parse-tc-u32-key-values-and-masks-natively.patch create mode 100644 queue-4.14/cxgb4-use-unaligned-conversion-for-fetching-timestam.patch create mode 100644 queue-4.14/drm-sun4i-hdmi-remove-extra-hpd-polling.patch create mode 100644 queue-4.14/hwmon-acpi_power_meter-fix-potential-memory-leak-in-.patch create mode 100644 queue-4.14/hwmon-max6697-make-sure-the-overt-mask-is-set-correc.patch create mode 100644 queue-4.14/i2c-algo-pca-add-0x78-as-scl-stuck-low-status-for-pc.patch create mode 100644 queue-4.14/virtio-blk-free-vblk-vqs-in-error-path-of-virtblk_pr.patch diff --git a/queue-4.14/cxgb4-parse-tc-u32-key-values-and-masks-natively.patch b/queue-4.14/cxgb4-parse-tc-u32-key-values-and-masks-natively.patch new file mode 100644 index 00000000000..d38a5ad75ad --- /dev/null +++ b/queue-4.14/cxgb4-parse-tc-u32-key-values-and-masks-natively.patch @@ -0,0 +1,348 @@ +From bb86c2ec732d555246ea73049971294d2fb3cf8c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 24 Jun 2020 01:51:34 +0530 +Subject: cxgb4: parse TC-U32 key values and masks natively + +From: Rahul Lakkireddy + +[ Upstream commit 27f78cb245abdb86735529c13b0a579f57829e71 ] + +TC-U32 passes all keys values and masks in __be32 format. The parser +already expects this and hence pass the value and masks in __be32 +natively to the parser. + +Fixes following sparse warnings in several places: +cxgb4_tc_u32.c:57:21: warning: incorrect type in assignment (different base +types) +cxgb4_tc_u32.c:57:21: expected unsigned int [usertype] val +cxgb4_tc_u32.c:57:21: got restricted __be32 [usertype] val +cxgb4_tc_u32_parse.h:48:24: warning: cast to restricted __be32 + +Fixes: 2e8aad7bf203 ("cxgb4: add parser to translate u32 filters to internal spec") +Signed-off-by: Rahul Lakkireddy +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + .../net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c | 18 +-- + .../chelsio/cxgb4/cxgb4_tc_u32_parse.h | 122 ++++++++++++------ + 2 files changed, 91 insertions(+), 49 deletions(-) + +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c +index 48970ba08bdc1..de5804ddefbd0 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32.c +@@ -47,7 +47,7 @@ static int fill_match_fields(struct adapter *adap, + bool next_header) + { + unsigned int i, j; +- u32 val, mask; ++ __be32 val, mask; + int off, err; + bool found; + +@@ -217,7 +217,7 @@ int cxgb4_config_knode(struct net_device *dev, struct tc_cls_u32_offload *cls) + const struct cxgb4_next_header *next; + bool found = false; + unsigned int i, j; +- u32 val, mask; ++ __be32 val, mask; + int off; + + if (t->table[link_uhtid - 1].link_handle) { +@@ -231,10 +231,10 @@ int cxgb4_config_knode(struct net_device *dev, struct tc_cls_u32_offload *cls) + + /* Try to find matches that allow jumps to next header. */ + for (i = 0; next[i].jump; i++) { +- if (next[i].offoff != cls->knode.sel->offoff || +- next[i].shift != cls->knode.sel->offshift || +- next[i].mask != cls->knode.sel->offmask || +- next[i].offset != cls->knode.sel->off) ++ if (next[i].sel.offoff != cls->knode.sel->offoff || ++ next[i].sel.offshift != cls->knode.sel->offshift || ++ next[i].sel.offmask != cls->knode.sel->offmask || ++ next[i].sel.off != cls->knode.sel->off) + continue; + + /* Found a possible candidate. Find a key that +@@ -246,9 +246,9 @@ int cxgb4_config_knode(struct net_device *dev, struct tc_cls_u32_offload *cls) + val = cls->knode.sel->keys[j].val; + mask = cls->knode.sel->keys[j].mask; + +- if (next[i].match_off == off && +- next[i].match_val == val && +- next[i].match_mask == mask) { ++ if (next[i].key.off == off && ++ next[i].key.val == val && ++ next[i].key.mask == mask) { + found = true; + break; + } +diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h +index a4b99edcc3399..141085e159e57 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h ++++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_tc_u32_parse.h +@@ -38,12 +38,12 @@ + struct cxgb4_match_field { + int off; /* Offset from the beginning of the header to match */ + /* Fill the value/mask pair in the spec if matched */ +- int (*val)(struct ch_filter_specification *f, u32 val, u32 mask); ++ int (*val)(struct ch_filter_specification *f, __be32 val, __be32 mask); + }; + + /* IPv4 match fields */ + static inline int cxgb4_fill_ipv4_tos(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + f->val.tos = (ntohl(val) >> 16) & 0x000000FF; + f->mask.tos = (ntohl(mask) >> 16) & 0x000000FF; +@@ -52,7 +52,7 @@ static inline int cxgb4_fill_ipv4_tos(struct ch_filter_specification *f, + } + + static inline int cxgb4_fill_ipv4_frag(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + u32 mask_val; + u8 frag_val; +@@ -74,7 +74,7 @@ static inline int cxgb4_fill_ipv4_frag(struct ch_filter_specification *f, + } + + static inline int cxgb4_fill_ipv4_proto(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + f->val.proto = (ntohl(val) >> 16) & 0x000000FF; + f->mask.proto = (ntohl(mask) >> 16) & 0x000000FF; +@@ -83,7 +83,7 @@ static inline int cxgb4_fill_ipv4_proto(struct ch_filter_specification *f, + } + + static inline int cxgb4_fill_ipv4_src_ip(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + memcpy(&f->val.fip[0], &val, sizeof(u32)); + memcpy(&f->mask.fip[0], &mask, sizeof(u32)); +@@ -92,7 +92,7 @@ static inline int cxgb4_fill_ipv4_src_ip(struct ch_filter_specification *f, + } + + static inline int cxgb4_fill_ipv4_dst_ip(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + memcpy(&f->val.lip[0], &val, sizeof(u32)); + memcpy(&f->mask.lip[0], &mask, sizeof(u32)); +@@ -111,7 +111,7 @@ static const struct cxgb4_match_field cxgb4_ipv4_fields[] = { + + /* IPv6 match fields */ + static inline int cxgb4_fill_ipv6_tos(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + f->val.tos = (ntohl(val) >> 20) & 0x000000FF; + f->mask.tos = (ntohl(mask) >> 20) & 0x000000FF; +@@ -120,7 +120,7 @@ static inline int cxgb4_fill_ipv6_tos(struct ch_filter_specification *f, + } + + static inline int cxgb4_fill_ipv6_proto(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + f->val.proto = (ntohl(val) >> 8) & 0x000000FF; + f->mask.proto = (ntohl(mask) >> 8) & 0x000000FF; +@@ -129,7 +129,7 @@ static inline int cxgb4_fill_ipv6_proto(struct ch_filter_specification *f, + } + + static inline int cxgb4_fill_ipv6_src_ip0(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + memcpy(&f->val.fip[0], &val, sizeof(u32)); + memcpy(&f->mask.fip[0], &mask, sizeof(u32)); +@@ -138,7 +138,7 @@ static inline int cxgb4_fill_ipv6_src_ip0(struct ch_filter_specification *f, + } + + static inline int cxgb4_fill_ipv6_src_ip1(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + memcpy(&f->val.fip[4], &val, sizeof(u32)); + memcpy(&f->mask.fip[4], &mask, sizeof(u32)); +@@ -147,7 +147,7 @@ static inline int cxgb4_fill_ipv6_src_ip1(struct ch_filter_specification *f, + } + + static inline int cxgb4_fill_ipv6_src_ip2(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + memcpy(&f->val.fip[8], &val, sizeof(u32)); + memcpy(&f->mask.fip[8], &mask, sizeof(u32)); +@@ -156,7 +156,7 @@ static inline int cxgb4_fill_ipv6_src_ip2(struct ch_filter_specification *f, + } + + static inline int cxgb4_fill_ipv6_src_ip3(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + memcpy(&f->val.fip[12], &val, sizeof(u32)); + memcpy(&f->mask.fip[12], &mask, sizeof(u32)); +@@ -165,7 +165,7 @@ static inline int cxgb4_fill_ipv6_src_ip3(struct ch_filter_specification *f, + } + + static inline int cxgb4_fill_ipv6_dst_ip0(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + memcpy(&f->val.lip[0], &val, sizeof(u32)); + memcpy(&f->mask.lip[0], &mask, sizeof(u32)); +@@ -174,7 +174,7 @@ static inline int cxgb4_fill_ipv6_dst_ip0(struct ch_filter_specification *f, + } + + static inline int cxgb4_fill_ipv6_dst_ip1(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + memcpy(&f->val.lip[4], &val, sizeof(u32)); + memcpy(&f->mask.lip[4], &mask, sizeof(u32)); +@@ -183,7 +183,7 @@ static inline int cxgb4_fill_ipv6_dst_ip1(struct ch_filter_specification *f, + } + + static inline int cxgb4_fill_ipv6_dst_ip2(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + memcpy(&f->val.lip[8], &val, sizeof(u32)); + memcpy(&f->mask.lip[8], &mask, sizeof(u32)); +@@ -192,7 +192,7 @@ static inline int cxgb4_fill_ipv6_dst_ip2(struct ch_filter_specification *f, + } + + static inline int cxgb4_fill_ipv6_dst_ip3(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + memcpy(&f->val.lip[12], &val, sizeof(u32)); + memcpy(&f->mask.lip[12], &mask, sizeof(u32)); +@@ -216,7 +216,7 @@ static const struct cxgb4_match_field cxgb4_ipv6_fields[] = { + + /* TCP/UDP match */ + static inline int cxgb4_fill_l4_ports(struct ch_filter_specification *f, +- u32 val, u32 mask) ++ __be32 val, __be32 mask) + { + f->val.fport = ntohl(val) >> 16; + f->mask.fport = ntohl(mask) >> 16; +@@ -237,19 +237,13 @@ static const struct cxgb4_match_field cxgb4_udp_fields[] = { + }; + + struct cxgb4_next_header { +- unsigned int offset; /* Offset to next header */ +- /* offset, shift, and mask added to offset above ++ /* Offset, shift, and mask added to beginning of the header + * to get to next header. Useful when using a header + * field's value to jump to next header such as IHL field + * in IPv4 header. + */ +- unsigned int offoff; +- u32 shift; +- u32 mask; +- /* match criteria to make this jump */ +- unsigned int match_off; +- u32 match_val; +- u32 match_mask; ++ struct tc_u32_sel sel; ++ struct tc_u32_key key; + /* location of jump to make */ + const struct cxgb4_match_field *jump; + }; +@@ -258,26 +252,74 @@ struct cxgb4_next_header { + * IPv4 header. + */ + static const struct cxgb4_next_header cxgb4_ipv4_jumps[] = { +- { .offset = 0, .offoff = 0, .shift = 6, .mask = 0xF, +- .match_off = 8, .match_val = 0x600, .match_mask = 0xFF00, +- .jump = cxgb4_tcp_fields }, +- { .offset = 0, .offoff = 0, .shift = 6, .mask = 0xF, +- .match_off = 8, .match_val = 0x1100, .match_mask = 0xFF00, +- .jump = cxgb4_udp_fields }, +- { .jump = NULL } ++ { ++ /* TCP Jump */ ++ .sel = { ++ .off = 0, ++ .offoff = 0, ++ .offshift = 6, ++ .offmask = cpu_to_be16(0x0f00), ++ }, ++ .key = { ++ .off = 8, ++ .val = cpu_to_be32(0x00060000), ++ .mask = cpu_to_be32(0x00ff0000), ++ }, ++ .jump = cxgb4_tcp_fields, ++ }, ++ { ++ /* UDP Jump */ ++ .sel = { ++ .off = 0, ++ .offoff = 0, ++ .offshift = 6, ++ .offmask = cpu_to_be16(0x0f00), ++ }, ++ .key = { ++ .off = 8, ++ .val = cpu_to_be32(0x00110000), ++ .mask = cpu_to_be32(0x00ff0000), ++ }, ++ .jump = cxgb4_udp_fields, ++ }, ++ { .jump = NULL }, + }; + + /* Accept a rule with a jump directly past the 40 Bytes of IPv6 fixed header + * to get to transport layer header. + */ + static const struct cxgb4_next_header cxgb4_ipv6_jumps[] = { +- { .offset = 0x28, .offoff = 0, .shift = 0, .mask = 0, +- .match_off = 4, .match_val = 0x60000, .match_mask = 0xFF0000, +- .jump = cxgb4_tcp_fields }, +- { .offset = 0x28, .offoff = 0, .shift = 0, .mask = 0, +- .match_off = 4, .match_val = 0x110000, .match_mask = 0xFF0000, +- .jump = cxgb4_udp_fields }, +- { .jump = NULL } ++ { ++ /* TCP Jump */ ++ .sel = { ++ .off = 40, ++ .offoff = 0, ++ .offshift = 0, ++ .offmask = 0, ++ }, ++ .key = { ++ .off = 4, ++ .val = cpu_to_be32(0x00000600), ++ .mask = cpu_to_be32(0x0000ff00), ++ }, ++ .jump = cxgb4_tcp_fields, ++ }, ++ { ++ /* UDP Jump */ ++ .sel = { ++ .off = 40, ++ .offoff = 0, ++ .offshift = 0, ++ .offmask = 0, ++ }, ++ .key = { ++ .off = 4, ++ .val = cpu_to_be32(0x00001100), ++ .mask = cpu_to_be32(0x0000ff00), ++ }, ++ .jump = cxgb4_udp_fields, ++ }, ++ { .jump = NULL }, + }; + + struct cxgb4_link { +-- +2.25.1 + diff --git a/queue-4.14/cxgb4-use-unaligned-conversion-for-fetching-timestam.patch b/queue-4.14/cxgb4-use-unaligned-conversion-for-fetching-timestam.patch new file mode 100644 index 00000000000..f42373e9a52 --- /dev/null +++ b/queue-4.14/cxgb4-use-unaligned-conversion-for-fetching-timestam.patch @@ -0,0 +1,39 @@ +From 9bd21d7c8aa1658bef2cf8902a0e63e98f97a47d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 24 Jun 2020 01:51:33 +0530 +Subject: cxgb4: use unaligned conversion for fetching timestamp + +From: Rahul Lakkireddy + +[ Upstream commit 589b1c9c166dce120e27b32a83a78f55464a7ef9 ] + +Use get_unaligned_be64() to fetch the timestamp needed for ns_to_ktime() +conversion. + +Fixes following sparse warning: +sge.c:3282:43: warning: cast to restricted __be64 + +Fixes: a456950445a0 ("cxgb4: time stamping interface for PTP") +Signed-off-by: Rahul Lakkireddy +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/chelsio/cxgb4/sge.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c b/drivers/net/ethernet/chelsio/cxgb4/sge.c +index 4ef68f69b58c4..0a5c4c7da5052 100644 +--- a/drivers/net/ethernet/chelsio/cxgb4/sge.c ++++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c +@@ -2088,7 +2088,7 @@ static noinline int t4_systim_to_hwstamp(struct adapter *adapter, + + hwtstamps = skb_hwtstamps(skb); + memset(hwtstamps, 0, sizeof(*hwtstamps)); +- hwtstamps->hwtstamp = ns_to_ktime(be64_to_cpu(*((u64 *)data))); ++ hwtstamps->hwtstamp = ns_to_ktime(get_unaligned_be64(data)); + + return RX_PTP_PKT_SUC; + } +-- +2.25.1 + diff --git a/queue-4.14/drm-sun4i-hdmi-remove-extra-hpd-polling.patch b/queue-4.14/drm-sun4i-hdmi-remove-extra-hpd-polling.patch new file mode 100644 index 00000000000..9a952838299 --- /dev/null +++ b/queue-4.14/drm-sun4i-hdmi-remove-extra-hpd-polling.patch @@ -0,0 +1,50 @@ +From c292c65d1bfd6da05258523afe6aaf8da36a591a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 29 Jun 2020 14:00:32 +0800 +Subject: drm: sun4i: hdmi: Remove extra HPD polling + +From: Chen-Yu Tsai + +[ Upstream commit bda8eaa6dee7525f4dac950810a85a88bf6c2ba0 ] + +The HPD sense mechanism in Allwinner's old HDMI encoder hardware is more +or less an input-only GPIO. Other GPIO-based HPD implementations +directly return the current state, instead of polling for a specific +state and returning the other if that times out. + +Remove the I/O polling from sun4i_hdmi_connector_detect() and directly +return a known state based on the current reading. This also gets rid +of excessive CPU usage by kworker as reported on Stack Exchange [1] and +Armbian forums [2]. + + [1] https://superuser.com/questions/1515001/debian-10-buster-on-cubietruck-with-bug-in-sun4i-drm-hdmi + [2] https://forum.armbian.com/topic/14282-headless-systems-and-sun4i_drm_hdmi-a10a20/ + +Fixes: 9c5681011a0c ("drm/sun4i: Add HDMI support") +Signed-off-by: Chen-Yu Tsai +Signed-off-by: Maxime Ripard +Link: https://patchwork.freedesktop.org/patch/msgid/20200629060032.24134-1-wens@kernel.org +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +index 298d6a8bab120..82cb939351889 100644 +--- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c ++++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +@@ -214,9 +214,8 @@ sun4i_hdmi_connector_detect(struct drm_connector *connector, bool force) + struct sun4i_hdmi *hdmi = drm_connector_to_sun4i_hdmi(connector); + unsigned long reg; + +- if (readl_poll_timeout(hdmi->base + SUN4I_HDMI_HPD_REG, reg, +- reg & SUN4I_HDMI_HPD_HIGH, +- 0, 500000)) { ++ reg = readl(hdmi->base + SUN4I_HDMI_HPD_REG); ++ if (reg & SUN4I_HDMI_HPD_HIGH) { + cec_phys_addr_invalidate(hdmi->cec_adap); + return connector_status_disconnected; + } +-- +2.25.1 + diff --git a/queue-4.14/hwmon-acpi_power_meter-fix-potential-memory-leak-in-.patch b/queue-4.14/hwmon-acpi_power_meter-fix-potential-memory-leak-in-.patch new file mode 100644 index 00000000000..908afd27db2 --- /dev/null +++ b/queue-4.14/hwmon-acpi_power_meter-fix-potential-memory-leak-in-.patch @@ -0,0 +1,47 @@ +From 795beec0a3699ea9e1c6e40be4615df1b13b2e8a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 25 Jun 2020 13:32:42 +0900 +Subject: hwmon: (acpi_power_meter) Fix potential memory leak in + acpi_power_meter_add() + +From: Misono Tomohiro + +[ Upstream commit 8b97f9922211c44a739c5cbd9502ecbb9f17f6d1 ] + +Although it rarely happens, we should call free_capabilities() +if error happens after read_capabilities() to free allocated strings. + +Fixes: de584afa5e188 ("hwmon driver for ACPI 4.0 power meters") +Signed-off-by: Misono Tomohiro +Link: https://lore.kernel.org/r/20200625043242.31175-1-misono.tomohiro@jp.fujitsu.com +Signed-off-by: Guenter Roeck +Signed-off-by: Sasha Levin +--- + drivers/hwmon/acpi_power_meter.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/hwmon/acpi_power_meter.c b/drivers/hwmon/acpi_power_meter.c +index ba3af4505d8fb..e40d8907853bf 100644 +--- a/drivers/hwmon/acpi_power_meter.c ++++ b/drivers/hwmon/acpi_power_meter.c +@@ -895,7 +895,7 @@ static int acpi_power_meter_add(struct acpi_device *device) + + res = setup_attrs(resource); + if (res) +- goto exit_free; ++ goto exit_free_capability; + + resource->hwmon_dev = hwmon_device_register(&device->dev); + if (IS_ERR(resource->hwmon_dev)) { +@@ -908,6 +908,8 @@ static int acpi_power_meter_add(struct acpi_device *device) + + exit_remove: + remove_attrs(resource); ++exit_free_capability: ++ free_capabilities(resource); + exit_free: + kfree(resource); + exit: +-- +2.25.1 + diff --git a/queue-4.14/hwmon-max6697-make-sure-the-overt-mask-is-set-correc.patch b/queue-4.14/hwmon-max6697-make-sure-the-overt-mask-is-set-correc.patch new file mode 100644 index 00000000000..623a6bf7caa --- /dev/null +++ b/queue-4.14/hwmon-max6697-make-sure-the-overt-mask-is-set-correc.patch @@ -0,0 +1,67 @@ +From eee5f5888515755fbdf0ca7f24a69701d46c25a8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 23 Jun 2020 22:13:08 +0000 +Subject: hwmon: (max6697) Make sure the OVERT mask is set correctly + +From: Chu Lin + +[ Upstream commit 016983d138cbe99a5c0aaae0103ee88f5300beb3 ] + +Per the datasheet for max6697, OVERT mask and ALERT mask are different. +For example, the 7th bit of OVERT is the local channel but for alert +mask, the 6th bit is the local channel. Therefore, we can't apply the +same mask for both registers. In addition to that, the max6697 driver +is supposed to be compatibale with different models. I manually went over +all the listed chips and made sure all chip types have the same layout. + +Testing; + mask value of 0x9 should map to 0x44 for ALERT and 0x84 for OVERT. + I used iotool to read the reg value back to verify. I only tested this + change on max6581. + +Reference: +https://datasheets.maximintegrated.com/en/ds/MAX6581.pdf +https://datasheets.maximintegrated.com/en/ds/MAX6697.pdf +https://datasheets.maximintegrated.com/en/ds/MAX6699.pdf + +Signed-off-by: Chu Lin +Fixes: 5372d2d71c46e ("hwmon: Driver for Maxim MAX6697 and compatibles") +Signed-off-by: Guenter Roeck +Signed-off-by: Sasha Levin +--- + drivers/hwmon/max6697.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/drivers/hwmon/max6697.c b/drivers/hwmon/max6697.c +index 221fd14920576..6df28fe0577da 100644 +--- a/drivers/hwmon/max6697.c ++++ b/drivers/hwmon/max6697.c +@@ -47,8 +47,9 @@ static const u8 MAX6697_REG_CRIT[] = { + * Map device tree / platform data register bit map to chip bit map. + * Applies to alert register and over-temperature register. + */ +-#define MAX6697_MAP_BITS(reg) ((((reg) & 0x7e) >> 1) | \ ++#define MAX6697_ALERT_MAP_BITS(reg) ((((reg) & 0x7e) >> 1) | \ + (((reg) & 0x01) << 6) | ((reg) & 0x80)) ++#define MAX6697_OVERT_MAP_BITS(reg) (((reg) >> 1) | (((reg) & 0x01) << 7)) + + #define MAX6697_REG_STAT(n) (0x44 + (n)) + +@@ -587,12 +588,12 @@ static int max6697_init_chip(struct max6697_data *data, + return ret; + + ret = i2c_smbus_write_byte_data(client, MAX6697_REG_ALERT_MASK, +- MAX6697_MAP_BITS(pdata->alert_mask)); ++ MAX6697_ALERT_MAP_BITS(pdata->alert_mask)); + if (ret < 0) + return ret; + + ret = i2c_smbus_write_byte_data(client, MAX6697_REG_OVERT_MASK, +- MAX6697_MAP_BITS(pdata->over_temperature_mask)); ++ MAX6697_OVERT_MAP_BITS(pdata->over_temperature_mask)); + if (ret < 0) + return ret; + +-- +2.25.1 + diff --git a/queue-4.14/i2c-algo-pca-add-0x78-as-scl-stuck-low-status-for-pc.patch b/queue-4.14/i2c-algo-pca-add-0x78-as-scl-stuck-low-status-for-pc.patch new file mode 100644 index 00000000000..ca4d46d3892 --- /dev/null +++ b/queue-4.14/i2c-algo-pca-add-0x78-as-scl-stuck-low-status-for-pc.patch @@ -0,0 +1,43 @@ +From 8d70dbe1bc16ebd99bb89fca28c15bc181af6267 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 2 Jul 2020 10:39:11 +1200 +Subject: i2c: algo-pca: Add 0x78 as SCL stuck low status for PCA9665 + +From: Chris Packham + +[ Upstream commit cd217f2300793a106b49c7dfcbfb26e348bc7593 ] + +The PCA9665 datasheet says that I2CSTA = 78h indicates that SCL is stuck +low, this differs to the PCA9564 which uses 90h for this indication. +Treat either 0x78 or 0x90 as an indication that the SCL line is stuck. + +Based on looking through the PCA9564 and PCA9665 datasheets this should +be safe for both chips. The PCA9564 should not return 0x78 for any valid +state and the PCA9665 should not return 0x90. + +Fixes: eff9ec95efaa ("i2c-algo-pca: Add PCA9665 support") +Signed-off-by: Chris Packham +Reviewed-by: Andy Shevchenko +Signed-off-by: Wolfram Sang +Signed-off-by: Sasha Levin +--- + drivers/i2c/algos/i2c-algo-pca.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/i2c/algos/i2c-algo-pca.c b/drivers/i2c/algos/i2c-algo-pca.c +index e370804ec8bc6..3a9db4626cb60 100644 +--- a/drivers/i2c/algos/i2c-algo-pca.c ++++ b/drivers/i2c/algos/i2c-algo-pca.c +@@ -326,7 +326,8 @@ static int pca_xfer(struct i2c_adapter *i2c_adap, + DEB2("BUS ERROR - SDA Stuck low\n"); + pca_reset(adap); + goto out; +- case 0x90: /* Bus error - SCL stuck low */ ++ case 0x78: /* Bus error - SCL stuck low (PCA9665) */ ++ case 0x90: /* Bus error - SCL stuck low (PCA9564) */ + DEB2("BUS ERROR - SCL Stuck low\n"); + pca_reset(adap); + goto out; +-- +2.25.1 + diff --git a/queue-4.14/series b/queue-4.14/series index 9e01bddf6f8..a550f03e8ed 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -10,3 +10,10 @@ usb-usbtest-fix-missing-kfree-dev-buf-in-usbtest_dis.patch kgdb-avoid-suspicious-rcu-usage-warning.patch tpm_tis-remove-the-hid-ifx0102.patch crypto-af_alg-fix-use-after-free-in-af_alg_accept-due-to-bh_lock_sock.patch +cxgb4-use-unaligned-conversion-for-fetching-timestam.patch +cxgb4-parse-tc-u32-key-values-and-masks-natively.patch +hwmon-max6697-make-sure-the-overt-mask-is-set-correc.patch +hwmon-acpi_power_meter-fix-potential-memory-leak-in-.patch +drm-sun4i-hdmi-remove-extra-hpd-polling.patch +virtio-blk-free-vblk-vqs-in-error-path-of-virtblk_pr.patch +i2c-algo-pca-add-0x78-as-scl-stuck-low-status-for-pc.patch diff --git a/queue-4.14/virtio-blk-free-vblk-vqs-in-error-path-of-virtblk_pr.patch b/queue-4.14/virtio-blk-free-vblk-vqs-in-error-path-of-virtblk_pr.patch new file mode 100644 index 00000000000..d2acbaff47c --- /dev/null +++ b/queue-4.14/virtio-blk-free-vblk-vqs-in-error-path-of-virtblk_pr.patch @@ -0,0 +1,36 @@ +From 3cc10eb3f95c72a496a1a065dda0cf9bfd7c5795 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 15 Jun 2020 12:14:59 +0800 +Subject: virtio-blk: free vblk-vqs in error path of virtblk_probe() + +From: Hou Tao + +[ Upstream commit e7eea44eefbdd5f0345a0a8b80a3ca1c21030d06 ] + +Else there will be memory leak if alloc_disk() fails. + +Fixes: 6a27b656fc02 ("block: virtio-blk: support multi virt queues per virtio-blk device") +Signed-off-by: Hou Tao +Reviewed-by: Stefano Garzarella +Reviewed-by: Ming Lei +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + drivers/block/virtio_blk.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c +index 0e18eed62c575..2f15e38fb3f8c 100644 +--- a/drivers/block/virtio_blk.c ++++ b/drivers/block/virtio_blk.c +@@ -879,6 +879,7 @@ static int virtblk_probe(struct virtio_device *vdev) + put_disk(vblk->disk); + out_free_vq: + vdev->config->del_vqs(vdev); ++ kfree(vblk->vqs); + out_free_vblk: + kfree(vblk); + out_free_index: +-- +2.25.1 + -- 2.47.3