From f7d761b5d26eb14cd50947c94e830eaa0f061a02 Mon Sep 17 00:00:00 2001 From: Sasha Levin Date: Mon, 31 Jul 2023 21:06:56 -0400 Subject: [PATCH] Fixes for 5.4 Signed-off-by: Sasha Levin --- ...he-transaction-was-aborted-at-btrfs_.patch | 41 +++++++++ ...o-not-assume-a-fixed-block-to-cpu-ma.patch | 91 +++++++++++++++++++ queue-5.4/series | 2 + 3 files changed, 134 insertions(+) create mode 100644 queue-5.4/btrfs-check-if-the-transaction-was-aborted-at-btrfs_.patch create mode 100644 queue-5.4/irq-bcm6345-l1-do-not-assume-a-fixed-block-to-cpu-ma.patch diff --git a/queue-5.4/btrfs-check-if-the-transaction-was-aborted-at-btrfs_.patch b/queue-5.4/btrfs-check-if-the-transaction-was-aborted-at-btrfs_.patch new file mode 100644 index 00000000000..285bfa49476 --- /dev/null +++ b/queue-5.4/btrfs-check-if-the-transaction-was-aborted-at-btrfs_.patch @@ -0,0 +1,41 @@ +From 10c0df614e6969e381384226504c0fddbd43caea Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Jul 2023 10:49:20 +0100 +Subject: btrfs: check if the transaction was aborted at + btrfs_wait_for_commit() + +From: Filipe Manana + +[ Upstream commit bf7ecbe9875061bf3fce1883e3b26b77f847d1e8 ] + +At btrfs_wait_for_commit() we wait for a transaction to finish and then +always return 0 (success) without checking if it was aborted, in which +case the transaction didn't happen due to some critical error. Fix this +by checking if the transaction was aborted. + +Fixes: 462045928bda ("Btrfs: add START_SYNC, WAIT_SYNC ioctls") +CC: stable@vger.kernel.org # 4.19+ +Reviewed-by: Qu Wenruo +Signed-off-by: Filipe Manana +Reviewed-by: David Sterba +Signed-off-by: David Sterba +Signed-off-by: Sasha Levin +--- + fs/btrfs/transaction.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c +index f2bd9f833e8d7..f2e348d22dc1e 100644 +--- a/fs/btrfs/transaction.c ++++ b/fs/btrfs/transaction.c +@@ -776,6 +776,7 @@ int btrfs_wait_for_commit(struct btrfs_fs_info *fs_info, u64 transid) + } + + wait_for_commit(cur_trans); ++ ret = cur_trans->aborted; + btrfs_put_transaction(cur_trans); + out: + return ret; +-- +2.40.1 + diff --git a/queue-5.4/irq-bcm6345-l1-do-not-assume-a-fixed-block-to-cpu-ma.patch b/queue-5.4/irq-bcm6345-l1-do-not-assume-a-fixed-block-to-cpu-ma.patch new file mode 100644 index 00000000000..0ef7287719e --- /dev/null +++ b/queue-5.4/irq-bcm6345-l1-do-not-assume-a-fixed-block-to-cpu-ma.patch @@ -0,0 +1,91 @@ +From 0992650a85419d5da3aeec60bd0a88f13fca3dd3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 29 Jun 2023 09:26:20 +0200 +Subject: irq-bcm6345-l1: Do not assume a fixed block to cpu mapping +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Jonas Gorski + +[ Upstream commit 55ad24857341c36616ecc1d9580af5626c226cf1 ] + +The irq to block mapping is fixed, and interrupts from the first block +will always be routed to the first parent IRQ. But the parent interrupts +themselves can be routed to any available CPU. + +This is used by the bootloader to map the first parent interrupt to the +boot CPU, regardless wether the boot CPU is the first one or the second +one. + +When booting from the second CPU, the assumption that the first block's +IRQ is mapped to the first CPU breaks, and the system hangs because +interrupts do not get routed correctly. + +Fix this by passing the appropriate bcm6434_l1_cpu to the interrupt +handler instead of the chip itself, so the handler always has the right +block. + +Fixes: c7c42ec2baa1 ("irqchips/bmips: Add bcm6345-l1 interrupt controller") +Signed-off-by: Jonas Gorski +Reviewed-by: Philippe Mathieu-Daudé +Reviewed-by: Florian Fainelli +Signed-off-by: Marc Zyngier +Link: https://lore.kernel.org/r/20230629072620.62527-1-jonas.gorski@gmail.com +Signed-off-by: Sasha Levin +--- + drivers/irqchip/irq-bcm6345-l1.c | 14 +++++--------- + 1 file changed, 5 insertions(+), 9 deletions(-) + +diff --git a/drivers/irqchip/irq-bcm6345-l1.c b/drivers/irqchip/irq-bcm6345-l1.c +index 1bd0621c4ce2a..4827a11832478 100644 +--- a/drivers/irqchip/irq-bcm6345-l1.c ++++ b/drivers/irqchip/irq-bcm6345-l1.c +@@ -82,6 +82,7 @@ struct bcm6345_l1_chip { + }; + + struct bcm6345_l1_cpu { ++ struct bcm6345_l1_chip *intc; + void __iomem *map_base; + unsigned int parent_irq; + u32 enable_cache[]; +@@ -115,17 +116,11 @@ static inline unsigned int cpu_for_irq(struct bcm6345_l1_chip *intc, + + static void bcm6345_l1_irq_handle(struct irq_desc *desc) + { +- struct bcm6345_l1_chip *intc = irq_desc_get_handler_data(desc); +- struct bcm6345_l1_cpu *cpu; ++ struct bcm6345_l1_cpu *cpu = irq_desc_get_handler_data(desc); ++ struct bcm6345_l1_chip *intc = cpu->intc; + struct irq_chip *chip = irq_desc_get_chip(desc); + unsigned int idx; + +-#ifdef CONFIG_SMP +- cpu = intc->cpus[cpu_logical_map(smp_processor_id())]; +-#else +- cpu = intc->cpus[0]; +-#endif +- + chained_irq_enter(chip, desc); + + for (idx = 0; idx < intc->n_words; idx++) { +@@ -257,6 +252,7 @@ static int __init bcm6345_l1_init_one(struct device_node *dn, + if (!cpu) + return -ENOMEM; + ++ cpu->intc = intc; + cpu->map_base = ioremap(res.start, sz); + if (!cpu->map_base) + return -ENOMEM; +@@ -272,7 +268,7 @@ static int __init bcm6345_l1_init_one(struct device_node *dn, + return -EINVAL; + } + irq_set_chained_handler_and_data(cpu->parent_irq, +- bcm6345_l1_irq_handle, intc); ++ bcm6345_l1_irq_handle, cpu); + + return 0; + } +-- +2.40.1 + diff --git a/queue-5.4/series b/queue-5.4/series index dfc8684d331..1653ff4cb06 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -72,3 +72,5 @@ staging-ks7010-potential-buffer-overflow-in-ks_wlan_set_encode_ext.patch hwmon-nct7802-fix-for-temp6-peci1-processed-even-if-peci1-disabled.patch btrfs-check-for-commit-error-at-btrfs_attach_transaction_barrier.patch tpm_tis-explicitly-check-for-error-code.patch +irq-bcm6345-l1-do-not-assume-a-fixed-block-to-cpu-ma.patch +btrfs-check-if-the-transaction-was-aborted-at-btrfs_.patch -- 2.47.3