media: Revert "media: rkisp1: Drop IRQF_SHARED"
Subsystems (11)
Sasha Levin
maintainerPATCH 1/12 media: Revert "media: rkisp1: Drop IRQF_SHARED"
From: Tomi Valkeinen <[email protected]>
[ Upstream commit a107d643b2a3382e0a2d2c4ef08bf8c6bff4561d ]
This reverts commit 85d2a31fe4d9be1555f621ead7a520d8791e0f74.
The rkisp1 does share interrupt lines on some platforms, after all. Thus we need to revert this, and implement a fix for the rkisp1 shared irq handling in a follow-up patch.
--- drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c +1 -1
@@ -559,7 +559,7 @@ static int rkisp1_probe(struct platform_device *pdev) rkisp1->irqs[il] = irq; } - ret =devm_request_irq (dev, irq, info->isrs[i].isr,0 , + ret =devm_request_irq (dev, irq, info->isrs[i].isr,IRQF_SHARED ,dev_driver_string (dev), dev);if (ret) {dev_err (dev,"request irq failed: %d\n" , ret);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 2/12 media: rkisp1: Fix IRQ handling due to shared interrupts
From: Tomi Valkeinen <[email protected]>
[ Upstream commit ffb635bb398fc07cb38f8a7b4a82cbe5f412f08e ]
The driver requests the interrupts as IRQF_SHARED, so the interrupt handlers can be called at any time. If such a call happens while the ISP is powered down, the SoC will hang as the driver tries to access the ISP registers.
This can be reproduced even without the platform sharing the IRQ line:
Enable CONFIG_DEBUG_SHIRQ and unload the driver, and the board will hang.
Fix this by adding a new field, 'irqs_enabled', which is used to bail out from the interrupt handler when the ISP is not operational.
--- .../platform/rockchip/rkisp1/rkisp1-capture.c | 3 +++ .../platform/rockchip/rkisp1/rkisp1-common.h | 2 ++ .../platform/rockchip/rkisp1/rkisp1-csi.c | 3 +++ .../platform/rockchip/rkisp1/rkisp1-dev.c | 22 +++++++++++++++++++ .../platform/rockchip/rkisp1/rkisp1-isp.c | 3 +++ 5 files changed, 33 insertions(+)
drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c +3 -0
@@ -701,6 +701,9 @@ irqreturn_t rkisp1_capture_isr(int irq, void *ctx)unsigned int i;u32 status; +if (!rkisp1->irqs_enabled) +return IRQ_NONE ; + status =rkisp1_read (rkisp1,RKISP1_CIF_MI_MIS );if (!status)return IRQ_NONE ;
drivers/media/platform/rockchip/rkisp1/rkisp1-common.h +2 -0
@@ -467,6 +467,7 @@ struct rkisp1_debug {* @debug: debug params to be exposed on debugfs * @info: version-specific ISP information * @irqs: IRQ line numbers +* @irqs_enabled: the hardware is enabled and can cause interrupts */ struct rkisp1_device {void __iomem *base_addr;
@@ -488,6 +489,7 @@ struct rkisp1_device {struct rkisp1_debug debug;const struct rkisp1_info *info;int irqs[RKISP1_NUM_IRQS ]; +bool irqs_enabled; };/*
drivers/media/platform/rockchip/rkisp1/rkisp1-csi.c +3 -0
@@ -211,6 +211,9 @@ irqreturn_t rkisp1_csi_isr(int irq, void *ctx)struct rkisp1_device *rkisp1 =dev_get_drvdata (dev);u32 val, status; +if (!rkisp1->irqs_enabled) +return IRQ_NONE ; + status =rkisp1_read (rkisp1,RKISP1_CIF_MIPI_MIS );if (!status)return IRQ_NONE ;
drivers/media/platform/rockchip/rkisp1/rkisp1-dev.c +22 -0
@@ -305,6 +305,24 @@ static int __maybe_unused rkisp1_runtime_suspend(struct device *dev) {struct rkisp1_device *rkisp1 =dev_get_drvdata (dev); + rkisp1->irqs_enabled = false; +/* Make sure the IRQ handler will see the above */ +mb (); + +/* +* Wait until any running IRQ handler has returned. The IRQ handler +* may get called even after this (as it's a shared interrupt line) +* but the 'irqs_enabled' flag will make the handler return immediately. +*/ +for (unsigned int il =0 ; il <ARRAY_SIZE (rkisp1->irqs); ++il) { +if (rkisp1->irqs[il] ==-1 ) +continue ; + +/* Skip if the irq line is the same as previous */ +if (il ==0 || rkisp1->irqs[il -1 ] != rkisp1->irqs[il]) +synchronize_irq (rkisp1->irqs[il]); + } +clk_bulk_disable_unprepare (rkisp1->clk_size, rkisp1->clks);return pinctrl_pm_select_sleep_state (dev); }
@@ -321,6 +339,10 @@ static int __maybe_unused rkisp1_runtime_resume(struct device *dev)if (ret)return ret; + rkisp1->irqs_enabled = true; +/* Make sure the IRQ handler will see the above */ +mb (); +return 0 ; }
drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c +3 -0
@@ -1023,6 +1023,9 @@ irqreturn_t rkisp1_isp_isr(int irq, void *ctx)struct rkisp1_device *rkisp1 =dev_get_drvdata (dev);u32 status, isp_err; +if (!rkisp1->irqs_enabled) +return IRQ_NONE ; + status =rkisp1_read (rkisp1,RKISP1_CIF_ISP_MIS );if (!status)return IRQ_NONE ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 3/12 perf/arm-cmn: Workaround AmpereOneX errata AC04_MESH_1 (incorrect child count)
In reply to Sasha LevinFrom: Ilkka Koskinen <[email protected]>
[ Upstream commit 50572064ec7109b00eef8880e905f55861c8b3de ]
AmpereOneX mesh implementation has a bug in HN-P nodes that makes them report incorrect child count. The failing crosspoints report 8 children while they only have two.
When the driver tries to access the inexistent child nodes, it believes it has reached an invalid node type and probing fails. The workaround is to ignore those incorrect child nodes and continue normally.
--- drivers/perf/arm-cmn.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/perf/arm-cmn.c +11 -0
@@ -2178,6 +2178,17 @@ static int arm_cmn_discover(struct arm_cmn *cmn, unsigned int rgn_offset)dev_dbg (cmn->dev,"ignoring external node %llx\n" , reg);continue ; } +/* +* AmpereOneX erratum AC04_MESH_1 makes some XPs report a bogus +* child count larger than the number of valid child pointers. +* A child offset of 0 can only occur on CMN-600; otherwise it +* would imply the root node being its own grandchild, which +* we can safely dismiss in general. +*/ +if (reg ==0 && cmn->part !=PART_CMN600 ) { +dev_dbg (cmn->dev,"bogus child pointer?\n" ); +continue ; + }arm_cmn_init_node_info (cmn, reg &CMN_CHILD_NODE_ADDR , dn);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 4/12 btrfs: add and use helper to check if block group is used
In reply to Sasha LevinFrom: Filipe Manana <[email protected]>
[ Upstream commit 1693d5442c458ae8d5b0d58463b873cd879569ed ]
Add a helper function to determine if a block group is being used and make use of it at btrfs_delete_unused_bgs(). This helper will also be used in future code changes.
--- fs/btrfs/block-group.c | 3 +-- fs/btrfs/block-group.h | 7 +++++++ 2 files changed, 8 insertions(+), 2 deletions(-)
fs/btrfs/block-group.c +1 -2
@@ -1375,8 +1375,7 @@ void btrfs_delete_unused_bgs(struct btrfs_fs_info *fs_info) }spin_lock (&block_group->lock); -if (block_group->reserved || block_group->pinned || - block_group->used || block_group->ro || +if (btrfs_is_block_group_used (block_group) || block_group->ro ||list_is_singular (&block_group->list)) {/* * We want to bail if we made new allocations or have
fs/btrfs/block-group.h +7 -0
@@ -241,6 +241,13 @@ static inline u64 btrfs_block_group_end(struct btrfs_block_group *block_group)return (block_group->start + block_group->length); } +static inline bool btrfs_is_block_group_used (const struct btrfs_block_group *bg) +{ +lockdep_assert_held (&bg->lock); + +return (bg->used >0 || bg->reserved >0 || bg->pinned >0 ); +} +static inline bool btrfs_is_block_group_data_only (struct btrfs_block_group *block_group) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 5/12 selftests: tls: use exact comparison in recv_partial
In reply to Sasha LevinFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 49d821064c44cb5ffdf272905236012ea9ce50e3 ]
This exact case was fail for async crypto and we weren't catching it.
--- tools/testing/selftests/net/tls.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/testing/selftests/net/tls.c +4 -4
@@ -926,12 +926,12 @@ TEST_F(tls, recv_partial)memset (recv_mem,0 ,sizeof (recv_mem));EXPECT_EQ (send (self->fd, test_str, send_len,0 ), send_len); -EXPECT_NE (recv (self->cfd, recv_mem,strlen (test_str_first), -MSG_WAITALL ),-1 ); +EXPECT_EQ (recv (self->cfd, recv_mem,strlen (test_str_first), +MSG_WAITALL ),strlen (test_str_first));EXPECT_EQ (memcmp (test_str_first, recv_mem,strlen (test_str_first)),0 );memset (recv_mem,0 ,sizeof (recv_mem)); -EXPECT_NE (recv (self->cfd, recv_mem,strlen (test_str_second), -MSG_WAITALL ),-1 ); +EXPECT_EQ (recv (self->cfd, recv_mem,strlen (test_str_second), +MSG_WAITALL ),strlen (test_str_second));EXPECT_EQ (memcmp (test_str_second, recv_mem,strlen (test_str_second)),0 ); }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 6/12 ASoC: rt5645: Make LattePanda board DMI match more precise
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 551539a8606e28cb2a130f8ef3e9834235b456c4 ]
The DMI strings used for the LattePanda board DMI quirks are very generic.
Using the dmidecode database from https://linux-hardware.org/ shows that the chosen DMI strings also match the following 2 laptops which also have a rt5645 codec:
Insignia NS-P11W7100 https://linux-hardware.org/?computer=E092FFF8BA04
Insignia NS-P10W8100 https://linux-hardware.org/?computer=AFB6C0BF7934
All 4 hw revisions of the LattePanda board have "S70CR" in their BIOS version DMI strings:
DF-BI-7-S70CR100-*
DF-BI-7-S70CR110-*
DF-BI-7-S70CR200-*
LP-BS-7-S70CR700-*
See e.g. https://linux-hardware.org/?computer=D98250A817C0
Add a partial (non exact) DMI match on this string to make the LattePanda board DMI match more precise to avoid false-positive matches.
--- sound/soc/codecs/rt5645.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
sound/soc/codecs/rt5645.c +10 -0
@@ -3801,6 +3801,16 @@ static const struct dmi_system_id dmi_platform_data[] = { DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"), DMI_EXACT_MATCH(DMI_BOARD_VERSION, "Default string"), +/* +* Above strings are too generic, LattePanda BIOS versions for +* all 4 hw revisions are: +* DF-BI-7-S70CR100-* +* DF-BI-7-S70CR110-* +* DF-BI-7-S70CR200-* +* LP-BS-7-S70CR700-* +* Do a partial match for S70CR to avoid false positive matches. +*/ + DMI_MATCH(DMI_BIOS_VERSION, "S70CR"), }, .driver_data = (void *)&lattepanda_board_platform_data, },
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 7/12 ASoC: amd: yc: Fix non-functional mic on Lenovo 82UU
In reply to Sasha LevinFrom: Attila Tőkés <[email protected]>
[ Upstream commit f7fe85b229bc30cb5dc95b4e9015a601c9e3a8cd ]
Like many other models, the Lenovo 82UU (Yoga Slim 7 Pro 14ARH7) needs a quirk entry for the internal microphone to function.
--- sound/soc/amd/yc/acp6x-mach.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/amd/yc/acp6x-mach.c +7 -0
@@ -227,6 +227,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "82QF"), } }, + { + .driver_data = &acp6x_card, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "82UU"), + } + }, { .driver_data = &acp6x_card, .matches = {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 8/12 x86/xen: Add some null pointer checking to smp.c
In reply to Sasha LevinFrom: Kunwu Chan <[email protected]>
[ Upstream commit 3693bb4465e6e32a204a5b86d3ec7e6b9f7e67c2 ]
kasprintf() returns a pointer to dynamically allocated memory which can be NULL upon failure. Ensure the allocation was successful by checking the pointer validity.
--- arch/x86/xen/smp.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/x86/xen/smp.c +12 -0
@@ -65,6 +65,8 @@ int xen_smp_intr_init(unsigned int cpu)char *resched_name, *callfunc_name, *debug_name; resched_name =kasprintf (GFP_KERNEL ,"resched%d" , cpu); +if (!resched_name) + goto fail_mem;per_cpu (xen_resched_irq, cpu).name = resched_name; rc = bind_ipi_to_irqhandler(XEN_RESCHEDULE_VECTOR, cpu,
@@ -77,6 +79,8 @@ int xen_smp_intr_init(unsigned int cpu)per_cpu (xen_resched_irq, cpu).irq = rc; callfunc_name =kasprintf (GFP_KERNEL ,"callfunc%d" , cpu); +if (!callfunc_name) + goto fail_mem;per_cpu (xen_callfunc_irq, cpu).name = callfunc_name; rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_VECTOR, cpu,
@@ -90,6 +94,9 @@ int xen_smp_intr_init(unsigned int cpu)if (!xen_fifo_events) { debug_name =kasprintf (GFP_KERNEL ,"debug%d" , cpu); +if (!debug_name) + goto fail_mem; +per_cpu (xen_debug_irq, cpu).name = debug_name; rc = bind_virq_to_irqhandler(VIRQ_DEBUG, cpu, xen_debug_interrupt,
@@ -101,6 +108,9 @@ int xen_smp_intr_init(unsigned int cpu) } callfunc_name =kasprintf (GFP_KERNEL ,"callfuncsingle%d" , cpu); +if (!callfunc_name) + goto fail_mem; +per_cpu (xen_callfuncsingle_irq, cpu).name = callfunc_name; rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_SINGLE_VECTOR, cpu,
@@ -114,6 +124,8 @@ int xen_smp_intr_init(unsigned int cpu)return 0 ; + fail_mem: + rc = -ENOMEM ; fail:xen_smp_intr_free (cpu);return rc;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 9/12 MIPS: Clear Cause.BD in instruction_pointer_set
In reply to Sasha LevinFrom: Jiaxun Yang <[email protected]>
[ Upstream commit 9d6e21ddf20293b3880ae55b9d14de91c5891c59 ]
Clear Cause.BD after we use instruction_pointer_set to override EPC.
This can prevent exception_epc check against instruction code at new return address.
It won't be considered as "in delay slot" after epc being overridden anyway.
--- arch/mips/include/asm/ptrace.h | 1 + 1 file changed, 1 insertion(+)
arch/mips/include/asm/ptrace.h +1 -0
@@ -60,6 +60,7 @@ static inline void instruction_pointer_set(struct pt_regs *regs, unsigned long val) { regs->cp0_epc = val; + regs->cp0_cause &= ~CAUSEF_BD ; }/* Query offset/name of register from its name/offset */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 10/12 HID: multitouch: Add required quirk for Synaptics 0xcddc device
In reply to Sasha LevinFrom: Manuel Fombuena <[email protected]>
[ Upstream commit 1741a8269e1c51fa08d4bfdf34667387a6eb10ec ]
Add support for the pointing stick (Accupoint) and 2 mouse buttons.
Present on some Toshiba/dynabook Portege X30 and X40 laptops.
It should close https://bugzilla.kernel.org/show_bug.cgi?id=205817
--- drivers/hid/hid-multitouch.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/hid/hid-multitouch.c +4 -0
@@ -2153,6 +2153,10 @@ static const struct hid_device_id mt_devices[] = {HID_DEVICE (BUS_I2C ,HID_GROUP_MULTITOUCH_WIN_8 , USB_VENDOR_ID_SYNAPTICS, 0xcd7e) }, + { .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT, +HID_DEVICE (BUS_I2C ,HID_GROUP_MULTITOUCH_WIN_8 , + USB_VENDOR_ID_SYNAPTICS, 0xcddc) }, + { .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT,HID_DEVICE (BUS_I2C ,HID_GROUP_MULTITOUCH_WIN_8 , USB_VENDOR_ID_SYNAPTICS, 0xce08) },
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 11/12 gen_compile_commands: fix invalid escape sequence warning
In reply to Sasha LevinFrom: Andrew Ballance <[email protected]>
[ Upstream commit dae4a0171e25884787da32823b3081b4c2acebb2 ]
With python 3.12, '\#' results in this warning
SyntaxWarning: invalid escape sequence '\#'
--- scripts/clang-tools/gen_compile_commands.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/clang-tools/gen_compile_commands.py +1 -1
@@ -170,7 +170,7 @@ def process_line(root_directory, command_prefix, file_path): # escape the pound sign '#', either as '\#' or '$(pound)' (depending on the # kernel version). The compile_commands.json file is not interepreted # by Make, so this code replaces the escaped version with '#'. - prefix = command_prefix.replace('\#', '#').replace('$(pound)', '#') + prefix = command_prefix.replace(r'\#', '#').replace('$(pound)', '#') # Use os.path.abspath() to normalize the path resolving '.' and '..' . abs_path = os.path.abspath(os.path.join(root_directory, file_path))
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 12/12 arm64/sve: Lower the maximum allocation for the SVE ptrace regset
In reply to Sasha LevinFrom: Mark Brown <[email protected]>
[ Upstream commit 2813926261e436d33bc74486b51cce60b76edf78 ]
Doug Anderson observed that ChromeOS crashes are being reported which include failing allocations of order 7 during core dumps due to ptrace allocating storage for regsets:
chrome: page allocation failure: order:7,
mode:0x40dc0(GFP_KERNEL|__GFP_COMP|__GFP_ZERO),
nodemask=(null),cpuset=urgent,mems_allowed=0
...
regset_get_alloc+0x1c/0x28
elf_core_dump+0x3d8/0xd8c
do_coredump+0xeb8/0x1378with further investigation showing that this is:
[ 66.957385] DOUG: Allocating 279584 bytes
which is the maximum size of the SVE regset. As Doug observes it is not entirely surprising that such a large allocation of contiguous memory might fail on a long running system.
The SVE regset is currently sized to hold SVE registers with a VQ of SVE_VQ_MAX which is 512, substantially more than the architectural maximum of 16 which we might see even in a system emulating the limits of the architecture. Since we don't expose the size we tell the regset core externally let's define ARCH_SVE_VQ_MAX with the actual architectural maximum and use that for the regset, we'll still overallocate most of the time but much less so which will be helpful even if the core is fixed to not require contiguous allocations.
Specify ARCH_SVE_VQ_MAX in terms of the maximum value that can be written into ZCR_ELx.LEN (where this is set in the hardware). For consistency update the maximum SME vector length to be specified in the same style while we are at it.
We could also teach the ptrace core about runtime discoverable regset sizes but that would be a more invasive change and this is being observed in practical systems.
--- arch/arm64/include/asm/fpsimd.h | 12 ++++++------ arch/arm64/kernel/ptrace.c | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-)
arch/arm64/include/asm/fpsimd.h +6 -6
@@ -36,13 +36,13 @@* When we defined the maximum SVE vector length we defined the ABI so * that the maximum vector length included all the reserved for future * expansion bits in ZCR rather than those just currently defined by -* the architecture. While SME follows a similar pattern the fact that -* it includes a square matrix means that any allocations that attempt -* to cover the maximum potential vector length (such as happen with -* the regset used for ptrace) end up being extremely large. Define -* the much lower actual limit for use in such situations. +* the architecture. Using this length to allocate worst size buffers +* results in excessively large allocations, and this effect is even +* more pronounced for SME due to ZA. Define more suitable VLs for +* these situations. */ -#define SME_VQ_MAX 16 +#define ARCH_SVE_VQ_MAX ((ZCR_ELx_LEN_MASK >> ZCR_ELx_LEN_SHIFT) + 1) +#define SME_VQ_MAX ((SMCR_ELx_LEN_MASK >> SMCR_ELx_LEN_SHIFT) + 1)struct task_struct ;
arch/arm64/kernel/ptrace.c +2 -1
@@ -1450,7 +1450,8 @@ static const struct user_regset aarch64_regsets[] = { #ifdef CONFIG_ARM64_SVE [REGSET_SVE ] = {/* Scalable Vector Extension */ .core_note_type =NT_ARM_SVE , - .n =DIV_ROUND_UP (SVE_PT_SIZE (SVE_VQ_MAX ,SVE_PT_REGS_SVE ), + .n =DIV_ROUND_UP (SVE_PT_SIZE (ARCH_SVE_VQ_MAX , +SVE_PT_REGS_SVE ),SVE_VQ_BYTES ), .size =SVE_VQ_BYTES , .align = SVE_VQ_BYTES,
Signature · 1 line
2.43.0