watchdog: it87_wdt: add PWRGD enable quirk for Qotom QCML04
Subsystems (18)
Sasha Levin
maintainerPATCH 1/23 watchdog: it87_wdt: add PWRGD enable quirk for Qotom QCML04
From: James Hilliard <[email protected]>
[ Upstream commit 43439076383a7611300334d1357c0f8883f40816 ]
For the watchdog timer to work properly on the QCML04 board we need to set PWRGD enable in the Environment Controller Configuration Registers Special Configuration Register 1 when it is not already set, this may be the case when the watchdog is not enabled from within the BIOS.
--- drivers/watchdog/it87_wdt.c | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
drivers/watchdog/it87_wdt.c +39 -0
@@ -20,6 +20,8 @@#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/bits.h> +#include <linux/dmi.h> #include <linux/init.h> #include <linux/io.h> #include <linux/kernel.h>
@@ -40,6 +42,7 @@#define VAL 0x2f/* Logical device Numbers LDN */ +#define EC 0x04#define GPIO 0x07/* Configuration Registers and Functions */
@@ -71,6 +74,12 @@#define IT8784_ID 0x8784#define IT8786_ID 0x8786 +/* Environment Controller Configuration Registers LDN=0x04 */ +#define SCR1 0xfa + +/* Environment Controller Bits SCR1 */ +#define WDT_PWRGD 0x20 +/* GPIO Configuration Registers LDN=0x07 */ #define WDTCTRL 0x71#define WDTCFG 0x72
@@ -233,6 +242,21 @@ static int wdt_set_timeout(struct watchdog_device *wdd, unsigned int t)return ret; } +enum { +IT87_WDT_OUTPUT_THROUGH_PWRGD =BIT (0 ), +}; + +static const struct dmi_system_id it87_quirks[] = { + { +/* Qotom Q30900P (IT8786) */ + .matches = { +DMI_EXACT_MATCH (DMI_BOARD_NAME ,"QCML04" ), + }, + .driver_data = (void *)IT87_WDT_OUTPUT_THROUGH_PWRGD , + }, + {} +}; +static const struct watchdog_info ident = { .options =WDIOF_SETTIMEOUT |WDIOF_MAGICCLOSE |WDIOF_KEEPALIVEPING , .firmware_version =1 ,
@@ -254,8 +278,10 @@ static struct watchdog_device wdt_dev = {static int __init it87_wdt_init (void ) { +const struct dmi_system_id *dmi_id;u8 chip_rev;u8 ctrl; +int quirks =0 ;int rc; rc =superio_enter ();
@@ -266,6 +292,10 @@ static int __init it87_wdt_init(void) chip_rev =superio_inb (CHIPREV ) &0x0f ;superio_exit (); + dmi_id =dmi_first_match (it87_quirks); +if (dmi_id) + quirks = (long )dmi_id->driver_data; +switch (chip_type) {case IT8702_ID : max_units =255 ;
@@ -326,6 +356,15 @@ static int __init it87_wdt_init(void)superio_outb (0x00 ,WDTCTRL ); } +if (quirks &IT87_WDT_OUTPUT_THROUGH_PWRGD ) { +superio_select (EC ); + ctrl =superio_inb (SCR1 ); +if (!(ctrl &WDT_PWRGD )) { + ctrl |=WDT_PWRGD ; +superio_outb (ctrl,SCR1 ); + } + } +superio_exit ();if (timeout <1 || timeout > max_units *60 ) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 2/23 watchdog: mediatek: Add support for MT6735 TOPRGU/WDT
From: Yassine Oudjana <[email protected]>
[ Upstream commit 15ddf704f56f8c95ff74dfd1157ed8646b322fa1 ]
Add support for the Top Reset Generation Unit/Watchdog Timer found on MT6735.
--- drivers/watchdog/mtk_wdt.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/watchdog/mtk_wdt.c +6 -0
@@ -10,6 +10,7 @@*/ #include <dt-bindings/reset/mt2712-resets.h> +#include <dt-bindings/reset/mediatek,mt6735-wdt.h> #include <dt-bindings/reset/mediatek,mt6795-resets.h> #include <dt-bindings/reset/mt7986-resets.h> #include <dt-bindings/reset/mt8183-resets.h>
@@ -81,6 +82,10 @@ static const struct mtk_wdt_data mt2712_data = { .toprgu_sw_rst_num = MT2712_TOPRGU_SW_RST_NUM, }; +static const struct mtk_wdt_data mt6735_data = { + .toprgu_sw_rst_num =MT6735_TOPRGU_RST_NUM , +}; +static const struct mtk_wdt_data mt6795_data = { .toprgu_sw_rst_num =MT6795_TOPRGU_SW_RST_NUM , };
@@ -442,6 +447,7 @@ static int mtk_wdt_resume(struct device *dev)static const struct of_device_id mtk_wdt_dt_ids[] = { { .compatible ="mediatek,mt2712-wdt" , .data = &mt2712_data }, { .compatible ="mediatek,mt6589-wdt" }, + { .compatible ="mediatek,mt6735-wdt" , .data = &mt6735_data }, { .compatible ="mediatek,mt6795-wdt" , .data = &mt6795_data }, { .compatible ="mediatek,mt7986-wdt" , .data = &mt7986_data }, { .compatible ="mediatek,mt8183-wdt" , .data = &mt8183_data },
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 3/23 scsi: qla1280: Fix hw revision numbering for ISP1020/1040
In reply to Sasha LevinFrom: Magnus Lindholm <[email protected]>
[ Upstream commit c064de86d2a3909222d5996c5047f64c7a8f791b ]
Fix the hardware revision numbering for Qlogic ISP1020/1040 boards. HWMASK suggests that the revision number only needs four bits, this is consistent with how NetBSD does things in their ISP driver. Verified on a IPS1040B which is seen as rev 5 not as BIT_4.
--- drivers/scsi/qla1280.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/scsi/qla1280.h +6 -6
@@ -116,12 +116,12 @@ struct device_reg {uint16_t id_h;/* ID high */ uint16_t cfg_0;/* Configuration 0 */ #define ISP_CFG0_HWMSK 0x000f/* Hardware revision mask */ -#define ISP_CFG0_1020 BIT_0/* ISP1020 */ -#define ISP_CFG0_1020A BIT_1/* ISP1020A */ -#define ISP_CFG0_1040 BIT_2/* ISP1040 */ -#define ISP_CFG0_1040A BIT_3/* ISP1040A */ -#define ISP_CFG0_1040B BIT_4/* ISP1040B */ -#define ISP_CFG0_1040C BIT_5/* ISP1040C */ +#define ISP_CFG0_1020 1/* ISP1020 */ +#define ISP_CFG0_1020A 2/* ISP1020A */ +#define ISP_CFG0_1040 3/* ISP1040 */ +#define ISP_CFG0_1040A 4/* ISP1040A */ +#define ISP_CFG0_1040B 5/* ISP1040B */ +#define ISP_CFG0_1040C 6/* ISP1040C */ uint16_t cfg_1;/* Configuration 1 */ #define ISP_CFG1_F128 BIT_6/* 128-byte FIFO threshold */ #define ISP_CFG1_F64 BIT_4|BIT_5/* 128-byte FIFO threshold */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 4/23 scsi: megaraid_sas: Fix for a potential deadlock
In reply to Sasha LevinFrom: Tomas Henzl <[email protected]>
[ Upstream commit 50740f4dc78b41dec7c8e39772619d5ba841ddd7 ]
This fixes a 'possible circular locking dependency detected' warning
CPU0 CPU1
---- ----
lock(&instance->reset_mutex);
lock(&shost->scan_mutex);
lock(&instance->reset_mutex); lock(&shost->scan_mutex);
Fix this by temporarily releasing the reset_mutex.
--- drivers/scsi/megaraid/megaraid_sas_base.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/scsi/megaraid/megaraid_sas_base.c +4 -1
@@ -8904,8 +8904,11 @@ megasas_aen_polling(struct work_struct *work) (ld_target_id /MEGASAS_MAX_DEV_PER_CHANNEL ), (ld_target_id %MEGASAS_MAX_DEV_PER_CHANNEL ), 0); -if (sdev1) +if (sdev1) { +mutex_unlock (&instance->reset_mutex);megasas_remove_scsi_device (sdev1); +mutex_lock (&instance->reset_mutex); + } event_type =SCAN_VD_CHANNEL ;break ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 5/23 udf: Skip parent dir link count update if corrupted
In reply to Sasha LevinFrom: Jan Kara <[email protected]>
[ Upstream commit c5566903af56dd1abb092f18dcb0c770d6cd8dcb ]
If the parent directory link count is too low (likely directory inode corruption), just skip updating its link count as if it goes to 0 too early it can cause unexpected issues.
--- fs/udf/namei.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/udf/namei.c +5 -1
@@ -521,7 +521,11 @@ static int udf_rmdir(struct inode *dir, struct dentry *dentry) inode->i_nlink);clear_nlink (inode); inode->i_size =0 ; -inode_dec_link_count (dir); +if (dir->i_nlink >=3 ) +inode_dec_link_count (dir); +else +udf_warn (inode->i_sb,"parent dir link count too low (%u)\n" , + dir->i_nlink);udf_add_fid_counter (dir->i_sb, true,-1 ); dir->i_mtime =inode_set_ctime_to_ts (dir,inode_set_ctime_current (inode));
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 6/23 ALSA: hda/conexant: fix Z60MR100 startup pop issue
In reply to Sasha LevinFrom: bo liu <[email protected]>
[ Upstream commit 947c4012f8f03a8bb946beb6e5294d5e32817d67 ]
When Z60MR100 startup, speaker will output a pop. To fix this issue, we mute codec by init verbs in bios when system startup, and set GPIO to low to unmute codec in codec driver when it loaded .
[ white space fixes and compile warning fix by tiwai ]
--- sound/pci/hda/patch_conexant.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
sound/pci/hda/patch_conexant.c +28 -0
@@ -311,6 +311,7 @@ enum {CXT_FIXUP_HP_MIC_NO_PRESENCE ,CXT_PINCFG_SWS_JS201D ,CXT_PINCFG_TOP_SPEAKER , + CXT_FIXUP_HP_A_U, };/* for hda_fixup_thinkpad_acpi() */
@@ -778,6 +779,18 @@ static void cxt_setup_mute_led(struct hda_codec *codec, } } +static void cxt_setup_gpio_unmute (struct hda_codec *codec, +unsigned int gpio_mute_mask) +{ +if (gpio_mute_mask) { +// set gpio data to 0. +snd_hda_codec_write (codec,0x01 ,0 ,AC_VERB_SET_GPIO_DATA ,0 ); +snd_hda_codec_write (codec,0x01 ,0 ,AC_VERB_SET_GPIO_MASK , gpio_mute_mask); +snd_hda_codec_write (codec,0x01 ,0 ,AC_VERB_SET_GPIO_DIRECTION , gpio_mute_mask); +snd_hda_codec_write (codec,0x01 ,0 ,AC_VERB_SET_GPIO_STICKY_MASK ,0 ); + } +} +static void cxt_fixup_mute_led_gpio (struct hda_codec *codec,const struct hda_fixup *fix,int action) {
@@ -792,6 +805,15 @@ static void cxt_fixup_hp_zbook_mute_led(struct hda_codec *codec,cxt_setup_mute_led (codec,0x10 ,0x20 ); } +static void cxt_fixup_hp_a_u (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +// Init vers in BIOS mute the spk/hp by set gpio high to avoid pop noise, +// so need to unmute once by clearing the gpio data when runs into the system. +if (action ==HDA_FIXUP_ACT_INIT ) +cxt_setup_gpio_unmute (codec,0x2 ); +} +/* ThinkPad X200 & co with cxt5051 */ static const struct hda_pintbl cxt_pincfg_lenovo_x200[] = { {0x16 ,0x042140ff },/* HP (seq# overridden) */
@@ -1016,6 +1038,10 @@ static const struct hda_fixup cxt_fixups[] = { .type = HDA_FIXUP_FUNC, .v.func = cxt_fixup_sirius_top_speaker, }, + [CXT_FIXUP_HP_A_U] = { + .type = HDA_FIXUP_FUNC, + .v.func = cxt_fixup_hp_a_u, + }, }; static const struct snd_pci_quirk cxt5045_fixups[] = {
@@ -1090,6 +1116,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = {SND_PCI_QUIRK (0x103c ,0x8457 ,"HP Z2 G4 mini" ,CXT_FIXUP_HP_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x103c ,0x8458 ,"HP Z2 G4 mini premium" ,CXT_FIXUP_HP_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1043 ,0x138d ,"Asus" ,CXT_FIXUP_HEADPHONE_MIC_PIN ), +SND_PCI_QUIRK (0x14f1 ,0x0252 ,"MBX-Z60MR100" ,CXT_FIXUP_HP_A_U ),SND_PCI_QUIRK (0x14f1 ,0x0265 ,"SWS JS201D" ,CXT_PINCFG_SWS_JS201D ),SND_PCI_QUIRK (0x152d ,0x0833 ,"OLPC XO-1.5" ,CXT_FIXUP_OLPC_XO ), SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410),
@@ -1135,6 +1162,7 @@ static const struct hda_model_fixup cxt5066_fixup_models[] = { { .id = CXT_PINCFG_LENOVO_NOTEBOOK, .name = "lenovo-20149" }, { .id = CXT_PINCFG_SWS_JS201D, .name = "sws-js201d" }, { .id = CXT_PINCFG_TOP_SPEAKER, .name = "sirius-top-speaker" }, + { .id = CXT_FIXUP_HP_A_U, .name = "HP-U-support" }, {} };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 7/23 ALSA: sh: Use standard helper for buffer accesses
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 9b5f8ee43e48c25fbe1a10163ec04343d750acd0 ]
The SH DAC audio driver uses the kmalloc'ed buffer as the main PCM buffer, and the data is transferred via hrtimer callbacks manually from there to the hardware. Meanwhile, some of its code are written as if the buffer is on iomem and use the special helpers for the iomem (e.g. copy_from_iter_toio() or memset_io()). Those are rather useless and the standard helpers should be used.
Similarly, the PCM mmap callback is set to a special one with snd_pcm_lib_mmap_iomem, but this is also nonsense, because SH architecture doesn't support this function, hence it leads just to NULL -- the fallback to the standard helper.
This patch replaces those special setups with the standard ones.
--- sound/sh/sh_dac_audio.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
sound/sh/sh_dac_audio.c +2 -3
@@ -163,7 +163,7 @@ static int snd_sh_dac_pcm_copy(struct snd_pcm_substream *substream,/* channel is not used (interleaved data) */ struct snd_sh_dac *chip =snd_pcm_substream_chip (substream); -if (copy_from_iter_toio (chip->data_buffer + pos, src, count)) +if (copy_from_iter (chip->data_buffer + pos, src, count) != count)return -EFAULT ; chip->buffer_end = chip->data_buffer + pos + count;
@@ -182,7 +182,7 @@ static int snd_sh_dac_pcm_silence(struct snd_pcm_substream *substream,/* channel is not used (interleaved data) */ struct snd_sh_dac *chip =snd_pcm_substream_chip (substream); -memset_io (chip->data_buffer + pos,0 , count); +memset (chip->data_buffer + pos,0 , count); chip->buffer_end = chip->data_buffer + pos + count;if (chip->empty) {
@@ -211,7 +211,6 @@ static const struct snd_pcm_ops snd_sh_dac_pcm_ops = { .pointer = snd_sh_dac_pcm_pointer, .copy = snd_sh_dac_pcm_copy, .fill_silence = snd_sh_dac_pcm_silence, - .mmap = snd_pcm_lib_mmap_iomem, };static int snd_sh_dac_pcm (struct snd_sh_dac *chip,int device)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 8/23 smb: server: Fix building with GCC 15
In reply to Sasha LevinFrom: Brahmajit Das <[email protected]>
[ Upstream commit e18655cf35a5958fbf4ae9ca3ebf28871a3a1801 ]
GCC 15 introduces -Werror=unterminated-string-initialization by default, this results in the following build error
fs/smb/server/smb_common.c:21:35: error: initializer-string for array of 'char' is too long [-Werror=unterminated-string-ini tialization]
21 | static const char basechars[43] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_-!@#$%";
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~cc1: all warnings being treated as errors
To this we are replacing char basechars[43] with a character pointer and then using strlen to get the length.
--- fs/smb/server/smb_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/smb/server/smb_common.c +2 -2
@@ -18,8 +18,8 @@#include "mgmt/share_config.h" /*for shortname implementation */ -static const char basechars[43 ] ="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_-!@#$%" ; -#define MANGLE_BASE (sizeof(basechars) / sizeof(char) - 1) +static const char *basechars ="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_-!@#$%" ; +#define MANGLE_BASE (strlen(basechars) - 1)#define MAGIC_CHAR '~'#define PERIOD '.'#define mangle (V ) ((char)(basechars[(V) % MANGLE_BASE]))
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 9/23 regmap: Use correct format specifier for logging range errors
In reply to Sasha LevinFrom: Mark Brown <[email protected]>
[ Upstream commit 3f1aa0c533d9dd8a835caf9a6824449c463ee7e2 ]
The register addresses are unsigned ints so we should use %u not %d to log them.
--- drivers/base/regmap/regmap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/base/regmap/regmap.c +2 -2
@@ -1050,13 +1050,13 @@ struct regmap *__regmap_init(struct device *dev,/* Sanity check */ if (range_cfg->range_max < range_cfg->range_min) { -dev_err (map->dev,"Invalid range %d: %d < %d\n" , i, +dev_err (map->dev,"Invalid range %d: %u < %u\n" , i, range_cfg->range_max, range_cfg->range_min); goto err_range; }if (range_cfg->range_max > map->max_register) { -dev_err (map->dev,"Invalid range %d: %d > %d\n" , i, +dev_err (map->dev,"Invalid range %d: %u > %u\n" , i, range_cfg->range_max, map->max_register); goto err_range; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 10/23 LoongArch: Fix reserving screen info memory for above-4G firmware
In reply to Sasha LevinFrom: Huacai Chen <[email protected]>
[ Upstream commit 55dc2f8f263448f1e6c7ef135d08e640d5a4826e ]
Since screen_info.lfb_base is a __u32 type, an above-4G address need an ext_lfb_base to present its higher 32bits. In init_screen_info() we can use __screen_info_lfb_base() to handle this case for reserving screen info memory.
--- arch/loongarch/kernel/efi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/loongarch/kernel/efi.c +1 -1
@@ -90,7 +90,7 @@ static void __init init_screen_info(void)memset (si,0 ,sizeof (*si));early_memunmap (si,sizeof (*si)); -memblock_reserve (screen_info.lfb_base, screen_info.lfb_size); +memblock_reserve (__screen_info_lfb_base (&screen_info), screen_info.lfb_size); }void __init efi_init (void )
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 11/23 LoongArch/irq: Use seq_put_decimal_ull_width() for decimal values
In reply to Sasha LevinFrom: David Wang <[email protected]>
[ Upstream commit ad2a05a6d287aef7e069c06e329f1355756415c2 ]
Performance improvement for reading /proc/interrupts on LoongArch.
On a system with n CPUs and m interrupts, there will be n*m decimal values yielded via seq_printf(.."%10u "..) which is less efficient than seq_put_decimal_ull_width(), stress reading /proc/interrupts indicates ~30% performance improvement with this patch (and its friends).
--- arch/loongarch/kernel/smp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/loongarch/kernel/smp.c +1 -1
@@ -83,7 +83,7 @@ void show_ipi_list(struct seq_file *p, int prec)for (i =0 ; i <NR_IPI ; i++) {seq_printf (p,"%*s%u:%s" , prec -1 ,"IPI" , i, prec >=4 ?" " :"" );for_each_online_cpu (cpu) -seq_printf (p,"%10u " ,per_cpu (irq_stat, cpu).ipi_irqs[i]); +seq_put_decimal_ull_width (p," " ,per_cpu (irq_stat, cpu).ipi_irqs[i],10 );seq_printf (p," LoongArch %d %s\n" , i +1 , ipi_types[i]); } }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 12/23 LoongArch: BPF: Adjust the parameter of emit_jirl()
In reply to Sasha LevinFrom: Tiezhu Yang <[email protected]>
[ Upstream commit c1474bb0b7cff4e8481095bd0618b8f6c2f0aeb4 ]
The branch instructions beq, bne, blt, bge, bltu, bgeu and jirl belong to the format reg2i16, but the sequence of oprand is different for the instruction jirl. So adjust the parameter order of emit_jirl() to make it more readable correspond with the Instruction Set Architecture manual.
Here are the instruction formats:
beq rj, rd, offs16 bne rj, rd, offs16 blt rj, rd, offs16 bge rj, rd, offs16 bltu rj, rd, offs16 bgeu rj, rd, offs16 jirl rd, rj, offs16
--- arch/loongarch/include/asm/inst.h | 12 +++++++++++- arch/loongarch/kernel/inst.c | 2 +- arch/loongarch/net/bpf_jit.c | 6 +++--- 3 files changed, 15 insertions(+), 5 deletions(-)
arch/loongarch/include/asm/inst.h +11 -1
@@ -655,7 +655,17 @@ DEF_EMIT_REG2I16_FORMAT(blt, blt_op) DEF_EMIT_REG2I16_FORMAT(bge, bge_op) DEF_EMIT_REG2I16_FORMAT(bltu, bltu_op) DEF_EMIT_REG2I16_FORMAT(bgeu, bgeu_op) -DEF_EMIT_REG2I16_FORMAT(jirl, jirl_op) + +static inline void emit_jirl (union loongarch_instruction *insn, +enum loongarch_gpr rd, +enum loongarch_gpr rj, +int offset) +{ + insn->reg2i16_format.opcode = jirl_op; + insn->reg2i16_format.immediate = offset; + insn->reg2i16_format.rd = rd; + insn->reg2i16_format.rj = rj; +}#define DEF_EMIT_REG2BSTRD_FORMAT (NAME ,OP ) \ static inline void emit_##NAME(union loongarch_instruction *insn, \
arch/loongarch/kernel/inst.c +1 -1
@@ -332,7 +332,7 @@ u32 larch_insn_gen_jirl(enum loongarch_gpr rd, enum loongarch_gpr rj, int imm)return INSN_BREAK ; } -emit_jirl (&insn, rj, rd, imm >>2 ); +emit_jirl (&insn, rd, rj, imm >>2 );return insn.word; }
arch/loongarch/net/bpf_jit.c +3 -3
@@ -181,13 +181,13 @@ static void __build_epilogue(struct jit_ctx *ctx, bool is_tail_call)/* Set return value */ emit_insn (ctx, addiw,LOONGARCH_GPR_A0 , regmap[BPF_REG_0 ],0 );/* Return to the caller */ -emit_insn (ctx, jirl,LOONGARCH_GPR_RA ,LOONGARCH_GPR_ZERO ,0 ); +emit_insn (ctx, jirl,LOONGARCH_GPR_ZERO ,LOONGARCH_GPR_RA ,0 ); }else {/* * Call the next bpf prog and skip the first instruction * of TCC initialization. */ -emit_insn (ctx, jirl,LOONGARCH_GPR_T3 ,LOONGARCH_GPR_ZERO ,1 ); +emit_insn (ctx, jirl,LOONGARCH_GPR_ZERO ,LOONGARCH_GPR_T3 ,1 ); } }
@@ -841,7 +841,7 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, bool extreturn ret;move_addr (ctx, t1, func_addr); -emit_insn (ctx, jirl, t1,LOONGARCH_GPR_RA ,0 ); +emit_insn (ctx, jirl,LOONGARCH_GPR_RA , t1,0 );move_reg (ctx, regmap[BPF_REG_0 ],LOONGARCH_GPR_A0 );break ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 13/23 platform/x86: asus-nb-wmi: Ignore unknown event 0xCF
In reply to Sasha LevinFrom: Armin Wolf <[email protected]>
[ Upstream commit e9fba20c29e27dc99e55e1c550573a114561bf8c ]
On the Asus X541UAK an unknown event 0xCF is emited when the charger is plugged in. This is caused by the following AML code:
If (ACPS ())
{
ACPF = One
Local0 = 0x58
If (ATKP)
{
^^^^ATKD.IANE (0xCF)
}
}
Else
{
ACPF = Zero
Local0 = 0x57
}
Notify (AC0, 0x80) // Status Change
If (ATKP)
{
^^^^ATKD.IANE (Local0)
}
Sleep (0x64)
PNOT ()
Sleep (0x0A)
NBAT (0x80)Ignore the 0xCF event to silence the unknown event warning.
--- drivers/platform/x86/asus-nb-wmi.c | 1 + 1 file changed, 1 insertion(+)
drivers/platform/x86/asus-nb-wmi.c +1 -0
@@ -590,6 +590,7 @@ static const struct key_entry asus_nb_wmi_keymap[] = { { KE_KEY, 0xC4, { KEY_KBDILLUMUP } }, { KE_KEY, 0xC5, { KEY_KBDILLUMDOWN } }, { KE_IGNORE, 0xC6, }, /* Ambient Light Sensor notification */ + { KE_IGNORE, 0xCF, }, /* AC mode */ { KE_KEY, 0xFA, { KEY_PROG2 } }, /* Lid flip action */ { KE_KEY, 0xBD, { KEY_PROG2 } }, /* Lid flip action on ROG xflow laptops */ { KE_END, 0},
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 14/23 net: sched: fix ordering of qlen adjustment
In reply to Sasha LevinFrom: Lion Ackermann <[email protected]>
[ Upstream commit 5eb7de8cd58e73851cd37ff8d0666517d9926948 ]
Changes to sch->q.qlen around qdisc_tree_reduce_backlog() need to happen _before_ a call to said function because otherwise it may fail to notify parent qdiscs when the child is about to become empty.
--- net/sched/sch_cake.c | 2 +- net/sched/sch_choke.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/sched/sch_cake.c +1 -1
@@ -1542,7 +1542,6 @@ static unsigned int cake_drop(struct Qdisc *sch, struct sk_buff **to_free) b->backlogs[idx] -= len; b->tin_backlog -= len; sch->qstats.backlog -= len; -qdisc_tree_reduce_backlog (sch,1 , len); flow->dropped++; b->tin_dropped++;
@@ -1553,6 +1552,7 @@ static unsigned int cake_drop(struct Qdisc *sch, struct sk_buff **to_free)__qdisc_drop (skb, to_free); sch->q.qlen--; +qdisc_tree_reduce_backlog (sch,1 , len);cake_heapify (q,0 );
net/sched/sch_choke.c +1 -1
@@ -123,10 +123,10 @@ static void choke_drop_by_idx(struct Qdisc *sch, unsigned int idx,if (idx == q->tail)choke_zap_tail_holes (q); + --sch->q.qlen;qdisc_qstats_backlog_dec (sch, skb);qdisc_tree_reduce_backlog (sch,1 ,qdisc_pkt_len (skb));qdisc_drop (skb, sch, to_free); - --sch->q.qlen; }struct choke_skb_cb {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 15/23 spi: intel: Add Panther Lake SPI controller support
In reply to Sasha LevinFrom: Aapo Vienamo <[email protected]>
[ Upstream commit ceb259e43bf572ba7d766e1679ba73861d16203a ]
The Panther Lake SPI controllers are compatible with the Cannon Lake controllers. Add support for following SPI controller device IDs:
- H-series: 0xe323
- P-series: 0xe423
- U-series: 0xe423
--- drivers/spi/spi-intel-pci.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/spi/spi-intel-pci.c +2 -0
@@ -86,6 +86,8 @@ static const struct pci_device_id intel_spi_pci_ids[] = { { PCI_VDEVICE(INTEL, 0xa324), (unsigned long)&cnl_info }, { PCI_VDEVICE(INTEL, 0xa3a4), (unsigned long)&cnl_info }, { PCI_VDEVICE(INTEL, 0xa823), (unsigned long)&cnl_info }, + { PCI_VDEVICE(INTEL, 0xe323), (unsigned long)&cnl_info }, + { PCI_VDEVICE(INTEL, 0xe423), (unsigned long)&cnl_info }, { }, };MODULE_DEVICE_TABLE (pci, intel_spi_pci_ids);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 16/23 scsi: mpt3sas: Diag-Reset when Doorbell-In-Use bit is set during driver load time
In reply to Sasha LevinFrom: Ranjan Kumar <[email protected]>
[ Upstream commit 3f5eb062e8aa335643181c480e6c590c6cedfd22 ]
Issue a Diag-Reset when the "Doorbell-In-Use" bit is set during the driver load/initialization.
--- drivers/scsi/mpt3sas/mpt3sas_base.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/scsi/mpt3sas/mpt3sas_base.c +6 -1
@@ -7050,11 +7050,12 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes,int i;u8 failed;__le32 *mfp; +int ret_val;/* make sure doorbell is not in use */ if ((ioc->base_readl_ext_retry (&ioc->chip->Doorbell) &MPI2_DOORBELL_USED )) {ioc_err (ioc,"doorbell is in use (line=%d)\n" , __LINE__); -return -EFAULT ; + goto doorbell_diag_reset; }/* clear pending doorbell interrupts from previous state changes */
@@ -7144,6 +7145,10 @@ _base_handshake_req_reply_wait(struct MPT3SAS_ADAPTER *ioc, int request_bytes, le32_to_cpu(mfp[i])); }return 0 ; + +doorbell_diag_reset: + ret_val =_base_diag_reset (ioc); +return ret_val; }/**
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 17/23 scsi: storvsc: Do not flag MAINTENANCE_IN return of SRB_STATUS_DATA_OVERRUN as an error
In reply to Sasha LevinFrom: Cathy Avery <[email protected]>
[ Upstream commit b1aee7f034615b6824d2c70ddb37ef9fc23493b7 ]
This partially reverts commit 812fe6420a6e ("scsi: storvsc: Handle additional SRB status values").
HyperV does not support MAINTENANCE_IN resulting in FC passthrough returning the SRB_STATUS_DATA_OVERRUN value. Now that SRB_STATUS_DATA_OVERRUN is treated as an error, multipath ALUA paths go into a faulty state as multipath ALUA submits RTPG commands via MAINTENANCE_IN.
[ 3.215560] hv_storvsc 1d69d403-9692-4460-89f9-a8cbcc0f94f3: tag#230 cmd 0xa3 status: scsi 0x0 srb 0x12 hv 0xc0000001 [ 3.215572] scsi 1:0:0:32: alua: rtpg failed, result 458752
Make MAINTENANCE_IN return success to avoid the error path as is currently done with INQUIRY and MODE_SENSE.
--- drivers/scsi/storvsc_drv.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/scsi/storvsc_drv.c +6 -1
@@ -149,6 +149,8 @@ struct hv_fc_wwn_packet {*/ static int vmstor_proto_version; +static bool hv_dev_is_fc (struct hv_device *hv_dev); +#define STORVSC_LOGGING_NONE 0#define STORVSC_LOGGING_ERROR 1#define STORVSC_LOGGING_WARN 2
@@ -1138,6 +1140,7 @@ static void storvsc_on_io_completion(struct storvsc_device *stor_device,* not correctly handle: * INQUIRY command with page code parameter set to 0x80 * MODE_SENSE command with cmd[2] == 0x1c +* MAINTENANCE_IN is not supported by HyperV FC passthrough * * Setup srb and scsi status so this won't be fatal. * We do this so we can distinguish truly fatal failues
@@ -1145,7 +1148,9 @@ static void storvsc_on_io_completion(struct storvsc_device *stor_device,*/ if ((stor_pkt->vm_srb.cdb[0 ] ==INQUIRY ) || - (stor_pkt->vm_srb.cdb[0 ] ==MODE_SENSE )) { + (stor_pkt->vm_srb.cdb[0 ] ==MODE_SENSE ) || + (stor_pkt->vm_srb.cdb[0 ] ==MAINTENANCE_IN && +hv_dev_is_fc (device))) { vstor_packet->vm_srb.scsi_status =0 ; vstor_packet->vm_srb.srb_status =SRB_STATUS_SUCCESS ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 18/23 spi: omap2-mcspi: Fix the IS_ERR() bug for devm_clk_get_optional_enabled()
In reply to Sasha LevinFrom: Purushothama Siddaiah <[email protected]>
[ Upstream commit 4c6ac5446d060f0bf435ccc8bc3aa7b7b5f718ad ]
The devm_clk_get_optional_enabled() function returns error pointers(PTR_ERR()). So use IS_ERR() to check it.
Verified on K3-J7200 EVM board, without clock node mentioned in the device tree.
--- drivers/spi/spi-omap2-mcspi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/spi/spi-omap2-mcspi.c +3 -3
@@ -1521,10 +1521,10 @@ static int omap2_mcspi_probe(struct platform_device *pdev) } mcspi->ref_clk =devm_clk_get_optional_enabled (&pdev->dev,NULL ); -if (mcspi->ref_clk) - mcspi->ref_clk_hz =clk_get_rate (mcspi->ref_clk); -else +if (IS_ERR (mcspi->ref_clk)) mcspi->ref_clk_hz =OMAP2_MCSPI_MAX_FREQ ; +else + mcspi->ref_clk_hz =clk_get_rate (mcspi->ref_clk); ctlr->max_speed_hz = mcspi->ref_clk_hz; ctlr->min_speed_hz = mcspi->ref_clk_hz >>15 ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 19/23 drm/dp_mst: Ensure mst_primary pointer is valid in drm_dp_mst_handle_up_req()
In reply to Sasha LevinFrom: Imre Deak <[email protected]>
[ Upstream commit e54b00086f7473dbda1a7d6fc47720ced157c6a8 ]
While receiving an MST up request message from one thread in drm_dp_mst_handle_up_req(), the MST topology could be removed from another thread via drm_dp_mst_topology_mgr_set_mst(false), freeing mst_primary and setting drm_dp_mst_topology_mgr::mst_primary to NULL. This could lead to a NULL deref/use-after-free of mst_primary in drm_dp_mst_handle_up_req().
Avoid the above by holding a reference for mst_primary in drm_dp_mst_handle_up_req() while it's used.
v2: Fix kfreeing the request if getting an mst_primary reference fails.
--- drivers/gpu/drm/display/drm_dp_mst_topology.c | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-)
drivers/gpu/drm/display/drm_dp_mst_topology.c +18 -6
@@ -3995,9 +3995,10 @@ static void drm_dp_mst_up_req_work(struct work_struct *work)static int drm_dp_mst_handle_up_req (struct drm_dp_mst_topology_mgr *mgr) {struct drm_dp_pending_up_req *up_req; +struct drm_dp_mst_branch *mst_primary;if (!drm_dp_get_one_sb_msg (mgr, true,NULL )) - goto out; + goto out_clear_reply;if (!mgr->up_req_recv.have_eomt)return 0 ;
@@ -4015,10 +4016,19 @@ static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr)drm_dbg_kms (mgr->dev,"Received unknown up req type, ignoring: %x\n" , up_req->msg.req_type);kfree (up_req); - goto out; + goto out_clear_reply; + } + +mutex_lock (&mgr->lock); + mst_primary = mgr->mst_primary; +if (!mst_primary || !drm_dp_mst_topology_try_get_mstb (mst_primary)) { +mutex_unlock (&mgr->lock); +kfree (up_req); + goto out_clear_reply; } +mutex_unlock (&mgr->lock); -drm_dp_send_up_ack_reply (mgr, mgr->mst_primary, up_req->msg.req_type, +drm_dp_send_up_ack_reply (mgr, mst_primary, up_req->msg.req_type, false);if (up_req->msg.req_type ==DP_CONNECTION_STATUS_NOTIFY ) {
@@ -4035,13 +4045,13 @@ static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr) conn_stat->peer_device_type);mutex_lock (&mgr->probe_lock); - handle_csn = mgr->mst_primary->link_address_sent; + handle_csn = mst_primary->link_address_sent;mutex_unlock (&mgr->probe_lock);if (!handle_csn) {drm_dbg_kms (mgr->dev,"Got CSN before finish topology probing. Skip it." );kfree (up_req); - goto out; + goto out_put_primary; } }else if (up_req->msg.req_type ==DP_RESOURCE_STATUS_NOTIFY ) { const struct drm_dp_resource_status_notify *res_stat =
@@ -4058,7 +4068,9 @@ static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr)mutex_unlock (&mgr->up_req_lock);queue_work (system_long_wq, &mgr->up_req_work); -out: +out_put_primary: +drm_dp_mst_topology_put_mstb (mst_primary); +out_clear_reply:memset (&mgr->up_req_recv,0 ,sizeof (struct drm_dp_sideband_msg_rx ));return 0 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 20/23 drm/dp_mst: Reset message rx state after OOM in drm_dp_mst_handle_up_req()
In reply to Sasha LevinFrom: Imre Deak <[email protected]>
[ Upstream commit 2b245c97b1af5d8f04c359e0826cb5a5c81ef704 ]
After an out-of-memory error the reception state should be reset, so that the next attempt receiving a message doesn't fail (due to getting a start-of-message packet, while the reception state has already the start-of-message flag set).
--- drivers/gpu/drm/display/drm_dp_mst_topology.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/display/drm_dp_mst_topology.c +6 -3
@@ -3996,6 +3996,7 @@ static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr) {struct drm_dp_pending_up_req *up_req;struct drm_dp_mst_branch *mst_primary; +int ret =0 ;if (!drm_dp_get_one_sb_msg (mgr, true,NULL )) goto out_clear_reply;
@@ -4004,8 +4005,10 @@ static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr)return 0 ; up_req =kzalloc (sizeof (*up_req),GFP_KERNEL ); -if (!up_req) -return -ENOMEM ; +if (!up_req) { + ret = -ENOMEM ; + goto out_clear_reply; + }INIT_LIST_HEAD (&up_req->next);
@@ -4072,7 +4075,7 @@ static int drm_dp_mst_handle_up_req(struct drm_dp_mst_topology_mgr *mgr)drm_dp_mst_topology_put_mstb (mst_primary); out_clear_reply:memset (&mgr->up_req_recv,0 ,sizeof (struct drm_dp_sideband_msg_rx )); -return 0 ; +return ret; }/**
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 21/23 virtio-blk: don't keep queue frozen during system suspend
In reply to Sasha LevinFrom: Ming Lei <[email protected]>
[ Upstream commit 7678abee0867e6b7fb89aa40f6e9f575f755fb37 ]
Commit 4ce6e2db00de ("virtio-blk: Ensure no requests in virtqueues before deleting vqs.") replaces queue quiesce with queue freeze in virtio-blk's PM callbacks. And the motivation is to drain inflight IOs before suspending.
block layer's queue freeze looks very handy, but it is also easy to cause deadlock, such as, any attempt to call into bio_queue_enter() may run into deadlock if the queue is frozen in current context. There are all kinds of ->suspend() called in suspend context, so keeping queue frozen in the whole suspend context isn't one good idea. And Marek reported lockdep warning[1] caused by virtio-blk's freeze queue in virtblk_freeze().
[1] https://lore.kernel.org/linux-block/[email protected]/
Given the motivation is to drain in-flight IOs, it can be done by calling freeze & unfreeze, meantime restore to previous behavior by keeping queue quiesced during suspend.
--- drivers/block/virtio_blk.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/block/virtio_blk.c +5 -2
@@ -1624,9 +1624,12 @@ static void virtblk_remove(struct virtio_device *vdev)static int virtblk_freeze (struct virtio_device *vdev) {struct virtio_blk *vblk = vdev->priv; +struct request_queue *q = vblk->disk->queue;/* Ensure no requests in virtqueues before deleting vqs. */ -blk_mq_freeze_queue (vblk->disk->queue); +blk_mq_freeze_queue (q); +blk_mq_quiesce_queue_nowait (q); +blk_mq_unfreeze_queue (q);/* Ensure we don't receive any more interrupts */ virtio_reset_device (vdev);
@@ -1650,8 +1653,8 @@ static int virtblk_restore(struct virtio_device *vdev)return ret;virtio_device_ready (vdev); +blk_mq_unquiesce_queue (vblk->disk->queue); -blk_mq_unfreeze_queue (vblk->disk->queue); return 0; }#endif
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 22/23 blk-mq: register cpuhp callback after hctx is added to xarray table
In reply to Sasha LevinFrom: Ming Lei <[email protected]>
[ Upstream commit 4bf485a7db5d82ddd0f3ad2b299893199090375e ]
We need to retrieve 'hctx' from xarray table in the cpuhp callback, so the callback should be registered after this 'hctx' is added to xarray table.
--- block/blk-mq.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
block/blk-mq.c +7 -8
@@ -3708,16 +3708,11 @@ static int blk_mq_init_hctx(struct request_queue *q, { hctx->queue_num = hctx_idx; -if (!(hctx->flags &BLK_MQ_F_STACKING )) -cpuhp_state_add_instance_nocalls (CPUHP_AP_BLK_MQ_ONLINE , - &hctx->cpuhp_online); -cpuhp_state_add_instance_nocalls (CPUHP_BLK_MQ_DEAD , &hctx->cpuhp_dead); - hctx->tags = set->tags[hctx_idx];if (set->ops->init_hctx && set->ops->init_hctx (hctx, set->driver_data, hctx_idx)) - goto unregister_cpu_notifier; + goto fail;if (blk_mq_init_request (set, hctx->fq->flush_rq, hctx_idx, hctx->numa_node))
@@ -3726,6 +3721,11 @@ static int blk_mq_init_hctx(struct request_queue *q,if (xa_insert (&q->hctx_table, hctx_idx, hctx,GFP_KERNEL )) goto exit_flush_rq; +if (!(hctx->flags &BLK_MQ_F_STACKING )) +cpuhp_state_add_instance_nocalls (CPUHP_AP_BLK_MQ_ONLINE , + &hctx->cpuhp_online); +cpuhp_state_add_instance_nocalls (CPUHP_BLK_MQ_DEAD , &hctx->cpuhp_dead); +return 0 ; exit_flush_rq:
@@ -3734,8 +3734,7 @@ static int blk_mq_init_hctx(struct request_queue *q, exit_hctx:if (set->ops->exit_hctx) set->ops->exit_hctx (hctx, hctx_idx); - unregister_cpu_notifier: -blk_mq_remove_cpuhp (hctx); + fail:return -1 ; }
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 23/23 blk-mq: move cpuhp callback registering out of q->sysfs_lock
In reply to Sasha LevinFrom: Ming Lei <[email protected]>
[ Upstream commit 22465bbac53c821319089016f268a2437de9b00a ]
Registering and unregistering cpuhp callback requires global cpu hotplug lock, which is used everywhere. Meantime q->sysfs_lock is used in block layer almost everywhere.
It is easy to trigger lockdep warning[1] by connecting the two locks.
Fix the warning by moving blk-mq's cpuhp callback registering out of q->sysfs_lock. Add one dedicated global lock for covering registering & unregistering hctx's cpuhp, and it is safe to do so because hctx is guaranteed to be live if our request_queue is live.
[1] https://lore.kernel.org/lkml/Z04pz3AlvI4o0Mr8@agluck-desk3/
--- block/blk-mq.c | 103 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 92 insertions(+), 11 deletions(-)
block/blk-mq.c +92 -11
@@ -43,6 +43,7 @@ static DEFINE_PER_CPU(struct llist_head, blk_cpu_done); static DEFINE_PER_CPU(call_single_data_t, blk_cpu_csd); +static DEFINE_MUTEX (blk_mq_cpuhp_lock);static void blk_mq_insert_request (struct request *rq,blk_insert_t flags); static void blk_mq_request_bypass_insert(struct request *rq,
@@ -3623,13 +3624,91 @@ static int blk_mq_hctx_notify_dead(unsigned int cpu, struct hlist_node *node)return 0 ; } -static void blk_mq_remove_cpuhp (struct blk_mq_hw_ctx *hctx) +static void __blk_mq_remove_cpuhp (struct blk_mq_hw_ctx *hctx) { -if (!(hctx->flags &BLK_MQ_F_STACKING )) +lockdep_assert_held (&blk_mq_cpuhp_lock); + +if (!(hctx->flags &BLK_MQ_F_STACKING ) && + !hlist_unhashed (&hctx->cpuhp_online)) {cpuhp_state_remove_instance_nocalls (CPUHP_AP_BLK_MQ_ONLINE , &hctx->cpuhp_online); -cpuhp_state_remove_instance_nocalls (CPUHP_BLK_MQ_DEAD , - &hctx->cpuhp_dead); +INIT_HLIST_NODE (&hctx->cpuhp_online); + } + +if (!hlist_unhashed (&hctx->cpuhp_dead)) { +cpuhp_state_remove_instance_nocalls (CPUHP_BLK_MQ_DEAD , + &hctx->cpuhp_dead); +INIT_HLIST_NODE (&hctx->cpuhp_dead); + } +} + +static void blk_mq_remove_cpuhp (struct blk_mq_hw_ctx *hctx) +{ +mutex_lock (&blk_mq_cpuhp_lock); +__blk_mq_remove_cpuhp (hctx); +mutex_unlock (&blk_mq_cpuhp_lock); +} + +static void __blk_mq_add_cpuhp (struct blk_mq_hw_ctx *hctx) +{ +lockdep_assert_held (&blk_mq_cpuhp_lock); + +if (!(hctx->flags &BLK_MQ_F_STACKING ) && +hlist_unhashed (&hctx->cpuhp_online)) +cpuhp_state_add_instance_nocalls (CPUHP_AP_BLK_MQ_ONLINE , + &hctx->cpuhp_online); + +if (hlist_unhashed (&hctx->cpuhp_dead)) +cpuhp_state_add_instance_nocalls (CPUHP_BLK_MQ_DEAD , + &hctx->cpuhp_dead); +} + +static void __blk_mq_remove_cpuhp_list (struct list_head *head) +{ +struct blk_mq_hw_ctx *hctx; + +lockdep_assert_held (&blk_mq_cpuhp_lock); + +list_for_each_entry (hctx, head, hctx_list) +__blk_mq_remove_cpuhp (hctx); +} + +/* +* Unregister cpuhp callbacks from exited hw queues +* +* Safe to call if this `request_queue` is live +*/ +static void blk_mq_remove_hw_queues_cpuhp (struct request_queue *q) +{ +LIST_HEAD (hctx_list); + +spin_lock (&q->unused_hctx_lock); +list_splice_init (&q->unused_hctx_list, &hctx_list); +spin_unlock (&q->unused_hctx_lock); + +mutex_lock (&blk_mq_cpuhp_lock); +__blk_mq_remove_cpuhp_list (&hctx_list); +mutex_unlock (&blk_mq_cpuhp_lock); + +spin_lock (&q->unused_hctx_lock); +list_splice (&hctx_list, &q->unused_hctx_list); +spin_unlock (&q->unused_hctx_lock); +} + +/* +* Register cpuhp callbacks from all hw queues +* +* Safe to call if this `request_queue` is live +*/ +static void blk_mq_add_hw_queues_cpuhp (struct request_queue *q) +{ +struct blk_mq_hw_ctx *hctx; +unsigned long i; + +mutex_lock (&blk_mq_cpuhp_lock); +queue_for_each_hw_ctx (q, hctx, i) +__blk_mq_add_cpuhp (hctx); +mutex_unlock (&blk_mq_cpuhp_lock); }/*
@@ -3680,8 +3759,6 @@ static void blk_mq_exit_hctx(struct request_queue *q,if (set->ops->exit_hctx) set->ops->exit_hctx (hctx, hctx_idx); -blk_mq_remove_cpuhp (hctx); -xa_erase (&q->hctx_table, hctx_idx);spin_lock (&q->unused_hctx_lock);
@@ -3698,6 +3775,7 @@ static void blk_mq_exit_hw_queues(struct request_queue *q,queue_for_each_hw_ctx (q, hctx, i) {if (i == nr_queue)break ; +blk_mq_remove_cpuhp (hctx);blk_mq_exit_hctx (q, set, hctx, i); } }
@@ -3721,11 +3799,6 @@ static int blk_mq_init_hctx(struct request_queue *q,if (xa_insert (&q->hctx_table, hctx_idx, hctx,GFP_KERNEL )) goto exit_flush_rq; -if (!(hctx->flags &BLK_MQ_F_STACKING )) -cpuhp_state_add_instance_nocalls (CPUHP_AP_BLK_MQ_ONLINE , - &hctx->cpuhp_online); -cpuhp_state_add_instance_nocalls (CPUHP_BLK_MQ_DEAD , &hctx->cpuhp_dead); -return 0 ; exit_flush_rq:
@@ -3760,6 +3833,8 @@ blk_mq_alloc_hctx(struct request_queue *q, struct blk_mq_tag_set *set,INIT_DELAYED_WORK (&hctx->run_work, blk_mq_run_work_fn);spin_lock_init (&hctx->lock);INIT_LIST_HEAD (&hctx->dispatch); +INIT_HLIST_NODE (&hctx->cpuhp_dead); +INIT_HLIST_NODE (&hctx->cpuhp_online); hctx->queue = q; hctx->flags = set->flags & ~BLK_MQ_F_TAG_QUEUE_SHARED ;
@@ -4278,6 +4353,12 @@ static void blk_mq_realloc_hw_ctxs(struct blk_mq_tag_set *set,xa_for_each_start (&q->hctx_table, j, hctx, j)blk_mq_exit_hctx (q, set, hctx, j);mutex_unlock (&q->sysfs_lock); + +/* unregister cpuhp callbacks for exited hctxs */ +blk_mq_remove_hw_queues_cpuhp (q); + +/* register cpuhp for new initialized hctxs */ +blk_mq_add_hw_queues_cpuhp (q); }static void blk_mq_update_poll_flag (struct request_queue *q)
Signature · 1 line
2.43.0