5.17.14-rc1 review
Subsystems (3)
Greg Kroah-Hartman
maintainerPATCH 81/772 scsi: lpfc: Fix call trace observed during I/O with CMF enabled
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
[ Upstream commit d6d45f67a11136cb88a70a29ab22ea6db8ae6bd5 ]
The following was seen with CMF enabled:
BUG: using smp_processor_id() in preemptible
code: systemd-udevd/31711
kernel: caller is lpfc_update_cmf_cmd+0x214/0x420 [lpfc]
kernel: CPU: 12 PID: 31711 Comm: systemd-udevd
kernel: Call Trace:
kernel: <TASK>
kernel: dump_stack_lvl+0x44/0x57
kernel: check_preemption_disabled+0xbf/0xe0
kernel: lpfc_update_cmf_cmd+0x214/0x420 [lpfc]
kernel: lpfc_nvme_fcp_io_submit+0x23b4/0x4df0 [lpfc]
this_cpu_ptr() calls smp_processor_id() in a preemptible context.
Fix by using per_cpu_ptr() with raw_smp_processor_id() instead.
--- drivers/scsi/lpfc/lpfc_scsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_scsi.c +2 -2
@@ -3936,7 +3936,7 @@ lpfc_update_cmf_cmpl(struct lpfc_hba *phba,else time =div_u64 (time +500 ,1000 );/* round it */ - cgs =this_cpu_ptr (phba->cmf_stat); + cgs =per_cpu_ptr (phba->cmf_stat,raw_smp_processor_id ());atomic64_add (size, &cgs->rcv_bytes);atomic64_add (time, &cgs->rx_latency);atomic_inc (&cgs->rx_io_cnt);
@@ -3980,7 +3980,7 @@ lpfc_update_cmf_cmd(struct lpfc_hba *phba, uint32_t size)atomic_set (&phba->rx_max_read_cnt, size); } - cgs =this_cpu_ptr (phba->cmf_stat); + cgs =per_cpu_ptr (phba->cmf_stat,raw_smp_processor_id ());atomic64_add (size, &cgs->total_bytes);return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 101/772 drm/plane: Move range check for format_count earlier
In reply to Greg Kroah-HartmanFrom: Steven Price <[email protected]>
[ Upstream commit 4b674dd69701c2e22e8e7770c1706a69f3b17269 ]
While the check for format_count > 64 in __drm_universal_plane_init() shouldn't be hit (it's a WARN_ON), in its current position it will then leak the plane->format_types array and fail to call drm_mode_object_unregister() leaking the modeset identifier. Move it to the start of the function to avoid allocating those resources in the first place.
--- drivers/gpu/drm/drm_plane.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/drm_plane.c +7 -7
@@ -249,6 +249,13 @@ static int __drm_universal_plane_init(struct drm_device *dev,if (WARN_ON (config->num_total_plane >=32 ))return -EINVAL ; +/* +* First driver to need more than 64 formats needs to fix this. Each +* format is encoded as a bit and the current code only supports a u64. +*/ +if (WARN_ON (format_count >64 )) +return -EINVAL ; +WARN_ON (drm_drv_uses_atomic_modeset (dev) && (!funcs->atomic_destroy_state || !funcs->atomic_duplicate_state));
@@ -270,13 +277,6 @@ static int __drm_universal_plane_init(struct drm_device *dev,return -ENOMEM ; } -/* -* First driver to need more than 64 formats needs to fix this. Each -* format is encoded as a bit and the current code only supports a u64. -*/ -if (WARN_ON (format_count >64 )) -return -EINVAL ; -if (format_modifiers) {const uint64_t *temp_modifiers = format_modifiers;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 147/772 Bluetooth: HCI: Add HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN quirk
In reply to Greg Kroah-HartmanFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 05abad857277dda198063017b00ba5b9fed2c0cb ]
This adds HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN quirk which can be used to mark HCI_Enhanced_Setup_Synchronous_Connection as broken even if its support command bit are set since some controller report it as supported but the command don't work properly with some configurations (e.g. BT_VOICE_TRANSPARENT/mSBC).
--- include/net/bluetooth/hci.h | 9 +++++++++ include/net/bluetooth/hci_core.h | 8 ++++++-- net/bluetooth/hci_conn.c | 2 +- net/bluetooth/sco.c | 2 +- 4 files changed, 17 insertions(+), 4 deletions(-)
include/net/bluetooth/hci.h +9 -0
@@ -265,6 +265,15 @@ enum {* runtime suspend, because event filtering takes place there. */ HCI_QUIRK_BROKEN_FILTER_CLEAR_ALL , + +/* +* When this quirk is set, disables the use of +* HCI_OP_ENHANCED_SETUP_SYNC_CONN command to setup SCO connections. +* +* This quirk can be set before hci_register_dev is called or +* during the hdev->setup vendor callback. +*/ + HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN, };/* HCI device flags */
include/net/bluetooth/hci_core.h +6 -2
@@ -1483,8 +1483,12 @@ void hci_conn_del_sysfs(struct hci_conn *conn);#define privacy_mode_capable (dev) (use_ll_privacy(dev) && \ (hdev->commands[39] & 0x04)) -/* Use enhanced synchronous connection if command is supported */ -#define enhanced_sco_capable (dev) ((dev)->commands[29] & 0x08) +/* Use enhanced synchronous connection if command is supported and its quirk +* has not been set. +*/ +#define enhanced_sync_conn_capable (dev) \ + (((dev)->commands[29] & 0x08) && \ + !test_bit(HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN, &(dev)->quirks))/* Use ext scanning if set ext scan param and ext scan enable is supported */ #define use_ext_scan (dev) (((dev)->commands[37] & 0x20) && \
net/bluetooth/hci_conn.c +1 -1
@@ -481,7 +481,7 @@ static bool hci_setup_sync_conn(struct hci_conn *conn, __u16 handle)bool hci_setup_sync (struct hci_conn *conn,__u16 handle) { -if (enhanced_sco_capable (conn->hdev)) +if (enhanced_sync_conn_capable (conn->hdev))return hci_enhanced_setup_sync_conn (conn, handle);return hci_setup_sync_conn (conn, handle);
net/bluetooth/sco.c +1 -1
@@ -885,7 +885,7 @@ static int sco_sock_setsockopt(struct socket *sock, int level, int optname, err = -EBADFD ;break ; } -if (enhanced_sco_capable (hdev) && +if (enhanced_sync_conn_capable (hdev) && voice.setting ==BT_VOICE_TRANSPARENT )sco_pi (sk)->codec.id =BT_CODEC_TRANSPARENT ;hci_dev_put (hdev);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 138/772 mt76: mt7921: accept rx frames with non-standard VHT MCS10-11
In reply to Greg Kroah-HartmanFrom: Felix Fietkau <[email protected]>
[ Upstream commit 3128ea016965ce9f91ddf4e1dd944724462d1698 ]
The hardware receives them properly, they should not be dropped
--- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7921/mac.c +1 -1
@@ -698,7 +698,7 @@ mt7921_mac_fill_rx(struct mt7921_dev *dev, struct sk_buff *skb) status->nss =FIELD_GET (MT_PRXV_NSTS , v0) +1 ; status->encoding =RX_ENC_VHT ; -if (i >9 ) +if (i >11 )return -EINVAL ;break ;case MT_PHY_TYPE_HE_MU :
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 104/772 arm64: compat: Do not treat syscall number as ESR_ELx for a bad syscall
In reply to Greg Kroah-HartmanFrom: Alexandru Elisei <[email protected]>
[ Upstream commit 3fed9e551417b84038b15117732ea4505eee386b ]
If a compat process tries to execute an unknown system call above the __ARM_NR_COMPAT_END number, the kernel sends a SIGILL signal to the offending process. Information about the error is printed to dmesg in compat_arm_syscall() -> arm64_notify_die() -> arm64_force_sig_fault() -> arm64_show_signal().
arm64_show_signal() interprets a non-zero value for current->thread.fault_code as an exception syndrome and displays the message associated with the ESR_ELx.EC field (bits 31:26). current->thread.fault_code is set in compat_arm_syscall() -> arm64_notify_die() with the bad syscall number instead of a valid ESR_ELx value. This means that the ESR_ELx.EC field has the value that the user set for the syscall number and the kernel can end up printing bogus exception messages*. For example, for the syscall number 0x68000000, which evaluates to ESR_ELx.EC value of 0x1A (ESR_ELx_EC_FPAC) the kernel prints this error:
[ 18.349161] syscall[300]: unhandled exception: ERET/ERETAA/ERETAB, ESR 0x68000000, Oops - bad compat syscall(2) in syscall[10000+50000] [ 18.350639] CPU: 2 PID: 300 Comm: syscall Not tainted 5.18.0-rc1 #79 [ 18.351249] Hardware name: Pine64 RockPro64 v2.0 (DT)
[..]
which is misleading, as the bad compat syscall has nothing to do with pointer authentication.
Stop arm64_show_signal() from printing exception syndrome information by having compat_arm_syscall() set the ESR_ELx value to 0, as it has no meaning for an invalid system call number. The example above now becomes:
[ 19.935275] syscall[301]: unhandled exception: Oops - bad compat syscall(2) in syscall[10000+50000] [ 19.936124] CPU: 1 PID: 301 Comm: syscall Not tainted 5.18.0-rc1-00005-g7e08006d4102 #80 [ 19.936894] Hardware name: Pine64 RockPro64 v2.0 (DT)
[..]
which although shows less information because the syscall number, wrongfully advertised as the ESR value, is missing, it is better than showing plainly wrong information. The syscall number can be easily obtained with strace.
*A 32-bit value above or equal to 0x8000_0000 is interpreted as a negative integer in compat_arm_syscal() and the condition scno < __ARM_NR_COMPAT_END evaluates to true; the syscall will exit to userspace in this case with the ENOSYS error code instead of arm64_notify_die() being called.
--- arch/arm64/kernel/sys_compat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/sys_compat.c +1 -1
@@ -114,6 +114,6 @@ long compat_arm_syscall(struct pt_regs *regs, int scno) addr =instruction_pointer (regs) - (compat_thumb_mode (regs) ?2 :4 );arm64_notify_die ("Oops - bad compat syscall(2)" , regs, -SIGILL ,ILL_ILLTRP , addr, scno); +SIGILL ,ILL_ILLTRP , addr,0 );return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 78/772 tcp: consume incoming skb leading to a reset
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit d9d024f96609016628d750ebc8ee4a6f0d80e6e1 ]
Whenever tcp_validate_incoming() handles a valid RST packet, we should not pretend the packet was dropped.
Create a special section at the end of tcp_validate_incoming() to handle this case.
--- net/ipv4/tcp_input.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-)
net/ipv4/tcp_input.c +16 -12
@@ -5694,7 +5694,7 @@ static bool tcp_validate_incoming(struct sock *sk, struct sk_buff *skb, &tp->last_oow_ack_time))tcp_send_dupack (sk, skb); }else if (tcp_reset_check (sk, skb)) { -tcp_reset (sk, skb); + goto reset; } goto discard; }
@@ -5730,17 +5730,16 @@ static bool tcp_validate_incoming(struct sock *sk, struct sk_buff *skb, }if (rst_seq_match) -tcp_reset (sk, skb); -else { -/* Disable TFO if RST is out-of-order -* and no data has been received -* for current active TFO socket -*/ -if (tp->syn_fastopen && !tp->data_segs_in && - sk->sk_state ==TCP_ESTABLISHED ) -tcp_fastopen_active_disable (sk); -tcp_send_challenge_ack (sk); - } + goto reset; + +/* Disable TFO if RST is out-of-order +* and no data has been received +* for current active TFO socket +*/ +if (tp->syn_fastopen && !tp->data_segs_in && + sk->sk_state ==TCP_ESTABLISHED ) +tcp_fastopen_active_disable (sk); +tcp_send_challenge_ack (sk); goto discard; }
@@ -5765,6 +5764,11 @@ static bool tcp_validate_incoming(struct sock *sk, struct sk_buff *skb, discard:tcp_drop (sk, skb);return false; + +reset: +tcp_reset (sk, skb); +__kfree_skb (skb); +return false; }/*
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 105/772 drm: msm: fix error check return value of irq_of_parse_and_map()
In reply to Greg Kroah-HartmanFrom: Lv Ruyi <[email protected]>
[ Upstream commit b9e4f1d2b505df8e2439b63e67afaa287c1c43e2 ]
The irq_of_parse_and_map() function returns 0 on failure, and does not return an negative value.
Patchwork: https://patchwork.freedesktop.org/patch/483175/
--- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +3 -3
@@ -577,9 +577,9 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev) } irq =irq_of_parse_and_map (pdev->dev.of_node,0 ); -if (irq <0 ) { - ret = irq; -DRM_DEV_ERROR (&pdev->dev,"failed to get irq: %d\n" , ret); +if (!irq) { + ret = -EINVAL ; +DRM_DEV_ERROR (&pdev->dev,"failed to get irq\n" ); goto fail; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 83/772 drm/amd/pm: fix double free in si_parse_power_table()
In reply to Greg Kroah-HartmanFrom: Keita Suzuki <[email protected]>
[ Upstream commit f3fa2becf2fc25b6ac7cf8d8b1a2e4a86b3b72bd ]
In function si_parse_power_table(), array adev->pm.dpm.ps and its member is allocated. If the allocation of each member fails, the array itself is freed and returned with an error code. However, the array is later freed again in si_dpm_fini() function which is called when the function returns an error.
This leads to potential double free of the array adev->pm.dpm.ps, as well as leak of its array members, since the members are not freed in the allocation function and the array is not nulled when freed. In addition adev->pm.dpm.num_ps, which keeps track of the allocated array member, is not updated until the member allocation is successfully finished, this could also lead to either use after free, or uninitialized variable access in si_dpm_fini().
Fix this by postponing the free of the array until si_dpm_fini() and increment adev->pm.dpm.num_ps everytime the array member is allocated.
--- drivers/gpu/drm/amd/pm/powerplay/si_dpm.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/pm/powerplay/si_dpm.c +3 -5
@@ -7247,17 +7247,15 @@ static int si_parse_power_table(struct amdgpu_device *adev)if (!adev->pm.dpm.ps)return -ENOMEM ; power_state_offset = (u8 *)state_array->states; -for (i =0 ; i < state_array->ucNumEntries; i++) { +for (adev->pm.dpm.num_ps =0 , i =0 ; i < state_array->ucNumEntries; i++) {u8 *idx; power_state = (union pplib_power_state *)power_state_offset; non_clock_array_index = power_state->v2.nonClockInfoIndex; non_clock_info = (struct _ATOM_PPLIB_NONCLOCK_INFO *) &non_clock_info_array->nonClockInfo[non_clock_array_index]; ps =kzalloc (sizeof (struct si_ps ),GFP_KERNEL ); -if (ps ==NULL ) { -kfree (adev->pm.dpm.ps); +if (ps ==NULL )return -ENOMEM ; - } adev->pm.dpm.ps[i].ps_priv = ps; si_parse_pplib_non_clock_info(adev, &adev->pm.dpm.ps[i], non_clock_info,
@@ -7279,8 +7277,8 @@ static int si_parse_power_table(struct amdgpu_device *adev) k++; } power_state_offset +=2 + power_state->v2.ucNumDPMLevels; + adev->pm.dpm.num_ps++; } - adev->pm.dpm.num_ps = state_array->ucNumEntries;/* fill in the vce power states */ for (i =0 ; i < adev->pm.dpm.num_of_vce_states; i++) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 142/772 media: hantro: HEVC: unconditionnaly set pps_{cb/cr}_qp_offset values
In reply to Greg Kroah-HartmanFrom: Benjamin Gaignard <[email protected]>
[ Upstream commit 46c836569196f377f87a3657b330cffaf94bd727 ]
Always set pps_cb_qp_offset and pps_cr_qp_offset values in Hantro/G2 register whatever is V4L2_HEVC_PPS_FLAG_PPS_SLICE_CHROMA_QP_OFFSETS_PRESENT flag value.
The vendor code does the same to set these values.
This fixes conformance test CAINIT_G_SHARP_3.
Fluster HEVC score is increase by one with this patch.
--- drivers/staging/media/hantro/hantro_g2_hevc_dec.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/staging/media/hantro/hantro_g2_hevc_dec.c +2 -7
@@ -180,13 +180,8 @@ static void set_params(struct hantro_ctx *ctx)hantro_reg_write (vpu, &g2_max_cu_qpd_depth,0 ); } -if (pps->flags &V4L2_HEVC_PPS_FLAG_PPS_SLICE_CHROMA_QP_OFFSETS_PRESENT ) { -hantro_reg_write (vpu, &g2_cb_qp_offset, pps->pps_cb_qp_offset); -hantro_reg_write (vpu, &g2_cr_qp_offset, pps->pps_cr_qp_offset); - }else { -hantro_reg_write (vpu, &g2_cb_qp_offset,0 ); -hantro_reg_write (vpu, &g2_cr_qp_offset,0 ); - } +hantro_reg_write (vpu, &g2_cb_qp_offset, pps->pps_cb_qp_offset); +hantro_reg_write (vpu, &g2_cr_qp_offset, pps->pps_cr_qp_offset);hantro_reg_write (vpu, &g2_filt_offset_beta, pps->pps_beta_offset_div2);hantro_reg_write (vpu, &g2_filt_offset_tc, pps->pps_tc_offset_div2);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 121/772 ASoC: tscs454: Add endianness flag in snd_soc_component_driver
In reply to Greg Kroah-HartmanFrom: Charles Keepax <[email protected]>
[ Upstream commit ff69ec96b87dccb3a29edef8cec5d4fefbbc2055 ]
The endianness flag is used on the CODEC side to specify an ambivalence to endian, typically because it is lost over the hardware link. This device receives audio over an I2S DAI and as such should have endianness applied.
A fixup is also required to use the width directly rather than relying on the format in hw_params, now both little and big endian would be supported. It is worth noting this changes the behaviour of S24_LE to use a word length of 24 rather than 32. This would appear to be a correction since the fact S24_LE is stored as 32 bits should not be presented over the bus.
--- sound/soc/codecs/tscs454.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
sound/soc/codecs/tscs454.c +6 -6
@@ -3120,18 +3120,17 @@ static int set_aif_sample_format(struct snd_soc_component *component,unsigned int width;int ret; -switch (format) { -case SNDRV_PCM_FORMAT_S16_LE : +switch (snd_pcm_format_width (format)) { +case 16 : width =FV_WL_16 ;break ; -case SNDRV_PCM_FORMAT_S20_3LE : +case 20 : width =FV_WL_20 ;break ; -case SNDRV_PCM_FORMAT_S24_3LE : +case 24 : width =FV_WL_24 ;break ; -case SNDRV_PCM_FORMAT_S24_LE : -case SNDRV_PCM_FORMAT_S32_LE : +case 32 : width =FV_WL_32 ;break ;default :
@@ -3326,6 +3325,7 @@ static const struct snd_soc_component_driver soc_component_dev_tscs454 = { .num_dapm_routes = ARRAY_SIZE(tscs454_intercon), .controls = tscs454_snd_controls, .num_controls = ARRAY_SIZE(tscs454_snd_controls), + .endianness = 1, };#define TSCS454_RATES SNDRV_PCM_RATE_8000_96000
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 146/772 usbnet: Run unregister_netdev() before unbind() again
In reply to Greg Kroah-HartmanFrom: Lukas Wunner <[email protected]>
[ Upstream commit d1408f6b4dd78fb1b9e26bcf64477984e5f85409 ]
Commit 2c9d6c2b871d ("usbnet: run unbind() before unregister_netdev()") sought to fix a use-after-free on disconnect of USB Ethernet adapters.
It turns out that a different fix is necessary to address the issue:
https://lore.kernel.org/netdev/18b3541e5372bc9b9fc733d422f4e698c089077c.1650177997.git.lukas@wunner.de/
So the commit was not necessary.
The commit made binding and unbinding of USB Ethernet asymmetrical:
Before, usbnet_probe() first invoked the ->bind() callback and then register_netdev(). usbnet_disconnect() mirrored that by first invoking unregister_netdev() and then ->unbind().
Since the commit, the order in usbnet_disconnect() is reversed and no longer mirrors usbnet_probe().
One consequence is that a PHY disconnected (and stopped) in ->unbind() is afterwards stopped once more by unregister_netdev() as it closes the netdev before unregistering. That necessitates a contortion in ->stop() because the PHY may only be stopped if it hasn't already been disconnected.
Reverting the commit allows making the call to phy_stop() unconditional in ->stop().
--- drivers/net/usb/asix_devices.c | 6 +----- drivers/net/usb/smsc95xx.c | 3 +-- drivers/net/usb/usbnet.c | 6 +++--- 3 files changed, 5 insertions(+), 10 deletions(-)
drivers/net/usb/asix_devices.c +1 -5
@@ -799,11 +799,7 @@ static int ax88772_stop(struct usbnet *dev) {struct asix_common_private *priv = dev->driver_priv; -/* On unplugged USB, we will get MDIO communication errors and the -* PHY will be set in to PHY_HALTED state. -*/ -if (priv->phydev->state !=PHY_HALTED ) -phy_stop (priv->phydev); +phy_stop (priv->phydev);return 0 ; }
drivers/net/usb/smsc95xx.c +1 -2
@@ -1218,8 +1218,7 @@ static int smsc95xx_start_phy(struct usbnet *dev)static int smsc95xx_stop (struct usbnet *dev) { -if (dev->net->phydev) -phy_stop (dev->net->phydev); +phy_stop (dev->net->phydev);return 0 ; }
drivers/net/usb/usbnet.c +3 -3
@@ -1616,9 +1616,6 @@ void usbnet_disconnect (struct usb_interface *intf) xdev->bus->bus_name, xdev->devpath, dev->driver_info->description); -if (dev->driver_info->unbind) - dev->driver_info->unbind (dev, intf); - net = dev->net;unregister_netdev (net);
@@ -1626,6 +1623,9 @@ void usbnet_disconnect (struct usb_interface *intf)usb_scuttle_anchored_urbs (&dev->deferred); +if (dev->driver_info->unbind) + dev->driver_info->unbind (dev, intf); +usb_kill_urb (dev->interrupt);usb_free_urb (dev->interrupt);kfree (dev->padding_pkt);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 152/772 ASoC: rt5645: Fix errorenous cleanup order
In reply to Greg Kroah-HartmanFrom: Lin Ma <[email protected]>
[ Upstream commit 2def44d3aec59e38d2701c568d65540783f90f2f ]
There is a logic error when removing rt5645 device as the function rt5645_i2c_remove() first cancel the &rt5645->jack_detect_work and delete the &rt5645->btn_check_timer latter. However, since the timer handler rt5645_btn_check_callback() will re-queue the jack_detect_work, this cleanup order is buggy.
That is, once the del_timer_sync in rt5645_i2c_remove is concurrently run with the rt5645_btn_check_callback, the canceled jack_detect_work will be rescheduled again, leading to possible use-after-free.
This patch fix the issue by placing the del_timer_sync function before the cancel_delayed_work_sync.
--- sound/soc/codecs/rt5645.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
sound/soc/codecs/rt5645.c +6 -1
@@ -4154,9 +4154,14 @@ static int rt5645_i2c_remove(struct i2c_client *i2c)if (i2c->irq)free_irq (i2c->irq, rt5645); +/* +* Since the rt5645_btn_check_callback() can queue jack_detect_work, +* the timer need to be delted first +*/ +del_timer_sync (&rt5645->btn_check_timer); +cancel_delayed_work_sync (&rt5645->jack_detect_work);cancel_delayed_work_sync (&rt5645->rcclock_work); -del_timer_sync (&rt5645->btn_check_timer);regulator_bulk_disable (ARRAY_SIZE (rt5645->supplies), rt5645->supplies);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 140/772 media: rga: fix possible memory leak in rga_probe
In reply to Greg Kroah-HartmanFrom: Hangyu Hua <[email protected]>
[ Upstream commit a71eb6025305192e646040cd76ccacb5bd48a1b5 ]
rga->m2m_dev needs to be freed when rga_probe fails.
--- drivers/media/platform/rockchip/rga/rga.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/media/platform/rockchip/rga/rga.c +4 -2
@@ -865,7 +865,7 @@ static int rga_probe(struct platform_device *pdev) ret =pm_runtime_resume_and_get (rga->dev);if (ret <0 ) - goto rel_vdev; + goto rel_m2m; rga->version.major = (rga_read (rga,RGA_VERSION_INFO ) >>24 ) &0xFF ; rga->version.minor = (rga_read (rga,RGA_VERSION_INFO ) >>20 ) &0x0F ;
@@ -881,7 +881,7 @@ static int rga_probe(struct platform_device *pdev) DMA_ATTR_WRITE_COMBINE);if (!rga->cmdbuf_virt) { ret = -ENOMEM ; - goto rel_vdev; + goto rel_m2m; } rga->src_mmu_pages =
@@ -918,6 +918,8 @@ static int rga_probe(struct platform_device *pdev) free_dma:dma_free_attrs (rga->dev,RGA_CMDBUF_SIZE , rga->cmdbuf_virt, rga->cmdbuf_phy,DMA_ATTR_WRITE_COMBINE ); +rel_m2m: +v4l2_m2m_release (rga->m2m_dev); rel_vdev:video_device_release (vfd); unreg_v4l2_dev:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 79/772 scsi: lpfc: Move cfg_log_verbose check before calling lpfc_dmp_dbg()
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
[ Upstream commit e294647b1aed4247fe52851f3a3b2b19ae906228 ]
In an attempt to log message 0126 with LOG_TRACE_EVENT, the following hard lockup call trace hangs the system.
Call Trace: _raw_spin_lock_irqsave+0x32/0x40 lpfc_dmp_dbg.part.32+0x28/0x220 [lpfc] lpfc_cmpl_els_fdisc+0x145/0x460 [lpfc] lpfc_sli_cancel_jobs+0x92/0xd0 [lpfc] lpfc_els_flush_cmd+0x43c/0x670 [lpfc] lpfc_els_flush_all_cmd+0x37/0x60 [lpfc] lpfc_sli4_async_event_proc+0x956/0x1720 [lpfc] lpfc_do_work+0x1485/0x1d70 [lpfc] kthread+0x112/0x130 ret_from_fork+0x1f/0x40 Kernel panic - not syncing: Hard LOCKUP
The same CPU tries to claim the phba->port_list_lock twice.
Move the cfg_log_verbose checks as part of the lpfc_printf_vlog() and lpfc_printf_log() macros before calling lpfc_dmp_dbg(). There is no need to take the phba->port_list_lock within lpfc_dmp_dbg().
--- drivers/scsi/lpfc/lpfc_init.c | 29 +---------------------------- drivers/scsi/lpfc/lpfc_logmsg.h | 6 +++--- 2 files changed, 4 insertions(+), 31 deletions(-)
drivers/scsi/lpfc/lpfc_init.c +1 -28
@@ -15712,34 +15712,7 @@ void lpfc_dmp_dbg(struct lpfc_hba *phba)unsigned int temp_idx;int i;int j =0 ; -unsigned long rem_nsec, iflags; -bool log_verbose = false; -struct lpfc_vport *port_iterator; - -/* Don't dump messages if we explicitly set log_verbose for the -* physical port or any vport. -*/ -if (phba->cfg_log_verbose) -return ; - -spin_lock_irqsave (&phba->port_list_lock, iflags); -list_for_each_entry (port_iterator, &phba->port_list, listentry) { -if (port_iterator->load_flag &FC_UNLOADING ) -continue ; -if (scsi_host_get (lpfc_shost_from_vport (port_iterator))) { -if (port_iterator->cfg_log_verbose) - log_verbose = true; - -scsi_host_put (lpfc_shost_from_vport (port_iterator)); - -if (log_verbose) { -spin_unlock_irqrestore (&phba->port_list_lock, - iflags); -return ; - } - } - } -spin_unlock_irqrestore (&phba->port_list_lock, iflags); +unsigned long rem_nsec;if (atomic_cmpxchg (&phba->dbg_log_dmping,0 ,1 ) !=0 )return ;
drivers/scsi/lpfc/lpfc_logmsg.h +3 -3
@@ -73,7 +73,7 @@ do { \ #define lpfc_printf_vlog(vport, level, mask, fmt, arg...) \ do { \ { if (((mask) & (vport)->cfg_log_verbose) || (level[1] <= '3')) { \ - if ((mask) & LOG_TRACE_EVENT) \ + if ((mask) & LOG_TRACE_EVENT && !(vport)->cfg_log_verbose) \ lpfc_dmp_dbg((vport)->phba); \ dev_printk(level, &((vport)->phba->pcidev)->dev, "%d:(%d):" \ fmt, (vport)->phba->brd_no, vport->vpi, ##arg); \
@@ -89,11 +89,11 @@ do { \ (phba)->pport->cfg_log_verbose : \ (phba)->cfg_log_verbose; \if (((mask) & log_verbose) || (level[1 ] <='3' )) { \ -if ((mask) &LOG_TRACE_EVENT ) \ +if ((mask) &LOG_TRACE_EVENT && !log_verbose) \lpfc_dmp_dbg (phba); \ dev_printk(level, &((phba)->pcidev)->dev, "%d:" \ fmt, phba->brd_no, ##arg); \ - } else if (!(phba)->cfg_log_verbose)\ + } else if (!log_verbose)\ lpfc_dbg_print(phba, "%d:" fmt, phba->brd_no, ##arg); \ } \ } while (0)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 145/772 media: cec-adap.c: fix is_configuring state
In reply to Greg Kroah-HartmanFrom: Hans Verkuil <[email protected]>
[ Upstream commit 59267fc34f4900dcd2ec3295f6be04b79aee2186 ]
If an adapter is trying to claim a free logical address then it is in the 'is_configuring' state. If during that process the cable is disconnected (HPD goes low, which in turn invalidates the physical address), then cec_adap_unconfigure() is called, and that set the is_configuring boolean to false, even though the thread that's trying to claim an LA is still running.
Don't touch the is_configuring bool in cec_adap_unconfigure(), it will eventually be cleared by the thread. By making that change the cec_config_log_addr() function also had to change: it was aborting if is_configuring became false (since that is what cec_adap_unconfigure() did), but that no longer works. Instead check if the physical address is invalid. That is a much more appropriate check anyway.
This fixes a bug where the the adapter could be disabled even though the device was still configuring. This could cause POLL transmits to time out.
--- drivers/media/cec/core/cec-adap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/cec/core/cec-adap.c +3 -3
@@ -1278,7 +1278,7 @@ static int cec_config_log_addr(struct cec_adapter *adap,* While trying to poll the physical address was reset * and the adapter was unconfigured, so bail out. */ -if (!adap->is_configuring) +if (adap->phys_addr ==CEC_PHYS_ADDR_INVALID )return -EINTR ;if (err)
@@ -1335,7 +1335,6 @@ static void cec_adap_unconfigure(struct cec_adapter *adap) adap->phys_addr != CEC_PHYS_ADDR_INVALID)WARN_ON (adap->ops->adap_log_addr (adap,CEC_LOG_ADDR_INVALID )); adap->log_addrs.log_addr_mask =0 ; - adap->is_configuring = false; adap->is_configured = false;cec_flush (adap);wake_up_interruptible (&adap->kthread_waitq);
@@ -1527,9 +1526,10 @@ static int cec_config_thread_func(void *arg)for (i =0 ; i < las->num_log_addrs; i++) las->log_addr[i] =CEC_LOG_ADDR_INVALID ;cec_adap_unconfigure (adap); + adap->is_configuring = false; adap->kthread_config =NULL ; -mutex_unlock (&adap->lock);complete (&adap->config_completion); +mutex_unlock (&adap->lock);return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 135/772 ipmi: Fix pr_fmt to avoid compilation issues
In reply to Greg Kroah-HartmanFrom: Corey Minyard <[email protected]>
[ Upstream commit 2ebaf18a0b7fb764bba6c806af99fe868cee93de ]
The was it was wouldn't work in some situations, simplify it. What was there was unnecessary complexity.
--- drivers/char/ipmi/ipmi_msghandler.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/ipmi/ipmi_msghandler.c +2 -2
@@ -11,8 +11,8 @@* Copyright 2002 MontaVista Software Inc. */ -#define pr_fmt (fmt) "%s" fmt, "IPMI message handler: " -#define dev_fmt pr_fmt +#define pr_fmt (fmt) "IPMI message handler: " fmt +#define dev_fmt (fmt) pr_fmt(fmt)#include <linux/module.h> #include <linux/errno.h>
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 141/772 media: coda: limit frame interval enumeration to supported encoder frame sizes
In reply to Greg Kroah-HartmanFrom: Philipp Zabel <[email protected]>
[ Upstream commit 67e33dd957880879e785cfea83a3aa24bd5c5577 ]
Let VIDIOC_ENUM_FRAMEINTERVALS return -EINVAL if userspace queries frame intervals for frame sizes unsupported by the encoder. Fixes the following v4l2-compliance failure:
fail: v4l2-test-formats.cpp(123): found frame intervals for invalid size 47x16
fail: v4l2-test-formats.cpp(282): node->codec_mask & STATEFUL_ENCODER
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: FAIL
[hverkuil: drop incorrect 'For decoder devices, return -ENOTTY.' in the commit log]
--- drivers/media/platform/coda/coda-common.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/media/platform/coda/coda-common.c +14 -6
@@ -1324,7 +1324,8 @@ static int coda_enum_frameintervals(struct file *file, void *fh, struct v4l2_frmivalenum *f) {struct coda_ctx *ctx =fh_to_ctx (fh); -int i; +struct coda_q_data *q_data; +const struct coda_codec *codec;if (f->index)return -EINVAL ;
@@ -1333,12 +1334,19 @@ static int coda_enum_frameintervals(struct file *file, void *fh,if (!ctx->vdoa && f->pixel_format ==V4L2_PIX_FMT_YUYV )return -EINVAL ; -for (i =0 ; i <CODA_MAX_FORMATS ; i++) { -if (f->pixel_format == ctx->cvd->src_formats[i] || - f->pixel_format == ctx->cvd->dst_formats[i]) -break ; +if (coda_format_normalize_yuv (f->pixel_format) ==V4L2_PIX_FMT_YUV420 ) { + q_data =get_q_data (ctx,V4L2_BUF_TYPE_VIDEO_CAPTURE ); + codec =coda_find_codec (ctx->dev, f->pixel_format, + q_data->fourcc); + }else { + codec =coda_find_codec (ctx->dev,V4L2_PIX_FMT_YUV420 , + f->pixel_format); } -if (i ==CODA_MAX_FORMATS ) +if (!codec) +return -EINVAL ; + +if (f->width <MIN_W || f->width > codec->max_w || + f->height <MIN_H || f->height > codec->max_h)return -EINVAL ; f->type =V4L2_FRMIVAL_TYPE_CONTINUOUS ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 156/772 btrfs: fix anon_dev leak in create_subvol()
In reply to Greg Kroah-HartmanFrom: Omar Sandoval <[email protected]>
[ Upstream commit 2256e901f5bddc56e24089c96f27b77da932dfcc ]
When btrfs_qgroup_inherit(), btrfs_alloc_tree_block, or btrfs_insert_root() fail in create_subvol(), we return without freeing anon_dev. Reorganize the error handling in create_subvol() to fix this.
--- fs/btrfs/ioctl.c | 49 +++++++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 26 deletions(-)
fs/btrfs/ioctl.c +23 -26
@@ -544,7 +544,7 @@ static noinline int create_subvol(struct user_namespace *mnt_userns,struct timespec64 cur_time =current_time (dir);struct inode *inode;int ret; -dev_t anon_dev =0 ; +dev_t anon_dev;u64 objectid;u64 index =0 ;
@@ -554,11 +554,7 @@ static noinline int create_subvol(struct user_namespace *mnt_userns, ret =btrfs_get_free_objectid (fs_info->tree_root, &objectid);if (ret) - goto fail_free; - - ret =get_anon_bdev (&anon_dev); -if (ret <0 ) - goto fail_free; + goto out_root_item;/* * Don't create subvolume whose level is not zero. Or qgroup will be
@@ -566,9 +562,13 @@ static noinline int create_subvol(struct user_namespace *mnt_userns,*/ if (btrfs_qgroup_level (objectid)) { ret = -ENOSPC ; - goto fail_free; + goto out_root_item; } + ret =get_anon_bdev (&anon_dev); +if (ret <0 ) + goto out_root_item; +btrfs_init_block_rsv (&block_rsv,BTRFS_BLOCK_RSV_TEMP );/* * The same as the snapshot creation, please see the comment
@@ -576,26 +576,26 @@ static noinline int create_subvol(struct user_namespace *mnt_userns,*/ ret =btrfs_subvolume_reserve_metadata (root, &block_rsv,8 , false);if (ret) - goto fail_free; + goto out_anon_dev; trans =btrfs_start_transaction (root,0 );if (IS_ERR (trans)) { ret =PTR_ERR (trans);btrfs_subvolume_release_metadata (root, &block_rsv); - goto fail_free; + goto out_anon_dev; } trans->block_rsv = &block_rsv; trans->bytes_reserved = block_rsv.size; ret =btrfs_qgroup_inherit (trans,0 , objectid, inherit);if (ret) - goto fail; + goto out; leaf =btrfs_alloc_tree_block (trans, root,0 , objectid,NULL ,0 ,0 ,0 ,BTRFS_NESTING_NORMAL );if (IS_ERR (leaf)) { ret =PTR_ERR (leaf); - goto fail; + goto out; }btrfs_mark_buffer_dirty (leaf);
@@ -650,7 +650,7 @@ static noinline int create_subvol(struct user_namespace *mnt_userns,btrfs_tree_unlock (leaf);btrfs_free_tree_block (trans, objectid, leaf,0 ,1 );free_extent_buffer (leaf); - goto fail; + goto out; }free_extent_buffer (leaf);
@@ -659,19 +659,18 @@ static noinline int create_subvol(struct user_namespace *mnt_userns, key.offset = (u64)-1 ; new_root =btrfs_get_new_fs_root (fs_info, objectid, anon_dev);if (IS_ERR (new_root)) { -free_anon_bdev (anon_dev); ret =PTR_ERR (new_root);btrfs_abort_transaction (trans, ret); - goto fail; + goto out; } -/* Freeing will be done in btrfs_put_root() of new_root */ +/* anon_dev is owned by new_root now. */ anon_dev =0 ; ret =btrfs_record_root_in_trans (trans, new_root);if (ret) {btrfs_put_root (new_root);btrfs_abort_transaction (trans, ret); - goto fail; + goto out; } ret =btrfs_create_subvol_root (trans, new_root, root, mnt_userns);
@@ -679,7 +678,7 @@ static noinline int create_subvol(struct user_namespace *mnt_userns,if (ret) {/* We potentially lose an unused inode item here */ btrfs_abort_transaction (trans, ret); - goto fail; + goto out; }/*
@@ -688,28 +687,28 @@ static noinline int create_subvol(struct user_namespace *mnt_userns, ret =btrfs_set_inode_index (BTRFS_I (dir), &index);if (ret) {btrfs_abort_transaction (trans, ret); - goto fail; + goto out; } ret =btrfs_insert_dir_item (trans, name, namelen,BTRFS_I (dir), &key,BTRFS_FT_DIR , index);if (ret) {btrfs_abort_transaction (trans, ret); - goto fail; + goto out; }btrfs_i_size_write (BTRFS_I (dir), dir->i_size + namelen *2 ); ret =btrfs_update_inode (trans, root,BTRFS_I (dir));if (ret) {btrfs_abort_transaction (trans, ret); - goto fail; + goto out; } ret =btrfs_add_root_ref (trans, objectid, root->root_key.objectid,btrfs_ino (BTRFS_I (dir)), index, name, namelen);if (ret) {btrfs_abort_transaction (trans, ret); - goto fail; + goto out; } ret = btrfs_uuid_tree_add(trans, root_item->uuid,
@@ -717,8 +716,7 @@ static noinline int create_subvol(struct user_namespace *mnt_userns,if (ret)btrfs_abort_transaction (trans, ret); -fail: -kfree (root_item); +out: trans->block_rsv =NULL ; trans->bytes_reserved =0 ;btrfs_subvolume_release_metadata (root, &block_rsv);
@@ -734,11 +732,10 @@ static noinline int create_subvol(struct user_namespace *mnt_userns,return PTR_ERR (inode);d_instantiate (dentry, inode); } -return ret; - -fail_free: +out_anon_dev:if (anon_dev)free_anon_bdev (anon_dev); +out_root_item:kfree (root_item);return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 157/772 kunit: tool: make parser stop overwriting status of suites w/ no_tests
In reply to Greg Kroah-HartmanFrom: Daniel Latypov <[email protected]>
[ Upstream commit dbf0b0d53a2b5afa6ef7372dcedf52302669fc2c ]
Consider this invocation
$ ./tools/testing/kunit/kunit.py parse <<EOF
TAP version 14
1..2
ok 1 - suite
# Subtest: no_tests_suite
# catastrophic error!
not ok 1 - no_tests_suite
EOFIt will have a 0 exit code even though there's a "not ok".
Consider this one:
$ ./tools/testing/kunit/kunit.py parse <<EOF TAP version 14 1..2 ok 1 - suite not ok 1 - no_tests_suite EOF
It will a non-zero exit code.
Why?
We have this line in the kunit_parser.py
Quoted 1 line
parent_test=parse_test_header(lines, test)
where we have special handling when we see "# Subtest" and we ignore the explicit reported "not ok 1" status!
Also, NO_TESTS at a suite-level only results in a non-zero status code where then there's only one suite atm.
This change is the minimal one to make sure we don't overwrite it.
--- tools/testing/kunit/kunit_parser.py | 7 +++++-- .../test_data/test_is_test_passed-no_tests_no_plan.log | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-)
tools/testing/kunit/kunit_parser.py +5 -2
@@ -789,8 +789,11 @@ def parse_test(lines: LineStream, expected_num: int, log: List[str]) -> Test: # Check for there being no tests if parent_test and len(subtests) == 0: - test.status = TestStatus.NO_TESTS - test.add_error('0 tests run!') + # Don't override a bad status if this test had one reported. + # Assumption: no subtests means CRASHED is from Test.__init__() + if test.status in (TestStatus.TEST_CRASHED, TestStatus.SUCCESS): + test.status = TestStatus.NO_TESTS + test.add_error('0 tests run!') # Add statuses to TestCounts attribute in Test object bubble_up_test_results(test)
tools/testing/kunit/test_data/test_is_test_passed-no_tests_no_plan.log +1 -1
@@ -3,5 +3,5 @@ TAP version 14 # Subtest: suite 1..1 # Subtest: case - ok 1 - case # SKIP + ok 1 - case ok 1 - suite
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 155/772 drm/amd/pm: update smartshift powerboost calc for smu13
In reply to Greg Kroah-HartmanFrom: Sathishkumar S <[email protected]>
[ Upstream commit cdf4c8ec39872a61a58d62f19b4db80f0f7bc586 ]
smartshift apu and dgpu power boost are reported as percentage with respect to their power limits. adjust the units of power before calculating the percentage of boost.
--- .../drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c | 62 ++++++++++++++----- 1 file changed, 46 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +46 -16
@@ -296,6 +296,42 @@ static int yellow_carp_mode2_reset(struct smu_context *smu)return yellow_carp_mode_reset (smu,SMU_RESET_MODE_2 ); } + +static void yellow_carp_get_ss_power_percent (SmuMetrics_t *metrics, +uint32_t *apu_percent,uint32_t *dgpu_percent) +{ +uint32_t apu_boost =0 ; +uint32_t dgpu_boost =0 ; +uint16_t apu_limit =0 ; +uint16_t dgpu_limit =0 ; +uint16_t apu_power =0 ; +uint16_t dgpu_power =0 ; + +/* APU and dGPU power values are reported in milli Watts +* and STAPM power limits are in Watts */ + apu_power = metrics->ApuPower/1000 ; + apu_limit = metrics->StapmOpnLimit; +if (apu_power > apu_limit && apu_limit !=0 ) + apu_boost = ((apu_power - apu_limit) *100 ) / apu_limit; + apu_boost = (apu_boost >100 ) ?100 : apu_boost; + + dgpu_power = metrics->dGpuPower/1000 ; +if (metrics->StapmCurrentLimit > metrics->StapmOpnLimit) + dgpu_limit = metrics->StapmCurrentLimit - metrics->StapmOpnLimit; +if (dgpu_power > dgpu_limit && dgpu_limit !=0 ) + dgpu_boost = ((dgpu_power - dgpu_limit) *100 ) / dgpu_limit; + dgpu_boost = (dgpu_boost >100 ) ?100 : dgpu_boost; + +if (dgpu_boost >= apu_boost) + apu_boost =0 ; +else + dgpu_boost =0 ; + + *apu_percent = apu_boost; + *dgpu_percent = dgpu_boost; + +} +static int yellow_carp_get_smu_metrics_data (struct smu_context *smu,MetricsMember_t member,uint32_t *value)
@@ -304,6 +340,8 @@ static int yellow_carp_get_smu_metrics_data(struct smu_context *smu,SmuMetrics_t *metrics = (SmuMetrics_t *)smu_table->metrics_table;int ret =0 ; +uint32_t apu_percent =0 ; +uint32_t dgpu_percent =0 ;mutex_lock (&smu->metrics_lock);
@@ -356,26 +394,18 @@ static int yellow_carp_get_smu_metrics_data(struct smu_context *smu, *value = metrics->Voltage[1 ];break ;case METRICS_SS_APU_SHARE : -/* return the percentage of APU power with respect to APU's power limit. -* percentage is reported, this isn't boost value. Smartshift power -* boost/shift is only when the percentage is more than 100. +/* return the percentage of APU power boost +* with respect to APU's power limit. */ -if (metrics->StapmOpnLimit >0 ) - *value = (metrics->ApuPower *100 ) / metrics->StapmOpnLimit; -else - *value =0 ; +yellow_carp_get_ss_power_percent (metrics, &apu_percent, &dgpu_percent); + *value = apu_percent;break ;case METRICS_SS_DGPU_SHARE : -/* return the percentage of dGPU power with respect to dGPU's power limit. -* percentage is reported, this isn't boost value. Smartshift power -* boost/shift is only when the percentage is more than 100. +/* return the percentage of dGPU power boost +* with respect to dGPU's power limit. */ -if ((metrics->dGpuPower >0 ) && - (metrics->StapmCurrentLimit > metrics->StapmOpnLimit)) - *value = (metrics->dGpuPower *100 ) / - (metrics->StapmCurrentLimit - metrics->StapmOpnLimit); -else - *value =0 ; +yellow_carp_get_ss_power_percent (metrics, &apu_percent, &dgpu_percent); + *value = dgpu_percent;break ;default : *value =UINT_MAX ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 154/772 drm/amd/pm: update smartshift powerboost calc for smu12
In reply to Greg Kroah-HartmanFrom: Sathishkumar S <[email protected]>
[ Upstream commit 138292f1dc00e7e0724f44769f9da39cf2f3bf0b ]
smartshift apu and dgpu power boost are reported as percentage with respect to their power limits. This value[0-100] reflects the boost for the respective device.
--- .../gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c | 60 ++++++++++++++----- 1 file changed, 44 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c +44 -16
@@ -1119,6 +1119,39 @@ static int renoir_get_power_profile_mode(struct smu_context *smu,return size; } +static void renoir_get_ss_power_percent (SmuMetrics_t *metrics, +uint32_t *apu_percent,uint32_t *dgpu_percent) +{ +uint32_t apu_boost =0 ; +uint32_t dgpu_boost =0 ; +uint16_t apu_limit =0 ; +uint16_t dgpu_limit =0 ; +uint16_t apu_power =0 ; +uint16_t dgpu_power =0 ; + + apu_power = metrics->ApuPower; + apu_limit = metrics->StapmOriginalLimit; +if (apu_power > apu_limit && apu_limit !=0 ) + apu_boost = ((apu_power - apu_limit) *100 ) / apu_limit; + apu_boost = (apu_boost >100 ) ?100 : apu_boost; + + dgpu_power = metrics->dGpuPower; +if (metrics->StapmCurrentLimit > metrics->StapmOriginalLimit) + dgpu_limit = metrics->StapmCurrentLimit - metrics->StapmOriginalLimit; +if (dgpu_power > dgpu_limit && dgpu_limit !=0 ) + dgpu_boost = ((dgpu_power - dgpu_limit) *100 ) / dgpu_limit; + dgpu_boost = (dgpu_boost >100 ) ?100 : dgpu_boost; + +if (dgpu_boost >= apu_boost) + apu_boost =0 ; +else + dgpu_boost =0 ; + + *apu_percent = apu_boost; + *dgpu_percent = dgpu_boost; +} + +static int renoir_get_smu_metrics_data (struct smu_context *smu,MetricsMember_t member,uint32_t *value)
@@ -1127,6 +1160,9 @@ static int renoir_get_smu_metrics_data(struct smu_context *smu,SmuMetrics_t *metrics = (SmuMetrics_t *)smu_table->metrics_table;int ret =0 ; +uint32_t apu_percent =0 ; +uint32_t dgpu_percent =0 ; +mutex_lock (&smu->metrics_lock);
@@ -1175,26 +1211,18 @@ static int renoir_get_smu_metrics_data(struct smu_context *smu, *value = metrics->Voltage[1 ];break ;case METRICS_SS_APU_SHARE : -/* return the percentage of APU power with respect to APU's power limit. -* percentage is reported, this isn't boost value. Smartshift power -* boost/shift is only when the percentage is more than 100. +/* return the percentage of APU power boost +* with respect to APU's power limit. */ -if (metrics->StapmOriginalLimit >0 ) - *value = (metrics->ApuPower *100 ) / metrics->StapmOriginalLimit; -else - *value =0 ; +renoir_get_ss_power_percent (metrics, &apu_percent, &dgpu_percent); + *value = apu_percent;break ;case METRICS_SS_DGPU_SHARE : -/* return the percentage of dGPU power with respect to dGPU's power limit. -* percentage is reported, this isn't boost value. Smartshift power -* boost/shift is only when the percentage is more than 100. +/* return the percentage of dGPU power boost +* with respect to dGPU's power limit. */ -if ((metrics->dGpuPower >0 ) && - (metrics->StapmCurrentLimit > metrics->StapmOriginalLimit)) - *value = (metrics->dGpuPower *100 ) / - (metrics->StapmCurrentLimit - metrics->StapmOriginalLimit); -else - *value =0 ; +renoir_get_ss_power_percent (metrics, &apu_percent, &dgpu_percent); + *value = dgpu_percent;break ;default : *value =UINT_MAX ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 134/772 ipmi: Add an intializer for ipmi_smi_msg struct
In reply to Greg Kroah-HartmanFrom: Corey Minyard <[email protected]>
[ Upstream commit 9824117dd964ecebf5d81990dbf21dfb56445049 ]
There was a "type" element added to this structure, but some static values were missed. The default value will be zero, which is correct, but create an initializer for the type and initialize the type properly in the initializer to avoid future issues.
--- drivers/char/ipmi/ipmi_poweroff.c | 4 +--- drivers/char/ipmi/ipmi_watchdog.c | 14 +++++--------- include/linux/ipmi_smi.h | 6 ++++++ 3 files changed, 12 insertions(+), 12 deletions(-)
drivers/char/ipmi/ipmi_poweroff.c +1 -3
@@ -94,9 +94,7 @@ static void dummy_recv_free(struct ipmi_recv_msg *msg) {atomic_dec (&dummy_count); } -static struct ipmi_smi_msg halt_smi_msg = { - .done = dummy_smi_free -}; +static struct ipmi_smi_msg halt_smi_msg =INIT_IPMI_SMI_MSG (dummy_smi_free);static struct ipmi_recv_msg halt_recv_msg = { .done = dummy_recv_free };
drivers/char/ipmi/ipmi_watchdog.c +5 -9
@@ -354,9 +354,7 @@ static void msg_free_recv(struct ipmi_recv_msg *msg)complete (&msg_wait); } } -static struct ipmi_smi_msg smi_msg = { - .done = msg_free_smi -}; +static struct ipmi_smi_msg smi_msg =INIT_IPMI_SMI_MSG (msg_free_smi);static struct ipmi_recv_msg recv_msg = { .done = msg_free_recv };
@@ -475,9 +473,8 @@ static void panic_recv_free(struct ipmi_recv_msg *msg)atomic_dec (&panic_done_count); } -static struct ipmi_smi_msg panic_halt_heartbeat_smi_msg = { - .done = panic_smi_free -}; +static struct ipmi_smi_msg panic_halt_heartbeat_smi_msg = +INIT_IPMI_SMI_MSG (panic_smi_free);static struct ipmi_recv_msg panic_halt_heartbeat_recv_msg = { .done = panic_recv_free };
@@ -516,9 +513,8 @@ static void panic_halt_ipmi_heartbeat(void)atomic_sub (2 , &panic_done_count); } -static struct ipmi_smi_msg panic_halt_smi_msg = { - .done = panic_smi_free -}; +static struct ipmi_smi_msg panic_halt_smi_msg = +INIT_IPMI_SMI_MSG (panic_smi_free);static struct ipmi_recv_msg panic_halt_recv_msg = { .done = panic_recv_free };
include/linux/ipmi_smi.h +6 -0
@@ -125,6 +125,12 @@ struct ipmi_smi_msg {void (*done)(struct ipmi_smi_msg *msg); }; +#define INIT_IPMI_SMI_MSG (done_handler) \ +{ \ + .done = done_handler, \ + .type = IPMI_SMI_MSG_TYPE_NORMAL \ +} +struct ipmi_smi_handlers {struct module *owner;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 132/772 ACPI: PM: Block ASUS B1400CEAE from suspend to idle by default
In reply to Greg Kroah-HartmanFrom: Mario Limonciello <[email protected]>
[ Upstream commit d52848620de00cde4a3a5df908e231b8c8868250 ]
ASUS B1400CEAE fails to resume from suspend to idle by default. This was bisected back to commit df4f9bc4fb9c ("nvme-pci: add support for ACPI StorageD3Enable property") but this is a red herring to the problem.
Before this commit the system wasn't getting into deepest sleep state. Presumably this commit is allowing entry into deepest sleep state as advertised by firmware, but there are some other problems related to the wakeup.
As it is confirmed the system works properly with S3, set the default for this system to S3.
--- drivers/acpi/sleep.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/acpi/sleep.c +12 -0
@@ -373,6 +373,18 @@ static const struct dmi_system_id acpisleep_dmi_table[] __initconst = { DMI_MATCH(DMI_PRODUCT_NAME, "20GGA00L00"), }, }, +/* +* ASUS B1400CEAE hangs on resume from suspend (see +* https://bugzilla.kernel.org/show_bug.cgi?id=215742). +*/ + { + .callback = init_default_s3, + .ident = "ASUS B1400CEAE", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "ASUS EXPERTBOOK B1400CEAE"), + }, + }, {}, };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 130/772 dma-debug: change allocation mode from GFP_NOWAIT to GFP_ATIOMIC
In reply to Greg Kroah-HartmanFrom: Mikulas Patocka <[email protected]>
[ Upstream commit 84bc4f1dbbbb5f8aa68706a96711dccb28b518e5 ]
We observed the error "cacheline tracking ENOMEM, dma-debug disabled" during a light system load (copying some files). The reason for this error is that the dma_active_cacheline radix tree uses GFP_NOWAIT allocation - so it can't access the emergency memory reserves and it fails as soon as anybody reaches the watermark.
This patch changes GFP_NOWAIT to GFP_ATOMIC, so that it can access the emergency memory reserves.
--- kernel/dma/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/dma/debug.c +1 -1
@@ -448,7 +448,7 @@ void debug_dma_dump_mappings(struct device *dev)* other hand, consumes a single dma_debug_entry, but inserts 'nents' * entries into the tree. */ -static RADIX_TREE(dma_active_cacheline, GFP_NOWAIT); +static RADIX_TREE(dma_active_cacheline, GFP_ATOMIC);static DEFINE_SPINLOCK (radix_lock);#define ACTIVE_CACHELINE_MAX_OVERLAP ((1 << RADIX_TREE_MAX_TAGS) - 1)#define CACHELINE_PER_PAGE_SHIFT (PAGE_SHIFT - L1_CACHE_SHIFT)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 131/772 ASoC: SOF: amd: add missing platform_device_unregister in acp_pci_rn_probe
In reply to Greg Kroah-HartmanFrom: Zheng Bin <[email protected]>
[ Upstream commit cbcab8cd737c74c20195c31d647e19f7cb49c9b8 ]
acp_pci_rn_probe misses a call platform_device_unregister in error path, this patch fixes that.
--- sound/soc/sof/amd/pci-rn.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/sof/amd/pci-rn.c +1 -0
@@ -93,6 +93,7 @@ static int acp_pci_rn_probe(struct pci_dev *pci, const struct pci_device_id *pci res =devm_kzalloc (&pci->dev,sizeof (struct resource ) *ARRAY_SIZE (renoir_res),GFP_KERNEL );if (!res) {sof_pci_remove (pci); +platform_device_unregister (dmic_dev);return -ENOMEM ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 76/772 spi: spi-rspi: Remove setting {src,dst}_{addr,addr_width} based on DMA direction
In reply to Greg Kroah-HartmanFrom: Biju Das <[email protected]>
[ Upstream commit 6f381481a5b236cb53d6de2c49c6ef83a4d0f432 ]
The direction field in the DMA config is deprecated. The rspi driver sets {src,dst}_{addr,addr_width} based on the DMA direction and it results in dmaengine_slave_config() failure as RZ DMAC driver validates {src,dst}_addr_width values independent of DMA direction.
This patch fixes the issue by passing both {src,dst}_{addr,addr_width} values independent of DMA direction.
--- drivers/spi/spi-rspi.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/spi/spi-rspi.c +6 -9
@@ -1108,14 +1108,11 @@ static struct dma_chan *rspi_request_dma_chan(struct device *dev, }memset (&cfg,0 ,sizeof (cfg)); + cfg.dst_addr = port_addr +RSPI_SPDR ; + cfg.src_addr = port_addr +RSPI_SPDR ; + cfg.dst_addr_width =DMA_SLAVE_BUSWIDTH_1_BYTE ; + cfg.src_addr_width =DMA_SLAVE_BUSWIDTH_1_BYTE ; cfg.direction = dir; -if (dir ==DMA_MEM_TO_DEV ) { - cfg.dst_addr = port_addr; - cfg.dst_addr_width =DMA_SLAVE_BUSWIDTH_1_BYTE ; - }else { - cfg.src_addr = port_addr; - cfg.src_addr_width =DMA_SLAVE_BUSWIDTH_1_BYTE ; - } ret =dmaengine_slave_config (chan, &cfg);if (ret) {
@@ -1146,12 +1143,12 @@ static int rspi_request_dma(struct device *dev, struct spi_controller *ctlr, } ctlr->dma_tx =rspi_request_dma_chan (dev,DMA_MEM_TO_DEV , dma_tx_id, - res->start +RSPI_SPDR ); + res->start);if (!ctlr->dma_tx)return -ENODEV ; ctlr->dma_rx =rspi_request_dma_chan (dev,DMA_DEV_TO_MEM , dma_rx_id, - res->start +RSPI_SPDR ); + res->start);if (!ctlr->dma_rx) {dma_release_channel (ctlr->dma_tx); ctlr->dma_tx =NULL ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 158/772 net: phy: micrel: Allow probing without .driver_data
In reply to Greg Kroah-HartmanFrom: Fabio Estevam <[email protected]>
[ Upstream commit f2ef6f7539c68c6bd6c32323d8845ee102b7c450 ]
Currently, if the .probe element is present in the phy_driver structure and the .driver_data is not, a NULL pointer dereference happens.
Allow passing .probe without .driver_data by inserting NULL checks for priv->type.
--- drivers/net/phy/micrel.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/phy/micrel.c +6 -5
@@ -348,7 +348,7 @@ static int kszphy_config_reset(struct phy_device *phydev) } } -if (priv->led_mode >=0 ) +if (priv->type && priv->led_mode >=0 )kszphy_setup_led (phydev, priv->type->led_mode_reg, priv->led_mode);return 0 ;
@@ -364,10 +364,10 @@ static int kszphy_config_init(struct phy_device *phydev) type = priv->type; -if (type->has_broadcast_disable) +if (type && type->has_broadcast_disable)kszphy_broadcast_disable (phydev); -if (type->has_nand_tree_disable) +if (type && type->has_nand_tree_disable)kszphy_nand_tree_disable (phydev);return kszphy_config_reset (phydev);
@@ -1365,7 +1365,7 @@ static int kszphy_probe(struct phy_device *phydev) priv->type = type; -if (type->led_mode_reg) { +if (type && type->led_mode_reg) { ret =of_property_read_u32 (np,"micrel,led-mode" , &priv->led_mode);if (ret)
@@ -1386,7 +1386,8 @@ static int kszphy_probe(struct phy_device *phydev)unsigned long rate =clk_get_rate (clk);bool rmii_ref_clk_sel_25_mhz; - priv->rmii_ref_clk_sel = type->has_rmii_ref_clk_sel; +if (type) + priv->rmii_ref_clk_sel = type->has_rmii_ref_clk_sel; rmii_ref_clk_sel_25_mhz =of_property_read_bool (np,"micrel,rmii-reference-clock-select-25-mhz" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 160/772 media: hantro: Stop using H.264 parameter pic_num
In reply to Greg Kroah-HartmanFrom: Nicolas Dufresne <[email protected]>
[ Upstream commit 831410700909f4e29d5af1ef26b8c59fc2d1988e ]
The hardware expects FrameNumWrap or long_term_frame_idx. Picture numbers are per field, and are mostly used during the memory management process, which is done in userland. This fixes two ITU conformance tests:
- MR6_BT_B
- MR8_BT_B
--- drivers/staging/media/hantro/hantro_h264.c | 2 -- 1 file changed, 2 deletions(-)
drivers/staging/media/hantro/hantro_h264.c +0 -2
@@ -354,8 +354,6 @@ u16 hantro_h264_get_ref_nbr(struct hantro_ctx *ctx, unsigned int dpb_idx)if (!(dpb->flags &V4L2_H264_DPB_ENTRY_FLAG_ACTIVE ))return 0 ; -if (dpb->flags &V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM ) -return dpb->pic_num;return dpb->frame_num; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 159/772 media: exynos4-is: Fix compile warning
In reply to Greg Kroah-HartmanFrom: Kwanghoon Son <[email protected]>
[ Upstream commit e080f5c1f2b6d02c02ee5d674e0e392ccf63bbaf ]
Declare static on function 'fimc_isp_video_device_unregister'.
When VIDEO_EXYNOS4_ISP_DMA_CAPTURE=n, compiler warns about
warning: no previous prototype for function [-Wmissing-prototypes]
--- drivers/media/platform/exynos4-is/fimc-isp-video.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/exynos4-is/fimc-isp-video.h +1 -1
@@ -32,7 +32,7 @@ static inline int fimc_isp_video_device_register(struct fimc_isp *isp,return 0 ; } -void fimc_isp_video_device_unregister (struct fimc_isp *isp, +static inline void fimc_isp_video_device_unregister (struct fimc_isp *isp,enum v4l2_buf_type type) { }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 124/772 scsi: lpfc: Alter FPIN stat accounting logic
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
[ Upstream commit e6f51041450282a8668af3a8fc5c7744e81a447c ]
When configuring CMF management based on signals instead of FPINs, FPIN alarm and warning statistics are not tracked.
Change the behavior so that FPIN alarms and warnings are always tracked regardless of the configured mode.
Similar changes are made in the CMF signal stat accounting logic. Upon receipt of a signal, only track signaled alarms and warnings. FPIN stats should not be incremented upon receipt of a signal.
--- drivers/scsi/lpfc/lpfc_els.c | 49 +++++++++++------------------------ drivers/scsi/lpfc/lpfc_init.c | 22 ++-------------- 2 files changed, 17 insertions(+), 54 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +15 -34
@@ -3784,9 +3784,6 @@ lpfc_least_capable_settings(struct lpfc_hba *phba, {u32 rsp_sig_cap =0 , drv_sig_cap =0 ;u32 rsp_sig_freq_cyc =0 , rsp_sig_freq_scale =0 ; -struct lpfc_cgn_info *cp; -u32 crc; -u16 sig_freq;/* Get rsp signal and frequency capabilities. */ rsp_sig_cap =be32_to_cpu (pcgd->xmt_signal_capability);
@@ -3842,25 +3839,7 @@ lpfc_least_capable_settings(struct lpfc_hba *phba, } } -if (!phba->cgn_i) -return ; - -/* Update signal frequency in congestion info buffer */ - cp = (struct lpfc_cgn_info *)phba->cgn_i->virt; - -/* Frequency (in ms) Signal Warning/Signal Congestion Notifications -* are received by the HBA -*/ - sig_freq = phba->cgn_sig_freq; - -if (phba->cgn_reg_signal ==EDC_CG_SIG_WARN_ONLY ) - cp->cgn_warn_freq =cpu_to_le16 (sig_freq); -if (phba->cgn_reg_signal ==EDC_CG_SIG_WARN_ALARM ) { - cp->cgn_alarm_freq =cpu_to_le16 (sig_freq); - cp->cgn_warn_freq =cpu_to_le16 (sig_freq); - } - crc =lpfc_cgn_calc_crc32 (cp,LPFC_CGN_INFO_SZ ,LPFC_CGN_CRC32_SEED ); - cp->cgn_info_crc =cpu_to_le32 (crc); +/* We are NOT recording signal frequency in congestion info buffer */ return ; out_no_support:
@@ -9606,11 +9585,14 @@ lpfc_els_rcv_fpin_cgn(struct lpfc_hba *phba, struct fc_tlv_desc *tlv)/* Take action here for an Alarm event */ if (phba->cmf_active_mode !=LPFC_CFG_OFF ) {if (phba->cgn_reg_fpin &LPFC_CGN_FPIN_ALARM ) { -/* Track of alarm cnt for cgn_info */ -atomic_inc (&phba->cgn_fabric_alarm_cnt);/* Track of alarm cnt for SYNC_WQE */ atomic_inc (&phba->cgn_sync_alarm_cnt); } +/* Track alarm cnt for cgn_info regardless +* of whether CMF is configured for Signals +* or FPINs. +*/ +atomic_inc (&phba->cgn_fabric_alarm_cnt); goto cleanup; }break ;
@@ -9618,11 +9600,14 @@ lpfc_els_rcv_fpin_cgn(struct lpfc_hba *phba, struct fc_tlv_desc *tlv)/* Take action here for a Warning event */ if (phba->cmf_active_mode !=LPFC_CFG_OFF ) {if (phba->cgn_reg_fpin &LPFC_CGN_FPIN_WARN ) { -/* Track of warning cnt for cgn_info */ -atomic_inc (&phba->cgn_fabric_warn_cnt);/* Track of warning cnt for SYNC_WQE */ atomic_inc (&phba->cgn_sync_warn_cnt); } +/* Track warning cnt and freq for cgn_info +* regardless of whether CMF is configured for +* Signals or FPINs. +*/ +atomic_inc (&phba->cgn_fabric_warn_cnt); cleanup:/* Save frequency in ms */ phba->cgn_fpin_frequency =
@@ -9631,14 +9616,10 @@ lpfc_els_rcv_fpin_cgn(struct lpfc_hba *phba, struct fc_tlv_desc *tlv)if (phba->cgn_i) { cp = (struct lpfc_cgn_info *) phba->cgn_i->virt; -if (phba->cgn_reg_fpin & -LPFC_CGN_FPIN_ALARM ) - cp->cgn_alarm_freq = -cpu_to_le16 (value); -if (phba->cgn_reg_fpin & -LPFC_CGN_FPIN_WARN ) - cp->cgn_warn_freq = -cpu_to_le16 (value); + cp->cgn_alarm_freq = +cpu_to_le16 (value); + cp->cgn_warn_freq = +cpu_to_le16 (value); crc = lpfc_cgn_calc_crc32 (cp, LPFC_CGN_INFO_SZ,
drivers/scsi/lpfc/lpfc_init.c +2 -20
@@ -5877,21 +5877,8 @@ lpfc_cgn_save_evt_cnt(struct lpfc_hba *phba)/* Use the frequency found in the last rcv'ed FPIN */ value = phba->cgn_fpin_frequency; -if (phba->cgn_reg_fpin &LPFC_CGN_FPIN_WARN ) - cp->cgn_warn_freq =cpu_to_le16 (value); -if (phba->cgn_reg_fpin &LPFC_CGN_FPIN_ALARM ) - cp->cgn_alarm_freq =cpu_to_le16 (value); - -/* Frequency (in ms) Signal Warning/Signal Congestion Notifications -* are received by the HBA -*/ - value = phba->cgn_sig_freq; - -if (phba->cgn_reg_signal ==EDC_CG_SIG_WARN_ONLY || - phba->cgn_reg_signal ==EDC_CG_SIG_WARN_ALARM ) - cp->cgn_warn_freq =cpu_to_le16 (value); -if (phba->cgn_reg_signal ==EDC_CG_SIG_WARN_ALARM ) - cp->cgn_alarm_freq =cpu_to_le16 (value); + cp->cgn_warn_freq =cpu_to_le16 (value); + cp->cgn_alarm_freq =cpu_to_le16 (value); lvalue =lpfc_cgn_calc_crc32 (cp,LPFC_CGN_INFO_SZ ,LPFC_CGN_CRC32_SEED );
@@ -6606,9 +6593,6 @@ lpfc_sli4_async_sli_evt(struct lpfc_hba *phba, struct lpfc_acqe_sli *acqe_sli)/* Alarm overrides warning, so check that first */ if (cgn_signal->alarm_cnt) {if (phba->cgn_reg_signal ==EDC_CG_SIG_WARN_ALARM ) { -/* Keep track of alarm cnt for cgn_info */ -atomic_add (cgn_signal->alarm_cnt, - &phba->cgn_fabric_alarm_cnt);/* Keep track of alarm cnt for CMF_SYNC_WQE */ atomic_add (cgn_signal->alarm_cnt, &phba->cgn_sync_alarm_cnt);
@@ -6617,8 +6601,6 @@ lpfc_sli4_async_sli_evt(struct lpfc_hba *phba, struct lpfc_acqe_sli *acqe_sli)/* signal action needs to be taken */ if (phba->cgn_reg_signal ==EDC_CG_SIG_WARN_ONLY || phba->cgn_reg_signal ==EDC_CG_SIG_WARN_ALARM ) { -/* Keep track of warning cnt for cgn_info */ -atomic_add (cnt, &phba->cgn_fabric_warn_cnt);/* Keep track of warning cnt for CMF_SYNC_WQE */ atomic_add (cnt, &phba->cgn_sync_warn_cnt); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 82/772 cpuidle: PSCI: Improve support for suspend-to-RAM for PSCI OSI mode
In reply to Greg Kroah-HartmanFrom: Ulf Hansson <[email protected]>
[ Upstream commit 171b66e2e2e9d80b93c8cff799e6175074b22297 ]
When PSCI OSI mode is supported the syscore flag is set for the CPU devices that becomes attached to their PM domains (genpds). In the suspend-to-idle case, we call dev_pm_genpd_suspend|resume() to allow genpd to properly manage the power-off/on operations (pick an idlestate and manage the on/off notifications).
For suspend-to-ram, dev_pm_genpd_suspend|resume() is currently not being called, which causes a problem that the genpd on/off notifiers do not get sent as expected. This prevents the platform-specific operations from being executed, typically needed just before/after the boot CPU is being turned off/on.
To deal with this problem, let's register a syscore ops for cpuidle-psci when PSCI OSI mode is being used and call dev_pm_genpd_suspend|resume() from them. In this way, genpd regains control of the PM domain topology and then sends the on/off notifications when it's appropriate.
--- drivers/cpuidle/cpuidle-psci.c | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)
drivers/cpuidle/cpuidle-psci.c +46 -0
@@ -23,6 +23,7 @@#include <linux/pm_runtime.h> #include <linux/slab.h> #include <linux/string.h> +#include <linux/syscore_ops.h> #include <asm/cpuidle.h>
@@ -131,6 +132,49 @@ static int psci_idle_cpuhp_down(unsigned int cpu)return 0 ; } +static void psci_idle_syscore_switch (bool suspend) +{ +bool cleared = false; +struct device *dev; +int cpu; + +for_each_possible_cpu (cpu) { + dev =per_cpu_ptr (&psci_cpuidle_data, cpu)->dev; + +if (dev && suspend) { +dev_pm_genpd_suspend (dev); + }else if (dev) { +dev_pm_genpd_resume (dev); + +/* Account for userspace having offlined a CPU. */ +if (pm_runtime_status_suspended (dev)) +pm_runtime_set_active (dev); + +/* Clear domain state to re-start fresh. */ +if (!cleared) { +psci_set_domain_state (0 ); + cleared = true; + } + } + } +} + +static int psci_idle_syscore_suspend (void ) +{ +psci_idle_syscore_switch (true); +return 0 ; +} + +static void psci_idle_syscore_resume (void ) +{ +psci_idle_syscore_switch (false); +} + +static struct syscore_ops psci_idle_syscore_ops = { + .suspend = psci_idle_syscore_suspend, + .resume = psci_idle_syscore_resume, +}; +static void psci_idle_init_cpuhp (void ) {int err;
@@ -138,6 +182,8 @@ static void psci_idle_init_cpuhp(void)if (!psci_cpuidle_use_cpuhp)return ; +register_syscore_ops (&psci_idle_syscore_ops); + err = cpuhp_setup_state_nocalls(CPUHP_AP_CPU_PM_STARTING, "cpuidle/psci:online", psci_idle_cpuhp_up,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 118/772 HID: bigben: fix slab-out-of-bounds Write in bigben_probe
In reply to Greg Kroah-HartmanFrom: Dongliang Mu <[email protected]>
[ Upstream commit fc4ef9d5724973193bfa5ebed181dba6de3a56db ]
There is a slab-out-of-bounds Write bug in hid-bigbenff driver. The problem is the driver assumes the device must have an input but some malicious devices violate this assumption.
Fix this by checking hid_device's input is non-empty before its usage.
--- drivers/hid/hid-bigbenff.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/hid/hid-bigbenff.c +6 -0
@@ -347,6 +347,12 @@ static int bigben_probe(struct hid_device *hid, bigben->report =list_entry (report_list->next, struct hid_report, list); +if (list_empty (&hid->inputs)) { +hid_err (hid,"no inputs found\n" ); + error = -ENODEV ; + goto error_hw_stop; + } + hidinput = list_first_entry(&hid->inputs, struct hid_input, list);set_bit (FF_RUMBLE , hidinput->input->ffbit);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 115/772 drm/amdgpu/psp: move PSP memory alloc from hw_init to sw_init
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
[ Upstream commit b95b5391684b39695887afb4a13cccee7820f5d6 ]
Memory allocations should be done in sw_init. hw_init should just be hardware programming needed to initialize the IP block. This is how most other IP blocks work. Move the GPU memory allocations from psp hw_init to psp sw_init and move the memory free to sw_fini. This also fixes a potential GPU memory leak if psp hw_init fails.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 95 ++++++++++++------------- 1 file changed, 47 insertions(+), 48 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +47 -48
@@ -331,7 +331,39 @@ static int psp_sw_init(void *handle) } } + ret =amdgpu_bo_create_kernel (adev,PSP_1_MEG ,PSP_1_MEG , +amdgpu_sriov_vf (adev) ? +AMDGPU_GEM_DOMAIN_VRAM :AMDGPU_GEM_DOMAIN_GTT , + &psp->fw_pri_bo, + &psp->fw_pri_mc_addr, + &psp->fw_pri_buf); +if (ret) +return ret; + + ret =amdgpu_bo_create_kernel (adev,PSP_FENCE_BUFFER_SIZE ,PAGE_SIZE , +AMDGPU_GEM_DOMAIN_VRAM , + &psp->fence_buf_bo, + &psp->fence_buf_mc_addr, + &psp->fence_buf); +if (ret) + goto failed1; + + ret =amdgpu_bo_create_kernel (adev,PSP_CMD_BUFFER_SIZE ,PAGE_SIZE , +AMDGPU_GEM_DOMAIN_VRAM , + &psp->cmd_buf_bo, &psp->cmd_buf_mc_addr, + (void **)&psp->cmd_buf_mem); +if (ret) + goto failed2; +return 0 ; + +failed2: +amdgpu_bo_free_kernel (&psp->fw_pri_bo, + &psp->fw_pri_mc_addr, &psp->fw_pri_buf); +failed1: +amdgpu_bo_free_kernel (&psp->fence_buf_bo, + &psp->fence_buf_mc_addr, &psp->fence_buf); +return ret; }static int psp_sw_fini (void *handle)
@@ -361,6 +393,13 @@ static int psp_sw_fini(void *handle)kfree (cmd); cmd =NULL ; +amdgpu_bo_free_kernel (&psp->fw_pri_bo, + &psp->fw_pri_mc_addr, &psp->fw_pri_buf); +amdgpu_bo_free_kernel (&psp->fence_buf_bo, + &psp->fence_buf_mc_addr, &psp->fence_buf); +amdgpu_bo_free_kernel (&psp->cmd_buf_bo, &psp->cmd_buf_mc_addr, + (void **)&psp->cmd_buf_mem); +return 0 ; }
@@ -2391,51 +2430,18 @@ static int psp_load_fw(struct amdgpu_device *adev)struct psp_context *psp = &adev->psp;if (amdgpu_sriov_vf (adev) &&amdgpu_in_reset (adev)) { -psp_ring_stop (psp,PSP_RING_TYPE__KM );/* should not destroy ring, only stop */ - goto skip_memalloc; - } - -if (amdgpu_sriov_vf (adev)) { - ret =amdgpu_bo_create_kernel (adev,PSP_1_MEG ,PSP_1_MEG , -AMDGPU_GEM_DOMAIN_VRAM , - &psp->fw_pri_bo, - &psp->fw_pri_mc_addr, - &psp->fw_pri_buf); +/* should not destroy ring, only stop */ +psp_ring_stop (psp,PSP_RING_TYPE__KM ); }else { - ret =amdgpu_bo_create_kernel (adev,PSP_1_MEG ,PSP_1_MEG , -AMDGPU_GEM_DOMAIN_GTT , - &psp->fw_pri_bo, - &psp->fw_pri_mc_addr, - &psp->fw_pri_buf); - } - -if (ret) - goto failed; - - ret =amdgpu_bo_create_kernel (adev,PSP_FENCE_BUFFER_SIZE ,PAGE_SIZE , -AMDGPU_GEM_DOMAIN_VRAM , - &psp->fence_buf_bo, - &psp->fence_buf_mc_addr, - &psp->fence_buf); -if (ret) - goto failed; - - ret =amdgpu_bo_create_kernel (adev,PSP_CMD_BUFFER_SIZE ,PAGE_SIZE , -AMDGPU_GEM_DOMAIN_VRAM , - &psp->cmd_buf_bo, &psp->cmd_buf_mc_addr, - (void **)&psp->cmd_buf_mem); -if (ret) - goto failed; +memset (psp->fence_buf,0 ,PSP_FENCE_BUFFER_SIZE ); -memset (psp->fence_buf,0 ,PSP_FENCE_BUFFER_SIZE ); - - ret =psp_ring_init (psp,PSP_RING_TYPE__KM ); -if (ret) { -DRM_ERROR ("PSP ring init failed!\n" ); - goto failed; + ret =psp_ring_init (psp,PSP_RING_TYPE__KM ); +if (ret) { +DRM_ERROR ("PSP ring init failed!\n" ); + goto failed; + } } -skip_memalloc: ret =psp_hw_start (psp);if (ret) goto failed;
@@ -2553,13 +2559,6 @@ static int psp_hw_fini(void *handle)psp_tmr_terminate (psp);psp_ring_destroy (psp,PSP_RING_TYPE__KM ); -amdgpu_bo_free_kernel (&psp->fw_pri_bo, - &psp->fw_pri_mc_addr, &psp->fw_pri_buf); -amdgpu_bo_free_kernel (&psp->fence_buf_bo, - &psp->fence_buf_mc_addr, &psp->fence_buf); -amdgpu_bo_free_kernel (&psp->cmd_buf_bo, &psp->cmd_buf_mc_addr, - (void **)&psp->cmd_buf_mem); -return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 113/772 mlxsw: spectrum_dcb: Do not warn about priority changes
In reply to Greg Kroah-HartmanFrom: Petr Machata <[email protected]>
[ Upstream commit b6b584562cbe7dc357083459d6dd5b171e12cadb ]
The idea behind the warnings is that the user would get warned in case when more than one priority is configured for a given DSCP value on a netdevice.
The warning is currently wrong, because dcb_ieee_getapp_mask() returns the first matching entry, not all of them, and the warning will then claim that some priority is "current", when in fact it is not.
But more importantly, the warning is misleading in general. Consider the following commands:
# dcb app flush dev swp19 dscp-prio # dcb app add dev swp19 dscp-prio 24:3 # dcb app replace dev swp19 dscp-prio 24:2
The last command will issue the following warning:
mlxsw_spectrum3 0000:07:00.0 swp19: Ignoring new priority 2 for DSCP 24 in favor of current value of 3
The reason is that the "replace" command works by first adding the new value, and then removing all old values. This is the only way to make the replacement without causing the traffic to be prioritized to whatever the chip defaults to. The warning is issued in response to adding the new priority, and then no warning is shown when the old priority is removed. The upshot is that the canonical way to change traffic prioritization always produces a warning about ignoring the new priority, but what gets configured is in fact what the user intended.
An option to just emit warning every time that the prioritization changes just to make it clear that it happened is obviously unsatisfactory.
Therefore, in this patch, remove the warnings.
--- drivers/net/ethernet/mellanox/mlxsw/spectrum_dcb.c | 13 ------------- 1 file changed, 13 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_dcb.c +0 -13
@@ -168,8 +168,6 @@ static int mlxsw_sp_dcbnl_ieee_setets(struct net_device *dev,static int mlxsw_sp_dcbnl_app_validate (struct net_device *dev,struct dcb_app *app) { -int prio; -if (app->priority >=IEEE_8021QAZ_MAX_TCS ) {netdev_err (dev,"APP entry with priority value %u is invalid\n" , app->priority);
@@ -183,17 +181,6 @@ static int mlxsw_sp_dcbnl_app_validate(struct net_device *dev, app->protocol);return -EINVAL ; } - -/* Warn about any DSCP APP entries with the same PID. */ - prio =fls (dcb_ieee_getapp_mask (dev, app)); -if (prio--) { -if (prio < app->priority) -netdev_warn (dev,"Choosing priority %d for DSCP %d in favor of previously-active value of %d\n" , - app->priority, app->protocol, prio); -else if (prio > app->priority) -netdev_warn (dev,"Ignoring new priority %d for DSCP %d in favor of current value of %d\n" , - app->priority, app->protocol, prio); - }break ;case IEEE_8021QAZ_APP_SEL_ETHERTYPE :
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 109/772 scsi: target: tcmu: Fix possible data corruption
In reply to Greg Kroah-HartmanFrom: Xiaoguang Wang <[email protected]>
[ Upstream commit bb9b9eb0ae2e9d3f6036f0ad907c3a83dcd43485 ]
When tcmu_vma_fault() gets a page successfully, before the current context completes page fault procedure, find_free_blocks() may run and call unmap_mapping_range() to unmap the page. Assume that when find_free_blocks() initially completes and the previous page fault procedure starts to run again and completes, then one truncated page has been mapped to userspace. But note that tcmu_vma_fault() has gotten a refcount for the page so any other subsystem won't be able to use the page unless the userspace address is unmapped later.
If another command subsequently runs and needs to extend dbi_thresh it may reuse the corresponding slot for the previous page in data_bitmap. Then though we'll allocate new page for this slot in data_area, no page fault will happen because we have a valid map and the real request's data will be lost.
Filesystem implementations will also run into this issue but they usually lock the page when vm_operations_struct->fault gets a page and unlock the page after finish_fault() completes. For truncate filesystems lock pages in truncate_inode_pages() to protect against racing wrt. page faults.
To fix this possible data corruption scenario we can apply a method similar to the filesystems. For pages that are to be freed, tcmu_blocks_release() locks and unlocks. Make tcmu_vma_fault() also lock found page under cmdr_lock. At the same time, since tcmu_vma_fault() gets an extra page refcount, tcmu_blocks_release() won't free pages if pages are in page fault procedure, which means it is safe to call tcmu_blocks_release() before unmap_mapping_range().
With these changes tcmu_blocks_release() will wait for all page faults to be completed before calling unmap_mapping_range(). And later, if unmap_mapping_range() is called, it will ensure stale mappings are removed.
--- drivers/target/target_core_user.c | 40 ++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-)
drivers/target/target_core_user.c +37 -3
@@ -20,6 +20,7 @@#include <linux/configfs.h> #include <linux/mutex.h> #include <linux/workqueue.h> +#include <linux/pagemap.h> #include <net/genetlink.h> #include <scsi/scsi_common.h> #include <scsi/scsi_proto.h>
@@ -1666,6 +1667,26 @@ static u32 tcmu_blocks_release(struct tcmu_dev *udev, unsigned long first,xas_lock (&xas);xas_for_each (&xas, page, (last +1 ) * udev->data_pages_per_blk -1 ) {xas_store (&xas,NULL ); +/* +* While reaching here there may be page faults occurring on +* the to-be-released pages. A race condition may occur if +* unmap_mapping_range() is called before page faults on these +* pages have completed; a valid but stale map is created. +* +* If another command subsequently runs and needs to extend +* dbi_thresh, it may reuse the slot corresponding to the +* previous page in data_bitmap. Though we will allocate a new +* page for the slot in data_area, no page fault will happen +* because we have a valid map. Therefore the command's data +* will be lost. +* +* We lock and unlock pages that are to be released to ensure +* all page faults have completed. This way +* unmap_mapping_range() can ensure stale maps are cleanly +* removed. +*/ +lock_page (page); +unlock_page (page);__free_page (page); pages_freed++; }
@@ -1821,6 +1842,7 @@ static struct page *tcmu_try_get_data_page(struct tcmu_dev *udev, uint32_t dpi) page =xa_load (&udev->data_pages, dpi);if (likely (page)) {get_page (page); +lock_page (page);mutex_unlock (&udev->cmdr_lock);return page; }
@@ -1862,6 +1884,7 @@ static vm_fault_t tcmu_vma_fault(struct vm_fault *vmf)struct page *page;unsigned long offset;void *addr; +vm_fault_t ret =0 ;int mi =tcmu_find_mem_index (vmf->vma);if (mi <0 )
@@ -1886,10 +1909,11 @@ static vm_fault_t tcmu_vma_fault(struct vm_fault *vmf) page =tcmu_try_get_data_page (udev, dpi);if (!page)return VM_FAULT_SIGBUS ; + ret =VM_FAULT_LOCKED ; } vmf->page = page; -return 0 ; +return ret; }static const struct vm_operations_struct tcmu_vm_ops = {
@@ -3152,12 +3176,22 @@ static void find_free_blocks(void) udev->dbi_max = block; } +/* +* Release the block pages. +* +* Also note that since tcmu_vma_fault() gets an extra page +* refcount, tcmu_blocks_release() won't free pages if pages +* are mapped. This means it is safe to call +* tcmu_blocks_release() before unmap_mapping_range() which +* drops the refcount of any pages it unmaps and thus releases +* them. +*/ + pages_freed =tcmu_blocks_release (udev, start, end -1 ); +/* Here will truncate the data area from off */ off = udev->data_off + (loff_t )start * udev->data_blk_size;unmap_mapping_range (udev->inode->i_mapping, off,0 ,1 ); -/* Release the block pages */ - pages_freed =tcmu_blocks_release (udev, start, end -1 );mutex_unlock (&udev->cmdr_lock); total_pages_freed += pages_freed;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 112/772 ASoC: dapm: Dont fold register value changes into notifications
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
[ Upstream commit ad685980469b9f9b99d4d6ea05f4cb8f57cb2234 ]
DAPM tracks and reports the value presented to the user from DAPM controls separately to the register value, these may diverge during initialisation or when an autodisable control is in use.
When writing DAPM controls we currently report that a change has occurred if either the DAPM value or the value stored in the register has changed, meaning that if the two are out of sync we may appear to report a spurious event to userspace. Since we use this folded in value for nothing other than the value reported to userspace simply drop the folding in of the register change.
--- sound/soc/soc-dapm.c | 2 -- 1 file changed, 2 deletions(-)
sound/soc/soc-dapm.c +0 -2
@@ -3430,7 +3430,6 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, update.val = val; card->update = &update; } - change |= reg_change; ret =soc_dapm_mixer_update_power (card, kcontrol, connect, rconnect);
@@ -3532,7 +3531,6 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, update.val = val; card->update = &update; } - change |= reg_change; ret =soc_dapm_mux_update_power (card, kcontrol, item[0 ], e);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 108/772 ath11k: fix warning of not found station for bssid in message
In reply to Greg Kroah-HartmanFrom: Wen Gong <[email protected]>
[ Upstream commit 7330e1ec9748948177830c6e1a13379835d577f9 ]
When test connect/disconnect to an AP frequently with WCN6855, sometimes it show below log.
[ 277.040121] wls1: deauthenticating from 8c:21:0a:b3:5a:64 by local choice (Reason: 3=DEAUTH_LEAVING) [ 277.050906] ath11k_pci 0000:05:00.0: wmi stats vdev id 0 mac 00:03:7f:29:61:11 [ 277.050944] ath11k_pci 0000:05:00.0: wmi stats bssid 8c:21:0a:b3:5a:64 vif pK-error [ 277.050954] ath11k_pci 0000:05:00.0: not found station for bssid 8c:21:0a:b3:5a:64 [ 277.050961] ath11k_pci 0000:05:00.0: failed to parse rssi chain -71 [ 277.050967] ath11k_pci 0000:05:00.0: failed to pull fw stats: -71 [ 277.050976] ath11k_pci 0000:05:00.0: wmi stats vdev id 0 mac 00:03:7f:29:61:11 [ 277.050983] ath11k_pci 0000:05:00.0: wmi stats bssid 8c:21:0a:b3:5a:64 vif pK-error [ 277.050989] ath11k_pci 0000:05:00.0: not found station for bssid 8c:21:0a:b3:5a:64 [ 277.050995] ath11k_pci 0000:05:00.0: failed to parse rssi chain -71 [ 277.051000] ath11k_pci 0000:05:00.0: failed to pull fw stats: -71 [ 278.064050] ath11k_pci 0000:05:00.0: failed to request fw stats: -110
Reason is:
When running disconnect operation, sta_info removed from local->sta_hash by __sta_info_destroy_part1() from __sta_info_flush(), after this, ieee80211_find_sta_by_ifaddr() which called by ath11k_wmi_tlv_fw_stats_data_parse() and ath11k_wmi_tlv_rssi_chain_parse() cannot find this station, then failed log printed.
steps are like this:
1. when disconnect from AP, __sta_info_destroy() called __sta_info_destroy_part1() and __sta_info_destroy_part2().
2. in __sta_info_destroy_part1(), it has "sta_info_hash_del(local, sta)" and "list_del_rcu(&sta->list)", it will remove the ieee80211_sta from the list of ieee80211_hw.
3. in __sta_info_destroy_part2(), it called drv_sta_state()->ath11k_mac_op_sta_state(), then peer->sta is clear at this moment.
4. in __sta_info_destroy_part2(), it then called sta_set_sinfo()->drv_sta_statistics() ->ath11k_mac_op_sta_statistics(), then WMI_REQUEST_STATS_CMDID sent to firmware.
5. WMI_UPDATE_STATS_EVENTID reported from firmware, at this moment, the ieee80211_sta can not be found again because it has remove from list in step2 and also peer->sta is clear in step3.
6. in __sta_info_destroy_part2(), it then called cleanup_single_sta()-> sta_info_free()->kfree(sta), at this moment, the ieee80211_sta is freed in memory, then the failed log will not happen because function ath11k_mac_op_sta_state() will not be called.
Actually this print log is not a real error, it is only to skip parse the info, so change to skip print by default debug setting.
Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3
--- drivers/net/wireless/ath/ath11k/wmi.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath11k/wmi.c +6 -5
@@ -5616,9 +5616,9 @@ static int ath11k_wmi_tlv_rssi_chain_parse(struct ath11k_base *ab, arvif->bssid, NULL);if (!sta) { -ath11k_warn (ab,"not found station for bssid %pM\n" , - arvif->bssid); - ret = -EPROTO ; +ath11k_dbg (ab,ATH11K_DBG_WMI , +"not found station of bssid %pM for rssi chain\n" , + arvif->bssid); goto exit; }
@@ -5716,8 +5716,9 @@ static int ath11k_wmi_tlv_fw_stats_data_parse(struct ath11k_base *ab,"wmi stats vdev id %d snr %d\n" , src->vdev_id, src->beacon_snr); }else { -ath11k_warn (ab,"not found station for bssid %pM\n" , - arvif->bssid); +ath11k_dbg (ab,ATH11K_DBG_WMI , +"not found station of bssid %pM for vdev stat\n" , + arvif->bssid); } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 161/772 rtw89: cfo: check mac_id to avoid out-of-bounds
In reply to Greg Kroah-HartmanFrom: Ping-Ke Shih <[email protected]>
[ Upstream commit 97df85871a5b187609d30fca6d85b912d9e02f29 ]
Somehow, hardware reports incorrect mac_id and pollute memory. Check index before we access the array.
UBSAN: array-index-out-of-bounds in rtw89/phy.c:2517:23 index 188 is out of range for type 's32 [64]' CPU: 1 PID: 51550 Comm: irq/35-rtw89_pc Tainted: G OE Call Trace: <IRQ> show_stack+0x52/0x58 dump_stack_lvl+0x4c/0x63 dump_stack+0x10/0x12 ubsan_epilogue+0x9/0x45 __ubsan_handle_out_of_bounds.cold+0x44/0x49 ? __alloc_skb+0x92/0x1d0 rtw89_phy_cfo_parse+0x44/0x7f [rtw89_core] rtw89_core_rx+0x261/0x871 [rtw89_core] ? __alloc_skb+0xee/0x1d0 rtw89_pci_napi_poll+0x3fa/0x4ea [rtw89_pci] __napi_poll+0x33/0x1a0 net_rx_action+0x126/0x260 ? __queue_work+0x217/0x4c0 __do_softirq+0xd9/0x315 ? disable_irq_nosync+0x10/0x10 do_softirq.part.0+0x6d/0x90 </IRQ> <TASK> __local_bh_enable_ip+0x62/0x70 rtw89_pci_interrupt_threadfn+0x182/0x1a6 [rtw89_pci] irq_thread_fn+0x28/0x60 irq_thread+0xc8/0x190 ? irq_thread_fn+0x60/0x60 kthread+0x16b/0x190 ? irq_thread_check_affinity+0xe0/0xe0 ? set_kthread_struct+0x50/0x50 ret_from_fork+0x22/0x30 </TASK>
--- drivers/net/wireless/realtek/rtw89/phy.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/realtek/rtw89/phy.c +5 -0
@@ -1872,6 +1872,11 @@ void rtw89_phy_cfo_parse(struct rtw89_dev *rtwdev, s16 cfo_val,struct rtw89_cfo_tracking_info *cfo = &rtwdev->cfo_tracking;u8 macid = phy_ppdu->mac_id; +if (macid >=CFO_TRACK_MAX_USER ) { +rtw89_warn (rtwdev,"mac_id %d is out of range\n" , macid); +return ; + } + cfo->cfo_tail[macid] += cfo_val; cfo->cfo_cnt[macid]++; cfo->packet_count++;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 110/772 ipv6: Dont send rs packets to the interface of ARPHRD_TUNNEL
In reply to Greg Kroah-HartmanFrom: jianghaoran <[email protected]>
[ Upstream commit b52e1cce31ca721e937d517411179f9196ee6135 ]
ARPHRD_TUNNEL interface can't process rs packets
and will generate TX errors
ex:
ip tunnel add ethn mode ipip local 192.168.1.1 remote 192.168.1.2 ifconfig ethn x.x.x.x
ethn: flags=209<UP,POINTOPOINT,RUNNING,NOARP> mtu 1480
inet x.x.x.x netmask 255.255.255.255 destination x.x.x.x inet6 fe80::5efe:ac1e:3cdb prefixlen 64 scopeid 0x20<link>
tunnel txqueuelen 1000 (IPIP Tunnel)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 3 dropped 0 overruns 0 carrier 0 collisions 0
--- net/ipv6/addrconf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv6/addrconf.c +2 -1
@@ -4221,7 +4221,8 @@ static void addrconf_dad_completed(struct inet6_ifaddr *ifp, bool bump_id, send_rs = send_mld &&ipv6_accept_ra (ifp->idev) && ifp->idev->cnf.rtr_solicits !=0 && - (dev->flags&IFF_LOOPBACK ) ==0 ; + (dev->flags &IFF_LOOPBACK ) ==0 && + (dev->type !=ARPHRD_TUNNEL );read_unlock_bh (&ifp->idev->lock);/* While dad is in progress mld report's source address is in6_addrany.
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 106/772 drm/msm/dpu: Clean up CRC debug logs
In reply to Greg Kroah-HartmanFrom: Jessica Zhang <[email protected]>
[ Upstream commit 3ce8bdca394fc606b55e7c5ed779d171aaae5d09 ]
Currently, dpu_hw_lm_collect_misr returns EINVAL if CRC is disabled. This causes a lot of spam in the DRM debug logs as it's called for every vblank.
Instead of returning EINVAL when CRC is disabled in dpu_hw_lm_collect_misr, let's return ENODATA and add an extra ENODATA check before the debug log in dpu_crtc_get_crc.
Changes since V1:
- Added reported-by and suggested-by tags
Patchwork: https://patchwork.freedesktop.org/patch/484274/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 3 ++- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +2 -1
@@ -204,7 +204,8 @@ static int dpu_crtc_get_crc(struct drm_crtc *crtc) rc = m->hw_lm->ops.collect_misr (m->hw_lm, &crcs[i]);if (rc) { -DRM_DEBUG_DRIVER ("MISR read failed\n" ); +if (rc != -ENODATA ) +DRM_DEBUG_DRIVER ("MISR read failed\n" );return rc; } }
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c +1 -1
@@ -138,7 +138,7 @@ static int dpu_hw_lm_collect_misr(struct dpu_hw_mixer *ctx, u32 *misr_value) ctrl =DPU_REG_READ (c,LM_MISR_CTRL );if (!(ctrl &LM_MISR_CTRL_ENABLE )) -return -EINVAL ; +return -ENODATA ;if (!(ctrl &LM_MISR_CTRL_STATUS ))return -EINVAL ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 107/772 xtensa: move trace_hardirqs_off call back to entry.S
In reply to Greg Kroah-HartmanFrom: Max Filippov <[email protected]>
[ Upstream commit de4415d0bac91192ee9c74e849bc61429efa9b42 ]
Context tracking call must be done after hardirq tracking call, otherwise lockdep_assert_irqs_disabled called from rcu_eqs_exit gives a warning. To avoid context tracking logic duplication for IRQ/exception entry paths move trace_hardirqs_off call back to common entry code.
--- arch/xtensa/kernel/entry.S | 19 +++++++++++++------ arch/xtensa/kernel/traps.c | 11 ++--------- 2 files changed, 15 insertions(+), 15 deletions(-)
arch/xtensa/kernel/entry.S +13 -6
@@ -442,7 +442,6 @@ KABI_W or a3, a3, a0 moveqz a3, a0, a2 # a3 = LOCKLEVEL iff interrupt KABI_W movi a2, PS_WOE_MASK KABI_W or a3, a3, a2 - rsr a2, exccause #endif /* restore return address (or 0 if return to userspace) */
@@ -469,19 +468,27 @@ KABI_W or a3, a3, a2 save_xtregs_opt a1 a3 a4 a5 a6 a7 PT_XTREGS_OPT +#ifdef CONFIG_TRACE_IRQFLAGS + rsr abi_tmp0, ps + extui abi_tmp0, abi_tmp0, PS_INTLEVEL_SHIFT, PS_INTLEVEL_WIDTH + beqz abi_tmp0, 1f + abi_call trace_hardirqs_off +1: +#endif + /* Go to second-level dispatcher. Set up parameters to pass to the * exception handler and call the exception handler. */ - rsr a4, excsave1 - addx4 a4, a2, a4 - l32i a4, a4, EXC_TABLE_DEFAULT # load handler - mov abi_arg1, a2 # pass EXCCAUSE + l32i abi_arg1, a1, PT_EXCCAUSE # pass EXCCAUSE + rsr abi_tmp0, excsave1 + addx4 abi_tmp0, abi_arg1, abi_tmp0 + l32i abi_tmp0, abi_tmp0, EXC_TABLE_DEFAULT # load handler mov abi_arg0, a1 # pass stack frame /* Call the second-level handler */ - abi_callx a4 + abi_callx abi_tmp0 /* Jump here for exception exit */ .global common_exception_return
arch/xtensa/kernel/traps.c +2 -9
@@ -242,12 +242,8 @@ DEFINE_PER_CPU(unsigned long, nmi_count);void do_nmi (struct pt_regs *regs) { -struct pt_regs *old_regs; +struct pt_regs *old_regs =set_irq_regs (regs); -if ((regs->ps &PS_INTLEVEL_MASK ) <LOCKLEVEL ) -trace_hardirqs_off (); - - old_regs =set_irq_regs (regs);nmi_enter (); ++*this_cpu_ptr (&nmi_count);check_valid_nmi ();
@@ -269,12 +265,9 @@ void do_interrupt(struct pt_regs *regs)XCHAL_INTLEVEL6_MASK , XCHAL_INTLEVEL7_MASK, }; -struct pt_regs *old_regs; +struct pt_regs *old_regs =set_irq_regs (regs);unsigned unhandled = ~0u ; -trace_hardirqs_off (); - - old_regs =set_irq_regs (regs);irq_enter ();for (;;) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 162/772 of/fdt: Ignore disabled memory nodes
In reply to Greg Kroah-HartmanFrom: Andre Przywara <[email protected]>
[ Upstream commit df5cd369876114f91f9ae60658fea80acfb15890 ]
When we boot a machine using a devicetree, the generic DT code goes through all nodes with a 'device_type = "memory"' property, and collects all memory banks mentioned there. However it does not check for the status property, so any nodes which are explicitly "disabled" will still be added as a memblock.
This ends up badly for QEMU, when booting with secure firmware on arm/arm64 machines, because QEMU adds a node describing secure-only memory:
===================
secram@e000000 {
secure-status = "okay";
status = "disabled";
reg = <0x00 0xe000000 0x00 0x1000000>;
device_type = "memory";
};===================
The kernel will eventually use that memory block (which is located below the main DRAM bank), but accesses to that will be answered with an SError:
===================
[ 0.000000] Internal error: synchronous external abort: 96000050 [#1] PREEMPT SMP [ 0.000000] Modules linked in: [ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 5.18.0-rc6-00014-g10c8acb8b679 #524 [ 0.000000] Hardware name: linux,dummy-virt (DT) [ 0.000000] pstate: 200000c5 (nzCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 0.000000] pc : new_slab+0x190/0x340 [ 0.000000] lr : new_slab+0x184/0x340 [ 0.000000] sp : ffff80000a4b3d10
....
==================
The actual crash location and call stack will be somewhat random, and depend on the specific allocation of that physical memory range.
As the DT spec[1] explicitly mentions standard properties, add a simple check to skip over disabled memory nodes, so that we only use memory that is meant for non-secure code to use.
That fixes booting a QEMU arm64 VM with EL3 enabled ("secure=on"), when not using UEFI. In this case the QEMU generated DT will be handed on to the kernel, which will see the secram node.
This issue is reproducible when using TF-A together with U-Boot as firmware, then booting with the "booti" command.
When using U-Boot as an UEFI provider, the code there [2] explicitly filters for disabled nodes when generating the UEFI memory map, so we are safe.
EDK/2 only reads the first bank of the first DT memory node [3] to learn about memory, so we got lucky there.
[1] https://github.com/devicetree-org/devicetree-specification/blob/main/source/chapter3-devicenodes.rst#memory-node (after the table)
[2] https://source.denx.de/u-boot/u-boot/-/blob/master/lib/fdtdec.c#L1061-1063
[3] https://github.com/tianocore/edk2/blob/master/ArmVirtPkg/PrePi/FdtParser.c
--- drivers/of/fdt.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/of/fdt.c +3 -0
@@ -1105,6 +1105,9 @@ int __init early_init_dt_scan_memory(void)if (type ==NULL ||strcmp (type,"memory" ) !=0 )continue ; +if (!of_fdt_device_is_available (fdt, node)) +continue ; + reg =of_get_flat_dt_prop (node,"linux,usable-memory" , &l);if (reg ==NULL ) reg =of_get_flat_dt_prop (node,"reg" , &l);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 126/772 s390/preempt: disable __preempt_count_add() optimization for PROFILE_ALL_BRANCHES
In reply to Greg Kroah-HartmanFrom: Heiko Carstens <[email protected]>
[ Upstream commit 63678eecec57fc51b778be3da35a397931287170 ]
gcc 12 does not (always) optimize away code that should only be generated if parameters are constant and within in a certain range. This depends on various obscure kernel config options, however in particular PROFILE_ALL_BRANCHES can trigger this compile error:
In function ‘__atomic_add_const’,
inlined from ‘__preempt_count_add.part.0’ at ./arch/s390/include/asm/preempt.h:50:3:
./arch/s390/include/asm/atomic_ops.h:80:9: error: impossible constraint in ‘asm’
80 | asm volatile( \
| ^~~Workaround this by simply disabling the optimization for PROFILE_ALL_BRANCHES, since the kernel will be so slow, that this optimization won't matter at all.
--- arch/s390/include/asm/preempt.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
arch/s390/include/asm/preempt.h +11 -4
@@ -46,10 +46,17 @@ static inline bool test_preempt_need_resched(void)static inline void __preempt_count_add (int val) { -if (__builtin_constant_p (val) && (val >=-128 ) && (val <=127 )) -__atomic_add_const (val, &S390_lowcore.preempt_count); -else -__atomic_add (val, &S390_lowcore.preempt_count); +/* +* With some obscure config options and CONFIG_PROFILE_ALL_BRANCHES +* enabled, gcc 12 fails to handle __builtin_constant_p(). +*/ +if (!IS_ENABLED (CONFIG_PROFILE_ALL_BRANCHES )) { +if (__builtin_constant_p (val) && (val >=-128 ) && (val <=127 )) { +__atomic_add_const (val, &S390_lowcore.preempt_count); +return ; + } + } +__atomic_add (val, &S390_lowcore.preempt_count); }static inline void __preempt_count_sub (int val)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 125/772 net: remove two BUG() from skb_checksum_help()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit d7ea0d9df2a6265b2b180d17ebc64b38105968fc ]
I have a syzbot report that managed to get a crash in skb_checksum_help()
If syzbot can trigger these BUG(), it makes sense to replace them with more friendly WARN_ON_ONCE() since skb_checksum_help() can instead return an error code.
Note that syzbot will still crash there, until real bug is fixed.
--- net/core/dev.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/core/dev.c +6 -2
@@ -3156,11 +3156,15 @@ int skb_checksum_help(struct sk_buff *skb) } offset =skb_checksum_start_offset (skb); -BUG_ON (offset >=skb_headlen (skb)); + ret = -EINVAL ; +if (WARN_ON_ONCE (offset >=skb_headlen (skb))) + goto out; + csum =skb_checksum (skb, offset, skb->len - offset,0 ); offset += skb->csum_offset; -BUG_ON (offset +sizeof (__sum16) >skb_headlen (skb)); +if (WARN_ON_ONCE (offset +sizeof (__sum16) >skb_headlen (skb))) + goto out; ret =skb_ensure_writable (skb, offset +sizeof (__sum16));if (ret)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 128/772 sched/core: Avoid obvious double update_rq_clock warning
In reply to Greg Kroah-HartmanFrom: Hao Jia <[email protected]>
[ Upstream commit 2679a83731d51a744657f718fc02c3b077e47562 ]
When we use raw_spin_rq_lock() to acquire the rq lock and have to update the rq clock while holding the lock, the kernel may issue a WARN_DOUBLE_CLOCK warning.
Since we directly use raw_spin_rq_lock() to acquire rq lock instead of rq_lock(), there is no corresponding change to rq->clock_update_flags. In particular, we have obtained the rq lock of other CPUs, the rq->clock_update_flags of this CPU may be RQCF_UPDATED at this time, and then calling update_rq_clock() will trigger the WARN_DOUBLE_CLOCK warning.
So we need to clear RQCF_UPDATED of rq->clock_update_flags to avoid the WARN_DOUBLE_CLOCK warning.
For the sched_rt_period_timer() and migrate_task_rq_dl() cases we simply replace raw_spin_rq_lock()/raw_spin_rq_unlock() with rq_lock()/rq_unlock().
For the {pull,push}_{rt,dl}_task() cases, we add the double_rq_clock_clear_update() function to clear RQCF_UPDATED of rq->clock_update_flags, and call double_rq_clock_clear_update() before double_lock_balance()/double_rq_lock() returns to avoid the WARN_DOUBLE_CLOCK warning.
Some call trace reports:
Call Trace 1:
<IRQ> sched_rt_period_timer+0x10f/0x3a0 ? enqueue_top_rt_rq+0x110/0x110 __hrtimer_run_queues+0x1a9/0x490 hrtimer_interrupt+0x10b/0x240 __sysvec_apic_timer_interrupt+0x8a/0x250 sysvec_apic_timer_interrupt+0x9a/0xd0 </IRQ> <TASK> asm_sysvec_apic_timer_interrupt+0x12/0x20
Call Trace 2:
<TASK> activate_task+0x8b/0x110 push_rt_task.part.108+0x241/0x2c0 push_rt_tasks+0x15/0x30 finish_task_switch+0xaa/0x2e0 ? __switch_to+0x134/0x420 __schedule+0x343/0x8e0 ? hrtimer_start_range_ns+0x101/0x340 schedule+0x4e/0xb0 do_nanosleep+0x8e/0x160 hrtimer_nanosleep+0x89/0x120 ? hrtimer_init_sleeper+0x90/0x90 __x64_sys_nanosleep+0x96/0xd0 do_syscall_64+0x34/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae
Call Trace 3:
<TASK> deactivate_task+0x93/0xe0 pull_rt_task+0x33e/0x400 balance_rt+0x7e/0x90 __schedule+0x62f/0x8e0 do_task_dead+0x3f/0x50 do_exit+0x7b8/0xbb0 do_group_exit+0x2d/0x90 get_signal+0x9df/0x9e0 ? preempt_count_add+0x56/0xa0 ? __remove_hrtimer+0x35/0x70 arch_do_signal_or_restart+0x36/0x720 ? nanosleep_copyout+0x39/0x50 ? do_nanosleep+0x131/0x160 ? audit_filter_inodes+0xf5/0x120 exit_to_user_mode_prepare+0x10f/0x1e0 syscall_exit_to_user_mode+0x17/0x30 do_syscall_64+0x40/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae
Call Trace 4:
update_rq_clock+0x128/0x1a0 migrate_task_rq_dl+0xec/0x310 set_task_cpu+0x84/0x1e4 try_to_wake_up+0x1d8/0x5c0 wake_up_process+0x1c/0x30 hrtimer_wakeup+0x24/0x3c __hrtimer_run_queues+0x114/0x270 hrtimer_interrupt+0xe8/0x244 arch_timer_handler_phys+0x30/0x50 handle_percpu_devid_irq+0x88/0x140 generic_handle_domain_irq+0x40/0x60 gic_handle_irq+0x48/0xe0 call_on_irq_stack+0x2c/0x60 do_interrupt_handler+0x80/0x84
Steps to reproduce:
1. Enable CONFIG_SCHED_DEBUG when compiling the kernel
2. echo 1 > /sys/kernel/debug/clear_warn_once
echo "WARN_DOUBLE_CLOCK" > /sys/kernel/debug/sched/features echo "NO_RT_PUSH_IPI" > /sys/kernel/debug/sched/features
3. Run some rt/dl tasks that periodically work and sleep, e.g. Create 2*n rt or dl (90% running) tasks via rt-app (on a system with n CPUs), and Dietmar Eggemann reports Call Trace 4 when running on PREEMPT_RT kernel.
--- kernel/sched/core.c | 6 +++--- kernel/sched/deadline.c | 5 +++-- kernel/sched/rt.c | 5 +++-- kernel/sched/sched.h | 28 ++++++++++++++++++++++++---- 4 files changed, 33 insertions(+), 11 deletions(-)
kernel/sched/core.c +3 -3
@@ -546,10 +546,10 @@ void double_rq_lock(struct rq *rq1, struct rq *rq2)swap (rq1, rq2);raw_spin_rq_lock (rq1); -if (__rq_lockp (rq1) ==__rq_lockp (rq2)) -return ; +if (__rq_lockp (rq1) !=__rq_lockp (rq2)) +raw_spin_rq_lock_nested (rq2,SINGLE_DEPTH_NESTING ); - raw_spin_rq_lock_nested(rq2, SINGLE_DEPTH_NESTING); + double_rq_clock_clear_update(rq1, rq2); }#endif
kernel/sched/deadline.c +3 -2
@@ -1804,6 +1804,7 @@ select_task_rq_dl(struct task_struct *p, int cpu, int flags)static void migrate_task_rq_dl (struct task_struct *p,int new_cpu__maybe_unused ) { +struct rq_flags rf;struct rq *rq;if (READ_ONCE (p->__state) !=TASK_WAKING )
@@ -1815,7 +1816,7 @@ static void migrate_task_rq_dl(struct task_struct *p, int new_cpu __maybe_unused* from try_to_wake_up(). Hence, p->pi_lock is locked, but * rq->lock is not... So, lock it */ -raw_spin_rq_lock (rq); +rq_lock (rq, &rf);if (p->dl.dl_non_contending) {update_rq_clock (rq);sub_running_bw (&p->dl, &rq->dl);
@@ -1831,7 +1832,7 @@ static void migrate_task_rq_dl(struct task_struct *p, int new_cpu __maybe_unusedput_task_struct (p); }sub_rq_bw (&p->dl, &rq->dl); -raw_spin_rq_unlock (rq); +rq_unlock (rq, &rf); }static void check_preempt_equal_dl (struct rq *rq,struct task_struct *p)
kernel/sched/rt.c +3 -2
@@ -885,6 +885,7 @@ static int do_sched_rt_period_timer(struct rt_bandwidth *rt_b, int overrun)int enqueue =0 ;struct rt_rq *rt_rq =sched_rt_period_rt_rq (rt_b, i);struct rq *rq =rq_of_rt_rq (rt_rq); +struct rq_flags rf;int skip;/*
@@ -899,7 +900,7 @@ static int do_sched_rt_period_timer(struct rt_bandwidth *rt_b, int overrun)if (skip)continue ; -raw_spin_rq_lock (rq); +rq_lock (rq, &rf);update_rq_clock (rq);if (rt_rq->rt_time) {
@@ -937,7 +938,7 @@ static int do_sched_rt_period_timer(struct rt_bandwidth *rt_b, int overrun)if (enqueue)sched_rt_rq_enqueue (rt_rq); -raw_spin_rq_unlock (rq); +rq_unlock (rq, &rf); }if (!throttled && (!rt_bandwidth_enabled () || rt_b->rt_runtime ==RUNTIME_INF ))
kernel/sched/sched.h +24 -4
@@ -2494,6 +2494,24 @@ unsigned long arch_scale_freq_capacity(int cpu) }#endif +#ifdef CONFIG_SCHED_DEBUG +/* +* In double_lock_balance()/double_rq_lock(), we use raw_spin_rq_lock() to +* acquire rq lock instead of rq_lock(). So at the end of these two functions +* we need to call double_rq_clock_clear_update() to clear RQCF_UPDATED of +* rq->clock_update_flags to avoid the WARN_DOUBLE_CLOCK warning. +*/ +static inline void double_rq_clock_clear_update (struct rq *rq1,struct rq *rq2) +{ + rq1->clock_update_flags &= (RQCF_REQ_SKIP |RQCF_ACT_SKIP ); +/* rq1 == rq2 for !CONFIG_SMP, so just clear RQCF_UPDATED once. */ +#ifdef CONFIG_SMP + rq2->clock_update_flags &= (RQCF_REQ_SKIP |RQCF_ACT_SKIP ); +#endif +} +#else +static inline void double_rq_clock_clear_update (struct rq *rq1,struct rq *rq2) {} +#endif #ifdef CONFIG_SMP
@@ -2559,14 +2577,15 @@ static inline int _double_lock_balance(struct rq *this_rq, struct rq *busiest) __acquires(busiest->lock) __acquires(this_rq->lock) { -if (__rq_lockp (this_rq) ==__rq_lockp (busiest)) -return 0 ; - -if (likely (raw_spin_rq_trylock (busiest))) +if (__rq_lockp (this_rq) ==__rq_lockp (busiest) || +likely (raw_spin_rq_trylock (busiest))) { +double_rq_clock_clear_update (this_rq, busiest);return 0 ; + }if (rq_order_less (this_rq, busiest)) {raw_spin_rq_lock_nested (busiest,SINGLE_DEPTH_NESTING ); +double_rq_clock_clear_update (this_rq, busiest);return 0 ; }
@@ -2660,6 +2679,7 @@ static inline void double_rq_lock(struct rq *rq1, struct rq *rq2)BUG_ON (rq1 != rq2);raw_spin_rq_lock (rq1);__acquire (rq2->lock);/* Fake it out ;) */ +double_rq_clock_clear_update (rq1, rq2); }/*
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 127/772 perf/amd/ibs: Cascade pmu init functions return value
In reply to Greg Kroah-HartmanFrom: Ravi Bangoria <[email protected]>
[ Upstream commit 39b2ca75eec8a33e2ffdb8aa0c4840ec3e3b472c ]
IBS pmu initialization code ignores return value provided by callee functions. Fix it.
--- arch/x86/events/amd/ibs.c | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-)
arch/x86/events/amd/ibs.c +29 -8
@@ -759,9 +759,10 @@ static __init int perf_ibs_pmu_init(struct perf_ibs *perf_ibs, char *name)return ret; } -static __init void perf_event_ibs_init (void ) +static __init int perf_event_ibs_init (void ) {struct attribute **attr = ibs_op_format_attrs; +int ret;/* * Some chips fail to reset the fetch count when it is written; instead
@@ -773,7 +774,9 @@ static __init void perf_event_ibs_init(void)if (boot_cpu_data.x86 ==0x19 && boot_cpu_data.x86_model <0x10 ) perf_ibs_fetch.fetch_ignore_if_zero_rip =1 ; -perf_ibs_pmu_init (&perf_ibs_fetch,"ibs_fetch" ); + ret =perf_ibs_pmu_init (&perf_ibs_fetch,"ibs_fetch" ); +if (ret) +return ret;if (ibs_caps &IBS_CAPS_OPCNT ) { perf_ibs_op.config_mask |=IBS_OP_CNT_CTL ;
@@ -786,15 +789,35 @@ static __init void perf_event_ibs_init(void) perf_ibs_op.cnt_mask |= IBS_OP_MAX_CNT_EXT_MASK; } -perf_ibs_pmu_init (&perf_ibs_op,"ibs_op" ); + ret =perf_ibs_pmu_init (&perf_ibs_op,"ibs_op" ); +if (ret) + goto err_op; + + ret =register_nmi_handler (NMI_LOCAL , perf_ibs_nmi_handler,0 ,"perf_ibs" ); +if (ret) + goto err_nmi; -register_nmi_handler (NMI_LOCAL , perf_ibs_nmi_handler,0 ,"perf_ibs" );pr_info ("perf: AMD IBS detected (0x%08x)\n" , ibs_caps); +return 0 ; + +err_nmi: +perf_pmu_unregister (&perf_ibs_op.pmu); +free_percpu (perf_ibs_op.pcpu); + perf_ibs_op.pcpu =NULL ; +err_op: +perf_pmu_unregister (&perf_ibs_fetch.pmu); +free_percpu (perf_ibs_fetch.pcpu); + perf_ibs_fetch.pcpu =NULL ; + +return ret; }#else /* defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_AMD) */ -static __init void perf_event_ibs_init (void ) { } +static __init int perf_event_ibs_init (void ) +{ +return 0 ; +}#endif
@@ -1064,9 +1087,7 @@ static __init int amd_ibs_init(void) x86_pmu_amd_ibs_starting_cpu, x86_pmu_amd_ibs_dying_cpu); -perf_event_ibs_init (); - -return 0 ; +return perf_event_ibs_init (); }/* Since we need the pci subsystem to init ibs we can't do this earlier: */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 120/772 of: Support more than one crash kernel regions for kexec -s
In reply to Greg Kroah-HartmanFrom: Zhen Lei <[email protected]>
[ Upstream commit 8af6b91f58341325bf74ecb0389ddc0039091d84 ]
When "crashkernel=X,high" is used, there may be two crash regions:
high=crashk_res and low=crashk_low_res. But now the syscall kexec_file_load() only add crashk_res into "linux,usable-memory-range", this may cause the second kernel to have no available dma memory.
Fix it like kexec-tools does for option -c, add both 'high' and 'low' regions into the dtb.
--- drivers/of/kexec.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/of/kexec.c +9 -0
@@ -386,6 +386,15 @@ void *of_kexec_alloc_and_setup_fdt(const struct kimage *image, crashk_res.end - crashk_res.start + 1);if (ret) goto out; + +if (crashk_low_res.end) { + ret =fdt_appendprop_addrrange (fdt,0 , chosen_node, +"linux,usable-memory-range" , + crashk_low_res.start, + crashk_low_res.end - crashk_low_res.start +1 ); +if (ret) + goto out; + } }/* add bootargs */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 173/772 rxrpc: Return an error to sendmsg if call failed
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit 4ba68c5192554876bd8c3afd904e3064d2915341 ]
If at the end of rxrpc sendmsg() or rxrpc_kernel_send_data() the call that was being given data was aborted remotely or otherwise failed, return an error rather than returning the amount of data buffered for transmission.
The call (presumably) did not complete, so there's not much point continuing with it. AF_RXRPC considers it "complete" and so will be unwilling to do anything else with it - and won't send a notification for it, deeming the return from sendmsg sufficient.
Not returning an error causes afs to incorrectly handle a StoreData operation that gets interrupted by a change of address due to NAT reconfiguration.
This doesn't normally affect most operations since their request parameters tend to fit into a single UDP packet and afs_make_call() returns before the server responds; StoreData is different as it involves transmission of a lot of data.
This can be triggered on a client by doing something like:
dd if=/dev/zero of=/afs/example.com/foo bs=1M count=512
at one prompt, and then changing the network address at another prompt, e.g.:
ifconfig enp6s0 inet 192.168.6.2 && route add 192.168.6.1 dev enp6s0
Tracing packets on an Auristor fileserver looks something like:
192.168.6.1 -> 192.168.6.3 RX 107 ACK Idle Seq: 0 Call: 4 Source Port: 7000 Destination Port: 7001 192.168.6.3 -> 192.168.6.1 AFS (RX) 1482 FS Request: Unknown(64538) (64538) 192.168.6.3 -> 192.168.6.1 AFS (RX) 1482 FS Request: Unknown(64538) (64538) 192.168.6.1 -> 192.168.6.3 RX 107 ACK Idle Seq: 0 Call: 4 Source Port: 7000 Destination Port: 7001 <ARP exchange for 192.168.6.2> 192.168.6.2 -> 192.168.6.1 AFS (RX) 1482 FS Request: Unknown(0) (0) 192.168.6.2 -> 192.168.6.1 AFS (RX) 1482 FS Request: Unknown(0) (0) 192.168.6.1 -> 192.168.6.2 RX 107 ACK Exceeds Window Seq: 0 Call: 4 Source Port: 7000 Destination Port: 7001 192.168.6.1 -> 192.168.6.2 RX 74 ABORT Seq: 0 Call: 4 Source Port: 7000 Destination Port: 7001 192.168.6.1 -> 192.168.6.2 RX 74 ABORT Seq: 29321 Call: 4 Source Port: 7000 Destination Port: 7001
The Auristor fileserver logs code -453 (RXGEN_SS_UNMARSHAL), but the abort code received by kafs is -5 (RX_PROTOCOL_ERROR) as the rx layer sees the condition and generates an abort first and the unmarshal error is a consequence of that at the application layer.
--- net/rxrpc/sendmsg.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/rxrpc/sendmsg.c +6 -0
@@ -444,6 +444,12 @@ static int rxrpc_send_data(struct rxrpc_sock *rx, success: ret = copied; +if (READ_ONCE (call->state) ==RXRPC_CALL_COMPLETE ) { +read_lock_bh (&call->state_lock); +if (call->error <0 ) + ret = call->error; +read_unlock_bh (&call->state_lock); + } out: call->tx_pending = skb;_leave (" = %d" , ret);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 129/772 spi: stm32-qspi: Fix wait_cmd timeout in APM mode
In reply to Greg Kroah-HartmanFrom: Patrice Chotard <[email protected]>
[ Upstream commit d83d89ea68b4726700fa87b22db075e4217e691c ]
In APM mode, TCF and TEF flags are not set. To avoid timeout in stm32_qspi_wait_cmd(), don't check if TCF/TEF are set.
--- drivers/spi/spi-stm32-qspi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/spi/spi-stm32-qspi.c +2 -1
@@ -308,7 +308,8 @@ static int stm32_qspi_wait_cmd(struct stm32_qspi *qspi,if (!op->data.nbytes) goto wait_nobusy; -if (readl_relaxed (qspi->io_base +QSPI_SR ) &SR_TCF ) +if ((readl_relaxed (qspi->io_base +QSPI_SR ) &SR_TCF ) || + qspi->fmode ==CCR_FMODE_APM ) goto out;reinit_completion (&qspi->data_completion);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 174/772 rxrpc, afs: Fix selection of abort codes
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit de696c4784f0706884458893c5a6c39b3a3ff65c ]
The RX_USER_ABORT code should really only be used to indicate that the user of the rxrpc service (ie. userspace) implicitly caused a call to be aborted
- for instance if the AF_RXRPC socket is closed whilst the call was in progress. (The user may also explicitly abort a call and specify the abort code to use).
Change some of the points of generation to use other abort codes instead:
(1) Abort the call with RXGEN_SS_UNMARSHAL or RXGEN_CC_UNMARSHAL if we see ENOMEM and EFAULT during received data delivery and abort with RX_CALL_DEAD in the default case.
(2) Abort with RXGEN_SS_MARSHAL if we get ENOMEM whilst trying to send a reply.
(3) Abort with RX_CALL_DEAD if we stop hearing from the peer if we had heard from the peer and abort with RX_CALL_TIMEOUT if we hadn't.
(4) Abort with RX_CALL_DEAD if we try to disconnect a call that's not completed successfully or been aborted.
--- fs/afs/rxrpc.c | 8 +++++--- net/rxrpc/call_event.c | 4 ++-- net/rxrpc/conn_object.c | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-)
fs/afs/rxrpc.c +5 -3
@@ -537,6 +537,8 @@ static void afs_deliver_to_call(struct afs_call *call)case -ENODATA :case -EBADMSG :case -EMSGSIZE : +case -ENOMEM : +case -EFAULT : abort_code =RXGEN_CC_UNMARSHAL ;if (state !=AFS_CALL_CL_AWAIT_REPLY ) abort_code =RXGEN_SS_UNMARSHAL ;
@@ -544,7 +546,7 @@ static void afs_deliver_to_call(struct afs_call *call) abort_code, ret, "KUM"); goto local_abort;default : - abort_code =RX_USER_ABORT ; + abort_code =RX_CALL_DEAD ;rxrpc_kernel_abort_call (call->net->socket, call->rxcall, abort_code, ret,"KER" ); goto local_abort;
@@ -836,7 +838,7 @@ void afs_send_empty_reply(struct afs_call *call)case -ENOMEM :_debug ("oom" );rxrpc_kernel_abort_call (net->socket, call->rxcall, -RX_USER_ABORT , -ENOMEM ,"KOO" ); +RXGEN_SS_MARSHAL , -ENOMEM ,"KOO" ); fallthrough;default :_leave (" [error]" );
@@ -878,7 +880,7 @@ void afs_send_simple_reply(struct afs_call *call, const void *buf, size_t len)if (n == -ENOMEM ) {_debug ("oom" );rxrpc_kernel_abort_call (net->socket, call->rxcall, -RX_USER_ABORT , -ENOMEM ,"KOO" ); +RXGEN_SS_MARSHAL , -ENOMEM ,"KOO" ); }_leave (" [error]" ); }
net/rxrpc/call_event.c +2 -2
@@ -377,9 +377,9 @@ void rxrpc_process_call(struct work_struct *work)if (test_bit (RXRPC_CALL_RX_HEARD , &call->flags) && (int )call->conn->hi_serial - (int )call->rx_serial >0 ) {trace_rxrpc_call_reset (call); -rxrpc_abort_call ("EXP" , call,0 ,RX_USER_ABORT , -ECONNRESET ); +rxrpc_abort_call ("EXP" , call,0 ,RX_CALL_DEAD , -ECONNRESET ); }else { -rxrpc_abort_call ("EXP" , call,0 ,RX_USER_ABORT , -ETIME ); +rxrpc_abort_call ("EXP" , call,0 ,RX_CALL_TIMEOUT , -ETIME ); }set_bit (RXRPC_CALL_EV_ABORT , &call->events); goto recheck_state;
net/rxrpc/conn_object.c +1 -1
@@ -183,7 +183,7 @@ void __rxrpc_disconnect_call(struct rxrpc_connection *conn, chan->last_type =RXRPC_PACKET_TYPE_ABORT ;break ;default : - chan->last_abort =RX_USER_ABORT ; + chan->last_abort =RX_CALL_DEAD ; chan->last_type =RXRPC_PACKET_TYPE_ABORT ;break ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 164/772 ASoC: max98357a: remove dependency on GPIOLIB
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 21ca3274333f5c1cbbf9d91e5b33f4f2463859b2 ]
commit dcc2c012c7691 ("ASoC: Fix gpiolib dependencies") removed a series of unnecessary dependencies on GPIOLIB when the gpio was optional.
A similar simplification seems valid for max98357a, so remove the dependency as well. This will avoid the following warning
WARNING: unmet direct dependencies detected for SND_SOC_MAX98357A
Depends on [n]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && GPIOLIB [=n]
Selected by [y]:
- SND_SOC_INTEL_SOF_CS42L42_MACH [=y] && SOUND [=y] && !UML &&
SND [=y] && SND_SOC [=y] && SND_SOC_INTEL_MACH [=y] &&
(SND_SOC_SOF_HDA_LINK [=y] || SND_SOC_SOF_BAYTRAIL [=n]) && I2C
[=y] && ACPI [=y] && SND_HDA_CODEC_HDMI [=y] &&
SND_SOC_SOF_HDA_AUDIO_CODEC [=y] && (MFD_INTEL_LPSS [=y] ||
COMPILE_TEST [=n])--- sound/soc/codecs/Kconfig | 1 - 1 file changed, 1 deletion(-)
sound/soc/codecs/Kconfig +0 -1
@@ -943,7 +943,6 @@ config SND_SOC_MAX98095 config SND_SOC_MAX98357A tristate "Maxim MAX98357A CODEC" - depends on GPIOLIB config SND_SOC_MAX98371 tristate
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 175/772 afs: Adjust ACK interpretation to try and cope with NAT
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit adc9613ff66c26ebaff9814973181ac178beb90b ]
If a client's address changes, say if it is NAT'd, this can disrupt an in progress operation. For most operations, this is not much of a problem, but StoreData can be different as some servers modify the target file as the data comes in, so if a store request is disrupted, the file can get corrupted on the server.
The problem is that the server doesn't recognise packets that come after the change of address as belonging to the original client and will bounce them, either by sending an OUT_OF_SEQUENCE ACK to the apparent new call if the packet number falls within the initial sequence number window of a call or by sending an EXCEEDS_WINDOW ACK if it falls outside and then aborting it. In both cases, firstPacket will be 1 and previousPacket will be 0 in the ACK information.
Fix this by the following means:
(1) If a client call receives an EXCEEDS_WINDOW ACK with firstPacket as 1 and previousPacket as 0, assume this indicates that the server saw the incoming packets from a different peer and thus as a different call. Fail the call with error -ENETRESET.
(2) Also fail the call if a similar OUT_OF_SEQUENCE ACK occurs if the first packet has been hard-ACK'd. If it hasn't been hard-ACK'd, the ACK packet will cause it to get retransmitted, so the call will just be repeated.
(3) Make afs_select_fileserver() treat -ENETRESET as a straight fail of the operation.
(4) Prioritise the error code over things like -ECONNRESET as the server did actually respond.
(5) Make writeback treat -ENETRESET as a retryable error and make it redirty all the pages involved in a write so that the VM will retry.
Note that there is still a circumstance that I can't easily deal with: if the operation is fully received and processed by the server, but the reply is lost due to address change. There's no way to know if the op happened. We can examine the server, but a conflicting change could have been made by a third party - and we can't tell the difference. In such a case, a message like:
kAFS: vnode modified {100058:146266} b7->b8 YFS.StoreData64 (op=2646a)will be logged to dmesg on the next op to touch the file and the client will reset the inode state, including invalidating clean parts of the pagecache.
--- fs/afs/misc.c | 5 ++++- fs/afs/rotate.c | 4 ++++ fs/afs/write.c | 1 + net/rxrpc/input.c | 27 +++++++++++++++++++++++++++ 4 files changed, 36 insertions(+), 1 deletion(-)
fs/afs/misc.c +4 -1
@@ -163,8 +163,11 @@ void afs_prioritise_error(struct afs_error *e, int error, u32 abort_code)return ;case -ECONNABORTED : + error =afs_abort_to_error (abort_code); + fallthrough; +case -ENETRESET :/* Responded, but we seem to have changed address */ e->responded = true; - e->error =afs_abort_to_error (abort_code); + e->error = error;return ; } }
fs/afs/rotate.c +4 -0
@@ -292,6 +292,10 @@ bool afs_select_fileserver(struct afs_operation *op) op->error = error; goto iterate_address; +case -ENETRESET : +pr_warn ("kAFS: Peer reset %s (op=%x)\n" , + op->type ? op->type->name :"???" , op->debug_id); + fallthrough;case -ECONNRESET :_debug ("call reset" ); op->error = error;
fs/afs/write.c +1 -0
@@ -638,6 +638,7 @@ static ssize_t afs_write_back_from_locked_folio(struct address_space *mapping,case -EKEYEXPIRED :case -EKEYREJECTED :case -EKEYREVOKED : +case -ENETRESET :afs_redirty_pages (wbc, mapping, start, len);mapping_set_error (mapping, ret);break ;
net/rxrpc/input.c +27 -0
@@ -903,6 +903,33 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) rxrpc_propose_ack_respond_to_ack); } +/* If we get an EXCEEDS_WINDOW ACK from the server, it probably +* indicates that the client address changed due to NAT. The server +* lost the call because it switched to a different peer. +*/ +if (unlikely (buf.ack.reason ==RXRPC_ACK_EXCEEDS_WINDOW ) && + first_soft_ack ==1 && + prev_pkt ==0 && +rxrpc_is_client_call (call)) { +rxrpc_set_call_completion (call,RXRPC_CALL_REMOTELY_ABORTED , +0 , -ENETRESET ); +return ; + } + +/* If we get an OUT_OF_SEQUENCE ACK from the server, that can also +* indicate a change of address. However, we can retransmit the call +* if we still have it buffered to the beginning. +*/ +if (unlikely (buf.ack.reason ==RXRPC_ACK_OUT_OF_SEQUENCE ) && + first_soft_ack ==1 && + prev_pkt ==0 && + call->tx_hard_ack ==0 && +rxrpc_is_client_call (call)) { +rxrpc_set_call_completion (call,RXRPC_CALL_REMOTELY_ABORTED , +0 , -ENETRESET ); +return ; + } +/* Discard any out-of-order or duplicate ACKs (outside lock). */ if (!rxrpc_is_ack_valid (call, first_soft_ack, prev_pkt)) { trace_rxrpc_rx_discard_ack(call->debug_id, ack_serial,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 176/772 eth: tg3: silence the GCC 12 array-bounds warning
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 9dec850fd7c210a04b4707df8e6c95bfafdd6a4b ]
GCC 12 currently generates a rather inconsistent warning:
drivers/net/ethernet/broadcom/tg3.c:17795:51: warning: array subscript 5 is above array bounds of ‘struct tg3_napi[5]’ [-Warray-bounds]
17795 | struct tg3_napi *tnapi = &tp->napi[i];
| ~~~~~~~~^~~
i is guaranteed < tp->irq_max which in turn is either 1 or 5. There are more loops like this one in the driver, but strangely GCC 12 dislikes only this single one.
Silence this silliness for now.
--- drivers/net/ethernet/broadcom/Makefile | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/broadcom/Makefile +5 -0
@@ -17,3 +17,8 @@ obj-$(CONFIG_BGMAC_BCMA) += bgmac-bcma.o bgmac-bcma-mdio.o obj-$(CONFIG_BGMAC_PLATFORM) += bgmac-platform.o obj-$(CONFIG_SYSTEMPORT) += bcmsysport.o obj-$(CONFIG_BNXT) += bnxt/ + +# FIXME: temporarily silence -Warray-bounds on non W=1+ builds +ifndef KBUILD_EXTRA_WARN +CFLAGS_tg3.o += -Wno-array-bounds +endif
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 177/772 char: tpm: cr50_i2c: Suppress duplicated error message in .remove()
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit e0687fe958f763f1790f22ed5483025b7624e744 ]
Returning an error value in an i2c remove callback results in an error message being emitted by the i2c core, but otherwise it doesn't make a difference. The device goes away anyhow and the devm cleanups are called.
As tpm_cr50_i2c_remove() emits an error message already and the additional error message by the i2c core doesn't add any useful information, change the return value to zero to suppress this error message.
Note that if i2c_clientdata is NULL, there is something really fishy. Assuming no memory corruption happened (then all bets are lost anyhow), tpm_cr50_i2c_remove() is only called after tpm_cr50_i2c_probe() returned successfully. So there was a tpm chip registered before and after tpm_cr50_i2c_remove() its privdata is freed but the associated character device isn't removed. If after that happened userspace accesses the character device it's likely that the freed memory is accessed. For that reason the warning message is made a bit more frightening.
--- drivers/char/tpm/tpm_tis_i2c_cr50.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/tpm/tpm_tis_i2c_cr50.c +2 -2
@@ -768,8 +768,8 @@ static int tpm_cr50_i2c_remove(struct i2c_client *client)struct device *dev = &client->dev;if (!chip) { -dev_err (dev,"Could not get client data at remove\n" ); -return -ENODEV ; +dev_crit (dev,"Could not get client data at remove, memory corruption ahead\n" ); +return 0 ; }tpm_chip_unregister (chip);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 179/772 gfs2: use i_lock spin_lock for inode qadata
In reply to Greg Kroah-HartmanFrom: Bob Peterson <[email protected]>
[ Upstream commit 5fcff61eea9efd1f4b60e89d2d686b5feaea100f ]
Before this patch, functions gfs2_qa_get and _put used the i_rw_mutex to prevent simultaneous access to its i_qadata. But i_rw_mutex is now used for many other things, including iomap_begin and end, which causes a conflict according to lockdep. We cannot just remove the lock since simultaneous opens (gfs2_open -> gfs2_open_common -> gfs2_qa_get) can then stomp on each others values for i_qadata.
This patch solves the conflict by using the i_lock spin_lock in the inode to prevent simultaneous access.
--- fs/gfs2/quota.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-)
fs/gfs2/quota.c +20 -12
@@ -531,34 +531,42 @@ static void qdsb_put(struct gfs2_quota_data *qd)*/ int gfs2_qa_get (struct gfs2_inode *ip) { -int error =0 ;struct gfs2_sbd *sdp =GFS2_SB (&ip->i_inode); +struct inode *inode = &ip->i_inode;if (sdp->sd_args.ar_quota ==GFS2_QUOTA_OFF )return 0 ; -down_write (&ip->i_rw_mutex); +spin_lock (&inode->i_lock);if (ip->i_qadata ==NULL ) { - ip->i_qadata =kmem_cache_zalloc (gfs2_qadata_cachep,GFP_NOFS ); -if (!ip->i_qadata) { - error = -ENOMEM ; - goto out; - } +struct gfs2_qadata *tmp; + +spin_unlock (&inode->i_lock); + tmp =kmem_cache_zalloc (gfs2_qadata_cachep,GFP_NOFS ); +if (!tmp) +return -ENOMEM ; + +spin_lock (&inode->i_lock); +if (ip->i_qadata ==NULL ) + ip->i_qadata = tmp; +else +kmem_cache_free (gfs2_qadata_cachep, tmp); } ip->i_qadata->qa_ref++; -out: -up_write (&ip->i_rw_mutex); -return error; +spin_unlock (&inode->i_lock); +return 0 ; }void gfs2_qa_put (struct gfs2_inode *ip) { -down_write (&ip->i_rw_mutex); +struct inode *inode = &ip->i_inode; + +spin_lock (&inode->i_lock);if (ip->i_qadata && --ip->i_qadata->qa_ref ==0 ) {kmem_cache_free (gfs2_qadata_cachep, ip->i_qadata); ip->i_qadata =NULL ; } -up_write (&ip->i_rw_mutex); +spin_unlock (&inode->i_lock); }int gfs2_quota_hold (struct gfs2_inode *ip,kuid_t uid,kgid_t gid)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 178/772 selftests/bpf: fix btf_dump/btf_dump due to recent clang change
In reply to Greg Kroah-HartmanFrom: Yonghong Song <[email protected]>
[ Upstream commit 4050764cbaa25760aab40857f723393c07898474 ]
Latest llvm-project upstream had a change of behavior related to qualifiers on function return type ([1]). This caused selftests btf_dump/btf_dump failure. The following example shows what changed.
$ cat t.c
typedef const char * const (* const (* const fn_ptr_arr2_t[5])())(char * (*)(int));
struct t {
int a;
fn_ptr_arr2_t l;
};
int foo(struct t *arg) {
return arg->a;
}Compiled with latest upstream llvm15,
$ clang -O2 -g -target bpf -S -emit-llvm t.c
The related generated debuginfo IR looks like:
!16 = !DIDerivedType(tag: DW_TAG_typedef, name: "fn_ptr_arr2_t", file: !1, line: 1, baseType: !17)
!17 = !DICompositeType(tag: DW_TAG_array_type, baseType: !18, size: 320, elements: !32)
!18 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !19)
!19 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !20, size: 64)
!20 = !DISubroutineType(types: !21)
!21 = !{!22, null}
!22 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !23, size: 64)
!23 = !DISubroutineType(types: !24)
!24 = !{!25, !28}
!25 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !26, size: 64)
!26 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !27)
!27 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
You can see two intermediate const qualifier to pointer are dropped in debuginfo IR.With llvm14, we have following debuginfo IR:
!16 = !DIDerivedType(tag: DW_TAG_typedef, name: "fn_ptr_arr2_t", file: !1, line: 1, baseType: !17) !17 = !DICompositeType(tag: DW_TAG_array_type, baseType: !18, size: 320, elements: !34) !18 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !19)
!19 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !20, size: 64)
!20 = !DISubroutineType(types: !21)
!21 = !{!22, null}
!22 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !23)
!23 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !24, size: 64)
!24 = !DISubroutineType(types: !25)
!25 = !{!26, !30}
!26 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !27)
!27 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !28, size: 64)
!28 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !29)
!29 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
All const qualifiers are preserved.
To adapt the selftest to both old and new llvm, this patch removed the intermediate const qualifier in const-to-ptr types, to make the test succeed again.
[1] https://reviews.llvm.org/D125919
--- tools/testing/selftests/bpf/progs/btf_dump_test_case_syntax.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/progs/btf_dump_test_case_syntax.c +1 -1
@@ -94,7 +94,7 @@ typedef void (* (*signal_t)(int, void (*)(int)))(int);typedef char * (*fn_ptr_arr1_t [10 ])(int **); -typedef char * (*const (*const fn_ptr_arr2_t [5 ])())(char * (*)(int )); +typedef char * (* (*const fn_ptr_arr2_t [5 ])())(char * (*)(int ));struct struct_w_typedefs {int_t a;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 180/772 scsi: target: tcmu: Avoid holding XArray lock when calling lock_page
In reply to Greg Kroah-HartmanFrom: Bodo Stroesser <[email protected]>
[ Upstream commit 325d5c5fb216674296f3902a8902b942da3adc5b ]
In tcmu_blocks_release(), lock_page() is called to prevent a race causing possible data corruption. Since lock_page() might sleep, calling it while holding XArray lock is a bug.
To fix this, replace the xas_for_each() call with xa_for_each_range(). Since the latter does its own handling of XArray locking, the xas_lock() and xas_unlock() calls around the original loop are no longer necessary.
The switch to xa_for_each_range() slows down the loop slightly. This is acceptable since tcmu_blocks_release() is not relevant for performance.
--- drivers/target/target_core_user.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/target/target_core_user.c +5 -5
@@ -1660,13 +1660,14 @@ static int tcmu_check_and_free_pending_cmd(struct tcmu_cmd *cmd)static u32 tcmu_blocks_release (struct tcmu_dev *udev,unsigned long first,unsigned long last) { -XA_STATE (xas, &udev->data_pages, first * udev->data_pages_per_blk);struct page *page; +unsigned long dpi;u32 pages_freed =0 ; -xas_lock (&xas); -xas_for_each (&xas, page, (last +1 ) * udev->data_pages_per_blk -1 ) { -xas_store (&xas,NULL ); + first = first * udev->data_pages_per_blk; + last = (last +1 ) * udev->data_pages_per_blk -1 ; +xa_for_each_range (&udev->data_pages, dpi, page, first, last) { +xa_erase (&udev->data_pages, dpi);/* * While reaching here there may be page faults occurring on * the to-be-released pages. A race condition may occur if
@@ -1690,7 +1691,6 @@ static u32 tcmu_blocks_release(struct tcmu_dev *udev, unsigned long first,__free_page (page); pages_freed++; } -xas_unlock (&xas);atomic_sub (pages_freed, &global_page_count);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 182/772 IB/rdmavt: add missing locks in rvt_ruc_loopback
In reply to Greg Kroah-HartmanFrom: Niels Dossche <[email protected]>
[ Upstream commit 22cbc6c2681a0a4fe76150270426e763d52353a4 ]
The documentation of the function rvt_error_qp says both r_lock and s_lock need to be held when calling that function.
It also asserts using lockdep that both of those locks are held. rvt_error_qp is called form rvt_send_cq, which is called from rvt_qp_complete_swqe, which is called from rvt_send_complete, which is called from rvt_ruc_loopback in two places. Both of these places do not hold r_lock. Fix this by acquiring a spin_lock of r_lock in both of these places.
The r_lock acquiring cannot be added in rvt_qp_complete_swqe because some of its other callers already have r_lock acquired.
--- drivers/infiniband/sw/rdmavt/qp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/infiniband/sw/rdmavt/qp.c +5 -1
@@ -2775,7 +2775,7 @@ void rvt_qp_iter(struct rvt_dev_info *rdi,EXPORT_SYMBOL (rvt_qp_iter);/* -* This should be called with s_lock held. +* This should be called with s_lock and r_lock held. */ void rvt_send_complete (struct rvt_qp *qp,struct rvt_swqe *wqe,enum ib_wc_status status)
@@ -3134,7 +3134,9 @@ void rvt_ruc_loopback(struct rvt_qp *sqp) rvp->n_loop_pkts++; flush_send: sqp->s_rnr_retry = sqp->s_rnr_retry_cnt; +spin_lock (&sqp->r_lock);rvt_send_complete (sqp, wqe, send_status); +spin_unlock (&sqp->r_lock);if (local_ops) {atomic_dec (&sqp->local_ops_pending); local_ops =0 ;
@@ -3188,7 +3190,9 @@ void rvt_ruc_loopback(struct rvt_qp *sqp)spin_unlock_irqrestore (&qp->r_lock, flags); serr_no_r_lock:spin_lock_irqsave (&sqp->s_lock, flags); +spin_lock (&sqp->r_lock);rvt_send_complete (sqp, wqe, send_status); +spin_unlock (&sqp->r_lock);if (sqp->ibqp.qp_type ==IB_QPT_RC ) {int lastwqe;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 181/772 kunit: fix executor OOM error handling logic on non-UML
In reply to Greg Kroah-HartmanFrom: Daniel Latypov <[email protected]>
[ Upstream commit 1b11063d32d7e11366e48be64215ff517ce32217 ]
The existing logic happens to work fine on UML, but is not correct when running on other arches.
1. We didn't initialize int err, and kunit_filter_suites() doesn't explicitly set it to 0 on success. So we had false "failures".
Note: it doesn't happen on UML, causing this to get overlooked.
2. If we error out, we do not call kunit_handle_shutdown(). This makes kunit.py timeout when using a non-UML arch, since the QEMU process doesn't ever exit.
--- lib/kunit/executor.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
lib/kunit/executor.c +5 -4
@@ -247,13 +247,13 @@ int kunit_run_all_tests(void) .start = __kunit_suites_start, .end = __kunit_suites_end, }; -int err; +int err =0 ;if (filter_glob_param) { suite_set =kunit_filter_suites (&suite_set, filter_glob_param, &err);if (err) {pr_err ("kunit executor: error filtering suites: %d\n" , err); -return err; + goto out; } }
@@ -268,9 +268,10 @@ int kunit_run_all_tests(void)kunit_free_suite_set (suite_set); } -kunit_handle_shutdown (); -return 0 ; +out: +kunit_handle_shutdown (); +return err; }#if IS_BUILTIN (CONFIG_KUNIT_TEST )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 165/772 ASoC: rt1015p: remove dependency on GPIOLIB
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit b390c25c6757b9d56cecdfbf6d55f15fc89a6386 ]
commit dcc2c012c7691 ("ASoC: Fix gpiolib dependencies") removed a series of unnecessary dependencies on GPIOLIB when the gpio was optional.
A similar simplification seems valid for rt1015p, so remove the dependency as well. This will avoid the following warning
WARNING: unmet direct dependencies detected for SND_SOC_RT1015P
Depends on [n]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] &&
GPIOLIB [=n]
Selected by [y]:
- SND_SOC_INTEL_SOF_RT5682_MACH [=y] && SOUND [=y] && !UML && SND
[=y] && SND_SOC [=y] && SND_SOC_INTEL_MACH [=y] &&
(SND_SOC_SOF_HDA_LINK [=y] || SND_SOC_SOF_BAYTRAIL [=n]) && I2C
[=y] && ACPI [=y] && (SND_HDA_CODEC_HDMI [=y] &&
SND_SOC_SOF_HDA_AUDIO_CODEC [=y] && (MFD_INTEL_LPSS [=y] ||
COMPILE_TEST [=y]) || SND_SOC_SOF_BAYTRAIL [=n] &&
(X86_INTEL_LPSS [=n] || COMPILE_TEST [=y]))--- sound/soc/codecs/Kconfig | 1 - 1 file changed, 1 deletion(-)
sound/soc/codecs/Kconfig +0 -1
@@ -1202,7 +1202,6 @@ config SND_SOC_RT1015 config SND_SOC_RT1015P tristate - depends on GPIOLIB config SND_SOC_RT1019 tristate
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 186/772 ARM: dts: s5pv210: align DMA channels with dtschema
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 9e916fb9bc3d16066286f19fc9c51d26a6aec6bd ]
dtschema expects DMA channels in specific order (tx, rx and tx-sec). The order actually should not matter because dma-names is used however let's make it aligned with dtschema to suppress warnings like:
i2s@eee30000: dma-names: ['rx', 'tx', 'tx-sec'] is not valid under any of the given schemas
--- arch/arm/boot/dts/s5pv210-aries.dtsi | 2 +- arch/arm/boot/dts/s5pv210.dtsi | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-)
arch/arm/boot/dts/s5pv210-aries.dtsi +1 -1
@@ -636,7 +636,7 @@ }; &i2s0 { - dmas = <&pdma0 9>, <&pdma0 10>, <&pdma0 11>; + dmas = <&pdma0 10>, <&pdma0 9>, <&pdma0 11>; status = "okay"; };
arch/arm/boot/dts/s5pv210.dtsi +6 -6
@@ -239,8 +239,8 @@ reg = <0xeee30000 0x1000>; interrupt-parent = <&vic2>; interrupts = <16>; - dma-names = "rx", "tx", "tx-sec"; - dmas = <&pdma1 9>, <&pdma1 10>, <&pdma1 11>; + dma-names = "tx", "rx", "tx-sec"; + dmas = <&pdma1 10>, <&pdma1 9>, <&pdma1 11>; clock-names = "iis", "i2s_opclk0", "i2s_opclk1";
@@ -259,8 +259,8 @@ reg = <0xe2100000 0x1000>; interrupt-parent = <&vic2>; interrupts = <17>; - dma-names = "rx", "tx"; - dmas = <&pdma1 12>, <&pdma1 13>; + dma-names = "tx", "rx"; + dmas = <&pdma1 13>, <&pdma1 12>; clock-names = "iis", "i2s_opclk0"; clocks = <&clocks CLK_I2S1>, <&clocks SCLK_AUDIO1>; pinctrl-names = "default";
@@ -274,8 +274,8 @@ reg = <0xe2a00000 0x1000>; interrupt-parent = <&vic2>; interrupts = <18>; - dma-names = "rx", "tx"; - dmas = <&pdma1 14>, <&pdma1 15>; + dma-names = "tx", "rx"; + dmas = <&pdma1 15>, <&pdma1 14>; clock-names = "iis", "i2s_opclk0"; clocks = <&clocks CLK_I2S2>, <&clocks SCLK_AUDIO2>; pinctrl-names = "default";
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 183/772 PCI/ASPM: Make Intel DG2 L1 acceptable latency unlimited
In reply to Greg Kroah-HartmanFrom: Mika Westerberg <[email protected]>
[ Upstream commit 03038d84ace72678a9944524508f218a00377dc0 ]
Intel DG2 discrete graphics PCIe endpoints advertise L1 acceptable exit latency to be < 1us even though they can actually tolerate unlimited exit latencies just fine. Quirk the L1 acceptable exit latency for these endpoints to be unlimited so ASPM L1 can be enabled.
--- drivers/pci/quirks.c | 47 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+)
drivers/pci/quirks.c +47 -0
@@ -12,6 +12,7 @@* file, where their drivers can use them. */ +#include <linux/bitfield.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/export.h>
@@ -5895,3 +5896,49 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x1533, rom_bar_overlap_defect);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x1536 , rom_bar_overlap_defect);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x1537 , rom_bar_overlap_defect);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x1538 , rom_bar_overlap_defect); + +#ifdef CONFIG_PCIEASPM +/* +* Several Intel DG2 graphics devices advertise that they can only tolerate +* 1us latency when transitioning from L1 to L0, which may prevent ASPM L1 +* from being enabled. But in fact these devices can tolerate unlimited +* latency. Override their Device Capabilities value to allow ASPM L1 to +* be enabled. +*/ +static void aspm_l1_acceptable_latency (struct pci_dev *dev) +{ +u32 l1_lat =FIELD_GET (PCI_EXP_DEVCAP_L1 , dev->devcap); + +if (l1_lat <7 ) { + dev->devcap |=FIELD_PREP (PCI_EXP_DEVCAP_L1 ,7 ); +pci_info (dev,"ASPM: overriding L1 acceptable latency from %#x to 0x7\n" , + l1_lat); + } +} +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x4f80 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x4f81 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x4f82 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x4f83 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x4f84 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x4f85 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x4f86 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x4f87 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x4f88 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x5690 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x5691 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x5692 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x5693 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x5694 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x5695 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x56a0 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x56a1 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x56a2 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x56a3 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x56a4 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x56a5 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x56a6 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x56b0 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x56b1 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x56c0 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x56c1 , aspm_l1_acceptable_latency); +#endif
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 184/772 ARM: dts: ox820: align interrupt controller node name with dtschema
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit fbcd5ad7a419ad40644a0bb8b4152bc660172d8a ]
Fixes dtbs_check warnings like:
gic@1000: $nodename:0: 'gic@1000' does not match '^interrupt-controller(@[0-9a-f,]+)*$'
--- arch/arm/boot/dts/ox820.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/ox820.dtsi +1 -1
@@ -287,7 +287,7 @@ clocks = <&armclk>; }; - gic: gic@1000 { + gic: interrupt-controller@1000 { compatible = "arm,arm11mp-gic"; interrupt-controller; #interrupt-cells = <3>;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 185/772 ARM: dts: socfpga: align interrupt controller node name with dtschema
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit c9bdd50d2019f78bf4c1f6a79254c27771901023 ]
Fixes dtbs_check warnings like:
$nodename:0: 'intc@fffed000' does not match '^interrupt-controller(@[0-9a-f,]+)*$'
--- arch/arm/boot/dts/socfpga.dtsi | 2 +- arch/arm/boot/dts/socfpga_arria10.dtsi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/socfpga.dtsi +1 -1
@@ -46,7 +46,7 @@ <0xff113000 0x1000>; }; - intc: intc@fffed000 { + intc: interrupt-controller@fffed000 { compatible = "arm,cortex-a9-gic"; #interrupt-cells = <3>; interrupt-controller;
arch/arm/boot/dts/socfpga_arria10.dtsi +1 -1
@@ -38,7 +38,7 @@ <0xff113000 0x1000>; }; - intc: intc@ffffd000 { + intc: interrupt-controller@ffffd000 { compatible = "arm,cortex-a9-gic"; #interrupt-cells = <3>; interrupt-controller;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 188/772 arm64: dts: qcom: msm8994: Fix the cont_splash_mem address
In reply to Greg Kroah-HartmanFrom: Konrad Dybcio <[email protected]>
[ Upstream commit 049c46f31a726bf8d202ff1681661513447fac84 ]
The default memory map places cont_splash_mem at 3401000, which was overlooked.. Fix it!
--- arch/arm64/boot/dts/qcom/msm8994.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/msm8994.dtsi +2 -2
@@ -183,8 +183,8 @@ no-map; }; - cont_splash_mem: memory@3800000 { - reg = <0 0x03800000 0 0x2400000>; + cont_splash_mem: memory@3401000 { + reg = <0 0x03401000 0 0x2200000>; no-map; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 190/772 PM / devfreq: rk3399_dmc: Disable edev on remove()
In reply to Greg Kroah-HartmanFrom: Brian Norris <[email protected]>
[ Upstream commit 2fccf9e6050e0e3b8b4cd275d41daf7f7fa22804 ]
Otherwise we hit an unablanced enable-count when unbinding the DFI device:
[ 1279.659119] ------------[ cut here ]------------ [ 1279.659179] WARNING: CPU: 2 PID: 5638 at drivers/devfreq/devfreq-event.c:360 devfreq_event_remove_edev+0x84/0x8c ... [ 1279.659352] Hardware name: Google Kevin (DT) [ 1279.659363] pstate: 80400005 (Nzcv daif +PAN -UAO -TCO BTYPE=--) [ 1279.659371] pc : devfreq_event_remove_edev+0x84/0x8c [ 1279.659380] lr : devm_devfreq_event_release+0x1c/0x28 ... [ 1279.659571] Call trace: [ 1279.659582] devfreq_event_remove_edev+0x84/0x8c [ 1279.659590] devm_devfreq_event_release+0x1c/0x28 [ 1279.659602] release_nodes+0x1cc/0x244 [ 1279.659611] devres_release_all+0x44/0x60 [ 1279.659621] device_release_driver_internal+0x11c/0x1ac [ 1279.659629] device_driver_detach+0x20/0x2c [ 1279.659641] unbind_store+0x7c/0xb0 [ 1279.659650] drv_attr_store+0x2c/0x40 [ 1279.659663] sysfs_kf_write+0x44/0x58 [ 1279.659672] kernfs_fop_write_iter+0xf4/0x190 [ 1279.659684] vfs_write+0x2b0/0x2e4 [ 1279.659693] ksys_write+0x80/0xec [ 1279.659701] __arm64_sys_write+0x24/0x30 [ 1279.659714] el0_svc_common+0xf0/0x1d8 [ 1279.659724] do_el0_svc_compat+0x28/0x3c [ 1279.659738] el0_svc_compat+0x10/0x1c [ 1279.659746] el0_sync_compat_handler+0xa8/0xcc [ 1279.659758] el0_sync_compat+0x188/0x1c0 [ 1279.659768] ---[ end trace cec200e5094155b4 ]---
--- drivers/devfreq/rk3399_dmc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/devfreq/rk3399_dmc.c +2 -0
@@ -477,6 +477,8 @@ static int rk3399_dmcfreq_remove(struct platform_device *pdev) {struct rk3399_dmcfreq *dmcfreq =dev_get_drvdata (&pdev->dev); +devfreq_event_disable_edev (dmcfreq->edev); +/* * Before remove the opp table we need to unregister the opp notifier. */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 193/772 soc: ti: ti_sci_pm_domains: Check for null return of devm_kcalloc
In reply to Greg Kroah-HartmanFrom: QintaoShen <[email protected]>
[ Upstream commit ba56291e297d28aa6eb82c5c1964fae2d7594746 ]
The allocation funciton devm_kcalloc may fail and return a null pointer, which would cause a null-pointer dereference later.
It might be better to check it and directly return -ENOMEM just like the usage of devm_kcalloc in previous code.
--- drivers/soc/ti/ti_sci_pm_domains.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/soc/ti/ti_sci_pm_domains.c +2 -0
@@ -183,6 +183,8 @@ static int ti_sci_pm_domain_probe(struct platform_device *pdev)devm_kcalloc (dev, max_id +1 ,sizeof (*pd_provider->data.domains),GFP_KERNEL ); +if (!pd_provider->data.domains) +return -ENOMEM ; pd_provider->data.num_domains = max_id +1 ; pd_provider->data.xlate = ti_sci_pd_xlate;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 187/772 ASoC: amd: Add driver data to acp6x machine driver
In reply to Greg Kroah-HartmanFrom: Mario Limonciello <[email protected]>
[ Upstream commit e521f087780d07731e8c950f2f34d08358c86bc9 ]
Currently all of the quirked systems use the same card and so the DMI quirk list doesn't contain driver data.
Add driver data to these quirks and then check the data was present or not. This will allow potentially setting quirks for systems with faulty firmware that claims to have a DMIC but doesn't really.
--- sound/soc/amd/yc/acp6x-mach.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-)
sound/soc/amd/yc/acp6x-mach.c +25 -4
@@ -45,108 +45,126 @@ static struct snd_soc_card acp6x_card = {static const struct dmi_system_id yc_acp_quirk_table[] = { { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21D2" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21D3" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21D4" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21D5" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21CF" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21CG" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21CQ" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21CR" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21AW" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21AX" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21BN" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21BQ" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21CH" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21CJ" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21CK" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21CL" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21D8" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21D9" ),
@@ -157,18 +175,21 @@ static const struct dmi_system_id yc_acp_quirk_table[] = {static int acp6x_probe (struct platform_device *pdev) { +const struct dmi_system_id *dmi_id;struct acp6x_pdm *machine =NULL ;struct snd_soc_card *card;int ret; -const struct dmi_system_id *dmi_id; +/* check for any DMI overrides */ dmi_id =dmi_first_match (yc_acp_quirk_table); -if (!dmi_id) +if (dmi_id) +platform_set_drvdata (pdev, dmi_id->driver_data); + + card =platform_get_drvdata (pdev); +if (!card)return -ENODEV ; - card = &acp6x_card; acp6x_card.dev = &pdev->dev; -platform_set_drvdata (pdev, card);snd_soc_card_set_drvdata (card, machine); ret =devm_snd_soc_register_card (&pdev->dev, card);if (ret) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 189/772 arm64: dts: qcom: msm8994: Fix BLSP[12]_DMA channels count
In reply to Greg Kroah-HartmanFrom: Konrad Dybcio <[email protected]>
[ Upstream commit 1ae438d26b620979ed004d559c304d31c42173ae ]
MSM8994 actually features 24 DMA channels for each BLSP, fix it!
--- arch/arm64/boot/dts/qcom/msm8994.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/msm8994.dtsi +2 -2
@@ -498,7 +498,7 @@ #dma-cells = <1>; qcom,ee = <0>; qcom,controlled-remotely; - num-channels = <18>; + num-channels = <24>; qcom,num-ees = <4>; };
@@ -634,7 +634,7 @@ #dma-cells = <1>; qcom,ee = <0>; qcom,controlled-remotely; - num-channels = <18>; + num-channels = <24>; qcom,num-ees = <4>; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 192/772 crypto: qat - fix off-by-one error in PFVF debug print
In reply to Greg Kroah-HartmanFrom: Marco Chiappero <[email protected]>
[ Upstream commit dd3d081b7ea6754913222ed0313fcf644edcc7e6 ]
PFVF Block Message requests for CRC use 0-based values to indicate amounts, which have to be remapped to 1-based values on the receiving side.
This patch fixes one debug print which was however using the wire value.
--- drivers/crypto/qat/qat_common/adf_pfvf_pf_proto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/qat/qat_common/adf_pfvf_pf_proto.c +1 -1
@@ -154,7 +154,7 @@ static struct pfvf_message handle_blkmsg_req(struct adf_accel_vf_info *vf_info, if (FIELD_GET(ADF_VF2PF_BLOCK_CRC_REQ_MASK, req.data)) { dev_dbg(&GET_DEV(vf_info->accel_dev), "BlockMsg of type %d for CRC over %d bytes received from VF%d\n", - blk_type, blk_byte, vf_info->vf_nr); + blk_type, blk_byte + 1, vf_info->vf_nr); if (!adf_pf2vf_blkmsg_get_data(vf_info, blk_type, blk_byte, byte_max, &resp_data,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 191/772 crypto: ccree - use fine grained DMA mapping dir
In reply to Greg Kroah-HartmanFrom: Gilad Ben-Yossef <[email protected]>
[ Upstream commit a260436c98171cd825955a84a7f6e62bc8f4f00d ]
Use a fine grained specification of DMA mapping directions in certain cases, allowing both a more optimized operation as well as shushing out a harmless, though persky dma-debug warning.
--- drivers/crypto/ccree/cc_buffer_mgr.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-)
drivers/crypto/ccree/cc_buffer_mgr.c +15 -12
@@ -356,12 +356,14 @@ void cc_unmap_cipher_request(struct device *dev, void *ctx, req_ctx->mlli_params.mlli_dma_addr); } -dma_unmap_sg (dev, src, req_ctx->in_nents,DMA_BIDIRECTIONAL ); -dev_dbg (dev,"Unmapped req->src=%pK\n" ,sg_virt (src)); -if (src != dst) { -dma_unmap_sg (dev, dst, req_ctx->out_nents,DMA_BIDIRECTIONAL ); +dma_unmap_sg (dev, src, req_ctx->in_nents,DMA_TO_DEVICE ); +dma_unmap_sg (dev, dst, req_ctx->out_nents,DMA_FROM_DEVICE );dev_dbg (dev,"Unmapped req->dst=%pK\n" ,sg_virt (dst)); +dev_dbg (dev,"Unmapped req->src=%pK\n" ,sg_virt (src)); + }else { +dma_unmap_sg (dev, src, req_ctx->in_nents,DMA_BIDIRECTIONAL ); +dev_dbg (dev,"Unmapped req->src=%pK\n" ,sg_virt (src)); } }
@@ -377,6 +379,7 @@ int cc_map_cipher_request(struct cc_drvdata *drvdata, void *ctx,u32 dummy =0 ;int rc =0 ;u32 mapped_nents =0 ; +int src_direction = (src != dst ?DMA_TO_DEVICE :DMA_BIDIRECTIONAL ); req_ctx->dma_buf_type =CC_DMA_BUF_DLLI ; mlli_params->curr_pool =NULL ;
@@ -399,7 +402,7 @@ int cc_map_cipher_request(struct cc_drvdata *drvdata, void *ctx, }/* Map the src SGL */ - rc =cc_map_sg (dev, src, nbytes,DMA_BIDIRECTIONAL , &req_ctx->in_nents, + rc =cc_map_sg (dev, src, nbytes, src_direction, &req_ctx->in_nents,LLI_MAX_NUM_OF_DATA_ENTRIES , &dummy, &mapped_nents);if (rc) goto cipher_exit;
@@ -416,7 +419,7 @@ int cc_map_cipher_request(struct cc_drvdata *drvdata, void *ctx, } }else {/* Map the dst sg */ - rc =cc_map_sg (dev, dst, nbytes,DMA_BIDIRECTIONAL , + rc =cc_map_sg (dev, dst, nbytes,DMA_FROM_DEVICE , &req_ctx->out_nents,LLI_MAX_NUM_OF_DATA_ENTRIES , &dummy, &mapped_nents);if (rc)
@@ -456,6 +459,7 @@ void cc_unmap_aead_request(struct device *dev, struct aead_request *req)struct aead_req_ctx *areq_ctx =aead_request_ctx (req);unsigned int hw_iv_size = areq_ctx->hw_iv_size;struct cc_drvdata *drvdata =dev_get_drvdata (dev); +int src_direction = (req->src != req->dst ?DMA_TO_DEVICE :DMA_BIDIRECTIONAL );if (areq_ctx->mac_buf_dma_addr) { dma_unmap_single(dev, areq_ctx->mac_buf_dma_addr,
@@ -514,13 +518,11 @@ void cc_unmap_aead_request(struct device *dev, struct aead_request *req)sg_virt (req->src), areq_ctx->src.nents, areq_ctx->assoc.nents, areq_ctx->assoclen, req->cryptlen); -dma_unmap_sg (dev, req->src, areq_ctx->src.mapped_nents, -DMA_BIDIRECTIONAL ); +dma_unmap_sg (dev, req->src, areq_ctx->src.mapped_nents, src_direction);if (req->src != req->dst) {dev_dbg (dev,"Unmapping dst sgl: req->dst=%pK\n" ,sg_virt (req->dst)); -dma_unmap_sg (dev, req->dst, areq_ctx->dst.mapped_nents, -DMA_BIDIRECTIONAL ); +dma_unmap_sg (dev, req->dst, areq_ctx->dst.mapped_nents,DMA_FROM_DEVICE ); } if (drvdata->coherent && areq_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_DECRYPT &&
@@ -843,7 +845,7 @@ static int cc_aead_chain_data(struct cc_drvdata *drvdata,else size_for_map -= authsize; - rc =cc_map_sg (dev, req->dst, size_for_map,DMA_BIDIRECTIONAL , + rc =cc_map_sg (dev, req->dst, size_for_map,DMA_FROM_DEVICE , &areq_ctx->dst.mapped_nents,LLI_MAX_NUM_OF_DATA_ENTRIES , &dst_last_bytes, &dst_mapped_nents);
@@ -1056,7 +1058,8 @@ int cc_map_aead_request(struct cc_drvdata *drvdata, struct aead_request *req) size_to_map += authsize; } - rc = cc_map_sg(dev, req->src, size_to_map, DMA_BIDIRECTIONAL, + rc = cc_map_sg(dev, req->src, size_to_map, + (req->src != req->dst ? DMA_TO_DEVICE : DMA_BIDIRECTIONAL), &areq_ctx->src.mapped_nents, (LLI_MAX_NUM_OF_ASSOC_DATA_ENTRIES + LLI_MAX_NUM_OF_DATA_ENTRIES),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 194/772 fs: jfs: fix possible NULL pointer dereference in dbFree()
In reply to Greg Kroah-HartmanFrom: Zixuan Fu <[email protected]>
[ Upstream commit 0d4837fdb796f99369cf7691d33de1b856bcaf1f ]
In our fault-injection testing, the variable "nblocks" in dbFree() can be zero when kmalloc_array() fails in dtSearch(). In this case, the variable
"mp" in dbFree() would be NULL and then it is dereferenced in
"write_metapage(mp)".
The failure log is listed as follows:
[ 13.824137] BUG: kernel NULL pointer dereference, address: 0000000000000020 ... [ 13.827416] RIP: 0010:dbFree+0x5f7/0x910 [jfs] [ 13.834341] Call Trace: [ 13.834540] <TASK> [ 13.834713] txFreeMap+0x7b4/0xb10 [jfs] [ 13.835038] txUpdateMap+0x311/0x650 [jfs] [ 13.835375] jfs_lazycommit+0x5f2/0xc70 [jfs] [ 13.835726] ? sched_dynamic_update+0x1b0/0x1b0 [ 13.836092] kthread+0x3c2/0x4a0 [ 13.836355] ? txLockFree+0x160/0x160 [jfs] [ 13.836763] ? kthread_unuse_mm+0x160/0x160 [ 13.837106] ret_from_fork+0x1f/0x30 [ 13.837402] </TASK>
...
This patch adds a NULL check of "mp" before "write_metapage(mp)" is called.
--- fs/jfs/jfs_dmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/jfs/jfs_dmap.c +2 -1
@@ -385,7 +385,8 @@ int dbFree(struct inode *ip, s64 blkno, s64 nblocks) }/* write the last buffer. */ -write_metapage (mp); +if (mp) +write_metapage (mp);IREAD_UNLOCK (ipbmap);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 197/772 ALSA: usb-audio: Move generic implicit fb quirk entries into quirks.c
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 67d64069bc0867e52e73a1e255b17462005ca9b4 ]
Use the new quirk bits to manage the generic implicit fb quirk entries. This makes easier to compare with other devices.
--- sound/usb/implicit.c | 5 ----- sound/usb/quirks.c | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-)
sound/usb/implicit.c +0 -5
@@ -45,11 +45,6 @@ struct snd_usb_implicit_fb_match {/* Implicit feedback quirk table for playback */ static const struct snd_usb_implicit_fb_match playback_implicit_fb_quirks[] = { -/* Generic matching */ -IMPLICIT_FB_GENERIC_DEV (0x0499 ,0x1509 ),/* Steinberg UR22 */ -IMPLICIT_FB_GENERIC_DEV (0x0763 ,0x2030 ),/* M-Audio Fast Track C400 */ -IMPLICIT_FB_GENERIC_DEV (0x0763 ,0x2031 ),/* M-Audio Fast Track C600 */ -/* Fixed EP */ /* FIXME: check the availability of generic matching */ IMPLICIT_FB_FIXED_DEV (0x0763 ,0x2080 ,0x81 ,2 ),/* M-Audio FastTrack Ultra */
sound/usb/quirks.c +6 -0
@@ -1793,6 +1793,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { QUIRK_FLAG_CTL_MSG_DELAY_1M | QUIRK_FLAG_IGNORE_CTL_ERROR),DEVICE_FLG (0x046d ,0x09a4 ,/* Logitech QuickCam E 3500 */ QUIRK_FLAG_CTL_MSG_DELAY_1M |QUIRK_FLAG_IGNORE_CTL_ERROR ), +DEVICE_FLG (0x0499 ,0x1509 ,/* Steinberg UR22 */ +QUIRK_FLAG_GENERIC_IMPLICIT_FB ),DEVICE_FLG (0x04d8 ,0xfeea ,/* Benchmark DAC1 Pre */ QUIRK_FLAG_GET_SAMPLE_RATE ), DEVICE_FLG(0x04e8, 0xa051, /* Samsung USBC Headset (AKG) */
@@ -1826,6 +1828,10 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { QUIRK_FLAG_GET_SAMPLE_RATE),DEVICE_FLG (0x074d ,0x3553 ,/* Outlaw RR2150 (Micronas UAC3553B) */ QUIRK_FLAG_GET_SAMPLE_RATE ), +DEVICE_FLG (0x0763 ,0x2030 ,/* M-Audio Fast Track C400 */ +QUIRK_FLAG_GENERIC_IMPLICIT_FB ), +DEVICE_FLG (0x0763 ,0x2031 ,/* M-Audio Fast Track C600 */ +QUIRK_FLAG_GENERIC_IMPLICIT_FB ),DEVICE_FLG (0x08bb ,0x2702 ,/* LineX FM Transmitter */ QUIRK_FLAG_IGNORE_CTL_ERROR ), DEVICE_FLG(0x0951, 0x16ad, /* Kingston HyperX */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 196/772 ALSA: usb-audio: Add quirk bits for enabling/disabling generic implicit fb
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 0f1f7a6661394fe4a53db254c346d6aa2dd64397 ]
For making easier to test, add the new quirk_flags bits 17 and 18 to enable and disable the generic implicit feedback mode. The bit 17 is equivalent with implicit_fb=1 option, applying the generic implicit feedback sync mode. OTOH, the bit 18 disables the implicit fb mode forcibly.
--- Documentation/sound/alsa-configuration.rst | 4 +++- sound/usb/implicit.c | 5 ++++- sound/usb/usbaudio.h | 6 ++++++ 3 files changed, 13 insertions(+), 2 deletions(-)
Documentation/sound/alsa-configuration.rst +3 -1
@@ -2246,7 +2246,7 @@ implicit_fb Apply the generic implicit feedback sync mode. When this is set and the playback stream sync mode is ASYNC, the driver tries to tie an adjacent ASYNC capture stream as the implicit feedback - source. + source. This is equivalent with quirk_flags bit 17. use_vmalloc Use vmalloc() for allocations of the PCM buffers (default: yes). For architectures with non-coherent memory like ARM or MIPS, the
@@ -2288,6 +2288,8 @@ quirk_flags * bit 14: Ignore errors for mixer access * bit 15: Support generic DSD raw U32_BE format * bit 16: Set up the interface at first like UAC1 + * bit 17: Apply the generic implicit feedback sync mode + * bit 18: Don't apply implicit feedback sync mode This module supports multiple devices, autoprobe and hotplugging.
sound/usb/implicit.c +4 -1
@@ -350,7 +350,8 @@ static int audioformat_implicit_fb_quirk(struct snd_usb_audio *chip, }/* Try the generic implicit fb if available */ -if (chip->generic_implicit_fb) +if (chip->generic_implicit_fb || + (chip->quirk_flags &QUIRK_FLAG_GENERIC_IMPLICIT_FB ))return add_generic_implicit_fb (chip, fmt, alts);/* No quirk */
@@ -387,6 +388,8 @@ int snd_usb_parse_implicit_fb_quirk(struct snd_usb_audio *chip, struct audioformat *fmt, struct usb_host_interface *alts) { +if (chip->quirk_flags &QUIRK_FLAG_SKIP_IMPLICIT_FB ) +return 0 ;if (fmt->endpoint &USB_DIR_IN )return audioformat_capture_quirk (chip, fmt, alts);else
sound/usb/usbaudio.h +6 -0
@@ -164,6 +164,10 @@ extern bool snd_usb_skip_validation;* Support generic DSD raw U32_BE format * QUIRK_FLAG_SET_IFACE_FIRST: * Set up the interface at first like UAC1 +* QUIRK_FLAG_GENERIC_IMPLICIT_FB +* Apply the generic implicit feedback sync mode (same as implicit_fb=1 option) +* QUIRK_FLAG_SKIP_IMPLICIT_FB +* Don't apply implicit feedback sync mode */ #define QUIRK_FLAG_GET_SAMPLE_RATE (1U << 0)
@@ -183,5 +187,7 @@ extern bool snd_usb_skip_validation;#define QUIRK_FLAG_IGNORE_CTL_ERROR (1U << 14)#define QUIRK_FLAG_DSD_RAW (1U << 15)#define QUIRK_FLAG_SET_IFACE_FIRST (1U << 16) +#define QUIRK_FLAG_GENERIC_IMPLICIT_FB (1U << 17) +#define QUIRK_FLAG_SKIP_IMPLICIT_FB (1U << 18)#endif /* __USBAUDIO_H */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 166/772 ACPI: CPPC: Assume no transition latency if no PCCT
In reply to Greg Kroah-HartmanFrom: Pierre Gondois <[email protected]>
[ Upstream commit 6380b7b2b29da9d9c5ab2d4a265901cd93ba3696 ]
The transition_delay_us (struct cpufreq_policy) is currently defined as:
Preferred average time interval between consecutive invocations of the driver to set the frequency for this policy. To be set by the scaling driver (0, which is the default, means no preference).
The transition_latency represents the amount of time necessary for a CPU to change its frequency.
A PCCT table advertises mutliple values:
- pcc_nominal: Expected latency to process a command, in microseconds
- pcc_mpar: The maximum number of periodic requests that the subspace channel can support, reported in commands per minute. 0 indicates no limitation.
- pcc_mrtt: The minimum amount of time that OSPM must wait after the completion of a command before issuing the next command, in microseconds.cppc_get_transition_latency() allows to get the max of them.
commit d4f3388afd48 ("cpufreq / CPPC: Set platform specific transition_delay_us") allows to select transition_delay_us based on the platform, and fallbacks to cppc_get_transition_latency() otherwise.
If _CPC objects are not using PCC channels (no PPCT table), the transition_delay_us is set to CPUFREQ_ETERNAL, leading to really long periods between frequency updates (~4s).
If the desired_reg, where performance requests are written, is in SystemMemory or SystemIo ACPI address space, there is no delay in requests. So return 0 instead of CPUFREQ_ETERNAL, leading to transition_delay_us being set to LATENCY_MULTIPLIER us (1000 us).
This patch also adds two macros to check the address spaces.
--- drivers/acpi/cppc_acpi.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/acpi/cppc_acpi.c +16 -1
@@ -100,6 +100,16 @@ static DEFINE_PER_CPU(struct cpc_desc *, cpc_desc_ptr); (cpc)->cpc_entry.reg.space_id == \ ACPI_ADR_SPACE_PLATFORM_COMM) +/* Check if a CPC register is in SystemMemory */ +#define CPC_IN_SYSTEM_MEMORY (cpc) ((cpc)->type == ACPI_TYPE_BUFFER && \ + (cpc)->cpc_entry.reg.space_id == \ + ACPI_ADR_SPACE_SYSTEM_MEMORY) + +/* Check if a CPC register is in SystemIo */ +#define CPC_IN_SYSTEM_IO (cpc) ((cpc)->type == ACPI_TYPE_BUFFER && \ + (cpc)->cpc_entry.reg.space_id == \ + ACPI_ADR_SPACE_SYSTEM_IO) +/* Evaluates to True if reg is a NULL register descriptor */ #define IS_NULL_REG (reg) ((reg)->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY && \ (reg)->address == 0 && \
@@ -1441,6 +1451,9 @@ EXPORT_SYMBOL_GPL(cppc_set_perf);* transition latency for performance change requests. The closest we have * is the timing information from the PCCT tables which provides the info * on the number and frequency of PCC commands the platform can handle. +* +* If desired_reg is in the SystemMemory or SystemIo ACPI address space, +* then assume there is no latency. */ unsigned int cppc_get_transition_latency (int cpu_num) {
@@ -1466,7 +1479,9 @@ unsigned int cppc_get_transition_latency(int cpu_num)return CPUFREQ_ETERNAL ; desired_reg = &cpc_desc->cpc_regs[DESIRED_PERF ]; -if (!CPC_IN_PCC (desired_reg)) +if (CPC_IN_SYSTEM_MEMORY (desired_reg) ||CPC_IN_SYSTEM_IO (desired_reg)) +return 0 ; +else if (!CPC_IN_PCC (desired_reg))return CPUFREQ_ETERNAL ;if (pcc_ss_id <0 )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 195/772 arm64: dts: qcom: sdm845-xiaomi-beryllium: fix typo in panels vddio-supply property
In reply to Greg Kroah-HartmanFrom: Joel Selvaraj <[email protected]>
[ Upstream commit 1f1c494082a1f10d03ce4ee1485ee96d212e22ff ]
vddio is misspelled with a "0" instead of "o". Fix it.
--- arch/arm64/boot/dts/qcom/sdm845-xiaomi-beryllium.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sdm845-xiaomi-beryllium.dts +1 -1
@@ -218,7 +218,7 @@ panel@0 { compatible = "tianma,fhd-video"; reg = <0>; - vddi0-supply = <&vreg_l14a_1p8>; + vddio-supply = <&vreg_l14a_1p8>; vddpos-supply = <&lab>; vddneg-supply = <&ibb>;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 200/772 fat: add ratelimit to fat*_ent_bread()
In reply to Greg Kroah-HartmanFrom: OGAWA Hirofumi <[email protected]>
[ Upstream commit 183c3237c928109d2008c0456dff508baf692b20 ]
fat*_ent_bread() can be the cause of too many report on I/O error path. So use fat_msg_ratelimit() instead.
--- fs/fat/fatent.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
fs/fat/fatent.c +4 -3
@@ -94,7 +94,8 @@ static int fat12_ent_bread(struct super_block *sb, struct fat_entry *fatent, err_brelse:brelse (bhs[0 ]); err: -fat_msg (sb,KERN_ERR ,"FAT read failed (blocknr %llu)" , (llu )blocknr); +fat_msg_ratelimit (sb,KERN_ERR ,"FAT read failed (blocknr %llu)" , + (llu )blocknr);return -EIO ; }
@@ -107,8 +108,8 @@ static int fat_ent_bread(struct super_block *sb, struct fat_entry *fatent, fatent->fat_inode =MSDOS_SB (sb)->fat_inode; fatent->bhs[0 ] =sb_bread (sb, blocknr);if (!fatent->bhs[0 ]) { -fat_msg (sb,KERN_ERR ,"FAT read failed (blocknr %llu)" , - (llu )blocknr); +fat_msg_ratelimit (sb,KERN_ERR ,"FAT read failed (blocknr %llu)" , + (llu )blocknr);return -EIO ; } fatent->nr_bhs =1 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 199/772 powerpc/fadump: Fix fadump to work with a different endian capture kernel
In reply to Greg Kroah-HartmanFrom: Hari Bathini <[email protected]>
[ Upstream commit b74196af372f7cb4902179009265fe63ac81824f ]
Dump capture would fail if capture kernel is not of the endianess as the production kernel, because the in-memory data structure (struct opal_fadump_mem_struct) shared across production kernel and capture kernel assumes the same endianess for both the kernels, which doesn't have to be true always. Fix it by having a well-defined endianess for struct opal_fadump_mem_struct.
--- arch/powerpc/platforms/powernv/opal-fadump.c | 94 +++++++++++--------- arch/powerpc/platforms/powernv/opal-fadump.h | 10 +-- 2 files changed, 57 insertions(+), 47 deletions(-)
arch/powerpc/platforms/powernv/opal-fadump.c +52 -42
@@ -60,7 +60,7 @@ void __init opal_fadump_dt_scan(struct fw_dump *fadump_conf, u64 node) addr =be64_to_cpu (addr);pr_debug ("Kernel metadata addr: %llx\n" , addr); opal_fdm_active = (void *)addr; -if (opal_fdm_active->registered_regions ==0 ) +if (be16_to_cpu (opal_fdm_active->registered_regions) ==0 )return ; ret =opal_mpipl_query_tag (OPAL_MPIPL_TAG_BOOT_MEM , &addr);
@@ -95,17 +95,17 @@ static int opal_fadump_unregister(struct fw_dump *fadump_conf);static void opal_fadump_update_config (struct fw_dump *fadump_conf,const struct opal_fadump_mem_struct *fdm) { -pr_debug ("Boot memory regions count: %d\n" , fdm->region_cnt); +pr_debug ("Boot memory regions count: %d\n" ,be16_to_cpu (fdm->region_cnt));/* * The destination address of the first boot memory region is the * destination address of boot memory regions. */ - fadump_conf->boot_mem_dest_addr = fdm->rgn[0 ].dest; + fadump_conf->boot_mem_dest_addr =be64_to_cpu (fdm->rgn[0 ].dest);pr_debug ("Destination address of boot memory regions: %#016llx\n" , fadump_conf->boot_mem_dest_addr); - fadump_conf->fadumphdr_addr = fdm->fadumphdr_addr; + fadump_conf->fadumphdr_addr =be64_to_cpu (fdm->fadumphdr_addr); }/*
@@ -126,9 +126,9 @@ static void __init opal_fadump_get_config(struct fw_dump *fadump_conf, fadump_conf->boot_memory_size =0 ;pr_debug ("Boot memory regions:\n" ); -for (i =0 ; i < fdm->region_cnt; i++) { - base = fdm->rgn[i].src; - size = fdm->rgn[i].size; +for (i =0 ; i <be16_to_cpu (fdm->region_cnt); i++) { + base =be64_to_cpu (fdm->rgn[i].src); + size =be64_to_cpu (fdm->rgn[i].size);pr_debug ("\t[%03d] base: 0x%lx, size: 0x%lx\n" , i, base, size); fadump_conf->boot_mem_addr[i] = base;
@@ -143,7 +143,7 @@ static void __init opal_fadump_get_config(struct fw_dump *fadump_conf,* Start address of reserve dump area (permanent reservation) for * re-registering FADump after dump capture. */ - fadump_conf->reserve_dump_area_start = fdm->rgn[0 ].dest; + fadump_conf->reserve_dump_area_start =be64_to_cpu (fdm->rgn[0 ].dest);/* * Rarely, but it can so happen that system crashes before all
@@ -155,13 +155,14 @@ static void __init opal_fadump_get_config(struct fw_dump *fadump_conf,* Hope the memory that could not be preserved only has pages * that are usually filtered out while saving the vmcore. */ -if (fdm->region_cnt > fdm->registered_regions) { +if (be16_to_cpu (fdm->region_cnt) >be16_to_cpu (fdm->registered_regions)) {pr_warn ("Not all memory regions were saved!!!\n" );pr_warn (" Unsaved memory regions:\n" ); - i = fdm->registered_regions; -while (i < fdm->region_cnt) { + i =be16_to_cpu (fdm->registered_regions); +while (i <be16_to_cpu (fdm->region_cnt)) {pr_warn ("\t[%03d] base: 0x%llx, size: 0x%llx\n" , - i, fdm->rgn[i].src, fdm->rgn[i].size); + i,be64_to_cpu (fdm->rgn[i].src), +be64_to_cpu (fdm->rgn[i].size)); i++; }
@@ -170,7 +171,7 @@ static void __init opal_fadump_get_config(struct fw_dump *fadump_conf, } fadump_conf->boot_mem_top = (fadump_conf->boot_memory_size + hole_size); - fadump_conf->boot_mem_regs_cnt = fdm->region_cnt; + fadump_conf->boot_mem_regs_cnt =be16_to_cpu (fdm->region_cnt);opal_fadump_update_config (fadump_conf, fdm); }
@@ -178,35 +179,38 @@ static void __init opal_fadump_get_config(struct fw_dump *fadump_conf,static void opal_fadump_init_metadata (struct opal_fadump_mem_struct *fdm) { fdm->version =OPAL_FADUMP_VERSION ; - fdm->region_cnt =0 ; - fdm->registered_regions =0 ; - fdm->fadumphdr_addr =0 ; + fdm->region_cnt =cpu_to_be16 (0 ); + fdm->registered_regions =cpu_to_be16 (0 ); + fdm->fadumphdr_addr =cpu_to_be64 (0 ); }static u64 opal_fadump_init_mem_struct (struct fw_dump *fadump_conf) {u64 addr = fadump_conf->reserve_dump_area_start; +u16 reg_cnt;int i; opal_fdm =__va (fadump_conf->kernel_metadata);opal_fadump_init_metadata (opal_fdm);/* Boot memory regions */ + reg_cnt =be16_to_cpu (opal_fdm->region_cnt);for (i =0 ; i < fadump_conf->boot_mem_regs_cnt; i++) { - opal_fdm->rgn[i].src = fadump_conf->boot_mem_addr[i]; - opal_fdm->rgn[i].dest = addr; - opal_fdm->rgn[i].size = fadump_conf->boot_mem_sz[i]; + opal_fdm->rgn[i].src =cpu_to_be64 (fadump_conf->boot_mem_addr[i]); + opal_fdm->rgn[i].dest =cpu_to_be64 (addr); + opal_fdm->rgn[i].size =cpu_to_be64 (fadump_conf->boot_mem_sz[i]); - opal_fdm->region_cnt++; + reg_cnt++; addr += fadump_conf->boot_mem_sz[i]; } + opal_fdm->region_cnt =cpu_to_be16 (reg_cnt);/* * Kernel metadata is passed to f/w and retrieved in capture kerenl. * So, use it to save fadump header address instead of calculating it. */ - opal_fdm->fadumphdr_addr = (opal_fdm->rgn[0 ].dest + - fadump_conf->boot_memory_size); + opal_fdm->fadumphdr_addr =cpu_to_be64 (be64_to_cpu (opal_fdm->rgn[0 ].dest) + + fadump_conf->boot_memory_size);opal_fadump_update_config (fadump_conf, opal_fdm);
@@ -269,18 +273,21 @@ static u64 opal_fadump_get_bootmem_min(void)static int opal_fadump_register (struct fw_dump *fadump_conf) {s64 rc =OPAL_PARAMETER ; +u16 registered_regs;int i, err = -EIO ; -for (i =0 ; i < opal_fdm->region_cnt; i++) { + registered_regs =be16_to_cpu (opal_fdm->registered_regions); +for (i =0 ; i <be16_to_cpu (opal_fdm->region_cnt); i++) { rc =opal_mpipl_update (OPAL_MPIPL_ADD_RANGE , - opal_fdm->rgn[i].src, - opal_fdm->rgn[i].dest, - opal_fdm->rgn[i].size); +be64_to_cpu (opal_fdm->rgn[i].src), +be64_to_cpu (opal_fdm->rgn[i].dest), +be64_to_cpu (opal_fdm->rgn[i].size));if (rc !=OPAL_SUCCESS )break ; - opal_fdm->registered_regions++; + registered_regs++; } + opal_fdm->registered_regions =cpu_to_be16 (registered_regs);switch (rc) {case OPAL_SUCCESS :
@@ -291,7 +298,8 @@ static int opal_fadump_register(struct fw_dump *fadump_conf)case OPAL_RESOURCE :/* If MAX regions limit in f/w is hit, warn and proceed. */ pr_warn ("%d regions could not be registered for MPIPL as MAX limit is reached!\n" , - (opal_fdm->region_cnt - opal_fdm->registered_regions)); + (be16_to_cpu (opal_fdm->region_cnt) - +be16_to_cpu (opal_fdm->registered_regions))); fadump_conf->dump_registered =1 ; err =0 ;break ;
@@ -312,7 +320,7 @@ static int opal_fadump_register(struct fw_dump *fadump_conf)* If some regions were registered before OPAL_MPIPL_ADD_RANGE * OPAL call failed, unregister all regions. */ -if ((err <0 ) && (opal_fdm->registered_regions >0 )) +if ((err <0 ) && (be16_to_cpu (opal_fdm->registered_regions) >0 ))opal_fadump_unregister (fadump_conf);return err;
@@ -328,7 +336,7 @@ static int opal_fadump_unregister(struct fw_dump *fadump_conf)return -EIO ; } - opal_fdm->registered_regions =0 ; + opal_fdm->registered_regions =cpu_to_be16 (0 ); fadump_conf->dump_registered =0 ;return 0 ; }
@@ -563,19 +571,20 @@ static void opal_fadump_region_show(struct fw_dump *fadump_conf,else fdm_ptr = opal_fdm; -for (i =0 ; i < fdm_ptr->region_cnt; i++) { +for (i =0 ; i <be16_to_cpu (fdm_ptr->region_cnt); i++) {/* * Only regions that are registered for MPIPL * would have dump data. */ if ((fadump_conf->dump_active) && - (i < fdm_ptr->registered_regions)) - dumped_bytes = fdm_ptr->rgn[i].size; + (i <be16_to_cpu (fdm_ptr->registered_regions))) + dumped_bytes =be64_to_cpu (fdm_ptr->rgn[i].size);seq_printf (m,"DUMP: Src: %#016llx, Dest: %#016llx, " , - fdm_ptr->rgn[i].src, fdm_ptr->rgn[i].dest); +be64_to_cpu (fdm_ptr->rgn[i].src), +be64_to_cpu (fdm_ptr->rgn[i].dest));seq_printf (m,"Size: %#llx, Dumped: %#llx bytes\n" , - fdm_ptr->rgn[i].size, dumped_bytes); +be64_to_cpu (fdm_ptr->rgn[i].size), dumped_bytes); }/* Dump is active. Show reserved area start address. */
@@ -624,6 +633,7 @@ void __init opal_fadump_dt_scan(struct fw_dump *fadump_conf, u64 node) {const __be32 *prop;unsigned long dn; +__be64 be_addr;u64 addr =0 ;int i, len;s64 ret;
@@ -680,13 +690,13 @@ void __init opal_fadump_dt_scan(struct fw_dump *fadump_conf, u64 node)if (!prop)return ; - ret =opal_mpipl_query_tag (OPAL_MPIPL_TAG_KERNEL , &addr); -if ((ret !=OPAL_SUCCESS ) || !addr) { + ret =opal_mpipl_query_tag (OPAL_MPIPL_TAG_KERNEL , &be_addr); +if ((ret !=OPAL_SUCCESS ) || !be_addr) {pr_err ("Failed to get Kernel metadata (%lld)\n" , ret);return ; } - addr =be64_to_cpu (addr); + addr =be64_to_cpu (be_addr);pr_debug ("Kernel metadata addr: %llx\n" , addr); opal_fdm_active =__va (addr);
@@ -697,14 +707,14 @@ void __init opal_fadump_dt_scan(struct fw_dump *fadump_conf, u64 node) }/* Kernel regions not registered with f/w for MPIPL */ -if (opal_fdm_active->registered_regions ==0 ) { +if (be16_to_cpu (opal_fdm_active->registered_regions) ==0 ) { opal_fdm_active =NULL ;return ; } - ret =opal_mpipl_query_tag (OPAL_MPIPL_TAG_CPU , &addr); -if (addr) { - addr =be64_to_cpu (addr); + ret =opal_mpipl_query_tag (OPAL_MPIPL_TAG_CPU , &be_addr); +if (be_addr) { + addr =be64_to_cpu (be_addr);pr_debug ("CPU metadata addr: %llx\n" , addr); opal_cpu_metadata =__va (addr); }
arch/powerpc/platforms/powernv/opal-fadump.h +5 -5
@@ -31,14 +31,14 @@* OPAL FADump kernel metadata * * The address of this structure will be registered with f/w for retrieving -* and processing during crash dump. +* in the capture kernel to process the crash dump. */ struct opal_fadump_mem_struct {u8 version;u8 reserved[3 ]; -u16 region_cnt;/* number of regions */ -u16 registered_regions;/* Regions registered for MPIPL */ -u64 fadumphdr_addr; +__be16 region_cnt;/* number of regions */ +__be16 registered_regions;/* Regions registered for MPIPL */ +__be64 fadumphdr_addr;struct opal_mpipl_region rgn[FADUMP_MAX_MEM_REGS ]; } __packed;
@@ -135,7 +135,7 @@ static inline void opal_fadump_read_regs(char *bufp, unsigned int regs_cnt,for (i =0 ; i < regs_cnt; i++, bufp += reg_entry_size) { reg_entry = (struct hdat_fadump_reg_entry *)bufp; val = (cpu_endian ?be64_to_cpu (reg_entry->reg_val) : - reg_entry->reg_val); + (u64)(reg_entry->reg_val)); opal_fadump_set_regval_regnum(regs, be32_to_cpu(reg_entry->reg_type), be32_to_cpu(reg_entry->reg_num),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 201/772 pinctrl: renesas: rzn1: Fix possible null-ptr-deref in sh_pfc_map_resources()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 2f661477c2bb8068194dbba9738d05219f111c6e ]
It will cause null-ptr-deref when using 'res', if platform_get_resource() returns NULL, so move using 'res' after devm_ioremap_resource() that will check it to avoid null-ptr-deref.
And use devm_platform_get_and_ioremap_resource() to simplify code.
--- drivers/pinctrl/renesas/pinctrl-rzn1.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/pinctrl/renesas/pinctrl-rzn1.c +4 -6
@@ -865,17 +865,15 @@ static int rzn1_pinctrl_probe(struct platform_device *pdev) ipctl->mdio_func[0 ] =-1 ; ipctl->mdio_func[1 ] =-1 ; - res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); - ipctl->lev1_protect_phys = (u32 )res->start +0x400 ; - ipctl->lev1 =devm_ioremap_resource (&pdev->dev, res); + ipctl->lev1 =devm_platform_get_and_ioremap_resource (pdev,0 , &res);if (IS_ERR (ipctl->lev1))return PTR_ERR (ipctl->lev1); + ipctl->lev1_protect_phys = (u32 )res->start +0x400 ; - res =platform_get_resource (pdev,IORESOURCE_MEM ,1 ); - ipctl->lev2_protect_phys = (u32 )res->start +0x400 ; - ipctl->lev2 =devm_ioremap_resource (&pdev->dev, res); + ipctl->lev2 =devm_platform_get_and_ioremap_resource (pdev,1 , &res);if (IS_ERR (ipctl->lev2))return PTR_ERR (ipctl->lev2); + ipctl->lev2_protect_phys = (u32 )res->start +0x400 ; ipctl->clk =devm_clk_get (&pdev->dev,NULL );if (IS_ERR (ipctl->clk))
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 198/772 ARM: OMAP1: clock: Fix UART rate reporting algorithm
In reply to Greg Kroah-HartmanFrom: Janusz Krzysztofik <[email protected]>
[ Upstream commit 338d5d476cde853dfd97378d20496baabc2ce3c0 ]
Since its introduction to the mainline kernel, omap1_uart_recalc() helper makes incorrect use of clk->enable_bit as a ready to use bitmap mask while it only provides the bit number. Fix it.
--- arch/arm/mach-omap1/clock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap1/clock.c +1 -1
@@ -41,7 +41,7 @@ static DEFINE_SPINLOCK(clockfw_lock);unsigned long omap1_uart_recalc (struct clk *clk) {unsigned int val =__raw_readl (clk->enable_reg); -return val & clk->enable_bit ?48000000 :12000000 ; +return val &1 << clk->enable_bit ?48000000 :12000000 ; }unsigned long omap1_sossi_recalc (struct clk *clk)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 167/772 nvme: set non-mdts limits in nvme_scan_work
In reply to Greg Kroah-HartmanFrom: Chaitanya Kulkarni <[email protected]>
[ Upstream commit 78288665b5d0154978fed431985310cb4f166836 ]
In current implementation we set the non-mdts limits by calling nvme_init_non_mdts_limits() from nvme_init_ctrl_finish(). This also tries to set the limits for the discovery controller which has no I/O queues resulting in the warning message reported by the nvme_log_error() when running blktest nvme/002: -
[ 2005.155946] run blktests nvme/002 at 2022-04-09 16:57:47 [ 2005.192223] loop: module loaded [ 2005.196429] nvmet: adding nsid 1 to subsystem blktests-subsystem-0 [ 2005.200334] nvmet: adding nsid 1 to subsystem blktests-subsystem-1
<------------------------------SNIP---------------------------------->
[ 2008.958108] nvmet: adding nsid 1 to subsystem blktests-subsystem-997 [ 2008.962082] nvmet: adding nsid 1 to subsystem blktests-subsystem-998 [ 2008.966102] nvmet: adding nsid 1 to subsystem blktests-subsystem-999 [ 2008.973132] nvmet: creating discovery controller 1 for subsystem nqn.2014-08.org.nvmexpress.discovery for NQN testhostnqn. *[ 2008.973196] nvme1: Identify(0x6), Invalid Field in Command (sct 0x0 / sc 0x2) MORE DNR* [ 2008.974595] nvme nvme1: new ctrl: "nqn.2014-08.org.nvmexpress.discovery" [ 2009.103248] nvme nvme1: Removing ctrl: NQN "nqn.2014-08.org.nvmexpress.discovery"
Move the call of nvme_init_non_mdts_limits() to nvme_scan_work() after we verify that I/O queues are created since that is a converging point for each transport where these limits are actually used.
1. FC :nvme_fc_create_association()
...
nvme_fc_create_io_queues(ctrl);
...
nvme_start_ctrl()
nvme_scan_queue()
nvme_scan_work()
2. PCIe:-nvme_reset_work()
...
nvme_setup_io_queues()
nvme_create_io_queues()
nvme_alloc_queue()
...
nvme_start_ctrl()
nvme_scan_queue()
nvme_scan_work()
3. RDMA :-nvme_rdma_setup_ctrl
...
nvme_rdma_configure_io_queues
...
nvme_start_ctrl()
nvme_scan_queue()
nvme_scan_work()
4. TCP :-nvme_tcp_setup_ctrl
...
nvme_tcp_configure_io_queues
...
nvme_start_ctrl()
nvme_scan_queue()
nvme_scan_work()
* nvme_scan_work()
...nvme_validate_or_alloc_ns()
nvme_alloc_ns()
nvme_update_ns_info()
nvme_update_disk_info()
nvme_config_discard() <---
blk_queue_max_write_zeroes_sectors() <------ drivers/nvme/host/core.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
drivers/nvme/host/core.c +15 -4
@@ -3096,10 +3096,6 @@ int nvme_init_ctrl_finish(struct nvme_ctrl *ctrl)if (ret)return ret; - ret =nvme_init_non_mdts_limits (ctrl); -if (ret <0 ) -return ret; - ret =nvme_configure_apst (ctrl);if (ret <0 )return ret;
@@ -4160,11 +4156,26 @@ static void nvme_scan_work(struct work_struct *work) {struct nvme_ctrl *ctrl = container_of(work, struct nvme_ctrl, scan_work); +int ret;/* No tagset on a live ctrl means IO queues could not created */ if (ctrl->state !=NVME_CTRL_LIVE || !ctrl->tagset)return ; +/* +* Identify controller limits can change at controller reset due to +* new firmware download, even though it is not common we cannot ignore +* such scenario. Controller's non-mdts limits are reported in the unit +* of logical blocks that is dependent on the format of attached +* namespace. Hence re-read the limits at the time of ns allocation. +*/ + ret =nvme_init_non_mdts_limits (ctrl); +if (ret <0 ) { +dev_warn (ctrl->device, +"reading non-mdts-limits failed: %d\n" , ret); +return ; + } +if (test_and_clear_bit (NVME_AER_NOTICE_NS_CHANGED , &ctrl->events)) {dev_info (ctrl->device,"rescanning namespaces.\n" );nvme_clear_changed_ns_log (ctrl);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 202/772 ARM: versatile: Add missing of_node_put in dcscb_init
In reply to Greg Kroah-HartmanFrom: Peng Wu <[email protected]>
[ Upstream commit 23b44f9c649bbef10b45fa33080cd8b4166800ae ]
The device_node pointer is returned by of_find_compatible_node with refcount incremented. We should use of_node_put() to avoid the refcount leak.
--- arch/arm/mach-vexpress/dcscb.c | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-vexpress/dcscb.c +1 -0
@@ -144,6 +144,7 @@ static int __init dcscb_init(void)if (!node)return -ENODEV ; dcscb_base =of_iomap (node,0 ); +of_node_put (node);if (!dcscb_base)return -EADDRNOTAVAIL ; cfg =readl_relaxed (dcscb_base +DCS_CFG_R );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 203/772 ARM: dts: exynos: add atmel,24c128 fallback to Samsung EEPROM
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit f038e8186fbc5723d7d38c6fa1d342945107347e ]
The Samsung s524ad0xd1 EEPROM should use atmel,24c128 fallback, according to the AT24 EEPROM bindings.
--- arch/arm/boot/dts/exynos5250-smdk5250.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/exynos5250-smdk5250.dts +2 -2
@@ -129,7 +129,7 @@ samsung,i2c-max-bus-freq = <20000>; eeprom@50 { - compatible = "samsung,s524ad0xd1"; + compatible = "samsung,s524ad0xd1", "atmel,24c128"; reg = <0x50>; };
@@ -289,7 +289,7 @@ samsung,i2c-max-bus-freq = <20000>; eeprom@51 { - compatible = "samsung,s524ad0xd1"; + compatible = "samsung,s524ad0xd1", "atmel,24c128"; reg = <0x51>; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 205/772 ARM: hisi: Add missing of_node_put after of_find_compatible_node
In reply to Greg Kroah-HartmanFrom: Peng Wu <[email protected]>
[ Upstream commit 9bc72e47d4630d58a840a66a869c56b29554cfe4 ]
of_find_compatible_node will increment the refcount of the returned device_node. Calling of_node_put() to avoid the refcount leak
--- arch/arm/mach-hisi/platsmp.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/mach-hisi/platsmp.c +4 -0
@@ -67,14 +67,17 @@ static void __init hi3xxx_smp_prepare_cpus(unsigned int max_cpus) } ctrl_base =of_iomap (np,0 );if (!ctrl_base) { +of_node_put (np);pr_err ("failed to map address\n" );return ; }if (of_property_read_u32 (np,"smp-offset" , &offset) <0 ) { +of_node_put (np);pr_err ("failed to find smp-offset property\n" );return ; } ctrl_base += offset; +of_node_put (np); } }
@@ -160,6 +163,7 @@ static int hip01_boot_secondary(unsigned int cpu, struct task_struct *idle)if (WARN_ON (!node))return -1 ; ctrl_base =of_iomap (node,0 ); +of_node_put (node);/* set the secondary core boot from DDR */ remap_reg_value =readl_relaxed (ctrl_base +REG_SC_CTRL );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 168/772 can: mcp251xfd: silence clangs -Wunaligned-access warning
In reply to Greg Kroah-HartmanFrom: Vincent Mailhol <[email protected]>
[ Upstream commit 1a6dd9996699889313327be03981716a8337656b ]
clang emits a -Wunaligned-access warning on unionmcp251xfd_tx_ojb_load_buf.
The reason is that field hw_tx_obj (not declared as packed) is being packed right after a 16 bits field inside a packed struct:
| union mcp251xfd_tx_obj_load_buf {
| struct __packed {
| struct mcp251xfd_buf_cmd cmd;
| /* ^ 16 bits fields */
| struct mcp251xfd_hw_tx_obj_raw hw_tx_obj;
| /* ^ not declared as packed */
| } nocrc;
| struct __packed {
| struct mcp251xfd_buf_cmd_crc cmd;
| struct mcp251xfd_hw_tx_obj_raw hw_tx_obj;
| __be16 crc;
| } crc;
| } ____cacheline_aligned;Starting from LLVM 14, having an unpacked struct nested in a packed struct triggers a warning. c.f. [1].
This is a false positive because the field is always being accessed with the relevant put_unaligned_*() function. Adding __packed to the structure declaration silences the warning.
[1] https://github.com/llvm/llvm-project/issues/55520
--- drivers/net/can/spi/mcp251xfd/mcp251xfd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/spi/mcp251xfd/mcp251xfd.h +1 -1
@@ -434,7 +434,7 @@ struct mcp251xfd_hw_tef_obj {/* The tx_obj_raw version is used in spi async, i.e. without * regmap. We have to take care of endianness ourselves. */ -struct mcp251xfd_hw_tx_obj_raw { +struct __packed mcp251xfd_hw_tx_obj_raw {__le32 id;__le32 flags; u8 data[sizeof_field(struct canfd_frame, data)];
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 204/772 arm64: dts: qcom: sc7280-idp: Configure CTS pin to bias-bus-hold for bluetooth
In reply to Greg Kroah-HartmanFrom: Vijaya Krishna Nivarthi <[email protected]>
[ Upstream commit 497b272759986af1aa5a25b5e903d082c67bd8f6 ]
WLAN rail was leaking power during RBSC/sleep even after turning BT off. Change active and sleep pinctrl configurations to handle same.
--- arch/arm64/boot/dts/qcom/sc7280-idp.dtsi | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/qcom/sc7280-idp.dtsi +12 -6
@@ -462,10 +462,13 @@ &qup_uart7_cts { /* - * Configure a pull-down on CTS to match the pull of - * the Bluetooth module. + * Configure a bias-bus-hold on CTS to lower power + * usage when Bluetooth is turned off. Bus hold will + * maintain a low power state regardless of whether + * the Bluetooth module drives the pin in either + * direction or leaves the pin fully unpowered. */ - bias-pull-down; + bias-bus-hold; }; &qup_uart7_rts {
@@ -516,10 +519,13 @@ pins = "gpio28"; function = "gpio"; /* - * Configure a pull-down on CTS to match the pull of - * the Bluetooth module. + * Configure a bias-bus-hold on CTS to lower power + * usage when Bluetooth is turned off. Bus hold will + * maintain a low power state regardless of whether + * the Bluetooth module drives the pin in either + * direction or leaves the pin fully unpowered. */ - bias-pull-down; + bias-bus-hold; }; qup_uart7_sleep_rts: qup-uart7-sleep-rts {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 206/772 cpufreq: Avoid unnecessary frequency updates due to mismatch
In reply to Greg Kroah-HartmanFrom: Viresh Kumar <[email protected]>
[ Upstream commit f55ae08c89873e140c7cac2a7fa161d31a0d60cf ]
For some platforms, the frequency returned by hardware may be slightly different from what is provided in the frequency table. For example, hardware may return 499 MHz instead of 500 MHz. In such cases it is better to avoid getting into unnecessary frequency updates, as we may end up switching policy->cur between the two and sending unnecessary pre/post update notifications, etc.
This patch has chosen allows the hardware frequency and table frequency to deviate by 1 MHz for now, we may want to increase it a bit later on if someone still complains.
--- drivers/cpufreq/cpufreq.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/cpufreq/cpufreq.c +11 -0
@@ -28,6 +28,7 @@#include <linux/suspend.h> #include <linux/syscore_ops.h> #include <linux/tick.h> +#include <linux/units.h> #include <trace/events/power.h> static LIST_HEAD (cpufreq_policy_list);
@@ -1707,6 +1708,16 @@ static unsigned int cpufreq_verify_current_freq(struct cpufreq_policy *policy, breturn new_freq;if (policy->cur != new_freq) { +/* +* For some platforms, the frequency returned by hardware may be +* slightly different from what is provided in the frequency +* table, for example hardware may return 499 MHz instead of 500 +* MHz. In such cases it is better to avoid getting into +* unnecessary frequency updates. +*/ +if (abs (policy->cur - new_freq) <HZ_PER_MHZ ) +return policy->cur; +cpufreq_out_of_sync (policy, new_freq);if (update)schedule_work (&policy->update);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 169/772 x86/microcode: Add explicit CPU vendor dependency
In reply to Greg Kroah-HartmanFrom: Borislav Petkov <[email protected]>
[ Upstream commit 9c55d99e099bd7aa6b91fce8718505c35d5dfc65 ]
Add an explicit dependency to the respective CPU vendor so that the respective microcode support for it gets built only when that support is enabled.
--- arch/x86/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/Kconfig +2 -2
@@ -1332,7 +1332,7 @@ config MICROCODE config MICROCODE_INTEL bool "Intel microcode loading support" - depends on MICROCODE + depends on CPU_SUP_INTEL && MICROCODE default MICROCODE help This options enables microcode patch loading support for Intel
@@ -1344,7 +1344,7 @@ config MICROCODE_INTEL config MICROCODE_AMD bool "AMD microcode loading support" - depends on MICROCODE + depends on CPU_SUP_AMD && MICROCODE help If you select this option, microcode patch loading support for AMD processors will be enabled.
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 170/772 net: ipa: ignore endianness if there is no header
In reply to Greg Kroah-HartmanFrom: Alex Elder <[email protected]>
[ Upstream commit 332ef7c814bdd60f08d0d9013d0e1104798b2d23 ]
If we program an RX endpoint to have no header (header length is 0), header-related endpoint configuration values are meaningless and are ignored.
The only case we support that defines a header is QMAP endpoints. In ipa_endpoint_init_hdr_ext() we set the endianness mask value unconditionally, but it should not be done if there is no header (meaning it is not configured for QMAP).
Set the endianness conditionally, and rearrange the logic in that function slightly to avoid testing the qmap flag twice.
Delete an incorrect comment in ipa_endpoint_init_aggr().
--- drivers/net/ipa/ipa_endpoint.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-)
drivers/net/ipa/ipa_endpoint.c +17 -15
@@ -571,19 +571,23 @@ static void ipa_endpoint_init_hdr_ext(struct ipa_endpoint *endpoint)struct ipa *ipa = endpoint->ipa;u32 val =0 ; - val |=HDR_ENDIANNESS_FMASK ;/* big endian */ - -/* A QMAP header contains a 6 bit pad field at offset 0. The RMNet -* driver assumes this field is meaningful in packets it receives, -* and assumes the header's payload length includes that padding. -* The RMNet driver does *not* pad packets it sends, however, so -* the pad field (although 0) should be ignored. -*/ -if (endpoint->data->qmap && !endpoint->toward_ipa) { - val |=HDR_TOTAL_LEN_OR_PAD_VALID_FMASK ; -/* HDR_TOTAL_LEN_OR_PAD is 0 (pad, not total_len) */ - val |=HDR_PAYLOAD_LEN_INC_PADDING_FMASK ; -/* HDR_TOTAL_LEN_OR_PAD_OFFSET is 0 */ +if (endpoint->data->qmap) { +/* We have a header, so we must specify its endianness */ + val |=HDR_ENDIANNESS_FMASK ;/* big endian */ + +/* A QMAP header contains a 6 bit pad field at offset 0. +* The RMNet driver assumes this field is meaningful in +* packets it receives, and assumes the header's payload +* length includes that padding. The RMNet driver does +* *not* pad packets it sends, however, so the pad field +* (although 0) should be ignored. +*/ +if (!endpoint->toward_ipa) { + val |=HDR_TOTAL_LEN_OR_PAD_VALID_FMASK ; +/* HDR_TOTAL_LEN_OR_PAD is 0 (pad, not total_len) */ + val |=HDR_PAYLOAD_LEN_INC_PADDING_FMASK ; +/* HDR_TOTAL_LEN_OR_PAD_OFFSET is 0 */ + } }/* HDR_PAYLOAD_LEN_INC_PADDING is 0 */
@@ -741,8 +745,6 @@ static void ipa_endpoint_init_aggr(struct ipa_endpoint *endpoint) close_eof = endpoint->data->rx.aggr_close_eof; val |=aggr_sw_eof_active_encoded (version, close_eof); - -/* AGGR_HARD_BYTE_LIMIT_ENABLE is 0 */ }else { val |=u32_encode_bits (IPA_ENABLE_DEAGGR ,AGGR_EN_FMASK );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 172/772 m68k: atari: Make Atari ROM port I/O write macros return void
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 30b5e6ef4a32ea4985b99200e06d6660a69f9246 ]
The macros implementing Atari ROM port I/O writes do not cast away their output, unlike similar implementations for other I/O buses. When they are combined using conditional expressions in the definitions of outb() and friends, this triggers sparse warnings like:
drivers/net/appletalk/cops.c:382:17: error: incompatible types in conditional expression (different base types):
drivers/net/appletalk/cops.c:382:17: unsigned char
drivers/net/appletalk/cops.c:382:17: void
Fix this by adding casts to "void".
--- arch/m68k/include/asm/raw_io.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/m68k/include/asm/raw_io.h +3 -3
@@ -80,14 +80,14 @@ ({ u16 __v = le16_to_cpu(*(__force volatile u16 *) (addr)); __v; })#define rom_out_8 (addr, b) \ - ({u8 __maybe_unused __w, __v = (b); u32 _addr = ((u32) (addr)); \ + (void)({u8 __maybe_unused __w, __v = (b); u32 _addr = ((u32) (addr)); \ __w = ((*(__force volatile u8 *) ((_addr | 0x10000) + (__v<<1)))); })#define rom_out_be16 (addr, w) \ - ({u16 __maybe_unused __w, __v = (w); u32 _addr = ((u32) (addr)); \ + (void)({u16 __maybe_unused __w, __v = (w); u32 _addr = ((u32) (addr)); \ __w = ((*(__force volatile u16 *) ((_addr & 0xFFFF0000UL) + ((__v & 0xFF)<<1)))); \ __w = ((*(__force volatile u16 *) ((_addr | 0x10000) + ((__v >> 8)<<1)))); })#define rom_out_le16 (addr, w) \ - ({u16 __maybe_unused __w, __v = (w); u32 _addr = ((u32) (addr)); \ + (void)({u16 __maybe_unused __w, __v = (w); u32 _addr = ((u32) (addr)); \ __w = ((*(__force volatile u16 *) ((_addr & 0xFFFF0000UL) + ((__v >> 8)<<1)))); \ __w = ((*(__force volatile u16 *) ((_addr | 0x10000) + ((__v & 0xFF)<<1)))); })
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 217/772 powerpc/powernv: fix missing of_node_put in uv_init()
In reply to Greg Kroah-HartmanFrom: Lv Ruyi <[email protected]>
[ Upstream commit 3ffa9fd471f57f365bc54fc87824c530422f64a5 ]
of_find_compatible_node() returns node pointer with refcount incremented, use of_node_put() on it when done.
--- arch/powerpc/platforms/powernv/ultravisor.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/platforms/powernv/ultravisor.c +1 -0
@@ -55,6 +55,7 @@ static int __init uv_init(void)return -ENODEV ; uv_memcons =memcons_init (node,"memcons" ); +of_node_put (node);if (!uv_memcons)return -ENOENT ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 208/772 powerpc/rtas: Keep MSR[RI] set when calling RTAS
In reply to Greg Kroah-HartmanFrom: Laurent Dufour <[email protected]>
[ Upstream commit b6b1c3ce06ca438eb24e0f45bf0e63ecad0369f5 ]
RTAS runs in real mode (MSR[DR] and MSR[IR] unset) and in 32-bit big endian mode (MSR[SF,LE] unset).
The change in MSR is done in enter_rtas() in a relatively complex way, since the MSR value could be hardcoded.
Furthermore, a panic has been reported when hitting the watchdog interrupt while running in RTAS, this leads to the following stack trace:
watchdog: CPU 24 Hard LOCKUP
watchdog: CPU 24 TB:997512652051031, last heartbeat TB:997504470175378 (15980ms ago)
...
Supported: No, Unreleased kernel
CPU: 24 PID: 87504 Comm: drmgr Kdump: loaded Tainted: G E X 5.14.21-150400.71.1.bz196362_2-default #1 SLE15-SP4 (unreleased) 0d821077ef4faa8dfaf370efb5fdca1fa35f4e2c NIP: 000000001fb41050 LR: 000000001fb4104c CTR: 0000000000000000 REGS: c00000000fc33d60 TRAP: 0100 Tainted: G E X (5.14.21-150400.71.1.bz196362_2-default) MSR: 8000000002981000 <SF,VEC,VSX,ME> CR: 48800002 XER: 20040020 CFAR: 000000000000011c IRQMASK: 1 GPR00: 0000000000000003 ffffffffffffffff 0000000000000001 00000000000050dc GPR04: 000000001ffb6100 0000000000000020 0000000000000001 000000001fb09010 GPR08: 0000000020000000 0000000000000000 0000000000000000 0000000000000000 GPR12: 80040000072a40a8 c00000000ff8b680 0000000000000007 0000000000000034 GPR16: 000000001fbf6e94 000000001fbf6d84 000000001fbd1db0 000000001fb3f008 GPR20: 000000001fb41018 ffffffffffffffff 000000000000017f fffffffffffff68f GPR24: 000000001fb18fe8 000000001fb3e000 000000001fb1adc0 000000001fb1cf40 GPR28: 000000001fb26000 000000001fb460f0 000000001fb17f18 000000001fb17000 NIP [000000001fb41050] 0x1fb41050 LR [000000001fb4104c] 0x1fb4104c Call Trace: Instruction dump: XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX Oops: Unrecoverable System Reset, sig: 6 [#1] LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries ... Supported: No, Unreleased kernel CPU: 24 PID: 87504 Comm: drmgr Kdump: loaded Tainted: G E X 5.14.21-150400.71.1.bz196362_2-default #1 SLE15-SP4 (unreleased) 0d821077ef4faa8dfaf370efb5fdca1fa35f4e2c NIP: 000000001fb41050 LR: 000000001fb4104c CTR: 0000000000000000 REGS: c00000000fc33d60 TRAP: 0100 Tainted: G E X (5.14.21-150400.71.1.bz196362_2-default) MSR: 8000000002981000 <SF,VEC,VSX,ME> CR: 48800002 XER: 20040020 CFAR: 000000000000011c IRQMASK: 1 GPR00: 0000000000000003 ffffffffffffffff 0000000000000001 00000000000050dc GPR04: 000000001ffb6100 0000000000000020 0000000000000001 000000001fb09010 GPR08: 0000000020000000 0000000000000000 0000000000000000 0000000000000000 GPR12: 80040000072a40a8 c00000000ff8b680 0000000000000007 0000000000000034 GPR16: 000000001fbf6e94 000000001fbf6d84 000000001fbd1db0 000000001fb3f008 GPR20: 000000001fb41018 ffffffffffffffff 000000000000017f fffffffffffff68f GPR24: 000000001fb18fe8 000000001fb3e000 000000001fb1adc0 000000001fb1cf40 GPR28: 000000001fb26000 000000001fb460f0 000000001fb17f18 000000001fb17000 NIP [000000001fb41050] 0x1fb41050 LR [000000001fb4104c] 0x1fb4104c Call Trace: Instruction dump: XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX ---[ end trace 3ddec07f638c34a2 ]---
This happens because MSR[RI] is unset when entering RTAS but there is no valid reason to not set it here.
RTAS is expected to be called with MSR[RI] as specified in PAPR+ section "7.2.1 Machine State":
R1–7.2.1–9. If called with MSR[RI] equal to 1, then RTAS must protect its own critical regions from recursion by setting the MSR[RI] bit to 0 when in the critical regions.
Fixing this by reviewing the way MSR is compute before calling RTAS. Now a hardcoded value meaning real mode, 32 bits big endian mode and Recoverable Interrupt is loaded. In the case MSR[S] is set, it will remain set while entering RTAS as only urfid can unset it (thanks Fabiano).
In addition a check is added in do_enter_rtas() to detect calls made with MSR[RI] unset, as we are forcing it on later.
This patch has been tested on the following machines:
Power KVM Guest
P8 S822L (host Ubuntu kernel 5.11.0-49-generic)
PowerVM LPAR
P8 9119-MME (FW860.A1)
p9 9008-22L (FW950.00)
P10 9080-HEX (FW1010.00)
--- arch/powerpc/kernel/entry_64.S | 24 ++++++++++++------------ arch/powerpc/kernel/rtas.c | 9 +++++++++ 2 files changed, 21 insertions(+), 12 deletions(-)
arch/powerpc/kernel/entry_64.S +12 -12
@@ -330,22 +330,22 @@ _GLOBAL(enter_rtas) clrldi r4,r4,2 /* convert to realmode address */ mtlr r4 - li r0,0 - ori r0,r0,MSR_EE|MSR_SE|MSR_BE|MSR_RI - andc r0,r6,r0 - - li r9,1 - rldicr r9,r9,MSR_SF_LG,(63-MSR_SF_LG) - ori r9,r9,MSR_IR|MSR_DR|MSR_FE0|MSR_FE1|MSR_FP|MSR_RI|MSR_LE - andc r6,r0,r9 - __enter_rtas: - sync /* disable interrupts so SRR0/1 */ - mtmsrd r0 /* don't get trashed */ - LOAD_REG_ADDR(r4, rtas) ld r5,RTASENTRY(r4) /* get the rtas->entry value */ ld r4,RTASBASE(r4) /* get the rtas->base value */ + + /* + * RTAS runs in 32-bit big endian real mode, but leave MSR[RI] on as we + * may hit NMI (SRESET or MCE) while in RTAS. RTAS should disable RI in + * its critical regions (as specified in PAPR+ section 7.2.1). MSR[S] + * is not impacted by RFI_TO_KERNEL (only urfid can unset it). So if + * MSR[S] is set, it will remain when entering RTAS. + */ + LOAD_REG_IMMEDIATE(r6, MSR_ME | MSR_RI) + + li r0,0 + mtmsrd r0,1 /* disable RI before using SRR0/1 */ mtspr SPRN_SRR0,r5 mtspr SPRN_SRR1,r6
arch/powerpc/kernel/rtas.c +9 -0
@@ -49,6 +49,15 @@ void enter_rtas(unsigned long);static inline void do_enter_rtas (unsigned long args) { +unsigned long msr; + +/* +* Make sure MSR[RI] is currently enabled as it will be forced later +* in enter_rtas. +*/ + msr =mfmsr (); +BUG_ON (!(msr &MSR_RI )); +enter_rtas (args);srr_regs_clobbered ();/* rtas uses SRRs, invalidate */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 163/772 blk-throttle: Set BIO_THROTTLED when bio has been throttled
In reply to Greg Kroah-HartmanFrom: Laibin Qiu <[email protected]>
[ Upstream commit 5a011f889b4832aa80c2a872a5aade5c48d2756f ]
1.In current process, all bio will set the BIO_THROTTLED flag after __blk_throtl_bio().
2.If bio needs to be throttled, it will start the timer and stop submit bio directly. Bio will submit in blk_throtl_dispatch_work_fn() when the timer expires.But in the current process, if bio is throttled. The BIO_THROTTLED will be set to bio after timer start. If the bio has been completed, it may cause use-after-free blow.
BUG: KASAN: use-after-free in blk_throtl_bio+0x12f0/0x2c70 Read of size 2 at addr ffff88801b8902d4 by task fio/26380 dump_stack+0x9b/0xce print_address_description.constprop.6+0x3e/0x60 kasan_report.cold.9+0x22/0x3a blk_throtl_bio+0x12f0/0x2c70 submit_bio_checks+0x701/0x1550 submit_bio_noacct+0x83/0xc80 submit_bio+0xa7/0x330 mpage_readahead+0x380/0x500 read_pages+0x1c1/0xbf0 page_cache_ra_unbounded+0x471/0x6f0 do_page_cache_ra+0xda/0x110 ondemand_readahead+0x442/0xae0 page_cache_async_ra+0x210/0x300 generic_file_buffered_read+0x4d9/0x2130 generic_file_read_iter+0x315/0x490 blkdev_read_iter+0x113/0x1b0 aio_read+0x2ad/0x450 io_submit_one+0xc8e/0x1d60 __se_sys_io_submit+0x125/0x350 do_syscall_64+0x2d/0x40 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Allocated by task 26380: kasan_save_stack+0x19/0x40 __kasan_kmalloc.constprop.2+0xc1/0xd0 kmem_cache_alloc+0x146/0x440 mempool_alloc+0x125/0x2f0 bio_alloc_bioset+0x353/0x590 mpage_alloc+0x3b/0x240 do_mpage_readpage+0xddf/0x1ef0 mpage_readahead+0x264/0x500 read_pages+0x1c1/0xbf0 page_cache_ra_unbounded+0x471/0x6f0 do_page_cache_ra+0xda/0x110 ondemand_readahead+0x442/0xae0 page_cache_async_ra+0x210/0x300 generic_file_buffered_read+0x4d9/0x2130 generic_file_read_iter+0x315/0x490 blkdev_read_iter+0x113/0x1b0 aio_read+0x2ad/0x450 io_submit_one+0xc8e/0x1d60 __se_sys_io_submit+0x125/0x350 do_syscall_64+0x2d/0x40 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Freed by task 0: kasan_save_stack+0x19/0x40 kasan_set_track+0x1c/0x30 kasan_set_free_info+0x1b/0x30 __kasan_slab_free+0x111/0x160 kmem_cache_free+0x94/0x460 mempool_free+0xd6/0x320 bio_free+0xe0/0x130 bio_put+0xab/0xe0 bio_endio+0x3a6/0x5d0 blk_update_request+0x590/0x1370 scsi_end_request+0x7d/0x400 scsi_io_completion+0x1aa/0xe50 scsi_softirq_done+0x11b/0x240 blk_mq_complete_request+0xd4/0x120 scsi_mq_done+0xf0/0x200 virtscsi_vq_done+0xbc/0x150 vring_interrupt+0x179/0x390 __handle_irq_event_percpu+0xf7/0x490 handle_irq_event_percpu+0x7b/0x160 handle_irq_event+0xcc/0x170 handle_edge_irq+0x215/0xb20 common_interrupt+0x60/0x120 asm_common_interrupt+0x1e/0x40
Fix this by move BIO_THROTTLED set into the queue_lock.
--- block/blk-throttle.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
block/blk-throttle.c +2 -1
@@ -2167,13 +2167,14 @@ bool __blk_throtl_bio(struct bio *bio) } out_unlock: -spin_unlock_irq (&q->queue_lock);bio_set_flag (bio,BIO_THROTTLED );#ifdef CONFIG_BLK_DEV_THROTTLING_LOW if (throttled || !td->track_bio_latency) bio->bi_issue.value |=BIO_ISSUE_THROTL_SKIP_LATENCY ;#endif +spin_unlock_irq (&q->queue_lock); +rcu_read_unlock ();return throttled; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 220/772 fanotify: fix incorrect fmode_t casts
In reply to Greg Kroah-HartmanFrom: Vasily Averin <[email protected]>
[ Upstream commit dccd855771b37820b6d976a99729c88259549f85 ]
Fixes sparce warnings:fs/notify/fanotify/fanotify_user.c:267:63: sparse:
warning: restricted fmode_t degrades to integerfs/notify/fanotify/fanotify_user.c:1351:28: sparse:
warning: restricted fmode_t degrades to integer
FMODE_NONTIFY have bitwise fmode_t type and requires __force attribute for any casts.
--- fs/notify/fanotify/fanotify_user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/notify/fanotify/fanotify_user.c +2 -2
@@ -264,7 +264,7 @@ static int create_fd(struct fsnotify_group *group, struct path *path,* originally opened O_WRONLY. */ new_file =dentry_open (path, - group->fanotify_data.f_flags |FMODE_NONOTIFY , + group->fanotify_data.f_flags | __FMODE_NONOTIFY,current_cred ());if (IS_ERR (new_file)) {/*
@@ -1329,7 +1329,7 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags) (!(fid_mode & FAN_REPORT_NAME) || !(fid_mode & FAN_REPORT_FID)))return -EINVAL ; - f_flags =O_RDWR |FMODE_NONOTIFY ; + f_flags =O_RDWR | __FMODE_NONOTIFY;if (flags &FAN_CLOEXEC ) f_flags |=O_CLOEXEC ;if (flags &FAN_NONBLOCK )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 222/772 RDMA/hfi1: Prevent panic when SDMA is disabled
In reply to Greg Kroah-HartmanFrom: Douglas Miller <[email protected]>
[ Upstream commit 629e052d0c98e46dde9f0824f0aa437f678d9b8f ]
If the hfi1 module is loaded with HFI1_CAP_SDMA off, a call to hfi1_write_iter() will dereference a NULL pointer and panic. A typical stack frame is:
sdma_select_user_engine [hfi1]
hfi1_user_sdma_process_request [hfi1]
hfi1_write_iter [hfi1]
do_iter_readv_writev
do_iter_write
vfs_writev
do_writev
do_syscall_64
The fix is to test for SDMA in hfi1_write_iter() and fail the I/O with EINVAL.
--- drivers/infiniband/hw/hfi1/file_ops.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/hw/hfi1/file_ops.c +2 -0
@@ -265,6 +265,8 @@ static ssize_t hfi1_write_iter(struct kiocb *kiocb, struct iov_iter *from)unsigned long dim = from->nr_segs;int idx; +if (!HFI1_CAP_IS_KSET (SDMA )) +return -EINVAL ; idx =srcu_read_lock (&fd->pq_srcu); pq =srcu_dereference (fd->pq, &fd->pq_srcu);if (!cq || !pq) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 223/772 cifs: do not use tcpStatus after negotiate completes
In reply to Greg Kroah-HartmanFrom: Shyam Prasad N <[email protected]>
[ Upstream commit 1a6a41d4cedd9b302e2200e6f0e3c44dbbe13689 ]
Recent changes to multichannel to allow channel reconnects to work in parallel and independent of each other did so by making use of tcpStatus for the connection, and status for the session. However, this did not take into account the multiuser scenario, where same connection is used by multiple connections.
However, tcpStatus should be tracked only till the end of negotiate exchange, and not used for session setup. This change fixes this.
--- fs/cifs/connect.c | 23 +++++++++++------------ fs/cifs/smb2pdu.c | 3 ++- fs/cifs/smb2transport.c | 3 ++- 3 files changed, 15 insertions(+), 14 deletions(-)
fs/cifs/connect.c +11 -12
@@ -3956,7 +3956,7 @@ cifs_negotiate_protocol(const unsigned int xid, struct cifs_ses *ses,if (rc ==0 ) {spin_lock (&cifs_tcp_ses_lock);if (server->tcpStatus == CifsInNegotiate) - server->tcpStatus = CifsNeedSessSetup; + server->tcpStatus = CifsGood;else rc = -EHOSTDOWN ;spin_unlock (&cifs_tcp_ses_lock);
@@ -3979,19 +3979,18 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,bool is_binding = false;/* only send once per connect */ +spin_lock (&ses->chan_lock); + is_binding = !CIFS_ALL_CHANS_NEED_RECONNECT (ses); +spin_unlock (&ses->chan_lock); +spin_lock (&cifs_tcp_ses_lock); -if ((server->tcpStatus != CifsNeedSessSetup) && - (ses->status == CifsGood)) { +if (ses->status == CifsExiting) {spin_unlock (&cifs_tcp_ses_lock);return 0 ; } - server->tcpStatus = CifsInSessSetup; + ses->status = CifsInSessSetup;spin_unlock (&cifs_tcp_ses_lock); -spin_lock (&ses->chan_lock); - is_binding = !CIFS_ALL_CHANS_NEED_RECONNECT (ses); -spin_unlock (&ses->chan_lock); -if (!is_binding) { ses->capabilities = server->capabilities;if (!linuxExtEnabled)
@@ -4015,13 +4014,13 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,if (rc) {cifs_server_dbg (VFS ,"Send error in SessSetup = %d\n" , rc);spin_lock (&cifs_tcp_ses_lock); -if (server->tcpStatus == CifsInSessSetup) - server->tcpStatus = CifsNeedSessSetup; +if (ses->status == CifsInSessSetup) + ses->status = CifsNeedSessSetup;spin_unlock (&cifs_tcp_ses_lock); }else {spin_lock (&cifs_tcp_ses_lock); -if (server->tcpStatus == CifsInSessSetup) - server->tcpStatus = CifsGood; +if (ses->status == CifsInSessSetup) + ses->status = CifsGood;/* Even if one channel is active, session is in good state */ ses->status = CifsGood;spin_unlock (&cifs_tcp_ses_lock);
fs/cifs/smb2pdu.c +2 -1
@@ -3904,7 +3904,8 @@ SMB2_echo(struct TCP_Server_Info *server)cifs_dbg (FYI ,"In echo request for conn_id %lld\n" , server->conn_id);spin_lock (&cifs_tcp_ses_lock); -if (server->tcpStatus == CifsNeedNegotiate) { +if (server->ops->need_neg && + server->ops->need_neg (server)) {spin_unlock (&cifs_tcp_ses_lock);/* No need to send echo on newly established connections */ mod_delayed_work (cifsiod_wq, &server->reconnect,0 );
fs/cifs/smb2transport.c +2 -1
@@ -641,7 +641,8 @@ smb2_sign_rqst(struct smb_rqst *rqst, struct TCP_Server_Info *server)if (!is_signed)return 0 ;spin_lock (&cifs_tcp_ses_lock); -if (server->tcpStatus == CifsNeedNegotiate) { +if (server->ops->need_neg && + server->ops->need_neg (server)) {spin_unlock (&cifs_tcp_ses_lock);return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 226/772 drm/bridge_connector: enable HPD by default if supported
In reply to Greg Kroah-HartmanFrom: Nikita Yushchenko <[email protected]>
[ Upstream commit 09077bc3116581f4d1cb961ec359ad56586e370b ]
Hotplug events reported by bridge drivers over drm_bridge_hpd_notify() get ignored unless somebody calls drm_bridge_hpd_enable(). When the connector for the bridge is bridge_connector, such a call is done from drm_bridge_connector_enable_hpd().
However drm_bridge_connector_enable_hpd() is never called on init paths, documentation suggests that it is intended for suspend/resume paths.
In result, once encoders are switched to bridge_connector, bridge-detected HPD stops working.
This patch adds a call to that API on init path.
This fixes HDMI HPD with rcar-du + adv7513 case when adv7513 reports HPD events via interrupts.
--- drivers/gpu/drm/drm_bridge_connector.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_bridge_connector.c +3 -1
@@ -369,8 +369,10 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, connector_type, ddc);drm_connector_helper_add (connector, &drm_bridge_connector_helper_funcs); -if (bridge_connector->bridge_hpd) +if (bridge_connector->bridge_hpd) { connector->polled =DRM_CONNECTOR_POLL_HPD ; +drm_bridge_connector_enable_hpd (connector); + }else if (bridge_connector->bridge_detect) connector->polled =DRM_CONNECTOR_POLL_CONNECT |DRM_CONNECTOR_POLL_DISCONNECT ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 225/772 drm: fix EDID struct for old ARM OABI format
In reply to Greg Kroah-HartmanFrom: Linus Torvalds <[email protected]>
[ Upstream commit 47f15561b69e226bfc034e94ff6dbec51a4662af ]
When building the kernel for arm with the "-mabi=apcs-gnu" option, gcc will force alignment of all structures and unions to a word boundary (see also STRUCTURE_SIZE_BOUNDARY and the "-mstructure-size-boundary=XX" option if you're a gcc person), even when the members of said structures do not want or need said alignment.
This completely messes up the structure alignment of 'struct edid' on those targets, because even though all the embedded structures are marked with "__attribute__((packed))", the unions that contain them are not.
This was exposed by commit f1e4c916f97f ("drm/edid: add EDID block count and size helpers"), but the bug is pre-existing. That commit just made the structure layout problem cause a build failure due to the addition of the
BUILD_BUG_ON(sizeof(*edid) != EDID_LENGTH);
sanity check in drivers/gpu/drm/drm_edid.c:edid_block_data().
This legacy union alignment should probably not be used in the first place, but we can fix the layout by adding the packed attribute to the union entries even when each member is already packed and it shouldn't matter in a sane build environment.
You can see this issue with a trivial test program:
union {
struct {
char c[5];
};
struct {
char d;
unsigned e;
} __attribute__((packed));} a = { "1234" };
where building this with a normal "gcc -S" will result in the expected 5-byte size of said union:
.type a, @object .size a, 5
but with an ARM compiler and the old ABI:
arm-linux-gnu-gcc -mabi=apcs-gnu -mfloat-abi=soft -S t.c
you get
.type a, %object .size a, 8
instead, because even though each member of the union is packed, the union itself still gets aligned.
This was reported by Sudip for the spear3xx_defconfig target.
--- include/drm/drm_edid.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/drm/drm_edid.h +3 -3
@@ -121,7 +121,7 @@ struct detailed_data_monitor_range {u8 supported_scalings;u8 preferred_refresh; } __attribute__((packed)) cvt; - } formula; + } __attribute__((packed)) formula; } __attribute__((packed));struct detailed_data_wpindex {
@@ -154,7 +154,7 @@ struct detailed_non_pixel {struct detailed_data_wpindex color;struct std_timing timings[6 ];struct cvt_timing cvt[4 ]; - } data; + } __attribute__((packed)) data; } __attribute__((packed));#define EDID_DETAIL_EST_TIMINGS 0xf7
@@ -172,7 +172,7 @@ struct detailed_timing {union {struct detailed_pixel_timing pixel_data;struct detailed_non_pixel other_data; - } data; + } __attribute__((packed)) data; } __attribute__((packed));#define DRM_EDID_INPUT_SERRATION_VSYNC (1 << 0)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 221/772 smb3: check for null tcon
In reply to Greg Kroah-HartmanFrom: Steve French <[email protected]>
[ Upstream commit bbdf6cf56c88845fb0b713cbf5c6623c53fe40d8 ]
Although unlikely to be null, it is confusing to use a pointer before checking for it to be null so move the use down after null check.
Addresses-Coverity: 1517586 ("Null pointer dereferences (REVERSE_INULL)")
--- fs/cifs/smb2ops.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/cifs/smb2ops.c +5 -2
@@ -757,8 +757,8 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,struct cifs_sb_info *cifs_sb, struct cached_fid **cfid) { - struct cifs_ses *ses = tcon->ses; -struct TCP_Server_Info *server = ses->server; + struct cifs_ses *ses; +struct TCP_Server_Info *server;struct cifs_open_parms oparms;struct smb2_create_rsp *o_rsp =NULL ;struct smb2_query_info_rsp *qi_rsp =NULL ;
@@ -776,6 +776,9 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,if (tcon->nohandlecache)return -ENOTSUPP ; + ses = tcon->ses; + server = ses->server; +if (cifs_sb->root ==NULL )return -ENOENT ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 227/772 drm/omap: fix NULL but dereferenced coccicheck error
In reply to Greg Kroah-HartmanFrom: Wan Jiabing <[email protected]>
[ Upstream commit 8f2a3970c969d0d8d7289a4c65edcedafc16fd92 ]
Fix the following coccicheck warning:
./drivers/gpu/drm/omapdrm/omap_overlay.c:89:22-25: ERROR: r_ovl is NULL but dereferenced.
Here should be ovl->idx rather than r_ovl->idx.
--- drivers/gpu/drm/omapdrm/omap_overlay.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/omapdrm/omap_overlay.c +1 -1
@@ -86,7 +86,7 @@ int omap_overlay_assign(struct drm_atomic_state *s, struct drm_plane *plane, r_ovl =omap_plane_find_free_overlay (s->dev, overlay_map, caps, fourcc);if (!r_ovl) { - overlay_map[r_ovl->idx] =NULL ; + overlay_map[ovl->idx] =NULL ; *overlay =NULL ;return -ENOMEM ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 228/772 dt-bindings: display: sitronix, st7735r: Fix backlight in example
In reply to Greg Kroah-HartmanFrom: Noralf Trønnes <[email protected]>
[ Upstream commit 471e201f543559e2cb19b182b680ebf04d80ee31 ]
The backlight property was lost during conversion to yaml in commit abdd9e3705c8 ("dt-bindings: display: sitronix,st7735r: Convert to DT schema"). Put it back.
--- Documentation/devicetree/bindings/display/sitronix,st7735r.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/display/sitronix,st7735r.yaml +1 -0
@@ -72,6 +72,7 @@ examples: dc-gpios = <&gpio 43 GPIO_ACTIVE_HIGH>; reset-gpios = <&gpio 80 GPIO_ACTIVE_HIGH>; rotation = <270>; + backlight = <&backlight>; }; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 231/772 drm: bridge: it66121: Fix the register page length
In reply to Greg Kroah-HartmanFrom: Nicolas Belin <[email protected]>
[ Upstream commit 003a1bd6a2a55c16cb2451153533dbedb12bebec ]
Set the register page length or window length to 0x100 according to the documentation.
--- drivers/gpu/drm/bridge/ite-it66121.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/ite-it66121.c +1 -1
@@ -227,7 +227,7 @@ static const struct regmap_range_cfg it66121_regmap_banks[] = { .selector_mask = 0x1, .selector_shift = 0, .window_start = 0x00, - .window_len = 0x130, + .window_len = 0x100, }, };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 233/772 drm/edid: fix invalid EDID extension block filtering
In reply to Greg Kroah-HartmanFrom: Jani Nikula <[email protected]>
[ Upstream commit 3aefc722ff52076407203b6af9713de567993adf ]
The invalid EDID block filtering uses the number of valid EDID extensions instead of all EDID extensions for looping the extensions in the copy. This is fine, by coincidence, if all the invalid blocks are at the end of the EDID. However, it's completely broken if there are invalid extensions in the middle; the invalid blocks are included and valid blocks are excluded.
Fix it by modifying the base block after, not before, the copy.
--- drivers/gpu/drm/drm_edid.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_edid.c +3 -3
@@ -2029,9 +2029,6 @@ struct edid *drm_do_get_edid(struct drm_connector *connector,connector_bad_edid (connector, edid, edid[0x7e ] +1 ); - edid[EDID_LENGTH -1 ] += edid[0x7e ] - valid_extensions; - edid[0x7e ] = valid_extensions; - new =kmalloc_array (valid_extensions +1 ,EDID_LENGTH ,GFP_KERNEL );if (!new)
@@ -2048,6 +2045,9 @@ struct edid *drm_do_get_edid(struct drm_connector *connector, base +=EDID_LENGTH ; } + new[EDID_LENGTH -1 ] += new[0x7e ] - valid_extensions; + new[0x7e ] = valid_extensions; +kfree (edid); edid = new; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 234/772 drm/bridge: adv7511: clean up CEC adapter when probe fails
In reply to Greg Kroah-HartmanFrom: Lucas Stach <[email protected]>
[ Upstream commit 7ed2b0dabf7a22874cb30f8878df239ef638eb53 ]
When the probe routine fails we also need to clean up the CEC adapter registered in adv7511_cec_init().
--- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +1 -0
@@ -1313,6 +1313,7 @@ static int adv7511_probe(struct i2c_client *i2c, const struct i2c_device_id *id)adv7511_audio_exit (adv7511);drm_bridge_remove (&adv7511->bridge); err_unregister_cec: +cec_unregister_adapter (adv7511->cec_adap);i2c_unregister_device (adv7511->i2c_cec);clk_disable_unprepare (adv7511->cec_clk); err_i2c_unregister_packet:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 237/772 mtd: spinand: gigadevice: fix Quad IO for GD5F1GQ5UExxG
In reply to Greg Kroah-HartmanFrom: Chuanhong Guo <[email protected]>
[ Upstream commit a4f9dd55c5e1bb951db6f1dee20e62e0103f3438 ]
Read From Cache Quad IO (EBH) uses 2 dummy bytes on this chip according to page 23 of the datasheet[0].
[0]: https://www.gigadevice.com/datasheet/gd5f1gq5xexxg/
--- drivers/mtd/nand/spi/gigadevice.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/mtd/nand/spi/gigadevice.c +9 -1
@@ -39,6 +39,14 @@ static SPINAND_OP_VARIANTS(read_cache_variants_f,SPINAND_PAGE_READ_FROM_CACHE_OP_3A (true,0 ,1 ,NULL ,0 ), SPINAND_PAGE_READ_FROM_CACHE_OP_3A(false, 0, 0, NULL, 0)); +static SPINAND_OP_VARIANTS(read_cache_variants_1gq5, + SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), +SPINAND_PAGE_READ_FROM_CACHE_X4_OP (0 ,1 ,NULL ,0 ), +SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP (0 ,1 ,NULL ,0 ), +SPINAND_PAGE_READ_FROM_CACHE_X2_OP (0 ,1 ,NULL ,0 ), +SPINAND_PAGE_READ_FROM_CACHE_OP (true,0 ,1 ,NULL ,0 ), + SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0)); + static SPINAND_OP_VARIANTS(write_cache_variants, SPINAND_PROG_LOAD_X4(true, 0, NULL, 0), SPINAND_PROG_LOAD(true, 0, NULL, 0));
@@ -339,7 +347,7 @@ static const struct spinand_info gigadevice_spinand_table[] = {SPINAND_ID (SPINAND_READID_METHOD_OPCODE_DUMMY ,0x51 ),NAND_MEMORG (1 ,2048 ,128 ,64 ,1024 ,20 ,1 ,1 ,1 ),NAND_ECCREQ (4 ,512 ), -SPINAND_INFO_OP_VARIANTS (&read_cache_variants, +SPINAND_INFO_OP_VARIANTS (&read_cache_variants_1gq5, &write_cache_variants, &update_cache_variants), SPINAND_HAS_QE_BIT,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 240/772 ASoC: mediatek: Fix error handling in mt8173_max98090_dev_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 4f4e0454e226de3bf4efd7e7924d1edc571c52d5 ]
Call of_node_put(platform_node) to avoid refcount leak in the error path.
--- sound/soc/mediatek/mt8173/mt8173-max98090.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
sound/soc/mediatek/mt8173/mt8173-max98090.c +4 -1
@@ -167,7 +167,8 @@ static int mt8173_max98090_dev_probe(struct platform_device *pdev)if (!codec_node) {dev_err (&pdev->dev,"Property 'audio-codec' missing or invalid\n" ); -return -EINVAL ; + ret = -EINVAL ; + goto put_platform_node; }for_each_card_prelinks (card, i, dai_link) {if (dai_link->codecs->name)
@@ -179,6 +180,8 @@ static int mt8173_max98090_dev_probe(struct platform_device *pdev) ret =devm_snd_soc_register_card (&pdev->dev, card);of_node_put (codec_node); + +put_platform_node:of_node_put (platform_node);return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 239/772 ASoC: cs35l41: Fix an out-of-bounds access in otp_packed_element_t
In reply to Greg Kroah-HartmanFrom: Hui Wang <[email protected]>
[ Upstream commit 9f342904216f378e88008bb0ce1ae200a4b99fe8 ]
The CS35L41_NUM_OTP_ELEM is 100, but only 99 entries are defined in the array otp_map_1/2[CS35L41_NUM_OTP_ELEM], this will trigger UBSAN to report a shift-out-of-bounds warning in the cs35l41_otp_unpack() since the last entry in the array will result in GENMASK(-1, 0).
UBSAN reports this problem:
UBSAN: shift-out-of-bounds in /home/hwang4/build/jammy/jammy/sound/soc/codecs/cs35l41-lib.c:836:8 shift exponent 64 is too large for 64-bit type 'long unsigned int' CPU: 10 PID: 595 Comm: systemd-udevd Not tainted 5.15.0-23-generic #23 Hardware name: LENOVO \x02MFG_IN_GO/\x02MFG_IN_GO, BIOS N3GET19W (1.00 ) 03/11/2022 Call Trace: <TASK> show_stack+0x52/0x58 dump_stack_lvl+0x4a/0x5f dump_stack+0x10/0x12 ubsan_epilogue+0x9/0x45 __ubsan_handle_shift_out_of_bounds.cold+0x61/0xef ? regmap_unlock_mutex+0xe/0x10 cs35l41_otp_unpack.cold+0x1c6/0x2b2 [snd_soc_cs35l41_lib] cs35l41_hda_probe+0x24f/0x33a [snd_hda_scodec_cs35l41] cs35l41_hda_i2c_probe+0x65/0x90 [snd_hda_scodec_cs35l41_i2c] ? cs35l41_hda_i2c_remove+0x20/0x20 [snd_hda_scodec_cs35l41_i2c] i2c_device_probe+0x252/0x2b0
--- include/sound/cs35l41.h | 1 - sound/soc/codecs/cs35l41-lib.c | 14 +++++++------- 2 files changed, 7 insertions(+), 8 deletions(-)
include/sound/cs35l41.h +0 -1
@@ -536,7 +536,6 @@#define CS35L41_MAX_CACHE_REG 36#define CS35L41_OTP_SIZE_WORDS 32 -#define CS35L41_NUM_OTP_ELEM 100#define CS35L41_VALID_PDATA 0x80000000#define CS35L41_NUM_SUPPLIES 2
sound/soc/codecs/cs35l41-lib.c +7 -7
@@ -422,7 +422,7 @@ static bool cs35l41_volatile_reg(struct device *dev, unsigned int reg) } } -static const struct cs35l41_otp_packed_element_t otp_map_1[CS35L41_NUM_OTP_ELEM ] = { +static const struct cs35l41_otp_packed_element_t otp_map_1[] = {/* addr shift size */ {0x00002030 ,0 ,4 },/*TRIM_OSC_FREQ_TRIM*/ {0x00002030 ,7 ,1 },/*TRIM_OSC_TRIM_DONE*/
@@ -525,7 +525,7 @@ static const struct cs35l41_otp_packed_element_t otp_map_1[CS35L41_NUM_OTP_ELEM] { 0x00017044, 0, 24 }, /*LOT_NUMBER*/ }; -static const struct cs35l41_otp_packed_element_t otp_map_2[CS35L41_NUM_OTP_ELEM ] = { +static const struct cs35l41_otp_packed_element_t otp_map_2[] = {/* addr shift size */ {0x00002030 ,0 ,4 },/*TRIM_OSC_FREQ_TRIM*/ { 0x00002030, 7, 1 }, /*TRIM_OSC_TRIM_DONE*/
@@ -671,35 +671,35 @@ static const struct cs35l41_otp_map_element_t cs35l41_otp_map_map[] = { { .id = 0x01, .map = otp_map_1, - .num_elements = CS35L41_NUM_OTP_ELEM, + .num_elements = ARRAY_SIZE(otp_map_1), .bit_offset = 16, .word_offset = 2, }, { .id = 0x02, .map = otp_map_2, - .num_elements = CS35L41_NUM_OTP_ELEM, + .num_elements = ARRAY_SIZE(otp_map_2), .bit_offset = 16, .word_offset = 2, }, { .id = 0x03, .map = otp_map_2, - .num_elements = CS35L41_NUM_OTP_ELEM, + .num_elements = ARRAY_SIZE(otp_map_2), .bit_offset = 16, .word_offset = 2, }, { .id = 0x06, .map = otp_map_2, - .num_elements = CS35L41_NUM_OTP_ELEM, + .num_elements = ARRAY_SIZE(otp_map_2), .bit_offset = 16, .word_offset = 2, }, { .id = 0x08, .map = otp_map_1, - .num_elements = CS35L41_NUM_OTP_ELEM, + .num_elements = ARRAY_SIZE(otp_map_1), .bit_offset = 16, .word_offset = 2, },
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 242/772 x86/delay: Fix the wrong asm constraint in delay_loop()
In reply to Greg Kroah-HartmanFrom: Ammar Faizi <[email protected]>
[ Upstream commit b86eb74098a92afd789da02699b4b0dd3f73b889 ]
The asm constraint does not reflect the fact that the asm statement can modify the value of the local variable loops. Which it does.
Specifying the wrong constraint may lead to undefined behavior, it may clobber random stuff (e.g. local variable, important temporary value in regs, etc.). This is especially dangerous when the compiler decides to inline the function and since it doesn't know that the value gets modified, it might decide to use it from a register directly without reloading it.
Change the constraint to "+a" to denote that the first argument is an input and an output argument.
[ bp: Fix typo, massage commit message. ]
--- arch/x86/lib/delay.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/lib/delay.c +2 -2
@@ -54,8 +54,8 @@ static void delay_loop(u64 __loops)" jnz 2b \n" "3: dec %0 \n" - : /* we don't need output */ - :"a" (loops) + : "+a" (loops) + : ); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 244/772 drm/mediatek: Fix DPI component detection for MT8192
In reply to Greg Kroah-HartmanFrom: Chen-Yu Tsai <[email protected]>
[ Upstream commit cfab37ff31afcd0f99f3cccbff1f8ffa11e44c00 ]
When support for MT8192 was added, the DPI device was not added to the list of components to look for. This causes the secondary display pipeline to not be able to fully bind, and the DRM driver subsequently defers probing.
Add the DPI device compatible to list of DPI components to fix this.
--- drivers/gpu/drm/mediatek/mtk_drm_drv.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/mediatek/mtk_drm_drv.c +2 -0
@@ -511,6 +511,8 @@ static const struct of_device_id mtk_ddp_comp_dt_ids[] = { .data = (void *)MTK_DPI }, { .compatible = "mediatek,mt8183-dpi", .data = (void *)MTK_DPI }, + { .compatible = "mediatek,mt8192-dpi", + .data = (void *)MTK_DPI }, { .compatible = "mediatek,mt2701-dsi", .data = (void *)MTK_DSI }, { .compatible = "mediatek,mt8173-dsi",
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 247/772 drm/mediatek: Fix mtk_cec_mask()
In reply to Greg Kroah-HartmanFrom: Miles Chen <[email protected]>
[ Upstream commit 2c5d69b0a141e1e98febe3111e6f4fd8420493a5 ]
In current implementation, mtk_cec_mask() writes val into target register and ignores the mask. After talking to our hdmi experts, mtk_cec_mask() should read a register, clean only mask bits, and update (val | mask) bits to the register.
--- drivers/gpu/drm/mediatek/mtk_cec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/mediatek/mtk_cec.c +1 -1
@@ -85,7 +85,7 @@ static void mtk_cec_mask(struct mtk_cec *cec, unsigned int offset,u32 tmp =readl (cec->regs + offset) & ~mask; tmp |= val & mask; -writel (val, cec->regs + offset); +writel (tmp, cec->regs + offset); } void mtk_cec_set_hpd_event(struct device *dev,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 211/772 KVM: PPC: Book3S HV Nested: L2 LPCR should inherit L1 LPES setting
In reply to Greg Kroah-HartmanFrom: Nicholas Piggin <[email protected]>
[ Upstream commit 2852ebfa10afdcefff35ec72c8da97141df9845c ]
The L1 should not be able to adjust LPES mode for the L2. Setting LPES if the L0 needs it clear would cause external interrupts to be sent to L2 and missed by the L0.
Clearing LPES when it may be set, as typically happens with XIVE enabled could cause a performance issue despite having no native XIVE support in the guest, because it will cause mediated interrupts for the L2 to be taken in HV mode, which then have to be injected.
--- arch/powerpc/kvm/book3s_hv.c | 4 ++++ arch/powerpc/kvm/book3s_hv_nested.c | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-)
arch/powerpc/kvm/book3s_hv.c +4 -0
@@ -5289,6 +5289,10 @@ static int kvmppc_core_init_vm_hv(struct kvm *kvm) kvm->arch.host_lpcr = lpcr =mfspr (SPRN_LPCR ); lpcr &=LPCR_PECE |LPCR_LPES ; }else { +/* +* The L2 LPES mode will be set by the L0 according to whether +* or not it needs to take external interrupts in HV mode. +*/ lpcr =0 ; } lpcr |= (4UL << LPCR_DPFD_SH) | LPCR_HDICE |
arch/powerpc/kvm/book3s_hv_nested.c +1 -2
@@ -261,8 +261,7 @@ static void load_l2_hv_regs(struct kvm_vcpu *vcpu,/* * Don't let L1 change LPCR bits for the L2 except these: */ - mask =LPCR_DPFD |LPCR_ILE |LPCR_TC |LPCR_AIL |LPCR_LD | -LPCR_LPES |LPCR_MER ; + mask =LPCR_DPFD |LPCR_ILE |LPCR_TC |LPCR_AIL |LPCR_LD |LPCR_MER ;/* * Additional filtering is required depending on hardware
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 248/772 drm/vc4: hvs: Reset muxes at probe time
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
[ Upstream commit 8514e6b1f40319e31ac4aa3fbf606796786366c9 ]
By default, the HVS driver will force the HVS output 3 to be muxed to the HVS channel 2. However, the Transposer can only be assigned to the HVS channel 2, so whenever we try to use the writeback connector, we'll mux its associated output (Output 2) to the channel 2.
This leads to both the output 2 and 3 feeding from the same channel, which is explicitly discouraged in the documentation.
In order to avoid this, let's reset all the output muxes to their reset value.
--- drivers/gpu/drm/vc4/vc4_hvs.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-)
drivers/gpu/drm/vc4/vc4_hvs.c +21 -5
@@ -605,6 +605,7 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data)struct vc4_hvs *hvs =NULL ;int ret;u32 dispctrl; +u32 reg; hvs =devm_kzalloc (&pdev->dev,sizeof (*hvs),GFP_KERNEL );if (!hvs)
@@ -676,6 +677,26 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data) vc4->hvs = hvs; + reg =HVS_READ (SCALER_DISPECTRL ); + reg &= ~SCALER_DISPECTRL_DSP2_MUX_MASK ; +HVS_WRITE (SCALER_DISPECTRL , + reg |VC4_SET_FIELD (0 ,SCALER_DISPECTRL_DSP2_MUX )); + + reg =HVS_READ (SCALER_DISPCTRL ); + reg &= ~SCALER_DISPCTRL_DSP3_MUX_MASK ; +HVS_WRITE (SCALER_DISPCTRL , + reg |VC4_SET_FIELD (3 ,SCALER_DISPCTRL_DSP3_MUX )); + + reg =HVS_READ (SCALER_DISPEOLN ); + reg &= ~SCALER_DISPEOLN_DSP4_MUX_MASK ; +HVS_WRITE (SCALER_DISPEOLN , + reg |VC4_SET_FIELD (3 ,SCALER_DISPEOLN_DSP4_MUX )); + + reg =HVS_READ (SCALER_DISPDITHER ); + reg &= ~SCALER_DISPDITHER_DSP5_MUX_MASK ; +HVS_WRITE (SCALER_DISPDITHER , + reg |VC4_SET_FIELD (3 ,SCALER_DISPDITHER_DSP5_MUX )); + dispctrl =HVS_READ (SCALER_DISPCTRL ); dispctrl |=SCALER_DISPCTRL_ENABLE ;
@@ -683,10 +704,6 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data)SCALER_DISPCTRL_DISPEIRQ (1 ) |SCALER_DISPCTRL_DISPEIRQ (2 ); -/* Set DSP3 (PV1) to use HVS channel 2, which would otherwise -* be unused. -*/ - dispctrl &= ~SCALER_DISPCTRL_DSP3_MUX_MASK ; dispctrl &= ~(SCALER_DISPCTRL_DMAEIRQ | SCALER_DISPCTRL_SLVWREIRQ | SCALER_DISPCTRL_SLVRDEIRQ |
@@ -700,7 +717,6 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data)SCALER_DISPCTRL_DSPEISLUR (1 ) |SCALER_DISPCTRL_DSPEISLUR (2 ) | SCALER_DISPCTRL_SCLEIRQ); - dispctrl |=VC4_SET_FIELD (2 ,SCALER_DISPCTRL_DSP3_MUX );HVS_WRITE (SCALER_DISPCTRL , dispctrl);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 246/772 drm/vc4: hvs: Fix frame count register readout
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
[ Upstream commit b51cd7ad143d2eb31a6df81c2183128920e47c2b ]
In order to get the field currently being output, the driver has been using the display FIFO frame count in the HVS, reading a 6-bit field at the offset 12 in the DISPSTATx register.
While that field is indeed at that location for the FIFO 1 and 2, the one for the FIFO0 is actually in the DISPSTAT1 register, at the offset 18.
--- drivers/gpu/drm/vc4/vc4_crtc.c | 2 +- drivers/gpu/drm/vc4/vc4_drv.h | 1 + drivers/gpu/drm/vc4/vc4_hvs.c | 23 +++++++++++++++++++++++ drivers/gpu/drm/vc4/vc4_regs.h | 12 ++++++++++-- 4 files changed, 35 insertions(+), 3 deletions(-)
drivers/gpu/drm/vc4/vc4_crtc.c +1 -1
@@ -123,7 +123,7 @@ static bool vc4_crtc_get_scanout_position(struct drm_crtc *crtc, *vpos /=2 ;/* Use hpos to correct for field offset in interlaced mode. */ -if (VC4_GET_FIELD (val,SCALER_DISPSTATX_FRAME_COUNT ) %2 ) +if (vc4_hvs_get_fifo_frame_count (dev, vc4_crtc_state->assigned_channel) %2 ) *hpos += mode->crtc_htotal /2 ; }
drivers/gpu/drm/vc4/vc4_drv.h +1 -0
@@ -935,6 +935,7 @@ void vc4_irq_reset(struct drm_device *dev);extern struct platform_driver vc4_hvs_driver;void vc4_hvs_stop_channel (struct drm_device *dev,unsigned int output);int vc4_hvs_get_fifo_from_output (struct drm_device *dev,unsigned int output); +u8 vc4_hvs_get_fifo_frame_count (struct drm_device *dev,unsigned int fifo);int vc4_hvs_atomic_check (struct drm_crtc *crtc,struct drm_atomic_state *state);void vc4_hvs_atomic_begin (struct drm_crtc *crtc,struct drm_atomic_state *state);void vc4_hvs_atomic_enable (struct drm_crtc *crtc,struct drm_atomic_state *state);
drivers/gpu/drm/vc4/vc4_hvs.c +23 -0
@@ -197,6 +197,29 @@ static void vc4_hvs_update_gamma_lut(struct drm_crtc *crtc)vc4_hvs_lut_load (crtc); } +u8 vc4_hvs_get_fifo_frame_count (struct drm_device *dev,unsigned int fifo) +{ +struct vc4_dev *vc4 =to_vc4_dev (dev); +u8 field =0 ; + +switch (fifo) { +case 0 : + field =VC4_GET_FIELD (HVS_READ (SCALER_DISPSTAT1 ), +SCALER_DISPSTAT1_FRCNT0 ); +break ; +case 1 : + field =VC4_GET_FIELD (HVS_READ (SCALER_DISPSTAT1 ), +SCALER_DISPSTAT1_FRCNT1 ); +break ; +case 2 : + field =VC4_GET_FIELD (HVS_READ (SCALER_DISPSTAT2 ), +SCALER_DISPSTAT2_FRCNT2 ); +break ; + } + +return field; +} +int vc4_hvs_get_fifo_from_output (struct drm_device *dev,unsigned int output) {struct vc4_dev *vc4 =to_vc4_dev (dev);
drivers/gpu/drm/vc4/vc4_regs.h +10 -2
@@ -379,8 +379,6 @@# define SCALER_DISPSTATX_MODE_EOF 3# define SCALER_DISPSTATX_FULL BIT(29)# define SCALER_DISPSTATX_EMPTY BIT(28) -# define SCALER_DISPSTATX_FRAME_COUNT_MASK VC4_MASK(17, 12) -# define SCALER_DISPSTATX_FRAME_COUNT_SHIFT 12# define SCALER_DISPSTATX_LINE_MASK VC4_MASK(11, 0)# define SCALER_DISPSTATX_LINE_SHIFT 0
@@ -403,9 +401,15 @@ (x) * (SCALER_DISPBKGND1 - \ SCALER_DISPBKGND0))#define SCALER_DISPSTAT1 0x00000058 +# define SCALER_DISPSTAT1_FRCNT0_MASK VC4_MASK(23, 18) +# define SCALER_DISPSTAT1_FRCNT0_SHIFT 18 +# define SCALER_DISPSTAT1_FRCNT1_MASK VC4_MASK(17, 12) +# define SCALER_DISPSTAT1_FRCNT1_SHIFT 12 +#define SCALER_DISPSTATX (x) (SCALER_DISPSTAT0 + \ (x) * (SCALER_DISPSTAT1 - \ SCALER_DISPSTAT0)) +#define SCALER_DISPBASE1 0x0000005c#define SCALER_DISPBASEX (x) (SCALER_DISPBASE0 + \ (x) * (SCALER_DISPBASE1 - \
@@ -415,7 +419,11 @@ (x) * (SCALER_DISPCTRL1 - \ SCALER_DISPCTRL0))#define SCALER_DISPBKGND2 0x00000064 +#define SCALER_DISPSTAT2 0x00000068 +# define SCALER_DISPSTAT2_FRCNT2_MASK VC4_MASK(17, 12) +# define SCALER_DISPSTAT2_FRCNT2_SHIFT 12 +#define SCALER_DISPBASE2 0x0000006c#define SCALER_DISPALPHA2 0x00000070#define SCALER_GAMADDR 0x00000078
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 243/772 drm/mediatek: Add vblank register/unregister callback functions
In reply to Greg Kroah-HartmanFrom: Rex-BC Chen <[email protected]>
[ Upstream commit b74d921b900b6ce38c6247c0a1c86be9f3746493 ]
We encountered a kernel panic issue that callback data will be NULL when it's using in ovl irq handler. There is a timing issue between mtk_disp_ovl_irq_handler() and mtk_ovl_disable_vblank().
To resolve this issue, we use the flow to register/unregister vblank cb:
- Register callback function and callback data when crtc creates.
- Unregister callback function and callback data when crtc destroies.
With this solution, we can assure callback data will not be NULL when vblank is disable.
--- drivers/gpu/drm/mediatek/mtk_disp_drv.h | 16 +++++++----- drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 22 ++++++++++++---- drivers/gpu/drm/mediatek/mtk_disp_rdma.c | 20 +++++++++----- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 14 +++++++++- drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 4 +++ drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 29 ++++++++++++++++----- 6 files changed, 80 insertions(+), 25 deletions(-)
drivers/gpu/drm/mediatek/mtk_disp_drv.h +10 -6
@@ -76,9 +76,11 @@ void mtk_ovl_layer_off(struct device *dev, unsigned int idx,void mtk_ovl_start (struct device *dev);void mtk_ovl_stop (struct device *dev);unsigned int mtk_ovl_supported_rotations (struct device *dev); -void mtk_ovl_enable_vblank (struct device *dev, -void (*vblank_cb)(void *), -void *vblank_cb_data); +void mtk_ovl_register_vblank_cb (struct device *dev, +void (*vblank_cb)(void *), +void *vblank_cb_data); +void mtk_ovl_unregister_vblank_cb (struct device *dev); +void mtk_ovl_enable_vblank (struct device *dev);void mtk_ovl_disable_vblank (struct device *dev);void mtk_rdma_bypass_shadow (struct device *dev);
@@ -93,9 +95,11 @@ void mtk_rdma_layer_config(struct device *dev, unsigned int idx, struct cmdq_pkt *cmdq_pkt);void mtk_rdma_start (struct device *dev);void mtk_rdma_stop (struct device *dev); -void mtk_rdma_enable_vblank (struct device *dev, -void (*vblank_cb)(void *), -void *vblank_cb_data); +void mtk_rdma_register_vblank_cb (struct device *dev, +void (*vblank_cb)(void *), +void *vblank_cb_data); +void mtk_rdma_unregister_vblank_cb (struct device *dev); +void mtk_rdma_enable_vblank (struct device *dev);void mtk_rdma_disable_vblank (struct device *dev);#endif
drivers/gpu/drm/mediatek/mtk_disp_ovl.c +17 -5
@@ -96,14 +96,28 @@ static irqreturn_t mtk_disp_ovl_irq_handler(int irq, void *dev_id)return IRQ_HANDLED ; } -void mtk_ovl_enable_vblank (struct device *dev, -void (*vblank_cb)(void *), -void *vblank_cb_data) +void mtk_ovl_register_vblank_cb (struct device *dev, +void (*vblank_cb)(void *), +void *vblank_cb_data) {struct mtk_disp_ovl *ovl =dev_get_drvdata (dev); ovl->vblank_cb = vblank_cb; ovl->vblank_cb_data = vblank_cb_data; +} + +void mtk_ovl_unregister_vblank_cb (struct device *dev) +{ +struct mtk_disp_ovl *ovl =dev_get_drvdata (dev); + + ovl->vblank_cb =NULL ; + ovl->vblank_cb_data =NULL ; +} + +void mtk_ovl_enable_vblank (struct device *dev) +{ +struct mtk_disp_ovl *ovl =dev_get_drvdata (dev); +writel (0x0 , ovl->regs +DISP_REG_OVL_INTSTA );writel_relaxed (OVL_FME_CPL_INT , ovl->regs +DISP_REG_OVL_INTEN ); }
@@ -112,8 +126,6 @@ void mtk_ovl_disable_vblank(struct device *dev) {struct mtk_disp_ovl *ovl =dev_get_drvdata (dev); - ovl->vblank_cb =NULL ; - ovl->vblank_cb_data =NULL ;writel_relaxed (0x0 , ovl->regs +DISP_REG_OVL_INTEN ); }
drivers/gpu/drm/mediatek/mtk_disp_rdma.c +14 -6
@@ -94,24 +94,32 @@ static void rdma_update_bits(struct device *dev, unsigned int reg,writel (tmp, rdma->regs + reg); } -void mtk_rdma_enable_vblank (struct device *dev, -void (*vblank_cb)(void *), -void *vblank_cb_data) +void mtk_rdma_register_vblank_cb (struct device *dev, +void (*vblank_cb)(void *), +void *vblank_cb_data) {struct mtk_disp_rdma *rdma =dev_get_drvdata (dev); rdma->vblank_cb = vblank_cb; rdma->vblank_cb_data = vblank_cb_data; -rdma_update_bits (dev,DISP_REG_RDMA_INT_ENABLE ,RDMA_FRAME_END_INT , -RDMA_FRAME_END_INT ); } -void mtk_rdma_disable_vblank (struct device *dev) +void mtk_rdma_unregister_vblank_cb (struct device *dev) {struct mtk_disp_rdma *rdma =dev_get_drvdata (dev); rdma->vblank_cb =NULL ; rdma->vblank_cb_data =NULL ; +} + +void mtk_rdma_enable_vblank (struct device *dev) +{ +rdma_update_bits (dev,DISP_REG_RDMA_INT_ENABLE ,RDMA_FRAME_END_INT , +RDMA_FRAME_END_INT ); +} + +void mtk_rdma_disable_vblank (struct device *dev) +{rdma_update_bits (dev,DISP_REG_RDMA_INT_ENABLE ,RDMA_FRAME_END_INT ,0 ); }
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +13 -1
@@ -152,6 +152,7 @@ static void mtk_drm_cmdq_pkt_destroy(struct cmdq_pkt *pkt)static void mtk_drm_crtc_destroy (struct drm_crtc *crtc) {struct mtk_drm_crtc *mtk_crtc =to_mtk_crtc (crtc); +int i;mtk_mutex_put (mtk_crtc->mutex);#if IS_REACHABLE (CONFIG_MTK_CMDQ )
@@ -162,6 +163,14 @@ static void mtk_drm_crtc_destroy(struct drm_crtc *crtc) mtk_crtc->cmdq_client.chan = NULL; }#endif + +for (i =0 ; i < mtk_crtc->ddp_comp_nr; i++) { +struct mtk_ddp_comp *comp; + + comp = mtk_crtc->ddp_comp[i]; +mtk_ddp_comp_unregister_vblank_cb (comp); + } +drm_crtc_cleanup (crtc); }
@@ -616,7 +625,7 @@ static int mtk_drm_crtc_enable_vblank(struct drm_crtc *crtc)struct mtk_drm_crtc *mtk_crtc =to_mtk_crtc (crtc);struct mtk_ddp_comp *comp = mtk_crtc->ddp_comp[0 ]; -mtk_ddp_comp_enable_vblank (comp, mtk_crtc_ddp_irq, &mtk_crtc->base); +mtk_ddp_comp_enable_vblank (comp);return 0 ; }
@@ -916,6 +925,9 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev,if (comp->funcs->ctm_set) has_ctm = true; } + +mtk_ddp_comp_register_vblank_cb (comp, mtk_crtc_ddp_irq, + &mtk_crtc->base); }for (i =0 ; i < mtk_crtc->ddp_comp_nr; i++)
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +4 -0
@@ -297,6 +297,8 @@ static const struct mtk_ddp_comp_funcs ddp_ovl = { .config = mtk_ovl_config, .start = mtk_ovl_start, .stop = mtk_ovl_stop, + .register_vblank_cb = mtk_ovl_register_vblank_cb, + .unregister_vblank_cb = mtk_ovl_unregister_vblank_cb, .enable_vblank = mtk_ovl_enable_vblank, .disable_vblank = mtk_ovl_disable_vblank, .supported_rotations = mtk_ovl_supported_rotations,
@@ -321,6 +323,8 @@ static const struct mtk_ddp_comp_funcs ddp_rdma = { .config = mtk_rdma_config, .start = mtk_rdma_start, .stop = mtk_rdma_stop, + .register_vblank_cb = mtk_rdma_register_vblank_cb, + .unregister_vblank_cb = mtk_rdma_unregister_vblank_cb, .enable_vblank = mtk_rdma_enable_vblank, .disable_vblank = mtk_rdma_disable_vblank, .layer_nr = mtk_rdma_layer_nr,
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h +22 -7
@@ -48,9 +48,11 @@ struct mtk_ddp_comp_funcs { unsigned int bpc, struct cmdq_pkt *cmdq_pkt);void (*start)(struct device *dev);void (*stop)(struct device *dev); -void (*enable_vblank)(struct device *dev, -void (*vblank_cb)(void *), -void *vblank_cb_data); +void (*register_vblank_cb)(struct device *dev, +void (*vblank_cb)(void *), +void *vblank_cb_data); +void (*unregister_vblank_cb)(struct device *dev); +void (*enable_vblank)(struct device *dev);void (*disable_vblank)(struct device *dev);unsigned int (*supported_rotations)(struct device *dev);unsigned int (*layer_nr)(struct device *dev);
@@ -111,12 +113,25 @@ static inline void mtk_ddp_comp_stop(struct mtk_ddp_comp *comp) comp->funcs->stop (comp->dev); } -static inline void mtk_ddp_comp_enable_vblank (struct mtk_ddp_comp *comp, -void (*vblank_cb)(void *), -void *vblank_cb_data) +static inline void mtk_ddp_comp_register_vblank_cb (struct mtk_ddp_comp *comp, +void (*vblank_cb)(void *), +void *vblank_cb_data) +{ +if (comp->funcs && comp->funcs->register_vblank_cb) + comp->funcs->register_vblank_cb (comp->dev, vblank_cb, + vblank_cb_data); +} + +static inline void mtk_ddp_comp_unregister_vblank_cb (struct mtk_ddp_comp *comp) +{ +if (comp->funcs && comp->funcs->unregister_vblank_cb) + comp->funcs->unregister_vblank_cb (comp->dev); +} + +static inline void mtk_ddp_comp_enable_vblank (struct mtk_ddp_comp *comp) {if (comp->funcs && comp->funcs->enable_vblank) - comp->funcs->enable_vblank (comp->dev, vblank_cb, vblank_cb_data); + comp->funcs->enable_vblank (comp->dev); }static inline void mtk_ddp_comp_disable_vblank (struct mtk_ddp_comp *comp)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 245/772 drm/vc4: kms: Take old state core clock rate into account
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
[ Upstream commit 748acfc98adab21a93ae7a1b5bed0f048463e873 ]
During a commit, the core clock, which feeds the HVS, needs to run at a minimum of 500MHz.
While doing that commit, we can also change the mode to one that requires a higher core clock, so we take the core clock rate associated to that new state into account for that boost.
However, the old state also needs to be taken into account if it requires a core clock higher that the new one and our 500MHz limit, since it's still live in hardware at the beginning of our commit.
--- drivers/gpu/drm/vc4/vc4_kms.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/vc4/vc4_kms.c +3 -2
@@ -385,9 +385,10 @@ static void vc4_atomic_commit_tail(struct drm_atomic_state *state) }if (vc4->hvs->hvs5) { +unsigned long state_rate =max (old_hvs_state->core_clock_rate, + new_hvs_state->core_clock_rate); unsigned long core_rate = max_t(unsigned long, -500000000 , - new_hvs_state->core_clock_rate); +500000000 , state_rate);clk_set_min_rate (hvs->core_clk, core_rate); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 249/772 drm/vc4: txp: Dont set TXP_VSTART_AT_EOF
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
[ Upstream commit 234998df929f14d00cbf2f1e81a7facb69fd9266 ]
The TXP_VSTART_AT_EOF will generate a second VSTART signal to the HVS. However, the HVS waits for VSTART to enable the FIFO and will thus start filling the FIFO before the start of the frame.
This leads to corruption at the beginning of the first frame, and content from the previous frame at the beginning of the next frames.
Since one VSTART is enough, let's get rid of it.
--- drivers/gpu/drm/vc4/vc4_txp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vc4/vc4_txp.c +1 -1
@@ -298,7 +298,7 @@ static void vc4_txp_connector_atomic_commit(struct drm_connector *conn,if (WARN_ON (i ==ARRAY_SIZE (drm_fmts)))return ; - ctrl =TXP_GO |TXP_VSTART_AT_EOF |TXP_EI | + ctrl =TXP_GO |TXP_EI |VC4_SET_FIELD (0xf ,TXP_BYTE_ENABLE ) |VC4_SET_FIELD (txp_fmts[i],TXP_FORMAT );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 207/772 PCI: microchip: Add missing chained_irq_enter()/exit() calls
In reply to Greg Kroah-HartmanFrom: Conor Dooley <[email protected]>
[ Upstream commit 30097efa334a706f9021b9aee6efcddcfa44a78a ]
Two of the chained IRQ handlers miss their chained_irq_enter()/chained_irq_exit() calls, so add them in to avoid potentially lost interrupts.
Reported by: Bjorn Helgaas <[email protected]>
--- drivers/pci/controller/pcie-microchip-host.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/pci/controller/pcie-microchip-host.c +10 -0
@@ -406,6 +406,7 @@ static void mc_pcie_enable_msi(struct mc_pcie *port, void __iomem *base)static void mc_handle_msi (struct irq_desc *desc) {struct mc_pcie *port =irq_desc_get_handler_data (desc); +struct irq_chip *chip =irq_desc_get_chip (desc);struct device *dev = port->dev;struct mc_msi *msi = &port->msi; void __iomem *bridge_base_addr =
@@ -414,6 +415,8 @@ static void mc_handle_msi(struct irq_desc *desc)u32 bit;int ret; +chained_irq_enter (chip, desc); + status =readl_relaxed (bridge_base_addr +ISTATUS_LOCAL );if (status &PM_MSI_INT_MSI_MASK ) { status =readl_relaxed (bridge_base_addr +ISTATUS_MSI );
@@ -424,6 +427,8 @@ static void mc_handle_msi(struct irq_desc *desc) bit); } } + +chained_irq_exit (chip, desc); }static void mc_msi_bottom_irq_ack (struct irq_data *data)
@@ -563,6 +568,7 @@ static int mc_allocate_msi_domains(struct mc_pcie *port)static void mc_handle_intx (struct irq_desc *desc) {struct mc_pcie *port =irq_desc_get_handler_data (desc); +struct irq_chip *chip =irq_desc_get_chip (desc);struct device *dev = port->dev;void __iomem *bridge_base_addr = port->axi_base_addr +MC_PCIE_BRIDGE_ADDR ;
@@ -570,6 +576,8 @@ static void mc_handle_intx(struct irq_desc *desc)u32 bit;int ret; +chained_irq_enter (chip, desc); + status =readl_relaxed (bridge_base_addr +ISTATUS_LOCAL );if (status &PM_MSI_INT_INTX_MASK ) { status &=PM_MSI_INT_INTX_MASK ;
@@ -581,6 +589,8 @@ static void mc_handle_intx(struct irq_desc *desc) bit); } } + +chained_irq_exit (chip, desc); }static void mc_ack_intx_irq (struct irq_data *data)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 210/772 PCI: cadence: Clear FLR in device capabilities register
In reply to Greg Kroah-HartmanFrom: Parshuram Thombare <[email protected]>
[ Upstream commit 95b00f68209e2bc9f2ee9126afcebab451e0e9d8 ]
Clear FLR (Function Level Reset) from device capabilities registers for all physical functions.
During FLR, the Margining Lane Status and Margining Lane Control registers should not be reset, as per PCIe specification. However, the controller incorrectly resets these registers upon FLR. This causes PCISIG compliance FLR test to fail. Hence preventing all functions from advertising FLR support if flag quirk_disable_flr is set.
--- drivers/pci/controller/cadence/pci-j721e.c | 3 +++ .../pci/controller/cadence/pcie-cadence-ep.c | 18 +++++++++++++++++- drivers/pci/controller/cadence/pcie-cadence.h | 3 +++ 3 files changed, 23 insertions(+), 1 deletion(-)
drivers/pci/controller/cadence/pci-j721e.c +3 -0
@@ -69,6 +69,7 @@ struct j721e_pcie_data {enum j721e_pcie_mode mode; unsigned int quirk_retrain_flag:1; unsigned int quirk_detect_quiet_flag:1; + unsigned int quirk_disable_flr:1;u32 linkdown_irq_regfield; unsigned int byte_access_allowed:1; };
@@ -307,6 +308,7 @@ static const struct j721e_pcie_data j7200_pcie_rc_data = {static const struct j721e_pcie_data j7200_pcie_ep_data = { .mode =PCI_MODE_EP , .quirk_detect_quiet_flag = true, + .quirk_disable_flr = true, };static const struct j721e_pcie_data am64_pcie_rc_data = {
@@ -405,6 +407,7 @@ static int j721e_pcie_probe(struct platform_device *pdev)return -ENOMEM ; ep->quirk_detect_quiet_flag = data->quirk_detect_quiet_flag; + ep->quirk_disable_flr = data->quirk_disable_flr; cdns_pcie = &ep->pcie; cdns_pcie->dev = dev;
drivers/pci/controller/cadence/pcie-cadence-ep.c +17 -1
@@ -565,7 +565,8 @@ static int cdns_pcie_ep_start(struct pci_epc *epc)struct cdns_pcie_ep *ep =epc_get_drvdata (epc);struct cdns_pcie *pcie = &ep->pcie;struct device *dev = pcie->dev; -int ret; +int max_epfs =sizeof (epc->function_num_map) *8 ; +int ret, value, epf;/* * BIT(0) is hardwired to 1, hence function 0 is always enabled
@@ -573,6 +574,21 @@ static int cdns_pcie_ep_start(struct pci_epc *epc)*/ cdns_pcie_writel (pcie,CDNS_PCIE_LM_EP_FUNC_CFG , epc->function_num_map); +if (ep->quirk_disable_flr) { +for (epf =0 ; epf < max_epfs; epf++) { +if (!(epc->function_num_map &BIT (epf))) +continue ; + + value =cdns_pcie_ep_fn_readl (pcie, epf, +CDNS_PCIE_EP_FUNC_DEV_CAP_OFFSET + +PCI_EXP_DEVCAP ); + value &= ~PCI_EXP_DEVCAP_FLR ; +cdns_pcie_ep_fn_writel (pcie, epf, +CDNS_PCIE_EP_FUNC_DEV_CAP_OFFSET + +PCI_EXP_DEVCAP , value); + } + } + ret =cdns_pcie_start_link (pcie);if (ret) {dev_err (dev,"Failed to start link\n" );
drivers/pci/controller/cadence/pcie-cadence.h +3 -0
@@ -123,6 +123,7 @@#define CDNS_PCIE_EP_FUNC_MSI_CAP_OFFSET 0x90#define CDNS_PCIE_EP_FUNC_MSIX_CAP_OFFSET 0xb0 +#define CDNS_PCIE_EP_FUNC_DEV_CAP_OFFSET 0xc0#define CDNS_PCIE_EP_FUNC_SRIOV_CAP_OFFSET 0x200/*
@@ -357,6 +358,7 @@ struct cdns_pcie_epf {* minimize time between read and write * @epf: Structure to hold info about endpoint function * @quirk_detect_quiet_flag: LTSSM Detect Quiet min delay set as quirk +* @quirk_disable_flr: Disable FLR (Function Level Reset) quirk flag */ struct cdns_pcie_ep {struct cdns_pcie pcie;
@@ -372,6 +374,7 @@ struct cdns_pcie_ep {spinlock_t lock;struct cdns_pcie_epf *epf; unsigned int quirk_detect_quiet_flag:1; + unsigned int quirk_disable_flr:1; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 214/772 cifs: return ENOENT for DFS lookup_cache_entry()
In reply to Greg Kroah-HartmanFrom: Enzo Matsumiya <[email protected]>
[ Upstream commit 337b8b0e4343567221ef8d88aac5e418208d4ac1 ]
EEXIST didn't make sense to use when dfs_cache_find() couldn't find a cache entry nor retrieve a referral target.
It also doesn't make sense cifs_dfs_query_info_nonascii_quirk() to emulate ENOENT anymore.
--- fs/cifs/connect.c | 6 ++++-- fs/cifs/dfs_cache.c | 6 +++--- fs/cifs/misc.c | 6 +----- 3 files changed, 8 insertions(+), 10 deletions(-)
fs/cifs/connect.c +4 -2
@@ -3406,8 +3406,9 @@ cifs_are_all_path_components_accessible(struct TCP_Server_Info *server, }/* -* Check if path is remote (e.g. a DFS share). Return -EREMOTE if it is, -* otherwise 0. +* Check if path is remote (i.e. a DFS share). +* +* Return -EREMOTE if it is, otherwise 0 or -errno. */ static int is_path_remote (struct mount_ctx *mnt_ctx) {
@@ -3697,6 +3698,7 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx)if (!isdfs) goto out; +/* proceed as DFS mount */ uuid_gen (&mnt_ctx.mount_id); rc =connect_dfs_root (&mnt_ctx, &tl);dfs_cache_free_tgts (&tl);
fs/cifs/dfs_cache.c +3 -3
@@ -654,7 +654,7 @@ static struct cache_entry *__lookup_cache_entry(const char *path, unsigned int hreturn ce; } } -return ERR_PTR (-EEXIST ); +return ERR_PTR (-ENOENT ); }/*
@@ -662,7 +662,7 @@ static struct cache_entry *__lookup_cache_entry(const char *path, unsigned int h* * Use whole path components in the match. Must be called with htable_rw_lock held. * -* Return ERR_PTR(-EEXIST) if the entry is not found. +* Return ERR_PTR(-ENOENT) if the entry is not found. */ static struct cache_entry *lookup_cache_entry (const char *path) {
@@ -710,7 +710,7 @@ static struct cache_entry *lookup_cache_entry(const char *path)while (e > s && *e != sep) e--; } -return ERR_PTR (-EEXIST ); +return ERR_PTR (-ENOENT ); }/**
fs/cifs/misc.c +1 -5
@@ -1308,7 +1308,7 @@ int cifs_update_super_prepath(struct cifs_sb_info *cifs_sb, char *prefix)* for "\<server>\<dfsname>\<linkpath>" DFS reference, * where <dfsname> contains non-ASCII unicode symbols. * -* Check such DFS reference and emulate -ENOENT if it is actual. +* Check such DFS reference. */ int cifs_dfs_query_info_nonascii_quirk(const unsigned int xid, struct cifs_tcon *tcon,
@@ -1340,10 +1340,6 @@ int cifs_dfs_query_info_nonascii_quirk(const unsigned int xid,cifs_dbg (FYI ,"DFS ref '%s' is found, emulate -EREMOTE\n" , dfspath); rc = -EREMOTE ; - }else if (rc == -EEXIST ) { -cifs_dbg (FYI ,"DFS ref '%s' is not found, emulate -ENOENT\n" , - dfspath); - rc = -ENOENT ; }else {cifs_dbg (FYI ,"%s: dfs_cache_find returned %d\n" , __func__, rc); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 216/772 powerpc/xics: fix refcount leak in icp_opal_init()
In reply to Greg Kroah-HartmanFrom: Lv Ruyi <[email protected]>
[ Upstream commit 5dd9e27ea4a39f7edd4bf81e9e70208e7ac0b7c9 ]
The of_find_compatible_node() function returns a node pointer with refcount incremented, use of_node_put() on it when done.
--- arch/powerpc/sysdev/xics/icp-opal.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/sysdev/xics/icp-opal.c +1 -0
@@ -196,6 +196,7 @@ int __init icp_opal_init(void)printk ("XICS: Using OPAL ICP fallbacks\n" ); +of_node_put (np);return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 230/772 ath11k: acquire ab->base_lock in unassign when finding the peer by addr
In reply to Greg Kroah-HartmanFrom: Niels Dossche <[email protected]>
[ Upstream commit 2db80f93869d491be57cbc2b36f30d0d3a0e5bde ]
ath11k_peer_find_by_addr states via lockdep that ab->base_lock must be held when calling that function in order to protect the list. All callers except ath11k_mac_op_unassign_vif_chanctx have that lock acquired when calling ath11k_peer_find_by_addr. That lock is also not transitively held by a path towards ath11k_mac_op_unassign_vif_chanctx. The solution is to acquire the lock when calling ath11k_peer_find_by_addr inside ath11k_mac_op_unassign_vif_chanctx.
I am currently working on a static analyser to detect missing locks and this was a reported case. I manually verified the report by looking at the code, but I do not have real hardware so this is compile tested only.
--- drivers/net/wireless/ath/ath11k/mac.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath11k/mac.c +8 -3
@@ -7068,6 +7068,7 @@ ath11k_mac_op_unassign_vif_chanctx(struct ieee80211_hw *hw,struct ath11k *ar = hw->priv;struct ath11k_base *ab = ar->ab;struct ath11k_vif *arvif = (void *)vif->drv_priv; +struct ath11k_peer *peer;int ret;mutex_lock (&ar->conf_mutex);
@@ -7079,9 +7080,13 @@ ath11k_mac_op_unassign_vif_chanctx(struct ieee80211_hw *hw,WARN_ON (!arvif->is_started);if (ab->hw_params.vdev_start_delay && - arvif->vdev_type ==WMI_VDEV_TYPE_MONITOR && -ath11k_peer_find_by_addr (ab, ar->mac_addr)) -ath11k_peer_delete (ar, arvif->vdev_id, ar->mac_addr); + arvif->vdev_type ==WMI_VDEV_TYPE_MONITOR ) { +spin_lock_bh (&ab->base_lock); + peer =ath11k_peer_find_by_addr (ab, ar->mac_addr); +spin_unlock_bh (&ab->base_lock); +if (peer) +ath11k_peer_delete (ar, arvif->vdev_id, ar->mac_addr); + }if (arvif->vdev_type ==WMI_VDEV_TYPE_MONITOR ) { ret =ath11k_mac_monitor_stop (ar);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 238/772 spi: qcom-qspi: Add minItems to interconnect-names
In reply to Greg Kroah-HartmanFrom: Kuldeep Singh <[email protected]>
[ Upstream commit e23d86c49a9c78e8dbe3abff20b30812b26ab427 ]
Add minItems constraint to interconnect-names as well. The schema currently tries to match 2 names and fail for DTs with single entry.
With the change applied, below interconnect-names values are possible:
['qspi-config'], ['qspi-config', 'qspi-memory']
--- Documentation/devicetree/bindings/spi/qcom,spi-qcom-qspi.yaml | 1 + 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/spi/qcom,spi-qcom-qspi.yaml +1 -0
@@ -49,6 +49,7 @@ properties: maxItems: 2 interconnect-names: + minItems: 1 items: - const: qspi-config - const: qspi-memory
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 250/772 drm/vc4: txp: Force alpha to be 0xff if its disabled
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
[ Upstream commit 5453343a88ede8b12812fced81ecd24cb888ccc3 ]
If we use a format that has padding instead of the alpha component (such as XRGB8888), it appears that the Transposer will fill the padding to 0, disregarding what was stored in the input buffer padding.
This leads to issues with IGT, since it will set the padding to 0xff, but will then compare the CRC of the two frames which will thus fail. Another nice side effect is that it is now possible to just use the buffer as ARGB.
--- drivers/gpu/drm/vc4/vc4_txp.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/vc4/vc4_txp.c +6 -0
@@ -304,6 +304,12 @@ static void vc4_txp_connector_atomic_commit(struct drm_connector *conn,if (fb->format->has_alpha) ctrl |=TXP_ALPHA_ENABLE ; +else +/* +* If TXP_ALPHA_ENABLE isn't set and TXP_ALPHA_INVERT is, the +* hardware will force the output padding to be 0xff. +*/ + ctrl |=TXP_ALPHA_INVERT ; gem =drm_fb_cma_get_gem_obj (fb,0 );TXP_WRITE (TXP_DST_PTR , gem->paddr + fb->offsets[0 ]);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 252/772 x86/PCI: Fix ALi M1487 (IBC) PIRQ router link value interpretation
In reply to Greg Kroah-HartmanFrom: Maciej W. Rozycki <[email protected]>
[ Upstream commit 4969e223b109754c2340a26bba9b1cf44f0cba9b ]
Fix an issue with commit 1ce849c75534 ("x86/PCI: Add support for the ALi M1487 (IBC) PIRQ router") and correct ALi M1487 (IBC) PIRQ router link value (`pirq' cookie) interpretation according to findings in the BIOS.
Credit to Nikolai Zhubr for the detective work as to the bit layout.
--- arch/x86/pci/irq.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
arch/x86/pci/irq.c +16 -3
@@ -253,6 +253,15 @@ static void write_pc_conf_nybble(u8 base, u8 index, u8 val)pc_conf_set (reg, x); } +/* +* FinALi pirq rules are as follows: +* +* - bit 0 selects between INTx Routing Table Mapping Registers, +* +* - bit 3 selects the nibble within the INTx Routing Table Mapping Register, +* +* - bits 7:4 map to bits 3:0 of the PCI INTx Sensitivity Register. +*/ static int pirq_finali_get (struct pci_dev *router,struct pci_dev *dev,int pirq) {
@@ -260,11 +269,13 @@ static int pirq_finali_get(struct pci_dev *router, struct pci_dev *dev,0 ,9 ,3 ,10 ,4 ,5 ,7 ,6 ,0 ,11 ,0 ,12 ,0 ,14 ,0 ,15 };unsigned long flags; +u8 index;u8 x; + index = (pirq &1 ) <<1 | (pirq &8 ) >>3 ;raw_spin_lock_irqsave (&pc_conf_lock, flags);pc_conf_set (PC_CONF_FINALI_LOCK ,PC_CONF_FINALI_LOCK_KEY ); - x = irqmap[read_pc_conf_nybble (PC_CONF_FINALI_PCI_INTX_RT1 , pirq -1 )]; + x = irqmap[read_pc_conf_nybble (PC_CONF_FINALI_PCI_INTX_RT1 , index)];pc_conf_set (PC_CONF_FINALI_LOCK ,0 );raw_spin_unlock_irqrestore (&pc_conf_lock, flags);return x;
@@ -278,13 +289,15 @@ static int pirq_finali_set(struct pci_dev *router, struct pci_dev *dev, };u8 val = irqmap[irq];unsigned long flags; +u8 index;if (!val)return 0 ; + index = (pirq &1 ) <<1 | (pirq &8 ) >>3 ;raw_spin_lock_irqsave (&pc_conf_lock, flags);pc_conf_set (PC_CONF_FINALI_LOCK ,PC_CONF_FINALI_LOCK_KEY ); -write_pc_conf_nybble (PC_CONF_FINALI_PCI_INTX_RT1 , pirq -1 , val); +write_pc_conf_nybble (PC_CONF_FINALI_PCI_INTX_RT1 , index, val);pc_conf_set (PC_CONF_FINALI_LOCK ,0 );raw_spin_unlock_irqrestore (&pc_conf_lock, flags);return 1 ;
@@ -293,7 +306,7 @@ static int pirq_finali_set(struct pci_dev *router, struct pci_dev *dev,static int pirq_finali_lvl (struct pci_dev *router,struct pci_dev *dev,int pirq,int irq) { -u8 mask = ~(1u << (pirq -1 )); +u8 mask = ~((pirq &0xf0u ) >>4 );unsigned long flags;u8 trig;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 263/772 NFC: NULL out the dev->rfkill to prevent UAF
In reply to Greg Kroah-HartmanFrom: Lin Ma <[email protected]>
[ Upstream commit 1b0e81416a24d6e9b8c2341e22e8bf48f8b8bfc9 ]
Commit 3e3b5dfcd16a ("NFC: reorder the logic in nfc_{un,}register_device") assumes the device_is_registered() in function nfc_dev_up() will help to check when the rfkill is unregistered. However, this check only take effect when device_del(&dev->dev) is done in nfc_unregister_device(). Hence, the rfkill object is still possible be dereferenced.
The crash trace in latest kernel (5.18-rc2):
[ 68.760105] ================================================================== [ 68.760330] BUG: KASAN: use-after-free in __lock_acquire+0x3ec1/0x6750 [ 68.760756] Read of size 8 at addr ffff888009c93018 by task fuzz/313 [ 68.760756] [ 68.760756] CPU: 0 PID: 313 Comm: fuzz Not tainted 5.18.0-rc2 #4 [ 68.760756] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 [ 68.760756] Call Trace: [ 68.760756] <TASK> [ 68.760756] dump_stack_lvl+0x57/0x7d [ 68.760756] print_report.cold+0x5e/0x5db [ 68.760756] ? __lock_acquire+0x3ec1/0x6750 [ 68.760756] kasan_report+0xbe/0x1c0 [ 68.760756] ? __lock_acquire+0x3ec1/0x6750 [ 68.760756] __lock_acquire+0x3ec1/0x6750 [ 68.760756] ? lockdep_hardirqs_on_prepare+0x410/0x410 [ 68.760756] ? register_lock_class+0x18d0/0x18d0 [ 68.760756] lock_acquire+0x1ac/0x4f0 [ 68.760756] ? rfkill_blocked+0xe/0x60 [ 68.760756] ? lockdep_hardirqs_on_prepare+0x410/0x410 [ 68.760756] ? mutex_lock_io_nested+0x12c0/0x12c0 [ 68.760756] ? nla_get_range_signed+0x540/0x540 [ 68.760756] ? _raw_spin_lock_irqsave+0x4e/0x50 [ 68.760756] _raw_spin_lock_irqsave+0x39/0x50 [ 68.760756] ? rfkill_blocked+0xe/0x60 [ 68.760756] rfkill_blocked+0xe/0x60 [ 68.760756] nfc_dev_up+0x84/0x260 [ 68.760756] nfc_genl_dev_up+0x90/0xe0 [ 68.760756] genl_family_rcv_msg_doit+0x1f4/0x2f0 [ 68.760756] ? genl_family_rcv_msg_attrs_parse.constprop.0+0x230/0x230 [ 68.760756] ? security_capable+0x51/0x90 [ 68.760756] genl_rcv_msg+0x280/0x500 [ 68.760756] ? genl_get_cmd+0x3c0/0x3c0 [ 68.760756] ? lock_acquire+0x1ac/0x4f0 [ 68.760756] ? nfc_genl_dev_down+0xe0/0xe0 [ 68.760756] ? lockdep_hardirqs_on_prepare+0x410/0x410 [ 68.760756] netlink_rcv_skb+0x11b/0x340 [ 68.760756] ? genl_get_cmd+0x3c0/0x3c0 [ 68.760756] ? netlink_ack+0x9c0/0x9c0 [ 68.760756] ? netlink_deliver_tap+0x136/0xb00 [ 68.760756] genl_rcv+0x1f/0x30 [ 68.760756] netlink_unicast+0x430/0x710 [ 68.760756] ? memset+0x20/0x40 [ 68.760756] ? netlink_attachskb+0x740/0x740 [ 68.760756] ? __build_skb_around+0x1f4/0x2a0 [ 68.760756] netlink_sendmsg+0x75d/0xc00 [ 68.760756] ? netlink_unicast+0x710/0x710 [ 68.760756] ? netlink_unicast+0x710/0x710 [ 68.760756] sock_sendmsg+0xdf/0x110 [ 68.760756] __sys_sendto+0x19e/0x270 [ 68.760756] ? __ia32_sys_getpeername+0xa0/0xa0 [ 68.760756] ? fd_install+0x178/0x4c0 [ 68.760756] ? fd_install+0x195/0x4c0 [ 68.760756] ? kernel_fpu_begin_mask+0x1c0/0x1c0 [ 68.760756] __x64_sys_sendto+0xd8/0x1b0 [ 68.760756] ? lockdep_hardirqs_on+0xbf/0x130 [ 68.760756] ? syscall_enter_from_user_mode+0x1d/0x50 [ 68.760756] do_syscall_64+0x3b/0x90 [ 68.760756] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 68.760756] RIP: 0033:0x7f67fb50e6b3 ... [ 68.760756] RSP: 002b:00007f67fa91fe90 EFLAGS: 00000293 ORIG_RAX: 000000000000002c [ 68.760756] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f67fb50e6b3 [ 68.760756] RDX: 000000000000001c RSI: 0000559354603090 RDI: 0000000000000003 [ 68.760756] RBP: 00007f67fa91ff00 R08: 00007f67fa91fedc R09: 000000000000000c [ 68.760756] R10: 0000000000000000 R11: 0000000000000293 R12: 00007ffe824d496e [ 68.760756] R13: 00007ffe824d496f R14: 00007f67fa120000 R15: 0000000000000003
[ 68.760756] </TASK> [ 68.760756] [ 68.760756] Allocated by task 279: [ 68.760756] kasan_save_stack+0x1e/0x40 [ 68.760756] __kasan_kmalloc+0x81/0xa0 [ 68.760756] rfkill_alloc+0x7f/0x280 [ 68.760756] nfc_register_device+0xa3/0x1a0 [ 68.760756] nci_register_device+0x77a/0xad0 [ 68.760756] nfcmrvl_nci_register_dev+0x20b/0x2c0 [ 68.760756] nfcmrvl_nci_uart_open+0xf2/0x1dd [ 68.760756] nci_uart_tty_ioctl+0x2c3/0x4a0 [ 68.760756] tty_ioctl+0x764/0x1310 [ 68.760756] __x64_sys_ioctl+0x122/0x190 [ 68.760756] do_syscall_64+0x3b/0x90 [ 68.760756] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 68.760756] [ 68.760756] Freed by task 314: [ 68.760756] kasan_save_stack+0x1e/0x40 [ 68.760756] kasan_set_track+0x21/0x30 [ 68.760756] kasan_set_free_info+0x20/0x30 [ 68.760756] __kasan_slab_free+0x108/0x170 [ 68.760756] kfree+0xb0/0x330 [ 68.760756] device_release+0x96/0x200 [ 68.760756] kobject_put+0xf9/0x1d0 [ 68.760756] nfc_unregister_device+0x77/0x190 [ 68.760756] nfcmrvl_nci_unregister_dev+0x88/0xd0 [ 68.760756] nci_uart_tty_close+0xdf/0x180 [ 68.760756] tty_ldisc_kill+0x73/0x110 [ 68.760756] tty_ldisc_hangup+0x281/0x5b0 [ 68.760756] __tty_hangup.part.0+0x431/0x890 [ 68.760756] tty_release+0x3a8/0xc80 [ 68.760756] __fput+0x1f0/0x8c0 [ 68.760756] task_work_run+0xc9/0x170 [ 68.760756] exit_to_user_mode_prepare+0x194/0x1a0 [ 68.760756] syscall_exit_to_user_mode+0x19/0x50 [ 68.760756] do_syscall_64+0x48/0x90 [ 68.760756] entry_SYSCALL_64_after_hwframe+0x44/0xae
This patch just add the null out of dev->rfkill to make sure such dereference cannot happen. This is safe since the device_lock() already protect the check/write from data race.
--- net/nfc/core.c | 1 + 1 file changed, 1 insertion(+)
net/nfc/core.c +1 -0
@@ -1166,6 +1166,7 @@ void nfc_unregister_device(struct nfc_dev *dev)if (dev->rfkill) {rfkill_unregister (dev->rfkill);rfkill_destroy (dev->rfkill); + dev->rfkill =NULL ; } dev->shutting_down = true;device_unlock (&dev->dev);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 267/772 target: remove an incorrect unmap zeroes data deduction
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 179d8609d8424529e95021df939ed7b0b82b37f1 ]
For block devices, the SCSI target drivers implements UNMAP as calls to blkdev_issue_discard, which does not guarantee zeroing just because Write Zeroes is supported.
Note that this does not affect the file backed path which uses fallocate to punch holes.
--- drivers/target/target_core_device.c | 1 - 1 file changed, 1 deletion(-)
drivers/target/target_core_device.c +0 -1
@@ -850,7 +850,6 @@ bool target_configure_unmap_from_queue(struct se_dev_attrib *attrib, attrib->unmap_granularity = q->limits.discard_granularity / block_size; attrib->unmap_granularity_alignment = q->limits.discard_alignment / block_size; - attrib->unmap_zeroes_data = !!(q->limits.max_write_zeroes_sectors);return true; }EXPORT_SYMBOL (target_configure_unmap_from_queue);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 215/772 powerpc/powernv/vas: Assign real address to rx_fifo in vas_rx_win_attr
In reply to Greg Kroah-HartmanFrom: Haren Myneni <[email protected]>
[ Upstream commit c127d130f6d59fa81701f6b04023cf7cd1972fb3 ]
In init_winctx_regs(), __pa() is called on winctx->rx_fifo and this function is called to initialize registers for receive and fault windows. But the real address is passed in winctx->rx_fifo for receive windows and the virtual address for fault windows which causes errors with DEBUG_VIRTUAL enabled. Fixes this issue by assigning only real address to rx_fifo in vas_rx_win_attr struct for both receive and fault windows.
--- arch/powerpc/include/asm/vas.h | 2 +- arch/powerpc/platforms/powernv/vas-fault.c | 2 +- arch/powerpc/platforms/powernv/vas-window.c | 4 ++-- arch/powerpc/platforms/powernv/vas.h | 2 +- drivers/crypto/nx/nx-common-powernv.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-)
arch/powerpc/include/asm/vas.h +1 -1
@@ -112,7 +112,7 @@ static inline void vas_user_win_add_mm_context(struct vas_user_win_ref *ref)* Receive window attributes specified by the (in-kernel) owner of window. */ struct vas_rx_win_attr { -void *rx_fifo; +u64 rx_fifo;int rx_fifo_size;int wcreds_max;
arch/powerpc/platforms/powernv/vas-fault.c +1 -1
@@ -216,7 +216,7 @@ int vas_setup_fault_window(struct vas_instance *vinst)vas_init_rx_win_attr (&attr,VAS_COP_TYPE_FAULT ); attr.rx_fifo_size = vinst->fault_fifo_size; - attr.rx_fifo = vinst->fault_fifo; + attr.rx_fifo =__pa (vinst->fault_fifo);/* * Max creds is based on number of CRBs can fit in the FIFO.
arch/powerpc/platforms/powernv/vas-window.c +2 -2
@@ -404,7 +404,7 @@ static void init_winctx_regs(struct pnv_vas_window *window,* * See also: Design note in function header. */ - val =__pa (winctx->rx_fifo); + val = winctx->rx_fifo; val =SET_FIELD (VAS_PAGE_MIGRATION_SELECT , val,0 );write_hvwc_reg (window,VREG (LFIFO_BAR ), val);
@@ -739,7 +739,7 @@ static void init_winctx_for_rxwin(struct pnv_vas_window *rxwin,*/ winctx->fifo_disable = true; winctx->intr_disable = true; - winctx->rx_fifo =NULL ; + winctx->rx_fifo =0 ; } winctx->lnotify_lpid = rxattr->lnotify_lpid;
arch/powerpc/platforms/powernv/vas.h +1 -1
@@ -376,7 +376,7 @@ struct pnv_vas_window {* is a container for the register fields in the window context. */ struct vas_winctx { -void *rx_fifo; +u64 rx_fifo;int rx_fifo_size;int wcreds_max;int rsvd_txbuf_count;
drivers/crypto/nx/nx-common-powernv.c +1 -1
@@ -827,7 +827,7 @@ static int __init vas_cfg_coproc_info(struct device_node *dn, int chip_id, goto err_out;vas_init_rx_win_attr (&rxattr, coproc->ct); - rxattr.rx_fifo = (void *)rx_fifo; + rxattr.rx_fifo = rx_fifo; rxattr.rx_fifo_size = fifo_size; rxattr.lnotify_lpid = lpid; rxattr.lnotify_pid = pid;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 253/772 mptcp: optimize release_cb for the common case
In reply to Greg Kroah-HartmanFrom: Paolo Abeni <[email protected]>
[ Upstream commit 65a569b03ca832ebc93ce45a7466137e2bb62254 ]
The mptcp release callback checks several flags in atomic context, but only MPTCP_CLEAN_UNA can be up frequently.
Reorganize the code to avoid multiple conditionals in the most common scenarios.
Additional clarify a related comment.
--- net/mptcp/protocol.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
net/mptcp/protocol.c +9 -7
@@ -3088,15 +3088,17 @@ static void mptcp_release_cb(struct sock *sk)spin_lock_bh (&sk->sk_lock.slock); } -/* be sure to set the current sk state before tacking actions -* depending on sk_state -*/ -if (__test_and_clear_bit (MPTCP_CONNECTED , &msk->cb_flags)) -__mptcp_set_connected (sk);if (__test_and_clear_bit (MPTCP_CLEAN_UNA , &msk->cb_flags))__mptcp_clean_una_wakeup (sk); -if (__test_and_clear_bit (MPTCP_ERROR_REPORT , &msk->cb_flags)) -__mptcp_error_report (sk); +if (unlikely (&msk->cb_flags)) { +/* be sure to set the current sk state before tacking actions +* depending on sk_state, that is processing MPTCP_ERROR_REPORT +*/ +if (__test_and_clear_bit (MPTCP_CONNECTED , &msk->cb_flags)) +__mptcp_set_connected (sk); +if (__test_and_clear_bit (MPTCP_ERROR_REPORT , &msk->cb_flags)) +__mptcp_error_report (sk); + }__mptcp_update_rmem (sk); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 266/772 device property: Allow error pointer to be passed to fwnode APIs
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 002752af7b89b74c64fe6bec8c5fde3d3a7810d8 ]
Some of the fwnode APIs might return an error pointer instead of NULL or valid fwnode handle. The result of such API call may be considered optional and hence the test for it is usually done in a form of
fwnode = fwnode_find_reference(...); if (IS_ERR(fwnode)) ...error handling...
Nevertheless the resulting fwnode may have bumped the reference count and hence caller of the above API is obliged to call fwnode_handle_put(). Since fwnode may be not valid either as NULL or error pointer the check has to be performed there. This approach uglifies the code and adds a point of making a mistake, i.e. forgetting about error point case.
To prevent this, allow an error pointer to be passed to the fwnode APIs.
--- drivers/base/property.c | 89 +++++++++++++++++++++++------------------ include/linux/fwnode.h | 10 ++--- 2 files changed, 56 insertions(+), 43 deletions(-)
drivers/base/property.c +51 -38
@@ -47,12 +47,14 @@ bool fwnode_property_present(const struct fwnode_handle *fwnode, {bool ret; +if (IS_ERR_OR_NULL (fwnode)) +return false; + ret =fwnode_call_bool_op (fwnode, property_present, propname); -if (ret == false && !IS_ERR_OR_NULL (fwnode) && - !IS_ERR_OR_NULL (fwnode->secondary)) - ret =fwnode_call_bool_op (fwnode->secondary, property_present, - propname); -return ret; +if (ret) +return ret; + +return fwnode_call_bool_op (fwnode->secondary, property_present, propname); }EXPORT_SYMBOL_GPL (fwnode_property_present);
@@ -232,15 +234,16 @@ static int fwnode_property_read_int_array(const struct fwnode_handle *fwnode, {int ret; +if (IS_ERR_OR_NULL (fwnode)) +return -EINVAL ; + ret =fwnode_call_int_op (fwnode, property_read_int_array, propname, elem_size, val, nval); -if (ret == -EINVAL && !IS_ERR_OR_NULL (fwnode) && - !IS_ERR_OR_NULL (fwnode->secondary)) - ret =fwnode_call_int_op ( - fwnode->secondary, property_read_int_array, propname, - elem_size, val, nval); +if (ret != -EINVAL ) +return ret; -return ret; +return fwnode_call_int_op (fwnode->secondary, property_read_int_array, propname, + elem_size, val, nval); }/**
@@ -371,14 +374,16 @@ int fwnode_property_read_string_array(const struct fwnode_handle *fwnode, {int ret; +if (IS_ERR_OR_NULL (fwnode)) +return -EINVAL ; + ret =fwnode_call_int_op (fwnode, property_read_string_array, propname, val, nval); -if (ret == -EINVAL && !IS_ERR_OR_NULL (fwnode) && - !IS_ERR_OR_NULL (fwnode->secondary)) - ret =fwnode_call_int_op (fwnode->secondary, - property_read_string_array, propname, - val, nval); -return ret; +if (ret != -EINVAL ) +return ret; + +return fwnode_call_int_op (fwnode->secondary, property_read_string_array, propname, + val, nval); }EXPORT_SYMBOL_GPL (fwnode_property_read_string_array);
@@ -480,15 +485,19 @@ int fwnode_property_get_reference_args(const struct fwnode_handle *fwnode, {int ret; +if (IS_ERR_OR_NULL (fwnode)) +return -ENOENT ; + ret =fwnode_call_int_op (fwnode, get_reference_args, prop, nargs_prop, nargs, index, args); +if (ret ==0 ) +return ret; -if (ret <0 && !IS_ERR_OR_NULL (fwnode) && - !IS_ERR_OR_NULL (fwnode->secondary)) - ret =fwnode_call_int_op (fwnode->secondary, get_reference_args, - prop, nargs_prop, nargs, index, args); +if (IS_ERR_OR_NULL (fwnode->secondary)) +return ret; -return ret; +return fwnode_call_int_op (fwnode->secondary, get_reference_args, prop, nargs_prop, + nargs, index, args); }EXPORT_SYMBOL_GPL (fwnode_property_get_reference_args);
@@ -635,12 +644,13 @@ EXPORT_SYMBOL_GPL(fwnode_count_parents);struct fwnode_handle *fwnode_get_nth_parent (struct fwnode_handle *fwnode,unsigned int depth) { -unsigned int i; -fwnode_handle_get (fwnode); -for (i =0 ; i < depth && fwnode; i++) +do { +if (depth-- ==0 ) +break ; fwnode =fwnode_get_next_parent (fwnode); + }while (fwnode);return fwnode; }
@@ -659,17 +669,17 @@ EXPORT_SYMBOL_GPL(fwnode_get_nth_parent);bool fwnode_is_ancestor_of (struct fwnode_handle *test_ancestor,struct fwnode_handle *test_child) { -if (!test_ancestor) +if (IS_ERR_OR_NULL (test_ancestor))return false;fwnode_handle_get (test_child); -while (test_child) { +do {if (test_child == test_ancestor) {fwnode_handle_put (test_child);return true; } test_child =fwnode_get_next_parent (test_child); - } + }while (test_child);return false; }
@@ -698,7 +708,7 @@ fwnode_get_next_available_child_node(const struct fwnode_handle *fwnode, {struct fwnode_handle *next_child = child; -if (!fwnode) +if (IS_ERR_OR_NULL (fwnode))return NULL ; do {
@@ -722,16 +732,16 @@ struct fwnode_handle *device_get_next_child_node(struct device *dev,const struct fwnode_handle *fwnode =dev_fwnode (dev);struct fwnode_handle *next; +if (IS_ERR_OR_NULL (fwnode)) +return NULL ; +/* Try to find a child in primary fwnode */ next =fwnode_get_next_child_node (fwnode, child);if (next)return next;/* When no more children in primary, continue with secondary */ -if (fwnode && !IS_ERR_OR_NULL (fwnode->secondary)) - next =fwnode_get_next_child_node (fwnode->secondary, child); - -return next; +return fwnode_get_next_child_node (fwnode->secondary, child); }EXPORT_SYMBOL_GPL (device_get_next_child_node);
@@ -798,6 +808,9 @@ EXPORT_SYMBOL_GPL(fwnode_handle_put);*/ bool fwnode_device_is_available (const struct fwnode_handle *fwnode) { +if (IS_ERR_OR_NULL (fwnode)) +return false; +if (!fwnode_has_op (fwnode, device_is_available))return true;
@@ -959,14 +972,14 @@ fwnode_graph_get_next_endpoint(const struct fwnode_handle *fwnode, parent =fwnode_graph_get_port_parent (prev); else parent = fwnode; +if (IS_ERR_OR_NULL (parent)) +return NULL ; ep =fwnode_call_ptr_op (parent, graph_get_next_endpoint, prev); +if (ep) +return ep; -if (IS_ERR_OR_NULL (ep) && - !IS_ERR_OR_NULL (parent) && !IS_ERR_OR_NULL (parent->secondary)) - ep =fwnode_graph_get_next_endpoint (parent->secondary,NULL ); - -return ep; +return fwnode_graph_get_next_endpoint (parent->secondary,NULL ); }EXPORT_SYMBOL_GPL (fwnode_graph_get_next_endpoint);
include/linux/fwnode.h +5 -5
@@ -148,12 +148,12 @@ struct fwnode_operations {int (*add_links)(struct fwnode_handle *fwnode); }; -#define fwnode_has_op (fwnode, op) \ - ((fwnode) && (fwnode)->ops && (fwnode)->ops->op) +#define fwnode_has_op (fwnode, op) \ + (!IS_ERR_OR_NULL(fwnode) && (fwnode)->ops && (fwnode)->ops->op) +#define fwnode_call_int_op (fwnode, op, ...) \ - (fwnode ? (fwnode_has_op(fwnode, op) ? \ - (fwnode)->ops->op(fwnode, ## __VA_ARGS__) : -ENXIO) : \ - -EINVAL) + (fwnode_has_op(fwnode, op) ? \ + (fwnode)->ops->op(fwnode, ## __VA_ARGS__) : (IS_ERR_OR_NULL(fwnode) ? -EINVAL : -ENXIO))#define fwnode_call_bool_op (fwnode, op, ...) \ (fwnode_has_op(fwnode, op) ? \
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 273/772 HID: elan: Fix potential double free in elan_input_configured
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 1af20714fedad238362571620be0bd690ded05b6 ]
'input' is a managed resource allocated with devm_input_allocate_device(), so there is no need to call input_free_device() explicitly or there will be a double free.
According to the doc of devm_input_allocate_device():
* Managed input devices do not need to be explicitly unregistered or
* freed as it will be done automatically when owner device unbinds from
* its driver (or binding fails).
--- drivers/hid/hid-elan.c | 2 -- 1 file changed, 2 deletions(-)
drivers/hid/hid-elan.c +0 -2
@@ -188,7 +188,6 @@ static int elan_input_configured(struct hid_device *hdev, struct hid_input *hi) ret =input_mt_init_slots (input,ELAN_MAX_FINGERS ,INPUT_MT_POINTER );if (ret) {hid_err (hdev,"Failed to init elan MT slots: %d\n" , ret); -input_free_device (input);return ret; }
@@ -200,7 +199,6 @@ static int elan_input_configured(struct hid_device *hdev, struct hid_input *hi)hid_err (hdev,"Failed to register elan input device: %d\n" , ret);input_mt_destroy_slots (input); -input_free_device (input);return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 275/772 regulator: da9121: Fix uninit-value in da9121_assign_chip_model()
In reply to Greg Kroah-HartmanFrom: Wei Yongjun <[email protected]>
[ Upstream commit bab76514aca36bc513224525d5598da676938218 ]
KASAN report slab-out-of-bounds in __regmap_init as follows:
BUG: KASAN: slab-out-of-bounds in __regmap_init drivers/base/regmap/regmap.c:841 Read of size 1 at addr ffff88803678cdf1 by task xrun/9137 CPU: 0 PID: 9137 Comm: xrun Tainted: G W 5.18.0-rc2 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014 Call Trace: <TASK> dump_stack_lvl+0xe8/0x15a lib/dump_stack.c:88 print_report.cold+0xcd/0x69b mm/kasan/report.c:313 kasan_report+0x8e/0xc0 mm/kasan/report.c:491 __regmap_init+0x4540/0x4ba0 drivers/base/regmap/regmap.c:841 __devm_regmap_init+0x7a/0x100 drivers/base/regmap/regmap.c:1266 __devm_regmap_init_i2c+0x65/0x80 drivers/base/regmap/regmap-i2c.c:394 da9121_i2c_probe+0x386/0x6d1 drivers/regulator/da9121-regulator.c:1039 i2c_device_probe+0x959/0xac0 drivers/i2c/i2c-core-base.c:563
This happend when da9121 device is probe by da9121_i2c_id, but with invalid dts. Thus, chip->subvariant_id is set to -EINVAL, and later da9121_assign_chip_model() will access 'regmap' without init it.
Fix it by return -EINVAL from da9121_assign_chip_model() if 'chip->subvariant_id' is invalid.
--- drivers/regulator/da9121-regulator.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/regulator/da9121-regulator.c +2 -0
@@ -1030,6 +1030,8 @@ static int da9121_assign_chip_model(struct i2c_client *i2c, chip->variant_id =DA9121_TYPE_DA9142 ; regmap = &da9121_2ch_regmap_config;break ; +default : +return -EINVAL ; }/* Set these up for of_regulator_match call which may want .of_map_modes */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 276/772 drm/mediatek: dpi: Use mt8183 output formats for mt8192
In reply to Greg Kroah-HartmanFrom: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit 7112e0b0a58be8575547eba6596c42710922674f ]
The configuration for mt8192 was incorrectly using the output formats from mt8173. Since the output formats for mt8192 are instead the same ones as for mt8183, which require two bus samples per pixel, the pixelclock and DDR edge setting were misconfigured. This made external displays unable to show the image.
Fix the issue by correcting the output format for mt8192 to be the same as for mt8183, fixing the usage of external displays for mt8192.
--- drivers/gpu/drm/mediatek/mtk_dpi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/mediatek/mtk_dpi.c +2 -2
@@ -819,8 +819,8 @@ static const struct mtk_dpi_conf mt8192_conf = { .cal_factor = mt8183_calculate_factor, .reg_h_fre_con = 0xe0, .max_clock_khz = 150000, - .output_fmts = mt8173_output_fmts, - .num_output_fmts = ARRAY_SIZE(mt8173_output_fmts), + .output_fmts = mt8183_output_fmts, + .num_output_fmts = ARRAY_SIZE(mt8183_output_fmts), };static int mtk_dpi_probe (struct platform_device *pdev)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 277/772 signal: Deliver SIGTRAP on perf event asynchronously if blocked
In reply to Greg Kroah-HartmanFrom: Marco Elver <[email protected]>
[ Upstream commit 78ed93d72ded679e3caf0758357209887bda885f ]
With SIGTRAP on perf events, we have encountered termination of processes due to user space attempting to block delivery of SIGTRAP. Consider this case:
<set up SIGTRAP on a perf event>
...
sigset_t s;
sigemptyset(&s);
sigaddset(&s, SIGTRAP | <and others>);
sigprocmask(SIG_BLOCK, &s, ...);
...
<perf event triggers>When the perf event triggers, while SIGTRAP is blocked, force_sig_perf() will force the signal, but revert back to the default handler, thus terminating the task.
This makes sense for error conditions, but not so much for explicitly requested monitoring. However, the expectation is still that signals generated by perf events are synchronous, which will no longer be the case if the signal is blocked and delivered later.
To give user space the ability to clearly distinguish synchronous from asynchronous signals, introduce siginfo_t::si_perf_flags and TRAP_PERF_FLAG_ASYNC (opted for flags in case more binary information is required in future).
The resolution to the problem is then to (a) no longer force the signal (avoiding the terminations), but (b) tell user space via si_perf_flags if the signal was synchronous or not, so that such signals can be handled differently (e.g. let user space decide to ignore or consider the data imprecise).
The alternative of making the kernel ignore SIGTRAP on perf events if the signal is blocked may work for some usecases, but likely causes issues in others that then have to revert back to interception of sigprocmask() (which we want to avoid). [ A concrete example: when using breakpoint perf events to track data-flow, in a region of code where signals are blocked, data-flow can no longer be tracked accurately. When a relevant asynchronous signal is received after unblocking the signal, the data-flow tracking logic needs to know its state is imprecise. ]
--- arch/arm/kernel/signal.c | 1 + arch/arm64/kernel/signal.c | 1 + arch/arm64/kernel/signal32.c | 1 + arch/m68k/kernel/signal.c | 1 + arch/sparc/kernel/signal32.c | 1 + arch/sparc/kernel/signal_64.c | 1 + arch/x86/kernel/signal_compat.c | 2 ++ include/linux/compat.h | 1 + include/linux/sched/signal.h | 2 +- include/uapi/asm-generic/siginfo.h | 7 +++++++ kernel/events/core.c | 4 ++-- kernel/signal.c | 18 ++++++++++++++++-- 12 files changed, 35 insertions(+), 5 deletions(-)
arch/arm/kernel/signal.c +1 -0
@@ -708,6 +708,7 @@ static_assert(offsetof(siginfo_t, si_upper) == 0x18);static_assert (offsetof(siginfo_t , si_pkey) ==0x14 );static_assert (offsetof(siginfo_t , si_perf_data) ==0x10 );static_assert (offsetof(siginfo_t , si_perf_type) ==0x14 ); +static_assert (offsetof(siginfo_t , si_perf_flags) ==0x18 );static_assert (offsetof(siginfo_t , si_band) ==0x0c );static_assert (offsetof(siginfo_t , si_fd) ==0x10 );static_assert (offsetof(siginfo_t , si_call_addr) ==0x0c );
arch/arm64/kernel/signal.c +1 -0
@@ -1012,6 +1012,7 @@ static_assert(offsetof(siginfo_t, si_upper) == 0x28);static_assert (offsetof(siginfo_t , si_pkey) ==0x20 );static_assert (offsetof(siginfo_t , si_perf_data) ==0x18 );static_assert (offsetof(siginfo_t , si_perf_type) ==0x20 ); +static_assert (offsetof(siginfo_t , si_perf_flags) ==0x24 );static_assert (offsetof(siginfo_t , si_band) ==0x10 );static_assert (offsetof(siginfo_t , si_fd) ==0x18 );static_assert (offsetof(siginfo_t , si_call_addr) ==0x10 );
arch/arm64/kernel/signal32.c +1 -0
@@ -487,6 +487,7 @@ static_assert(offsetof(compat_siginfo_t, si_upper) == 0x18);static_assert (offsetof(compat_siginfo_t , si_pkey) ==0x14 );static_assert (offsetof(compat_siginfo_t , si_perf_data) ==0x10 );static_assert (offsetof(compat_siginfo_t , si_perf_type) ==0x14 ); +static_assert (offsetof(compat_siginfo_t , si_perf_flags) ==0x18 );static_assert (offsetof(compat_siginfo_t , si_band) ==0x0c );static_assert (offsetof(compat_siginfo_t , si_fd) ==0x10 );static_assert (offsetof(compat_siginfo_t , si_call_addr) ==0x0c );
arch/m68k/kernel/signal.c +1 -0
@@ -625,6 +625,7 @@ static inline void siginfo_build_tests(void)/* _sigfault._perf */ BUILD_BUG_ON (offsetof(siginfo_t , si_perf_data) !=0x10 );BUILD_BUG_ON (offsetof(siginfo_t , si_perf_type) !=0x14 ); +BUILD_BUG_ON (offsetof(siginfo_t , si_perf_flags) !=0x18 );/* _sigpoll */ BUILD_BUG_ON (offsetof(siginfo_t , si_band) !=0x0c );
arch/sparc/kernel/signal32.c +1 -0
@@ -780,5 +780,6 @@ static_assert(offsetof(compat_siginfo_t, si_upper) == 0x18);static_assert (offsetof(compat_siginfo_t , si_pkey) ==0x14 );static_assert (offsetof(compat_siginfo_t , si_perf_data) ==0x10 );static_assert (offsetof(compat_siginfo_t , si_perf_type) ==0x14 ); +static_assert (offsetof(compat_siginfo_t , si_perf_flags) ==0x18 );static_assert (offsetof(compat_siginfo_t , si_band) ==0x0c );static_assert (offsetof(compat_siginfo_t , si_fd) ==0x10 );
arch/sparc/kernel/signal_64.c +1 -0
@@ -590,5 +590,6 @@ static_assert(offsetof(siginfo_t, si_upper) == 0x28);static_assert (offsetof(siginfo_t , si_pkey) ==0x20 );static_assert (offsetof(siginfo_t , si_perf_data) ==0x18 );static_assert (offsetof(siginfo_t , si_perf_type) ==0x20 ); +static_assert (offsetof(siginfo_t , si_perf_flags) ==0x24 );static_assert (offsetof(siginfo_t , si_band) ==0x10 );static_assert (offsetof(siginfo_t , si_fd) ==0x14 );
arch/x86/kernel/signal_compat.c +2 -0
@@ -149,8 +149,10 @@ static inline void signal_compat_build_tests(void)BUILD_BUG_ON (offsetof(siginfo_t , si_perf_data) !=0x18 );BUILD_BUG_ON (offsetof(siginfo_t , si_perf_type) !=0x20 ); +BUILD_BUG_ON (offsetof(siginfo_t , si_perf_flags) !=0x24 );BUILD_BUG_ON (offsetof(compat_siginfo_t , si_perf_data) !=0x10 );BUILD_BUG_ON (offsetof(compat_siginfo_t , si_perf_type) !=0x14 ); +BUILD_BUG_ON (offsetof(compat_siginfo_t , si_perf_flags) !=0x18 );CHECK_CSI_OFFSET (_sigpoll);CHECK_CSI_SIZE (_sigpoll,2 *sizeof (int ));
include/linux/compat.h +1 -0
@@ -235,6 +235,7 @@ typedef struct compat_siginfo {struct {compat_ulong_t _data;u32 _type; +u32 _flags; } _perf; }; } _sigfault;
include/linux/sched/signal.h +1 -1
@@ -320,7 +320,7 @@ int send_sig_mceerr(int code, void __user *, short, struct task_struct *);int force_sig_bnderr (void __user *addr,void __user *lower,void __user *upper);int force_sig_pkuerr (void __user *addr,u32 pkey); -int force_sig_perf (void __user *addr,u32 type,u64 sig_data); +int send_sig_perf (void __user *addr,u32 type,u64 sig_data);int force_sig_ptrace_errno_trap (int errno,void __user *addr);int force_sig_fault_trapno (int sig,int code,void __user *addr,int trapno);
include/uapi/asm-generic/siginfo.h +7 -0
@@ -99,6 +99,7 @@ union __sifields {struct {unsigned long _data;__u32 _type; +__u32 _flags; } _perf; }; } _sigfault;
@@ -164,6 +165,7 @@ typedef struct siginfo {#define si_pkey _sifields._sigfault._addr_pkey._pkey#define si_perf_data _sifields._sigfault._perf._data#define si_perf_type _sifields._sigfault._perf._type +#define si_perf_flags _sifields._sigfault._perf._flags#define si_band _sifields._sigpoll._band#define si_fd _sifields._sigpoll._fd#define si_call_addr _sifields._sigsys._call_addr
@@ -270,6 +272,11 @@ typedef struct siginfo {* that are of the form: ((PTRACE_EVENT_XXX << 8) | SIGTRAP) */ +/* +* Flags for si_perf_flags if SIGTRAP si_code is TRAP_PERF. +*/ +#define TRAP_PERF_FLAG_ASYNC (1u << 0) +/* * SIGCHLD si_codes */
kernel/events/core.c +2 -2
@@ -6533,8 +6533,8 @@ static void perf_sigtrap(struct perf_event *event)if (current->flags &PF_EXITING )return ; -force_sig_perf ((void __user *)event->pending_addr, - event->attr.type, event->attr.sig_data); +send_sig_perf ((void __user *)event->pending_addr, + event->attr.type, event->attr.sig_data); }static void perf_pending_event_disable (struct perf_event *event)
kernel/signal.c +16 -2
@@ -1805,7 +1805,7 @@ int force_sig_pkuerr(void __user *addr, u32 pkey) }#endif -int force_sig_perf (void __user *addr,u32 type,u64 sig_data) +int send_sig_perf (void __user *addr,u32 type,u64 sig_data) {struct kernel_siginfo info;
@@ -1817,7 +1817,18 @@ int force_sig_perf(void __user *addr, u32 type, u64 sig_data) info.si_perf_data = sig_data; info.si_perf_type = type; -return force_sig_info (&info); +/* +* Signals generated by perf events should not terminate the whole +* process if SIGTRAP is blocked, however, delivering the signal +* asynchronously is better than not delivering at all. But tell user +* space if the signal was asynchronous, so it can clearly be +* distinguished from normal synchronous ones. +*/ + info.si_perf_flags =sigismember (¤t->blocked, info.si_signo) ? +TRAP_PERF_FLAG_ASYNC : +0 ; + +return send_sig_info (info.si_signo, &info, current); }/**
@@ -3430,6 +3441,7 @@ void copy_siginfo_to_external32(struct compat_siginfo *to, to->si_addr =ptr_to_compat (from->si_addr); to->si_perf_data = from->si_perf_data; to->si_perf_type = from->si_perf_type; + to->si_perf_flags = from->si_perf_flags;break ;case SIL_CHLD : to->si_pid = from->si_pid;
@@ -3507,6 +3519,7 @@ static int post_copy_siginfo_from_user32(kernel_siginfo_t *to, to->si_addr =compat_ptr (from->si_addr); to->si_perf_data = from->si_perf_data; to->si_perf_type = from->si_perf_type; + to->si_perf_flags = from->si_perf_flags;break ;case SIL_CHLD : to->si_pid = from->si_pid;
@@ -4720,6 +4733,7 @@ static inline void siginfo_buildtime_checks(void)CHECK_OFFSET (si_pkey);CHECK_OFFSET (si_perf_data);CHECK_OFFSET (si_perf_type); +CHECK_OFFSET (si_perf_flags);/* sigpoll */ CHECK_OFFSET (si_band);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 278/772 sched/fair: Fix cfs_rq_clock_pelt() for throttled cfs_rq
In reply to Greg Kroah-HartmanFrom: Chengming Zhou <[email protected]>
[ Upstream commit 64eaf50731ac0a8c76ce2fedd50ef6652aabc5ff ]
Since commit 23127296889f ("sched/fair: Update scale invariance of PELT") change to use rq_clock_pelt() instead of rq_clock_task(), we should also use rq_clock_pelt() for throttled_clock_task_time and throttled_clock_task accounting to get correct cfs_rq_clock_pelt() of throttled cfs_rq. And rename throttled_clock_task(_time) to be clock_pelt rather than clock_task.
--- kernel/sched/fair.c | 8 ++++---- kernel/sched/pelt.h | 4 ++-- kernel/sched/sched.h | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-)
kernel/sched/fair.c +4 -4
@@ -4793,8 +4793,8 @@ static int tg_unthrottle_up(struct task_group *tg, void *data) cfs_rq->throttle_count--;if (!cfs_rq->throttle_count) { - cfs_rq->throttled_clock_task_time +=rq_clock_task (rq) - - cfs_rq->throttled_clock_task; + cfs_rq->throttled_clock_pelt_time +=rq_clock_pelt (rq) - + cfs_rq->throttled_clock_pelt;/* Add cfs_rq with load or one or more already running entities to the list */ if (!cfs_rq_is_decayed (cfs_rq) || cfs_rq->nr_running)
@@ -4811,7 +4811,7 @@ static int tg_throttle_down(struct task_group *tg, void *data)/* group is entering throttled state, stop time */ if (!cfs_rq->throttle_count) { - cfs_rq->throttled_clock_task =rq_clock_task (rq); + cfs_rq->throttled_clock_pelt =rq_clock_pelt (rq);list_del_leaf_cfs_rq (cfs_rq); } cfs_rq->throttle_count++;
@@ -5255,7 +5255,7 @@ static void sync_throttle(struct task_group *tg, int cpu) pcfs_rq = tg->parent->cfs_rq[cpu]; cfs_rq->throttle_count = pcfs_rq->throttle_count; - cfs_rq->throttled_clock_task =rq_clock_task (cpu_rq (cpu)); + cfs_rq->throttled_clock_pelt =rq_clock_pelt (cpu_rq (cpu)); }/* conditionally throttle active cfs_rq's from put_prev_entity() */
kernel/sched/pelt.h +2 -2
@@ -145,9 +145,9 @@ static inline u64 rq_clock_pelt(struct rq *rq)static inline u64 cfs_rq_clock_pelt (struct cfs_rq *cfs_rq) {if (unlikely (cfs_rq->throttle_count)) -return cfs_rq->throttled_clock_task - cfs_rq->throttled_clock_task_time; +return cfs_rq->throttled_clock_pelt - cfs_rq->throttled_clock_pelt_time; -return rq_clock_pelt (rq_of (cfs_rq)) - cfs_rq->throttled_clock_task_time; +return rq_clock_pelt (rq_of (cfs_rq)) - cfs_rq->throttled_clock_pelt_time; }#else static inline u64 cfs_rq_clock_pelt (struct cfs_rq *cfs_rq)
kernel/sched/sched.h +2 -2
@@ -618,8 +618,8 @@ struct cfs_rq {s64 runtime_remaining;u64 throttled_clock; -u64 throttled_clock_task; -u64 throttled_clock_task_time; +u64 throttled_clock_pelt; +u64 throttled_clock_pelt_time;int throttled;int throttle_count;struct list_head throttled_list;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 279/772 sched/psi: report zeroes for CPU full at the system level
In reply to Greg Kroah-HartmanFrom: Chengming Zhou <[email protected]>
[ Upstream commit 890d550d7dbac7a31ecaa78732aa22be282bb6b8 ]
Martin find it confusing when look at the /proc/pressure/cpu output, and found no hint about that CPU "full" line in psi Documentation.
% cat /proc/pressure/cpu
some avg10=0.92 avg60=0.91 avg300=0.73 total=933490489 full avg10=0.22 avg60=0.23 avg300=0.16 total=358783277
The PSI_CPU_FULL state is introduced by commit e7fcd7622823 ("psi: Add PSI_CPU_FULL state"), which mainly for cgroup level, but also counted at the system level as a side effect.
Naturally, the FULL state doesn't exist for the CPU resource at the system level. These "full" numbers can come from CPU idle schedule latency. For example, t1 is the time when task wakeup on an idle CPU, t2 is the time when CPU pick and switch to it. The delta of (t2 - t1) will be in CPU_FULL state.
Another case all processes can be stalled is when all cgroups have been throttled at the same time, which unlikely to happen.
Anyway, CPU_FULL metric is meaningless and confusing at the system level. So this patch will report zeroes for CPU full at the system level, and update psi Documentation accordingly.
--- Documentation/accounting/psi.rst | 9 ++++----- kernel/sched/psi.c | 15 +++++++++------ 2 files changed, 13 insertions(+), 11 deletions(-)
Documentation/accounting/psi.rst +4 -5
@@ -37,11 +37,7 @@ Pressure interface Pressure information for each resource is exported through the respective file in /proc/pressure/ -- cpu, memory, and io. -The format for CPU is as such:: - - some avg10=0.00 avg60=0.00 avg300=0.00 total=0 - -and for memory and IO:: +The format is as such:: some avg10=0.00 avg60=0.00 avg300=0.00 total=0 full avg10=0.00 avg60=0.00 avg300=0.00 total=0
@@ -58,6 +54,9 @@ situation from a state where some tasks are stalled but the CPU is still doing productive work. As such, time spent in this subset of the stall state is tracked separately and exported in the "full" averages. +CPU full is undefined at the system level, but has been reported +since 5.13, so it is set to zero for backward compatibility. + The ratios (in %) are tracked as recent trends over ten, sixty, and three hundred second windows, which gives insight into short term events as well as medium and long term trends. The total absolute stall time
kernel/sched/psi.c +9 -6
@@ -1062,14 +1062,17 @@ int psi_show(struct seq_file *m, struct psi_group *group, enum psi_res res)mutex_unlock (&group->avgs_lock);for (full =0 ; full <2 ; full++) { -unsigned long avg[3 ]; -u64 total; +unsigned long avg[3 ] = {0 , }; +u64 total =0 ;int w; -for (w =0 ; w <3 ; w++) - avg[w] = group->avg[res *2 + full][w]; - total =div_u64 (group->total[PSI_AVGS ][res *2 + full], -NSEC_PER_USEC ); +/* CPU FULL is undefined at the system level */ +if (!(group == &psi_system && res ==PSI_CPU && full)) { +for (w =0 ; w <3 ; w++) + avg[w] = group->avg[res *2 + full][w]; + total =div_u64 (group->total[PSI_AVGS ][res *2 + full], +NSEC_PER_USEC ); + } seq_printf(m, "%s avg10=%lu.%02lu avg60=%lu.%02lu avg300=%lu.%02lu total=%llu\n", full ? "full" : "some",
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 280/772 spi: img-spfi: Fix pm_runtime_get_sync() error checking
In reply to Greg Kroah-HartmanFrom: Zheng Yongjun <[email protected]>
[ Upstream commit cc470d55343056d6b2a5c32e10e0aad06f324078 ]
If the device is already in a runtime PM enabled state pm_runtime_get_sync() will return 1, so a test for negative value should be used to check for errors.
--- drivers/spi/spi-img-spfi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-img-spfi.c +1 -1
@@ -731,7 +731,7 @@ static int img_spfi_resume(struct device *dev)int ret; ret =pm_runtime_get_sync (dev); -if (ret) { +if (ret <0 ) {pm_runtime_put_noidle (dev);return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 282/772 printk: use atomic updates for klogd work
In reply to Greg Kroah-HartmanFrom: John Ogness <[email protected]>
[ Upstream commit 2ba3673d70178bf07fb75ff25c54bc478add4021 ]
The per-cpu @printk_pending variable can be updated from sleepable contexts, such as:
get_random_bytes()
warn_unseeded_randomness()
printk_deferred()
defer_console_output()
and can be updated from interrupt contexts, such as:
handle_irq_event_percpu()
__irq_wake_thread()
wake_up_process()
try_to_wake_up()
select_task_rq()
select_fallback_rq()
printk_deferred()
defer_console_output()and can be updated from NMI contexts, such as:
vprintk()
if (in_nmi()) defer_console_output()
Therefore the atomic variant of the updating functions must be used.
Replace __this_cpu_xchg() with this_cpu_xchg().
Replace __this_cpu_or() with this_cpu_or().
--- kernel/printk/printk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/printk/printk.c +2 -2
@@ -3230,7 +3230,7 @@ static DEFINE_PER_CPU(int, printk_pending);static void wake_up_klogd_work_func (struct irq_work *irq_work) { -int pending =__this_cpu_xchg (printk_pending,0 ); +int pending =this_cpu_xchg (printk_pending,0 );if (pending &PRINTK_PENDING_OUTPUT ) {/* If trylock fails, someone else is doing the printing */
@@ -3264,7 +3264,7 @@ void defer_console_output(void)return ;preempt_disable (); -__this_cpu_or (printk_pending,PRINTK_PENDING_OUTPUT ); +this_cpu_or (printk_pending,PRINTK_PENDING_OUTPUT );irq_work_queue (this_cpu_ptr (&wake_up_klogd_work));preempt_enable (); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 254/772 mptcp: reset the packet scheduler on incoming MP_PRIO
In reply to Greg Kroah-HartmanFrom: Paolo Abeni <[email protected]>
[ Upstream commit 43f5b111d1ff16161ce60e19aeddb999cb6f0b01 ]
When an incoming MP_PRIO option changes the backup status of any subflow, we need to reset the packet scheduler status, or the next send could keep using the previously selected subflow, without taking in account the new priorities.
--- net/mptcp/pm.c | 19 +++++++++++++++---- net/mptcp/protocol.c | 2 ++ net/mptcp/protocol.h | 1 + 3 files changed, 18 insertions(+), 4 deletions(-)
net/mptcp/pm.c +15 -4
@@ -261,14 +261,25 @@ void mptcp_pm_rm_addr_received(struct mptcp_sock *msk,spin_unlock_bh (&pm->lock); } -void mptcp_pm_mp_prio_received (struct sock *sk,u8 bkup) +void mptcp_pm_mp_prio_received (struct sock *ssk,u8 bkup) { -struct mptcp_subflow_context *subflow =mptcp_subflow_ctx (sk); +struct mptcp_subflow_context *subflow =mptcp_subflow_ctx (ssk); +struct sock *sk = subflow->conn; +struct mptcp_sock *msk;pr_debug ("subflow->backup=%d, bkup=%d\n" , subflow->backup, bkup); - subflow->backup = bkup; + msk =mptcp_sk (sk); +if (subflow->backup != bkup) { + subflow->backup = bkup; +mptcp_data_lock (sk); +if (!sock_owned_by_user (sk)) + msk->last_snd =NULL ; +else +__set_bit (MPTCP_RESET_SCHEDULER , &msk->cb_flags); +mptcp_data_unlock (sk); + } -mptcp_event (MPTCP_EVENT_SUB_PRIORITY ,mptcp_sk (subflow->conn), sk,GFP_ATOMIC ); +mptcp_event (MPTCP_EVENT_SUB_PRIORITY , msk, ssk,GFP_ATOMIC ); }void mptcp_pm_mp_fail_received (struct sock *sk,u64 fail_seq)
net/mptcp/protocol.c +2 -0
@@ -3098,6 +3098,8 @@ static void mptcp_release_cb(struct sock *sk)__mptcp_set_connected (sk);if (__test_and_clear_bit (MPTCP_ERROR_REPORT , &msk->cb_flags))__mptcp_error_report (sk); +if (__test_and_clear_bit (MPTCP_RESET_SCHEDULER , &msk->cb_flags)) + msk->last_snd =NULL ; }__mptcp_update_rmem (sk);
net/mptcp/protocol.h +1 -0
@@ -124,6 +124,7 @@#define MPTCP_RETRANSMIT 4#define MPTCP_FLUSH_JOIN_LIST 5#define MPTCP_CONNECTED 6 +#define MPTCP_RESET_SCHEDULER 7static inline bool before64 (__u64 seq1,__u64 seq2) {
Signature · 1 line
2.35.1