6.1.63-rc1 review
Subsystems (7)
Greg Kroah-Hartman
maintainerPATCH 284/379 interconnect: qcom: sm6350: Retire DEFINE_QBCM
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit ab2c1cb5740a7d2240b40b7b494700078db4eb13 ]
The struct definition macros are hard to read and compare, expand them.
Stable-dep-of: fe7a3abf4111 ("interconnect: qcom: sm6350: Set ACV enable_mask")
--- drivers/interconnect/qcom/sm6350.c | 251 ++++++++++++++++++++++++++--- 1 file changed, 226 insertions(+), 25 deletions(-)
drivers/interconnect/qcom/sm6350.c +226 -25
@@ -142,31 +142,232 @@ DEFINE_QNODE(srvc_snoc, SM6350_SLAVE_SERVICE_SNOC, 1, 4);DEFINE_QNODE (xs_qdss_stm,SM6350_SLAVE_QDSS_STM ,1 ,4 );DEFINE_QNODE (xs_sys_tcu_cfg,SM6350_SLAVE_TCU ,1 ,8 ); -DEFINE_QBCM (bcm_acv,"ACV" , false, &ebi); -DEFINE_QBCM (bcm_ce0,"CE0" , false, &qxm_crypto); -DEFINE_QBCM (bcm_cn0,"CN0" , true, &qnm_snoc, &xm_qdss_dap, &qhs_a1_noc_cfg, &qhs_a2_noc_cfg, &qhs_ahb2phy0, &qhs_aoss, &qhs_boot_rom, &qhs_camera_cfg, &qhs_camera_nrt_thrott_cfg, &qhs_camera_rt_throttle_cfg, &qhs_clk_ctl, &qhs_cpr_cx, &qhs_cpr_mx, &qhs_crypto0_cfg, &qhs_dcc_cfg, &qhs_ddrss_cfg, &qhs_display_cfg, &qhs_display_throttle_cfg, &qhs_glm, &qhs_gpuss_cfg, &qhs_imem_cfg, &qhs_ipa, &qhs_mnoc_cfg, &qhs_mss_cfg, &qhs_npu_cfg, &qhs_pimem_cfg, &qhs_prng, &qhs_qdss_cfg, &qhs_qm_cfg, &qhs_qm_mpu_cfg, &qhs_qup0, &qhs_qup1, &qhs_security, &qhs_snoc_cfg, &qhs_tcsr, &qhs_ufs_mem_cfg, &qhs_usb3_0, &qhs_venus_cfg, &qhs_venus_throttle_cfg, &qhs_vsense_ctrl_cfg, &srvc_cnoc); -DEFINE_QBCM (bcm_cn1,"CN1" , false, &xm_emmc, &xm_sdc2, &qhs_ahb2phy2, &qhs_emmc_cfg, &qhs_pdm, &qhs_sdc2); -DEFINE_QBCM (bcm_co0,"CO0" , false, &qns_cdsp_gemnoc); -DEFINE_QBCM (bcm_co2,"CO2" , false, &qnm_npu); -DEFINE_QBCM (bcm_co3,"CO3" , false, &qxm_npu_dsp); -DEFINE_QBCM (bcm_mc0,"MC0" , true, &ebi); -DEFINE_QBCM (bcm_mm0,"MM0" , true, &qns_mem_noc_hf); -DEFINE_QBCM (bcm_mm1,"MM1" , true, &qxm_camnoc_hf0_uncomp, &qxm_camnoc_icp_uncomp, &qxm_camnoc_sf_uncomp, &qxm_camnoc_hf, &qxm_mdp0); -DEFINE_QBCM (bcm_mm2,"MM2" , false, &qns_mem_noc_sf); -DEFINE_QBCM (bcm_mm3,"MM3" , false, &qhm_mnoc_cfg, &qnm_video0, &qnm_video_cvp, &qxm_camnoc_sf); -DEFINE_QBCM (bcm_qup0,"QUP0" , false, &qup0_core_master, &qup1_core_master, &qup0_core_slave, &qup1_core_slave); -DEFINE_QBCM (bcm_sh0,"SH0" , true, &qns_llcc); -DEFINE_QBCM (bcm_sh2,"SH2" , false, &acm_sys_tcu); -DEFINE_QBCM (bcm_sh3,"SH3" , false, &qnm_cmpnoc); -DEFINE_QBCM (bcm_sh4,"SH4" , false, &acm_apps); -DEFINE_QBCM (bcm_sn0,"SN0" , true, &qns_gemnoc_sf); -DEFINE_QBCM (bcm_sn1,"SN1" , false, &qxs_imem); -DEFINE_QBCM (bcm_sn2,"SN2" , false, &qns_gemnoc_gc); -DEFINE_QBCM (bcm_sn3,"SN3" , false, &qxs_pimem); -DEFINE_QBCM (bcm_sn4,"SN4" , false, &xs_qdss_stm); -DEFINE_QBCM (bcm_sn5,"SN5" , false, &qnm_aggre1_noc); -DEFINE_QBCM (bcm_sn6,"SN6" , false, &qnm_aggre2_noc); -DEFINE_QBCM (bcm_sn10,"SN10" , false, &qnm_gemnoc); +static struct qcom_icc_bcm bcm_acv = { + .name ="ACV" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &ebi }, +}; + +static struct qcom_icc_bcm bcm_ce0 = { + .name ="CE0" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qxm_crypto }, +}; + +static struct qcom_icc_bcm bcm_cn0 = { + .name ="CN0" , + .keepalive = true, + .num_nodes =41 , + .nodes = { &qnm_snoc, + &xm_qdss_dap, + &qhs_a1_noc_cfg, + &qhs_a2_noc_cfg, + &qhs_ahb2phy0, + &qhs_aoss, + &qhs_boot_rom, + &qhs_camera_cfg, + &qhs_camera_nrt_thrott_cfg, + &qhs_camera_rt_throttle_cfg, + &qhs_clk_ctl, + &qhs_cpr_cx, + &qhs_cpr_mx, + &qhs_crypto0_cfg, + &qhs_dcc_cfg, + &qhs_ddrss_cfg, + &qhs_display_cfg, + &qhs_display_throttle_cfg, + &qhs_glm, + &qhs_gpuss_cfg, + &qhs_imem_cfg, + &qhs_ipa, + &qhs_mnoc_cfg, + &qhs_mss_cfg, + &qhs_npu_cfg, + &qhs_pimem_cfg, + &qhs_prng, + &qhs_qdss_cfg, + &qhs_qm_cfg, + &qhs_qm_mpu_cfg, + &qhs_qup0, + &qhs_qup1, + &qhs_security, + &qhs_snoc_cfg, + &qhs_tcsr, + &qhs_ufs_mem_cfg, + &qhs_usb3_0, + &qhs_venus_cfg, + &qhs_venus_throttle_cfg, + &qhs_vsense_ctrl_cfg, + &srvc_cnoc + }, +}; + +static struct qcom_icc_bcm bcm_cn1 = { + .name ="CN1" , + .keepalive = false, + .num_nodes =6 , + .nodes = { &xm_emmc, + &xm_sdc2, + &qhs_ahb2phy2, + &qhs_emmc_cfg, + &qhs_pdm, + &qhs_sdc2 + }, +}; + +static struct qcom_icc_bcm bcm_co0 = { + .name ="CO0" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qns_cdsp_gemnoc }, +}; + +static struct qcom_icc_bcm bcm_co2 = { + .name ="CO2" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qnm_npu }, +}; + +static struct qcom_icc_bcm bcm_co3 = { + .name ="CO3" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qxm_npu_dsp }, +}; + +static struct qcom_icc_bcm bcm_mc0 = { + .name ="MC0" , + .keepalive = true, + .num_nodes =1 , + .nodes = { &ebi }, +}; + +static struct qcom_icc_bcm bcm_mm0 = { + .name ="MM0" , + .keepalive = true, + .num_nodes =1 , + .nodes = { &qns_mem_noc_hf }, +}; + +static struct qcom_icc_bcm bcm_mm1 = { + .name ="MM1" , + .keepalive = true, + .num_nodes =5 , + .nodes = { &qxm_camnoc_hf0_uncomp, + &qxm_camnoc_icp_uncomp, + &qxm_camnoc_sf_uncomp, + &qxm_camnoc_hf, + &qxm_mdp0 + }, +}; + +static struct qcom_icc_bcm bcm_mm2 = { + .name ="MM2" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qns_mem_noc_sf }, +}; + +static struct qcom_icc_bcm bcm_mm3 = { + .name ="MM3" , + .keepalive = false, + .num_nodes =4 , + .nodes = { &qhm_mnoc_cfg, &qnm_video0, &qnm_video_cvp, &qxm_camnoc_sf }, +}; + +static struct qcom_icc_bcm bcm_qup0 = { + .name ="QUP0" , + .keepalive = false, + .num_nodes =4 , + .nodes = { &qup0_core_master, &qup1_core_master, &qup0_core_slave, &qup1_core_slave }, +}; + +static struct qcom_icc_bcm bcm_sh0 = { + .name ="SH0" , + .keepalive = true, + .num_nodes =1 , + .nodes = { &qns_llcc }, +}; + +static struct qcom_icc_bcm bcm_sh2 = { + .name ="SH2" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &acm_sys_tcu }, +}; + +static struct qcom_icc_bcm bcm_sh3 = { + .name ="SH3" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qnm_cmpnoc }, +}; + +static struct qcom_icc_bcm bcm_sh4 = { + .name ="SH4" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &acm_apps }, +}; + +static struct qcom_icc_bcm bcm_sn0 = { + .name ="SN0" , + .keepalive = true, + .num_nodes =1 , + .nodes = { &qns_gemnoc_sf }, +}; + +static struct qcom_icc_bcm bcm_sn1 = { + .name ="SN1" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qxs_imem }, +}; + +static struct qcom_icc_bcm bcm_sn2 = { + .name ="SN2" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qns_gemnoc_gc }, +}; + +static struct qcom_icc_bcm bcm_sn3 = { + .name ="SN3" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qxs_pimem }, +}; + +static struct qcom_icc_bcm bcm_sn4 = { + .name ="SN4" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &xs_qdss_stm }, +}; + +static struct qcom_icc_bcm bcm_sn5 = { + .name ="SN5" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qnm_aggre1_noc }, +}; + +static struct qcom_icc_bcm bcm_sn6 = { + .name ="SN6" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qnm_aggre2_noc }, +}; + +static struct qcom_icc_bcm bcm_sn10 = { + .name ="SN10" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qnm_gemnoc }, +};static struct qcom_icc_bcm *const aggre1_noc_bcms[] = { &bcm_cn1,
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 285/379 interconnect: qcom: sm6350: Set ACV enable_mask
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit fe7a3abf4111992af3de51d22383a8e8a0affe1e ]
ACV expects an enable_mask corresponding to the APPS RSC, fill it in.
--- drivers/interconnect/qcom/sm6350.c | 1 + 1 file changed, 1 insertion(+)
drivers/interconnect/qcom/sm6350.c +1 -0
@@ -144,6 +144,7 @@ DEFINE_QNODE(xs_sys_tcu_cfg, SM6350_SLAVE_TCU, 1, 8);static struct qcom_icc_bcm bcm_acv = { .name ="ACV" , + .enable_mask =BIT (3 ), .keepalive = false, .num_nodes =1 , .nodes = { &ebi },
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 286/379 interconnect: move ignore_list out of of_count_icc_providers()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 88387e21d224923eaa0074e3eef699a30f437e62 ]
Move the const ignore_list definition out of the of_count_icc_providers() function. This prevents the following stack frame size warnings if the list is expanded:
drivers/interconnect/core.c:1082:12: warning: stack frame size (1216) exceeds limit (1024) in 'of_count_icc_providers' [-Wframe-larger-than]
Stable-dep-of: 7ed42176406e ("interconnect: qcom: sm8150: Set ACV enable_mask")
--- drivers/interconnect/core.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/interconnect/core.c +6 -5
@@ -1100,15 +1100,16 @@ void icc_provider_del(struct icc_provider *provider) }EXPORT_SYMBOL_GPL (icc_provider_del); +static const struct of_device_id __maybe_unused ignore_list[] = { + { .compatible ="qcom,sc7180-ipa-virt" }, + { .compatible ="qcom,sdx55-ipa-virt" }, + {} +}; +static int of_count_icc_providers (struct device_node *np) {struct device_node *child;int count =0 ; -const struct of_device_id __maybe_unused ignore_list[] = { - { .compatible ="qcom,sc7180-ipa-virt" }, - { .compatible ="qcom,sdx55-ipa-virt" }, - {} - };for_each_available_child_of_node (np, child) { if (of_property_read_bool(child, "#interconnect-cells") &&
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 287/379 interconnect: qcom: sm8150: Drop IP0 interconnects
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit a532439199369b86cf7323f84d1946b7d0634c53 ]
Similar to the sdx55 and sc7180, let's drop the MASTER_IPA_CORE and SLAVE_IPA_CORE interconnects for this platform. There are no actual users of this interconnect. The IP0 resource will be handled by clk-rpmh driver.
Stable-dep-of: 7ed42176406e ("interconnect: qcom: sm8150: Set ACV enable_mask")
--- drivers/interconnect/core.c | 1 + drivers/interconnect/qcom/sm8150.c | 21 --------------------- drivers/interconnect/qcom/sm8150.h | 4 ++-- 3 files changed, 3 insertions(+), 23 deletions(-)
drivers/interconnect/core.c +1 -0
@@ -1103,6 +1103,7 @@ EXPORT_SYMBOL_GPL(icc_provider_del);static const struct of_device_id __maybe_unused ignore_list[] = { { .compatible ="qcom,sc7180-ipa-virt" }, { .compatible ="qcom,sdx55-ipa-virt" }, + { .compatible ="qcom,sm8150-ipa-virt" }, {} };
drivers/interconnect/qcom/sm8150.c +0 -21
@@ -56,7 +56,6 @@ DEFINE_QNODE(qnm_pcie, SM8150_MASTER_GEM_NOC_PCIE_SNOC, 1, 16, SM8150_SLAVE_LLCCDEFINE_QNODE (qnm_snoc_gc,SM8150_MASTER_SNOC_GC_MEM_NOC ,1 ,8 ,SM8150_SLAVE_LLCC );DEFINE_QNODE (qnm_snoc_sf,SM8150_MASTER_SNOC_SF_MEM_NOC ,1 ,16 ,SM8150_SLAVE_LLCC );DEFINE_QNODE (qxm_ecc,SM8150_MASTER_ECC ,2 ,32 ,SM8150_SLAVE_LLCC ); -DEFINE_QNODE (ipa_core_master,SM8150_MASTER_IPA_CORE ,1 ,8 ,SM8150_SLAVE_IPA_CORE );DEFINE_QNODE (llcc_mc,SM8150_MASTER_LLCC ,4 ,4 ,SM8150_SLAVE_EBI_CH0 );DEFINE_QNODE (qhm_mnoc_cfg,SM8150_MASTER_CNOC_MNOC_CFG ,1 ,4 ,SM8150_SLAVE_SERVICE_MNOC );DEFINE_QNODE (qxm_camnoc_hf0,SM8150_MASTER_CAMNOC_HF0 ,1 ,32 ,SM8150_SLAVE_MNOC_HF_MEM_NOC );
@@ -139,7 +138,6 @@ DEFINE_QNODE(qns_ecc, SM8150_SLAVE_ECC, 1, 32);DEFINE_QNODE (qns_gem_noc_snoc,SM8150_SLAVE_GEM_NOC_SNOC ,1 ,8 ,SM8150_MASTER_GEM_NOC_SNOC );DEFINE_QNODE (qns_llcc,SM8150_SLAVE_LLCC ,4 ,16 ,SM8150_MASTER_LLCC );DEFINE_QNODE (srvc_gemnoc,SM8150_SLAVE_SERVICE_GEM_NOC ,1 ,4 ); -DEFINE_QNODE (ipa_core_slave,SM8150_SLAVE_IPA_CORE ,1 ,8 );DEFINE_QNODE (ebi,SM8150_SLAVE_EBI_CH0 ,4 ,4 );DEFINE_QNODE (qns2_mem_noc,SM8150_SLAVE_MNOC_SF_MEM_NOC ,1 ,32 ,SM8150_MASTER_MNOC_SF_MEM_NOC );DEFINE_QNODE (qns_mem_noc_hf,SM8150_SLAVE_MNOC_HF_MEM_NOC ,2 ,32 ,SM8150_MASTER_MNOC_HF_MEM_NOC );
@@ -172,7 +170,6 @@ DEFINE_QBCM(bcm_co0, "CO0", false, &qns_cdsp_mem_noc);DEFINE_QBCM (bcm_ce0,"CE0" , false, &qxm_crypto);DEFINE_QBCM (bcm_sn1,"SN1" , false, &qxs_imem);DEFINE_QBCM (bcm_co1,"CO1" , false, &qnm_npu); -DEFINE_QBCM (bcm_ip0,"IP0" , false, &ipa_core_slave);DEFINE_QBCM (bcm_cn0,"CN0" , true, &qhm_spdm, &qnm_snoc, &qhs_a1_noc_cfg, &qhs_a2_noc_cfg, &qhs_ahb2phy_south, &qhs_aop, &qhs_aoss, &qhs_camera_cfg, &qhs_clk_ctl, &qhs_compute_dsp, &qhs_cpr_cx, &qhs_cpr_mmcx, &qhs_cpr_mx, &qhs_crypto0_cfg, &qhs_ddrss_cfg, &qhs_display_cfg, &qhs_emac_cfg, &qhs_glm, &qhs_gpuss_cfg, &qhs_imem_cfg, &qhs_ipa, &qhs_mnoc_cfg, &qhs_npu_cfg, &qhs_pcie0_cfg, &qhs_pcie1_cfg, &qhs_phy_refgen_north, &qhs_pimem_cfg, &qhs_prng, &qhs_qdss_cfg, &qhs_qspi, &qhs_qupv3_east, &qhs_qupv3_north, &qhs_qupv3_south, &qhs_sdc2, &qhs_sdc4, &qhs_snoc_cfg, &qhs_spdm, &qhs_spss_cfg, &qhs_ssc_cfg, &qhs_tcsr, &qhs_tlmm_east, &qhs_tlmm_north, &qhs_tlmm_south, &qhs_tlmm_west, &qhs_tsif, &qhs_ufs_card_cfg, &qhs_ufs_mem_cfg, &qhs_usb3_0, &qhs_usb3_1, &qhs_venus_cfg, &qhs_vsense_ctrl_cfg, &qns_cnoc_a2noc, &srvc_cnoc);DEFINE_QBCM (bcm_qup0,"QUP0" , false, &qhm_qup0, &qhm_qup1, &qhm_qup2);DEFINE_QBCM (bcm_sn2,"SN2" , false, &qns_gemnoc_gc);
@@ -398,22 +395,6 @@ static const struct qcom_icc_desc sm8150_gem_noc = { .num_bcms = ARRAY_SIZE(gem_noc_bcms), }; -static struct qcom_icc_bcm *const ipa_virt_bcms[] = { - &bcm_ip0, -}; - -static struct qcom_icc_node *const ipa_virt_nodes[] = { - [MASTER_IPA_CORE ] = &ipa_core_master, - [SLAVE_IPA_CORE ] = &ipa_core_slave, -}; - -static const struct qcom_icc_desc sm8150_ipa_virt = { - .nodes = ipa_virt_nodes, - .num_nodes =ARRAY_SIZE (ipa_virt_nodes), - .bcms = ipa_virt_bcms, - .num_bcms =ARRAY_SIZE (ipa_virt_bcms), -}; -static struct qcom_icc_bcm *const mc_virt_bcms[] = { &bcm_acv, &bcm_mc0,
@@ -517,8 +498,6 @@ static const struct of_device_id qnoc_of_match[] = { .data = &sm8150_dc_noc}, { .compatible = "qcom,sm8150-gem-noc", .data = &sm8150_gem_noc}, - { .compatible = "qcom,sm8150-ipa-virt", - .data = &sm8150_ipa_virt}, { .compatible = "qcom,sm8150-mc-virt", .data = &sm8150_mc_virt}, { .compatible = "qcom,sm8150-mmss-noc",
drivers/interconnect/qcom/sm8150.h +2 -2
@@ -35,7 +35,7 @@#define SM8150_MASTER_GPU_TCU 24#define SM8150_MASTER_GRAPHICS_3D 25#define SM8150_MASTER_IPA 26 -#define SM8150_MASTER_IPA_CORE 27 +/* 27 was used by SLAVE_IPA_CORE, now represented as RPMh clock */ #define SM8150_MASTER_LLCC 28#define SM8150_MASTER_MDP_PORT0 29#define SM8150_MASTER_MDP_PORT1 30
@@ -94,7 +94,7 @@#define SM8150_SLAVE_GRAPHICS_3D_CFG 83#define SM8150_SLAVE_IMEM_CFG 84#define SM8150_SLAVE_IPA_CFG 85 -#define SM8150_SLAVE_IPA_CORE 86 +/* 86 was used by SLAVE_IPA_CORE, now represented as RPMh clock */ #define SM8150_SLAVE_LLCC 87#define SM8150_SLAVE_LLCC_CFG 88#define SM8150_SLAVE_MNOC_HF_MEM_NOC 89
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 288/379 interconnect: qcom: sm8150: Retire DEFINE_QBCM
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 670699a4225b8cba6962f965b227e0175d09ecda ]
The struct definition macros are hard to read and compare, expand them.
Stable-dep-of: 7ed42176406e ("interconnect: qcom: sm8150: Set ACV enable_mask")
--- drivers/interconnect/qcom/sm8150.c | 283 ++++++++++++++++++++++++++--- 1 file changed, 255 insertions(+), 28 deletions(-)
drivers/interconnect/qcom/sm8150.c +255 -28
@@ -154,34 +154,261 @@ DEFINE_QNODE(xs_pcie_1, SM8150_SLAVE_PCIE_1, 1, 8);DEFINE_QNODE (xs_qdss_stm,SM8150_SLAVE_QDSS_STM ,1 ,4 );DEFINE_QNODE (xs_sys_tcu_cfg,SM8150_SLAVE_TCU ,1 ,8 ); -DEFINE_QBCM (bcm_acv,"ACV" , false, &ebi); -DEFINE_QBCM (bcm_mc0,"MC0" , true, &ebi); -DEFINE_QBCM (bcm_sh0,"SH0" , true, &qns_llcc); -DEFINE_QBCM (bcm_mm0,"MM0" , true, &qns_mem_noc_hf); -DEFINE_QBCM (bcm_mm1,"MM1" , false, &qxm_camnoc_hf0_uncomp, &qxm_camnoc_hf1_uncomp, &qxm_camnoc_sf_uncomp, &qxm_camnoc_hf0, &qxm_camnoc_hf1, &qxm_mdp0, &qxm_mdp1); -DEFINE_QBCM (bcm_sh2,"SH2" , false, &qns_gem_noc_snoc); -DEFINE_QBCM (bcm_mm2,"MM2" , false, &qxm_camnoc_sf, &qns2_mem_noc); -DEFINE_QBCM (bcm_sh3,"SH3" , false, &acm_gpu_tcu, &acm_sys_tcu); -DEFINE_QBCM (bcm_mm3,"MM3" , false, &qxm_rot, &qxm_venus0, &qxm_venus1, &qxm_venus_arm9); -DEFINE_QBCM (bcm_sh4,"SH4" , false, &qnm_cmpnoc); -DEFINE_QBCM (bcm_sh5,"SH5" , false, &acm_apps); -DEFINE_QBCM (bcm_sn0,"SN0" , true, &qns_gemnoc_sf); -DEFINE_QBCM (bcm_co0,"CO0" , false, &qns_cdsp_mem_noc); -DEFINE_QBCM (bcm_ce0,"CE0" , false, &qxm_crypto); -DEFINE_QBCM (bcm_sn1,"SN1" , false, &qxs_imem); -DEFINE_QBCM (bcm_co1,"CO1" , false, &qnm_npu); -DEFINE_QBCM (bcm_cn0,"CN0" , true, &qhm_spdm, &qnm_snoc, &qhs_a1_noc_cfg, &qhs_a2_noc_cfg, &qhs_ahb2phy_south, &qhs_aop, &qhs_aoss, &qhs_camera_cfg, &qhs_clk_ctl, &qhs_compute_dsp, &qhs_cpr_cx, &qhs_cpr_mmcx, &qhs_cpr_mx, &qhs_crypto0_cfg, &qhs_ddrss_cfg, &qhs_display_cfg, &qhs_emac_cfg, &qhs_glm, &qhs_gpuss_cfg, &qhs_imem_cfg, &qhs_ipa, &qhs_mnoc_cfg, &qhs_npu_cfg, &qhs_pcie0_cfg, &qhs_pcie1_cfg, &qhs_phy_refgen_north, &qhs_pimem_cfg, &qhs_prng, &qhs_qdss_cfg, &qhs_qspi, &qhs_qupv3_east, &qhs_qupv3_north, &qhs_qupv3_south, &qhs_sdc2, &qhs_sdc4, &qhs_snoc_cfg, &qhs_spdm, &qhs_spss_cfg, &qhs_ssc_cfg, &qhs_tcsr, &qhs_tlmm_east, &qhs_tlmm_north, &qhs_tlmm_south, &qhs_tlmm_west, &qhs_tsif, &qhs_ufs_card_cfg, &qhs_ufs_mem_cfg, &qhs_usb3_0, &qhs_usb3_1, &qhs_venus_cfg, &qhs_vsense_ctrl_cfg, &qns_cnoc_a2noc, &srvc_cnoc); -DEFINE_QBCM (bcm_qup0,"QUP0" , false, &qhm_qup0, &qhm_qup1, &qhm_qup2); -DEFINE_QBCM (bcm_sn2,"SN2" , false, &qns_gemnoc_gc); -DEFINE_QBCM (bcm_sn3,"SN3" , false, &srvc_aggre1_noc, &srvc_aggre2_noc, &qns_cnoc); -DEFINE_QBCM (bcm_sn4,"SN4" , false, &qxs_pimem); -DEFINE_QBCM (bcm_sn5,"SN5" , false, &xs_qdss_stm); -DEFINE_QBCM (bcm_sn8,"SN8" , false, &xs_pcie_0, &xs_pcie_1); -DEFINE_QBCM (bcm_sn9,"SN9" , false, &qnm_aggre1_noc); -DEFINE_QBCM (bcm_sn11,"SN11" , false, &qnm_aggre2_noc); -DEFINE_QBCM (bcm_sn12,"SN12" , false, &qxm_pimem, &xm_gic); -DEFINE_QBCM (bcm_sn14,"SN14" , false, &qns_pcie_mem_noc); -DEFINE_QBCM (bcm_sn15,"SN15" , false, &qnm_gemnoc); +static struct qcom_icc_bcm bcm_acv = { + .name ="ACV" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &ebi }, +}; + +static struct qcom_icc_bcm bcm_mc0 = { + .name ="MC0" , + .keepalive = true, + .num_nodes =1 , + .nodes = { &ebi }, +}; + +static struct qcom_icc_bcm bcm_sh0 = { + .name ="SH0" , + .keepalive = true, + .num_nodes =1 , + .nodes = { &qns_llcc }, +}; + +static struct qcom_icc_bcm bcm_mm0 = { + .name ="MM0" , + .keepalive = true, + .num_nodes =1 , + .nodes = { &qns_mem_noc_hf }, +}; + +static struct qcom_icc_bcm bcm_mm1 = { + .name ="MM1" , + .keepalive = false, + .num_nodes =7 , + .nodes = { &qxm_camnoc_hf0_uncomp, + &qxm_camnoc_hf1_uncomp, + &qxm_camnoc_sf_uncomp, + &qxm_camnoc_hf0, + &qxm_camnoc_hf1, + &qxm_mdp0, + &qxm_mdp1 + }, +}; + +static struct qcom_icc_bcm bcm_sh2 = { + .name ="SH2" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qns_gem_noc_snoc }, +}; + +static struct qcom_icc_bcm bcm_mm2 = { + .name ="MM2" , + .keepalive = false, + .num_nodes =2 , + .nodes = { &qxm_camnoc_sf, &qns2_mem_noc }, +}; + +static struct qcom_icc_bcm bcm_sh3 = { + .name ="SH3" , + .keepalive = false, + .num_nodes =2 , + .nodes = { &acm_gpu_tcu, &acm_sys_tcu }, +}; + +static struct qcom_icc_bcm bcm_mm3 = { + .name ="MM3" , + .keepalive = false, + .num_nodes =4 , + .nodes = { &qxm_rot, &qxm_venus0, &qxm_venus1, &qxm_venus_arm9 }, +}; + +static struct qcom_icc_bcm bcm_sh4 = { + .name ="SH4" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qnm_cmpnoc }, +}; + +static struct qcom_icc_bcm bcm_sh5 = { + .name ="SH5" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &acm_apps }, +}; + +static struct qcom_icc_bcm bcm_sn0 = { + .name ="SN0" , + .keepalive = true, + .num_nodes =1 , + .nodes = { &qns_gemnoc_sf }, +}; + +static struct qcom_icc_bcm bcm_co0 = { + .name ="CO0" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qns_cdsp_mem_noc }, +}; + +static struct qcom_icc_bcm bcm_ce0 = { + .name ="CE0" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qxm_crypto }, +}; + +static struct qcom_icc_bcm bcm_sn1 = { + .name ="SN1" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qxs_imem }, +}; + +static struct qcom_icc_bcm bcm_co1 = { + .name ="CO1" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qnm_npu }, +}; + +static struct qcom_icc_bcm bcm_cn0 = { + .name ="CN0" , + .keepalive = true, + .num_nodes =53 , + .nodes = { &qhm_spdm, + &qnm_snoc, + &qhs_a1_noc_cfg, + &qhs_a2_noc_cfg, + &qhs_ahb2phy_south, + &qhs_aop, + &qhs_aoss, + &qhs_camera_cfg, + &qhs_clk_ctl, + &qhs_compute_dsp, + &qhs_cpr_cx, + &qhs_cpr_mmcx, + &qhs_cpr_mx, + &qhs_crypto0_cfg, + &qhs_ddrss_cfg, + &qhs_display_cfg, + &qhs_emac_cfg, + &qhs_glm, + &qhs_gpuss_cfg, + &qhs_imem_cfg, + &qhs_ipa, + &qhs_mnoc_cfg, + &qhs_npu_cfg, + &qhs_pcie0_cfg, + &qhs_pcie1_cfg, + &qhs_phy_refgen_north, + &qhs_pimem_cfg, + &qhs_prng, + &qhs_qdss_cfg, + &qhs_qspi, + &qhs_qupv3_east, + &qhs_qupv3_north, + &qhs_qupv3_south, + &qhs_sdc2, + &qhs_sdc4, + &qhs_snoc_cfg, + &qhs_spdm, + &qhs_spss_cfg, + &qhs_ssc_cfg, + &qhs_tcsr, + &qhs_tlmm_east, + &qhs_tlmm_north, + &qhs_tlmm_south, + &qhs_tlmm_west, + &qhs_tsif, + &qhs_ufs_card_cfg, + &qhs_ufs_mem_cfg, + &qhs_usb3_0, + &qhs_usb3_1, + &qhs_venus_cfg, + &qhs_vsense_ctrl_cfg, + &qns_cnoc_a2noc, + &srvc_cnoc + }, +}; + +static struct qcom_icc_bcm bcm_qup0 = { + .name ="QUP0" , + .keepalive = false, + .num_nodes =3 , + .nodes = { &qhm_qup0, &qhm_qup1, &qhm_qup2 }, +}; + +static struct qcom_icc_bcm bcm_sn2 = { + .name ="SN2" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qns_gemnoc_gc }, +}; + +static struct qcom_icc_bcm bcm_sn3 = { + .name ="SN3" , + .keepalive = false, + .num_nodes =3 , + .nodes = { &srvc_aggre1_noc, &srvc_aggre2_noc, &qns_cnoc }, +}; + +static struct qcom_icc_bcm bcm_sn4 = { + .name ="SN4" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qxs_pimem }, +}; + +static struct qcom_icc_bcm bcm_sn5 = { + .name ="SN5" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &xs_qdss_stm }, +}; + +static struct qcom_icc_bcm bcm_sn8 = { + .name ="SN8" , + .keepalive = false, + .num_nodes =2 , + .nodes = { &xs_pcie_0, &xs_pcie_1 }, +}; + +static struct qcom_icc_bcm bcm_sn9 = { + .name ="SN9" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qnm_aggre1_noc }, +}; + +static struct qcom_icc_bcm bcm_sn11 = { + .name ="SN11" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qnm_aggre2_noc }, +}; + +static struct qcom_icc_bcm bcm_sn12 = { + .name ="SN12" , + .keepalive = false, + .num_nodes =2 , + .nodes = { &qxm_pimem, &xm_gic }, +}; + +static struct qcom_icc_bcm bcm_sn14 = { + .name ="SN14" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qns_pcie_mem_noc }, +}; + +static struct qcom_icc_bcm bcm_sn15 = { + .name ="SN15" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qnm_gemnoc }, +};static struct qcom_icc_bcm *const aggre1_noc_bcms[] = { &bcm_qup0,
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 289/379 interconnect: qcom: sm8150: Set ACV enable_mask
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 7ed42176406e5a2c9a5767d0d75690c7d1588027 ]
ACV expects an enable_mask corresponding to the APPS RSC, fill it in.
--- drivers/interconnect/qcom/sm8150.c | 1 + 1 file changed, 1 insertion(+)
drivers/interconnect/qcom/sm8150.c +1 -0
@@ -156,6 +156,7 @@ DEFINE_QNODE(xs_sys_tcu_cfg, SM8150_SLAVE_TCU, 1, 8);static struct qcom_icc_bcm bcm_acv = { .name ="ACV" , + .enable_mask =BIT (3 ), .keepalive = false, .num_nodes =1 , .nodes = { &ebi },
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 290/379 interconnect: qcom: sm8350: Retire DEFINE_QBCM
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit edd13c04ff0d90ed152902a88f01f466c77a0cf9 ]
The struct definition macros are hard to read and compare, expand them.
Stable-dep-of: df1b8356a80a ("interconnect: qcom: sm8350: Set ACV enable_mask")
--- drivers/interconnect/qcom/sm8350.c | 308 ++++++++++++++++++++++++++--- 1 file changed, 276 insertions(+), 32 deletions(-)
drivers/interconnect/qcom/sm8350.c +276 -32
@@ -165,38 +165,282 @@ DEFINE_QNODE(ebi_disp, SM8350_SLAVE_EBI1_DISP, 4, 4);DEFINE_QNODE (qns_mem_noc_hf_disp,SM8350_SLAVE_MNOC_HF_MEM_NOC_DISP ,2 ,32 ,SM8350_MASTER_MNOC_HF_MEM_NOC_DISP );DEFINE_QNODE (qns_mem_noc_sf_disp,SM8350_SLAVE_MNOC_SF_MEM_NOC_DISP ,2 ,32 ,SM8350_MASTER_MNOC_SF_MEM_NOC_DISP ); -DEFINE_QBCM (bcm_acv,"ACV" , false, &ebi); -DEFINE_QBCM (bcm_ce0,"CE0" , false, &qxm_crypto); -DEFINE_QBCM (bcm_cn0,"CN0" , true, &qnm_gemnoc_cnoc, &qnm_gemnoc_pcie); -DEFINE_QBCM (bcm_cn1,"CN1" , false, &xm_qdss_dap, &qhs_ahb2phy0, &qhs_ahb2phy1, &qhs_aoss, &qhs_apss, &qhs_camera_cfg, &qhs_clk_ctl, &qhs_compute_cfg, &qhs_cpr_cx, &qhs_cpr_mmcx, &qhs_cpr_mx, &qhs_crypto0_cfg, &qhs_cx_rdpm, &qhs_dcc_cfg, &qhs_display_cfg, &qhs_gpuss_cfg, &qhs_hwkm, &qhs_imem_cfg, &qhs_ipa, &qhs_ipc_router, &qhs_mss_cfg, &qhs_mx_rdpm, &qhs_pcie0_cfg, &qhs_pcie1_cfg, &qhs_pimem_cfg, &qhs_pka_wrapper_cfg, &qhs_pmu_wrapper_cfg, &qhs_qdss_cfg, &qhs_qup0, &qhs_qup1, &qhs_qup2, &qhs_security, &qhs_spss_cfg, &qhs_tcsr, &qhs_tlmm, &qhs_ufs_card_cfg, &qhs_ufs_mem_cfg, &qhs_usb3_0, &qhs_usb3_1, &qhs_venus_cfg, &qhs_vsense_ctrl_cfg, &qns_a1_noc_cfg, &qns_a2_noc_cfg, &qns_ddrss_cfg, &qns_mnoc_cfg, &qns_snoc_cfg, &srvc_cnoc); -DEFINE_QBCM (bcm_cn2,"CN2" , false, &qhs_lpass_cfg, &qhs_pdm, &qhs_qspi, &qhs_sdc2, &qhs_sdc4); -DEFINE_QBCM (bcm_co0,"CO0" , false, &qns_nsp_gemnoc); -DEFINE_QBCM (bcm_co3,"CO3" , false, &qxm_nsp); -DEFINE_QBCM (bcm_mc0,"MC0" , true, &ebi); -DEFINE_QBCM (bcm_mm0,"MM0" , true, &qns_mem_noc_hf); -DEFINE_QBCM (bcm_mm1,"MM1" , false, &qnm_camnoc_hf, &qxm_mdp0, &qxm_mdp1); -DEFINE_QBCM (bcm_mm4,"MM4" , false, &qns_mem_noc_sf); -DEFINE_QBCM (bcm_mm5,"MM5" , false, &qnm_camnoc_icp, &qnm_camnoc_sf, &qnm_video0, &qnm_video1, &qnm_video_cvp, &qxm_rot); -DEFINE_QBCM (bcm_sh0,"SH0" , true, &qns_llcc); -DEFINE_QBCM (bcm_sh2,"SH2" , false, &alm_gpu_tcu, &alm_sys_tcu); -DEFINE_QBCM (bcm_sh3,"SH3" , false, &qnm_cmpnoc); -DEFINE_QBCM (bcm_sh4,"SH4" , false, &chm_apps); -DEFINE_QBCM (bcm_sn0,"SN0" , true, &qns_gemnoc_sf); -DEFINE_QBCM (bcm_sn2,"SN2" , false, &qns_gemnoc_gc); -DEFINE_QBCM (bcm_sn3,"SN3" , false, &qxs_pimem); -DEFINE_QBCM (bcm_sn4,"SN4" , false, &xs_qdss_stm); -DEFINE_QBCM (bcm_sn5,"SN5" , false, &xm_pcie3_0); -DEFINE_QBCM (bcm_sn6,"SN6" , false, &xm_pcie3_1); -DEFINE_QBCM (bcm_sn7,"SN7" , false, &qnm_aggre1_noc); -DEFINE_QBCM (bcm_sn8,"SN8" , false, &qnm_aggre2_noc); -DEFINE_QBCM (bcm_sn14,"SN14" , false, &qns_pcie_mem_noc); -DEFINE_QBCM (bcm_acv_disp,"ACV" , false, &ebi_disp); -DEFINE_QBCM (bcm_mc0_disp,"MC0" , false, &ebi_disp); -DEFINE_QBCM (bcm_mm0_disp,"MM0" , false, &qns_mem_noc_hf_disp); -DEFINE_QBCM (bcm_mm1_disp,"MM1" , false, &qxm_mdp0_disp, &qxm_mdp1_disp); -DEFINE_QBCM (bcm_mm4_disp,"MM4" , false, &qns_mem_noc_sf_disp); -DEFINE_QBCM (bcm_mm5_disp,"MM5" , false, &qxm_rot_disp); -DEFINE_QBCM (bcm_sh0_disp,"SH0" , false, &qns_llcc_disp); +static struct qcom_icc_bcm bcm_acv = { + .name ="ACV" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &ebi }, +}; + +static struct qcom_icc_bcm bcm_ce0 = { + .name ="CE0" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qxm_crypto }, +}; + +static struct qcom_icc_bcm bcm_cn0 = { + .name ="CN0" , + .keepalive = true, + .num_nodes =2 , + .nodes = { &qnm_gemnoc_cnoc, &qnm_gemnoc_pcie }, +}; + +static struct qcom_icc_bcm bcm_cn1 = { + .name ="CN1" , + .keepalive = false, + .num_nodes =47 , + .nodes = { &xm_qdss_dap, + &qhs_ahb2phy0, + &qhs_ahb2phy1, + &qhs_aoss, + &qhs_apss, + &qhs_camera_cfg, + &qhs_clk_ctl, + &qhs_compute_cfg, + &qhs_cpr_cx, + &qhs_cpr_mmcx, + &qhs_cpr_mx, + &qhs_crypto0_cfg, + &qhs_cx_rdpm, + &qhs_dcc_cfg, + &qhs_display_cfg, + &qhs_gpuss_cfg, + &qhs_hwkm, + &qhs_imem_cfg, + &qhs_ipa, + &qhs_ipc_router, + &qhs_mss_cfg, + &qhs_mx_rdpm, + &qhs_pcie0_cfg, + &qhs_pcie1_cfg, + &qhs_pimem_cfg, + &qhs_pka_wrapper_cfg, + &qhs_pmu_wrapper_cfg, + &qhs_qdss_cfg, + &qhs_qup0, + &qhs_qup1, + &qhs_qup2, + &qhs_security, + &qhs_spss_cfg, + &qhs_tcsr, + &qhs_tlmm, + &qhs_ufs_card_cfg, + &qhs_ufs_mem_cfg, + &qhs_usb3_0, + &qhs_usb3_1, + &qhs_venus_cfg, + &qhs_vsense_ctrl_cfg, + &qns_a1_noc_cfg, + &qns_a2_noc_cfg, + &qns_ddrss_cfg, + &qns_mnoc_cfg, + &qns_snoc_cfg, + &srvc_cnoc + }, +}; + +static struct qcom_icc_bcm bcm_cn2 = { + .name ="CN2" , + .keepalive = false, + .num_nodes =5 , + .nodes = { &qhs_lpass_cfg, &qhs_pdm, &qhs_qspi, &qhs_sdc2, &qhs_sdc4 }, +}; + +static struct qcom_icc_bcm bcm_co0 = { + .name ="CO0" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qns_nsp_gemnoc }, +}; + +static struct qcom_icc_bcm bcm_co3 = { + .name ="CO3" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qxm_nsp }, +}; + +static struct qcom_icc_bcm bcm_mc0 = { + .name ="MC0" , + .keepalive = true, + .num_nodes =1 , + .nodes = { &ebi }, +}; + +static struct qcom_icc_bcm bcm_mm0 = { + .name ="MM0" , + .keepalive = true, + .num_nodes =1 , + .nodes = { &qns_mem_noc_hf }, +}; + +static struct qcom_icc_bcm bcm_mm1 = { + .name ="MM1" , + .keepalive = false, + .num_nodes =3 , + .nodes = { &qnm_camnoc_hf, &qxm_mdp0, &qxm_mdp1 }, +}; + +static struct qcom_icc_bcm bcm_mm4 = { + .name ="MM4" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qns_mem_noc_sf }, +}; + +static struct qcom_icc_bcm bcm_mm5 = { + .name ="MM5" , + .keepalive = false, + .num_nodes =6 , + .nodes = { &qnm_camnoc_icp, + &qnm_camnoc_sf, + &qnm_video0, + &qnm_video1, + &qnm_video_cvp, + &qxm_rot + }, +}; + +static struct qcom_icc_bcm bcm_sh0 = { + .name ="SH0" , + .keepalive = true, + .num_nodes =1 , + .nodes = { &qns_llcc }, +}; + +static struct qcom_icc_bcm bcm_sh2 = { + .name ="SH2" , + .keepalive = false, + .num_nodes =2 , + .nodes = { &alm_gpu_tcu, &alm_sys_tcu }, +}; + +static struct qcom_icc_bcm bcm_sh3 = { + .name ="SH3" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qnm_cmpnoc }, +}; + +static struct qcom_icc_bcm bcm_sh4 = { + .name ="SH4" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &chm_apps }, +}; + +static struct qcom_icc_bcm bcm_sn0 = { + .name ="SN0" , + .keepalive = true, + .num_nodes =1 , + .nodes = { &qns_gemnoc_sf }, +}; + +static struct qcom_icc_bcm bcm_sn2 = { + .name ="SN2" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qns_gemnoc_gc }, +}; + +static struct qcom_icc_bcm bcm_sn3 = { + .name ="SN3" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qxs_pimem }, +}; + +static struct qcom_icc_bcm bcm_sn4 = { + .name ="SN4" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &xs_qdss_stm }, +}; + +static struct qcom_icc_bcm bcm_sn5 = { + .name ="SN5" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &xm_pcie3_0 }, +}; + +static struct qcom_icc_bcm bcm_sn6 = { + .name ="SN6" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &xm_pcie3_1 }, +}; + +static struct qcom_icc_bcm bcm_sn7 = { + .name ="SN7" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qnm_aggre1_noc }, +}; + +static struct qcom_icc_bcm bcm_sn8 = { + .name ="SN8" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qnm_aggre2_noc }, +}; + +static struct qcom_icc_bcm bcm_sn14 = { + .name ="SN14" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qns_pcie_mem_noc }, +}; + +static struct qcom_icc_bcm bcm_acv_disp = { + .name ="ACV" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &ebi_disp }, +}; + +static struct qcom_icc_bcm bcm_mc0_disp = { + .name ="MC0" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &ebi_disp }, +}; + +static struct qcom_icc_bcm bcm_mm0_disp = { + .name ="MM0" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qns_mem_noc_hf_disp }, +}; + +static struct qcom_icc_bcm bcm_mm1_disp = { + .name ="MM1" , + .keepalive = false, + .num_nodes =2 , + .nodes = { &qxm_mdp0_disp, &qxm_mdp1_disp }, +}; + +static struct qcom_icc_bcm bcm_mm4_disp = { + .name ="MM4" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qns_mem_noc_sf_disp }, +}; + +static struct qcom_icc_bcm bcm_mm5_disp = { + .name ="MM5" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qxm_rot_disp }, +}; + +static struct qcom_icc_bcm bcm_sh0_disp = { + .name ="SH0" , + .keepalive = false, + .num_nodes =1 , + .nodes = { &qns_llcc_disp }, +};static struct qcom_icc_bcm *const aggre1_noc_bcms[] = { };
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 291/379 interconnect: qcom: sm8350: Set ACV enable_mask
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit df1b8356a80ab47a7623e08facf36fe434ea9722 ]
ACV expects an enable_mask corresponding to the APPS RSC, fill it in.
--- drivers/interconnect/qcom/sm8350.c | 1 + 1 file changed, 1 insertion(+)
drivers/interconnect/qcom/sm8350.c +1 -0
@@ -167,6 +167,7 @@ DEFINE_QNODE(qns_mem_noc_sf_disp, SM8350_SLAVE_MNOC_SF_MEM_NOC_DISP, 2, 32, SM83static struct qcom_icc_bcm bcm_acv = { .name ="ACV" , + .enable_mask =BIT (3 ), .keepalive = false, .num_nodes =1 , .nodes = { &ebi },
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 292/379 powerpc: Only define __parse_fpscr() when required
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Leroy <[email protected]>
[ Upstream commit c7e0d9bb9154c6e6b2ac8746faba27b53393f25e ]
Clang 17 reports:
arch/powerpc/kernel/traps.c:1167:19: error: unused function '__parse_fpscr' [-Werror,-Wunused-function]
__parse_fpscr() is called from two sites. First call is guarded by #ifdef CONFIG_PPC_FPU_REGS
Second call is guarded by CONFIG_MATH_EMULATION which selects CONFIG_PPC_FPU_REGS.
So only define __parse_fpscr() when CONFIG_PPC_FPU_REGS is defined.
--- arch/powerpc/kernel/traps.c | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/kernel/traps.c +2 -0
@@ -1164,6 +1164,7 @@ static void emulate_single_step(struct pt_regs *regs)__single_step_exception (regs); } +#ifdef CONFIG_PPC_FPU_REGS static inline int __parse_fpscr (unsigned long fpscr) {int ret =FPE_FLTUNK ;
@@ -1190,6 +1191,7 @@ static inline int __parse_fpscr(unsigned long fpscr) return ret; } +#endif static void parse_fpe (struct pt_regs *regs) {
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 293/379 modpost: fix tee MODULE_DEVICE_TABLE built on big-endian host
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
[ Upstream commit 7f54e00e5842663c2cea501bbbdfa572c94348a3 ]
When MODULE_DEVICE_TABLE(tee, ) is built on a host with a different endianness from the target architecture, it results in an incorrect MODULE_ALIAS().
For example, see a case where drivers/char/hw_random/optee-rng.c is built as a module for ARM little-endian.
If you build it on a little-endian host, you will get the correct MODULE_ALIAS:
$ grep MODULE_ALIAS drivers/char/hw_random/optee-rng.mod.c
MODULE_ALIAS("tee:ab7a617c-b8e7-4d8f-8301-d09b61036b64*");However, if you build it on a big-endian host, you will get a wrong MODULE_ALIAS:
$ grep MODULE_ALIAS drivers/char/hw_random/optee-rng.mod.c
MODULE_ALIAS("tee:646b0361-9bd0-0183-8f4d-e7b87c617aab*");The same problem also occurs when you enable CONFIG_CPU_BIG_ENDIAN, and build it on a little-endian host.
This issue has been unnoticed because the ARM kernel is configured for little-endian by default, and most likely built on a little-endian host (cross-build on x86 or native-build on ARM).
The uuid field must not be reversed because uuid_t is an array of __u8.
--- scripts/mod/file2alias.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
scripts/mod/file2alias.c +5 -5
@@ -1348,13 +1348,13 @@ static int do_typec_entry(const char *filename, void *symval, char *alias)/* Looks like: tee:uuid */ static int do_tee_entry (const char *filename,void *symval,char *alias) { -DEF_FIELD (symval, tee_client_device_id, uuid); +DEF_FIELD_ADDR (symval, tee_client_device_id, uuid);sprintf (alias,"tee:%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x" , - uuid.b[0 ], uuid.b[1 ], uuid.b[2 ], uuid.b[3 ], uuid.b[4 ], - uuid.b[5 ], uuid.b[6 ], uuid.b[7 ], uuid.b[8 ], uuid.b[9 ], - uuid.b[10 ], uuid.b[11 ], uuid.b[12 ], uuid.b[13 ], uuid.b[14 ], - uuid.b[15 ]); + uuid->b[0 ], uuid->b[1 ], uuid->b[2 ], uuid->b[3 ], uuid->b[4 ], + uuid->b[5 ], uuid->b[6 ], uuid->b[7 ], uuid->b[8 ], uuid->b[9 ], + uuid->b[10 ], uuid->b[11 ], uuid->b[12 ], uuid->b[13 ], uuid->b[14 ], + uuid->b[15 ]);add_wildcard (alias);return 1 ;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 294/379 modpost: fix ishtp MODULE_DEVICE_TABLE built on big-endian host
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masahiro Yamada <[email protected]>
[ Upstream commit ac96a15a0f0c8812a3aaa587b871cd5527f6d736 ]
When MODULE_DEVICE_TABLE(ishtp, ) is built on a host with a different endianness from the target architecture, it results in an incorrect MODULE_ALIAS().
For example, see a case where drivers/platform/x86/intel/ishtp_eclite.c is built as a module for x86.
If you build it on a little-endian host, you will get the correct MODULE_ALIAS:
$ grep MODULE_ALIAS drivers/platform/x86/intel/ishtp_eclite.mod.c
MODULE_ALIAS("ishtp:{6A19CC4B-D760-4DE3-B14D-F25EBD0FBCD9}");However, if you build it on a big-endian host, you will get a wrong MODULE_ALIAS:
$ grep MODULE_ALIAS drivers/platform/x86/intel/ishtp_eclite.mod.c
MODULE_ALIAS("ishtp:{BD0FBCD9-F25E-B14D-4DE3-D7606A19CC4B}");This issue has been unnoticed because the x86 kernel is most likely built natively on an x86 host.
The guid field must not be reversed because guid_t is an array of __u8.
--- scripts/mod/file2alias.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/mod/file2alias.c +2 -2
@@ -1401,10 +1401,10 @@ static int do_mhi_ep_entry(const char *filename, void *symval, char *alias)/* Looks like: ishtp:{guid} */ static int do_ishtp_entry (const char *filename,void *symval,char *alias) { -DEF_FIELD (symval, ishtp_device_id, guid); +DEF_FIELD_ADDR (symval, ishtp_device_id, guid);strcpy (alias,ISHTP_MODULE_PREFIX "{" ); -add_guid (alias, guid); +add_guid (alias, *guid);strcat (alias,"}" );return 1 ;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 295/379 powerpc/40x: Remove stale PTE_ATOMIC_UPDATES macro
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Leroy <[email protected]>
[ Upstream commit cc8ee288f484a2a59c01ccd4d8a417d6ed3466e3 ]
40x TLB handlers were reworked by commit 2c74e2586bb9 ("powerpc/40x:
Rework 40x PTE access and TLB miss") to not require PTE_ATOMIC_UPDATES anymore.
Then commit 4e1df545e2fa ("powerpc/pgtable: Drop PTE_ATOMIC_UPDATES") removed all code related to PTE_ATOMIC_UPDATES.
Remove left over PTE_ATOMIC_UPDATES macro.
--- arch/powerpc/include/asm/nohash/32/pte-40x.h | 3 --- 1 file changed, 3 deletions(-)
arch/powerpc/include/asm/nohash/32/pte-40x.h +0 -3
@@ -69,9 +69,6 @@#define _PTE_NONE_MASK 0 -/* Until my rework is finished, 40x still needs atomic PTE updates */ -#define PTE_ATOMIC_UPDATES 1 -#define _PAGE_BASE_NC (_PAGE_PRESENT | _PAGE_ACCESSED)#define _PAGE_BASE (_PAGE_BASE_NC)
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 296/379 powerpc/xive: Fix endian conversion size
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Gray <[email protected]>
[ Upstream commit ff7a60ab1e065257a0e467c13b519f4debcd7fcf ]
Sparse reports a size mismatch in the endian swap. The Opal implementation[1] passes the value as a __be64, and the receiving variable out_qsize is a u64, so the use of be32_to_cpu() appears to be an error.
[1]: https://github.com/open-power/skiboot/blob/80e2b1dc73/hw/xive.c#L3854
--- arch/powerpc/sysdev/xive/native.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/sysdev/xive/native.c +1 -1
@@ -804,7 +804,7 @@ int xive_native_get_queue_info(u32 vp_id, u32 prio,if (out_qpage) *out_qpage =be64_to_cpu (qpage);if (out_qsize) - *out_qsize =be32_to_cpu (qsize); + *out_qsize =be64_to_cpu (qsize);if (out_qeoi_page) *out_qeoi_page =be64_to_cpu (qeoi_page);if (out_escalate_irq)
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 297/379 powerpc/vas: Limit open window failure messages in log bufffer
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haren Myneni <[email protected]>
[ Upstream commit 73b25505ce043b561028e5571d84dc82aa53c2b4 ]
The VAS open window call prints error message and returns -EBUSY after the migration suspend event initiated and until the resume event completed on the destination system. It can cause the log buffer filled with these error messages if the user space issues continuous open window calls. Similar case even for DLPAR CPU remove event when no credits are available until the credits are freed or with the other DLPAR CPU add event.
So changes in the patch to use pr_err_ratelimited() instead of pr_err() to display open window failure and not-available credits error messages.
Use pr_fmt() and make the corresponding changes to have the consistencein prefix all pr_*() messages (vas-api.c).
--- arch/powerpc/platforms/book3s/vas-api.c | 34 ++++++++++++------------- arch/powerpc/platforms/pseries/vas.c | 4 +-- 2 files changed, 18 insertions(+), 20 deletions(-)
arch/powerpc/platforms/book3s/vas-api.c +16 -18
@@ -4,6 +4,8 @@* Copyright (C) 2019 Haren Myneni, IBM Corp */ +#define pr_fmt (fmt) "vas-api: " fmt +#include <linux/kernel.h> #include <linux/device.h> #include <linux/cdev.h>
@@ -78,7 +80,7 @@ int get_vas_user_win_ref(struct vas_user_win_ref *task_ref) task_ref->mm =get_task_mm (current);if (!task_ref->mm) {put_pid (task_ref->pid); -pr_err ("VAS: pid(%d): mm_struct is not found\n" , +pr_err ("pid(%d): mm_struct is not found\n" , current->pid);return -EPERM ; }
@@ -235,8 +237,7 @@ void vas_update_csb(struct coprocessor_request_block *crb, rc =kill_pid_info (SIGSEGV , &info, pid);rcu_read_unlock (); -pr_devel ("%s(): pid %d kill_proc_info() rc %d\n" , __func__, -pid_vnr (pid), rc); +pr_devel ("pid %d kill_proc_info() rc %d\n" ,pid_vnr (pid), rc); }void vas_dump_crb (struct coprocessor_request_block *crb)
@@ -294,7 +295,7 @@ static int coproc_ioc_tx_win_open(struct file *fp, unsigned long arg) rc =copy_from_user (&uattr, uptr,sizeof (uattr));if (rc) { -pr_err ("%s(): copy_from_user() returns %d\n" , __func__, rc); +pr_err ("copy_from_user() returns %d\n" , rc);return -EFAULT ; }
@@ -311,7 +312,7 @@ static int coproc_ioc_tx_win_open(struct file *fp, unsigned long arg) txwin = cp_inst->coproc->vops->open_win (uattr.vas_id, uattr.flags, cp_inst->coproc->cop_type);if (IS_ERR (txwin)) { -pr_err ("%s() VAS window open failed, %ld\n" , __func__, +pr_err_ratelimited ("VAS window open failed rc=%ld\n" ,PTR_ERR (txwin));return PTR_ERR (txwin); }
@@ -405,8 +406,7 @@ static vm_fault_t vas_mmap_fault(struct vm_fault *vmf)* window is not opened. Shouldn't expect this error. */ if (!cp_inst || !cp_inst->txwin) { -pr_err ("%s(): Unexpected fault on paste address with TX window closed\n" , - __func__); +pr_err ("Unexpected fault on paste address with TX window closed\n" );return VM_FAULT_SIGBUS ; }
@@ -421,8 +421,7 @@ static vm_fault_t vas_mmap_fault(struct vm_fault *vmf)* issue NX request. */ if (txwin->task_ref.vma != vmf->vma) { -pr_err ("%s(): No previous mapping with paste address\n" , - __func__); +pr_err ("No previous mapping with paste address\n" );return VM_FAULT_SIGBUS ; }
@@ -481,19 +480,19 @@ static int coproc_mmap(struct file *fp, struct vm_area_struct *vma) txwin = cp_inst->txwin;if ((vma->vm_end - vma->vm_start) >PAGE_SIZE ) { -pr_debug ("%s(): size 0x%zx, PAGE_SIZE 0x%zx\n" , __func__, +pr_debug ("size 0x%zx, PAGE_SIZE 0x%zx\n" , (vma->vm_end - vma->vm_start),PAGE_SIZE );return -EINVAL ; }/* Ensure instance has an open send window */ if (!txwin) { -pr_err ("%s(): No send window open?\n" , __func__); +pr_err ("No send window open?\n" );return -EINVAL ; }if (!cp_inst->coproc->vops || !cp_inst->coproc->vops->paste_addr) { -pr_err ("%s(): VAS API is not registered\n" , __func__); +pr_err ("VAS API is not registered\n" );return -EACCES ; }
@@ -510,14 +509,14 @@ static int coproc_mmap(struct file *fp, struct vm_area_struct *vma)*/ mutex_lock (&txwin->task_ref.mmap_mutex);if (txwin->status !=VAS_WIN_ACTIVE ) { -pr_err ("%s(): Window is not active\n" , __func__); +pr_err ("Window is not active\n" ); rc = -EACCES ; goto out; } paste_addr = cp_inst->coproc->vops->paste_addr (txwin);if (!paste_addr) { -pr_err ("%s(): Window paste address failed\n" , __func__); +pr_err ("Window paste address failed\n" ); rc = -EINVAL ; goto out; }
@@ -533,8 +532,8 @@ static int coproc_mmap(struct file *fp, struct vm_area_struct *vma) rc =remap_pfn_range (vma, vma->vm_start, pfn + vma->vm_pgoff, vma->vm_end - vma->vm_start, prot); -pr_devel ("%s(): paste addr %llx at %lx, rc %d\n" , __func__, - paste_addr, vma->vm_start, rc); +pr_devel ("paste addr %llx at %lx, rc %d\n" , paste_addr, + vma->vm_start, rc); txwin->task_ref.vma = vma; vma->vm_ops = &vas_vm_ops;
@@ -609,8 +608,7 @@ int vas_register_coproc_api(struct module *mod, enum vas_cop_type cop_type, goto err; } -pr_devel ("%s: Added dev [%d,%d]\n" , __func__,MAJOR (devno), -MINOR (devno)); +pr_devel ("Added dev [%d,%d]\n" ,MAJOR (devno),MINOR (devno));return 0 ;
arch/powerpc/platforms/pseries/vas.c +2 -2
@@ -340,7 +340,7 @@ static struct vas_window *vas_allocate_window(int vas_id, u64 flags,if (atomic_inc_return (&cop_feat_caps->nr_used_credits) >atomic_read (&cop_feat_caps->nr_total_credits)) { -pr_err ("Credits are not available to allocate window\n" ); +pr_err_ratelimited ("Credits are not available to allocate window\n" ); rc = -EINVAL ; goto out; }
@@ -423,7 +423,7 @@ static struct vas_window *vas_allocate_window(int vas_id, u64 flags,put_vas_user_win_ref (&txwin->vas_win.task_ref); rc = -EBUSY ; -pr_err ("No credit is available to allocate window\n" ); +pr_err_ratelimited ("No credit is available to allocate window\n" ); out_free:/*
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 298/379 powerpc/imc-pmu: Use the correct spinlock initializer.
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
[ Upstream commit 007240d59c11f87ac4f6cfc6a1d116630b6b634c ]
The macro __SPIN_LOCK_INITIALIZER() is implementation specific. Users that desire to initialize a spinlock in a struct must use __SPIN_LOCK_UNLOCKED().
Use __SPIN_LOCK_UNLOCKED() for the spinlock_t in imc_global_refc.
--- arch/powerpc/perf/imc-pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/perf/imc-pmu.c +1 -1
@@ -51,7 +51,7 @@ static int trace_imc_mem_size;* core and trace-imc */ static struct imc_pmu_ref imc_global_refc = { - .lock =__SPIN_LOCK_INITIALIZER (imc_global_refc.lock), + .lock =__SPIN_LOCK_UNLOCKED (imc_global_refc.lock), .id =0 , .refc =0 , };
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 299/379 powerpc/pseries: fix potential memory leak in init_cpu_associativity()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wang Yufen <[email protected]>
[ Upstream commit 95f1a128cd728a7257d78e868f1f5a145fc43736 ]
If the vcpu_associativity alloc memory successfully but the pcpu_associativity fails to alloc memory, the vcpu_associativity memory leaks.
--- arch/powerpc/platforms/pseries/lpar.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/platforms/pseries/lpar.c +3 -1
@@ -524,8 +524,10 @@ static ssize_t vcpudispatch_stats_write(struct file *file, const char __user *p,if (cmd) { rc =init_cpu_associativity (); -if (rc) +if (rc) { +destroy_cpu_associativity (); goto out; + }for_each_possible_cpu (cpu) { disp =per_cpu_ptr (&vcpu_disp_data, cpu);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 300/379 xhci: Loosen RPM as default policy to cover for AMD xHC 1.1
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Basavaraj Natikar <[email protected]>
[ Upstream commit 4baf1218150985ee3ab0a27220456a1f027ea0ac ]
The AMD USB host controller (1022:43f7) isn't going into PCI D3 by default without anything connected. This is because the policy that was introduced by commit a611bf473d1f ("xhci-pci: Set runtime PM as default policy on all xHC 1.2 or later devices") only covered 1.2 or later.
The 1.1 specification also has the same requirement as the 1.2 specification for D3 support. So expand the runtime PM as default policy to all AMD 1.1 devices as well.
--- drivers/usb/host/xhci-pci.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/host/xhci-pci.c +2 -0
@@ -348,6 +348,8 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)/* xHC spec requires PCI devices to support D3hot and D3cold */ if (xhci->hci_version >=0x120 ) xhci->quirks |=XHCI_DEFAULT_PM_RUNTIME_ALLOW ; +else if (pdev->vendor ==PCI_VENDOR_ID_AMD && xhci->hci_version >=0x110 ) + xhci->quirks |=XHCI_DEFAULT_PM_RUNTIME_ALLOW ;if (xhci->quirks &XHCI_RESET_ON_RESUME ) xhci_dbg_trace(xhci, trace_xhci_dbg_quirks,
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 301/379 usb: host: xhci-plat: fix possible kernel oops while resuming
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergey Shtylyov <[email protected]>
[ Upstream commit a5f928db59519a15e82ecba4ae3e7cbf5a44715a ]
If this driver enables the xHC clocks while resuming from sleep, it calls clk_prepare_enable() without checking for errors and blithely goes on to read/write the xHC's registers -- which, with the xHC not being clocked, at least on ARM32 usually causes an imprecise external abort exceptions which cause kernel oops. Currently, the chips for which the driver does the clock dance on suspend/resume seem to be the Broadcom STB SoCs, based on ARM32 CPUs, as it seems...
Found by Linux Verification Center (linuxtesting.org) with the Svace static analysis tool.
--- drivers/usb/host/xhci-plat.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)
drivers/usb/host/xhci-plat.c +19 -4
@@ -456,23 +456,38 @@ static int __maybe_unused xhci_plat_resume(struct device *dev)int ret;if (!device_may_wakeup (dev) && (xhci->quirks &XHCI_SUSPEND_RESUME_CLKS )) { -clk_prepare_enable (xhci->clk); -clk_prepare_enable (xhci->reg_clk); + ret =clk_prepare_enable (xhci->clk); +if (ret) +return ret; + + ret =clk_prepare_enable (xhci->reg_clk); +if (ret) { +clk_disable_unprepare (xhci->clk); +return ret; + } } ret =xhci_priv_resume_quirk (hcd);if (ret) -return ret; + goto disable_clks; ret =xhci_resume (xhci,0 );if (ret) -return ret; + goto disable_clks;pm_runtime_disable (dev);pm_runtime_set_active (dev);pm_runtime_enable (dev);return 0 ; + +disable_clks: +if (!device_may_wakeup (dev) && (xhci->quirks &XHCI_SUSPEND_RESUME_CLKS )) { +clk_disable_unprepare (xhci->clk); +clk_disable_unprepare (xhci->reg_clk); + } + +return ret; }static int __maybe_unused xhci_plat_runtime_suspend (struct device *dev)
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 302/379 perf machine: Avoid out of bounds LBR memory read
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit ab8ce150781d326c6bfbe1e09f175ffde1186f80 ]
Running perf top with address sanitizer and "--call-graph=lbr" fails due to reading sample 0 when no samples exist. Add a guard to prevent this.
--- tools/perf/util/machine.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
tools/perf/util/machine.c +12 -10
@@ -2555,16 +2555,18 @@ static int lbr_callchain_add_lbr_ip(struct thread *thread,save_lbr_cursor_node (thread, cursor, i); } -/* Add LBR ip from first entries.to */ - ip = entries[0 ].to; - flags = &entries[0 ].flags; - *branch_from = entries[0 ].from; - err =add_callchain_ip (thread, cursor, parent, - root_al, &cpumode, ip, - true, flags,NULL , - *branch_from); -if (err) -return err; +if (lbr_nr >0 ) { +/* Add LBR ip from first entries.to */ + ip = entries[0 ].to; + flags = &entries[0 ].flags; + *branch_from = entries[0 ].from; + err =add_callchain_ip (thread, cursor, parent, + root_al, &cpumode, ip, + true, flags,NULL , + *branch_from); +if (err) +return err; + }return 0 ; }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 303/379 perf hist: Add missing puts to hist__account_cycles
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Rogers <[email protected]>
[ Upstream commit c1149037f65bcf0334886180ebe3d5efcf214912 ]
Caught using reference count checking on perf top with "--call-graph=lbr". After this no memory leaks were detected.
--- tools/perf/util/hist.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
tools/perf/util/hist.c +7 -3
@@ -2645,8 +2645,6 @@ void hist__account_cycles(struct branch_stack *bs, struct addr_location *al,/* If we have branch cycles always annotate them. */ if (bs && bs->nr && entries[0 ].flags.cycles) { -int i; - bi =sample__resolve_bstack (sample, al);if (bi) {struct addr_map_symbol *prev =NULL ;
@@ -2661,7 +2659,7 @@ void hist__account_cycles(struct branch_stack *bs, struct addr_location *al,* Note that perf stores branches reversed from * program order! */ -for (i = bs->nr -1 ; i >=0 ; i--) { +for (int i = bs->nr -1 ; i >=0 ; i--) {addr_map_symbol__account_cycles (&bi[i].from, nonany_branch_mode ?NULL : prev, bi[i].flags.cycles);
@@ -2670,6 +2668,12 @@ void hist__account_cycles(struct branch_stack *bs, struct addr_location *al,if (total_cycles) *total_cycles += bi[i].flags.cycles; } +for (unsigned int i =0 ; i < bs->nr; i++) { +map__put (bi[i].to.ms.map); +maps__put (bi[i].to.ms.maps); +map__put (bi[i].from.ms.map); +maps__put (bi[i].from.ms.maps); + }free (bi); } }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 304/379 9p/net: fix possible memory leak in p9_check_errors()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hangyu Hua <[email protected]>
[ Upstream commit ce07087964208eee2ca2f9ee4a98f8b5d9027fe6 ]
When p9pdu_readf() is called with "s?d" attribute, it allocates a pointer that will store a string. But when p9pdu_readf() fails while handling "d" then this pointer will not be freed in p9_check_errors().
Message-ID: <[email protected]>
--- net/9p/client.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/9p/client.c +4 -2
@@ -537,12 +537,14 @@ static int p9_check_errors(struct p9_client *c, struct p9_req_t *req)return 0 ;if (!p9_is_proto_dotl (c)) { -char *ename; +char *ename =NULL ; err =p9pdu_readf (&req->rc, c->proto_version,"s?d" , &ename, &ecode); -if (err) +if (err) { +kfree (ename); goto out_err; + }if (p9_is_proto_dotu (c) && ecode <512 ) err = -ecode;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 305/379 i3c: Fix potential refcount leak in i3c_master_register_new_i3c_devs
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dinghao Liu <[email protected]>
[ Upstream commit cab63f64887616e3c4e31cfd8103320be6ebc8d3 ]
put_device() needs to be called on failure of device_register() to give up the reference initialized in it to avoid refcount leak.
--- drivers/i3c/master.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/i3c/master.c +3 -1
@@ -1508,9 +1508,11 @@ i3c_master_register_new_i3c_devs(struct i3c_master_controller *master) desc->dev->dev.of_node = desc->boardinfo->of_node; ret =device_register (&desc->dev->dev); -if (ret) +if (ret) {dev_err (&master->dev,"Failed to add I3C device (err = %d)\n" , ret); +put_device (&desc->dev->dev); + } } }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 306/379 cxl/mem: Fix shutdown order
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
[ Upstream commit 88d3917f82ed4215a2154432c26de1480a61b209 ]
Ira reports that removing cxl_mock_mem causes a crash with the following trace:
BUG: kernel NULL pointer dereference, address: 0000000000000044 [..] RIP: 0010:cxl_region_decode_reset+0x7f/0x180 [cxl_core] [..] Call Trace: <TASK> cxl_region_detach+0xe8/0x210 [cxl_core] cxl_decoder_kill_region+0x27/0x40 [cxl_core] cxld_unregister+0x29/0x40 [cxl_core] devres_release_all+0xb8/0x110 device_unbind_cleanup+0xe/0x70 device_release_driver_internal+0x1d2/0x210 bus_remove_device+0xd7/0x150 device_del+0x155/0x3e0 device_unregister+0x13/0x60 devm_release_action+0x4d/0x90 ? __pfx_unregister_port+0x10/0x10 [cxl_core] delete_endpoint+0x121/0x130 [cxl_core] devres_release_all+0xb8/0x110 device_unbind_cleanup+0xe/0x70 device_release_driver_internal+0x1d2/0x210 bus_remove_device+0xd7/0x150 device_del+0x155/0x3e0 ? lock_release+0x142/0x290 cdev_device_del+0x15/0x50 cxl_memdev_unregister+0x54/0x70 [cxl_core]
This crash is due to the clearing out the cxl_memdev's driver context (@cxlds) before the subsystem is done with it. This is ultimately due to the region(s), that this memdev is a member, being torn down and expecting to be able to de-reference @cxlds, like here:
static int cxl_region_decode_reset(struct cxl_region *cxlr, int count)
...
if (cxlds->rcd)
goto endpoint_reset;...
Fix it by keeping the driver context valid until memdev-device unregistration, and subsequently the entire stack of related dependencies, unwinds.
--- drivers/cxl/core/memdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cxl/core/memdev.c +1 -1
@@ -214,8 +214,8 @@ static void cxl_memdev_unregister(void *_cxlmd)struct cxl_memdev *cxlmd = _cxlmd;struct device *dev = &cxlmd->dev; -cxl_memdev_shutdown (dev);cdev_device_del (&cxlmd->cdev, dev); +cxl_memdev_shutdown (dev);put_device (dev); }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 307/379 crypto: ccp - Name -1 return value as SEV_RET_NO_FW_CALL
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Gonda <[email protected]>
[ Upstream commit efb339a83368ab25de1a18c0fdff85e01c13a1ea ]
The PSP can return a "firmware error" code of -1 in circumstances where the PSP has not actually been called. To make this protocol unambiguous, name the value SEV_RET_NO_FW_CALL.
[ bp: Massage a bit. ]
Stable-dep-of: db10cb9b5746 ("virt: sevguest: Fix passing a stack buffer as a scatterlist target")
--- Documentation/virt/coco/sev-guest.rst | 4 ++-- drivers/crypto/ccp/sev-dev.c | 8 +++++--- include/uapi/linux/psp-sev.h | 7 +++++++ 3 files changed, 14 insertions(+), 5 deletions(-)
Documentation/virt/coco/sev-guest.rst +2 -2
@@ -40,8 +40,8 @@ along with a description: The guest ioctl should be issued on a file descriptor of the /dev/sev-guest device. The ioctl accepts struct snp_user_guest_request. The input and output structure is specified through the req_data and resp_data field respectively. If the ioctl fails -to execute due to a firmware error, then fw_err code will be set otherwise the -fw_err will be set to 0x00000000000000ff. +to execute due to a firmware error, then fw_err code will be set. Otherwise, fw_err +will be set to 0x00000000ffffffff, i.e., the lower 32-bits are -1. The firmware checks that the message sequence counter is one greater than the guests message sequence counter. If guest driver fails to increment message
drivers/crypto/ccp/sev-dev.c +5 -3
@@ -443,10 +443,10 @@ static int __sev_init_ex_locked(int *error)static int __sev_platform_init_locked (int *error) { +int rc =0 , psp_ret =SEV_RET_NO_FW_CALL ;struct psp_device *psp = psp_master; -struct sev_device *sev; -int rc =0 , psp_ret =-1 ;int (*init_function)(int *error); +struct sev_device *sev;if (!psp || !psp->sev_data)return -ENODEV ;
@@ -474,9 +474,11 @@ static int __sev_platform_init_locked(int *error)* initialization function should succeed by replacing the state * with a reset state. */ -dev_err (sev->dev,"SEV: retrying INIT command because of SECURE_DATA_INVALID error. Retrying once to reset PSP SEV state." ); +dev_err (sev->dev, +"SEV: retrying INIT command because of SECURE_DATA_INVALID error. Retrying once to reset PSP SEV state." ); rc =init_function (&psp_ret); } +if (error) *error = psp_ret;
include/uapi/linux/psp-sev.h +7 -0
@@ -36,6 +36,13 @@ enum {* SEV Firmware status code */ typedef enum { + /* + * This error code is not in the SEV spec. Its purpose is to convey that + * there was an error that prevented the SEV firmware from being called. + * The SEV API error codes are 16 bits, so the -1 value will not overlap + * with possible values from the specification. + */ + SEV_RET_NO_FW_CALL = -1, SEV_RET_SUCCESS = 0, SEV_RET_INVALID_PLATFORM_STATE, SEV_RET_INVALID_GUEST_STATE,
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 308/379 x86/sev: Change snp_guest_issue_request()s fw_err argument
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dionna Glaze <[email protected]>
[ Upstream commit 0144e3b85d7b42e8a4cda991c0e81f131897457a ]
The GHCB specification declares that the firmware error value for a guest request will be stored in the lower 32 bits of EXIT_INFO_2. The upper 32 bits are for the VMM's own error code. The fw_err argument to snp_guest_issue_request() is thus a misnomer, and callers will need access to all 64 bits.
The type of unsigned long also causes problems, since sw_exit_info2 is u64 (unsigned long long) vs the argument's unsigned long*. Change this type for issuing the guest request. Pass the ioctl command struct's error field directly instead of in a local variable, since an incomplete guest request may not set the error code, and uninitialized stack memory would be written back to user space.
The firmware might not even be called, so bookend the call with the no firmware call error and clear the error.
Since the "fw_err" field is really exitinfo2 split into the upper bits' vmm error code and lower bits' firmware error code, convert the 64 bit value to a union.
[ bp:
- Massage commit message
- adjust code
- Fix a build issue as
- print exitinfo2 in hex
Tom:
- Correct -EIO exit case. ]
Stable-dep-of: db10cb9b5746 ("virt: sevguest: Fix passing a stack buffer as a scatterlist target")
--- Documentation/virt/coco/sev-guest.rst | 20 ++++--- arch/x86/include/asm/sev-common.h | 4 -- arch/x86/include/asm/sev.h | 10 ++-- arch/x86/kernel/sev.c | 15 +++--- drivers/virt/coco/sev-guest/sev-guest.c | 72 +++++++++++++------------ include/uapi/linux/sev-guest.h | 18 ++++++- 6 files changed, 83 insertions(+), 56 deletions(-)
Documentation/virt/coco/sev-guest.rst +13 -7
@@ -37,11 +37,11 @@ along with a description: the return value. General error numbers (-ENOMEM, -EINVAL) are not detailed, but errors with specific meanings are. -The guest ioctl should be issued on a file descriptor of the /dev/sev-guest device. -The ioctl accepts struct snp_user_guest_request. The input and output structure is -specified through the req_data and resp_data field respectively. If the ioctl fails -to execute due to a firmware error, then fw_err code will be set. Otherwise, fw_err -will be set to 0x00000000ffffffff, i.e., the lower 32-bits are -1. +The guest ioctl should be issued on a file descriptor of the /dev/sev-guest +device. The ioctl accepts struct snp_user_guest_request. The input and +output structure is specified through the req_data and resp_data field +respectively. If the ioctl fails to execute due to a firmware error, then +the fw_error code will be set, otherwise fw_error will be set to -1. The firmware checks that the message sequence counter is one greater than the guests message sequence counter. If guest driver fails to increment message
@@ -57,8 +57,14 @@ counter (e.g. counter overflow), then -EIO will be returned. __u64 req_data; __u64 resp_data; - /* firmware error code on failure (see psp-sev.h) */ - __u64 fw_err; + /* bits[63:32]: VMM error code, bits[31:0] firmware error code (see psp-sev.h) */ + union { + __u64 exitinfo2; + struct { + __u32 fw_error; + __u32 vmm_error; + }; + }; }; 2.1 SNP_GET_REPORT
arch/x86/include/asm/sev-common.h +0 -4
@@ -128,10 +128,6 @@ struct snp_psc_desc {struct psc_entry entries[VMGEXIT_PSC_MAX_ENTRY ]; } __packed; -/* Guest message request error codes */ -#define SNP_GUEST_REQ_INVALID_LEN BIT_ULL(32) -#define SNP_GUEST_REQ_ERR_BUSY BIT_ULL(33) -#define GHCB_MSR_TERM_REQ 0x100#define GHCB_MSR_TERM_REASON_SET_POS 12#define GHCB_MSR_TERM_REASON_SET_MASK 0xf
arch/x86/include/asm/sev.h +7 -3
@@ -9,6 +9,8 @@#define __ASM_ENCRYPTED_STATE_H#include <linux/types.h> +#include <linux/sev-guest.h> +#include <asm/insn.h> #include <asm/sev-common.h> #include <asm/bootparam.h>
@@ -185,6 +187,9 @@ static inline int pvalidate(unsigned long vaddr, bool rmp_psize, bool validate)return rc; } + +struct snp_guest_request_ioctl ; +void setup_ghcb (void );void __init early_snp_set_memory_private (unsigned long vaddr,unsigned long paddr,unsigned long npages);
@@ -196,7 +201,7 @@ void snp_set_memory_private(unsigned long vaddr, unsigned long npages);void snp_set_wakeup_secondary_cpu (void );bool snp_init (struct boot_params *bp);void __init __noreturn snp_abort (void ); -int snp_issue_guest_request (u64 exit_code,struct snp_req_data *input,unsigned long *fw_err); +int snp_issue_guest_request (u64 exit_code,struct snp_req_data *input,struct snp_guest_request_ioctl *rio);#else static inline void sev_es_ist_enter (struct pt_regs *regs) { }static inline void sev_es_ist_exit (void ) { }
@@ -216,8 +221,7 @@ static inline void snp_set_memory_private(unsigned long vaddr, unsigned long npastatic inline void snp_set_wakeup_secondary_cpu (void ) { }static inline bool snp_init (struct boot_params *bp) {return false; }static inline void snp_abort (void ) { } -static inline int snp_issue_guest_request (u64 exit_code,struct snp_req_data *input, -unsigned long *fw_err) +static inline int snp_issue_guest_request (u64 exit_code,struct snp_req_data *input,struct snp_guest_request_ioctl *rio) {return -ENOTTY ; }
arch/x86/kernel/sev.c +8 -7
@@ -22,6 +22,8 @@#include <linux/efi.h> #include <linux/platform_device.h> #include <linux/io.h> +#include <linux/psp-sev.h> +#include <uapi/linux/sev-guest.h> #include <asm/cpu_entry_area.h> #include <asm/stacktrace.h>
@@ -2205,7 +2207,7 @@ static int __init init_sev_config(char *str) }__setup ("sev=" , init_sev_config); -int snp_issue_guest_request (u64 exit_code,struct snp_req_data *input,unsigned long *fw_err) +int snp_issue_guest_request (u64 exit_code,struct snp_req_data *input,struct snp_guest_request_ioctl *rio) {struct ghcb_state state;struct es_em_ctxt ctxt;
@@ -2213,8 +2215,7 @@ int snp_issue_guest_request(u64 exit_code, struct snp_req_data *input, unsignedstruct ghcb *ghcb;int ret; -if (!fw_err) -return -EINVAL ; + rio->exitinfo2 =SEV_RET_NO_FW_CALL ;/* * __sev_get_ghcb() needs to run with IRQs disabled because it is using
@@ -2239,16 +2240,16 @@ int snp_issue_guest_request(u64 exit_code, struct snp_req_data *input, unsignedif (ret) goto e_put; - *fw_err = ghcb->save.sw_exit_info_2; -switch (*fw_err) { + rio->exitinfo2 = ghcb->save.sw_exit_info_2; +switch (rio->exitinfo2) {case 0 :break ; -case SNP_GUEST_REQ_ERR_BUSY : +case SNP_GUEST_VMM_ERR (SNP_GUEST_VMM_ERR_BUSY ): ret = -EAGAIN ;break ; -case SNP_GUEST_REQ_INVALID_LEN : +case SNP_GUEST_VMM_ERR (SNP_GUEST_VMM_ERR_INVALID_LEN ):/* Number of expected pages are returned in RBX */ if (exit_code ==SVM_VMGEXIT_EXT_GUEST_REQUEST ) { input->data_npages =ghcb_get_rbx (ghcb);
drivers/virt/coco/sev-guest/sev-guest.c +39 -33
161 lines not on this page · raw message
include/uapi/linux/sev-guest.h +16 -2
@@ -52,8 +52,14 @@ struct snp_guest_request_ioctl {__u64 req_data;__u64 resp_data; -/* firmware error code on failure (see psp-sev.h) */ -__u64 fw_err; +/* bits[63:32]: VMM error code, bits[31:0] firmware error code (see psp-sev.h) */ +union { +__u64 exitinfo2; +struct { +__u32 fw_error; +__u32 vmm_error; + }; + }; };struct snp_ext_report_req {
@@ -77,4 +83,12 @@ struct snp_ext_report_req {/* Get SNP extended report as defined in the GHCB specification version 2. */ #define SNP_GET_EXT_REPORT _IOWR(SNP_GUEST_REQ_IOC_TYPE, 0x2, struct snp_guest_request_ioctl) +/* Guest message request EXIT_INFO_2 constants */ +#define SNP_GUEST_FW_ERR_MASK GENMASK_ULL(31, 0) +#define SNP_GUEST_VMM_ERR_SHIFT 32 +#define SNP_GUEST_VMM_ERR (x) (((u64)x) << SNP_GUEST_VMM_ERR_SHIFT) + +#define SNP_GUEST_VMM_ERR_INVALID_LEN 1 +#define SNP_GUEST_VMM_ERR_BUSY 2 +#endif /* __UAPI_LINUX_SEV_GUEST_H_ */
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 309/379 virt: sevguest: Fix passing a stack buffer as a scatterlist target
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
[ Upstream commit db10cb9b574675402bfd8fe1a31aafdd45b002df ]
CONFIG_DEBUG_SG highlights that get_{report,ext_report,derived_key)()} are passing stack buffers as the @req_buf argument to handle_guest_request(), generating a Call Trace of the following form:
WARNING: CPU: 0 PID: 1175 at include/linux/scatterlist.h:187 enc_dec_message+0x518/0x5b0 [sev_guest]
[..]
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023
RIP: 0010:enc_dec_message+0x518/0x5b0 [sev_guest]
Call Trace:
<TASK>
[..]
handle_guest_request+0x135/0x520 [sev_guest]
get_ext_report+0x1ec/0x3e0 [sev_guest]
snp_guest_ioctl+0x157/0x200 [sev_guest]Note that the above Call Trace was with the DEBUG_SG BUG_ON()s converted to WARN_ON()s.
This is benign as long as there are no hardware crypto accelerators loaded for the aead cipher, and no subsequent dma_map_sg() is performed on the scatterlist. However, sev-guest can not assume the presence of an aead accelerator nor can it assume that CONFIG_DEBUG_SG is disabled.
Resolve this bug by allocating virt_addr_valid() memory, similar to the other buffers am @snp_dev instance carries, to marshal requests from user buffers to kernel buffers.
--- drivers/virt/coco/sev-guest/sev-guest.c | 45 ++++++++++++++----------- 1 file changed, 25 insertions(+), 20 deletions(-)
drivers/virt/coco/sev-guest/sev-guest.c +25 -20
@@ -57,6 +57,11 @@ struct snp_guest_dev {struct snp_secrets_page_layout *layout;struct snp_req_data input; +union { +struct snp_report_req report; +struct snp_derived_key_req derived_key; +struct snp_ext_report_req ext_report; + } req;u32 *os_area_msg_seqno;u8 *vmpck; };
@@ -475,8 +480,8 @@ static int handle_guest_request(struct snp_guest_dev *snp_dev, u64 exit_code,static int get_report (struct snp_guest_dev *snp_dev,struct snp_guest_request_ioctl *arg) {struct snp_guest_crypto *crypto = snp_dev->crypto; +struct snp_report_req *req = &snp_dev->req.report;struct snp_report_resp *resp; -struct snp_report_req req;int rc, resp_len;lockdep_assert_held (&snp_cmd_mutex);
@@ -484,7 +489,7 @@ static int get_report(struct snp_guest_dev *snp_dev, struct snp_guest_request_ioif (!arg->req_data || !arg->resp_data)return -EINVAL ; -if (copy_from_user (&req, (void __user *)arg->req_data,sizeof (req))) +if (copy_from_user (req, (void __user *)arg->req_data,sizeof (*req)))return -EFAULT ;/*
@@ -498,7 +503,7 @@ static int get_report(struct snp_guest_dev *snp_dev, struct snp_guest_request_ioreturn -ENOMEM ; rc =handle_guest_request (snp_dev,SVM_VMGEXIT_GUEST_REQUEST , arg, -SNP_MSG_REPORT_REQ , &req,sizeof (req), resp->data, +SNP_MSG_REPORT_REQ , req,sizeof (*req), resp->data, resp_len);if (rc) goto e_free;
@@ -513,9 +518,9 @@ static int get_report(struct snp_guest_dev *snp_dev, struct snp_guest_request_iostatic int get_derived_key (struct snp_guest_dev *snp_dev,struct snp_guest_request_ioctl *arg) { +struct snp_derived_key_req *req = &snp_dev->req.derived_key;struct snp_guest_crypto *crypto = snp_dev->crypto;struct snp_derived_key_resp resp = {0 }; -struct snp_derived_key_req req;int rc, resp_len;/* Response data is 64 bytes and max authsize for GCM is 16 bytes. */ u8 buf[64 +16 ];
@@ -534,11 +539,11 @@ static int get_derived_key(struct snp_guest_dev *snp_dev, struct snp_guest_requeif (sizeof (buf) < resp_len)return -ENOMEM ; -if (copy_from_user (&req, (void __user *)arg->req_data,sizeof (req))) +if (copy_from_user (req, (void __user *)arg->req_data,sizeof (*req)))return -EFAULT ; rc =handle_guest_request (snp_dev,SVM_VMGEXIT_GUEST_REQUEST , arg, -SNP_MSG_KEY_REQ , &req,sizeof (req), buf, resp_len); +SNP_MSG_KEY_REQ , req,sizeof (*req), buf, resp_len);if (rc)return rc;
@@ -554,8 +559,8 @@ static int get_derived_key(struct snp_guest_dev *snp_dev, struct snp_guest_requestatic int get_ext_report (struct snp_guest_dev *snp_dev,struct snp_guest_request_ioctl *arg) { +struct snp_ext_report_req *req = &snp_dev->req.ext_report;struct snp_guest_crypto *crypto = snp_dev->crypto; -struct snp_ext_report_req req;struct snp_report_resp *resp;int ret, npages =0 , resp_len;
@@ -564,18 +569,18 @@ static int get_ext_report(struct snp_guest_dev *snp_dev, struct snp_guest_requesif (!arg->req_data || !arg->resp_data)return -EINVAL ; -if (copy_from_user (&req, (void __user *)arg->req_data,sizeof (req))) +if (copy_from_user (req, (void __user *)arg->req_data,sizeof (*req)))return -EFAULT ;/* userspace does not want certificate data */ -if (!req.certs_len || !req.certs_address) +if (!req->certs_len || !req->certs_address) goto cmd; -if (req.certs_len >SEV_FW_BLOB_MAX_SIZE || - !IS_ALIGNED (req.certs_len,PAGE_SIZE )) +if (req->certs_len >SEV_FW_BLOB_MAX_SIZE || + !IS_ALIGNED (req->certs_len,PAGE_SIZE ))return -EINVAL ; -if (!access_ok ((const void __user *)req.certs_address, req.certs_len)) +if (!access_ok ((const void __user *)req->certs_address, req->certs_len))return -EFAULT ;/*
@@ -584,8 +589,8 @@ static int get_ext_report(struct snp_guest_dev *snp_dev, struct snp_guest_reques* the host. If host does not supply any certs in it, then copy * zeros to indicate that certificate data was not provided. */ -memset (snp_dev->certs_data,0 , req.certs_len); - npages = req.certs_len >>PAGE_SHIFT ; +memset (snp_dev->certs_data,0 , req->certs_len); + npages = req->certs_len >>PAGE_SHIFT ; cmd:/* * The intermediate response buffer is used while decrypting the
@@ -599,14 +604,14 @@ static int get_ext_report(struct snp_guest_dev *snp_dev, struct snp_guest_reques snp_dev->input.data_npages = npages; ret =handle_guest_request (snp_dev,SVM_VMGEXIT_EXT_GUEST_REQUEST , arg, -SNP_MSG_REPORT_REQ , &req.data, -sizeof (req.data), resp->data, resp_len); +SNP_MSG_REPORT_REQ , &req->data, +sizeof (req->data), resp->data, resp_len);/* If certs length is invalid then copy the returned length */ if (arg->vmm_error ==SNP_GUEST_VMM_ERR_INVALID_LEN ) { - req.certs_len = snp_dev->input.data_npages <<PAGE_SHIFT ; + req->certs_len = snp_dev->input.data_npages <<PAGE_SHIFT ; -if (copy_to_user ((void __user *)arg->req_data, &req,sizeof (req))) +if (copy_to_user ((void __user *)arg->req_data, req,sizeof (*req))) ret = -EFAULT ; }
@@ -614,8 +619,8 @@ static int get_ext_report(struct snp_guest_dev *snp_dev, struct snp_guest_reques goto e_free;if (npages && -copy_to_user ((void __user *)req.certs_address, snp_dev->certs_data, - req.certs_len)) { +copy_to_user ((void __user *)req->certs_address, snp_dev->certs_data, + req->certs_len)) { ret = -EFAULT ; goto e_free; }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 310/379 rtc: pcf85363: fix wrong mask/val parameters in regmap_update_bits call
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
[ Upstream commit 2be36c09b6b07306be33519e1aa70d2e2a2161bb ]
The current implementation passes PIN_IO_INTA_OUT (2) as a mask and PIN_IO_INTAPM (GENMASK(1, 0)) as a value.
Swap the variables to assign mask and value the right way.
This error was first introduced with the alarm support. For better or worse it worked as expected because 0x02 was applied as a mask to 0x03, resulting 0x02 anyway. This will of course not work for any other value.
--- drivers/rtc/rtc-pcf85363.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-pcf85363.c +1 -1
@@ -402,7 +402,7 @@ static int pcf85363_probe(struct i2c_client *client)if (client->irq >0 ) {regmap_write (pcf85363->regmap,CTRL_FLAGS ,0 );regmap_update_bits (pcf85363->regmap,CTRL_PIN_IO , -PIN_IO_INTA_OUT ,PIN_IO_INTAPM ); +PIN_IO_INTAPM ,PIN_IO_INTA_OUT ); ret = devm_request_threaded_irq(&client->dev, client->irq, NULL, pcf85363_rtc_handle_irq, IRQF_TRIGGER_LOW | IRQF_ONESHOT,
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 311/379 pcmcia: cs: fix possible hung task and memory leak pccardd()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Yingliang <[email protected]>
[ Upstream commit e3ea1b4847e49234e691c0d66bf030bd65bb7f2b ]
If device_register() returns error in pccardd(), it leads two issues:
1. The socket_released has never been completed, it will block pcmcia_unregister_socket(), because of waiting for completion of socket_released.
2. The device name allocated by dev_set_name() is leaked.
Fix this two issues by calling put_device() when device_register() fails. socket_released can be completed in pcmcia_release_socket(), the name can be freed in kobject_cleanup().
--- drivers/pcmcia/cs.c | 1 + 1 file changed, 1 insertion(+)
drivers/pcmcia/cs.c +1 -0
@@ -605,6 +605,7 @@ static int pccardd(void *__skt)dev_warn (&skt->dev,"PCMCIA: unable to register socket\n" ); skt->thread =NULL ;complete (&skt->thread_done); +put_device (&skt->dev);return 0 ; } ret =pccard_sysfs_add_socket (&skt->dev);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 312/379 pcmcia: ds: fix refcount leak in pcmcia_device_add()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Yingliang <[email protected]>
[ Upstream commit 402ab979b29126068e0b596b641422ff7490214c ]
As the comment of device_register() says, it should use put_device() to give up the reference in the error path. Then, insofar resources will be freed in pcmcia_release_dev(), the error path is no longer needed. In particular, this means that the (previously missing) dropping of the reference to &p_dev->function_config->ref is now handled by pcmcia_release_dev().
--- drivers/pcmcia/ds.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/pcmcia/ds.c +8 -2
@@ -573,8 +573,14 @@ static struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s,pcmcia_device_query (p_dev); -if (device_register (&p_dev->dev)) - goto err_unreg; +if (device_register (&p_dev->dev)) { +mutex_lock (&s->ops_mutex); +list_del (&p_dev->socket_device_list); + s->device_count--; +mutex_unlock (&s->ops_mutex); +put_device (&p_dev->dev); +return NULL ; + }return p_dev;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 313/379 pcmcia: ds: fix possible name leak in error path in pcmcia_device_add()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yang Yingliang <[email protected]>
[ Upstream commit 99e1241049a92dd3e9a90a0f91e32ce390133278 ]
Afer commit 1fa5ae857bb1 ("driver core: get rid of struct device's bus_id string array"), the name of device is allocated dynamically. Therefore, it needs to be freed, which is done by the driver core for us once all references to the device are gone. Therefore, move the dev_set_name() call immediately before the call device_register(), which either succeeds (then the freeing will be done upon subsequent remvoal), or puts the reference in the error call. Also, it is not unusual that the return value of dev_set_name is not checked.
--- drivers/pcmcia/ds.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pcmcia/ds.c +1 -3
@@ -513,9 +513,6 @@ static struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s,/* by default don't allow DMA */ p_dev->dma_mask =0 ; p_dev->dev.dma_mask = &p_dev->dma_mask; -dev_set_name (&p_dev->dev,"%d.%d" , p_dev->socket->sock, p_dev->device_no); -if (!dev_name (&p_dev->dev)) - goto err_free; p_dev->devname =kasprintf (GFP_KERNEL ,"pcmcia%s" ,dev_name (&p_dev->dev));if (!p_dev->devname) goto err_free;
@@ -573,6 +570,7 @@ static struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s,pcmcia_device_query (p_dev); +dev_set_name (&p_dev->dev,"%d.%d" , p_dev->socket->sock, p_dev->device_no);if (device_register (&p_dev->dev)) {mutex_lock (&s->ops_mutex);list_del (&p_dev->socket_device_list);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 314/379 media: hantro: Check whether reset op is defined before use
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
[ Upstream commit 88d4b23a629ebd34f682f770cb6c2116c851f7b8 ]
The i.MX8MM/N/P does not define the .reset op since reset of the VPU is done by genpd. Check whether the .reset op is defined before calling it to avoid NULL pointer dereference.
Note that the Fixes tag is set to the commit which removed the reset op from i.MX8M Hantro G2 implementation, this is because before this commit all the implementations did define the .reset op.
--- drivers/media/platform/verisilicon/hantro_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/platform/verisilicon/hantro_drv.c +2 -1
@@ -125,7 +125,8 @@ void hantro_watchdog(struct work_struct *work) ctx =v4l2_m2m_get_curr_priv (vpu->m2m_dev);if (ctx) {vpu_err ("frame processing timed out!\n" ); - ctx->codec_ops->reset (ctx); +if (ctx->codec_ops->reset) + ctx->codec_ops->reset (ctx);hantro_job_finish (vpu, ctx,VB2_BUF_STATE_ERROR ); } }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 315/379 media: verisilicon: Do not enable G2 postproc downscale if source is narrower than destination
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
[ Upstream commit 6e481d52d363218a3e6feb31694da74b38b30fad ]
In case of encoded input VP9 data width that is not multiple of macroblock size, which is 16 (e.g. 1080x1920 frames, where 1080 is multiple of 8), the width is padded to be a multiple of macroblock size (for 1080x1920 frames, that is 1088x1920).
The hantro_postproc_g2_enable() checks whether the encoded data width is equal to decoded frame width, and if not, enables down-scale mode. For a frame where input is 1080x1920 and output is 1088x1920, this is incorrect as no down-scale happens, the frame is only padded. Enabling the down-scale mode in this case results in corrupted frames.
Fix this by adjusting the check to test whether encoded data width is greater than decoded frame width, and only in that case enable the down-scale mode.
To generate input test data to trigger this bug, use e.g.:
$ gst-launch-1.0 videotestsrc ! video/x-raw,width=272,height=256,format=I420 ! \
vp9enc ! matroskamux ! filesink location=/tmp/test.vp9
To trigger the bug upon decoding (note that the NV12 must be forced, as
that assures the output data would pass the G2 postproc):
$ gst-launch-1.0 filesrc location=/tmp/test.vp9 ! matroskademux ! vp9parse ! \
v4l2slvp9dec ! video/x-raw,format=NV12 ! videoconvert ! fbdevsink--- drivers/media/platform/verisilicon/hantro_postproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/verisilicon/hantro_postproc.c +1 -1
@@ -103,7 +103,7 @@ static void hantro_postproc_g1_enable(struct hantro_ctx *ctx)static int down_scale_factor (struct hantro_ctx *ctx) { -if (ctx->src_fmt.width == ctx->dst_fmt.width) +if (ctx->src_fmt.width <= ctx->dst_fmt.width)return 0 ;return DIV_ROUND_CLOSEST (ctx->src_fmt.width, ctx->dst_fmt.width);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 316/379 media: ov5640: Drop dead code using frame_interval
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacopo Mondi <[email protected]>
[ Upstream commit eeaa47d182fedfe68b8fd40ef3798761c8904791 ]
The ov5640_update_pixel_rate() function handles the parallel and MIPI CSI-2 cases separately.
When running on a parallel setup the V4L2_CID_PIXEL_RATE value is calculated at the beginning of the function using the values configured with the frame_interval operations, and then the function immediately returns.
The remaining of the function handles the MIPI CSI-2 configuration and should not use the 'current_fr' and 'def_fps' fields as those are only relevant for parallel mode.
Drop a small section of dead code that updates vblank using frame_interval on a MIPI CSI-2 setup.
Stable-dep-of: 8fc29e3c9f68 ("media: ov5640: fix vblank unchange issue when work at dvp mode")
--- drivers/media/i2c/ov5640.c | 13 ------------- 1 file changed, 13 deletions(-)
drivers/media/i2c/ov5640.c +0 -13
@@ -2912,19 +2912,6 @@ static int ov5640_update_pixel_rate(struct ov5640_dev *sensor) hblank, hblank, 1, hblank); vblank = timings->vblank_def; - -if (sensor->current_fr != mode->def_fps) { -/* -* Compute the vertical blanking according to the framerate -* configured with s_frame_interval. -*/ -int fie_num = sensor->frame_interval.numerator; -int fie_denom = sensor->frame_interval.denominator; - - vblank = ((fie_num * pixel_rate / fie_denom) / timings->htot) - - mode->height; - } -__v4l2_ctrl_modify_range (sensor->ctrls.vblank,OV5640_MIN_VBLANK ,OV5640_MAX_VTS - mode->height,1 , vblank);__v4l2_ctrl_s_ctrl (sensor->ctrls.vblank, vblank);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 317/379 media: ov5640: fix vblank unchange issue when work at dvp mode
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guoniu.zhou <[email protected]>
[ Upstream commit 8fc29e3c9f682d4ad9b0764d44ecc6c19b000051 ]
The value of V4L2_CID_VBLANK control is initialized to default vblank value of 640x480 when driver probe. When OV5640 work at DVP mode, the control value won't update and lead to sensor can't output data if the resolution remain the same as last time since incorrect total vertical size. So update it when there is a new value applied.
--- drivers/media/i2c/ov5640.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
drivers/media/i2c/ov5640.c +14 -5
@@ -2840,12 +2840,22 @@ static int ov5640_try_fmt_internal(struct v4l2_subdev *sd,return 0 ; } +static void __v4l2_ctrl_vblank_update (struct ov5640_dev *sensor,u32 vblank) +{ +const struct ov5640_mode_info *mode = sensor->current_mode; + +__v4l2_ctrl_modify_range (sensor->ctrls.vblank,OV5640_MIN_VBLANK , +OV5640_MAX_VTS - mode->height,1 , vblank); + +__v4l2_ctrl_s_ctrl (sensor->ctrls.vblank, vblank); +} +static int ov5640_update_pixel_rate (struct ov5640_dev *sensor) {const struct ov5640_mode_info *mode = sensor->current_mode;enum ov5640_pixel_rate_id pixel_rate_id = mode->pixel_rate;struct v4l2_mbus_framefmt *fmt = &sensor->fmt; -const struct ov5640_timings *timings; +const struct ov5640_timings *timings =ov5640_timings (sensor, mode);s32 exposure_val, exposure_max;unsigned int hblank;unsigned int i =0 ;
@@ -2864,6 +2874,8 @@ static int ov5640_update_pixel_rate(struct ov5640_dev *sensor)__v4l2_ctrl_s_ctrl_int64 (sensor->ctrls.pixel_rate,ov5640_calc_pixel_rate (sensor)); +__v4l2_ctrl_vblank_update (sensor, timings->vblank_def); +return 0 ; }
@@ -2906,15 +2918,12 @@ static int ov5640_update_pixel_rate(struct ov5640_dev *sensor)__v4l2_ctrl_s_ctrl_int64 (sensor->ctrls.pixel_rate, pixel_rate);__v4l2_ctrl_s_ctrl (sensor->ctrls.link_freq, i); - timings =ov5640_timings (sensor, mode); hblank = timings->htot - mode->width;__v4l2_ctrl_modify_range (sensor->ctrls.hblank, hblank, hblank,1 , hblank); vblank = timings->vblank_def; -__v4l2_ctrl_modify_range (sensor->ctrls.vblank,OV5640_MIN_VBLANK , -OV5640_MAX_VTS - mode->height,1 , vblank); -__v4l2_ctrl_s_ctrl (sensor->ctrls.vblank, vblank); +__v4l2_ctrl_vblank_update (sensor, vblank); exposure_max = timings->crop.height + vblank -4 ; exposure_val = clamp_t(s32, sensor->ctrls.exposure->val,
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 318/379 media: i2c: max9286: Fix some redundant of_node_put() calls
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit 0822315e46b400f611cba1193456ee6a5dc3e41d ]
This is odd to have a of_node_put() just after a for_each_child_of_node() or a for_each_endpoint_of_node() loop. It should already be called during the last iteration.
Remove these calls.
--- drivers/media/i2c/max9286.c | 2 -- 1 file changed, 2 deletions(-)
drivers/media/i2c/max9286.c +0 -2
@@ -1234,7 +1234,6 @@ static int max9286_parse_dt(struct max9286_priv *priv) i2c_mux_mask |=BIT (id); } -of_node_put (node);of_node_put (i2c_mux);/* Parse the endpoints */
@@ -1298,7 +1297,6 @@ static int max9286_parse_dt(struct max9286_priv *priv) priv->source_mask |=BIT (ep.port); priv->nsources++; } -of_node_put (node);/* * Parse the initial value of the reverse channel amplitude from
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 319/379 media: ov5640: Fix a memory leak when ov5640_probe fails
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiaolei Wang <[email protected]>
[ Upstream commit 20290feaaeb76cc719921aad275ccb18662a7c3a ]
sensor->ctrls.handler is initialized in ov5640_init_controls(), so when the sensor is not connected and ov5640_sensor_resume() fails, sensor->ctrls.handler should be released, otherwise a memory leak will be detected:
unreferenced object 0xc674ca80 (size 64):
comm "swapper/0", pid 1, jiffies 4294938337 (age 204.880s) hex dump (first 32 bytes):
80 55 75 c6 80 54 75 c6 00 55 75 c6 80 52 75 c6 .Uu..Tu..Uu..Ru.
00 53 75 c6 00 00 00 00 00 00 00 00 00 00 00 00 .Su..........--- drivers/media/i2c/ov5640.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/i2c/ov5640.c +3 -2
@@ -3909,7 +3909,7 @@ static int ov5640_probe(struct i2c_client *client) ret =ov5640_sensor_resume (dev);if (ret) {dev_err (dev,"failed to power on\n" ); - goto entity_cleanup; + goto free_ctrls; }pm_runtime_set_active (dev);
@@ -3933,8 +3933,9 @@ static int ov5640_probe(struct i2c_client *client) err_pm_runtime:pm_runtime_put_noidle (dev);pm_runtime_disable (dev); -v4l2_ctrl_handler_free (&sensor->ctrls.handler);ov5640_sensor_suspend (dev); +free_ctrls: +v4l2_ctrl_handler_free (&sensor->ctrls.handler); entity_cleanup:media_entity_cleanup (&sensor->sd.entity);mutex_destroy (&sensor->lock);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 320/379 media: bttv: fix use after free error due to btv->timeout timer
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zheng Wang <[email protected]>
[ Upstream commit bd5b50b329e850d467e7bcc07b2b6bde3752fbda ]
There may be some a race condition between timer function bttv_irq_timeout and bttv_remove. The timer is setup in probe and there is no timer_delete operation in remove function. When it hit kfree btv, the function might still be invoked, which will cause use after free bug.
This bug is found by static analysis, it may be false positive.
Fix it by adding del_timer_sync invoking to the remove function.
cpu0 cpu1
bttv_probe
->timer_setup
->bttv_set_dma
->mod_timer;
bttv_remove
->kfree(btv);
->bttv_irq_timeout
->USE btv--- drivers/media/pci/bt8xx/bttv-driver.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/pci/bt8xx/bttv-driver.c +1 -0
@@ -4248,6 +4248,7 @@ static void bttv_remove(struct pci_dev *pci_dev)/* free resources */ free_irq (btv->c.pci->irq,btv); +del_timer_sync (&btv->timeout);iounmap (btv->bt848_mmio);release_mem_region (pci_resource_start (btv->c.pci,0 ),pci_resource_len (btv->c.pci,0 ));
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 321/379 media: amphion: handle firmware debug message
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Qian <[email protected]>
[ Upstream commit 6496617b2b06d7004a5cbd53d48f19567d6b018c ]
decoder firmware may notify host some debug message, it can help analyze the state of the firmware in case of error
--- drivers/media/platform/amphion/vpu_defs.h | 1 + drivers/media/platform/amphion/vpu_helpers.c | 1 + drivers/media/platform/amphion/vpu_malone.c | 1 + drivers/media/platform/amphion/vpu_msgs.c | 31 ++++++++++++++++---- 4 files changed, 29 insertions(+), 5 deletions(-)
drivers/media/platform/amphion/vpu_defs.h +1 -0
@@ -71,6 +71,7 @@ enum {VPU_MSG_ID_TIMESTAMP_INFO ,VPU_MSG_ID_FIRMWARE_XCPT ,VPU_MSG_ID_PIC_SKIPPED , + VPU_MSG_ID_DBG_MSG, }; enum VPU_ENC_MEMORY_RESOURSE {
drivers/media/platform/amphion/vpu_helpers.c +1 -0
@@ -454,6 +454,7 @@ const char *vpu_id_name(u32 id)case VPU_MSG_ID_UNSUPPORTED :return "unsupported" ;case VPU_MSG_ID_FIRMWARE_XCPT :return "exception" ;case VPU_MSG_ID_PIC_SKIPPED :return "skipped" ; +case VPU_MSG_ID_DBG_MSG :return "debug msg" ; }return "<unknown>" ; }
drivers/media/platform/amphion/vpu_malone.c +1 -0
@@ -726,6 +726,7 @@ static struct vpu_pair malone_msgs[] = { {VPU_MSG_ID_UNSUPPORTED, VID_API_EVENT_UNSUPPORTED_STREAM}, {VPU_MSG_ID_FIRMWARE_XCPT, VID_API_EVENT_FIRMWARE_XCPT}, {VPU_MSG_ID_PIC_SKIPPED, VID_API_EVENT_PIC_SKIPPED}, + {VPU_MSG_ID_DBG_MSG, VID_API_EVENT_DBG_MSG_DEC}, }; static void vpu_malone_pack_fs_alloc(struct vpu_rpc_event *pkt,
drivers/media/platform/amphion/vpu_msgs.c +26 -5
@@ -23,6 +23,7 @@struct vpu_msg_handler {u32 id;void (*done)(struct vpu_inst *inst,struct vpu_rpc_event *pkt); +u32 is_str; };static void vpu_session_handle_start_done (struct vpu_inst *inst,struct vpu_rpc_event *pkt)
@@ -154,7 +155,7 @@ static void vpu_session_handle_error(struct vpu_inst *inst, struct vpu_rpc_event {char *str = (char *)pkt->data; -if (strlen (str)) +if (*str)dev_err (inst->dev,"instance %d firmware error : %s\n" , inst->id, str);else dev_err (inst->dev,"instance %d is unsupported stream\n" , inst->id);
@@ -180,6 +181,21 @@ static void vpu_session_handle_pic_skipped(struct vpu_inst *inst, struct vpu_rpcvpu_inst_unlock (inst); } +static void vpu_session_handle_dbg_msg (struct vpu_inst *inst,struct vpu_rpc_event *pkt) +{ +char *str = (char *)pkt->data; + +if (*str) +dev_info (inst->dev,"instance %d firmware dbg msg : %s\n" , inst->id, str); +} + +static void vpu_terminate_string_msg (struct vpu_rpc_event *pkt) +{ +if (pkt->hdr.num ==ARRAY_SIZE (pkt->data)) + pkt->hdr.num--; + pkt->data[pkt->hdr.num] =0 ; +} +static struct vpu_msg_handler handlers[] = { {VPU_MSG_ID_START_DONE , vpu_session_handle_start_done}, {VPU_MSG_ID_STOP_DONE , vpu_session_handle_stop_done},
@@ -193,9 +209,10 @@ static struct vpu_msg_handler handlers[] = { {VPU_MSG_ID_PIC_DECODED, vpu_session_handle_pic_decoded}, {VPU_MSG_ID_DEC_DONE, vpu_session_handle_pic_done}, {VPU_MSG_ID_PIC_EOS, vpu_session_handle_eos}, - {VPU_MSG_ID_UNSUPPORTED, vpu_session_handle_error}, - {VPU_MSG_ID_FIRMWARE_XCPT, vpu_session_handle_firmware_xcpt}, + {VPU_MSG_ID_UNSUPPORTED, vpu_session_handle_error, true}, + {VPU_MSG_ID_FIRMWARE_XCPT, vpu_session_handle_firmware_xcpt, true}, {VPU_MSG_ID_PIC_SKIPPED, vpu_session_handle_pic_skipped}, + {VPU_MSG_ID_DBG_MSG, vpu_session_handle_dbg_msg, true}, };static int vpu_session_handle_msg (struct vpu_inst *inst,struct vpu_rpc_event *msg)
@@ -219,8 +236,12 @@ static int vpu_session_handle_msg(struct vpu_inst *inst, struct vpu_rpc_event *m } } -if (handler && handler->done) - handler->done (inst, msg); +if (handler) { +if (handler->is_str) +vpu_terminate_string_msg (msg); +if (handler->done) + handler->done (inst, msg); + }vpu_response_cmd (inst, msg_id,1 );
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 322/379 media: mtk-jpegenc: Fix bug in JPEG encode quality selection
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fei Shao <[email protected]>
[ Upstream commit 0aeccc63f3bc4cfd49dc4893da1409402ee6b295 ]
The driver uses the upper-bound approach to decide the target JPEG encode quality, but there's a logic bug that if the desired quality is higher than what the driver can support, the driver falls back to using the worst quality.
Fix the bug by assuming using the best quality in the beginning, and with trivial refactor to avoid long lines.
--- drivers/media/platform/mediatek/jpeg/mtk_jpeg_enc_hw.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/media/platform/mediatek/jpeg/mtk_jpeg_enc_hw.c +3 -2
@@ -98,6 +98,7 @@ void mtk_jpeg_set_enc_params(struct mtk_jpeg_ctx *ctx, void __iomem *base)u32 img_stride;u32 mem_stride;u32 i, enc_quality; +u32 nr_enc_quality =ARRAY_SIZE (mtk_jpeg_enc_quality); value = width <<16 | height;writel (value, base +JPEG_ENC_IMG_SIZE );
@@ -128,8 +129,8 @@ void mtk_jpeg_set_enc_params(struct mtk_jpeg_ctx *ctx, void __iomem *base)writel (img_stride, base +JPEG_ENC_IMG_STRIDE );writel (mem_stride, base +JPEG_ENC_STRIDE ); - enc_quality = mtk_jpeg_enc_quality[0 ].hardware_value; -for (i =0 ; i <ARRAY_SIZE (mtk_jpeg_enc_quality); i++) { + enc_quality = mtk_jpeg_enc_quality[nr_enc_quality -1 ].hardware_value; +for (i =0 ; i < nr_enc_quality; i++) {if (ctx->enc_quality <= mtk_jpeg_enc_quality[i].quality_param) { enc_quality = mtk_jpeg_enc_quality[i].hardware_value;break ;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 323/379 media: s3c-camif: Avoid inappropriate kfree()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Katya Orlova <[email protected]>
[ Upstream commit 61334819aca018c3416ee6c330a08a49c1524fc3 ]
s3c_camif_register_video_node() works with video_device structure stored as a field of camif_vp, so it should not be kfreed.
But there is video_device_release() on error path that do it.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/media/platform/samsung/s3c-camif/camif-capture.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/media/platform/samsung/s3c-camif/camif-capture.c +2 -4
@@ -1132,12 +1132,12 @@ int s3c_camif_register_video_node(struct camif_dev *camif, int idx) ret =vb2_queue_init (q);if (ret) - goto err_vd_rel; +return ret; vp->pad.flags =MEDIA_PAD_FL_SINK ; ret =media_entity_pads_init (&vfd->entity,1 , &vp->pad);if (ret) - goto err_vd_rel; +return ret;video_set_drvdata (vfd, vp);
@@ -1170,8 +1170,6 @@ int s3c_camif_register_video_node(struct camif_dev *camif, int idx)v4l2_ctrl_handler_free (&vp->ctrl_handler); err_me_cleanup:media_entity_cleanup (&vfd->entity); -err_vd_rel: -video_device_release (vfd);return ret; }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 324/379 media: vidtv: psi: Add check for kstrdup
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiasheng Jiang <[email protected]>
[ Upstream commit 76a2c5df6ca8bd8ada45e953b8c72b746f42918d ]
Add check for the return value of kstrdup() and return the error if it fails in order to avoid NULL pointer dereference.
--- drivers/media/test-drivers/vidtv/vidtv_psi.c | 45 +++++++++++++++++--- 1 file changed, 40 insertions(+), 5 deletions(-)
drivers/media/test-drivers/vidtv/vidtv_psi.c +40 -5
@@ -301,16 +301,29 @@ struct vidtv_psi_desc_service *vidtv_psi_service_desc_init(struct vidtv_psi_desc desc->service_name_len = service_name_len; -if (service_name && service_name_len) +if (service_name && service_name_len) { desc->service_name =kstrdup (service_name,GFP_KERNEL ); +if (!desc->service_name) + goto free_desc; + } desc->provider_name_len = provider_name_len; -if (provider_name && provider_name_len) +if (provider_name && provider_name_len) { desc->provider_name =kstrdup (provider_name,GFP_KERNEL ); +if (!desc->provider_name) + goto free_desc_service_name; + }vidtv_psi_desc_chain (head, (struct vidtv_psi_desc *)desc);return desc; + +free_desc_service_name: +if (service_name && service_name_len) +kfree (desc->service_name); +free_desc: +kfree (desc); +return NULL ; }struct vidtv_psi_desc_registration
@@ -355,8 +368,13 @@ struct vidtv_psi_desc_network_name desc->length = network_name_len; -if (network_name && network_name_len) +if (network_name && network_name_len) { desc->network_name =kstrdup (network_name,GFP_KERNEL ); +if (!desc->network_name) { +kfree (desc); +return NULL ; + } + }vidtv_psi_desc_chain (head, (struct vidtv_psi_desc *)desc);return desc;
@@ -442,15 +460,32 @@ struct vidtv_psi_desc_short_event iso_language_code ="eng" ; desc->iso_language_code =kstrdup (iso_language_code,GFP_KERNEL ); +if (!desc->iso_language_code) + goto free_desc; -if (event_name && event_name_len) +if (event_name && event_name_len) { desc->event_name =kstrdup (event_name,GFP_KERNEL ); +if (!desc->event_name) + goto free_desc_language_code; + } -if (text && text_len) +if (text && text_len) { desc->text =kstrdup (text,GFP_KERNEL ); +if (!desc->text) + goto free_desc_event_name; + }vidtv_psi_desc_chain (head, (struct vidtv_psi_desc *)desc);return desc; + +free_desc_event_name: +if (event_name && event_name_len) +kfree (desc->event_name); +free_desc_language_code: +kfree (desc->iso_language_code); +free_desc: +kfree (desc); +return NULL ; }struct vidtv_psi_desc *vidtv_psi_desc_clone (struct vidtv_psi_desc *desc)
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 325/379 media: vidtv: mux: Add check and kfree for kstrdup
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiasheng Jiang <[email protected]>
[ Upstream commit 1fd6eb12642e0c32692924ff359c07de4b781d78 ]
Add check for the return value of kstrdup() and return the error if it fails in order to avoid NULL pointer dereference. Moreover, use kfree() in the later error handling in order to avoid memory leak.
--- drivers/media/test-drivers/vidtv/vidtv_mux.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/media/test-drivers/vidtv/vidtv_mux.c +6 -1
@@ -504,13 +504,16 @@ struct vidtv_mux *vidtv_mux_init(struct dvb_frontend *fe, m->priv = args->priv; m->network_id = args->network_id; m->network_name =kstrdup (args->network_name,GFP_KERNEL ); +if (!m->network_name) + goto free_mux_buf; + m->timing.current_jiffies =get_jiffies_64 ();if (args->channels) m->channels = args->channels;else if (vidtv_channels_init (m) <0 ) - goto free_mux_buf; + goto free_mux_network_name;/* will alloc data for pmt_sections after initializing pat */ if (vidtv_channel_si_init (m) <0 )
@@ -527,6 +530,8 @@ struct vidtv_mux *vidtv_mux_init(struct dvb_frontend *fe,vidtv_channel_si_destroy (m); free_channels:vidtv_channels_destroy (m); +free_mux_network_name: +kfree (m->network_name); free_mux_buf:vfree (m->mux_buf); free_mux:
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 326/379 media: cedrus: Fix clock/reset sequence
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jernej Skrabec <[email protected]>
[ Upstream commit 36fe515c1a3cd5eac148e8a591a82108d92d5522 ]
According to H6 user manual, resets should always be de-asserted before clocks are enabled. This is also consistent with vendor driver.
--- .../staging/media/sunxi/cedrus/cedrus_hw.c | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/staging/media/sunxi/cedrus/cedrus_hw.c +12 -12
@@ -172,12 +172,12 @@ int cedrus_hw_suspend(struct device *device) {struct cedrus_dev *dev =dev_get_drvdata (device); -reset_control_assert (dev->rstc); -clk_disable_unprepare (dev->ram_clk);clk_disable_unprepare (dev->mod_clk);clk_disable_unprepare (dev->ahb_clk); +reset_control_assert (dev->rstc); +return 0 ; }
@@ -186,11 +186,18 @@ int cedrus_hw_resume(struct device *device)struct cedrus_dev *dev =dev_get_drvdata (device);int ret; + ret =reset_control_reset (dev->rstc); +if (ret) { +dev_err (dev->dev,"Failed to apply reset\n" ); + +return ret; + } + ret =clk_prepare_enable (dev->ahb_clk);if (ret) {dev_err (dev->dev,"Failed to enable AHB clock\n" ); -return ret; + goto err_rst; } ret =clk_prepare_enable (dev->mod_clk);
@@ -207,21 +214,14 @@ int cedrus_hw_resume(struct device *device) goto err_mod_clk; } - ret =reset_control_reset (dev->rstc); -if (ret) { -dev_err (dev->dev,"Failed to apply reset\n" ); - - goto err_ram_clk; - } -return 0 ; -err_ram_clk: -clk_disable_unprepare (dev->ram_clk); err_mod_clk:clk_disable_unprepare (dev->mod_clk); err_ahb_clk:clk_disable_unprepare (dev->ahb_clk); +err_rst: +reset_control_assert (dev->rstc);return ret; }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 327/379 media: cadence: csi2rx: Unregister v4l2 async notifier
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pratyush Yadav <[email protected]>
[ Upstream commit b2701715301a49b53d05c7d43f3fedc3b8743bfc ]
The notifier is added to the global notifier list when registered. When the module is removed, the struct csi2rx_priv in which the notifier is embedded, is destroyed. As a result the notifier list has a reference to a notifier that no longer exists. This causes invalid memory accesses when the list is iterated over. Similar for when the probe fails. Unregister and clean up the notifier to avoid this.
--- drivers/media/platform/cadence/cdns-csi2rx.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/media/platform/cadence/cdns-csi2rx.c +6 -1
@@ -404,8 +404,10 @@ static int csi2rx_parse_dt(struct csi2rx_priv *csi2rx) asd =v4l2_async_nf_add_fwnode_remote (&csi2rx->notifier, fwh, struct v4l2_async_subdev);of_node_put (ep); -if (IS_ERR (asd)) +if (IS_ERR (asd)) { +v4l2_async_nf_cleanup (&csi2rx->notifier);return PTR_ERR (asd); + } csi2rx->notifier.ops = &csi2rx_notifier_ops;
@@ -467,6 +469,7 @@ static int csi2rx_probe(struct platform_device *pdev)return 0 ; err_cleanup: +v4l2_async_nf_unregister (&csi2rx->notifier);v4l2_async_nf_cleanup (&csi2rx->notifier); err_free_priv:kfree (csi2rx);
@@ -477,6 +480,8 @@ static int csi2rx_remove(struct platform_device *pdev) {struct csi2rx_priv *csi2rx =platform_get_drvdata (pdev); +v4l2_async_nf_unregister (&csi2rx->notifier); +v4l2_async_nf_cleanup (&csi2rx->notifier);v4l2_async_unregister_subdev (&csi2rx->subdev);kfree (csi2rx);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 328/379 media: dvb-usb-v2: af9035: fix missing unlock
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Verkuil <[email protected]>
[ Upstream commit f31b2cb85f0ee165d78e1c43f6d69f82cc3b2145 ]
Instead of returning an error, goto the mutex unlock at the end of the function.
Fixes smatch warning:
drivers/media/usb/dvb-usb-v2/af9035.c:467 af9035_i2c_master_xfer() warn: inconsistent returns '&d->i2c_mutex'.
Locked on : 326,387
Unlocked on: 465,467
--- drivers/media/usb/dvb-usb-v2/af9035.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/media/usb/dvb-usb-v2/af9035.c +9 -4
@@ -323,8 +323,10 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, ret = -EOPNOTSUPP ; }else if ((msg[0 ].addr == state->af9033_i2c_addr[0 ]) || (msg[0 ].addr == state->af9033_i2c_addr[1 ])) { -if (msg[0 ].len <3 || msg[1 ].len <1 ) -return -EOPNOTSUPP ; +if (msg[0 ].len <3 || msg[1 ].len <1 ) { + ret = -EOPNOTSUPP ; + goto unlock; + }/* demod access via firmware interface */ reg = msg[0 ].buf[0 ] <<16 | msg[0 ].buf[1 ] <<8 | msg[0 ].buf[2 ];
@@ -384,8 +386,10 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, ret = -EOPNOTSUPP ; }else if ((msg[0 ].addr == state->af9033_i2c_addr[0 ]) || (msg[0 ].addr == state->af9033_i2c_addr[1 ])) { -if (msg[0 ].len <3 ) -return -EOPNOTSUPP ; +if (msg[0 ].len <3 ) { + ret = -EOPNOTSUPP ; + goto unlock; + }/* demod access via firmware interface */ reg = msg[0 ].buf[0 ] <<16 | msg[0 ].buf[1 ] <<8 | msg[0 ].buf[2 ];
@@ -460,6 +464,7 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, ret = -EOPNOTSUPP ; } +unlock:mutex_unlock (&d->i2c_mutex);if (ret <0 )
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 329/379 media: cec: meson: always include meson sub-directory in Makefile
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Szyprowski <[email protected]>
[ Upstream commit 94e27fbeca27d8c772fc2bc807730aaee5886055 ]
'meson' directory contains two separate drivers, so it should be added to Makefile compilation hierarchy unconditionally, because otherwise the meson-ao-cec-g12a won't be compiled if meson-ao-cec is not selected.
--- drivers/media/cec/platform/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/cec/platform/Makefile +1 -1
@@ -6,7 +6,7 @@ # Please keep it in alphabetic order obj-$(CONFIG_CEC_CROS_EC) += cros-ec/ obj-$(CONFIG_CEC_GPIO) += cec-gpio/ -obj-$(CONFIG_CEC_MESON_AO) += meson/ +obj-y += meson/ obj-$(CONFIG_CEC_SAMSUNG_S5P) += s5p/ obj-$(CONFIG_CEC_SECO) += seco/ obj-$(CONFIG_CEC_STI) += sti/
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 330/379 regmap: prevent noinc writes from clobbering cache
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Wolsieffer <[email protected]>
[ Upstream commit 984a4afdc87a1fc226fd657b1cd8255c13d3fc1a ]
Currently, noinc writes are cached as if they were standard incrementing writes, overwriting unrelated register values in the cache. Instead, we want to cache the last value written to the register, as is done in the accelerated noinc handler (regmap_noinc_readwrite).
--- drivers/base/regmap/regmap.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/base/regmap/regmap.c +9 -7
@@ -1702,17 +1702,19 @@ static int _regmap_raw_write_impl(struct regmap *map, unsigned int reg, }if (!map->cache_bypass && map->format.parse_val) { -unsigned int ival; +unsigned int ival, offset;int val_bytes = map->format.val_bytes; -for (i =0 ; i < val_len / val_bytes; i++) { - ival = map->format.parse_val (val + (i * val_bytes)); - ret =regcache_write (map, - reg +regmap_get_offset (map, i), - ival); + +/* Cache the last written value for noinc writes */ + i = noinc ? val_len - val_bytes :0 ; +for (; i < val_len; i += val_bytes) { + ival = map->format.parse_val (val + i); + offset = noinc ?0 :regmap_get_offset (map, i / val_bytes); + ret =regcache_write (map, reg + offset, ival);if (ret) {dev_err (map->dev,"Error in caching of register: %x ret: %d\n" , - reg +regmap_get_offset (map, i), ret); + reg + offset, ret);return ret; } }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 331/379 pwm: sti: Reduce number of allocations and drop usage of chip_data
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 2d6812b41e0d832919d72c72ebddf361df53ba1b ]
Instead of using one allocation per capture channel, use a single one. Also store it in driver data instead of chip data.
This has several advantages:
- driver data isn't cleared when pwm_put() is called
- Reduces memory fragmentation
Also register the pwm chip only after the per capture channel data is initialized as the capture callback relies on this initialization and it might be called even before pwmchip_add() returns.
It would be still better to have struct sti_pwm_compat_data and the per-channel data struct sti_cpt_ddata in a single memory chunk, but that's not easily possible because the number of capture channels isn't known yet when the driver data struct is allocated.
--- drivers/pwm/pwm-sti.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-)
drivers/pwm/pwm-sti.c +14 -15
@@ -79,6 +79,7 @@ struct sti_pwm_compat_data {unsigned int cpt_num_devs;unsigned int max_pwm_cnt;unsigned int max_prescale; +struct sti_cpt_ddata *ddata; };struct sti_pwm_chip {
@@ -314,7 +315,7 @@ static int sti_pwm_capture(struct pwm_chip *chip, struct pwm_device *pwm, {struct sti_pwm_chip *pc =to_sti_pwmchip (chip);struct sti_pwm_compat_data *cdata = pc->cdata; -struct sti_cpt_ddata *ddata =pwm_get_chip_data (pwm); +struct sti_cpt_ddata *ddata = &cdata->ddata[pwm->hwpwm];struct device *dev = pc->dev;unsigned int effective_ticks;unsigned long long high, low;
@@ -440,7 +441,7 @@ static irqreturn_t sti_pwm_interrupt(int irq, void *data)while (cpt_int_stat) { devicenum =ffs (cpt_int_stat) -1 ; - ddata =pwm_get_chip_data (&pc->chip.pwms[devicenum]); + ddata = &pc->cdata->ddata[devicenum];/* * Capture input:
@@ -638,30 +639,28 @@ static int sti_pwm_probe(struct platform_device *pdev)dev_err (dev,"failed to prepare clock\n" );return ret; } + + cdata->ddata =devm_kzalloc (dev, cdata->cpt_num_devs *sizeof (*cdata->ddata),GFP_KERNEL ); +if (!cdata->ddata) +return -ENOMEM ; } pc->chip.dev = dev; pc->chip.ops = &sti_pwm_ops; pc->chip.npwm = pc->cdata->pwm_num_devs; - ret =pwmchip_add (&pc->chip); -if (ret <0 ) { -clk_unprepare (pc->pwm_clk); -clk_unprepare (pc->cpt_clk); -return ret; - } -for (i =0 ; i < cdata->cpt_num_devs; i++) { -struct sti_cpt_ddata *ddata; - - ddata =devm_kzalloc (dev,sizeof (*ddata),GFP_KERNEL ); -if (!ddata) -return -ENOMEM ; +struct sti_cpt_ddata *ddata = &cdata->ddata[i];init_waitqueue_head (&ddata->wait);mutex_init (&ddata->lock); + } -pwm_set_chip_data (&pc->chip.pwms[i], ddata); + ret =pwmchip_add (&pc->chip); +if (ret <0 ) { +clk_unprepare (pc->pwm_clk); +clk_unprepare (pc->cpt_clk); +return ret; }platform_set_drvdata (pdev, pc);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 332/379 pwm: brcmstb: Utilize appropriate clock APIs in suspend/resume
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Fainelli <[email protected]>
[ Upstream commit e9bc4411548aaa738905d37851a0146c16b3bb21 ]
The suspend/resume functions currently utilize clk_disable()/clk_enable() respectively which may be no-ops with certain clock providers such as SCMI. Fix this to use clk_disable_unprepare() and clk_prepare_enable() respectively as we should.
--- drivers/pwm/pwm-brcmstb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pwm/pwm-brcmstb.c +2 -2
@@ -290,7 +290,7 @@ static int brcmstb_pwm_suspend(struct device *dev) {struct brcmstb_pwm *p =dev_get_drvdata (dev); -clk_disable (p->clk); +clk_disable_unprepare (p->clk);return 0 ; }
@@ -299,7 +299,7 @@ static int brcmstb_pwm_resume(struct device *dev) {struct brcmstb_pwm *p =dev_get_drvdata (dev); -clk_enable (p->clk); +clk_prepare_enable (p->clk);return 0 ; }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 333/379 Input: synaptics-rmi4 - fix use after free in rmi_unregister_function()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit eb988e46da2e4eae89f5337e047ce372fe33d5b1 ]
The put_device() calls rmi_release_function() which frees "fn" so the dereference on the next line "fn->num_of_irqs" is a use after free. Move the put_device() to the end to fix this.
--- drivers/input/rmi4/rmi_bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/rmi4/rmi_bus.c +1 -1
@@ -277,11 +277,11 @@ void rmi_unregister_function(struct rmi_function *fn)device_del (&fn->dev);of_node_put (fn->dev.of_node); -put_device (&fn->dev);for (i =0 ; i < fn->num_of_irqs; i++)irq_dispose_mapping (fn->irq[i]); +put_device (&fn->dev); }/**
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 334/379 watchdog: ixp4xx: Make sure restart always works
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <[email protected]>
[ Upstream commit b4075ecfe348a44209534c75ad72392c63a489a6 ]
The IXP4xx watchdog in early "A0" silicon is unreliable and cannot be registered, however for some systems such as the USRobotics USR8200 the watchdog is the only restart option, so implement a "dummy" watchdog that can only support restart in this case.
--- drivers/watchdog/ixp4xx_wdt.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-)
drivers/watchdog/ixp4xx_wdt.c +25 -3
@@ -105,6 +105,25 @@ static const struct watchdog_ops ixp4xx_wdt_ops = { .owner = THIS_MODULE, }; +/* +* The A0 version of the IXP422 had a bug in the watchdog making +* is useless, but we still need to use it to restart the system +* as it is the only way, so in this special case we register a +* "dummy" watchdog that doesn't really work, but will support +* the restart operation. +*/ +static int ixp4xx_wdt_dummy (struct watchdog_device *wdd) +{ +return 0 ; +} + +static const struct watchdog_ops ixp4xx_wdt_restart_only_ops = { + .start = ixp4xx_wdt_dummy, + .stop = ixp4xx_wdt_dummy, + .restart = ixp4xx_wdt_restart, + .owner =THIS_MODULE , +}; +static const struct watchdog_info ixp4xx_wdt_info = { .options =WDIOF_KEEPALIVEPING |WDIOF_MAGICCLOSE
@@ -120,14 +139,17 @@ static void ixp4xx_clock_action(void *d)static int ixp4xx_wdt_probe (struct platform_device *pdev) { +static const struct watchdog_ops *iwdt_ops;struct device *dev = &pdev->dev;struct ixp4xx_wdt *iwdt;struct clk *clk;int ret;if (!(read_cpuid_id () &0xf ) && !cpu_is_ixp46x ()) { -dev_err (dev,"Rev. A0 IXP42x CPU detected - watchdog disabled\n" ); -return -ENODEV ; +dev_info (dev,"Rev. A0 IXP42x CPU detected - only restart supported\n" ); + iwdt_ops = &ixp4xx_wdt_restart_only_ops; + }else { + iwdt_ops = &ixp4xx_wdt_ops; } iwdt =devm_kzalloc (dev,sizeof (*iwdt),GFP_KERNEL );
@@ -153,7 +175,7 @@ static int ixp4xx_wdt_probe(struct platform_device *pdev) iwdt->rate =IXP4XX_TIMER_FREQ ; iwdt->wdd.info = &ixp4xx_wdt_info; - iwdt->wdd.ops = &ixp4xx_wdt_ops; + iwdt->wdd.ops = iwdt_ops; iwdt->wdd.min_timeout =1 ; iwdt->wdd.max_timeout =U32_MAX / iwdt->rate; iwdt->wdd.parent = dev;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 335/379 llc: verify mac len before reading mac header
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Willem de Bruijn <[email protected]>
[ Upstream commit 7b3ba18703a63f6fd487183b9262b08e5632da1b ]
LLC reads the mac header with eth_hdr without verifying that the skb has an Ethernet header.
Syzbot was able to enter llc_rcv on a tun device. Tun can insert packets without mac len and with user configurable skb->protocol (passing a tun_pi header when not configuring IFF_NO_PI).
BUG: KMSAN: uninit-value in llc_station_ac_send_test_r net/llc/llc_station.c:81 [inline]
BUG: KMSAN: uninit-value in llc_station_rcv+0x6fb/0x1290 net/llc/llc_station.c:111
llc_station_ac_send_test_r net/llc/llc_station.c:81 [inline]
llc_station_rcv+0x6fb/0x1290 net/llc/llc_station.c:111
llc_rcv+0xc5d/0x14a0 net/llc/llc_input.c:218
__netif_receive_skb_one_core net/core/dev.c:5523 [inline]
__netif_receive_skb+0x1a6/0x5a0 net/core/dev.c:5637
netif_receive_skb_internal net/core/dev.c:5723 [inline]
netif_receive_skb+0x58/0x660 net/core/dev.c:5782
tun_rx_batched+0x3ee/0x980 drivers/net/tun.c:1555
tun_get_user+0x54c5/0x69c0 drivers/net/tun.c:2002Add a mac_len test before all three eth_hdr(skb) calls under net/llc.
There are further uses in include/net/llc_pdu.h. All these are protected by a test skb->protocol == ETH_P_802_2. Which does not protect against this tun scenario.
But the mac_len test added in this patch in llc_fixup_skb will indirectly protect those too. That is called from llc_rcv before any other LLC code.
It is tempting to just add a blanket mac_len check in llc_rcv, but not sure whether that could break valid LLC paths that do not assume an Ethernet header. 802.2 LLC may be used on top of non-802.3 protocols in principle. The below referenced commit shows that used to, on top of Token Ring.
At least one of the three eth_hdr uses goes back to before the start of git history. But the one that syzbot exercises is introduced in this commit. That commit is old enough (2008), that effectively all stable kernels should receive this.
--- net/llc/llc_input.c | 10 ++++++++-- net/llc/llc_s_ac.c | 3 +++ net/llc/llc_station.c | 3 +++ 3 files changed, 14 insertions(+), 2 deletions(-)
net/llc/llc_input.c +8 -2
@@ -127,8 +127,14 @@ static inline int llc_fixup_skb(struct sk_buff *skb) skb->transport_header += llc_len;skb_pull (skb, llc_len);if (skb->protocol ==htons (ETH_P_802_2 )) { -__be16 pdulen =eth_hdr (skb)->h_proto; -s32 data_size =ntohs (pdulen) - llc_len; +__be16 pdulen; +s32 data_size; + +if (skb->mac_len <ETH_HLEN ) +return 0 ; + + pdulen =eth_hdr (skb)->h_proto; + data_size =ntohs (pdulen) - llc_len;if (data_size <0 || !pskb_may_pull (skb, data_size))
net/llc/llc_s_ac.c +3 -0
@@ -153,6 +153,9 @@ int llc_sap_action_send_test_r(struct llc_sap *sap, struct sk_buff *skb)int rc =1 ;u32 data_size; +if (skb->mac_len <ETH_HLEN ) +return 1 ; +llc_pdu_decode_sa (skb, mac_da);llc_pdu_decode_da (skb, mac_sa);llc_pdu_decode_ssap (skb, &dsap);
net/llc/llc_station.c +3 -0
@@ -76,6 +76,9 @@ static int llc_station_ac_send_test_r(struct sk_buff *skb)u32 data_size;struct sk_buff *nskb; +if (skb->mac_len <ETH_HLEN ) + goto out; +/* The test request command is type U (llc_len = 3) */ data_size =ntohs (eth_hdr (skb)->h_proto) -3 ; nskb =llc_alloc_frame (NULL , skb->dev,LLC_PDU_TYPE_U , data_size);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 336/379 hsr: Prevent use after free in prp_create_tagged_frame()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 876f8ab52363f649bcc74072157dfd7adfbabc0d ]
The prp_fill_rct() function can fail. In that situation, it frees the skb and returns NULL. Meanwhile on the success path, it returns the original skb. So it's straight forward to fix bug by using the returned value.
--- net/hsr/hsr_forward.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
net/hsr/hsr_forward.c +1 -3
@@ -342,9 +342,7 @@ struct sk_buff *prp_create_tagged_frame(struct hsr_frame_info *frame, skb =skb_copy_expand (frame->skb_std,0 ,skb_tailroom (frame->skb_std) +HSR_HLEN ,GFP_ATOMIC ); -prp_fill_rct (skb, frame, port); - -return skb; +return prp_fill_rct (skb, frame, port); } static void hsr_deliver_master(struct sk_buff *skb, struct net_device *dev,
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 337/379 tipc: Change nla_policy for bearer-related names to NLA_NUL_STRING
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shigeru Yoshida <[email protected]>
[ Upstream commit 19b3f72a41a8751e26bffc093bb7e1cef29ad579 ]
syzbot reported the following uninit-value access issue [1]:
=====================================================
BUG: KMSAN: uninit-value in strlen lib/string.c:418 [inline] BUG: KMSAN: uninit-value in strstr+0xb8/0x2f0 lib/string.c:756 strlen lib/string.c:418 [inline] strstr+0xb8/0x2f0 lib/string.c:756 tipc_nl_node_reset_link_stats+0x3ea/0xb50 net/tipc/node.c:2595 genl_family_rcv_msg_doit net/netlink/genetlink.c:971 [inline] genl_family_rcv_msg net/netlink/genetlink.c:1051 [inline] genl_rcv_msg+0x11ec/0x1290 net/netlink/genetlink.c:1066 netlink_rcv_skb+0x371/0x650 net/netlink/af_netlink.c:2545 genl_rcv+0x40/0x60 net/netlink/genetlink.c:1075 netlink_unicast_kernel net/netlink/af_netlink.c:1342 [inline] netlink_unicast+0xf47/0x1250 net/netlink/af_netlink.c:1368 netlink_sendmsg+0x1238/0x13d0 net/netlink/af_netlink.c:1910 sock_sendmsg_nosec net/socket.c:730 [inline] sock_sendmsg net/socket.c:753 [inline] ____sys_sendmsg+0x9c2/0xd60 net/socket.c:2541 ___sys_sendmsg+0x28d/0x3c0 net/socket.c:2595 __sys_sendmsg net/socket.c:2624 [inline] __do_sys_sendmsg net/socket.c:2633 [inline] __se_sys_sendmsg net/socket.c:2631 [inline] __x64_sys_sendmsg+0x307/0x490 net/socket.c:2631 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd
Uninit was created at:
slab_post_alloc_hook+0x12f/0xb70 mm/slab.h:767 slab_alloc_node mm/slub.c:3478 [inline] kmem_cache_alloc_node+0x577/0xa80 mm/slub.c:3523 kmalloc_reserve+0x13d/0x4a0 net/core/skbuff.c:559 __alloc_skb+0x318/0x740 net/core/skbuff.c:650 alloc_skb include/linux/skbuff.h:1286 [inline] netlink_alloc_large_skb net/netlink/af_netlink.c:1214 [inline] netlink_sendmsg+0xb34/0x13d0 net/netlink/af_netlink.c:1885 sock_sendmsg_nosec net/socket.c:730 [inline] sock_sendmsg net/socket.c:753 [inline] ____sys_sendmsg+0x9c2/0xd60 net/socket.c:2541 ___sys_sendmsg+0x28d/0x3c0 net/socket.c:2595 __sys_sendmsg net/socket.c:2624 [inline] __do_sys_sendmsg net/socket.c:2633 [inline] __se_sys_sendmsg net/socket.c:2631 [inline] __x64_sys_sendmsg+0x307/0x490 net/socket.c:2631 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd
TIPC bearer-related names including link names must be null-terminated strings. If a link name which is not null-terminated is passed through netlink, strstr() and similar functions can cause buffer overrun. This causes the above issue.
This patch changes the nla_policy for bearer-related names from NLA_STRING to NLA_NUL_STRING. This resolves the issue by ensuring that only null-terminated strings are accepted as bearer-related names.
syzbot reported similar uninit-value issue related to bearer names [2]. The root cause of this issue is that a non-null-terminated bearer name was passed. This patch also resolved this issue.
--- net/tipc/netlink.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/tipc/netlink.c +2 -2
@@ -88,7 +88,7 @@ const struct nla_policy tipc_nl_net_policy[TIPC_NLA_NET_MAX + 1] = {const struct nla_policy tipc_nl_link_policy[TIPC_NLA_LINK_MAX +1 ] = { [TIPC_NLA_LINK_UNSPEC ] = { .type =NLA_UNSPEC }, - [TIPC_NLA_LINK_NAME ] = { .type =NLA_STRING , + [TIPC_NLA_LINK_NAME ] = { .type =NLA_NUL_STRING , .len =TIPC_MAX_LINK_NAME }, [TIPC_NLA_LINK_MTU ] = { .type =NLA_U32 }, [TIPC_NLA_LINK_BROADCAST ] = { .type =NLA_FLAG },
@@ -125,7 +125,7 @@ const struct nla_policy tipc_nl_prop_policy[TIPC_NLA_PROP_MAX + 1] = {const struct nla_policy tipc_nl_bearer_policy[TIPC_NLA_BEARER_MAX +1 ] = { [TIPC_NLA_BEARER_UNSPEC ] = { .type =NLA_UNSPEC }, - [TIPC_NLA_BEARER_NAME ] = { .type =NLA_STRING , + [TIPC_NLA_BEARER_NAME ] = { .type =NLA_NUL_STRING , .len =TIPC_MAX_BEARER_NAME }, [TIPC_NLA_BEARER_PROP ] = { .type =NLA_NESTED }, [TIPC_NLA_BEARER_DOMAIN ] = { .type =NLA_U32 }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 338/379 bpf: Check map->usercnt after timer->timer is assigned
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hou Tao <[email protected]>
[ Upstream commit fd381ce60a2d79cc967506208085336d3d268ae0 ]
When there are concurrent uref release and bpf timer init operations, the following sequence diagram is possible. It will break the guarantee provided by bpf_timer: bpf_timer will still be alive after userspace application releases or unpins the map. It also will lead to kmemleak for old kernel version which doesn't release bpf_timer when map is released.
bpf program X:
bpf_timer_init()
lock timer->lock
read timer->timer as NULL
read map->usercnt != 0
process Y:
close(map_fd)
// put last uref
bpf_map_put_uref()
atomic_dec_and_test(map->usercnt)
array_map_free_timers()
bpf_timer_cancel_and_free()
// just return
read timer->timer is NULL
t = bpf_map_kmalloc_node()
timer->timer = t unlock timer->lock
Fix the problem by checking map->usercnt after timer->timer is assigned, so when there are concurrent uref release and bpf timer init, either bpf_timer_cancel_and_free() from uref release reads a no-NULL timer or the newly-added atomic64_read() returns a zero usercnt.
Because atomic_dec_and_test(map->usercnt) and READ_ONCE(timer->timer) in bpf_timer_cancel_and_free() are not protected by a lock, so add a memory barrier to guarantee the order between map->usercnt and timer->timer. Also use WRITE_ONCE(timer->timer, x) to match the lockless read of timer->timer in bpf_timer_cancel_and_free().
--- kernel/bpf/helpers.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)
kernel/bpf/helpers.c +16 -9
@@ -1156,13 +1156,6 @@ BPF_CALL_3(bpf_timer_init, struct bpf_timer_kern *, timer, struct bpf_map *, map ret = -EBUSY ; goto out; } -if (!atomic64_read (&map->usercnt)) { -/* maps with timers must be either held by user space -* or pinned in bpffs. -*/ - ret = -EPERM ; - goto out; - }/* allocate hrtimer via map_kmalloc to use memcg accounting */ t =bpf_map_kmalloc_node (map,sizeof (*t),GFP_ATOMIC , map->numa_node);if (!t) {
@@ -1175,7 +1168,21 @@ BPF_CALL_3(bpf_timer_init, struct bpf_timer_kern *, timer, struct bpf_map *, maprcu_assign_pointer (t->callback_fn,NULL );hrtimer_init (&t->timer, clockid,HRTIMER_MODE_REL_SOFT ); t->timer.function = bpf_timer_cb; - timer->timer = t; +WRITE_ONCE (timer->timer, t); +/* Guarantee the order between timer->timer and map->usercnt. So +* when there are concurrent uref release and bpf timer init, either +* bpf_timer_cancel_and_free() called by uref release reads a no-NULL +* timer or atomic64_read() below returns a zero usercnt. +*/ +smp_mb (); +if (!atomic64_read (&map->usercnt)) { +/* maps with timers must be either held by user space +* or pinned in bpffs. +*/ +WRITE_ONCE (timer->timer,NULL ); +kfree (t); + ret = -EPERM ; + } out:__bpf_spin_unlock_irqrestore (&timer->lock);return ret;
@@ -1343,7 +1350,7 @@ void bpf_timer_cancel_and_free(void *val)/* The subsequent bpf_timer_start/cancel() helpers won't be able to use * this timer, since it won't be initialized. */ - timer->timer =NULL ; +WRITE_ONCE (timer->timer,NULL ); out:__bpf_spin_unlock_irqrestore (&timer->lock);if (!t)
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 339/379 inet: shrink struct flowi_common
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 1726483b79a72e0150734d5367e4a0238bf8fcff ]
I am looking at syzbot reports triggering kernel stack overflows involving a cascade of ipvlan devices.
We can save 8 bytes in struct flowi_common.
This patch alone will not fix the issue, but is a start.
--- include/net/flow.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/flow.h +1 -1
@@ -39,8 +39,8 @@ struct flowi_common {#define FLOWI_FLAG_KNOWN_NH 0x02__u32 flowic_secid;kuid_t flowic_uid; -struct flowi_tunnel flowic_tun_key;__u32 flowic_multipath_hash; +struct flowi_tunnel flowic_tun_key; };union flowi_uli {
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 340/379 octeontx2-pf: Fix error codes
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ratheesh Kannoth <[email protected]>
[ Upstream commit 96b9a68d1a6e4f889d453874c9e359aa720b520f ]
Some of error codes were wrong. Fix the same.
--- .../marvell/octeontx2/nic/otx2_struct.h | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_struct.h +17 -17
@@ -318,23 +318,23 @@ enum nix_snd_status_e {NIX_SND_STATUS_EXT_ERR =0x6 ,NIX_SND_STATUS_JUMP_FAULT =0x7 ,NIX_SND_STATUS_JUMP_POISON =0x8 , -NIX_SND_STATUS_CRC_ERR =0x9 , -NIX_SND_STATUS_IMM_ERR =0x10 , -NIX_SND_STATUS_SG_ERR =0x11 , -NIX_SND_STATUS_MEM_ERR =0x12 , -NIX_SND_STATUS_INVALID_SUBDC =0x13 , -NIX_SND_STATUS_SUBDC_ORDER_ERR =0x14 , -NIX_SND_STATUS_DATA_FAULT =0x15 , -NIX_SND_STATUS_DATA_POISON =0x16 , -NIX_SND_STATUS_NPC_DROP_ACTION =0x17 , -NIX_SND_STATUS_LOCK_VIOL =0x18 , -NIX_SND_STATUS_NPC_UCAST_CHAN_ERR =0x19 , -NIX_SND_STATUS_NPC_MCAST_CHAN_ERR =0x20 , -NIX_SND_STATUS_NPC_MCAST_ABORT =0x21 , -NIX_SND_STATUS_NPC_VTAG_PTR_ERR =0x22 , -NIX_SND_STATUS_NPC_VTAG_SIZE_ERR =0x23 , -NIX_SND_STATUS_SEND_MEM_FAULT =0x24 , -NIX_SND_STATUS_SEND_STATS_ERR =0x25 , +NIX_SND_STATUS_CRC_ERR =0x10 , +NIX_SND_STATUS_IMM_ERR =0x11 , +NIX_SND_STATUS_SG_ERR =0x12 , +NIX_SND_STATUS_MEM_ERR =0x13 , +NIX_SND_STATUS_INVALID_SUBDC =0x14 , +NIX_SND_STATUS_SUBDC_ORDER_ERR =0x15 , +NIX_SND_STATUS_DATA_FAULT =0x16 , +NIX_SND_STATUS_DATA_POISON =0x17 , +NIX_SND_STATUS_NPC_DROP_ACTION =0x20 , +NIX_SND_STATUS_LOCK_VIOL =0x21 , +NIX_SND_STATUS_NPC_UCAST_CHAN_ERR =0x22 , +NIX_SND_STATUS_NPC_MCAST_CHAN_ERR =0x23 , +NIX_SND_STATUS_NPC_MCAST_ABORT =0x24 , +NIX_SND_STATUS_NPC_VTAG_PTR_ERR =0x25 , +NIX_SND_STATUS_NPC_VTAG_SIZE_ERR =0x26 , +NIX_SND_STATUS_SEND_MEM_FAULT =0x27 , +NIX_SND_STATUS_SEND_STATS_ERR =0x28 , NIX_SND_STATUS_MAX, };
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 341/379 octeontx2-pf: Fix holes in error code
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ratheesh Kannoth <[email protected]>
[ Upstream commit 7aeeb2cb7a2570bb69a87ad14018b03e06ce5be5 ]
Error code strings are not getting printed properly due to holes. Print error code as well.
--- .../ethernet/marvell/octeontx2/nic/otx2_pf.c | 80 +++++++++++-------- 1 file changed, 46 insertions(+), 34 deletions(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +46 -34
@@ -1194,31 +1194,32 @@ static char *nix_mnqerr_e_str[NIX_MNQERR_MAX] = { };static char *nix_snd_status_e_str[NIX_SND_STATUS_MAX ] = { -"NIX_SND_STATUS_GOOD" , -"NIX_SND_STATUS_SQ_CTX_FAULT" , -"NIX_SND_STATUS_SQ_CTX_POISON" , -"NIX_SND_STATUS_SQB_FAULT" , -"NIX_SND_STATUS_SQB_POISON" , -"NIX_SND_STATUS_HDR_ERR" , -"NIX_SND_STATUS_EXT_ERR" , -"NIX_SND_STATUS_JUMP_FAULT" , -"NIX_SND_STATUS_JUMP_POISON" , -"NIX_SND_STATUS_CRC_ERR" , -"NIX_SND_STATUS_IMM_ERR" , -"NIX_SND_STATUS_SG_ERR" , -"NIX_SND_STATUS_MEM_ERR" , -"NIX_SND_STATUS_INVALID_SUBDC" , -"NIX_SND_STATUS_SUBDC_ORDER_ERR" , -"NIX_SND_STATUS_DATA_FAULT" , -"NIX_SND_STATUS_DATA_POISON" , -"NIX_SND_STATUS_NPC_DROP_ACTION" , -"NIX_SND_STATUS_LOCK_VIOL" , -"NIX_SND_STATUS_NPC_UCAST_CHAN_ERR" , -"NIX_SND_STATUS_NPC_MCAST_CHAN_ERR" , -"NIX_SND_STATUS_NPC_MCAST_ABORT" , -"NIX_SND_STATUS_NPC_VTAG_PTR_ERR" , -"NIX_SND_STATUS_NPC_VTAG_SIZE_ERR" , -"NIX_SND_STATUS_SEND_STATS_ERR" , + [NIX_SND_STATUS_GOOD ] ="NIX_SND_STATUS_GOOD" , + [NIX_SND_STATUS_SQ_CTX_FAULT ] ="NIX_SND_STATUS_SQ_CTX_FAULT" , + [NIX_SND_STATUS_SQ_CTX_POISON ] ="NIX_SND_STATUS_SQ_CTX_POISON" , + [NIX_SND_STATUS_SQB_FAULT ] ="NIX_SND_STATUS_SQB_FAULT" , + [NIX_SND_STATUS_SQB_POISON ] ="NIX_SND_STATUS_SQB_POISON" , + [NIX_SND_STATUS_HDR_ERR ] ="NIX_SND_STATUS_HDR_ERR" , + [NIX_SND_STATUS_EXT_ERR ] ="NIX_SND_STATUS_EXT_ERR" , + [NIX_SND_STATUS_JUMP_FAULT ] ="NIX_SND_STATUS_JUMP_FAULT" , + [NIX_SND_STATUS_JUMP_POISON ] ="NIX_SND_STATUS_JUMP_POISON" , + [NIX_SND_STATUS_CRC_ERR ] ="NIX_SND_STATUS_CRC_ERR" , + [NIX_SND_STATUS_IMM_ERR ] ="NIX_SND_STATUS_IMM_ERR" , + [NIX_SND_STATUS_SG_ERR ] ="NIX_SND_STATUS_SG_ERR" , + [NIX_SND_STATUS_MEM_ERR ] ="NIX_SND_STATUS_MEM_ERR" , + [NIX_SND_STATUS_INVALID_SUBDC ] ="NIX_SND_STATUS_INVALID_SUBDC" , + [NIX_SND_STATUS_SUBDC_ORDER_ERR ] ="NIX_SND_STATUS_SUBDC_ORDER_ERR" , + [NIX_SND_STATUS_DATA_FAULT ] ="NIX_SND_STATUS_DATA_FAULT" , + [NIX_SND_STATUS_DATA_POISON ] ="NIX_SND_STATUS_DATA_POISON" , + [NIX_SND_STATUS_NPC_DROP_ACTION ] ="NIX_SND_STATUS_NPC_DROP_ACTION" , + [NIX_SND_STATUS_LOCK_VIOL ] ="NIX_SND_STATUS_LOCK_VIOL" , + [NIX_SND_STATUS_NPC_UCAST_CHAN_ERR ] ="NIX_SND_STAT_NPC_UCAST_CHAN_ERR" , + [NIX_SND_STATUS_NPC_MCAST_CHAN_ERR ] ="NIX_SND_STAT_NPC_MCAST_CHAN_ERR" , + [NIX_SND_STATUS_NPC_MCAST_ABORT ] ="NIX_SND_STATUS_NPC_MCAST_ABORT" , + [NIX_SND_STATUS_NPC_VTAG_PTR_ERR ] ="NIX_SND_STATUS_NPC_VTAG_PTR_ERR" , + [NIX_SND_STATUS_NPC_VTAG_SIZE_ERR ] ="NIX_SND_STATUS_NPC_VTAG_SIZE_ERR" , + [NIX_SND_STATUS_SEND_MEM_FAULT ] ="NIX_SND_STATUS_SEND_MEM_FAULT" , + [NIX_SND_STATUS_SEND_STATS_ERR ] ="NIX_SND_STATUS_SEND_STATS_ERR" , };static irqreturn_t otx2_q_intr_handler (int irq,void *data)
@@ -1238,14 +1239,16 @@ static irqreturn_t otx2_q_intr_handler(int irq, void *data)continue ;if (val &BIT_ULL (42 )) { -netdev_err (pf->netdev,"CQ%lld: error reading NIX_LF_CQ_OP_INT, NIX_LF_ERR_INT 0x%llx\n" , +netdev_err (pf->netdev, +"CQ%lld: error reading NIX_LF_CQ_OP_INT, NIX_LF_ERR_INT 0x%llx\n" , qidx,otx2_read64 (pf,NIX_LF_ERR_INT )); }else {if (val &BIT_ULL (NIX_CQERRINT_DOOR_ERR ))netdev_err (pf->netdev,"CQ%lld: Doorbell error" , qidx);if (val &BIT_ULL (NIX_CQERRINT_CQE_FAULT )) -netdev_err (pf->netdev,"CQ%lld: Memory fault on CQE write to LLC/DRAM" , +netdev_err (pf->netdev, +"CQ%lld: Memory fault on CQE write to LLC/DRAM" , qidx); }
@@ -1268,7 +1271,8 @@ static irqreturn_t otx2_q_intr_handler(int irq, void *data) (val & NIX_SQINT_BITS));if (val &BIT_ULL (42 )) { -netdev_err (pf->netdev,"SQ%lld: error reading NIX_LF_SQ_OP_INT, NIX_LF_ERR_INT 0x%llx\n" , +netdev_err (pf->netdev, +"SQ%lld: error reading NIX_LF_SQ_OP_INT, NIX_LF_ERR_INT 0x%llx\n" , qidx,otx2_read64 (pf,NIX_LF_ERR_INT )); goto done; }
@@ -1278,8 +1282,11 @@ static irqreturn_t otx2_q_intr_handler(int irq, void *data) goto chk_mnq_err_dbg; sq_op_err_code =FIELD_GET (GENMASK (7 ,0 ), sq_op_err_dbg); -netdev_err (pf->netdev,"SQ%lld: NIX_LF_SQ_OP_ERR_DBG(%llx) err=%s\n" , - qidx, sq_op_err_dbg, nix_sqoperr_e_str[sq_op_err_code]); +netdev_err (pf->netdev, +"SQ%lld: NIX_LF_SQ_OP_ERR_DBG(0x%llx) err=%s(%#x)\n" , + qidx, sq_op_err_dbg, + nix_sqoperr_e_str[sq_op_err_code], + sq_op_err_code);otx2_write64 (pf,NIX_LF_SQ_OP_ERR_DBG ,BIT_ULL (44 ));
@@ -1296,16 +1303,21 @@ static irqreturn_t otx2_q_intr_handler(int irq, void *data) goto chk_snd_err_dbg; mnq_err_code =FIELD_GET (GENMASK (7 ,0 ), mnq_err_dbg); -netdev_err (pf->netdev,"SQ%lld: NIX_LF_MNQ_ERR_DBG(%llx) err=%s\n" , - qidx, mnq_err_dbg, nix_mnqerr_e_str[mnq_err_code]); +netdev_err (pf->netdev, +"SQ%lld: NIX_LF_MNQ_ERR_DBG(0x%llx) err=%s(%#x)\n" , + qidx, mnq_err_dbg, nix_mnqerr_e_str[mnq_err_code], + mnq_err_code);otx2_write64 (pf,NIX_LF_MNQ_ERR_DBG ,BIT_ULL (44 )); chk_snd_err_dbg: snd_err_dbg =otx2_read64 (pf,NIX_LF_SEND_ERR_DBG );if (snd_err_dbg &BIT (44 )) { snd_err_code =FIELD_GET (GENMASK (7 ,0 ), snd_err_dbg); -netdev_err (pf->netdev,"SQ%lld: NIX_LF_SND_ERR_DBG:0x%llx err=%s\n" , - qidx, snd_err_dbg, nix_snd_status_e_str[snd_err_code]); +netdev_err (pf->netdev, +"SQ%lld: NIX_LF_SND_ERR_DBG:0x%llx err=%s(%#x)\n" , + qidx, snd_err_dbg, + nix_snd_status_e_str[snd_err_code], + snd_err_code);otx2_write64 (pf,NIX_LF_SEND_ERR_DBG ,BIT_ULL (44 )); }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 342/379 net: page_pool: add missing free_percpu when page_pool_init fail
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jian Shen <[email protected]>
[ Upstream commit 8ffbd1669ed1d58939d6e878dffaa2f60bf961a4 ]
When ptr_ring_init() returns failure in page_pool_init(), free_percpu() is not called to free pool->recycle_stats, which may cause memory leak.
--- net/core/page_pool.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/core/page_pool.c +5 -1
@@ -209,8 +209,12 @@ static int page_pool_init(struct page_pool *pool,return -ENOMEM ;#endif -if (ptr_ring_init (&pool->ring, ring_qsize,GFP_KERNEL ) <0 ) +if (ptr_ring_init (&pool->ring, ring_qsize,GFP_KERNEL ) <0 ) { +#ifdef CONFIG_PAGE_POOL_STATS +free_percpu (pool->recycle_stats); +#endif return -ENOMEM ; + }atomic_set (&pool->pages_state_release_cnt,0 );
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 343/379 dccp: Call security_inet_conn_request() after setting IPv4 addresses.
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit fa2df45af13091f76b89adb84a28f13818d5d631 ]
Initially, commit 4237c75c0a35 ("[MLSXFRM]: Auto-labeling of child sockets") introduced security_inet_conn_request() in some functions where reqsk is allocated. The hook is added just after the allocation, so reqsk's IPv4 remote address was not initialised then.
However, SELinux/Smack started to read it in netlbl_req_setattr() after the cited commits.
This bug was partially fixed by commit 284904aa7946 ("lsm: Relocate the IPv4 security_inet_conn_request() hooks").
This patch fixes the last bug in DCCPv4.
--- net/dccp/ipv4.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/dccp/ipv4.c +3 -3
@@ -628,9 +628,6 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb)if (dccp_parse_options (sk, dreq, skb)) goto drop_and_free; -if (security_inet_conn_request (sk, skb, req)) - goto drop_and_free; - ireq =inet_rsk (req);sk_rcv_saddr_set (req_to_sk (req),ip_hdr (skb)->daddr);sk_daddr_set (req_to_sk (req),ip_hdr (skb)->saddr);
@@ -638,6 +635,9 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb) ireq->ireq_family =AF_INET ; ireq->ir_iif =READ_ONCE (sk->sk_bound_dev_if); +if (security_inet_conn_request (sk, skb, req)) + goto drop_and_free; +/* * Step 3: Process LISTEN state *
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 344/379 dccp/tcp: Call security_inet_conn_request() after setting IPv6 addresses.
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 23be1e0e2a83a8543214d2599a31d9a2185a796b ]
Initially, commit 4237c75c0a35 ("[MLSXFRM]: Auto-labeling of child sockets") introduced security_inet_conn_request() in some functions where reqsk is allocated. The hook is added just after the allocation, so reqsk's IPv6 remote address was not initialised then.
However, SELinux/Smack started to read it in netlbl_req_setattr() after commit e1adea927080 ("calipso: Allow request sockets to be relabelled by the lsm.").
Commit 284904aa7946 ("lsm: Relocate the IPv4 security_inet_conn_request() hooks") fixed that kind of issue only in TCPv4 because IPv6 labeling was not supported at that time. Finally, the same issue was introduced again in IPv6.
Let's apply the same fix on DCCPv6 and TCPv6.
--- net/dccp/ipv6.c | 6 +++--- net/ipv6/syncookies.c | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-)
net/dccp/ipv6.c +3 -3
@@ -359,15 +359,15 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb)if (dccp_parse_options (sk, dreq, skb)) goto drop_and_free; -if (security_inet_conn_request (sk, skb, req)) - goto drop_and_free; - ireq =inet_rsk (req); ireq->ir_v6_rmt_addr =ipv6_hdr (skb)->saddr; ireq->ir_v6_loc_addr =ipv6_hdr (skb)->daddr; ireq->ireq_family =AF_INET6 ; ireq->ir_mark =inet_request_mark (sk, skb); +if (security_inet_conn_request (sk, skb, req)) + goto drop_and_free; +if (ipv6_opt_accepted (sk, skb,IP6CB (skb)) || np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo || np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim) {
net/ipv6/syncookies.c +4 -3
@@ -180,14 +180,15 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb) treq =tcp_rsk (req); treq->tfo_listener = false; -if (security_inet_conn_request (sk, skb, req)) - goto out_free; - req->mss = mss; ireq->ir_rmt_port = th->source; ireq->ir_num =ntohs (th->dest); ireq->ir_v6_rmt_addr =ipv6_hdr (skb)->saddr; ireq->ir_v6_loc_addr =ipv6_hdr (skb)->daddr; + +if (security_inet_conn_request (sk, skb, req)) + goto out_free; +if (ipv6_opt_accepted (sk, skb, &TCP_SKB_CB (skb)->header.h6) || np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo || np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim) {
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 345/379 net: r8169: Disable multicast filter for RTL8168H and RTL8107E
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Patrick Thompson <[email protected]>
[ Upstream commit efa5f1311c4998e9e6317c52bc5ee93b3a0f36df ]
RTL8168H and RTL8107E ethernet adapters erroneously filter unicast eapol packets unless allmulti is enabled. These devices correspond to RTL_GIGA_MAC_VER_46 and VER_48. Add an exception for VER_46 and VER_48 in the same way that VER_35 has an exception.
--- drivers/net/ethernet/realtek/r8169_main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/realtek/r8169_main.c +3 -1
@@ -2514,7 +2514,9 @@ static void rtl_set_rx_mode(struct net_device *dev) rx_mode |= AcceptAllPhys; }else if (netdev_mc_count (dev) >MC_FILTER_LIMIT || dev->flags &IFF_ALLMULTI || - tp->mac_version ==RTL_GIGA_MAC_VER_35 ) { + tp->mac_version ==RTL_GIGA_MAC_VER_35 || + tp->mac_version ==RTL_GIGA_MAC_VER_46 || + tp->mac_version ==RTL_GIGA_MAC_VER_48 ) {/* accept all multicasts */ }else if (netdev_mc_empty (dev)) { rx_mode &= ~AcceptMulticast;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 346/379 Fix termination state for idr_for_each_entry_ul()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: NeilBrown <[email protected]>
[ Upstream commit e8ae8ad479e2d037daa33756e5e72850a7bd37a9 ]
The comment for idr_for_each_entry_ul() states
after normal termination @entry is left with the value NULL
This is not correct in the case where UINT_MAX has an entry in the idr. In that case @entry will be non-NULL after termination.
No current code depends on the documentation being correct, but to save future code we should fix it.
Also fix idr_for_each_entry_continue_ul(). While this is not documented as leaving @entry as NULL, the mellanox driver appears to depend on it doing so. So make that explicit in the documentation as well as in the code.
--- include/linux/idr.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
include/linux/idr.h +4 -2
@@ -200,7 +200,7 @@ static inline void idr_preload_end(void)*/ #define idr_for_each_entry_ul (idr, entry, tmp, id) \ for (tmp = 0, id = 0; \ - tmp <= id && ((entry) = idr_get_next_ul(idr, &(id))) != NULL; \ + ((entry) = tmp <= id ? idr_get_next_ul(idr, &(id)) : NULL) != NULL; \ tmp = id, ++id)/**
@@ -224,10 +224,12 @@ static inline void idr_preload_end(void)* @id: Entry ID. * * Continue to iterate over entries, continuing after the current position. +* After normal termination @entry is left with the value NULL. This +* is convenient for a "not found" value. */ #define idr_for_each_entry_continue_ul (idr, entry, tmp, id) \ for (tmp = id; \ - tmp <= id && ((entry) = idr_get_next_ul(idr, &(id))) != NULL; \ + ((entry) = tmp <= id ? idr_get_next_ul(idr, &(id)) : NULL) != NULL; \ tmp = id, ++id)/*
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 347/379 net: stmmac: xgmac: Enable support for multiple Flexible PPS outputs
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Furong Xu <[email protected]>
[ Upstream commit db456d90a4c1b43b6251fa4348c8adc59b583274 ]
Quoted 1 line
From XGMAC Core 3.20 and later, each Flexible PPS has individual PPSEN bit
to select Fixed mode or Flexible mode. The PPSEN must be set, or it stays in Fixed PPS mode by default.
XGMAC Core prior 3.20, only PPSEN0(bit 4) is writable. PPSEN{1,2,3} are read-only reserved, and they are already in Flexible mode by default, our new code always set PPSEN{1,2,3} do not make things worse ;-)
--- drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 2 +- .../net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +1 -1
@@ -222,7 +222,7 @@ ((val) << XGMAC_PPS_MINIDX(x))#define XGMAC_PPSCMD_START 0x2#define XGMAC_PPSCMD_STOP 0x5 -#define XGMAC_PPSEN0 BIT(4) +#define XGMAC_PPSENx (x) BIT(4 + (x) * 8)#define XGMAC_PPSx_TARGET_TIME_SEC (x) (0x00000d80 + (x) * 0x10)#define XGMAC_PPSx_TARGET_TIME_NSEC (x) (0x00000d84 + (x) * 0x10)#define XGMAC_TRGTBUSY0 BIT(31)
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +13 -1
@@ -1135,7 +1135,19 @@ static int dwxgmac2_flex_pps_config(void __iomem *ioaddr, int index, val |=XGMAC_PPSCMDx (index,XGMAC_PPSCMD_START ); val |=XGMAC_TRGTMODSELx (index,XGMAC_PPSCMD_START ); - val |=XGMAC_PPSEN0 ; + +/* XGMAC Core has 4 PPS outputs at most. +* +* Prior XGMAC Core 3.20, Fixed mode or Flexible mode are selectable for +* PPS0 only via PPSEN0. PPS{1,2,3} are in Flexible mode by default, +* and can not be switched to Fixed mode, since PPSEN{1,2,3} are +* read-only reserved to 0. +* But we always set PPSEN{1,2,3} do not make things worse ;-) +* +* From XGMAC Core 3.20 and later, PPSEN{0,1,2,3} are writable and must +* be set, or the PPS outputs stay in Fixed PPS mode by default. +*/ + val |=XGMAC_PPSENx (index);writel (cfg->start.tv_sec, ioaddr +XGMAC_PPSx_TARGET_TIME_SEC (index));
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 348/379 selftests: pmtu.sh: fix result checking
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hangbin Liu <[email protected]>
[ Upstream commit 63e201916b27260218e528a2f8758be47f99bbf4 ]
In the PMTU test, when all previous tests are skipped and the new test passes, the exit code is set to 0. However, the current check mistakenly treats this as an assignment, causing the check to pass every time.
Consequently, regardless of how many tests have failed, if the latest test passes, the PMTU test will report a pass.
--- tools/testing/selftests/net/pmtu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/pmtu.sh +1 -1
@@ -2013,7 +2013,7 @@ run_test() { case $ret in 0) all_skipped=false - [ $exitcode=$ksft_skip ] && exitcode=0 + [ $exitcode -eq $ksft_skip ] && exitcode=0 ;; $ksft_skip) [ $all_skipped = true ] && exitcode=$ksft_skip
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 349/379 octeontx2-pf: Rename tot_tx_queues to non_qos_queues
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hariprasad Kelam <[email protected]>
[ Upstream commit 508c58f76ca510956625c945f9b8eb104f2c8208 ]
current implementation is such that tot_tx_queues contains both xdp queues and normal tx queues. which will be allocated in interface open calls and deallocated on interface down calls respectively.
With addition of QOS, where send quees are allocated/deallacated upon user request Qos send queues won't be part of tot_tx_queues. So this patch renames tot_tx_queues to non_qos_queues.
Stable-dep-of: 3423ca23e08b ("octeontx2-pf: Free pending and dropped SQEs")
--- .../ethernet/marvell/octeontx2/nic/otx2_common.c | 12 ++++++------ .../ethernet/marvell/octeontx2/nic/otx2_common.h | 2 +- .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 14 +++++++------- .../net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +6 -6
@@ -799,7 +799,7 @@ void otx2_sqb_flush(struct otx2_nic *pfvf)int timeout =1000 ; ptr = (u64 *)otx2_get_regaddr (pfvf,NIX_LF_SQ_OP_STATUS ); -for (qidx =0 ; qidx < pfvf->hw.tot_tx_queues; qidx++) { +for (qidx =0 ; qidx < pfvf->hw.non_qos_queues; qidx++) { incr = (u64 )qidx <<32 ;while (timeout) { val =otx2_atomic64_add (incr, ptr);
@@ -1085,7 +1085,7 @@ int otx2_config_nix_queues(struct otx2_nic *pfvf) }/* Initialize TX queues */ -for (qidx =0 ; qidx < pfvf->hw.tot_tx_queues; qidx++) { +for (qidx =0 ; qidx < pfvf->hw.non_qos_queues; qidx++) {u16 sqb_aura =otx2_get_pool_idx (pfvf,AURA_NIX_SQ , qidx); err =otx2_sq_init (pfvf, qidx, sqb_aura);
@@ -1132,7 +1132,7 @@ int otx2_config_nix(struct otx2_nic *pfvf)/* Set RQ/SQ/CQ counts */ nixlf->rq_cnt = pfvf->hw.rx_queues; - nixlf->sq_cnt = pfvf->hw.tot_tx_queues; + nixlf->sq_cnt = pfvf->hw.non_qos_queues; nixlf->cq_cnt = pfvf->qset.cq_cnt; nixlf->rss_sz =MAX_RSS_INDIR_TBL_SIZE ; nixlf->rss_grps =MAX_RSS_GROUPS ;
@@ -1170,7 +1170,7 @@ void otx2_sq_free_sqbs(struct otx2_nic *pfvf)int sqb, qidx;u64 iova, pa; -for (qidx =0 ; qidx < hw->tot_tx_queues; qidx++) { +for (qidx =0 ; qidx < hw->non_qos_queues; qidx++) { sq = &qset->sq[qidx];if (!sq->sqb_ptrs)continue ;
@@ -1386,7 +1386,7 @@ int otx2_sq_aura_pool_init(struct otx2_nic *pfvf) stack_pages = (num_sqbs + hw->stack_pg_ptrs -1 ) / hw->stack_pg_ptrs; -for (qidx =0 ; qidx < hw->tot_tx_queues; qidx++) { +for (qidx =0 ; qidx < hw->non_qos_queues; qidx++) { pool_id =otx2_get_pool_idx (pfvf,AURA_NIX_SQ , qidx);/* Initialize aura context */ err =otx2_aura_init (pfvf, pool_id, pool_id, num_sqbs);
@@ -1406,7 +1406,7 @@ int otx2_sq_aura_pool_init(struct otx2_nic *pfvf) goto fail;/* Allocate pointers and free them to aura/pool */ -for (qidx =0 ; qidx < hw->tot_tx_queues; qidx++) { +for (qidx =0 ; qidx < hw->non_qos_queues; qidx++) { pool_id =otx2_get_pool_idx (pfvf,AURA_NIX_SQ , qidx); pool = &pfvf->qset.pool[pool_id];
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +1 -1
@@ -186,7 +186,7 @@ struct otx2_hw {u16 rx_queues;u16 tx_queues;u16 xdp_queues; -u16 tot_tx_queues; +u16 non_qos_queues;/* tx queues plus xdp queues */ u16 max_queues;u16 pool_cnt;u16 rqpool_cnt;
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +7 -7
@@ -1256,7 +1256,7 @@ static irqreturn_t otx2_q_intr_handler(int irq, void *data) }/* SQ */ -for (qidx =0 ; qidx < pf->hw.tot_tx_queues; qidx++) { +for (qidx =0 ; qidx < pf->hw.non_qos_queues; qidx++) {u64 sq_op_err_dbg, mnq_err_dbg, snd_err_dbg;u8 sq_op_err_code, mnq_err_code, snd_err_code;
@@ -1391,7 +1391,7 @@ static void otx2_free_sq_res(struct otx2_nic *pf)otx2_ctx_disable (&pf->mbox,NIX_AQ_CTYPE_SQ , false);/* Free SQB pointers */ otx2_sq_free_sqbs (pf); -for (qidx =0 ; qidx < pf->hw.tot_tx_queues; qidx++) { +for (qidx =0 ; qidx < pf->hw.non_qos_queues; qidx++) { sq = &qset->sq[qidx];qmem_free (pf->dev, sq->sqe);qmem_free (pf->dev, sq->tso_hdrs);
@@ -1441,7 +1441,7 @@ static int otx2_init_hw_resources(struct otx2_nic *pf)* so, aura count = pool count. */ hw->rqpool_cnt = hw->rx_queues; - hw->sqpool_cnt = hw->tot_tx_queues; + hw->sqpool_cnt = hw->non_qos_queues; hw->pool_cnt = hw->rqpool_cnt + hw->sqpool_cnt;/* Maximum hardware supported transmit length */
@@ -1694,7 +1694,7 @@ int otx2_open(struct net_device *netdev)netif_carrier_off (netdev); - pf->qset.cq_cnt = pf->hw.rx_queues + pf->hw.tot_tx_queues; + pf->qset.cq_cnt = pf->hw.rx_queues + pf->hw.non_qos_queues;/* RQ and SQs are mapped to different CQs, * so find out max CQ IRQs (i.e CINTs) needed. */
@@ -1714,7 +1714,7 @@ int otx2_open(struct net_device *netdev)if (!qset->cq) goto err_free_mem; - qset->sq =kcalloc (pf->hw.tot_tx_queues, + qset->sq =kcalloc (pf->hw.non_qos_queues,sizeof (struct otx2_snd_queue ),GFP_KERNEL );if (!qset->sq) goto err_free_mem;
@@ -2532,7 +2532,7 @@ static int otx2_xdp_setup(struct otx2_nic *pf, struct bpf_prog *prog)else pf->hw.xdp_queues =0 ; - pf->hw.tot_tx_queues += pf->hw.xdp_queues; + pf->hw.non_qos_queues += pf->hw.xdp_queues;if (if_up)otx2_open (pf->netdev);
@@ -2763,7 +2763,7 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id) hw->pdev = pdev; hw->rx_queues = qcount; hw->tx_queues = qcount; - hw->tot_tx_queues = qcount; + hw->non_qos_queues = qcount; hw->max_queues = qcount; hw->rbuf_len =OTX2_DEFAULT_RBUF_LEN ;/* Use CQE of 128 byte descriptor size by default */
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c +1 -1
@@ -566,7 +566,7 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id) hw->rx_queues = qcount; hw->tx_queues = qcount; hw->max_queues = qcount; - hw->tot_tx_queues = qcount; + hw->non_qos_queues = qcount; hw->rbuf_len =OTX2_DEFAULT_RBUF_LEN ;/* Use CQE of 128 byte descriptor size by default */ hw->xqe_size =128 ;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 350/379 octeontx2-pf: qos send queues management
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Subbaraya Sundeep <[email protected]>
[ Upstream commit ab6dddd2a669a0ecc2ce07485c7a15fadbb5a0aa ]
Current implementation is such that the number of Send queues (SQs) are decided on the device probe which is equal to the number of online cpus. These SQs are allocated and deallocated in interface open and c lose calls respectively.
This patch defines new APIs for initializing and deinitializing Send queues dynamically and allocates more number of transmit queues for QOS feature.
Stable-dep-of: 3423ca23e08b ("octeontx2-pf: Free pending and dropped SQEs")
--- .../marvell/octeontx2/af/rvu_debugfs.c | 5 + .../ethernet/marvell/octeontx2/nic/Makefile | 2 +- .../marvell/octeontx2/nic/otx2_common.c | 43 ++- .../marvell/octeontx2/nic/otx2_common.h | 39 ++- .../ethernet/marvell/octeontx2/nic/otx2_pf.c | 44 ++- .../marvell/octeontx2/nic/otx2_txrx.c | 24 +- .../marvell/octeontx2/nic/otx2_txrx.h | 3 +- .../ethernet/marvell/octeontx2/nic/otx2_vf.c | 7 +- .../net/ethernet/marvell/octeontx2/nic/qos.h | 19 ++ .../ethernet/marvell/octeontx2/nic/qos_sq.c | 282 ++++++++++++++++++ 10 files changed, 426 insertions(+), 42 deletions(-) create mode 100644 drivers/net/ethernet/marvell/octeontx2/nic/qos.h create mode 100644 drivers/net/ethernet/marvell/octeontx2/nic/qos_sq.c
drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c +5 -0
@@ -1222,6 +1222,11 @@ static int rvu_dbg_npa_ctx_display(struct seq_file *m, void *unused, int ctype)for (aura = id; aura < max_id; aura++) { aq_req.aura_id = aura; + +/* Skip if queue is uninitialized */ +if (ctype ==NPA_AQ_CTYPE_POOL && !test_bit (aura, pfvf->pool_bmap)) +continue ; +seq_printf (m,"======%s : %d=======\n" , (ctype ==NPA_AQ_CTYPE_AURA ) ?"AURA" :"POOL" , aq_req.aura_id);
drivers/net/ethernet/marvell/octeontx2/nic/Makefile +1 -1
@@ -8,7 +8,7 @@ obj-$(CONFIG_OCTEONTX2_VF) += rvu_nicvf.o otx2_ptp.o rvu_nicpf-y := otx2_pf.o otx2_common.o otx2_txrx.o otx2_ethtool.o \ otx2_flows.o otx2_tc.o cn10k.o otx2_dmac_flt.o \ - otx2_devlink.o + otx2_devlink.o qos_sq.o rvu_nicvf-y := otx2_vf.o otx2_devlink.o rvu_nicpf-$(CONFIG_DCB) += otx2_dcbnl.o
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +28 -15
101 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +34 -5
@@ -27,6 +27,7 @@#include "otx2_txrx.h" #include "otx2_devlink.h" #include <rvu_trace.h> +#include "qos.h" /* PCI device IDs */ #define PCI_DEVID_OCTEONTX2_RVU_PF 0xA063
@@ -186,6 +187,7 @@ struct otx2_hw {u16 rx_queues;u16 tx_queues;u16 xdp_queues; +u16 tc_tx_queues;u16 non_qos_queues;/* tx queues plus xdp queues */ u16 max_queues;u16 pool_cnt;
@@ -498,6 +500,8 @@ struct otx2_nic {u16 pfc_schq_list[NIX_TXSCH_LVL_CNT ][MAX_TXSCHQ_PER_FUNC ];bool pfc_alloc_status[NIX_PF_PFC_PRIO_MAX ];#endif +/* qos */ +struct otx2_qos qos;/* napi event count. It is needed for adaptive irq coalescing. */ u32 napi_events;
@@ -742,8 +746,7 @@ static inline void cn10k_aura_freeptr(void *dev, int aura, u64 buf)/* Alloc pointer from pool/aura */ static inline u64 otx2_aura_allocptr (struct otx2_nic *pfvf,int aura) { -u64 *ptr = (u64 *)otx2_get_regaddr (pfvf, -NPA_LF_AURA_OP_ALLOCX (0 )); +u64 *ptr = (__force u64 *)otx2_get_regaddr (pfvf,NPA_LF_AURA_OP_ALLOCX (0 ));u64 incr = (u64 )aura |BIT_ULL (63 );return otx2_atomic64_add (incr, ptr);
@@ -885,12 +888,23 @@ static inline void otx2_dma_unmap_page(struct otx2_nic *pfvf,static inline u16 otx2_get_smq_idx (struct otx2_nic *pfvf,u16 qidx) { +u16 smq;#ifdef CONFIG_DCB if (qidx <NIX_PF_PFC_PRIO_MAX && pfvf->pfc_alloc_status[qidx])return pfvf->pfc_schq_list[NIX_TXSCH_LVL_SMQ ][qidx];#endif +/* check if qidx falls under QOS queues */ +if (qidx >= pfvf->hw.non_qos_queues) + smq = pfvf->qos.qid_to_sqmap[qidx - pfvf->hw.non_qos_queues]; +else + smq = pfvf->hw.txschq_list[NIX_TXSCH_LVL_SMQ ][0 ]; -return pfvf->hw.txschq_list[NIX_TXSCH_LVL_SMQ ][0 ]; +return smq; +} + +static inline u16 otx2_get_total_tx_queues (struct otx2_nic *pfvf) +{ +return pfvf->hw.non_qos_queues + pfvf->hw.tc_tx_queues; }/* MSI-X APIs */
@@ -920,17 +934,22 @@ int otx2_txsch_alloc(struct otx2_nic *pfvf);void otx2_txschq_stop (struct otx2_nic *pfvf);void otx2_txschq_free_one (struct otx2_nic *pfvf,u16 lvl,u16 schq);void otx2_sqb_flush (struct otx2_nic *pfvf); -int __otx2_alloc_rbuf (struct otx2_nic *pfvf,struct otx2_pool *pool, -dma_addr_t *dma); +int otx2_alloc_rbuf (struct otx2_nic *pfvf,struct otx2_pool *pool, +dma_addr_t *dma);int otx2_rxtx_enable (struct otx2_nic *pfvf,bool enable);void otx2_ctx_disable (struct mbox *mbox,int type,bool npa);int otx2_nix_config_bp (struct otx2_nic *pfvf,bool enable);void otx2_cleanup_rx_cqes (struct otx2_nic *pfvf,struct otx2_cq_queue *cq);void otx2_cleanup_tx_cqes (struct otx2_nic *pfvf,struct otx2_cq_queue *cq); +int otx2_sq_init (struct otx2_nic *pfvf,u16 qidx,u16 sqb_aura);int otx2_sq_aq_init (void *dev,u16 qidx,u16 sqb_aura);int cn10k_sq_aq_init (void *dev,u16 qidx,u16 sqb_aura);int otx2_alloc_buffer (struct otx2_nic *pfvf,struct otx2_cq_queue *cq,dma_addr_t *dma); +int otx2_pool_init (struct otx2_nic *pfvf,u16 pool_id, +int stack_pages,int numptrs,int buf_size); +int otx2_aura_init (struct otx2_nic *pfvf,int aura_id, +int pool_id,int numptrs);/* RSS configuration APIs*/ int otx2_rss_init (struct otx2_nic *pfvf);
@@ -1038,4 +1057,14 @@ static inline void cn10k_handle_mcs_event(struct otx2_nic *pfvf, {}#endif /* CONFIG_MACSEC */ +/* qos support */ +static inline void otx2_qos_init (struct otx2_nic *pfvf,int qos_txqs) +{ +struct otx2_hw *hw = &pfvf->hw; + + hw->tc_tx_queues = qos_txqs; +} + +u16 otx2_select_queue (struct net_device *netdev,struct sk_buff *skb, +struct net_device *sb_dev);#endif /* OTX2_COMMON_H */
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +34 -10
138 lines not on this page · raw message
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c +16 -8
@@ -468,12 +468,13 @@ static int otx2_tx_napi_handler(struct otx2_nic *pfvf,break ; } -if (cq->cq_type ==CQ_XDP ) { + qidx = cq->cq_idx - pfvf->hw.rx_queues; + +if (cq->cq_type ==CQ_XDP )otx2_xdp_snd_pkt_handler (pfvf, sq, cqe); - }else { -otx2_snd_pkt_handler (pfvf, cq, sq, cqe, budget, - &tx_pkts, &tx_bytes); - } +else +otx2_snd_pkt_handler (pfvf, cq, &pfvf->qset.sq[qidx], + cqe, budget, &tx_pkts, &tx_bytes); cqe->hdr.cqe_type =NIX_XQE_TYPE_INVALID ; processed_cqe++;
@@ -490,7 +491,11 @@ static int otx2_tx_napi_handler(struct otx2_nic *pfvf,if (likely (tx_pkts)) {struct netdev_queue *txq; - txq =netdev_get_tx_queue (pfvf->netdev, cq->cint_idx); + qidx = cq->cq_idx - pfvf->hw.rx_queues; + +if (qidx >= pfvf->hw.tx_queues) + qidx -= pfvf->hw.xdp_queues; + txq =netdev_get_tx_queue (pfvf->netdev, qidx);netdev_tx_completed_queue (txq, tx_pkts, tx_bytes);/* Check if queue was stopped earlier due to ring full */ smp_mb ();
@@ -738,7 +743,8 @@ static void otx2_sqe_add_hdr(struct otx2_nic *pfvf, struct otx2_snd_queue *sq, sqe_hdr->aura = sq->aura_id;/* Post a CQE Tx after pkt transmission */ sqe_hdr->pnc =1 ; - sqe_hdr->sq = qidx; + sqe_hdr->sq = (qidx >= pfvf->hw.tx_queues) ? + qidx + pfvf->hw.xdp_queues : qidx; } sqe_hdr->total = skb->len;/* Set SQE identifier which will be used later for freeing SKB */
@@ -1223,8 +1229,10 @@ void otx2_cleanup_tx_cqes(struct otx2_nic *pfvf, struct otx2_cq_queue *cq)struct nix_cqe_tx_s *cqe;int processed_cqe =0 ;struct sg_list *sg; +int qidx; - sq = &pfvf->qset.sq[cq->cint_idx]; + qidx = cq->cq_idx - pfvf->hw.rx_queues; + sq = &pfvf->qset.sq[qidx];if (otx2_nix_cq_op_status (pfvf, cq) || !cq->pend_cqe)return ;
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.h +2 -1
@@ -102,7 +102,8 @@ enum cq_type {CQ_RX ,CQ_TX ,CQ_XDP , - CQS_PER_CINT = 3, /* RQ + SQ + XDP */ +CQ_QOS , + CQS_PER_CINT = 4, /* RQ + SQ + XDP + QOS_SQ */ }; struct otx2_cq_poll {
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c +5 -2
@@ -475,6 +475,7 @@ static const struct net_device_ops otx2vf_netdev_ops = { .ndo_open = otx2vf_open, .ndo_stop = otx2vf_stop, .ndo_start_xmit = otx2vf_xmit, + .ndo_select_queue = otx2_select_queue, .ndo_set_rx_mode = otx2vf_set_rx_mode, .ndo_set_mac_address = otx2_set_mac_address, .ndo_change_mtu = otx2vf_change_mtu,
@@ -520,10 +521,10 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id) {int num_vec =pci_msix_vec_count (pdev);struct device *dev = &pdev->dev; +int err, qcount, qos_txqs;struct net_device *netdev;struct otx2_nic *vf;struct otx2_hw *hw; -int err, qcount; err =pcim_enable_device (pdev);if (err) {
@@ -546,7 +547,8 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id)pci_set_master (pdev); qcount =num_online_cpus (); - netdev =alloc_etherdev_mqs (sizeof (*vf), qcount, qcount); + qos_txqs =min_t (int, qcount,OTX2_QOS_MAX_LEAF_NODES ); + netdev =alloc_etherdev_mqs (sizeof (*vf), qcount + qos_txqs, qcount);if (!netdev) { err = -ENOMEM ; goto err_release_regions;
@@ -695,6 +697,7 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id)if (err) goto err_shutdown_tc;#endif +otx2_qos_init (vf, qos_txqs);return 0 ;
drivers/net/ethernet/marvell/octeontx2/nic/qos.h new file +19 -0
@@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Marvell RVU Ethernet driver +* +* Copyright (C) 2023 Marvell. +* +*/ +#ifndef OTX2_QOS_H +#define OTX2_QOS_H + +#define OTX2_QOS_MAX_LEAF_NODES 16 + +int otx2_qos_enable_sq (struct otx2_nic *pfvf,int qidx,u16 smq); +void otx2_qos_disable_sq (struct otx2_nic *pfvf,int qidx,u16 mdq); + +struct otx2_qos { +u16 qid_to_sqmap[OTX2_QOS_MAX_LEAF_NODES ]; + }; + +#endif
drivers/net/ethernet/marvell/octeontx2/nic/qos_sq.c new file +282 -0
282 lines not on this page · raw message
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 351/379 octeontx2-pf: Free pending and dropped SQEs
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geetha sowjanya <[email protected]>
[ Upstream commit 3423ca23e08bf285a324237abe88e7e7d9becfe6 ]
On interface down, the pending SQEs in the NIX get dropped or drained out during SMQ flush. But skb's pointed by these SQEs never get free or updated to the stack as respective CQE never get added.
This patch fixes the issue by freeing all valid skb's in SQ SG list.
--- .../marvell/octeontx2/nic/otx2_common.c | 15 +++---- .../marvell/octeontx2/nic/otx2_common.h | 1 + .../ethernet/marvell/octeontx2/nic/otx2_pf.c | 1 + .../marvell/octeontx2/nic/otx2_txrx.c | 42 +++++++++++++++++++ 4 files changed, 49 insertions(+), 10 deletions(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c +5 -10
@@ -797,7 +797,6 @@ void otx2_sqb_flush(struct otx2_nic *pfvf)int qidx, sqe_tail, sqe_head;struct otx2_snd_queue *sq;u64 incr, *ptr, val; -int timeout =1000 ; ptr = (u64 *)otx2_get_regaddr (pfvf,NIX_LF_SQ_OP_STATUS );for (qidx =0 ; qidx <otx2_get_total_tx_queues (pfvf); qidx++) {
@@ -806,15 +805,11 @@ void otx2_sqb_flush(struct otx2_nic *pfvf)continue ; incr = (u64 )qidx <<32 ; -while (timeout) { - val =otx2_atomic64_add (incr, ptr); - sqe_head = (val >>20 ) &0x3F ; - sqe_tail = (val >>28 ) &0x3F ; -if (sqe_head == sqe_tail) -break ; -usleep_range (1 ,3 ); - timeout--; - } + val =otx2_atomic64_add (incr, ptr); + sqe_head = (val >>20 ) &0x3F ; + sqe_tail = (val >>28 ) &0x3F ; +if (sqe_head != sqe_tail) +usleep_range (50 ,60 ); } }
drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +1 -0
@@ -933,6 +933,7 @@ int otx2_txschq_config(struct otx2_nic *pfvf, int lvl, int prio, bool pfc_en);int otx2_txsch_alloc (struct otx2_nic *pfvf);void otx2_txschq_stop (struct otx2_nic *pfvf);void otx2_txschq_free_one (struct otx2_nic *pfvf,u16 lvl,u16 schq); +void otx2_free_pending_sqe (struct otx2_nic *pfvf);void otx2_sqb_flush (struct otx2_nic *pfvf);int otx2_alloc_rbuf (struct otx2_nic *pfvf,struct otx2_pool *pool,dma_addr_t *dma);
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +1 -0
@@ -1596,6 +1596,7 @@ static void otx2_free_hw_resources(struct otx2_nic *pf)else otx2_cleanup_tx_cqes (pf, cq); } +otx2_free_pending_sqe (pf);otx2_free_sq_res (pf);
drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c +42 -0
69 lines not on this page · raw message
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 352/379 net/smc: fix dangling sock under state SMC_APPFINCLOSEWAIT
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: D. Wythe <[email protected]>
[ Upstream commit 5211c9729484c923f8d2e06bd29f9322cc42bb8f ]
Considering scenario:
smc_cdc_rx_handler__smc_release
sock_set_flagsmc_close_active()sock_set_flag
__set_bit(DEAD) __set_bit(DONE)
Dues to __set_bit is not atomic, the DEAD or DONE might be lost. if the DEAD flag lost, the state SMC_CLOSED will be never be reached in smc_close_passive_work:
if (sock_flag(sk, SOCK_DEAD) &&
smc_close_sent_any_close(conn)) {
sk->sk_state = SMC_CLOSED;
} else {
/* just shutdown, but not yet closed locally */
sk->sk_state = SMC_APPFINCLOSEWAIT;
}Replace sock_set_flags or __set_bit to set_bit will fix this problem. Since set_bit is atomic.
--- net/smc/af_smc.c | 4 ++-- net/smc/smc.h | 5 +++++ net/smc/smc_cdc.c | 2 +- net/smc/smc_close.c | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-)
net/smc/af_smc.c +2 -2
@@ -274,7 +274,7 @@ static int __smc_release(struct smc_sock *smc)if (!smc->use_fallback) { rc =smc_close_active (smc); -sock_set_flag (sk,SOCK_DEAD ); +smc_sock_set_flag (sk,SOCK_DEAD ); sk->sk_shutdown |=SHUTDOWN_MASK ; }else {if (sk->sk_state !=SMC_CLOSED ) {
@@ -1710,7 +1710,7 @@ static int smc_clcsock_accept(struct smc_sock *lsmc, struct smc_sock **new_smc)if (new_clcsock)sock_release (new_clcsock); new_sk->sk_state =SMC_CLOSED ; -sock_set_flag (new_sk,SOCK_DEAD ); +smc_sock_set_flag (new_sk,SOCK_DEAD );sock_put (new_sk);/* final */ *new_smc =NULL ; goto out;
net/smc/smc.h +5 -0
@@ -377,4 +377,9 @@ int smc_nl_dump_hs_limitation(struct sk_buff *skb, struct netlink_callback *cb);int smc_nl_enable_hs_limitation (struct sk_buff *skb,struct genl_info *info);int smc_nl_disable_hs_limitation (struct sk_buff *skb,struct genl_info *info); +static inline void smc_sock_set_flag (struct sock *sk,enum sock_flags flag) +{ +set_bit (flag, &sk->sk_flags); +} +#endif /* __SMC_H */
net/smc/smc_cdc.c +1 -1
@@ -385,7 +385,7 @@ static void smc_cdc_msg_recv_action(struct smc_sock *smc, smc->sk.sk_shutdown |=RCV_SHUTDOWN ;if (smc->clcsock && smc->clcsock->sk) smc->clcsock->sk->sk_shutdown |=RCV_SHUTDOWN ; -sock_set_flag (&smc->sk,SOCK_DONE ); +smc_sock_set_flag (&smc->sk,SOCK_DONE );sock_hold (&smc->sk);/* sock_put in close_work */ if (!queue_work (smc_close_wq, &conn->close_work))sock_put (&smc->sk);
net/smc/smc_close.c +1 -1
@@ -173,7 +173,7 @@ void smc_close_active_abort(struct smc_sock *smc)break ; } -sock_set_flag (sk,SOCK_DEAD ); +smc_sock_set_flag (sk,SOCK_DEAD ); sk->sk_state_change (sk);if (release_clcsock) {
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 353/379 net/smc: allow cdc msg send rather than drop it with NULL sndbuf_desc
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: D. Wythe <[email protected]>
[ Upstream commit c5bf605ba4f9d6fbbb120595ab95002f4716edcb ]
This patch re-fix the issues mentioned by commit 22a825c541d7 ("net/smc: fix NULL sndbuf_desc in smc_cdc_tx_handler()").
Blocking sending message do solve the issues though, but it also prevents the peer to receive the final message. Besides, in logic, whether the sndbuf_desc is NULL or not have no impact on the processing of cdc message sending.
Hence that, this patch allows the cdc message sending but to check the sndbuf_desc with care in smc_cdc_tx_handler().
--- net/smc/smc_cdc.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
net/smc/smc_cdc.c +4 -5
@@ -28,13 +28,15 @@ static void smc_cdc_tx_handler(struct smc_wr_tx_pend_priv *pnd_snd, {struct smc_cdc_tx_pend *cdcpend = (struct smc_cdc_tx_pend *)pnd_snd;struct smc_connection *conn = cdcpend->conn; +struct smc_buf_desc *sndbuf_desc;struct smc_sock *smc;int diff; + sndbuf_desc = conn->sndbuf_desc; smc = container_of(conn, struct smc_sock, conn);bh_lock_sock (&smc->sk); -if (!wc_status) { - diff =smc_curs_diff (cdcpend->conn->sndbuf_desc->len, +if (!wc_status && sndbuf_desc) { + diff =smc_curs_diff (sndbuf_desc->len, &cdcpend->conn->tx_curs_fin, &cdcpend->cursor);/* sndbuf_space is decreased in smc_sendmsg */
@@ -114,9 +116,6 @@ int smc_cdc_msg_send(struct smc_connection *conn,union smc_host_cursor cfed;int rc; -if (unlikely (!READ_ONCE (conn->sndbuf_desc))) -return -ENOBUFS ; -smc_cdc_add_pending_send (conn, pend); conn->tx_cdc_seq++;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 354/379 net/smc: put sk reference if close work was canceled
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: D. Wythe <[email protected]>
[ Upstream commit aa96fbd6d78d9770323b21e2c92bd38821be8852 ]
Note that we always hold a reference to sock when attempting to submit close_work. Therefore, if we have successfully canceled close_work from pending, we MUST release that reference to avoid potential leaks.
--- net/smc/smc_close.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/smc/smc_close.c +2 -1
@@ -116,7 +116,8 @@ static void smc_close_cancel_work(struct smc_sock *smc)struct sock *sk = &smc->sk;release_sock (sk); -cancel_work_sync (&smc->conn.close_work); +if (cancel_work_sync (&smc->conn.close_work)) +sock_put (sk);cancel_delayed_work_sync (&smc->conn.tx_work);lock_sock (sk); }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 355/379 nvme: fix error-handling for io_uring nvme-passthrough
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anuj Gupta <[email protected]>
[ Upstream commit 1147dd0503564fa0e03489a039f9e0c748a03db4 ]
Driver may return an error before submitting the command to the device. Ensure that such error is propagated up.
--- drivers/nvme/host/ioctl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/nvme/host/ioctl.c +5 -2
@@ -435,10 +435,13 @@ static enum rq_end_io_ret nvme_uring_cmd_end_io(struct request *req,void *cookie =READ_ONCE (ioucmd->cookie); req->bio = pdu->bio; -if (nvme_req (req)->flags &NVME_REQ_CANCELLED ) +if (nvme_req (req)->flags &NVME_REQ_CANCELLED ) { pdu->nvme_status = -EINTR ; -else + }else { pdu->nvme_status =nvme_req (req)->status; +if (!pdu->nvme_status) + pdu->nvme_status =blk_status_to_errno (err); + } pdu->u.result =le64_to_cpu (nvme_req (req)->result.u64);/*
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 356/379 tg3: power down device only on SYSTEM_POWER_OFF
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: George Shuklin <[email protected]>
[ Upstream commit 9fc3bc7643341dc5be7d269f3d3dbe441d8d7ac3 ]
Dell R650xs servers hangs on reboot if tg3 driver calls tg3_power_down.
This happens only if network adapters (BCM5720 for R650xs) were initialized using SNP (e.g. by booting ipxe.efi).
The actual problem is on Dell side, but this fix allows servers to come back alive after reboot.
--- drivers/net/ethernet/broadcom/tg3.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/tg3.c +2 -1
@@ -18086,7 +18086,8 @@ static void tg3_shutdown(struct pci_dev *pdev)if (netif_running (dev))dev_close (dev); -tg3_power_down (tp); +if (system_state ==SYSTEM_POWER_OFF ) +tg3_power_down (tp);rtnl_unlock ();
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 357/379 nbd: fix uaf in nbd_open
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Lingfeng <[email protected]>
[ Upstream commit 327462725b0f759f093788dfbcb2f1fd132f956b ]
Commit 4af5f2e03013 ("nbd: use blk_mq_alloc_disk and blk_cleanup_disk") cleans up disk by blk_cleanup_disk() and it won't set disk->private_data as NULL as before. UAF may be triggered in nbd_open() if someone tries to open nbd device right after nbd_put() since nbd has been free in nbd_dev_remove().
Fix this by implementing ->free_disk and free private data in it.
--- drivers/block/nbd.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/block/nbd.c +9 -2
@@ -250,7 +250,6 @@ static void nbd_dev_remove(struct nbd_device *nbd)struct gendisk *disk = nbd->disk;del_gendisk (disk); -put_disk (disk);blk_mq_free_tag_set (&nbd->tag_set);/*
@@ -261,7 +260,7 @@ static void nbd_dev_remove(struct nbd_device *nbd)idr_remove (&nbd_index_idr, nbd->index);mutex_unlock (&nbd_index_mutex);destroy_workqueue (nbd->recv_workq); -kfree (nbd); +put_disk (disk); }static void nbd_dev_remove_work (struct work_struct *work)
@@ -1608,6 +1607,13 @@ static void nbd_release(struct gendisk *disk, fmode_t mode)nbd_put (nbd); } +static void nbd_free_disk (struct gendisk *disk) +{ +struct nbd_device *nbd = disk->private_data; + +kfree (nbd); +} +static const struct block_device_operations nbd_fops = { .owner =THIS_MODULE ,
@@ -1615,6 +1621,7 @@ static const struct block_device_operations nbd_fops = .release = nbd_release, .ioctl = nbd_ioctl, .compat_ioctl = nbd_ioctl, + .free_disk = nbd_free_disk, };#if IS_ENABLED (CONFIG_DEBUG_FS )
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 358/379 blk-core: use pr_warn_ratelimited() in bio_check_ro()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
[ Upstream commit 1b0a151c10a6d823f033023b9fdd9af72a89591b ]
If one of the underlying disks of raid or dm is set to read-only, then each io will generate new log, which will cause message storm. This environment is indeed problematic, however we can't make sure our naive custormer won't do this, hence use pr_warn_ratelimited() to prevent message storm in this case.
--- block/blk-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
block/blk-core.c +2 -2
@@ -490,8 +490,8 @@ static inline void bio_check_ro(struct bio *bio)if (op_is_write (bio_op (bio)) &&bdev_read_only (bio->bi_bdev)) {if (op_is_flush (bio->bi_opf) && !bio_sectors (bio))return ; -pr_warn ("Trying to write to read-only block-device %pg\n" , - bio->bi_bdev); +pr_warn_ratelimited ("Trying to write to read-only block-device %pg\n" , + bio->bi_bdev);/* Older lvm-tools actually trigger this */ } }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 359/379 virtio/vsock: replace virtio_vsock_pkt with sk_buff
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bobby Eshleman <[email protected]>
[ Upstream commit 71dc9ec9ac7d3eee785cdc986c3daeb821381e20 ]
This commit changes virtio/vsock to use sk_buff instead of virtio_vsock_pkt. Beyond better conforming to other net code, using sk_buff allows vsock to use sk_buff-dependent features in the future (such as sockmap) and improves throughput.
This patch introduces the following performance changes:
Tool: Uperf
Env: Phys Host + L1 Guest
Payload: 64k
Threads: 16
Test Runs: 10
Type: SOCK_STREAM
Before: commit b7bfaa761d760 ("Linux 6.2-rc3")
Before
------
g2h: 16.77Gb/s
h2g: 10.56Gb/s
After
-----
g2h: 21.04Gb/s
h2g: 10.76Gb/s
Stable-dep-of: 3a5cc90a4d17 ("vsock/virtio: remove socket from connected/bound list on shutdown")
--- drivers/vhost/vsock.c | 214 +++++------- include/linux/virtio_vsock.h | 129 ++++++-- net/vmw_vsock/virtio_transport.c | 149 +++------ net/vmw_vsock/virtio_transport_common.c | 422 +++++++++++++----------- net/vmw_vsock/vsock_loopback.c | 51 +-- 5 files changed, 498 insertions(+), 467 deletions(-)
drivers/vhost/vsock.c +89 -125
@@ -51,8 +51,7 @@ struct vhost_vsock {struct hlist_node hash;struct vhost_work send_pkt_work; -spinlock_t send_pkt_list_lock; -struct list_head send_pkt_list;/* host->guest pending packets */ +struct sk_buff_head send_pkt_queue;/* host->guest pending packets */ atomic_t queued_replies;
@@ -108,40 +107,31 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock,vhost_disable_notify (&vsock->dev, vq); do { - struct virtio_vsock_pkt *pkt; + struct virtio_vsock_hdr *hdr; + size_t iov_len, payload_len; struct iov_iter iov_iter; + u32 flags_to_restore = 0; + struct sk_buff *skb; unsigned out, in; size_t nbytes; - size_t iov_len, payload_len; int head; - u32 flags_to_restore = 0; - spin_lock_bh(&vsock->send_pkt_list_lock); - if (list_empty(&vsock->send_pkt_list)) { - spin_unlock_bh(&vsock->send_pkt_list_lock); + skb = virtio_vsock_skb_dequeue(&vsock->send_pkt_queue); + + if (!skb) { vhost_enable_notify(&vsock->dev, vq); break; } - pkt = list_first_entry(&vsock->send_pkt_list, - struct virtio_vsock_pkt, list); - list_del_init(&pkt->list); - spin_unlock_bh(&vsock->send_pkt_list_lock); - head = vhost_get_vq_desc(vq, vq->iov, ARRAY_SIZE(vq->iov), &out, &in, NULL, NULL); if (head < 0) { - spin_lock_bh(&vsock->send_pkt_list_lock); - list_add(&pkt->list, &vsock->send_pkt_list); - spin_unlock_bh(&vsock->send_pkt_list_lock); + virtio_vsock_skb_queue_head(&vsock->send_pkt_queue, skb); break; } if (head == vq->num) { - spin_lock_bh(&vsock->send_pkt_list_lock); - list_add(&pkt->list, &vsock->send_pkt_list); - spin_unlock_bh(&vsock->send_pkt_list_lock); - + virtio_vsock_skb_queue_head(&vsock->send_pkt_queue, skb); /* We cannot finish yet if more buffers snuck in while * re-enabling notify. */
@@ -153,26 +143,27 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock, }if (out) { -virtio_transport_free_pkt (pkt); +kfree_skb (skb);vq_err (vq,"Expected 0 output buffers, got %u\n" , out);break ; } iov_len =iov_length (&vq->iov[out], in); -if (iov_len <sizeof (pkt->hdr)) { -virtio_transport_free_pkt (pkt); +if (iov_len <sizeof (*hdr)) { +kfree_skb (skb);vq_err (vq,"Buffer len [%zu] too small\n" , iov_len);break ; }iov_iter_init (&iov_iter,ITER_DEST , &vq->iov[out], in, iov_len); - payload_len = pkt->len - pkt->off; + payload_len = skb->len; + hdr =virtio_vsock_hdr (skb);/* If the packet is greater than the space available in the * buffer, we split it using multiple buffers. */ -if (payload_len > iov_len -sizeof (pkt->hdr)) { - payload_len = iov_len -sizeof (pkt->hdr); +if (payload_len > iov_len -sizeof (*hdr)) { + payload_len = iov_len -sizeof (*hdr);/* As we are copying pieces of large packet's buffer to * small rx buffers, headers of packets in rx queue are
@@ -185,31 +176,30 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock,* bits set. After initialized header will be copied to * rx buffer, these required bits will be restored. */ -if (le32_to_cpu (pkt->hdr.flags) &VIRTIO_VSOCK_SEQ_EOM ) { - pkt->hdr.flags &= ~cpu_to_le32 (VIRTIO_VSOCK_SEQ_EOM ); +if (le32_to_cpu (hdr->flags) &VIRTIO_VSOCK_SEQ_EOM ) { + hdr->flags &= ~cpu_to_le32 (VIRTIO_VSOCK_SEQ_EOM ); flags_to_restore |=VIRTIO_VSOCK_SEQ_EOM ; -if (le32_to_cpu (pkt->hdr.flags) &VIRTIO_VSOCK_SEQ_EOR ) { - pkt->hdr.flags &= ~cpu_to_le32 (VIRTIO_VSOCK_SEQ_EOR ); +if (le32_to_cpu (hdr->flags) &VIRTIO_VSOCK_SEQ_EOR ) { + hdr->flags &= ~cpu_to_le32 (VIRTIO_VSOCK_SEQ_EOR ); flags_to_restore |=VIRTIO_VSOCK_SEQ_EOR ; } } }/* Set the correct length in the header */ - pkt->hdr.len =cpu_to_le32 (payload_len); + hdr->len =cpu_to_le32 (payload_len); - nbytes =copy_to_iter (&pkt->hdr,sizeof (pkt->hdr), &iov_iter); -if (nbytes !=sizeof (pkt->hdr)) { -virtio_transport_free_pkt (pkt); + nbytes =copy_to_iter (hdr,sizeof (*hdr), &iov_iter); +if (nbytes !=sizeof (*hdr)) { +kfree_skb (skb);vq_err (vq,"Faulted on copying pkt hdr\n" );break ; } - nbytes =copy_to_iter (pkt->buf + pkt->off, payload_len, - &iov_iter); + nbytes =copy_to_iter (skb->data, payload_len, &iov_iter);if (nbytes != payload_len) { -virtio_transport_free_pkt (pkt); +kfree_skb (skb);vq_err (vq,"Faulted on copying pkt buf\n" );break ; }
@@ -217,31 +207,28 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock,/* Deliver to monitoring devices all packets that we * will transmit. */ -virtio_transport_deliver_tap_pkt (pkt); +virtio_transport_deliver_tap_pkt (skb); -vhost_add_used (vq, head,sizeof (pkt->hdr) + payload_len); +vhost_add_used (vq, head,sizeof (*hdr) + payload_len); added = true; - pkt->off += payload_len; +skb_pull (skb, payload_len); total_len += payload_len;/* If we didn't send all the payload we can requeue the packet * to send it with the next available buffer. */ -if (pkt->off < pkt->len) { - pkt->hdr.flags |=cpu_to_le32 (flags_to_restore); +if (skb->len >0 ) { + hdr->flags |=cpu_to_le32 (flags_to_restore); -/* We are queueing the same virtio_vsock_pkt to handle +/* We are queueing the same skb to handle * the remaining bytes, and we want to deliver it * to monitoring devices in the next iteration. */ - pkt->tap_delivered = false; - -spin_lock_bh (&vsock->send_pkt_list_lock); -list_add (&pkt->list, &vsock->send_pkt_list); -spin_unlock_bh (&vsock->send_pkt_list_lock); +virtio_vsock_skb_clear_tap_delivered (skb); +virtio_vsock_skb_queue_head (&vsock->send_pkt_queue, skb); }else { -if (pkt->reply) { +if (virtio_vsock_skb_reply (skb)) {int val; val =atomic_dec_return (&vsock->queued_replies);
@@ -253,7 +240,7 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock, restart_tx = true; } -virtio_transport_free_pkt (pkt); +consume_skb (skb); } }while (likely (!vhost_exceeds_weight (vq, ++pkts, total_len)));if (added)
@@ -278,28 +265,26 @@ static void vhost_transport_send_pkt_work(struct vhost_work *work) }static int -vhost_transport_send_pkt (struct virtio_vsock_pkt *pkt) +vhost_transport_send_pkt (struct sk_buff *skb) { +struct virtio_vsock_hdr *hdr =virtio_vsock_hdr (skb);struct vhost_vsock *vsock; -int len = pkt->len; +int len = skb->len;rcu_read_lock ();/* Find the vhost_vsock according to guest context id */ - vsock =vhost_vsock_get (le64_to_cpu (pkt->hdr.dst_cid)); + vsock =vhost_vsock_get (le64_to_cpu (hdr->dst_cid));if (!vsock) {rcu_read_unlock (); -virtio_transport_free_pkt (pkt); +kfree_skb (skb);return -ENODEV ; } -if (pkt->reply) +if (virtio_vsock_skb_reply (skb))atomic_inc (&vsock->queued_replies); -spin_lock_bh (&vsock->send_pkt_list_lock); -list_add_tail (&pkt->list, &vsock->send_pkt_list); -spin_unlock_bh (&vsock->send_pkt_list_lock); - +virtio_vsock_skb_queue_tail (&vsock->send_pkt_queue, skb);vhost_work_queue (&vsock->dev, &vsock->send_pkt_work);rcu_read_unlock ();
@@ -310,10 +295,8 @@ static int vhost_transport_cancel_pkt(struct vsock_sock *vsk) {struct vhost_vsock *vsock; -struct virtio_vsock_pkt *pkt, *n;int cnt =0 ;int ret = -ENODEV ; -LIST_HEAD (freeme);rcu_read_lock ();
@@ -322,20 +305,7 @@ vhost_transport_cancel_pkt(struct vsock_sock *vsk)if (!vsock) goto out; -spin_lock_bh (&vsock->send_pkt_list_lock); -list_for_each_entry_safe (pkt, n, &vsock->send_pkt_list, list) { -if (pkt->vsk != vsk) -continue ; -list_move (&pkt->list, &freeme); - } -spin_unlock_bh (&vsock->send_pkt_list_lock); - -list_for_each_entry_safe (pkt, n, &freeme, list) { -if (pkt->reply) - cnt++; -list_del (&pkt->list); -virtio_transport_free_pkt (pkt); - } + cnt =virtio_transport_purge_skbs (vsk, &vsock->send_pkt_queue);if (cnt) {struct vhost_virtqueue *tx_vq = &vsock->vqs[VSOCK_VQ_TX ];
@@ -352,12 +322,14 @@ vhost_transport_cancel_pkt(struct vsock_sock *vsk)return ret; } -static struct virtio_vsock_pkt * -vhost_vsock_alloc_pkt (struct vhost_virtqueue *vq, +static struct sk_buff * +vhost_vsock_alloc_skb (struct vhost_virtqueue *vq,unsigned int out,unsigned int in) { -struct virtio_vsock_pkt *pkt; +struct virtio_vsock_hdr *hdr;struct iov_iter iov_iter; +struct sk_buff *skb; +size_t payload_len;size_t nbytes;size_t len;
@@ -366,50 +338,48 @@ vhost_vsock_alloc_pkt(struct vhost_virtqueue *vq,return NULL ; } - pkt =kzalloc (sizeof (*pkt),GFP_KERNEL ); -if (!pkt) + len =iov_length (vq->iov, out); + +/* len contains both payload and hdr */ + skb =virtio_vsock_alloc_skb (len,GFP_KERNEL ); +if (!skb)return NULL ; - len =iov_length (vq->iov, out);iov_iter_init (&iov_iter,ITER_SOURCE , vq->iov, out, len); - nbytes =copy_from_iter (&pkt->hdr,sizeof (pkt->hdr), &iov_iter); -if (nbytes !=sizeof (pkt->hdr)) { + hdr =virtio_vsock_hdr (skb); + nbytes =copy_from_iter (hdr,sizeof (*hdr), &iov_iter); +if (nbytes !=sizeof (*hdr)) {vq_err (vq,"Expected %zu bytes for pkt->hdr, got %zu bytes\n" , -sizeof (pkt->hdr), nbytes); -kfree (pkt); +sizeof (*hdr), nbytes); +kfree_skb (skb);return NULL ; } - pkt->len =le32_to_cpu (pkt->hdr.len); + payload_len =le32_to_cpu (hdr->len);/* No payload */ -if (!pkt->len) -return pkt; +if (!payload_len) +return skb; -/* The pkt is too big */ -if (pkt->len >VIRTIO_VSOCK_MAX_PKT_BUF_SIZE ) { -kfree (pkt); +/* The pkt is too big or the length in the header is invalid */ +if (payload_len >VIRTIO_VSOCK_MAX_PKT_BUF_SIZE || + payload_len +sizeof (*hdr) > len) { +kfree_skb (skb);return NULL ; } - pkt->buf =kvmalloc (pkt->len,GFP_KERNEL ); -if (!pkt->buf) { -kfree (pkt); -return NULL ; - } +virtio_vsock_skb_rx_put (skb); - pkt->buf_len = pkt->len; - - nbytes =copy_from_iter (pkt->buf, pkt->len, &iov_iter); -if (nbytes != pkt->len) { -vq_err (vq,"Expected %u byte payload, got %zu bytes\n" , - pkt->len, nbytes); -virtio_transport_free_pkt (pkt); + nbytes =copy_from_iter (skb->data, payload_len, &iov_iter); +if (nbytes != payload_len) { +vq_err (vq,"Expected %zu byte payload, got %zu bytes\n" , + payload_len, nbytes); +kfree_skb (skb);return NULL ; } -return pkt; +return skb; }/* Is there space left for replies to rx packets? */
@@ -496,9 +466,9 @@ static void vhost_vsock_handle_tx_kick(struct vhost_work *work) poll.work); struct vhost_vsock *vsock = container_of(vq->dev, struct vhost_vsock, dev); -struct virtio_vsock_pkt *pkt;int head, pkts =0 , total_len =0 ;unsigned int out, in; +struct sk_buff *skb;bool added = false;mutex_lock (&vq->mutex);
@@ -511,6 +481,8 @@ static void vhost_vsock_handle_tx_kick(struct vhost_work *work)vhost_disable_notify (&vsock->dev, vq); do { + struct virtio_vsock_hdr *hdr; + if (!vhost_vsock_more_replies(vsock)) { /* Stop tx until the device processes already * pending replies. Leave tx virtqueue
@@ -532,24 +504,26 @@ static void vhost_vsock_handle_tx_kick(struct vhost_work *work)break ; } - pkt =vhost_vsock_alloc_pkt (vq, out, in); -if (!pkt) { + skb =vhost_vsock_alloc_skb (vq, out, in); +if (!skb) {vq_err (vq,"Faulted on pkt\n" );continue ; } - total_len +=sizeof (pkt->hdr) + pkt->len; + total_len +=sizeof (*hdr) + skb->len;/* Deliver to monitoring devices all received packets */ -virtio_transport_deliver_tap_pkt (pkt); +virtio_transport_deliver_tap_pkt (skb); + + hdr =virtio_vsock_hdr (skb);/* Only accept correctly addressed packets */ -if (le64_to_cpu (pkt->hdr.src_cid) == vsock->guest_cid && -le64_to_cpu (pkt->hdr.dst_cid) == +if (le64_to_cpu (hdr->src_cid) == vsock->guest_cid && +le64_to_cpu (hdr->dst_cid) ==vhost_transport_get_local_cid ()) -virtio_transport_recv_pkt (&vhost_transport, pkt); +virtio_transport_recv_pkt (&vhost_transport, skb);else -virtio_transport_free_pkt (pkt); +kfree_skb (skb);vhost_add_used (vq, head,0 ); added = true;
@@ -693,8 +667,7 @@ static int vhost_vsock_dev_open(struct inode *inode, struct file *file) VHOST_VSOCK_WEIGHT, true, NULL); file->private_data = vsock; -spin_lock_init (&vsock->send_pkt_list_lock); -INIT_LIST_HEAD (&vsock->send_pkt_list); +skb_queue_head_init (&vsock->send_pkt_queue);vhost_work_init (&vsock->send_pkt_work, vhost_transport_send_pkt_work);return 0 ;
@@ -760,16 +733,7 @@ static int vhost_vsock_dev_release(struct inode *inode, struct file *file)vhost_vsock_flush (vsock);vhost_dev_stop (&vsock->dev); -spin_lock_bh (&vsock->send_pkt_list_lock); -while (!list_empty (&vsock->send_pkt_list)) { -struct virtio_vsock_pkt *pkt; - - pkt =list_first_entry (&vsock->send_pkt_list, - struct virtio_vsock_pkt, list); -list_del_init (&pkt->list); -virtio_transport_free_pkt (pkt); - } -spin_unlock_bh (&vsock->send_pkt_list_lock); +virtio_vsock_skb_queue_purge (&vsock->send_pkt_queue);vhost_dev_cleanup (&vsock->dev);kfree (vsock->dev.vqs);
include/linux/virtio_vsock.h +109 -20
156 lines not on this page · raw message
net/vmw_vsock/virtio_transport.c +52 -97
280 lines not on this page · raw message
net/vmw_vsock/virtio_transport_common.c +233 -189
887 lines not on this page · raw message
net/vmw_vsock/vsock_loopback.c +15 -36
102 lines not on this page · raw message
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 360/379 vsock/virtio: remove socket from connected/bound list on shutdown
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filippo Storniolo <[email protected]>
[ Upstream commit 3a5cc90a4d1756072619fe511d07621bdef7f120 ]
If the same remote peer, using the same port, tries to connect to a server on a listening port more than once, the server will reject the connection, causing a "connection reset by peer" error on the remote peer. This is due to the presence of a dangling socket from a previous connection in both the connected and bound socket lists.
The inconsistency of the above lists only occurs when the remote peer disconnects and the server remains active.
This bug does not occur when the server socket is closed:virtio_transport_release() will eventually schedule a call to virtio_transport_do_close() and the latter will remove the socket from the bound and connected socket lists and clear the sk_buff.
However, virtio_transport_do_close() will only perform the above actions if it has been scheduled, and this will not happen if the server is processing the shutdown message from a remote peer.
To fix this, introduce a call to vsock_remove_sock() when the server is handling a client disconnect.
This is to remove the socket from the bound and connected socket lists without clearing the sk_buff.
--- net/vmw_vsock/virtio_transport_common.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
net/vmw_vsock/virtio_transport_common.c +11 -5
@@ -1108,11 +1108,17 @@ virtio_transport_recv_connected(struct sock *sk, vsk->peer_shutdown |=RCV_SHUTDOWN ;if (le32_to_cpu (hdr->flags) &VIRTIO_VSOCK_SHUTDOWN_SEND ) vsk->peer_shutdown |=SEND_SHUTDOWN ; -if (vsk->peer_shutdown ==SHUTDOWN_MASK && -vsock_stream_has_data (vsk) <=0 && - !sock_flag (sk,SOCK_DONE )) { - (void )virtio_transport_reset (vsk,NULL ); -virtio_transport_do_close (vsk, true); +if (vsk->peer_shutdown ==SHUTDOWN_MASK ) { +if (vsock_stream_has_data (vsk) <=0 && !sock_flag (sk,SOCK_DONE )) { + (void )virtio_transport_reset (vsk,NULL ); +virtio_transport_do_close (vsk, true); + } +/* Remove this socket anyway because the remote peer sent +* the shutdown. This way a new connection will succeed +* if the remote peer uses the same source port, +* even if the old socket is still unreleased, but now disconnected. +*/ +vsock_remove_sock (vsk); }if (le32_to_cpu (virtio_vsock_hdr (skb)->flags)) sk->sk_state_change (sk);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 361/379 r8169: respect userspace disabling IFF_MULTICAST
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiner Kallweit <[email protected]>
[ Upstream commit 8999ce4cfc87e61b4143ec2e7b93d8e92e11fa7f ]
So far we ignore the setting of IFF_MULTICAST. Fix this and clear bit AcceptMulticast if IFF_MULTICAST isn't set.
Note: Based on the implementations I've seen it doesn't seem to be 100% clear what a driver is supposed to do if IFF_ALLMULTI is set but IFF_MULTICAST is not. This patch is based on the understanding that IFF_MULTICAST has precedence.
--- drivers/net/ethernet/realtek/r8169_main.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/realtek/r8169_main.c +2 -0
@@ -2512,6 +2512,8 @@ static void rtl_set_rx_mode(struct net_device *dev)if (dev->flags &IFF_PROMISC ) { rx_mode |= AcceptAllPhys; + }else if (!(dev->flags &IFF_MULTICAST )) { + rx_mode &= ~AcceptMulticast; } else if (netdev_mc_count(dev) > MC_FILTER_LIMIT || dev->flags & IFF_ALLMULTI || tp->mac_version == RTL_GIGA_MAC_VER_35 ||
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 362/379 i2c: iproc: handle invalid slave state
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roman Bacik <[email protected]>
[ Upstream commit ba15a14399c262f91ce30c19fcbdc952262dd1be ]
Add the code to handle an invalid state when both bits S_RX_EVENT (indicating a transaction) and S_START_BUSY (indicating the end of transaction - transition of START_BUSY from 1 to 0) are set in the interrupt status register during a slave read.
--- drivers/i2c/busses/i2c-bcm-iproc.c | 133 ++++++++++++++++------------- 1 file changed, 75 insertions(+), 58 deletions(-)
drivers/i2c/busses/i2c-bcm-iproc.c +75 -58
@@ -316,26 +316,44 @@ static void bcm_iproc_i2c_slave_init(iproc_i2c_wr_reg (iproc_i2c,IE_OFFSET , val); } -static void bcm_iproc_i2c_check_slave_status ( -struct bcm_iproc_i2c_dev *iproc_i2c) +static bool bcm_iproc_i2c_check_slave_status + (struct bcm_iproc_i2c_dev *iproc_i2c,u32 status) {u32 val; +bool recover = false; - val =iproc_i2c_rd_reg (iproc_i2c,S_CMD_OFFSET ); -/* status is valid only when START_BUSY is cleared after it was set */ -if (val &BIT (S_CMD_START_BUSY_SHIFT )) -return ; +/* check slave transmit status only if slave is transmitting */ +if (!iproc_i2c->slave_rx_only) { + val =iproc_i2c_rd_reg (iproc_i2c,S_CMD_OFFSET ); +/* status is valid only when START_BUSY is cleared */ +if (!(val &BIT (S_CMD_START_BUSY_SHIFT ))) { + val = (val >>S_CMD_STATUS_SHIFT ) &S_CMD_STATUS_MASK ; +if (val ==S_CMD_STATUS_TIMEOUT || + val ==S_CMD_STATUS_MASTER_ABORT ) { +dev_warn (iproc_i2c->device, + (val ==S_CMD_STATUS_TIMEOUT ) ? +"slave random stretch time timeout\n" : +"Master aborted read transaction\n" ); + recover = true; + } + } + } + +/* RX_EVENT is not valid when START_BUSY is set */ +if ((status &BIT (IS_S_RX_EVENT_SHIFT )) && + (status &BIT (IS_S_START_BUSY_SHIFT ))) { +dev_warn (iproc_i2c->device,"Slave aborted read transaction\n" ); + recover = true; + } - val = (val >>S_CMD_STATUS_SHIFT ) &S_CMD_STATUS_MASK ; -if (val ==S_CMD_STATUS_TIMEOUT || val ==S_CMD_STATUS_MASTER_ABORT ) { -dev_err (iproc_i2c->device, (val ==S_CMD_STATUS_TIMEOUT ) ? -"slave random stretch time timeout\n" : -"Master aborted read transaction\n" ); +if (recover) {/* re-initialize i2c for recovery */ bcm_iproc_i2c_enable_disable (iproc_i2c, false);bcm_iproc_i2c_slave_init (iproc_i2c, true);bcm_iproc_i2c_enable_disable (iproc_i2c, true); } + +return recover; }static void bcm_iproc_i2c_slave_read (struct bcm_iproc_i2c_dev *iproc_i2c)
@@ -420,48 +438,6 @@ static bool bcm_iproc_i2c_slave_isr(struct bcm_iproc_i2c_dev *iproc_i2c,u32 val;u8 value; -/* -* Slave events in case of master-write, master-write-read and, -* master-read -* -* Master-write : only IS_S_RX_EVENT_SHIFT event -* Master-write-read: both IS_S_RX_EVENT_SHIFT and IS_S_RD_EVENT_SHIFT -* events -* Master-read : both IS_S_RX_EVENT_SHIFT and IS_S_RD_EVENT_SHIFT -* events or only IS_S_RD_EVENT_SHIFT -* -* iproc has a slave rx fifo size of 64 bytes. Rx fifo full interrupt -* (IS_S_RX_FIFO_FULL_SHIFT) will be generated when RX fifo becomes -* full. This can happen if Master issues write requests of more than -* 64 bytes. -*/ -if (status &BIT (IS_S_RX_EVENT_SHIFT ) || - status &BIT (IS_S_RD_EVENT_SHIFT ) || - status &BIT (IS_S_RX_FIFO_FULL_SHIFT )) { -/* disable slave interrupts */ - val =iproc_i2c_rd_reg (iproc_i2c,IE_OFFSET ); - val &= ~iproc_i2c->slave_int_mask; -iproc_i2c_wr_reg (iproc_i2c,IE_OFFSET , val); - -if (status &BIT (IS_S_RD_EVENT_SHIFT )) -/* Master-write-read request */ - iproc_i2c->slave_rx_only = false; -else -/* Master-write request only */ - iproc_i2c->slave_rx_only = true; - -/* schedule tasklet to read data later */ -tasklet_schedule (&iproc_i2c->slave_rx_tasklet); - -/* -* clear only IS_S_RX_EVENT_SHIFT and -* IS_S_RX_FIFO_FULL_SHIFT interrupt. -*/ - val =BIT (IS_S_RX_EVENT_SHIFT ); -if (status &BIT (IS_S_RX_FIFO_FULL_SHIFT )) - val |=BIT (IS_S_RX_FIFO_FULL_SHIFT ); -iproc_i2c_wr_reg (iproc_i2c,IS_OFFSET , val); - }if (status &BIT (IS_S_TX_UNDERRUN_SHIFT )) { iproc_i2c->tx_underrun++;
@@ -493,8 +469,9 @@ static bool bcm_iproc_i2c_slave_isr(struct bcm_iproc_i2c_dev *iproc_i2c,* less than PKT_LENGTH bytes were output on the SMBUS */ iproc_i2c->slave_int_mask &= ~BIT (IE_S_TX_UNDERRUN_SHIFT ); -iproc_i2c_wr_reg (iproc_i2c,IE_OFFSET , - iproc_i2c->slave_int_mask); + val =iproc_i2c_rd_reg (iproc_i2c,IE_OFFSET ); + val &= ~BIT (IE_S_TX_UNDERRUN_SHIFT ); +iproc_i2c_wr_reg (iproc_i2c,IE_OFFSET , val);/* End of SMBUS for Master Read */ val =BIT (S_TX_WR_STATUS_SHIFT );
@@ -515,9 +492,49 @@ static bool bcm_iproc_i2c_slave_isr(struct bcm_iproc_i2c_dev *iproc_i2c, BIT(IS_S_START_BUSY_SHIFT)); } -/* check slave transmit status only if slave is transmitting */ -if (!iproc_i2c->slave_rx_only) -bcm_iproc_i2c_check_slave_status (iproc_i2c); +/* if the controller has been reset, immediately return from the ISR */ +if (bcm_iproc_i2c_check_slave_status (iproc_i2c, status)) +return true; + +/* +* Slave events in case of master-write, master-write-read and, +* master-read +* +* Master-write : only IS_S_RX_EVENT_SHIFT event +* Master-write-read: both IS_S_RX_EVENT_SHIFT and IS_S_RD_EVENT_SHIFT +* events +* Master-read : both IS_S_RX_EVENT_SHIFT and IS_S_RD_EVENT_SHIFT +* events or only IS_S_RD_EVENT_SHIFT +* +* iproc has a slave rx fifo size of 64 bytes. Rx fifo full interrupt +* (IS_S_RX_FIFO_FULL_SHIFT) will be generated when RX fifo becomes +* full. This can happen if Master issues write requests of more than +* 64 bytes. +*/ +if (status &BIT (IS_S_RX_EVENT_SHIFT ) || + status &BIT (IS_S_RD_EVENT_SHIFT ) || + status &BIT (IS_S_RX_FIFO_FULL_SHIFT )) { +/* disable slave interrupts */ + val =iproc_i2c_rd_reg (iproc_i2c,IE_OFFSET ); + val &= ~iproc_i2c->slave_int_mask; +iproc_i2c_wr_reg (iproc_i2c,IE_OFFSET , val); + +if (status &BIT (IS_S_RD_EVENT_SHIFT )) +/* Master-write-read request */ + iproc_i2c->slave_rx_only = false; +else +/* Master-write request only */ + iproc_i2c->slave_rx_only = true; + +/* schedule tasklet to read data later */ +tasklet_schedule (&iproc_i2c->slave_rx_tasklet); + +/* clear IS_S_RX_FIFO_FULL_SHIFT interrupt */ +if (status &BIT (IS_S_RX_FIFO_FULL_SHIFT )) { + val =BIT (IS_S_RX_FIFO_FULL_SHIFT ); +iproc_i2c_wr_reg (iproc_i2c,IS_OFFSET , val); + } + }return true; }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 363/379 netfilter: xt_recent: fix (increase) ipv6 literal buffer length
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej Żenczykowski <[email protected]>
[ Upstream commit 7b308feb4fd2d1c06919445c65c8fbf8e9fd1781 ]
in6_pton() supports 'low-32-bit dot-decimal representation' (this is useful with DNS64/NAT64 networks for example):
# echo +aaaa:bbbb:cccc:dddd:eeee:ffff:1.2.3.4 > /proc/self/net/xt_recent/DEFAULT # cat /proc/self/net/xt_recent/DEFAULT src=aaaa:bbbb:cccc:dddd:eeee:ffff:0102:0304 ttl: 0 last_seen: 9733848829 oldest_pkt: 1 9733848829
but the provided buffer is too short:
# echo +aaaa:bbbb:cccc:dddd:eeee:ffff:255.255.255.255 > /proc/self/net/xt_recent/DEFAULT -bash: echo: write error: Invalid argument
--- net/netfilter/xt_recent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/xt_recent.c +1 -1
@@ -561,7 +561,7 @@ recent_mt_proc_write(struct file *file, const char __user *input, {struct recent_table *t =pde_data (file_inode (file));struct recent_entry *e; -char buf[sizeof ("+b335:1d35:1e55:dead:c0de:1715:5afe:c0de" )]; +char buf[sizeof ("+b335:1d35:1e55:dead:c0de:1715:255.255.255.255" )];const char *c = buf;union nf_inet_addr addr = {};u_int16_t family;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 364/379 netfilter: nft_redir: use `struct nf_nat_range2` throughout and deduplicate eval call-backs
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeremy Sowden <[email protected]>
[ Upstream commit 6f56ad1b92328997e1b1792047099df6f8d7acb5 ]
nf_nat_redirect_ipv4 takes a struct nf_nat_ipv4_multi_range_compat, but converts it internally to a struct nf_nat_range2. Change the function to take the latter, factor out the code now shared with nf_nat_redirect_ipv6, move the conversion to the xt_REDIRECT module, and update the ipv4 range initialization in the nft_redir module.
Replace a bare hex constant for 127.0.0.1 with a macro.
Remove WARN_ON. nf_nat_setup_info calls nf_ct_is_confirmed:
/* Can't setup nat info for confirmed ct. */ if (nf_ct_is_confirmed(ct)) return NF_ACCEPT;
This means that ct cannot be null or the kernel will crash, and implies that ctinfo is IP_CT_NEW or IP_CT_RELATED.
nft_redir has separate ipv4 and ipv6 call-backs which share much of their code, and an inet one switch containing a switch that calls one of the others based on the family of the packet. Merge the ipv4 and ipv6 ones into the inet one in order to get rid of the duplicate code.
Const-qualify the priv pointer since we don't need to write through it.
Assign priv->flags to the range instead of OR-ing it in.
Set the NF_NAT_RANGE_PROTO_SPECIFIED flag once during init, rather than on every eval.
Stable-dep-of: 80abbe8a8263 ("netfilter: nat: fix ipv6 nat redirect with mapped and scoped addresses")
--- include/net/netfilter/nf_nat_redirect.h | 3 +- net/netfilter/nf_nat_redirect.c | 71 ++++++++++----------- net/netfilter/nft_redir.c | 84 +++++++++---------------- net/netfilter/xt_REDIRECT.c | 10 ++- 4 files changed, 72 insertions(+), 96 deletions(-)
include/net/netfilter/nf_nat_redirect.h +1 -2
@@ -6,8 +6,7 @@#include <uapi/linux/netfilter/nf_nat.h> unsigned int -nf_nat_redirect_ipv4 (struct sk_buff *skb, -const struct nf_nat_ipv4_multi_range_compat *mr, +nf_nat_redirect_ipv4 (struct sk_buff *skb,const struct nf_nat_range2 *range,unsigned int hooknum); unsigned int nf_nat_redirect_ipv6(struct sk_buff *skb, const struct nf_nat_range2 *range,
net/netfilter/nf_nat_redirect.c +32 -39
125 lines not on this page · raw message
net/netfilter/nft_redir.c +31 -53
131 lines not on this page · raw message
net/netfilter/xt_REDIRECT.c +8 -2
@@ -46,7 +46,6 @@ static void redirect_tg_destroy(const struct xt_tgdtor_param *par)nf_ct_netns_put (par->net, par->family); } -/* FIXME: Take multiple ranges --RR */ static int redirect_tg4_check (const struct xt_tgchk_param *par) {const struct nf_nat_ipv4_multi_range_compat *mr = par->targinfo;
@@ -65,7 +64,14 @@ static int redirect_tg4_check(const struct xt_tgchk_param *par)static unsigned int redirect_tg4 (struct sk_buff *skb,const struct xt_action_param *par) { -return nf_nat_redirect_ipv4 (skb, par->targinfo,xt_hooknum (par)); +const struct nf_nat_ipv4_multi_range_compat *mr = par->targinfo; +struct nf_nat_range2 range = { + .flags = mr->range[0 ].flags, + .min_proto = mr->range[0 ].min, + .max_proto = mr->range[0 ].max, + }; + +return nf_nat_redirect_ipv4 (skb, &range,xt_hooknum (par)); }static struct xt_target redirect_tg_reg[]__read_mostly = {
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 365/379 netfilter: nat: fix ipv6 nat redirect with mapped and scoped addresses
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Florian Westphal <[email protected]>
[ Upstream commit 80abbe8a8263106fe45a4f293b92b5c74cc9cc8a ]
The ipv6 redirect target was derived from the ipv4 one, i.e. its identical to a 'dnat' with the first (primary) address assigned to the network interface. The code has been moved around to make it usable from nf_tables too, but its still the same as it was back when this was added in 2012.
IPv6, however, has different types of addresses, if the 'wrong' address comes first the redirection does not work.
In Daniels case, the addresses are:
inet6 ::ffff:192 ...
inet6 2a01: ...
... so the function attempts to redirect to the mapped address.
Add more checks before the address is deemed correct:
1. If the packets' daddr is scoped, search for a scoped address too
2. skip tentative addresses
3. skip mapped addresses
Use the first address that appears to match our needs.
--- net/netfilter/nf_nat_redirect.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
net/netfilter/nf_nat_redirect.c +26 -1
@@ -80,6 +80,26 @@ EXPORT_SYMBOL_GPL(nf_nat_redirect_ipv4);static const struct in6_addr loopback_addr =IN6ADDR_LOOPBACK_INIT ; +static bool nf_nat_redirect_ipv6_usable (const struct inet6_ifaddr *ifa,unsigned int scope) +{ +unsigned int ifa_addr_type =ipv6_addr_type (&ifa->addr); + +if (ifa_addr_type &IPV6_ADDR_MAPPED ) +return false; + +if ((ifa->flags &IFA_F_TENTATIVE ) && (!(ifa->flags &IFA_F_OPTIMISTIC ))) +return false; + +if (scope) { +unsigned int ifa_scope = ifa_addr_type &IPV6_ADDR_SCOPE_MASK ; + +if (!(scope & ifa_scope)) +return false; + } + +return true; +} +unsigned int nf_nat_redirect_ipv6 (struct sk_buff *skb,const struct nf_nat_range2 *range,unsigned int hooknum)
@@ -89,14 +109,19 @@ nf_nat_redirect_ipv6(struct sk_buff *skb, const struct nf_nat_range2 *range,if (hooknum ==NF_INET_LOCAL_OUT ) { newdst.in6 = loopback_addr; }else { +unsigned int scope =ipv6_addr_scope (&ipv6_hdr (skb)->daddr);struct inet6_dev *idev; -struct inet6_ifaddr *ifa;bool addr = false; idev =__in6_dev_get (skb->dev);if (idev !=NULL ) { +const struct inet6_ifaddr *ifa; +read_lock_bh (&idev->lock);list_for_each_entry (ifa, &idev->addr_list, if_list) { +if (!nf_nat_redirect_ipv6_usable (ifa, scope)) +continue ; + newdst.in6 = ifa->addr; addr = true;break ;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 366/379 RISC-V: Dont fail in riscv_of_parent_hartid() for disabled HARTs
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anup Patel <[email protected]>
[ Upstream commit c4676f8dc1e12e68d6511f9ed89707fdad4c962c ]
The riscv_of_processor_hartid() used by riscv_of_parent_hartid() fails for HARTs disabled in the DT. This results in the following warning thrown by the RISC-V INTC driver for the E-core on SiFive boards:
[ 0.000000] riscv-intc: unable to find hart id for /cpus/cpu@0/interrupt-controller
The riscv_of_parent_hartid() is only expected to read the hartid from the DT so we directly call of_get_cpu_hwid() instead of calling riscv_of_processor_hartid().
--- arch/riscv/kernel/cpu.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
arch/riscv/kernel/cpu.c +6 -5
@@ -57,13 +57,14 @@ int riscv_of_processor_hartid(struct device_node *node, unsigned long *hart)*/ int riscv_of_parent_hartid (struct device_node *node,unsigned long *hartid) { -int rc; -for (; node; node = node->parent) {if (of_device_is_compatible (node,"riscv" )) { - rc =riscv_of_processor_hartid (node, hartid); -if (!rc) -return 0 ; + *hartid = (unsigned long )of_get_cpu_hwid (node,0 ); +if (*hartid == ~0UL ) { +pr_warn ("Found CPU without hart ID\n" ); +return -ENODEV ; + } +return 0 ; } }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 367/379 drm/syncobj: fix DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Erik Kurzinger <[email protected]>
[ Upstream commit 101c9f637efa1655f55876644d4439e552267527 ]
If DRM_IOCTL_SYNCOBJ_TIMELINE_WAIT is invoked with the DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE flag set but no fence has yet been submitted for the given timeline point the call will fail immediately with EINVAL. This does not match the intended behavior where the call should wait until the fence has been submitted (or the timeout expires).
The following small example program illustrates the issue. It should wait for 5 seconds and then print ETIME, but instead it terminates right away after printing EINVAL.
#include <stdio.h>
#include <fcntl.h>
#include <time.h>
#include <errno.h>
#include <xf86drm.h>
int main(void)
{
int fd = open("/dev/dri/card0", O_RDWR);
uint32_t syncobj;
drmSyncobjCreate(fd, 0, &syncobj);
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
uint64_t point = 1;
if (drmSyncobjTimelineWait(fd, &syncobj, &point, 1,
ts.tv_sec * 1000000000 + ts.tv_nsec + 5000000000, // 5s
DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE, NULL)) {
printf("drmSyncobjTimelineWait failed %d\n", errno);
}
}Reviewed by: Simon Ser <[email protected]>
--- drivers/gpu/drm/drm_syncobj.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_syncobj.c +2 -1
@@ -1015,7 +1015,8 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, fence =drm_syncobj_fence_get (syncobjs[i]);if (!fence ||dma_fence_chain_find_seqno (&fence, points[i])) {dma_fence_put (fence); -if (flags &DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT ) { +if (flags & (DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT | +DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE )) {continue ; }else { timeout = -EINVAL ;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 368/379 ASoC: mediatek: mt8186_mt6366_rt1019_rt5682s: trivial: fix error messages
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eugen Hristev <[email protected]>
[ Upstream commit 004fc58edea6f00db9ad07b40b882e8d976f7a54 ]
Property 'playback-codecs' is referenced as 'speaker-codec' in the error message, and this can lead to confusion.
Correct the error message such that the correct property name is referenced.
--- sound/soc/mediatek/mt8186/mt8186-mt6366-rt1019-rt5682s.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/mediatek/mt8186/mt8186-mt6366-rt1019-rt5682s.c +2 -2
@@ -1080,7 +1080,7 @@ static int mt8186_mt6366_rt1019_rt5682s_dev_probe(struct platform_device *pdev) playback_codec =of_get_child_by_name (pdev->dev.of_node,"playback-codecs" );if (!playback_codec) { ret = -EINVAL ; -dev_err_probe (&pdev->dev, ret,"Property 'speaker-codecs' missing or invalid\n" ); +dev_err_probe (&pdev->dev, ret,"Property 'playback-codecs' missing or invalid\n" ); goto err_playback_codec; }
@@ -1094,7 +1094,7 @@ static int mt8186_mt6366_rt1019_rt5682s_dev_probe(struct platform_device *pdev)for_each_card_prelinks (card, i, dai_link) { ret =mt8186_mt6366_card_set_be_link (card, dai_link, playback_codec,"I2S3" );if (ret) { -dev_err_probe (&pdev->dev, ret,"%s set speaker_codec fail\n" , +dev_err_probe (&pdev->dev, ret,"%s set playback_codec fail\n" , dai_link->name); goto err_probe; }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 369/379 ASoC: hdmi-codec: register hpd callback on component probe
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jerome Brunet <[email protected]>
[ Upstream commit 15be353d55f9e12e34f9a819f51eb41fdef5eda8 ]
The HDMI hotplug callback to the hdmi-codec is currently registered when jack is set.
The hotplug not only serves to report the ASoC jack state but also to get the ELD. It should be registered when the component probes instead, so it does not depend on the card driver registering a jack for the HDMI to properly report the ELD.
--- sound/soc/codecs/hdmi-codec.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-)
sound/soc/codecs/hdmi-codec.c +19 -8
@@ -861,18 +861,13 @@ static int hdmi_codec_set_jack(struct snd_soc_component *component, void *data) {struct hdmi_codec_priv *hcp =snd_soc_component_get_drvdata (component); -int ret = -ENOTSUPP ;if (hcp->hcd.ops->hook_plugged_cb) { hcp->jack = jack; - ret = hcp->hcd.ops->hook_plugged_cb (component->dev->parent, - hcp->hcd.data, - plugged_cb, - component->dev); -if (ret) - hcp->jack =NULL ; +return 0 ; } -return ret; + +return -ENOTSUPP ; }static int hdmi_dai_spdif_probe (struct snd_soc_dai *dai)
@@ -948,6 +943,21 @@ static int hdmi_of_xlate_dai_id(struct snd_soc_component *component,return ret; } +static int hdmi_probe (struct snd_soc_component *component) +{ +struct hdmi_codec_priv *hcp =snd_soc_component_get_drvdata (component); +int ret =0 ; + +if (hcp->hcd.ops->hook_plugged_cb) { + ret = hcp->hcd.ops->hook_plugged_cb (component->dev->parent, + hcp->hcd.data, + plugged_cb, + component->dev); + } + +return ret; +} +static void hdmi_remove (struct snd_soc_component *component) {struct hdmi_codec_priv *hcp =snd_soc_component_get_drvdata (component);
@@ -958,6 +968,7 @@ static void hdmi_remove(struct snd_soc_component *component) }static const struct snd_soc_component_driver hdmi_driver = { + .probe = hdmi_probe, .remove = hdmi_remove, .dapm_widgets = hdmi_widgets, .num_dapm_widgets =ARRAY_SIZE (hdmi_widgets),
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 370/379 ASoC: dapm: fix clock get name
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jerome Brunet <[email protected]>
[ Upstream commit 4bdcbc31ad2112385ad525b28972c45015e6ad70 ]
The name currently used to get the clock includes the dapm prefix. It should use the name as provided to the widget, without the prefix.
--- sound/soc/soc-dapm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/soc-dapm.c +1 -1
@@ -3670,7 +3670,7 @@ snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm,dapm_pinctrl_event (w,NULL ,SND_SOC_DAPM_POST_PMD );break ;case snd_soc_dapm_clock_supply: - w->clk =devm_clk_get (dapm->dev, w->name); + w->clk =devm_clk_get (dapm->dev, widget->name);if (IS_ERR (w->clk)) { ret =PTR_ERR (w->clk); goto request_failed;
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 371/379 spi: spi-zynq-qspi: add spi-mem to driver kconfig dependencies
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amit Kumar Mahapatra <[email protected]>
[ Upstream commit c2ded280a4b1b7bd93e53670528504be08d24967 ]
Zynq QSPI driver has been converted to use spi-mem framework so add spi-mem to driver kconfig dependencies.
--- drivers/spi/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/spi/Kconfig +1 -0
@@ -1093,6 +1093,7 @@ config SPI_XTENSA_XTFPGA config SPI_ZYNQ_QSPI tristate "Xilinx Zynq QSPI controller" depends on ARCH_ZYNQ || COMPILE_TEST + depends on SPI_MEM help This enables support for the Zynq Quad SPI controller in master mode.
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 372/379 fbdev: imsttfb: Fix error path of imsttfb_probe()
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
[ Upstream commit 518ecb6a209f6ff678aeadf9f2bf870c0982ca85 ]
Release ressources when init_imstt() returns failure.
Stable-dep-of: aba6ab57a910 ("fbdev: imsttfb: fix a resource leak in probe")
--- drivers/video/fbdev/imsttfb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/video/fbdev/imsttfb.c +4 -2
@@ -1531,8 +1531,10 @@ static int imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto error; info->pseudo_palette = par->palette; ret =init_imstt (info); -if (!ret) -pci_set_drvdata (pdev, info); +if (ret) + goto error; + +pci_set_drvdata (pdev, info);return ret; error:
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 373/379 fbdev: imsttfb: fix a resource leak in probe
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit aba6ab57a910ad4b940c2024d15f2cdbf5b7f76b ]
I've re-written the error handling but the bug is that if init_imstt() fails we need to call iounmap(par->cmap_regs).
--- drivers/video/fbdev/imsttfb.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-)
drivers/video/fbdev/imsttfb.c +16 -13
@@ -1495,8 +1495,8 @@ static int imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)if (!request_mem_region (addr, size,"imsttfb" )) {printk (KERN_ERR "imsttfb: Can't reserve memory region\n" ); -framebuffer_release (info); -return -ENODEV ; + ret = -ENODEV ; + goto release_info; }switch (pdev->device) {
@@ -1513,36 +1513,39 @@ static int imsttfb_probe(struct pci_dev *pdev, const struct pci_device_id *ent)printk (KERN_INFO "imsttfb: Device 0x%x unknown, " "contact maintainer.\n" , pdev->device); ret = -ENODEV ; - goto error; + goto release_mem_region; } info->fix.smem_start = addr; info->screen_base = (__u8 *)ioremap (addr, par->ramdac ==IBM ?0x400000 :0x800000 );if (!info->screen_base) - goto error; + goto release_mem_region; info->fix.mmio_start = addr +0x800000 ; par->dc_regs =ioremap (addr +0x800000 ,0x1000 );if (!par->dc_regs) - goto error; + goto unmap_screen_base; par->cmap_regs_phys = addr +0x840000 ; par->cmap_regs = (__u8 *)ioremap (addr +0x840000 ,0x1000 );if (!par->cmap_regs) - goto error; + goto unmap_dc_regs; info->pseudo_palette = par->palette; ret =init_imstt (info);if (ret) - goto error; + goto unmap_cmap_regs;pci_set_drvdata (pdev, info); -return ret; +return 0 ; -error: -if (par->dc_regs) -iounmap (par->dc_regs); -if (info->screen_base) -iounmap (info->screen_base); +unmap_cmap_regs: +iounmap (par->cmap_regs); +unmap_dc_regs: +iounmap (par->dc_regs); +unmap_screen_base: +iounmap (info->screen_base); +release_mem_region:release_mem_region (addr, size); +release_info:framebuffer_release (info);return ret; }
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 374/379 fbdev: fsl-diu-fb: mark wr_reg_wa() static
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit a5035c81847430dfa3482807b07325f29e9e8c09 ]
wr_reg_wa() is not an appropriate name for a global function, and doesn't need to be global anyway, so mark it static and avoid the warning:
drivers/video/fbdev/fsl-diu-fb.c:493:6: error: no previous prototype for 'wr_reg_wa' [-Werror=missing-prototypes]
--- drivers/video/fbdev/fsl-diu-fb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/fsl-diu-fb.c +1 -1
@@ -490,7 +490,7 @@ static enum fsl_diu_monitor_port fsl_diu_name_to_port(const char *s)* Workaround for failed writing desc register of planes. * Needed with MPC5121 DIU rev 2.0 silicon. */ -void wr_reg_wa (u32 *reg,u32 val) +static void wr_reg_wa (u32 *reg,u32 val) { do { out_be32(reg, val);
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 375/379 tracing/kprobes: Fix the order of argument descriptions
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yujie Liu <[email protected]>
[ Upstream commit f032c53bea6d2057c14553832d846be2f151cfb2 ]
The order of descriptions should be consistent with the argument list of the function, so "kretprobe" should be the second one.
int __kprobe_event_gen_cmd_start(struct dynevent_cmd *cmd, bool kretprobe,
const char *name, const char *loc, ...)
--- kernel/trace/trace_kprobe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace_kprobe.c +1 -1
@@ -986,9 +986,9 @@ EXPORT_SYMBOL_GPL(kprobe_event_cmd_init);/** * __kprobe_event_gen_cmd_start - Generate a kprobe event command from arg list * @cmd: A pointer to the dynevent_cmd struct representing the new event +* @kretprobe: Is this a return probe? * @name: The name of the kprobe event * @loc: The location of the kprobe event -* @kretprobe: Is this a return probe? * @...: Variable number of arg (pairs), one pair for each field * * NOTE: Users normally won't want to call this function directly, but
Signature · 1 line
2.42.0
Greg Kroah-Hartman
maintainerPATCH 376/379 io_uring/net: ensure socket is marked connected on connect retry
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Axboe <[email protected]>
commit f8f9ab2d98116e79d220f1d089df7464ad4e026d upstream.
io_uring does non-blocking connection attempts, which can yield some unexpected results if a connect request is re-attempted by an an application. This is equivalent to the following sync syscall sequence:
sock = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, IPPROTO_TCP); connect(sock, &addr, sizeof(addr);
ret == -1 and errno == EINPROGRESS expected here. Now poll for POLLOUT on sock, and when that returns, we expect the socket to be connected. But if we follow that procedure with:
connect(sock, &addr, sizeof(addr));
you'd expect ret == -1 and errno == EISCONN here, but you actually get ret == 0. If we attempt the connection one more time, then we get EISCON as expected.
io_uring used to do this, but turns out that bluetooth fails with EBADFD if you attempt to re-connect. Also looks like EISCONN _could_ occur with this sequence.
Retain the ->in_progress logic, but work-around a potential EISCONN or EBADFD error and only in those cases look at the sock_error(). This should work in general and avoid the odd sequence of a repeated connect request returning success when the socket is already connected.
This is all a side effect of the socket state being in a CONNECTING state when we get EINPROGRESS, and only a re-connect or other related operation will turn that into CONNECTED.
--- io_uring/net.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-)
io_uring/net.c +11 -13
@@ -1433,16 +1433,6 @@ int io_connect(struct io_kiocb *req, unsint ret;bool force_nonblock = issue_flags &IO_URING_F_NONBLOCK ; -if (connect->in_progress) { -struct socket *socket; - - ret = -ENOTSOCK ; - socket =sock_from_file (req->file); -if (socket) - ret =sock_error (socket->sk); - goto out; - } -if (req_has_async_data (req)) { io = req->async_data; }else {
@@ -1462,9 +1452,7 @@ int io_connect(struct io_kiocb *req, uns && force_nonblock) {if (ret == -EINPROGRESS ) { connect->in_progress = true; -return -EAGAIN ; - } -if (ret == -ECONNABORTED ) { + }else if (ret == -ECONNABORTED ) {if (connect->seen_econnaborted) goto out; connect->seen_econnaborted = true;
@@ -1478,6 +1466,16 @@ int io_connect(struct io_kiocb *req, unsmemcpy (req->async_data, &__io,sizeof (__io));return -EAGAIN ; } +if (connect->in_progress) { +/* +* At least bluetooth will return -EBADFD on a re-connect +* attempt, and it's (supposedly) also valid to get -EISCONN +* which means the previous result is good. For both of these, +* grab the sock_error() and use that for the completion. +*/ +if (ret == -EBADFD || ret == -EISCONN ) + ret =sock_error (sock_from_file (req->file)->sk); + }if (ret == -ERESTARTSYS ) ret = -EINTR ; out:
Greg Kroah-Hartman
maintainerPATCH 377/379 x86/amd_nb: Use Family 19h Models 60h-7Fh Function 4 IDs
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yazen Ghannam <[email protected]>
commit 2a565258b3f4bbdc7a3c09cd02082cb286a7bffc upstream.
Three PCI IDs for DF Function 4 were defined but not used.
Add them to the "link" list.
--- arch/x86/kernel/amd_nb.c | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/kernel/amd_nb.c +3 -0
@@ -100,6 +100,9 @@ static const struct pci_device_id amd_nb { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_M10H_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_M40H_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_M50H_DF_F4) }, + { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_M60H_DF_F4) }, + { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_M70H_DF_F4) }, + { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_19H_M78H_DF_F4) }, { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CNB17H_F4) }, {} };
Greg Kroah-Hartman
maintainerPATCH 378/379 Revert "mmc: core: Capture correct oemid-bits for eMMC cards"
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dominique Martinet <[email protected]>
commit 421b605edb1ce611dee06cf6fd9a1c1f2fd85ad0 upstream.
This reverts commit 84ee19bffc9306128cd0f1c650e89767079efeff.
The commit above made quirks with an OEMID fail to be applied, as they were checking card->cid.oemid for the full 16 bits defined in MMC_FIXUP macros but the field would only contain the bottom 8 bits.
eMMC v5.1A might have bogus values in OEMID's higher bits so another fix will be made, but it has been decided to revert this until that is ready.
--- drivers/mmc/core/mmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/core/mmc.c +1 -1
@@ -104,7 +104,7 @@ static int mmc_decode_cid(struct mmc_carcase 3 :/* MMC v3.1 - v3.3 */ case 4 :/* MMC v4 */ card->cid.manfid =UNSTUFF_BITS (resp,120 ,8 ); - card->cid.oemid =UNSTUFF_BITS (resp,104 ,8 ); + card->cid.oemid =UNSTUFF_BITS (resp,104 ,16 ); card->cid.prod_name[0 ] =UNSTUFF_BITS (resp,96 ,8 ); card->cid.prod_name[1 ] =UNSTUFF_BITS (resp,88 ,8 ); card->cid.prod_name[2 ] =UNSTUFF_BITS (resp,80 ,8 );
Greg Kroah-Hartman
maintainerPATCH 379/379 btrfs: use u64 for buffer sizes in the tree search ioctls
In reply to Greg Kroah-Hartman6.1-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
[ Upstream commit dec96fc2dcb59723e041416b8dc53e011b4bfc2e ]
In the tree search v2 ioctl we use the type size_t, which is an unsigned long, to track the buffer size in the local variable 'buf_size'. An unsigned long is 32 bits wide on a 32 bits architecture. The buffer size defined in struct btrfs_ioctl_search_args_v2 is a u64, so when we later try to copy the local variable 'buf_size' to the argument struct, when the search returns -EOVERFLOW, we copy only 32 bits which will be a problem on big endian systems.
Fix this by using a u64 type for the buffer sizes, not only at btrfs_ioctl_tree_search_v2(), but also everywhere down the call chain so that we can use the u64 at btrfs_ioctl_tree_search_v2().
--- fs/btrfs/ioctl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/btrfs/ioctl.c +5 -5
@@ -2420,7 +2420,7 @@ static noinline int key_in_sk(struct btrfs_key *key, static noinline int copy_to_sk(struct btrfs_path *path,struct btrfs_key *key,struct btrfs_ioctl_search_key *sk, -size_t *buf_size, +u64 *buf_size,char __user *ubuf,unsigned long *sk_offset,int *num_found)
@@ -2552,7 +2552,7 @@ static noinline int copy_to_sk(struct btrfs_path *path, static noinline int search_ioctl(struct inode *inode,struct btrfs_ioctl_search_key *sk, -size_t *buf_size, +u64 *buf_size,char __user *ubuf) {struct btrfs_fs_info *info =btrfs_sb (inode->i_sb);
@@ -2625,7 +2625,7 @@ static noinline int btrfs_ioctl_tree_search(struct inode *inode,struct btrfs_ioctl_search_args __user *uargs = argp;struct btrfs_ioctl_search_key sk;int ret; -size_t buf_size; +u64 buf_size;if (!capable (CAP_SYS_ADMIN ))return -EPERM ;
@@ -2655,8 +2655,8 @@ static noinline int btrfs_ioctl_tree_search_v2(struct inode *inode,struct btrfs_ioctl_search_args_v2 __user *uarg = argp;struct btrfs_ioctl_search_args_v2 args;int ret; -size_t buf_size; -const size_t buf_limit =SZ_16M ; +u64 buf_size; +const u64 buf_limit =SZ_16M ;if (!capable (CAP_SYS_ADMIN ))return -EPERM ;
Signature · 1 line
2.42.0
Hello,
Quoted 5 lines · On Wed, 15 Nov 2023 14:21:15 -0500 Greg Kroah-Hartman…
This is the start of the stable review cycle for the 6.1.63 release. There are 379 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 8 lines
Responses should be made by Fri, 17 Nov 2023 19:25:27 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.63-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.
This rc kernel passes DAMON functionality test[1] on my test machine. Attaching the test results summary below. Please note that I retrieved the kernel from linux-stable-rc tree[2].
[1] https://github.com/awslabs/damon-tests/tree/next/corr
[2] 505b91175bcf ("Linux 6.1.63-rc1")
Thanks,
SJ
[...]
---
ok 1 selftests: damon: debugfs_attrs.sh
ok 2 selftests: damon: debugfs_schemes.sh
ok 3 selftests: damon: debugfs_target_ids.sh
ok 4 selftests: damon: debugfs_empty_targets.sh
ok 5 selftests: damon: debugfs_huge_count_read_write.sh
ok 6 selftests: damon: debugfs_duplicate_context_creation.sh
ok 7 selftests: damon: sysfs.sh
ok 1 selftests: damon-tests: kunit.sh
ok 2 selftests: damon-tests: huge_count_read_write.sh
ok 3 selftests: damon-tests: buffer_overflow.sh
ok 4 selftests: damon-tests: rm_contexts.sh
ok 5 selftests: damon-tests: record_null_deref.sh
ok 6 selftests: damon-tests: dbgfs_target_ids_read_before_terminate_race.sh ok 7 selftests: damon-tests: dbgfs_target_ids_pid_leak.sh
ok 8 selftests: damon-tests: damo_tests.sh
ok 9 selftests: damon-tests: masim-record.sh
ok 10 selftests: damon-tests: build_i386.sh
ok 11 selftests: damon-tests: build_arm64.sh
ok 12 selftests: damon-tests: build_i386_idle_flag.sh
ok 13 selftests: damon-tests: build_i386_highpte.sh
ok 14 selftests: damon-tests: build_nomemcg.sh
[33m
[92mPASS [39m_remote_run_corr.sh SUCCESS
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.63 release. There are 379 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 17 Nov 2023 19:25:27 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.63-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels build tested on BMIPS_GENERIC:
Signature · 1 line
Florian
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.63 release. There are 379 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 17 Nov 2023 19:25:27 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.63-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
## Build
* kernel: 6.1.63-rc1
* git: https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc
* git branch: linux-6.1.y
* git commit: 505b91175bcfcf16c4adc437901109bee0ab649f
* git describe: v6.1.62-380-g505b91175bcf
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.1.y/build/v6.1.62-380-g505b91175bcf
## Test Regressions (compared to v6.1.62)
## Metric Regressions (compared to v6.1.62)
## Test Fixes (compared to v6.1.62)
## Metric Fixes (compared to v6.1.62)
## Test result summary
total: 126938, pass: 108065, fail: 2482, skip: 16277, xfail: 114
## Build Summary
* arc: 5 total, 5 passed, 0 failed
* arm: 147 total, 147 passed, 0 failed
* arm64: 52 total, 52 passed, 0 failed
* i386: 37 total, 33 passed, 4 failed
* mips: 26 total, 26 passed, 0 failed
* parisc: 3 total, 3 passed, 0 failed
* powerpc: 36 total, 32 passed, 4 failed
* riscv: 14 total, 14 passed, 0 failed
* s390: 16 total, 15 passed, 1 failed
* sh: 10 total, 10 passed, 0 failed
* sparc: 7 total, 7 passed, 0 failed
* x86_64: 44 total, 44 passed, 0 failed
## Test suites summary
* boot
* kselftest-android
* kselftest-arm64
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-cgroup
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-cpufreq
* kselftest-drivers-dma-buf
* kselftest-efivarfs
* kselftest-exec
* kselftest-filesystems
* kselftest-filesystems-binderfs
* kselftest-filesystems-epoll
* kselftest-firmware
* kselftest-fpu
* kselftest-ftrace
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-ir
* kselftest-kcmp
* kselftest-kexec
* kselftest-kvm
* kselftest-lib
* kselftest-membarrier
* kselftest-memfd
* kselftest-memory-hotplug
* kselftest-mincore
* kselftest-mount
* kselftest-mqueue
* kselftest-net
* kselftest-net-forwarding
* kselftest-net-mptcp
* kselftest-netfilter
* kselftest-nsfs
* kselftest-openat2
* kselftest-pid_namespace
* kselftest-pidfd
* kselftest-proc
* kselftest-pstore
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-splice
* kselftest-static_keys
* kselftest-sync
* kselftest-sysctl
* kselftest-tc-testing
* kselftest-timens
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user
* kselftest-user_events
* kselftest-vDSO
* kselftest-vm
* kselftest-watchdog
* kselftest-x86
* kselftest-zram
* kunit
* libgpiod
* log-parser-boot
* log-parser-test
* ltp-cap_bounds
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-cpuhotplug
* ltp-crypto
* ltp-cve
* ltp-dio
* ltp-fcntl-locktests
* ltp-filecaps
* ltp-fs
* ltp-fs_bind
* ltp-fs_perms_simple
* ltp-fsx
* ltp-hugetlb
* ltp-io
* ltp-ipc
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-pty
* ltp-sched
* ltp-securebits
* ltp-smoke
* ltp-syscalls
* ltp-tracing
* network-basic-tests
* perf
* rcutorture
* v4l2-compliance
--
Linaro LKFT
https://lkft.linaro.org
Quoted 7 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.63 release. There are 379 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 17 Nov 2023 19:25:27 +0000. Anything received after that time might be too late.
Build results:
total: 157 pass: 157 fail: 0 Qemu test results: total: 529 pass: 529 fail: 0
Guenter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.1.63 release. There are 379 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 17 Nov 2023 19:25:27 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.63-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 6.1.63 release. There are 379 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
CIP testing did not find any problems here:
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/tree/linux-6.1.y
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Quoted 9 lines
This is the start of the stable review cycle for the 6.1.63 release. There are 379 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 17 Nov 2023 19:25:27 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.1.63-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.1.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my x86_64 and ARM64 test systems. No errors or regressions.
Thanks.
Hi!
Quoted 8 lines
This is the start of the stable review cycle for the 6.1.63 release. There are 379 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Tomas Glozar <[email protected]>
nd_btt: Make BTT lanes preemptible
This is for preempt-rt only, and we don't really have that in -stable. This means we don't really need this in 4.19, either:
d9ea9d2ff 666300 o: 4.19| sched/rt: Provide migrate_disable/enable() inlines
Quoted 2 lines
Phil Sutter <[email protected]>
netfilter:nf_tables: Drop pointless memset when dumping rules
A cleanup, but I don't believe we need it in -stable.
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany