5.16.19-rc1 review
Subsystems (11)
Greg Kroah-Hartman
maintainerPATCH 399/1017 drm/meson: split out encoder from meson_dw_hdmi
In reply to Greg Kroah-HartmanFrom: Neil Armstrong <[email protected]>
[ Upstream commit e67f6037ae1be34b2b686bab72caa41d57714534 ]
This moves all the non-DW-HDMI code where it should be:
an encoder in the drm/meson core driver.
The bridge functions are copied as-is, except:
- the encoder init uses the simple kms helper
- the mode_set has been moved to atomic_enable()
- debug prints are converted to dev_debg()
For now the bridge attach flags is 0, DRM_BRIDGE_ATTACH_NO_CONNECTOR will be handled later.
The meson dw-hdmi glue is slightly fixed to live without the encoder in the same driver.
--- drivers/gpu/drm/meson/Makefile | 1 + drivers/gpu/drm/meson/meson_drv.c | 5 + drivers/gpu/drm/meson/meson_dw_hdmi.c | 341 ++----------------- drivers/gpu/drm/meson/meson_encoder_hdmi.c | 370 +++++++++++++++++++++ drivers/gpu/drm/meson/meson_encoder_hdmi.h | 12 + 5 files changed, 407 insertions(+), 322 deletions(-) create mode 100644 drivers/gpu/drm/meson/meson_encoder_hdmi.c create mode 100644 drivers/gpu/drm/meson/meson_encoder_hdmi.h
drivers/gpu/drm/meson/Makefile +1 -0
@@ -2,6 +2,7 @@ meson-drm-y := meson_drv.o meson_plane.o meson_crtc.o meson_venc_cvbs.o meson-drm-y += meson_viu.o meson_vpp.o meson_venc.o meson_vclk.o meson_overlay.o meson-drm-y += meson_rdma.o meson_osd_afbcd.o +meson-drm-y += meson_encoder_hdmi.o obj-$(CONFIG_DRM_MESON) += meson-drm.o obj-$(CONFIG_DRM_MESON_DW_HDMI) += meson_dw_hdmi.o
drivers/gpu/drm/meson/meson_drv.c +5 -0
@@ -32,6 +32,7 @@#include "meson_osd_afbcd.h" #include "meson_registers.h" #include "meson_venc_cvbs.h" +#include "meson_encoder_hdmi.h" #include "meson_viu.h" #include "meson_vpp.h" #include "meson_rdma.h"
@@ -318,6 +319,10 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) } } + ret =meson_encoder_hdmi_init (priv); +if (ret) + goto free_drm; + ret =meson_plane_create (priv);if (ret) goto free_drm;
drivers/gpu/drm/meson/meson_dw_hdmi.c +19 -322
460 lines not on this page · raw message
drivers/gpu/drm/meson/meson_encoder_hdmi.c new file +370 -0
370 lines not on this page · raw message
drivers/gpu/drm/meson/meson_encoder_hdmi.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* Copyright (C) 2021 BayLibre, SAS +* Author: Neil Armstrong <[email protected]> +*/ + +#ifndef __MESON_ENCODER_HDMI_H +#define __MESON_ENCODER_HDMI_H + +int meson_encoder_hdmi_init (struct meson_drm *priv); + +#endif /* __MESON_ENCODER_HDMI_H */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 400/1017 drm/meson: Fix error handling when afbcd.ops->init fails
In reply to Greg Kroah-HartmanFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit fa747d75f65d1b1cbc3f4691fa67b695e8a399c8 ]
When afbcd.ops->init fails we need to free the struct drm_device. Also all errors which come after afbcd.ops->init was successful need to exit the AFBCD, just like meson_drv_unbind() does.
--- drivers/gpu/drm/meson/meson_drv.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/gpu/drm/meson/meson_drv.c +11 -8
@@ -302,42 +302,42 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)if (priv->afbcd.ops) { ret = priv->afbcd.ops->init (priv);if (ret) -return ret; + goto free_drm; }/* Encoder Initialization */ ret =meson_venc_cvbs_create (priv);if (ret) - goto free_drm; + goto exit_afbcd;if (has_components) { ret =component_bind_all (drm->dev, drm);if (ret) {dev_err (drm->dev,"Couldn't bind all components\n" ); - goto free_drm; + goto exit_afbcd; } } ret =meson_encoder_hdmi_init (priv);if (ret) - goto free_drm; + goto exit_afbcd; ret =meson_plane_create (priv);if (ret) - goto free_drm; + goto exit_afbcd; ret =meson_overlay_create (priv);if (ret) - goto free_drm; + goto exit_afbcd; ret =meson_crtc_create (priv);if (ret) - goto free_drm; + goto exit_afbcd; ret =request_irq (priv->vsync_irq, meson_irq,0 , drm->driver->name, drm);if (ret) - goto free_drm; + goto exit_afbcd;drm_mode_config_reset (drm);
@@ -355,6 +355,9 @@ static int meson_drv_bind_master(struct device *dev, bool has_components) uninstall_irq:free_irq (priv->vsync_irq, drm); +exit_afbcd: +if (priv->afbcd.ops) + priv->afbcd.ops->exit (priv); free_drm:drm_dev_put (drm);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 401/1017 drm/bridge: Fix free wrong object in sii8620_init_rcp_input_dev
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 7c442e76c06cb1bef16a6c523487438175584eea ]
rc_dev is allocated by rc_allocate_device(), and doesn't assigned to ctx->rc_dev before calling rc_free_device(ctx->rc_dev). So it should call rc_free_device(rc_dev);
--- drivers/gpu/drm/bridge/sil-sii8620.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/sil-sii8620.c +1 -1
@@ -2120,7 +2120,7 @@ static void sii8620_init_rcp_input_dev(struct sii8620 *ctx)if (ret) {dev_err (ctx->dev,"Failed to register RC device\n" ); ctx->error = ret; -rc_free_device (ctx->rc_dev); +rc_free_device (rc_dev);return ; } ctx->rc_dev = rc_dev;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 402/1017 drm/bridge: Add missing pm_runtime_disable() in __dw_mipi_dsi_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 96211b7c56b109a52768e6cc5e23a1f79316eca0 ]
If the probe fails, we should use pm_runtime_disable() to balance pm_runtime_enable().
Add missing pm_runtime_disable() for __dw_mipi_dsi_probe.
--- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +1 -0
@@ -1199,6 +1199,7 @@ __dw_mipi_dsi_probe(struct platform_device *pdev, ret =mipi_dsi_host_register (&dsi->dsi_host);if (ret) {dev_err (dev,"Failed to register MIPI host: %d\n" , ret); +pm_runtime_disable (dev);dw_mipi_dsi_debugfs_remove (dsi);return ERR_PTR (ret); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 403/1017 drm/bridge: nwl-dsi: Fix PM disable depth imbalance in nwl_dsi_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit b146e343a9e05605b491b1bf4a2b62a39d5638d8 ]
The pm_runtime_enable will increase power disable depth. Thus a pairing decrement is needed on the error handling path to keep it balanced according to context.
--- drivers/gpu/drm/bridge/nwl-dsi.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/bridge/nwl-dsi.c +1 -0
@@ -1204,6 +1204,7 @@ static int nwl_dsi_probe(struct platform_device *pdev) ret =nwl_dsi_select_input (dsi);if (ret <0 ) { +pm_runtime_disable (dev);mipi_dsi_host_unregister (&dsi->dsi_host);return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 404/1017 drm: bridge: adv7511: Fix ADV7535 HPD enablement
In reply to Greg Kroah-HartmanFrom: Jagan Teki <[email protected]>
[ Upstream commit 3dbc84a595d17f64f14fcea00120d31e33e98880 ]
Existing HPD enablement logic is not compatible with ADV7535 bridge, thus any runtime plug-in of HDMI cable is not working on these bridge designs.
Unlike other ADV7511 family of bridges, the ADV7535 require HPD_OVERRIDE bit to set and reset for proper handling of HPD functionality.
Fix it.
--- drivers/gpu/drm/bridge/adv7511/adv7511.h | 1 + drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 29 +++++++++++++++----- 2 files changed, 23 insertions(+), 7 deletions(-)
drivers/gpu/drm/bridge/adv7511/adv7511.h +1 -0
@@ -169,6 +169,7 @@#define ADV7511_PACKET_ENABLE_SPARE2 BIT(1)#define ADV7511_PACKET_ENABLE_SPARE1 BIT(0) +#define ADV7535_REG_POWER2_HPD_OVERRIDE BIT(6)#define ADV7511_REG_POWER2_HPD_SRC_MASK 0xc0#define ADV7511_REG_POWER2_HPD_SRC_BOTH 0x00#define ADV7511_REG_POWER2_HPD_SRC_HPD 0x40
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +22 -7
@@ -351,11 +351,17 @@ static void __adv7511_power_on(struct adv7511 *adv7511)* from standby or are enabled. When the HPD goes low the adv7511 is * reset and the outputs are disabled which might cause the monitor to * go to standby again. To avoid this we ignore the HPD pin for the -* first few seconds after enabling the output. +* first few seconds after enabling the output. On the other hand +* adv7535 require to enable HPD Override bit for proper HPD. */ -regmap_update_bits (adv7511->regmap,ADV7511_REG_POWER2 , -ADV7511_REG_POWER2_HPD_SRC_MASK , -ADV7511_REG_POWER2_HPD_SRC_NONE ); +if (adv7511->type ==ADV7535 ) +regmap_update_bits (adv7511->regmap,ADV7511_REG_POWER2 , +ADV7535_REG_POWER2_HPD_OVERRIDE , +ADV7535_REG_POWER2_HPD_OVERRIDE ); +else +regmap_update_bits (adv7511->regmap,ADV7511_REG_POWER2 , +ADV7511_REG_POWER2_HPD_SRC_MASK , +ADV7511_REG_POWER2_HPD_SRC_NONE ); }static void adv7511_power_on (struct adv7511 *adv7511)
@@ -375,6 +381,10 @@ static void adv7511_power_on(struct adv7511 *adv7511)static void __adv7511_power_off (struct adv7511 *adv7511) {/* TODO: setup additional power down modes */ +if (adv7511->type ==ADV7535 ) +regmap_update_bits (adv7511->regmap,ADV7511_REG_POWER2 , +ADV7535_REG_POWER2_HPD_OVERRIDE ,0 ); +regmap_update_bits (adv7511->regmap,ADV7511_REG_POWER ,ADV7511_POWER_POWER_DOWN ,ADV7511_POWER_POWER_DOWN );
@@ -672,9 +682,14 @@ adv7511_detect(struct adv7511 *adv7511, struct drm_connector *connector) status = connector_status_disconnected; }else {/* Renable HPD sensing */ -regmap_update_bits (adv7511->regmap,ADV7511_REG_POWER2 , -ADV7511_REG_POWER2_HPD_SRC_MASK , -ADV7511_REG_POWER2_HPD_SRC_BOTH ); +if (adv7511->type ==ADV7535 ) +regmap_update_bits (adv7511->regmap,ADV7511_REG_POWER2 , +ADV7535_REG_POWER2_HPD_OVERRIDE , +ADV7535_REG_POWER2_HPD_OVERRIDE ); +else +regmap_update_bits (adv7511->regmap,ADV7511_REG_POWER2 , +ADV7511_REG_POWER2_HPD_SRC_MASK , +ADV7511_REG_POWER2_HPD_SRC_BOTH ); } adv7511->status = status;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 405/1017 ath10k: fix memory overwrite of the WoWLAN wakeup packet pattern
In reply to Greg Kroah-HartmanFrom: Wen Gong <[email protected]>
[ Upstream commit e3fb3d4418fce5484dfe7995fcd94c18b10a431a ]
In function ath10k_wow_convert_8023_to_80211(), it will do memcpy for the new->pattern, and currently the new->pattern and new->mask is same with the old, then the memcpy of new->pattern will also overwrite the old->pattern, because the header format of new->pattern is 802.11, its length is larger than the old->pattern which is 802.3. Then the operation of "Copy frame body" will copy a mistake value because the body memory has been overwrite when memcpy the new->pattern.
Assign another empty value to new_pattern to avoid the overwrite issue.
Tested-on: QCA6174 hw3.2 SDIO WLAN.RMH.4.4.1-00049
--- drivers/net/wireless/ath/ath10k/wow.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath10k/wow.c +4 -3
@@ -337,14 +337,15 @@ static int ath10k_vif_wow_set_wakeups(struct ath10k_vif *arvif,if (patterns[i].mask[j /8 ] &BIT (j %8 )) bitmask[j] =0xff ; old_pattern.mask = bitmask; - new_pattern = old_pattern;if (ar->wmi.rx_decap_mode ==ATH10K_HW_TXRX_NATIVE_WIFI ) { -if (patterns[i].pkt_offset <ETH_HLEN ) +if (patterns[i].pkt_offset <ETH_HLEN ) {ath10k_wow_convert_8023_to_80211 (&new_pattern, &old_pattern); -else + }else { + new_pattern = old_pattern; new_pattern.pkt_offset +=WOW_HDR_LEN -ETH_HLEN ; + } }if (WARN_ON (new_pattern.pattern_len >WOW_MAX_PATTERN_SIZE ))
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 406/1017 drm/v3d/v3d_drv: Check for error num after setting mask
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 4a39156166b90465da0f9a33b3442d63b5651bec ]
Because of the possible failure of the dma_supported(), the dma_set_mask_and_coherent() may return error num. Therefore, it should be better to check it and return the error if fails.
Also, we can create a variable for the mask to solve the alignment issue.
--- drivers/gpu/drm/v3d/v3d_drv.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/v3d/v3d_drv.c +6 -2
@@ -219,6 +219,7 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)int ret;u32 mmu_debug;u32 ident1; +u64 mask; v3d = devm_drm_dev_alloc(dev, &v3d_drm_driver, struct v3d_dev, drm);if (IS_ERR (v3d))
@@ -237,8 +238,11 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)return ret; mmu_debug =V3D_READ (V3D_MMU_DEBUG_INFO ); -dma_set_mask_and_coherent (dev, -DMA_BIT_MASK (30 +V3D_GET_FIELD (mmu_debug,V3D_MMU_PA_WIDTH ))); + mask =DMA_BIT_MASK (30 +V3D_GET_FIELD (mmu_debug,V3D_MMU_PA_WIDTH )); + ret =dma_set_mask_and_coherent (dev, mask); +if (ret) +return ret; + v3d->va_width =30 +V3D_GET_FIELD (mmu_debug,V3D_MMU_VA_WIDTH ); ident1 =V3D_READ (V3D_HUB_IDENT1 );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 407/1017 drm/panfrost: Check for error num after setting mask
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 44ab30b056149bd59dd7989a593dd25ead6007fd ]
Because of the possible failure of the dma_supported(), the dma_set_mask_and_coherent() may return error num. Therefore, it should be better to check it and return the error if fails.
--- drivers/gpu/drm/panfrost/panfrost_gpu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/panfrost/panfrost_gpu.c +4 -1
@@ -360,8 +360,11 @@ int panfrost_gpu_init(struct panfrost_device *pfdev)panfrost_gpu_init_features (pfdev); -dma_set_mask_and_coherent (pfdev->dev, + err =dma_set_mask_and_coherent (pfdev->dev,DMA_BIT_MASK (FIELD_GET (0xff00 , pfdev->features.mmu_features))); +if (err) +return err; +dma_set_max_seg_size (pfdev->dev,UINT_MAX ); irq =platform_get_irq_byname (to_platform_device (pfdev->dev),"gpu" );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 408/1017 bpftool: Fix error check when calling hashmap__new()
In reply to Greg Kroah-HartmanFrom: Mauricio Vásquez <[email protected]>
[ Upstream commit 622a5b582cc27d3deedc38fcef68da2972e8e58d ]
hashmap__new() encodes errors with ERR_PTR(), hence it's not valid to check the returned pointer against NULL and IS_ERR() has to be used instead.
libbpf_get_error() can't be used in this case as hashmap__new() is not part of the public libbpf API and it'll continue using ERR_PTR() after libbpf 1.0.
--- tools/bpf/bpftool/btf.c | 2 +- tools/bpf/bpftool/link.c | 3 ++- tools/bpf/bpftool/map.c | 2 +- tools/bpf/bpftool/pids.c | 3 ++- tools/bpf/bpftool/prog.c | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-)
tools/bpf/bpftool/btf.c +1 -1
@@ -899,7 +899,7 @@ static int do_show(int argc, char **argv) equal_fn_for_key_as_id, NULL); btf_map_table =hashmap__new (hash_fn_for_key_as_id, equal_fn_for_key_as_id,NULL ); -if (!btf_prog_table || !btf_map_table) { +if (IS_ERR (btf_prog_table) ||IS_ERR (btf_map_table)) {hashmap__free (btf_prog_table);hashmap__free (btf_map_table);if (fd >=0 )
tools/bpf/bpftool/link.c +2 -1
@@ -2,6 +2,7 @@/* Copyright (C) 2020 Facebook */ #include <errno.h> +#include <linux/err.h> #include <net/if.h> #include <stdio.h> #include <unistd.h>
@@ -306,7 +307,7 @@ static int do_show(int argc, char **argv)if (show_pinned) { link_table =hashmap__new (hash_fn_for_key_as_id, equal_fn_for_key_as_id,NULL ); -if (!link_table) { +if (IS_ERR (link_table)) {p_err ("failed to create hashmap for pinned paths" );return -1 ; }
tools/bpf/bpftool/map.c +1 -1
@@ -698,7 +698,7 @@ static int do_show(int argc, char **argv)if (show_pinned) { map_table =hashmap__new (hash_fn_for_key_as_id, equal_fn_for_key_as_id,NULL ); -if (!map_table) { +if (IS_ERR (map_table)) {p_err ("failed to create hashmap for pinned paths" );return -1 ; }
tools/bpf/bpftool/pids.c +2 -1
@@ -1,6 +1,7 @@// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) /* Copyright (C) 2020 Facebook */ #include <errno.h> +#include <linux/err.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h>
@@ -101,7 +102,7 @@ int build_obj_refs_table(struct hashmap **map, enum bpf_obj_type type)libbpf_print_fn_t default_print; *map =hashmap__new (hash_fn_for_key_as_id, equal_fn_for_key_as_id,NULL ); -if (!*map) { +if (IS_ERR (*map)) {p_err ("failed to create hashmap for PID references" );return -1 ; }
tools/bpf/bpftool/prog.c +1 -1
@@ -571,7 +571,7 @@ static int do_show(int argc, char **argv)if (show_pinned) { prog_table =hashmap__new (hash_fn_for_key_as_id, equal_fn_for_key_as_id,NULL ); -if (!prog_table) { +if (IS_ERR (prog_table)) {p_err ("failed to create hashmap for pinned paths" );return -1 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 409/1017 libbpf: Fix possible NULL pointer dereference when destroying skeleton
In reply to Greg Kroah-HartmanFrom: Yafang Shao <[email protected]>
[ Upstream commit a32ea51a3f17ce6524c9fc19d311e708331c8b5f ]
When I checked the code in skeleton header file generated with my own bpf prog, I found there may be possible NULL pointer dereference when destroying skeleton. Then I checked the in-tree bpf progs, finding that is a common issue. Let's take the generated samples/bpf/xdp_redirect_cpu.skel.h for example. Below is the generated code in xdp_redirect_cpu__create_skeleton():
xdp_redirect_cpu__create_skeleton struct bpf_object_skeleton *s; s = (struct bpf_object_skeleton *)calloc(1, sizeof(*s)); if (!s) goto error; ... error: bpf_object__destroy_skeleton(s); return -ENOMEM;
After goto error, the NULL 's' will be deferenced in bpf_object__destroy_skeleton().
We can simply fix this issue by just adding a NULL check in bpf_object__destroy_skeleton().
--- tools/lib/bpf/libbpf.c | 3 +++ 1 file changed, 3 insertions(+)
tools/lib/bpf/libbpf.c +3 -0
@@ -11497,6 +11497,9 @@ void bpf_object__detach_skeleton(struct bpf_object_skeleton *s)void bpf_object__destroy_skeleton (struct bpf_object_skeleton *s) { +if (!s) +return ; +if (s->progs)bpf_object__detach_skeleton (s);if (s->obj)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 410/1017 bpftool: Only set obj->skeleton on complete success
In reply to Greg Kroah-HartmanFrom: Wei Fu <[email protected]>
[ Upstream commit 0991f6a38f576aa9a5e34713e23c998a3310d4d0 ]
After bpftool gen skeleton, the ${bpf_app}.skel.h will provide that ${bpf_app_name}__open helper to load bpf. If there is some error like ENOMEM, the ${bpf_app_name}__open will rollback(free) the allocated object, including bpf_object_skeleton.
Since the ${bpf_app_name}__create_skeleton set the obj->skeleton first and not rollback it when error, it will cause double-free in ${bpf_app_name}__destory at ${bpf_app_name}__open. Therefore, we should set the obj->skeleton before return 0;
--- tools/bpf/bpftool/gen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bpf/bpftool/gen.c +1 -1
@@ -928,7 +928,6 @@ static int do_skeleton(int argc, char **argv) s = (struct bpf_object_skeleton *)calloc(1, sizeof(*s));\n\ if (!s) \n\ goto err; \n\ - obj->skeleton = s; \n\ \n\ s->sz = sizeof(*s); \n\ s->name = \"%1$s\"; \n\
@@ -1001,6 +1000,7 @@ static int do_skeleton(int argc, char **argv) \n\ s->data = (void *)%2$s__elf_bytes(&s->data_sz); \n\ \n\ + obj->skeleton = s; \n\ return 0; \n\ err: \n\ bpf_object__destroy_skeleton(s); \n\
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 411/1017 udmabuf: validate ubuf->pagecount
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 2b6dd600dd72573c23ea180b5b0b2f1813405882 ]
Syzbot has reported GPF in sg_alloc_append_table_from_pages(). The problem was in ubuf->pages == ZERO_PTR.
ubuf->pagecount is calculated from arguments passed from user-space. If user creates udmabuf with list.size == 0 then ubuf->pagecount will be also equal to zero; it causes kmalloc_array() to return ZERO_PTR.
Fix it by validating ubuf->pagecount before passing it to kmalloc_array().
--- drivers/dma-buf/udmabuf.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/dma-buf/udmabuf.c +4 -0
@@ -190,6 +190,10 @@ static long udmabuf_create(struct miscdevice *device,if (ubuf->pagecount > pglimit) goto err; } + +if (!ubuf->pagecount) + goto err; + ubuf->pages =kmalloc_array (ubuf->pagecount,sizeof (*ubuf->pages),GFP_KERNEL );if (!ubuf->pages) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 412/1017 bpf: Fix UAF due to race between btf_try_get_module and load_module
In reply to Greg Kroah-HartmanFrom: Kumar Kartikeya Dwivedi <[email protected]>
[ Upstream commit 18688de203b47e5d8d9d0953385bf30b5949324f ]
While working on code to populate kfunc BTF ID sets for module BTF from its initcall, I noticed that by the time the initcall is invoked, the module BTF can already be seen by userspace (and the BPF verifier). The existing btf_try_get_module calls try_module_get which only fails if mod->state == MODULE_STATE_GOING, i.e. it can increment module reference when module initcall is happening in parallel.
Currently, BTF parsing happens from MODULE_STATE_COMING notifier callback. At this point, the module initcalls have not been invoked. The notifier callback parses and prepares the module BTF, allocates an ID, which publishes it to userspace, and then adds it to the btf_modules list allowing the kernel to invoke btf_try_get_module for the BTF.
However, at this point, the module has not been fully initialized (i.e. its initcalls have not finished). The code in module.c can still fail and free the module, without caring for other users. However, nothing stops btf_try_get_module from succeeding between the state transition from MODULE_STATE_COMING to MODULE_STATE_LIVE.
This leads to a use-after-free issue when BPF program loads successfully in the state transition, load_module's do_init_module call fails and frees the module, and BPF program fd on close calls module_put for the freed module. Future patch has test case to verify we don't regress in this area in future.
There are multiple points after prepare_coming_module (in load_module) where failure can occur and module loading can return error. We illustrate and test for the race using the last point where it can practically occur (in module __init function).
An illustration of the race:
CPU 0 CPU 1
load_module
notifier_call(MODULE_STATE_COMING)
btf_parse_module
btf_alloc_id // Published to userspace
list_add(&btf_mod->list, btf_modules)
mod->init(...)
... ^
bpf_check |
check_pseudo_btf_id |
btf_try_get_module |
returns true | ...
... | module __init in progress
return prog_fd | ...
... V
if (ret < 0)
free_module(mod)
...close(prog_fd)
...
bpf_prog_free_deferred
module_put(used_btf.mod) // use-after-free
We fix this issue by setting a flag BTF_MODULE_F_LIVE, from the notifier callback when MODULE_STATE_LIVE state is reached for the module, so that we return NULL from btf_try_get_module for modules that are not fully formed. Since try_module_get already checks that module is not in MODULE_STATE_GOING state, and that is the only transition a live module can make before being removed from btf_modules list, this is enough to close the race and prevent the bug.
A later selftest patch crafts the race condition artifically to verify that it has been fixed, and that verifier fails to load program (with ENXIO).
Lastly, a couple of comments:
1. Even if this race didn't exist, it seems more appropriate to only access resources (ksyms and kfuncs) of a fully formed module which has been initialized completely.
2. This patch was born out of need for synchronization against module initcall for the next patch, so it is needed for correctness even without the aforementioned race condition. The BTF resources initialized by module initcall are set up once and then only looked up, so just waiting until the initcall has finished ensures correct behavior.
--- kernel/bpf/btf.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
kernel/bpf/btf.c +24 -2
@@ -6189,12 +6189,17 @@ bool btf_id_set_contains(const struct btf_id_set *set, u32 id)return bsearch (&id, set->ids, set->cnt,sizeof (u32), btf_id_cmp_func) !=NULL ; } +enum { +BTF_MODULE_F_LIVE = (1 <<0 ), +}; +#ifdef CONFIG_DEBUG_INFO_BTF_MODULES struct btf_module {struct list_head list;struct module *module;struct btf *btf;struct bin_attribute *sysfs_attr; +int flags; };static LIST_HEAD (btf_modules);
@@ -6220,7 +6225,8 @@ static int btf_module_notify(struct notifier_block *nb, unsigned long op,int err =0 ;if (mod->btf_data_size ==0 || - (op !=MODULE_STATE_COMING && op !=MODULE_STATE_GOING )) + (op !=MODULE_STATE_COMING && op !=MODULE_STATE_LIVE && + op !=MODULE_STATE_GOING )) goto out;switch (op) {
@@ -6277,6 +6283,17 @@ static int btf_module_notify(struct notifier_block *nb, unsigned long op, btf_mod->sysfs_attr = attr; } +break ; +case MODULE_STATE_LIVE : +mutex_lock (&btf_module_mutex); +list_for_each_entry_safe (btf_mod, tmp, &btf_modules, list) { +if (btf_mod->module != module) +continue ; + + btf_mod->flags |=BTF_MODULE_F_LIVE ; +break ; + } +mutex_unlock (&btf_module_mutex);break ;case MODULE_STATE_GOING :mutex_lock (&btf_module_mutex);
@@ -6323,7 +6340,12 @@ struct module *btf_try_get_module(const struct btf *btf)if (btf_mod->btf != btf)continue ; -if (try_module_get (btf_mod->module)) +/* We must only consider module whose __init routine has +* finished, hence we must check for BTF_MODULE_F_LIVE flag, +* which is set from the notifier callback for +* MODULE_STATE_LIVE. +*/ +if ((btf_mod->flags &BTF_MODULE_F_LIVE ) &&try_module_get (btf_mod->module)) res = btf_mod->module;break ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 413/1017 drm/selftests/test-drm_dp_mst_helper: Fix memory leak in sideband_msg_req_encode_decode
In reply to Greg Kroah-HartmanFrom: José Expósito <[email protected]>
[ Upstream commit ba3a5ddcf1e5df31f2291006d5297ca62035584f ]
Avoid leaking the "out" variable if it is not possible to allocate the "txmsg" variable.
Addresses-Coverity-ID: 1475685 ("Resource leak")
--- drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/selftests/test-drm_dp_mst_helper.c +3 -1
@@ -131,8 +131,10 @@ sideband_msg_req_encode_decode(struct drm_dp_sideband_msg_req_body *in)return false; txmsg =kzalloc (sizeof (*txmsg),GFP_KERNEL ); -if (!txmsg) +if (!txmsg) { +kfree (out);return false; + }drm_dp_encode_sideband_req (in, txmsg); ret =drm_dp_decode_sideband_req (txmsg, out);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 414/1017 drm/locking: fix drm_modeset_acquire_ctx kernel-doc
In reply to Greg Kroah-HartmanFrom: Jani Nikula <[email protected]>
[ Upstream commit 6f043b5969a4d6d385ca429388ded37e30e0d179 ]
The stack_depot member was added without kernel-doc, leading to below warning. Fix it.
./include/drm/drm_modeset_lock.h:74: warning: Function parameter or member 'stack_depot' not described in 'drm_modeset_acquire_ctx'
--- include/drm/drm_modeset_lock.h | 1 + 1 file changed, 1 insertion(+)
include/drm/drm_modeset_lock.h +1 -0
@@ -34,6 +34,7 @@ struct drm_modeset_lock;* struct drm_modeset_acquire_ctx - locking context (see ww_acquire_ctx) * @ww_ctx: base acquire ctx * @contended: used internally for -EDEADLK handling +* @stack_depot: used internally for contention debugging * @locked: list of held locks * @trylock_only: trylock mode used in atomic contexts/panic notifiers * @interruptible: whether interruptible locking should be used.
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 415/1017 selftests: bpf: Fix bind on used port
In reply to Greg Kroah-HartmanFrom: Felix Maurer <[email protected]>
[ Upstream commit 8c0be0631d81e48f77d0ebf0534c86e32bef5f89 ]
The bind_perm BPF selftest failed when port 111/tcp was already in use during the test. To fix this, the test now runs in its own network name space.
To use unshare, it is necessary to reorder the includes. The style of the includes is adapted to be consistent with the other prog_tests.
v2: Replace deprecated CHECK macro with ASSERT_OK
--- .../selftests/bpf/prog_tests/bind_perm.c | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
tools/testing/selftests/bpf/prog_tests/bind_perm.c +17 -3
@@ -1,13 +1,24 @@// SPDX-License-Identifier: GPL-2.0 -#include <test_progs.h> -#include "bind_perm.skel.h" - +#define _GNU_SOURCE +#include <sched.h> +#include <stdlib.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/capability.h> +#include "test_progs.h" +#include "bind_perm.skel.h" +static int duration; +static int create_netns (void ) +{ +if (!ASSERT_OK (unshare (CLONE_NEWNET ),"create netns" )) +return -1 ; + +return 0 ; +} +void try_bind (int family,int port,int expected_errno) {struct sockaddr_storage addr = {};
@@ -75,6 +86,9 @@ void test_bind_perm(void)struct bind_perm *skel;int cgroup_fd; +if (create_netns ()) +return ; + cgroup_fd =test__join_cgroup ("/bind_perm" );if (CHECK (cgroup_fd <0 ,"cg-join" ,"errno %d" , errno))return ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 416/1017 Bluetooth: btintel: Fix WBS setting for Intel legacy ROM products
In reply to Greg Kroah-HartmanFrom: Tedd Ho-Jeong An <[email protected]>
[ Upstream commit 55235304c2560d4a94ccfff2a47ea927b4114064 ]
This patch adds the flag to identify the Intel legacy ROM products that don't support WBS like WP and StP.
--- drivers/bluetooth/btintel.c | 11 ++++++++--- drivers/bluetooth/btintel.h | 1 + drivers/bluetooth/btusb.c | 6 ++++++ 3 files changed, 15 insertions(+), 3 deletions(-)
drivers/bluetooth/btintel.c +8 -3
@@ -2426,10 +2426,15 @@ static int btintel_setup_combined(struct hci_dev *hdev)/* Apply the device specific HCI quirks * -* WBS for SdP - SdP and Stp have a same hw_varaint but -* different fw_variant +* WBS for SdP - For the Legacy ROM products, only SdP +* supports the WBS. But the version information is not +* enough to use here because the StP2 and SdP have same +* hw_variant and fw_variant. So, this flag is set by +* the transport driver (btusb) based on the HW info +* (idProduct) */ -if (ver.hw_variant ==0x08 && ver.fw_variant ==0x22 ) +if (!btintel_test_flag (hdev, +INTEL_ROM_LEGACY_NO_WBS_SUPPORT ))set_bit (HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED , &hdev->quirks);
drivers/bluetooth/btintel.h +1 -0
@@ -152,6 +152,7 @@ enum {INTEL_BROKEN_INITIAL_NCMD ,INTEL_BROKEN_SHUTDOWN_LED ,INTEL_ROM_LEGACY , +INTEL_ROM_LEGACY_NO_WBS_SUPPORT , __INTEL_NUM_FLAGS, };
drivers/bluetooth/btusb.c +6 -0
@@ -61,6 +61,7 @@ static struct usb_driver btusb_driver;#define BTUSB_QCA_WCN6855 0x1000000#define BTUSB_INTEL_BROKEN_SHUTDOWN_LED 0x2000000#define BTUSB_INTEL_BROKEN_INITIAL_NCMD 0x4000000 +#define BTUSB_INTEL_NO_WBS_SUPPORT 0x8000000static const struct usb_device_id btusb_table[] = {/* Generic Bluetooth USB device */
@@ -384,9 +385,11 @@ static const struct usb_device_id blacklist_table[] = { { USB_DEVICE(0x8087, 0x0033), .driver_info = BTUSB_INTEL_COMBINED }, { USB_DEVICE(0x8087, 0x07da), .driver_info = BTUSB_CSR }, { USB_DEVICE(0x8087, 0x07dc), .driver_info = BTUSB_INTEL_COMBINED | +BTUSB_INTEL_NO_WBS_SUPPORT |BTUSB_INTEL_BROKEN_INITIAL_NCMD | BTUSB_INTEL_BROKEN_SHUTDOWN_LED }, { USB_DEVICE(0x8087, 0x0a2a), .driver_info = BTUSB_INTEL_COMBINED | +BTUSB_INTEL_NO_WBS_SUPPORT | BTUSB_INTEL_BROKEN_SHUTDOWN_LED }, { USB_DEVICE(0x8087, 0x0a2b), .driver_info = BTUSB_INTEL_COMBINED }, { USB_DEVICE(0x8087, 0x0aa7), .driver_info = BTUSB_INTEL_COMBINED |
@@ -3902,6 +3905,9 @@ static int btusb_probe(struct usb_interface *intf, hdev->send = btusb_send_frame_intel; hdev->cmd_timeout = btusb_intel_cmd_timeout; +if (id->driver_info &BTUSB_INTEL_NO_WBS_SUPPORT ) +btintel_set_flag (hdev,INTEL_ROM_LEGACY_NO_WBS_SUPPORT ); +if (id->driver_info &BTUSB_INTEL_BROKEN_INITIAL_NCMD )btintel_set_flag (hdev,INTEL_BROKEN_INITIAL_NCMD );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 417/1017 Bluetooth: hci_serdev: call init_rwsem() before p->open()
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 9d7cbe2b9cf5f650067df4f402fdd799d4bbb4e1 ]
kvartet reported, that hci_uart_tx_wakeup() uses uninitialized rwsem. The problem was in wrong place for percpu_init_rwsem() call.
hci_uart_proto::open() may register a timer whose callback may call hci_uart_tx_wakeup(). There is a chance, that hci_uart_register_device() thread won't be fast enough to call percpu_init_rwsem().
Fix it my moving percpu_init_rwsem() call before p->open().
INFO: trying to register non-static key.
The code is fine but needs lockdep annotation, or maybe you didn't initialize this object before use? turning off the locking correctness validator.
CPU: 2 PID: 18524 Comm: syz-executor.5 Not tainted 5.16.0-rc6 #9 ... Call Trace: <IRQ> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 assign_lock_key kernel/locking/lockdep.c:951 [inline] register_lock_class+0x148d/0x1950 kernel/locking/lockdep.c:1263 __lock_acquire+0x106/0x57e0 kernel/locking/lockdep.c:4906 lock_acquire kernel/locking/lockdep.c:5637 [inline] lock_acquire+0x1ab/0x520 kernel/locking/lockdep.c:5602 percpu_down_read_trylock include/linux/percpu-rwsem.h:92 [inline] hci_uart_tx_wakeup+0x12e/0x490 drivers/bluetooth/hci_ldisc.c:124 h5_timed_event+0x32f/0x6a0 drivers/bluetooth/hci_h5.c:188 call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1421
--- drivers/bluetooth/hci_serdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/bluetooth/hci_serdev.c +2 -1
@@ -305,6 +305,8 @@ int hci_uart_register_device(struct hci_uart *hu,if (err)return err; +percpu_init_rwsem (&hu->proto_lock); + err = p->open (hu);if (err) goto err_open;
@@ -327,7 +329,6 @@ int hci_uart_register_device(struct hci_uart *hu,INIT_WORK (&hu->init_ready, hci_uart_init_work);INIT_WORK (&hu->write_work, hci_uart_write_work); -percpu_init_rwsem (&hu->proto_lock);/* Only when vendor specific setup callback is provided, consider * the manufacturer information valid. This avoids filling in the
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 418/1017 mtd: onenand: Check for error irq
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 3e68f331c8c759c0daa31cc92c3449b23119a215 ]
For the possible failure of the platform_get_irq(), the returned irq could be error number and will finally cause the failure of the request_irq().
Consider that platform_get_irq() can now in certain cases return -EPROBE_DEFER, and the consequences of letting request_irq() effectively convert that into -EINVAL, even at probe time rather than later on. So it might be better to check just now.
--- drivers/mtd/nand/onenand/generic.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/mtd/nand/onenand/generic.c +6 -1
@@ -53,7 +53,12 @@ static int generic_onenand_probe(struct platform_device *pdev) } info->onenand.mmcontrol = pdata ? pdata->mmcontrol :NULL ; - info->onenand.irq =platform_get_irq (pdev,0 ); + + err =platform_get_irq (pdev,0 ); +if (err <0 ) + goto out_iounmap; + + info->onenand.irq = err; info->mtd.dev.parent = &pdev->dev; info->mtd.priv = &info->onenand;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 419/1017 mtd: rawnand: gpmi: fix controller timings setting
In reply to Greg Kroah-HartmanFrom: Dario Binacchi <[email protected]>
[ Upstream commit 2970bf5a32f079e1e9197411db4fe9faccb1503a ]
Set the controller registers according to the real clock rate. The controller registers configuration (setup, hold, timeout, ... cycles) depends on the clock rate of the GPMI. Using the real rate instead of the ideal one, avoids that this inaccuracy (required_rate - real_rate) affects the registers setting.
This patch has been tested on two custom boards with i.MX28 and i.MX6 SOCs:
- i.MX28:
required rate 100MHz, real rate 99.3MHz
- i.MX6
required rate 100MHz, real rate 99MHz
--- drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c +3 -0
@@ -648,6 +648,7 @@ static void gpmi_nfc_compute_timings(struct gpmi_nand_data *this, const struct nand_sdr_timings *sdr) {struct gpmi_nfc_hardware_timing *hw = &this->hw; +struct resources *r = &this->resources;unsigned int dll_threshold_ps = this->devdata->max_chain_delay;unsigned int period_ps, reference_period_ps;unsigned int data_setup_cycles, data_hold_cycles, addr_setup_cycles;
@@ -671,6 +672,8 @@ static void gpmi_nfc_compute_timings(struct gpmi_nand_data *this, wrn_dly_sel =BV_GPMI_CTRL1_WRN_DLY_SEL_NO_DELAY ; } + hw->clk_rate =clk_round_rate (r->clock[0 ], hw->clk_rate); +/* SDR core timings are given in picoseconds */ period_ps =div_u64 ((u64 )NSEC_PER_SEC *1000 , hw->clk_rate);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 420/1017 selftests, xsk: Fix rx_full stats test
In reply to Greg Kroah-HartmanFrom: Magnus Karlsson <[email protected]>
[ Upstream commit b4ec6a19231224f6b08dc54ea07da4c4090e8ee3 ]
Fix the rx_full stats test so that it correctly reports pass even when the fill ring is not full of buffers.
--- tools/testing/selftests/bpf/xdpxceiver.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tools/testing/selftests/bpf/xdpxceiver.c +4 -1
@@ -902,7 +902,10 @@ static bool rx_stats_are_valid(struct ifobject *ifobject)return true;case STAT_TEST_RX_FULL : xsk_stat = stats.rx_ring_full; - expected_stat -=RX_FULL_RXQSIZE ; +if (ifobject->umem->num_frames <XSK_RING_PROD__DEFAULT_NUM_DESCS ) + expected_stat = ifobject->umem->num_frames -RX_FULL_RXQSIZE ; +else + expected_stat =XSK_RING_PROD__DEFAULT_NUM_DESCS -RX_FULL_RXQSIZE ;break ;case STAT_TEST_RX_FILL_EMPTY : xsk_stat = stats.rx_fill_ring_empty_descs;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 421/1017 drm/edid: Dont clear formats if using deep color
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
[ Upstream commit 75478b3b393bcbdca4e6da76fe3a9f1a4133ec5d ]
The current code, when parsing the EDID Deep Color depths, that the YUV422 cannot be used, referring to the HDMI 1.3 Specification.
This specification, in its section 6.2.4, indeed states:
For each supported Deep Color mode, RGB 4:4:4 shall be supported and optionally YCBCR 4:4:4 may be supported.
YCBCR 4:2:2 is not permitted for any Deep Color mode.
This indeed can be interpreted like the code does, but the HDMI 1.4 specification further clarifies that statement in its section 6.2.4:
For each supported Deep Color mode, RGB 4:4:4 shall be supported and optionally YCBCR 4:4:4 may be supported.
YCBCR 4:2:2 is also 36-bit mode but does not require the further use of the Deep Color modes described in section 6.5.2 and 6.5.3.
This means that, even though YUV422 can be used with 12 bit per color, it shouldn't be treated as a deep color mode.
This is also broken with YUV444 if it's supported by the display, but DRM_EDID_HDMI_DC_Y444 isn't set. In such a case, the code will clear color_formats of the YUV444 support set previously in drm_parse_cea_ext(), but will not set it back.
Since the formats supported are already setup properly in drm_parse_cea_ext(), let's just remove the code modifying the formats in drm_parse_hdmi_deep_color_info()
--- drivers/gpu/drm/drm_edid.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/gpu/drm/drm_edid.c +0 -8
@@ -5105,16 +5105,8 @@ static void drm_parse_hdmi_deep_color_in connector->name, dc_bpc); info->bpc = dc_bpc; -/* -* Deep color support mandates RGB444 support for all video -* modes and forbids YCRCB422 support for all video modes per -* HDMI 1.3 spec. -*/ - info->color_formats =DRM_COLOR_FORMAT_RGB444 ; -/* YCRCB444 is optional according to spec. */ if (hdmi[6 ] &DRM_EDID_HDMI_DC_Y444 ) { - info->color_formats |=DRM_COLOR_FORMAT_YCRCB444 ;DRM_DEBUG ("%s: HDMI sink does YCRCB444 in deep color.\n" , connector->name); }
Greg Kroah-Hartman
maintainerPATCH 422/1017 drm/edid: Split deep color modes between RGB and YUV444
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
[ Upstream commit 4adc33f36d80489339f1b43dfeee96bb9ea8e459 ]
The current code assumes that the RGB444 and YUV444 formats are the same, but the HDMI 2.0 specification states that:
The three DC_XXbit bits above only indicate support for RGB 4:4:4 at that pixel size. Support for YCBCR 4:4:4 in Deep Color modes is indicated with the DC_Y444 bit. If DC_Y444 is set, then YCBCR 4:4:4 is supported for all modes indicated by the DC_XXbit flags.
So if we have YUV444 support and any DC_XXbit flag set but the DC_Y444 flag isn't, we'll assume that we support that deep colour mode for YUV444 which breaks the specification.
In order to fix this, let's split the edid_hdmi_dc_modes field in struct drm_display_info into two fields, one for RGB444 and one for YUV444.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 2 +- drivers/gpu/drm/drm_edid.c | 7 ++++--- drivers/gpu/drm/i915/display/intel_hdmi.c | 4 ++-- drivers/gpu/drm/radeon/radeon_connectors.c | 2 +- include/drm/drm_connector.h | 12 +++++++++--- 5 files changed, 17 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +1 -1
@@ -175,7 +175,7 @@ int amdgpu_connector_get_monitor_bpc(str/* Check if bpc is within clock limit. Try to degrade gracefully otherwise */ if ((bpc ==12 ) && (mode_clock *3 /2 > max_tmds_clock)) { -if ((connector->display_info.edid_hdmi_dc_modes &DRM_EDID_HDMI_DC_30 ) && +if ((connector->display_info.edid_hdmi_rgb444_dc_modes &DRM_EDID_HDMI_DC_30 ) && (mode_clock *5 /4 <= max_tmds_clock)) bpc =10 ;else
drivers/gpu/drm/drm_edid.c +4 -3
@@ -5076,21 +5076,21 @@ static void drm_parse_hdmi_deep_color_inif (hdmi[6 ] &DRM_EDID_HDMI_DC_30 ) { dc_bpc =10 ; - info->edid_hdmi_dc_modes |=DRM_EDID_HDMI_DC_30 ; + info->edid_hdmi_rgb444_dc_modes |=DRM_EDID_HDMI_DC_30 ;DRM_DEBUG ("%s: HDMI sink does deep color 30.\n" , connector->name); }if (hdmi[6 ] &DRM_EDID_HDMI_DC_36 ) { dc_bpc =12 ; - info->edid_hdmi_dc_modes |=DRM_EDID_HDMI_DC_36 ; + info->edid_hdmi_rgb444_dc_modes |=DRM_EDID_HDMI_DC_36 ;DRM_DEBUG ("%s: HDMI sink does deep color 36.\n" , connector->name); }if (hdmi[6 ] &DRM_EDID_HDMI_DC_48 ) { dc_bpc =16 ; - info->edid_hdmi_dc_modes |=DRM_EDID_HDMI_DC_48 ; + info->edid_hdmi_rgb444_dc_modes |=DRM_EDID_HDMI_DC_48 ;DRM_DEBUG ("%s: HDMI sink does deep color 48.\n" , connector->name); }
@@ -5107,6 +5107,7 @@ static void drm_parse_hdmi_deep_color_in/* YCRCB444 is optional according to spec. */ if (hdmi[6 ] &DRM_EDID_HDMI_DC_Y444 ) { + info->edid_hdmi_ycbcr444_dc_modes = info->edid_hdmi_rgb444_dc_modes;DRM_DEBUG ("%s: HDMI sink does YCRCB444 in deep color.\n" , connector->name); }
drivers/gpu/drm/i915/display/intel_hdmi.c +2 -2
@@ -1892,7 +1892,7 @@ static bool intel_hdmi_bpc_possible(struif (ycbcr420_output)return hdmi->y420_dc_modes &DRM_EDID_YCBCR420_DC_36 ;else -return info->edid_hdmi_dc_modes &DRM_EDID_HDMI_DC_36 ; +return info->edid_hdmi_rgb444_dc_modes &DRM_EDID_HDMI_DC_36 ;case 10 :if (DISPLAY_VER (i915) <11 )return false;
@@ -1903,7 +1903,7 @@ static bool intel_hdmi_bpc_possible(struif (ycbcr420_output)return hdmi->y420_dc_modes &DRM_EDID_YCBCR420_DC_30 ;else -return info->edid_hdmi_dc_modes &DRM_EDID_HDMI_DC_30 ; +return info->edid_hdmi_rgb444_dc_modes &DRM_EDID_HDMI_DC_30 ;case 8 :return true;default :
drivers/gpu/drm/radeon/radeon_connectors.c +1 -1
@@ -204,7 +204,7 @@ int radeon_get_monitor_bpc(struct drm_co/* Check if bpc is within clock limit. Try to degrade gracefully otherwise */ if ((bpc ==12 ) && (mode_clock *3 /2 > max_tmds_clock)) { -if ((connector->display_info.edid_hdmi_dc_modes &DRM_EDID_HDMI_DC_30 ) && +if ((connector->display_info.edid_hdmi_rgb444_dc_modes &DRM_EDID_HDMI_DC_30 ) && (mode_clock *5 /4 <= max_tmds_clock)) bpc =10 ;else
include/drm/drm_connector.h +9 -3
@@ -566,10 +566,16 @@ struct drm_display_info {bool rgb_quant_range_selectable;/** -* @edid_hdmi_dc_modes: Mask of supported hdmi deep color modes. Even -* more stuff redundant with @bus_formats. +* @edid_hdmi_dc_rgb444_modes: Mask of supported hdmi deep color modes +* in RGB 4:4:4. Even more stuff redundant with @bus_formats. */ -u8 edid_hdmi_dc_modes; +u8 edid_hdmi_rgb444_dc_modes; + +/** +* @edid_hdmi_dc_ycbcr444_modes: Mask of supported hdmi deep color +* modes in YCbCr 4:4:4. Even more stuff redundant with @bus_formats. +*/ +u8 edid_hdmi_ycbcr444_dc_modes;/** * @cea_rev: CEA revision of the HDMI sink.
Greg Kroah-Hartman
maintainerPATCH 423/1017 ionic: fix type complaint in ionic_dev_cmd_clean()
In reply to Greg Kroah-HartmanFrom: Shannon Nelson <[email protected]>
[ Upstream commit bc0bf9de6f48268f4ee59e57fb42ac751be3ecda ]
Sparse seems to have gotten a little more picky lately and we need to revisit this bit of code to make sparse happy.
warning: incorrect type in initializer (different address spaces)
expected union ionic_dev_cmd_regs *regs
got union ionic_dev_cmd_regs [noderef] __iomem *dev_cmd_regs
warning: incorrect type in argument 2 (different address spaces)
expected void [noderef] __iomem *
got unsigned int *
warning: incorrect type in argument 1 (different address spaces)
expected void volatile [noderef] __iomem *
got union ionic_dev_cmd *
--- drivers/net/ethernet/pensando/ionic/ionic_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/pensando/ionic/ionic_main.c +3 -3
@@ -370,10 +370,10 @@ int ionic_adminq_post_wait_nomsg(struct ionic_lif *lif, struct ionic_admin_ctx *static void ionic_dev_cmd_clean (struct ionic *ionic) { -union __iomem ionic_dev_cmd_regs *regs = ionic->idev.dev_cmd_regs; +struct ionic_dev *idev = &ionic->idev; -iowrite32 (0 , ®s->doorbell); -memset_io (®s->cmd,0 ,sizeof (regs->cmd)); +iowrite32 (0 , &idev->dev_cmd_regs->doorbell); +memset_io (&idev->dev_cmd_regs->cmd,0 ,sizeof (idev->dev_cmd_regs->cmd)); }int ionic_dev_cmd_wait (struct ionic *ionic,unsigned long max_seconds)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 424/1017 ionic: start watchdog after all is setup
In reply to Greg Kroah-HartmanFrom: Shannon Nelson <[email protected]>
[ Upstream commit 9ad2939a1525962a79a2fd974ec7e3a71455b964 ]
The watchdog expects the lif to fully exist when it goes off, so lets not start the watchdog until all is ready in case there is some quirky time dialation that makes probe take multiple seconds.
--- drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c | 4 +++- drivers/net/ethernet/pensando/ionic/ionic_dev.c | 3 --- 2 files changed, 3 insertions(+), 4 deletions(-)
drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c +3 -1
@@ -331,6 +331,9 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto err_out_deregister_lifs; } +mod_timer (&ionic->watchdog_timer, +round_jiffies (jiffies + ionic->watchdog_period)); +return 0 ; err_out_deregister_lifs:
@@ -348,7 +351,6 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) err_out_reset:ionic_reset (ionic); err_out_teardown: -del_timer_sync (&ionic->watchdog_timer);pci_clear_master (pdev);/* Don't fail the probe for these errors, keep * the hw interface around for inspection
drivers/net/ethernet/pensando/ionic/ionic_dev.c +0 -3
@@ -122,9 +122,6 @@ int ionic_dev_setup(struct ionic *ionic) idev->fw_generation =IONIC_FW_STS_F_GENERATION &ioread8 (&idev->dev_info_regs->fw_status); -mod_timer (&ionic->watchdog_timer, -round_jiffies (jiffies + ionic->watchdog_period)); - idev->db_pages = bar->vaddr; idev->phy_db_pages = bar->bus_addr;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 425/1017 ionic: Dont send reset commands if FW isnt running
In reply to Greg Kroah-HartmanFrom: Brett Creeley <[email protected]>
[ Upstream commit b8fd0271dad00b953caaabe73474788d3d19e252 ]
It's possible the FW is already shutting down while the driver is being removed and/or when the driver is going through reset. This can cause unexpected/unnecessary errors to be printed:
eth0: DEV_CMD IONIC_CMD_PORT_RESET (12) error, IONIC_RC_ERROR (29) failed
eth1: DEV_CMD IONIC_CMD_RESET (3) error, IONIC_RC_ERROR (29) failed
Fix this by checking the FW status register before issuing the reset commands.
Also, since err may not be assigned in ionic_port_reset(), assign it a default value of 0, and remove an unnecessary log message.
--- .../net/ethernet/pensando/ionic/ionic_dev.c | 17 ++++++++++++----- .../net/ethernet/pensando/ionic/ionic_dev.h | 1 + .../net/ethernet/pensando/ionic/ionic_main.c | 18 ++++++++++-------- 3 files changed, 23 insertions(+), 13 deletions(-)
drivers/net/ethernet/pensando/ionic/ionic_dev.c +12 -5
@@ -129,6 +129,16 @@ int ionic_dev_setup(struct ionic *ionic) }/* Devcmd Interface */ +bool ionic_is_fw_running (struct ionic_dev *idev) +{ +u8 fw_status =ioread8 (&idev->dev_info_regs->fw_status); + +/* firmware is useful only if the running bit is set and +* fw_status != 0xff (bad PCI read) +*/ +return (fw_status !=0xff ) && (fw_status &IONIC_FW_STS_F_RUNNING ); +} +int ionic_heartbeat_check (struct ionic *ionic) {struct ionic_dev *idev = &ionic->idev;
@@ -152,13 +162,10 @@ int ionic_heartbeat_check(struct ionic *ionic) goto do_check_time; } -/* firmware is useful only if the running bit is set and -* fw_status != 0xff (bad PCI read) -* If fw_status is not ready don't bother with the generation. -*/ fw_status =ioread8 (&idev->dev_info_regs->fw_status); -if (fw_status ==0xff || !(fw_status &IONIC_FW_STS_F_RUNNING )) { +/* If fw_status is not ready don't bother with the generation */ +if (!ionic_is_fw_running (idev)) { fw_status_ready = false; }else { fw_generation = fw_status &IONIC_FW_STS_F_GENERATION ;
drivers/net/ethernet/pensando/ionic/ionic_dev.h +1 -0
@@ -353,5 +353,6 @@ void ionic_q_rewind(struct ionic_queue *q, struct ionic_desc_info *start);void ionic_q_service (struct ionic_queue *q,struct ionic_cq_info *cq_info,unsigned int stop_index);int ionic_heartbeat_check (struct ionic *ionic); +bool ionic_is_fw_running (struct ionic_dev *idev);#endif /* _IONIC_DEV_H_ */
drivers/net/ethernet/pensando/ionic/ionic_main.c +10 -8
@@ -540,6 +540,9 @@ int ionic_reset(struct ionic *ionic)struct ionic_dev *idev = &ionic->idev;int err; +if (!ionic_is_fw_running (idev)) +return 0 ; +mutex_lock (&ionic->dev_cmd_lock);ionic_dev_cmd_reset (idev); err =ionic_dev_cmd_wait (ionic,DEVCMD_TIMEOUT );
@@ -612,15 +615,17 @@ int ionic_port_init(struct ionic *ionic)int ionic_port_reset (struct ionic *ionic) {struct ionic_dev *idev = &ionic->idev; -int err; +int err =0 ;if (!idev->port_info)return 0 ; -mutex_lock (&ionic->dev_cmd_lock); -ionic_dev_cmd_port_reset (idev); - err =ionic_dev_cmd_wait (ionic,DEVCMD_TIMEOUT ); -mutex_unlock (&ionic->dev_cmd_lock); +if (ionic_is_fw_running (idev)) { +mutex_lock (&ionic->dev_cmd_lock); +ionic_dev_cmd_port_reset (idev); + err =ionic_dev_cmd_wait (ionic,DEVCMD_TIMEOUT ); +mutex_unlock (&ionic->dev_cmd_lock); + }dma_free_coherent (ionic->dev, idev->port_info_sz, idev->port_info, idev->port_info_pa);
@@ -628,9 +633,6 @@ int ionic_port_reset(struct ionic *ionic) idev->port_info =NULL ; idev->port_info_pa =0 ; -if (err) -dev_err (ionic->dev,"Failed to reset port\n" ); -return err; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 426/1017 ionic: fix up printing of timeout error
In reply to Greg Kroah-HartmanFrom: Shannon Nelson <[email protected]>
[ Upstream commit 4cc787bd88be6974f3362fa49fd8c5609bd039b8 ]
Make sure we print the TIMEOUT string if we had a timeout error, rather than printing the wrong status.
--- drivers/net/ethernet/pensando/ionic/ionic_main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/pensando/ionic/ionic_main.c +6 -2
@@ -215,9 +215,13 @@ static void ionic_adminq_flush(struct ionic_lif *lif)void ionic_adminq_netdev_err_print (struct ionic_lif *lif,u8 opcode,u8 status,int err) { +const char *stat_str; + + stat_str = (err == -ETIMEDOUT ) ?"TIMEOUT" : +ionic_error_to_str (status); +netdev_err (lif->netdev,"%s (%d) failed: %s (%d)\n" , -ionic_opcode_to_str (opcode), opcode, -ionic_error_to_str (status), err); +ionic_opcode_to_str (opcode), opcode, stat_str, err); } static int ionic_adminq_check_err(struct ionic_lif *lif,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 427/1017 ionic: Correctly print AQ errors if completions arent received
In reply to Greg Kroah-HartmanFrom: Brett Creeley <[email protected]>
[ Upstream commit bc43ed4f35abfdb1d52311110d49b545fccce975 ]
Recent changes went into the driver to allow flexibility when printing error messages. Unfortunately this had the unexpected consequence of printing confusing messages like the following:
IONIC_CMD_RX_FILTER_ADD (31) failed: IONIC_RC_SUCCESS (-6)
In cases like this the completion of the admin queue command never completes, so the completion status is 0, hence IONIC_RC_SUCCESS is printed even though the command clearly failed. For example, this could happen when the driver tries to add a filter and at the same time the FW goes through a reset, so the AQ command never completes.
Fix this by forcing the FW completion status to IONIC_RC_ERROR in cases where we never get the completion.
--- drivers/net/ethernet/pensando/ionic/ionic_main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/pensando/ionic/ionic_main.c +2 -0
@@ -322,6 +322,7 @@ int ionic_adminq_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx,if (do_msg && !test_bit (IONIC_LIF_F_FW_RESET , lif->state))netdev_err (netdev,"Posting of %s (%d) failed: %d\n" , name, ctx->cmd.cmd.opcode, err); + ctx->comp.comp.status =IONIC_RC_ERROR ;return err; }
@@ -340,6 +341,7 @@ int ionic_adminq_wait(struct ionic_lif *lif, struct ionic_admin_ctx *ctx,if (do_msg)netdev_err (netdev,"%s (%d) interrupted, FW in reset\n" , name, ctx->cmd.cmd.opcode); + ctx->comp.comp.status =IONIC_RC_ERROR ;return -ENXIO ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 428/1017 drm/nouveau/acr: Fix undefined behavior in nvkm_acr_hsfw_load_bl()
In reply to Greg Kroah-HartmanFrom: Zhou Qingyang <[email protected]>
[ Upstream commit 2343bcdb4747d4f418a4daf2e898b94f86c24a59 ]
In nvkm_acr_hsfw_load_bl(), the return value of kmalloc() is directly passed to memcpy(), which could lead to undefined behavior on failure of kmalloc().
Fix this bug by using kmemdup() instead of kmalloc()+memcpy().
This bug was found by a static analyzer.
Builds with 'make allyesconfig' show no new warnings, and our static analyzer no longer warns about this code.
--- drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/acr/hsfw.c +5 -4
@@ -142,11 +142,12 @@ nvkm_acr_hsfw_load_bl(struct nvkm_acr *acr, const char *name, int ver, hsfw->imem_size = desc->code_size; hsfw->imem_tag = desc->start_tag; - hsfw->imem =kmalloc (desc->code_size,GFP_KERNEL ); -memcpy (hsfw->imem, data + desc->code_off, desc->code_size); - + hsfw->imem =kmemdup (data + desc->code_off, desc->code_size,GFP_KERNEL );nvkm_firmware_put (fw); -return 0 ; +if (!hsfw->imem) +return -ENOMEM ; +else +return 0 ; }int
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 429/1017 drm/amd/display: Fix a NULL pointer dereference in amdgpu_dm_connector_add_common_modes()
In reply to Greg Kroah-HartmanFrom: Zhou Qingyang <[email protected]>
[ Upstream commit 588a70177df3b1777484267584ef38ab2ca899a2 ]
In amdgpu_dm_connector_add_common_modes(), amdgpu_dm_create_common_mode() is assigned to mode and is passed to drm_mode_probed_add() directly after that. drm_mode_probed_add() passes &mode->head to list_add_tail(), and there is a dereference of it in list_add_tail() without recoveries, which could lead to NULL pointer dereference on failure of amdgpu_dm_create_common_mode().
Fix this by adding a NULL check of mode.
This bug was found by a static analyzer.
Builds with 'make allyesconfig' show no new warnings, and our static analyzer no longer warns about this code.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -0
@@ -8030,6 +8030,9 @@ static void amdgpu_dm_connector_add_common_modes(struct drm_encoder *encoder, mode =amdgpu_dm_create_common_mode (encoder, common_modes[i].name, common_modes[i].w, common_modes[i].h); +if (!mode) +continue ; +drm_mode_probed_add (connector, mode); amdgpu_dm_connector->num_modes++; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 430/1017 drm/amd/pm: return -ENOTSUPP if there is no get_dpm_ultimate_freq function
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
[ Upstream commit 430e6a0212b2a0eb1de5e9d47a016fa79edf3978 ]
clang static analysis reports this represenative problem amdgpu_smu.c:144:18: warning: The left operand of '*' is a garbage value
return clk_freq * 100;
~~~~~~~~ ^If there is no get_dpm_ultimate_freq function, smu_get_dpm_freq_range returns success without setting the output min,max parameters. So return an -ENOTSUPP error.
--- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +1 -1
@@ -138,7 +138,7 @@ int smu_get_dpm_freq_range(struct smu_context *smu,uint32_t *min, uint32_t *max) { - int ret = 0; + int ret = -ENOTSUPP;if (!min && !max)return -EINVAL ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 431/1017 net: phy: at803x: move page selection fix to config_init
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
[ Upstream commit 4f3a00c7f5b2cfe4e127fd3fe49b55e1b318c01f ]
The fix to select the copper page on AR8031 was being done in the probe function rather than config_init, so it would not be redone after resume from suspend. Move this to config_init so it is always redone when needed.
--- drivers/net/phy/at803x.c | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-)
drivers/net/phy/at803x.c +16 -24
@@ -784,25 +784,7 @@ static int at803x_probe(struct phy_device *phydev)return ret; } -/* Some bootloaders leave the fiber page selected. -* Switch to the copper page, as otherwise we read -* the PHY capabilities from the fiber side. -*/ -if (phydev->drv->phy_id ==ATH8031_PHY_ID ) { -phy_lock_mdio_bus (phydev); - ret =at803x_write_page (phydev,AT803X_PAGE_COPPER ); -phy_unlock_mdio_bus (phydev); -if (ret) - goto err; - } -return 0 ; - -err: -if (priv->vddio) -regulator_disable (priv->vddio); - -return ret; }static void at803x_remove (struct phy_device *phydev)
@@ -912,6 +894,22 @@ static int at803x_config_init(struct phy_device *phydev) {int ret; +if (phydev->drv->phy_id ==ATH8031_PHY_ID ) { +/* Some bootloaders leave the fiber page selected. +* Switch to the copper page, as otherwise we read +* the PHY capabilities from the fiber side. +*/ +phy_lock_mdio_bus (phydev); + ret =at803x_write_page (phydev,AT803X_PAGE_COPPER ); +phy_unlock_mdio_bus (phydev); +if (ret) +return ret; + + ret =at8031_pll_config (phydev); +if (ret <0 ) +return ret; + } +/* The RX and TX delay default is: * after HW reset: RX delay enabled and TX delay disabled * after SW reset: RX delay enabled, while TX delay retains the
@@ -941,12 +939,6 @@ static int at803x_config_init(struct phy_device *phydev)if (ret <0 )return ret; -if (phydev->drv->phy_id ==ATH8031_PHY_ID ) { - ret =at8031_pll_config (phydev); -if (ret <0 ) -return ret; - } -/* Ar803x extended next page bit is enabled by default. Cisco * multigig switches read this bit and attempt to negotiate 10Gbps * rates even if the next page bit is disabled. This is incorrect
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 432/1017 selftests/bpf/test_xdp_redirect_multi: use temp netns for testing
In reply to Greg Kroah-HartmanFrom: Hangbin Liu <[email protected]>
[ Upstream commit cec74489a8dee93053340ec88ea938ff4008c3c0 ]
Use temp netns instead of hard code name for testing in case the netns already exists.
Remove the hard code interface index when creating the veth interfaces. Because when the system loads some virtual interface modules, e.g. tunnels. the ifindex of 2 will be used and the cmd will fail.
As the netns has not created if checking environment failed. Trap the clean up function after checking env.
--- .../selftests/bpf/test_xdp_redirect_multi.sh | 60 ++++++++++--------- 1 file changed, 31 insertions(+), 29 deletions(-)
tools/testing/selftests/bpf/test_xdp_redirect_multi.sh +31 -29
@@ -32,6 +32,11 @@ DRV_MODE="xdpgeneric xdpdrv xdpegress" PASS=0 FAIL=0 LOG_DIR=$(mktemp -d) +declare -a NS +NS[0]="ns0-$(mktemp -u XXXXXX)" +NS[1]="ns1-$(mktemp -u XXXXXX)" +NS[2]="ns2-$(mktemp -u XXXXXX)" +NS[3]="ns3-$(mktemp -u XXXXXX)" test_pass() {
@@ -47,11 +52,9 @@ test_fail() clean_up() { - for i in $(seq $NUM); do - ip link del veth$i 2> /dev/null - ip netns del ns$i 2> /dev/null + for i in $(seq 0 $NUM); do + ip netns del ${NS[$i]} 2> /dev/null done - ip netns del ns0 2> /dev/null } # Kselftest framework requirement - SKIP code is 4.
@@ -79,23 +82,22 @@ setup_ns() mode="xdpdrv" fi - ip netns add ns0 + ip netns add ${NS[0]} for i in $(seq $NUM); do - ip netns add ns$i - ip -n ns$i link add veth0 index 2 type veth \ - peer name veth$i netns ns0 index $((1 + $i)) - ip -n ns0 link set veth$i up - ip -n ns$i link set veth0 up - - ip -n ns$i addr add 192.0.2.$i/24 dev veth0 - ip -n ns$i addr add 2001:db8::$i/64 dev veth0 + ip netns add ${NS[$i]} + ip -n ${NS[$i]} link add veth0 type veth peer name veth$i netns ${NS[0]} + ip -n ${NS[$i]} link set veth0 up + ip -n ${NS[0]} link set veth$i up + + ip -n ${NS[$i]} addr add 192.0.2.$i/24 dev veth0 + ip -n ${NS[$i]} addr add 2001:db8::$i/64 dev veth0 # Add a neigh entry for IPv4 ping test - ip -n ns$i neigh add 192.0.2.253 lladdr 00:00:00:00:00:01 dev veth0 - ip -n ns$i link set veth0 $mode obj \ + ip -n ${NS[$i]} neigh add 192.0.2.253 lladdr 00:00:00:00:00:01 dev veth0 + ip -n ${NS[$i]} link set veth0 $mode obj \ xdp_dummy.o sec xdp &> /dev/null || \ { test_fail "Unable to load dummy xdp" && exit 1; } IFACES="$IFACES veth$i" - veth_mac[$i]=$(ip -n ns0 link show veth$i | awk '/link\/ether/ {print $2}') + veth_mac[$i]=$(ip -n ${NS[0]} link show veth$i | awk '/link\/ether/ {print $2}') done }
@@ -104,10 +106,10 @@ do_egress_tests() local mode=$1 # mac test - ip netns exec ns2 tcpdump -e -i veth0 -nn -l -e &> ${LOG_DIR}/mac_ns1-2_${mode}.log & - ip netns exec ns3 tcpdump -e -i veth0 -nn -l -e &> ${LOG_DIR}/mac_ns1-3_${mode}.log & + ip netns exec ${NS[2]} tcpdump -e -i veth0 -nn -l -e &> ${LOG_DIR}/mac_ns1-2_${mode}.log & + ip netns exec ${NS[3]} tcpdump -e -i veth0 -nn -l -e &> ${LOG_DIR}/mac_ns1-3_${mode}.log & sleep 0.5 - ip netns exec ns1 ping 192.0.2.254 -i 0.1 -c 4 &> /dev/null + ip netns exec ${NS[1]} ping 192.0.2.254 -i 0.1 -c 4 &> /dev/null sleep 0.5 pkill tcpdump
@@ -123,18 +125,18 @@ do_ping_tests() local mode=$1 # ping6 test: echo request should be redirect back to itself, not others - ip netns exec ns1 ip neigh add 2001:db8::2 dev veth0 lladdr 00:00:00:00:00:02 + ip netns exec ${NS[1]} ip neigh add 2001:db8::2 dev veth0 lladdr 00:00:00:00:00:02 - ip netns exec ns1 tcpdump -i veth0 -nn -l -e &> ${LOG_DIR}/ns1-1_${mode}.log & - ip netns exec ns2 tcpdump -i veth0 -nn -l -e &> ${LOG_DIR}/ns1-2_${mode}.log & - ip netns exec ns3 tcpdump -i veth0 -nn -l -e &> ${LOG_DIR}/ns1-3_${mode}.log & + ip netns exec ${NS[1]} tcpdump -i veth0 -nn -l -e &> ${LOG_DIR}/ns1-1_${mode}.log & + ip netns exec ${NS[2]} tcpdump -i veth0 -nn -l -e &> ${LOG_DIR}/ns1-2_${mode}.log & + ip netns exec ${NS[3]} tcpdump -i veth0 -nn -l -e &> ${LOG_DIR}/ns1-3_${mode}.log & sleep 0.5 # ARP test - ip netns exec ns1 arping -q -c 2 -I veth0 192.0.2.254 + ip netns exec ${NS[1]} arping -q -c 2 -I veth0 192.0.2.254 # IPv4 test - ip netns exec ns1 ping 192.0.2.253 -i 0.1 -c 4 &> /dev/null + ip netns exec ${NS[1]} ping 192.0.2.253 -i 0.1 -c 4 &> /dev/null # IPv6 test - ip netns exec ns1 ping6 2001:db8::2 -i 0.1 -c 2 &> /dev/null + ip netns exec ${NS[1]} ping6 2001:db8::2 -i 0.1 -c 2 &> /dev/null sleep 0.5 pkill tcpdump
@@ -180,7 +182,7 @@ do_tests() xdpgeneric) drv_p="-S";; esac - ip netns exec ns0 ./xdp_redirect_multi $drv_p $IFACES &> ${LOG_DIR}/xdp_redirect_${mode}.log & + ip netns exec ${NS[0]} ./xdp_redirect_multi $drv_p $IFACES &> ${LOG_DIR}/xdp_redirect_${mode}.log & xdp_pid=$! sleep 1 if ! ps -p $xdp_pid > /dev/null; then
@@ -197,10 +199,10 @@ do_tests() kill $xdp_pid } -trap clean_up EXIT - check_env +trap clean_up EXIT + for mode in ${DRV_MODE}; do setup_ns $mode do_tests $mode
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 433/1017 ath9k_htc: fix uninit value bugs
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit d1e0df1c57bd30871dd1c855742a7c346dbca853 ]
Syzbot reported 2 KMSAN bugs in ath9k. All of them are caused by missing field initialization.
In htc_connect_service() svc_meta_len and pad are not initialized. Based on code it looks like in current skb there is no service data, so simply initialize svc_meta_len to 0.
htc_issue_send() does not initialize htc_frame_hdr::control array. Based on firmware code, it will initialize it by itself, so simply zero whole array to make KMSAN happy
Fail logs:
BUG: KMSAN: kernel-usb-infoleak in usb_submit_urb+0x6c1/0x2aa0 drivers/usb/core/urb.c:430 usb_submit_urb+0x6c1/0x2aa0 drivers/usb/core/urb.c:430 hif_usb_send_regout drivers/net/wireless/ath/ath9k/hif_usb.c:127 [inline] hif_usb_send+0x5f0/0x16f0 drivers/net/wireless/ath/ath9k/hif_usb.c:479 htc_issue_send drivers/net/wireless/ath/ath9k/htc_hst.c:34 [inline] htc_connect_service+0x143e/0x1960 drivers/net/wireless/ath/ath9k/htc_hst.c:275
...
Uninit was created at:
slab_post_alloc_hook mm/slab.h:524 [inline] slab_alloc_node mm/slub.c:3251 [inline] __kmalloc_node_track_caller+0xe0c/0x1510 mm/slub.c:4974 kmalloc_reserve net/core/skbuff.c:354 [inline] __alloc_skb+0x545/0xf90 net/core/skbuff.c:426 alloc_skb include/linux/skbuff.h:1126 [inline] htc_connect_service+0x1029/0x1960 drivers/net/wireless/ath/ath9k/htc_hst.c:258
...
Bytes 4-7 of 18 are uninitialized
Memory access of size 18 starts at ffff888027377e00
BUG: KMSAN: kernel-usb-infoleak in usb_submit_urb+0x6c1/0x2aa0 drivers/usb/core/urb.c:430 usb_submit_urb+0x6c1/0x2aa0 drivers/usb/core/urb.c:430 hif_usb_send_regout drivers/net/wireless/ath/ath9k/hif_usb.c:127 [inline] hif_usb_send+0x5f0/0x16f0 drivers/net/wireless/ath/ath9k/hif_usb.c:479 htc_issue_send drivers/net/wireless/ath/ath9k/htc_hst.c:34 [inline] htc_connect_service+0x143e/0x1960 drivers/net/wireless/ath/ath9k/htc_hst.c:275
...
Uninit was created at:
slab_post_alloc_hook mm/slab.h:524 [inline] slab_alloc_node mm/slub.c:3251 [inline] __kmalloc_node_track_caller+0xe0c/0x1510 mm/slub.c:4974 kmalloc_reserve net/core/skbuff.c:354 [inline] __alloc_skb+0x545/0xf90 net/core/skbuff.c:426 alloc_skb include/linux/skbuff.h:1126 [inline] htc_connect_service+0x1029/0x1960 drivers/net/wireless/ath/ath9k/htc_hst.c:258
...
Bytes 16-17 of 18 are uninitialized
Memory access of size 18 starts at ffff888027377e00
--- drivers/net/wireless/ath/ath9k/htc_hst.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/ath/ath9k/htc_hst.c +5 -0
@@ -30,6 +30,7 @@ static int htc_issue_send(struct htc_target *target, struct sk_buff* skb, hdr->endpoint_id = epid; hdr->flags = flags; hdr->payload_len =cpu_to_be16 (len); +memset (hdr->control,0 ,sizeof (hdr->control)); status = target->hif->send (target->hif_dev, endpoint->ul_pipeid, skb);
@@ -272,6 +273,10 @@ int htc_connect_service(struct htc_target *target, conn_msg->dl_pipeid = endpoint->dl_pipeid; conn_msg->ul_pipeid = endpoint->ul_pipeid; +/* To prevent infoleak */ + conn_msg->svc_meta_len =0 ; + conn_msg->pad =0 ; + ret =htc_issue_send (target, skb, skb->len,0 ,ENDPOINT0 );if (ret) goto err;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 434/1017 ath11k: set WMI_PEER_40MHZ while peer assoc for 6 GHz
In reply to Greg Kroah-HartmanFrom: Wen Gong <[email protected]>
[ Upstream commit 1cb747192de2edb7e55920af8c458e4792908486 ]
When station connect to AP of 6 GHz with 40 MHz bandwidth, the TX is always stay 20 MHz, it is because the flag WMI_PEER_40MHZ is not set while peer assoc. Add the flag if remote peer is 40 MHz bandwidth.
Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03003-QCAHSPSWPL_V1_V2_SILICONZ_LITE-2
--- drivers/net/wireless/ath/ath11k/mac.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/ath/ath11k/mac.c +3 -0
@@ -2039,6 +2039,9 @@ static void ath11k_peer_assoc_h_he_6ghz(struct ath11k *ar,if (!arg->he_flag || band !=NL80211_BAND_6GHZ || !sta->he_6ghz_capa.capa)return ; +if (sta->bandwidth ==IEEE80211_STA_RX_BW_40 ) + arg->bw_40 = true; +if (sta->bandwidth ==IEEE80211_STA_RX_BW_80 ) arg->bw_80 = true;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 435/1017 RDMA/core: Set MR type in ib_reg_user_mr
In reply to Greg Kroah-HartmanFrom: Maor Gottlieb <[email protected]>
[ Upstream commit 32a88d16615c2be295571c29273c4ac94cb75309 ]
Add missing assignment of MR type to IB_MR_TYPE_USER.
--- drivers/infiniband/core/verbs.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/core/verbs.c +1 -0
@@ -2153,6 +2153,7 @@ struct ib_mr *ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,return mr; mr->device = pd->device; + mr->type =IB_MR_TYPE_USER ; mr->pd = pd; mr->dm =NULL ;atomic_inc (&pd->usecnt);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 436/1017 KVM: PPC: Fix vmx/vsx mixup in mmio emulation
In reply to Greg Kroah-HartmanFrom: Fabiano Rosas <[email protected]>
[ Upstream commit b99234b918c6e36b9aa0a5b2981e86b6bd11f8e2 ]
The MMIO emulation code for vector instructions is duplicated between VSX and VMX. When emulating VMX we should check the VMX copy size instead of the VSX one.
--- arch/powerpc/kvm/powerpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kvm/powerpc.c +2 -2
@@ -1507,7 +1507,7 @@ int kvmppc_handle_vmx_load(struct kvm_vcpu *vcpu, {enum emulation_result emulated =EMULATE_DONE ; -if (vcpu->arch.mmio_vsx_copy_nums >2 ) +if (vcpu->arch.mmio_vmx_copy_nums >2 )return EMULATE_FAIL ;while (vcpu->arch.mmio_vmx_copy_nums) {
@@ -1604,7 +1604,7 @@ int kvmppc_handle_vmx_store(struct kvm_vcpu *vcpu,unsigned int index = rs &KVM_MMIO_REG_MASK ;enum emulation_result emulated =EMULATE_DONE ; -if (vcpu->arch.mmio_vsx_copy_nums >2 ) +if (vcpu->arch.mmio_vmx_copy_nums >2 )return EMULATE_FAIL ; vcpu->arch.io_gpr = rs;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 437/1017 selftests/net: timestamping: Fix bind_phc check
In reply to Greg Kroah-HartmanFrom: Gerhard Engleder <[email protected]>
[ Upstream commit 678dfd5280341d877ca646499bfdc82a3d8b4356 ]
timestamping checks socket options during initialisation. For the field bind_phc of the socket option SO_TIMESTAMPING it expects the value -1 if PHC is not bound. Actually the value of bind_phc is 0 if PHC is not bound. This results in the following output:
SIOCSHWTSTAMP: tx_type 0 requested, got 0; rx_filter 0 requested, got 0 SO_TIMESTAMP 0SO_TIMESTAMPNS 0SO_TIMESTAMPING flags 0, bind phc 0
not expected, flags 0, bind phc -1
This is fixed by setting default value and expected value of bind_phc to 0.
--- tools/testing/selftests/net/timestamping.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/net/timestamping.c +2 -2
@@ -325,8 +325,8 @@ int main(int argc, char **argv)struct ifreq device;struct ifreq hwtstamp;struct hwtstamp_config hwconfig, hwconfig_requested; -struct so_timestamping so_timestamping_get = {0 ,-1 }; -struct so_timestamping so_timestamping = {0 ,-1 }; +struct so_timestamping so_timestamping_get = {0 ,0 }; +struct so_timestamping so_timestamping = {0 ,0 };struct sockaddr_in addr;struct ip_mreq imr;struct in_addr iaddr;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 438/1017 i40e: dont reserve excessive XDP_PACKET_HEADROOM on XSK Rx to skb
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
[ Upstream commit bc97f9c6f988b31b728eb47a94ca825401dbeffe ]
{__,}napi_alloc_skb() allocates and reserves additional NET_SKB_PAD
+ NET_IP_ALIGN for any skb.
OTOH, i40e_construct_skb_zc() currently allocates and reserves additional xdp->data - xdp->data_hard_start, which is XDP_PACKET_HEADROOM for XSK frames.
There's no need for that at all as the frame is post-XDP and will go only to the networking stack core.
Pass the size of the actual data only to __napi_alloc_skb() and don't reserve anything. This will give enough headroom for stack processing.
--- drivers/net/ethernet/intel/i40e/i40e_xsk.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_xsk.c +1 -3
@@ -246,13 +246,11 @@ static struct sk_buff *i40e_construct_skb_zc(struct i40e_ring *rx_ring,struct sk_buff *skb;/* allocate a skb to store the frags */ - skb =__napi_alloc_skb (&rx_ring->q_vector->napi, - xdp->data_end - xdp->data_hard_start, + skb =__napi_alloc_skb (&rx_ring->q_vector->napi, datasize,GFP_ATOMIC | __GFP_NOWARN);if (unlikely (!skb)) goto out; -skb_reserve (skb, xdp->data - xdp->data_hard_start);memcpy (__skb_put (skb, datasize), xdp->data, datasize);if (metasize)skb_metadata_set (skb, metasize);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 439/1017 i40e: respect metadata on XSK Rx to skb
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
[ Upstream commit 6dba29537c0f639b482bd8f8bbd50ab4ae74b48d ]
For now, if the XDP prog returns XDP_PASS on XSK, the metadata will be lost as it doesn't get copied to the skb.
Copy it along with the frame headers. Account its size on skb allocation, and when copying just treat it as a part of the frame and do a pull after to "move" it to the "reserved" zone.
net_prefetch() xdp->data_meta and align the copy size to speed-up memcpy() a little and better match i40e_construct_skb().
--- drivers/net/ethernet/intel/i40e/i40e_xsk.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_xsk.c +10 -4
@@ -241,19 +241,25 @@ bool i40e_alloc_rx_buffers_zc(struct i40e_ring *rx_ring, u16 count)static struct sk_buff *i40e_construct_skb_zc (struct i40e_ring *rx_ring,struct xdp_buff *xdp) { +unsigned int totalsize = xdp->data_end - xdp->data_meta;unsigned int metasize = xdp->data - xdp->data_meta; -unsigned int datasize = xdp->data_end - xdp->data;struct sk_buff *skb; +net_prefetch (xdp->data_meta); +/* allocate a skb to store the frags */ - skb =__napi_alloc_skb (&rx_ring->q_vector->napi, datasize, + skb =__napi_alloc_skb (&rx_ring->q_vector->napi, totalsize,GFP_ATOMIC | __GFP_NOWARN);if (unlikely (!skb)) goto out; -memcpy (__skb_put (skb, datasize), xdp->data, datasize); -if (metasize) +memcpy (__skb_put (skb, totalsize), xdp->data_meta, +ALIGN (totalsize,sizeof (long ))); + +if (metasize) {skb_metadata_set (skb, metasize); +__skb_pull (skb, metasize); + } out:xsk_buff_free (xdp);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 440/1017 ice: dont reserve excessive XDP_PACKET_HEADROOM on XSK Rx to skb
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
[ Upstream commit dc44572d195e10ec41a03e09b3b5addab4af5cea ]
{__,}napi_alloc_skb() allocates and reserves additional NET_SKB_PAD
+ NET_IP_ALIGN for any skb.
OTOH, ice_construct_skb_zc() currently allocates and reserves additional xdp->data - xdp->data_hard_start, which is XDP_PACKET_HEADROOM for XSK frames.
There's no need for that at all as the frame is post-XDP and will go only to the networking stack core.
Pass the size of the actual data only to __napi_alloc_skb() and don't reserve anything. This will give enough headroom for stack processing.
--- drivers/net/ethernet/intel/ice/ice_xsk.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/intel/ice/ice_xsk.c +1 -3
@@ -428,17 +428,15 @@ static void ice_bump_ntc(struct ice_rx_ring *rx_ring)static struct sk_buff *ice_construct_skb_zc (struct ice_rx_ring *rx_ring,struct xdp_buff *xdp) { -unsigned int datasize_hard = xdp->data_end - xdp->data_hard_start;unsigned int metasize = xdp->data - xdp->data_meta;unsigned int datasize = xdp->data_end - xdp->data;struct sk_buff *skb; - skb =__napi_alloc_skb (&rx_ring->q_vector->napi, datasize_hard, + skb =__napi_alloc_skb (&rx_ring->q_vector->napi, datasize,GFP_ATOMIC | __GFP_NOWARN);if (unlikely (!skb))return NULL ; -skb_reserve (skb, xdp->data - xdp->data_hard_start);memcpy (__skb_put (skb, datasize), xdp->data, datasize);if (metasize)skb_metadata_set (skb, metasize);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 441/1017 ice: respect metadata on XSK Rx to skb
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
[ Upstream commit 45a34ca68070e34e09d5bf4309f7f1f286a27fc7 ]
For now, if the XDP prog returns XDP_PASS on XSK, the metadata will be lost as it doesn't get copied to the skb.
Copy it along with the frame headers. Account its size on skb allocation, and when copying just treat it as a part of the frame and do a pull after to "move" it to the "reserved" zone.
net_prefetch() xdp->data_meta and align the copy size to speed-up memcpy() a little and better match ice_construct_skb().
--- drivers/net/ethernet/intel/ice/ice_xsk.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/ice/ice_xsk.c +10 -4
@@ -428,18 +428,24 @@ static void ice_bump_ntc(struct ice_rx_ring *rx_ring)static struct sk_buff *ice_construct_skb_zc (struct ice_rx_ring *rx_ring,struct xdp_buff *xdp) { +unsigned int totalsize = xdp->data_end - xdp->data_meta;unsigned int metasize = xdp->data - xdp->data_meta; -unsigned int datasize = xdp->data_end - xdp->data;struct sk_buff *skb; - skb =__napi_alloc_skb (&rx_ring->q_vector->napi, datasize, +net_prefetch (xdp->data_meta); + + skb =__napi_alloc_skb (&rx_ring->q_vector->napi, totalsize,GFP_ATOMIC | __GFP_NOWARN);if (unlikely (!skb))return NULL ; -memcpy (__skb_put (skb, datasize), xdp->data, datasize); -if (metasize) +memcpy (__skb_put (skb, totalsize), xdp->data_meta, +ALIGN (totalsize,sizeof (long ))); + +if (metasize) {skb_metadata_set (skb, metasize); +__skb_pull (skb, metasize); + }xsk_buff_free (xdp);return skb;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 442/1017 igc: dont reserve excessive XDP_PACKET_HEADROOM on XSK Rx to skb
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
[ Upstream commit f9e61d365bafdee40fe2586fc6be490c3e824dad ]
{__,}napi_alloc_skb() allocates and reserves additional NET_SKB_PAD
+ NET_IP_ALIGN for any skb.
OTOH, igc_construct_skb_zc() currently allocates and reserves additional xdp->data_meta - xdp->data_hard_start, which is about XDP_PACKET_HEADROOM for XSK frames.
There's no need for that at all as the frame is post-XDP and will go only to the networking stack core.
Pass the size of the actual data only (+ meta) to __napi_alloc_skb() and don't reserve anything. This will give enough headroom for stack processing.
Also, net_prefetch() xdp->data_meta and align the copy size to speed-up memcpy() a little and better match igc_construct_skb().
--- drivers/net/ethernet/intel/igc/igc_main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/igc/igc_main.c +7 -6
@@ -2435,19 +2435,20 @@ static int igc_clean_rx_irq(struct igc_q_vector *q_vector, const int budget)static struct sk_buff *igc_construct_skb_zc (struct igc_ring *ring,struct xdp_buff *xdp) { +unsigned int totalsize = xdp->data_end - xdp->data_meta;unsigned int metasize = xdp->data - xdp->data_meta; -unsigned int datasize = xdp->data_end - xdp->data; -unsigned int totalsize = metasize + datasize;struct sk_buff *skb; - skb =__napi_alloc_skb (&ring->q_vector->napi, - xdp->data_end - xdp->data_hard_start, +net_prefetch (xdp->data_meta); + + skb =__napi_alloc_skb (&ring->q_vector->napi, totalsize,GFP_ATOMIC | __GFP_NOWARN);if (unlikely (!skb))return NULL ; -skb_reserve (skb, xdp->data_meta - xdp->data_hard_start); -memcpy (__skb_put (skb, totalsize), xdp->data_meta, totalsize); +memcpy (__skb_put (skb, totalsize), xdp->data_meta, +ALIGN (totalsize,sizeof (long ))); +if (metasize) {skb_metadata_set (skb, metasize);__skb_pull (skb, metasize);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 443/1017 ixgbe: pass bi->xdp to ixgbe_construct_skb_zc() directly
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
[ Upstream commit 1fbdaa13386804a31eefd3db3c5fe00e80ce9bc3 ]
To not dereference bi->xdp each time in ixgbe_construct_skb_zc(), pass bi->xdp as an argument instead of bi. We can also call xsk_buff_free() outside of the function as well as assign bi->xdp to NULL, which seems to make it closer to its name.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c +10 -9
@@ -207,26 +207,24 @@ bool ixgbe_alloc_rx_buffers_zc(struct ixgbe_ring *rx_ring, u16 count) }static struct sk_buff *ixgbe_construct_skb_zc (struct ixgbe_ring *rx_ring, -struct ixgbe_rx_buffer *bi) +const struct xdp_buff *xdp) { -unsigned int metasize = bi->xdp->data - bi->xdp->data_meta; -unsigned int datasize = bi->xdp->data_end - bi->xdp->data; +unsigned int metasize = xdp->data - xdp->data_meta; +unsigned int datasize = xdp->data_end - xdp->data;struct sk_buff *skb;/* allocate a skb to store the frags */ skb =__napi_alloc_skb (&rx_ring->q_vector->napi, - bi->xdp->data_end - bi->xdp->data_hard_start, + xdp->data_end - xdp->data_hard_start,GFP_ATOMIC | __GFP_NOWARN);if (unlikely (!skb))return NULL ; -skb_reserve (skb, bi->xdp->data - bi->xdp->data_hard_start); -memcpy (__skb_put (skb, datasize), bi->xdp->data, datasize); +skb_reserve (skb, xdp->data - xdp->data_hard_start); +memcpy (__skb_put (skb, datasize), xdp->data, datasize);if (metasize)skb_metadata_set (skb, metasize); -xsk_buff_free (bi->xdp); - bi->xdp =NULL ;return skb; }
@@ -317,12 +315,15 @@ int ixgbe_clean_rx_irq_zc(struct ixgbe_q_vector *q_vector, }/* XDP_PASS path */ - skb =ixgbe_construct_skb_zc (rx_ring, bi); + skb =ixgbe_construct_skb_zc (rx_ring, bi->xdp);if (!skb) { rx_ring->rx_stats.alloc_rx_buff_failed++;break ; } +xsk_buff_free (bi->xdp); + bi->xdp =NULL ; + cleaned_count++;ixgbe_inc_ntc (rx_ring);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 444/1017 ixgbe: dont reserve excessive XDP_PACKET_HEADROOM on XSK Rx to skb
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
[ Upstream commit 8f405221a73a53234486c185d8ef647377a53cc6 ]
{__,}napi_alloc_skb() allocates and reserves additional NET_SKB_PAD
+ NET_IP_ALIGN for any skb.
OTOH, ixgbe_construct_skb_zc() currently allocates and reserves additional xdp->data - xdp->data_hard_start, which is XDP_PACKET_HEADROOM for XSK frames.
There's no need for that at all as the frame is post-XDP and will go only to the networking stack core.
Pass the size of the actual data only to __napi_alloc_skb() and don't reserve anything. This will give enough headroom for stack processing.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c +1 -3
@@ -214,13 +214,11 @@ static struct sk_buff *ixgbe_construct_skb_zc(struct ixgbe_ring *rx_ring,struct sk_buff *skb;/* allocate a skb to store the frags */ - skb =__napi_alloc_skb (&rx_ring->q_vector->napi, - xdp->data_end - xdp->data_hard_start, + skb =__napi_alloc_skb (&rx_ring->q_vector->napi, datasize,GFP_ATOMIC | __GFP_NOWARN);if (unlikely (!skb))return NULL ; -skb_reserve (skb, xdp->data - xdp->data_hard_start);memcpy (__skb_put (skb, datasize), xdp->data, datasize);if (metasize)skb_metadata_set (skb, metasize);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 445/1017 ixgbe: respect metadata on XSK Rx to skb
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
[ Upstream commit f322a620be69e95594eda89502b478aa7dbf6ec2 ]
For now, if the XDP prog returns XDP_PASS on XSK, the metadata will be lost as it doesn't get copied to the skb.
Copy it along with the frame headers. Account its size on skb allocation, and when copying just treat it as a part of the frame and do a pull after to "move" it to the "reserved" zone.
net_prefetch() xdp->data_meta and align the copy size to speed-up memcpy() a little and better match ixgbe_construct_skb().
--- drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_xsk.c +10 -4
@@ -209,19 +209,25 @@ bool ixgbe_alloc_rx_buffers_zc(struct ixgbe_ring *rx_ring, u16 count)static struct sk_buff *ixgbe_construct_skb_zc (struct ixgbe_ring *rx_ring,const struct xdp_buff *xdp) { +unsigned int totalsize = xdp->data_end - xdp->data_meta;unsigned int metasize = xdp->data - xdp->data_meta; -unsigned int datasize = xdp->data_end - xdp->data;struct sk_buff *skb; +net_prefetch (xdp->data_meta); +/* allocate a skb to store the frags */ - skb =__napi_alloc_skb (&rx_ring->q_vector->napi, datasize, + skb =__napi_alloc_skb (&rx_ring->q_vector->napi, totalsize,GFP_ATOMIC | __GFP_NOWARN);if (unlikely (!skb))return NULL ; -memcpy (__skb_put (skb, datasize), xdp->data, datasize); -if (metasize) +memcpy (__skb_put (skb, totalsize), xdp->data_meta, +ALIGN (totalsize,sizeof (long ))); + +if (metasize) {skb_metadata_set (skb, metasize); +__skb_pull (skb, metasize); + }return skb; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 446/1017 power: reset: gemini-poweroff: Fix IRQ check in gemini_poweroff_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit ba18dad0fb880cd29aa97b6b75560ef14d1061ba ]
platform_get_irq() returns negative error number instead 0 on failure. And the doc of platform_get_irq() provides a usage example:
int irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;Fix the check of return value to catch errors correctly.
--- drivers/power/reset/gemini-poweroff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/power/reset/gemini-poweroff.c +2 -2
@@ -107,8 +107,8 @@ static int gemini_poweroff_probe(struct platform_device *pdev)return PTR_ERR (gpw->base); irq =platform_get_irq (pdev,0 ); -if (!irq) -return -EINVAL ; +if (irq <0 ) +return irq; gpw->dev = dev;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 447/1017 ray_cs: Check ioremap return value
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 7e4760713391ee46dc913194b33ae234389a174e ]
As the possible failure of the ioremap(), the 'local->sram' and other two could be NULL.
Therefore it should be better to check it in order to avoid the later dev_dbg.
--- drivers/net/wireless/ray_cs.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/wireless/ray_cs.c +6 -0
@@ -382,6 +382,8 @@ static int ray_config(struct pcmcia_device *link) goto failed; local->sram =ioremap (link->resource[2 ]->start,resource_size (link->resource[2 ])); +if (!local->sram) + goto failed;/*** Set up 16k window for shared memory (receive buffer) ***************/ link->resource[3]->flags |=
@@ -396,6 +398,8 @@ static int ray_config(struct pcmcia_device *link) goto failed; local->rmem =ioremap (link->resource[3 ]->start,resource_size (link->resource[3 ])); +if (!local->rmem) + goto failed;/*** Set up window for attribute memory ***********************************/ link->resource[4]->flags |=
@@ -410,6 +414,8 @@ static int ray_config(struct pcmcia_device *link) goto failed; local->amem =ioremap (link->resource[4 ]->start,resource_size (link->resource[4 ])); +if (!local->amem) + goto failed;dev_dbg (&link->dev,"ray_config sram=%p\n" , local->sram);dev_dbg (&link->dev,"ray_config rmem=%p\n" , local->rmem);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 448/1017 powerpc: dts: t1040rdb: fix ports names for Seville Ethernet switch
In reply to Greg Kroah-HartmanFrom: Maxim Kiselev <[email protected]>
[ Upstream commit 5ebb74749202a25da4b3cc2eb15470225a05527c ]
On board rev A, the network interface labels for the switch ports written on the front panel are different than on rev B and later.
This patch fixes network interface names for the switch ports according to labels that are written on the front panel of the board rev B. They start from ETH3 and end at ETH10.
This patch also introduces a separate device tree for rev A. The main device tree is supposed to cover rev B and later.
--- arch/powerpc/boot/dts/fsl/t1040rdb-rev-a.dts | 30 ++++++++++++++++++++ arch/powerpc/boot/dts/fsl/t1040rdb.dts | 8 +++--- 2 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 arch/powerpc/boot/dts/fsl/t1040rdb-rev-a.dts
arch/powerpc/boot/dts/fsl/t1040rdb-rev-a.dts new file +30 -0
@@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * T1040RDB-REV-A Device Tree Source + * + * Copyright 2014 - 2015 Freescale Semiconductor Inc. + * + */ + +#include "t1040rdb.dts" + +/ { + model = "fsl,T1040RDB-REV-A"; + compatible = "fsl,T1040RDB-REV-A"; +}; + +&seville_port0 { + label = "ETH5"; +}; + +&seville_port2 { + label = "ETH7"; +}; + +&seville_port4 { + label = "ETH9"; +}; + +&seville_port6 { + label = "ETH11"; +};
arch/powerpc/boot/dts/fsl/t1040rdb.dts +4 -4
@@ -119,7 +119,7 @@ managed = "in-band-status"; phy-handle = <&phy_qsgmii_0>; phy-mode = "qsgmii"; - label = "ETH5"; + label = "ETH3"; status = "okay"; };
@@ -135,7 +135,7 @@ managed = "in-band-status"; phy-handle = <&phy_qsgmii_2>; phy-mode = "qsgmii"; - label = "ETH7"; + label = "ETH5"; status = "okay"; };
@@ -151,7 +151,7 @@ managed = "in-band-status"; phy-handle = <&phy_qsgmii_4>; phy-mode = "qsgmii"; - label = "ETH9"; + label = "ETH7"; status = "okay"; };
@@ -167,7 +167,7 @@ managed = "in-band-status"; phy-handle = <&phy_qsgmii_6>; phy-mode = "qsgmii"; - label = "ETH11"; + label = "ETH9"; status = "okay"; };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 449/1017 KVM: PPC: Book3S HV: Check return value of kvmppc_radix_init
In reply to Greg Kroah-HartmanFrom: Fabiano Rosas <[email protected]>
[ Upstream commit 69ab6ac380a00244575de02c406dcb9491bf3368 ]
The return of the function is being shadowed by the call to kvmppc_uvmem_init.
--- arch/powerpc/kvm/book3s_hv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/powerpc/kvm/book3s_hv.c +4 -1
@@ -6101,8 +6101,11 @@ static int kvmppc_book3s_init_hv(void)if (r)return r; -if (kvmppc_radix_possible ()) +if (kvmppc_radix_possible ()) { r =kvmppc_radix_init (); +if (r) +return r; + } r =kvmppc_uvmem_init ();if (r <0 )
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 450/1017 powerpc/perf: Dont use perf_hw_context for trace IMC PMU
In reply to Greg Kroah-HartmanFrom: Athira Rajeev <[email protected]>
[ Upstream commit 0198322379c25215b2778482bf1221743a76e2b5 ]
Trace IMC (In-Memory collection counters) in powerpc is useful for application level profiling.
For trace_imc, presently task context (task_ctx_nr) is set to perf_hw_context. But perf_hw_context should only be used for CPU PMU. See commit 26657848502b ("perf/core: Verify we have a single perf_hw_context PMU").
So for trace_imc, even though it is per thread PMU, it is preferred to use sw_context in order to be able to do application level monitoring. Hence change the task_ctx_nr to use perf_sw_context.
--- arch/powerpc/perf/imc-pmu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/powerpc/perf/imc-pmu.c +5 -1
@@ -1457,7 +1457,11 @@ static int trace_imc_event_init(struct perf_event *event) event->hw.idx =-1 ; - event->pmu->task_ctx_nr = perf_hw_context; +/* +* There can only be a single PMU for perf_hw_context events which is assigned to +* core PMU. Hence use "perf_sw_context" for trace_imc. +*/ + event->pmu->task_ctx_nr = perf_sw_context; event->destroy = reset_global_refc;return 0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 451/1017 mt76: connac: fix sta_rec_wtbl tag len
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 74c337ec0905d99111fc63a15f2e0784b9ed5503 ]
Similar to mt7915 driver, fix tag len error for sta_rec_wtbl, which causes fw parsing error for the tags placed behind it.
--- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +1 -1
@@ -313,7 +313,7 @@ mt76_connac_mcu_alloc_wtbl_req(struct mt76_dev *dev, struct mt76_wcid *wcid, }if (sta_hdr) - sta_hdr->len =cpu_to_le16 (sizeof (hdr)); +le16_add_cpu (&sta_hdr->len,sizeof (hdr));return skb_put_data (nskb, &hdr,sizeof (hdr)); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 452/1017 mt76: mt7915: use proper aid value in mt7915_mcu_wtbl_generic_tlv in sta mode
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit a56b1b0f145ef2d6bb9312dedf3ab8558ef50a5b ]
mac80211 provides aid in vif->bss_conf.aid for sta mode and not in sta->aid. Fix mt7915_mcu_wtbl_generic_tlv routine using proper value for aid in sta mode.
--- drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +4 -1
@@ -1263,8 +1263,11 @@ mt7915_mcu_wtbl_generic_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, generic = (struct wtbl_generic *)tlv;if (sta) { +if (vif->type ==NL80211_IFTYPE_STATION ) + generic->partial_aid =cpu_to_le16 (vif->bss_conf.aid); +else + generic->partial_aid =cpu_to_le16 (sta->aid);memcpy (generic->peer_addr, sta->addr,ETH_ALEN ); - generic->partial_aid =cpu_to_le16 (sta->aid); generic->muar_idx = mvif->omac_idx; generic->qos = sta->wme; }else {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 453/1017 mt76: mt7915: use proper aid value in mt7915_mcu_sta_basic_tlv
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit abdb8bc94be4cf68aa71c9a8ee0bad9b3e6f52d3 ]
Similar to mt7915_mcu_wtbl_generic_tlv, rely on vif->bss_conf.aid for aid in sta mode and not on sta->aid.
--- drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +3 -1
@@ -1321,12 +1321,15 @@ mt7915_mcu_sta_basic_tlv(struct sk_buff *skb, struct ieee80211_vif *vif,case NL80211_IFTYPE_MESH_POINT :case NL80211_IFTYPE_AP : basic->conn_type =cpu_to_le32 (CONNECTION_INFRA_STA ); + basic->aid =cpu_to_le16 (sta->aid);break ;case NL80211_IFTYPE_STATION : basic->conn_type =cpu_to_le32 (CONNECTION_INFRA_AP ); + basic->aid =cpu_to_le16 (vif->bss_conf.aid);break ;case NL80211_IFTYPE_ADHOC : basic->conn_type =cpu_to_le32 (CONNECTION_IBSS_ADHOC ); + basic->aid =cpu_to_le16 (sta->aid);break ;default :WARN_ON (1 );
@@ -1334,7 +1337,6 @@ mt7915_mcu_sta_basic_tlv(struct sk_buff *skb, struct ieee80211_vif *vif, }memcpy (basic->peer_addr, sta->addr,ETH_ALEN ); - basic->aid =cpu_to_le16 (sta->aid); basic->qos = sta->wme; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 454/1017 mt76: mt76_connac: fix MCU_CE_CMD_SET_ROC definition error
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit bf9727a27442a50c75b7d99a5088330c578b2a42 ]
Fixed an MCU_CE_CMD_SET_ROC definition error that occurred from a previous refactor work.
--- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +1 -1
@@ -598,7 +598,7 @@ enum {MCU_CE_CMD_SET_BSS_CONNECTED =0x16 ,MCU_CE_CMD_SET_BSS_ABORT =0x17 ,MCU_CE_CMD_CANCEL_HW_SCAN =0x1b , -MCU_CE_CMD_SET_ROC =0x1d , +MCU_CE_CMD_SET_ROC =0x1c ,MCU_CE_CMD_SET_P2P_OPPPS =0x33 ,MCU_CE_CMD_SET_RATE_TX_POWER =0x5d , MCU_CE_CMD_SCHED_SCAN_ENABLE = 0x61,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 455/1017 mt76: mt7921: set EDCA parameters with the MCU CE command
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit 66ca1a7b2d5503f561b751abdd6ec6fa96343eb6 ]
The command MCU_EXT_CMD_EDCA_UPDATE is not fully supported by the MT7921 firmware, so we apply CE command MCU_CE_CMD_SET_EDCA_PARAMS instead which is supported even in the oldest firmware to properly set up EDCA parameters for each AC.
--- .../wireless/mediatek/mt76/mt76_connac_mcu.h | 1 + .../net/wireless/mediatek/mt76/mt7921/mcu.c | 49 ++++++++----------- 2 files changed, 22 insertions(+), 28 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +1 -0
@@ -599,6 +599,7 @@ enum {MCU_CE_CMD_SET_BSS_ABORT =0x17 ,MCU_CE_CMD_CANCEL_HW_SCAN =0x1b ,MCU_CE_CMD_SET_ROC =0x1c , +MCU_CE_CMD_SET_EDCA_PARMS =0x1d ,MCU_CE_CMD_SET_P2P_OPPPS =0x33 ,MCU_CE_CMD_SET_RATE_TX_POWER =0x5d , MCU_CE_CMD_SCHED_SCAN_ENABLE = 0x61,
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c +21 -28
91 lines not on this page · raw message
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 456/1017 mt76: mt7921: do not always disable fw runtime-pm
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit b44eeb8cbdf2b88f2844f11e4f263b0abed5b5b0 ]
After commit 'd430dffbe9dd ("mt76: mt7921: fix a possible race enabling/disabling runtime-pm")', runtime-pm is always disabled in the fw even if the user requests to enable it toggling debugfs node since mt7921_pm_interface_iter routine will use pm->enable to configure the fw. Fix the issue moving enable variable configuration before running mt7921_pm_interface_iter routine.
--- drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c +1 -2
@@ -291,13 +291,12 @@ mt7921_pm_set(void *data, u64 val) pm->enable = false;mt76_connac_pm_wake (&dev->mphy, pm); + pm->enable = val;ieee80211_iterate_active_interfaces (mt76_hw (dev),IEEE80211_IFACE_ITER_RESUME_ALL , mt7921_pm_interface_iter, dev);mt76_connac_mcu_set_deep_sleep (&dev->mt76, pm->ds_enable); - - pm->enable = val;mt76_connac_power_save_sched (&dev->mphy, pm); out:mutex_unlock (&dev->mt76.mutex);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 457/1017 mt76: mt7921: fix a leftover race in runtime-pm
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 591cdccebdd4d02eb46d400dea911136400cc567 ]
Fix a possible race in mt7921_pm_power_save_work() if rx/tx napi schedules ps_work and we are currently accessing device register on a different cpu.
--- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7921/mac.c +8 -0
@@ -1472,6 +1472,14 @@ void mt7921_pm_power_save_work(struct work_struct *work) test_bit(MT76_HW_SCHED_SCANNING, &mphy->state)) goto out; +if (mutex_is_locked (&dev->mt76.mutex)) +/* if mt76 mutex is held we should not put the device +* to sleep since we are currently accessing device +* register map. We need to wait for the next power_save +* trigger. +*/ + goto out; +if (time_is_after_jiffies (dev->pm.last_activity + delta)) { delta = dev->pm.last_activity + delta - jiffies; goto out;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 458/1017 mt76: mt7615: fix a leftover race in runtime-pm
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 42ce8d3b623162f3248db50a38359f294e6b06fd ]
Fix a possible race in mt7615_pm_power_save_work() if rx/tx napi schedules ps_work and we are currently accessing device register on a different cpu.
--- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7615/mac.c +8 -0
@@ -2000,6 +2000,14 @@ void mt7615_pm_power_save_work(struct work_struct *work) test_bit(MT76_HW_SCHED_SCANNING, &dev->mphy.state)) goto out; +if (mutex_is_locked (&dev->mt76.mutex)) +/* if mt76 mutex is held we should not put the device +* to sleep since we are currently accessing device +* register map. We need to wait for the next power_save +* trigger. +*/ + goto out; +if (time_is_after_jiffies (dev->pm.last_activity + delta)) { delta = dev->pm.last_activity + delta - jiffies; goto out;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 459/1017 mt76: mt7915: fix ht mcs in mt7915_mac_add_txs_skb()
In reply to Greg Kroah-HartmanFrom: Peter Chiu <[email protected]>
[ Upstream commit d8e4e8d148fb68858d6a997d88a87a2c615629ce ]
The mcs value of HT mode reported by mt7915_mac_add_txs_skb() has already been converted to the expected format.
--- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +0 -1
@@ -1412,7 +1412,6 @@ mt7915_mac_add_txs_skb(struct mt7915_dev *dev, struct mt76_wcid *wcid, int pid,break ;case MT_PHY_TYPE_HT :case MT_PHY_TYPE_HT_GF : - rate.mcs += (rate.nss -1 ) *8 ;if (rate.mcs >31 ) goto out;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 460/1017 mt76: mt7921: fix ht mcs in mt7921_mac_add_txs_skb()
In reply to Greg Kroah-HartmanFrom: Peter Chiu <[email protected]>
[ Upstream commit b1fe07ed21024f64719315ba0f3a5676d8b36db6 ]
The mcs value of HT mode reported by mt7921_mac_add_txs_skb() has already been converted to the expected format.
--- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7921/mac.c +0 -1
@@ -1014,7 +1014,6 @@ mt7921_mac_add_txs_skb(struct mt7921_dev *dev, struct mt76_wcid *wcid, int pid,break ;case MT_PHY_TYPE_HT :case MT_PHY_TYPE_HT_GF : - rate.mcs += (rate.nss -1 ) *8 ;if (rate.mcs >31 ) goto out;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 461/1017 mt76: mt7921s: fix mt7921s_mcu_[fw|drv]_pmctrl
In reply to Greg Kroah-HartmanFrom: Leon Yen <[email protected]>
[ Upstream commit b12deb5e86fa36dc6f3aa3321f5da27addec4f1f ]
According to the firmware behavior (even the oldest one in linux-firmware) If the firmware is downloaded, MT7921S must rely on the additional mailbox mechanism that resides in firmware to check if the device is the right state for mt7921s_mcu_[fw|drv]_pmctrl. Otherwise, we still apply the old way for that.
That is a necessary patch before we enable runtime pm for mt7921s as default.
--- .../wireless/mediatek/mt76/mt7921/sdio_mcu.c | 38 +++++++++++++++++++ drivers/net/wireless/mediatek/mt76/sdio.h | 2 + 2 files changed, 40 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7921/sdio_mcu.c +38 -0
@@ -49,6 +49,26 @@ mt7921s_mcu_send_message(struct mt76_dev *mdev, struct sk_buff *skb,return ret; } +static u32 mt7921s_read_rm3r (struct mt7921_dev *dev) +{ +struct mt76_sdio *sdio = &dev->mt76.sdio; + +return sdio_readl (sdio->func,MCR_D2HRM3R ,NULL ); +} + +static u32 mt7921s_clear_rm3r_drv_own (struct mt7921_dev *dev) +{ +struct mt76_sdio *sdio = &dev->mt76.sdio; +u32 val; + + val =sdio_readl (sdio->func,MCR_D2HRM3R ,NULL ); +if (val) +sdio_writel (sdio->func,H2D_SW_INT_CLEAR_MAILBOX_ACK , +MCR_WSICR ,NULL ); + +return val; +} +int mt7921s_mcu_init (struct mt7921_dev *dev) {static const struct mt76_mcu_ops mt7921s_mcu_ops = {
@@ -88,6 +108,12 @@ int mt7921s_mcu_drv_pmctrl(struct mt7921_dev *dev) err =readx_poll_timeout (mt76s_read_pcr, &dev->mt76, status, status &WHLPCR_IS_DRIVER_OWN ,2000 ,1000000 ); + +if (!err &&test_bit (MT76_STATE_MCU_RUNNING , &dev->mphy.state)) + err =readx_poll_timeout (mt7921s_read_rm3r, dev, status, + status &D2HRM3R_IS_DRIVER_OWN , +2000 ,1000000 ); +sdio_release_host (func);if (err <0 ) {
@@ -115,12 +141,24 @@ int mt7921s_mcu_fw_pmctrl(struct mt7921_dev *dev)sdio_claim_host (func); +if (test_bit (MT76_STATE_MCU_RUNNING , &dev->mphy.state)) { + err =readx_poll_timeout (mt7921s_clear_rm3r_drv_own, + dev, status, + !(status &D2HRM3R_IS_DRIVER_OWN ), +2000 ,1000000 ); +if (err <0 ) { +dev_err (dev->mt76.dev,"mailbox ACK not cleared\n" ); + goto err; + } + } +sdio_writel (func,WHLPCR_FW_OWN_REQ_SET ,MCR_WHLPCR ,NULL ); err =readx_poll_timeout (mt76s_read_pcr, &dev->mt76, status, !(status &WHLPCR_IS_DRIVER_OWN ),2000 ,1000000 );sdio_release_host (func); +err:if (err <0 ) {dev_err (dev->mt76.dev,"firmware own failed\n" );clear_bit (MT76_STATE_PM , &mphy->state);
drivers/net/wireless/mediatek/mt76/sdio.h +2 -0
@@ -65,6 +65,7 @@#define MCR_H2DSM0R 0x0070#define H2D_SW_INT_READ BIT(16)#define H2D_SW_INT_WRITE BIT(17) +#define H2D_SW_INT_CLEAR_MAILBOX_ACK BIT(22)#define MCR_H2DSM1R 0x0074#define MCR_D2HRM0R 0x0078
@@ -109,6 +110,7 @@#define MCR_H2DSM2R 0x0160/* supported in CONNAC2 */ #define MCR_H2DSM3R 0x0164/* supported in CONNAC2 */ #define MCR_D2HRM3R 0x0174/* supported in CONNAC2 */ +#define D2HRM3R_IS_DRIVER_OWN BIT(0)#define MCR_WTQCR8 0x0190/* supported in CONNAC2 */ #define MCR_WTQCR9 0x0194/* supported in CONNAC2 */ #define MCR_WTQCR10 0x0198/* supported in CONNAC2 */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 462/1017 mt76: mt7921e: fix possible probe failure after reboot
In reply to Greg Kroah-HartmanFrom: Sean Wang <[email protected]>
[ Upstream commit 602cc0c9618a819ab00ea3c9400742a0ca318380 ]
It doesn't guarantee the mt7921e gets started with ASPM L0 after each machine reboot on every platform.
If mt7921e gets started with not ASPM L0, it would be possible that the driver encounters time to time failure in mt7921_pci_probe, like a weird chip identifier is read
[ 215.514503] mt7921e 0000:05:00.0: ASIC revision: feed0000 [ 216.604741] mt7921e: probe of 0000:05:00.0 failed with error -110
or failing to init hardware because the driver is not allowed to access the register until the device is in ASPM L0 state. So, we call __mt7921e_mcu_drv_pmctrl in early mt7921_pci_probe to force the device to bring back to the L0 state for we can safely access registers in any case.
In the patch, we move all functions from dma.c to pci.c and register mt76 bus operation earilier, that is the __mt7921e_mcu_drv_pmctrl depends on.
--- .../net/wireless/mediatek/mt76/mt7921/dma.c | 119 ----------------- .../wireless/mediatek/mt76/mt7921/mt7921.h | 1 + .../net/wireless/mediatek/mt76/mt7921/pci.c | 124 ++++++++++++++++++ .../wireless/mediatek/mt76/mt7921/pci_mcu.c | 18 ++- 4 files changed, 139 insertions(+), 123 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/dma.c +0 -119
@@ -78,110 +78,6 @@ static void mt7921_dma_prefetch(struct mt7921_dev *dev)mt76_wr (dev,MT_WFDMA0_TX_RING17_EXT_CTRL ,PREFETCH (0x380 ,0x4 )); } -static u32 __mt7921_reg_addr (struct mt7921_dev *dev,u32 addr) -{ -static const struct { -u32 phys; -u32 mapped; -u32 size; - } fixed_map[] = { - {0x820d0000 ,0x30000 ,0x10000 },/* WF_LMAC_TOP (WF_WTBLON) */ - {0x820ed000 ,0x24800 ,0x0800 },/* WF_LMAC_TOP BN0 (WF_MIB) */ - {0x820e4000 ,0x21000 ,0x0400 },/* WF_LMAC_TOP BN0 (WF_TMAC) */ - {0x820e7000 ,0x21e00 ,0x0200 },/* WF_LMAC_TOP BN0 (WF_DMA) */ - {0x820eb000 ,0x24200 ,0x0400 },/* WF_LMAC_TOP BN0 (WF_LPON) */ - {0x820e2000 ,0x20800 ,0x0400 },/* WF_LMAC_TOP BN0 (WF_AGG) */ - {0x820e3000 ,0x20c00 ,0x0400 },/* WF_LMAC_TOP BN0 (WF_ARB) */ - {0x820e5000 ,0x21400 ,0x0800 },/* WF_LMAC_TOP BN0 (WF_RMAC) */ - {0x00400000 ,0x80000 ,0x10000 },/* WF_MCU_SYSRAM */ - {0x00410000 ,0x90000 ,0x10000 },/* WF_MCU_SYSRAM (configure register) */ - {0x40000000 ,0x70000 ,0x10000 },/* WF_UMAC_SYSRAM */ - {0x54000000 ,0x02000 ,0x1000 },/* WFDMA PCIE0 MCU DMA0 */ - {0x55000000 ,0x03000 ,0x1000 },/* WFDMA PCIE0 MCU DMA1 */ - {0x58000000 ,0x06000 ,0x1000 },/* WFDMA PCIE1 MCU DMA0 (MEM_DMA) */ - {0x59000000 ,0x07000 ,0x1000 },/* WFDMA PCIE1 MCU DMA1 */ - {0x7c000000 ,0xf0000 ,0x10000 },/* CONN_INFRA */ - {0x7c020000 ,0xd0000 ,0x10000 },/* CONN_INFRA, WFDMA */ - {0x7c060000 ,0xe0000 ,0x10000 },/* CONN_INFRA, conn_host_csr_top */ - {0x80020000 ,0xb0000 ,0x10000 },/* WF_TOP_MISC_OFF */ - {0x81020000 ,0xc0000 ,0x10000 },/* WF_TOP_MISC_ON */ - {0x820c0000 ,0x08000 ,0x4000 },/* WF_UMAC_TOP (PLE) */ - {0x820c8000 ,0x0c000 ,0x2000 },/* WF_UMAC_TOP (PSE) */ - {0x820cc000 ,0x0e000 ,0x1000 },/* WF_UMAC_TOP (PP) */ - {0x820cd000 ,0x0f000 ,0x1000 },/* WF_MDP_TOP */ - {0x820ce000 ,0x21c00 ,0x0200 },/* WF_LMAC_TOP (WF_SEC) */ - {0x820cf000 ,0x22000 ,0x1000 },/* WF_LMAC_TOP (WF_PF) */ - {0x820e0000 ,0x20000 ,0x0400 },/* WF_LMAC_TOP BN0 (WF_CFG) */ - {0x820e1000 ,0x20400 ,0x0200 },/* WF_LMAC_TOP BN0 (WF_TRB) */ - {0x820e9000 ,0x23400 ,0x0200 },/* WF_LMAC_TOP BN0 (WF_WTBLOFF) */ - {0x820ea000 ,0x24000 ,0x0200 },/* WF_LMAC_TOP BN0 (WF_ETBF) */ - {0x820ec000 ,0x24600 ,0x0200 },/* WF_LMAC_TOP BN0 (WF_INT) */ - {0x820f0000 ,0xa0000 ,0x0400 },/* WF_LMAC_TOP BN1 (WF_CFG) */ - {0x820f1000 ,0xa0600 ,0x0200 },/* WF_LMAC_TOP BN1 (WF_TRB) */ - {0x820f2000 ,0xa0800 ,0x0400 },/* WF_LMAC_TOP BN1 (WF_AGG) */ - {0x820f3000 ,0xa0c00 ,0x0400 },/* WF_LMAC_TOP BN1 (WF_ARB) */ - {0x820f4000 ,0xa1000 ,0x0400 },/* WF_LMAC_TOP BN1 (WF_TMAC) */ - {0x820f5000 ,0xa1400 ,0x0800 },/* WF_LMAC_TOP BN1 (WF_RMAC) */ - {0x820f7000 ,0xa1e00 ,0x0200 },/* WF_LMAC_TOP BN1 (WF_DMA) */ - {0x820f9000 ,0xa3400 ,0x0200 },/* WF_LMAC_TOP BN1 (WF_WTBLOFF) */ - {0x820fa000 ,0xa4000 ,0x0200 },/* WF_LMAC_TOP BN1 (WF_ETBF) */ - {0x820fb000 ,0xa4200 ,0x0400 },/* WF_LMAC_TOP BN1 (WF_LPON) */ - {0x820fc000 ,0xa4600 ,0x0200 },/* WF_LMAC_TOP BN1 (WF_INT) */ - {0x820fd000 ,0xa4800 ,0x0800 },/* WF_LMAC_TOP BN1 (WF_MIB) */ - }; -int i; - -if (addr <0x100000 ) -return addr; - -for (i =0 ; i <ARRAY_SIZE (fixed_map); i++) { -u32 ofs; - -if (addr < fixed_map[i].phys) -continue ; - - ofs = addr - fixed_map[i].phys; -if (ofs > fixed_map[i].size) -continue ; - -return fixed_map[i].mapped + ofs; - } - -if ((addr >=0x18000000 && addr <0x18c00000 ) || - (addr >=0x70000000 && addr <0x78000000 ) || - (addr >=0x7c000000 && addr <0x7c400000 )) -return mt7921_reg_map_l1 (dev, addr); - -dev_err (dev->mt76.dev,"Access currently unsupported address %08x\n" , - addr); - -return 0 ; -} - -static u32 mt7921_rr (struct mt76_dev *mdev,u32 offset) -{ - struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76); -u32 addr =__mt7921_reg_addr (dev, offset); - -return dev->bus_ops->rr (mdev, addr); -} - -static void mt7921_wr (struct mt76_dev *mdev,u32 offset,u32 val) -{ - struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76); -u32 addr =__mt7921_reg_addr (dev, offset); - - dev->bus_ops->wr (mdev, addr, val); -} - -static u32 mt7921_rmw (struct mt76_dev *mdev,u32 offset,u32 mask,u32 val) -{ - struct mt7921_dev *dev = container_of(mdev, struct mt7921_dev, mt76); -u32 addr =__mt7921_reg_addr (dev, offset); - -return dev->bus_ops->rmw (mdev, addr, mask, val); -} -static int mt7921_dma_disable (struct mt7921_dev *dev,bool force) {if (force) {
@@ -341,23 +237,8 @@ int mt7921_wpdma_reinit_cond(struct mt7921_dev *dev)int mt7921_dma_init (struct mt7921_dev *dev) { -struct mt76_bus_ops *bus_ops;int ret; - dev->phy.dev = dev; - dev->phy.mt76 = &dev->mt76.phy; - dev->mt76.phy.priv = &dev->phy; - dev->bus_ops = dev->mt76.bus; - bus_ops =devm_kmemdup (dev->mt76.dev, dev->bus_ops,sizeof (*bus_ops), -GFP_KERNEL ); -if (!bus_ops) -return -ENOMEM ; - - bus_ops->rr = mt7921_rr; - bus_ops->wr = mt7921_wr; - bus_ops->rmw = mt7921_rmw; - dev->mt76.bus = bus_ops; -mt76_dma_attach (&dev->mt76); ret =mt7921_dma_disable (dev, true);
drivers/net/wireless/mediatek/mt76/mt7921/mt7921.h +1 -0
@@ -452,6 +452,7 @@ int mt7921e_mcu_init(struct mt7921_dev *dev);int mt7921s_wfsys_reset (struct mt7921_dev *dev);int mt7921s_mac_reset (struct mt7921_dev *dev);int mt7921s_init_reset (struct mt7921_dev *dev); +int __mt7921e_mcu_drv_pmctrl (struct mt7921_dev *dev);int mt7921e_mcu_drv_pmctrl (struct mt7921_dev *dev);int mt7921e_mcu_fw_pmctrl (struct mt7921_dev *dev);
drivers/net/wireless/mediatek/mt76/mt7921/pci.c +124 -0
142 lines not on this page · raw message
drivers/net/wireless/mediatek/mt76/mt7921/pci_mcu.c +14 -4
@@ -59,10 +59,8 @@ int mt7921e_mcu_init(struct mt7921_dev *dev)return err; } -int mt7921e_mcu_drv_pmctrl (struct mt7921_dev *dev) +int __mt7921e_mcu_drv_pmctrl (struct mt7921_dev *dev) { -struct mt76_phy *mphy = &dev->mt76.phy; -struct mt76_connac_pm *pm = &dev->pm;int i, err =0 ;for (i =0 ; i <MT7921_DRV_OWN_RETRY_COUNT ; i++) {
@@ -75,9 +73,21 @@ int mt7921e_mcu_drv_pmctrl(struct mt7921_dev *dev)if (i ==MT7921_DRV_OWN_RETRY_COUNT ) {dev_err (dev->mt76.dev,"driver own failed\n" ); err = -EIO ; - goto out; } +return err; +} + +int mt7921e_mcu_drv_pmctrl (struct mt7921_dev *dev) +{ +struct mt76_phy *mphy = &dev->mt76.phy; +struct mt76_connac_pm *pm = &dev->pm; +int err; + + err =__mt7921e_mcu_drv_pmctrl (dev); +if (err <0 ) + goto out; +mt7921_wpdma_reinit_cond (dev);clear_bit (MT76_STATE_PM , &mphy->state);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 463/1017 mt76: mt7603: check sta_rates pointer in mt7603_sta_rate_tbl_update
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit fc8e2c707ce11c8ec2e992885b0d53a5e04031ac ]
Check sta_rates pointer value in mt7603_sta_rate_tbl_update routine since minstrel_ht_update_rates can fail allocating rates array.
--- drivers/net/wireless/mediatek/mt76/mt7603/main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7603/main.c +3 -0
@@ -623,6 +623,9 @@ mt7603_sta_rate_tbl_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif,struct ieee80211_sta_rates *sta_rates =rcu_dereference (sta->rates);int i; +if (!sta_rates) +return ; +spin_lock_bh (&dev->mt76.lock);for (i =0 ; i <ARRAY_SIZE (msta->rates); i++) { msta->rates[i].idx = sta_rates->rate[i].idx;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 464/1017 mt76: mt7615: check sta_rates pointer in mt7615_sta_rate_tbl_update
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 6a6f457ed5fdf6777536c20644a9e42128a50ec2 ]
Check sta_rates pointer value in mt7615_sta_rate_tbl_update routine since minstrel_ht_update_rates can fail allocating rates array.
--- drivers/net/wireless/mediatek/mt76/mt7615/main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7615/main.c +3 -0
@@ -686,6 +686,9 @@ static void mt7615_sta_rate_tbl_update(struct ieee80211_hw *hw,struct ieee80211_sta_rates *sta_rates =rcu_dereference (sta->rates);int i; +if (!sta_rates) +return ; +spin_lock_bh (&dev->mt76.lock);for (i =0 ; i <ARRAY_SIZE (msta->rates); i++) { msta->rates[i].idx = sta_rates->rate[i].idx;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 465/1017 mt76: mt7915: fix possible memory leak in mt7915_mcu_add_sta
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit a43736cd12d82913102eb49cb56787a5553e028f ]
Free allocated skb in mt7915_mcu_add_sta routine in case of failures.
--- drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +6 -2
@@ -2397,8 +2397,10 @@ int mt7915_mcu_add_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif, } ret =mt7915_mcu_sta_wtbl_tlv (dev, skb, vif, sta); -if (ret) +if (ret) { +dev_kfree_skb (skb);return ret; + }if (sta && sta->ht_cap.ht_supported) {/* starec amsdu */
@@ -2412,8 +2414,10 @@ int mt7915_mcu_add_sta(struct mt7915_dev *dev, struct ieee80211_vif *vif, } ret =mt7915_mcu_add_group (dev, vif, sta); -if (ret) +if (ret) { +dev_kfree_skb (skb);return ret; + } out:return mt76_mcu_skb_send_msg (&dev->mt76, skb,MCU_EXT_CMD (STA_REC_UPDATE ), true);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 466/1017 mt76: mt7915: fix mcs_map in mt7915_mcu_set_sta_he_mcs()
In reply to Greg Kroah-HartmanFrom: Peter Chiu <[email protected]>
[ Upstream commit ade25ca7950bc8930356d98ec89aa41560a9dab5 ]
Should use peer's bandwidth instead of chandef->width to get correct mcs_map.
--- .../net/wireless/mediatek/mt76/mt7915/mcu.c | 29 +++++-------------- 1 file changed, 8 insertions(+), 21 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +8 -21
@@ -211,24 +211,12 @@ mt7915_mcu_get_sta_nss(u16 mcs_map)static void mt7915_mcu_set_sta_he_mcs (struct ieee80211_sta *sta,__le16 *he_mcs, -const u16 *mask) +u16 mcs_map) {struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; -struct cfg80211_chan_def *chandef = &msta->vif->phy->mt76->chandef; +enum nl80211_band band = msta->vif->phy->mt76->chandef.chan->band; +const u16 *mask = msta->vif->bitrate_mask.control[band].he_mcs;int nss, max_nss = sta->rx_nss >3 ?4 : sta->rx_nss; -u16 mcs_map; - -switch (chandef->width) { -case NL80211_CHAN_WIDTH_80P80 : - mcs_map =le16_to_cpu (sta->he_cap.he_mcs_nss_supp.rx_mcs_80p80); -break ; -case NL80211_CHAN_WIDTH_160 : - mcs_map =le16_to_cpu (sta->he_cap.he_mcs_nss_supp.rx_mcs_160); -break ; -default : - mcs_map =le16_to_cpu (sta->he_cap.he_mcs_nss_supp.rx_mcs_80); -break ; - }for (nss =0 ; nss < max_nss; nss++) {int mcs;
@@ -1344,11 +1332,9 @@ static void mt7915_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta, struct ieee80211_vif *vif) { - struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv; struct mt7915_vif *mvif = (struct mt7915_vif *)vif->drv_priv;struct ieee80211_he_cap_elem *elem = &sta->he_cap.he_cap_elem; -enum nl80211_band band = msta->vif->phy->mt76->chandef.chan->band; -const u16 *mcs_mask = msta->vif->bitrate_mask.control[band].he_mcs; +struct ieee80211_he_mcs_nss_supp mcs_map;struct sta_rec_he *he;struct tlv *tlv;u32 cap =0 ;
@@ -1438,22 +1424,23 @@ mt7915_mcu_sta_he_tlv(struct sk_buff *skb, struct ieee80211_sta *sta, he->he_cap =cpu_to_le32 (cap); + mcs_map = sta->he_cap.he_mcs_nss_supp;switch (sta->bandwidth) {case IEEE80211_STA_RX_BW_160 :if (elem->phy_cap_info[0 ] &IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G )mt7915_mcu_set_sta_he_mcs (sta, &he->max_nss_mcs[CMD_HE_MCS_BW8080 ], - mcs_mask); +le16_to_cpu (mcs_map.rx_mcs_80p80));mt7915_mcu_set_sta_he_mcs (sta, &he->max_nss_mcs[CMD_HE_MCS_BW160 ], - mcs_mask); +le16_to_cpu (mcs_map.rx_mcs_160)); fallthrough;default :mt7915_mcu_set_sta_he_mcs (sta, &he->max_nss_mcs[CMD_HE_MCS_BW80 ], - mcs_mask); +le16_to_cpu (mcs_map.rx_mcs_80));break ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 467/1017 mt76: mt7915: fix the nss setting in bitrates
In reply to Greg Kroah-HartmanFrom: MeiChia Chiu <[email protected]>
[ Upstream commit c41d2a075206fcbdc89695b874a6ac06160b4f1a ]
without this change, the fixed MCS only supports 1 Nss.
--- drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +6 -3
@@ -2124,9 +2124,12 @@ mt7915_mcu_add_rate_ctrl_fixed(struct mt7915_dev *dev, phy.sgi |= gi << (i << (_he)); \ phy.he_ltf |= mask->control[band].he_ltf << (i << (_he));\ } \ -for (i =0 ; i <ARRAY_SIZE (mask->control[band]._mcs); i++) \ - nrates +=hweight16 (mask->control[band]._mcs[i]); \ - phy.mcs =ffs (mask->control[band]._mcs[0 ]) -1 ; \ +for (i =0 ; i <ARRAY_SIZE (mask->control[band]._mcs); i++) { \ +if (!mask->control[band]._mcs[i]) \ +continue ; \ + nrates +=hweight16 (mask->control[band]._mcs[i]); \ + phy.mcs =ffs (mask->control[band]._mcs[i]) -1 ; \ + } \ }while (0 )if (sta->he_cap.has_he) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 468/1017 ptp: unregister virtual clocks when unregistering physical clock.
In reply to Greg Kroah-HartmanFrom: Miroslav Lichvar <[email protected]>
[ Upstream commit bfcbb76b0f595ea9ede9f7a218086fef85242f10 ]
When unregistering a physical clock which has some virtual clocks, unregister the virtual clocks with it.
This fixes the following oops, which can be triggered by unloading a driver providing a PTP clock when it has enabled virtual clocks:
BUG: unable to handle page fault for address: ffffffffc04fc4d8 Oops: 0000 [#1] PREEMPT SMP NOPTI RIP: 0010:ptp_vclock_read+0x31/0xb0 Call Trace: timecounter_read+0xf/0x50 ptp_vclock_refresh+0x2c/0x50 ? ptp_clock_release+0x40/0x40 ptp_aux_kworker+0x17/0x30 kthread_worker_fn+0x9b/0x240 ? kthread_should_park+0x30/0x30 kthread+0xe2/0x110 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x22/0x30
--- drivers/ptp/ptp_clock.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/ptp/ptp_clock.c +9 -2
@@ -317,11 +317,18 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, }EXPORT_SYMBOL (ptp_clock_register); +static int unregister_vclock (struct device *dev,void *data) +{ +struct ptp_clock *ptp =dev_get_drvdata (dev); + +ptp_vclock_unregister (info_to_vclock (ptp->info)); +return 0 ; +} +int ptp_clock_unregister (struct ptp_clock *ptp) {if (ptp_vclock_in_use (ptp)) { -pr_err ("ptp: virtual clock in use\n" ); -return -EBUSY ; +device_for_each_child (&ptp->dev,NULL , unregister_vclock); } ptp->defunct =1 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 469/1017 net: dsa: mv88e6xxx: Enable port policy support on 6097
In reply to Greg Kroah-HartmanFrom: Tobias Waldekranz <[email protected]>
[ Upstream commit 585d42bb57bb358d48906660a8de273b078810b1 ]
This chip has support for the same per-port policy actions found in later versions of LinkStreet devices.
--- drivers/net/dsa/mv88e6xxx/chip.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/dsa/mv88e6xxx/chip.c +1 -0
@@ -3655,6 +3655,7 @@ static const struct mv88e6xxx_ops mv88e6097_ops = { .port_sync_link = mv88e6185_port_sync_link, .port_set_speed_duplex = mv88e6185_port_set_speed_duplex, .port_tag_remap = mv88e6095_port_tag_remap, + .port_set_policy = mv88e6352_port_set_policy, .port_set_frame_mode = mv88e6351_port_set_frame_mode, .port_set_ucast_flood = mv88e6352_port_set_ucast_flood, .port_set_mcast_flood = mv88e6352_port_set_mcast_flood,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 470/1017 bpf: Fix a btf decl_tag bug when tagging a function
In reply to Greg Kroah-HartmanFrom: Yonghong Song <[email protected]>
[ Upstream commit d7e7b42f4f956f2c68ad8cda87d750093dbba737 ]
syzbot reported a btf decl_tag bug with stack trace below:
general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] CPU: 0 PID: 3592 Comm: syz-executor914 Not tainted 5.16.0-syzkaller-11424-gb7892f7d5cb2 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:btf_type_vlen include/linux/btf.h:231 [inline] RIP: 0010:btf_decl_tag_resolve+0x83e/0xaa0 kernel/bpf/btf.c:3910 ... Call Trace: <TASK> btf_resolve+0x251/0x1020 kernel/bpf/btf.c:4198 btf_check_all_types kernel/bpf/btf.c:4239 [inline] btf_parse_type_sec kernel/bpf/btf.c:4280 [inline] btf_parse kernel/bpf/btf.c:4513 [inline] btf_new_fd+0x19fe/0x2370 kernel/bpf/btf.c:6047 bpf_btf_load kernel/bpf/syscall.c:4039 [inline] __sys_bpf+0x1cbb/0x5970 kernel/bpf/syscall.c:4679 __do_sys_bpf kernel/bpf/syscall.c:4738 [inline] __se_sys_bpf kernel/bpf/syscall.c:4736 [inline] __x64_sys_bpf+0x75/0xb0 kernel/bpf/syscall.c:4736 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae
The kasan error is triggered with an illegal BTF like below:
type 0: void
type 1: int
type 2: decl_tag to func type 3
type 3: func to func_proto type 8
The total number of types is 4 and the type 3 is illegal since its func_proto type is out of range.
Currently, the target type of decl_tag can be struct/union, var or func. Both struct/union and var implemented their own 'resolve' callback functions and hence handled properly in kernel.
But func type doesn't have 'resolve' callback function. When btf_decl_tag_resolve() tries to check func type, it tries to get vlen of its func_proto type, which triggered the above kasan error.
To fix the issue, btf_decl_tag_resolve() needs to do btf_func_check() before trying to accessing func_proto type.
In the current implementation, func type is checked with btf_func_check() in the main checking function btf_check_all_types(). To fix the above kasan issue, let us implement 'resolve' callback func type properly. The 'resolve' callback will be also called in btf_check_all_types() for func types.
--- kernel/bpf/btf.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-)
kernel/bpf/btf.c +21 -8
@@ -401,6 +401,9 @@ static struct btf_type btf_void;static int btf_resolve (struct btf_verifier_env *env,const struct btf_type *t,u32 type_id); +static int btf_func_check (struct btf_verifier_env *env, +const struct btf_type *t); +static bool btf_type_is_modifier (const struct btf_type *t) {/* Some of them is not strictly a C modifier
@@ -576,6 +579,7 @@ static bool btf_type_needs_resolve(const struct btf_type *t)btf_type_is_struct (t) ||btf_type_is_array (t) ||btf_type_is_var (t) || +btf_type_is_func (t) ||btf_type_is_decl_tag (t) ||btf_type_is_datasec (t); }
@@ -3521,9 +3525,24 @@ static s32 btf_func_check_meta(struct btf_verifier_env *env,return 0 ; } +static int btf_func_resolve (struct btf_verifier_env *env, +const struct resolve_vertex *v) +{ +const struct btf_type *t = v->t; +u32 next_type_id = t->type; +int err; + + err =btf_func_check (env, t); +if (err) +return err; + +env_stack_pop_resolved (env, next_type_id,0 ); +return 0 ; +} +static struct btf_kind_operations func_ops = { .check_meta = btf_func_check_meta, - .resolve = btf_df_resolve, + .resolve = btf_func_resolve, .check_member = btf_df_check_member, .check_kflag_member = btf_df_check_kflag_member, .log_details = btf_ref_type_log,
@@ -4143,7 +4162,7 @@ static bool btf_resolve_valid(struct btf_verifier_env *env,return !btf_resolved_type_id (btf, type_id) && !btf_resolved_type_size (btf, type_id); -if (btf_type_is_decl_tag (t)) +if (btf_type_is_decl_tag (t) ||btf_type_is_func (t))return btf_resolved_type_id (btf, type_id) && !btf_resolved_type_size (btf, type_id);
@@ -4233,12 +4252,6 @@ static int btf_check_all_types(struct btf_verifier_env *env)if (err)return err; } - -if (btf_type_is_func (t)) { - err =btf_func_check (env, t); -if (err) -return err; - } }return 0 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 471/1017 mac80211: Remove a couple of obsolete TODO
In reply to Greg Kroah-HartmanFrom: Ilan Peer <[email protected]>
[ Upstream commit cee04f3c3a00ffd2a2a6ed1028e0ab58a3a28d25 ]
The HE capability IE is an extension IE so remove
an irrelevant comments.
--- net/mac80211/main.c | 13 +++++-------- net/mac80211/mlme.c | 4 ---- 2 files changed, 5 insertions(+), 12 deletions(-)
net/mac80211/main.c +5 -8
@@ -1131,17 +1131,14 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) local->scan_ies_len +=2 +sizeof (struct ieee80211_vht_cap ); -/* HE cap element is variable in size - set len to allow max size */ /* -* TODO: 1 is added at the end of the calculation to accommodate for -* the temporary placing of the HE capabilities IE under EXT. -* Remove it once it is placed in the final place. -*/ -if (supp_he) +* HE cap element is variable in size - set len to allow max size */ +if (supp_he) { local->scan_ies_len += -2 +sizeof (struct ieee80211_he_cap_elem ) + +3 +sizeof (struct ieee80211_he_cap_elem ) +sizeof (struct ieee80211_he_mcs_nss_supp ) + -IEEE80211_HE_PPE_THRES_MAX_LEN +1 ; +IEEE80211_HE_PPE_THRES_MAX_LEN ; + }if (!local->ops->hw_scan) {/* For hw_scan, driver needs to set these up. */
net/mac80211/mlme.c +0 -4
@@ -650,10 +650,6 @@ static void ieee80211_add_he_ie(struct ieee80211_sub_if_data *sdata,if (!he_cap || !reg_cap)return ; -/* -* TODO: the 1 added is because this temporarily is under the EXTENSION -* IE. Get rid of it when it moves. -*/ he_cap_size =2 +1 +sizeof (he_cap->he_cap_elem) + ieee80211_he_mcs_nss_size(&he_cap->he_cap_elem) +
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 472/1017 mac80211: limit bandwidth in HE capabilities
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 1f2c104448477512fcf7296df54bfbc3a6f9a765 ]
If we're limiting bandwidth for some reason such as regulatory restrictions, then advertise that limitation just like we do for VHT today, so the AP is aware we cannot use the higher BW it might be using.
--- net/mac80211/ieee80211_i.h | 2 +- net/mac80211/mesh.c | 2 +- net/mac80211/mlme.c | 11 ++++++++--- net/mac80211/util.c | 27 ++++++++++++++++++++++----- 4 files changed, 32 insertions(+), 10 deletions(-)
net/mac80211/ieee80211_i.h +1 -1
@@ -2380,7 +2380,7 @@ u8 *ieee80211_ie_build_vht_cap(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap,u8 *ieee80211_ie_build_vht_oper (u8 *pos,struct ieee80211_sta_vht_cap *vht_cap,const struct cfg80211_chan_def *chandef);u8 ieee80211_ie_len_he_cap (struct ieee80211_sub_if_data *sdata,u8 iftype); -u8 *ieee80211_ie_build_he_cap (u8 *pos, +u8 *ieee80211_ie_build_he_cap (u32 disable_flags,u8 *pos,const struct ieee80211_sta_he_cap *he_cap,u8 *end); void ieee80211_ie_build_he_6ghz_cap(struct ieee80211_sub_if_data *sdata,
net/mac80211/mesh.c +1 -1
@@ -580,7 +580,7 @@ int mesh_add_he_cap_ie(struct ieee80211_sub_if_data *sdata,return -ENOMEM ; pos =skb_put (skb, ie_len); -ieee80211_ie_build_he_cap (pos, he_cap, pos + ie_len); +ieee80211_ie_build_he_cap (0 , pos, he_cap, pos + ie_len);return 0 ; }
net/mac80211/mlme.c +8 -3
@@ -630,7 +630,7 @@ static void ieee80211_add_he_ie(struct ieee80211_sub_if_data *sdata,struct sk_buff *skb, struct ieee80211_supported_band *sband) { - u8 *pos; + u8 *pos, *pre_he_pos;const struct ieee80211_sta_he_cap *he_cap =NULL ;struct ieee80211_chanctx_conf *chanctx_conf;u8 he_cap_size;
@@ -647,16 +647,21 @@ static void ieee80211_add_he_ie(struct ieee80211_sub_if_data *sdata, he_cap =ieee80211_get_he_iftype_cap (sband,ieee80211_vif_type_p2p (&sdata->vif)); -if (!he_cap || !reg_cap) +if (!he_cap || !chanctx_conf || !reg_cap)return ; +/* get a max size estimate */ he_cap_size =2 +1 +sizeof (he_cap->he_cap_elem) +ieee80211_he_mcs_nss_size (&he_cap->he_cap_elem) +ieee80211_he_ppe_size (he_cap->ppe_thres[0 ], he_cap->he_cap_elem.phy_cap_info); pos =skb_put (skb, he_cap_size); -ieee80211_ie_build_he_cap (pos, he_cap, pos + he_cap_size); + pre_he_pos = pos; + pos =ieee80211_ie_build_he_cap (sdata->u.mgd.flags, + pos, he_cap, pos + he_cap_size); +/* trim excess if any */ +skb_trim (skb, skb->len - (pre_he_pos + he_cap_size - pos));ieee80211_ie_build_he_6ghz_cap (sdata, skb); }
net/mac80211/util.c +22 -5
@@ -1961,7 +1961,7 @@ static int ieee80211_build_preq_ies_band(struct ieee80211_sub_if_data *sdata,if (he_cap &&cfg80211_any_usable_channels (local->hw.wiphy,BIT (sband->band),IEEE80211_CHAN_NO_HE )) { - pos =ieee80211_ie_build_he_cap (pos, he_cap, end); + pos =ieee80211_ie_build_he_cap (0 , pos, he_cap, end);if (!pos) goto out_err; }
@@ -2905,10 +2905,11 @@ u8 ieee80211_ie_len_he_cap(struct ieee80211_sub_if_data *sdata, u8 iftype) he_cap->he_cap_elem.phy_cap_info); } -u8 *ieee80211_ie_build_he_cap (u8 *pos, +u8 *ieee80211_ie_build_he_cap (u32 disable_flags,u8 *pos,const struct ieee80211_sta_he_cap *he_cap,u8 *end) { +struct ieee80211_he_cap_elem elem;u8 n;u8 ie_len;u8 *orig_pos = pos;
@@ -2921,7 +2922,23 @@ u8 *ieee80211_ie_build_he_cap(u8 *pos,if (!he_cap)return orig_pos; - n =ieee80211_he_mcs_nss_size (&he_cap->he_cap_elem); +/* modify on stack first to calculate 'n' and 'ie_len' correctly */ + elem = he_cap->he_cap_elem; + +if (disable_flags &IEEE80211_STA_DISABLE_40MHZ ) + elem.phy_cap_info[0 ] &= + ~(IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G | +IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G ); + +if (disable_flags &IEEE80211_STA_DISABLE_160MHZ ) + elem.phy_cap_info[0 ] &= + ~IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G ; + +if (disable_flags &IEEE80211_STA_DISABLE_80P80MHZ ) + elem.phy_cap_info[0 ] &= + ~IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G ; + + n =ieee80211_he_mcs_nss_size (&elem); ie_len =2 +1 +sizeof (he_cap->he_cap_elem) + n + ieee80211_he_ppe_size(he_cap->ppe_thres[0],
@@ -2935,8 +2952,8 @@ u8 *ieee80211_ie_build_he_cap(u8 *pos, *pos++ =WLAN_EID_EXT_HE_CAPABILITY ;/* Fixed data */ -memcpy (pos, &he_cap->he_cap_elem,sizeof (he_cap->he_cap_elem)); - pos +=sizeof (he_cap->he_cap_elem); +memcpy (pos, &elem,sizeof (elem)); + pos +=sizeof (elem);memcpy (pos, &he_cap->he_mcs_nss_supp, n); pos += n;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 473/1017 scripts/dtc: Call pkg-config POSIXly correct
In reply to Greg Kroah-HartmanFrom: Thomas Bracht Laumann Jespersen <[email protected]>
[ Upstream commit a8b309ce9760943486e0585285e0125588a31650 ]
Running with POSIXLY_CORRECT=1 in the environment the scripts/dtc build fails, because pkg-config doesn't output anything when the flags come after the arguments.
--- scripts/dtc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/dtc/Makefile +1 -1
@@ -29,7 +29,7 @@ dtc-objs += yamltree.o # To include <yaml.h> installed in a non-default path HOSTCFLAGS_yamltree.o := $(shell pkg-config --cflags yaml-0.1) # To link libyaml installed in a non-default path -HOSTLDLIBS_dtc := $(shell pkg-config yaml-0.1 --libs) +HOSTLDLIBS_dtc := $(shell pkg-config --libs yaml-0.1) endif # Generated files need one more search path to include headers in source tree
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 474/1017 livepatch: Fix build failure on 32 bits processors
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit 2f293651eca3eacaeb56747dede31edace7329d2 ]
Trying to build livepatch on powerpc/32 results in:
kernel/livepatch/core.c: In function 'klp_resolve_symbols':
kernel/livepatch/core.c:221:23: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
221 | sym = (Elf64_Sym *)sechdrs[symndx].sh_addr + ELF_R_SYM(relas[i].r_info);
| ^
kernel/livepatch/core.c:221:21: error: assignment to 'Elf32_Sym *' {aka 'struct elf32_sym *'} from incompatible pointer type 'Elf64_Sym *' {aka 'struct elf64_sym *'} [-Werror=incompatible-pointer-types]
221 | sym = (Elf64_Sym *)sechdrs[symndx].sh_addr + ELF_R_SYM(relas[i].r_info);
| ^
kernel/livepatch/core.c: In function 'klp_apply_section_relocs':
kernel/livepatch/core.c:312:35: error: passing argument 1 of 'klp_resolve_symbols' from incompatible pointer type [-Werror=incompatible-pointer-types]
312 | ret = klp_resolve_symbols(sechdrs, strtab, symndx, sec, sec_objname);
| ^~~~~~~
| |
| Elf32_Shdr * {aka struct elf32_shdr *}
kernel/livepatch/core.c:193:44: note: expected 'Elf64_Shdr *' {aka 'struct elf64_shdr *'} but argument is of type 'Elf32_Shdr *' {aka 'struct elf32_shdr *'}
193 | static int klp_resolve_symbols(Elf64_Shdr *sechdrs, const char *strtab,
| ~~~~~~~~~~~~^~~~~~~Fix it by using the right types instead of forcing 64 bits types.
--- kernel/livepatch/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/livepatch/core.c +2 -2
@@ -190,7 +190,7 @@ static int klp_find_object_symbol(const char *objname, const char *name,return -EINVAL ; } -static int klp_resolve_symbols (Elf64_Shdr *sechdrs,const char *strtab, +static int klp_resolve_symbols (Elf_Shdr *sechdrs,const char *strtab,unsigned int symndx,Elf_Shdr *relasec,const char *sec_objname) {
@@ -218,7 +218,7 @@ static int klp_resolve_symbols(Elf64_Shdr *sechdrs, const char *strtab, relas = (Elf_Rela *) relasec->sh_addr;/* For each rela in this klp relocation section */ for (i =0 ; i < relasec->sh_size /sizeof (Elf_Rela); i++) { - sym = (Elf64_Sym *)sechdrs[symndx].sh_addr +ELF_R_SYM (relas[i].r_info); + sym = (Elf_Sym *)sechdrs[symndx].sh_addr +ELF_R_SYM (relas[i].r_info);if (sym->st_shndx !=SHN_LIVEPATCH ) {pr_err ("symbol %s is not marked as a livepatch symbol\n" , strtab + sym->st_name);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 475/1017 net: asix: add proper error handling of usb read errors
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 920a9fa27e7805499cfe78491b36fed2322c02ec ]
Syzbot once again hit uninit value in asix driver. The problem still the same -- asix_read_cmd() reads less bytes, than was requested by caller.
Since all read requests are performed via asix_read_cmd() let's catch usb related error there and add __must_check notation to be sure all callers actually check return value.
So, this patch adds sanity check inside asix_read_cmd(), that simply checks if bytes read are not less, than was requested and adds missing error handling of asix_read_cmd() all across the driver code.
--- drivers/net/usb/asix.h | 4 ++-- drivers/net/usb/asix_common.c | 19 +++++++++++++------ drivers/net/usb/asix_devices.c | 21 ++++++++++++++++++--- 3 files changed, 33 insertions(+), 11 deletions(-)
drivers/net/usb/asix.h +2 -2
@@ -192,8 +192,8 @@ extern const struct driver_info ax88172a_info;/* ASIX specific flags */ #define FLAG_EEPROM_MAC (1UL << 0)/* init device MAC from eeprom */ -int asix_read_cmd (struct usbnet *dev,u8 cmd,u16 value,u16 index, -u16 size,void *data,int in_pm); +int __must_check asix_read_cmd (struct usbnet *dev,u8 cmd,u16 value,u16 index, +u16 size,void *data,int in_pm);int asix_write_cmd (struct usbnet *dev,u8 cmd,u16 value,u16 index,u16 size,void *data,int in_pm);
drivers/net/usb/asix_common.c +13 -6
@@ -11,8 +11,8 @@#define AX_HOST_EN_RETRIES 30 -int asix_read_cmd (struct usbnet *dev,u8 cmd,u16 value,u16 index, -u16 size,void *data,int in_pm) +int __must_check asix_read_cmd (struct usbnet *dev,u8 cmd,u16 value,u16 index, +u16 size,void *data,int in_pm) {int ret;int (*fn)(struct usbnet *,u8 ,u8 ,u16 ,u16 ,void *,u16 );
@@ -27,9 +27,12 @@ int asix_read_cmd(struct usbnet *dev, u8 cmd, u16 value, u16 index, ret =fn (dev, cmd,USB_DIR_IN |USB_TYPE_VENDOR |USB_RECIP_DEVICE , value, index, data, size); -if (unlikely (ret <0 )) +if (unlikely (ret < size)) { + ret = ret <0 ? ret : -ENODATA ; +netdev_warn (dev->net,"Failed to read reg index 0x%04x: %d\n" , index, ret); + }return ret; }
@@ -79,7 +82,7 @@ static int asix_check_host_enable(struct usbnet *dev, int in_pm) 0, 0, 1, &smsr, in_pm);if (ret == -ENODEV )break ; -else if (ret <sizeof (smsr)) +else if (ret <0 )continue ;else if (smsr &AX_HOST_EN )break ;
@@ -579,8 +582,12 @@ int asix_mdio_read_nopm(struct net_device *netdev, int phy_id, int loc)return ret; } -asix_read_cmd (dev,AX_CMD_READ_MII_REG , phy_id, - (__u16 )loc,2 , &res,1 ); + ret =asix_read_cmd (dev,AX_CMD_READ_MII_REG , phy_id, + (__u16 )loc,2 , &res,1 ); +if (ret <0 ) { +mutex_unlock (&dev->phy_mutex); +return ret; + }asix_set_hw_mii (dev,1 );mutex_unlock (&dev->phy_mutex);
drivers/net/usb/asix_devices.c +18 -3
@@ -755,7 +755,12 @@ static int ax88772_bind(struct usbnet *dev, struct usb_interface *intf) priv->phy_addr = ret; priv->embd_phy = ((priv->phy_addr &0x1f ) ==0x10 ); -asix_read_cmd (dev,AX_CMD_STATMNGSTS_REG ,0 ,0 ,1 , &chipcode,0 ); + ret =asix_read_cmd (dev,AX_CMD_STATMNGSTS_REG ,0 ,0 ,1 , &chipcode,0 ); +if (ret <0 ) { +netdev_dbg (dev->net,"Failed to read STATMNGSTS_REG: %d\n" , ret); +return ret; + } + chipcode &=AX_CHIPCODE_MASK ; ret = (chipcode == AX_AX88772_CHIPCODE) ? ax88772_hw_reset(dev, 0) :
@@ -920,11 +925,21 @@ static int ax88178_reset(struct usbnet *dev)int gpio0 =0 ;u32 phyid; -asix_read_cmd (dev,AX_CMD_READ_GPIOS ,0 ,0 ,1 , &status,0 ); + ret =asix_read_cmd (dev,AX_CMD_READ_GPIOS ,0 ,0 ,1 , &status,0 ); +if (ret <0 ) { +netdev_dbg (dev->net,"Failed to read GPIOS: %d\n" , ret); +return ret; + } +netdev_dbg (dev->net,"GPIO Status: 0x%04x\n" , status);asix_write_cmd (dev,AX_CMD_WRITE_ENABLE ,0 ,0 ,0 ,NULL ,0 ); -asix_read_cmd (dev,AX_CMD_READ_EEPROM ,0x0017 ,0 ,2 , &eeprom,0 ); + ret =asix_read_cmd (dev,AX_CMD_READ_EEPROM ,0x0017 ,0 ,2 , &eeprom,0 ); +if (ret <0 ) { +netdev_dbg (dev->net,"Failed to read EEPROM: %d\n" , ret); +return ret; + } +asix_write_cmd (dev,AX_CMD_WRITE_DISABLE ,0 ,0 ,0 ,NULL ,0 );netdev_dbg (dev->net,"EEPROM index 0x17 is 0x%04x\n" , eeprom);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 476/1017 i2c: bcm2835: Use platform_get_irq() to get the interrupt
In reply to Greg Kroah-HartmanFrom: Lad Prabhakar <[email protected]>
[ Upstream commit c3b2f911ac11892b672df7829becf28d3a830073 ]
platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static allocation of IRQ resources in DT core code, this causes an issue when using hierarchical interrupt domains using "interrupts" property in the node as this bypasses the hierarchical setup and messes up the irq chaining.
In preparation for removal of static setup of IRQ resource from DT core code use platform_get_irq().
--- drivers/i2c/busses/i2c-bcm2835.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/i2c/busses/i2c-bcm2835.c +4 -7
@@ -407,7 +407,7 @@ static const struct i2c_adapter_quirks bcm2835_i2c_quirks = {static int bcm2835_i2c_probe (struct platform_device *pdev) {struct bcm2835_i2c_dev *i2c_dev; -struct resource *mem, *irq; +struct resource *mem;int ret;struct i2c_adapter *adap;struct clk *mclk;
@@ -457,12 +457,9 @@ static int bcm2835_i2c_probe(struct platform_device *pdev)return ret; } - irq =platform_get_resource (pdev,IORESOURCE_IRQ ,0 ); -if (!irq) { -dev_err (&pdev->dev,"No IRQ resource\n" ); -return -ENODEV ; - } - i2c_dev->irq = irq->start; + i2c_dev->irq =platform_get_irq (pdev,0 ); +if (i2c_dev->irq <0 ) +return i2c_dev->irq; ret =request_irq (i2c_dev->irq, bcm2835_i2c_isr,IRQF_SHARED ,dev_name (&pdev->dev), i2c_dev);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 477/1017 i2c: bcm2835: Fix the error handling in bcm2835_i2c_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit b205f5850263632b6897d8f0bfaeeea4955f8663 ]
Some resource should be released if an error occurs in 'bcm2835_i2c_probe()'.
Add an error handling path and the needed 'clk_disable_unprepare()' and 'clk_rate_exclusive_put()' calls.
While at it, rework the bottom of the function to use this newly added error handling path and have an explicit and more standard "return 0;" at the end of the normal path.
--- drivers/i2c/busses/i2c-bcm2835.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
drivers/i2c/busses/i2c-bcm2835.c +16 -5
@@ -454,18 +454,20 @@ static int bcm2835_i2c_probe(struct platform_device *pdev) ret =clk_prepare_enable (i2c_dev->bus_clk);if (ret) {dev_err (&pdev->dev,"Couldn't prepare clock" ); -return ret; + goto err_put_exclusive_rate; } i2c_dev->irq =platform_get_irq (pdev,0 ); -if (i2c_dev->irq <0 ) -return i2c_dev->irq; +if (i2c_dev->irq <0 ) { + ret = i2c_dev->irq; + goto err_disable_unprepare_clk; + } ret =request_irq (i2c_dev->irq, bcm2835_i2c_isr,IRQF_SHARED ,dev_name (&pdev->dev), i2c_dev);if (ret) {dev_err (&pdev->dev,"Could not request IRQ\n" ); -return -ENODEV ; + goto err_disable_unprepare_clk; } adap = &i2c_dev->adapter;
@@ -489,7 +491,16 @@ static int bcm2835_i2c_probe(struct platform_device *pdev) ret =i2c_add_adapter (adap);if (ret) -free_irq (i2c_dev->irq, i2c_dev); + goto err_free_irq; + +return 0 ; + +err_free_irq: +free_irq (i2c_dev->irq, i2c_dev); +err_disable_unprepare_clk: +clk_disable_unprepare (i2c_dev->bus_clk); +err_put_exclusive_rate: +clk_rate_exclusive_put (i2c_dev->bus_clk);return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 478/1017 mtd: mchp23k256: Add SPI ID table
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
[ Upstream commit bc7ee2e34b219da6813c17a1680dd20766648883 ]
Currently autoloading for SPI devices does not use the DT ID table, it uses SPI modalises. Supporting OF modalises is going to be difficult if not impractical, an attempt was made but has been reverted, so ensure that module autoloading works for this driver by adding an id_table listing the SPI IDs for everything.
--- drivers/mtd/devices/mchp23k256.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/mtd/devices/mchp23k256.c +14 -0
@@ -229,6 +229,19 @@ static const struct of_device_id mchp23k256_of_table[] = { };MODULE_DEVICE_TABLE (of, mchp23k256_of_table); +static const struct spi_device_id mchp23k256_spi_ids[] = { + { + .name ="mchp23k256" , + .driver_data = (kernel_ulong_t)&mchp23k256_caps, + }, + { + .name ="mchp23lcv1024" , + .driver_data = (kernel_ulong_t)&mchp23lcv1024_caps, + }, + {} +}; +MODULE_DEVICE_TABLE (spi, mchp23k256_spi_ids); +static struct spi_driver mchp23k256_driver = { .driver = { .name ="mchp23k256" ,
@@ -236,6 +249,7 @@ static struct spi_driver mchp23k256_driver = { }, .probe = mchp23k256_probe, .remove = mchp23k256_remove, + .id_table = mchp23k256_spi_ids, };module_spi_driver (mchp23k256_driver);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 479/1017 mtd: mchp48l640: Add SPI ID table
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
[ Upstream commit 69a6d06878f05d63673b0dcdc3c3ef1af2996d46 ]
Currently autoloading for SPI devices does not use the DT ID table, it uses SPI modalises. Supporting OF modalises is going to be difficult if not impractical, an attempt was made but has been reverted, so ensure that module autoloading works for this driver by adding an id_table listing the SPI IDs for everything.
--- drivers/mtd/devices/mchp48l640.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/mtd/devices/mchp48l640.c +10 -0
@@ -357,6 +357,15 @@ static const struct of_device_id mchp48l640_of_table[] = { };MODULE_DEVICE_TABLE (of, mchp48l640_of_table); +static const struct spi_device_id mchp48l640_spi_ids[] = { + { + .name ="48l640" , + .driver_data = (kernel_ulong_t)&mchp48l640_caps, + }, + {} +}; +MODULE_DEVICE_TABLE (spi, mchp48l640_spi_ids); +static struct spi_driver mchp48l640_driver = { .driver = { .name ="mchp48l640" ,
@@ -364,6 +373,7 @@ static struct spi_driver mchp48l640_driver = { }, .probe = mchp48l640_probe, .remove = mchp48l640_remove, + .id_table = mchp48l640_spi_ids, };module_spi_driver (mchp48l640_driver);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 480/1017 selftests/bpf: Extract syscall wrapper
In reply to Greg Kroah-HartmanFrom: Kenta Tada <[email protected]>
[ Upstream commit 78a2054156dd6265619b230cc5372b74f9ba5233 ]
Extract the helper to set up SYS_PREFIX for fentry and kprobe selftests that use __x86_sys_* attach functions.
--- tools/testing/selftests/bpf/progs/bpf_misc.h | 19 +++++++++++++++++++ .../selftests/bpf/progs/test_probe_user.c | 15 +-------------- 2 files changed, 20 insertions(+), 14 deletions(-) create mode 100644 tools/testing/selftests/bpf/progs/bpf_misc.h
tools/testing/selftests/bpf/progs/bpf_misc.h new file +19 -0
@@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __BPF_MISC_H__ +#define __BPF_MISC_H__ + +#if defined(__TARGET_ARCH_x86) +#define SYSCALL_WRAPPER 1 +#define SYS_PREFIX "__x64_" +#elif defined(__TARGET_ARCH_s390) +#define SYSCALL_WRAPPER 1 +#define SYS_PREFIX "__s390x_" +#elif defined(__TARGET_ARCH_arm64) +#define SYSCALL_WRAPPER 1 +#define SYS_PREFIX "__arm64_" +#else +#define SYSCALL_WRAPPER 0 +#define SYS_PREFIX "" +#endif + +#endif
tools/testing/selftests/bpf/progs/test_probe_user.c +1 -14
@@ -7,20 +7,7 @@#include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> - -#if defined(__TARGET_ARCH_x86) -#define SYSCALL_WRAPPER 1 -#define SYS_PREFIX "__x64_" -#elif defined(__TARGET_ARCH_s390) -#define SYSCALL_WRAPPER 1 -#define SYS_PREFIX "__s390x_" -#elif defined(__TARGET_ARCH_arm64) -#define SYSCALL_WRAPPER 1 -#define SYS_PREFIX "__arm64_" -#else -#define SYSCALL_WRAPPER 0 -#define SYS_PREFIX "" -#endif +#include "bpf_misc.h" static struct sockaddr_in old;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 481/1017 selftests/bpf: Use "__se_" prefix on architectures without syscall wrapper
In reply to Greg Kroah-HartmanFrom: Naveen N. Rao <[email protected]>
[ Upstream commit 046b841ea7c528931e7d2e74d5e668aa6c94c1fc ]
On architectures that don't use a syscall wrapper, sys_* function names are set as an alias of __se_sys_* functions. Due to this, there is no BTF associated with sys_* function names. This results in some of the test progs failing to load. Set the SYS_PREFIX to "__se_" to fix this issue.
--- tools/testing/selftests/bpf/progs/bpf_misc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/progs/bpf_misc.h +1 -1
@@ -13,7 +13,7 @@#define SYS_PREFIX "__arm64_"#else #define SYSCALL_WRAPPER 0 -#define SYS_PREFIX "" +#define SYS_PREFIX "__se_"#endif #endif
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 482/1017 igc: avoid kernel warning when changing RX ring parameters
In reply to Greg Kroah-HartmanFrom: Corinna Vinschen <[email protected]>
[ Upstream commit 453307b569a0d41bddd07f26bf41b784cd82a4c9 ]
Calling ethtool changing the RX ring parameters like this:
$ ethtool -G eth0 rx 1024
on igc triggers kernel warnings like this:
[ 225.198467] ------------[ cut here ]------------ [ 225.198473] Missing unregister, handled but fix driver [ 225.198485] WARNING: CPU: 7 PID: 959 at net/core/xdp.c:168 xdp_rxq_info_reg+0x79/0xd0 [...] [ 225.198601] Call Trace: [ 225.198604] <TASK> [ 225.198609] igc_setup_rx_resources+0x3f/0xe0 [igc] [ 225.198617] igc_ethtool_set_ringparam+0x30e/0x450 [igc] [ 225.198626] ethnl_set_rings+0x18a/0x250 [ 225.198631] genl_family_rcv_msg_doit+0xca/0x110 [ 225.198637] genl_rcv_msg+0xce/0x1c0 [ 225.198640] ? rings_prepare_data+0x60/0x60 [ 225.198644] ? genl_get_cmd+0xd0/0xd0 [ 225.198647] netlink_rcv_skb+0x4e/0xf0 [ 225.198652] genl_rcv+0x24/0x40 [ 225.198655] netlink_unicast+0x20e/0x330 [ 225.198659] netlink_sendmsg+0x23f/0x480 [ 225.198663] sock_sendmsg+0x5b/0x60 [ 225.198667] __sys_sendto+0xf0/0x160 [ 225.198671] ? handle_mm_fault+0xb2/0x280 [ 225.198676] ? do_user_addr_fault+0x1eb/0x690 [ 225.198680] __x64_sys_sendto+0x20/0x30 [ 225.198683] do_syscall_64+0x38/0x90 [ 225.198687] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 225.198693] RIP: 0033:0x7f7ae38ac3aa
igc_ethtool_set_ringparam() copies the igc_ring structure but neglects to reset the xdp_rxq_info member before calling igc_setup_rx_resources(). This in turn calls xdp_rxq_info_reg() with an already registered xdp_rxq_info.
Make sure to unregister the xdp_rxq_info structure first in igc_setup_rx_resources.
--- drivers/net/ethernet/intel/igc/igc_main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/intel/igc/igc_main.c +3 -0
@@ -505,6 +505,9 @@ int igc_setup_rx_resources(struct igc_ring *rx_ring)u8 index = rx_ring->queue_index;int size, desc_len, res; +/* XDP RX-queue info */ +if (xdp_rxq_info_is_reg (&rx_ring->xdp_rxq)) +xdp_rxq_info_unreg (&rx_ring->xdp_rxq); res =xdp_rxq_info_reg (&rx_ring->xdp_rxq, ndev, index, rx_ring->q_vector->napi.napi_id);if (res <0 ) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 483/1017 igb: refactor XDP registration
In reply to Greg Kroah-HartmanFrom: Corinna Vinschen <[email protected]>
[ Upstream commit e62ad74aa534404b3ee7e250b114a3536ac56987 ]
On changing the RX ring parameters igb uses a hack to avoid a warning when calling xdp_rxq_info_reg via igb_setup_rx_resources. It just clears the struct xdp_rxq_info content.
Instead, change this to unregister if we're already registered. Align code to the igc code.
--- drivers/net/ethernet/intel/igb/igb_ethtool.c | 4 ---- drivers/net/ethernet/intel/igb/igb_main.c | 19 +++++++++++++------ 2 files changed, 13 insertions(+), 10 deletions(-)
drivers/net/ethernet/intel/igb/igb_ethtool.c +0 -4
@@ -961,10 +961,6 @@ static int igb_set_ringparam(struct net_device *netdev,memcpy (&temp_ring[i], adapter->rx_ring[i],sizeof (struct igb_ring )); -/* Clear copied XDP RX-queue info */ -memset (&temp_ring[i].xdp_rxq,0 , -sizeof (temp_ring[i].xdp_rxq)); - temp_ring[i].count = new_rx_count; err =igb_setup_rx_resources (&temp_ring[i]);if (err) {
drivers/net/ethernet/intel/igb/igb_main.c +13 -6
@@ -4352,7 +4352,18 @@ int igb_setup_rx_resources(struct igb_ring *rx_ring) {struct igb_adapter *adapter =netdev_priv (rx_ring->netdev);struct device *dev = rx_ring->dev; -int size; +int size, res; + +/* XDP RX-queue info */ +if (xdp_rxq_info_is_reg (&rx_ring->xdp_rxq)) +xdp_rxq_info_unreg (&rx_ring->xdp_rxq); + res =xdp_rxq_info_reg (&rx_ring->xdp_rxq, rx_ring->netdev, + rx_ring->queue_index,0 ); +if (res <0 ) { +dev_err (dev,"Failed to register xdp_rxq index %u\n" , + rx_ring->queue_index); +return res; + } size =sizeof (struct igb_rx_buffer ) * rx_ring->count;
@@ -4375,14 +4386,10 @@ int igb_setup_rx_resources(struct igb_ring *rx_ring) rx_ring->xdp_prog = adapter->xdp_prog; -/* XDP RX-queue info */ -if (xdp_rxq_info_reg (&rx_ring->xdp_rxq, rx_ring->netdev, - rx_ring->queue_index,0 ) <0 ) - goto err; -return 0 ; err: +xdp_rxq_info_unreg (&rx_ring->xdp_rxq);vfree (rx_ring->rx_buffer_info); rx_ring->rx_buffer_info =NULL ;dev_err (dev,"Unable to allocate memory for the Rx descriptor ring\n" );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 484/1017 PCI: aardvark: Fix reading MSI interrupt number
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit 805dfc18dd3d4dd97a987d4406593b5a225b1253 ]
In advk_pcie_handle_msi() it is expected that when bit i in the W1C register PCIE_MSI_STATUS_REG is cleared, the PCIE_MSI_PAYLOAD_REG is updated to contain the MSI number corresponding to index i.
Experiments show that this is not so, and instead PCIE_MSI_PAYLOAD_REG always contains the number of the last received MSI, overall.
Do not read PCIE_MSI_PAYLOAD_REG register for determining MSI interrupt number. Since Aardvark already forbids more than 32 interrupts and uses own allocated hwirq numbers, the msi_idx already corresponds to the received MSI number.
--- drivers/pci/controller/pci-aardvark.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/pci/controller/pci-aardvark.c +2 -7
@@ -1381,7 +1381,6 @@ static void advk_pcie_remove_irq_domain(struct advk_pcie *pcie)static void advk_pcie_handle_msi (struct advk_pcie *pcie) {u32 msi_val, msi_mask, msi_status, msi_idx; -u16 msi_data; msi_mask =advk_readl (pcie,PCIE_MSI_MASK_REG ); msi_val =advk_readl (pcie,PCIE_MSI_STATUS_REG );
@@ -1391,13 +1390,9 @@ static void advk_pcie_handle_msi(struct advk_pcie *pcie)if (!(BIT (msi_idx) & msi_status))continue ; -/* -* msi_idx contains bits [4:0] of the msi_data and msi_data -* contains 16bit MSI interrupt number -*/ advk_writel (pcie,BIT (msi_idx),PCIE_MSI_STATUS_REG ); - msi_data =advk_readl (pcie,PCIE_MSI_PAYLOAD_REG ) &PCIE_MSI_DATA_MASK ; -generic_handle_irq (msi_data); +if (generic_handle_domain_irq (pcie->msi_inner_domain, msi_idx) == -EINVAL ) +dev_err_ratelimited (&pcie->pdev->dev,"unexpected MSI 0x%02x\n" , msi_idx); } advk_writel(pcie, PCIE_ISR0_MSI_INT_PENDING,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 485/1017 PCI: aardvark: Fix reading PCI_EXP_RTSTA_PME bit on emulated bridge
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit 735f5ae49e1b44742cc63ca9b5c1ffde3e94ba91 ]
The emulated bridge returns incorrect value for PCI_EXP_RTSTA register during readout in advk_pci_bridge_emul_pcie_conf_read() function: the correct bit is BIT(16), but we are setting BIT(23), because the code does
*value = (isr0 & PCIE_MSG_PM_PME_MASK) << 16
where
PCIE_MSG_PM_PME_MASK
is
BIT(7).
The code should probably have been something like
*value = (!!(isr0 & PCIE_MSG_PM_PME_MASK)) << 16,
but we are better of using an if() and using the proper macro for this bit.
--- drivers/pci/controller/pci-aardvark.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pci/controller/pci-aardvark.c +3 -1
@@ -844,7 +844,9 @@ advk_pci_bridge_emul_pcie_conf_read(struct pci_bridge_emul *bridge,case PCI_EXP_RTSTA : {u32 isr0 =advk_readl (pcie,PCIE_ISR0_REG );u32 msglog =advk_readl (pcie,PCIE_MSG_LOG_REG ); - *value = (isr0 &PCIE_MSG_PM_PME_MASK ) <<16 | (msglog >>16 ); + *value = msglog >>16 ; +if (isr0 &PCIE_MSG_PM_PME_MASK ) + *value |=PCI_EXP_RTSTA_PME ;return PCI_BRIDGE_EMUL_HANDLED ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 486/1017 RDMA/rxe: Check the last packet by RXE_END_MASK
In reply to Greg Kroah-HartmanFrom: Xiao Yang <[email protected]>
[ Upstream commit b1377cc37f6bebd57ce8747b7e16163a475af295 ]
It's wrong to check the last packet by RXE_COMP_MASK because the flag is to indicate if responder needs to generate a completion.
--- drivers/infiniband/sw/rxe/rxe_resp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/infiniband/sw/rxe/rxe_resp.c +6 -4
@@ -814,6 +814,10 @@ static enum resp_states execute(struct rxe_qp *qp, struct rxe_pkt_info *pkt)return RESPST_ERR_INVALIDATE_RKEY ; } +if (pkt->mask &RXE_END_MASK ) +/* We successfully processed this new request. */ + qp->resp.msn++; +/* next expected psn, read handles this separately */ qp->resp.psn = (pkt->psn +1 ) &BTH_PSN_MASK ; qp->resp.ack_psn = qp->resp.psn;
@@ -821,11 +825,9 @@ static enum resp_states execute(struct rxe_qp *qp, struct rxe_pkt_info *pkt) qp->resp.opcode = pkt->opcode; qp->resp.status =IB_WC_SUCCESS ; -if (pkt->mask &RXE_COMP_MASK ) { -/* We successfully processed this new request. */ - qp->resp.msn++; +if (pkt->mask &RXE_COMP_MASK )return RESPST_COMPLETE ; - }else if (qp_type (qp) ==IB_QPT_RC ) +else if (qp_type (qp) ==IB_QPT_RC )return RESPST_ACKNOWLEDGE ;else return RESPST_CLEANUP ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 487/1017 libbpf: Fix signedness bug in btf_dump_array_data()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 4172843ed4a38f97084032f74f07b2037b5da3a6 ]
The btf__resolve_size() function returns negative error codes so "elem_size" must be signed for the error handling to work.
--- tools/lib/bpf/btf_dump.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
tools/lib/bpf/btf_dump.c +3 -2
@@ -1839,14 +1839,15 @@ static int btf_dump_array_data(struct btf_dump *d, {const struct btf_array *array =btf_array (t);const struct btf_type *elem_type; -__u32 i, elem_size =0 , elem_type_id; +__u32 i, elem_type_id; +__s64 elem_size;bool is_array_member; elem_type_id = array->type; elem_type =skip_mods_and_typedefs (d->btf, elem_type_id,NULL ); elem_size =btf__resolve_size (d->btf, elem_type_id);if (elem_size <=0 ) { -pr_warn ("unexpected elem size %d for array type [%u]\n" , elem_size, id); +pr_warn ("unexpected elem size %lld for array type [%u]\n" , elem_size, id);return -EINVAL ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 488/1017 cxl/core: Fix cxl_probe_component_regs() error message
In reply to Greg Kroah-HartmanFrom: Dan Williams <[email protected]>
[ Upstream commit d621bc2e7282f9955033a6359877fd4ac4be60e1 ]
Fix a '\n' vs '/n' typo.
--- drivers/cxl/core/regs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cxl/core/regs.c +1 -1
@@ -49,7 +49,7 @@ void cxl_probe_component_regs(struct device *dev, void __iomem *base,if (FIELD_GET (CXL_CM_CAP_HDR_ID_MASK , cap_array) !=CM_CAP_HDR_CAP_ID ) {dev_err (dev, -"Couldn't locate the CXL.cache and CXL.mem capability array header./n" ); +"Couldn't locate the CXL.cache and CXL.mem capability array header.\n" );return ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 489/1017 tools/testing/cxl: Fix root port to host bridge assignment
In reply to Greg Kroah-HartmanFrom: Dan Williams <[email protected]>
[ Upstream commit a4a0ce242fcd7022349212c4e2f795762e6ff050 ]
Mocked root-ports are meant to be round-robin assigned to host-bridges.
--- tools/testing/cxl/test/cxl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/cxl/test/cxl.c +1 -1
@@ -488,7 +488,7 @@ static __init int cxl_test_init(void)for (i =0 ; i <ARRAY_SIZE (cxl_root_port); i++) {struct platform_device *bridge = - cxl_host_bridge[i /NR_CXL_ROOT_PORTS ]; + cxl_host_bridge[i %ARRAY_SIZE (cxl_host_bridge)];struct platform_device *pdev; pdev =platform_device_alloc ("cxl_root_port" , i);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 490/1017 cxl/regs: Fix size of CXL Capability Header Register
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit 74b0fe80409733055971bbfaf33c80a33fddeeb3 ]
In CXL 2.0, 8.2.5.1 CXL Capability Header Register: this register is given as 32 bits.
8.2.3 which covers the CXL 2.0 Component registers, including the CXL Capability Header Register states that access restrictions specified in Section 8.2.2 apply.
8.2.2 includes:
* A 32 bit register shall be accessed as a 4 Byte quantity.
...
If these rules are not followed, the behavior is undefined.
Discovered during review of CXL QEMU emulation. Alex Bennée pointed out there was a comment saying that 4 byte registers must be read with a 4 byte read, but 8 byte reads were being emulated.
https://lore.kernel.org/qemu-devel/[email protected]/
Fixing that, led to this code failing. Whilst a given hardware implementation 'might' work with an 8 byte read, it should not be relied upon. The QEMU emulation v5 will return 0 and log the wrong access width.
The code moved, so one fixes tag for where this will directly apply and also a reference to the earlier introduction of the code for backports.
--- drivers/cxl/core/regs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/cxl/core/regs.c +2 -2
@@ -35,7 +35,7 @@ void cxl_probe_component_regs(struct device *dev, void __iomem *base, struct cxl_component_reg_map *map) {int cap, cap_count; -u64 cap_array; +u32 cap_array; *map = (struct cxl_component_reg_map ) {0 };
@@ -45,7 +45,7 @@ void cxl_probe_component_regs(struct device *dev, void __iomem *base,*/ base +=CXL_CM_OFFSET ; - cap_array =readq (base +CXL_CM_CAP_HDR_OFFSET ); + cap_array =readl (base +CXL_CM_CAP_HDR_OFFSET );if (FIELD_GET (CXL_CM_CAP_HDR_ID_MASK , cap_array) !=CM_CAP_HDR_CAP_ID ) { dev_err(dev,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 491/1017 net:enetc: allocate CBD ring data memory using DMA coherent methods
In reply to Greg Kroah-HartmanFrom: Po Liu <[email protected]>
[ Upstream commit b3a723dbc94a6e38f67669d03b521edd766ad895 ]
To replace the dma_map_single() stream DMA mapping with DMA coherent method dma_alloc_coherent() which is more simple.
dma_map_single() found by Tim Gardner not proper. Suggested by Claudiu Manoil and Jakub Kicinski to use dma_alloc_coherent(). Discussion at:
--- .../net/ethernet/freescale/enetc/enetc_qos.c | 128 +++++++++--------- 1 file changed, 64 insertions(+), 64 deletions(-)
drivers/net/ethernet/freescale/enetc/enetc_qos.c +64 -64
@@ -45,6 +45,7 @@ void enetc_sched_speed_set(struct enetc_ndev_priv *priv, int speed) | pspeed); } +#define ENETC_QOS_ALIGN 64static int enetc_setup_taprio (struct net_device *ndev,struct tc_taprio_qopt_offload *admin_conf) {
@@ -52,10 +53,11 @@ static int enetc_setup_taprio(struct net_device *ndev,struct enetc_cbd cbd = {.cmd =0 };struct tgs_gcl_conf *gcl_config;struct tgs_gcl_data *gcl_data; +dma_addr_t dma, dma_align;struct gce *gce; -dma_addr_t dma;u16 data_size;u16 gcl_len; +void *tmp;u32 tge;int err;int i;
@@ -82,9 +84,16 @@ static int enetc_setup_taprio(struct net_device *ndev, gcl_config = &cbd.gcl_conf; data_size =struct_size (gcl_data, entry, gcl_len); - gcl_data =kzalloc (data_size, __GFP_DMA |GFP_KERNEL ); -if (!gcl_data) + tmp =dma_alloc_coherent (&priv->si->pdev->dev, + data_size +ENETC_QOS_ALIGN , + &dma,GFP_KERNEL ); +if (!tmp) { +dev_err (&priv->si->pdev->dev, +"DMA mapping of taprio gate list failed!\n" );return -ENOMEM ; + } + dma_align =ALIGN (dma,ENETC_QOS_ALIGN ); + gcl_data = (struct tgs_gcl_data *)PTR_ALIGN (tmp,ENETC_QOS_ALIGN ); gce = (struct gce *)(gcl_data +1 );
@@ -110,16 +119,8 @@ static int enetc_setup_taprio(struct net_device *ndev, cbd.length =cpu_to_le16 (data_size); cbd.status_flags =0 ; - dma =dma_map_single (&priv->si->pdev->dev, gcl_data, - data_size,DMA_TO_DEVICE ); -if (dma_mapping_error (&priv->si->pdev->dev, dma)) { -netdev_err (priv->si->ndev,"DMA mapping failed!\n" ); -kfree (gcl_data); -return -ENOMEM ; - } - - cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma)); - cbd.addr[1 ] =cpu_to_le32 (upper_32_bits (dma)); + cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma_align)); + cbd.addr[1 ] =cpu_to_le32 (upper_32_bits (dma_align)); cbd.cls =BDCR_CMD_PORT_GCL ; cbd.status_flags =0 ;
@@ -132,8 +133,8 @@ static int enetc_setup_taprio(struct net_device *ndev,ENETC_QBV_PTGCR_OFFSET , tge & (~ENETC_QBV_TGE)); -dma_unmap_single (&priv->si->pdev->dev, dma, data_size,DMA_TO_DEVICE ); -kfree (gcl_data); +dma_free_coherent (&priv->si->pdev->dev, data_size +ENETC_QOS_ALIGN , + tmp, dma);return err; }
@@ -463,8 +464,9 @@ static int enetc_streamid_hw_set(struct enetc_ndev_priv *priv,struct enetc_cbd cbd = {.cmd =0 };struct streamid_data *si_data;struct streamid_conf *si_conf; +dma_addr_t dma, dma_align;u16 data_size; -dma_addr_t dma; +void *tmp;int port;int err;
@@ -485,21 +487,20 @@ static int enetc_streamid_hw_set(struct enetc_ndev_priv *priv, cbd.status_flags =0 ; data_size =sizeof (struct streamid_data ); - si_data =kzalloc (data_size, __GFP_DMA |GFP_KERNEL ); -if (!si_data) + tmp =dma_alloc_coherent (&priv->si->pdev->dev, + data_size +ENETC_QOS_ALIGN , + &dma,GFP_KERNEL ); +if (!tmp) { +dev_err (&priv->si->pdev->dev, +"DMA mapping of stream identify failed!\n" );return -ENOMEM ; - cbd.length =cpu_to_le16 (data_size); - - dma =dma_map_single (&priv->si->pdev->dev, si_data, - data_size,DMA_FROM_DEVICE ); -if (dma_mapping_error (&priv->si->pdev->dev, dma)) { -netdev_err (priv->si->ndev,"DMA mapping failed!\n" ); - err = -ENOMEM ; - goto out; } + dma_align =ALIGN (dma,ENETC_QOS_ALIGN ); + si_data = (struct streamid_data *)PTR_ALIGN (tmp,ENETC_QOS_ALIGN ); - cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma)); - cbd.addr[1 ] =cpu_to_le32 (upper_32_bits (dma)); + cbd.length =cpu_to_le16 (data_size); + cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma_align)); + cbd.addr[1 ] =cpu_to_le32 (upper_32_bits (dma_align));eth_broadcast_addr (si_data->dmac); si_data->vid_vidm_tg = (ENETC_CBDR_SID_VID_MASK + ((0x3 <<14 ) |ENETC_CBDR_SID_VIDM ));
@@ -539,8 +540,8 @@ static int enetc_streamid_hw_set(struct enetc_ndev_priv *priv, cbd.length =cpu_to_le16 (data_size); - cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma)); - cbd.addr[1 ] =cpu_to_le32 (upper_32_bits (dma)); + cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma_align)); + cbd.addr[1 ] =cpu_to_le32 (upper_32_bits (dma_align));/* VIDM default to be 1. * VID Match. If set (b1) then the VID must match, otherwise
@@ -561,10 +562,8 @@ static int enetc_streamid_hw_set(struct enetc_ndev_priv *priv, err =enetc_send_cmd (priv->si, &cbd); out: -if (!dma_mapping_error (&priv->si->pdev->dev, dma)) -dma_unmap_single (&priv->si->pdev->dev, dma, data_size,DMA_FROM_DEVICE ); - -kfree (si_data); +dma_free_coherent (&priv->si->pdev->dev, data_size +ENETC_QOS_ALIGN , + tmp, dma);return err; }
@@ -633,8 +632,9 @@ static int enetc_streamcounter_hw_get(struct enetc_ndev_priv *priv, {struct enetc_cbd cbd = { .cmd =2 };struct sfi_counter_data *data_buf; -dma_addr_t dma; +dma_addr_t dma, dma_align;u16 data_size; +void *tmp;int err; cbd.index =cpu_to_le16 ((u16 )index);
@@ -643,19 +643,19 @@ static int enetc_streamcounter_hw_get(struct enetc_ndev_priv *priv, cbd.status_flags =0 ; data_size =sizeof (struct sfi_counter_data ); - data_buf =kzalloc (data_size, __GFP_DMA |GFP_KERNEL ); -if (!data_buf) + tmp =dma_alloc_coherent (&priv->si->pdev->dev, + data_size +ENETC_QOS_ALIGN , + &dma,GFP_KERNEL ); +if (!tmp) { +dev_err (&priv->si->pdev->dev, +"DMA mapping of stream counter failed!\n" );return -ENOMEM ; - - dma =dma_map_single (&priv->si->pdev->dev, data_buf, - data_size,DMA_FROM_DEVICE ); -if (dma_mapping_error (&priv->si->pdev->dev, dma)) { -netdev_err (priv->si->ndev,"DMA mapping failed!\n" ); - err = -ENOMEM ; - goto exit; } - cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma)); - cbd.addr[1 ] =cpu_to_le32 (upper_32_bits (dma)); + dma_align =ALIGN (dma,ENETC_QOS_ALIGN ); + data_buf = (struct sfi_counter_data *)PTR_ALIGN (tmp,ENETC_QOS_ALIGN ); + + cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma_align)); + cbd.addr[1 ] =cpu_to_le32 (upper_32_bits (dma_align)); cbd.length =cpu_to_le16 (data_size);
@@ -684,7 +684,9 @@ static int enetc_streamcounter_hw_get(struct enetc_ndev_priv *priv, data_buf->flow_meter_dropl; exit: -kfree (data_buf); +dma_free_coherent (&priv->si->pdev->dev, data_size +ENETC_QOS_ALIGN , + tmp, dma); +return err; }
@@ -723,9 +725,10 @@ static int enetc_streamgate_hw_set(struct enetc_ndev_priv *priv,struct sgcl_conf *sgcl_config;struct sgcl_data *sgcl_data;struct sgce *sgce; -dma_addr_t dma; +dma_addr_t dma, dma_align;u16 data_size;int err, i; +void *tmp;u64 now; cbd.index =cpu_to_le16 (sgi->index);
@@ -772,24 +775,20 @@ static int enetc_streamgate_hw_set(struct enetc_ndev_priv *priv, sgcl_config->acl_len = (sgi->num_entries -1 ) &0x3 ; data_size =struct_size (sgcl_data, sgcl, sgi->num_entries); - - sgcl_data =kzalloc (data_size, __GFP_DMA |GFP_KERNEL ); -if (!sgcl_data) -return -ENOMEM ; - - cbd.length =cpu_to_le16 (data_size); - - dma =dma_map_single (&priv->si->pdev->dev, - sgcl_data, data_size, -DMA_FROM_DEVICE ); -if (dma_mapping_error (&priv->si->pdev->dev, dma)) { -netdev_err (priv->si->ndev,"DMA mapping failed!\n" ); -kfree (sgcl_data); + tmp =dma_alloc_coherent (&priv->si->pdev->dev, + data_size +ENETC_QOS_ALIGN , + &dma,GFP_KERNEL ); +if (!tmp) { +dev_err (&priv->si->pdev->dev, +"DMA mapping of stream counter failed!\n" );return -ENOMEM ; } + dma_align =ALIGN (dma,ENETC_QOS_ALIGN ); + sgcl_data = (struct sgcl_data *)PTR_ALIGN (tmp,ENETC_QOS_ALIGN ); - cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma)); - cbd.addr[1 ] =cpu_to_le32 (upper_32_bits (dma)); + cbd.length =cpu_to_le16 (data_size); + cbd.addr[0 ] =cpu_to_le32 (lower_32_bits (dma_align)); + cbd.addr[1 ] =cpu_to_le32 (upper_32_bits (dma_align)); sgce = &sgcl_data->sgcl[0 ];
@@ -844,7 +843,8 @@ static int enetc_streamgate_hw_set(struct enetc_ndev_priv *priv, err =enetc_send_cmd (priv->si, &cbd); exit: -kfree (sgcl_data); +dma_free_coherent (&priv->si->pdev->dev, data_size +ENETC_QOS_ALIGN , + tmp, dma);return err; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 492/1017 libbpf: Fix compilation warning due to mismatched printf format
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit dc37dc617fabfb1c3a16d49f5d8cc20e9e3608ca ]
On ppc64le architecture __s64 is long int and requires %ld. Cast to ssize_t and use %zd to avoid architecture-specific specifiers.
--- tools/lib/bpf/btf_dump.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/lib/bpf/btf_dump.c +2 -1
@@ -1847,7 +1847,8 @@ static int btf_dump_array_data(struct btf_dump *d, elem_type =skip_mods_and_typedefs (d->btf, elem_type_id,NULL ); elem_size =btf__resolve_size (d->btf, elem_type_id);if (elem_size <=0 ) { -pr_warn ("unexpected elem size %lld for array type [%u]\n" , elem_size, id); +pr_warn ("unexpected elem size %zd for array type [%u]\n" , + (ssize_t )elem_size, id);return -EINVAL ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 493/1017 drm/bridge: dw-hdmi: use safe format when first in bridge chain
In reply to Greg Kroah-HartmanFrom: Neil Armstrong <[email protected]>
[ Upstream commit 1528038385c0a706aac9ac165eeb24044fef6825 ]
When the dw-hdmi bridge is in first place of the bridge chain, this means there is no way to select an input format of the dw-hdmi HW component.
Since introduction of display-connector, negotiation was broken since the dw-hdmi negotiation code only worked when the dw-hdmi bridge was in last position of the bridge chain or behind another bridge also supporting input & output format negotiation.
Commit 7cd70656d128 ("drm/bridge: display-connector: implement bus fmts callbacks") was introduced to make negotiation work again by making display-connector act as a pass-through concerning input & output format negotiation.
But in the case where the dw-hdmi is single in the bridge chain, for example on Renesas SoCs, with the display-connector bridge the dw-hdmi is no more single, breaking output format.
--- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +3 -2
@@ -2551,8 +2551,9 @@ static u32 *dw_hdmi_bridge_atomic_get_output_bus_fmts(struct drm_bridge *bridge,if (!output_fmts)return NULL ; -/* If dw-hdmi is the only bridge, avoid negociating with ourselves */ -if (list_is_singular (&bridge->encoder->bridge_chain)) { +/* If dw-hdmi is the first or only bridge, avoid negociating with ourselves */ +if (list_is_singular (&bridge->encoder->bridge_chain) || +list_is_first (&bridge->chain_node, &bridge->encoder->bridge_chain)) { *num_output_fmts =1 ; output_fmts[0 ] =MEDIA_BUS_FMT_FIXED ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 494/1017 libbpf: Use dynamically allocated buffer when receiving netlink messages
In reply to Greg Kroah-HartmanFrom: Toke Høiland-Jørgensen <[email protected]>
[ Upstream commit 9c3de619e13ee6693ec5ac74f50b7aa89056a70e ]
When receiving netlink messages, libbpf was using a statically allocated stack buffer of 4k bytes. This happened to work fine on systems with a 4k page size, but on systems with larger page sizes it can lead to truncated messages. The user-visible impact of this was that libbpf would insist no XDP program was attached to some interfaces because that bit of the netlink message got chopped off.
Fix this by switching to a dynamically allocated buffer; we borrow the approach from iproute2 of using recvmsg() with MSG_PEEK|MSG_TRUNC to get the actual size of the pending message before receiving it, adjusting the buffer as necessary. While we're at it, also add retries on interrupted system calls around the recvmsg() call.
v2:
- Move peek logic to libbpf_netlink_recv(), don't double free on ENOMEM.
--- tools/lib/bpf/netlink.c | 55 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 4 deletions(-)
tools/lib/bpf/netlink.c +51 -4
@@ -87,29 +87,75 @@ enum { NL_DONE, }; +static int netlink_recvmsg (int sock,struct msghdr *mhdr,int flags) +{ +int len; + +do { + len =recvmsg (sock, mhdr, flags); + }while (len <0 && (errno ==EINTR || errno ==EAGAIN )); + +if (len <0 ) +return -errno; +return len; +} + +static int alloc_iov (struct iovec *iov,int len) +{ +void *nbuf; + + nbuf =realloc (iov->iov_base, len); +if (!nbuf) +return -ENOMEM ; + + iov->iov_base = nbuf; + iov->iov_len = len; +return 0 ; +} +static int libbpf_netlink_recv (int sock,__u32 nl_pid,int seq,__dump_nlmsg_t _fn,libbpf_dump_nlmsg_t fn,void *cookie) { +struct iovec iov = {}; +struct msghdr mhdr = { + .msg_iov = &iov, + .msg_iovlen =1 , + };bool multipart = true;struct nlmsgerr *err;struct nlmsghdr *nh; -char buf[4096 ];int len, ret; + ret =alloc_iov (&iov,4096 ); +if (ret) + goto done; +while (multipart) { start: multipart = false; - len =recv (sock, buf,sizeof (buf),0 ); + len =netlink_recvmsg (sock, &mhdr,MSG_PEEK |MSG_TRUNC ); +if (len <0 ) { + ret = len; + goto done; + } + +if (len > iov.iov_len) { + ret =alloc_iov (&iov, len); +if (ret) + goto done; + } + + len =netlink_recvmsg (sock, &mhdr,0 );if (len <0 ) { - ret = -errno; + ret = len; goto done; }if (len ==0 )break ; -for (nh = (struct nlmsghdr *)buf;NLMSG_OK (nh, len); +for (nh = (struct nlmsghdr *)iov.iov_base;NLMSG_OK (nh, len); nh =NLMSG_NEXT (nh, len)) {if (nh->nlmsg_pid != nl_pid) { ret = -LIBBPF_ERRNO__WRNGPID ;
@@ -151,6 +197,7 @@ static int libbpf_netlink_recv(int sock, __u32 nl_pid, int seq, } ret =0 ; done: +free (iov.iov_base);return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 495/1017 power: supply: ab8500: Fix memory leak in ab8500_fg_sysfs_init
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 6a4760463dbc6b603690938c468839985189ce0a ]
kobject_init_and_add() takes reference even when it fails. According to the doc of kobject_init_and_add():
If this function returns an error, kobject_put() must be called to properly clean up the memory associated with the object.
Fix memory leak by calling kobject_put().
--- drivers/power/supply/ab8500_fg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/power/supply/ab8500_fg.c +3 -1
@@ -2545,8 +2545,10 @@ static int ab8500_fg_sysfs_init(struct ab8500_fg *di) ret =kobject_init_and_add (&di->fg_kobject, &ab8500_fg_ktype,NULL ,"battery" ); -if (ret <0 ) +if (ret <0 ) { +kobject_put (&di->fg_kobject);dev_err (di->dev,"failed to create sysfs entry\n" ); + }return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 496/1017 HID: i2c-hid: fix GET/SET_REPORT for unnumbered reports
In reply to Greg Kroah-HartmanFrom: Dmitry Torokhov <[email protected]>
[ Upstream commit a5e5e03e94764148a01757b2fa4737d3445c13a6 ]
Internally kernel prepends all report buffers, for both numbered and unnumbered reports, with report ID, therefore to properly handle unnumbered reports we should prepend it ourselves.
For the same reason we should skip the first byte of the buffer when calling i2c_hid_set_or_send_report() which then will take care of properly formatting the transfer buffer based on its separate report ID argument along with report payload.
--- drivers/hid/i2c-hid/i2c-hid-core.c | 32 ++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-)
drivers/hid/i2c-hid/i2c-hid-core.c +24 -8
@@ -615,6 +615,17 @@ static int i2c_hid_get_raw_report(struct hid_device *hid,if (report_type ==HID_OUTPUT_REPORT )return -EINVAL ; +/* +* In case of unnumbered reports the response from the device will +* not have the report ID that the upper layers expect, so we need +* to stash it the buffer ourselves and adjust the data size. +*/ +if (!report_number) { + buf[0 ] =0 ; + buf++; + count--; + } +/* +2 bytes to include the size of the reply in the query buffer */ ask_count =min (count +2 , (size_t )ihid->bufsize);
@@ -636,6 +647,9 @@ static int i2c_hid_get_raw_report(struct hid_device *hid, count =min (count, ret_count -2 );memcpy (buf, ihid->rawbuf +2 , count); +if (!report_number) + count++; +return count; }
@@ -652,17 +666,19 @@ static int i2c_hid_output_raw_report(struct hid_device *hid, __u8 *buf,mutex_lock (&ihid->reset_lock); -if (report_id) { - buf++; - count--; - } - +/* +* Note that both numbered and unnumbered reports passed here +* are supposed to have report ID stored in the 1st byte of the +* buffer, so we strip it off unconditionally before passing payload +* to i2c_hid_set_or_send_report which takes care of encoding +* everything properly. +*/ ret =i2c_hid_set_or_send_report (client, report_type ==HID_FEATURE_REPORT ?0x03 :0x02 , - report_id, buf, count, use_data); + report_id, buf +1 , count -1 , use_data); -if (report_id && ret >=0 ) - ret++;/* add report_id to the number of transfered bytes */ +if (ret >=0 ) + ret++;/* add report_id to the number of transferred bytes */ mutex_unlock (&ihid->reset_lock);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 497/1017 iommu/ipmmu-vmsa: Check for error num after setting mask
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 1fdbbfd5099f797a4dac05e7ef0192ba4a9c39b4 ]
Because of the possible failure of the dma_supported(), the dma_set_mask_and_coherent() may return error num. Therefore, it should be better to check it and return the error if fails.
--- drivers/iommu/ipmmu-vmsa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/iommu/ipmmu-vmsa.c +3 -1
@@ -1006,7 +1006,9 @@ static int ipmmu_probe(struct platform_device *pdev)bitmap_zero (mmu->ctx,IPMMU_CTX_MAX ); mmu->features =of_device_get_match_data (&pdev->dev);memset (mmu->utlb_ctx,IPMMU_CTX_INVALID , mmu->features->num_utlbs); -dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (40 )); + ret =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (40 )); +if (ret) +return ret;/* Map I/O memory and request IRQ. */ res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 498/1017 drm/bridge: anx7625: Fix overflow issue on reading EDID
In reply to Greg Kroah-HartmanFrom: Pin-Yen Lin <[email protected]>
[ Upstream commit d5c6f647aec9ed524aedd04a3aec5ebc21d39007 ]
The length of EDID block can be longer than 256 bytes, so we should use int instead of u8 for the edid_pos variable.
--- drivers/gpu/drm/bridge/analogix/anx7625.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +2 -1
@@ -791,7 +791,8 @@ static int segments_edid_read(struct anx7625_data *ctx,static int sp_tx_edid_read (struct anx7625_data *ctx,u8 *pedid_blocks_buf) { -u8 offset, edid_pos; +u8 offset; +int edid_pos;int count, blocks_num;u8 pblock_buf[MAX_DPCD_BUFFER_SIZE ];u8 i, j;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 499/1017 i2c: pasemi: Drop I2C classes from platform driver variant
In reply to Greg Kroah-HartmanFrom: Martin Povišer <[email protected]>
[ Upstream commit 19e138e43a0820bb4dbf8fb5c7691f82e9221f2b ]
Drop I2C device-probing classes from platform variant of the PASemi controller as it is only used on platforms where I2C devices should be instantiated in devicetree. (The I2C_CLASS_DEPRECATED flag is not raised as up to this point no devices relied on the old behavior.)
--- drivers/i2c/busses/i2c-pasemi-core.c | 1 - drivers/i2c/busses/i2c-pasemi-pci.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-pasemi-core.c +0 -1
@@ -333,7 +333,6 @@ int pasemi_i2c_common_probe(struct pasemi_smbus *smbus) smbus->adapter.owner =THIS_MODULE ;snprintf (smbus->adapter.name,sizeof (smbus->adapter.name),"PA Semi SMBus adapter (%s)" ,dev_name (smbus->dev)); - smbus->adapter.class =I2C_CLASS_HWMON |I2C_CLASS_SPD ; smbus->adapter.algo = &smbus_algorithm; smbus->adapter.algo_data = smbus;
drivers/i2c/busses/i2c-pasemi-pci.c +1 -0
@@ -56,6 +56,7 @@ static int pasemi_smb_pci_probe(struct pci_dev *dev,if (!smbus->ioaddr)return -EBUSY ; + smbus->adapter.class =I2C_CLASS_HWMON |I2C_CLASS_SPD ; error =pasemi_i2c_common_probe (smbus);if (error)return error;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 500/1017 bpftool: Fix the error when lookup in no-btf maps
In reply to Greg Kroah-HartmanFrom: Yinjun Zhang <[email protected]>
[ Upstream commit edc21dc909c6c133a2727f063eadd7907af51f94 ]
When reworking btf__get_from_id() in commit a19f93cfafdf the error handling when calling bpf_btf_get_fd_by_id() changed. Before the rework if bpf_btf_get_fd_by_id() failed the error would not be propagated to callers of btf__get_from_id(), after the rework it is. This lead to a change in behavior in print_key_value() that now prints an error when trying to lookup keys in maps with no btf available.
Fix this by following the way used in dumping maps to allow to look up keys in no-btf maps, by which it decides whether and where to get the btf info according to the btf value type.
--- tools/bpf/bpftool/map.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
tools/bpf/bpftool/map.c +2 -4
@@ -1053,11 +1053,9 @@ static void print_key_value(struct bpf_map_info *info, void *key,json_writer_t *btf_wtr;struct btf *btf; - btf =btf__load_from_kernel_by_id (info->btf_id); -if (libbpf_get_error (btf)) { -p_err ("failed to get btf" ); + btf =get_map_kv_btf (info); +if (libbpf_get_error (btf))return ; - }if (json_output) {print_entry_json (info, key, value, btf);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 501/1017 drm/amd/pm: enable pm sysfs write for one VF mode
In reply to Greg Kroah-HartmanFrom: Yiqing Yao <[email protected]>
[ Upstream commit e610941c45bad75aa839af015c27d236ab6749e5 ]
[why]
pm sysfs should be writable in one VF mode as is in passthrough
[how]
do not remove write access on pm sysfs if device is in one VF mode
--- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/amdgpu_pm.c +2 -2
@@ -2123,8 +2123,8 @@ static int default_attr_update(struct amdgpu_device *adev, struct amdgpu_device_ } } -/* setting should not be allowed from VF */ -if (amdgpu_sriov_vf (adev)) { +/* setting should not be allowed from VF if not in one VF mode */ +if (amdgpu_sriov_vf (adev) && !amdgpu_sriov_is_pp_one_vf (adev)) { dev_attr->attr.mode &= ~S_IWUGO ; dev_attr->store =NULL ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 502/1017 drm/amd/display: Add affected crtcs to atomic state for dsc mst unplug
In reply to Greg Kroah-HartmanFrom: Roman Li <[email protected]>
[ Upstream commit 128f8ed5902a287a6bb4afe0ffdae8a80b2a64ec ]
[Why]
When display topology changed on DSC hub we add all crtcs with dsc support to atomic state.
Refer to patch:"drm/amd/display: Trigger modesets on MST DSC connectors" However the original implementation may skip crtc if the topology change caused by unplug.
That potentially could lead to no-lightup or corruption on DSC hub after unplug event on one of the connectors.
[How]
Update add_affected_mst_dsc_crtcs() to use old connector state if new connector state has no crtc (undergoes modeset due to unplug)
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +5 -2
@@ -10752,10 +10752,13 @@ static int dm_check_crtc_cursor(struct drm_atomic_state *state,static int add_affected_mst_dsc_crtcs (struct drm_atomic_state *state,struct drm_crtc *crtc) {struct drm_connector *connector; -struct drm_connector_state *conn_state; +struct drm_connector_state *conn_state, *old_conn_state;struct amdgpu_dm_connector *aconnector =NULL ;int i; -for_each_new_connector_in_state (state, connector, conn_state, i) { +for_each_oldnew_connector_in_state (state, connector, old_conn_state, conn_state, i) { +if (!conn_state->crtc) + conn_state = old_conn_state; +if (conn_state->crtc != crtc)continue ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 503/1017 libbpf: Fix memleak in libbpf_netlink_recv()
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 1b8c924a05934d2e758ec7da7bd217ef8ebd80ce ]
Ensure that libbpf_netlink_recv() frees dynamically allocated buffer in all code paths.
--- tools/lib/bpf/netlink.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
tools/lib/bpf/netlink.c +5 -3
@@ -176,7 +176,8 @@ static int libbpf_netlink_recv(int sock, __u32 nl_pid, int seq,libbpf_nla_dump_errormsg (nh); goto done;case NLMSG_DONE : -return 0 ; + ret =0 ; + goto done;default :break ; }
@@ -188,9 +189,10 @@ static int libbpf_netlink_recv(int sock, __u32 nl_pid, int seq,case NL_NEXT : goto start;case NL_DONE : -return 0 ; + ret =0 ; + goto done;default : -return ret; + goto done; } } }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 504/1017 IB/cma: Allow XRC INI QPs to set their local ACK timeout
In reply to Greg Kroah-HartmanFrom: Håkon Bugge <[email protected]>
[ Upstream commit 748663c8ccf6b2e5a800de19127c2cc1c4423fd2 ]
XRC INI QPs should be able to adjust their local ACK timeout.
--- drivers/infiniband/core/cma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/cma.c +1 -1
@@ -2642,7 +2642,7 @@ int rdma_set_ack_timeout(struct rdma_cm_id *id, u8 timeout) {struct rdma_id_private *id_priv; -if (id->qp_type !=IB_QPT_RC ) +if (id->qp_type !=IB_QPT_RC && id->qp_type !=IB_QPT_XRC_INI )return -EINVAL ; id_priv = container_of(id, struct rdma_id_private, id);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 505/1017 cxl/port: Hold port reference until decoder release
In reply to Greg Kroah-HartmanFrom: Dan Williams <[email protected]>
[ Upstream commit 74be98774dfbc5b8b795db726bd772e735d2edd4 ]
KASAN + DEBUG_KOBJECT_RELEASE reports a potential use-after-free in cxl_decoder_release() where it goes to reference its parent, a cxl_port, to free its id back to port->decoder_ida.
BUG: KASAN: use-after-free in to_cxl_port+0x18/0x90 [cxl_core] Read of size 8 at addr ffff888119270908 by task kworker/35:2/379 CPU: 35 PID: 379 Comm: kworker/35:2 Tainted: G OE 5.17.0-rc2+ #198 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015 Workqueue: events kobject_delayed_cleanup Call Trace: <TASK> dump_stack_lvl+0x59/0x73 print_address_description.constprop.0+0x1f/0x150 ? to_cxl_port+0x18/0x90 [cxl_core] kasan_report.cold+0x83/0xdf ? to_cxl_port+0x18/0x90 [cxl_core] to_cxl_port+0x18/0x90 [cxl_core] cxl_decoder_release+0x2a/0x60 [cxl_core] device_release+0x5f/0x100 kobject_cleanup+0x80/0x1c0
The device core only guarantees parent lifetime until all children are unregistered. If a child needs a parent to complete its ->release() callback that child needs to hold a reference to extend the lifetime of the parent.
--- drivers/cxl/core/bus.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/cxl/core/bus.c +4 -0
@@ -182,6 +182,7 @@ static void cxl_decoder_release(struct device *dev)ida_free (&port->decoder_ida, cxld->id);kfree (cxld); +put_device (&port->dev); }static const struct device_type cxl_decoder_switch_type = {
@@ -500,7 +501,10 @@ struct cxl_decoder *cxl_decoder_alloc(struct cxl_port *port, int nr_targets)if (rc <0 ) goto err; +/* need parent to stick around to release the id */ +get_device (&port->dev); cxld->id = rc; + cxld->nr_targets = nr_targets; dev = &cxld->dev;device_initialize (dev);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 506/1017 dax: make sure inodes are flushed before destroy cache
In reply to Greg Kroah-HartmanFrom: Tong Zhang <[email protected]>
[ Upstream commit a7e8de822e0b1979f08767c751f6c8a9c1d4ad86 ]
A bug can be triggered by following command
$ modprobe nd_pmem && modprobe -r nd_pmem
[ 10.060014] BUG dax_cache (Not tainted): Objects remaining in dax_cache on __kmem_cache_shutdown() [ 10.060938] Slab 0x0000000085b729ac objects=9 used=1 fp=0x000000004f5ae469 flags=0x200000000010200(slab|head|node) [ 10.062433] Call Trace: [ 10.062673] dump_stack_lvl+0x34/0x44 [ 10.062865] slab_err+0x90/0xd0 [ 10.063619] __kmem_cache_shutdown+0x13b/0x2f0 [ 10.063848] kmem_cache_destroy+0x4a/0x110 [ 10.064058] __x64_sys_delete_module+0x265/0x300
This is caused by dax_fs_exit() not flushing inodes before destroy cache. To fix this issue, call rcu_barrier() before destroy cache.
--- drivers/dax/super.c | 1 + 1 file changed, 1 insertion(+)
drivers/dax/super.c +1 -0
@@ -612,6 +612,7 @@ static int dax_fs_init(void)static void dax_fs_exit (void ) {kern_unmount (dax_mnt); +rcu_barrier ();kmem_cache_destroy (dax_cache); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 507/1017 selftests: mptcp: add csum mib check for mptcp_connect
In reply to Greg Kroah-HartmanFrom: Geliang Tang <[email protected]>
[ Upstream commit 24720d7452df2dff2e539d9dff28904e25bb1c6d ]
This patch added the data checksum error mib counters check for the script mptcp_connect.sh when the data checksum is enabled.
In do_transfer(), got the mib counters twice, before and after running the mptcp_connect commands. The latter minus the former is the actual number of the data checksum mib counter.
The output looks like this:
ns1 MPTCP -> ns2 (dead:beef:1::2:10007) MPTCP (duration 86ms) [ OK ] ns1 MPTCP -> ns2 (10.0.2.1:10008 ) MPTCP (duration 66ms) [ FAIL ]
server got 1 data checksum error[s]
--- .../selftests/net/mptcp/mptcp_connect.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
tools/testing/selftests/net/mptcp/mptcp_connect.sh +19 -0
@@ -445,6 +445,8 @@ do_transfer() local stat_ackrx_last_l=$(get_mib_counter "${listener_ns}" "MPTcpExtMPCapableACKRX") local stat_cookietx_last=$(get_mib_counter "${listener_ns}" "TcpExtSyncookiesSent") local stat_cookierx_last=$(get_mib_counter "${listener_ns}" "TcpExtSyncookiesRecv") + local stat_csum_err_s=$(get_mib_counter "${listener_ns}" "MPTcpExtDataCsumErr") + local stat_csum_err_c=$(get_mib_counter "${connector_ns}" "MPTcpExtDataCsumErr") timeout ${timeout_test} \ ip netns exec ${listener_ns} \
@@ -537,6 +539,23 @@ do_transfer() fi fi + if $checksum; then + local csum_err_s=$(get_mib_counter "${listener_ns}" "MPTcpExtDataCsumErr") + local csum_err_c=$(get_mib_counter "${connector_ns}" "MPTcpExtDataCsumErr") + + local csum_err_s_nr=$((csum_err_s - stat_csum_err_s)) + if [ $csum_err_s_nr -gt 0 ]; then + printf "[ FAIL ]\nserver got $csum_err_s_nr data checksum error[s]" + rets=1 + fi + + local csum_err_c_nr=$((csum_err_c - stat_csum_err_c)) + if [ $csum_err_c_nr -gt 0 ]; then + printf "[ FAIL ]\nclient got $csum_err_c_nr data checksum error[s]" + retc=1 + fi + fi + if [ $retc -eq 0 ] && [ $rets -eq 0 ]; then printf "[ OK ]" fi
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 508/1017 iwlwifi: mvm: Dont call iwl_mvm_sta_from_mac80211() with NULL sta
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 30d17c12b0895e15ce22ebc1f52a4ff02df6dbc6 ]
The recent fix for NULL sta in iwl_mvm_get_tx_rate() still has a call of iwl_mvm_sta_from_mac80211() that may be called with NULL sta. Although this practically only points to the address and the actual access doesn't happen due to the conditional evaluation at a later point, it looks a bit flaky.
This patch drops the temporary variable above and evaluates iwm_mvm_sta_from_mac80211() directly for avoiding confusions.
--- drivers/net/wireless/intel/iwlwifi/mvm/tx.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/tx.c +2 -3
@@ -272,15 +272,14 @@ static u32 iwl_mvm_get_tx_rate(struct iwl_mvm *mvm,/* info->control is only relevant for non HW rate control */ if (!ieee80211_hw_check (mvm->hw,HAS_RATE_CONTROL )) { -struct iwl_mvm_sta *mvmsta =iwl_mvm_sta_from_mac80211 (sta); -/* HT rate doesn't make sense for a non data frame */ WARN_ONCE (info->control.rates[0 ].flags &IEEE80211_TX_RC_MCS && !ieee80211_is_data (fc),"Got a HT rate (flags:0x%x/mcs:%d/fc:0x%x/state:%d) for a non data frame\n" , info->control.rates[0 ].flags, info->control.rates[0 ].idx, -le16_to_cpu (fc), sta ? mvmsta->sta_state :-1 ); +le16_to_cpu (fc), + sta ?iwl_mvm_sta_from_mac80211 (sta)->sta_state :-1 ); rate_idx = info->control.rates[0 ].idx; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 509/1017 iwlwifi: mvm: dont iterate unadded vifs when handling FW SMPS req
In reply to Greg Kroah-HartmanFrom: Luca Coelho <[email protected]>
[ Upstream commit 8a265d1a619c16400406c9d598411850ee104aed ]
We may not have all the interfaces added to the driver when we get the THERMAL_DUAL_CHAIN_REQUEST notification from the FW, so instead of iterating all vifs to update SMPS, iterate only the ones that are already assigned. The interfaces that were not assigned yet, will be updated accordingly when we start using them.
--- drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/ops.c +2 -1
@@ -237,7 +237,8 @@ static void iwl_mvm_rx_thermal_dual_chain_req(struct iwl_mvm *mvm,*/ mvm->fw_static_smps_request = req->event ==cpu_to_le32 (THERMAL_DUAL_CHAIN_REQ_DISABLE ); -ieee80211_iterate_interfaces (mvm->hw,IEEE80211_IFACE_ITER_NORMAL , +ieee80211_iterate_interfaces (mvm->hw, +IEEE80211_IFACE_SKIP_SDATA_NOT_IN_DRIVER , iwl_mvm_intf_dual_chain_req,NULL ); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 510/1017 iwlwifi: mvm: align locking in D3 test debugfs
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 59e1221f470c2e5d2f2d4c95153edd577a7071c5 ]
Since commit a05829a7222e ("cfg80211: avoid holding the RTNL when calling the driver") we're not only holding the RTNL when going in and out of suspend, but also the wiphy->mtx. Add that to the D3 test debugfs in iwlwifi since it's required for various calls to mac80211.
--- drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/d3.c +4 -0
@@ -2566,7 +2566,9 @@ static int iwl_mvm_d3_test_open(struct inode *inode, struct file *file)/* start pseudo D3 */ rtnl_lock (); +wiphy_lock (mvm->hw->wiphy); err =__iwl_mvm_suspend (mvm->hw, mvm->hw->wiphy->wowlan_config, true); +wiphy_unlock (mvm->hw->wiphy);rtnl_unlock ();if (err >0 ) err = -EINVAL ;
@@ -2622,7 +2624,9 @@ static int iwl_mvm_d3_test_release(struct inode *inode, struct file *file)iwl_fw_dbg_read_d3_debug_data (&mvm->fwrt);rtnl_lock (); +wiphy_lock (mvm->hw->wiphy);__iwl_mvm_resume (mvm, true); +wiphy_unlock (mvm->hw->wiphy);rtnl_unlock ();iwl_mvm_resume_tcm (mvm);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 511/1017 iwlwifi: yoyo: remove DBGI_SRAM address reset writing
In reply to Greg Kroah-HartmanFrom: Rotem Saado <[email protected]>
[ Upstream commit ce014c9861544bb4e789323d0d8956a5ad262e25 ]
Due to preg protection we cannot write to this register while FW is running (when FW in Halt it is ok). since we have some cases that we need to dump this region while FW is running remove this writing from DRV. FW will do this writing.
--- drivers/net/wireless/intel/iwlwifi/fw/dbg.c | 2 -- drivers/net/wireless/intel/iwlwifi/iwl-prph.h | 2 -- 2 files changed, 4 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/dbg.c +0 -2
@@ -1562,8 +1562,6 @@ iwl_dump_ini_dbgi_sram_iter(struct iwl_fw_runtime *fwrt,return -EBUSY ; range->range_data_size = reg->dev_addr.size; -iwl_write_prph_no_grab (fwrt->trans,DBGI_SRAM_TARGET_ACCESS_CFG , -DBGI_SRAM_TARGET_ACCESS_CFG_RESET_ADDRESS_MSK );for (i =0 ; i < (le32_to_cpu (reg->dev_addr.size) /4 ); i++) { prph_data = iwl_read_prph(fwrt->trans, (i % 2) ? DBGI_SRAM_TARGET_ACCESS_RDATA_MSB :
drivers/net/wireless/intel/iwlwifi/iwl-prph.h +0 -2
@@ -356,8 +356,6 @@#define WFPM_GP2 0xA030B4/* DBGI SRAM Register details */ -#define DBGI_SRAM_TARGET_ACCESS_CFG 0x00A2E14C -#define DBGI_SRAM_TARGET_ACCESS_CFG_RESET_ADDRESS_MSK 0x10000#define DBGI_SRAM_TARGET_ACCESS_RDATA_LSB 0x00A2E154#define DBGI_SRAM_TARGET_ACCESS_RDATA_MSB 0x00A2E158
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 512/1017 iwlwifi: yoyo: Avoid using dram data if allocation failed
In reply to Greg Kroah-HartmanFrom: Mukesh Sisodiya <[email protected]>
[ Upstream commit e2d53d10ef666859517360e711fd7761e7e984ce ]
The config set TLV setting depend on dram allocation and if allocation failed the data used in config set tlv should not set this.
Adding the check if dram fragment is available or not.
--- drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c +10 -3
@@ -849,11 +849,18 @@ static void iwl_dbg_tlv_apply_config(struct iwl_fw_runtime *fwrt,case IWL_FW_INI_CONFIG_SET_TYPE_DBGC_DRAM_ADDR : {struct iwl_dbgc1_info dram_info = {};struct iwl_dram_data *frags = &fwrt->trans->dbg.fw_mon_ini[1 ].frags[0 ]; -__le64 dram_base_addr =cpu_to_le64 (frags->physical); -__le32 dram_size =cpu_to_le32 (frags->size); -u64 dram_addr =le64_to_cpu (dram_base_addr); +__le64 dram_base_addr; +__le32 dram_size; +u64 dram_addr;u32 ret; +if (!frags) +break ; + + dram_base_addr =cpu_to_le64 (frags->physical); + dram_size =cpu_to_le32 (frags->size); + dram_addr =le64_to_cpu (dram_base_addr); +IWL_DEBUG_FW (fwrt,"WRT: dram_base_addr 0x%016llx, dram_size 0x%x\n" , dram_base_addr, dram_size); IWL_DEBUG_FW(fwrt, "WRT: config_list->addr_offset: %u\n",
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 513/1017 iwlwifi: Fix -EIO error code that is never returned
In reply to Greg Kroah-HartmanFrom: Colin Ian King <[email protected]>
[ Upstream commit c305c94bdc18e45b5ad1db54da4269f8cbfdff6b ]
Currently the error -EIO is being assinged to variable ret when the READY_BIT is not set but the function iwlagn_mac_start returns 0 rather than ret. Fix this by returning ret instead of 0.
Addresses-Coverity: ("Unused value")
--- drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/dvm/mac80211.c +1 -1
@@ -299,7 +299,7 @@ static int iwlagn_mac_start(struct ieee80211_hw *hw) priv->is_open =1 ;IWL_DEBUG_MAC80211 (priv,"leave\n" ); -return 0 ; +return ret; }static void iwlagn_mac_stop (struct ieee80211_hw *hw)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 514/1017 iwlwifi: mvm: Fix an error code in iwl_mvm_up()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 583d18336abdfb1b355270289ff8f6a2608ba905 ]
Return -ENODEV instead of success on this error path.
--- drivers/net/wireless/intel/iwlwifi/mvm/fw.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/fw.c +3 -1
@@ -1553,8 +1553,10 @@ int iwl_mvm_up(struct iwl_mvm *mvm)while (!sband && i <NUM_NL80211_BANDS ) sband = mvm->hw->wiphy->bands[i++]; -if (WARN_ON_ONCE (!sband)) +if (WARN_ON_ONCE (!sband)) { + ret = -ENODEV ; goto error; + } chan = &sband->channels[0 ];
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 515/1017 mtd: rawnand: pl353: Set the nand chip node as the flash node
In reply to Greg Kroah-HartmanFrom: Amit Kumar Mahapatra <[email protected]>
[ Upstream commit a1fe2ace2c39dcdc7c053705459a73b7598b1e4f ]
In devicetree the flash information is embedded within nand chip node, so during nand chip initialization the nand chip node should be passed to nand_set_flash_node() api, instead of nand controller node.
--- drivers/mtd/nand/raw/pl35x-nand-controller.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/raw/pl35x-nand-controller.c +1 -1
@@ -1062,7 +1062,7 @@ static int pl35x_nand_chip_init(struct pl35x_nandc *nfc, chip->controller = &nfc->controller; mtd =nand_to_mtd (chip); mtd->dev.parent = nfc->dev; -nand_set_flash_node (chip, nfc->dev->of_node); +nand_set_flash_node (chip, np);if (!mtd->name) { mtd->name =devm_kasprintf (nfc->dev,GFP_KERNEL ,"%s" ,PL35X_NANDC_DRIVER_NAME );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 516/1017 drm/msm/dp: populate connector of struct dp_panel
In reply to Greg Kroah-HartmanFrom: Kuogee Hsieh <[email protected]>
[ Upstream commit 5e602f5156910c7b19661699896cb6e3fb94fab9 ]
DP CTS test case 4.2.2.6 has valid edid with bad checksum on purpose and expect DP source return correct checksum. During drm edid read, correct edid checksum is calculated and stored at connector::real_edid_checksum.
The problem is struct dp_panel::connector never be assigned, instead the connector is stored in struct msm_dp::connector. When we run compliance testing test case 4.2.2.6 dp_panel_handle_sink_request() won't have a valid edid set in struct dp_panel::edid so we'll try to use the connectors real_edid_checksum and hit a NULL pointer dereference error because the connector pointer is never assigned.
Changes in V2:
-- populate panel connector at msm_dp_modeset_init() instead of at dp_panel_read_sink_caps()
Changes in V3:
-- remove unhelpful kernel crash trace commit text -- remove renaming dp_display parameter to dp
Changes in V4:
-- add more details to commit text
Changes in v10:
-- group into one series
Changes in v11:
-- drop drm/msm/dp: dp_link_parse_sink_count() return immediately if aux read
--- drivers/gpu/drm/msm/dp/dp_display.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/msm/dp/dp_display.c +5 -0
@@ -1455,6 +1455,7 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev, struct drm_encoder *encoder) {struct msm_drm_private *priv; +struct dp_display_private *dp_priv;int ret;if (WARN_ON (!encoder) ||WARN_ON (!dp_display) ||WARN_ON (!dev))
@@ -1463,6 +1464,8 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev, priv = dev->dev_private; dp_display->drm_dev = dev; + dp_priv = container_of(dp_display, struct dp_display_private, dp_display); + ret =dp_display_request_irq (dp_display);if (ret) {DRM_ERROR ("request_irq failed, ret=%d\n" , ret);
@@ -1480,6 +1483,8 @@ int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev,return ret; } + dp_priv->panel->connector = dp_display->connector; + priv->connectors[priv->num_connectors++] = dp_display->connector;return 0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 517/1017 drm/msm/dp: stop link training after link training 2 failed
In reply to Greg Kroah-HartmanFrom: Kuogee Hsieh <[email protected]>
[ Upstream commit 9051d629dbf7a998a40f7eac65a9512b01bc3bb8 ]
Each DP link training contains link training 1 followed by link training 2. There is maximum of 5 retries of DP link training before declared link training failed. It is required to stop link training at end of link training 2 if it is failed so that next link training 1 can start freshly. This patch fixes link compliance test case 4.3.1.13 (Source Device Link Training EQ Fallback Test).
Changes in v10:
-- group into one series
Changes in v11:
-- drop drm/msm/dp: dp_link_parse_sink_count() return immediately if aux read
--- drivers/gpu/drm/msm/dp/dp_ctrl.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/msm/dp/dp_ctrl.c +3 -0
@@ -1744,6 +1744,9 @@ int dp_ctrl_on_link(struct dp_ctrl *dp_ctrl)/* end with failure */ break ;/* lane == 1 already */ } + +/* stop link training before start re training */ +dp_ctrl_clear_training_pattern (ctrl); } }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 518/1017 drm/msm/dp: always add fail-safe mode into connector mode list
In reply to Greg Kroah-HartmanFrom: Kuogee Hsieh <[email protected]>
[ Upstream commit d4aca422539c441a7f3fec749287b36de37d9b6b ]
Some of DP link compliant test expects to return fail-safe mode if prefer detailed timing mode can not be supported by mainlink's lane and rate after link training. Therefore add fail-safe mode into connector mode list as backup mode. This patch fixes test case 4.2.2.1.
Changes in v2:
-- add Fixes text string
--- drivers/gpu/drm/msm/dp/dp_panel.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/msm/dp/dp_panel.c +5 -0
@@ -212,6 +212,11 @@ int dp_panel_read_sink_caps(struct dp_panel *dp_panel,if (drm_add_modes_noedid (connector,640 ,480 ))drm_set_preferred_mode (connector,640 ,480 );mutex_unlock (&connector->dev->mode_config.mutex); + }else { +/* always add fail-safe mode as backup mode */ +mutex_lock (&connector->dev->mode_config.mutex); +drm_add_modes_noedid (connector,640 ,480 ); +mutex_unlock (&connector->dev->mode_config.mutex); }if (panel->aux_cfg_update_done) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 519/1017 drm/msm/dsi: Use "ref" fw clock instead of global name for VCO parent
In reply to Greg Kroah-HartmanFrom: Marijn Suijten <[email protected]>
[ Upstream commit 3a3ee71bd8e14c5e852c71f317eebfda8f88dff0 ]
All DSI PHY/PLL drivers were referencing their VCO parent clock by a global name, most of which don't exist or have been renamed. These clock drivers seem to function fine without that except the 14nm driver for sdm6xx [1].
At the same time all DTs provide a "ref" clock as per the requirements of dsi-phy-common.yaml, but the clock is never used. This patchset puts that clock to use without relying on a global clock name, so that all dependencies are explicitly defined in DT (the firmware) in the end.
Note that this patch intentionally breaks older firmware (DT) that relies on the clock to be found globally instead. The only affected platform is msm8974 [2] for whose dsi_phy_28nm a .name="xo" fallback is left in place to accommodate a more graceful transition period. All other platforms had the "ref" clock added to their phy node since its inception, or in a followup patch some time after. These patches wrongly assumed that the "ref" clock was actively used and have hence been listed as "Fixes:" below.
Furthermore apq8064 was providing the wrong 19.2MHz cxo instead of 27MHz pxo clock, which has been addressed in [3].
It is expected that both [2] and [3] are applied to the tree well in advance of this patch such that any actual breakage is extremely unlikely, but might still occur if kernel upgrades are performed without the DT to match. After some time the fallback for msm8974 can be removed again as well.
[1]: https://lore.kernel.org/linux-arm-msm/[email protected]/
[2]: https://lore.kernel.org/linux-arm-msm/[email protected]/
[3]: https://lore.kernel.org/linux-arm-msm/[email protected]/
--- drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c | 4 +++- drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c | 4 +++- drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c | 4 +++- drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c | 4 +++- drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c | 4 +++- 5 files changed, 15 insertions(+), 5 deletions(-)
drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c +3 -1
@@ -562,7 +562,9 @@ static int pll_10nm_register(struct dsi_pll_10nm *pll_10nm, struct clk_hw **provchar clk_name[32 ], parent[32 ], vco_name[32 ];char parent2[32 ], parent3[32 ], parent4[32 ];struct clk_init_data vco_init = { - .parent_names = (const char *[]){"xo" }, + .parent_data = &(const struct clk_parent_data ) { + .fw_name ="ref" , + }, .num_parents =1 , .name = vco_name, .flags =CLK_IGNORE_UNUSED ,
drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c +3 -1
@@ -802,7 +802,9 @@ static int pll_14nm_register(struct dsi_pll_14nm *pll_14nm, struct clk_hw **prov {char clk_name[32 ], parent[32 ], vco_name[32 ];struct clk_init_data vco_init = { - .parent_names = (const char *[]){"xo" }, + .parent_data = &(const struct clk_parent_data ) { + .fw_name ="ref" , + }, .num_parents =1 , .name = vco_name, .flags =CLK_IGNORE_UNUSED ,
drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c +3 -1
@@ -521,7 +521,9 @@ static int pll_28nm_register(struct dsi_pll_28nm *pll_28nm, struct clk_hw **prov {char clk_name[32 ], parent1[32 ], parent2[32 ], vco_name[32 ];struct clk_init_data vco_init = { - .parent_names = (const char *[]){"xo" }, + .parent_data = &(const struct clk_parent_data ) { + .fw_name ="ref" , .name ="xo" , + }, .num_parents =1 , .name = vco_name, .flags =CLK_IGNORE_UNUSED ,
drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c +3 -1
@@ -385,7 +385,9 @@ static int pll_28nm_register(struct dsi_pll_28nm *pll_28nm, struct clk_hw **prov {char *clk_name, *parent_name, *vco_name;struct clk_init_data vco_init = { - .parent_names = (const char *[]){"pxo" }, + .parent_data = &(const struct clk_parent_data ) { + .fw_name ="ref" , + }, .num_parents =1 , .flags =CLK_IGNORE_UNUSED , .ops = &clk_ops_dsi_pll_28nm_vco,
drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c +3 -1
@@ -588,7 +588,9 @@ static int pll_7nm_register(struct dsi_pll_7nm *pll_7nm, struct clk_hw **providechar clk_name[32 ], parent[32 ], vco_name[32 ];char parent2[32 ], parent3[32 ], parent4[32 ];struct clk_init_data vco_init = { - .parent_names = (const char *[]){"bi_tcxo" }, + .parent_data = &(const struct clk_parent_data ) { + .fw_name ="ref" , + }, .num_parents =1 , .name = vco_name, .flags =CLK_IGNORE_UNUSED ,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 520/1017 drm/msm/dsi/phy: fix 7nm v4.0 settings for C-PHY mode
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit bb07af2ed2a47dc6c4d0681f275bb27d4f845465 ]
The dsi_7nm_phy_enable() disagrees with downstream for glbl_str_swi_cal_sel_ctrl and glbl_hstx_str_ctrl_0 values. Update programmed settings to match downstream driver. To remove the possibility for such errors in future drop less_than_1500_mhz assignment and specify settings explicitly.
--- drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c +14 -8
@@ -864,20 +864,26 @@ static int dsi_7nm_phy_enable(struct msm_dsi_phy *phy,/* Alter PHY configurations if data rate less than 1.5GHZ*/ less_than_1500_mhz = (clk_req->bitclk_rate <=1500000000 ); -/* For C-PHY, no low power settings for lower clk rate */ -if (phy->cphy_mode) - less_than_1500_mhz = false; -if (phy->cfg->quirks &DSI_PHY_7NM_QUIRK_V4_1 ) { vreg_ctrl_0 = less_than_1500_mhz ?0x53 :0x52 ; - glbl_rescode_top_ctrl = less_than_1500_mhz ?0x3d :0x00 ; - glbl_rescode_bot_ctrl = less_than_1500_mhz ?0x39 :0x3c ; +if (phy->cphy_mode) { + glbl_rescode_top_ctrl =0x00 ; + glbl_rescode_bot_ctrl =0x3c ; + }else { + glbl_rescode_top_ctrl = less_than_1500_mhz ?0x3d :0x00 ; + glbl_rescode_bot_ctrl = less_than_1500_mhz ?0x39 :0x3c ; + } glbl_str_swi_cal_sel_ctrl =0x00 ; glbl_hstx_str_ctrl_0 =0x88 ; }else { vreg_ctrl_0 = less_than_1500_mhz ?0x5B :0x59 ; - glbl_str_swi_cal_sel_ctrl = less_than_1500_mhz ?0x03 :0x00 ; - glbl_hstx_str_ctrl_0 = less_than_1500_mhz ?0x66 :0x88 ; +if (phy->cphy_mode) { + glbl_str_swi_cal_sel_ctrl =0x03 ; + glbl_hstx_str_ctrl_0 =0x66 ; + }else { + glbl_str_swi_cal_sel_ctrl = less_than_1500_mhz ?0x03 :0x00 ; + glbl_hstx_str_ctrl_0 = less_than_1500_mhz ?0x66 :0x88 ; + } glbl_rescode_top_ctrl =0x03 ; glbl_rescode_bot_ctrl =0x3c ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 521/1017 drm/msm/dpu: add DSPP blocks teardown
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit d5c5e78f217172e87d8fb2c3418dd8b58b4adfcb ]
Add missing calls to dpu_hw_dspp_destroy() to free resources allocated for DSPP hardware blocks.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c +8 -0
@@ -35,6 +35,14 @@ int dpu_rm_destroy(struct dpu_rm *rm) {int i; +for (i =0 ; i <ARRAY_SIZE (rm->dspp_blks); i++) { +struct dpu_hw_dspp *hw; + +if (rm->dspp_blks[i]) { + hw =to_dpu_hw_dspp (rm->dspp_blks[i]); +dpu_hw_dspp_destroy (hw); + } + }for (i =0 ; i <ARRAY_SIZE (rm->pingpong_blks); i++) {struct dpu_hw_pingpong *hw;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 522/1017 drm/msm/dpu: fix dp audio condition
In reply to Greg Kroah-HartmanFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit 1e0505a5a7a2fea243f8e6d7e13fcde65f9e41bc ]
DP audio enablement code which is comparing intf_type, DRM_MODE_ENCODER_TMDS (= 2) with DRM_MODE_CONNECTOR_DisplayPort (= 10). Which would never succeed. Fix it to check for DRM_MODE_ENCODER_TMDS.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +1 -1
@@ -1102,7 +1102,7 @@ static void _dpu_encoder_virt_enable_helper(struct drm_encoder *drm_enc) } -if (dpu_enc->disp_info.intf_type == DRM_MODE_CONNECTOR_DisplayPort && +if (dpu_enc->disp_info.intf_type ==DRM_MODE_ENCODER_TMDS && dpu_enc->cur_master->hw_mdptop && dpu_enc->cur_master->hw_mdptop->ops.intf_audio_select) dpu_enc->cur_master->hw_mdptop->ops.intf_audio_select(
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 523/1017 i40e: remove dead stores on XSK hotpath
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
[ Upstream commit 7e1b54d07751edcbf23c7211508abf5667b490ee ]
The 'if (ntu == rx_ring->count)' block in i40e_alloc_rx_buffers_zc() was previously residing in the loop, but after introducing the batched interface it is used only to wrap-around the NTU descriptor, thus no more need to assign 'xdp'.
'cleaned_count' in i40e_clean_rx_irq_zc() was previously being incremented in the loop, but after commit f12738b6ec06 ("i40e: remove unnecessary cleaned_count updates") it gets assigned only once after it, so the initialization can be dropped.
--- drivers/net/ethernet/intel/i40e/i40e_xsk.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_xsk.c +1 -2
@@ -218,7 +218,6 @@ bool i40e_alloc_rx_buffers_zc(struct i40e_ring *rx_ring, u16 count) ntu += nb_buffs;if (ntu == rx_ring->count) { rx_desc =I40E_RX_DESC (rx_ring,0 ); - xdp =i40e_rx_bi (rx_ring,0 ); ntu =0 ; }
@@ -328,11 +327,11 @@ static void i40e_handle_xdp_result_zc(struct i40e_ring *rx_ring,int i40e_clean_rx_irq_zc (struct i40e_ring *rx_ring,int budget) {unsigned int total_rx_bytes =0 , total_rx_packets =0 ; -u16 cleaned_count =I40E_DESC_UNUSED (rx_ring);u16 next_to_clean = rx_ring->next_to_clean;u16 count_mask = rx_ring->count -1 ;unsigned int xdp_res, xdp_xmit =0 ;bool failure = false; +u16 cleaned_count;while (likely (total_rx_packets < (unsigned int )budget)) {union i40e_rx_desc *rx_desc;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 524/1017 ath11k: avoid active pdev check for each msdu
In reply to Greg Kroah-HartmanFrom: P Praneesh <[email protected]>
[ Upstream commit c4d12cb37ea2e6c2b70880350d7bf1bbbd825c6c ]
The Active Pdev and CAC check are done for each msdu in ath11k_dp_rx_process_received_packets which is a overhead. To avoid this overhead, collect all msdus in a per mac msdu list and pass to function.
Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.4.0.1.r2-00012-QCAHKSWPL_SILICONZ-1
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.4.0.1-01695-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath11k/dp_rx.c | 70 ++++++++++++------------- 1 file changed, 34 insertions(+), 36 deletions(-)
drivers/net/wireless/ath/ath11k/dp_rx.c +34 -36
@@ -2596,13 +2596,11 @@ static int ath11k_dp_rx_process_msdu(struct ath11k *ar,static void ath11k_dp_rx_process_received_packets (struct ath11k_base *ab,struct napi_struct *napi,struct sk_buff_head *msdu_list, -int *quota,int ring_id) +int *quota,int mac_id) { -struct ath11k_skb_rxcb *rxcb;struct sk_buff *msdu;struct ath11k *ar;struct ieee80211_rx_status rx_status = {0 }; -u8 mac_id;int ret;if (skb_queue_empty (msdu_list))
@@ -2610,20 +2608,20 @@ static void ath11k_dp_rx_process_received_packets(struct ath11k_base *ab,rcu_read_lock (); -while (*quota && (msdu =__skb_dequeue (msdu_list))) { - rxcb =ATH11K_SKB_RXCB (msdu); - mac_id = rxcb->mac_id; - ar = ab->pdevs[mac_id].ar; -if (!rcu_dereference (ab->pdevs_active[mac_id])) { -dev_kfree_skb_any (msdu); -continue ; - } + ar = ab->pdevs[mac_id].ar; +if (!rcu_dereference (ab->pdevs_active[mac_id])) { +__skb_queue_purge (msdu_list); +rcu_read_unlock (); +return ; + } -if (test_bit (ATH11K_CAC_RUNNING , &ar->dev_flags)) { -dev_kfree_skb_any (msdu); -continue ; - } +if (test_bit (ATH11K_CAC_RUNNING , &ar->dev_flags)) { +__skb_queue_purge (msdu_list); +rcu_read_unlock (); +return ; + } +while ((msdu =__skb_dequeue (msdu_list))) { ret =ath11k_dp_rx_process_msdu (ar, msdu, msdu_list, &rx_status);if (ret) { ath11k_dbg(ab, ATH11K_DBG_DATA,
@@ -2645,7 +2643,7 @@ int ath11k_dp_process_rx(struct ath11k_base *ab, int ring_id,struct ath11k_dp *dp = &ab->dp;struct dp_rxdma_ring *rx_ring;int num_buffs_reaped[MAX_RADIOS ] = {0 }; -struct sk_buff_head msdu_list; +struct sk_buff_head msdu_list[MAX_RADIOS ];struct ath11k_skb_rxcb *rxcb;int total_msdu_reaped =0 ;struct hal_srng *srng;
@@ -2654,10 +2652,13 @@ int ath11k_dp_process_rx(struct ath11k_base *ab, int ring_id,bool done = false;int buf_id, mac_id;struct ath11k *ar; -u32 *rx_desc; +struct hal_reo_dest_ring *desc; +enum hal_reo_dest_ring_push_reason push_reason; +u32 cookie;int i; -__skb_queue_head_init (&msdu_list); +for (i =0 ; i <MAX_RADIOS ; i++) +__skb_queue_head_init (&msdu_list[i]); srng = &ab->hal.srng_list[dp->reo_dst_ring[ring_id].ring_id];
@@ -2666,13 +2667,11 @@ int ath11k_dp_process_rx(struct ath11k_base *ab, int ring_id,ath11k_hal_srng_access_begin (ab, srng); try_again: -while ((rx_desc =ath11k_hal_srng_dst_get_next_entry (ab, srng))) { -struct hal_reo_dest_ring desc = *(struct hal_reo_dest_ring *)rx_desc; -enum hal_reo_dest_ring_push_reason push_reason; -u32 cookie; - +while (likely (desc = + (struct hal_reo_dest_ring *)ath11k_hal_srng_dst_get_next_entry (ab, + srng))) { cookie =FIELD_GET (BUFFER_ADDR_INFO1_SW_COOKIE , - desc.buf_addr_info.info1); + desc->buf_addr_info.info1); buf_id =FIELD_GET (DP_RXDMA_BUF_COOKIE_BUF_ID , cookie); mac_id =FIELD_GET (DP_RXDMA_BUF_COOKIE_PDEV_ID , cookie);
@@ -2700,7 +2699,7 @@ int ath11k_dp_process_rx(struct ath11k_base *ab, int ring_id, total_msdu_reaped++; push_reason =FIELD_GET (HAL_REO_DEST_RING_INFO0_PUSH_REASON , - desc.info0); + desc->info0);if (push_reason !=HAL_REO_DEST_RING_PUSH_REASON_ROUTING_INSTRUCTION ) {dev_kfree_skb_any (msdu);
@@ -2708,21 +2707,21 @@ int ath11k_dp_process_rx(struct ath11k_base *ab, int ring_id,continue ; } - rxcb->is_first_msdu = !!(desc.rx_msdu_info.info0 & + rxcb->is_first_msdu = !!(desc->rx_msdu_info.info0 &RX_MSDU_DESC_INFO0_FIRST_MSDU_IN_MPDU ); - rxcb->is_last_msdu = !!(desc.rx_msdu_info.info0 & + rxcb->is_last_msdu = !!(desc->rx_msdu_info.info0 &RX_MSDU_DESC_INFO0_LAST_MSDU_IN_MPDU ); - rxcb->is_continuation = !!(desc.rx_msdu_info.info0 & + rxcb->is_continuation = !!(desc->rx_msdu_info.info0 &RX_MSDU_DESC_INFO0_MSDU_CONTINUATION ); rxcb->peer_id =FIELD_GET (RX_MPDU_DESC_META_DATA_PEER_ID , - desc.rx_mpdu_info.meta_data); + desc->rx_mpdu_info.meta_data); rxcb->seq_no =FIELD_GET (RX_MPDU_DESC_INFO0_SEQ_NUM , - desc.rx_mpdu_info.info0); + desc->rx_mpdu_info.info0); rxcb->tid =FIELD_GET (HAL_REO_DEST_RING_INFO0_RX_QUEUE_NUM , - desc.info0); + desc->info0); rxcb->mac_id = mac_id; -__skb_queue_tail (&msdu_list, msdu); +__skb_queue_tail (&msdu_list[mac_id], msdu);if (total_msdu_reaped >= quota && !rxcb->is_continuation) { done = true;
@@ -2752,16 +2751,15 @@ int ath11k_dp_process_rx(struct ath11k_base *ab, int ring_id,if (!num_buffs_reaped[i])continue ; +ath11k_dp_rx_process_received_packets (ab, napi, &msdu_list[i], + "a, i); + ar = ab->pdevs[i].ar; rx_ring = &ar->dp.rx_refill_buf_ring;ath11k_dp_rxbufs_replenish (ab, i, rx_ring, num_buffs_reaped[i], ab->hw_params.hal_params->rx_buf_rbm); } - -ath11k_dp_rx_process_received_packets (ab, napi, &msdu_list, - "a, ring_id); - exit:return budget - quota; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 525/1017 ath11k: Invalidate cached reo ring entry before accessing it
In reply to Greg Kroah-HartmanFrom: Rameshkumar Sundaram <[email protected]>
[ Upstream commit f2180ccb52b5fd0876291ad2df37e2898cac18cf ]
REO2SW ring descriptor is currently allocated in cacheable memory. While reaping reo ring entries on second trial after updating head pointer, first entry is not invalidated before accessing it.
This results in host reaping and using cached descriptor which is already overwritten in memory by DMA device (HW).
Since the contents of descriptor(buffer id, peer info and other information bits) are outdated host throws errors like below while parsing corresponding MSDU's and drops them.
[347712.048904] ath11k_pci 0004:01:00.0: msdu_done bit in attention is not set [349173.355503] ath11k_pci 0004:01:00.0: frame rx with invalid buf_id 962
Move the try_again: label above ath11k_hal_srng_access_begin() so that first entry will be invalidated and prefetched.
Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.0.1-01100-QCAHKSWPL_SILICONZ-1
--- drivers/net/wireless/ath/ath11k/dp_rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath11k/dp_rx.c +1 -1
@@ -2664,9 +2664,9 @@ int ath11k_dp_process_rx(struct ath11k_base *ab, int ring_id,spin_lock_bh (&srng->lock); +try_again:ath11k_hal_srng_access_begin (ab, srng); -try_again:while (likely (desc = (struct hal_reo_dest_ring *)ath11k_hal_srng_dst_get_next_entry (ab, srng))) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 526/1017 dm crypt: fix get_key_size compiler warning if !CONFIG_KEYS
In reply to Greg Kroah-HartmanFrom: Aashish Sharma <[email protected]>
[ Upstream commit 6fc51504388c1a1a53db8faafe9fff78fccc7c87 ]
Explicitly convert unsigned int in the right of the conditional expression to int to match the left side operand and the return type, fixing the following compiler warning:
drivers/md/dm-crypt.c:2593:43: warning: signed and unsigned type in conditional expression [-Wsign-compare]
--- drivers/md/dm-crypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-crypt.c +1 -1
@@ -2590,7 +2590,7 @@ static int crypt_set_keyring_key(struct crypt_config *cc, const char *key_stringstatic int get_key_size (char **key_string) { -return (*key_string[0 ] ==':' ) ? -EINVAL :strlen (*key_string) >>1 ; +return (*key_string[0 ] ==':' ) ? -EINVAL : (int )(strlen (*key_string) >>1 ); }#endif /* CONFIG_KEYS */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 527/1017 vfio/pci: fix memory leak during D3hot to D0 transition
In reply to Greg Kroah-HartmanFrom: Abhishek Sahu <[email protected]>
[ Upstream commit eadf88ecf6ac7d6a9f47a76c6055d9a1987a8991 ]
If 'vfio_pci_core_device::needs_pm_restore' is set (PCI device does not have No_Soft_Reset bit set in its PMCSR config register), then the current PCI state will be saved locally in 'vfio_pci_core_device::pm_save' during D0->D3hot transition and same will be restored back during D3hot->D0 transition.
For saving the PCI state locally, pci_store_saved_state() is being used and the pci_load_and_free_saved_state() will free the allocated memory.
But for reset related IOCTLs, vfio driver calls PCI reset-related API's which will internally change the PCI power state back to D0. So, when the guest resumes, then it will get the current state as D0 and it will skip the call to vfio_pci_set_power_state() for changing the power state to D0 explicitly. In this case, the memory pointed by 'pm_save' will never be freed. In a malicious sequence, the state changing to D3hot followed by VFIO_DEVICE_RESET/VFIO_DEVICE_PCI_HOT_RESET can be run in a loop and it can cause an OOM situation.
This patch frees the earlier allocated memory first before overwriting 'pm_save' to prevent the mentioned memory leak.
--- drivers/vfio/pci/vfio_pci_core.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/vfio/pci/vfio_pci_core.c +13 -0
@@ -228,6 +228,19 @@ int vfio_pci_set_power_state(struct vfio_pci_core_device *vdev, pci_power_t statif (!ret) {/* D3 might be unsupported via quirk, skip unless in D3 */ if (needs_save && pdev->current_state >= PCI_D3hot) { +/* +* The current PCI state will be saved locally in +* 'pm_save' during the D3hot transition. When the +* device state is changed to D0 again with the current +* function, then pci_store_saved_state() will restore +* the state and will free the memory pointed by +* 'pm_save'. There are few cases where the PCI power +* state can be changed to D0 without the involvement +* of the driver. For these cases, free the earlier +* allocated memory first before overwriting 'pm_save' +* to prevent the memory leak. +*/ +kfree (vdev->pm_save); vdev->pm_save =pci_store_saved_state (pdev); }else if (needs_restore) {pci_load_and_free_saved_state (pdev, &vdev->pm_save);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 528/1017 vfio/pci: wake-up devices around reset functions
In reply to Greg Kroah-HartmanFrom: Abhishek Sahu <[email protected]>
[ Upstream commit 26a17b12d7f3dd8a7aa45a290e5b46e9cc775ddf ]
If 'vfio_pci_core_device::needs_pm_restore' is set (PCI device does not have No_Soft_Reset bit set in its PMCSR config register), then the current PCI state will be saved locally in 'vfio_pci_core_device::pm_save' during D0->D3hot transition and same will be restored back during D3hot->D0 transition. For reset-related functionalities, vfio driver uses PCI reset API's. These API's internally change the PCI power state back to D0 first if the device power state is non-D0. This state change to D0 will happen without the involvement of vfio driver.
Let's consider the following example:
1. The device is in D3hot.
2. User invokes VFIO_DEVICE_RESET ioctl.
3. pci_try_reset_function() will be called which internally invokes pci_dev_save_and_disable().
4. pci_set_power_state(dev, PCI_D0) will be called first.
5. pci_save_state() will happen then.
Now, for the devices which has NoSoftRst-, the pci_set_power_state() can trigger soft reset and the original PCI config state will be lost at step (4) and this state cannot be restored again. This original PCI state can include any setting which is performed by SBIOS or host linux kernel (for example LTR, ASPM L1 substates, etc.). When this soft reset will be triggered, then all these settings will be reset, and the device state saved at step (5) will also have this setting cleared so it cannot be restored. Since the vfio driver only exposes limited PCI capabilities to its user, so the vfio driver user also won't have the option to save and restore these capabilities state either and these original settings will be permanently lost.
For pci_reset_bus() also, we can have the above situation. The other functions/devices can be in D3hot and the reset will change the power state of all devices to D0 without the involvement of vfio driver.
So, before calling any reset-related API's, we need to make sure that the device state is D0. This is mainly to preserve the state around soft reset.
For vfio_pci_core_disable(), we use __pci_reset_function_locked() which internally can use pci_pm_reset() for the function reset. pci_pm_reset() requires the device power state to be in D0, otherwise it returns error.
This patch changes the device power state to D0 by invoking vfio_pci_set_power_state() explicitly before calling any reset related API's.
--- drivers/vfio/pci/vfio_pci_core.c | 48 ++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+)
drivers/vfio/pci/vfio_pci_core.c +48 -0
@@ -335,6 +335,17 @@ void vfio_pci_core_disable(struct vfio_pci_core_device *vdev)/* For needs_reset */ lockdep_assert_held (&vdev->vdev.dev_set->lock); +/* +* This function can be invoked while the power state is non-D0. +* This function calls __pci_reset_function_locked() which internally +* can use pci_pm_reset() for the function reset. pci_pm_reset() will +* fail if the power state is non-D0. Also, for the devices which +* have NoSoftRst-, the reset function can cause the PCI config space +* reset without restoring the original state (saved locally in +* 'vdev->pm_save'). +*/ +vfio_pci_set_power_state (vdev,PCI_D0 ); +/* Stop the device from further DMA */ pci_clear_master (pdev);
@@ -934,6 +945,19 @@ long vfio_pci_core_ioctl(struct vfio_device *core_vdev, unsigned int cmd,return -EINVAL ;vfio_pci_zap_and_down_write_memory_lock (vdev); + +/* +* This function can be invoked while the power state is non-D0. +* If pci_try_reset_function() has been called while the power +* state is non-D0, then pci_try_reset_function() will +* internally set the power state to D0 without vfio driver +* involvement. For the devices which have NoSoftRst-, the +* reset function can cause the PCI config space reset without +* restoring the original state (saved locally in +* 'vdev->pm_save'). +*/ +vfio_pci_set_power_state (vdev,PCI_D0 ); + ret =pci_try_reset_function (vdev->pdev);up_write (&vdev->memory_lock);
@@ -2068,6 +2092,18 @@ static int vfio_pci_dev_set_hot_reset(struct vfio_device_set *dev_set, } cur_mem =NULL ; +/* +* The pci_reset_bus() will reset all the devices in the bus. +* The power state can be non-D0 for some of the devices in the bus. +* For these devices, the pci_reset_bus() will internally set +* the power state to D0 without vfio driver involvement. +* For the devices which have NoSoftRst-, the reset function can +* cause the PCI config space reset without restoring the original +* state (saved locally in 'vdev->pm_save'). +*/ +list_for_each_entry (cur, &dev_set->device_list, vdev.dev_set_list) +vfio_pci_set_power_state (cur,PCI_D0 ); + ret =pci_reset_bus (pdev); err_undo:
@@ -2121,6 +2157,18 @@ static bool vfio_pci_dev_set_try_reset(struct vfio_device_set *dev_set)if (!pdev)return false; +/* +* The pci_reset_bus() will reset all the devices in the bus. +* The power state can be non-D0 for some of the devices in the bus. +* For these devices, the pci_reset_bus() will internally set +* the power state to D0 without vfio driver involvement. +* For the devices which have NoSoftRst-, the reset function can +* cause the PCI config space reset without restoring the original +* state (saved locally in 'vdev->pm_save'). +*/ +list_for_each_entry (cur, &dev_set->device_list, vdev.dev_set_list) +vfio_pci_set_power_state (cur,PCI_D0 ); + ret =pci_reset_bus (pdev);if (ret)return false;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 529/1017 scsi: fnic: Fix a tracing statement
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
[ Upstream commit 3032ed77a28913203a4fe0ab8f05752331af79b3 ]
Report both the command flags and command state instead of only the command state.
--- drivers/scsi/fnic/fnic_scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/fnic/fnic_scsi.c +1 -1
@@ -604,7 +604,7 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc)FNIC_TRACE (fnic_queuecommand, sc->device->host->host_no, tag, sc, io_req, sg_count, cmd_trace, - (((u64 )CMD_FLAGS (sc) >>32 ) |CMD_STATE (sc))); + (((u64 )CMD_FLAGS (sc) <<32 ) |CMD_STATE (sc)));/* if only we issued IO, will we have the io lock */ if (io_lock_acquired)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 530/1017 scsi: pm8001: Fix command initialization in pm80XX_send_read_log()
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit 1a37b6738b58d86f6b144b3fc754ace0f2e0166d ]
Since the sata_cmd struct is zeroed out before its fields are initialized, there is no need for using "|=" to initialize the ncqtag_atap_dir_m field. Using a standard assignment removes the sparse warning:
warning: invalid assignment: |=
Also, since the ncqtag_atap_dir_m field has type __le32, use cpu_to_le32() to generate the assigned value.
--- drivers/scsi/pm8001/pm8001_hwi.c | 2 +- drivers/scsi/pm8001/pm80xx_hwi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/pm8001/pm8001_hwi.c +1 -1
@@ -1860,7 +1860,7 @@ static void pm8001_send_read_log(struct pm8001_hba_info *pm8001_ha, sata_cmd.tag =cpu_to_le32 (ccb_tag); sata_cmd.device_id =cpu_to_le32 (pm8001_ha_dev->device_id); - sata_cmd.ncqtag_atap_dir_m |= ((0x1 <<7 ) | (0x5 <<9 )); + sata_cmd.ncqtag_atap_dir_m =cpu_to_le32 ((0x1 <<7 ) | (0x5 <<9 ));memcpy (&sata_cmd.sata_fis, &fis,sizeof (struct host_to_dev_fis )); res = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &sata_cmd,
drivers/scsi/pm8001/pm80xx_hwi.c +1 -1
@@ -1881,7 +1881,7 @@ static void pm80xx_send_read_log(struct pm8001_hba_info *pm8001_ha, sata_cmd.tag =cpu_to_le32 (ccb_tag); sata_cmd.device_id =cpu_to_le32 (pm8001_ha_dev->device_id); - sata_cmd.ncqtag_atap_dir_m_dad |= ((0x1 <<7 ) | (0x5 <<9 )); + sata_cmd.ncqtag_atap_dir_m_dad =cpu_to_le32 (((0x1 <<7 ) | (0x5 <<9 )));memcpy (&sata_cmd.sata_fis, &fis,sizeof (struct host_to_dev_fis )); res = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &sata_cmd,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 531/1017 scsi: pm8001: Fix command initialization in pm8001_chip_ssp_tm_req()
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit cd2268a180117aa8ebb23e090ba204324b2d0e93 ]
The ds_ads_m field of struct ssp_ini_tm_start_req has the type __le32. Assigning a value to it should thus use cpu_to_le32(). This fixes the sparse warning:
warning: incorrect type in assignment (different base types)
expected restricted __le32 [addressable] [assigned] [usertype] ds_ads_m got int
--- drivers/scsi/pm8001/pm8001_hwi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/pm8001/pm8001_hwi.c +1 -1
@@ -4637,7 +4637,7 @@ int pm8001_chip_ssp_tm_req(struct pm8001_hba_info *pm8001_ha,memcpy (sspTMCmd.lun, task->ssp_task.LUN,8 ); sspTMCmd.tag =cpu_to_le32 (ccb->ccb_tag);if (pm8001_ha->chip_id != chip_8001) - sspTMCmd.ds_ads_m =0x08 ; + sspTMCmd.ds_ads_m =cpu_to_le32 (0x08 ); circularQ = &pm8001_ha->inbnd_q_tbl[0 ]; ret =pm8001_mpi_build_cmd (pm8001_ha, circularQ, opc, &sspTMCmd,sizeof (sspTMCmd),0 );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 532/1017 scsi: pm8001: Fix payload initialization in pm80xx_set_thermal_config()
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit bb225b12dbcc82d53d637d10b8d70b64494f8c16 ]
The fields of the set_ctrl_cfg_req structure have the __le32 type, so use cpu_to_le32() to assign them. This removes the sparse warnings:
warning: incorrect type in assignment (different base types)
expected restricted __le32
got unsigned int
--- drivers/scsi/pm8001/pm80xx_hwi.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/scsi/pm8001/pm80xx_hwi.c +5 -3
@@ -1202,9 +1202,11 @@ pm80xx_set_thermal_config(struct pm8001_hba_info *pm8001_ha)else page_code =THERMAL_PAGE_CODE_8H ; - payload.cfg_pg[0 ] = (THERMAL_LOG_ENABLE <<9 ) | - (THERMAL_ENABLE <<8 ) | page_code; - payload.cfg_pg[1 ] = (LTEMPHIL <<24 ) | (RTEMPHIL <<8 ); + payload.cfg_pg[0 ] = +cpu_to_le32 ((THERMAL_LOG_ENABLE <<9 ) | + (THERMAL_ENABLE <<8 ) | page_code); + payload.cfg_pg[1 ] = +cpu_to_le32 ((LTEMPHIL <<24 ) | (RTEMPHIL <<8 )); pm8001_dbg(pm8001_ha, DEV, "Setting up thermal config. cfg_pg 0 0x%x cfg_pg 1 0x%x\n",
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 533/1017 scsi: pm8001: Fix le32 values handling in pm80xx_set_sas_protocol_timer_config()
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit ca374f5d92b8ae778f6a37dd3e7ed809bbf7a953 ]
All fields of the SASProtocolTimerConfig structure have the __le32 type. As such, use cpu_to_le32() to initialize them. This change suppresses many sparse warnings:
warning: incorrect type in assignment (different base types)
expected restricted __le32 [addressable] [usertype] pageCode got int
Note that the check to limit the value of the STP_IDLE_TMO field is removed as this field is initialized using the fixed (and small) value defined by the STP_IDLE_TIME macro.
The pm8001_dbg() calls printing the values of the SASProtocolTimerConfig structure fileds are changed to use le32_to_cpu() to present the values in human readable form.
--- drivers/scsi/pm8001/pm80xx_hwi.c | 52 +++++++++++++++----------------- 1 file changed, 25 insertions(+), 27 deletions(-)
drivers/scsi/pm8001/pm80xx_hwi.c +25 -27
@@ -1246,43 +1246,41 @@ pm80xx_set_sas_protocol_timer_config(struct pm8001_hba_info *pm8001_ha) circularQ = &pm8001_ha->inbnd_q_tbl[0 ]; payload.tag =cpu_to_le32 (tag); - SASConfigPage.pageCode =SAS_PROTOCOL_TIMER_CONFIG_PAGE ; - SASConfigPage.MST_MSI =3 <<15 ; - SASConfigPage.STP_SSP_MCT_TMO = (STP_MCT_TMO <<16 ) |SSP_MCT_TMO ; - SASConfigPage.STP_FRM_TMO = (SAS_MAX_OPEN_TIME <<24 ) | - (SMP_MAX_CONN_TIMER <<16 ) |STP_FRM_TIMER ; - SASConfigPage.STP_IDLE_TMO =STP_IDLE_TIME ; - -if (SASConfigPage.STP_IDLE_TMO >0x3FFFFFF ) - SASConfigPage.STP_IDLE_TMO =0x3FFFFFF ; - - - SASConfigPage.OPNRJT_RTRY_INTVL = (SAS_MFD <<16 ) | -SAS_OPNRJT_RTRY_INTVL ; - SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO = (SAS_DOPNRJT_RTRY_TMO <<16 ) - |SAS_COPNRJT_RTRY_TMO ; - SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR = (SAS_DOPNRJT_RTRY_THR <<16 ) - |SAS_COPNRJT_RTRY_THR ; - SASConfigPage.MAX_AIP =SAS_MAX_AIP ; + SASConfigPage.pageCode =cpu_to_le32 (SAS_PROTOCOL_TIMER_CONFIG_PAGE ); + SASConfigPage.MST_MSI =cpu_to_le32 (3 <<15 ); + SASConfigPage.STP_SSP_MCT_TMO = +cpu_to_le32 ((STP_MCT_TMO <<16 ) |SSP_MCT_TMO ); + SASConfigPage.STP_FRM_TMO = +cpu_to_le32 ((SAS_MAX_OPEN_TIME <<24 ) | + (SMP_MAX_CONN_TIMER <<16 ) |STP_FRM_TIMER ); + SASConfigPage.STP_IDLE_TMO =cpu_to_le32 (STP_IDLE_TIME ); + + SASConfigPage.OPNRJT_RTRY_INTVL = +cpu_to_le32 ((SAS_MFD <<16 ) |SAS_OPNRJT_RTRY_INTVL ); + SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO = +cpu_to_le32 ((SAS_DOPNRJT_RTRY_TMO <<16 ) |SAS_COPNRJT_RTRY_TMO ); + SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR = +cpu_to_le32 ((SAS_DOPNRJT_RTRY_THR <<16 ) |SAS_COPNRJT_RTRY_THR ); + SASConfigPage.MAX_AIP =cpu_to_le32 (SAS_MAX_AIP );pm8001_dbg (pm8001_ha,INIT ,"SASConfigPage.pageCode 0x%08x\n" , - SASConfigPage.pageCode); +le32_to_cpu (SASConfigPage.pageCode));pm8001_dbg (pm8001_ha,INIT ,"SASConfigPage.MST_MSI 0x%08x\n" , - SASConfigPage.MST_MSI); +le32_to_cpu (SASConfigPage.MST_MSI));pm8001_dbg (pm8001_ha,INIT ,"SASConfigPage.STP_SSP_MCT_TMO 0x%08x\n" , - SASConfigPage.STP_SSP_MCT_TMO); +le32_to_cpu (SASConfigPage.STP_SSP_MCT_TMO));pm8001_dbg (pm8001_ha,INIT ,"SASConfigPage.STP_FRM_TMO 0x%08x\n" , - SASConfigPage.STP_FRM_TMO); +le32_to_cpu (SASConfigPage.STP_FRM_TMO));pm8001_dbg (pm8001_ha,INIT ,"SASConfigPage.STP_IDLE_TMO 0x%08x\n" , - SASConfigPage.STP_IDLE_TMO); +le32_to_cpu (SASConfigPage.STP_IDLE_TMO));pm8001_dbg (pm8001_ha,INIT ,"SASConfigPage.OPNRJT_RTRY_INTVL 0x%08x\n" , - SASConfigPage.OPNRJT_RTRY_INTVL); +le32_to_cpu (SASConfigPage.OPNRJT_RTRY_INTVL));pm8001_dbg (pm8001_ha,INIT ,"SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO 0x%08x\n" , - SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO); +le32_to_cpu (SASConfigPage.Data_Cmd_OPNRJT_RTRY_TMO));pm8001_dbg (pm8001_ha,INIT ,"SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR 0x%08x\n" , - SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR); +le32_to_cpu (SASConfigPage.Data_Cmd_OPNRJT_RTRY_THR));pm8001_dbg (pm8001_ha,INIT ,"SASConfigPage.MAX_AIP 0x%08x\n" , - SASConfigPage.MAX_AIP); +le32_to_cpu (SASConfigPage.MAX_AIP));memcpy (&payload.cfg_pg, &SASConfigPage,sizeof (SASProtocolTimerConfig_t));
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 534/1017 scsi: pm8001: Fix payload initialization in pm80xx_encrypt_update()
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit f8b12dfb476dad38ce755aaf5e2df46f06f1822e ]
All fields of the kek_mgmt_req structure have the type __le32. So make sure to use cpu_to_le32() to initialize them. This suppresses the sparse warning:
warning: incorrect type in assignment (different base types)
expected restricted __le32 [addressable] [assigned] [usertype] new_curidx_ksop got int
--- drivers/scsi/pm8001/pm80xx_hwi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/scsi/pm8001/pm80xx_hwi.c +4 -3
@@ -1406,12 +1406,13 @@ static int pm80xx_encrypt_update(struct pm8001_hba_info *pm8001_ha)/* Currently only one key is used. New KEK index is 1. * Current KEK index is 1. Store KEK to NVRAM is 1. */ - payload.new_curidx_ksop = ((1 <<24 ) | (1 <<16 ) | (1 <<8 ) | -KEK_MGMT_SUBOP_KEYCARDUPDATE ); + payload.new_curidx_ksop = +cpu_to_le32 (((1 <<24 ) | (1 <<16 ) | (1 <<8 ) | +KEK_MGMT_SUBOP_KEYCARDUPDATE ));pm8001_dbg (pm8001_ha,DEV ,"Saving Encryption info to flash. payload 0x%x\n" , - payload.new_curidx_ksop); +le32_to_cpu (payload.new_curidx_ksop)); rc =pm8001_mpi_build_cmd (pm8001_ha, circularQ, opc, &payload,sizeof (payload),0 );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 535/1017 scsi: pm8001: Fix le32 values handling in pm80xx_chip_ssp_io_req()
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit 970404cc5744b1033b6ee601be4ef0e2d1fbcf72 ]
Make sure that the __le32 fields of struct ssp_ini_io_start_req are manipulated after applying the correct endian conversion. That is, use cpu_to_le32() for assigning values and le32_to_cpu() for consulting a field value. In particular, make sure that the calculations for the 4G boundary check are done using CPU endianness and *not* little endian values. With these fixes, many sparse warnings are removed.
While at it, add blank lines after variable declarations and in some other places to make this code more readable.
--- drivers/scsi/pm8001/pm80xx_hwi.c | 41 +++++++++++++++++++------------- 1 file changed, 25 insertions(+), 16 deletions(-)
drivers/scsi/pm8001/pm80xx_hwi.c +25 -16
@@ -4389,13 +4389,15 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha,struct ssp_ini_io_start_req ssp_cmd;u32 tag = ccb->ccb_tag;int ret; -u64 phys_addr, start_addr, end_addr; +u64 phys_addr, end_addr;u32 end_addr_high, end_addr_low;struct inbound_queue_table *circularQ;u32 q_index, cpu_id;u32 opc =OPC_INB_SSPINIIOSTART ; +memset (&ssp_cmd,0 ,sizeof (ssp_cmd));memcpy (ssp_cmd.ssp_iu.lun, task->ssp_task.LUN,8 ); +/* data address domain added for spcv; set to 0 by host, * used internally by controller * 0 for SAS 1.1 and SAS 2.0 compatible TLR
@@ -4406,7 +4408,7 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, ssp_cmd.device_id =cpu_to_le32 (pm8001_dev->device_id); ssp_cmd.tag =cpu_to_le32 (tag);if (task->ssp_task.enable_first_burst) - ssp_cmd.ssp_iu.efb_prio_attr |=0x80 ; + ssp_cmd.ssp_iu.efb_prio_attr =0x80 ; ssp_cmd.ssp_iu.efb_prio_attr |= (task->ssp_task.task_prio <<3 ); ssp_cmd.ssp_iu.efb_prio_attr |= (task->ssp_task.task_attr &7 ); memcpy(ssp_cmd.ssp_iu.cdb, task->ssp_task.cmd->cmnd,
@@ -4438,21 +4440,24 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, ssp_cmd.enc_esgl =cpu_to_le32 (1 <<31 ); }else if (task->num_scatter ==1 ) {u64 dma_addr =sg_dma_address (task->scatter); + ssp_cmd.enc_addr_low =cpu_to_le32 (lower_32_bits (dma_addr)); ssp_cmd.enc_addr_high =cpu_to_le32 (upper_32_bits (dma_addr)); ssp_cmd.enc_len =cpu_to_le32 (task->total_xfer_len); ssp_cmd.enc_esgl =0 ; +/* Check 4G Boundary */ - start_addr =cpu_to_le64 (dma_addr); - end_addr = (start_addr + ssp_cmd.enc_len) -1 ; - end_addr_low =cpu_to_le32 (lower_32_bits (end_addr)); - end_addr_high =cpu_to_le32 (upper_32_bits (end_addr)); -if (end_addr_high != ssp_cmd.enc_addr_high) { + end_addr = dma_addr +le32_to_cpu (ssp_cmd.enc_len) -1 ; + end_addr_low =lower_32_bits (end_addr); + end_addr_high =upper_32_bits (end_addr); + +if (end_addr_high !=le32_to_cpu (ssp_cmd.enc_addr_high)) {pm8001_dbg (pm8001_ha,FAIL ,"The sg list address start_addr=0x%016llx data_len=0x%x end_addr_high=0x%08x end_addr_low=0x%08x has crossed 4G boundary\n" , - start_addr, ssp_cmd.enc_len, + dma_addr, +le32_to_cpu (ssp_cmd.enc_len), end_addr_high, end_addr_low);pm8001_chip_make_sg (task->scatter,1 , ccb->buf_prd);
@@ -4461,7 +4466,7 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha,cpu_to_le32 (lower_32_bits (phys_addr)); ssp_cmd.enc_addr_high =cpu_to_le32 (upper_32_bits (phys_addr)); - ssp_cmd.enc_esgl =cpu_to_le32 (1 <<31 ); + ssp_cmd.enc_esgl =cpu_to_le32 (1U <<31 ); } }else if (task->num_scatter ==0 ) { ssp_cmd.enc_addr_low =0 ;
@@ -4469,8 +4474,10 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, ssp_cmd.enc_len =cpu_to_le32 (task->total_xfer_len); ssp_cmd.enc_esgl =0 ; } +/* XTS mode. All other fields are 0 */ - ssp_cmd.key_cmode =0x6 <<4 ; + ssp_cmd.key_cmode =cpu_to_le32 (0x6 <<4 ); +/* set tweak values. Should be the start lba */ ssp_cmd.twk_val0 = cpu_to_le32((task->ssp_task.cmd->cmnd[2] << 24) | (task->ssp_task.cmd->cmnd[3] << 16) |
@@ -4492,20 +4499,22 @@ static int pm80xx_chip_ssp_io_req(struct pm8001_hba_info *pm8001_ha, ssp_cmd.esgl =cpu_to_le32 (1 <<31 ); }else if (task->num_scatter ==1 ) {u64 dma_addr =sg_dma_address (task->scatter); + ssp_cmd.addr_low =cpu_to_le32 (lower_32_bits (dma_addr)); ssp_cmd.addr_high =cpu_to_le32 (upper_32_bits (dma_addr)); ssp_cmd.len =cpu_to_le32 (task->total_xfer_len); ssp_cmd.esgl =0 ; +/* Check 4G Boundary */ - start_addr =cpu_to_le64 (dma_addr); - end_addr = (start_addr + ssp_cmd.len) -1 ; - end_addr_low =cpu_to_le32 (lower_32_bits (end_addr)); - end_addr_high =cpu_to_le32 (upper_32_bits (end_addr)); -if (end_addr_high != ssp_cmd.addr_high) { + end_addr = dma_addr +le32_to_cpu (ssp_cmd.len) -1 ; + end_addr_low =lower_32_bits (end_addr); + end_addr_high =upper_32_bits (end_addr); +if (end_addr_high !=le32_to_cpu (ssp_cmd.addr_high)) {pm8001_dbg (pm8001_ha,FAIL ,"The sg list address start_addr=0x%016llx data_len=0x%x end_addr_high=0x%08x end_addr_low=0x%08x has crossed 4G boundary\n" , - start_addr, ssp_cmd.len, + dma_addr, +le32_to_cpu (ssp_cmd.len), end_addr_high, end_addr_low);pm8001_chip_make_sg (task->scatter,1 , ccb->buf_prd);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 536/1017 scsi: pm8001: Fix le32 values handling in pm80xx_chip_sata_req()
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit fd6d0e376211d7ed759db96b0fbd9a1cee67d462 ]
Make sure that the __le32 fields of struct sata_cmd are manipulated after applying the correct endian conversion. That is, use cpu_to_le32() for assigning values and le32_to_cpu() for consulting a field value. In particular, make sure that the calculations for the 4G boundary check are done using CPU endianness and *not* little endian values. With these fixes, many sparse warnings are removed.
While at it, fix some code identation and add blank lines after variable declarations and in some other places to make this code more readable.
--- drivers/scsi/pm8001/pm80xx_hwi.c | 82 ++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 37 deletions(-)
drivers/scsi/pm8001/pm80xx_hwi.c +45 -37
@@ -4548,7 +4548,7 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha,u32 q_index, cpu_id;struct sata_start_req sata_cmd;u32 hdr_tag, ncg_tag =0 ; -u64 phys_addr, start_addr, end_addr; +u64 phys_addr, end_addr;u32 end_addr_high, end_addr_low;u32 ATAP =0x0 ;u32 dir;
@@ -4609,32 +4609,38 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha,pm8001_chip_make_sg (task->scatter, ccb->n_elem, ccb->buf_prd); phys_addr = ccb->ccb_dma_handle; - sata_cmd.enc_addr_low =lower_32_bits (phys_addr); - sata_cmd.enc_addr_high =upper_32_bits (phys_addr); + sata_cmd.enc_addr_low = +cpu_to_le32 (lower_32_bits (phys_addr)); + sata_cmd.enc_addr_high = +cpu_to_le32 (upper_32_bits (phys_addr)); sata_cmd.enc_esgl =cpu_to_le32 (1 <<31 ); }else if (task->num_scatter ==1 ) {u64 dma_addr =sg_dma_address (task->scatter); - sata_cmd.enc_addr_low =lower_32_bits (dma_addr); - sata_cmd.enc_addr_high =upper_32_bits (dma_addr); + + sata_cmd.enc_addr_low = +cpu_to_le32 (lower_32_bits (dma_addr)); + sata_cmd.enc_addr_high = +cpu_to_le32 (upper_32_bits (dma_addr)); sata_cmd.enc_len =cpu_to_le32 (task->total_xfer_len); sata_cmd.enc_esgl =0 ; +/* Check 4G Boundary */ - start_addr =cpu_to_le64 (dma_addr); - end_addr = (start_addr + sata_cmd.enc_len) -1 ; - end_addr_low =cpu_to_le32 (lower_32_bits (end_addr)); - end_addr_high =cpu_to_le32 (upper_32_bits (end_addr)); -if (end_addr_high != sata_cmd.enc_addr_high) { + end_addr = dma_addr +le32_to_cpu (sata_cmd.enc_len) -1 ; + end_addr_low =lower_32_bits (end_addr); + end_addr_high =upper_32_bits (end_addr); +if (end_addr_high !=le32_to_cpu (sata_cmd.enc_addr_high)) {pm8001_dbg (pm8001_ha,FAIL ,"The sg list address start_addr=0x%016llx data_len=0x%x end_addr_high=0x%08x end_addr_low=0x%08x has crossed 4G boundary\n" , - start_addr, sata_cmd.enc_len, + dma_addr, +le32_to_cpu (sata_cmd.enc_len), end_addr_high, end_addr_low);pm8001_chip_make_sg (task->scatter,1 , ccb->buf_prd); phys_addr = ccb->ccb_dma_handle; sata_cmd.enc_addr_low = -lower_32_bits (phys_addr); +cpu_to_le32 (lower_32_bits (phys_addr)); sata_cmd.enc_addr_high = -upper_32_bits (phys_addr); +cpu_to_le32 (upper_32_bits (phys_addr)); sata_cmd.enc_esgl =cpu_to_le32 (1 <<31 ); }
@@ -4645,7 +4651,8 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha, sata_cmd.enc_esgl =0 ; }/* XTS mode. All other fields are 0 */ - sata_cmd.key_index_mode =0x6 <<4 ; + sata_cmd.key_index_mode =cpu_to_le32 (0x6 <<4 ); +/* set tweak values. Should be the start lba */ sata_cmd.twk_val0 = cpu_to_le32((sata_cmd.sata_fis.lbal_exp << 24) |
@@ -4671,31 +4678,31 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha, phys_addr = ccb->ccb_dma_handle; sata_cmd.addr_low =lower_32_bits (phys_addr); sata_cmd.addr_high =upper_32_bits (phys_addr); - sata_cmd.esgl =cpu_to_le32 (1 <<31 ); + sata_cmd.esgl =cpu_to_le32 (1U <<31 ); }else if (task->num_scatter ==1 ) {u64 dma_addr =sg_dma_address (task->scatter); + sata_cmd.addr_low =lower_32_bits (dma_addr); sata_cmd.addr_high =upper_32_bits (dma_addr); sata_cmd.len =cpu_to_le32 (task->total_xfer_len); sata_cmd.esgl =0 ; +/* Check 4G Boundary */ - start_addr =cpu_to_le64 (dma_addr); - end_addr = (start_addr + sata_cmd.len) -1 ; - end_addr_low =cpu_to_le32 (lower_32_bits (end_addr)); - end_addr_high =cpu_to_le32 (upper_32_bits (end_addr)); + end_addr = dma_addr +le32_to_cpu (sata_cmd.len) -1 ; + end_addr_low =lower_32_bits (end_addr); + end_addr_high =upper_32_bits (end_addr);if (end_addr_high != sata_cmd.addr_high) {pm8001_dbg (pm8001_ha,FAIL ,"The sg list address start_addr=0x%016llx data_len=0x%xend_addr_high=0x%08x end_addr_low=0x%08x has crossed 4G boundary\n" , - start_addr, sata_cmd.len, + dma_addr, +le32_to_cpu (sata_cmd.len), end_addr_high, end_addr_low);pm8001_chip_make_sg (task->scatter,1 , ccb->buf_prd); phys_addr = ccb->ccb_dma_handle; - sata_cmd.addr_low = -lower_32_bits (phys_addr); - sata_cmd.addr_high = -upper_32_bits (phys_addr); - sata_cmd.esgl =cpu_to_le32 (1 <<31 ); + sata_cmd.addr_low =lower_32_bits (phys_addr); + sata_cmd.addr_high =upper_32_bits (phys_addr); + sata_cmd.esgl =cpu_to_le32 (1U <<31 ); } }else if (task->num_scatter ==0 ) { sata_cmd.addr_low =0 ;
@@ -4703,27 +4710,28 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha, sata_cmd.len =cpu_to_le32 (task->total_xfer_len); sata_cmd.esgl =0 ; } +/* scsi cdb */ sata_cmd.atapi_scsi_cdb[0 ] =cpu_to_le32 (((task->ata_task.atapi_packet[0 ]) | - (task->ata_task.atapi_packet[1 ] <<8 ) | - (task->ata_task.atapi_packet[2 ] <<16 ) | - (task->ata_task.atapi_packet[3 ] <<24 ))); + (task->ata_task.atapi_packet[1 ] <<8 ) | + (task->ata_task.atapi_packet[2 ] <<16 ) | + (task->ata_task.atapi_packet[3 ] <<24 ))); sata_cmd.atapi_scsi_cdb[1 ] =cpu_to_le32 (((task->ata_task.atapi_packet[4 ]) | - (task->ata_task.atapi_packet[5 ] <<8 ) | - (task->ata_task.atapi_packet[6 ] <<16 ) | - (task->ata_task.atapi_packet[7 ] <<24 ))); + (task->ata_task.atapi_packet[5 ] <<8 ) | + (task->ata_task.atapi_packet[6 ] <<16 ) | + (task->ata_task.atapi_packet[7 ] <<24 ))); sata_cmd.atapi_scsi_cdb[2 ] =cpu_to_le32 (((task->ata_task.atapi_packet[8 ]) | - (task->ata_task.atapi_packet[9 ] <<8 ) | - (task->ata_task.atapi_packet[10 ] <<16 ) | - (task->ata_task.atapi_packet[11 ] <<24 ))); + (task->ata_task.atapi_packet[9 ] <<8 ) | + (task->ata_task.atapi_packet[10 ] <<16 ) | + (task->ata_task.atapi_packet[11 ] <<24 ))); sata_cmd.atapi_scsi_cdb[3 ] =cpu_to_le32 (((task->ata_task.atapi_packet[12 ]) | - (task->ata_task.atapi_packet[13 ] <<8 ) | - (task->ata_task.atapi_packet[14 ] <<16 ) | - (task->ata_task.atapi_packet[15 ] <<24 ))); + (task->ata_task.atapi_packet[13 ] <<8 ) | + (task->ata_task.atapi_packet[14 ] <<16 ) | + (task->ata_task.atapi_packet[15 ] <<24 ))); }/* Check for read log for failed drive and return */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 537/1017 scsi: pm8001: Fix NCQ NON DATA command task initialization
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit aa028141ab0bc62c44a84d42f09db35d82df82a2 ]
In the pm8001_chip_sata_req() and pm80xx_chip_sata_req() functions, all tasks with a DMA direction of DMA_NONE (no data transfer) are initialized using the ATAP value 0x04. However, NCQ NON DATA commands, while being DMA_NONE commands are NCQ commands and need to be initialized using the value 0x07 for ATAP, similarly to other NCQ commands.
Make sure that NCQ NON DATA command tasks are initialized similarly to other NCQ commands by also testing the task "use_ncq" field in addition to the DMA direction. While at it, reorganize the code into a chain of if - else if - else to avoid useless affectations and debug messages.
--- drivers/scsi/pm8001/pm8001_hwi.c | 14 +++++++------- drivers/scsi/pm8001/pm80xx_hwi.c | 13 ++++++------- 2 files changed, 13 insertions(+), 14 deletions(-)
drivers/scsi/pm8001/pm8001_hwi.c +7 -7
@@ -4282,22 +4282,22 @@ static int pm8001_chip_sata_req(struct pm8001_hba_info *pm8001_ha,u32 opc =OPC_INB_SATA_HOST_OPSTART ;memset (&sata_cmd,0 ,sizeof (sata_cmd)); circularQ = &pm8001_ha->inbnd_q_tbl[0 ]; -if (task->data_dir ==DMA_NONE ) { + +if (task->data_dir ==DMA_NONE && !task->ata_task.use_ncq) {ATAP =0x04 ;/* no data*/ pm8001_dbg (pm8001_ha,IO ,"no data\n" ); }else if (likely (!task->ata_task.device_control_reg_update)) { -if (task->ata_task.dma_xfer) { +if (task->ata_task.use_ncq && + dev->sata_dev.class !=ATA_DEV_ATAPI ) { +ATAP =0x07 ;/* FPDMA */ +pm8001_dbg (pm8001_ha,IO ,"FPDMA\n" ); + }else if (task->ata_task.dma_xfer) {ATAP =0x06 ;/* DMA */ pm8001_dbg (pm8001_ha,IO ,"DMA\n" ); }else {ATAP =0x05 ;/* PIO*/ pm8001_dbg (pm8001_ha,IO ,"PIO\n" ); } -if (task->ata_task.use_ncq && - dev->sata_dev.class !=ATA_DEV_ATAPI ) { -ATAP =0x07 ;/* FPDMA */ -pm8001_dbg (pm8001_ha,IO ,"FPDMA\n" ); - } }if (task->ata_task.use_ncq &&pm8001_get_ncq_tag (task, &hdr_tag)) { task->ata_task.fis.sector_count |= (u8) (hdr_tag <<3 );
drivers/scsi/pm8001/pm80xx_hwi.c +6 -7
@@ -4560,22 +4560,21 @@ static int pm80xx_chip_sata_req(struct pm8001_hba_info *pm8001_ha, q_index = (u32) (cpu_id) % (pm8001_ha->max_q_num); circularQ = &pm8001_ha->inbnd_q_tbl[q_index]; -if (task->data_dir ==DMA_NONE ) { +if (task->data_dir ==DMA_NONE && !task->ata_task.use_ncq) {ATAP =0x04 ;/* no data*/ pm8001_dbg (pm8001_ha,IO ,"no data\n" ); }else if (likely (!task->ata_task.device_control_reg_update)) { -if (task->ata_task.dma_xfer) { +if (task->ata_task.use_ncq && + dev->sata_dev.class !=ATA_DEV_ATAPI ) { +ATAP =0x07 ;/* FPDMA */ +pm8001_dbg (pm8001_ha,IO ,"FPDMA\n" ); + }else if (task->ata_task.dma_xfer) {ATAP =0x06 ;/* DMA */ pm8001_dbg (pm8001_ha,IO ,"DMA\n" ); }else {ATAP =0x05 ;/* PIO*/ pm8001_dbg (pm8001_ha,IO ,"PIO\n" ); } -if (task->ata_task.use_ncq && - dev->sata_dev.class !=ATA_DEV_ATAPI ) { -ATAP =0x07 ;/* FPDMA */ -pm8001_dbg (pm8001_ha,IO ,"FPDMA\n" ); - } }if (task->ata_task.use_ncq &&pm8001_get_ncq_tag (task, &hdr_tag)) { task->ata_task.fis.sector_count |= (u8) (hdr_tag <<3 );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 538/1017 scsi: pm8001: Fix NCQ NON DATA command completion handling
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit 1d6736c3e162061dc811c76e605f35ef3234bffa ]
NCQ NON DATA is an NCQ command with the DMA_NONE DMA direction and so a register-device-to-host-FIS response is expected for it.
However, for an IO_SUCCESS case, mpi_sata_completion() expects a set-device-bits-FIS for any ata task with an use_ncq field true, which includes NCQ NON DATA commands.
Fix this to correctly treat NCQ NON DATA commands as non-data by also testing for the DMA_NONE DMA direction.
--- drivers/scsi/pm8001/pm8001_hwi.c | 3 ++- drivers/scsi/pm8001/pm80xx_hwi.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/scsi/pm8001/pm8001_hwi.c +2 -1
@@ -2421,7 +2421,8 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb) len =sizeof (struct pio_setup_fis );pm8001_dbg (pm8001_ha,IO ,"PIO read len = %d\n" , len); - }else if (t->ata_task.use_ncq) { + }else if (t->ata_task.use_ncq && + t->data_dir !=DMA_NONE ) { len =sizeof (struct set_dev_bits_fis );pm8001_dbg (pm8001_ha,IO ,"FPDMA len = %d\n" , len);
drivers/scsi/pm8001/pm80xx_hwi.c +2 -1
@@ -2518,7 +2518,8 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, len =sizeof (struct pio_setup_fis );pm8001_dbg (pm8001_ha,IO ,"PIO read len = %d\n" , len); - }else if (t->ata_task.use_ncq) { + }else if (t->ata_task.use_ncq && + t->data_dir !=DMA_NONE ) { len =sizeof (struct set_dev_bits_fis );pm8001_dbg (pm8001_ha,IO ,"FPDMA len = %d\n" , len);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 539/1017 scsi: pm8001: Fix abort all task initialization
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
[ Upstream commit 7f12845c8389855dbcc67baa068b6832dc4a396e ]
In pm80xx_send_abort_all(), the n_elem field of the ccb used is not initialized to 0. This missing initialization sometimes lead to the task completion path seeing the ccb with a non-zero n_elem resulting in the execution of invalid dma_unmap_sg() calls in pm8001_ccb_task_free(), causing a crash such as:
[ 197.676341] RIP: 0010:iommu_dma_unmap_sg+0x6d/0x280 [ 197.700204] RSP: 0018:ffff889bbcf89c88 EFLAGS: 00010012 [ 197.705485] RAX: dffffc0000000000 RBX: 0000000000000000 RCX: ffffffff83d0bda0 [ 197.712687] RDX: 0000000000000002 RSI: 0000000000000000 RDI: ffff88810dffc0d0 [ 197.719887] RBP: 0000000000000000 R08: 0000000000000000 R09: ffff8881c790098b [ 197.727089] R10: ffffed1038f20131 R11: 0000000000000001 R12: 0000000000000000 [ 197.734296] R13: ffff88810dffc0d0 R14: 0000000000000010 R15: 0000000000000000 [ 197.741493] FS: 0000000000000000(0000) GS:ffff889bbcf80000(0000) knlGS:0000000000000000 [ 197.749659] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 197.755459] CR2: 00007f16c1b42734 CR3: 0000000004814000 CR4: 0000000000350ee0 [ 197.762656] Call Trace: [ 197.765127] <IRQ> [ 197.767162] pm8001_ccb_task_free+0x5f1/0x820 [pm80xx] [ 197.772364] ? do_raw_spin_unlock+0x54/0x220 [ 197.776680] pm8001_mpi_task_abort_resp+0x2ce/0x4f0 [pm80xx] [ 197.782406] process_oq+0xe85/0x7890 [pm80xx] [ 197.786817] ? lock_acquire+0x194/0x490 [ 197.790697] ? handle_irq_event+0x10e/0x1b0 [ 197.794920] ? mpi_sata_completion+0x2d70/0x2d70 [pm80xx] [ 197.800378] ? __wake_up_bit+0x100/0x100 [ 197.804340] ? lock_is_held_type+0x98/0x110 [ 197.808565] pm80xx_chip_isr+0x94/0x130 [pm80xx] [ 197.813243] tasklet_action_common.constprop.0+0x24b/0x2f0 [ 197.818785] __do_softirq+0x1b5/0x82d [ 197.822485] ? do_raw_spin_unlock+0x54/0x220 [ 197.826799] __irq_exit_rcu+0x17e/0x1e0 [ 197.830678] irq_exit_rcu+0xa/0x20 [ 197.834114] common_interrupt+0x78/0x90 [ 197.840051] </IRQ> [ 197.844236] <TASK> [ 197.848397] asm_common_interrupt+0x1e/0x40
Avoid this issue by always initializing the ccb n_elem field to 0 in pm8001_send_abort_all(), pm8001_send_read_log() and pm80xx_send_abort_all().
--- drivers/scsi/pm8001/pm8001_hwi.c | 2 ++ drivers/scsi/pm8001/pm80xx_hwi.c | 1 + 2 files changed, 3 insertions(+)
drivers/scsi/pm8001/pm8001_hwi.c +2 -0
@@ -1783,6 +1783,7 @@ static void pm8001_send_abort_all(struct pm8001_hba_info *pm8001_ha, ccb->device = pm8001_ha_dev; ccb->ccb_tag = ccb_tag; ccb->task = task; + ccb->n_elem =0 ; circularQ = &pm8001_ha->inbnd_q_tbl[0 ];
@@ -1844,6 +1845,7 @@ static void pm8001_send_read_log(struct pm8001_hba_info *pm8001_ha, ccb->device = pm8001_ha_dev; ccb->ccb_tag = ccb_tag; ccb->task = task; + ccb->n_elem =0 ; pm8001_ha_dev->id |=NCQ_READ_LOG_FLAG ; pm8001_ha_dev->id |=NCQ_2ND_RLE_FLAG ;
drivers/scsi/pm8001/pm80xx_hwi.c +1 -0
@@ -1801,6 +1801,7 @@ static void pm80xx_send_abort_all(struct pm8001_hba_info *pm8001_ha, ccb->device = pm8001_ha_dev; ccb->ccb_tag = ccb_tag; ccb->task = task; + ccb->n_elem =0 ; circularQ = &pm8001_ha->inbnd_q_tbl[0 ];
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 540/1017 mt76: mt7921s: fix missing fc type/sub-type for 802.11 pkts
In reply to Greg Kroah-HartmanFrom: Deren Wu <[email protected]>
[ Upstream commit 355c060d5f38a784822d544e969121a273bcf545 ]
For non-mmio devices, should set fc values to proper txwi config
--- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 12 +++++++++--- drivers/net/wireless/mediatek/mt76/mt7921/mac.h | 3 +++ 2 files changed, 12 insertions(+), 3 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/mac.c +9 -3
@@ -836,9 +836,15 @@ mt7921_mac_write_txwi_80211(struct mt7921_dev *dev, __le32 *txwi, txwi[3 ] |=cpu_to_le32 (val); } - val =FIELD_PREP (MT_TXD7_TYPE , fc_type) | -FIELD_PREP (MT_TXD7_SUB_TYPE , fc_stype); - txwi[7 ] |=cpu_to_le32 (val); +if (mt76_is_mmio (&dev->mt76)) { + val =FIELD_PREP (MT_TXD7_TYPE , fc_type) | +FIELD_PREP (MT_TXD7_SUB_TYPE , fc_stype); + txwi[7 ] |=cpu_to_le32 (val); + }else { + val =FIELD_PREP (MT_TXD8_L_TYPE , fc_type) | +FIELD_PREP (MT_TXD8_L_SUB_TYPE , fc_stype); + txwi[8 ] |=cpu_to_le32 (val); + } } void mt7921_mac_write_txwi(struct mt7921_dev *dev, __le32 *txwi,
drivers/net/wireless/mediatek/mt76/mt7921/mac.h +3 -0
@@ -284,6 +284,9 @@ enum tx_mcu_port_q_idx {#define MT_TXD7_HW_AMSDU BIT(10)#define MT_TXD7_TX_TIME GENMASK(9, 0) +#define MT_TXD8_L_TYPE GENMASK(5, 4) +#define MT_TXD8_L_SUB_TYPE GENMASK(3, 0) +#define MT_TX_RATE_STBC BIT(13)#define MT_TX_RATE_NSS GENMASK(12, 10)#define MT_TX_RATE_MODE GENMASK(9, 6)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 541/1017 net: dsa: realtek-smi: fix kdoc warnings
In reply to Greg Kroah-HartmanFrom: Luiz Angelo Daros de Luca <[email protected]>
[ Upstream commit 0f0c6da03ba37739901ca5db4361c1ef1ae9463f ]
Removed kdoc mark for incomplete struct description. Added a return description for rtl8366rb_drop_untagged.
--- drivers/net/dsa/realtek-smi-core.h | 4 ++-- drivers/net/dsa/rtl8366rb.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/net/dsa/realtek-smi-core.h +2 -2
@@ -25,7 +25,7 @@ struct rtl8366_mib_counter {const char *name; }; -/** +/* * struct rtl8366_vlan_mc - Virtual LAN member configuration */ struct rtl8366_vlan_mc {
@@ -74,7 +74,7 @@ struct realtek_smi {void *chip_data;/* Per-chip extra variant data */ }; -/** +/* * struct realtek_smi_ops - vtable for the per-SMI-chiptype operations * @detect: detects the chiptype */
drivers/net/dsa/rtl8366rb.c +2 -0
@@ -1251,6 +1251,8 @@ rtl8366rb_port_bridge_leave(struct dsa_switch *ds, int port,* @smi: SMI state container * @port: the port to drop untagged and C-tagged frames on * @drop: whether to drop or pass untagged and C-tagged frames +* +* Return: zero for success, a negative number on error. */ static int rtl8366rb_drop_untagged (struct realtek_smi *smi,int port,bool drop) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 542/1017 net: dsa: realtek-smi: move to subdirectory
In reply to Greg Kroah-HartmanFrom: Luiz Angelo Daros de Luca <[email protected]>
[ Upstream commit 319a70a5fea9590e9431dd57f56191996c4787f4 ]
---
MAINTAINERS | 3 +--
drivers/net/dsa/Kconfig | 12 +----------
drivers/net/dsa/Makefile | 3 +--
drivers/net/dsa/realtek/Kconfig | 20 +++++++++++++++++++
drivers/net/dsa/realtek/Makefile | 3 +++
.../net/dsa/{ => realtek}/realtek-smi-core.c | 0
.../net/dsa/{ => realtek}/realtek-smi-core.h | 0
drivers/net/dsa/{ => realtek}/rtl8365mb.c | 0
drivers/net/dsa/{ => realtek}/rtl8366.c | 0
drivers/net/dsa/{ => realtek}/rtl8366rb.c | 0
10 files changed, 26 insertions(+), 15 deletions(-)
create mode 100644 drivers/net/dsa/realtek/Kconfig
create mode 100644 drivers/net/dsa/realtek/Makefile
rename drivers/net/dsa/{ => realtek}/realtek-smi-core.c (100%)
rename drivers/net/dsa/{ => realtek}/realtek-smi-core.h (100%)
rename drivers/net/dsa/{ => realtek}/rtl8365mb.c (100%)
rename drivers/net/dsa/{ => realtek}/rtl8366.c (100%)
rename drivers/net/dsa/{ => realtek}/rtl8366rb.c (100%)MAINTAINERS +1 -2
@@ -16147,8 +16147,7 @@ REALTEK RTL83xx SMI DSA ROUTER CHIPS M: Linus Walleij <[email protected]> S: Maintained F: Documentation/devicetree/bindings/net/dsa/realtek-smi.txt -F: drivers/net/dsa/realtek-smi* -F: drivers/net/dsa/rtl83* +F: drivers/net/dsa/realtek/* REALTEK WIRELESS DRIVER (rtlwifi family) M: Ping-Ke Shih <[email protected]>
drivers/net/dsa/Kconfig +1 -11
@@ -68,17 +68,7 @@ config NET_DSA_QCA8K This enables support for the Qualcomm Atheros QCA8K Ethernet switch chips. -config NET_DSA_REALTEK_SMI - tristate "Realtek SMI Ethernet switch family support" - select NET_DSA_TAG_RTL4_A - select NET_DSA_TAG_RTL8_4 - select FIXED_PHY - select IRQ_DOMAIN - select REALTEK_PHY - select REGMAP - help - This enables support for the Realtek SMI-based switch - chips, currently only RTL8366RB. +source "drivers/net/dsa/realtek/Kconfig" config NET_DSA_SMSC_LAN9303 tristate
drivers/net/dsa/Makefile +1 -2
@@ -9,8 +9,6 @@ obj-$(CONFIG_NET_DSA_LANTIQ_GSWIP) += lantiq_gswip.o obj-$(CONFIG_NET_DSA_MT7530) += mt7530.o obj-$(CONFIG_NET_DSA_MV88E6060) += mv88e6060.o obj-$(CONFIG_NET_DSA_QCA8K) += qca8k.o -obj-$(CONFIG_NET_DSA_REALTEK_SMI) += realtek-smi.o -realtek-smi-objs := realtek-smi-core.o rtl8366.o rtl8366rb.o rtl8365mb.o obj-$(CONFIG_NET_DSA_SMSC_LAN9303) += lan9303-core.o obj-$(CONFIG_NET_DSA_SMSC_LAN9303_I2C) += lan9303_i2c.o obj-$(CONFIG_NET_DSA_SMSC_LAN9303_MDIO) += lan9303_mdio.o
@@ -23,5 +21,6 @@ obj-y += microchip/ obj-y += mv88e6xxx/ obj-y += ocelot/ obj-y += qca/ +obj-y += realtek/ obj-y += sja1105/ obj-y += xrs700x/
drivers/net/dsa/realtek/Kconfig new file +20 -0
@@ -0,0 +1,20 @@ +# SPDX-License-Identifier: GPL-2.0-only +menuconfig NET_DSA_REALTEK + tristate "Realtek Ethernet switch family support" + depends on NET_DSA + select NET_DSA_TAG_RTL4_A + select NET_DSA_TAG_RTL8_4 + select FIXED_PHY + select IRQ_DOMAIN + select REALTEK_PHY + select REGMAP + help + Select to enable support for Realtek Ethernet switch chips. + +config NET_DSA_REALTEK_SMI + tristate "Realtek SMI connected switch driver" + depends on NET_DSA_REALTEK + default y + help + Select to enable support for registering switches connected + through SMI.
drivers/net/dsa/realtek/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 +obj-$(CONFIG_NET_DSA_REALTEK_SMI) += realtek-smi.o +realtek-smi-objs := realtek-smi-core.o rtl8366.o rtl8366rb.o rtl8365mb.o
drivers/net/dsa/realtek/realtek-smi-core.c renamed from drivers/net/dsa/realtek-smi-core.c +0 -0
drivers/net/dsa/realtek/realtek-smi-core.h renamed from drivers/net/dsa/realtek-smi-core.h +0 -0
drivers/net/dsa/realtek/rtl8365mb.c renamed from drivers/net/dsa/rtl8365mb.c +0 -0
drivers/net/dsa/realtek/rtl8366.c renamed from drivers/net/dsa/rtl8366.c +0 -0
drivers/net/dsa/realtek/rtl8366rb.c renamed from drivers/net/dsa/rtl8366rb.c +0 -0
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 543/1017 RDMA/mlx5: Fix the flow of a miss in the allocation of a cache ODP MR
In reply to Greg Kroah-HartmanFrom: Aharon Landau <[email protected]>
[ Upstream commit 2f0e60d5e9f96341a0c8a01be8878cdb3b29ff20 ]
When an ODP MR cache entry is empty and trying to allocate it, increment the ent->miss counter and call to queue_adjust_cache_locked() to verify the entry is balanced.
--- drivers/infiniband/hw/mlx5/mr.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/hw/mlx5/mr.c +2 -0
@@ -585,6 +585,8 @@ struct mlx5_ib_mr *mlx5_mr_cache_alloc(struct mlx5_ib_dev *dev, ent = &cache->ent[entry];spin_lock_irq (&ent->lock);if (list_empty (&ent->head)) { +queue_adjust_cache_locked (ent); + ent->miss++;spin_unlock_irq (&ent->lock); mr =create_cache_mr (ent);if (IS_ERR (mr))
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 544/1017 drm/amd/display: Remove vupdate_int_entry definition
In reply to Greg Kroah-HartmanFrom: Maíra Canal <[email protected]>
[ Upstream commit 3679b8518cd213c25d555553ef212e233faf698c ]
Remove the vupdate_int_entry definition and utilization to avoid the following warning by Clang:
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:410:2:
warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides]
vupdate_no_lock_int_entry(0),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:280:39:
note: expanded from macro 'vupdate_no_lock_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:404:2:
note: previous initialization is here
vupdate_int_entry(0),
^~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:269:39:
note: expanded from macro 'vupdate_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:411:2:
warning: initializer overrides prior initialization of this subobject
[-Winitializer-overrides]
vupdate_no_lock_int_entry(1),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:280:39:
note: expanded from macro 'vupdate_no_lock_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:405:2:
note: previous initialization is here
vupdate_int_entry(1),
^~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:269:39:
note: expanded from macro 'vupdate_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:412:2:
warning: initializer overrides prior initialization of this subobject
[-Winitializer-overrides]
vupdate_no_lock_int_entry(2),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:280:39:
note: expanded from macro 'vupdate_no_lock_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:406:2:
note: previous initialization is here
vupdate_int_entry(2),
^~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:269:39:
note: expanded from macro 'vupdate_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:413:2:
warning: initializer overrides prior initialization of this subobject
[-Winitializer-overrides]
vupdate_no_lock_int_entry(3),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:280:39:
note: expanded from macro 'vupdate_no_lock_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:407:2:
note: previous initialization is here
vupdate_int_entry(3),
^~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:269:39:
note: expanded from macro 'vupdate_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:414:2:
warning: initializer overrides prior initialization of this subobject
[-Winitializer-overrides]
vupdate_no_lock_int_entry(4),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:280:39:
note: expanded from macro 'vupdate_no_lock_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:408:2:
note: previous initialization is here
vupdate_int_entry(4),
^~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:269:39:
note: expanded from macro 'vupdate_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:415:2:
warning: initializer overrides prior initialization of this subobject
[-Winitializer-overrides]
vupdate_no_lock_int_entry(5),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:280:39:
note: expanded from macro 'vupdate_no_lock_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:409:2:
note: previous initialization is here
vupdate_int_entry(5),
^~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/irq/dcn21/irq_service_dcn21.c:269:39:
note: expanded from macro 'vupdate_int_entry'
[DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\
^~6 warnings generated.
--- .../amd/display/dc/irq/dcn21/irq_service_dcn21.c | 14 -------------- 1 file changed, 14 deletions(-)
drivers/gpu/drm/amd/display/dc/irq/dcn21/irq_service_dcn21.c +0 -14
@@ -266,14 +266,6 @@ static const struct irq_source_info_funcs vline0_irq_info_funcs = { .funcs = &pflip_irq_info_funcs\ } -#define vupdate_int_entry (reg_num)\ - [DC_IRQ_SOURCE_VUPDATE1 + reg_num] = {\ - IRQ_REG_ENTRY(OTG, reg_num,\ - OTG_GLOBAL_SYNC_STATUS, VUPDATE_INT_EN,\ - OTG_GLOBAL_SYNC_STATUS, VUPDATE_EVENT_CLEAR),\ - .funcs = &vblank_irq_info_funcs\ - } -/* vupdate_no_lock_int_entry maps to DC_IRQ_SOURCE_VUPDATEx, to match semantic * of DCE's DC_IRQ_SOURCE_VUPDATEx. */
@@ -402,12 +394,6 @@ irq_source_info_dcn21[DAL_IRQ_SOURCES_NUMBER] = { dc_underflow_int_entry(6), [DC_IRQ_SOURCE_DMCU_SCP] = dummy_irq_entry(), [DC_IRQ_SOURCE_VBIOS_SW ] =dummy_irq_entry (), -vupdate_int_entry (0 ), -vupdate_int_entry (1 ), -vupdate_int_entry (2 ), -vupdate_int_entry (3 ), -vupdate_int_entry (4 ), -vupdate_int_entry (5 ),vupdate_no_lock_int_entry (0 ),vupdate_no_lock_int_entry (1 ), vupdate_no_lock_int_entry(2),
Signature · 1 line
2.34.1