5.15.17-rc1 review
Subsystems (9)
Greg Kroah-Hartman
maintainerPATCH 409/846 iommu/arm-smmu-qcom: Fix TTBR0 read
In reply to Greg Kroah-HartmanFrom: Rob Clark <[email protected]>
[ Upstream commit c31112fbd4077a51a14ff338038c82e9571dc821 ]
It is a 64b register, lets not lose the upper bits.
--- drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +1 -1
@@ -51,7 +51,7 @@ static void qcom_adreno_smmu_get_fault_info(const void *cookie, info->fsynr1 =arm_smmu_cb_read (smmu, cfg->cbndx,ARM_SMMU_CB_FSYNR1 ); info->far =arm_smmu_cb_readq (smmu, cfg->cbndx,ARM_SMMU_CB_FAR ); info->cbfrsynra =arm_smmu_gr1_read (smmu,ARM_SMMU_GR1_CBFRSYNRA (cfg->cbndx)); - info->ttbr0 =arm_smmu_cb_read (smmu, cfg->cbndx,ARM_SMMU_CB_TTBR0 ); + info->ttbr0 =arm_smmu_cb_readq (smmu, cfg->cbndx,ARM_SMMU_CB_TTBR0 ); info->contextidr =arm_smmu_cb_read (smmu, cfg->cbndx,ARM_SMMU_CB_CONTEXTIDR ); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 410/846 RDMA/core: Let ib_find_gid() continue search even after empty entry
In reply to Greg Kroah-HartmanFrom: Avihai Horon <[email protected]>
[ Upstream commit 483d805191a23191f8294bbf9b4e94836f5d92e4 ]
Currently, ib_find_gid() will stop searching after encountering the first empty GID table entry. This behavior is wrong since neither IB nor RoCE spec enforce tightly packed GID tables.
For example, when a valid GID entry exists at index N, and if a GID entry is empty at index N-1, ib_find_gid() will fail to find the valid entry.
Fix it by making ib_find_gid() continue searching even after encountering missing entries.
--- drivers/infiniband/core/device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/core/device.c +2 -1
@@ -2461,7 +2461,8 @@ int ib_find_gid(struct ib_device *device, union ib_gid *gid, ++i) { ret =rdma_query_gid (device, port, i, &tmp_gid);if (ret) -return ret; +continue ; +if (!memcmp (&tmp_gid, gid,sizeof *gid)) { *port_num = port;if (index)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 411/846 RDMA/cma: Let cma_resolve_ib_dev() continue search even after empty entry
In reply to Greg Kroah-HartmanFrom: Avihai Horon <[email protected]>
[ Upstream commit 20679094a0161c94faf77e373fa3f7428a8e14bd ]
Currently, when cma_resolve_ib_dev() searches for a matching GID it will stop searching after encountering the first empty GID table entry. This behavior is wrong since neither IB nor RoCE spec enforce tightly packed GID tables.
For example, when the matching valid GID entry exists at index N, and if a GID entry is empty at index N-1, cma_resolve_ib_dev() will fail to find the matching valid entry.
Fix it by making cma_resolve_ib_dev() continue searching even after encountering missing entries.
--- drivers/infiniband/core/cma.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/infiniband/core/cma.c +9 -3
@@ -766,6 +766,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv)unsigned int p;u16 pkey, index;enum ib_port_state port_state; +int ret;int i; cma_dev =NULL ;
@@ -784,9 +785,14 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv)if (ib_get_cached_port_state (cur_dev->device, p, &port_state))continue ; -for (i =0 ; !rdma_query_gid (cur_dev->device, - p, i, &gid); - i++) { + +for (i =0 ; i < cur_dev->device->port_data[p].immutable.gid_tbl_len; + ++i) { + ret =rdma_query_gid (cur_dev->device, p, i, + &gid); +if (ret) +continue ; +if (!memcmp (&gid, dgid,sizeof (gid))) { cma_dev = cur_dev; sgid = gid;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 412/846 ASoC: rt5663: Handle device_property_read_u32_array error codes
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 2167c0b205960607fb136b4bb3c556a62be1569a ]
The return value of device_property_read_u32_array() is not always 0. To catch the exception in case that devm_kzalloc failed and the rt5663->imp_table was NULL, which caused the failure of device_property_read_u32_array.
--- sound/soc/codecs/rt5663.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
sound/soc/codecs/rt5663.c +9 -3
@@ -3461,6 +3461,7 @@ static void rt5663_calibrate(struct rt5663_priv *rt5663)static int rt5663_parse_dp (struct rt5663_priv *rt5663,struct device *dev) {int table_size; +int ret;device_property_read_u32 (dev,"realtek,dc_offset_l_manual" , &rt5663->pdata.dc_offset_l_manual);
@@ -3477,9 +3478,11 @@ static int rt5663_parse_dp(struct rt5663_priv *rt5663, struct device *dev) table_size =sizeof (struct impedance_mapping_table ) * rt5663->pdata.impedance_sensing_num; rt5663->imp_table =devm_kzalloc (dev, table_size,GFP_KERNEL ); -device_property_read_u32_array (dev, + ret =device_property_read_u32_array (dev,"realtek,impedance_sensing_table" , (u32 *)rt5663->imp_table, table_size); +if (ret) +return ret; }return 0 ;
@@ -3504,8 +3507,11 @@ static int rt5663_i2c_probe(struct i2c_client *i2c,if (pdata) rt5663->pdata = *pdata; -else -rt5663_parse_dp (rt5663, &i2c->dev); +else { + ret =rt5663_parse_dp (rt5663, &i2c->dev); +if (ret) +return ret; + }for (i =0 ; i <ARRAY_SIZE (rt5663->supplies); i++) rt5663->supplies[i].supply = rt5663_supply_names[i];
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 413/846 of: unittest: fix warning on PowerPC frame size warning
In reply to Greg Kroah-HartmanFrom: Jim Quinlan <[email protected]>
[ Upstream commit a8d61a9112ad0c9216ab45d050991e07bc4f3408 ]
The struct device variable "dev_bogus" was triggering this warning on a PowerPC build:
drivers/of/unittest.c: In function 'of_unittest_dma_ranges_one.constprop':
[...] >> The frame size of 1424 bytes is larger than 1024 bytes
[-Wframe-larger-than=]
This variable is now dynamically allocated.
--- drivers/of/unittest.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/of/unittest.c +12 -4
@@ -911,11 +911,18 @@ static void __init of_unittest_dma_ranges_one(const char *path,if (!rc) {phys_addr_t paddr;dma_addr_t dma_addr; -struct device dev_bogus; +struct device *dev_bogus; - dev_bogus.dma_range_map = map; - paddr =dma_to_phys (&dev_bogus, expect_dma_addr); - dma_addr =phys_to_dma (&dev_bogus, expect_paddr); + dev_bogus =kzalloc (sizeof (struct device ),GFP_KERNEL ); +if (!dev_bogus) { +unittest (0 ,"kzalloc() failed\n" ); +kfree (map); +return ; + } + + dev_bogus->dma_range_map = map; + paddr =dma_to_phys (dev_bogus, expect_dma_addr); + dma_addr =phys_to_dma (dev_bogus, expect_paddr); unittest(paddr == expect_paddr, "of_dma_get_range: wrong phys addr %pap (expecting %llx) on node %pOF\n",
@@ -925,6 +932,7 @@ static void __init of_unittest_dma_ranges_one(const char *path, &dma_addr, expect_dma_addr, np);kfree (map); + kfree(dev_bogus); }of_node_put (np);#endif
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 414/846 of: unittest: 64 bit dma address test requires arch support
In reply to Greg Kroah-HartmanFrom: Frank Rowand <[email protected]>
[ Upstream commit 9fd4cf5d3571b27d746b8ead494a3f051485b679 ]
If an architecture does not support 64 bit dma addresses then testing for an expected dma address >= 0x100000000 will fail.
--- drivers/of/unittest.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/of/unittest.c +3 -2
@@ -942,8 +942,9 @@ static void __init of_unittest_parse_dma_ranges(void) {of_unittest_dma_ranges_one ("/testcase-data/address-tests/device@70000000" ,0x0 ,0x20000000 ); -of_unittest_dma_ranges_one ("/testcase-data/address-tests/bus@80000000/device@1000" , -0x100000000 ,0x20000000 ); +if (IS_ENABLED (CONFIG_ARCH_DMA_ADDR_T_64BIT )) +of_unittest_dma_ranges_one ("/testcase-data/address-tests/bus@80000000/device@1000" , +0x100000000 ,0x20000000 );of_unittest_dma_ranges_one ("/testcase-data/address-tests/pci@90000000" ,0x80000000 ,0x20000000 ); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 415/846 clk: stm32: Fix ltdcs clock turn off by clk_disable_unused() after system enter shell
In reply to Greg Kroah-HartmanFrom: Dillon Min <[email protected]>
[ Upstream commit 6fc058a72f3b7b07fc4de6d66ad1f68951b00f6e ]
stm32's clk driver register two ltdc gate clk to clk core by clk_hw_register_gate() and clk_hw_register_composite()
first: 'stm32f429_gates[]', clk name is 'ltdc', which no user to use.
second: 'stm32f429_aux_clk[]', clk name is 'lcd-tft', used by ltdc driver
both of them point to the same offset of stm32's RCC register. after kernel enter console, clk core turn off ltdc's clk as 'stm32f429_gates[]' is no one to use. but, actually 'stm32f429_aux_clk[]' is in use.
stm32f469/746/769 have the same issue, fix it.
--- drivers/clk/clk-stm32f4.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/clk/clk-stm32f4.c +0 -4
@@ -129,7 +129,6 @@ static const struct stm32f4_gate_data stm32f429_gates[] __initconst = { { STM32F4_RCC_APB2ENR, 20, "spi5", "apb2_div" }, { STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" }, { STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" }, - { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, }; static const struct stm32f4_gate_data stm32f469_gates[] __initconst = {
@@ -211,7 +210,6 @@ static const struct stm32f4_gate_data stm32f469_gates[] __initconst = { { STM32F4_RCC_APB2ENR, 20, "spi5", "apb2_div" }, { STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" }, { STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" }, - { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, }; static const struct stm32f4_gate_data stm32f746_gates[] __initconst = {
@@ -286,7 +284,6 @@ static const struct stm32f4_gate_data stm32f746_gates[] __initconst = { { STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" }, { STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" }, { STM32F4_RCC_APB2ENR, 23, "sai2", "apb2_div" }, - { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, }; static const struct stm32f4_gate_data stm32f769_gates[] __initconst = {
@@ -364,7 +361,6 @@ static const struct stm32f4_gate_data stm32f769_gates[] __initconst = { { STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" }, { STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" }, { STM32F4_RCC_APB2ENR, 23, "sai2", "apb2_div" }, - { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, { STM32F4_RCC_APB2ENR, 30, "mdio", "apb2_div" }, };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 416/846 mips: add SYS_HAS_CPU_MIPS64_R5 config for MIPS Release 5 support
In reply to Greg Kroah-HartmanFrom: Lukas Bulwahn <[email protected]>
[ Upstream commit fd4eb90b164442cb1e9909f7845e12a0835ac699 ]
Commit ab7c01fdc3cf ("mips: Add MIPS Release 5 support") adds the two configs CPU_MIPS32_R5 and CPU_MIPS64_R5, which depend on the corresponding SYS_HAS_CPU_MIPS32_R5 and SYS_HAS_CPU_MIPS64_R5, respectively.
The config SYS_HAS_CPU_MIPS32_R5 was already introduced with commit c5b367835cfc ("MIPS: Add support for XPA."); the config SYS_HAS_CPU_MIPS64_R5, however, was never introduced.
Hence, ./scripts/checkkconfigsymbols.py warns:
SYS_HAS_CPU_MIPS64_R5
Referencing files: arch/mips/Kconfig, arch/mips/include/asm/cpu-type.h
Add the definition for config SYS_HAS_CPU_MIPS64_R5 under the assumption that SYS_HAS_CPU_MIPS64_R5 follows the same pattern as the existing SYS_HAS_CPU_MIPS32_R5 and SYS_HAS_CPU_MIPS64_R6.
--- arch/mips/Kconfig | 4 ++++ 1 file changed, 4 insertions(+)
arch/mips/Kconfig +4 -0
@@ -1993,6 +1993,10 @@ config SYS_HAS_CPU_MIPS64_R1 config SYS_HAS_CPU_MIPS64_R2 bool +config SYS_HAS_CPU_MIPS64_R5 + bool + select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT + config SYS_HAS_CPU_MIPS64_R6 bool select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 417/846 mips: fix Kconfig reference to PHYS_ADDR_T_64BIT
In reply to Greg Kroah-HartmanFrom: Lukas Bulwahn <[email protected]>
[ Upstream commit a670c82d9ca4f1e7385d9d6f26ff41a50fbdd944 ]
Commit d4a451d5fc84 ("arch: remove the ARCH_PHYS_ADDR_T_64BIT config symbol") removes config ARCH_PHYS_ADDR_T_64BIT with all instances of that config refactored appropriately. Since then, it is recommended to use the config PHYS_ADDR_T_64BIT instead.
Commit 171543e75272 ("MIPS: Disallow CPU_SUPPORTS_HUGEPAGES for XPA,EVA") introduces the expression "!(32BIT && (ARCH_PHYS_ADDR_T_64BIT || EVA))" for config CPU_SUPPORTS_HUGEPAGES, which unintentionally refers to the non-existing symbol ARCH_PHYS_ADDR_T_64BIT instead of the intended PHYS_ADDR_T_64BIT.
Fix this Kconfig reference to the intended PHYS_ADDR_T_64BIT.
This issue was identified with the script ./scripts/checkkconfigsymbols.py. I then reported it on the mailing list and Paul confirmed the mistake in the linked email thread.
--- arch/mips/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/Kconfig +1 -1
@@ -2161,7 +2161,7 @@ config CPU_SUPPORTS_ADDRWINCFG bool config CPU_SUPPORTS_HUGEPAGES bool - depends on !(32BIT && (ARCH_PHYS_ADDR_T_64BIT || EVA)) + depends on !(32BIT && (PHYS_ADDR_T_64BIT || EVA)) config MIPS_PGD_C0_CONTEXT bool depends on 64BIT
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 418/846 dmaengine: pxa/mmp: stop referencing config->slave_id
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 134c37fa250a87a7e77c80a7c59ae16c462e46e0 ]
The last driver referencing the slave_id on Marvell PXA and MMP platforms was the SPI driver, but this stopped doing so a long time ago, so the TODO from the earlier patch can no be removed.
--- drivers/dma/mmp_pdma.c | 6 ------ drivers/dma/pxa_dma.c | 7 ------- 2 files changed, 13 deletions(-)
drivers/dma/mmp_pdma.c +0 -6
@@ -727,12 +727,6 @@ static int mmp_pdma_config_write(struct dma_chan *dchan, chan->dir = direction; chan->dev_addr = addr; -/* FIXME: drivers should be ported over to use the filter -* function. Once that's done, the following two lines can -* be removed. -*/ -if (cfg->slave_id) - chan->drcmr = cfg->slave_id;return 0 ; }
drivers/dma/pxa_dma.c +0 -7
@@ -910,13 +910,6 @@ static void pxad_get_config(struct pxad_chan *chan, *dcmd |=PXA_DCMD_BURST16 ; else if (maxburst == 32) *dcmd |= PXA_DCMD_BURST32; - - /* FIXME: drivers should be ported over to use the filter - * function. Once that's done, the following two lines can - * be removed. - */ - if (chan->cfg.slave_id) - chan->drcmr = chan->cfg.slave_id; } static struct dma_async_tx_descriptor *
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 419/846 iommu/amd: Restore GA log/tail pointer on host resume
In reply to Greg Kroah-HartmanFrom: Maxim Levitsky <[email protected]>
[ Upstream commit a8d4a37d1bb93608501d0d0545f902061152669a ]
This will give IOMMU GA log a chance to work after resume from s3/s4.
--- drivers/iommu/amd/init.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-)
drivers/iommu/amd/init.c +15 -16
@@ -804,16 +804,27 @@ static int iommu_ga_log_enable(struct amd_iommu *iommu) {#ifdef CONFIG_IRQ_REMAP u32 status, i; +u64 entry;if (!iommu->ga_log)return -EINVAL ; - status =readl (iommu->mmio_base +MMIO_STATUS_OFFSET ); -/* Check if already running */ -if (status & (MMIO_STATUS_GALOG_RUN_MASK )) + status =readl (iommu->mmio_base +MMIO_STATUS_OFFSET ); +if (WARN_ON (status & (MMIO_STATUS_GALOG_RUN_MASK )))return 0 ; + entry =iommu_virt_to_phys (iommu->ga_log) |GA_LOG_SIZE_512 ; +memcpy_toio (iommu->mmio_base +MMIO_GA_LOG_BASE_OFFSET , + &entry,sizeof (entry)); + entry = (iommu_virt_to_phys (iommu->ga_log_tail) & + (BIT_ULL (52 )-1 )) & ~7ULL ; +memcpy_toio (iommu->mmio_base +MMIO_GA_LOG_TAIL_OFFSET , + &entry,sizeof (entry)); +writel (0x00 , iommu->mmio_base +MMIO_GA_HEAD_OFFSET ); +writel (0x00 , iommu->mmio_base +MMIO_GA_TAIL_OFFSET ); + +iommu_feature_enable (iommu,CONTROL_GAINT_EN );iommu_feature_enable (iommu,CONTROL_GALOG_EN );
@@ -823,7 +834,7 @@ static int iommu_ga_log_enable(struct amd_iommu *iommu) break; } -if (i >=LOOP_TIMEOUT ) +if (WARN_ON (i >=LOOP_TIMEOUT ))return -EINVAL ;#endif /* CONFIG_IRQ_REMAP */ return 0 ;
@@ -832,8 +843,6 @@ static int iommu_ga_log_enable(struct amd_iommu *iommu)static int iommu_init_ga_log (struct amd_iommu *iommu) {#ifdef CONFIG_IRQ_REMAP -u64 entry; -if (!AMD_IOMMU_GUEST_IR_VAPIC (amd_iommu_guest_ir))return 0 ;
@@ -847,16 +856,6 @@ static int iommu_init_ga_log(struct amd_iommu *iommu)if (!iommu->ga_log_tail) goto err_out; - entry =iommu_virt_to_phys (iommu->ga_log) |GA_LOG_SIZE_512 ; -memcpy_toio (iommu->mmio_base +MMIO_GA_LOG_BASE_OFFSET , - &entry,sizeof (entry)); - entry = (iommu_virt_to_phys (iommu->ga_log_tail) & - (BIT_ULL (52 )-1 )) & ~7ULL ; -memcpy_toio (iommu->mmio_base +MMIO_GA_LOG_TAIL_OFFSET , - &entry,sizeof (entry)); -writel (0x00 , iommu->mmio_base +MMIO_GA_HEAD_OFFSET ); -writel (0x00 , iommu->mmio_base +MMIO_GA_TAIL_OFFSET ); -return 0 ; err_out:free_ga_log (iommu);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 420/846 iommu/amd: X2apic mode: re-enable after resume
In reply to Greg Kroah-HartmanFrom: Maxim Levitsky <[email protected]>
[ Upstream commit 01b297a48a26bcb96769505ac948db4603b72bd1 ]
Otherwise it is guaranteed to not work after the resume...
--- drivers/iommu/amd/init.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/iommu/amd/init.c +4 -1
@@ -2169,7 +2169,6 @@ static int iommu_setup_intcapxt(struct amd_iommu *iommu)return ret; } -iommu_feature_enable (iommu,CONTROL_INTCAPXT_EN );return 0 ; }
@@ -2192,6 +2191,10 @@ static int iommu_init_irq(struct amd_iommu *iommu) iommu->int_enabled = true; enable_faults: + +if (amd_iommu_xt_mode ==IRQ_REMAP_X2APIC_MODE ) +iommu_feature_enable (iommu,CONTROL_INTCAPXT_EN ); +iommu_feature_enable (iommu,CONTROL_EVT_INT_EN );if (iommu->ppr_log !=NULL )
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 421/846 iommu/amd: X2apic mode: setup the INTX registers on mask/unmask
In reply to Greg Kroah-HartmanFrom: Maxim Levitsky <[email protected]>
[ Upstream commit 4691f79d62a637958f7b5f55c232a65399500b7a ]
This is more logically correct and will also allow us to to use mask/unmask logic to restore INTX setttings after the resume from s3/s4.
--- drivers/iommu/amd/init.c | 65 ++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 32 deletions(-)
drivers/iommu/amd/init.c +33 -32
@@ -2012,48 +2012,18 @@ union intcapxt { }; } __attribute__ ((packed)); -/* -* There isn't really any need to mask/unmask at the irqchip level because -* the 64-bit INTCAPXT registers can be updated atomically without tearing -* when the affinity is being updated. -*/ -static void intcapxt_unmask_irq (struct irq_data *data) -{ -} - -static void intcapxt_mask_irq (struct irq_data *data) -{ -}static struct irq_chip intcapxt_controller;static int intcapxt_irqdomain_activate (struct irq_domain *domain,struct irq_data *irqd,bool reserve) { -struct amd_iommu *iommu = irqd->chip_data; -struct irq_cfg *cfg =irqd_cfg (irqd); -union intcapxt xt; - - xt.capxt =0ULL ; - xt.dest_mode_logical = apic->dest_mode_logical; - xt.vector = cfg->vector; - xt.destid_0_23 = cfg->dest_apicid &GENMASK (23 ,0 ); - xt.destid_24_31 = cfg->dest_apicid >>24 ; - -/** -* Current IOMMU implemtation uses the same IRQ for all -* 3 IOMMU interrupts. -*/ -writeq (xt.capxt, iommu->mmio_base +MMIO_INTCAPXT_EVT_OFFSET ); -writeq (xt.capxt, iommu->mmio_base +MMIO_INTCAPXT_PPR_OFFSET ); -writeq (xt.capxt, iommu->mmio_base +MMIO_INTCAPXT_GALOG_OFFSET );return 0 ; }static void intcapxt_irqdomain_deactivate (struct irq_domain *domain,struct irq_data *irqd) { -intcapxt_mask_irq (irqd); }
@@ -2087,6 +2057,38 @@ static void intcapxt_irqdomain_free(struct irq_domain *domain, unsigned int virqirq_domain_free_irqs_top (domain, virq, nr_irqs); } + +static void intcapxt_unmask_irq (struct irq_data *irqd) +{ +struct amd_iommu *iommu = irqd->chip_data; +struct irq_cfg *cfg =irqd_cfg (irqd); +union intcapxt xt; + + xt.capxt =0ULL ; + xt.dest_mode_logical = apic->dest_mode_logical; + xt.vector = cfg->vector; + xt.destid_0_23 = cfg->dest_apicid &GENMASK (23 ,0 ); + xt.destid_24_31 = cfg->dest_apicid >>24 ; + +/** +* Current IOMMU implementation uses the same IRQ for all +* 3 IOMMU interrupts. +*/ +writeq (xt.capxt, iommu->mmio_base +MMIO_INTCAPXT_EVT_OFFSET ); +writeq (xt.capxt, iommu->mmio_base +MMIO_INTCAPXT_PPR_OFFSET ); +writeq (xt.capxt, iommu->mmio_base +MMIO_INTCAPXT_GALOG_OFFSET ); +} + +static void intcapxt_mask_irq (struct irq_data *irqd) +{ +struct amd_iommu *iommu = irqd->chip_data; + +writeq (0 , iommu->mmio_base +MMIO_INTCAPXT_EVT_OFFSET ); +writeq (0 , iommu->mmio_base +MMIO_INTCAPXT_PPR_OFFSET ); +writeq (0 , iommu->mmio_base +MMIO_INTCAPXT_GALOG_OFFSET ); +} + +static int intcapxt_set_affinity (struct irq_data *irqd,const struct cpumask *mask,bool force) {
@@ -2096,8 +2098,7 @@ static int intcapxt_set_affinity(struct irq_data *irqd, ret = parent->chip->irq_set_affinity (parent, mask, force);if (ret <0 || ret ==IRQ_SET_MASK_OK_DONE )return ret; - -return intcapxt_irqdomain_activate (irqd->domain, irqd, false); +return 0 ; }static struct irq_chip intcapxt_controller = {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 422/846 iommu/amd: X2apic mode: mask/unmask interrupts on suspend/resume
In reply to Greg Kroah-HartmanFrom: Maxim Levitsky <[email protected]>
[ Upstream commit 1980105e3cfc2215c75b4f6b172661d675c467d1 ]
Use IRQCHIP_MASK_ON_SUSPEND to make the core irq code to mask the iommu interrupt on suspend and unmask it on the resume.
Since now the unmask function updates the INTX settings, that will restore them on resume from s3/s4.
Since IRQCHIP_MASK_ON_SUSPEND is only effective for interrupts which are not wakeup sources, remove IRQCHIP_SKIP_SET_WAKE flag and instead implement a dummy .irq_set_wake which doesn't allow the interrupt to become a wakeup source.
--- drivers/iommu/amd/init.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/iommu/amd/init.c +7 -1
@@ -2101,6 +2101,11 @@ static int intcapxt_set_affinity(struct irq_data *irqd,return 0 ; } +static int intcapxt_set_wake (struct irq_data *irqd,unsigned int on) +{ +return on ? -EOPNOTSUPP :0 ; +} +static struct irq_chip intcapxt_controller = { .name ="IOMMU-MSI" , .irq_unmask = intcapxt_unmask_irq,
@@ -2108,7 +2113,8 @@ static struct irq_chip intcapxt_controller = { .irq_ack = irq_chip_ack_parent, .irq_retrigger = irq_chip_retrigger_hierarchy, .irq_set_affinity = intcapxt_set_affinity, - .flags = IRQCHIP_SKIP_SET_WAKE, + .irq_set_wake = intcapxt_set_wake, + .flags = IRQCHIP_MASK_ON_SUSPEND, };static const struct irq_domain_ops intcapxt_domain_ops = {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 423/846 iommu/amd: Remove useless irq affinity notifier
In reply to Greg Kroah-HartmanFrom: Maxim Levitsky <[email protected]>
[ Upstream commit 575f5cfb13c84f324f9898383fa4a5694e53c9ef ]
iommu->intcapxt_notify field is no longer used
after a switch to a separate domain was done
--- drivers/iommu/amd/amd_iommu_types.h | 2 -- 1 file changed, 2 deletions(-)
drivers/iommu/amd/amd_iommu_types.h +0 -2
@@ -643,8 +643,6 @@ struct amd_iommu {/* DebugFS Info */ struct dentry *debugfs;#endif -/* IRQ notifier for IntCapXT interrupt */ -struct irq_affinity_notify intcapxt_notify; };static inline struct amd_iommu *dev_to_amd_iommu (struct device *dev)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 424/846 ASoC: Intel: catpt: Test dmaengine_submit() result before moving on
In reply to Greg Kroah-HartmanFrom: Cezary Rojewski <[email protected]>
[ Upstream commit 2a9a72e290d4a4741e673f86b9fba9bfb319786d ]
After calling dmaengine_submit(), the submitted transfer descriptor belongs to the DMA engine. Pointer to that descriptor may no longer be valid after the call and should be tested before awaiting transfer completion.
--- sound/soc/intel/catpt/dsp.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
sound/soc/intel/catpt/dsp.c +12 -2
@@ -65,6 +65,7 @@ static int catpt_dma_memcpy(struct catpt_dev *cdev, struct dma_chan *chan, {struct dma_async_tx_descriptor *desc;enum dma_status status; +int ret; desc =dmaengine_prep_dma_memcpy (chan, dst_addr, src_addr, size,DMA_CTRL_ACK );
@@ -77,13 +78,22 @@ static int catpt_dma_memcpy(struct catpt_dev *cdev, struct dma_chan *chan,catpt_updatel_shim (cdev,HMDC ,CATPT_HMDC_HDDA (CATPT_DMA_DEVID , chan->chan_id),CATPT_HMDC_HDDA (CATPT_DMA_DEVID , chan->chan_id)); -dmaengine_submit (desc); + + ret =dma_submit_error (dmaengine_submit (desc)); +if (ret) { +dev_err (cdev->dev,"submit tx failed: %d\n" , ret); + goto clear_hdda; + } + status =dma_wait_for_async_tx (desc); + ret = (status ==DMA_COMPLETE ) ?0 : -EPROTO ; + +clear_hdda:/* regardless of status, disable access to HOST memory in demand mode */ catpt_updatel_shim (cdev,HMDC ,CATPT_HMDC_HDDA (CATPT_DMA_DEVID , chan->chan_id),0 ); -return (status ==DMA_COMPLETE ) ?0 : -EPROTO ; +return ret; } int catpt_dma_memcpy_todsp(struct catpt_dev *cdev, struct dma_chan *chan,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 425/846 iommu/iova: Fix race between FQ timeout and teardown
In reply to Greg Kroah-HartmanFrom: Xiongfeng Wang <[email protected]>
[ Upstream commit d7061627d701c90e1cac1e1e60c45292f64f3470 ]
It turns out to be possible for hotplugging out a device to reach the stage of tearing down the device's group and default domain before the domain's flush queue has drained naturally. At this point, it is then possible for the timeout to expire just before the del_timer() call in free_iova_flush_queue(), such that we then proceed to free the FQ resources while fq_flush_timeout() is still accessing them on another CPU. Crashes due to this have been observed in the wild while removing NVMe devices.
Close the race window by using del_timer_sync() to safely wait for any active timeout handler to finish before we start to free things. We already avoid any locking in free_iova_flush_queue() since the FQ is supposed to be inactive anyway, so the potential deadlock scenario does not apply.
--- drivers/iommu/iova.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/iommu/iova.c +1 -2
@@ -83,8 +83,7 @@ static void free_iova_flush_queue(struct iova_domain *iovad)if (!has_iova_flush_queue (iovad))return ; -if (timer_pending (&iovad->fq_timer)) -del_timer (&iovad->fq_timer); +del_timer_sync (&iovad->fq_timer);fq_destroy_all_entries (iovad);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 426/846 ASoC: mediatek: mt8195: correct default value
In reply to Greg Kroah-HartmanFrom: Trevor Wu <[email protected]>
[ Upstream commit 30e693ee82d20361f2caacca3b68c79e1a7cb16c ]
mt8195_cg_patch is used to reset the default value of audio cg, so the register value could be consistent with CCF reference count. Nevertheless, AUDIO_TOP_CON1[1:0] is used to control an internal mux, and it's expected to keep the default value 0.
This patch corrects the default value in case an unexpected behavior happens in the future.
--- sound/soc/mediatek/mt8195/mt8195-afe-pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/mediatek/mt8195/mt8195-afe-pcm.c +1 -1
@@ -3028,7 +3028,7 @@ static const struct reg_sequence mt8195_afe_reg_defaults[] = {static const struct reg_sequence mt8195_cg_patch[] = { {AUDIO_TOP_CON0 ,0xfffffffb }, - {AUDIO_TOP_CON1 ,0xfffffffa }, + {AUDIO_TOP_CON1 ,0xfffffff8 }, };static int mt8195_afe_init_registers (struct mtk_base_afe *afe)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 427/846 of: fdt: Aggregate the processing of "linux,usable-memory-range"
In reply to Greg Kroah-HartmanFrom: Zhen Lei <[email protected]>
[ Upstream commit 8347b41748c3019157312fbe7f8a6792ae396eb7 ]
Currently, we parse the "linux,usable-memory-range" property in early_init_dt_scan_chosen(), to obtain the specified memory range of the crash kernel. We then reserve the required memory after early_init_dt_scan_memory() has identified all available physical memory. Because the two pieces of code are separated far, the readability and maintainability are reduced. So bring them together.
(change the prototype of early_init_dt_check_for_usable_mem_range(), in order to use it outside)
To: [email protected]
To: [email protected]
--- drivers/of/fdt.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/of/fdt.c +13 -6
@@ -969,18 +969,22 @@ static void __init early_init_dt_check_for_elfcorehdr(unsigned long node) elfcorehdr_addr, elfcorehdr_size); } -static phys_addr_t cap_mem_addr; -static phys_addr_t cap_mem_size; +static unsigned long chosen_node_offset = -FDT_ERR_NOTFOUND ;/** * early_init_dt_check_for_usable_mem_range - Decode usable memory range * location from flat tree -* @node: reference to node containing usable memory range location ('chosen') */ -static void __init early_init_dt_check_for_usable_mem_range (unsigned long node) +static void __init early_init_dt_check_for_usable_mem_range (void ) {const __be32 *prop;int len; +phys_addr_t cap_mem_addr; +phys_addr_t cap_mem_size; +unsigned long node = chosen_node_offset; + +if ((long )node <0 ) +return ;pr_debug ("Looking for usable-memory-range property... " );
@@ -993,6 +997,8 @@ static void __init early_init_dt_check_for_usable_mem_range(unsigned long node)pr_debug ("cap_mem_start=%pa cap_mem_size=%pa\n" , &cap_mem_addr, &cap_mem_size); + +memblock_cap_memory_range (cap_mem_addr, cap_mem_size); }#ifdef CONFIG_SERIAL_EARLYCON
@@ -1141,9 +1147,10 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0))return 0 ; + chosen_node_offset = node; +early_init_dt_check_for_initrd (node);early_init_dt_check_for_elfcorehdr (node); -early_init_dt_check_for_usable_mem_range (node);/* Retrieve command line */ p =of_get_flat_dt_prop (node,"bootargs" , &l);
@@ -1279,7 +1286,7 @@ void __init early_init_dt_scan_nodes(void)of_scan_flat_dt (early_init_dt_scan_memory,NULL );/* Handle linux,usable-memory-range property */ -memblock_cap_memory_range (cap_mem_addr, cap_mem_size); +early_init_dt_check_for_usable_mem_range (); }bool __init early_init_dt_scan (void *params)
Signature · 9 lines
2.34.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 428/846 efi: apply memblock cap after memblock_add()
In reply to Greg Kroah-HartmanFrom: Pingfan Liu <[email protected]>
[ Upstream commit b398123bff3bcbc1facb0f29bf6e7b9f1bc55931 ]
On arm64, during kdump kernel saves vmcore, it runs into the following bug:
...
[ 15.148919] usercopy: Kernel memory exposure attempt detected from SLUB object 'kmem_cache_node' (offset 0, size 4096)! [ 15.159707] ------------[ cut here ]------------ [ 15.164311] kernel BUG at mm/usercopy.c:99! [ 15.168482] Internal error: Oops - BUG: 0 [#1] SMP [ 15.173261] Modules linked in: xfs libcrc32c crct10dif_ce ghash_ce sha2_ce sha256_arm64 sha1_ce sbsa_gwdt ast i2c_algo_bit drm_vram_helper drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops cec drm_ttm_helper ttm drm nvme nvme_core xgene_hwmon i2c_designware_platform i2c_designware_core dm_mirror dm_region_hash dm_log dm_mod overlay squashfs zstd_decompress loop [ 15.206186] CPU: 0 PID: 542 Comm: cp Not tainted 5.16.0-rc4 #1 [ 15.212006] Hardware name: GIGABYTE R272-P30-JG/MP32-AR0-JG, BIOS F12 (SCP: 1.5.20210426) 05/13/2021 [ 15.221125] pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 15.228073] pc : usercopy_abort+0x9c/0xa0 [ 15.232074] lr : usercopy_abort+0x9c/0xa0 [ 15.236070] sp : ffff8000121abba0 [ 15.239371] x29: ffff8000121abbb0 x28: 0000000000003000 x27: 0000000000000000 [ 15.246494] x26: 0000000080000400 x25: 0000ffff885c7000 x24: 0000000000000000 [ 15.253617] x23: 000007ff80400000 x22: ffff07ff80401000 x21: 0000000000000001 [ 15.260739] x20: 0000000000001000 x19: ffff07ff80400000 x18: ffffffffffffffff [ 15.267861] x17: 656a626f2042554c x16: 53206d6f72662064 x15: 6574636574656420 [ 15.274983] x14: 74706d6574746120 x13: 2129363930342065 x12: 7a6973202c302074 [ 15.282105] x11: ffffc8b041d1b148 x10: 00000000ffff8000 x9 : ffffc8b04012812c [ 15.289228] x8 : 00000000ffff7fff x7 : ffffc8b041d1b148 x6 : 0000000000000000 [ 15.296349] x5 : 0000000000000000 x4 : 0000000000007fff x3 : 0000000000000000 [ 15.303471] x2 : 0000000000000000 x1 : ffff07ff8c064800 x0 : 000000000000006b [ 15.310593] Call trace: [ 15.313027] usercopy_abort+0x9c/0xa0 [ 15.316677] __check_heap_object+0xd4/0xf0 [ 15.320762] __check_object_size.part.0+0x160/0x1e0 [ 15.325628] __check_object_size+0x2c/0x40 [ 15.329711] copy_oldmem_page+0x7c/0x140 [ 15.333623] read_from_oldmem.part.0+0xfc/0x1c0 [ 15.338142] __read_vmcore.constprop.0+0x23c/0x350 [ 15.342920] read_vmcore+0x28/0x34 [ 15.346309] proc_reg_read+0xb4/0xf0 [ 15.349871] vfs_read+0xb8/0x1f0 [ 15.353088] ksys_read+0x74/0x100 [ 15.356390] __arm64_sys_read+0x28/0x34
...
This bug introduced by commit b261dba2fdb2 ("arm64: kdump: Remove custom linux,usable-memory-range handling"), which moves memblock_cap_memory_range() to fdt, but it breaches the rules that memblock_cap_memory_range() should come after memblock_add() etc as said in commit e888fa7bb882 ("memblock: Check memory add/cap ordering").
As a consequence, the virtual address set up by copy_oldmem_page() does not bail out from the test of virt_addr_valid() in check_heap_object(), and finally hits the BUG_ON().
Since memblock allocator has no idea about when the memblock is fully populated, while efi_init() is aware, so tackling this issue by calling the interface early_init_dt_check_for_usable_mem_range() exposed by of/fdt.
To: [email protected]
To: [email protected]
--- drivers/firmware/efi/efi-init.c | 5 +++++ drivers/of/fdt.c | 2 +- include/linux/of_fdt.h | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-)
drivers/firmware/efi/efi-init.c +5 -0
@@ -235,6 +235,11 @@ void __init efi_init(void) }reserve_regions (); +/* +* For memblock manipulation, the cap should come after the memblock_add(). +* And now, memblock is fully populated, it is time to do capping. +*/ +early_init_dt_check_for_usable_mem_range ();efi_esrt_init ();efi_mokvar_table_init ();
drivers/of/fdt.c +1 -1
@@ -975,7 +975,7 @@ static unsigned long chosen_node_offset = -FDT_ERR_NOTFOUND;* early_init_dt_check_for_usable_mem_range - Decode usable memory range * location from flat tree */ -static void __init early_init_dt_check_for_usable_mem_range (void ) +void __init early_init_dt_check_for_usable_mem_range (void ) {const __be32 *prop;int len;
include/linux/of_fdt.h +2 -0
@@ -62,6 +62,7 @@ extern int early_init_dt_scan_chosen(unsigned long node, const char *uname, int depth, void *data);extern int early_init_dt_scan_memory (unsigned long node,const char *uname,int depth,void *data); +extern void early_init_dt_check_for_usable_mem_range (void );extern int early_init_dt_scan_chosen_stdout (void );extern void early_init_fdt_scan_reserved_mem (void );extern void early_init_fdt_reserve_self (void );
@@ -87,6 +88,7 @@ extern void unflatten_and_copy_device_tree(void);extern void early_init_devtree (void *);extern void early_get_first_memblock_info (void *,phys_addr_t *);#else /* CONFIG_OF_EARLY_FLATTREE */ +static inline void early_init_dt_check_for_usable_mem_range (void ) {}static inline int early_init_dt_scan_chosen_stdout (void ) {return -ENODEV ; }static inline void early_init_fdt_scan_reserved_mem (void ) {}static inline void early_init_fdt_reserve_self (void ) {}
Signature · 9 lines
2.34.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 429/846 scsi: block: pm: Always set request queue runtime active in blk_post_runtime_resume()
In reply to Greg Kroah-HartmanFrom: Alan Stern <[email protected]>
[ Upstream commit 6e1fcab00a23f7fe9f4fe9704905a790efa1eeab ]
John Garry reported a deadlock that occurs when trying to access a runtime-suspended SATA device. For obscure reasons, the rescan procedure causes the link to be hard-reset, which disconnects the device.
The rescan tries to carry out a runtime resume when accessing the device. scsi_rescan_device() holds the SCSI device lock and won't release it until it can put commands onto the device's block queue. This can't happen until the queue is successfully runtime-resumed or the device is unregistered. But the runtime resume fails because the device is disconnected, and __scsi_remove_device() can't do the unregistration because it can't get the device lock.
The best way to resolve this deadlock appears to be to allow the block queue to start running again even after an unsuccessful runtime resume. The idea is that the driver or the SCSI error handler will need to be able to use the queue to resolve the runtime resume failure.
This patch removes the err argument to blk_post_runtime_resume() and makes the routine act as though the resume was successful always. This fixes the deadlock.
--- block/blk-pm.c | 22 +++++++--------------- drivers/scsi/scsi_pm.c | 2 +- include/linux/blk-pm.h | 2 +- 3 files changed, 9 insertions(+), 17 deletions(-)
block/blk-pm.c +7 -15
@@ -163,27 +163,19 @@ EXPORT_SYMBOL(blk_pre_runtime_resume);/** * blk_post_runtime_resume - Post runtime resume processing * @q: the queue of the device -* @err: return value of the device's runtime_resume function * * Description: -* Update the queue's runtime status according to the return value of the -* device's runtime_resume function. If the resume was successful, call -* blk_set_runtime_active() to do the real work of restarting the queue. +* For historical reasons, this routine merely calls blk_set_runtime_active() +* to do the real work of restarting the queue. It does this regardless of +* whether the device's runtime-resume succeeded; even if it failed the +* driver or error handler will need to communicate with the device. * * This function should be called near the end of the device's * runtime_resume callback. */ -void blk_post_runtime_resume (struct request_queue *q,int err) +void blk_post_runtime_resume (struct request_queue *q) { -if (!q->dev) -return ; -if (!err) { -blk_set_runtime_active (q); - }else { -spin_lock_irq (&q->queue_lock); - q->rpm_status =RPM_SUSPENDED ; -spin_unlock_irq (&q->queue_lock); - } +blk_set_runtime_active (q); }EXPORT_SYMBOL (blk_post_runtime_resume);
@@ -201,7 +193,7 @@ EXPORT_SYMBOL(blk_post_runtime_resume);* runtime PM status and re-enable peeking requests from the queue. It * should be called before first request is added to the queue. * -* This function is also called by blk_post_runtime_resume() for successful +* This function is also called by blk_post_runtime_resume() for * runtime resumes. It does everything necessary to restart the queue. */ void blk_set_runtime_active (struct request_queue *q)
drivers/scsi/scsi_pm.c +1 -1
@@ -262,7 +262,7 @@ static int sdev_runtime_resume(struct device *dev)blk_pre_runtime_resume (sdev->request_queue);if (pm && pm->runtime_resume) err = pm->runtime_resume (dev); -blk_post_runtime_resume (sdev->request_queue, err); +blk_post_runtime_resume (sdev->request_queue);return err; }
include/linux/blk-pm.h +1 -1
@@ -14,7 +14,7 @@ extern void blk_pm_runtime_init(struct request_queue *q, struct device *dev);extern int blk_pre_runtime_suspend (struct request_queue *q);extern void blk_post_runtime_suspend (struct request_queue *q,int err);extern void blk_pre_runtime_resume (struct request_queue *q); -extern void blk_post_runtime_resume (struct request_queue *q,int err); +extern void blk_post_runtime_resume (struct request_queue *q);extern void blk_set_runtime_active (struct request_queue *q);#else static inline void blk_pm_runtime_init(struct request_queue *q,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 430/846 phy: uniphier-usb3ss: fix unintended writing zeros to PHY register
In reply to Greg Kroah-HartmanFrom: Ryuta NAKANISHI <[email protected]>
[ Upstream commit 898c7a9ec81620125f2463714a0f4dea18ad6e54 ]
Similar to commit 4a90bbb478db ("phy: uniphier-pcie: Fix updating phy parameters"), in function uniphier_u3ssphy_set_param(), unintentionally write zeros to other fields when writing PHY registers.
--- drivers/phy/socionext/phy-uniphier-usb3ss.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/phy/socionext/phy-uniphier-usb3ss.c +6 -4
@@ -22,11 +22,13 @@#include <linux/reset.h> #define SSPHY_TESTI 0x0 -#define SSPHY_TESTO 0x4#define TESTI_DAT_MASK GENMASK(13, 6)#define TESTI_ADR_MASK GENMASK(5, 1)#define TESTI_WR_EN BIT(0) +#define SSPHY_TESTO 0x4 +#define TESTO_DAT_MASK GENMASK(7, 0) +#define PHY_F (regno, msb, lsb) { (regno), (msb), (lsb) }#define CDR_CPD_TRIM PHY_F(7, 3, 0)/* RxPLL charge pump current */
@@ -84,12 +86,12 @@ static void uniphier_u3ssphy_set_param(struct uniphier_u3ssphy_priv *priv, val =FIELD_PREP (TESTI_DAT_MASK ,1 ); val |=FIELD_PREP (TESTI_ADR_MASK , p->field.reg_no);uniphier_u3ssphy_testio_write (priv, val); - val =readl (priv->base +SSPHY_TESTO ); + val =readl (priv->base +SSPHY_TESTO ) &TESTO_DAT_MASK ;/* update value */ - val &= ~FIELD_PREP (TESTI_DAT_MASK , field_mask); + val &= ~field_mask; data = field_mask & (p->value << p->field.lsb); - val =FIELD_PREP (TESTI_DAT_MASK , data); + val =FIELD_PREP (TESTI_DAT_MASK , data | val); val |=FIELD_PREP (TESTI_ADR_MASK , p->field.reg_no);uniphier_u3ssphy_testio_write (priv, val);uniphier_u3ssphy_testio_write (priv, val |TESTI_WR_EN );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 431/846 ASoC: mediatek: Check for error clk pointer
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 9de2b9286a6dd16966959b3cb34fc2ddfd39213e ]
Yes, you are right and now the return code depending on the init_clks().
--- drivers/soc/mediatek/mtk-scpsys.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/soc/mediatek/mtk-scpsys.c +11 -4
@@ -411,12 +411,17 @@ out:return ret; } -static void init_clks (struct platform_device *pdev,struct clk **clk) +static int init_clks (struct platform_device *pdev,struct clk **clk) {int i; -for (i =CLK_NONE +1 ; i <CLK_MAX ; i++) +for (i =CLK_NONE +1 ; i <CLK_MAX ; i++) { clk[i] =devm_clk_get (&pdev->dev, clk_names[i]); +if (IS_ERR (clk[i])) +return PTR_ERR (clk[i]); + } + +return 0 ; } static struct scp *init_scp(struct platform_device *pdev,
@@ -426,7 +431,7 @@ static struct scp *init_scp(struct platform_device *pdev, {struct genpd_onecell_data *pd_data;struct resource *res; -int i, j; +int i, j, ret;struct scp *scp;struct clk *clk[CLK_MAX ];
@@ -481,7 +486,9 @@ static struct scp *init_scp(struct platform_device *pdev, pd_data->num_domains = num; -init_clks (pdev, clk); + ret =init_clks (pdev, clk); +if (ret) +return ERR_PTR (ret);for (i =0 ; i < num; i++) {struct scp_domain *scpd = &scp->domains[i];
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 432/846 powerpc/64s: Mask NIP before checking against SRR0
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
[ Upstream commit 314f6c23dd8d417281eb9e8a516dd98036f2e7b3 ]
When CONFIG_PPC_RFI_SRR_DEBUG=y we check that NIP and SRR0 match when returning from interrupts. This can trigger falsely if NIP has either of its two low bits set via sigreturn or ptrace, while SRR0 has its low two bits masked in hardware.
As a quick fix make sure to mask the low bits before doing the check.
--- arch/powerpc/kernel/interrupt_64.S | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/kernel/interrupt_64.S +2 -0
@@ -30,6 +30,7 @@ COMPAT_SYS_CALL_TABLE: .ifc \srr,srr mfspr r11,SPRN_SRR0 ld r12,_NIP(r1) + clrrdi r12,r12,2 100: tdne r11,r12 EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) mfspr r11,SPRN_SRR1
@@ -39,6 +40,7 @@ COMPAT_SYS_CALL_TABLE: .else mfspr r11,SPRN_HSRR0 ld r12,_NIP(r1) + clrrdi r12,r12,2 100: tdne r11,r12 EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) mfspr r11,SPRN_HSRR1
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 433/846 powerpc/64s: Use EMIT_WARN_ENTRY for SRR debug warnings
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
[ Upstream commit fd1eaaaaa6864b5fb8f99880fcefb49760b8fe4e ]
When CONFIG_PPC_RFI_SRR_DEBUG=y we check the SRR values before returning from interrupts. This is done in asm using EMIT_BUG_ENTRY, and passing BUGFLAG_WARNING.
However that fails to create an exception table entry for the warning, and so do_program_check() fails the exception table search and proceeds to call _exception(), resulting in an oops like:
Oops: Exception in kernel mode, sig: 5 [#1] LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA pSeries Modules linked in: CPU: 2 PID: 1204 Comm: sigreturn_unali Tainted: P 5.16.0-rc2-00194-g91ca3d4f77c5 #12 NIP: c00000000000c5b0 LR: 0000000000000000 CTR: 0000000000000000 ... NIP [c00000000000c5b0] system_call_common+0x150/0x268 LR [0000000000000000] 0x0 Call Trace: [c00000000db73e10] [c00000000000c558] system_call_common+0xf8/0x268 (unreliable) ... Instruction dump: 7cc803a6 888d0931 2c240000 4082001c 38800000 988d0931 e8810170 e8a10178 7c9a03a6 7cbb03a6 7d7a02a6 e9810170 <7f0b6088> 7d7b02a6 e9810178 7f0b6088
We should instead use EMIT_WARN_ENTRY, which creates an exception table entry for the warning, allowing the warning to be correctly recognised, and the code to resume after printing the warning.
Note however that because this warning is buried deep in the interrupt return path, we are not able to recover from it (due to MSR_RI being clear), so we still end up in die() with an unrecoverable exception.
--- arch/powerpc/kernel/interrupt_64.S | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/powerpc/kernel/interrupt_64.S +4 -4
@@ -32,21 +32,21 @@ COMPAT_SYS_CALL_TABLE: ld r12,_NIP(r1) clrrdi r12,r12,2 100: tdne r11,r12 - EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) + EMIT_WARN_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) mfspr r11,SPRN_SRR1 ld r12,_MSR(r1) 100: tdne r11,r12 - EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) + EMIT_WARN_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) .else mfspr r11,SPRN_HSRR0 ld r12,_NIP(r1) clrrdi r12,r12,2 100: tdne r11,r12 - EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) + EMIT_WARN_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) mfspr r11,SPRN_HSRR1 ld r12,_MSR(r1) 100: tdne r11,r12 - EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) + EMIT_WARN_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) .endif #endif .endm
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 434/846 phy: cadence: Sierra: Fix to get correct parent for mux clocks
In reply to Greg Kroah-HartmanFrom: Swapnil Jakhade <[email protected]>
[ Upstream commit da08aab940092a050a4fb2857ed9479d2b0e03c4 ]
Fix get_parent() callback to return the correct index of the parent for PLL_CMNLC1 clock. Add a separate table of register values corresponding to the parent index for PLL_CMNLC1. Update set_parent() callback accordingly.
--- drivers/phy/cadence/phy-cadence-sierra.c | 31 ++++++++++++++++++++---- 1 file changed, 26 insertions(+), 5 deletions(-)
drivers/phy/cadence/phy-cadence-sierra.c +26 -5
@@ -215,7 +215,10 @@ static const int pll_mux_parent_index[][SIERRA_NUM_CMN_PLLC_PARENTS] = { [CMN_PLLLC1] = { PLL1_REFCLK, PLL0_REFCLK }, }; -static u32 cdns_sierra_pll_mux_table[] = {0 ,1 }; +static u32 cdns_sierra_pll_mux_table[][SIERRA_NUM_CMN_PLLC_PARENTS ] = { + [CMN_PLLLC ] = {0 ,1 }, + [CMN_PLLLC1 ] = {1 ,0 }, +};struct cdns_sierra_inst {struct phy *phy;
@@ -436,11 +439,25 @@ static const struct phy_ops ops = {static u8 cdns_sierra_pll_mux_get_parent (struct clk_hw *hw) {struct cdns_sierra_pll_mux *mux =to_cdns_sierra_pll_mux (hw); +struct regmap_field *plllc1en_field = mux->plllc1en_field; +struct regmap_field *termen_field = mux->termen_field;struct regmap_field *field = mux->pfdclk_sel_preg;unsigned int val; +int index;regmap_field_read (field, &val); -return clk_mux_val_to_index (hw, cdns_sierra_pll_mux_table,0 , val); + +if (strstr (clk_hw_get_name (hw), clk_names[CDNS_SIERRA_PLL_CMNLC1 ])) { + index =clk_mux_val_to_index (hw, cdns_sierra_pll_mux_table[CMN_PLLLC1 ],0 , val); +if (index ==1 ) { +regmap_field_write (plllc1en_field,1 ); +regmap_field_write (termen_field,1 ); + } + }else { + index =clk_mux_val_to_index (hw, cdns_sierra_pll_mux_table[CMN_PLLLC ],0 , val); + } + +return index; }static int cdns_sierra_pll_mux_set_parent (struct clk_hw *hw,u8 index)
@@ -458,7 +475,11 @@ static int cdns_sierra_pll_mux_set_parent(struct clk_hw *hw, u8 index) ret |=regmap_field_write (termen_field,1 ); } - val = cdns_sierra_pll_mux_table[index]; +if (strstr (clk_hw_get_name (hw), clk_names[CDNS_SIERRA_PLL_CMNLC1 ])) + val = cdns_sierra_pll_mux_table[CMN_PLLLC1 ][index]; +else + val = cdns_sierra_pll_mux_table[CMN_PLLLC ][index]; + ret |=regmap_field_write (field, val);return ret;
@@ -496,8 +517,8 @@ static int cdns_sierra_pll_mux_register(struct cdns_sierra_phy *sp,for (i =0 ; i < num_parents; i++) { clk = sp->input_clks[pll_mux_parent_index[clk_index][i]];if (IS_ERR_OR_NULL (clk)) { -dev_err (dev,"No parent clock for derived_refclk\n" ); -return PTR_ERR (clk); +dev_err (dev,"No parent clock for PLL mux clocks\n" ); +return IS_ERR (clk) ?PTR_ERR (clk) : -ENOENT ; } parent_names[i] =__clk_get_name (clk); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 435/846 ASoC: samsung: idma: Check of ioremap return value
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 3ecb46755eb85456b459a1a9f952c52986bce8ec ]
Because of the potential failure of the ioremap(), the buf->area could be NULL.
Therefore, we need to check it and return -ENOMEM in order to transfer the error.
--- sound/soc/samsung/idma.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/samsung/idma.c +2 -0
@@ -360,6 +360,8 @@ static int preallocate_idma_buffer(struct snd_pcm *pcm, int stream) buf->addr = idma.lp_tx_addr; buf->bytes = idma_hardware.buffer_bytes_max; buf->area = (unsigned char *__force )ioremap (buf->addr, buf->bytes); +if (!buf->area) +return -ENOMEM ;return 0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 436/846 misc: lattice-ecp3-config: Fix task hung when firmware load failed
In reply to Greg Kroah-HartmanFrom: Wei Yongjun <[email protected]>
[ Upstream commit fcee5ce50bdb21116711e38635e3865594af907e ]
When firmware load failed, kernel report task hung as follows:
INFO: task xrun:5191 blocked for more than 147 seconds.
Tainted: G W 5.16.0-rc5-next-20211220+ #11
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:xrun state:D stack: 0 pid: 5191 ppid: 270 flags:0x00000004
Call Trace:
__schedule+0xc12/0x4b50 kernel/sched/core.c:4986
schedule+0xd7/0x260 kernel/sched/core.c:6369 (discriminator 1)
schedule_timeout+0x7aa/0xa80 kernel/time/timer.c:1857
wait_for_completion+0x181/0x290 kernel/sched/completion.c:85
lattice_ecp3_remove+0x32/0x40 drivers/misc/lattice-ecp3-config.c:221
spi_remove+0x72/0xb0 drivers/spi/spi.c:409lattice_ecp3_remove() wait for signals from firmware loading, but when load failed, firmware_load() does not send this signal. This cause device remove hung. Fix it by sending signal even if load failed.
--- drivers/misc/lattice-ecp3-config.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/misc/lattice-ecp3-config.c +6 -6
@@ -76,12 +76,12 @@ static void firmware_load(const struct firmware *fw, void *context)if (fw ==NULL ) {dev_err (&spi->dev,"Cannot load firmware, aborting\n" ); -return ; + goto out; }if (fw->size ==0 ) {dev_err (&spi->dev,"Error: Firmware size is 0!\n" ); -return ; + goto out; }/* Fill dummy data (24 stuffing bits for commands) */
@@ -103,7 +103,7 @@ static void firmware_load(const struct firmware *fw, void *context)dev_err (&spi->dev,"Error: No supported FPGA detected (JEDEC_ID=%08x)!\n" , jedec_id); -return ; + goto out; }dev_info (&spi->dev,"FPGA %s detected\n" , ecp3_dev[i].name);
@@ -116,7 +116,7 @@ static void firmware_load(const struct firmware *fw, void *context) buffer =kzalloc (fw->size +8 ,GFP_KERNEL );if (!buffer) {dev_err (&spi->dev,"Error: Can't allocate memory!\n" ); -return ; + goto out; }/*
@@ -155,7 +155,7 @@ static void firmware_load(const struct firmware *fw, void *context)"Error: Timeout waiting for FPGA to clear (status=%08x)!\n" , status);kfree (buffer); -return ; + goto out; }dev_info (&spi->dev,"Configuring the FPGA...\n" );
@@ -181,7 +181,7 @@ static void firmware_load(const struct firmware *fw, void *context)release_firmware (fw);kfree (buffer); - +out:complete (&data->fw_loaded); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 437/846 ASoC: mediatek: mt8195: correct pcmif BE dai control flow
In reply to Greg Kroah-HartmanFrom: Trevor Wu <[email protected]>
[ Upstream commit 2355028c0c54c03afb66c589347f1dc9f6fe2e38 ]
Originally, the conditions for preventing reentry are not correct. dai->component->active is not the state specifically for pcmif dai, so it is not a correct condition to indicate the status of pcmif dai. On the other hand, snd_soc_dai_stream_actvie() in prepare ops for both playback and capture possibly return true at the first entry when these two streams are opened at the same time.
In the patch, I refer to the implementation in mt8192-dai-pcm.c. Clock and enabling bit for PCMIF are managed by DAPM, and the condition for prepare ops is replaced by the status of dai widget.
--- sound/soc/mediatek/mt8195/mt8195-dai-pcm.c | 73 +++++++--------------- sound/soc/mediatek/mt8195/mt8195-reg.h | 1 + 2 files changed, 22 insertions(+), 52 deletions(-)
sound/soc/mediatek/mt8195/mt8195-dai-pcm.c +21 -52
@@ -80,8 +80,15 @@ static const struct snd_soc_dapm_widget mtk_dai_pcm_widgets[] = { mtk_dai_pcm_o001_mix, ARRAY_SIZE(mtk_dai_pcm_o001_mix)), +SND_SOC_DAPM_SUPPLY ("PCM_EN" ,PCM_INTF_CON1 , +PCM_INTF_CON1_PCM_EN_SHIFT ,0 ,NULL ,0 ), +SND_SOC_DAPM_INPUT ("PCM1_INPUT" ),SND_SOC_DAPM_OUTPUT ("PCM1_OUTPUT" ), + +SND_SOC_DAPM_CLOCK_SUPPLY ("aud_asrc11" ), +SND_SOC_DAPM_CLOCK_SUPPLY ("aud_asrc12" ), + SND_SOC_DAPM_CLOCK_SUPPLY("aud_pcmif"), }; static const struct snd_soc_dapm_route mtk_dai_pcm_routes[] = {
@@ -97,22 +104,18 @@ static const struct snd_soc_dapm_route mtk_dai_pcm_routes[] = { {"PCM1 Playback", NULL, "O000"}, {"PCM1 Playback", NULL, "O001"}, + {"PCM1 Playback", NULL, "PCM_EN"}, + {"PCM1 Playback", NULL, "aud_asrc12"}, + {"PCM1 Playback", NULL, "aud_pcmif"}, + + {"PCM1 Capture", NULL, "PCM_EN"}, + {"PCM1 Capture", NULL, "aud_asrc11"}, + {"PCM1 Capture", NULL, "aud_pcmif"}, + {"PCM1_OUTPUT", NULL, "PCM1 Playback"}, {"PCM1 Capture", NULL, "PCM1_INPUT"}, }; -static void mtk_dai_pcm_enable (struct mtk_base_afe *afe) -{ -regmap_update_bits (afe->regmap,PCM_INTF_CON1 , -PCM_INTF_CON1_PCM_EN ,PCM_INTF_CON1_PCM_EN ); -} - -static void mtk_dai_pcm_disable (struct mtk_base_afe *afe) -{ -regmap_update_bits (afe->regmap,PCM_INTF_CON1 , -PCM_INTF_CON1_PCM_EN ,0x0 ); -} -static int mtk_dai_pcm_configure (struct snd_pcm_substream *substream,struct snd_soc_dai *dai) {
@@ -207,54 +210,22 @@ static int mtk_dai_pcm_configure(struct snd_pcm_substream *substream, }/* dai ops */ -static int mtk_dai_pcm_startup (struct snd_pcm_substream *substream, -struct snd_soc_dai *dai) -{ -struct mtk_base_afe *afe =snd_soc_dai_get_drvdata (dai); -struct mt8195_afe_private *afe_priv = afe->platform_priv; - -if (dai->component->active) -return 0 ; - -mt8195_afe_enable_clk (afe, afe_priv->clk[MT8195_CLK_AUD_ASRC11 ]); -mt8195_afe_enable_clk (afe, afe_priv->clk[MT8195_CLK_AUD_ASRC12 ]); -mt8195_afe_enable_clk (afe, afe_priv->clk[MT8195_CLK_AUD_PCMIF ]); - -return 0 ; -} - -static void mtk_dai_pcm_shutdown (struct snd_pcm_substream *substream, -struct snd_soc_dai *dai) -{ -struct mtk_base_afe *afe =snd_soc_dai_get_drvdata (dai); -struct mt8195_afe_private *afe_priv = afe->platform_priv; - -if (dai->component->active) -return ; - -mtk_dai_pcm_disable (afe); - -mt8195_afe_disable_clk (afe, afe_priv->clk[MT8195_CLK_AUD_PCMIF ]); -mt8195_afe_disable_clk (afe, afe_priv->clk[MT8195_CLK_AUD_ASRC12 ]); -mt8195_afe_disable_clk (afe, afe_priv->clk[MT8195_CLK_AUD_ASRC11 ]); -} -static int mtk_dai_pcm_prepare (struct snd_pcm_substream *substream,struct snd_soc_dai *dai) { -struct mtk_base_afe *afe =snd_soc_dai_get_drvdata (dai); -int ret =0 ; +int ret; -if (snd_soc_dai_stream_active (dai,SNDRV_PCM_STREAM_PLAYBACK ) && -snd_soc_dai_stream_active (dai,SNDRV_PCM_STREAM_CAPTURE )) +dev_dbg (dai->dev,"%s(), id %d, stream %d, widget active p %d, c %d\n" , + __func__, dai->id, substream->stream, + dai->playback_widget->active, dai->capture_widget->active); + +if (dai->playback_widget->active || dai->capture_widget->active)return 0 ; ret =mtk_dai_pcm_configure (substream, dai);if (ret)return ret; -mtk_dai_pcm_enable (afe); -return 0 ; }
@@ -316,8 +287,6 @@ static int mtk_dai_pcm_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) }static const struct snd_soc_dai_ops mtk_dai_pcm_ops = { - .startup = mtk_dai_pcm_startup, - .shutdown = mtk_dai_pcm_shutdown, .prepare = mtk_dai_pcm_prepare, .set_fmt = mtk_dai_pcm_set_fmt, };
sound/soc/mediatek/mt8195/mt8195-reg.h +1 -0
@@ -2550,6 +2550,7 @@#define PCM_INTF_CON1_PCM_FMT (x) (((x) & 0x3) << 1)#define PCM_INTF_CON1_PCM_FMT_MASK (0x3 << 1)#define PCM_INTF_CON1_PCM_EN BIT(0) +#define PCM_INTF_CON1_PCM_EN_SHIFT 0/* PCM_INTF_CON2 */ #define PCM_INTF_CON2_CLK_DOMAIN_SEL (x) (((x) & 0x3) << 23)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 438/846 arm64: tegra: Remove non existent Tegra194 reset
In reply to Greg Kroah-HartmanFrom: Sameer Pujar <[email protected]>
[ Upstream commit 146b3a77af8091cabbd1decc51d67799e69682d2 ]
Tegra194 does not really have "hda2codec_2x" related reset. Hence drop this entry to reflect actual HW.
--- arch/arm64/boot/dts/nvidia/tegra194.dtsi | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/nvidia/tegra194.dtsi +2 -3
@@ -818,9 +818,8 @@ <&bpmp TEGRA194_CLK_HDA2CODEC_2X>; clock-names = "hda", "hda2hdmi", "hda2codec_2x"; resets = <&bpmp TEGRA194_RESET_HDA>, - <&bpmp TEGRA194_RESET_HDA2HDMICODEC>, - <&bpmp TEGRA194_RESET_HDA2CODEC_2X>; - reset-names = "hda", "hda2hdmi", "hda2codec_2x"; + <&bpmp TEGRA194_RESET_HDA2HDMICODEC>; + reset-names = "hda", "hda2hdmi"; power-domains = <&bpmp TEGRA194_POWER_DOMAIN_DISP>; interconnects = <&mc TEGRA194_MEMORY_CLIENT_HDAR &emc>, <&mc TEGRA194_MEMORY_CLIENT_HDAW &emc>;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 439/846 mips: lantiq: add support for clk_set_parent()
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 76f66dfd60dc5d2f9dec22d99091fea1035c5d03 ]
Provide a simple implementation of clk_set_parent() in the lantiq subarch so that callers of it will build without errors.
Fixes these build errors:
ERROR: modpost: "clk_set_parent" [sound/soc/jz4740/snd-soc-jz4740-i2s.ko] undefined!
ERROR: modpost: "clk_set_parent" [sound/soc/atmel/snd-soc-atmel-i2s.ko] undefined!
[email protected] --cc="John Crispin <[email protected]>" --cc="Jonathan Cameron <[email protected]>" --cc="Russell King <[email protected]>" --cc="Andy Shevchenko <[email protected]>" [email protected] --to="Thomas Bogendoerfer <[email protected]>"
--- arch/mips/lantiq/clk.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/mips/lantiq/clk.c +6 -0
@@ -164,6 +164,12 @@ struct clk *clk_get_parent(struct clk *clk) }EXPORT_SYMBOL (clk_get_parent); +int clk_set_parent (struct clk *clk,struct clk *parent) +{ +return 0 ; +} +EXPORT_SYMBOL (clk_set_parent); +static inline u32 get_counter_resolution (void ) {u32 res;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 440/846 mips: bcm63xx: add support for clk_set_parent()
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 6f03055d508ff4feb8db02ba3df9303a1db8d381 ]
The MIPS BMC63XX subarch does not provide/support clk_set_parent(). This causes build errors in a few drivers, so add a simple implementation of that function so that callers of it will build without errors.
Fixes these build errors:
ERROR: modpost: "clk_set_parent" [sound/soc/jz4740/snd-soc-jz4740-i2s.ko] undefined!
ERROR: modpost: "clk_set_parent" [sound/soc/atmel/snd-soc-atmel-i2s.ko] undefined!
--- arch/mips/bcm63xx/clk.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/mips/bcm63xx/clk.c +6 -0
@@ -387,6 +387,12 @@ struct clk *clk_get_parent(struct clk *clk) }EXPORT_SYMBOL (clk_get_parent); +int clk_set_parent (struct clk *clk,struct clk *parent) +{ +return 0 ; +} +EXPORT_SYMBOL (clk_set_parent); +unsigned long clk_get_rate (struct clk *clk) {if (!clk)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 441/846 powerpc/xive: Add missing null check after calling kmalloc
In reply to Greg Kroah-HartmanFrom: Ammar Faizi <[email protected]>
[ Upstream commit 18dbfcdedc802f9500b2c29794f22a31d27639c0 ]
Commit 930914b7d528fc ("powerpc/xive: Add a debugfs file to dump internal XIVE state") forgot to add a null check.
Add it.
--- arch/powerpc/sysdev/xive/spapr.c | 3 +++ 1 file changed, 3 insertions(+)
arch/powerpc/sysdev/xive/spapr.c +3 -0
@@ -653,6 +653,9 @@ static int xive_spapr_debug_show(struct seq_file *m, void *private)struct xive_irq_bitmap *xibm;char *buf =kmalloc (PAGE_SIZE ,GFP_KERNEL ); +if (!buf) +return -ENOMEM ; +list_for_each_entry (xibm, &xive_irq_bitmaps, list) {memset (buf,0 ,PAGE_SIZE );bitmap_print_to_pagebuf (true, buf, xibm->bitmap, xibm->count);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 442/846 ASoC: fsl_mqs: fix MODULE_ALIAS
In reply to Greg Kroah-HartmanFrom: Alyssa Ross <[email protected]>
[ Upstream commit 9f3d45318dd9e739ed62e4218839a7a824d3cced ]
modprobe can't handle spaces in aliases.
--- sound/soc/fsl/fsl_mqs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/fsl/fsl_mqs.c +1 -1
@@ -337,4 +337,4 @@ module_platform_driver(fsl_mqs_driver);MODULE_AUTHOR ("Shengjiu Wang <[email protected]>" );MODULE_DESCRIPTION ("MQS codec driver" );MODULE_LICENSE ("GPL v2" ); -MODULE_ALIAS ("platform: fsl-mqs" ); +MODULE_ALIAS ("platform:fsl-mqs" );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 443/846 ALSA: hda/cs8409: Increase delay during jack detection
In reply to Greg Kroah-HartmanFrom: Christian A. Ehrhardt <[email protected]>
[ Upstream commit 8cd07657177006b67cc1610e4466cc75ad781c05 ]
Commit c8b4f0865e82 reduced delays related to cs42l42 jack detection. However, the change was too aggressive. As a result internal speakers on DELL Inspirion 3501 are not detected.
Increase the delay in cs42l42_run_jack_detect() a bit.
--- sound/pci/hda/patch_cs8409.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/hda/patch_cs8409.c +2 -2
@@ -628,8 +628,8 @@ static void cs42l42_run_jack_detect(struct sub_codec *cs42l42)cs8409_i2c_write (cs42l42,0x1b74 ,0x07 );cs8409_i2c_write (cs42l42,0x131b ,0xFD );cs8409_i2c_write (cs42l42,0x1120 ,0x80 ); -/* Wait ~100us*/ -usleep_range (100 ,200 ); +/* Wait ~20ms*/ +usleep_range (20000 ,25000 );cs8409_i2c_write (cs42l42,0x111f ,0x77 );cs8409_i2c_write (cs42l42,0x1120 ,0xc0 ); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 444/846 ALSA: hda/cs8409: Fix Jack detection after resume
In reply to Greg Kroah-HartmanFrom: Christian A. Ehrhardt <[email protected]>
[ Upstream commit 57f234248ff925d88caedf4019ec84e6ecb83909 ]
The suspend code unconditionally sets ->hp_jack_in and ->mic_jack_in to zero but without reporting this status change to the HDA core. To compensate for this, always assume a status change on the first unsol event after boot or resume.
--- sound/pci/hda/patch_cs8409-tables.c | 3 +++ sound/pci/hda/patch_cs8409.c | 5 ++++- sound/pci/hda/patch_cs8409.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-)
sound/pci/hda/patch_cs8409-tables.c +3 -0
@@ -252,6 +252,7 @@ struct sub_codec cs8409_cs42l42_codec = { .init_seq_num = ARRAY_SIZE(cs42l42_init_reg_seq), .hp_jack_in = 0, .mic_jack_in = 0, + .force_status_change = 1, .paged = 1, .suspended = 1, .no_type_dect = 0,
@@ -443,6 +444,7 @@ struct sub_codec dolphin_cs42l42_0 = { .init_seq_num = ARRAY_SIZE(dolphin_c0_init_reg_seq), .hp_jack_in = 0, .mic_jack_in = 0, + .force_status_change = 1, .paged = 1, .suspended = 1, .no_type_dect = 0,
@@ -456,6 +458,7 @@ struct sub_codec dolphin_cs42l42_1 = { .init_seq_num = ARRAY_SIZE(dolphin_c1_init_reg_seq), .hp_jack_in = 0, .mic_jack_in = 0, + .force_status_change = 1, .paged = 1, .suspended = 1, .no_type_dect = 1,
sound/pci/hda/patch_cs8409.c +4 -1
@@ -636,7 +636,9 @@ static void cs42l42_run_jack_detect(struct sub_codec *cs42l42)static int cs42l42_handle_tip_sense (struct sub_codec *cs42l42,unsigned int reg_ts_status) { -int status_changed =0 ; +int status_changed = cs42l42->force_status_change; + + cs42l42->force_status_change =0 ;/* TIP_SENSE INSERT/REMOVE */ switch (reg_ts_status) {
@@ -791,6 +793,7 @@ static void cs42l42_suspend(struct sub_codec *cs42l42) cs42l42->last_page =0 ; cs42l42->hp_jack_in =0 ; cs42l42->mic_jack_in =0 ; + cs42l42->force_status_change =1 ;/* Put CS42L42 into Reset */ gpio_data =snd_hda_codec_read (codec,CS8409_PIN_AFG ,0 ,AC_VERB_GET_GPIO_DATA ,0 );
sound/pci/hda/patch_cs8409.h +1 -0
@@ -305,6 +305,7 @@ struct sub_codec { unsigned int hp_jack_in:1; unsigned int mic_jack_in:1; + unsigned int force_status_change:1; unsigned int suspended:1; unsigned int paged:1;unsigned int last_page;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 445/846 RDMA/cxgb4: Set queue pair state when being queried
In reply to Greg Kroah-HartmanFrom: Kamal Heib <[email protected]>
[ Upstream commit e375b9c92985e409c4bb95dd43d34915ea7f5e28 ]
The API for ib_query_qp requires the driver to set cur_qp_state on return, add the missing set.
--- drivers/infiniband/hw/cxgb4/qp.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/cxgb4/qp.c +1 -0
@@ -2460,6 +2460,7 @@ int c4iw_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,memset (attr,0 ,sizeof (*attr));memset (init_attr,0 ,sizeof (*init_attr)); attr->qp_state =to_ib_qp_state (qhp->attr.state); + attr->cur_qp_state =to_ib_qp_state (qhp->attr.state); init_attr->cap.max_send_wr = qhp->attr.sq_num_entries; init_attr->cap.max_recv_wr = qhp->attr.rq_num_entries; init_attr->cap.max_send_sge = qhp->attr.sq_max_sges;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 446/846 clk: qcom: gcc-sc7280: Mark gcc_cfg_noc_lpass_clk always enabled
In reply to Greg Kroah-HartmanFrom: Taniya Das <[email protected]>
[ Upstream commit 9c337073d9d81a145434b22f42dc3128ecd17730 ]
The gcc cfg noc lpass clock is required to be always enabled for the LPASS core and audio drivers to be functional.
--- drivers/clk/qcom/gcc-sc7280.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/gcc-sc7280.c +1 -1
@@ -2998,7 +2998,7 @@ static struct clk_branch gcc_cfg_noc_lpass_clk = { .enable_mask = BIT(0), .hw.init = &(struct clk_init_data ){ .name ="gcc_cfg_noc_lpass_clk" , - .ops = &clk_branch2_ops, + .ops = &clk_branch2_aon_ops, }, }, };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 447/846 ASoC: imx-card: Need special setting for ak4497 on i.MX8MQ
In reply to Greg Kroah-HartmanFrom: Shengjiu Wang <[email protected]>
[ Upstream commit 3349b3d0c63b8b6fcca58156d72407f0b2e101ac ]
The SAI on i.MX8MQ don't support one2one ratio for mclk:bclk, so the mclk frequency exceeds the supported range of codec for the case that sample rate is larger than 705kHZ and format is S32_LE. Update the supported width for such case.
--- sound/soc/fsl/imx-card.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
sound/soc/fsl/imx-card.c +16 -1
@@ -553,8 +553,23 @@ static int imx_card_parse_of(struct imx_card_data *data) link_data->cpu_sysclk_id =FSL_SAI_CLK_MAST1 ;/* sai may support mclk/bclk = 1 */ -if (of_find_property (np,"fsl,mclk-equal-bclk" ,NULL )) +if (of_find_property (np,"fsl,mclk-equal-bclk" ,NULL )) { link_data->one2one_ratio = true; + }else { +int i; + +/* +* i.MX8MQ don't support one2one ratio, then +* with ak4497 only 16bit case is supported. +*/ +for (i =0 ; i <ARRAY_SIZE (ak4497_fs_mul); i++) { +if (ak4497_fs_mul[i].rmin ==705600 && + ak4497_fs_mul[i].rmax ==768000 ) { + ak4497_fs_mul[i].wmin =32 ; + ak4497_fs_mul[i].wmax =32 ; + } + } + } } link->cpus->of_node = args.np;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 448/846 ASoC: imx-card: Fix mclk calculation issue for akcodec
In reply to Greg Kroah-HartmanFrom: Shengjiu Wang <[email protected]>
[ Upstream commit f331ae5fa59fbfb748317b290648fc3f1a50d932 ]
Transfer the refined slots and slot_width to akcodec_get_mclk_rate() for mclk calculation, otherwise the mclk frequency does not match with the slots and slot_width for S16_LE format, because the default slot_width is 32.
--- sound/soc/fsl/imx-card.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
sound/soc/fsl/imx-card.c +4 -3
@@ -247,13 +247,14 @@ static bool codec_is_akcodec(unsigned int type) }static unsigned long akcodec_get_mclk_rate (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *params) +struct snd_pcm_hw_params *params, +int slots,int slot_width) {struct snd_soc_pcm_runtime *rtd = substream->private_data;struct imx_card_data *data =snd_soc_card_get_drvdata (rtd->card);const struct imx_card_plat_data *plat_data = data->plat_data;struct dai_link_data *link_data = &data->link_data[rtd->num]; -unsigned int width = link_data->slots * link_data->slot_width; +unsigned int width = slots * slot_width;unsigned int rate =params_rate (params);int i;
@@ -349,7 +350,7 @@ static int imx_aif_hw_params(struct snd_pcm_substream *substream,/* Set MCLK freq */ if (codec_is_akcodec (plat_data->type)) - mclk_freq =akcodec_get_mclk_rate (substream, params); + mclk_freq =akcodec_get_mclk_rate (substream, params, slots, slot_width);else mclk_freq =params_rate (params) * slots * slot_width;/* Use the maximum freq from DSD512 (512*44100 = 22579200) */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 449/846 ASoC: imx-card: improve the sound quality for low rate
In reply to Greg Kroah-HartmanFrom: Shengjiu Wang <[email protected]>
[ Upstream commit 3969341813eb56d2dfc39bb64229359a6ae3c195 ]
According to RM, on auto mode:
For codec AK4458 and AK4497, the lowest ratio of MLCK/FS is 256 if sample rate is 8kHz-48kHz,
For codec AK5558, the lowest ratio of MLCK/FS is 512 if sample rate is 8kHz-48kHz.
With these setting the sound quality for 8kHz-48kHz can be improved.
--- sound/soc/fsl/imx-card.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/soc/fsl/imx-card.c +4 -4
@@ -120,7 +120,7 @@ struct imx_card_data {static struct imx_akcodec_fs_mul ak4458_fs_mul[] = {/* Normal, < 32kHz */ - { .rmin =8000 , .rmax =24000 , .wmin =1024 , .wmax =1024 , }, + { .rmin =8000 , .rmax =24000 , .wmin =256 , .wmax =1024 , },/* Normal, 32kHz */ { .rmin =32000 , .rmax =32000 , .wmin =256 , .wmax =1024 , },/* Normal */
@@ -151,8 +151,8 @@ static struct imx_akcodec_fs_mul ak4497_fs_mul[] = {* Table 7 - mapping multiplier and speed mode * Tables 8 & 9 - mapping speed mode and LRCK fs */ - { .rmin = 8000, .rmax = 32000, .wmin = 1024, .wmax = 1024, }, /* Normal, <= 32kHz */ - { .rmin = 44100, .rmax = 48000, .wmin = 512, .wmax = 512, }, /* Normal */ + { .rmin = 8000, .rmax = 32000, .wmin = 256, .wmax = 1024, }, /* Normal, <= 32kHz */ + { .rmin = 44100, .rmax = 48000, .wmin = 256, .wmax = 512, }, /* Normal */ { .rmin = 88200, .rmax = 96000, .wmin = 256, .wmax = 256, }, /* Double */ { .rmin = 176400, .rmax = 192000, .wmin = 128, .wmax = 128, }, /* Quad */ { .rmin = 352800, .rmax = 384000, .wmin = 128, .wmax = 128, }, /* Oct */
@@ -164,7 +164,7 @@ static struct imx_akcodec_fs_mul ak4497_fs_mul[] = {* (Table 4 from datasheet) */ static struct imx_akcodec_fs_mul ak5558_fs_mul[] = { - { .rmin =8000 , .rmax =32000 , .wmin =1024 , .wmax =1024 , }, + { .rmin =8000 , .rmax =32000 , .wmin =512 , .wmax =1024 , }, { .rmin =44100 , .rmax =48000 , .wmin =512 , .wmax =512 , }, { .rmin =88200 , .rmax =96000 , .wmin =256 , .wmax =256 , }, { .rmin =176400 , .rmax =192000 , .wmin =128 , .wmax =128 , },
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 450/846 ASoC: fsl_asrc: refine the check of available clock divider
In reply to Greg Kroah-HartmanFrom: Shengjiu Wang <[email protected]>
[ Upstream commit 320386343451ab6a3577e0ee200dac56a6182944 ]
According to RM, the clock divider range is from 1 to 8, clock prescaling ratio may be any power of 2 from 1 to 128. So the supported divider is not all the value between 1 and 1024, just limited value in that range.
Create table for the supported divder and add function to check the clock divider is available by comparing with the table.
--- sound/soc/fsl/fsl_asrc.c | 69 +++++++++++++++++++++++++++++++++------- 1 file changed, 58 insertions(+), 11 deletions(-)
sound/soc/fsl/fsl_asrc.c +58 -11
@@ -19,6 +19,7 @@#include "fsl_asrc.h" #define IDEAL_RATIO_DECIMAL_DEPTH 26 +#define DIVIDER_NUM 64#define pair_err (fmt, ...) \ dev_err(&asrc->pdev->dev, "Pair %c: " fmt, 'A' + index, ##__VA_ARGS__)
@@ -101,6 +102,55 @@ static unsigned char clk_map_imx8qxp[2][ASRC_CLK_MAP_LEN] = { }, }; +/* +* According to RM, the divider range is 1 ~ 8, +* prescaler is power of 2 from 1 ~ 128. +*/ +static int asrc_clk_divider[DIVIDER_NUM ] = { +1 ,2 ,4 ,8 ,16 ,32 ,64 ,128 ,/* divider = 1 */ +2 ,4 ,8 ,16 ,32 ,64 ,128 ,256 ,/* divider = 2 */ +3 ,6 ,12 ,24 ,48 ,96 ,192 ,384 ,/* divider = 3 */ +4 ,8 ,16 ,32 ,64 ,128 ,256 ,512 ,/* divider = 4 */ +5 ,10 ,20 ,40 ,80 ,160 ,320 ,640 ,/* divider = 5 */ +6 ,12 ,24 ,48 ,96 ,192 ,384 ,768 ,/* divider = 6 */ +7 ,14 ,28 ,56 ,112 ,224 ,448 ,896 ,/* divider = 7 */ +8 ,16 ,32 ,64 ,128 ,256 ,512 ,1024 ,/* divider = 8 */ +}; + +/* +* Check if the divider is available for internal ratio mode +*/ +static bool fsl_asrc_divider_avail (int clk_rate,int rate,int *div) +{ +u32 rem, i; +u64 n; + +if (div) + *div =0 ; + +if (clk_rate ==0 || rate ==0 ) +return false; + + n = clk_rate; + rem =do_div (n, rate); + +if (div) + *div = n; + +if (rem !=0 ) +return false; + +for (i =0 ; i <DIVIDER_NUM ; i++) { +if (n == asrc_clk_divider[i]) +break ; + } + +if (i ==DIVIDER_NUM ) +return false; + +return true; +} +/** * fsl_asrc_sel_proc - Select the pre-processing and post-processing options * @inrate: input sample rate
@@ -330,12 +380,12 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair *pair, bool use_ideal_rate)enum asrc_word_width input_word_width;enum asrc_word_width output_word_width;u32 inrate, outrate, indiv, outdiv; -u32 clk_index[2 ], div[2 ], rem[2 ]; +u32 clk_index[2 ], div[2 ];u64 clk_rate;int in, out, channels;int pre_proc, post_proc;struct clk *clk; -bool ideal; +bool ideal, div_avail;if (!config) {pair_err ("invalid pair config\n" );
@@ -415,8 +465,7 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair *pair, bool use_ideal_rate) clk = asrc_priv->asrck_clk[clk_index[ideal ?OUT :IN ]]; clk_rate =clk_get_rate (clk); - rem[IN ] =do_div (clk_rate, inrate); - div[IN ] = (u32 )clk_rate; + div_avail =fsl_asrc_divider_avail (clk_rate, inrate, &div[IN ]);/* * The divider range is [1, 1024], defined by the hardware. For non-
@@ -425,7 +474,7 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair *pair, bool use_ideal_rate)* only result in different converting speeds. So remainder does not * matter, as long as we keep the divider within its valid range. */ -if (div[IN ] ==0 || (!ideal && (div[IN ] >1024 || rem[IN ] !=0 ))) { +if (div[IN ] ==0 || (!ideal && !div_avail)) {pair_err ("failed to support input sample rate %dHz by asrck_%x\n" , inrate, clk_index[ideal ?OUT :IN ]);return -EINVAL ;
@@ -436,13 +485,12 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair *pair, bool use_ideal_rate) clk = asrc_priv->asrck_clk[clk_index[OUT ]]; clk_rate =clk_get_rate (clk);if (ideal && use_ideal_rate) - rem[OUT ] =do_div (clk_rate,IDEAL_RATIO_RATE ); + div_avail =fsl_asrc_divider_avail (clk_rate,IDEAL_RATIO_RATE , &div[OUT ]);else - rem[OUT ] =do_div (clk_rate, outrate); - div[OUT ] = clk_rate; + div_avail =fsl_asrc_divider_avail (clk_rate, outrate, &div[OUT ]);/* Output divider has the same limitation as the input one */ -if (div[OUT ] ==0 || (!ideal && (div[OUT ] >1024 || rem[OUT ] !=0 ))) { +if (div[OUT ] ==0 || (!ideal && !div_avail)) {pair_err ("failed to support output sample rate %dHz by asrck_%x\n" , outrate, clk_index[OUT ]);return -EINVAL ;
@@ -621,8 +669,7 @@ static void fsl_asrc_select_clk(struct fsl_asrc_priv *asrc_priv, clk_index = asrc_priv->clk_map[j][i]; clk_rate =clk_get_rate (asrc_priv->asrck_clk[clk_index]);/* Only match a perfect clock source with no remainder */ -if (clk_rate !=0 && (clk_rate / rate[j]) <=1024 && - (clk_rate % rate[j]) ==0 ) +if (fsl_asrc_divider_avail (clk_rate, rate[j],NULL ))break ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 451/846 clk: bm1880: remove kfrees on static allocations
In reply to Greg Kroah-HartmanFrom: Conor Dooley <[email protected]>
[ Upstream commit c861c1be3897845313a0df47804b1db37c7052e1 ]
bm1880_clk_unregister_pll & bm1880_clk_unregister_div both try to free statically allocated variables, so remove those kfrees.
For example, if we take L703 kfree(div_hw):
- div_hw is a bm1880_div_hw_clock pointer
- in bm1880_clk_register_plls this is pointed to an element of arg1:
struct bm1880_div_hw_clock *clks
- in the probe, where bm1880_clk_register_plls is called arg1 is bm1880_div_clks, defined on L371:
static struct bm1880_div_hw_clock bm1880_div_clks[]
--- drivers/clk/clk-bm1880.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-)
drivers/clk/clk-bm1880.c +2 -18
@@ -522,14 +522,6 @@ static struct clk_hw *bm1880_clk_register_pll(struct bm1880_pll_hw_clock *pll_clreturn hw; } -static void bm1880_clk_unregister_pll (struct clk_hw *hw) -{ -struct bm1880_pll_hw_clock *pll_hw =to_bm1880_pll_clk (hw); - -clk_hw_unregister (hw); -kfree (pll_hw); -} -static int bm1880_clk_register_plls (struct bm1880_pll_hw_clock *clks,int num_clks,struct bm1880_clock_data *data)
@@ -555,7 +547,7 @@ static int bm1880_clk_register_plls(struct bm1880_pll_hw_clock *clks, err_clk:while (i--) -bm1880_clk_unregister_pll (data->hw_data.hws[clks[i].pll.id]); +clk_hw_unregister (data->hw_data.hws[clks[i].pll.id]);return PTR_ERR (hw); }
@@ -695,14 +687,6 @@ static struct clk_hw *bm1880_clk_register_div(struct bm1880_div_hw_clock *div_clreturn hw; } -static void bm1880_clk_unregister_div (struct clk_hw *hw) -{ -struct bm1880_div_hw_clock *div_hw =to_bm1880_div_clk (hw); - -clk_hw_unregister (hw); -kfree (div_hw); -} -static int bm1880_clk_register_divs (struct bm1880_div_hw_clock *clks,int num_clks,struct bm1880_clock_data *data)
@@ -729,7 +713,7 @@ static int bm1880_clk_register_divs(struct bm1880_div_hw_clock *clks, err_clk:while (i--) -bm1880_clk_unregister_div (data->hw_data.hws[clks[i].div.id]); +clk_hw_unregister (data->hw_data.hws[clks[i].div.id]);return PTR_ERR (hw); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 452/846 of: base: Fix phandle argument length mismatch error message
In reply to Greg Kroah-HartmanFrom: Baruch Siach <[email protected]>
[ Upstream commit 94a4950a4acff39b5847cc1fee4f65e160813493 ]
The cell_count field of of_phandle_iterator is the number of cells we expect in the phandle arguments list when cells_name is missing. The error message should show the number of cells we actually see.
--- drivers/of/base.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/of/base.c +2 -2
@@ -1327,9 +1327,9 @@ int of_phandle_iterator_next(struct of_phandle_iterator *it)* property data length */ if (it->cur + count > it->list_end) { -pr_err ("%pOF: %s = %d found %d\n" , +pr_err ("%pOF: %s = %d found %td\n" , it->parent, it->cells_name, - count, it->cell_count); + count, it->list_end - it->cur); goto err; } }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 453/846 of/fdt: Dont worry about non-memory region overlap for no-map
In reply to Greg Kroah-HartmanFrom: Stephen Boyd <[email protected]>
[ Upstream commit da17d6905d29ddcdc04b2fdc37ed8cf1e8437cc8 ]
In commit 8a5a75e5e9e5 ("of/fdt: Make sure no-map does not remove already reserved regions") we returned -EBUSY when trying to mark regions as no-map when they intersect with reserved memory. The goal was to find bad no-map reserved memory DT nodes that would unmap the kernel text/data sections.
The problem is the reserved memory check will still trigger if the DT has a /memreserve/ that completely subsumes the no-map memory carveouts in the reserved memory node _and_ that region is also not part of the memory reg property. For example in sc7180.dtsi we have the following reserved-memory and memory node:
memory@80000000 {
/* We expect the bootloader to fill in the size */
reg = <0 0x80000000 0 0>;
};
smem_mem: memory@80900000 {
reg = <0x0 0x80900000 0x0 0x200000>;
no-map;
};and the memreserve filled in by the bootloader is
/memreserve/ 0x80800000 0x400000;
while the /memory node is transformed into
memory@80000000 {
/* The bootloader fills in the size, and adds another region */
reg = <0 0x80000000 0 0x00800000>,
<0 0x80c00000 0 0x7f200000>;
};The smem region is doubly reserved via /memreserve/ and by not being part of the /memory reg property. This leads to the following warning printed at boot.
OF: fdt: Reserved memory: failed to reserve memory for node 'memory@80900000': base 0x0000000080900000, size 2 MiB
Otherwise nothing really goes wrong because the smem region is not going to be mapped by the kernel's direct linear mapping given that it isn't part of the memory node. Therefore, let's only consider this to be a problem if we're trying to mark a region as no-map and it is actually memory that we're intending to keep out of the kernel's direct mapping but it's already been reserved.
--- drivers/of/fdt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/of/fdt.c +4 -2
@@ -482,9 +482,11 @@ static int __init early_init_dt_reserve_memory_arch(phys_addr_t base,if (nomap) {/* * If the memory is already reserved (by another region), we -* should not allow it to be marked nomap. +* should not allow it to be marked nomap, but don't worry +* if the region isn't memory as it won't be mapped. */ -if (memblock_is_region_reserved (base, size)) +if (memblock_overlaps_region (&memblock.memory, base, size) && +memblock_is_region_reserved (base, size))return -EBUSY ;return memblock_mark_nomap (base, size);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 454/846 MIPS: boot/compressed/: add __ashldi3 to target for ZSTD compression
In reply to Greg Kroah-HartmanFrom: Paul Cercueil <[email protected]>
[ Upstream commit fbf3bce458214bb971d3d571515b3b129eac290b ]
Just like before with __bswapdi2(), for MIPS pre-boot when CONFIG_KERNEL_ZSTD=y the decompressor function will use __ashldi3(), so the object file should be added to the target object file.
Fixes these build errors:
mipsel-linux-ld: arch/mips/boot/compressed/decompress.o: in function `FSE_buildDTable_internal':
decompress.c:(.text.FSE_buildDTable_internal+0x48): undefined reference to `__ashldi3'
mipsel-linux-ld: arch/mips/boot/compressed/decompress.o: in function `FSE_decompress_wksp_body_default':
decompress.c:(.text.FSE_decompress_wksp_body_default+0xa8): undefined reference to `__ashldi3'
mipsel-linux-ld: arch/mips/boot/compressed/decompress.o: in function `ZSTD_getFrameHeader_advanced':
decompress.c:(.text.ZSTD_getFrameHeader_advanced+0x134): undefined reference to `__ashldi3'
--- arch/mips/boot/compressed/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/boot/compressed/Makefile +1 -1
@@ -56,7 +56,7 @@ $(obj)/uart-ath79.c: $(srctree)/arch/mips/ath79/early_printk.c vmlinuzobjs-$(CONFIG_KERNEL_XZ) += $(obj)/ashldi3.o -vmlinuzobjs-$(CONFIG_KERNEL_ZSTD) += $(obj)/bswapdi.o +vmlinuzobjs-$(CONFIG_KERNEL_ZSTD) += $(obj)/bswapdi.o $(obj)/ashldi3.o extra-y += ashldi3.c $(obj)/ashldi3.c: $(obj)/%.c: $(srctree)/lib/%.c FORCE
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 455/846 MIPS: compressed: Fix build with ZSTD compression
In reply to Greg Kroah-HartmanFrom: Paul Cercueil <[email protected]>
[ Upstream commit c5c7440fe7f74645940d5c9e2c49cd7efb706a4f ]
Fix the following build issues:
mips64el-linux-ld: arch/mips/boot/compressed/decompress.o: in function `FSE_buildDTable_internal':
decompress.c:(.text.FSE_buildDTable_internal+0x2cc): undefined reference to `__clzdi2'
mips64el-linux-ld: arch/mips/boot/compressed/decompress.o: in function `BIT_initDStream':
decompress.c:(.text.BIT_initDStream+0x7c): undefined reference to `__clzdi2'
mips64el-linux-ld: decompress.c:(.text.BIT_initDStream+0x158): undefined reference to `__clzdi2'
mips64el-linux-ld: arch/mips/boot/compressed/decompress.o: in function `ZSTD_buildFSETable_body_default.constprop.0':
decompress.c:(.text.ZSTD_buildFSETable_body_default.constprop.0+0x2a8): undefined reference to `__clzdi2'
mips64el-linux-ld: arch/mips/boot/compressed/decompress.o: in function `FSE_readNCount_body_default':
decompress.c:(.text.FSE_readNCount_body_default+0x130): undefined reference to `__ctzdi2'
mips64el-linux-ld: decompress.c:(.text.FSE_readNCount_body_default+0x1a4): undefined reference to `__ctzdi2'
mips64el-linux-ld: decompress.c:(.text.FSE_readNCount_body_default+0x2e4): undefined reference to `__clzdi2'
mips64el-linux-ld: arch/mips/boot/compressed/decompress.o: in function `HUF_readStats_body_default':
decompress.c:(.text.HUF_readStats_body_default+0x184): undefined reference to `__clzdi2'
mips64el-linux-ld: decompress.c:(.text.HUF_readStats_body_default+0x1b4): undefined reference to `__clzdi2'
mips64el-linux-ld: arch/mips/boot/compressed/decompress.o: in function `ZSTD_DCtx_getParameter':
decompress.c:(.text.ZSTD_DCtx_getParameter+0x60): undefined reference to `__clzdi2'
--- arch/mips/boot/compressed/Makefile | 2 +- arch/mips/boot/compressed/clz_ctz.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 arch/mips/boot/compressed/clz_ctz.c
arch/mips/boot/compressed/Makefile +1 -1
@@ -56,7 +56,7 @@ $(obj)/uart-ath79.c: $(srctree)/arch/mips/ath79/early_printk.c vmlinuzobjs-$(CONFIG_KERNEL_XZ) += $(obj)/ashldi3.o -vmlinuzobjs-$(CONFIG_KERNEL_ZSTD) += $(obj)/bswapdi.o $(obj)/ashldi3.o +vmlinuzobjs-$(CONFIG_KERNEL_ZSTD) += $(obj)/bswapdi.o $(obj)/ashldi3.o $(obj)/clz_ctz.o extra-y += ashldi3.c $(obj)/ashldi3.c: $(obj)/%.c: $(srctree)/lib/%.c FORCE
arch/mips/boot/compressed/clz_ctz.c new file +2 -0
@@ -0,0 +1,2 @@ +// SPDX-License-Identifier: GPL-2.0-only +#include "../../../../lib/clz_ctz.c"
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 456/846 mailbox: fix gce_num of mt8192 driver data
In reply to Greg Kroah-HartmanFrom: jason-jh.lin <[email protected]>
[ Upstream commit 35ca43710f792ce183312fdc7e4b2bb0b721a173 ]
Because mt8192 only have 1 gce, the gce_num should be 1.
--- drivers/mailbox/mtk-cmdq-mailbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mailbox/mtk-cmdq-mailbox.c +1 -1
@@ -660,7 +660,7 @@ static const struct gce_plat gce_plat_v5 = { .thread_nr = 24, .shift = 3, .control_by_sw = true, - .gce_num = 2 + .gce_num = 1 };static const struct gce_plat gce_plat_v6 = {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 457/846 ARM: dts: omap3-n900: Fix lp5523 for multi color
In reply to Greg Kroah-HartmanFrom: Sicelo A. Mhlongo <[email protected]>
[ Upstream commit e9af026a3b24f59d7af4609f73e0ef60a4d6d516 ]
Since the LED multicolor framework support was added in commit 92a81562e695 ("leds: lp55xx: Add multicolor framework support to lp55xx") LEDs on this platform stopped working.
--- arch/arm/boot/dts/omap3-n900.dts | 50 +++++++++++++++++++++++++------- 1 file changed, 40 insertions(+), 10 deletions(-)
arch/arm/boot/dts/omap3-n900.dts +40 -10
@@ -8,6 +8,7 @@ #include "omap34xx.dtsi" #include <dt-bindings/input/input.h> +#include <dt-bindings/leds/common.h> /* * Default secure signed bootloader (Nokia X-Loader) does not enable L3 firewall
@@ -630,63 +631,92 @@ }; lp5523: lp5523@32 { + #address-cells = <1>; + #size-cells = <0>; compatible = "national,lp5523"; reg = <0x32>; clock-mode = /bits/ 8 <0>; /* LP55XX_CLOCK_AUTO */ - enable-gpio = <&gpio2 9 GPIO_ACTIVE_HIGH>; /* 41 */ + enable-gpios = <&gpio2 9 GPIO_ACTIVE_HIGH>; /* 41 */ - chan0 { + led@0 { + reg = <0>; chan-name = "lp5523:kb1"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; + color = <LED_COLOR_ID_WHITE>; + function = LED_FUNCTION_KBD_BACKLIGHT; }; - chan1 { + led@1 { + reg = <1>; chan-name = "lp5523:kb2"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; + color = <LED_COLOR_ID_WHITE>; + function = LED_FUNCTION_KBD_BACKLIGHT; }; - chan2 { + led@2 { + reg = <2>; chan-name = "lp5523:kb3"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; + color = <LED_COLOR_ID_WHITE>; + function = LED_FUNCTION_KBD_BACKLIGHT; }; - chan3 { + led@3 { + reg = <3>; chan-name = "lp5523:kb4"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; + color = <LED_COLOR_ID_WHITE>; + function = LED_FUNCTION_KBD_BACKLIGHT; }; - chan4 { + led@4 { + reg = <4>; chan-name = "lp5523:b"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; + color = <LED_COLOR_ID_BLUE>; + function = LED_FUNCTION_STATUS; }; - chan5 { + led@5 { + reg = <5>; chan-name = "lp5523:g"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; + color = <LED_COLOR_ID_GREEN>; + function = LED_FUNCTION_STATUS; }; - chan6 { + led@6 { + reg = <6>; chan-name = "lp5523:r"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; + color = <LED_COLOR_ID_RED>; + function = LED_FUNCTION_STATUS; }; - chan7 { + led@7 { + reg = <7>; chan-name = "lp5523:kb5"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; + color = <LED_COLOR_ID_WHITE>; + function = LED_FUNCTION_KBD_BACKLIGHT; }; - chan8 { + led@8 { + reg = <8>; chan-name = "lp5523:kb6"; led-cur = /bits/ 8 <50>; max-cur = /bits/ 8 <100>; + color = <LED_COLOR_ID_WHITE>; + function = LED_FUNCTION_KBD_BACKLIGHT; }; };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 458/846 leds: lp55xx: initialise output direction from dts
In reply to Greg Kroah-HartmanFrom: Merlijn Wajer <[email protected]>
[ Upstream commit 9e87a8da747bf72365abb79e6f64fcca955b4f56 ]
Commit a5d3d1adc95f ("leds: lp55xx: Initialize enable GPIO direction to output") attempts to fix this, but the fix did not work since at least for the Nokia N900 the value needs to be set to HIGH, per the device tree. So rather than hardcoding the value to a potentially invalid value for some devices, let's set direction in lp55xx_init_device.
--- drivers/leds/leds-lp55xx-common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/leds/leds-lp55xx-common.c +3 -1
@@ -439,6 +439,8 @@ int lp55xx_init_device(struct lp55xx_chip *chip)return -EINVAL ;if (pdata->enable_gpiod) { +gpiod_direction_output (pdata->enable_gpiod,0 ); +gpiod_set_consumer_name (pdata->enable_gpiod,"LP55xx enable" );gpiod_set_value (pdata->enable_gpiod,0 );usleep_range (1000 ,2000 );/* Keep enable down at least 1ms */
@@ -694,7 +696,7 @@ struct lp55xx_platform_data *lp55xx_of_populate_pdata(struct device *dev,of_property_read_u8 (np,"clock-mode" , &pdata->clock_mode); pdata->enable_gpiod =devm_gpiod_get_optional (dev,"enable" , -GPIOD_OUT_LOW ); +GPIOD_ASIS );if (IS_ERR (pdata->enable_gpiod))return ERR_CAST (pdata->enable_gpiod);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 459/846 Bluetooth: Fix debugfs entry leak in hci_register_dev()
In reply to Greg Kroah-HartmanFrom: Wei Yongjun <[email protected]>
[ Upstream commit 5a4bb6a8e981d3d0d492aa38412ee80b21033177 ]
Fault injection test report debugfs entry leak as follows:
debugfs: Directory 'hci0' with parent 'bluetooth' already present!
When register_pm_notifier() failed in hci_register_dev(), the debugfs create by debugfs_create_dir() do not removed in the error handing path.
Add the remove debugfs code to fix it.
--- net/bluetooth/hci_core.c | 1 + 1 file changed, 1 insertion(+)
net/bluetooth/hci_core.c +1 -0
@@ -3999,6 +3999,7 @@ int hci_register_dev(struct hci_dev *hdev)return id; err_wqueue: +debugfs_remove_recursive (hdev->debugfs);destroy_workqueue (hdev->workqueue);destroy_workqueue (hdev->req_workqueue); err:
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 460/846 Bluetooth: Fix memory leak of hci device
In reply to Greg Kroah-HartmanFrom: Wei Yongjun <[email protected]>
[ Upstream commit 75d9b8559ac36e059238ee4f8e33cd86086586ba ]
Fault injection test reported memory leak of hci device as follows:
unreferenced object 0xffff88800b858000 (size 8192):
comm "kworker/0:2", pid 167, jiffies 4294955747 (age 557.148s) hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 ad 4e ad de .............N..
backtrace:
[<0000000070eb1059>] kmem_cache_alloc_trace mm/slub.c:3208
[<00000000015eb521>] hci_alloc_dev_priv include/linux/slab.h:591
[<00000000dcfc1e21>] bpa10x_probe include/net/bluetooth/hci_core.h:1240
[<000000005d3028c7>] usb_probe_interface drivers/usb/core/driver.c:397
[<00000000cbac9243>] really_probe drivers/base/dd.c:517
[<0000000024cab3f0>] __driver_probe_device drivers/base/dd.c:751
[<00000000202135cb>] driver_probe_device drivers/base/dd.c:782
[<000000000761f2bc>] __device_attach_driver drivers/base/dd.c:899
[<00000000f7d63134>] bus_for_each_drv drivers/base/bus.c:427
[<00000000c9551f0b>] __device_attach drivers/base/dd.c:971
[<000000007f79bd16>] bus_probe_device drivers/base/bus.c:487
[<000000007bb8b95a>] device_add drivers/base/core.c:3364
[<000000009564d9ea>] usb_set_configuration drivers/usb/core/message.c:2171
[<00000000e4657087>] usb_generic_driver_probe drivers/usb/core/generic.c:239
[<0000000071ede518>] usb_probe_device drivers/usb/core/driver.c:294
[<00000000cbac9243>] really_probe drivers/base/dd.c:517hci_alloc_dev() do not init the device's flag. And hci_free_dev() using put_device() to free the memory allocated for this device, but it calls just put_device(dev) only in case of HCI_UNREGISTER flag is set, So any error handing before hci_register_dev() success will cause memory leak.
To avoid this behaviour we can using kfree() to release dev before hci_register_dev() success.
--- net/bluetooth/hci_sysfs.c | 2 ++ 1 file changed, 2 insertions(+)
net/bluetooth/hci_sysfs.c +2 -0
@@ -86,6 +86,8 @@ static void bt_host_release(struct device *dev)if (hci_dev_test_flag (hdev,HCI_UNREGISTER ))hci_release_dev (hdev); +else +kfree (hdev);module_put (THIS_MODULE ); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 461/846 drm/panel: Delete panel on mipi_dsi_attach() failure
In reply to Greg Kroah-HartmanFrom: Brian Norris <[email protected]>
[ Upstream commit 9bf7123bb07f98dc76acb5daa91248e6f95713cb ]
Many DSI panel drivers fail to clean up their panel references on mipi_dsi_attach() failure, so we're leaving a dangling drm_panel reference to freed memory. Clean that up on failure.
Noticed by inspection, after seeing similar problems on other drivers. Therefore, I'm not marking Fixes/stable.
--- drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c | 8 +++++++- drivers/gpu/drm/panel/panel-jdi-lt070me05000.c | 8 +++++++- drivers/gpu/drm/panel/panel-novatek-nt36672a.c | 8 +++++++- drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c | 8 +++++++- drivers/gpu/drm/panel/panel-ronbo-rb070d30.c | 8 +++++++- drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c | 1 + drivers/gpu/drm/panel/panel-samsung-sofef00.c | 1 + drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c | 8 +++++++- 8 files changed, 44 insertions(+), 6 deletions(-)
drivers/gpu/drm/panel/panel-feiyang-fy07024di26a30d.c +7 -1
@@ -227,7 +227,13 @@ static int feiyang_dsi_probe(struct mipi_dsi_device *dsi) dsi->format =MIPI_DSI_FMT_RGB888 ; dsi->lanes =4 ; -return mipi_dsi_attach (dsi); + ret =mipi_dsi_attach (dsi); +if (ret <0 ) { +drm_panel_remove (&ctx->panel); +return ret; + } + +return 0 ; }static int feiyang_dsi_remove (struct mipi_dsi_device *dsi)
drivers/gpu/drm/panel/panel-jdi-lt070me05000.c +7 -1
@@ -473,7 +473,13 @@ static int jdi_panel_probe(struct mipi_dsi_device *dsi)if (ret <0 )return ret; -return mipi_dsi_attach (dsi); + ret =mipi_dsi_attach (dsi); +if (ret <0 ) { +jdi_panel_del (jdi); +return ret; + } + +return 0 ; }static int jdi_panel_remove (struct mipi_dsi_device *dsi)
drivers/gpu/drm/panel/panel-novatek-nt36672a.c +7 -1
@@ -656,7 +656,13 @@ static int nt36672a_panel_probe(struct mipi_dsi_device *dsi)if (err <0 )return err; -return mipi_dsi_attach (dsi); + err =mipi_dsi_attach (dsi); +if (err <0 ) { +drm_panel_remove (&pinfo->base); +return err; + } + +return 0 ; }static int nt36672a_panel_remove (struct mipi_dsi_device *dsi)
drivers/gpu/drm/panel/panel-panasonic-vvx10f034n00.c +7 -1
@@ -241,7 +241,13 @@ static int wuxga_nt_panel_probe(struct mipi_dsi_device *dsi)if (ret <0 )return ret; -return mipi_dsi_attach (dsi); + ret =mipi_dsi_attach (dsi); +if (ret <0 ) { +wuxga_nt_panel_del (wuxga_nt); +return ret; + } + +return 0 ; }static int wuxga_nt_panel_remove (struct mipi_dsi_device *dsi)
drivers/gpu/drm/panel/panel-ronbo-rb070d30.c +7 -1
@@ -199,7 +199,13 @@ static int rb070d30_panel_dsi_probe(struct mipi_dsi_device *dsi) dsi->format =MIPI_DSI_FMT_RGB888 ; dsi->lanes =4 ; -return mipi_dsi_attach (dsi); + ret =mipi_dsi_attach (dsi); +if (ret <0 ) { +drm_panel_remove (&ctx->panel); +return ret; + } + +return 0 ; }static int rb070d30_panel_dsi_remove (struct mipi_dsi_device *dsi)
drivers/gpu/drm/panel/panel-samsung-s6e88a0-ams452ef01.c +1 -0
@@ -247,6 +247,7 @@ static int s6e88a0_ams452ef01_probe(struct mipi_dsi_device *dsi) ret =mipi_dsi_attach (dsi);if (ret <0 ) {dev_err (dev,"Failed to attach to DSI host: %d\n" , ret); +drm_panel_remove (&ctx->panel);return ret; }
drivers/gpu/drm/panel/panel-samsung-sofef00.c +1 -0
@@ -302,6 +302,7 @@ static int sofef00_panel_probe(struct mipi_dsi_device *dsi) ret =mipi_dsi_attach (dsi);if (ret <0 ) {dev_err (dev,"Failed to attach to DSI host: %d\n" , ret); +drm_panel_remove (&ctx->panel);return ret; }
drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c +7 -1
@@ -296,7 +296,13 @@ static int sharp_nt_panel_probe(struct mipi_dsi_device *dsi)if (ret <0 )return ret; -return mipi_dsi_attach (dsi); + ret =mipi_dsi_attach (dsi); +if (ret <0 ) { +sharp_nt_panel_del (sharp_nt); +return ret; + } + +return 0 ; }static int sharp_nt_panel_remove (struct mipi_dsi_device *dsi)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 462/846 Bluetooth: Fix removing adv when processing cmd complete
In reply to Greg Kroah-HartmanFrom: Archie Pusaka <[email protected]>
[ Upstream commit 2128939fe2e771645dd88e1938c27fdf96bd1cd0 ]
If we remove one instance of adv using Set Extended Adv Enable, there is a possibility of issue occurs when processing the Command Complete event. Especially, the adv_info might not be found since we already remove it in hci_req_clear_adv_instance() -> hci_remove_adv_instance(). If that's the case, we will mistakenly proceed to remove all adv instances instead of just one single instance.
This patch fixes the issue by checking the content of the HCI command instead of checking whether the adv_info is found.
--- net/bluetooth/hci_event.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/bluetooth/hci_event.c +4 -2
@@ -1325,8 +1325,10 @@ static void hci_cc_le_set_ext_adv_enable(struct hci_dev *hdev, &conn->le_conn_timeout, conn->conn_timeout); }else { -if (adv) { - adv->enabled = false; +if (cp->num_of_sets) { +if (adv) + adv->enabled = false; +/* If just one instance was disabled check if there are * any other instance enabled before clearing HCI_LE_ADV */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 463/846 fs: dlm: filter user dlm messages for kernel locks
In reply to Greg Kroah-HartmanFrom: Alexander Aring <[email protected]>
[ Upstream commit 6c2e3bf68f3e5e5a647aa52be246d5f552d7496d ]
This patch fixes the following crash by receiving a invalid message:
[ 160.672220] ================================================================== [ 160.676206] BUG: KASAN: user-memory-access in dlm_user_add_ast+0xc3/0x370 [ 160.679659] Read of size 8 at addr 00000000deadbeef by task kworker/u32:13/319 [ 160.681447] [ 160.681824] CPU: 10 PID: 319 Comm: kworker/u32:13 Not tainted 5.14.0-rc2+ #399 [ 160.683472] Hardware name: Red Hat KVM/RHEL-AV, BIOS 1.14.0-1.module+el8.6.0+12648+6ede71a5 04/01/2014 [ 160.685574] Workqueue: dlm_recv process_recv_sockets [ 160.686721] Call Trace: [ 160.687310] dump_stack_lvl+0x56/0x6f [ 160.688169] ? dlm_user_add_ast+0xc3/0x370 [ 160.689116] kasan_report.cold.14+0x116/0x11b [ 160.690138] ? dlm_user_add_ast+0xc3/0x370 [ 160.690832] dlm_user_add_ast+0xc3/0x370 [ 160.691502] _receive_unlock_reply+0x103/0x170 [ 160.692241] _receive_message+0x11df/0x1ec0 [ 160.692926] ? rcu_read_lock_sched_held+0xa1/0xd0 [ 160.693700] ? rcu_read_lock_bh_held+0xb0/0xb0 [ 160.694427] ? lock_acquire+0x175/0x400 [ 160.695058] ? do_purge.isra.51+0x200/0x200 [ 160.695744] ? lock_acquired+0x360/0x5d0 [ 160.696400] ? lock_contended+0x6a0/0x6a0 [ 160.697055] ? lock_release+0x21d/0x5e0 [ 160.697686] ? lock_is_held_type+0xe0/0x110 [ 160.698352] ? lock_is_held_type+0xe0/0x110 [ 160.699026] ? ___might_sleep+0x1cc/0x1e0 [ 160.699698] ? dlm_wait_requestqueue+0x94/0x140 [ 160.700451] ? dlm_process_requestqueue+0x240/0x240 [ 160.701249] ? down_write_killable+0x2b0/0x2b0 [ 160.701988] ? do_raw_spin_unlock+0xa2/0x130 [ 160.702690] dlm_receive_buffer+0x1a5/0x210 [ 160.703385] dlm_process_incoming_buffer+0x726/0x9f0 [ 160.704210] receive_from_sock+0x1c0/0x3b0 [ 160.704886] ? dlm_tcp_shutdown+0x30/0x30 [ 160.705561] ? lock_acquire+0x175/0x400 [ 160.706197] ? rcu_read_lock_sched_held+0xa1/0xd0 [ 160.706941] ? rcu_read_lock_bh_held+0xb0/0xb0 [ 160.707681] process_recv_sockets+0x32/0x40 [ 160.708366] process_one_work+0x55e/0xad0 [ 160.709045] ? pwq_dec_nr_in_flight+0x110/0x110 [ 160.709820] worker_thread+0x65/0x5e0 [ 160.710423] ? process_one_work+0xad0/0xad0 [ 160.711087] kthread+0x1ed/0x220 [ 160.711628] ? set_kthread_struct+0x80/0x80 [ 160.712314] ret_from_fork+0x22/0x30
The issue is that we received a DLM message for a user lock but the destination lock is a kernel lock. Note that the address which is trying to derefence is 00000000deadbeef, which is in a kernel lock lkb->lkb_astparam, this field should never be derefenced by the DLM kernel stack. In case of a user lock lkb->lkb_astparam is lkb->lkb_ua (memory is shared by a union field). The struct lkb_ua will be handled by the DLM kernel stack but on a kernel lock it will contain invalid data and ends in most likely crashing the kernel.
It can be reproduced with two cluster nodes.
node 2:dlm_tool join test
echo "862 fooobaar 1 2 1" > /sys/kernel/debug/dlm/test_locks echo "862 3 1" > /sys/kernel/debug/dlm/test_waiters
node 1:dlm_tool join test
python:
foo = DLM(h_cmd=3, o_nextcmd=1, h_nodeid=1, h_lockspace=0x77222027, \
m_type=7, m_flags=0x1, m_remid=0x862, m_result=0xFFFEFFFE)newFile = open("/sys/kernel/debug/dlm/comms/2/rawmsg", "wb") newFile.write(bytes(foo))
--- fs/dlm/lock.c | 9 +++++++++ 1 file changed, 9 insertions(+)
fs/dlm/lock.c +9 -0
@@ -3973,6 +3973,14 @@ static int validate_message(struct dlm_lkb *lkb, struct dlm_message *ms)int from = ms->m_header.h_nodeid;int error =0 ; +/* currently mixing of user/kernel locks are not supported */ +if (ms->m_flags &DLM_IFL_USER && ~lkb->lkb_flags &DLM_IFL_USER ) { +log_error (lkb->lkb_resource->res_ls, +"got user dlm message for a kernel lock" ); + error = -EINVAL ; + goto out; + } +switch (ms->m_type) {case DLM_MSG_CONVERT :case DLM_MSG_UNLOCK :
@@ -4001,6 +4009,7 @@ static int validate_message(struct dlm_lkb *lkb, struct dlm_message *ms) error = -EINVAL ; } +out:if (error) log_error(lkb->lkb_resource->res_ls, "ignore invalid message %d from %d %x %x %x %d",
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 464/846 libbpf: Validate that .BTF and .BTF.ext sections contain data
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 62554d52e71797eefa3fc15b54008038837bb2d4 ]
.BTF and .BTF.ext ELF sections should have SHT_PROGBITS type and contain data. If they are not, ELF is invalid or corrupted, so bail out. Otherwise this can lead to data->d_buf being NULL and SIGSEGV later on. Reported by oss-fuzz project.
--- tools/lib/bpf/libbpf.c | 4 ++++ 1 file changed, 4 insertions(+)
tools/lib/bpf/libbpf.c +4 -0
@@ -3035,8 +3035,12 @@ static int bpf_object__elf_collect(struct bpf_object *obj) }else if (strcmp (name,MAPS_ELF_SEC ) ==0 ) { obj->efile.btf_maps_shndx = idx; }else if (strcmp (name,BTF_ELF_SEC ) ==0 ) { +if (sh->sh_type !=SHT_PROGBITS ) +return -LIBBPF_ERRNO__FORMAT ; btf_data = data; }else if (strcmp (name,BTF_EXT_ELF_SEC ) ==0 ) { +if (sh->sh_type !=SHT_PROGBITS ) +return -LIBBPF_ERRNO__FORMAT ; btf_ext_data = data; }else if (sh.sh_type ==SHT_SYMTAB ) {/* already processed during the first pass above */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 465/846 drm/lima: fix warning when CONFIG_DEBUG_SG=y & CONFIG_DMA_API_DEBUG=y
In reply to Greg Kroah-HartmanFrom: Qiang Yu <[email protected]>
[ Upstream commit 89636a06fa2ee7826a19c39c19a9bc99ab9340a9 ]
Otherwise get following warning:
DMA-API: lima 1c40000.gpu: mapping sg segment longer than device claims to support [len=4149248] [max=65536]
See: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5496
--- drivers/gpu/drm/lima/lima_device.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/lima/lima_device.c +1 -0
@@ -357,6 +357,7 @@ int lima_device_init(struct lima_device *ldev)int err, i;dma_set_coherent_mask (ldev->dev,DMA_BIT_MASK (32 )); +dma_set_max_seg_size (ldev->dev,UINT_MAX ); err =lima_clk_init (ldev);if (err)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 466/846 selftests/bpf: Fix memory leaks in btf_type_c_dump() helper
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 8ba285874913da21ca39a46376e9cc5ce0f45f94 ]
Free up memory and resources used by temporary allocated memstream and btf_dump instance.
--- tools/testing/selftests/bpf/btf_helpers.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/btf_helpers.c +7 -2
@@ -246,18 +246,23 @@ const char *btf_type_c_dump(const struct btf *btf) d =btf_dump__new (btf,NULL , &opts, btf_dump_printf);if (libbpf_get_error (d)) {fprintf (stderr,"Failed to create btf_dump instance: %ld\n" ,libbpf_get_error (d)); -return NULL ; + goto err_out; }for (i =1 ; i <=btf__get_nr_types (btf); i++) { err =btf_dump__dump_type (d, i);if (err) {fprintf (stderr,"Failed to dump type [%d]: %d\n" , i, err); -return NULL ; + goto err_out; } } +btf_dump__free (d);fflush (buf_file);fclose (buf_file);return buf; +err_out: +btf_dump__free (d); +fclose (buf_file); +return NULL ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 467/846 selftests/bpf: Destroy XDP link correctly
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit f91231eeeed752119f49eb6620cae44ec745a007 ]
bpf_link__detach() was confused with bpf_link__destroy() and leaves leaked FD in the process. Fix the problem.
--- tools/testing/selftests/bpf/prog_tests/migrate_reuseport.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/prog_tests/migrate_reuseport.c +2 -2
@@ -204,8 +204,8 @@ static int pass_ack(struct migrate_reuseport_test_case *test_case) {int err; - err =bpf_link__detach (test_case->link); -if (!ASSERT_OK (err,"bpf_link__detach" )) + err =bpf_link__destroy (test_case->link); +if (!ASSERT_OK (err,"bpf_link__destroy" ))return -1 ; test_case->link =NULL ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 468/846 selftests/bpf: Fix bpf_object leak in skb_ctx selftest
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 8c7a95520184b6677ca6075e12df9c208d57d088 ]
skb_ctx selftest didn't close bpf_object implicitly allocated by bpf_prog_test_load() helper. Fix the problem by explicitly calling bpf_object__close() at the end of the test.
--- tools/testing/selftests/bpf/prog_tests/skb_ctx.c | 2 ++ 1 file changed, 2 insertions(+)
tools/testing/selftests/bpf/prog_tests/skb_ctx.c +2 -0
@@ -105,4 +105,6 @@ void test_skb_ctx(void)"ctx_out_mark" ,"skb->mark == %u, expected %d\n" , skb.mark, 10); + +bpf_object__close (obj); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 469/846 ar5523: Fix null-ptr-deref with unexpected WDCMSG_TARGET_START reply
In reply to Greg Kroah-HartmanFrom: Zekun Shen <[email protected]>
[ Upstream commit ae80b6033834342601e99f74f6a62ff5092b1cee ]
Unexpected WDCMSG_TARGET_START replay can lead to null-ptr-deref when ar->tx_cmd->odata is NULL. The patch adds a null check to prevent such case.
KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] ar5523_cmd+0x46a/0x581 [ar5523] ar5523_probe.cold+0x1b7/0x18da [ar5523] ? ar5523_cmd_rx_cb+0x7a0/0x7a0 [ar5523] ? __pm_runtime_set_status+0x54a/0x8f0 ? _raw_spin_trylock_bh+0x120/0x120 ? pm_runtime_barrier+0x220/0x220 ? __pm_runtime_resume+0xb1/0xf0 usb_probe_interface+0x25b/0x710 really_probe+0x209/0x5d0 driver_probe_device+0xc6/0x1b0 device_driver_attach+0xe2/0x120
I found the bug using a custome USBFuzz port. It's a research work to fuzz USB stack/drivers. I modified it to fuzz ath9k driver only, providing hand-crafted usb descriptors to QEMU.
After fixing the code (fourth byte in usb packet) to WDCMSG_TARGET_START, I got the null-ptr-deref bug. I believe the bug is triggerable whenever cmd->odata is NULL. After patching, I tested with the same input and no longer see the KASAN report.
This was NOT tested on a real device.
--- drivers/net/wireless/ath/ar5523/ar5523.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/ath/ar5523/ar5523.c +4 -0
@@ -153,6 +153,10 @@ static void ar5523_cmd_rx_cb(struct urb *urb)ar5523_err (ar,"Invalid reply to WDCMSG_TARGET_START" );return ; } +if (!cmd->odata) { +ar5523_err (ar,"Unexpected WDCMSG_TARGET_START reply" ); +return ; + }memcpy (cmd->odata, hdr +1 ,sizeof (u32)); cmd->olen =sizeof (u32); cmd->res =0 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 470/846 drm/bridge: dw-hdmi: handle ELD when DRM_BRIDGE_ATTACH_NO_CONNECTOR
In reply to Greg Kroah-HartmanFrom: Neil Armstrong <[email protected]>
[ Upstream commit 3f2532d65a571ca02258b547b5b68ab2e9406fdb ]
The current ELD handling takes the internal connector ELD buffer and shares it to the I2S and AHB sub-driver.
But with DRM_BRIDGE_ATTACH_NO_CONNECTOR, the connector is created elsewhere (or not), and an eventual connector is known only if the bridge chain up to a connector is enabled.
The current dw-hdmi code gets the current connector from atomic_enable() so use the already stored connector pointer and replace the buffer pointer with a callback returning the current connector ELD buffer.
Since a connector is not always available, either pass an empty ELD to the alsa HDMI driver or don't call snd_pcm_hw_constraint_eld() in AHB driver.
--- drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c | 10 +++++++--- drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h | 4 ++-- drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 9 ++++++++- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 12 ++++++++++-- 4 files changed, 27 insertions(+), 8 deletions(-)
drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c +7 -3
@@ -320,13 +320,17 @@ static int dw_hdmi_open(struct snd_pcm_substream *substream)struct snd_pcm_runtime *runtime = substream->runtime;struct snd_dw_hdmi *dw = substream->private_data;void __iomem *base = dw->data.base; +u8 *eld;int ret; runtime->hw = dw_hdmi_hw; - ret =snd_pcm_hw_constraint_eld (runtime, dw->data.eld); -if (ret <0 ) -return ret; + eld = dw->data.get_eld (dw->data.hdmi); +if (eld) { + ret =snd_pcm_hw_constraint_eld (runtime, eld); +if (ret <0 ) +return ret; + } ret =snd_pcm_limit_hw_rates (runtime);if (ret <0 )
drivers/gpu/drm/bridge/synopsys/dw-hdmi-audio.h +2 -2
@@ -9,15 +9,15 @@ struct dw_hdmi_audio_data {void __iomem *base;int irq;struct dw_hdmi *hdmi; - u8 *eld; + u8 *(*get_eld)(struct dw_hdmi *hdmi); };struct dw_hdmi_i2s_audio_data {struct dw_hdmi *hdmi; -u8 *eld;void (*write)(struct dw_hdmi *hdmi,u8 val,int offset);u8 (*read)(struct dw_hdmi *hdmi,int offset); +u8 *(*get_eld)(struct dw_hdmi *hdmi); };#endif
drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +8 -1
@@ -135,8 +135,15 @@ static int dw_hdmi_i2s_get_eld(struct device *dev, void *data, uint8_t *buf, size_t len) {struct dw_hdmi_i2s_audio_data *audio = data; +u8 *eld; + + eld = audio->get_eld (audio->hdmi); +if (eld) +memcpy (buf, eld,min_t (size_t,MAX_ELD_BYTES , len)); +else +/* Pass en empty ELD if connector not available */ +memset (buf,0 , len); -memcpy (buf, audio->eld,min_t (size_t,MAX_ELD_BYTES , len));return 0 ; }
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +10 -2
@@ -757,6 +757,14 @@ static void hdmi_enable_audio_clk(struct dw_hdmi *hdmi, bool enable)hdmi_writeb (hdmi, hdmi->mc_clkdis,HDMI_MC_CLKDIS ); } +static u8 *hdmi_audio_get_eld (struct dw_hdmi *hdmi) +{ +if (!hdmi->curr_conn) +return NULL ; + +return hdmi->curr_conn->eld; +} +static void dw_hdmi_ahb_audio_enable (struct dw_hdmi *hdmi) {hdmi_set_cts_n (hdmi, hdmi->audio_cts, hdmi->audio_n);
@@ -3431,7 +3439,7 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev, audio.base = hdmi->regs; audio.irq = irq; audio.hdmi = hdmi; - audio.eld = hdmi->connector.eld; + audio.get_eld = hdmi_audio_get_eld; hdmi->enable_audio = dw_hdmi_ahb_audio_enable; hdmi->disable_audio = dw_hdmi_ahb_audio_disable;
@@ -3444,7 +3452,7 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev,struct dw_hdmi_i2s_audio_data audio; audio.hdmi = hdmi; - audio.eld = hdmi->connector.eld; + audio.get_eld = hdmi_audio_get_eld; audio.write = hdmi_writeb; audio.read = hdmi_readb; hdmi->enable_audio = dw_hdmi_i2s_audio_enable;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 471/846 drm/nouveau/pmu/gm200-: avoid touching PMU outside of DEVINIT/PREOS/ACR
In reply to Greg Kroah-HartmanFrom: Ben Skeggs <[email protected]>
[ Upstream commit 1d2271d2fb85e54bfc9630a6c30ac0feb9ffb983 ]
There have been reports of the WFI timing out on some boards, and a patch was proposed to just remove it. This stuff is rather fragile, and I believe the WFI might be needed with our FW prior to GM200.
However, we probably should not be touching PMU during init on GPUs where we depend on NVIDIA FW, outside of limited circumstances, so this should be a somewhat safer change that achieves the desired result.
--- .../gpu/drm/nouveau/nvkm/subdev/pmu/base.c | 37 +++++++++++-------- 1 file changed, 21 insertions(+), 16 deletions(-)
drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c +21 -16
@@ -94,20 +94,13 @@ nvkm_pmu_fini(struct nvkm_subdev *subdev, bool suspend)return 0 ; } -static int +static void nvkm_pmu_reset (struct nvkm_pmu *pmu) {struct nvkm_device *device = pmu->subdev.device;if (!pmu->func->enabled (pmu)) -return 0 ; - -/* Inhibit interrupts, and wait for idle. */ -nvkm_wr32 (device,0x10a014 ,0x0000ffff ); -nvkm_msec (device,2000 , - if (!nvkm_rd32(device, 0x10a04c)) - break; - ); +return ;/* Reset. */ if (pmu->func->reset)
@@ -118,25 +111,37 @@ nvkm_pmu_reset(struct nvkm_pmu *pmu)if (!(nvkm_rd32 (device,0x10a10c ) &0x00000006 ))break ; ); - -return 0 ; }static int nvkm_pmu_preinit (struct nvkm_subdev *subdev) {struct nvkm_pmu *pmu =nvkm_pmu (subdev); -return nvkm_pmu_reset (pmu); +nvkm_pmu_reset (pmu); +return 0 ; }static int nvkm_pmu_init (struct nvkm_subdev *subdev) {struct nvkm_pmu *pmu =nvkm_pmu (subdev); -int ret =nvkm_pmu_reset (pmu); -if (ret ==0 && pmu->func->init) - ret = pmu->func->init (pmu); -return ret; +struct nvkm_device *device = pmu->subdev.device; + +if (!pmu->func->init) +return 0 ; + +if (pmu->func->enabled (pmu)) { +/* Inhibit interrupts, and wait for idle. */ +nvkm_wr32 (device,0x10a014 ,0x0000ffff ); +nvkm_msec (device,2000 , + if (!nvkm_rd32(device, 0x10a04c)) + break; + ); + +nvkm_pmu_reset (pmu); + } + +return pmu->func->init (pmu); } static void *
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 472/846 media: atomisp: fix try_fmt logic
In reply to Greg Kroah-HartmanFrom: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit c9e9094c4e42124af909b2f5f6ded0498e0854ac ]
The internal try_fmt logic is not meant to provide everything that the V4L2 API should provide. Also, it doesn't decrement the pads that are used only internally by the driver, but aren't part of the device's output.
Fix it.
--- .../staging/media/atomisp/pci/atomisp_ioctl.c | 72 ++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-)
drivers/staging/media/atomisp/pci/atomisp_ioctl.c +71 -1
@@ -863,6 +863,72 @@ static int atomisp_g_fmt_file(struct file *file, void *fh,return 0 ; } +static int atomisp_adjust_fmt (struct v4l2_format *f) +{ +const struct atomisp_format_bridge *format_bridge; +u32 padded_width; + + format_bridge =atomisp_get_format_bridge (f->fmt.pix.pixelformat); + + padded_width = f->fmt.pix.width + pad_w; + +if (format_bridge->planar) { + f->fmt.pix.bytesperline = padded_width; + f->fmt.pix.sizeimage =PAGE_ALIGN (f->fmt.pix.height * +DIV_ROUND_UP (format_bridge->depth * + padded_width,8 )); + }else { + f->fmt.pix.bytesperline =DIV_ROUND_UP (format_bridge->depth * + padded_width,8 ); + f->fmt.pix.sizeimage =PAGE_ALIGN (f->fmt.pix.height * f->fmt.pix.bytesperline); + } + +if (f->fmt.pix.field ==V4L2_FIELD_ANY ) + f->fmt.pix.field =V4L2_FIELD_NONE ; + + format_bridge =atomisp_get_format_bridge (f->fmt.pix.pixelformat); +if (!format_bridge) +return -EINVAL ; + +/* Currently, raw formats are broken!!! */ +if (format_bridge->sh_fmt ==IA_CSS_FRAME_FORMAT_RAW ) { + f->fmt.pix.pixelformat =V4L2_PIX_FMT_YUV420 ; + + format_bridge =atomisp_get_format_bridge (f->fmt.pix.pixelformat); +if (!format_bridge) +return -EINVAL ; + } + + padded_width = f->fmt.pix.width + pad_w; + +if (format_bridge->planar) { + f->fmt.pix.bytesperline = padded_width; + f->fmt.pix.sizeimage =PAGE_ALIGN (f->fmt.pix.height * +DIV_ROUND_UP (format_bridge->depth * + padded_width,8 )); + }else { + f->fmt.pix.bytesperline =DIV_ROUND_UP (format_bridge->depth * + padded_width,8 ); + f->fmt.pix.sizeimage =PAGE_ALIGN (f->fmt.pix.height * f->fmt.pix.bytesperline); + } + +if (f->fmt.pix.field ==V4L2_FIELD_ANY ) + f->fmt.pix.field =V4L2_FIELD_NONE ; + +/* +* FIXME: do we need to setup this differently, depending on the +* sensor or the pipeline? +*/ + f->fmt.pix.colorspace =V4L2_COLORSPACE_REC709 ; + f->fmt.pix.ycbcr_enc =V4L2_YCBCR_ENC_709 ; + f->fmt.pix.xfer_func =V4L2_XFER_FUNC_709 ; + + f->fmt.pix.width -= pad_w; + f->fmt.pix.height -= pad_h; + +return 0 ; +} +/* This function looks up the closest available resolution. */ static int atomisp_try_fmt_cap (struct file *file,void *fh,struct v4l2_format *f)
@@ -874,7 +940,11 @@ static int atomisp_try_fmt_cap(struct file *file, void *fh,rt_mutex_lock (&isp->mutex); ret =atomisp_try_fmt (vdev, &f->fmt.pix,NULL );rt_mutex_unlock (&isp->mutex); -return ret; + +if (ret) +return ret; + +return atomisp_adjust_fmt (f); } static int atomisp_s_fmt_cap(struct file *file, void *fh,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 473/846 media: atomisp: set per-devices default mode
In reply to Greg Kroah-HartmanFrom: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit 2c45e343c581091835c9047ed5298518aa133163 ]
The atomisp driver originally used the s_parm command to initialize the run_mode type to the driver. So, before start setting up the streaming, s_parm should be called.
So, even having 5 "normal" video devices, one meant to be used for each type, the run_mode was actually selected when s_parm is called.
Without setting the run mode, applications that don't call VIDIOC_SET_PARM with a custom atomisp parameters won't work, as the pipeline won't be set:
atomisp-isp2 0000:00:03.0: can't create streams atomisp-isp2 0000:00:03.0: __get_frame_info 1600x1200 (padded to 0) returned -22
However, commit 8a7c5594c020 ("media: v4l2-ioctl: clear fields in s_parm") broke support for it, with a good reason, as drivers shoudn't be extending the API for their own purposes.
So, as an step to allow generic apps to use this driver, put the device's run_mode in preview after open.
After this patch, using v4l2grab starts to work on preview mode (/dev/video2):
$ v4l2grab -f YUYV -x 1600 -y 1200 -d /dev/video2 -n 1 -u $ feh out000.pnm
So, let's just setup the default run_mode that each video devnode should assume, setting it at open() time.
--- drivers/staging/media/atomisp/pci/atomisp_fops.c | 5 +++++ .../staging/media/atomisp/pci/atomisp_subdev.c | 15 ++++++++++----- .../staging/media/atomisp/pci/atomisp_subdev.h | 3 +++ drivers/staging/media/atomisp/pci/atomisp_v4l2.c | 4 +++- drivers/staging/media/atomisp/pci/atomisp_v4l2.h | 3 ++- 5 files changed, 23 insertions(+), 7 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_fops.c +5 -0
@@ -877,6 +877,11 @@ done:else pipe->users++;rt_mutex_unlock (&isp->mutex); + +/* Ensure that a mode is set */ +if (asd) +v4l2_ctrl_s_ctrl (asd->run_mode, pipe->default_run_mode); +return 0 ; css_error:
drivers/staging/media/atomisp/pci/atomisp_subdev.c +10 -5
@@ -1164,23 +1164,28 @@ static int isp_subdev_init_entities(struct atomisp_sub_device *asd)atomisp_init_acc_pipe (asd, &asd->video_acc); - ret =atomisp_video_init (&asd->video_in,"MEMORY" ); + ret =atomisp_video_init (&asd->video_in,"MEMORY" , +ATOMISP_RUN_MODE_SDV );if (ret <0 )return ret; - ret =atomisp_video_init (&asd->video_out_capture,"CAPTURE" ); + ret =atomisp_video_init (&asd->video_out_capture,"CAPTURE" , +ATOMISP_RUN_MODE_STILL_CAPTURE );if (ret <0 )return ret; - ret =atomisp_video_init (&asd->video_out_vf,"VIEWFINDER" ); + ret =atomisp_video_init (&asd->video_out_vf,"VIEWFINDER" , +ATOMISP_RUN_MODE_CONTINUOUS_CAPTURE );if (ret <0 )return ret; - ret =atomisp_video_init (&asd->video_out_preview,"PREVIEW" ); + ret =atomisp_video_init (&asd->video_out_preview,"PREVIEW" , +ATOMISP_RUN_MODE_PREVIEW );if (ret <0 )return ret; - ret =atomisp_video_init (&asd->video_out_video_capture,"VIDEO" ); + ret =atomisp_video_init (&asd->video_out_video_capture,"VIDEO" , +ATOMISP_RUN_MODE_VIDEO );if (ret <0 )return ret;
drivers/staging/media/atomisp/pci/atomisp_subdev.h +3 -0
@@ -81,6 +81,9 @@ struct atomisp_video_pipe {/* the link list to store per_frame parameters */ struct list_head per_frame_params; +/* Store here the initial run mode */ +unsigned int default_run_mode; +unsigned int buffers_in_css;/* irq_lock is used to protect video buffer state change operations and
drivers/staging/media/atomisp/pci/atomisp_v4l2.c +3 -1
@@ -447,7 +447,8 @@ const struct atomisp_dfs_config dfs_config_cht_soc = { .dfs_table_size = ARRAY_SIZE(dfs_rules_cht_soc), }; -int atomisp_video_init (struct atomisp_video_pipe *video,const char *name) +int atomisp_video_init (struct atomisp_video_pipe *video,const char *name, +unsigned int run_mode) {int ret;const char *direction;
@@ -478,6 +479,7 @@ int atomisp_video_init(struct atomisp_video_pipe *video, const char *name) "ATOMISP ISP %s %s", name, direction); video->vdev.release = video_device_release_empty;video_set_drvdata (&video->vdev, video->isp); + video->default_run_mode = run_mode;return 0 ; }
drivers/staging/media/atomisp/pci/atomisp_v4l2.h +2 -1
@@ -27,7 +27,8 @@ struct v4l2_device;struct atomisp_device ;struct firmware ; -int atomisp_video_init (struct atomisp_video_pipe *video,const char *name); +int atomisp_video_init (struct atomisp_video_pipe *video,const char *name, +unsigned int run_mode);void atomisp_acc_init (struct atomisp_acc_pipe *video,const char *name);void atomisp_video_unregister (struct atomisp_video_pipe *video);void atomisp_acc_unregister (struct atomisp_acc_pipe *video);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 474/846 media: atomisp-ov2680: Fix ov2680_set_fmt() clobbering the exposure
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 4492289c31364d28c2680b43b18883385a5d216c ]
Now that we restore the default or last user set exposure setting on power_up() there is no need for the registers written by ov2680_set_fmt() to write to the exposure register.
Not doing so fixes the exposure always being reset to the value from the res->regs array after a set_fmt().
--- drivers/staging/media/atomisp/i2c/ov2680.h | 24 ---------------------- 1 file changed, 24 deletions(-)
drivers/staging/media/atomisp/i2c/ov2680.h +0 -24
@@ -289,8 +289,6 @@ static struct ov2680_reg const ov2680_global_setting[] = {*/ static struct ov2680_reg const ov2680_QCIF_30fps[] = { {0x3086 ,0x01 }, - {0x3501 ,0x24 }, - {0x3502 ,0x40 }, {0x370a ,0x23 }, {0x3801 ,0xa0 }, {0x3802 ,0x00 },
@@ -334,8 +332,6 @@ static struct ov2680_reg const ov2680_QCIF_30fps[] = {*/ static struct ov2680_reg const ov2680_CIF_30fps[] = { {0x3086 ,0x01 }, - {0x3501 ,0x24 }, - {0x3502 ,0x40 }, {0x370a ,0x23 }, {0x3801 ,0xa0 }, {0x3802 ,0x00 },
@@ -377,8 +373,6 @@ static struct ov2680_reg const ov2680_CIF_30fps[] = {*/ static struct ov2680_reg const ov2680_QVGA_30fps[] = { {0x3086 ,0x01 }, - {0x3501 ,0x24 }, - {0x3502 ,0x40 }, {0x370a ,0x23 }, {0x3801 ,0xa0 }, {0x3802 ,0x00 },
@@ -420,8 +414,6 @@ static struct ov2680_reg const ov2680_QVGA_30fps[] = {*/ static struct ov2680_reg const ov2680_656x496_30fps[] = { {0x3086 ,0x01 }, - {0x3501 ,0x24 }, - {0x3502 ,0x40 }, {0x370a ,0x23 }, {0x3801 ,0xa0 }, {0x3802 ,0x00 },
@@ -463,8 +455,6 @@ static struct ov2680_reg const ov2680_656x496_30fps[] = {*/ static struct ov2680_reg const ov2680_720x592_30fps[] = { {0x3086 ,0x01 }, - {0x3501 ,0x26 }, - {0x3502 ,0x40 }, {0x370a ,0x23 }, {0x3801 ,0x00 },// X_ADDR_START; {0x3802 ,0x00 },
@@ -508,8 +498,6 @@ static struct ov2680_reg const ov2680_720x592_30fps[] = {*/ static struct ov2680_reg const ov2680_800x600_30fps[] = { {0x3086 ,0x01 }, - {0x3501 ,0x26 }, - {0x3502 ,0x40 }, {0x370a ,0x23 }, {0x3801 ,0x00 }, {0x3802 ,0x00 },
@@ -551,8 +539,6 @@ static struct ov2680_reg const ov2680_800x600_30fps[] = {*/ static struct ov2680_reg const ov2680_720p_30fps[] = { {0x3086 ,0x00 }, - {0x3501 ,0x48 }, - {0x3502 ,0xe0 }, {0x370a ,0x21 }, {0x3801 ,0xa0 }, {0x3802 ,0x00 },
@@ -594,8 +580,6 @@ static struct ov2680_reg const ov2680_720p_30fps[] = {*/ static struct ov2680_reg const ov2680_1296x976_30fps[] = { {0x3086 ,0x00 }, - {0x3501 ,0x48 }, - {0x3502 ,0xe0 }, {0x370a ,0x21 }, {0x3801 ,0xa0 }, {0x3802 ,0x00 },
@@ -637,8 +621,6 @@ static struct ov2680_reg const ov2680_1296x976_30fps[] = {*/ static struct ov2680_reg const ov2680_1456x1096_30fps[] = { {0x3086 ,0x00 }, - {0x3501 ,0x48 }, - {0x3502 ,0xe0 }, {0x370a ,0x21 }, {0x3801 ,0x90 }, {0x3802 ,0x00 },
@@ -682,8 +664,6 @@ static struct ov2680_reg const ov2680_1456x1096_30fps[] = {static struct ov2680_reg const ov2680_1616x916_30fps[] = { {0x3086 ,0x00 }, - {0x3501 ,0x48 }, - {0x3502 ,0xe0 }, {0x370a ,0x21 }, {0x3801 ,0x00 }, {0x3802 ,0x00 },
@@ -726,8 +706,6 @@ static struct ov2680_reg const ov2680_1616x916_30fps[] = {#if 0 static struct ov2680_reg const ov2680_1616x1082_30fps[] = { {0x3086 ,0x00 }, - {0x3501 ,0x48 }, - {0x3502 ,0xe0 }, {0x370a ,0x21 }, {0x3801 ,0x00 }, {0x3802, 0x00},
@@ -769,8 +747,6 @@ static struct ov2680_reg const ov2680_1616x1082_30fps[] = {*/ static struct ov2680_reg const ov2680_1616x1216_30fps[] = { {0x3086 ,0x00 }, - {0x3501 ,0x48 }, - {0x3502 ,0xe0 }, {0x370a ,0x21 }, {0x3801 ,0x00 }, {0x3802 ,0x00 },
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 475/846 media: atomisp: check before deference asd variable
In reply to Greg Kroah-HartmanFrom: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit 71665d816214124d6bc4eb80314ac8f84ecacd78 ]
The asd->isp was referenced before checking if asd is not NULL.
This fixes this warning:
../drivers/staging/media/atomisp/pci/atomisp_cmd.c:5548 atomisp_set_fmt_to_snr() warn: variable dereferenced before check 'asd' (see line 5540)
While here, avoid getting the pipe pointer twice.
--- drivers/staging/media/atomisp/pci/atomisp_cmd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_cmd.c +4 -2
@@ -5529,8 +5529,8 @@ static int atomisp_set_fmt_to_snr(struct video_device *vdev, unsigned int padding_w, unsigned int padding_h, unsigned int dvs_env_w, unsigned int dvs_env_h) { - struct atomisp_sub_device *asd = atomisp_to_video_pipe(vdev)->asd; struct atomisp_video_pipe *pipe = atomisp_to_video_pipe(vdev); +struct atomisp_sub_device *asd = pipe->asd;const struct atomisp_format_bridge *format;struct v4l2_subdev_pad_config pad_cfg; struct v4l2_subdev_state pad_state = {
@@ -5541,7 +5541,7 @@ static int atomisp_set_fmt_to_snr(struct video_device *vdev, };struct v4l2_mbus_framefmt *ffmt = &vformat.format;struct v4l2_mbus_framefmt *req_ffmt; -struct atomisp_device *isp = asd->isp; +struct atomisp_device *isp;struct atomisp_input_stream_info *stream_info = (struct atomisp_input_stream_info *)ffmt->reserved;u16 stream_index =ATOMISP_INPUT_STREAM_GENERAL ;
@@ -5555,6 +5555,8 @@ static int atomisp_set_fmt_to_snr(struct video_device *vdev,return -EINVAL ; } + isp = asd->isp; +v4l2_fh_init (&fh.vfh, vdev); stream_index =atomisp_source_pad_to_stream_id (asd, source_pad);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 476/846 ARM: shmobile: rcar-gen2: Add missing of_node_put()
In reply to Greg Kroah-HartmanFrom: Wan Jiabing <[email protected]>
[ Upstream commit 85744f2d938c5f3cfc44cb6533c157469634da93 ]
Fix following coccicheck warning:
./arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c:156:1-33: Function for_each_matching_node_and_match should have of_node_put() before break and goto.
Early exits from for_each_matching_node_and_match() should decrement the node reference counter.
--- arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c +4 -1
@@ -154,8 +154,10 @@ static int __init rcar_gen2_regulator_quirk(void)return -ENODEV ;for_each_matching_node_and_match (np, rcar_gen2_quirk_match, &id) { -if (!of_device_is_available (np)) +if (!of_device_is_available (np)) { +of_node_put (np);break ; + } ret =of_property_read_u32 (np,"reg" , &addr);if (ret)/* Skip invalid entry and continue */
@@ -164,6 +166,7 @@ static int __init rcar_gen2_regulator_quirk(void) quirk =kzalloc (sizeof (*quirk),GFP_KERNEL );if (!quirk) { ret = -ENOMEM ; +of_node_put (np); goto err_mem; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 477/846 batman-adv: allow netlink usage in unprivileged containers
In reply to Greg Kroah-HartmanFrom: Linus Lüssing <[email protected]>
[ Upstream commit 9057d6c23e7388ee9d037fccc9a7bc8557ce277b ]
Currently, creating a batman-adv interface in an unprivileged LXD container and attaching secondary interfaces to it with "ip" or "batctl" works fine. However all batctl debug and configuration commands fail:
root@container:~# batctl originators Error received: Operation not permitted root@container:~# batctl orig_interval 1000 root@container:~# batctl orig_interval 2000 root@container:~# batctl orig_interval 1000
To fix this change the generic netlink permissions from GENL_ADMIN_PERM to GENL_UNS_ADMIN_PERM. This way a batman-adv interface is fully maintainable as root from within a user namespace, from an unprivileged container.
All except one batman-adv netlink setting are per interface and do not leak information or change settings from the host system and are therefore save to retrieve or modify as root from within an unprivileged container.
"batctl routing_algo" / BATADV_CMD_GET_ROUTING_ALGOS is the only
exception: It provides the batman-adv kernel module wide default routing algorithm. However it is read-only from netlink and an unprivileged container is still not allowed to modify /sys/module/batman_adv/parameters/routing_algo. Instead it is advised to use the newly introduced "batctl if create routing_algo RA_NAME" / IFLA_BATADV_ALGO_NAME to set the routing algorithm on interface creation, which already works fine in an unprivileged container.
--- net/batman-adv/netlink.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
net/batman-adv/netlink.c +15 -15
@@ -1368,21 +1368,21 @@ static const struct genl_small_ops batadv_netlink_ops[] = { { .cmd = BATADV_CMD_TP_METER, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags = GENL_ADMIN_PERM, + .flags = GENL_UNS_ADMIN_PERM, .doit = batadv_netlink_tp_meter_start, .internal_flags = BATADV_FLAG_NEED_MESH, }, { .cmd = BATADV_CMD_TP_METER_CANCEL, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags = GENL_ADMIN_PERM, + .flags = GENL_UNS_ADMIN_PERM, .doit = batadv_netlink_tp_meter_cancel, .internal_flags = BATADV_FLAG_NEED_MESH, }, { .cmd = BATADV_CMD_GET_ROUTING_ALGOS, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags = GENL_ADMIN_PERM, + .flags = GENL_UNS_ADMIN_PERM, .dumpit = batadv_algo_dump, }, {
@@ -1397,68 +1397,68 @@ static const struct genl_small_ops batadv_netlink_ops[] = { { .cmd = BATADV_CMD_GET_TRANSTABLE_LOCAL, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags = GENL_ADMIN_PERM, + .flags = GENL_UNS_ADMIN_PERM, .dumpit = batadv_tt_local_dump, }, { .cmd = BATADV_CMD_GET_TRANSTABLE_GLOBAL, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags = GENL_ADMIN_PERM, + .flags = GENL_UNS_ADMIN_PERM, .dumpit = batadv_tt_global_dump, }, { .cmd = BATADV_CMD_GET_ORIGINATORS, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags = GENL_ADMIN_PERM, + .flags = GENL_UNS_ADMIN_PERM, .dumpit = batadv_orig_dump, }, { .cmd = BATADV_CMD_GET_NEIGHBORS, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags = GENL_ADMIN_PERM, + .flags = GENL_UNS_ADMIN_PERM, .dumpit = batadv_hardif_neigh_dump, }, { .cmd = BATADV_CMD_GET_GATEWAYS, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags = GENL_ADMIN_PERM, + .flags = GENL_UNS_ADMIN_PERM, .dumpit = batadv_gw_dump, }, { .cmd = BATADV_CMD_GET_BLA_CLAIM, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags = GENL_ADMIN_PERM, + .flags = GENL_UNS_ADMIN_PERM, .dumpit = batadv_bla_claim_dump, }, { .cmd = BATADV_CMD_GET_BLA_BACKBONE, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags = GENL_ADMIN_PERM, + .flags = GENL_UNS_ADMIN_PERM, .dumpit = batadv_bla_backbone_dump, }, { .cmd = BATADV_CMD_GET_DAT_CACHE, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags = GENL_ADMIN_PERM, + .flags = GENL_UNS_ADMIN_PERM, .dumpit = batadv_dat_cache_dump, }, { .cmd = BATADV_CMD_GET_MCAST_FLAGS, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags = GENL_ADMIN_PERM, + .flags = GENL_UNS_ADMIN_PERM, .dumpit = batadv_mcast_flags_dump, }, { .cmd = BATADV_CMD_SET_MESH, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags = GENL_ADMIN_PERM, + .flags = GENL_UNS_ADMIN_PERM, .doit = batadv_netlink_set_mesh, .internal_flags = BATADV_FLAG_NEED_MESH, }, { .cmd = BATADV_CMD_SET_HARDIF, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags = GENL_ADMIN_PERM, + .flags = GENL_UNS_ADMIN_PERM, .doit = batadv_netlink_set_hardif, .internal_flags = BATADV_FLAG_NEED_MESH | BATADV_FLAG_NEED_HARDIF,
@@ -1474,7 +1474,7 @@ static const struct genl_small_ops batadv_netlink_ops[] = { { .cmd = BATADV_CMD_SET_VLAN, .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, - .flags = GENL_ADMIN_PERM, + .flags = GENL_UNS_ADMIN_PERM, .doit = batadv_netlink_set_vlan, .internal_flags =BATADV_FLAG_NEED_MESH | BATADV_FLAG_NEED_VLAN,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 478/846 media: atomisp: handle errors at sh_css_create_isp_params()
In reply to Greg Kroah-HartmanFrom: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit 58043dbf6d1ae9deab4f5aa1e039c70112017682 ]
The succ var tracks memory allocation erros on this function.
Fix it, in order to stop this W=1 Werror in clang:
drivers/staging/media/atomisp/pci/sh_css_params.c:2430:7: error: variable 'succ' set but not used [-Werror,-Wunused-but-set-variable]
bool succ = true;
^--- drivers/staging/media/atomisp/pci/sh_css_params.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/staging/media/atomisp/pci/sh_css_params.c +6 -2
@@ -2431,7 +2431,7 @@ sh_css_create_isp_params(struct ia_css_stream *stream,unsigned int i;struct sh_css_ddr_address_map *ddr_ptrs;struct sh_css_ddr_address_map_size *ddr_ptrs_size; -int err =0 ; +int err;size_t params_size;struct ia_css_isp_parameters *params =kvmalloc (sizeof (struct ia_css_isp_parameters ),GFP_KERNEL );
@@ -2473,7 +2473,11 @@ sh_css_create_isp_params(struct ia_css_stream *stream, succ &= (ddr_ptrs->macc_tbl != mmgr_NULL); *isp_params_out = params; -return err; + +if (!succ) +return -ENOMEM ; + +return 0 ; } static bool
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 479/846 ath11k: Fix crash caused by uninitialized TX ring
In reply to Greg Kroah-HartmanFrom: Baochen Qiang <[email protected]>
[ Upstream commit 273703ebdb01b6c5f1aaf4b98fb57b177609055c ]
Commit 31582373a4a8 ("ath11k: Change number of TCL rings to one for QCA6390") avoids initializing the other entries of dp->tx_ring cause the corresponding TX rings on QCA6390/WCN6855 are not used, but leaves those ring masks in ath11k_hw_ring_mask_qca6390.tx unchanged. Normally this is OK because we will only get interrupts from the first TX ring on these chips and thus only the first entry of dp->tx_ring is involved.
In case of one MSI vector, all DP rings share the same IRQ. For each interrupt, all rings have to be checked, which means the other entries of dp->tx_ring are involved. However since they are not initialized, system crashes.
Fix this issue by simply removing those ring masks.
crash stack:
[ 102.907438] BUG: kernel NULL pointer dereference, address: 0000000000000028 [ 102.907447] #PF: supervisor read access in kernel mode [ 102.907451] #PF: error_code(0x0000) - not-present page [ 102.907453] PGD 1081f0067 P4D 1081f0067 PUD 1081f1067 PMD 0 [ 102.907460] Oops: 0000 [#1] SMP DEBUG_PAGEALLOC NOPTI [ 102.907465] CPU: 0 PID: 3511 Comm: apt-check Kdump: loaded Tainted: G E 5.15.0-rc4-wt-ath+ #20 [ 102.907470] Hardware name: AMD Celadon-RN/Celadon-RN, BIOS RCD1005E 10/08/2020 [ 102.907472] RIP: 0010:ath11k_dp_tx_completion_handler+0x201/0x830 [ath11k] [ 102.907497] Code: 3c 24 4e 8d ac 37 10 04 00 00 4a 8d bc 37 68 04 00 00 48 89 3c 24 48 63 c8 89 83 84 18 00 00 48 c1 e1 05 48 03 8b 78 18 00 00 <8b> 51 08 89 d6 83 e6 07 89 74 24 24 83 fe 03 74 04 85 f6 75 63 41 [ 102.907501] RSP: 0000:ffff9b7340003e08 EFLAGS: 00010202 [ 102.907505] RAX: 0000000000000001 RBX: ffff8e21530c0100 RCX: 0000000000000020 [ 102.907508] RDX: 0000000000000000 RSI: 00000000fffffe00 RDI: ffff8e21530c1938 [ 102.907511] RBP: ffff8e21530c0000 R08: 0000000000000001 R09: 0000000000000000 [ 102.907513] R10: ffff8e2145534c10 R11: 0000000000000001 R12: ffff8e21530c2938 [ 102.907515] R13: ffff8e21530c18e0 R14: 0000000000000100 R15: ffff8e21530c2978 [ 102.907518] FS: 00007f5d4297e740(0000) GS:ffff8e243d600000(0000) knlGS:0000000000000000 [ 102.907521] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 102.907524] CR2: 0000000000000028 CR3: 00000001034ea000 CR4: 0000000000350ef0 [ 102.907527] Call Trace: [ 102.907531] <IRQ> [ 102.907537] ath11k_dp_service_srng+0x5c/0x2f0 [ath11k] [ 102.907556] ath11k_pci_ext_grp_napi_poll+0x21/0x70 [ath11k_pci] [ 102.907562] __napi_poll+0x2c/0x160 [ 102.907570] net_rx_action+0x251/0x310 [ 102.907576] __do_softirq+0x107/0x2fc [ 102.907585] irq_exit_rcu+0x74/0x90 [ 102.907593] common_interrupt+0x83/0xa0 [ 102.907600] </IRQ> [ 102.907601] asm_common_interrupt+0x1e/0x40
Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1
--- drivers/net/wireless/ath/ath11k/hw.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/wireless/ath/ath11k/hw.c +0 -2
@@ -1015,8 +1015,6 @@ const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_ipq8074 = {const struct ath11k_hw_ring_mask ath11k_hw_ring_mask_qca6390 = { .tx = {ATH11K_TX_RING_MASK_0 , -ATH11K_TX_RING_MASK_1 , -ATH11K_TX_RING_MASK_2 , }, .rx_mon_status = {0 ,0 ,0 ,0 ,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 480/846 usb: dwc3: meson-g12a: fix shared reset control use
In reply to Greg Kroah-HartmanFrom: Amjad Ouled-Ameur <[email protected]>
[ Upstream commit 4ce3b45704d5ef46fb4b28083c8aba6716fabf3b ]
reset_control_(de)assert() calls are called on a shared reset line when reset_control_reset has been used. This is not allowed by the reset framework.
Use reset_control_rearm() call in suspend() and remove() as a way to state that the resource is no longer used, hence the shared reset line may be triggered again by other devices. Use reset_control_rearm() also in case probe fails after reset() has been called.
reset_control_rearm() keeps use of triggered_count sane in the reset framework, use of reset_control_reset() on shared reset line should be balanced with reset_control_rearm().
--- drivers/usb/dwc3/dwc3-meson-g12a.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/usb/dwc3/dwc3-meson-g12a.c +12 -5
@@ -755,16 +755,16 @@ static int dwc3_meson_g12a_probe(struct platform_device *pdev) ret =dwc3_meson_g12a_get_phys (priv);if (ret) - goto err_disable_clks; + goto err_rearm; ret = priv->drvdata->setup_regmaps (priv, base);if (ret) - goto err_disable_clks; + goto err_rearm;if (priv->vbus) { ret =regulator_enable (priv->vbus);if (ret) - goto err_disable_clks; + goto err_rearm; }/* Get dr_mode */
@@ -825,6 +825,9 @@ err_disable_regulator:if (priv->vbus)regulator_disable (priv->vbus); +err_rearm: +reset_control_rearm (priv->reset); + err_disable_clks:clk_bulk_disable_unprepare (priv->drvdata->num_clks, priv->drvdata->clks);
@@ -852,6 +855,8 @@ static int dwc3_meson_g12a_remove(struct platform_device *pdev)pm_runtime_put_noidle (dev);pm_runtime_set_suspended (dev); +reset_control_rearm (priv->reset); +clk_bulk_disable_unprepare (priv->drvdata->num_clks, priv->drvdata->clks);
@@ -892,7 +897,7 @@ static int __maybe_unused dwc3_meson_g12a_suspend(struct device *dev)phy_exit (priv->phys[i]); } -reset_control_assert (priv->reset); +reset_control_rearm (priv->reset);return 0 ; }
@@ -902,7 +907,9 @@ static int __maybe_unused dwc3_meson_g12a_resume(struct device *dev)struct dwc3_meson_g12a *priv =dev_get_drvdata (dev);int i, ret; -reset_control_deassert (priv->reset); + ret =reset_control_reset (priv->reset); +if (ret) +return ret; ret = priv->drvdata->usb_init (priv);if (ret)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 481/846 USB: ehci_brcm_hub_control: Improve port index sanitizing
In reply to Greg Kroah-HartmanFrom: Haimin Zhang <[email protected]>
[ Upstream commit 9933698f6119886c110750e67c10ac66f12b730f ]
Due to (wIndex & 0xff) - 1 can get an integer greater than 15, this can cause array index to be out of bounds since the size of array port_status is 15. This change prevents a possible out-of-bounds pointer computation by forcing the use of a valid port number.
--- drivers/usb/host/ehci-brcm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/usb/host/ehci-brcm.c +5 -1
@@ -62,8 +62,12 @@ static int ehci_brcm_hub_control(u32 __iomem *status_reg;unsigned long flags;int retval, irq_disabled =0 ; +u32 temp; - status_reg = &ehci->regs->port_status[(wIndex &0xff ) -1 ]; + temp = (wIndex &0xff ) -1 ; +if (temp >=HCS_N_PORTS_MAX )/* Avoid index-out-of-bounds warning */ + temp =0 ; + status_reg = &ehci->regs->port_status[temp];/* * RESUME is cleared when GetPortStatus() is called 20ms after start
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 482/846 usb: gadget: f_fs: Use stream_open() for endpoint files
In reply to Greg Kroah-HartmanFrom: Pavankumar Kondeti <[email protected]>
[ Upstream commit c76ef96fc00eb398c8fc836b0eb2f82bcc619dc7 ]
Function fs endpoint file operations are synchronized via an interruptible mutex wait. However we see threads that do ep file operations concurrently are getting blocked for the mutex lock in __fdget_pos(). This is an uninterruptible wait and we see hung task warnings and kernel panic if hung_task_panic systcl is enabled if host does not send/receive the data for long time.
The reason for threads getting blocked in __fdget_pos() is due to the file position protection introduced by the commit 9c225f2655e3 ("vfs: atomic f_pos accesses as per POSIX"). Since function fs endpoint files does not have the notion of the file position, switch to the stream mode. This will bypass the file position mutex and threads will be blocked in interruptible state for the function fs mutex.
It should not affects user space as we are only changing the task state changes the task state from UNINTERRUPTIBLE to INTERRUPTIBLE while waiting for the USB transfers to be finished. However there is a slight change to the O_NONBLOCK behavior. Earlier threads that are using O_NONBLOCK are also getting blocked inside fdget_pos(). Now they reach to function fs and error code is returned. The non blocking behavior is actually honoured now.
--- drivers/usb/gadget/function/f_fs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/gadget/function/f_fs.c +2 -2
@@ -614,7 +614,7 @@ static int ffs_ep0_open(struct inode *inode, struct file *file) file->private_data = ffs;ffs_data_opened (ffs); -return 0 ; +return stream_open (inode, file); }static int ffs_ep0_release (struct inode *inode,struct file *file)
@@ -1154,7 +1154,7 @@ ffs_epfile_open(struct inode *inode, struct file *file) file->private_data = epfile;ffs_data_opened (epfile->ffs); -return 0 ; +return stream_open (inode, file); }static int ffs_aio_cancel (struct kiocb *kiocb)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 483/846 psi: Fix PSI_MEM_FULL state when tasks are in memstall and doing reclaim
In reply to Greg Kroah-HartmanFrom: Brian Chen <[email protected]>
[ Upstream commit cb0e52b7748737b2cf6481fdd9b920ce7e1ebbdf ]
We've noticed cases where tasks in a cgroup are stalled on memory but there is little memory FULL pressure since tasks stay on the runqueue in reclaim.
A simple example involves a single threaded program that keeps leaking and touching large amounts of memory. It runs in a cgroup with swap enabled, memory.high set at 10M and cpu.max ratio set at 5%. Though there is significant CPU pressure and memory SOME, there is barely any memory FULL since the task enters reclaim and stays on the runqueue. However, this memory-bound task is effectively stalled on memory and we expect memory FULL to match memory SOME in this scenario.
The code is confused about memstall && running, thinking there is a stalled task and a productive task when there's only one task: a reclaimer that's counted as both. To fix this, we redefine the condition for PSI_MEM_FULL to check that all running tasks are in an active memstall instead of checking that there are no running tasks.
case PSI_MEM_FULL:
- return unlikely(tasks[NR_MEMSTALL] && !tasks[NR_RUNNING]);
+ return unlikely(tasks[NR_MEMSTALL] &&
+ tasks[NR_RUNNING] == tasks[NR_MEMSTALL_RUNNING]);
This will capture reclaimers. It will also capture tasks that called psi_memstall_enter() and are about to sleep, but this should be negligible noise.
--- include/linux/psi_types.h | 13 ++++++++++- kernel/sched/psi.c | 45 ++++++++++++++++++++++++--------------- kernel/sched/stats.h | 5 ++++- 3 files changed, 44 insertions(+), 19 deletions(-)
include/linux/psi_types.h +12 -1
@@ -21,7 +21,17 @@ enum psi_task_count {* don't have to special case any state tracking for it. */ NR_ONCPU , - NR_PSI_TASK_COUNTS = 4, +/* +* For IO and CPU stalls the presence of running/oncpu tasks +* in the domain means a partial rather than a full stall. +* For memory it's not so simple because of page reclaimers: +* they are running/oncpu while representing a stall. To tell +* whether a domain has productivity left or not, we need to +* distinguish between regular running (i.e. productive) +* threads and memstall ones. +*/ +NR_MEMSTALL_RUNNING , + NR_PSI_TASK_COUNTS = 5, };/* Task state bitmasks */
@@ -29,6 +39,7 @@ enum psi_task_count {#define TSK_MEMSTALL (1 << NR_MEMSTALL)#define TSK_RUNNING (1 << NR_RUNNING)#define TSK_ONCPU (1 << NR_ONCPU) +#define TSK_MEMSTALL_RUNNING (1 << NR_MEMSTALL_RUNNING)/* Resources that workloads could be stalled on */ enum psi_res {
kernel/sched/psi.c +28 -17
104 lines not on this page · raw message
kernel/sched/stats.h +4 -1
@@ -69,6 +69,9 @@ static inline void psi_enqueue(struct task_struct *p, bool wakeup)if (static_branch_likely (&psi_disabled))return ; +if (p->in_memstall) + set |=TSK_MEMSTALL_RUNNING ; +if (!wakeup || p->sched_psi_wake_requeue) {if (p->in_memstall) set |=TSK_MEMSTALL ;
@@ -99,7 +102,7 @@ static inline void psi_dequeue(struct task_struct *p, bool sleep)return ;if (p->in_memstall) - clear |=TSK_MEMSTALL ; + clear |= (TSK_MEMSTALL |TSK_MEMSTALL_RUNNING );psi_task_change (p, clear,0 ); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 484/846 drm: panel-orientation-quirks: Add quirk for the Lenovo Yoga Book X91F/L
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit bc30c3b0c8a1904d83d5f0d60fb8650a334b207b ]
The Lenovo Yoga Book X91F/L uses a panel which has been mounted 90 degrees rotated. Add a quirk for this.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +6 -0
@@ -248,6 +248,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad D330-10IGM"), }, .driver_data = (void *)&lcd1200x1920_rightside_up, + }, { /* Lenovo Yoga Book X90F / X91F / X91L */ + .matches = { +/* Non exact match to match all versions */ + DMI_MATCH(DMI_PRODUCT_NAME, "Lenovo YB1-X9"), + }, + .driver_data = (void *)&lcd1200x1920_rightside_up, }, { /* OneGX1 Pro */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "SYSTEM_MANUFACTURER"),
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 485/846 HID: magicmouse: Report battery level over USB
In reply to Greg Kroah-HartmanFrom: José Expósito <[email protected]>
[ Upstream commit 0b91b4e4dae63cd43871fc2012370b86ee588f91 ]
When connected over USB, the Apple Magic Mouse 2 and the Apple Magic Trackpad 2 register multiple interfaces, one of them is used to report the battery level.
However, unlike when connected over Bluetooth, the battery level is not reported automatically and it is required to fetch it manually.
Fix the battery report descriptor and add a timer to fetch the battery level.
--- drivers/hid/hid-magicmouse.c | 94 +++++++++++++++++++++++++++++++++--- 1 file changed, 88 insertions(+), 6 deletions(-)
drivers/hid/hid-magicmouse.c +88 -6
@@ -57,6 +57,8 @@ MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state fie#define MOUSE_REPORT_ID 0x29#define MOUSE2_REPORT_ID 0x12#define DOUBLE_REPORT_ID 0xf7 +#define USB_BATTERY_TIMEOUT_MS 60000 +/* These definitions are not precise, but they're close enough. (Bits * 0x03 seem to indicate the aspect ratio of the touch, bits 0x70 seem * to be some kind of bit mask -- 0x20 may be a near-field reading,
@@ -140,6 +142,7 @@ struct magicmouse_sc {struct hid_device *hdev;struct delayed_work work; +struct timer_list battery_timer; };static int magicmouse_firm_touch (struct magicmouse_sc *msc)
@@ -738,6 +741,44 @@ static void magicmouse_enable_mt_work(struct work_struct *work)hid_err (msc->hdev,"unable to request touch data (%d)\n" , ret); } +static int magicmouse_fetch_battery (struct hid_device *hdev) +{ +#ifdef CONFIG_HID_BATTERY_STRENGTH +struct hid_report_enum *report_enum; +struct hid_report *report; + +if (!hdev->battery || hdev->vendor !=USB_VENDOR_ID_APPLE || + (hdev->product !=USB_DEVICE_ID_APPLE_MAGICMOUSE2 && + hdev->product !=USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 )) +return -1 ; + + report_enum = &hdev->report_enum[hdev->battery_report_type]; + report = report_enum->report_id_hash[hdev->battery_report_id]; + +if (!report || report->maxfield <1 ) +return -1 ; + +if (hdev->battery_capacity == hdev->battery_max) +return -1 ; + +hid_hw_request (hdev, report,HID_REQ_GET_REPORT ); +return 0 ; +#else +return -1 ; +#endif +} + +static void magicmouse_battery_timer_tick (struct timer_list *t) +{ +struct magicmouse_sc *msc =from_timer (msc, t, battery_timer); +struct hid_device *hdev = msc->hdev; + +if (magicmouse_fetch_battery (hdev) ==0 ) { +mod_timer (&msc->battery_timer, + jiffies +msecs_to_jiffies (USB_BATTERY_TIMEOUT_MS )); + } +} +static int magicmouse_probe (struct hid_device *hdev,const struct hid_device_id *id) {
@@ -745,11 +786,6 @@ static int magicmouse_probe(struct hid_device *hdev,struct hid_report *report;int ret; -if (id->vendor ==USB_VENDOR_ID_APPLE && - id->product ==USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 && - hdev->type !=HID_TYPE_USBMOUSE ) -return -ENODEV ; - msc =devm_kzalloc (&hdev->dev,sizeof (*msc),GFP_KERNEL );if (msc ==NULL ) {hid_err (hdev,"can't alloc magicmouse descriptor\n" );
@@ -775,6 +811,16 @@ static int magicmouse_probe(struct hid_device *hdev,return ret; } +timer_setup (&msc->battery_timer, magicmouse_battery_timer_tick,0 ); +mod_timer (&msc->battery_timer, + jiffies +msecs_to_jiffies (USB_BATTERY_TIMEOUT_MS )); +magicmouse_fetch_battery (hdev); + +if (id->vendor ==USB_VENDOR_ID_APPLE && + (id->product ==USB_DEVICE_ID_APPLE_MAGICMOUSE2 || + (id->product ==USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 && hdev->type !=HID_TYPE_USBMOUSE ))) +return 0 ; +if (!msc->input) {hid_err (hdev,"magicmouse input not registered\n" ); ret = -ENOMEM ;
@@ -835,17 +881,52 @@ static void magicmouse_remove(struct hid_device *hdev) {struct magicmouse_sc *msc =hid_get_drvdata (hdev); -if (msc) +if (msc) {cancel_delayed_work_sync (&msc->work); +del_timer_sync (&msc->battery_timer); + }hid_hw_stop (hdev); } +static __u8 *magicmouse_report_fixup (struct hid_device *hdev,__u8 *rdesc, +unsigned int *rsize) +{ +/* +* Change the usage from: +* 0x06, 0x00, 0xff, // Usage Page (Vendor Defined Page 1) 0 +* 0x09, 0x0b, // Usage (Vendor Usage 0x0b) 3 +* To: +* 0x05, 0x01, // Usage Page (Generic Desktop) 0 +* 0x09, 0x02, // Usage (Mouse) 2 +*/ +if (hdev->vendor ==USB_VENDOR_ID_APPLE && + (hdev->product ==USB_DEVICE_ID_APPLE_MAGICMOUSE2 || + hdev->product ==USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 ) && + *rsize ==83 && rdesc[46 ] ==0x84 && rdesc[58 ] ==0x85 ) { +hid_info (hdev, +"fixing up magicmouse battery report descriptor\n" ); + *rsize = *rsize -1 ; + rdesc =kmemdup (rdesc +1 , *rsize,GFP_KERNEL ); +if (!rdesc) +return NULL ; + + rdesc[0 ] =0x05 ; + rdesc[1 ] =0x01 ; + rdesc[2 ] =0x09 ; + rdesc[3 ] =0x02 ; + } + +return rdesc; +} +static const struct hid_device_id magic_mice[] = { {HID_BLUETOOTH_DEVICE (USB_VENDOR_ID_APPLE ,USB_DEVICE_ID_APPLE_MAGICMOUSE ), .driver_data =0 }, {HID_BLUETOOTH_DEVICE (BT_VENDOR_ID_APPLE ,USB_DEVICE_ID_APPLE_MAGICMOUSE2 ), .driver_data =0 }, + {HID_USB_DEVICE (USB_VENDOR_ID_APPLE , +USB_DEVICE_ID_APPLE_MAGICMOUSE2 ), .driver_data =0 }, {HID_BLUETOOTH_DEVICE (USB_VENDOR_ID_APPLE ,USB_DEVICE_ID_APPLE_MAGICTRACKPAD ), .driver_data =0 }, { HID_BLUETOOTH_DEVICE(BT_VENDOR_ID_APPLE,
@@ -861,6 +942,7 @@ static struct hid_driver magicmouse_driver = { .id_table = magic_mice, .probe = magicmouse_probe, .remove = magicmouse_remove, + .report_fixup = magicmouse_report_fixup, .raw_event = magicmouse_raw_event, .event = magicmouse_event, .input_mapping = magicmouse_input_mapping,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 486/846 HID: apple: Do not reset quirks when the Fn key is not found
In reply to Greg Kroah-HartmanFrom: José Expósito <[email protected]>
[ Upstream commit a5fe7864d8ada170f19cc47d176bf8260ffb4263 ]
When a keyboard without a function key is detected, instead of removing all quirks, remove only the APPLE_HAS_FN quirk.
--- drivers/hid/hid-apple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-apple.c +1 -1
@@ -429,7 +429,7 @@ static int apple_input_configured(struct hid_device *hdev,if ((asc->quirks &APPLE_HAS_FN ) && !asc->fn_found) {hid_info (hdev,"Fn key not found (Apple Wireless Keyboard clone?), disabling Fn key handling\n" ); - asc->quirks =0 ; + asc->quirks &= ~APPLE_HAS_FN ; }return 0 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 487/846 media: b2c2: Add missing check in flexcop_pci_isr:
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
[ Upstream commit b13203032e679674c7c518f52a7ec0801ca3a829 ]
A out-of-bounds bug can be triggered by an interrupt, the reason for this bug is the lack of checking of register values.
In flexcop_pci_isr, the driver reads value from a register and uses it as a dma address. Finally, this address will be passed to the count parameter of find_next_packet. If this value is larger than the size of dma, the index of buffer will be out-of-bounds.
Fix this by adding a check after reading the value of the register.
The following KASAN report reveals it:
BUG: KASAN: slab-out-of-bounds in find_next_packet drivers/media/dvb-core/dvb_demux.c:528 [inline] BUG: KASAN: slab-out-of-bounds in _dvb_dmx_swfilter drivers/media/dvb-core/dvb_demux.c:572 [inline] BUG: KASAN: slab-out-of-bounds in dvb_dmx_swfilter+0x3fa/0x420 drivers/media/dvb-core/dvb_demux.c:603 Read of size 1 at addr ffff8880608c00a0 by task swapper/2/0 CPU: 2 PID: 0 Comm: swapper/2 Not tainted 4.19.177-gdba4159c14ef #25 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014 Call Trace: <IRQ> __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0xec/0x156 lib/dump_stack.c:118 print_address_description+0x78/0x290 mm/kasan/report.c:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report+0x25b/0x380 mm/kasan/report.c:412 __asan_report_load1_noabort+0x19/0x20 mm/kasan/report.c:430 find_next_packet drivers/media/dvb-core/dvb_demux.c:528 [inline] _dvb_dmx_swfilter drivers/media/dvb-core/dvb_demux.c:572 [inline] dvb_dmx_swfilter+0x3fa/0x420 drivers/media/dvb-core/dvb_demux.c:603 flexcop_pass_dmx_data+0x2e/0x40 drivers/media/common/b2c2/flexcop.c:167 flexcop_pci_isr+0x3d1/0x5d0 drivers/media/pci/b2c2/flexcop-pci.c:212 __handle_irq_event_percpu+0xfb/0x770 kernel/irq/handle.c:149 handle_irq_event_percpu+0x79/0x150 kernel/irq/handle.c:189 handle_irq_event+0xac/0x140 kernel/irq/handle.c:206 handle_fasteoi_irq+0x232/0x5c0 kernel/irq/chip.c:725 generic_handle_irq_desc include/linux/irqdesc.h:155 [inline] handle_irq+0x230/0x3a0 arch/x86/kernel/irq_64.c:87 do_IRQ+0xa7/0x1e0 arch/x86/kernel/irq.c:247 common_interrupt+0xf/0xf arch/x86/entry/entry_64.S:670 </IRQ> RIP: 0010:native_safe_halt+0x28/0x30 arch/x86/include/asm/irqflags.h:61 Code: 00 00 55 be 04 00 00 00 48 c7 c7 00 62 2f 8c 48 89 e5 e8 fb 31
e8 f8 8b 05 75 4f 8e 03 85 c0 7e 07 0f 00 2d 8a 61 66 00 fb f4 <5d> c3 90 90 90 90 90 90 0f 1f 44 00 00 55 48 89 e5 41 57 41 56 41
RSP: 0018:ffff88806b71fcc8 EFLAGS: 00000246 ORIG_RAX: ffffffffffffffde
RAX: 0000000000000000 RBX: ffffffff8bde44c8 RCX: ffffffff88a11285
RDX: 0000000000000000 RSI: 0000000000000004 RDI: ffffffff8c2f6200
RBP: ffff88806b71fcc8 R08: fffffbfff185ec40 R09: fffffbfff185ec40
R10: 0000000000000001 R11: fffffbfff185ec40 R12: 0000000000000002
R13: ffffffff8be9d6e0 R14: 0000000000000000 R15: 0000000000000000
arch_safe_halt arch/x86/include/asm/paravirt.h:94 [inline] default_idle+0x6f/0x360 arch/x86/kernel/process.c:557 arch_cpu_idle+0xf/0x20 arch/x86/kernel/process.c:548 default_idle_call+0x3b/0x60 kernel/sched/idle.c:93 cpuidle_idle_call kernel/sched/idle.c:153 [inline] do_idle+0x2ab/0x3c0 kernel/sched/idle.c:263 cpu_startup_entry+0xcb/0xe0 kernel/sched/idle.c:369 start_secondary+0x3b8/0x4e0 arch/x86/kernel/smpboot.c:271 secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:243 Allocated by task 1: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:553 kasan_slab_alloc+0x11/0x20 mm/kasan/kasan.c:490 slab_post_alloc_hook mm/slab.h:445 [inline] slab_alloc_node mm/slub.c:2741 [inline] slab_alloc mm/slub.c:2749 [inline] kmem_cache_alloc+0xeb/0x280 mm/slub.c:2754 kmem_cache_zalloc include/linux/slab.h:699 [inline] __kernfs_new_node+0xe2/0x6f0 fs/kernfs/dir.c:633 kernfs_new_node+0x9a/0x120 fs/kernfs/dir.c:693 __kernfs_create_file+0x5f/0x340 fs/kernfs/file.c:992 sysfs_add_file_mode_ns+0x22a/0x4e0 fs/sysfs/file.c:306 create_files fs/sysfs/group.c:63 [inline] internal_create_group+0x34e/0xc30 fs/sysfs/group.c:147 sysfs_create_group fs/sysfs/group.c:173 [inline] sysfs_create_groups+0x9c/0x140 fs/sysfs/group.c:200 driver_add_groups+0x3e/0x50 drivers/base/driver.c:129 bus_add_driver+0x3a5/0x790 drivers/base/bus.c:684 driver_register+0x1cd/0x410 drivers/base/driver.c:170 __pci_register_driver+0x197/0x200 drivers/pci/pci-driver.c:1411 cx88_audio_pci_driver_init+0x23/0x25 drivers/media/pci/cx88/cx88-alsa.c: 1017 do_one_initcall+0xe0/0x610 init/main.c:884 do_initcall_level init/main.c:952 [inline] do_initcalls init/main.c:960 [inline] do_basic_setup init/main.c:978 [inline] kernel_init_freeable+0x4d0/0x592 init/main.c:1145 kernel_init+0x18/0x190 init/main.c:1062 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415 Freed by task 0:
(stack is not available)
The buggy address belongs to the object at ffff8880608c0000
which belongs to the cache kernfs_node_cache of size 160
The buggy address is located 0 bytes to the right of
160-byte region [ffff8880608c0000, ffff8880608c00a0)
The buggy address belongs to the page:
page:ffffea0001823000 count:1 mapcount:0 mapping:ffff88806bed1e00
index:0x0 compound_mapcount: 0
flags: 0x100000000008100(slab|head)
raw: 0100000000008100 dead000000000100 dead000000000200 ffff88806bed1e00
raw: 0000000000000000 0000000000240024 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff8880608bff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8880608c0000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880608c0080: 00 00 00 00 fc fc fc fc fc fc fc fc 00 00 00 00
^
ffff8880608c0100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8880608c0180: fc fc fc fc fc fc fc fc 00 00 00 00 00 00 00 00
==================================================================--- drivers/media/pci/b2c2/flexcop-pci.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/pci/b2c2/flexcop-pci.c +3 -0
@@ -185,6 +185,8 @@ static irqreturn_t flexcop_pci_isr(int irq, void *dev_id)dma_addr_t cur_addr = fc->read_ibi_reg (fc,dma1_008).dma_0x8.dma_cur_addr <<2 ;u32 cur_pos = cur_addr - fc_pci->dma[0 ].dma_addr0; +if (cur_pos > fc_pci->dma[0 ].size *2 ) + goto error; deb_irq("%u irq: %08x cur_addr: %llx: cur_pos: %08x, last_cur_pos: %08x ", jiffies_to_usecs(jiffies - fc_pci->last_irq),
@@ -225,6 +227,7 @@ static irqreturn_t flexcop_pci_isr(int irq, void *dev_id) ret =IRQ_NONE ; } +error:spin_unlock_irqrestore (&fc_pci->irq_lock, flags);return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 488/846 libbpf: Accommodate DWARF/compiler bug with duplicated structs
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit efdd3eb8015e7447095f02a26eaabd164cd18004 ]
According to [0], compilers sometimes might produce duplicate DWARF definitions for exactly the same struct/union within the same compilation unit (CU). We've had similar issues with identical arrays and handled them with a similar workaround in 6b6e6b1d09aa ("libbpf:
Accomodate DWARF/compiler bug with duplicated identical arrays"). Do the same for struct/union by ensuring that two structs/unions are exactly the same, down to the integer values of field referenced type IDs.
Solving this more generically (allowing referenced types to be equivalent, but using different type IDs, all within a single CU) requires a huge complexity increase to handle many-to-many mappings between canonidal and candidate type graphs. Before we invest in that, let's see if this approach handles all the instances of this issue in practice. Thankfully it's pretty rare, it seems.
[0] https://lore.kernel.org/bpf/YXr2NFlJTAhHdZqq@krava/
--- tools/lib/bpf/btf.c | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 4 deletions(-)
tools/lib/bpf/btf.c +41 -4
@@ -3358,8 +3358,8 @@ static long btf_hash_struct(struct btf_type *t) }/* -* Check structural compatibility of two FUNC_PROTOs, ignoring referenced type -* IDs. This check is performed during type graph equivalence check and +* Check structural compatibility of two STRUCTs/UNIONs, ignoring referenced +* type IDs. This check is performed during type graph equivalence check and * referenced types equivalence is checked separately. */ static bool btf_shallow_equal_struct (struct btf_type *t1,struct btf_type *t2)
@@ -3730,6 +3730,31 @@ static int btf_dedup_identical_arrays(struct btf_dedup *d, __u32 id1, __u32 id2)return btf_equal_array (t1, t2); } +/* Check if given two types are identical STRUCT/UNION definitions */ +static bool btf_dedup_identical_structs (struct btf_dedup *d,__u32 id1,__u32 id2) +{ +const struct btf_member *m1, *m2; +struct btf_type *t1, *t2; +int n, i; + + t1 =btf_type_by_id (d->btf, id1); + t2 =btf_type_by_id (d->btf, id2); + +if (!btf_is_composite (t1) ||btf_kind (t1) !=btf_kind (t2)) +return false; + +if (!btf_shallow_equal_struct (t1, t2)) +return false; + + m1 =btf_members (t1); + m2 =btf_members (t2); +for (i =0 , n =btf_vlen (t1); i < n; i++, m1++, m2++) { +if (m1->type != m2->type) +return false; + } +return true; +} +/* * Check equivalence of BTF type graph formed by candidate struct/union (we'll * call it "candidate graph" in this description for brevity) to a type graph
@@ -3841,6 +3866,8 @@ static int btf_dedup_is_equiv(struct btf_dedup *d, __u32 cand_id, hypot_type_id = d->hypot_map[canon_id];if (hypot_type_id <=BTF_MAX_NR_TYPES ) { +if (hypot_type_id == cand_id) +return 1 ;/* In some cases compiler will generate different DWARF types * for *identical* array type definitions and use them for * different fields within the *same* struct. This breaks type
@@ -3849,8 +3876,18 @@ static int btf_dedup_is_equiv(struct btf_dedup *d, __u32 cand_id,* types within a single CU. So work around that by explicitly * allowing identical array types here. */ -return hypot_type_id == cand_id || -btf_dedup_identical_arrays (d, hypot_type_id, cand_id); +if (btf_dedup_identical_arrays (d, hypot_type_id, cand_id)) +return 1 ; +/* It turns out that similar situation can happen with +* struct/union sometimes, sigh... Handle the case where +* structs/unions are exactly the same, down to the referenced +* type IDs. Anything more complicated (e.g., if referenced +* types are different, but equivalent) is *way more* +* complicated and requires a many-to-many equivalence mapping. +*/ +if (btf_dedup_identical_structs (d, hypot_type_id, cand_id)) +return 1 ; +return 0 ; }if (btf_dedup_hypot_map_add (d, canon_id, cand_id))
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 489/846 ethernet: renesas: Use div64_ul instead of do_div
In reply to Greg Kroah-HartmanFrom: Yang Li <[email protected]>
[ Upstream commit d9f31aeaa1e5aefa68130878af3c3513d41c1e2d ]
do_div() does a 64-by-32 division. Here the divisor is an unsigned long which on some platforms is 64 bit wide. So use div64_ul instead of do_div to avoid a possible truncation.
Eliminate the following coccicheck warning:
./drivers/net/ethernet/renesas/ravb_main.c:2492:1-7: WARNING:do_div() does a 64-by-32 division, please consider using div64_ul instead.
--- drivers/net/ethernet/renesas/ravb_main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/renesas/ravb_main.c +2 -4
@@ -30,8 +30,7 @@#include <linux/spinlock.h> #include <linux/sys_soc.h> #include <linux/reset.h> - -#include <asm/div64.h> +#include <linux/math64.h> #include "ravb.h"
@@ -2061,8 +2060,7 @@ static int ravb_set_gti(struct net_device *ndev)if (!rate)return -EINVAL ; - inc =1000000000ULL <<20 ; -do_div (inc, rate); + inc =div64_ul (1000000000ULL <<20 , rate);if (inc <GTI_TIV_MIN || inc >GTI_TIV_MAX ) { dev_err(dev, "gti.tiv increment 0x%llx is outside the range 0x%x - 0x%x\n",
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 490/846 EDAC/synopsys: Use the quirk for version instead of ddr version
In reply to Greg Kroah-HartmanFrom: Dinh Nguyen <[email protected]>
[ Upstream commit bd1d6da17c296bd005bfa656952710d256e77dd3 ]
Version 2.40a supports DDR_ECC_INTR_SUPPORT for a quirk, so use that quirk to determine a call to setup_address_map().
--- drivers/edac/synopsys_edac.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/edac/synopsys_edac.c +1 -2
@@ -1352,8 +1352,7 @@ static int mc_probe(struct platform_device *pdev) } } -if (of_device_is_compatible (pdev->dev.of_node, -"xlnx,zynqmp-ddrc-2.40a" )) +if (priv->p_data->quirks &DDR_ECC_INTR_SUPPORT )setup_address_map (priv);#endif
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 491/846 arm64: dts: qcom: sm8350: Shorten camera-thermal-bottom name
In reply to Greg Kroah-HartmanFrom: Konrad Dybcio <[email protected]>
[ Upstream commit f52dd33943ca5f84ae76890f352f6d9e12512c3f ]
Thermal zone names should not be longer than 20 names, which is indicated by a message at boot. Change "camera-thermal-bottom" to "cam-thermal-bottom" to fix it.
--- arch/arm64/boot/dts/qcom/sm8350.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm8350.dtsi +1 -1
@@ -2185,7 +2185,7 @@ }; }; - camera-thermal-bottom { + cam-thermal-bottom { polling-delay-passive = <250>; polling-delay = <1000>;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 492/846 soc: imx: gpcv2: Synchronously suspend MIX domains
In reply to Greg Kroah-HartmanFrom: Marek Vasut <[email protected]>
[ Upstream commit f756f435f7dd823f2d4bd593ce1bf3168def1308 ]
In case the following power domain sequence happens, iMX8M Mini always hangs:
gpumix:on -> gpu:on -> gpu:off -> gpu:on
This is likely due to another quirk of the GPC block. This situation can be prevented by always synchronously powering off both the domain and MIX domain. Make it so. This turns the aforementioned sequence into:
gpumix:on -> gpu:on -> gpu:off -> gpumix:off -> gpumix:on -> gpu:on
--- drivers/soc/imx/gpcv2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/imx/gpcv2.c +1 -1
@@ -369,7 +369,7 @@ static int imx_pgc_power_down(struct generic_pm_domain *genpd) } } -pm_runtime_put (domain->dev); +pm_runtime_put_sync_suspend (domain->dev);return 0 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 493/846 ARM: imx: rename DEBUG_IMX21_IMX27_UART to DEBUG_IMX27_UART
In reply to Greg Kroah-HartmanFrom: Lukas Bulwahn <[email protected]>
[ Upstream commit b0100bce4ff82ec1ccd3c1f3d339fd2df6a81784 ]
Since commit 4b563a066611 ("ARM: imx: Remove imx21 support"), the config DEBUG_IMX21_IMX27_UART is really only debug support for IMX27.
So, rename this option to DEBUG_IMX27_UART and adjust dependencies in Kconfig and rename the definitions to IMX27 as further clean-up.
This issue was discovered with ./scripts/checkkconfigsymbols.py, which reported that DEBUG_IMX21_IMX27_UART depends on the non-existing config SOC_IMX21.
--- arch/arm/Kconfig.debug | 14 +++++++------- arch/arm/include/debug/imx-uart.h | 18 +++++++++--------- 2 files changed, 16 insertions(+), 16 deletions(-)
arch/arm/Kconfig.debug +7 -7
@@ -410,12 +410,12 @@ choice Say Y here if you want kernel low-level debugging support on i.MX25. - config DEBUG_IMX21_IMX27_UART - bool "i.MX21 and i.MX27 Debug UART" - depends on SOC_IMX21 || SOC_IMX27 + config DEBUG_IMX27_UART + bool "i.MX27 Debug UART" + depends on SOC_IMX27 help Say Y here if you want kernel low-level debugging support - on i.MX21 or i.MX27. + on i.MX27. config DEBUG_IMX28_UART bool "i.MX28 Debug UART"
@@ -1481,7 +1481,7 @@ config DEBUG_IMX_UART_PORT int "i.MX Debug UART Port Selection" depends on DEBUG_IMX1_UART || \ DEBUG_IMX25_UART || \ - DEBUG_IMX21_IMX27_UART || \ + DEBUG_IMX27_UART || \ DEBUG_IMX31_UART || \ DEBUG_IMX35_UART || \ DEBUG_IMX50_UART || \
@@ -1540,12 +1540,12 @@ config DEBUG_LL_INCLUDE default "debug/icedcc.S" if DEBUG_ICEDCC default "debug/imx.S" if DEBUG_IMX1_UART || \ DEBUG_IMX25_UART || \ - DEBUG_IMX21_IMX27_UART || \ + DEBUG_IMX27_UART || \ DEBUG_IMX31_UART || \ DEBUG_IMX35_UART || \ DEBUG_IMX50_UART || \ DEBUG_IMX51_UART || \ - DEBUG_IMX53_UART ||\ + DEBUG_IMX53_UART || \ DEBUG_IMX6Q_UART || \ DEBUG_IMX6SL_UART || \ DEBUG_IMX6SX_UART || \
arch/arm/include/debug/imx-uart.h +9 -9
@@ -11,13 +11,6 @@#define IMX1_UART_BASE_ADDR (n) IMX1_UART##n##_BASE_ADDR#define IMX1_UART_BASE (n) IMX1_UART_BASE_ADDR(n) -#define IMX21_UART1_BASE_ADDR 0x1000a000 -#define IMX21_UART2_BASE_ADDR 0x1000b000 -#define IMX21_UART3_BASE_ADDR 0x1000c000 -#define IMX21_UART4_BASE_ADDR 0x1000d000 -#define IMX21_UART_BASE_ADDR (n) IMX21_UART##n##_BASE_ADDR -#define IMX21_UART_BASE (n) IMX21_UART_BASE_ADDR(n) -#define IMX25_UART1_BASE_ADDR 0x43f90000#define IMX25_UART2_BASE_ADDR 0x43f94000#define IMX25_UART3_BASE_ADDR 0x5000c000
@@ -26,6 +19,13 @@#define IMX25_UART_BASE_ADDR (n) IMX25_UART##n##_BASE_ADDR#define IMX25_UART_BASE (n) IMX25_UART_BASE_ADDR(n) +#define IMX27_UART1_BASE_ADDR 0x1000a000 +#define IMX27_UART2_BASE_ADDR 0x1000b000 +#define IMX27_UART3_BASE_ADDR 0x1000c000 +#define IMX27_UART4_BASE_ADDR 0x1000d000 +#define IMX27_UART_BASE_ADDR (n) IMX27_UART##n##_BASE_ADDR +#define IMX27_UART_BASE (n) IMX27_UART_BASE_ADDR(n) +#define IMX31_UART1_BASE_ADDR 0x43f90000#define IMX31_UART2_BASE_ADDR 0x43f94000#define IMX31_UART3_BASE_ADDR 0x5000c000
@@ -112,10 +112,10 @@#ifdef CONFIG_DEBUG_IMX1_UART #define UART_PADDR IMX_DEBUG_UART_BASE(IMX1) -#elif defined(CONFIG_DEBUG_IMX21_IMX27_UART ) -#define UART_PADDR IMX_DEBUG_UART_BASE(IMX21)#elif defined(CONFIG_DEBUG_IMX25_UART )#define UART_PADDR IMX_DEBUG_UART_BASE(IMX25) +#elif defined(CONFIG_DEBUG_IMX27_UART ) +#define UART_PADDR IMX_DEBUG_UART_BASE(IMX27)#elif defined(CONFIG_DEBUG_IMX31_UART )#define UART_PADDR IMX_DEBUG_UART_BASE(IMX31)#elif defined(CONFIG_DEBUG_IMX35_UART )
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 494/846 drm/amd/display: check top_pipe_to_program pointer
In reply to Greg Kroah-HartmanFrom: Yang Li <[email protected]>
[ Upstream commit a689e8d1f80012f90384ebac9dcfac4201f9f77e ]
Clang static analysis reports this error
drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:2870:7: warning:
Dereference of null pointer [clang-analyzer-core.NullDereference]
if
(top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable) {
^top_pipe_to_program being NULL is caught as an error But then it is used to report the error.
So add a check before using it.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +2 -1
@@ -2703,7 +2703,8 @@ static void commit_planes_for_stream(struct dc *dc,#endif if ((update_type !=UPDATE_TYPE_FAST ) && stream->update_flags.bits.dsc_changed) -if (top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable) { +if (top_pipe_to_program && + top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable) {if (should_use_dmub_lock (stream->link)) {union dmub_hw_lock_flags hw_locks = {0 };struct dmub_hw_lock_inst_flags inst_flags = {0 };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 495/846 drm/amdgpu/display: set vblank_disable_immediate for DC
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
[ Upstream commit 92020e81ddbeac351ea4a19bcf01743f32b9c800 ]
Disable vblanks immediately to save power. I think this was missed when we merged DC support.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 1 - drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +0 -1
@@ -333,7 +333,6 @@ int amdgpu_irq_init(struct amdgpu_device *adev)if (!amdgpu_device_has_dc_support (adev)) {if (!adev->enable_virtual_display)/* Disable vblank IRQs aggressively for power-saving */ -/* XXX: can this be enabled for DC? */ adev_to_drm (adev)->vblank_disable_immediate = true; r =drm_vblank_init (adev_to_drm (adev), adev->mode_info.num_crtc);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -0
@@ -1279,6 +1279,9 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)adev_to_drm (adev)->mode_config.cursor_width = adev->dm.dc->caps.max_cursor_size;adev_to_drm (adev)->mode_config.cursor_height = adev->dm.dc->caps.max_cursor_size; +/* Disable vblank IRQs aggressively for power-saving */ +adev_to_drm (adev)->vblank_disable_immediate = true; +if (drm_vblank_init (adev_to_drm (adev), adev->dm.display_indexes_num)) {DRM_ERROR ("amdgpu: failed to initialize sw for display support.\n" );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 496/846 soc: ti: pruss: fix referenced node in error message
In reply to Greg Kroah-HartmanFrom: Jan Kiszka <[email protected]>
[ Upstream commit 8aa35e0bb5eaa42bac415ad0847985daa7b4890c ]
So far, "(null)" is reported for the node that is missing clocks.
--- drivers/soc/ti/pruss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/ti/pruss.c +1 -1
@@ -129,7 +129,7 @@ static int pruss_clk_init(struct pruss *pruss, struct device_node *cfg_node) clks_np =of_get_child_by_name (cfg_node,"clocks" );if (!clks_np) { -dev_err (dev,"%pOF is missing its 'clocks' node\n" , clks_np); +dev_err (dev,"%pOF is missing its 'clocks' node\n" , cfg_node);return -ENODEV ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 497/846 mlxsw: pci: Add shutdown method in PCI driver
In reply to Greg Kroah-HartmanFrom: Danielle Ratson <[email protected]>
[ Upstream commit c1020d3cf4752f61a6a413f632ea2ce2370e150d ]
On an arm64 platform with the Spectrum ASIC, after loading and executing a new kernel via kexec, the following trace [1] is observed. This seems to be caused by the fact that the device is not properly shutdown before executing the new kernel.
Fix this by implementing a shutdown method which mirrors the remove method, as recommended by the kexec maintainer [2][3].
[1]
BUG: Bad page state in process devlink pfn:22f73d page:fffffe00089dcf40 refcount:-1 mapcount:0 mapping:0000000000000000 index:0x0 flags: 0x2ffff00000000000() raw: 2ffff00000000000 0000000000000000 ffffffff089d0201 0000000000000000 raw: 0000000000000000 0000000000000000 ffffffffffffffff 0000000000000000 page dumped because: nonzero _refcount Modules linked in: CPU: 1 PID: 16346 Comm: devlink Tainted: G B 5.8.0-rc6-custom-273020-gac6b365b1bf5 #44 Hardware name: Marvell Armada 7040 TX4810M (DT) Call trace: dump_backtrace+0x0/0x1d0 show_stack+0x1c/0x28 dump_stack+0xbc/0x118 bad_page+0xcc/0xf8 check_free_page_bad+0x80/0x88 __free_pages_ok+0x3f8/0x418 __free_pages+0x38/0x60 kmem_freepages+0x200/0x2a8 slab_destroy+0x28/0x68 slabs_destroy+0x60/0x90 ___cache_free+0x1b4/0x358 kfree+0xc0/0x1d0 skb_free_head+0x2c/0x38 skb_release_data+0x110/0x1a0 skb_release_all+0x2c/0x38 consume_skb+0x38/0x130 __dev_kfree_skb_any+0x44/0x50 mlxsw_pci_rdq_fini+0x8c/0xb0 mlxsw_pci_queue_fini.isra.0+0x28/0x58 mlxsw_pci_queue_group_fini+0x58/0x88 mlxsw_pci_aqs_fini+0x2c/0x60 mlxsw_pci_fini+0x34/0x50 mlxsw_core_bus_device_unregister+0x104/0x1d0 mlxsw_devlink_core_bus_device_reload_down+0x2c/0x48 devlink_reload+0x44/0x158 devlink_nl_cmd_reload+0x270/0x290 genl_rcv_msg+0x188/0x2f0 netlink_rcv_skb+0x5c/0x118 genl_rcv+0x3c/0x50 netlink_unicast+0x1bc/0x278 netlink_sendmsg+0x194/0x390 __sys_sendto+0xe0/0x158 __arm64_sys_sendto+0x2c/0x38 el0_svc_common.constprop.0+0x70/0x168 do_el0_svc+0x28/0x88 el0_sync_handler+0x88/0x190 el0_sync+0x140/0x180
[2]
https://www.mail-archive.com/[email protected]/msg1195432.html
[3]
https://patchwork.kernel.org/project/linux-scsi/patch/[email protected]/#20116693
--- drivers/net/ethernet/mellanox/mlxsw/pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlxsw/pci.c +1 -0
@@ -1973,6 +1973,7 @@ int mlxsw_pci_driver_register(struct pci_driver *pci_driver) { pci_driver->probe = mlxsw_pci_probe; pci_driver->remove = mlxsw_pci_remove; + pci_driver->shutdown = mlxsw_pci_remove;return pci_register_driver (pci_driver); }EXPORT_SYMBOL (mlxsw_pci_driver_register);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 498/846 drm/amd/display: add else to avoid double destroy clk_mgr
In reply to Greg Kroah-HartmanFrom: Martin Leung <[email protected]>
[ Upstream commit 11dff0e871037a6ad978e52f826a2eb7f5fb274a ]
[Why & How]
when changing some code we accidentally
changed else if-> if. reverting that.
--- drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c +1 -2
@@ -306,8 +306,7 @@ void dc_destroy_clk_mgr(struct clk_mgr *clk_mgr_base)case FAMILY_NV :if (ASICREV_IS_SIENNA_CICHLID_P (clk_mgr_base->ctx->asic_id.hw_internal_rev)) {dcn3_clk_mgr_destroy (clk_mgr); - } -if (ASICREV_IS_DIMGREY_CAVEFISH_P (clk_mgr_base->ctx->asic_id.hw_internal_rev)) { + }else if (ASICREV_IS_DIMGREY_CAVEFISH_P (clk_mgr_base->ctx->asic_id.hw_internal_rev)) {dcn3_clk_mgr_destroy (clk_mgr); }if (ASICREV_IS_BEIGE_GOBY_P (clk_mgr_base->ctx->asic_id.hw_internal_rev)) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 499/846 drm/bridge: megachips: Ensure both bridges are probed before registration
In reply to Greg Kroah-HartmanFrom: Martyn Welch <[email protected]>
[ Upstream commit 11632d4aa2b3f126790e81a4415d6c23103cf8bb ]
In the configuration used by the b850v3, the STDP2690 is used to read EDID data whilst it's the STDP4028 which can detect when monitors are connected.
This can result in problems at boot with monitors connected when the STDP4028 is probed first, a monitor is detected and an attempt is made to read the EDID data before the STDP2690 has probed:
[ 3.795721] Unable to handle kernel NULL pointer dereference at virtual address 00000018 [ 3.803845] pgd = (ptrval) [ 3.806581] [00000018] *pgd=00000000 [ 3.810180] Internal error: Oops: 5 [#1] SMP ARM [ 3.814813] Modules linked in: [ 3.817879] CPU: 0 PID: 64 Comm: kworker/u4:1 Not tainted 5.15.0 #1 [ 3.824161] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) [ 3.830705] Workqueue: events_unbound deferred_probe_work_func [ 3.836565] PC is at stdp2690_get_edid+0x44/0x19c [ 3.841286] LR is at ge_b850v3_lvds_get_modes+0x2c/0x5c [ 3.846526] pc : [<805eae10>] lr : [<805eb138>] psr: 80000013 [ 3.852802] sp : 81c359d0 ip : 7dbb550b fp : 81c35a1c [ 3.858037] r10: 81c73840 r9 : 81c73894 r8 : 816d9800 [ 3.863270] r7 : 00000000 r6 : 81c34000 r5 : 00000000 r4 : 810c35f0 [ 3.869808] r3 : 80e3e294 r2 : 00000080 r1 : 00000cc0 r0 : 81401180 [ 3.876349] Flags: Nzcv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none [ 3.883499] Control: 10c5387d Table: 1000404a DAC: 00000051 [ 3.889254] Register r0 information: slab kmem_cache start 81401180 pointer offset 0 [ 3.897034] Register r1 information: non-paged memory [ 3.902097] Register r2 information: non-paged memory [ 3.907160] Register r3 information: non-slab/vmalloc memory [ 3.912832] Register r4 information: non-slab/vmalloc memory [ 3.918503] Register r5 information: NULL pointer [ 3.923217] Register r6 information: non-slab/vmalloc memory [ 3.928887] Register r7 information: NULL pointer [ 3.933601] Register r8 information: slab kmalloc-1k start 816d9800 pointer offset 0 size 1024 [ 3.942244] Register r9 information: slab kmalloc-2k start 81c73800 pointer offset 148 size 2048 [ 3.951058] Register r10 information: slab kmalloc-2k start 81c73800 pointer offset 64 size 2048 [ 3.959873] Register r11 information: non-slab/vmalloc memory [ 3.965632] Register r12 information: non-paged memory [ 3.970781] Process kworker/u4:1 (pid: 64, stack limit = 0x(ptrval)) [ 3.977148] Stack: (0x81c359d0 to 0x81c36000) [ 3.981517] 59c0: 80b2b668 80b2b5bc 000002e2 0000034e [ 3.989712] 59e0: 81c35a8c 816d98e8 81c35a14 7dbb550b 805bfcd0 810c35f0 81c73840 824addc0 [ 3.997906] 5a00: 00001000 816d9800 81c73894 81c73840 81c35a34 81c35a20 805eb138 805eadd8 [ 4.006099] 5a20: 810c35f0 00000045 81c35adc 81c35a38 80594188 805eb118 80d7c788 80dd1848 [ 4.014292] 5a40: 00000000 81c35a50 80dca950 811194d3 80dca7c4 80dca944 80dca91c 816d9800 [ 4.022485] 5a60: 81c34000 81c760a8 816d9800 80c58c98 810c35f0 816d98e8 00001000 00001000 [ 4.030678] 5a80: 00000000 00000000 8017712c 81c60000 00000002 00000001 00000000 00000000 [ 4.038870] 5aa0: 816d9900 816d9900 00000000 7dbb550b 805c700c 00000008 826282c8 826282c8 [ 4.047062] 5ac0: 00001000 81e1ce40 00001000 00000002 81c35bf4 81c35ae0 805d9694 80593fc0 [ 4.055255] 5ae0: 8017a970 80179ad8 00000179 00000000 81c35bcc 81c35b00 80177108 8017a950 [ 4.063447] 5b00: 00000000 81c35b10 81c34000 00000000 81004fd8 81010a38 00000000 00000059 [ 4.071639] 5b20: 816d98d4 81fbb718 00000013 826282c8 8017a940 81c35b40 81134448 00000400 [ 4.079831] 5b40: 00000178 00000000 e063b9c1 00000000 c2000049 00000040 00000000 00000008 [ 4.088024] 5b60: 82628300 82628380 00000000 00000000 81c34000 00000000 81fbb700 82628340 [ 4.096216] 5b80: 826283c0 00001000 00000000 00000010 816d9800 826282c0 801766f8 00000000 [ 4.104408] 5ba0: 00000000 81004fd8 00000049 00000000 00000000 00000001 80dcf940 80178de4 [ 4.112601] 5bc0: 81c35c0c 7dbb550b 80178de4 81fbb700 00000010 00000010 810c35f4 81e1ce40 [ 4.120793] 5be0: 81c40908 0000000c 81c35c64 81c35bf8 805a7f18 805d94a0 81c35c3c 816d9800 [ 4.128985] 5c00: 00000010 81c34000 81c35c2c 81c35c18 8012fce0 805be90c 81c35c3c 81c35c28 [ 4.137178] 5c20: 805be90c 80173210 81fbb600 81fbb6b4 81c35c5c 7dbb550b 81c35c64 81fbb700 [ 4.145370] 5c40: 816d9800 00000010 810c35f4 81e1ce40 81c40908 0000000c 81c35c84 81c35c68 [ 4.153565] 5c60: 805a8c78 805a7ed0 816d9800 81fbb700 00000010 00000000 81c35cac 81c35c88 [ 4.161758] 5c80: 805a8dc4 805a8b68 816d9800 00000000 816d9800 00000000 8179f810 810c42d0 [ 4.169950] 5ca0: 81c35ccc 81c35cb0 805e47b0 805a8d18 824aa240 81e1ea80 81c40908 81126b60 [ 4.178144] 5cc0: 81c35d14 81c35cd0 8060db1c 805e46cc 81c35d14 81c35ce0 80dd90f8 810c4d58 [ 4.186338] 5ce0: 80dd90dc 81fe9740 fffffffe 81fe9740 81e1ea80 00000000 810c4d6c 80c4b95c [ 4.194531] 5d00: 80dd9a3c 815c6810 81c35d34 81c35d18 8060dc9c 8060d8fc 8246b440 815c6800 [ 4.202724] 5d20: 815c6810 eefd8e00 81c35d44 81c35d38 8060dd80 8060dbec 81c35d6c 81c35d48 [ 4.210918] 5d40: 805e98a4 8060dd70 00000000 815c6810 810c45b0 81126e90 81126e90 80dd9a3c [ 4.219112] 5d60: 81c35d8c 81c35d70 80619574 805e9808 815c6810 00000000 810c45b0 81126e90 [ 4.227305] 5d80: 81c35db4 81c35d90 806168dc 80619514 80625df0 80623c80 815c6810 810c45b0 [ 4.235498] 5da0: 81c35e6c 815c6810 81c35dec 81c35db8 80616d04 80616800 81c35de4 81c35dc8 [ 4.243691] 5dc0: 808382b0 80b2f444 8116e310 8116e314 81c35e6c 815c6810 00000003 80dd9a3c [ 4.251884] 5de0: 81c35e14 81c35df0 80616ec8 80616c60 00000001 810c45b0 81c35e6c 815c6810 [ 4.260076] 5e00: 00000001 80dd9a3c 81c35e34 81c35e18 80617338 80616e90 00000000 81c35e6c [ 4.268269] 5e20: 80617284 81c34000 81c35e64 81c35e38 80614730 80617290 81c35e64 8171a06c [ 4.276461] 5e40: 81e220b8 7dbb550b 815c6810 81c34000 815c6854 81126e90 81c35e9c 81c35e68 [ 4.284654] 5e60: 8061673c 806146a8 8060f5e0 815c6810 00000001 7dbb550b 00000000 810c5080 [ 4.292847] 5e80: 810c5320 815c6810 81126e90 00000000 81c35eac 81c35ea0 80617554 80616650 [ 4.301040] 5ea0: 81c35ecc 81c35eb0 80615694 80617544 810c5080 810c5080 810c5094 81126e90 [ 4.309233] 5ec0: 81c35efc 81c35ed0 80615c6c 8061560c 80615bc0 810c50c0 817eeb00 81412800 [ 4.317425] 5ee0: 814c3000 00000000 814c300d 81119a60 81c35f3c 81c35f00 80141488 80615bcc [ 4.325618] 5f00: 81c60000 81c34000 81c35f24 81c35f18 80143078 817eeb00 81412800 817eeb18 [ 4.333811] 5f20: 81412818 81003d00 00000088 81412800 81c35f74 81c35f40 80141a48 80141298 [ 4.342005] 5f40: 81c35f74 81c34000 801481ac 817efa40 817efc00 801417d8 817eeb00 00000000 [ 4.350199] 5f60: 815a7e7c 81c34000 81c35fac 81c35f78 80149b1c 801417e4 817efc20 817efc20 [ 4.358391] 5f80: ffffe000 817efa40 801499a8 00000000 00000000 00000000 00000000 00000000 [ 4.366583] 5fa0: 00000000 81c35fb0 80100130 801499b4 00000000 00000000 00000000 00000000 [ 4.374774] 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 4.382966] 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000 [ 4.391155] Backtrace: [ 4.393613] [<805eadcc>] (stdp2690_get_edid) from [<805eb138>] (ge_b850v3_lvds_get_modes+0x2c/0x5c) [ 4.402691] r10:81c73840 r9:81c73894 r8:816d9800 r7:00001000 r6:824addc0 r5:81c73840 [ 4.410534] r4:810c35f0 [ 4.413073] [<805eb10c>] (ge_b850v3_lvds_get_modes) from [<80594188>] (drm_helper_probe_single_connector_modes+0x1d4/0x84c) [ 4.424240] r5:00000045 r4:810c35f0 [ 4.427822] [<80593fb4>] (drm_helper_probe_single_connector_modes) from [<805d9694>] (drm_client_modeset_probe+0x200/0x1384) [ 4.439074] r10:00000002 r9:00001000 r8:81e1ce40 r7:00001000 r6:826282c8 r5:826282c8 [ 4.446917] r4:00000008 [ 4.449455] [<805d9494>] (drm_client_modeset_probe) from [<805a7f18>] (__drm_fb_helper_initial_config_and_unlock+0x54/0x5b4) [ 4.460713] r10:0000000c r9:81c40908 r8:81e1ce40 r7:810c35f4 r6:00000010 r5:00000010 [ 4.468556] r4:81fbb700 [ 4.471095] [<805a7ec4>] (__drm_fb_helper_initial_config_and_unlock) from [<805a8c78>] (drm_fbdev_client_hotplug+0x11c/0x1b0) [ 4.482434] r10:0000000c r9:81c40908 r8:81e1ce40 r7:810c35f4 r6:00000010 r5:816d9800 [ 4.490276] r4:81fbb700 [ 4.492814] [<805a8b5c>] (drm_fbdev_client_hotplug) from [<805a8dc4>] (drm_fbdev_generic_setup+0xb8/0x1a4) [ 4.502494] r7:00000000 r6:00000010 r5:81fbb700 r4:816d9800 [ 4.508160] [<805a8d0c>] (drm_fbdev_generic_setup) from [<805e47b0>] (imx_drm_bind+0xf0/0x130) [ 4.516805] r7:810c42d0 r6:8179f810 r5:00000000 r4:816d9800 [ 4.522474] [<805e46c0>] (imx_drm_bind) from [<8060db1c>] (try_to_bring_up_master+0x22c/0x2f0) [ 4.531116] r7:81126b60 r6:81c40908 r5:81e1ea80 r4:824aa240 [ 4.536783] [<8060d8f0>] (try_to_bring_up_master) from [<8060dc9c>] (__component_add+0xbc/0x184) [ 4.545597] r10:815c6810 r9:80dd9a3c r8:80c4b95c r7:810c4d6c r6:00000000 r5:81e1ea80 [ 4.553440] r4:81fe9740 [ 4.555980] [<8060dbe0>] (__component_add) from [<8060dd80>] (component_add+0x1c/0x20) [ 4.563921] r7:eefd8e00 r6:815c6810 r5:815c6800 r4:8246b440 [ 4.569589] [<8060dd64>] (component_add) from [<805e98a4>] (dw_hdmi_imx_probe+0xa8/0xe8) [ 4.577702] [<805e97fc>] (dw_hdmi_imx_probe) from [<80619574>] (platform_probe+0x6c/0xc8) [ 4.585908] r9:80dd9a3c r8:81126e90 r7:81126e90 r6:810c45b0 r5:815c6810 r4:00000000 [ 4.593662] [<80619508>] (platform_probe) from [<806168dc>] (really_probe+0xe8/0x460) [ 4.601524] r7:81126e90 r6:810c45b0 r5:00000000 r4:815c6810 [ 4.607191] [<806167f4>] (really_probe) from [<80616d04>] (__driver_probe_device+0xb0/0x230) [ 4.615658] r7:815c6810 r6:81c35e6c r5:810c45b0 r4:815c6810 [ 4.621326] [<80616c54>] (__driver_probe_device) from [<80616ec8>] (driver_probe_device+0x44/0xe0) [ 4.630313] r9:80dd9a3c r8:00000003 r7:815c6810 r6:81c35e6c r5:8116e314 r4:8116e310 [ 4.638068] [<80616e84>] (driver_probe_device) from [<80617338>] (__device_attach_driver+0xb4/0x12c) [ 4.647227] r9:80dd9a3c r8:00000001 r7:815c6810 r6:81c35e6c r5:810c45b0 r4:00000001 [ 4.654981] [<80617284>] (__device_attach_driver) from [<80614730>] (bus_for_each_drv+0x94/0xd8) [ 4.663794] r7:81c34000 r6:80617284 r5:81c35e6c r4:00000000 [ 4.669461] [<8061469c>] (bus_for_each_drv) from [<8061673c>] (__device_attach+0xf8/0x190) [ 4.677753] r7:81126e90 r6:815c6854 r5:81c34000 r4:815c6810 [ 4.683419] [<80616644>] (__device_attach) from [<80617554>] (device_initial_probe+0x1c/0x20) [ 4.691971] r8:00000000 r7:81126e90 r6:815c6810 r5:810c5320 r4:810c5080 [ 4.698681] [<80617538>] (device_initial_probe) from [<80615694>] (bus_probe_device+0x94/0x9c) [ 4.707318] [<80615600>] (bus_probe_device) from [<80615c6c>] (deferred_probe_work_func+0xac/0xf0) [ 4.716305] r7:81126e90 r6:810c5094 r5:810c5080 r4:810c5080 [ 4.721973] [<80615bc0>] (deferred_probe_work_func) from [<80141488>] (process_one_work+0x1fc/0x54c) [ 4.731139] r10:81119a60 r9:814c300d r8:00000000 r7:814c3000 r6:81412800 r5:817eeb00 [ 4.738981] r4:810c50c0 r3:80615bc0 [ 4.742563] [<8014128c>] (process_one_work) from [<80141a48>] (worker_thread+0x270/0x570) [ 4.750765] r10:81412800 r9:00000088 r8:81003d00 r7:81412818 r6:817eeb18 r5:81412800 [ 4.758608] r4:817eeb00 [ 4.761147] [<801417d8>] (worker_thread) from [<80149b1c>] (kthread+0x174/0x190) [ 4.768574] r10:81c34000 r9:815a7e7c r8:00000000 r7:817eeb00 r6:801417d8 r5:817efc00 [ 4.776417] r4:817efa40 [ 4.778955] [<801499a8>] (kthread) from [<80100130>] (ret_from_fork+0x14/0x24) [ 4.786201] Exception stack(0x81c35fb0 to 0x81c35ff8) [ 4.791266] 5fa0: 00000000 00000000 00000000 00000000 [ 4.799459] 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 4.807651] 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000 [ 4.814279] r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:801499a8 [ 4.822120] r4:817efa40 [ 4.824664] Code: e3a02080 e593001c e3a01d33 e3a05000 (e5979018)
Split the registration from the STDP4028 probe routine and only perform registration once both the STDP4028 and STDP2690 have probed.
--- .../bridge/megachips-stdpxxxx-ge-b850v3-fw.c | 40 +++++++++++++------ 1 file changed, 28 insertions(+), 12 deletions(-)
drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c +28 -12
@@ -306,19 +306,10 @@ out:mutex_unlock (&ge_b850v3_lvds_dev_mutex); } -static int stdp4028_ge_b850v3_fw_probe (struct i2c_client *stdp4028_i2c, -const struct i2c_device_id *id) +static int ge_b850v3_register (void ) { +struct i2c_client *stdp4028_i2c = ge_b850v3_lvds_ptr->stdp4028_i2c;struct device *dev = &stdp4028_i2c->dev; -int ret; - - ret =ge_b850v3_lvds_init (dev); - -if (ret) -return ret; - - ge_b850v3_lvds_ptr->stdp4028_i2c = stdp4028_i2c; -i2c_set_clientdata (stdp4028_i2c, ge_b850v3_lvds_ptr);/* drm bridge initialization */ ge_b850v3_lvds_ptr->bridge.funcs = &ge_b850v3_lvds_funcs;
@@ -343,6 +334,27 @@ static int stdp4028_ge_b850v3_fw_probe(struct i2c_client *stdp4028_i2c, "ge-b850v3-lvds-dp", ge_b850v3_lvds_ptr); } +static int stdp4028_ge_b850v3_fw_probe (struct i2c_client *stdp4028_i2c, +const struct i2c_device_id *id) +{ +struct device *dev = &stdp4028_i2c->dev; +int ret; + + ret =ge_b850v3_lvds_init (dev); + +if (ret) +return ret; + + ge_b850v3_lvds_ptr->stdp4028_i2c = stdp4028_i2c; +i2c_set_clientdata (stdp4028_i2c, ge_b850v3_lvds_ptr); + +/* Only register after both bridges are probed */ +if (!ge_b850v3_lvds_ptr->stdp2690_i2c) +return 0 ; + +return ge_b850v3_register (); +} +static int stdp4028_ge_b850v3_fw_remove (struct i2c_client *stdp4028_i2c) {ge_b850v3_lvds_remove ();
@@ -386,7 +398,11 @@ static int stdp2690_ge_b850v3_fw_probe(struct i2c_client *stdp2690_i2c, ge_b850v3_lvds_ptr->stdp2690_i2c = stdp2690_i2c;i2c_set_clientdata (stdp2690_i2c, ge_b850v3_lvds_ptr); -return 0 ; +/* Only register after both bridges are probed */ +if (!ge_b850v3_lvds_ptr->stdp4028_i2c) +return 0 ; + +return ge_b850v3_register (); }static int stdp2690_ge_b850v3_fw_remove (struct i2c_client *stdp2690_i2c)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 500/846 mxser: keep only !tty test in ISR
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
[ Upstream commit 274ab58dc2b460cc474ffc7ccfcede4b2be1a3f5 ]
The others are superfluous with tty refcounting in place now. And they are racy in fact:
* tty_port_initialized() reports false for a small moment after interrupts are enabled.
* closing is 1 while the port is still alive.
The queues are flushed later during close anyway. So there is no need for this special handling. Actually, the ISR should not flush the queues. It should behave as every other driver, just queue the chars into tty buffer and go on. But this will be changed later. There is still a lot code depending on having tty in ISR (and not only tty_port).
--- drivers/tty/mxser.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/tty/mxser.c +1 -4
@@ -261,7 +261,6 @@ struct mxser_port {unsigned int xmit_head;unsigned int xmit_tail;unsigned int xmit_cnt; -int closing;spinlock_t slock; };
@@ -923,7 +922,6 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)return ;if (tty_port_close_start (port, tty, filp) ==0 )return ; - info->closing =1 ;mutex_lock (&port->mutex);mxser_close_port (port);mxser_flush_buffer (tty);
@@ -932,7 +930,6 @@ static void mxser_close(struct tty_struct *tty, struct file *filp)mxser_shutdown_port (port);tty_port_set_initialized (port,0 );mutex_unlock (&port->mutex); - info->closing =0 ;/* Right now the tty_port set is done outside of the close_end helper as we don't yet have everyone using refcounts */ tty_port_close_end (port, tty);
@@ -1693,7 +1690,7 @@ static bool mxser_port_isr(struct mxser_port *port) iir &=MOXA_MUST_IIR_MASK ; tty =tty_port_tty_get (&port->port); -if (!tty || port->closing || !tty_port_initialized (&port->port)) { +if (!tty) { status =inb (port->ioaddr +UART_LSR ); outb(MOXA_MUST_FCR_GDA_MODE_ENABLE | UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 501/846 tty: serial: imx: disable UCR4_OREN in .stop_rx() instead of .shutdown()
In reply to Greg Kroah-HartmanFrom: Fugang Duan <[email protected]>
[ Upstream commit 028e083832b06fdeeb290e1e57dc1f6702c4c215 ]
The UCR4_OREN should be disabled before disabling the uart receiver in .stop_rx() instead of in the .shutdown().
Otherwise, if we have the overrun error during the receiver disable process, the overrun interrupt will keep trigging until we disable the OREN interrupt in the .shutdown(), because the ORE status can only be cleared when read the rx FIFO or reset the controller. Although the called time between the receiver disable and OREN disable in .shutdown() is very short, there is still the risk of endless interrupt during this short period of time. So here change to disable OREN before the receiver been disabled in .stop_rx().
--- drivers/tty/serial/imx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/tty/serial/imx.c +5 -2
@@ -486,18 +486,21 @@ static void imx_uart_stop_tx(struct uart_port *port)static void imx_uart_stop_rx (struct uart_port *port) {struct imx_port *sport = (struct imx_port *)port; -u32 ucr1, ucr2; +u32 ucr1, ucr2, ucr4; ucr1 =imx_uart_readl (sport,UCR1 ); ucr2 =imx_uart_readl (sport,UCR2 ); + ucr4 =imx_uart_readl (sport,UCR4 );if (sport->dma_is_enabled) { ucr1 &= ~(UCR1_RXDMAEN |UCR1_ATDMAEN ); }else { ucr1 &= ~UCR1_RRDYEN ; ucr2 &= ~UCR2_ATEN ; + ucr4 &= ~UCR4_OREN ; }imx_uart_writel (sport, ucr1,UCR1 ); +imx_uart_writel (sport, ucr4,UCR4 ); ucr2 &= ~UCR2_RXEN ;imx_uart_writel (sport, ucr2,UCR2 );
@@ -1544,7 +1547,7 @@ static void imx_uart_shutdown(struct uart_port *port)imx_uart_writel (sport, ucr1,UCR1 ); ucr4 =imx_uart_readl (sport,UCR4 ); - ucr4 &= ~(UCR4_OREN |UCR4_TCEN ); + ucr4 &= ~UCR4_TCEN ;imx_uart_writel (sport, ucr4,UCR4 );spin_unlock_irqrestore (&sport->port.lock, flags);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 502/846 gpiolib: acpi: Do not set the IRQ type if the IRQ is already in use
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit bdfd6ab8fdccd8b138837efff66f4a1911496378 ]
If the IRQ is already in use, then acpi_dev_gpio_irq_get_by() really should not change the type underneath the current owner.
I specifically hit an issue with this an a Chuwi Hi8 Super (CWI509) Bay Trail tablet, when the Boot OS selection in the BIOS is set to Android. In this case _STA for a MAX17047 ACPI I2C device wrongly returns 0xf and the _CRS resources for this device include a GpioInt pointing to a GPIO already in use by an _AEI handler, with a different type then specified in the _CRS for the MAX17047 device. Leading to the acpi_dev_gpio_irq_get() call done by the i2c-core-acpi.c code changing the type breaking the _AEI handler.
Now this clearly is a bug in the DSDT of this tablet (in Android mode), but in general calling irq_set_irq_type() on an IRQ which already is in use seems like a bad idea.
--- drivers/gpio/gpiolib-acpi.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/gpio/gpiolib-acpi.c +11 -4
@@ -1059,10 +1059,17 @@ int acpi_dev_gpio_irq_get_by(struct acpi_device *adev, const char *name, int ind irq_flags =acpi_dev_get_irq_type (info.triggering, info.polarity); -/* Set type if specified and different than the current one */ -if (irq_flags !=IRQ_TYPE_NONE && - irq_flags !=irq_get_trigger_type (irq)) -irq_set_irq_type (irq, irq_flags); +/* +* If the IRQ is not already in use then set type +* if specified and different than the current one. +*/ +if (can_request_irq (irq, irq_flags)) { +if (irq_flags !=IRQ_TYPE_NONE && + irq_flags !=irq_get_trigger_type (irq)) +irq_set_irq_type (irq, irq_flags); + }else { +dev_dbg (&adev->dev,"IRQ %d already in use\n" , irq); + }return irq; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 503/846 HSI: core: Fix return freed object in hsi_new_client
In reply to Greg Kroah-HartmanFrom: Chengfeng Ye <[email protected]>
[ Upstream commit a1ee1c08fcd5af03187dcd41dcab12fd5b379555 ]
cl is freed on error of calling device_register, but this object is return later, which will cause uaf issue. Fix it by return NULL on error.
--- drivers/hsi/hsi_core.c | 1 + 1 file changed, 1 insertion(+)
drivers/hsi/hsi_core.c +1 -0
@@ -102,6 +102,7 @@ struct hsi_client *hsi_new_client(struct hsi_port *port,if (device_register (&cl->device) <0 ) {pr_err ("hsi: failed to register client: %s\n" , info->name);put_device (&cl->device); + goto err; }return cl;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 504/846 crypto: jitter - consider 32 LSB for APT
In reply to Greg Kroah-HartmanFrom: Stephan Müller <[email protected]>
[ Upstream commit 552d03a223eda3df84526ab2c1f4d82e15eaee7a ]
The APT compares the current time stamp with a pre-set value. The current code only considered the 4 LSB only. Yet, after reviews by mathematicians of the user space Jitter RNG version >= 3.1.0, it was concluded that the APT can be calculated on the 32 LSB of the time delta. Thi change is applied to the kernel.
This fixes a bug where an AMD EPYC fails this test as its RDTSC value contains zeros in the LSB. The most appropriate fix would have been to apply a GCD calculation and divide the time stamp by the GCD. Yet, this is a significant code change that will be considered for a future update. Note, tests showed that constantly the GCD always was 32 on these systems, i.e. the 5 LSB were always zero (thus failing the APT since it only considered the 4 LSB for its calculation).
--- crypto/jitterentropy.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
crypto/jitterentropy.c +1 -2
@@ -265,7 +265,6 @@ static int jent_stuck(struct rand_data *ec, __u64 current_delta) {__u64 delta2 =jent_delta (ec->last_delta, current_delta);__u64 delta3 =jent_delta (ec->last_delta2, delta2); -unsigned int delta_masked = current_delta &JENT_APT_WORD_MASK ; ec->last_delta = current_delta; ec->last_delta2 = delta2;
@@ -274,7 +273,7 @@ static int jent_stuck(struct rand_data *ec, __u64 current_delta)* Insert the result of the comparison of two back-to-back time * deltas. */ -jent_apt_insert (ec, delta_masked); +jent_apt_insert (ec, current_delta);if (!current_delta || !delta2 || !delta3) {/* RCT with a stuck bit */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 505/846 mwifiex: Fix skb_over_panic in mwifiex_usb_recv()
In reply to Greg Kroah-HartmanFrom: Zekun Shen <[email protected]>
[ Upstream commit 04d80663f67ccef893061b49ec8a42ff7045ae84 ]
Currently, with an unknown recv_type, mwifiex_usb_recv just return -1 without restoring the skb. Next time mwifiex_usb_rx_complete is invoked with the same skb, calling skb_put causes skb_over_panic.
The bug is triggerable with a compromised/malfunctioning usb device. After applying the patch, skb_over_panic no longer shows up with the same input.
Attached is the panic report from fuzzing.
skbuff: skb_over_panic: text:000000003bf1b5fa
len:2048 put:4 head:00000000dd6a115b data:000000000a9445d8 tail:0x844 end:0x840 dev:<NULL>
kernel BUG at net/core/skbuff.c:109!
invalid opcode: 0000 [#1] SMP KASAN NOPTI
CPU: 0 PID: 198 Comm: in:imklog Not tainted 5.6.0 #60 RIP: 0010:skb_panic+0x15f/0x161 Call Trace: <IRQ> ? mwifiex_usb_rx_complete+0x26b/0xfcd [mwifiex_usb] skb_put.cold+0x24/0x24 mwifiex_usb_rx_complete+0x26b/0xfcd [mwifiex_usb] __usb_hcd_giveback_urb+0x1e4/0x380 usb_giveback_urb_bh+0x241/0x4f0 ? __hrtimer_run_queues+0x316/0x740 ? __usb_hcd_giveback_urb+0x380/0x380 tasklet_action_common.isra.0+0x135/0x330 __do_softirq+0x18c/0x634 irq_exit+0x114/0x140 smp_apic_timer_interrupt+0xde/0x380 apic_timer_interrupt+0xf/0x20 </IRQ>
--- drivers/net/wireless/marvell/mwifiex/usb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/marvell/mwifiex/usb.c +2 -1
@@ -130,7 +130,8 @@ static int mwifiex_usb_recv(struct mwifiex_adapter *adapter,default :mwifiex_dbg (adapter,ERROR ,"unknown recv_type %#x\n" , recv_type); -return -1 ; + ret =-1 ; + goto exit_restore_skb; }break ;case MWIFIEX_USB_EP_DATA :
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 506/846 rsi: Fix use-after-free in rsi_rx_done_handler()
In reply to Greg Kroah-HartmanFrom: Zekun Shen <[email protected]>
[ Upstream commit b07e3c6ebc0c20c772c0f54042e430acec2945c3 ]
When freeing rx_cb->rx_skb, the pointer is not set to NULL, a later rsi_rx_done_handler call will try to read the freed address.
This bug will very likley lead to double free, although detected early as use-after-free bug.
The bug is triggerable with a compromised/malfunctional usb device. After applying the patch, the same input no longer triggers the use-after-free.
Attached is the kasan report from fuzzing.
BUG: KASAN: use-after-free in rsi_rx_done_handler+0x354/0x430 [rsi_usb] Read of size 4 at addr ffff8880188e5930 by task modprobe/231 Call Trace: <IRQ> dump_stack+0x76/0xa0 print_address_description.constprop.0+0x16/0x200 ? rsi_rx_done_handler+0x354/0x430 [rsi_usb] ? rsi_rx_done_handler+0x354/0x430 [rsi_usb] __kasan_report.cold+0x37/0x7c ? dma_direct_unmap_page+0x90/0x110 ? rsi_rx_done_handler+0x354/0x430 [rsi_usb] kasan_report+0xe/0x20 rsi_rx_done_handler+0x354/0x430 [rsi_usb] __usb_hcd_giveback_urb+0x1e4/0x380 usb_giveback_urb_bh+0x241/0x4f0 ? __usb_hcd_giveback_urb+0x380/0x380 ? apic_timer_interrupt+0xa/0x20 tasklet_action_common.isra.0+0x135/0x330 __do_softirq+0x18c/0x634 ? handle_irq_event+0xcd/0x157 ? handle_edge_irq+0x1eb/0x7b0 irq_exit+0x114/0x140 do_IRQ+0x91/0x1e0 common_interrupt+0xf/0xf </IRQ>
--- drivers/net/wireless/rsi/rsi_91x_usb.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/wireless/rsi/rsi_91x_usb.c +7 -1
@@ -269,8 +269,12 @@ static void rsi_rx_done_handler(struct urb *urb)struct rsi_91x_usbdev *dev = (struct rsi_91x_usbdev *)rx_cb->data;int status = -EINVAL ; +if (!rx_cb->rx_skb) +return ; +if (urb->status) {dev_kfree_skb (rx_cb->rx_skb); + rx_cb->rx_skb =NULL ;return ; }
@@ -294,8 +298,10 @@ out:if (rsi_rx_urb_submit (dev->priv, rx_cb->ep_num,GFP_ATOMIC ))rsi_dbg (ERR_ZONE ,"%s: Failed in urb submission" , __func__); -if (status) +if (status) {dev_kfree_skb (rx_cb->rx_skb); + rx_cb->rx_skb =NULL ; + } }static void rsi_rx_urb_kill (struct rsi_hw *adapter,u8 ep_num)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 507/846 rsi: Fix out-of-bounds read in rsi_read_pkt()
In reply to Greg Kroah-HartmanFrom: Zekun Shen <[email protected]>
[ Upstream commit f1cb3476e48b60c450ec3a1d7da0805bffc6e43a ]
rsi_get_* functions rely on an offset variable from usb input. The size of usb input is RSI_MAX_RX_USB_PKT_SIZE(3000), while 2-byte offset can be up to 0xFFFF. Thus a large offset can cause out-of-bounds read.
The patch adds a bound checking condition when rcv_pkt_len is 0, indicating it's USB. It's unclear whether this is triggerable from other type of bus. The following check might help in that case. offset > rcv_pkt_len - FRAME_DESC_SZ
The bug is trigerrable with conpromised/malfunctioning USB devices. I tested the patch with the crashing input and got no more bug report.
Attached is the KASAN report from fuzzing.
BUG: KASAN: slab-out-of-bounds in rsi_read_pkt+0x42e/0x500 [rsi_91x] Read of size 2 at addr ffff888019439fdb by task RX-Thread/227 CPU: 0 PID: 227 Comm: RX-Thread Not tainted 5.6.0 #66 Call Trace: dump_stack+0x76/0xa0 print_address_description.constprop.0+0x16/0x200 ? rsi_read_pkt+0x42e/0x500 [rsi_91x] ? rsi_read_pkt+0x42e/0x500 [rsi_91x] __kasan_report.cold+0x37/0x7c ? rsi_read_pkt+0x42e/0x500 [rsi_91x] kasan_report+0xe/0x20 rsi_read_pkt+0x42e/0x500 [rsi_91x] rsi_usb_rx_thread+0x1b1/0x2fc [rsi_usb] ? rsi_probe+0x16a0/0x16a0 [rsi_usb] ? _raw_spin_lock_irqsave+0x7b/0xd0 ? _raw_spin_trylock_bh+0x120/0x120 ? __wake_up_common+0x10b/0x520 ? rsi_probe+0x16a0/0x16a0 [rsi_usb] kthread+0x2b5/0x3b0 ? kthread_create_on_node+0xd0/0xd0 ret_from_fork+0x22/0x40
--- drivers/net/wireless/rsi/rsi_91x_main.c | 4 ++++ drivers/net/wireless/rsi/rsi_91x_usb.c | 1 - drivers/net/wireless/rsi/rsi_usb.h | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-)
drivers/net/wireless/rsi/rsi_91x_main.c +4 -0
@@ -23,6 +23,7 @@#include "rsi_common.h" #include "rsi_coex.h" #include "rsi_hal.h" +#include "rsi_usb.h" u32 rsi_zone_enabled =/* INFO_ZONE | INIT_ZONE |
@@ -168,6 +169,9 @@ int rsi_read_pkt(struct rsi_common *common, u8 *rx_pkt, s32 rcv_pkt_len) frame_desc = &rx_pkt[index]; actual_length = *(u16 *)&frame_desc[0 ]; offset = *(u16 *)&frame_desc[2 ]; +if (!rcv_pkt_len && offset > +RSI_MAX_RX_USB_PKT_SIZE -FRAME_DESC_SZ ) + goto fail; queueno =rsi_get_queueno (frame_desc, offset); length =rsi_get_length (frame_desc, offset);
drivers/net/wireless/rsi/rsi_91x_usb.c +0 -1
@@ -330,7 +330,6 @@ static int rsi_rx_urb_submit(struct rsi_hw *adapter, u8 ep_num, gfp_t mem_flags)struct sk_buff *skb;u8 dword_align_bytes =0 ; -#define RSI_MAX_RX_USB_PKT_SIZE 3000 skb =dev_alloc_skb (RSI_MAX_RX_USB_PKT_SIZE );if (!skb)return -ENOMEM ;
drivers/net/wireless/rsi/rsi_usb.h +2 -0
@@ -44,6 +44,8 @@#define RSI_USB_BUF_SIZE 4096#define RSI_USB_CTRL_BUF_SIZE 0x04 +#define RSI_MAX_RX_USB_PKT_SIZE 3000 +struct rx_usb_ctrl_block {u8 *data;struct urb *rx_urb;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 508/846 ath11k: Avoid NULL ptr access during mgmt tx cleanup
In reply to Greg Kroah-HartmanFrom: Sriram R <[email protected]>
[ Upstream commit a93789ae541c7d5c1c2a4942013adb6bcc5e2848 ]
Currently 'ar' reference is not added in skb_cb during WMI mgmt tx. Though this is generally not used during tx completion callbacks, on interface removal the remaining idr cleanup callback uses the ar ptr from skb_cb from mgmt txmgmt_idr. Hence fill them during tx call for proper usage.
Also free the skb which is missing currently in these callbacks.
Crash_info:
[19282.489476] Unable to handle kernel NULL pointer dereference at virtual address 00000000 [19282.489515] pgd = 91eb8000 [19282.496702] [00000000] *pgd=00000000 [19282.502524] Internal error: Oops: 5 [#1] PREEMPT SMP ARM [19282.783728] PC is at ath11k_mac_vif_txmgmt_idr_remove+0x28/0xd8 [ath11k] [19282.789170] LR is at idr_for_each+0xa0/0xc8
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.5.0.1-00729-QCAHKSWPL_SILICONZ-3 v2
--- drivers/net/wireless/ath/ath11k/mac.c | 35 +++++++++++++++------------ 1 file changed, 20 insertions(+), 15 deletions(-)
drivers/net/wireless/ath/ath11k/mac.c +20 -15
@@ -1,6 +1,7 @@// SPDX-License-Identifier: BSD-3-Clause-Clear /* * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. +* Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. */ #include <net/mac80211.h>
@@ -4136,23 +4137,32 @@ static int __ath11k_set_antenna(struct ath11k *ar, u32 tx_ant, u32 rx_ant)return 0 ; } -int ath11k_mac_tx_mgmt_pending_free (int buf_id,void *skb,void *ctx) +static void ath11k_mac_tx_mgmt_free (struct ath11k *ar,int buf_id) { -struct sk_buff *msdu = skb; +struct sk_buff *msdu;struct ieee80211_tx_info *info; -struct ath11k *ar = ctx; -struct ath11k_base *ab = ar->ab;spin_lock_bh (&ar->txmgmt_idr_lock); -idr_remove (&ar->txmgmt_idr, buf_id); + msdu =idr_remove (&ar->txmgmt_idr, buf_id);spin_unlock_bh (&ar->txmgmt_idr_lock); -dma_unmap_single (ab->dev,ATH11K_SKB_CB (msdu)->paddr, msdu->len, + +if (!msdu) +return ; + +dma_unmap_single (ar->ab->dev,ATH11K_SKB_CB (msdu)->paddr, msdu->len,DMA_TO_DEVICE ); info =IEEE80211_SKB_CB (msdu);memset (&info->status,0 ,sizeof (info->status));ieee80211_free_txskb (ar->hw, msdu); +} + +int ath11k_mac_tx_mgmt_pending_free (int buf_id,void *skb,void *ctx) +{ +struct ath11k *ar = ctx; + +ath11k_mac_tx_mgmt_free (ar, buf_id);return 0 ; }
@@ -4161,17 +4171,10 @@ static int ath11k_mac_vif_txmgmt_idr_remove(int buf_id, void *skb, void *ctx) {struct ieee80211_vif *vif = ctx;struct ath11k_skb_cb *skb_cb =ATH11K_SKB_CB ((struct sk_buff *)skb); -struct sk_buff *msdu = skb;struct ath11k *ar = skb_cb->ar; -struct ath11k_base *ab = ar->ab; -if (skb_cb->vif == vif) { -spin_lock_bh (&ar->txmgmt_idr_lock); -idr_remove (&ar->txmgmt_idr, buf_id); -spin_unlock_bh (&ar->txmgmt_idr_lock); -dma_unmap_single (ab->dev, skb_cb->paddr, msdu->len, -DMA_TO_DEVICE ); - } +if (skb_cb->vif == vif) +ath11k_mac_tx_mgmt_free (ar, buf_id);return 0 ; }
@@ -4186,6 +4189,8 @@ static int ath11k_mac_mgmt_tx_wmi(struct ath11k *ar, struct ath11k_vif *arvif,int buf_id;int ret; +ATH11K_SKB_CB (skb)->ar = ar; +spin_lock_bh (&ar->txmgmt_idr_lock); buf_id =idr_alloc (&ar->txmgmt_idr, skb,0 ,ATH11K_TX_MGMT_NUM_PENDING_MAX ,GFP_ATOMIC );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 509/846 media: venus: avoid calling core_clk_setrate() concurrently during concurrent video sessions
In reply to Greg Kroah-HartmanFrom: Mansur Alisha Shaik <[email protected]>
[ Upstream commit 91f2b7d269e5c885c38c7ffa261f5276bd42f907 ]
In existing implementation, core_clk_setrate() is getting called concurrently in concurrent video sessions. Before the previous call to core_clk_setrate returns, new call to core_clk_setrate is invoked from another video session running concurrently. This results in latest calculated frequency being set (higher/lower) instead of actual frequency required for that video session. It also results in stability crashes mention below. These resources are specific to video core, hence keeping under core lock would ensure that they are estimated for all running video sessions and called once for the video core.
Crash logs:
[ 1.900089] WARNING: CPU: 4 PID: 1 at drivers/opp/debugfs.c:33 opp_debug_remove_one+0x2c/0x48 [ 1.908493] Modules linked in: [ 1.911524] CPU: 4 PID: 1 Comm: swapper/0 Not tainted 5.10.67 #35 f8edb8c30cf2dd6838495dd9ef9be47af7f5f60c [ 1.921036] Hardware name: Qualcomm Technologies, Inc. sc7280 IDP SKU2 platform (DT) [ 1.928673] pstate: 60800009 (nZCv daif -PAN +UAO -TCO BTYPE=--) [ 1.934608] pc : opp_debug_remove_one+0x2c/0x48 [ 1.939080] lr : opp_debug_remove_one+0x2c/0x48 [ 1.943560] sp : ffffffc011d7b7f0 [ 1.946836] pmr_save: 000000e0 [ 1.949854] x29: ffffffc011d7b7f0 x28: ffffffc010733bbc [ 1.955104] x27: ffffffc010733ba8 x26: ffffff8083cedd00 [ 1.960355] x25: 0000000000000001 x24: 0000000000000000 [ 1.965603] x23: ffffff8083cc2878 x22: ffffff8083ceb900 [ 1.970852] x21: ffffff8083ceb910 x20: ffffff8083cc2800 [ 1.976101] x19: ffffff8083ceb900 x18: 00000000ffff0a10 [ 1.981352] x17: ffffff80837a5620 x16: 00000000000000ec [ 1.986601] x15: ffffffc010519ad4 x14: 0000000000000003 [ 1.991849] x13: 0000000000000004 x12: 0000000000000001 [ 1.997100] x11: c0000000ffffdfff x10: 00000000ffffffff [ 2.002348] x9 : d2627c580300dc00 x8 : d2627c580300dc00 [ 2.007596] x7 : 0720072007200720 x6 : ffffff80802ecf00 [ 2.012845] x5 : 0000000000190004 x4 : 0000000000000000 [ 2.018094] x3 : ffffffc011d7b478 x2 : ffffffc011d7b480 [ 2.023343] x1 : 00000000ffffdfff x0 : 0000000000000017 [ 2.028594] Call trace: [ 2.031022] opp_debug_remove_one+0x2c/0x48 [ 2.035160] dev_pm_opp_put+0x94/0xb0 [ 2.038780] _opp_remove_all+0x7c/0xc8 [ 2.042486] _opp_remove_all_static+0x54/0x7c [ 2.046796] dev_pm_opp_remove_table+0x74/0x98 [ 2.051183] devm_pm_opp_of_table_release+0x18/0x24 [ 2.056001] devm_action_release+0x1c/0x28 [ 2.060053] release_nodes+0x23c/0x2b8 [ 2.063760] devres_release_group+0xcc/0xd0 [ 2.067900] component_bind+0xac/0x168 [ 2.071608] component_bind_all+0x98/0x124 [ 2.075664] msm_drm_bind+0x1e8/0x678 [ 2.079287] try_to_bring_up_master+0x60/0x134 [ 2.083674] component_master_add_with_match+0xd8/0x120 [ 2.088834] msm_pdev_probe+0x20c/0x2a0 [ 2.092629] platform_drv_probe+0x9c/0xbc [ 2.096598] really_probe+0x11c/0x46c [ 2.100217] driver_probe_device+0x8c/0xf0 [ 2.104270] device_driver_attach+0x54/0x78 [ 2.108407] __driver_attach+0x48/0x148 [ 2.112201] bus_for_each_dev+0x88/0xd4 [ 2.115998] driver_attach+0x2c/0x38 [ 2.119534] bus_add_driver+0x10c/0x200 [ 2.123330] driver_register+0x6c/0x104 [ 2.127122] __platform_driver_register+0x4c/0x58 [ 2.131767] msm_drm_register+0x6c/0x70 [ 2.135560] do_one_initcall+0x64/0x23c [ 2.139357] do_initcall_level+0xac/0x15c [ 2.143321] do_initcalls+0x5c/0x9c [ 2.146778] do_basic_setup+0x2c/0x38 [ 2.150401] kernel_init_freeable+0xf8/0x15c [ 2.154622] kernel_init+0x1c/0x11c [ 2.158079] ret_from_fork+0x10/0x30 [ 2.161615] ---[ end trace a2cc45a0f784b212 ]---
[ 2.166272] Removing OPP: 300000000
--- .../media/platform/qcom/venus/pm_helpers.c | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/media/platform/qcom/venus/pm_helpers.c +14 -14
@@ -163,14 +163,12 @@ static u32 load_per_type(struct venus_core *core, u32 session_type)struct venus_inst *inst =NULL ;u32 mbs_per_sec =0 ; -mutex_lock (&core->lock);list_for_each_entry (inst, &core->instances, list) {if (inst->session_type != session_type)continue ; mbs_per_sec +=load_per_instance (inst); } -mutex_unlock (&core->lock);return mbs_per_sec; }
@@ -219,14 +217,12 @@ static int load_scale_bw(struct venus_core *core)struct venus_inst *inst =NULL ;u32 mbs_per_sec, avg, peak, total_avg =0 , total_peak =0 ; -mutex_lock (&core->lock);list_for_each_entry (inst, &core->instances, list) { mbs_per_sec =load_per_instance (inst);mbs_to_bw (inst, mbs_per_sec, &avg, &peak); total_avg += avg; total_peak += peak; } -mutex_unlock (&core->lock);/* * keep minimum bandwidth vote for "video-mem" path,
@@ -253,8 +249,9 @@ static int load_scale_v1(struct venus_inst *inst)struct device *dev = core->dev;u32 mbs_per_sec;unsigned int i; -int ret; +int ret =0 ; +mutex_lock (&core->lock); mbs_per_sec =load_per_type (core,VIDC_SESSION_TYPE_ENC ) +load_per_type (core,VIDC_SESSION_TYPE_DEC );
@@ -279,17 +276,19 @@ set_freq:if (ret) {dev_err (dev,"failed to set clock rate %lu (%d)\n" , freq, ret); -return ret; + goto exit; } ret =load_scale_bw (core);if (ret) {dev_err (dev,"failed to set bandwidth (%d)\n" , ret); -return ret; + goto exit; } -return 0 ; +exit: +mutex_unlock (&core->lock); +return ret; }static int core_get_v1 (struct venus_core *core)
@@ -1116,13 +1115,13 @@ static int load_scale_v4(struct venus_inst *inst)struct device *dev = core->dev;unsigned long freq =0 , freq_core1 =0 , freq_core2 =0 ;unsigned long filled_len =0 ; -int i, ret; +int i, ret =0 ;for (i =0 ; i < inst->num_input_bufs; i++) filled_len =max (filled_len, inst->payloads[i]);if (inst->session_type ==VIDC_SESSION_TYPE_DEC && !filled_len) -return 0 ; +return ret; freq =calculate_inst_freq (inst, filled_len); inst->clk_data.freq = freq;
@@ -1138,7 +1137,6 @@ static int load_scale_v4(struct venus_inst *inst) freq_core2 += inst->clk_data.freq; } } -mutex_unlock (&core->lock); freq =max (freq_core1, freq_core2);
@@ -1162,17 +1160,19 @@ set_freq:if (ret) {dev_err (dev,"failed to set clock rate %lu (%d)\n" , freq, ret); -return ret; + goto exit; } ret =load_scale_bw (core);if (ret) {dev_err (dev,"failed to set bandwidth (%d)\n" , ret); -return ret; + goto exit; } -return 0 ; +exit: +mutex_unlock (&core->lock); +return ret; }static const struct venus_pm_ops pm_ops_v4 = {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 510/846 regulator: da9121: Prevent current limit change when enabled
In reply to Greg Kroah-HartmanFrom: Adam Ward <[email protected]>
[ Upstream commit 24f0853228f3b98f1ef08d5824376c69bb8124d2 ]
Prevent changing current limit when enabled as a precaution against possibile instability due to tight integration with switching cycle
--- drivers/regulator/da9121-regulator.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/regulator/da9121-regulator.c +5 -0
@@ -253,6 +253,11 @@ static int da9121_set_current_limit(struct regulator_dev *rdev, goto error; } +if (rdev->desc->ops->is_enabled (rdev)) { + ret = -EBUSY ; + goto error; + } + ret =da9121_ceiling_selector (rdev, min_ua, max_ua, &sel);if (ret <0 ) goto error;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 511/846 drm/vmwgfx: Release ttm memory if probe fails
In reply to Greg Kroah-HartmanFrom: Zack Rusin <[email protected]>
[ Upstream commit 28b5f3b6121b7db2a44be499cfca0b6b801588b6 ]
The ttm mem global state was leaking if the vmwgfx driver load failed.
In case of a driver load failure we have to make sure we also release the ttm mem global state.
--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +16 -10
@@ -1617,34 +1617,40 @@ static int vmw_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ret =drm_aperture_remove_conflicting_pci_framebuffers (pdev, &driver);if (ret) -return ret; + goto out_error; ret =pcim_enable_device (pdev);if (ret) -return ret; + goto out_error; vmw =devm_drm_dev_alloc (&pdev->dev, &driver, struct vmw_private, drm); -if (IS_ERR (vmw)) -return PTR_ERR (vmw); +if (IS_ERR (vmw)) { + ret =PTR_ERR (vmw); + goto out_error; + }pci_set_drvdata (pdev, &vmw->drm); ret =ttm_mem_global_init (&ttm_mem_glob, &pdev->dev);if (ret) -return ret; + goto out_error; ret =vmw_driver_load (vmw, ent->device);if (ret) -return ret; + goto out_release; ret =drm_dev_register (&vmw->drm,0 ); -if (ret) { -vmw_driver_unload (&vmw->drm); -return ret; - } +if (ret) + goto out_unload;return 0 ; +out_unload: +vmw_driver_unload (&vmw->drm); +out_release: +ttm_mem_global_release (&ttm_mem_glob); +out_error: +return ret; }static int __init vmwgfx_init (void )
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 512/846 drm/vmwgfx: Introduce a new placement for MOB page tables
In reply to Greg Kroah-HartmanFrom: Zack Rusin <[email protected]>
[ Upstream commit f6be23264bbac88d1e2bb39658e1b8a397e3f46d ]
For larger (bigger than a page) and noncontiguous mobs we have to create page tables that allow the host to find the memory. Those page tables just used regular system memory. Unfortunately in TTM those BO's are not allowed to be busy thus can't be fenced and we have to fence those bo's because we don't want to destroy the page tables while the host is still executing the command buffers which might be accessing them.
To solve it we introduce a new placement VMW_PL_SYSTEM which is very similar to TTM_PL_SYSTEM except that it allows fencing. This fixes kernel oops'es during unloading of the driver (and pci hot remove/add) which were caused by busy BO's in TTM_PL_SYSTEM being present in the delayed deletion list in TTM (TTM_PL_SYSTEM manager is destroyed before the delayed deletions are executed)
--- drivers/gpu/drm/vmwgfx/Makefile | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 14 ++- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 12 ++- .../gpu/drm/vmwgfx/vmwgfx_system_manager.c | 90 +++++++++++++++++++ drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 58 ++++++------ 5 files changed, 138 insertions(+), 38 deletions(-) create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_system_manager.c
drivers/gpu/drm/vmwgfx/Makefile +1 -1
@@ -9,7 +9,7 @@ vmwgfx-y := vmwgfx_execbuf.o vmwgfx_gmr.o vmwgfx_kms.o vmwgfx_drv.o \ vmwgfx_cotable.o vmwgfx_so.o vmwgfx_binding.o vmwgfx_msg.o \ vmwgfx_simple_resource.o vmwgfx_va.o vmwgfx_blit.o \ vmwgfx_validation.o vmwgfx_page_dirty.o vmwgfx_streamoutput.o \ - vmwgfx_devcaps.o ttm_object.o ttm_memory.o + vmwgfx_devcaps.o ttm_object.o ttm_memory.o vmwgfx_system_manager.o vmwgfx-$(CONFIG_DRM_FBDEV_EMULATION) += vmwgfx_fb.o vmwgfx-$(CONFIG_TRANSPARENT_HUGEPAGE) += vmwgfx_thp.o
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +12 -2
@@ -1071,6 +1071,12 @@ static int vmw_driver_load(struct vmw_private *dev_priv, u32 pci_id) "3D will be disabled.\n"); dev_priv->has_mob = false; } +if (vmw_sys_man_init (dev_priv) !=0 ) { +drm_info (&dev_priv->drm, +"No MOB page table memory available. " +"3D will be disabled.\n" ); + dev_priv->has_mob = false; + } }if (dev_priv->has_mob && (dev_priv->capabilities &SVGA_CAP_DX )) {
@@ -1121,8 +1127,10 @@ out_no_fifo:vmw_overlay_close (dev_priv);vmw_kms_close (dev_priv); out_no_kms: -if (dev_priv->has_mob) +if (dev_priv->has_mob) {vmw_gmrid_man_fini (dev_priv,VMW_PL_MOB ); +vmw_sys_man_fini (dev_priv); + }if (dev_priv->has_gmr)vmw_gmrid_man_fini (dev_priv,VMW_PL_GMR );vmw_devcaps_destroy (dev_priv);
@@ -1172,8 +1180,10 @@ static void vmw_driver_unload(struct drm_device *dev)vmw_gmrid_man_fini (dev_priv,VMW_PL_GMR );vmw_release_device_early (dev_priv); -if (dev_priv->has_mob) +if (dev_priv->has_mob) {vmw_gmrid_man_fini (dev_priv,VMW_PL_MOB ); +vmw_sys_man_fini (dev_priv); + }vmw_devcaps_destroy (dev_priv);vmw_vram_manager_fini (dev_priv);ttm_device_fini (&dev_priv->bdev);
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h +9 -3
@@ -82,8 +82,9 @@ VMWGFX_NUM_GB_SURFACE +\ VMWGFX_NUM_GB_SCREEN_TARGET) -#define VMW_PL_GMR (TTM_PL_PRIV + 0) -#define VMW_PL_MOB (TTM_PL_PRIV + 1) +#define VMW_PL_GMR (TTM_PL_PRIV + 0) +#define VMW_PL_MOB (TTM_PL_PRIV + 1) +#define VMW_PL_SYSTEM (TTM_PL_PRIV + 2)#define VMW_RES_CONTEXT ttm_driver_type0#define VMW_RES_SURFACE ttm_driver_type1
@@ -1039,7 +1040,6 @@ extern struct ttm_placement vmw_vram_placement;extern struct ttm_placement vmw_vram_sys_placement;extern struct ttm_placement vmw_vram_gmr_placement;extern struct ttm_placement vmw_sys_placement; -extern struct ttm_placement vmw_evictable_placement;extern struct ttm_placement vmw_srf_placement;extern struct ttm_placement vmw_mob_placement;extern struct ttm_placement vmw_nonfixed_placement;
@@ -1251,6 +1251,12 @@ int vmw_overlay_num_free_overlays(struct vmw_private *dev_priv);int vmw_gmrid_man_init (struct vmw_private *dev_priv,int type);void vmw_gmrid_man_fini (struct vmw_private *dev_priv,int type); +/** +* System memory manager +*/ +int vmw_sys_man_init (struct vmw_private *dev_priv); +void vmw_sys_man_fini (struct vmw_private *dev_priv); +/** * Prime - vmwgfx_prime.c */
drivers/gpu/drm/vmwgfx/vmwgfx_system_manager.c new file +90 -0
90 lines not on this page · raw message
drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c +26 -32
118 lines not on this page · raw message
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 513/846 ACPI / x86: Drop PWM2 device on Lenovo Yoga Book from always present table
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit d431dfb764b145369be820fcdfd50f2159b9bbc2 ]
It turns out that there is a WMI object which controls the PWM2 device used for the keyboard backlight and that WMI object also provides some other useful functionality.
The upcoming lenovo-yogabook-wmi driver will offer both backlight control and the other functionality, so there no longer is a need to have the lpss-pwm driver binding to PWM2 for backlight control; and this is now actually undesirable because this will cause both the WMI code and the lpss-pwm driver to poke at the same PWM controller.
Drop the always-present quirk for the PWM2 ACPI-device, so that the
lpss-pwm controller will no longer bind to it.
--- drivers/acpi/x86/utils.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/acpi/x86/utils.c +0 -4
@@ -54,10 +54,6 @@ static const struct always_present_id always_present_ids[] = {ENTRY ("80860F09" ,"1" ,X86_MATCH (ATOM_SILVERMONT ), {}), ENTRY("80862288", "1", X86_MATCH(ATOM_AIRMONT), {}), -/* Lenovo Yoga Book uses PWM2 for keyboard backlight control */ -ENTRY ("80862289" ,"2" ,X86_MATCH (ATOM_AIRMONT ), { - DMI_MATCH(DMI_PRODUCT_NAME, "Lenovo YB1-X9"), - }),/* * The INT0002 device is necessary to clear wakeup interrupt sources * on Cherry Trail devices, without it we get nobody cared IRQ msgs.
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 514/846 ACPI: Change acpi_device_always_present() into acpi_device_override_status()
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 1a68b346a2c9969c05e80a3b99a9ab160b5655c0 ]
Currently, acpi_bus_get_status() calls acpi_device_always_present() to allow platform quirks to override the _STA return to report that a device is present (status = ACPI_STA_DEFAULT) independent of the _STA return.
In some cases it might also be useful to have the opposite functionality and have a platform quirk which marks a device as not present (status = 0) to work around ACPI table bugs.
Change acpi_device_always_present() into a more generic acpi_device_override_status() function to allow this.
--- drivers/acpi/bus.c | 4 +-- drivers/acpi/x86/utils.c | 64 +++++++++++++++++++++++----------------- include/acpi/acpi_bus.h | 5 ++-- 3 files changed, 42 insertions(+), 31 deletions(-)
drivers/acpi/bus.c +2 -2
@@ -98,8 +98,8 @@ int acpi_bus_get_status(struct acpi_device *device)acpi_status status;unsigned long long sta; -if (acpi_device_always_present (device)) { -acpi_set_device_status (device,ACPI_STA_DEFAULT ); +if (acpi_device_override_status (device, &sta)) { +acpi_set_device_status (device, sta);return 0 ; }
drivers/acpi/x86/utils.c +37 -27
136 lines not on this page · raw message
include/acpi/acpi_bus.h +3 -2
@@ -613,9 +613,10 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state);int acpi_disable_wakeup_device_power (struct acpi_device *dev);#ifdef CONFIG_X86 -bool acpi_device_always_present (struct acpi_device *adev); +bool acpi_device_override_status (struct acpi_device *adev,unsigned long long *status);#else -static inline bool acpi_device_always_present (struct acpi_device *adev) +static inline bool acpi_device_override_status (struct acpi_device *adev, +unsigned long long *status) {return false; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 515/846 ACPI / x86: Allow specifying acpi_device_override_status() quirks by path
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit ba46e42e925b5d09b4e441f8de3db119cc7df58f ]
Not all ACPI-devices have a HID + UID, allow specifying quirks for acpi_device_override_status() by path too.
Note this moves the path/HID+UID check to after the CPU + DMI checks since the path lookup is somewhat costly.
This way this lookup is only done on devices where the other checks match.
--- drivers/acpi/x86/utils.c | 42 ++++++++++++++++++++++++++++++---------- 1 file changed, 32 insertions(+), 10 deletions(-)
drivers/acpi/x86/utils.c +32 -10
@@ -38,22 +38,30 @@ struct override_status_id {struct x86_cpu_id cpu_ids[2 ];struct dmi_system_id dmi_ids[2 ];/* Optional */ const char *uid; +const char *path;unsigned long long status; }; -#define ENTRY(status, hid, uid, cpu_model, dmi...) { \ +#define ENTRY(status, hid, uid, path, cpu_model, dmi...) { \ { { hid, }, {} }, \ { X86_MATCH_INTEL_FAM6_MODEL(cpu_model, NULL), {} }, \ { { .matches = dmi }, {} }, \ uid, \ + path, \ status, \ } #define PRESENT_ENTRY_HID(hid, uid, cpu_model, dmi...) \ - ENTRY(ACPI_STA_DEFAULT, hid, uid, cpu_model, dmi) + ENTRY(ACPI_STA_DEFAULT, hid, uid, NULL, cpu_model, dmi) #define NOT_PRESENT_ENTRY_HID(hid, uid, cpu_model, dmi...) \ - ENTRY(0, hid, uid, cpu_model, dmi) + ENTRY(0, hid, uid, NULL, cpu_model, dmi) + +#define PRESENT_ENTRY_PATH(path, cpu_model, dmi...) \ + ENTRY(ACPI_STA_DEFAULT, "", NULL, path, cpu_model, dmi) + +#define NOT_PRESENT_ENTRY_PATH(path, cpu_model, dmi...) \ + ENTRY(0, "", NULL, path, cpu_model, dmi)static const struct override_status_id override_status_ids[] = {/*
@@ -120,13 +128,6 @@ bool acpi_device_override_status(struct acpi_device *adev, unsigned long long *sunsigned int i;for (i =0 ; i <ARRAY_SIZE (override_status_ids); i++) { -if (acpi_match_device_ids (adev, override_status_ids[i].hid)) -continue ; - -if (!adev->pnp.unique_id || -strcmp (adev->pnp.unique_id, override_status_ids[i].uid)) -continue ; -if (!x86_match_cpu (override_status_ids[i].cpu_ids))continue ;
@@ -134,6 +135,27 @@ bool acpi_device_override_status(struct acpi_device *adev, unsigned long long *s !dmi_check_system(override_status_ids[i].dmi_ids)) continue; +if (override_status_ids[i].path) { +struct acpi_buffer path = {ACPI_ALLOCATE_BUFFER ,NULL }; +bool match; + +if (acpi_get_name (adev->handle,ACPI_FULL_PATHNAME , &path)) +continue ; + + match =strcmp ((char *)path.pointer, override_status_ids[i].path) ==0 ; +kfree (path.pointer); + +if (!match) +continue ; + }else { +if (acpi_match_device_ids (adev, override_status_ids[i].hid)) +continue ; + +if (!adev->pnp.unique_id || +strcmp (adev->pnp.unique_id, override_status_ids[i].uid)) +continue ; + } + *status = override_status_ids[i].status; ret = true;break ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 516/846 ACPI / x86: Add not-present quirk for the PCI0.SDHB.BRC1 device on the GPD win
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 57d2dbf710d832841872fb15ebb79429cab90fae ]
The GPD win and its sibling the GPD pocket (99% the same electronics in a different case) use a PCI wifi card. But the ACPI tables on both variants contain a bug where the SDIO MMC controller for SDIO wifi cards is enabled despite this. This SDIO MMC controller has a PCI0.SDHB.BRC1 child-device which _PS3 method sets a GPIO causing the PCI wifi card to turn off.
At the moment there is a pretty ugly kludge in the sdhci-acpi.c code, just to work around the bug in the DSDT of this single design. This can be solved cleaner/simply with a quirk overriding the _STA return of the broken PCI0.SDHB.BRC1 PCI0.SDHB.BRC1 child with a status value of 0, so that its power_manageable flag gets cleared, avoiding this problem.
Note that even though it is not used, the _STA method for the MMC controller is deliberately not overridden. If the status of the MMC controller were forced to 0 it would never get suspended, which would cause these mini-laptops to not reach S0i3 level when suspended.
--- drivers/acpi/x86/utils.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/acpi/x86/utils.c +17 -3
@@ -94,9 +94,10 @@ static const struct override_status_id override_status_ids[] = {/* * The GPD win BIOS dated 20170221 has disabled the accelerometer, the * drivers sometimes cause crashes under Windows and this is how the -* manufacturer has solved this :| Note that the the DMI data is less -* generic then it seems, a board_vendor of "AMI Corporation" is quite -* rare and a board_name of "Default String" also is rare. +* manufacturer has solved this :| The DMI match may not seem unique, +* but it is. In the 67000+ DMI decode dumps from linux-hardware.org +* only 116 have board_vendor set to "AMI Corporation" and of those 116 +* only the GPD win and pocket entries' board_name is "Default string". * * Unfortunately the GPD pocket also uses these strings and its BIOS * was copy-pasted from the GPD win, so it has a disabled KIOX000A
@@ -120,6 +121,19 @@ static const struct override_status_id override_status_ids[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Default string"), DMI_MATCH(DMI_BIOS_DATE, "05/25/2017") }), + +/* +* The GPD win/pocket have a PCI wifi card, but its DSDT has the SDIO +* mmc controller enabled and that has a child-device which _PS3 +* method sets a GPIO causing the PCI wifi card to turn off. +* See above remark about uniqueness of the DMI match. +*/ + NOT_PRESENT_ENTRY_PATH("\\_SB_.PCI0.SDHB.BRC1", ATOM_AIRMONT, { + DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), + DMI_EXACT_MATCH(DMI_BOARD_NAME, "Default string"), + DMI_EXACT_MATCH(DMI_BOARD_SERIAL, "Default string"), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Default string"), + }), }; bool acpi_device_override_status(struct acpi_device *adev, unsigned long long *status)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 517/846 arm64: dts: ti: j7200-main: Fix dtbs_check serdes_ln_ctrl node
In reply to Greg Kroah-HartmanFrom: Kishon Vijay Abraham I <[email protected]>
[ Upstream commit 4d3984906397581dc0ccb6a02bf16b6ff82c9192 ]
Fix 'dtbs_check' in serdes_ln_ctrl (serdes-ln-ctrl@4080) node by changing the node name to mux-controller@4080.
--- arch/arm64/boot/dts/ti/k3-j7200-main.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/ti/k3-j7200-main.dtsi +1 -1
@@ -32,7 +32,7 @@ #size-cells = <1>; ranges = <0x00 0x00 0x00100000 0x1c000>; - serdes_ln_ctrl: serdes-ln-ctrl@4080 { + serdes_ln_ctrl: mux-controller@4080 { compatible = "mmio-mux"; #mux-control-cells = <1>; mux-reg-masks = <0x4080 0x3>, <0x4084 0x3>, /* SERDES0 lane0/1 select */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 518/846 arm64: dts: ti: j721e-main: Fix dtbs_check in serdes_ln_ctrl node
In reply to Greg Kroah-HartmanFrom: Kishon Vijay Abraham I <[email protected]>
[ Upstream commit 3f92a5be6084b77f764a8bbb881ac0d12cb9e863 ]
Fix 'dtbs_check' in serdes_ln_ctrl (mux@4080) node by changing the node name to mux-controller@4080.
--- arch/arm64/boot/dts/ti/k3-j721e-main.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/ti/k3-j721e-main.dtsi +1 -1
@@ -42,7 +42,7 @@ #size-cells = <1>; ranges = <0x0 0x0 0x00100000 0x1c000>; - serdes_ln_ctrl: mux@4080 { + serdes_ln_ctrl: mux-controller@4080 { compatible = "mmio-mux"; reg = <0x00004080 0x50>; #mux-control-cells = <1>;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 519/846 usb: uhci: add aspeed ast2600 uhci support
In reply to Greg Kroah-HartmanFrom: Neal Liu <[email protected]>
[ Upstream commit 554abfe2eadec97d12c71d4a69da1518478f69eb ]
Enable ast2600 uhci quirks.
--- drivers/usb/host/uhci-platform.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/host/uhci-platform.c +2 -1
@@ -113,7 +113,8 @@ static int uhci_hcd_platform_probe(struct platform_device *pdev) num_ports); }if (of_device_is_compatible (np,"aspeed,ast2400-uhci" ) || -of_device_is_compatible (np,"aspeed,ast2500-uhci" )) { +of_device_is_compatible (np,"aspeed,ast2500-uhci" ) || +of_device_is_compatible (np,"aspeed,ast2600-uhci" )) { uhci->is_aspeed =1 ;dev_info (&pdev->dev,"Enabled Aspeed implementation workarounds\n" );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 520/846 floppy: Add max size check for user space request
In reply to Greg Kroah-HartmanFrom: Xiongwei Song <[email protected]>
[ Upstream commit 545a32498c536ee152331cd2e7d2416aa0f20e01 ]
We need to check the max request size that is from user space before allocating pages. If the request size exceeds the limit, return -EINVAL. This check can avoid the warning below from page allocator.
WARNING: CPU: 3 PID: 16525 at mm/page_alloc.c:5344 current_gfp_context include/linux/sched/mm.h:195 [inline] WARNING: CPU: 3 PID: 16525 at mm/page_alloc.c:5344 __alloc_pages+0x45d/0x500 mm/page_alloc.c:5356 Modules linked in: CPU: 3 PID: 16525 Comm: syz-executor.3 Not tainted 5.15.0-syzkaller #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 RIP: 0010:__alloc_pages+0x45d/0x500 mm/page_alloc.c:5344 Code: be c9 00 00 00 48 c7 c7 20 4a 97 89 c6 05 62 32 a7 0b 01 e8 74 9a 42 07 e9 6a ff ff ff 0f 0b e9 a0 fd ff ff 40 80 e5 3f eb 88 <0f> 0b e9 18 ff ff ff 4c 89 ef 44 89 e6 45 31 ed e8 1e 76 ff ff e9 RSP: 0018:ffffc90023b87850 EFLAGS: 00010246 RAX: 0000000000000000 RBX: 1ffff92004770f0b RCX: dffffc0000000000 RDX: 0000000000000000 RSI: 0000000000000033 RDI: 0000000000010cc1 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000001 R10: ffffffff81bb4686 R11: 0000000000000001 R12: ffffffff902c1960 R13: 0000000000000033 R14: 0000000000000000 R15: ffff88804cf64a30 FS: 0000000000000000(0000) GS:ffff88802cd00000(0063) knlGS:00000000f44b4b40 CS: 0010 DS: 002b ES: 002b CR0: 0000000080050033 CR2: 000000002c921000 CR3: 000000004f507000 CR4: 0000000000150ee0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> alloc_pages+0x1a7/0x300 mm/mempolicy.c:2191 __get_free_pages+0x8/0x40 mm/page_alloc.c:5418 raw_cmd_copyin drivers/block/floppy.c:3113 [inline] raw_cmd_ioctl drivers/block/floppy.c:3160 [inline] fd_locked_ioctl+0x12e5/0x2820 drivers/block/floppy.c:3528 fd_ioctl drivers/block/floppy.c:3555 [inline] fd_compat_ioctl+0x891/0x1b60 drivers/block/floppy.c:3869 compat_blkdev_ioctl+0x3b8/0x810 block/ioctl.c:662 __do_compat_sys_ioctl+0x1c7/0x290 fs/ioctl.c:972 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c
--- drivers/block/floppy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/block/floppy.c +3 -1
@@ -3080,6 +3080,8 @@ static void raw_cmd_free(struct floppy_raw_cmd **ptr) } } +#define MAX_LEN (1UL << MAX_ORDER << PAGE_SHIFT) +static int raw_cmd_copyin (int cmd,void __user *param,struct floppy_raw_cmd **rcmd) {
@@ -3107,7 +3109,7 @@ loop: ptr->resultcode =0 ;if (ptr->flags & (FD_RAW_READ |FD_RAW_WRITE )) { -if (ptr->length <=0 ) +if (ptr->length <=0 || ptr->length >=MAX_LEN )return -EINVAL ; ptr->kernel_data = (char *)fd_dma_mem_alloc (ptr->length);fallback_on_nodma_alloc (&ptr->kernel_data, ptr->length);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 521/846 x86/mm: Flush global TLB when switching to trampoline page-table
In reply to Greg Kroah-HartmanFrom: Joerg Roedel <[email protected]>
[ Upstream commit 71d5049b053876afbde6c3273250b76935494ab2 ]
Move the switching code into a function so that it can be re-used and add a global TLB flush. This makes sure that usage of memory which is not mapped in the trampoline page-table is reliably caught.
Also move the clearing of CR4.PCIDE before the CR3 switch because the cr4_clear_bits() function will access data not mapped into the trampoline page-table.
--- arch/x86/include/asm/realmode.h | 1 + arch/x86/kernel/reboot.c | 12 ++---------- arch/x86/realmode/init.c | 26 ++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 10 deletions(-)
arch/x86/include/asm/realmode.h +1 -0
@@ -89,6 +89,7 @@ static inline void set_real_mode_mem(phys_addr_t mem) }void reserve_real_mode (void ); +void load_trampoline_pgtable (void );#endif /* __ASSEMBLY__ */
arch/x86/kernel/reboot.c +2 -10
@@ -113,17 +113,9 @@ void __noreturn machine_real_restart(unsigned int type)spin_unlock (&rtc_lock);/* -* Switch back to the initial page table. +* Switch to the trampoline page table. */ -#ifdef CONFIG_X86_32 -load_cr3 (initial_page_table); -#else -write_cr3 (real_mode_header->trampoline_pgd); - -/* Exiting long mode will fail if CR4.PCIDE is set. */ -if (boot_cpu_has (X86_FEATURE_PCID )) -cr4_clear_bits (X86_CR4_PCIDE ); -#endif +load_trampoline_pgtable ();/* Jump to the identity-mapped low memory code */ #ifdef CONFIG_X86_32
arch/x86/realmode/init.c +26 -0
@@ -17,6 +17,32 @@ u32 *trampoline_cr4_features;/* Hold the pgd entry used on booting additional CPUs */ pgd_t trampoline_pgd_entry; +void load_trampoline_pgtable (void ) +{ +#ifdef CONFIG_X86_32 +load_cr3 (initial_page_table); +#else +/* +* This function is called before exiting to real-mode and that will +* fail with CR4.PCIDE still set. +*/ +if (boot_cpu_has (X86_FEATURE_PCID )) +cr4_clear_bits (X86_CR4_PCIDE ); + +write_cr3 (real_mode_header->trampoline_pgd); +#endif + +/* +* The CR3 write above will not flush global TLB entries. +* Stale, global entries from previous page tables may still be +* present. Flush those stale entries. +* +* This ensures that memory accessed while running with +* trampoline_pgd is *actually* mapped into trampoline_pgd. +*/ +__flush_tlb_all (); +} +void __init reserve_real_mode (void ) {phys_addr_t mem;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 522/846 drm: rcar-du: Fix CRTC timings when CMM is used
In reply to Greg Kroah-HartmanFrom: Laurent Pinchart <[email protected]>
[ Upstream commit f0ce591dc9a97067c6e783a2eaccd22c5476144d ]
When the CMM is enabled, an offset of 25 pixels must be subtracted from the HDS (horizontal display start) and HDE (horizontal display end) registers. Fix the timings calculation, and take this into account in the mode validation.
This fixes a visible horizontal offset in the image with VGA monitors. HDMI monitors seem to be generally more tolerant to incorrect timings, but may be affected too.
--- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
drivers/gpu/drm/rcar-du/rcar_du_crtc.c +16 -4
@@ -215,6 +215,7 @@ static void rcar_du_crtc_set_display_timing(struct rcar_du_crtc *rcrtc)const struct drm_display_mode *mode = &rcrtc->crtc.state->adjusted_mode;struct rcar_du_device *rcdu = rcrtc->dev;unsigned long mode_clock = mode->clock *1000 ; +unsigned int hdse_offset;u32 dsmr;u32 escr;
@@ -298,10 +299,15 @@ static void rcar_du_crtc_set_display_timing(struct rcar_du_crtc *rcrtc) | DSMR_DIPM_DISP | DSMR_CSPM;rcar_du_crtc_write (rcrtc,DSMR , dsmr); + hdse_offset =19 ; +if (rcrtc->group->cmms_mask &BIT (rcrtc->index %2 )) + hdse_offset +=25 ; +/* Display timings */ -rcar_du_crtc_write (rcrtc,HDSR , mode->htotal - mode->hsync_start -19 ); +rcar_du_crtc_write (rcrtc,HDSR , mode->htotal - mode->hsync_start - + hdse_offset);rcar_du_crtc_write (rcrtc,HDER , mode->htotal - mode->hsync_start + - mode->hdisplay -19 ); + mode->hdisplay - hdse_offset);rcar_du_crtc_write (rcrtc,HSWR , mode->hsync_end - mode->hsync_start -1 );rcar_du_crtc_write (rcrtc,HCR , mode->htotal -1 );
@@ -836,6 +842,7 @@ rcar_du_crtc_mode_valid(struct drm_crtc *crtc,struct rcar_du_crtc *rcrtc =to_rcar_crtc (crtc);struct rcar_du_device *rcdu = rcrtc->dev;bool interlaced = mode->flags &DRM_MODE_FLAG_INTERLACE ; +unsigned int min_sync_porch;unsigned int vbp;if (interlaced && !rcar_du_has (rcdu,RCAR_DU_FEATURE_INTERLACED ))
@@ -843,9 +850,14 @@ rcar_du_crtc_mode_valid(struct drm_crtc *crtc,/* * The hardware requires a minimum combined horizontal sync and back -* porch of 20 pixels and a minimum vertical back porch of 3 lines. +* porch of 20 pixels (when CMM isn't used) or 45 pixels (when CMM is +* used), and a minimum vertical back porch of 3 lines. */ -if (mode->htotal - mode->hsync_start <20 ) + min_sync_porch =20 ; +if (rcrtc->group->cmms_mask &BIT (rcrtc->index %2 )) + min_sync_porch +=25 ; + +if (mode->htotal - mode->hsync_start < min_sync_porch)return MODE_HBLANK_NARROW ; vbp = (mode->vtotal - mode->vsync_end) / (interlaced ?2 :1 );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 523/846 media: uvcvideo: Increase UVC_CTRL_CONTROL_TIMEOUT to 5 seconds.
In reply to Greg Kroah-HartmanFrom: James Hilliard <[email protected]>
[ Upstream commit c8ed7d2f614cd8b315981d116c7a2fb01829500d ]
Some uvc devices appear to require the maximum allowed USB timeout for GET_CUR/SET_CUR requests.
So lets just bump the UVC control timeout to 5 seconds which is the same as the usb ctrl get/set defaults:USB_CTRL_GET_TIMEOUT 5000USB_CTRL_SET_TIMEOUT 5000
It fixes the following runtime warnings:
Failed to query (GET_CUR) UVC control 11 on unit 2: -110 (exp. 1). Failed to query (SET_CUR) UVC control 3 on unit 2: -110 (exp. 2).
--- drivers/media/usb/uvc/uvcvideo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/uvc/uvcvideo.h +1 -1
@@ -189,7 +189,7 @@/* Maximum status buffer size in bytes of interrupt URB. */ #define UVC_MAX_STATUS_SIZE 16 -#define UVC_CTRL_CONTROL_TIMEOUT 500 +#define UVC_CTRL_CONTROL_TIMEOUT 5000#define UVC_CTRL_STREAMING_TIMEOUT 5000/* Maximum allowed number of control mappings per device */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 524/846 media: rcar-vin: Update format alignment constraints
In reply to Greg Kroah-HartmanFrom: Niklas Söderlund <[email protected]>
[ Upstream commit da6911f330d40cfe115a37249e47643eff555e82 ]
This change fixes two issues with the size constraints for buffers.
- There is no width alignment constraint for RGB formats. Prior to this change they were treated as YUV and as a result were more restricted than needed. Add a new check to differentiate between the two.
- The minimum width and height supported is 5x2, not 2x4, this is an artifact from the driver's soc-camera days. Fix this incorrect assumption.
--- drivers/media/platform/rcar-vin/rcar-v4l2.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/media/platform/rcar-vin/rcar-v4l2.c +11 -4
@@ -175,20 +175,27 @@ static void rvin_format_align(struct rvin_dev *vin, struct v4l2_pix_format *pix)break ; } -/* HW limit width to a multiple of 32 (2^5) for NV12/16 else 2 (2^1) */ +/* Hardware limits width alignment based on format. */ switch (pix->pixelformat) { +/* Multiple of 32 (2^5) for NV12/16. */ case V4L2_PIX_FMT_NV12 :case V4L2_PIX_FMT_NV16 : walign =5 ;break ; -default : +/* Multiple of 2 (2^1) for YUV. */ +case V4L2_PIX_FMT_YUYV : +case V4L2_PIX_FMT_UYVY : walign =1 ;break ; +/* No multiple for RGB. */ +default : + walign =0 ; +break ; }/* Limit to VIN capabilities */ -v4l_bound_align_image (&pix->width,2 , vin->info->max_width, walign, - &pix->height,4 , vin->info->max_height,2 ,0 ); +v4l_bound_align_image (&pix->width,5 , vin->info->max_width, walign, + &pix->height,2 , vin->info->max_height,0 ,0 ); pix->bytesperline =rvin_format_bytesperline (vin, pix); pix->sizeimage =rvin_format_sizeimage (pix);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 525/846 media: saa7146: hexium_orion: Fix a NULL pointer dereference in hexium_attach()
In reply to Greg Kroah-HartmanFrom: Zhou Qingyang <[email protected]>
[ Upstream commit 348df8035301dd212e3cc2860efe4c86cb0d3303 ]
In hexium_attach(dev, info), saa7146_vv_init() is called to allocate a new memory for dev->vv_data. In hexium_detach(), saa7146_vv_release() will be called and there is a dereference of dev->vv_data in saa7146_vv_release(), which could lead to a NULL pointer dereference on failure of saa7146_vv_init() according to the following logic.
Both hexium_attach() and hexium_detach() are callback functions of the variable 'extension', so there exists a possible call chain directly from hexium_attach() to hexium_detach():
hexium_attach(dev, info) -- fail to alloc memory to dev->vv_data
| in saa7146_vv_init(). | |
hexium_detach() -- a dereference of dev->vv_data in saa7146_vv_release()
Fix this bug by adding a check of saa7146_vv_init().
This bug was found by a static analyzer. The analysis employs differential checking to identify inconsistent security operations (e.g., checks or kfrees) between two code paths and confirms that the inconsistent operations are not recovered in the current function or the callers, so they constitute bugs.
Note that, as a bug found by static analysis, it can be a false positive or hard to trigger. Multiple researchers have cross-reviewed the bug.
Builds with CONFIG_VIDEO_HEXIUM_ORION=m show no new warnings, and our static analyzer no longer warns about this code.
--- drivers/media/pci/saa7146/hexium_orion.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/media/pci/saa7146/hexium_orion.c +7 -1
@@ -355,10 +355,16 @@ static struct saa7146_ext_vv vv_data;static int hexium_attach (struct saa7146_dev *dev,struct saa7146_pci_extension_data *info) {struct hexium *hexium = (struct hexium *) dev->ext_priv; +int ret;DEB_EE ("\n" ); -saa7146_vv_init (dev, &vv_data); + ret =saa7146_vv_init (dev, &vv_data); +if (ret) { +pr_err ("Error in saa7146_vv_init()\n" ); +return ret; + } + vv_data.vid_ops.vidioc_enum_input = vidioc_enum_input; vv_data.vid_ops.vidioc_g_input = vidioc_g_input; vv_data.vid_ops.vidioc_s_input = vidioc_s_input;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 526/846 media: atomisp: fix "variable dereferenced before check asd"
In reply to Greg Kroah-HartmanFrom: Tsuchiya Yuto <[email protected]>
[ Upstream commit ac56760a8bbb4e654b2fd54e5de79dd5d72f937d ]
There are two occurrences where the variable 'asd' is dereferenced before check. Fix this issue by using the variable after the check.
--- drivers/staging/media/atomisp/pci/atomisp_cmd.c | 3 ++- drivers/staging/media/atomisp/pci/atomisp_ioctl.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_cmd.c +2 -1
@@ -5224,7 +5224,7 @@ static int atomisp_set_fmt_to_isp(struct video_device *vdev,int (*configure_pp_input)(struct atomisp_sub_device *asd,unsigned int width,unsigned int height) = configure_pp_input_nop; -u16 stream_index =atomisp_source_pad_to_stream_id (asd, source_pad); +u16 stream_index;const struct atomisp_in_fmt_conv *fc;int ret, i;
@@ -5233,6 +5233,7 @@ static int atomisp_set_fmt_to_isp(struct video_device *vdev, __func__, vdev->name);return -EINVAL ; } + stream_index =atomisp_source_pad_to_stream_id (asd, source_pad);v4l2_fh_init (&fh.vfh, vdev);
drivers/staging/media/atomisp/pci/atomisp_ioctl.c +2 -1
@@ -1123,7 +1123,7 @@ int __atomisp_reqbufs(struct file *file, void *fh,struct ia_css_frame *frame;struct videobuf_vmalloc_memory *vm_mem;u16 source_pad =atomisp_subdev_source_pad (vdev); -u16 stream_id =atomisp_source_pad_to_stream_id (asd, source_pad); +u16 stream_id;int ret =0 , i =0 ;if (!asd) {
@@ -1131,6 +1131,7 @@ int __atomisp_reqbufs(struct file *file, void *fh, __func__, vdev->name);return -EINVAL ; } + stream_id =atomisp_source_pad_to_stream_id (asd, source_pad);if (req->count ==0 ) {mutex_lock (&pipe->capq.vb_lock);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 527/846 media: m920x: dont use stack on USB reads
In reply to Greg Kroah-HartmanFrom: Mauro Carvalho Chehab <[email protected]>
[ Upstream commit a2ab06d7c4d6bfd0b545a768247a70463e977e27 ]
Using stack-allocated pointers for USB message data don't work. This driver is almost OK with that, except for the I2C read logic.
Fix it by using a temporary read buffer, just like on all other calls to m920x_read().
--- drivers/media/usb/dvb-usb/m920x.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/media/usb/dvb-usb/m920x.c +11 -1
@@ -274,6 +274,13 @@ static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int nu/* Should check for ack here, if we knew how. */ }if (msg[i].flags &I2C_M_RD ) { +char *read =kmalloc (1 ,GFP_KERNEL ); +if (!read) { + ret = -ENOMEM ; +kfree (read); + goto unlock; + } +for (j =0 ; j < msg[i].len; j++) {/* Last byte of transaction? * Send STOP, otherwise send ACK. */
@@ -281,9 +288,12 @@ static int m920x_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[], int nuif ((ret =m920x_read (d->udev,M9206_I2C ,0x0 ,0x20 | stop, - &msg[i].buf[j],1 )) !=0 ) + read,1 )) !=0 ) goto unlock; + msg[i].buf[j] = read[0 ]; } + +kfree (read); }else {for (j =0 ; j < msg[i].len; j++) {/* Last byte of transaction? Then send STOP. */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 528/846 thunderbolt: Runtime PM activate both ends of the device link
In reply to Greg Kroah-HartmanFrom: Mika Westerberg <[email protected]>
[ Upstream commit f3380cac0c0b3a6f49ab161e2a057c363962f48d ]
If protocol tunnels are already up when the driver is loaded, for instance if the boot firmware implements connection manager of its own, runtime PM reference count of the consumer devices behind the tunnel might have been increased already before the device link is created but the supplier device runtime PM reference count is not. This leads to a situation where the supplier (the Thunderbolt driver) can runtime suspend even if it should not because the corresponding protocol tunnel needs to be up causing the devices to be removed from the corresponding native bus.
Prevent this from happening by making both sides of the link runtime PM active briefly. The pm_runtime_put() for the consumer (PCIe root/downstream port, xHCI) then allows it to runtime suspend again but keeps the supplier runtime resumed the whole time it is runtime active.
--- drivers/thunderbolt/acpi.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/thunderbolt/acpi.c +13 -0
@@ -7,6 +7,7 @@*/ #include <linux/acpi.h> +#include <linux/pm_runtime.h> #include "tb.h"
@@ -74,8 +75,18 @@ static acpi_status tb_acpi_add_link(acpi_handle handle, u32 level, void *data, pci_pcie_type(pdev) == PCI_EXP_TYPE_DOWNSTREAM))) {const struct device_link *link; +/* +* Make them both active first to make sure the NHI does +* not runtime suspend before the consumer. The +* pm_runtime_put() below then allows the consumer to +* runtime suspend again (which then allows NHI runtime +* suspend too now that the device link is established). +*/ +pm_runtime_get_sync (&pdev->dev); + link =device_link_add (&pdev->dev, &nhi->pdev->dev,DL_FLAG_AUTOREMOVE_SUPPLIER | +DL_FLAG_RPM_ACTIVE |DL_FLAG_PM_RUNTIME );if (link) { dev_dbg(&nhi->pdev->dev, "created link from %s\n",
@@ -84,6 +95,8 @@ static acpi_status tb_acpi_add_link(acpi_handle handle, u32 level, void *data,dev_warn (&nhi->pdev->dev,"device link creation from %s failed\n" ,dev_name (&pdev->dev)); } + +pm_runtime_put (&pdev->dev); } out_put:
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 529/846 arm64: dts: renesas: Fix thermal bindings
In reply to Greg Kroah-HartmanFrom: Kieran Bingham <[email protected]>
[ Upstream commit 82ce79391d0ec25ec8aaae3c0617b71048ff0836 ]
The binding node names for the thermal zones are not successfully validated by the dt-schemas.
Fix the validation by changing from sensor-thermalN or thermal-sensor-N to sensorN-thermal. Provide node labels of the form sensorN_thermal to ensure consistency with the other platform implementations.
--- arch/arm64/boot/dts/renesas/r8a774a1.dtsi | 6 +++--- arch/arm64/boot/dts/renesas/r8a774b1.dtsi | 6 +++--- arch/arm64/boot/dts/renesas/r8a774e1.dtsi | 6 +++--- arch/arm64/boot/dts/renesas/r8a77951.dtsi | 6 +++--- arch/arm64/boot/dts/renesas/r8a77960.dtsi | 6 +++--- arch/arm64/boot/dts/renesas/r8a77961.dtsi | 6 +++--- arch/arm64/boot/dts/renesas/r8a77965.dtsi | 6 +++--- arch/arm64/boot/dts/renesas/r8a77980.dtsi | 4 ++-- arch/arm64/boot/dts/renesas/r8a779a0.dtsi | 10 +++++----- 9 files changed, 28 insertions(+), 28 deletions(-)
arch/arm64/boot/dts/renesas/r8a774a1.dtsi +3 -3
@@ -2784,7 +2784,7 @@ }; thermal-zones { - sensor_thermal1: sensor-thermal1 { + sensor1_thermal: sensor1-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 0>;
@@ -2799,7 +2799,7 @@ }; }; - sensor_thermal2: sensor-thermal2 { + sensor2_thermal: sensor2-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 1>;
@@ -2814,7 +2814,7 @@ }; }; - sensor_thermal3: sensor-thermal3 { + sensor3_thermal: sensor3-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 2>;
arch/arm64/boot/dts/renesas/r8a774b1.dtsi +3 -3
@@ -2629,7 +2629,7 @@ }; thermal-zones { - sensor_thermal1: sensor-thermal1 { + sensor1_thermal: sensor1-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 0>;
@@ -2644,7 +2644,7 @@ }; }; - sensor_thermal2: sensor-thermal2 { + sensor2_thermal: sensor2-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 1>;
@@ -2659,7 +2659,7 @@ }; }; - sensor_thermal3: sensor-thermal3 { + sensor3_thermal: sensor3-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 2>;
arch/arm64/boot/dts/renesas/r8a774e1.dtsi +3 -3
@@ -2904,7 +2904,7 @@ }; thermal-zones { - sensor_thermal1: sensor-thermal1 { + sensor1_thermal: sensor1-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 0>;
@@ -2919,7 +2919,7 @@ }; }; - sensor_thermal2: sensor-thermal2 { + sensor2_thermal: sensor2-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 1>;
@@ -2934,7 +2934,7 @@ }; }; - sensor_thermal3: sensor-thermal3 { + sensor3_thermal: sensor3-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 2>;
arch/arm64/boot/dts/renesas/r8a77951.dtsi +3 -3
@@ -3375,7 +3375,7 @@ }; thermal-zones { - sensor_thermal1: sensor-thermal1 { + sensor1_thermal: sensor1-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 0>;
@@ -3390,7 +3390,7 @@ }; }; - sensor_thermal2: sensor-thermal2 { + sensor2_thermal: sensor2-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 1>;
@@ -3405,7 +3405,7 @@ }; }; - sensor_thermal3: sensor-thermal3 { + sensor3_thermal: sensor3-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 2>;
arch/arm64/boot/dts/renesas/r8a77960.dtsi +3 -3
@@ -2972,7 +2972,7 @@ }; thermal-zones { - sensor_thermal1: sensor-thermal1 { + sensor1_thermal: sensor1-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 0>;
@@ -2987,7 +2987,7 @@ }; }; - sensor_thermal2: sensor-thermal2 { + sensor2_thermal: sensor2-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 1>;
@@ -3002,7 +3002,7 @@ }; }; - sensor_thermal3: sensor-thermal3 { + sensor3_thermal: sensor3-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 2>;
arch/arm64/boot/dts/renesas/r8a77961.dtsi +3 -3
@@ -2719,7 +2719,7 @@ }; thermal-zones { - sensor_thermal1: sensor-thermal1 { + sensor1_thermal: sensor1-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 0>;
@@ -2734,7 +2734,7 @@ }; }; - sensor_thermal2: sensor-thermal2 { + sensor2_thermal: sensor2-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 1>;
@@ -2749,7 +2749,7 @@ }; }; - sensor_thermal3: sensor-thermal3 { + sensor3_thermal: sensor3-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 2>;
arch/arm64/boot/dts/renesas/r8a77965.dtsi +3 -3
@@ -2784,7 +2784,7 @@ }; thermal-zones { - sensor_thermal1: sensor-thermal1 { + sensor1_thermal: sensor1-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 0>;
@@ -2799,7 +2799,7 @@ }; }; - sensor_thermal2: sensor-thermal2 { + sensor2_thermal: sensor2-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 1>;
@@ -2814,7 +2814,7 @@ }; }; - sensor_thermal3: sensor-thermal3 { + sensor3_thermal: sensor3-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 2>;
arch/arm64/boot/dts/renesas/r8a77980.dtsi +2 -2
@@ -1580,7 +1580,7 @@ }; thermal-zones { - thermal-sensor-1 { + sensor1_thermal: sensor1-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 0>;
@@ -1599,7 +1599,7 @@ }; }; - thermal-sensor-2 { + sensor2_thermal: sensor2-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 1>;
arch/arm64/boot/dts/renesas/r8a779a0.dtsi +5 -5
@@ -1149,7 +1149,7 @@ }; thermal-zones { - sensor_thermal1: sensor-thermal1 { + sensor1_thermal: sensor1-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 0>;
@@ -1163,7 +1163,7 @@ }; }; - sensor_thermal2: sensor-thermal2 { + sensor2_thermal: sensor2-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 1>;
@@ -1177,7 +1177,7 @@ }; }; - sensor_thermal3: sensor-thermal3 { + sensor3_thermal: sensor3-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 2>;
@@ -1191,7 +1191,7 @@ }; }; - sensor_thermal4: sensor-thermal4 { + sensor4_thermal: sensor4-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 3>;
@@ -1205,7 +1205,7 @@ }; }; - sensor_thermal5: sensor-thermal5 { + sensor5_thermal: sensor5-thermal { polling-delay-passive = <250>; polling-delay = <1000>; thermal-sensors = <&tsc 4>;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 530/846 iwlwifi: mvm: synchronize with FW after multicast commands
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit db66abeea3aefed481391ecc564fb7b7fb31d742 ]
If userspace installs a lot of multicast groups very quickly, then we may run out of command queue space as we send the updates in an asynchronous fashion (due to locking concerns), and the CPU can create them faster than the firmware can process them. This is true even when mac80211 has a work struct that gets scheduled.
Fix this by synchronizing with the firmware after sending all those commands - outside of the iteration we can send a synchronous echo command that just has the effect of the CPU waiting for the prior asynchronous commands to finish. This also will cause fewer of the commands to be sent to the firmware overall, because the work will only run once when rescheduled multiple times while it's running.
--- .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +17 -0
@@ -1687,6 +1687,7 @@ static void iwl_mvm_recalc_multicast(struct iwl_mvm *mvm)struct iwl_mvm_mc_iter_data iter_data = { .mvm = mvm, }; +int ret;lockdep_assert_held (&mvm->mutex);
@@ -1696,6 +1697,22 @@ static void iwl_mvm_recalc_multicast(struct iwl_mvm *mvm)ieee80211_iterate_active_interfaces_atomic ( mvm->hw,IEEE80211_IFACE_ITER_NORMAL , iwl_mvm_mc_iface_iterator, &iter_data); + +/* +* Send a (synchronous) ech command so that we wait for the +* multiple asynchronous MCAST_FILTER_CMD commands sent by +* the interface iterator. Otherwise, we might get here over +* and over again (by userspace just sending a lot of these) +* and the CPU can send them faster than the firmware can +* process them. +* Note that the CPU is still faster - but with this we'll +* actually send fewer commands overall because the CPU will +* not schedule the work in mac80211 as frequently if it's +* still running when rescheduled (possibly multiple times). +*/ + ret =iwl_mvm_send_cmd_pdu (mvm,ECHO_CMD ,0 ,0 ,NULL ); +if (ret) +IWL_ERR (mvm,"Failed to synchronize multicast groups update\n" ); } static u64 iwl_mvm_prepare_multicast(struct ieee80211_hw *hw,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 531/846 iwlwifi: mvm: avoid clearing a just saved session protection id
In reply to Greg Kroah-HartmanFrom: Shaul Triebitz <[email protected]>
[ Upstream commit 8e967c137df3b236d2075f9538cb888129425d1a ]
When scheduling a session protection the id is saved but then it may be cleared when calling iwl_mvm_te_clear_data (if a previous session protection is currently active). Fix it by saving the id after calling iwl_mvm_te_clear_data.
--- drivers/net/wireless/intel/iwlwifi/mvm/time-event.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/time-event.c +6 -6
@@ -1167,15 +1167,10 @@ void iwl_mvm_schedule_session_protection(struct iwl_mvm *mvm,cpu_to_le32 (FW_CMD_ID_AND_COLOR (mvmvif->id, mvmvif->color)), .action = cpu_to_le32(FW_CTXT_ACTION_ADD), + .conf_id = cpu_to_le32(SESSION_PROTECT_CONF_ASSOC), .duration_tu =cpu_to_le32 (MSEC_TO_TU (duration)), }; -/* The time_event_data.id field is reused to save session -* protection's configuration. -*/ - mvmvif->time_event_data.id =SESSION_PROTECT_CONF_ASSOC ; - cmd.conf_id =cpu_to_le32 (mvmvif->time_event_data.id); -lockdep_assert_held (&mvm->mutex);spin_lock_bh (&mvm->time_event_lock);
@@ -1189,6 +1184,11 @@ void iwl_mvm_schedule_session_protection(struct iwl_mvm *mvm, }iwl_mvm_te_clear_data (mvm, te_data); +/* +* The time_event_data.id field is reused to save session +* protection's configuration. +*/ + te_data->id =le32_to_cpu (cmd.conf_id); te_data->duration =le32_to_cpu (cmd.duration_tu); te_data->vif = vif;spin_unlock_bh (&mvm->time_event_lock);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 532/846 rcutorture: Avoid soft lockup during cpu stall
In reply to Greg Kroah-HartmanFrom: Wander Lairson Costa <[email protected]>
[ Upstream commit 5ff7c9f9d7e3e0f6db5b81945fa11b69d62f433a ]
If we use the module stall_cpu option, we may get a soft lockup warning in case we also don't pass the stall_cpu_block option.
Introduce the stall_no_softlockup option to avoid a soft lockup on cpu stall even if we don't use the stall_cpu_block option.
--- kernel/rcu/rcutorture.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/rcu/rcutorture.c +5 -0
@@ -46,6 +46,7 @@#include <linux/oom.h> #include <linux/tick.h> #include <linux/rcupdate_trace.h> +#include <linux/nmi.h> #include "rcu.h"
@@ -109,6 +110,8 @@ torture_param(int, shutdown_secs, 0, "Shutdown time (s), <= zero to disable.");torture_param (int, stall_cpu,0 ,"Stall duration (s), zero to disable." );torture_param (int, stall_cpu_holdoff,10 ,"Time to wait before starting stall (s)." ); +torture_param (bool, stall_no_softlockup, false, +"Avoid softlockup warning during cpu stall." );torture_param (int, stall_cpu_irqsoff,0 ,"Disable interrupts while stalling." );torture_param (int, stall_cpu_block,0 ,"Sleep while stalling." ); torture_param(int, stall_gp_kthread, 0,
@@ -2052,6 +2055,8 @@ static int rcu_torture_stall(void *args)#else schedule_timeout_uninterruptible (HZ );#endif + }else if (stall_no_softlockup) { +touch_softlockup_watchdog (); }if (stall_cpu_irqsoff)local_irq_enable ();
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 533/846 ath11k: avoid deadlock by change ieee80211_queue_work for regd_update_work
In reply to Greg Kroah-HartmanFrom: Wen Gong <[email protected]>
[ Upstream commit ed05c7cf1286d7e31e7623bce55ff135723591bf ]
When enable debug config, it print below warning while shut down wlan interface shuh as run "ifconfig wlan0 down".
The reason is because ar->regd_update_work is ran once, and it is will call wiphy_lock(ar->hw->wiphy) in function ath11k_regd_update() which is running in workqueue of ieee80211_local queued by ieee80211_queue_work(). Another thread from "ifconfig wlan0 down" will also accuqire the lock by wiphy_lock(sdata->local->hw.wiphy) in function ieee80211_stop(), and then it call ieee80211_stop_device() to flush_workqueue(local->workqueue), this will wait the workqueue of ieee80211_local finished. Then deadlock will happen easily if the two thread run meanwhile.
Below warning disappeared after this change.
[ 914.088798] ath11k_pci 0000:05:00.0: mac remove interface (vdev 0) [ 914.088806] ath11k_pci 0000:05:00.0: mac stop 11d scan [ 914.088810] ath11k_pci 0000:05:00.0: mac stop 11d vdev id 0 [ 914.088827] ath11k_pci 0000:05:00.0: htc ep 2 consumed 1 credits (total 0) [ 914.088841] ath11k_pci 0000:05:00.0: send 11d scan stop vdev id 0 [ 914.088849] ath11k_pci 0000:05:00.0: htc insufficient credits ep 2 required 1 available 0 [ 914.088856] ath11k_pci 0000:05:00.0: htc insufficient credits ep 2 required 1 available 0 [ 914.096434] ath11k_pci 0000:05:00.0: rx ce pipe 2 len 16 [ 914.096442] ath11k_pci 0000:05:00.0: htc ep 2 got 1 credits (total 1) [ 914.096481] ath11k_pci 0000:05:00.0: htc ep 2 consumed 1 credits (total 0) [ 914.096491] ath11k_pci 0000:05:00.0: WMI vdev delete id 0 [ 914.111598] ath11k_pci 0000:05:00.0: rx ce pipe 2 len 16 [ 914.111628] ath11k_pci 0000:05:00.0: htc ep 2 got 1 credits (total 1) [ 914.114659] ath11k_pci 0000:05:00.0: rx ce pipe 2 len 20 [ 914.114742] ath11k_pci 0000:05:00.0: htc rx completion ep 2 skb pK-error [ 914.115977] ath11k_pci 0000:05:00.0: vdev delete resp for vdev id 0 [ 914.116685] ath11k_pci 0000:05:00.0: vdev 00:03:7f:29:61:11 deleted, vdev_id 0
[ 914.117583] ======================================================
[ 914.117592] WARNING: possible circular locking dependency detected
[ 914.117600] 5.16.0-rc1-wt-ath+ #1 Tainted: G OE
[ 914.117611] ------------------------------------------------------
[ 914.117618] ifconfig/2805 is trying to acquire lock:
[ 914.117628] ffff9c00a62bb548 ((wq_completion)phy0){+.+.}-{0:0}, at: flush_workqueue+0x87/0x470
[ 914.117674]
but task is already holding lock:
[ 914.117682] ffff9c00baea07d0 (&rdev->wiphy.mtx){+.+.}-{4:4}, at: ieee80211_stop+0x38/0x180 [mac80211]
[ 914.117872]
which lock already depends on the new lock.[ 914.117880]
the existing dependency chain (in reverse order) is:
[ 914.117888]
-> #3 (&rdev->wiphy.mtx){+.+.}-{4:4}:
[ 914.117910] __mutex_lock+0xa0/0x9c0
[ 914.117930] mutex_lock_nested+0x1b/0x20
[ 914.117944] reg_process_self_managed_hints+0x3a/0xb0 [cfg80211]
[ 914.118093] wiphy_regulatory_register+0x47/0x80 [cfg80211]
[ 914.118229] wiphy_register+0x84f/0x9c0 [cfg80211]
[ 914.118353] ieee80211_register_hw+0x6b1/0xd90 [mac80211]
[ 914.118486] ath11k_mac_register+0x6af/0xb60 [ath11k]
[ 914.118550] ath11k_core_qmi_firmware_ready+0x383/0x4a0 [ath11k]
[ 914.118598] ath11k_qmi_driver_event_work+0x347/0x4a0 [ath11k]
[ 914.118656] process_one_work+0x228/0x670
[ 914.118669] worker_thread+0x4d/0x440
[ 914.118680] kthread+0x16d/0x1b0
[ 914.118697] ret_from_fork+0x22/0x30
[ 914.118714]
-> #2 (rtnl_mutex){+.+.}-{4:4}:
[ 914.118736] __mutex_lock+0xa0/0x9c0
[ 914.118751] mutex_lock_nested+0x1b/0x20
[ 914.118767] rtnl_lock+0x17/0x20
[ 914.118783] ath11k_regd_update+0x15a/0x260 [ath11k]
[ 914.118841] ath11k_regd_update_work+0x15/0x20 [ath11k]
[ 914.118897] process_one_work+0x228/0x670
[ 914.118909] worker_thread+0x4d/0x440
[ 914.118920] kthread+0x16d/0x1b0
[ 914.118934] ret_from_fork+0x22/0x30
[ 914.118948]
-> #1 ((work_completion)(&ar->regd_update_work)){+.+.}-{0:0}:
[ 914.118972] process_one_work+0x1fa/0x670
[ 914.118984] worker_thread+0x4d/0x440
[ 914.118996] kthread+0x16d/0x1b0
[ 914.119010] ret_from_fork+0x22/0x30
[ 914.119023]
-> #0 ((wq_completion)phy0){+.+.}-{0:0}:
[ 914.119045] __lock_acquire+0x146d/0x1cf0
[ 914.119057] lock_acquire+0x19b/0x360
[ 914.119067] flush_workqueue+0xae/0x470
[ 914.119084] ieee80211_stop_device+0x3b/0x50 [mac80211]
[ 914.119260] ieee80211_do_stop+0x5d7/0x830 [mac80211]
[ 914.119409] ieee80211_stop+0x45/0x180 [mac80211]
[ 914.119557] __dev_close_many+0xb3/0x120
[ 914.119573] __dev_change_flags+0xc3/0x1d0
[ 914.119590] dev_change_flags+0x29/0x70
[ 914.119605] devinet_ioctl+0x653/0x810
[ 914.119620] inet_ioctl+0x193/0x1e0
[ 914.119631] sock_do_ioctl+0x4d/0xf0
[ 914.119649] sock_ioctl+0x262/0x340
[ 914.119665] __x64_sys_ioctl+0x96/0xd0
[ 914.119678] do_syscall_64+0x3d/0xd0
[ 914.119694] entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 914.119709]
other info that might help us debug this:[ 914.119717] Chain exists of:
(wq_completion)phy0 --> rtnl_mutex --> &rdev->wiphy.mtx[ 914.119745] Possible unsafe locking scenario:
[ 914.119752] CPU0 CPU1
[ 914.119758] ---- ----
[ 914.119765] lock(&rdev->wiphy.mtx);
[ 914.119778] lock(rtnl_mutex);
[ 914.119792] lock(&rdev->wiphy.mtx);
[ 914.119807] lock((wq_completion)phy0);
[ 914.119819]
*** DEADLOCK ***[ 914.119827] 2 locks held by ifconfig/2805:
[ 914.119837] #0: ffffffffba3dc010 (rtnl_mutex){+.+.}-{4:4}, at: rtnl_lock+0x17/0x20
[ 914.119872] #1: ffff9c00baea07d0 (&rdev->wiphy.mtx){+.+.}-{4:4}, at: ieee80211_stop+0x38/0x180 [mac80211]
[ 914.120039]
stack backtrace:
[ 914.120048] CPU: 0 PID: 2805 Comm: ifconfig Tainted: G OE 5.16.0-rc1-wt-ath+ #1
[ 914.120064] Hardware name: LENOVO 418065C/418065C, BIOS 83ET63WW (1.33 ) 07/29/2011
[ 914.120074] Call Trace:
[ 914.120084] <TASK>
[ 914.120094] dump_stack_lvl+0x73/0xa4
[ 914.120119] dump_stack+0x10/0x12
[ 914.120135] print_circular_bug.isra.44+0x221/0x2e0
[ 914.120165] check_noncircular+0x106/0x150
[ 914.120203] __lock_acquire+0x146d/0x1cf0
[ 914.120215] ? __lock_acquire+0x146d/0x1cf0
[ 914.120245] lock_acquire+0x19b/0x360
[ 914.120259] ? flush_workqueue+0x87/0x470
[ 914.120286] ? lockdep_init_map_type+0x6b/0x250
[ 914.120310] flush_workqueue+0xae/0x470
[ 914.120327] ? flush_workqueue+0x87/0x470
[ 914.120344] ? lockdep_hardirqs_on+0xd7/0x150
[ 914.120391] ieee80211_stop_device+0x3b/0x50 [mac80211]
[ 914.120565] ? ieee80211_stop_device+0x3b/0x50 [mac80211]
[ 914.120736] ieee80211_do_stop+0x5d7/0x830 [mac80211]
[ 914.120906] ieee80211_stop+0x45/0x180 [mac80211]
[ 914.121060] __dev_close_many+0xb3/0x120
[ 914.121081] __dev_change_flags+0xc3/0x1d0
[ 914.121109] dev_change_flags+0x29/0x70
[ 914.121131] devinet_ioctl+0x653/0x810
[ 914.121149] ? __might_fault+0x77/0x80
[ 914.121179] inet_ioctl+0x193/0x1e0
[ 914.121194] ? inet_ioctl+0x193/0x1e0
[ 914.121218] ? __might_fault+0x77/0x80
[ 914.121238] ? _copy_to_user+0x68/0x80
[ 914.121266] sock_do_ioctl+0x4d/0xf0
[ 914.121283] ? inet_stream_connect+0x60/0x60
[ 914.121297] ? sock_do_ioctl+0x4d/0xf0
[ 914.121329] sock_ioctl+0x262/0x340
[ 914.121347] ? sock_ioctl+0x262/0x340
[ 914.121362] ? exit_to_user_mode_prepare+0x13b/0x280
[ 914.121388] ? syscall_enter_from_user_mode+0x20/0x50
[ 914.121416] __x64_sys_ioctl+0x96/0xd0
[ 914.121430] ? br_ioctl_call+0x90/0x90
[ 914.121445] ? __x64_sys_ioctl+0x96/0xd0
[ 914.121465] do_syscall_64+0x3d/0xd0
[ 914.121482] entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 914.121497] RIP: 0033:0x7f0ed051737b
[ 914.121513] Code: 0f 1e fa 48 8b 05 15 3b 0d 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 0f 1f 44 00 00 f3 0f 1e fa b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d e5 3a 0d 00 f7 d8 64 89 01 48
[ 914.121527] RSP: 002b:00007fff7be38b98 EFLAGS: 00000202 ORIG_RAX: 0000000000000010
[ 914.121544] RAX: ffffffffffffffda RBX: 00007fff7be38ba0 RCX: 00007f0ed051737b
[ 914.121555] RDX: 00007fff7be38ba0 RSI: 0000000000008914 RDI: 0000000000000004
[ 914.121566] RBP: 00007fff7be38c60 R08: 000000000000000a R09: 0000000000000001
[ 914.121576] R10: 0000000000000000 R11: 0000000000000202 R12: 00000000fffffffe
[ 914.121586] R13: 0000000000000004 R14: 0000000000000000 R15: 0000000000000000
[ 914.121620] </TASK>Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1
--- drivers/net/wireless/ath/ath11k/wmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath11k/wmi.c +1 -1
@@ -5853,7 +5853,7 @@ static int ath11k_reg_chan_list_event(struct ath11k_base *ab, struct sk_buff *sk ar = ab->pdevs[pdev_idx].ar;kfree (ab->new_regd[pdev_idx]); ab->new_regd[pdev_idx] = regd; -ieee80211_queue_work (ar->hw, &ar->regd_update_work); +queue_work (ab->workqueue, &ar->regd_update_work); }else {/* This regd would be applied during mac registration and is * held constant throughout for regd intersection purpose
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 534/846 ath10k: Fix tx hanging
In reply to Greg Kroah-HartmanFrom: Sebastian Gottschall <[email protected]>
[ Upstream commit e8a91863eba3966a447d2daa1526082d52b5db2a ]
While running stress tests in roaming scenarios (switching ap's every 5 seconds, we discovered a issue which leads to tx hangings of exactly 5 seconds while or after scanning for new accesspoints. We found out that this hanging is triggered by ath10k_mac_wait_tx_complete since the empty_tx_wq was not wake when the num_tx_pending counter reaches zero. To fix this, we simply move the wake_up call to htt_tx_dec_pending, since this call was missed on several locations within the ath10k code.
--- drivers/net/wireless/ath/ath10k/htt_tx.c | 3 +++ drivers/net/wireless/ath/ath10k/txrx.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath10k/htt_tx.c +3 -0
@@ -147,6 +147,9 @@ void ath10k_htt_tx_dec_pending(struct ath10k_htt *htt) htt->num_pending_tx--;if (htt->num_pending_tx == htt->max_num_pending_tx -1 )ath10k_mac_tx_unlock (htt->ar,ATH10K_TX_PAUSE_Q_FULL ); + +if (htt->num_pending_tx ==0 ) +wake_up (&htt->empty_tx_wq); }int ath10k_htt_tx_inc_pending (struct ath10k_htt *htt)
drivers/net/wireless/ath/ath10k/txrx.c +0 -2
@@ -82,8 +82,6 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt, flags = skb_cb->flags;ath10k_htt_tx_free_msdu_id (htt, tx_done->msdu_id);ath10k_htt_tx_dec_pending (htt); -if (htt->num_pending_tx ==0 ) -wake_up (&htt->empty_tx_wq);spin_unlock_bh (&htt->tx_lock);rcu_read_lock ();
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 535/846 net-sysfs: update the queue counts in the unregistration path
In reply to Greg Kroah-HartmanFrom: Antoine Tenart <[email protected]>
[ Upstream commit d7dac083414eb5bb99a6d2ed53dc2c1b405224e5 ]
When updating Rx and Tx queue kobjects, the queue count should always be updated to match the queue kobjects count. This was not done in the net device unregistration path, fix it. Tracking all queue count updates will allow in a following up patch to detect illegal updates.
--- net/core/net-sysfs.c | 3 +++ 1 file changed, 3 insertions(+)
net/core/net-sysfs.c +3 -0
@@ -1820,6 +1820,9 @@ static void remove_queue_kobjects(struct net_device *dev)net_rx_queue_update_kobjects (dev, real_rx,0 );netdev_queue_update_kobjects (dev, real_tx,0 ); + + dev->real_num_rx_queues =0 ; + dev->real_num_tx_queues =0 ;#ifdef CONFIG_SYSFS kset_unregister (dev->queues_kset);#endif
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 536/846 net: phy: prefer 1000baseT over 1000baseKX
In reply to Greg Kroah-HartmanFrom: Russell King (Oracle) <[email protected]>
[ Upstream commit f20f94f7f52c4685c81754f489ffcc72186e8bdb ]
The PHY settings table is supposed to be sorted by descending match priority - in other words, earlier entries are preferred over later entries.
The order of 1000baseKX/Full and 1000baseT/Full is such that we prefer 1000baseKX/Full over 1000baseT/Full, but 1000baseKX/Full is a lot rarer than 1000baseT/Full, and thus is much less likely to be preferred.
This causes phylink problems - it means a fixed link specifying a speed of 1G and full duplex gets an ethtool linkmode of 1000baseKX/Full rather than 1000baseT/Full as would be expected - and since we offer userspace a software emulation of a conventional copper PHY, we want to offer copper modes in preference to anything else. However, we do still want to allow the rarer modes as well.
Hence, let's reorder these two modes to prefer copper.
--- drivers/net/phy/phy-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phy-core.c +1 -1
@@ -162,11 +162,11 @@ static const struct phy_setting settings[] = { PHY_SETTING( 2500, FULL, 2500baseT_Full ), PHY_SETTING( 2500, FULL, 2500baseX_Full ),/* 1G */ - PHY_SETTING( 1000, FULL, 1000baseKX_Full ), PHY_SETTING( 1000, FULL, 1000baseT_Full ), PHY_SETTING( 1000, HALF, 1000baseT_Half ), PHY_SETTING( 1000, FULL, 1000baseT1_Full ), PHY_SETTING( 1000, FULL, 1000baseX_Full ), + PHY_SETTING( 1000, FULL, 1000baseKX_Full ),/* 100M */ PHY_SETTING( 100, FULL, 100baseT_Full ), PHY_SETTING( 100, FULL, 100baseT1_Full ),
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 537/846 gpio: aspeed: Convert aspeed_gpio.lock to raw_spinlock
In reply to Greg Kroah-HartmanFrom: Iwona Winiarska <[email protected]>
[ Upstream commit 61a7904b6ace99b1bde0d0e867fa3097f5c8cee2 ]
The gpio-aspeed driver implements an irq_chip which need to be invoked from hardirq context. Since spin_lock() can sleep with PREEMPT_RT, it is no longer legal to invoke it while interrupts are disabled. This also causes lockdep to complain about:
[ 0.649797] [ BUG: Invalid wait context ]
because aspeed_gpio.lock (spin_lock_t) is taken under irq_desc.lock (raw_spinlock_t).
Let's use of raw_spinlock_t instead of spinlock_t.
--- drivers/gpio/gpio-aspeed.c | 52 +++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 26 deletions(-)
drivers/gpio/gpio-aspeed.c +26 -26
@@ -53,7 +53,7 @@ struct aspeed_gpio_config {struct aspeed_gpio {struct gpio_chip chip;struct irq_chip irqc; -spinlock_t lock; +raw_spinlock_t lock;void __iomem *base;int irq;const struct aspeed_gpio_config *config;
@@ -413,14 +413,14 @@ static void aspeed_gpio_set(struct gpio_chip *gc, unsigned int offset,unsigned long flags;bool copro; -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags); copro =aspeed_gpio_copro_request (gpio, offset);__aspeed_gpio_set (gc, offset, val);if (copro)aspeed_gpio_copro_release (gpio, offset); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags); }static int aspeed_gpio_dir_in (struct gpio_chip *gc,unsigned int offset)
@@ -435,7 +435,7 @@ static int aspeed_gpio_dir_in(struct gpio_chip *gc, unsigned int offset)if (!have_input (gpio, offset))return -ENOTSUPP ; -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags); reg =ioread32 (addr); reg &= ~GPIO_BIT (offset);
@@ -445,7 +445,7 @@ static int aspeed_gpio_dir_in(struct gpio_chip *gc, unsigned int offset)if (copro)aspeed_gpio_copro_release (gpio, offset); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags);return 0 ; }
@@ -463,7 +463,7 @@ static int aspeed_gpio_dir_out(struct gpio_chip *gc,if (!have_output (gpio, offset))return -ENOTSUPP ; -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags); reg =ioread32 (addr); reg |=GPIO_BIT (offset);
@@ -474,7 +474,7 @@ static int aspeed_gpio_dir_out(struct gpio_chip *gc,if (copro)aspeed_gpio_copro_release (gpio, offset); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags);return 0 ; }
@@ -492,11 +492,11 @@ static int aspeed_gpio_get_direction(struct gpio_chip *gc, unsigned int offset)if (!have_output (gpio, offset))return GPIO_LINE_DIRECTION_IN ; -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags); val =ioread32 (bank_reg (gpio, bank, reg_dir)) &GPIO_BIT (offset); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags);return val ?GPIO_LINE_DIRECTION_OUT :GPIO_LINE_DIRECTION_IN ; }
@@ -539,14 +539,14 @@ static void aspeed_gpio_irq_ack(struct irq_data *d) status_addr =bank_reg (gpio, bank, reg_irq_status); -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags); copro =aspeed_gpio_copro_request (gpio, offset);iowrite32 (bit, status_addr);if (copro)aspeed_gpio_copro_release (gpio, offset); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags); }static void aspeed_gpio_irq_set_mask (struct irq_data *d,bool set)
@@ -565,7 +565,7 @@ static void aspeed_gpio_irq_set_mask(struct irq_data *d, bool set) addr =bank_reg (gpio, bank, reg_irq_enable); -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags); copro =aspeed_gpio_copro_request (gpio, offset); reg =ioread32 (addr);
@@ -577,7 +577,7 @@ static void aspeed_gpio_irq_set_mask(struct irq_data *d, bool set)if (copro)aspeed_gpio_copro_release (gpio, offset); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags); }static void aspeed_gpio_irq_mask (struct irq_data *d)
@@ -629,7 +629,7 @@ static int aspeed_gpio_set_type(struct irq_data *d, unsigned int type)return -EINVAL ; } -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags); copro =aspeed_gpio_copro_request (gpio, offset); addr =bank_reg (gpio, bank, reg_irq_type0);
@@ -649,7 +649,7 @@ static int aspeed_gpio_set_type(struct irq_data *d, unsigned int type)if (copro)aspeed_gpio_copro_release (gpio, offset); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags);irq_set_handler_locked (d, handler);
@@ -716,7 +716,7 @@ static int aspeed_gpio_reset_tolerance(struct gpio_chip *chip, treg =bank_reg (gpio,to_bank (offset), reg_tolerance); -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags); copro =aspeed_gpio_copro_request (gpio, offset); val =readl (treg);
@@ -730,7 +730,7 @@ static int aspeed_gpio_reset_tolerance(struct gpio_chip *chip,if (copro)aspeed_gpio_copro_release (gpio, offset); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags);return 0 ; }
@@ -856,7 +856,7 @@ static int enable_debounce(struct gpio_chip *chip, unsigned int offset,return rc; } -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags);if (timer_allocation_registered (gpio, offset)) { rc =unregister_allocated_timer (gpio, offset);
@@ -916,7 +916,7 @@ static int enable_debounce(struct gpio_chip *chip, unsigned int offset,configure_timer (gpio, offset, i); out: -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags);return rc; }
@@ -927,13 +927,13 @@ static int disable_debounce(struct gpio_chip *chip, unsigned int offset)unsigned long flags;int rc; -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags); rc =unregister_allocated_timer (gpio, offset);if (!rc)configure_timer (gpio, offset,0 ); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags);return rc; }
@@ -1015,7 +1015,7 @@ int aspeed_gpio_copro_grab_gpio(struct gpio_desc *desc,return -EINVAL ; bindex = offset >>3 ; -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags);/* Sanity check, this shouldn't happen */ if (gpio->cf_copro_bankmap[bindex] ==0xff ) {
@@ -1036,7 +1036,7 @@ int aspeed_gpio_copro_grab_gpio(struct gpio_desc *desc,if (bit) *bit =GPIO_OFFSET (offset); bail: -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags);return rc; }EXPORT_SYMBOL_GPL (aspeed_gpio_copro_grab_gpio);
@@ -1060,7 +1060,7 @@ int aspeed_gpio_copro_release_gpio(struct gpio_desc *desc)return -EINVAL ; bindex = offset >>3 ; -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags);/* Sanity check, this shouldn't happen */ if (gpio->cf_copro_bankmap[bindex] ==0 ) {
@@ -1074,7 +1074,7 @@ int aspeed_gpio_copro_release_gpio(struct gpio_desc *desc)aspeed_gpio_change_cmd_source (gpio, bank, bindex,GPIO_CMDSRC_ARM ); bail: -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags);return rc; }EXPORT_SYMBOL_GPL (aspeed_gpio_copro_release_gpio);
@@ -1148,7 +1148,7 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev)if (IS_ERR (gpio->base))return PTR_ERR (gpio->base); -spin_lock_init (&gpio->lock); +raw_spin_lock_init (&gpio->lock); gpio_id =of_match_node (aspeed_gpio_of_table, pdev->dev.of_node);if (!gpio_id)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 538/846 gpio: aspeed-sgpio: Convert aspeed_sgpio.lock to raw_spinlock
In reply to Greg Kroah-HartmanFrom: Iwona Winiarska <[email protected]>
[ Upstream commit ab39d6988dd53f354130438d8afa5596a2440fed ]
The gpio-aspeed-sgpio driver implements an irq_chip which need to be invoked from hardirq context. Since spin_lock() can sleep with PREEMPT_RT, it is no longer legal to invoke it while interrupts are disabled.
This also causes lockdep to complain about:
[ 25.919465] [ BUG: Invalid wait context ]
because aspeed_sgpio.lock (spin_lock_t) is taken under irq_desc.lock (raw_spinlock_t).
Let's use of raw_spinlock_t instead of spinlock_t.
--- drivers/gpio/gpio-aspeed-sgpio.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/gpio/gpio-aspeed-sgpio.c +16 -16
@@ -31,7 +31,7 @@ struct aspeed_sgpio {struct gpio_chip chip;struct irq_chip intc;struct clk *pclk; -spinlock_t lock; +raw_spinlock_t lock;void __iomem *base;int irq; };
@@ -173,12 +173,12 @@ static int aspeed_sgpio_get(struct gpio_chip *gc, unsigned int offset)enum aspeed_sgpio_reg reg;int rc =0 ; -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags); reg =aspeed_sgpio_is_input (offset) ? reg_val : reg_rdata; rc = !!(ioread32 (bank_reg (gpio, bank, reg)) &GPIO_BIT (offset)); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags);return rc; }
@@ -215,11 +215,11 @@ static void aspeed_sgpio_set(struct gpio_chip *gc, unsigned int offset, int val)struct aspeed_sgpio *gpio =gpiochip_get_data (gc);unsigned long flags; -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags);sgpio_set_value (gc, offset, val); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags); }static int aspeed_sgpio_dir_in (struct gpio_chip *gc,unsigned int offset)
@@ -236,9 +236,9 @@ static int aspeed_sgpio_dir_out(struct gpio_chip *gc, unsigned int offset, int v/* No special action is required for setting the direction; we'll * error-out in sgpio_set_value if this isn't an output GPIO */ -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags); rc =sgpio_set_value (gc, offset, val); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags);return rc; }
@@ -277,11 +277,11 @@ static void aspeed_sgpio_irq_ack(struct irq_data *d) status_addr =bank_reg (gpio, bank, reg_irq_status); -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags);iowrite32 (bit, status_addr); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags); }static void aspeed_sgpio_irq_set_mask (struct irq_data *d,bool set)
@@ -296,7 +296,7 @@ static void aspeed_sgpio_irq_set_mask(struct irq_data *d, bool set)irqd_to_aspeed_sgpio_data (d, &gpio, &bank, &bit, &offset); addr =bank_reg (gpio, bank, reg_irq_enable); -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags); reg =ioread32 (addr);if (set)
@@ -306,7 +306,7 @@ static void aspeed_sgpio_irq_set_mask(struct irq_data *d, bool set)iowrite32 (reg, addr); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags); }static void aspeed_sgpio_irq_mask (struct irq_data *d)
@@ -355,7 +355,7 @@ static int aspeed_sgpio_set_type(struct irq_data *d, unsigned int type)return -EINVAL ; } -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags); addr =bank_reg (gpio, bank, reg_irq_type0); reg =ioread32 (addr);
@@ -372,7 +372,7 @@ static int aspeed_sgpio_set_type(struct irq_data *d, unsigned int type) reg = (reg & ~bit) | type2;iowrite32 (reg, addr); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags);irq_set_handler_locked (d, handler);
@@ -467,7 +467,7 @@ static int aspeed_sgpio_reset_tolerance(struct gpio_chip *chip, reg =bank_reg (gpio,to_bank (offset), reg_tolerance); -spin_lock_irqsave (&gpio->lock, flags); +raw_spin_lock_irqsave (&gpio->lock, flags); val =readl (reg);
@@ -478,7 +478,7 @@ static int aspeed_sgpio_reset_tolerance(struct gpio_chip *chip,writel (val, reg); -spin_unlock_irqrestore (&gpio->lock, flags); +raw_spin_unlock_irqrestore (&gpio->lock, flags);return 0 ; }
@@ -575,7 +575,7 @@ static int __init aspeed_sgpio_probe(struct platform_device *pdev)iowrite32 (FIELD_PREP (ASPEED_SGPIO_CLK_DIV_MASK , sgpio_clk_div) | gpio_cnt_regval |ASPEED_SGPIO_ENABLE , gpio->base +ASPEED_SGPIO_CTRL ); -spin_lock_init (&gpio->lock); +raw_spin_lock_init (&gpio->lock); gpio->chip.parent = &pdev->dev; gpio->chip.ngpio = nr_gpios *2 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 539/846 selftests/ftrace: make kprobe profile testcase description unique
In reply to Greg Kroah-HartmanFrom: Heiko Carstens <[email protected]>
[ Upstream commit e5992f373c6eed6d09e5858e9623df1259b3ce30 ]
Commit 32f6e5da83c7 ("selftests/ftrace: Add kprobe profile testcase") added a new kprobes testcase, but has a description which does not describe what the test case is doing and is duplicating the description of another test case.
Therefore change the test case description, so it is unique and then allows easily to tell which test case actually passed or failed.
--- tools/testing/selftests/ftrace/test.d/kprobe/profile.tc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/ftrace/test.d/kprobe/profile.tc +1 -1
@@ -1,6 +1,6 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 -# description: Kprobe dynamic event - adding and removing +# description: Kprobe profile # requires: kprobe_events ! grep -q 'myevent' kprobe_profile
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 540/846 ath11k: Avoid false DEADLOCK warning reported by lockdep
In reply to Greg Kroah-HartmanFrom: Baochen Qiang <[email protected]>
[ Upstream commit 767c94caf0efad136157110787fe221b74cb5c8a ]
With CONFIG_LOCKDEP=y and CONFIG_DEBUG_SPINLOCK=y, lockdep reports below warning:
[ 166.059415] ============================================
[ 166.059416] WARNING: possible recursive locking detected
[ 166.059418] 5.15.0-wt-ath+ #10 Tainted: G W O
[ 166.059420] --------------------------------------------
[ 166.059421] kworker/0:2/116 is trying to acquire lock:
[ 166.059423] ffff9905f2083160 (&srng->lock){+.-.}-{2:2}, at: ath11k_hal_reo_cmd_send+0x20/0x490 [ath11k]
[ 166.059440]
but task is already holding lock:
[ 166.059442] ffff9905f2083230 (&srng->lock){+.-.}-{2:2}, at: ath11k_dp_process_reo_status+0x95/0x2d0 [ath11k]
[ 166.059491]
other info that might help us debug this:
[ 166.059492] Possible unsafe locking scenario:[ 166.059493] CPU0
[ 166.059494] ----
[ 166.059495] lock(&srng->lock);
[ 166.059498] lock(&srng->lock);
[ 166.059500]
*** DEADLOCK ***[ 166.059501] May be due to missing lock nesting notation
[ 166.059502] 3 locks held by kworker/0:2/116:
[ 166.059504] #0: ffff9905c0081548 ((wq_completion)events){+.+.}-{0:0}, at: process_one_work+0x1f6/0x660
[ 166.059511] #1: ffff9d2400a5fe68 ((debug_obj_work).work){+.+.}-{0:0}, at: process_one_work+0x1f6/0x660
[ 166.059517] #2: ffff9905f2083230 (&srng->lock){+.-.}-{2:2}, at: ath11k_dp_process_reo_status+0x95/0x2d0 [ath11k]
[ 166.059532]
stack backtrace:
[ 166.059534] CPU: 0 PID: 116 Comm: kworker/0:2 Kdump: loaded Tainted: G W O 5.15.0-wt-ath+ #10
[ 166.059537] Hardware name: Intel(R) Client Systems NUC8i7HVK/NUC8i7HVB, BIOS HNKBLi70.86A.0059.2019.1112.1124 11/12/2019
[ 166.059539] Workqueue: events free_obj_work
[ 166.059543] Call Trace:
[ 166.059545] <IRQ>
[ 166.059547] dump_stack_lvl+0x56/0x7b
[ 166.059552] __lock_acquire+0xb9a/0x1a50
[ 166.059556] lock_acquire+0x1e2/0x330
[ 166.059560] ? ath11k_hal_reo_cmd_send+0x20/0x490 [ath11k]
[ 166.059571] _raw_spin_lock_bh+0x33/0x70
[ 166.059574] ? ath11k_hal_reo_cmd_send+0x20/0x490 [ath11k]
[ 166.059584] ath11k_hal_reo_cmd_send+0x20/0x490 [ath11k]
[ 166.059594] ath11k_dp_tx_send_reo_cmd+0x3f/0x130 [ath11k]
[ 166.059605] ath11k_dp_rx_tid_del_func+0x221/0x370 [ath11k]
[ 166.059618] ath11k_dp_process_reo_status+0x22f/0x2d0 [ath11k]
[ 166.059632] ? ath11k_dp_service_srng+0x2ea/0x2f0 [ath11k]
[ 166.059643] ath11k_dp_service_srng+0x2ea/0x2f0 [ath11k]
[ 166.059655] ath11k_pci_ext_grp_napi_poll+0x1c/0x70 [ath11k_pci]
[ 166.059659] __napi_poll+0x28/0x230
[ 166.059664] net_rx_action+0x285/0x310
[ 166.059668] __do_softirq+0xe6/0x4d2
[ 166.059672] irq_exit_rcu+0xd2/0xf0
[ 166.059675] common_interrupt+0xa5/0xc0
[ 166.059678] </IRQ>
[ 166.059679] <TASK>
[ 166.059680] asm_common_interrupt+0x1e/0x40
[ 166.059683] RIP: 0010:_raw_spin_unlock_irqrestore+0x38/0x70
[ 166.059686] Code: 83 c7 18 e8 2a 95 43 ff 48 89 ef e8 22 d2 43 ff 81 e3 00 02 00 00 75 25 9c 58 f6 c4 02 75 2d 48 85 db 74 01 fb bf 01 00 00 00 <e8> 63 2e 40 ff 65 8b 05 8c 59 97 5c 85 c0 74 0a 5b 5d c3 e8 00 6a
[ 166.059689] RSP: 0018:ffff9d2400a5fca0 EFLAGS: 00000206
[ 166.059692] RAX: 0000000000000002 RBX: 0000000000000200 RCX: 0000000000000006
[ 166.059694] RDX: 0000000000000000 RSI: ffffffffa404879b RDI: 0000000000000001
[ 166.059696] RBP: ffff9905c0053000 R08: 0000000000000001 R09: 0000000000000001
[ 166.059698] R10: ffff9d2400a5fc50 R11: 0000000000000001 R12: ffffe186c41e2840
[ 166.059700] R13: 0000000000000001 R14: ffff9905c78a1c68 R15: 0000000000000001
[ 166.059704] free_debug_processing+0x257/0x3d0
[ 166.059708] ? free_obj_work+0x1f5/0x250
[ 166.059712] __slab_free+0x374/0x5a0
[ 166.059718] ? kmem_cache_free+0x2e1/0x370
[ 166.059721] ? free_obj_work+0x1f5/0x250
[ 166.059724] kmem_cache_free+0x2e1/0x370
[ 166.059727] free_obj_work+0x1f5/0x250
[ 166.059731] process_one_work+0x28b/0x660
[ 166.059735] ? process_one_work+0x660/0x660
[ 166.059738] worker_thread+0x37/0x390
[ 166.059741] ? process_one_work+0x660/0x660
[ 166.059743] kthread+0x176/0x1a0
[ 166.059746] ? set_kthread_struct+0x40/0x40
[ 166.059749] ret_from_fork+0x22/0x30
[ 166.059754] </TASK>Since these two lockes are both initialized in ath11k_hal_srng_setup, they are assigned with the same key. As a result lockdep suspects that the task is trying to acquire the same lock (due to same key) while already holding it, and thus reports the DEADLOCK warning. However as they are different spinlock instances, the warning is false positive.
On the other hand, even no dead lock indeed, this is a major issue for upstream regression testing as it disables lockdep functionality.
Fix it by assigning separate lock class key for each srng->lock.
Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-01720.1-QCAHSPSWPL_V1_V2_SILICONZ_LITE-1
--- drivers/net/wireless/ath/ath11k/hal.c | 22 ++++++++++++++++++++++ drivers/net/wireless/ath/ath11k/hal.h | 2 ++ 2 files changed, 24 insertions(+)
drivers/net/wireless/ath/ath11k/hal.c +22 -0
@@ -947,6 +947,7 @@ int ath11k_hal_srng_setup(struct ath11k_base *ab, enum hal_ring_type type, srng->msi_data = params->msi_data; srng->initialized =1 ;spin_lock_init (&srng->lock); +lockdep_set_class (&srng->lock, hal->srng_key + ring_id);for (i =0 ; i <HAL_SRNG_NUM_REG_GRP ; i++) { srng->hwreg_base[i] = srng_config->reg_start[i] +
@@ -1233,6 +1234,24 @@ static int ath11k_hal_srng_create_config(struct ath11k_base *ab)return 0 ; } +static void ath11k_hal_register_srng_key (struct ath11k_base *ab) +{ +struct ath11k_hal *hal = &ab->hal; +u32 ring_id; + +for (ring_id =0 ; ring_id <HAL_SRNG_RING_ID_MAX ; ring_id++) +lockdep_register_key (hal->srng_key + ring_id); +} + +static void ath11k_hal_unregister_srng_key (struct ath11k_base *ab) +{ +struct ath11k_hal *hal = &ab->hal; +u32 ring_id; + +for (ring_id =0 ; ring_id <HAL_SRNG_RING_ID_MAX ; ring_id++) +lockdep_unregister_key (hal->srng_key + ring_id); +} +int ath11k_hal_srng_init (struct ath11k_base *ab) {struct ath11k_hal *hal = &ab->hal;
@@ -1252,6 +1271,8 @@ int ath11k_hal_srng_init(struct ath11k_base *ab)if (ret) goto err_free_cont_rdp; +ath11k_hal_register_srng_key (ab); +return 0 ; err_free_cont_rdp:
@@ -1266,6 +1287,7 @@ void ath11k_hal_srng_deinit(struct ath11k_base *ab) {struct ath11k_hal *hal = &ab->hal; +ath11k_hal_unregister_srng_key (ab);ath11k_hal_free_cont_rdp (ab);ath11k_hal_free_cont_wrp (ab);kfree (hal->srng_config);
drivers/net/wireless/ath/ath11k/hal.h +2 -0
@@ -901,6 +901,8 @@ struct ath11k_hal {/* shadow register configuration */ u32 shadow_reg_addr[HAL_SHADOW_NUM_REGS ];int num_shadow_reg_configured; + +struct lock_class_key srng_key[HAL_SRNG_RING_ID_MAX ]; };u32 ath11k_hal_reo_qdesc_size (u32 ba_window_size,u8 tid);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 541/846 ARM: dts: qcom: sdx55: fix IPA interconnect definitions
In reply to Greg Kroah-HartmanFrom: Alex Elder <[email protected]>
[ Upstream commit c0d6316c238b1bd743108bd4b08eda364f47c7c9 ]
The first two interconnects defined for IPA on the SDX55 SoC are really two parts of what should be represented as a single path between IPA and system memory.
Fix this by combining the "memory-a" and "memory-b" interconnects into a single "memory" interconnect.
--- arch/arm/boot/dts/qcom-sdx55.dtsi | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
arch/arm/boot/dts/qcom-sdx55.dtsi +2 -4
@@ -334,12 +334,10 @@ clocks = <&rpmhcc RPMH_IPA_CLK>; clock-names = "core"; - interconnects = <&system_noc MASTER_IPA &system_noc SLAVE_SNOC_MEM_NOC_GC>, - <&mem_noc MASTER_SNOC_GC_MEM_NOC &mc_virt SLAVE_EBI_CH0>, + interconnects = <&system_noc MASTER_IPA &mc_virt SLAVE_EBI_CH0>, <&system_noc MASTER_IPA &system_noc SLAVE_OCIMEM>, <&mem_noc MASTER_AMPSS_M0 &system_noc SLAVE_IPA_CFG>; - interconnect-names = "memory-a", - "memory-b", + interconnect-names = "memory", "imem", "config";
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 542/846 x86/mce: Allow instrumentation during task work queueing
In reply to Greg Kroah-HartmanFrom: Borislav Petkov <[email protected]>
[ Upstream commit 4fbce464db81a42f9a57ee242d6150ec7f996415 ]
Fixes
vmlinux.o: warning: objtool: do_machine_check()+0xdb1: call to queue_task_work() leaves .noinstr.text section
--- arch/x86/kernel/cpu/mce/core.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/x86/kernel/cpu/mce/core.c +11 -0
@@ -1454,6 +1454,14 @@ noinstr void do_machine_check(struct pt_regs *regs)if (worst !=MCE_AR_SEVERITY && !kill_current_task) goto out; +/* +* Enable instrumentation around the external facilities like +* task_work_add() (via queue_task_work()), fixup_exception() etc. +* For now, that is. Fixing this properly would need a lot more involved +* reorganization. +*/ +instrumentation_begin (); +/* Fault was in user mode and we need to take some action */ if ((m.cs &3 ) ==3 ) {/* If this triggers there is no way to recover. Die hard. */
@@ -1479,6 +1487,9 @@ noinstr void do_machine_check(struct pt_regs *regs)if (m.kflags &MCE_IN_KERNEL_COPYIN )queue_task_work (&m, msg, kill_current_task); } + +instrumentation_end (); + out:mce_wrmsrl (MSR_IA32_MCG_STATUS ,0 ); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 543/846 x86/mce: Mark mce_panic() noinstr
In reply to Greg Kroah-HartmanFrom: Borislav Petkov <[email protected]>
[ Upstream commit 3c7ce80a818fa7950be123cac80cd078e5ac1013 ]
And allow instrumentation inside it because it does calls to other facilities which will not be tagged noinstr.
Fixes
vmlinux.o: warning: objtool: do_machine_check()+0xc73: call to mce_panic() leaves .noinstr.text section
--- arch/x86/kernel/cpu/mce/core.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
arch/x86/kernel/cpu/mce/core.c +12 -3
@@ -295,11 +295,17 @@ static void wait_for_panic(void)panic ("Panicing machine check CPU died" ); } -static void mce_panic (const char *msg,struct mce *final,char *exp) +static noinstr void mce_panic(const char *msg, struct mce *final, char *exp) { -int apei_err =0 ;struct llist_node *pending;struct mce_evt_llist *l; +int apei_err =0 ; + +/* +* Allow instrumentation around external facilities usage. Not that it +* matters a whole lot since the machine is going to panic anyway. +*/ +instrumentation_begin ();if (!fake_panic) {/*
@@ -314,7 +320,7 @@ static void mce_panic(const char *msg, struct mce *final, char *exp) }else {/* Don't log too much for fake panic */ if (atomic_inc_return (&mce_fake_panicked) >1 ) -return ; + goto out; } pending =mce_gen_pool_prepare_records ();/* First print corrected ones that are still unlogged */
@@ -352,6 +358,9 @@ static void mce_panic(const char *msg, struct mce *final, char *exp)panic (msg); }else pr_emerg (HW_ERR "Fake kernel panic: %s\n" , msg); + +out: +instrumentation_end (); }/* Support code for software error injection */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 544/846 x86/mce: Mark mce_end() noinstr
In reply to Greg Kroah-HartmanFrom: Borislav Petkov <[email protected]>
[ Upstream commit b4813539d37fa31fed62cdfab7bd2dd8929c5b2e ]
It is called by the #MC handler which is noinstr.
Fixes
vmlinux.o: warning: objtool: do_machine_check()+0xbd6: call to memset() leaves .noinstr.text section
--- arch/x86/kernel/cpu/mce/core.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
arch/x86/kernel/cpu/mce/core.c +11 -3
@@ -1081,10 +1081,13 @@ static int mce_start(int *no_way_out)* Synchronize between CPUs after main scanning loop. * This invokes the bulk of the Monarch processing. */ -static int mce_end (int order) +static noinstr int mce_end(int order) { -int ret =-1 ;u64 timeout = (u64 )mca_cfg.monarch_timeout *NSEC_PER_USEC ; +int ret =-1 ; + +/* Allow instrumentation around external facilities. */ +instrumentation_begin ();if (!timeout) goto reset;
@@ -1128,7 +1131,8 @@ static int mce_end(int order)/* * Don't reset anything. That's done by the Monarch. */ -return 0 ; + ret =0 ; + goto out; }/*
@@ -1144,6 +1148,10 @@ reset:* Let others run again. */ atomic_set (&mce_executing,0 ); + +out: +instrumentation_end (); +return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 545/846 x86/mce: Mark mce_read_aux() noinstr
In reply to Greg Kroah-HartmanFrom: Borislav Petkov <[email protected]>
[ Upstream commit db6c996d6ce45dfb44891f0824a65ecec216f47a ]
Fixes
vmlinux.o: warning: objtool: do_machine_check()+0x681: call to mce_read_aux() leaves .noinstr.text section
--- arch/x86/kernel/cpu/mce/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/mce/core.c +1 -1
@@ -691,7 +691,7 @@ static struct notifier_block mce_default_nb = {/* * Read ADDR and MISC registers. */ -static void mce_read_aux (struct mce *m,int i) +static noinstr void mce_read_aux(struct mce *m, int i) {if (m->status &MCI_STATUS_MISCV ) m->misc =mce_rdmsrl (msr_ops.misc (i));
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 546/846 net: bonding: debug: avoid printing debug logs when bond is not notifying peers
In reply to Greg Kroah-HartmanFrom: Suresh Kumar <[email protected]>
[ Upstream commit fee32de284ac277ba434a2d59f8ce46528ff3946 ]
Currently "bond_should_notify_peers: slave ..." messages are printed whenever "bond_should_notify_peers" function is called.
+++
Dec 12 12:33:26 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 Dec 12 12:33:26 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 Dec 12 12:33:26 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 Dec 12 12:33:26 node1 kernel: bond0: (slave enp0s25): Received LACPDU on port 1 Dec 12 12:33:26 node1 kernel: bond0: (slave enp0s25): Rx Machine: Port=1, Last State=6, Curr State=6 Dec 12 12:33:26 node1 kernel: bond0: (slave enp0s25): partner sync=1 Dec 12 12:33:26 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 Dec 12 12:33:26 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 Dec 12 12:33:26 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 ... Dec 12 12:33:30 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 Dec 12 12:33:30 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 Dec 12 12:33:30 node1 kernel: bond0: (slave enp4s3): Received LACPDU on port 2 Dec 12 12:33:30 node1 kernel: bond0: (slave enp4s3): Rx Machine: Port=2, Last State=6, Curr State=6 Dec 12 12:33:30 node1 kernel: bond0: (slave enp4s3): partner sync=1 Dec 12 12:33:30 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 Dec 12 12:33:30 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25 Dec 12 12:33:30 node1 kernel: bond0: bond_should_notify_peers: slave enp0s25
+++
This is confusing and can also clutter up debug logs. Print logs only when the peer notification happens.
--- drivers/net/bonding/bond_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/bonding/bond_main.c +3 -3
@@ -1096,9 +1096,6 @@ static bool bond_should_notify_peers(struct bonding *bond) slave =rcu_dereference (bond->curr_active_slave);rcu_read_unlock (); -netdev_dbg (bond->dev,"bond_should_notify_peers: slave %s\n" , - slave ? slave->dev->name :"NULL" ); - if (!slave || !bond->send_peer_notif || bond->send_peer_notif % max(1, bond->params.peer_notif_delay) != 0 ||
@@ -1106,6 +1103,9 @@ static bool bond_should_notify_peers(struct bonding *bond) test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state))return false; +netdev_dbg (bond->dev,"bond_should_notify_peers: slave %s\n" , + slave ? slave->dev->name :"NULL" ); +return true; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 547/846 kunit: Dont crash if no parameters are generated
In reply to Greg Kroah-HartmanFrom: David Gow <[email protected]>
[ Upstream commit 37dbb4c7c7442dbfc9b651e4ddd4afe30b26afc9 ]
It's possible that a parameterised test could end up with zero parameters. At the moment, the test function will nevertheless be called with NULL as the parameter. Instead, don't try to run the test code, and just mark the test as SKIPped.
--- lib/kunit/test.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
lib/kunit/test.c +10 -8
@@ -504,16 +504,18 @@ int kunit_run_tests(struct kunit_suite *suite)struct kunit_result_stats param_stats = {0 }; test_case->status =KUNIT_SKIPPED ; -if (test_case->generate_params) { +if (!test_case->generate_params) { +/* Non-parameterised test. */ +kunit_run_case_catch_errors (suite, test_case, &test); +kunit_update_stats (¶m_stats, test.status); + }else {/* Get initial param. */ param_desc[0 ] ='\0' ; test.param_value = test_case->generate_params (NULL , param_desc); - } - do { - kunit_run_case_catch_errors(suite, test_case, &test); +while (test.param_value) { +kunit_run_case_catch_errors (suite, test_case, &test); - if (test_case->generate_params) {if (param_desc[0 ] =='\0' ) {snprintf (param_desc,sizeof (param_desc),"param-%d" , test.param_index);
@@ -530,11 +532,11 @@ int kunit_run_tests(struct kunit_suite *suite) param_desc[0 ] ='\0' ; test.param_value = test_case->generate_params (test.param_value, param_desc); test.param_index++; - } -kunit_update_stats (¶m_stats, test.status); +kunit_update_stats (¶m_stats, test.status); + } + } - }while (test.param_value);kunit_print_test_stats (&test, param_stats);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 548/846 bpf: Do not WARN in bpf_warn_invalid_xdp_action()
In reply to Greg Kroah-HartmanFrom: Paolo Abeni <[email protected]>
[ Upstream commit 2cbad989033bff0256675c38f96f5faab852af4b ]
The WARN_ONCE() in bpf_warn_invalid_xdp_action() can be triggered by any bugged program, and even attaching a correct program to a NIC not supporting the given action.
The resulting splat, beyond polluting the logs, fouls automated tools:
e.g. a syzkaller reproducers using an XDP program returning an unsupported action will never pass validation.
Replace the WARN_ONCE with a less intrusive pr_warn_once().
--- net/core/filter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/core/filter.c +3 -3
@@ -8178,9 +8178,9 @@ void bpf_warn_invalid_xdp_action(u32 act) {const u32 act_max =XDP_REDIRECT ; -WARN_ONCE (1 ,"%s XDP return value %u, expect packet loss!\n" , - act > act_max ?"Illegal" :"Driver unsupported" , - act); +pr_warn_once ("%s XDP return value %u, expect packet loss!\n" , + act > act_max ?"Illegal" :"Driver unsupported" , + act); }EXPORT_SYMBOL_GPL (bpf_warn_invalid_xdp_action);
Signature · 1 line
2.34.1