drm/fb-helper: Don't schedule_work() to flush frame buffer during panic()
Subsystems (11)
Sasha Levin
maintainerPATCH 1/16 drm/fb-helper: Don't schedule_work() to flush frame buffer during panic()
From: Qiuxu Zhuo <[email protected]>
[ Upstream commit 833cd3e9ad8360785b6c23c82dd3856df00732d9 ]
Sometimes the system [1] hangs on x86 I/O machine checks. However, the expected behavior is to reboot the system, as the machine check handler ultimately triggers a panic(), initiating a reboot in the last step.
The root cause is that sometimes the panic() is blocked when drm_fb_helper_damage() invoking schedule_work() to flush the frame buffer. This occurs during the process of flushing all messages to the frame buffer driver as shown in the following call trace:
Machine check occurs [2]:
panic()
console_flush_on_panic()
console_flush_all()
console_emit_next_record()
con->write()
vt_console_print()
hide_cursor()
vc->vc_sw->con_cursor()
fbcon_cursor()
ops->cursor()
bit_cursor()
soft_cursor()
info->fbops->fb_imageblit()
drm_fbdev_generic_defio_imageblit()
drm_fb_helper_damage_area()
drm_fb_helper_damage()
schedule_work() // <--- blocked here
...
emergency_restart() // wasn't invoked, so no reboot.During panic(), except the panic CPU, all the other CPUs are stopped. In schedule_work(), the panic CPU requires the lock of worker_pool to queue the work on that pool, while the lock may have been token by some other stopped CPU. So schedule_work() is blocked.
Additionally, during a panic(), since there is no opportunity to execute any scheduled work, it's safe to fix this issue by skipping schedule_work() on 'oops_in_progress' in drm_fb_helper_damage().
[1] Enable the kernel option CONFIG_FRAMEBUFFER_CONSOLE, CONFIG_DRM_FBDEV_EMULATION, and boot with the 'console=tty0' kernel command line parameter.
[2] Set 'panic_timeout' to a non-zero value before calling panic().
--- drivers/gpu/drm/drm_fb_helper.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/gpu/drm/drm_fb_helper.c +11 -0
@@ -631,6 +631,17 @@ static void drm_fb_helper_add_damage_clip(struct drm_fb_helper *helper, u32 x, ustatic void drm_fb_helper_damage (struct drm_fb_helper *helper,u32 x,u32 y,u32 width,u32 height) { +/* +* This function may be invoked by panic() to flush the frame +* buffer, where all CPUs except the panic CPU are stopped. +* During the following schedule_work(), the panic CPU needs +* the worker_pool lock, which might be held by a stopped CPU, +* causing schedule_work() and panic() to block. Return early on +* oops_in_progress to prevent this blocking. +*/ +if (oops_in_progress) +return ; +drm_fb_helper_add_damage_clip (helper, x, y, width, height);schedule_work (&helper->damage_work);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 2/16 drm: panel-orientation-quirks: Add quirk for OrangePi Neo
From: Philip Mueller <[email protected]>
[ Upstream commit d60c429610a14560085d98fa6f4cdb43040ca8f0 ]
This adds a DMI orientation quirk for the OrangePi Neo Linux Gaming Handheld.
--- drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/drm_panel_orientation_quirks.c +6 -0
@@ -414,6 +414,12 @@ static const struct dmi_system_id orientation_data[] = { DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ONE XPLAYER"), }, .driver_data = (void *)&lcd1600x2560_leftside_up, + }, { /* OrangePi Neo */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"OrangePi" ), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "NEO-01"), + }, + .driver_data = (void *)&lcd1200x1920_rightside_up, }, { /* Samsung GalaxyBook 10.6 */ .matches = { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 3/16 scsi: ufs: core: Check LSDBS cap when !mcq
In reply to Sasha LevinFrom: Kyoungrul Kim <[email protected]>
[ Upstream commit 0c60eb0cc320fffbb8b10329d276af14f6f5e6bf ]
If the user sets use_mcq_mode to 0, the host will try to activate the LSDB mode unconditionally even when the LSDBS of device HCI cap is 1. This makes commands time out and causes device probing to fail.
To prevent that problem, check the LSDBS cap when MCQ is not supported.
--- drivers/ufs/core/ufshcd.c | 16 ++++++++++++++++ include/ufs/ufshcd.h | 1 + include/ufs/ufshci.h | 1 + 3 files changed, 18 insertions(+)
drivers/ufs/core/ufshcd.c +16 -0
@@ -2412,7 +2412,17 @@ static inline int ufshcd_hba_capabilities(struct ufs_hba *hba)return err; } +/* +* The UFSHCI 3.0 specification does not define MCQ_SUPPORT and +* LSDB_SUPPORT, but [31:29] as reserved bits with reset value 0s, which +* means we can simply read values regardless of version. +*/ hba->mcq_sup =FIELD_GET (MASK_MCQ_SUPPORT , hba->capabilities); +/* +* 0h: legacy single doorbell support is available +* 1h: indicate that legacy single doorbell support has been removed +*/ + hba->lsdb_sup = !FIELD_GET (MASK_LSDB_SUPPORT , hba->capabilities);if (!hba->mcq_sup)return 0 ;
@@ -10451,6 +10461,12 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) }if (!is_mcq_supported (hba)) { +if (!hba->lsdb_sup) { +dev_err (hba->dev,"%s: failed to initialize (legacy doorbell mode not supported)\n" , + __func__); + err = -EINVAL ; + goto out_disable; + } err =scsi_add_host (host, hba->dev);if (err) {dev_err (hba->dev,"scsi_add_host failed\n" );
include/ufs/ufshcd.h +1 -0
@@ -1074,6 +1074,7 @@ struct ufs_hba {bool ext_iid_sup;bool scsi_host_added;bool mcq_sup; +bool lsdb_sup;bool mcq_enabled;struct ufshcd_res_info res[RES_MAX ];void __iomem *mcq_base;
include/ufs/ufshci.h +1 -0
@@ -75,6 +75,7 @@ enum {MASK_OUT_OF_ORDER_DATA_DELIVERY_SUPPORT =0x02000000 ,MASK_UIC_DME_TEST_MODE_SUPPORT =0x04000000 ,MASK_CRYPTO_SUPPORT =0x10000000 , +MASK_LSDB_SUPPORT =0x20000000 , MASK_MCQ_SUPPORT = 0x40000000, };
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 4/16 scsi: ufs: core: Bypass quick recovery if force reset is needed
In reply to Sasha LevinFrom: Peter Wang <[email protected]>
[ Upstream commit 022587d8aec3da1d1698ddae9fb8cfe35f3ad49c ]
If force_reset is true, bypass quick recovery. This will shorten error recovery time.
--- drivers/ufs/core/ufshcd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/ufs/core/ufshcd.c +2 -1
@@ -6555,7 +6555,8 @@ static void ufshcd_err_handler(struct work_struct *work)if (ufshcd_err_handling_should_stop (hba)) goto skip_err_handling; -if (hba->dev_quirks &UFS_DEVICE_QUIRK_RECOVERY_FROM_DL_NAC_ERRORS ) { +if ((hba->dev_quirks &UFS_DEVICE_QUIRK_RECOVERY_FROM_DL_NAC_ERRORS ) && + !hba->force_reset) {bool ret;spin_unlock_irqrestore (hba->host->host_lock, flags);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 5/16 btrfs: tree-checker: validate dref root and objectid
In reply to Sasha LevinFrom: Qu Wenruo <[email protected]>
[ Upstream commit f333a3c7e8323499aa65038e77fe8f3199d4e283 ]
[CORRUPTION]
There is a bug report that btrfs flips RO due to a corruption in the extent tree, the involved dumps looks like this:
item 188 key (402811572224 168 4096) itemoff 14598 itemsize 79
extent refs 3 gen 3678544 flags 1
ref#0: extent data backref root 13835058055282163977 objectid 281473384125923 offset 81432576 count 1 ref#1: shared data backref parent 1947073626112 count 1
ref#2: shared data backref parent 1156030103552 count 1
BTRFS critical (device vdc1: state EA): unable to find ref byte nr 402811572224 parent 0 root 265 owner 28703026 offset 81432576 slot 189 BTRFS error (device vdc1: state EA): failed to run delayed ref for logical 402811572224 num_bytes 4096 type 178 action 2 ref_mod 1: -2
[CAUSE]
The corrupted entry is ref#0 of item 188.
The root number 13835058055282163977 is beyond the upper limit for root items (the current limit is 1 << 48), and the objectid also looks suspicious.
Only the offset and count is correct.
[ENHANCEMENT]
Although it's still unknown why we have such many bytes corrupted randomly, we can still enhance the tree-checker for data backrefs by:
- Validate the root value
For now there should only be 3 types of roots can have data backref:
* subvolume trees
* data reloc trees
* root tree
Only for v1 space cache
- validate the objectid value
The objectid should be a valid inode number.
Hopefully we can catch such problem in the future with the new checkers.
--- fs/btrfs/tree-checker.c | 47 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+)
fs/btrfs/tree-checker.c +47 -0
@@ -1271,6 +1271,19 @@ static void extent_err(const struct extent_buffer *eb, int slot,va_end (args); } +static bool is_valid_dref_root (u64 rootid) +{ +/* +* The following tree root objectids are allowed to have a data backref: +* - subvolume trees +* - data reloc tree +* - tree root +* For v1 space cache +*/ +return is_fstree (rootid) || rootid ==BTRFS_DATA_RELOC_TREE_OBJECTID || + rootid ==BTRFS_ROOT_TREE_OBJECTID ; +} +static int check_extent_item (struct extent_buffer *leaf,struct btrfs_key *key,int slot,struct btrfs_key *prev_key)
@@ -1423,6 +1436,8 @@ static int check_extent_item(struct extent_buffer *leaf,struct btrfs_extent_data_ref *dref;struct btrfs_shared_data_ref *sref;u64 seq; +u64 dref_root; +u64 dref_objectid;u64 dref_offset;u64 inline_offset;u8 inline_type;
@@ -1466,11 +1481,26 @@ static int check_extent_item(struct extent_buffer *leaf,*/ case BTRFS_EXTENT_DATA_REF_KEY : dref = (struct btrfs_extent_data_ref *)(&iref->offset); + dref_root =btrfs_extent_data_ref_root (leaf, dref); + dref_objectid =btrfs_extent_data_ref_objectid (leaf, dref); dref_offset =btrfs_extent_data_ref_offset (leaf, dref); seq =hash_extent_data_ref (btrfs_extent_data_ref_root (leaf, dref),btrfs_extent_data_ref_objectid (leaf, dref),btrfs_extent_data_ref_offset (leaf, dref)); +if (unlikely (!is_valid_dref_root (dref_root))) { +extent_err (leaf, slot, +"invalid data ref root value %llu" , + dref_root); +return -EUCLEAN ; + } +if (unlikely (dref_objectid <BTRFS_FIRST_FREE_OBJECTID || + dref_objectid >BTRFS_LAST_FREE_OBJECTID )) { +extent_err (leaf, slot, +"invalid data ref objectid value %llu" , + dref_root); +return -EUCLEAN ; + }if (unlikely (!IS_ALIGNED (dref_offset, fs_info->sectorsize))) { extent_err(leaf, slot,
@@ -1609,6 +1639,8 @@ static int check_extent_data_ref(struct extent_buffer *leaf,return -EUCLEAN ; }for (; ptr < end; ptr +=sizeof (*dref)) { +u64 root; +u64 objectid;u64 offset;/*
@@ -1616,7 +1648,22 @@ static int check_extent_data_ref(struct extent_buffer *leaf,* overflow from the leaf due to hash collisions. */ dref = (struct btrfs_extent_data_ref *)ptr; + root =btrfs_extent_data_ref_root (leaf, dref); + objectid =btrfs_extent_data_ref_objectid (leaf, dref); offset =btrfs_extent_data_ref_offset (leaf, dref); +if (unlikely (!is_valid_dref_root (root))) { +extent_err (leaf, slot, +"invalid extent data backref root value %llu" , + root); +return -EUCLEAN ; + } +if (unlikely (objectid <BTRFS_FIRST_FREE_OBJECTID || + objectid >BTRFS_LAST_FREE_OBJECTID )) { +extent_err (leaf, slot, +"invalid extent data backref objectid value %llu" , + root); +return -EUCLEAN ; + }if (unlikely (!IS_ALIGNED (offset, leaf->fs_info->sectorsize))) { extent_err(leaf, slot, "invalid extent data backref offset, have %llu expect aligned to %u",
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 6/16 ALSA: hda/generic: Add a helper to mute speakers at suspend/shutdown
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 6cd23b26b348fa52c88e1adf9c0e48d68e13f95e ]
Some devices indicate click noises at suspend or shutdown when the speakers are unmuted. This patch adds a helper, snd_hda_gen_shutup_speakers(), to work around it. The new function is supposed to be called at suspend or shutdown by the codec driver, and it mutes the speakers.
The mute status isn't cached, hence the original mute state will be restored at resume again.
--- sound/pci/hda/hda_generic.c | 63 +++++++++++++++++++++++++++++++++++++ sound/pci/hda/hda_generic.h | 1 + 2 files changed, 64 insertions(+)
sound/pci/hda/hda_generic.c +63 -0
@@ -4955,6 +4955,69 @@ void snd_hda_gen_stream_pm(struct hda_codec *codec, hda_nid_t nid, bool on) }EXPORT_SYMBOL_GPL (snd_hda_gen_stream_pm); +/* forcibly mute the speaker output without caching; return true if updated */ +static bool force_mute_output_path (struct hda_codec *codec,hda_nid_t nid) +{ +if (!nid) +return false; +if (!nid_has_mute (codec, nid,HDA_OUTPUT )) +return false;/* no mute, skip */ +if (snd_hda_codec_amp_read (codec, nid,0 ,HDA_OUTPUT ,0 ) & +snd_hda_codec_amp_read (codec, nid,1 ,HDA_OUTPUT ,0 ) & +HDA_AMP_MUTE ) +return false;/* both channels already muted, skip */ + +/* direct amp update without caching */ +snd_hda_codec_write (codec, nid,0 ,AC_VERB_SET_AMP_GAIN_MUTE , +AC_AMP_SET_OUTPUT |AC_AMP_SET_LEFT | +AC_AMP_SET_RIGHT |HDA_AMP_MUTE ); +return true; +} + +/** +* snd_hda_gen_shutup_speakers - Forcibly mute the speaker outputs +* @codec: the HDA codec +* +* Forcibly mute the speaker outputs, to be called at suspend or shutdown. +* +* The mute state done by this function isn't cached, hence the original state +* will be restored at resume. +* +* Return true if the mute state has been changed. +*/ +bool snd_hda_gen_shutup_speakers (struct hda_codec *codec) +{ +struct hda_gen_spec *spec = codec->spec; +const int *paths; +const struct nid_path *path; +int i, p, num_paths; +bool updated = false; + +/* if already powered off, do nothing */ +if (!snd_hdac_is_power_on (&codec->core)) +return false; + +if (spec->autocfg.line_out_type ==AUTO_PIN_SPEAKER_OUT ) { + paths = spec->out_paths; + num_paths = spec->autocfg.line_outs; + }else { + paths = spec->speaker_paths; + num_paths = spec->autocfg.speaker_outs; + } + +for (i =0 ; i < num_paths; i++) { + path =snd_hda_get_path_from_idx (codec, paths[i]); +if (!path) +continue ; +for (p =0 ; p < path->depth; p++) +if (force_mute_output_path (codec, path->path[p])) + updated = true; + } + +return updated; +} +EXPORT_SYMBOL_GPL (snd_hda_gen_shutup_speakers); +/** * snd_hda_gen_parse_auto_config - Parse the given BIOS configuration and * set up the hda_gen_spec
sound/pci/hda/hda_generic.h +1 -0
@@ -353,5 +353,6 @@ int snd_hda_gen_add_mute_led_cdev(struct hda_codec *codec,int snd_hda_gen_add_micmute_led_cdev (struct hda_codec *codec,int (*callback)(struct led_classdev *,enum led_brightness )); +bool snd_hda_gen_shutup_speakers (struct hda_codec *codec);#endif /* __SOUND_HDA_GENERIC_H */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 7/16 ALSA: hda/conexant: Mute speakers at suspend / shutdown
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 4f61c8fe35202702426cfc0003e15116a01ba885 ]
Use the new helper to mute speakers at suspend / shutdown for avoiding click noises.
--- sound/pci/hda/patch_conexant.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/patch_conexant.c +2 -0
@@ -212,6 +212,8 @@ static void cx_auto_shutdown(struct hda_codec *codec) {struct conexant_spec *spec = codec->spec; +snd_hda_gen_shutup_speakers (codec); +/* Turn the problematic codec into D3 to avoid spurious noises from the internal speaker during (and after) reboot */ cx_auto_turn_eapd (codec, spec->num_eapds, spec->eapds, false);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 8/16 Input: MT - limit max slots
In reply to Sasha LevinFrom: Tetsuo Handa <[email protected]>
[ Upstream commit 99d3bf5f7377d42f8be60a6b9cb60fb0be34dceb ]
syzbot is reporting too large allocation at input_mt_init_slots(), for num_slots is supplied from userspace using ioctl(UI_DEV_CREATE).
Since nobody knows possible max slots, this patch chose 1024.
--- drivers/input/input-mt.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/input/input-mt.c +3 -0
@@ -46,6 +46,9 @@ int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots,return 0 ;if (mt)return mt->num_slots != num_slots ? -EINVAL :0 ; +/* Arbitrary limit for avoiding too large memory allocation. */ +if (num_slots >1024 ) +return -EINVAL ; mt =kzalloc (struct_size (mt, slots, num_slots),GFP_KERNEL );if (!mt)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 9/16 x86/CPU/AMD: Add models 0x60-0x6f to the Zen5 range
In reply to Sasha LevinFrom: Perry Yuan <[email protected]>
[ Upstream commit bf5641eccf71bcd13a849930e190563c3a19815d ]
Add some new Zen5 models for the 0x1A family.
[ bp: Merge the 0x60 and 0x70 ranges. ]
--- arch/x86/kernel/cpu/amd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/cpu/amd.c +1 -1
@@ -462,7 +462,7 @@ static void bsp_init_amd(struct cpuinfo_x86 *c)switch (c->x86_model) { case 0x00 ... 0x2f: case 0x40 ... 0x4f: - case 0x70 ... 0x7f: + case 0x60 ... 0x7f:setup_force_cpu_cap (X86_FEATURE_ZEN5 );break ;default :
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 10/16 ALSA: ump: Transmit RPN/NRPN message at each MSB/LSB data reception
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit e6ce8a28c768dbbad3f818db286cd0f4c7a921a8 ]
The UMP 1.1 spec says that an RPN/NRPN should be sent when one of the following occurs:
* a CC 38 is received
* a subsequent CC 6 is received
* a CC 98, 99, 100, and 101 is received, indicating the last RPN/NRPN message has ended and a new one has started
That said, we should send a partial data even if it's not fully filled. Let's change the UMP conversion helper code to follow that rule.
--- include/sound/ump_convert.h | 1 + sound/core/ump_convert.c | 49 ++++++++++++++++++++++++------------- 2 files changed, 33 insertions(+), 17 deletions(-)
include/sound/ump_convert.h +1 -0
@@ -13,6 +13,7 @@ struct ump_cvt_to_ump_bank {unsigned char cc_nrpn_msb, cc_nrpn_lsb;unsigned char cc_data_msb, cc_data_lsb;unsigned char cc_bank_msb, cc_bank_lsb; +bool cc_data_msb_set, cc_data_lsb_set; };/* context for converting from MIDI1 byte stream to UMP packet */
sound/core/ump_convert.c +32 -17
99 lines not on this page · raw message
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 11/16 ALSA: ump: Explicitly reset RPN with Null RPN
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 50a6dd19dca9446475f023eaa652016bfe5b1cbe ]
RPN with 127:127 is treated as a Null RPN, just to reset the parameters, and it's not translated to MIDI2. Although the current code can work as is in most cases, better to implement the RPN reset explicitly for Null message.
--- sound/core/ump_convert.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
sound/core/ump_convert.c +14 -5
@@ -287,6 +287,15 @@ static int cvt_legacy_system_to_ump(struct ump_cvt_to_ump *cvt,return 4 ; } +static void reset_rpn (struct ump_cvt_to_ump_bank *cc) +{ + cc->rpn_set =0 ; + cc->nrpn_set =0 ; + cc->cc_rpn_msb = cc->cc_rpn_lsb =0 ; + cc->cc_data_msb = cc->cc_data_lsb =0 ; + cc->cc_data_msb_set = cc->cc_data_lsb_set =0 ; +} +static int fill_rpn (struct ump_cvt_to_ump_bank *cc,union snd_ump_midi2_msg *midi2,bool flush)
@@ -312,11 +321,7 @@ static int fill_rpn(struct ump_cvt_to_ump_bank *cc, midi2->rpn.data =upscale_14_to_32bit ((cc->cc_data_msb <<7 ) | cc->cc_data_lsb); - cc->rpn_set =0 ; - cc->nrpn_set =0 ; - cc->cc_rpn_msb = cc->cc_rpn_lsb =0 ; - cc->cc_data_msb = cc->cc_data_lsb =0 ; - cc->cc_data_msb_set = cc->cc_data_lsb_set =0 ; +reset_rpn (cc);return 1 ; }
@@ -374,11 +379,15 @@ static int cvt_legacy_cmd_to_ump(struct ump_cvt_to_ump *cvt, ret =fill_rpn (cc, midi2, true); cc->rpn_set =1 ; cc->cc_rpn_msb = buf[2 ]; +if (cc->cc_rpn_msb ==0x7f && cc->cc_rpn_lsb ==0x7f ) +reset_rpn (cc);return ret;case UMP_CC_RPN_LSB : ret =fill_rpn (cc, midi2, true); cc->rpn_set =1 ; cc->cc_rpn_lsb = buf[2 ]; +if (cc->cc_rpn_msb ==0x7f && cc->cc_rpn_lsb ==0x7f ) +reset_rpn (cc);return ret;case UMP_CC_NRPN_MSB : ret =fill_rpn (cc, midi2, true);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 12/16 ALSA: seq: ump: Use the common RPN/bank conversion context
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit a683030606fa5ff8b722a5e28839d19288011ede ]
The UMP core conversion helper API already defines the context needed to record the bank and RPN/NRPN values, and we can simply re-use the same struct instead of re-defining the same content as a different name.
--- sound/core/seq/seq_ports.h | 14 ++------------ sound/core/seq/seq_ump_convert.c | 10 +++++----- 2 files changed, 7 insertions(+), 17 deletions(-)
sound/core/seq/seq_ports.h +2 -12
@@ -7,6 +7,7 @@#define __SND_SEQ_PORTS_H#include <sound/seq_kernel.h> +#include <sound/ump_convert.h> #include "seq_lock.h" /* list of 'exported' ports */
@@ -42,17 +43,6 @@ struct snd_seq_port_subs_info {int (*close)(void *private_data,struct snd_seq_port_subscribe *info); }; -/* context for converting from legacy control event to UMP packet */ -struct snd_seq_ump_midi2_bank { -bool rpn_set; -bool nrpn_set; -bool bank_set; -unsigned char cc_rpn_msb, cc_rpn_lsb; -unsigned char cc_nrpn_msb, cc_nrpn_lsb; -unsigned char cc_data_msb, cc_data_lsb; -unsigned char cc_bank_msb, cc_bank_lsb; -}; -struct snd_seq_client_port {struct snd_seq_addr addr;/* client/port number */
@@ -88,7 +78,7 @@ struct snd_seq_client_port {unsigned char ump_group;#if IS_ENABLED (CONFIG_SND_SEQ_UMP ) -struct snd_seq_ump_midi2_bank midi2_bank[16 ];/* per channel */ +struct ump_cvt_to_ump_bank midi2_bank[16 ];/* per channel */ #endif };
sound/core/seq/seq_ump_convert.c +5 -5
@@ -368,7 +368,7 @@ static int cvt_ump_midi1_to_midi2(struct snd_seq_client *dest,struct snd_seq_ump_event ev_cvt;const union snd_ump_midi1_msg *midi1 = (const union snd_ump_midi1_msg *)event->ump;union snd_ump_midi2_msg *midi2 = (union snd_ump_midi2_msg *)ev_cvt.ump; -struct snd_seq_ump_midi2_bank *cc; +struct ump_cvt_to_ump_bank *cc; ev_cvt = *event;memset (&ev_cvt.ump,0 ,sizeof (ev_cvt.ump));
@@ -790,7 +790,7 @@ static int paf_ev_to_ump_midi2(const struct snd_seq_event *event, }/* set up the MIDI2 RPN/NRPN packet data from the parsed info */ -static void fill_rpn (struct snd_seq_ump_midi2_bank *cc, +static void fill_rpn (struct ump_cvt_to_ump_bank *cc,union snd_ump_midi2_msg *data,unsigned char channel) {
@@ -822,7 +822,7 @@ static int cc_ev_to_ump_midi2(const struct snd_seq_event *event,unsigned char channel = event->data.control.channel &0x0f ;unsigned char index = event->data.control.param &0x7f ;unsigned char val = event->data.control.value &0x7f ; -struct snd_seq_ump_midi2_bank *cc = &dest_port->midi2_bank[channel]; +struct ump_cvt_to_ump_bank *cc = &dest_port->midi2_bank[channel];/* process special CC's (bank/rpn/nrpn) */ switch (index) {
@@ -887,7 +887,7 @@ static int pgm_ev_to_ump_midi2(const struct snd_seq_event *event, unsigned char status) {unsigned char channel = event->data.control.channel &0x0f ; -struct snd_seq_ump_midi2_bank *cc = &dest_port->midi2_bank[channel]; +struct ump_cvt_to_ump_bank *cc = &dest_port->midi2_bank[channel]; data->pg.status = status; data->pg.channel = channel;
@@ -924,7 +924,7 @@ static int ctrl14_ev_to_ump_midi2(const struct snd_seq_event *event, {unsigned char channel = event->data.control.channel &0x0f ;unsigned char index = event->data.control.param &0x7f ; -struct snd_seq_ump_midi2_bank *cc = &dest_port->midi2_bank[channel]; +struct ump_cvt_to_ump_bank *cc = &dest_port->midi2_bank[channel];unsigned char msb, lsb; msb = (event->data.control.value >>7 ) &0x7f ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 13/16 ALSA: seq: ump: Transmit RPN/NRPN message at each MSB/LSB data reception
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit a4ff92ff0bdd731eca9f0b50b1cbb5aba89be4b2 ]
Just like the core UMP conversion helper, we need to deal with the partially-filled RPN/NRPN data in the sequencer UMP converter as well.
--- sound/core/seq/seq_ump_convert.c | 74 +++++++++++++++++++------------- 1 file changed, 44 insertions(+), 30 deletions(-)
sound/core/seq/seq_ump_convert.c +44 -30
@@ -790,27 +790,39 @@ static int paf_ev_to_ump_midi2(const struct snd_seq_event *event, }/* set up the MIDI2 RPN/NRPN packet data from the parsed info */ -static void fill_rpn (struct ump_cvt_to_ump_bank *cc, -union snd_ump_midi2_msg *data, -unsigned char channel) +static int fill_rpn (struct ump_cvt_to_ump_bank *cc, +union snd_ump_midi2_msg *data, +unsigned char channel, +bool flush) { +if (!(cc->cc_data_lsb_set || cc->cc_data_msb_set)) +return 0 ;// skip +/* when not flushing, wait for complete data set */ +if (!flush && (!cc->cc_data_lsb_set || !cc->cc_data_msb_set)) +return 0 ;// skip +if (cc->rpn_set) { data->rpn.status =UMP_MSG_STATUS_RPN ; data->rpn.bank = cc->cc_rpn_msb; data->rpn.index = cc->cc_rpn_lsb; - cc->rpn_set =0 ; - cc->cc_rpn_msb = cc->cc_rpn_lsb =0 ; - }else { + }else if (cc->nrpn_set) { data->rpn.status =UMP_MSG_STATUS_NRPN ; data->rpn.bank = cc->cc_nrpn_msb; data->rpn.index = cc->cc_nrpn_lsb; - cc->nrpn_set =0 ; - cc->cc_nrpn_msb = cc->cc_nrpn_lsb =0 ; + }else { +return 0 ;// skip } + data->rpn.data =upscale_14_to_32bit ((cc->cc_data_msb <<7 ) | cc->cc_data_lsb); data->rpn.channel = channel; + + cc->rpn_set =0 ; + cc->nrpn_set =0 ; + cc->cc_rpn_msb = cc->cc_rpn_lsb =0 ; cc->cc_data_msb = cc->cc_data_lsb =0 ; + cc->cc_data_msb_set = cc->cc_data_lsb_set =0 ; +return 1 ; }/* convert CC event to MIDI 2.0 UMP */
@@ -823,28 +835,34 @@ static int cc_ev_to_ump_midi2(const struct snd_seq_event *event,unsigned char index = event->data.control.param &0x7f ;unsigned char val = event->data.control.value &0x7f ;struct ump_cvt_to_ump_bank *cc = &dest_port->midi2_bank[channel]; +int ret;/* process special CC's (bank/rpn/nrpn) */ switch (index) {case UMP_CC_RPN_MSB : + ret =fill_rpn (cc, data, channel, true); cc->rpn_set =1 ; cc->cc_rpn_msb = val; -return 0 ;// skip +return ret;case UMP_CC_RPN_LSB : + ret =fill_rpn (cc, data, channel, true); cc->rpn_set =1 ; cc->cc_rpn_lsb = val; -return 0 ;// skip +return ret;case UMP_CC_NRPN_MSB : + ret =fill_rpn (cc, data, channel, true); cc->nrpn_set =1 ; cc->cc_nrpn_msb = val; -return 0 ;// skip +return ret;case UMP_CC_NRPN_LSB : + ret =fill_rpn (cc, data, channel, true); cc->nrpn_set =1 ; cc->cc_nrpn_lsb = val; -return 0 ;// skip +return ret;case UMP_CC_DATA : + cc->cc_data_msb_set =1 ; cc->cc_data_msb = val; -return 0 ;// skip +return fill_rpn (cc, data, channel, false);case UMP_CC_BANK_SELECT : cc->bank_set =1 ; cc->cc_bank_msb = val;
@@ -854,11 +872,9 @@ static int cc_ev_to_ump_midi2(const struct snd_seq_event *event, cc->cc_bank_lsb = val;return 0 ;// skip case UMP_CC_DATA_LSB : + cc->cc_data_lsb_set =1 ; cc->cc_data_lsb = val; -if (!(cc->rpn_set || cc->nrpn_set)) -return 0 ;// skip -fill_rpn (cc, data, channel); -return 1 ; +return fill_rpn (cc, data, channel, false); } data->cc.status = status;
@@ -926,6 +942,7 @@ static int ctrl14_ev_to_ump_midi2(const struct snd_seq_event *event,unsigned char index = event->data.control.param &0x7f ;struct ump_cvt_to_ump_bank *cc = &dest_port->midi2_bank[channel];unsigned char msb, lsb; +int ret; msb = (event->data.control.value >>7 ) &0x7f ; lsb = event->data.control.value &0x7f ;
@@ -939,28 +956,25 @@ static int ctrl14_ev_to_ump_midi2(const struct snd_seq_event *event, cc->cc_bank_lsb = lsb;return 0 ;// skip case UMP_CC_RPN_MSB : - cc->cc_rpn_msb = msb; - fallthrough;case UMP_CC_RPN_LSB : - cc->rpn_set =1 ; + ret =fill_rpn (cc, data, channel, true); + cc->cc_rpn_msb = msb; cc->cc_rpn_lsb = lsb; -return 0 ;// skip + cc->rpn_set =1 ; +return ret;case UMP_CC_NRPN_MSB : - cc->cc_nrpn_msb = msb; - fallthrough;case UMP_CC_NRPN_LSB : + ret =fill_rpn (cc, data, channel, true); + cc->cc_nrpn_msb = msb; cc->nrpn_set =1 ; cc->cc_nrpn_lsb = lsb; -return 0 ;// skip +return ret;case UMP_CC_DATA : - cc->cc_data_msb = msb; - fallthrough;case UMP_CC_DATA_LSB : + cc->cc_data_msb_set = cc->cc_data_lsb_set =1 ; + cc->cc_data_msb = msb; cc->cc_data_lsb = lsb; -if (!(cc->rpn_set || cc->nrpn_set)) -return 0 ;// skip -fill_rpn (cc, data, channel); -return 1 ; +return fill_rpn (cc, data, channel, false); } data->cc.status =UMP_MSG_STATUS_CC ;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 14/16 ALSA: seq: ump: Explicitly reset RPN with Null RPN
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 98ea612dd1150adb61cd2a0e93875e1cc77e6b87 ]
RPN with 127:127 is treated as a Null RPN, just to reset the parameters, and it's not translated to MIDI2. Although the current code can work as is in most cases, better to implement the RPN reset explicitly for Null message.
--- sound/core/seq/seq_ump_convert.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
sound/core/seq/seq_ump_convert.c +16 -5
@@ -789,6 +789,15 @@ static int paf_ev_to_ump_midi2(const struct snd_seq_event *event,return 1 ; } +static void reset_rpn (struct ump_cvt_to_ump_bank *cc) +{ + cc->rpn_set =0 ; + cc->nrpn_set =0 ; + cc->cc_rpn_msb = cc->cc_rpn_lsb =0 ; + cc->cc_data_msb = cc->cc_data_lsb =0 ; + cc->cc_data_msb_set = cc->cc_data_lsb_set =0 ; +} +/* set up the MIDI2 RPN/NRPN packet data from the parsed info */ static int fill_rpn(struct ump_cvt_to_ump_bank *cc, union snd_ump_midi2_msg *data,
@@ -817,11 +826,7 @@ static int fill_rpn(struct ump_cvt_to_ump_bank *cc, cc->cc_data_lsb); data->rpn.channel = channel; - cc->rpn_set =0 ; - cc->nrpn_set =0 ; - cc->cc_rpn_msb = cc->cc_rpn_lsb =0 ; - cc->cc_data_msb = cc->cc_data_lsb =0 ; - cc->cc_data_msb_set = cc->cc_data_lsb_set =0 ; +reset_rpn (cc);return 1 ; }
@@ -843,11 +848,15 @@ static int cc_ev_to_ump_midi2(const struct snd_seq_event *event, ret =fill_rpn (cc, data, channel, true); cc->rpn_set =1 ; cc->cc_rpn_msb = val; +if (cc->cc_rpn_msb ==0x7f && cc->cc_rpn_lsb ==0x7f ) +reset_rpn (cc);return ret;case UMP_CC_RPN_LSB : ret =fill_rpn (cc, data, channel, true); cc->rpn_set =1 ; cc->cc_rpn_lsb = val; +if (cc->cc_rpn_msb ==0x7f && cc->cc_rpn_lsb ==0x7f ) +reset_rpn (cc);return ret;case UMP_CC_NRPN_MSB : ret =fill_rpn (cc, data, channel, true);
@@ -961,6 +970,8 @@ static int ctrl14_ev_to_ump_midi2(const struct snd_seq_event *event, cc->cc_rpn_msb = msb; cc->cc_rpn_lsb = lsb; cc->rpn_set =1 ; +if (cc->cc_rpn_msb ==0x7f && cc->cc_rpn_lsb ==0x7f ) +reset_rpn (cc);return ret;case UMP_CC_NRPN_MSB :case UMP_CC_NRPN_LSB :
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 15/16 net/mlx5: DR, Fix 'stack guard page was hit' error in dr_rule
In reply to Sasha LevinFrom: Yevgeny Kliteynik <[email protected]>
[ Upstream commit 94a3ad6c081381fa9ee523781789802b4ed00faf ]
This patch reduces the size of hw_ste_arr_optimized array that is allocated on stack from 640 bytes (5 match STEs + 5 action STES) to 448 bytes (2 match STEs + 5 action STES).
This fixes the 'stack guard page was hit' issue, while still fitting majority of the usecases (up to 2 match STEs).
--- drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_rule.c +1 -1
@@ -7,7 +7,7 @@/* don't try to optimize STE allocation if the stack is too constaraining */ #define DR_RULE_MAX_STES_OPTIMIZED 0#else -#define DR_RULE_MAX_STES_OPTIMIZED 5 +#define DR_RULE_MAX_STES_OPTIMIZED 2#endif #define DR_RULE_MAX_STE_CHAIN_OPTIMIZED (DR_RULE_MAX_STES_OPTIMIZED + DR_ACTION_MAX_STES)
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 16/16 smb: client: fix FSCTL_GET_REPARSE_POINT against NetApp
In reply to Sasha LevinFrom: Paulo Alcantara <[email protected]>
[ Upstream commit ddecea00f87f0c46e9c8339a7c89fb2ff891521a ]
NetApp server requires the file to be open with FILE_READ_EA access in order to support FSCTL_GET_REPARSE_POINT, otherwise it will return STATUS_INVALID_DEVICE_REQUEST. It doesn't make any sense because there's no requirement for FILE_READ_EA bit to be set nor STATUS_INVALID_DEVICE_REQUEST being used for something other than "unsupported reparse points" in MS-FSA.
To fix it and improve compatibility, set FILE_READ_EA & SYNCHRONIZE bits to match what Windows client currently does.
--- fs/smb/client/smb2inode.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/smb/client/smb2inode.c +4 -2
@@ -948,7 +948,8 @@ int smb2_query_path_info(const unsigned int xid, cmds[num_cmds++] =SMB2_OP_GET_REPARSE ; oparms =CIFS_OPARMS (cifs_sb, tcon, full_path, -FILE_READ_ATTRIBUTES |FILE_READ_EA , +FILE_READ_ATTRIBUTES | +FILE_READ_EA |SYNCHRONIZE ,FILE_OPEN , create_options |OPEN_REPARSE_POINT ,ACL_NO_MODE );cifs_get_readable_path (tcon, full_path, &cfile);
@@ -1256,7 +1257,8 @@ int smb2_query_reparse_point(const unsigned int xid,cifs_dbg (FYI ,"%s: path: %s\n" , __func__, full_path);cifs_get_readable_path (tcon, full_path, &cfile); - oparms =CIFS_OPARMS (cifs_sb, tcon, full_path,FILE_READ_ATTRIBUTES , + oparms =CIFS_OPARMS (cifs_sb, tcon, full_path, +FILE_READ_ATTRIBUTES |FILE_READ_EA |SYNCHRONIZE ,FILE_OPEN ,OPEN_REPARSE_POINT ,ACL_NO_MODE ); rc = smb2_compound_op(xid, tcon, cifs_sb, full_path, &oparms, &in_iov,
Signature · 1 line
2.43.0