5.16.3-rc1 review
Subsystems (9)
Greg Kroah-Hartman
maintainerPATCH 387/1039 Bluetooth: hci_qca: Fix NULL vs IS_ERR_OR_NULL check in qca_serdev_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 6845667146a28c09b5dfc401c1ad112374087944 ]
The function devm_gpiod_get_index() return error pointers on error. Thus devm_gpiod_get_index_optional() could return NULL and error pointers. The same as devm_gpiod_get_optional() function. Using IS_ERR_OR_NULL() check to catch error pointers.
--- drivers/bluetooth/hci_qca.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/bluetooth/hci_qca.c +3 -3
@@ -2059,14 +2059,14 @@ static int qca_serdev_probe(struct serdev_device *serdev) qcadev->bt_en =devm_gpiod_get_optional (&serdev->dev,"enable" ,GPIOD_OUT_LOW ); -if (!qcadev->bt_en && data->soc_type ==QCA_WCN6750 ) { +if (IS_ERR_OR_NULL (qcadev->bt_en) && data->soc_type ==QCA_WCN6750 ) {dev_err (&serdev->dev,"failed to acquire BT_EN gpio\n" ); power_ctrl_enabled = false; } qcadev->sw_ctrl =devm_gpiod_get_optional (&serdev->dev,"swctrl" ,GPIOD_IN ); -if (!qcadev->sw_ctrl && data->soc_type ==QCA_WCN6750 ) +if (IS_ERR_OR_NULL (qcadev->sw_ctrl) && data->soc_type ==QCA_WCN6750 )dev_warn (&serdev->dev,"failed to acquire SW_CTRL gpio\n" ); qcadev->susclk =devm_clk_get_optional (&serdev->dev,NULL );
@@ -2088,7 +2088,7 @@ static int qca_serdev_probe(struct serdev_device *serdev) qcadev->bt_en =devm_gpiod_get_optional (&serdev->dev,"enable" ,GPIOD_OUT_LOW ); -if (!qcadev->bt_en) { +if (IS_ERR_OR_NULL (qcadev->bt_en)) {dev_warn (&serdev->dev,"failed to acquire enable gpio\n" ); power_ctrl_enabled = false; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 388/1039 net/smc: Reset conn->lgr when link group registration fails
In reply to Greg Kroah-HartmanFrom: Wen Gu <[email protected]>
[ Upstream commit 36595d8ad46d9e4c41cc7c48c4405b7c3322deac ]
SMC connections might fail to be registered in a link group due to unable to find a usable link during its creation. As a result, smc_conn_create() will return a failure and most resources related to the connection won't be applied or initialized, such as conn->abort_work or conn->lnk.
If smc_conn_free() is invoked later, it will try to access the uninitialized resources related to the connection, thus causing a warning or crash.
This patch tries to fix this by resetting conn->lgr to NULL if an abnormal exit occurs in smc_lgr_register_conn(), thus avoiding the access to uninitialized resources in smc_conn_free().
Meanwhile, the new created link group should be terminated if smc connections can't be registered in it. So smc_lgr_cleanup_early() is modified to take care of link group only and invoked to terminate unusable link group by smc_conn_create(). The call to smc_conn_free() is moved out from smc_lgr_cleanup_early() to smc_conn_abort().
--- net/smc/af_smc.c | 8 +++++--- net/smc/smc_core.c | 12 +++++++----- net/smc/smc_core.h | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-)
net/smc/af_smc.c +5 -3
@@ -632,10 +632,12 @@ static int smc_connect_decline_fallback(struct smc_sock *smc, int reason_code,static void smc_conn_abort (struct smc_sock *smc,int local_first) { +struct smc_connection *conn = &smc->conn; +struct smc_link_group *lgr = conn->lgr; + +smc_conn_free (conn);if (local_first) -smc_lgr_cleanup_early (&smc->conn); -else -smc_conn_free (&smc->conn); +smc_lgr_cleanup_early (lgr); }/* check if there is a rdma device available for this connection. */
net/smc/smc_core.c +7 -5
@@ -171,8 +171,10 @@ static int smc_lgr_register_conn(struct smc_connection *conn, bool first)if (!conn->lgr->is_smcd) { rc =smcr_lgr_conn_assign_link (conn, first); -if (rc) +if (rc) { + conn->lgr =NULL ;return rc; + } }/* find a new alert_token_local value not yet used by some connection * in this link group
@@ -622,15 +624,13 @@ int smcd_nl_get_lgr(struct sk_buff *skb, struct netlink_callback *cb)return skb->len; } -void smc_lgr_cleanup_early (struct smc_connection *conn) +void smc_lgr_cleanup_early (struct smc_link_group *lgr) { -struct smc_link_group *lgr = conn->lgr;spinlock_t *lgr_lock;if (!lgr)return ; -smc_conn_free (conn);smc_lgr_list_head (lgr, &lgr_lock);spin_lock_bh (lgr_lock);/* do not use this link group for new connections */
@@ -1832,8 +1832,10 @@ create:write_lock_bh (&lgr->conns_lock); rc =smc_lgr_register_conn (conn, true);write_unlock_bh (&lgr->conns_lock); -if (rc) +if (rc) { +smc_lgr_cleanup_early (lgr); goto out; + } } conn->local_tx_ctrl.common.type =SMC_CDC_MSG_TYPE ; conn->local_tx_ctrl.len =SMC_WR_TX_SIZE ;
net/smc/smc_core.h +1 -1
@@ -468,7 +468,7 @@ static inline void smc_set_pci_values(struct pci_dev *pci_dev,struct smc_sock ;struct smc_clc_msg_accept_confirm ; -void smc_lgr_cleanup_early (struct smc_connection *conn); +void smc_lgr_cleanup_early (struct smc_link_group *lgr);void smc_lgr_terminate_sched (struct smc_link_group *lgr);void smcr_port_add (struct smc_ib_device *smcibdev,u8 ibport);void smcr_port_err (struct smc_ib_device *smcibdev,u8 ibport);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 389/1039 usb: dwc3: qcom: Fix NULL vs IS_ERR checking in dwc3_qcom_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit b52fe2dbb3e655eb1483000adfab68a219549e13 ]
Since the acpi_create_platform_device() function may return error pointers, dwc3_qcom_create_urs_usb_platdev() function may return error pointers too. Using IS_ERR_OR_NULL() to check the return value to fix this.
--- drivers/usb/dwc3/dwc3-qcom.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/dwc3/dwc3-qcom.c +5 -2
@@ -769,9 +769,12 @@ static int dwc3_qcom_probe(struct platform_device *pdev)if (qcom->acpi_pdata->is_urs) { qcom->urs_usb =dwc3_qcom_create_urs_usb_platdev (dev); -if (!qcom->urs_usb) { +if (IS_ERR_OR_NULL (qcom->urs_usb)) {dev_err (dev,"failed to create URS USB platdev\n" ); -return -ENODEV ; +if (!qcom->urs_usb) +return -ENODEV ; +else +return PTR_ERR (qcom->urs_usb); } } }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 390/1039 usb: dwc2: do not gate off the hardware if it does not support clock gating
In reply to Greg Kroah-HartmanFrom: Dinh Nguyen <[email protected]>
[ Upstream commit 34146c68083f1aef6709196b3dc888c1ceffd357 ]
We should not be clearing the HCD_FLAG_HW_ACCESSIBLE bit if the hardware does not support clock gating.
--- drivers/usb/dwc2/hcd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/usb/dwc2/hcd.c +4 -3
@@ -4399,11 +4399,12 @@ static int _dwc2_hcd_suspend(struct usb_hcd *hcd)* If not hibernation nor partial power down are supported, * clock gating is used to save power. */ -if (!hsotg->params.no_clock_gating) +if (!hsotg->params.no_clock_gating) {dwc2_host_enter_clock_gating (hsotg); -/* After entering suspend, hardware is not accessible */ -clear_bit (HCD_FLAG_HW_ACCESSIBLE , &hcd->flags); +/* After entering suspend, hardware is not accessible */ +clear_bit (HCD_FLAG_HW_ACCESSIBLE , &hcd->flags); + }break ;default : goto skip_power_saving;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 391/1039 usb: dwc2: gadget: initialize max_speed from params
In reply to Greg Kroah-HartmanFrom: John Keeping <[email protected]>
[ Upstream commit 92ef98a4caacad6d4a1490dda45d81ae5ccf5bc9 ]
DWC2 may be paired with a full-speed PHY which is not capable of high-speed operation. Report this correctly to the gadget core by setting max_speed from the core parameters.
Prior to commit 5324bad66f09f ("usb: dwc2: gadget: implement udc_set_speed()") this didn't cause the hardware to be configured incorrectly, although the speed may have been reported incorrectly. But after that commit params.speed is updated based on a value passed in by the gadget core which may set it to a faster speed than is supported by the hardware. Initialising the max_speed parameter ensures the speed passed to dwc2_gadget_set_speed() will be one supported by the hardware.
--- drivers/usb/dwc2/gadget.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/usb/dwc2/gadget.c +12 -1
@@ -4974,7 +4974,18 @@ int dwc2_gadget_init(struct dwc2_hsotg *hsotg) hsotg->params.g_np_tx_fifo_size);dev_dbg (dev,"RXFIFO size: %d\n" , hsotg->params.g_rx_fifo_size); - hsotg->gadget.max_speed =USB_SPEED_HIGH ; +switch (hsotg->params.speed) { +case DWC2_SPEED_PARAM_LOW : + hsotg->gadget.max_speed =USB_SPEED_LOW ; +break ; +case DWC2_SPEED_PARAM_FULL : + hsotg->gadget.max_speed =USB_SPEED_FULL ; +break ; +default : + hsotg->gadget.max_speed =USB_SPEED_HIGH ; +break ; + } + hsotg->gadget.ops = &dwc2_hsotg_gadget_ops; hsotg->gadget.name =dev_name (dev); hsotg->gadget.otg_caps = &hsotg->params.otg_caps;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 392/1039 usb: gadget: u_audio: fix calculations for small bInterval
In reply to Greg Kroah-HartmanFrom: John Keeping <[email protected]>
[ Upstream commit f2f69bf65df12176843ca11eab99949ba69e128b ]
If bInterval is 1, then p_interval is 8000 and p_interval_mil is 8E9, which is too big for a 32-bit value. While the storage is indeed 64-bit, this value is used as the divisor in do_div() which will truncate it into a uint32_t leading to incorrect calculated values.
Switch back to keeping the base value in struct snd_uac_chip which fits easily into an int, meaning that the division can be done in two steps with the divisor fitting safely into a uint32_t on both steps.
--- drivers/usb/gadget/function/u_audio.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
drivers/usb/gadget/function/u_audio.c +13 -11
@@ -76,8 +76,8 @@ struct snd_uac_chip {struct snd_pcm *pcm;/* pre-calculated values for playback iso completion */ -unsigned long long p_interval_mil;unsigned long long p_residue_mil; +unsigned int p_interval;unsigned int p_framesize; };
@@ -194,21 +194,24 @@ static void u_audio_iso_complete(struct usb_ep *ep, struct usb_request *req)* If there is a residue from this division, add it to the * residue accumulator. */ +unsigned long long p_interval_mil = uac->p_interval *1000000ULL ; + pitched_rate_mil = (unsigned long long ) params->p_srate * prm->pitch; div_result = pitched_rate_mil; -do_div (div_result, uac->p_interval_mil); +do_div (div_result, uac->p_interval); +do_div (div_result,1000000 ); frames = (unsigned int ) div_result;pr_debug ("p_srate %d, pitch %d, interval_mil %llu, frames %d\n" , - params->p_srate, prm->pitch, uac->p_interval_mil, frames); + params->p_srate, prm->pitch, p_interval_mil, frames); p_pktsize = min_t(unsigned int, uac->p_framesize * frames, ep->maxpacket);if (p_pktsize < ep->maxpacket) { - residue_frames_mil = pitched_rate_mil - frames * uac->p_interval_mil; + residue_frames_mil = pitched_rate_mil - frames * p_interval_mil; p_pktsize_residue_mil = uac->p_framesize * residue_frames_mil; }else p_pktsize_residue_mil =0 ;
@@ -222,11 +225,11 @@ static void u_audio_iso_complete(struct usb_ep *ep, struct usb_request *req)* size and decrease the accumulator. */ div_result = uac->p_residue_mil; -do_div (div_result, uac->p_interval_mil); +do_div (div_result, uac->p_interval); +do_div (div_result,1000000 );if ((unsigned int ) div_result >= uac->p_framesize) { req->length += uac->p_framesize; - uac->p_residue_mil -= uac->p_framesize * - uac->p_interval_mil; + uac->p_residue_mil -= uac->p_framesize * p_interval_mil;pr_debug ("increased req length to %d\n" , req->length); }pr_debug ("remains uac->p_residue_mil %llu\n" , uac->p_residue_mil);
@@ -591,7 +594,7 @@ int u_audio_start_playback(struct g_audio *audio_dev)unsigned int factor;const struct usb_endpoint_descriptor *ep_desc;int req_len, i; -unsigned int p_interval, p_pktsize; +unsigned int p_pktsize; ep = audio_dev->in_ep; prm = &uac->p_prm;
@@ -612,11 +615,10 @@ int u_audio_start_playback(struct g_audio *audio_dev)/* pre-compute some values for iso_complete() */ uac->p_framesize = params->p_ssize *num_channels (params->p_chmask); - p_interval = factor / (1 << (ep_desc->bInterval -1 )); - uac->p_interval_mil = (unsigned long long ) p_interval *1000000 ; + uac->p_interval = factor / (1 << (ep_desc->bInterval -1 )); p_pktsize = min_t(unsigned int, uac->p_framesize * - (params->p_srate / p_interval), + (params->p_srate / uac->p_interval), ep->maxpacket); req_len = p_pktsize;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 393/1039 usb: gadget: u_audio: Subdevice 0 for capture ctls
In reply to Greg Kroah-HartmanFrom: Pavel Hofman <[email protected]>
[ Upstream commit 601a5bc1aeef772ab1f47582fd322957799f5ab5 ]
Both capture and playback alsa devices use subdevice 0. Yet capture-side ctls are defined for subdevice 1. The patch sets subdevice 0 for them.
--- drivers/usb/gadget/function/u_audio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/gadget/function/u_audio.c +2 -2
@@ -1147,7 +1147,7 @@ int g_audio_setup(struct g_audio *g_audio, const char *pcm_name, } kctl->id.device = pcm->device; - kctl->id.subdevice = i; + kctl->id.subdevice =0 ; err =snd_ctl_add (card, kctl);if (err <0 )
@@ -1170,7 +1170,7 @@ int g_audio_setup(struct g_audio *g_audio, const char *pcm_name, } kctl->id.device = pcm->device; - kctl->id.subdevice = i; + kctl->id.subdevice =0 ; kctl->tlv.c = u_audio_volume_tlv;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 394/1039 HID: hid-uclogic-params: Invalid parameter check in uclogic_params_init
In reply to Greg Kroah-HartmanFrom: José Expósito <[email protected]>
[ Upstream commit f364c571a5c77e96de2d32062ff019d6b8d2e2bc ]
The function performs a check on its input parameters, however, the hdev parameter is used before the check.
Initialize the stack variables after checking the input parameters to avoid a possible NULL pointer dereference.
Addresses-Coverity-ID: 1443831 ("Null pointer dereference")
--- drivers/hid/hid-uclogic-params.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/hid/hid-uclogic-params.c +9 -4
@@ -834,10 +834,10 @@ int uclogic_params_init(struct uclogic_params *params, struct hid_device *hdev) {int rc; -struct usb_device *udev =hid_to_usb_dev (hdev); -__u8 bNumInterfaces = udev->config->desc.bNumInterfaces; -struct usb_interface *iface =to_usb_interface (hdev->dev.parent); -__u8 bInterfaceNumber = iface->cur_altsetting->desc.bInterfaceNumber; +struct usb_device *udev; +__u8 bNumInterfaces; +struct usb_interface *iface; +__u8 bInterfaceNumber;bool found;/* The resulting parameters (noop) */ struct uclogic_params p = {0 , };
@@ -848,6 +848,11 @@ int uclogic_params_init(struct uclogic_params *params, goto cleanup; } + udev =hid_to_usb_dev (hdev); + bNumInterfaces = udev->config->desc.bNumInterfaces; + iface =to_usb_interface (hdev->dev.parent); + bInterfaceNumber = iface->cur_altsetting->desc.bInterfaceNumber; +/* * Set replacement report descriptor if the original matches the * specified size. Otherwise keep interface unchanged.
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 395/1039 HID: hid-uclogic-params: Invalid parameter check in uclogic_params_get_str_desc
In reply to Greg Kroah-HartmanFrom: José Expósito <[email protected]>
[ Upstream commit 0a94131d6920916ccb6a357037c535533af08819 ]
The function performs a check on the hdev input parameters, however, it is used before the check.
Initialize the udev variable after the sanity check to avoid a possible NULL pointer dereference.
Addresses-Coverity-ID: 1443827 ("Null pointer dereference")
--- drivers/hid/hid-uclogic-params.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hid/hid-uclogic-params.c +3 -1
@@ -66,7 +66,7 @@ static int uclogic_params_get_str_desc(__u8 **pbuf, struct hid_device *hdev, __u8 idx, size_t len) {int rc; -struct usb_device *udev =hid_to_usb_dev (hdev); +struct usb_device *udev;__u8 *buf =NULL ;/* Check arguments */
@@ -75,6 +75,8 @@ static int uclogic_params_get_str_desc(__u8 **pbuf, struct hid_device *hdev, goto cleanup; } + udev =hid_to_usb_dev (hdev); + buf =kmalloc (len,GFP_KERNEL );if (buf ==NULL ) { rc = -ENOMEM ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 396/1039 HID: hid-uclogic-params: Invalid parameter check in uclogic_params_huion_init
In reply to Greg Kroah-HartmanFrom: José Expósito <[email protected]>
[ Upstream commit ff6b548afe4d9d1ff3a0f6ef79e8cbca25d8f905 ]
The function performs a check on its input parameters, however, the hdev parameter is used before the check.
Initialize the stack variables after checking the input parameters to avoid a possible NULL pointer dereference.
Addresses-Coverity-ID: 1443804 ("Null pointer dereference")
--- drivers/hid/hid-uclogic-params.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/hid/hid-uclogic-params.c +7 -3
@@ -709,9 +709,9 @@ static int uclogic_params_huion_init(struct uclogic_params *params, struct hid_device *hdev) {int rc; -struct usb_device *udev =hid_to_usb_dev (hdev); -struct usb_interface *iface =to_usb_interface (hdev->dev.parent); -__u8 bInterfaceNumber = iface->cur_altsetting->desc.bInterfaceNumber; +struct usb_device *udev; +struct usb_interface *iface; +__u8 bInterfaceNumber;bool found;/* The resulting parameters (noop) */ struct uclogic_params p = {0 , };
@@ -725,6 +725,10 @@ static int uclogic_params_huion_init(struct uclogic_params *params, goto cleanup; } + udev =hid_to_usb_dev (hdev); + iface =to_usb_interface (hdev->dev.parent); + bInterfaceNumber = iface->cur_altsetting->desc.bInterfaceNumber; +/* If it's not a pen interface */ if (bInterfaceNumber !=0 ) {/* TODO: Consider marking the interface invalid */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 397/1039 HID: hid-uclogic-params: Invalid parameter check in uclogic_params_frame_init_v1_buttonpad
In reply to Greg Kroah-HartmanFrom: José Expósito <[email protected]>
[ Upstream commit aa320fdbbbb482c19100f51461bd0069753ce3d7 ]
The function performs a check on the hdev input parameters, however, it is used before the check.
Initialize the udev variable after the sanity check to avoid a possible NULL pointer dereference.
Addresses-Coverity-ID: 1443763 ("Null pointer dereference")
--- drivers/hid/hid-uclogic-params.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hid/hid-uclogic-params.c +3 -1
@@ -452,7 +452,7 @@ static int uclogic_params_frame_init_v1_buttonpad( {int rc;bool found = false; -struct usb_device *usb_dev =hid_to_usb_dev (hdev); +struct usb_device *usb_dev;char *str_buf =NULL ;const size_t str_len =16 ;
@@ -462,6 +462,8 @@ static int uclogic_params_frame_init_v1_buttonpad( goto cleanup; } + usb_dev =hid_to_usb_dev (hdev); +/* * Enable generic button mode */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 398/1039 debugfs: lockdown: Allow reading debugfs files that are not world readable
In reply to Greg Kroah-HartmanFrom: Michal Suchanek <[email protected]>
[ Upstream commit 358fcf5ddbec4e6706405847d6a666f5933a6c25 ]
When the kernel is locked down the kernel allows reading only debugfs files with mode 444. Mode 400 is also valid but is not allowed.
Make the 444 into a mask.
--- fs/debugfs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/debugfs/file.c +1 -1
@@ -147,7 +147,7 @@ static int debugfs_locked_down(struct inode *inode, struct file *filp, const struct file_operations *real_fops) { - if ((inode->i_mode & 07777) == 0444 && + if ((inode->i_mode & 07777 & ~0444) == 0 && !(filp->f_mode & FMODE_WRITE) && !real_fops->unlocked_ioctl && !real_fops->compat_ioctl &&
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 399/1039 drivers/firmware: Add missing platform_device_put() in sysfb_create_simplefb
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 0589e8889dce8e0f0ea5bbf757f38865e2a469c1 ]
Add the missing platform_device_put() before return from sysfb_create_simplefb() in the error handling case.
--- drivers/firmware/sysfb_simplefb.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/firmware/sysfb_simplefb.c +6 -2
@@ -113,12 +113,16 @@ __init int sysfb_create_simplefb(const struct screen_info *si,sysfb_apply_efi_quirks (pd); ret =platform_device_add_resources (pd, &res,1 ); -if (ret) +if (ret) { +platform_device_put (pd);return ret; + } ret =platform_device_add_data (pd, mode,sizeof (*mode)); -if (ret) +if (ret) { +platform_device_put (pd);return ret; + }return platform_device_add (pd); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 400/1039 serial: liteuart: fix MODULE_ALIAS
In reply to Greg Kroah-HartmanFrom: Alyssa Ross <[email protected]>
[ Upstream commit 556172fabd226ba14b70c1740d0826a4717473dc ]
modprobe can't handle spaces in aliases.
--- drivers/tty/serial/liteuart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/liteuart.c +1 -1
@@ -436,4 +436,4 @@ module_exit(liteuart_exit);MODULE_AUTHOR ("Antmicro <www.antmicro.com>" );MODULE_DESCRIPTION ("LiteUART serial driver" );MODULE_LICENSE ("GPL v2" ); -MODULE_ALIAS ("platform: liteuart" ); +MODULE_ALIAS ("platform:liteuart" );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 401/1039 serial: stm32: move tx dma terminate DMA to shutdown
In reply to Greg Kroah-HartmanFrom: Valentin Caron <[email protected]>
[ Upstream commit 56a23f9319e86e1d62a109896e2c7e52c414e67d ]
Terminate DMA transaction and clear CR3_DMAT when shutdown is requested, instead of when remove is requested. If DMA transfer is not stopped in shutdown ops, driver will fail to start a new DMA transfer after next startup ops.
--- drivers/tty/serial/stm32-usart.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/tty/serial/stm32-usart.c +5 -1
@@ -883,6 +883,11 @@ static void stm32_usart_shutdown(struct uart_port *port)u32 val, isr;int ret; +if (stm32_port->tx_dma_busy) { +dmaengine_terminate_async (stm32_port->tx_ch); +stm32_usart_clr_bits (port, ofs->cr3,USART_CR3_DMAT ); + } +/* Disable modem control interrupts */ stm32_usart_disable_ms (port);
@@ -1570,7 +1575,6 @@ static int stm32_usart_serial_remove(struct platform_device *pdev)writel_relaxed (cr3, port->membase + ofs->cr3);if (stm32_port->tx_ch) { -dmaengine_terminate_async (stm32_port->tx_ch);stm32_usart_of_dma_tx_remove (stm32_port, pdev);dma_release_channel (stm32_port->tx_ch); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 402/1039 spi: qcom: geni: set the error code for gpi transfer
In reply to Greg Kroah-HartmanFrom: Vinod Koul <[email protected]>
[ Upstream commit 74b86d6af81be73bb74995ebeba74417e84b6b6f ]
Before we invoke spi_finalize_current_transfer() in spi_gsi_callback_result() we should set the spi->cur_msg->status as appropriate (0 for success, error otherwise).
The helps to return error on transfer and not wait till it timesout on error
--- drivers/spi/spi-geni-qcom.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/spi/spi-geni-qcom.c +5 -1
@@ -350,17 +350,21 @@ spi_gsi_callback_result(void *cb, const struct dmaengine_result *result) {struct spi_master *spi = cb; + spi->cur_msg->status = -EIO ;if (result->result !=DMA_TRANS_NOERROR ) {dev_err (&spi->dev,"DMA txn failed: %d\n" , result->result); +spi_finalize_current_transfer (spi);return ; }if (!result->residue) { + spi->cur_msg->status =0 ;dev_dbg (&spi->dev,"DMA txn completed\n" ); -spi_finalize_current_transfer (spi); }else {dev_err (&spi->dev,"DMA xfer has pending: %d\n" , result->residue); } + +spi_finalize_current_transfer (spi); } static int setup_gsi_xfer(struct spi_transfer *xfer, struct spi_geni_master *mas,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 403/1039 spi: qcom: geni: handle timeout for gpi mode
In reply to Greg Kroah-HartmanFrom: Vinod Koul <[email protected]>
[ Upstream commit f8039ea55d4ccac2238a247a574f0acb3bc1dc4b ]
We missed adding handle_err for gpi mode, so add a new function spi_geni_handle_err() which would call handle_fifo_timeout() or newly added handle_gpi_timeout() based on mode
--- drivers/spi/spi-geni-qcom.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-)
drivers/spi/spi-geni-qcom.c +25 -1
@@ -168,6 +168,30 @@ static void handle_fifo_timeout(struct spi_master *spi, } } +static void handle_gpi_timeout (struct spi_master *spi,struct spi_message *msg) +{ +struct spi_geni_master *mas =spi_master_get_devdata (spi); + +dmaengine_terminate_sync (mas->tx); +dmaengine_terminate_sync (mas->rx); +} + +static void spi_geni_handle_err (struct spi_master *spi,struct spi_message *msg) +{ +struct spi_geni_master *mas =spi_master_get_devdata (spi); + +switch (mas->cur_xfer_mode) { +case GENI_SE_FIFO : +handle_fifo_timeout (spi, msg); +break ; +case GENI_GPI_DMA : +handle_gpi_timeout (spi, msg); +break ; +default : +dev_err (mas->dev,"Abort on Mode:%d not supported" , mas->cur_xfer_mode); + } +} +static bool spi_geni_is_abort_still_pending (struct spi_geni_master *mas) {struct geni_se *se = &mas->se;
@@ -926,7 +950,7 @@ static int spi_geni_probe(struct platform_device *pdev) spi->can_dma = geni_can_dma; spi->dma_map_dev = dev->parent; spi->auto_runtime_pm = true; - spi->handle_err = handle_fifo_timeout; + spi->handle_err = spi_geni_handle_err; spi->use_gpio_descriptors = true;init_completion (&mas->cs_done);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 404/1039 x86, sched: Fix undefined reference to init_freq_invariance_cppc() build error
In reply to Greg Kroah-HartmanFrom: Huang Rui <[email protected]>
[ Upstream commit 6c4ab1b86dac3954d15c00c1a6396d60a1023fab ]
The init_freq_invariance_cppc function is implemented in smpboot and depends on CONFIG_SMP.
MODPOST vmlinux.symvers
MODINFO modules.builtin.modinfo
GEN modules.builtin
LD .tmp_vmlinux.kallsyms1
ld: drivers/acpi/cppc_acpi.o: in function `acpi_cppc_processor_probe':/home/ray/brahma3/linux/drivers/acpi/cppc_acpi.c:819: undefined reference to `init_freq_invariance_cppc'
make: *** [Makefile:1161: vmlinux] Error 1
See https://lore.kernel.org/lkml/[email protected]/.
--- arch/x86/include/asm/topology.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/topology.h +1 -1
@@ -221,7 +221,7 @@ static inline void arch_set_max_freq_ratio(bool turbo_disabled) }#endif -#ifdef CONFIG_ACPI_CPPC_LIB +#if defined(CONFIG_ACPI_CPPC_LIB ) && defined(CONFIG_SMP )void init_freq_invariance_cppc (void );#define init_freq_invariance_cppc init_freq_invariance_cppc#endif
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 405/1039 net/mlx5e: Fix page DMA map/unmap attributes
In reply to Greg Kroah-HartmanFrom: Aya Levin <[email protected]>
[ Upstream commit 0b7cfa4082fbf550595bc0e40f05614bd83bf0cd ]
Driver initiates DMA sync, hence it may skip CPU sync. Add DMA_ATTR_SKIP_CPU_SYNC as input attribute both to dma_map_page and dma_unmap_page to avoid redundant sync with the CPU.
When forcing the device to work with SWIOTLB, the extra sync might cause data corruption. The driver unmaps the whole page while the hardware used just a part of the bounce buffer. So syncing overrides the entire page with bounce buffer that only partially contains real data.
--- drivers/net/ethernet/mellanox/mlx5/core/en/xsk/pool.c | 4 ++-- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en/xsk/pool.c +2 -2
@@ -11,13 +11,13 @@ static int mlx5e_xsk_map_pool(struct mlx5e_priv *priv, {struct device *dev =mlx5_core_dma_dev (priv->mdev); -return xsk_pool_dma_map (pool, dev,0 ); +return xsk_pool_dma_map (pool, dev,DMA_ATTR_SKIP_CPU_SYNC ); }static void mlx5e_xsk_unmap_pool (struct mlx5e_priv *priv,struct xsk_buff_pool *pool) { -return xsk_pool_dma_unmap (pool,0 ); +return xsk_pool_dma_unmap (pool,DMA_ATTR_SKIP_CPU_SYNC ); }static int mlx5e_xsk_get_pools (struct mlx5e_xsk *xsk)
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +4 -3
@@ -278,8 +278,8 @@ static inline int mlx5e_page_alloc_pool(struct mlx5e_rq *rq,if (unlikely (!dma_info->page))return -ENOMEM ; - dma_info->addr =dma_map_page (rq->pdev, dma_info->page,0 , -PAGE_SIZE , rq->buff.map_dir); + dma_info->addr =dma_map_page_attrs (rq->pdev, dma_info->page,0 ,PAGE_SIZE , + rq->buff.map_dir,DMA_ATTR_SKIP_CPU_SYNC );if (unlikely (dma_mapping_error (rq->pdev, dma_info->addr))) {page_pool_recycle_direct (rq->page_pool, dma_info->page); dma_info->page =NULL ;
@@ -300,7 +300,8 @@ static inline int mlx5e_page_alloc(struct mlx5e_rq *rq,void mlx5e_page_dma_unmap (struct mlx5e_rq *rq,struct mlx5e_dma_info *dma_info) { -dma_unmap_page (rq->pdev, dma_info->addr,PAGE_SIZE , rq->buff.map_dir); +dma_unmap_page_attrs (rq->pdev, dma_info->addr,PAGE_SIZE , rq->buff.map_dir, +DMA_ATTR_SKIP_CPU_SYNC ); } void mlx5e_page_release_dynamic(struct mlx5e_rq *rq,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 406/1039 net/mlx5e: Fix nullptr on deleting mirroring rule
In reply to Greg Kroah-HartmanFrom: Dima Chumak <[email protected]>
[ Upstream commit de31854ece175e12ff3c35d07f340988823aed34 ]
Deleting a Tc rule with multiple outputs, one of which is internal port, like this one:
tc filter del dev enp8s0f0_0 ingress protocol ip pref 5 flower \
dst_mac 0c:42:a1:d1:d0:88 \
src_mac e4:ea:09:08:00:02 \
action tunnel_key set \
src_ip 0.0.0.0 \
dst_ip 7.7.7.8 \
id 8 \
dst_port 4789 \
action mirred egress mirror dev vxlan_sys_4789 pipe \
action mirred egress redirect dev enp8s0f0_1Triggers a call trace:
BUG: kernel NULL pointer dereference, address: 0000000000000230 RIP: 0010:del_sw_hw_rule+0x2b/0x1f0 [mlx5_core] Call Trace: tree_remove_node+0x16/0x30 [mlx5_core] mlx5_del_flow_rules+0x51/0x160 [mlx5_core] __mlx5_eswitch_del_rule+0x4b/0x170 [mlx5_core] mlx5e_tc_del_fdb_flow+0x295/0x550 [mlx5_core] mlx5e_flow_put+0x1f/0x70 [mlx5_core] mlx5e_delete_flower+0x286/0x390 [mlx5_core] tc_setup_cb_destroy+0xac/0x170 fl_hw_destroy_filter+0x94/0xc0 [cls_flower] __fl_delete+0x15e/0x170 [cls_flower] fl_delete+0x36/0x80 [cls_flower] tc_del_tfilter+0x3a6/0x6e0 rtnetlink_rcv_msg+0xe5/0x360 ? rtnl_calcit.isra.0+0x110/0x110 netlink_rcv_skb+0x46/0x110 netlink_unicast+0x16b/0x200 netlink_sendmsg+0x202/0x3d0 sock_sendmsg+0x33/0x40 ____sys_sendmsg+0x1c3/0x200 ? copy_msghdr_from_user+0xd6/0x150 ___sys_sendmsg+0x88/0xd0 ? ___sys_recvmsg+0x88/0xc0 ? do_futex+0x10c/0x460 __sys_sendmsg+0x59/0xa0 do_syscall_64+0x48/0x140 entry_SYSCALL_64_after_hwframe+0x44/0xa9
Fix by disabling offloading for flows matching esw_is_chain_src_port_rewrite() which have more than one output.
--- .../mellanox/mlx5/core/eswitch_offloads.c | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +15 -13
@@ -295,26 +295,28 @@ esw_setup_chain_src_port_rewrite(struct mlx5_flow_destination *dest, int *i) {struct mlx5_esw_flow_attr *esw_attr = attr->esw_attr; -int j, err; +int err;if (!(attr->flags &MLX5_ESW_ATTR_FLAG_SRC_REWRITE ))return -EOPNOTSUPP ; -for (j = esw_attr->split_count; j < esw_attr->out_count; j++, (*i)++) { - err =esw_setup_chain_dest (dest, flow_act, chains, attr->dest_chain,1 ,0 , *i); -if (err) - goto err_setup_chain; +/* flow steering cannot handle more than one dest with the same ft +* in a single flow +*/ +if (esw_attr->out_count - esw_attr->split_count >1 ) +return -EOPNOTSUPP ; -if (esw_attr->dests[j].pkt_reformat) { - flow_act->action |=MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT ; - flow_act->pkt_reformat = esw_attr->dests[j].pkt_reformat; - } + err =esw_setup_chain_dest (dest, flow_act, chains, attr->dest_chain,1 ,0 , *i); +if (err) +return err; + +if (esw_attr->dests[esw_attr->split_count].pkt_reformat) { + flow_act->action |=MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT ; + flow_act->pkt_reformat = esw_attr->dests[esw_attr->split_count].pkt_reformat; } -return 0 ; + (*i)++; -err_setup_chain: -esw_put_dest_tables_loop (esw, attr, esw_attr->split_count, j); -return err; +return 0 ; } static void esw_cleanup_chain_src_port_rewrite(struct mlx5_eswitch *esw,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 407/1039 net/mlx5e: Fix wrong usage of fib_info_nh when routes with nexthop objects are used
In reply to Greg Kroah-HartmanFrom: Maor Dickman <[email protected]>
[ Upstream commit 885751eb1b01d276e38f57d78c583e4ce006c5ed ]
Creating routes with nexthop objects while in switchdev mode leads to access to un-allocated memory and trigger bellow call trace due to hitting WARN_ON. This is caused due to illegal usage of fib_info_nh in TC tunnel FIB event handling to resolve the FIB device while fib_info built in with nexthop.
Fixed by ignoring attempts to use nexthop objects with routes until support can be properly added.
WARNING: CPU: 1 PID: 1724 at include/net/nexthop.h:468 mlx5e_tc_tun_fib_event+0x448/0x570 [mlx5_core] CPU: 1 PID: 1724 Comm: ip Not tainted 5.15.0_for_upstream_min_debug_2021_11_09_02_04 #1 RIP: 0010:mlx5e_tc_tun_fib_event+0x448/0x570 [mlx5_core] RSP: 0018:ffff8881349f7910 EFLAGS: 00010202 RAX: ffff8881492f1980 RBX: ffff8881349f79e8 RCX: 0000000000000000 RDX: ffff8881349f79e8 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffff8881349f7950 R08: 00000000000000fe R09: 0000000000000001 R10: 0000000000000000 R11: 0000000000000000 R12: ffff88811e9d0000 R13: ffff88810eb62000 R14: ffff888106710268 R15: 0000000000000018 FS: 00007f1d5ca6e800(0000) GS:ffff88852c880000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007ffedba44ff8 CR3: 0000000129808004 CR4: 0000000000370ea0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> atomic_notifier_call_chain+0x42/0x60 call_fib_notifiers+0x21/0x40 fib_table_insert+0x479/0x6d0 ? try_charge_memcg+0x480/0x6d0 inet_rtm_newroute+0x65/0xb0 rtnetlink_rcv_msg+0x2af/0x360 ? page_add_file_rmap+0x13/0x130 ? do_set_pte+0xcd/0x120 ? rtnl_calcit.isra.0+0x120/0x120 netlink_rcv_skb+0x4e/0xf0 netlink_unicast+0x1ee/0x2b0 netlink_sendmsg+0x22e/0x460 sock_sendmsg+0x33/0x40 ____sys_sendmsg+0x1d1/0x1f0 ___sys_sendmsg+0xab/0xf0 ? __mod_memcg_lruvec_state+0x40/0x60 ? __mod_lruvec_page_state+0x95/0xd0 ? page_add_new_anon_rmap+0x4e/0xf0 ? __handle_mm_fault+0xec6/0x1470 __sys_sendmsg+0x51/0x90 ? internal_get_user_pages_fast+0x480/0xa10 do_syscall_64+0x3d/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae
--- drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c +2 -0
@@ -1579,6 +1579,8 @@ mlx5e_init_fib_work_ipv4(struct mlx5e_priv *priv,struct net_device *fib_dev; fen_info = container_of(info, struct fib_entry_notifier_info, info); +if (fen_info->fi->nh) +return NULL ; fib_dev =fib_info_nh (fen_info->fi,0 )->fib_nh_dev;if (!fib_dev || fib_dev->netdev_ops != &mlx5e_netdev_ops || fen_info->dst_len !=32 )
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 408/1039 net/mlx5e: Dont block routes with nexthop objects in SW
In reply to Greg Kroah-HartmanFrom: Maor Dickman <[email protected]>
[ Upstream commit 9e72a55a3c9d54b38a704bb7292d984574a81d9d ]
Routes with nexthop objects is currently not supported by multipath offload and any attempts to use it is blocked, however this also block adding SW routes with nexthop.
Resolve this by returning NOTIFY_DONE instead of an error which will allow such a route to be created in SW but not offloaded.
This fix also solve an issue which block adding such routes on different devices due to missing check if the route FIB device is one of multipath devices.
--- drivers/net/ethernet/mellanox/mlx5/core/lag/mp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/lag/mp.c +2 -4
@@ -268,10 +268,8 @@ static int mlx5_lag_fib_event(struct notifier_block *nb, fen_info = container_of(info, struct fib_entry_notifier_info, info); fi = fen_info->fi; -if (fi->nh) { -NL_SET_ERR_MSG_MOD (info->extack,"IPv4 route with nexthop objects is not supported" ); -return notifier_from_errno (-EINVAL ); - } +if (fi->nh) +return NOTIFY_DONE ; fib_dev =fib_info_nh (fen_info->fi,0 )->fib_nh_dev;if (fib_dev != ldev->pf[MLX5_LAG_P1 ].netdev && fib_dev != ldev->pf[MLX5_LAG_P2 ].netdev) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 409/1039 Revert "net/mlx5e: Block offload of outer header csum for UDP tunnels"
In reply to Greg Kroah-HartmanFrom: Aya Levin <[email protected]>
[ Upstream commit 64050cdad0983ad8060e33c3f4b5aee2366bcebd ]
This reverts commit 6d6727dddc7f93fcc155cb8d0c49c29ae0e71122.
Although the NIC doesn't support offload of outer header CSUM, using gso_partial_features allows offloading the tunnel's segmentation. The driver relies on the stack CSUM calculation of the outer header. For this, NETIF_F_GSO_UDP_TUNNEL_CSUM must be a member of the device's features.
--- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +7 -3
@@ -4789,9 +4789,13 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev) }if (mlx5_vxlan_allowed (mdev->vxlan) ||mlx5_geneve_tx_allowed (mdev)) { - netdev->hw_features |=NETIF_F_GSO_UDP_TUNNEL ; - netdev->hw_enc_features |=NETIF_F_GSO_UDP_TUNNEL ; - netdev->vlan_features |=NETIF_F_GSO_UDP_TUNNEL ; + netdev->hw_features |=NETIF_F_GSO_UDP_TUNNEL | +NETIF_F_GSO_UDP_TUNNEL_CSUM ; + netdev->hw_enc_features |=NETIF_F_GSO_UDP_TUNNEL | +NETIF_F_GSO_UDP_TUNNEL_CSUM ; + netdev->gso_partial_features =NETIF_F_GSO_UDP_TUNNEL_CSUM ; + netdev->vlan_features |=NETIF_F_GSO_UDP_TUNNEL | +NETIF_F_GSO_UDP_TUNNEL_CSUM ; }if (mlx5e_tunnel_proto_supported_tx (mdev,IPPROTO_GRE )) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 410/1039 Revert "net/mlx5e: Block offload of outer header csum for GRE tunnel"
In reply to Greg Kroah-HartmanFrom: Aya Levin <[email protected]>
[ Upstream commit 01c3fd113ef50490ffd43f78f347ef6bb008510b ]
This reverts commit 54e1217b90486c94b26f24dcee1ee5ef5372f832.
Although the NIC doesn't support offload of outer header CSUM, using gso_partial_features allows offloading the tunnel's segmentation. The driver relies on the stack CSUM calculation of the outer header. For this, NETIF_F_GSO_GRE_CSUM must be a member of the device's features.
--- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +6 -3
@@ -4799,9 +4799,12 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev) }if (mlx5e_tunnel_proto_supported_tx (mdev,IPPROTO_GRE )) { - netdev->hw_features |=NETIF_F_GSO_GRE ; - netdev->hw_enc_features |=NETIF_F_GSO_GRE ; - netdev->gso_partial_features |=NETIF_F_GSO_GRE ; + netdev->hw_features |=NETIF_F_GSO_GRE | +NETIF_F_GSO_GRE_CSUM ; + netdev->hw_enc_features |=NETIF_F_GSO_GRE | +NETIF_F_GSO_GRE_CSUM ; + netdev->gso_partial_features |=NETIF_F_GSO_GRE | +NETIF_F_GSO_GRE_CSUM ; }if (mlx5e_tunnel_proto_supported_tx (mdev,IPPROTO_IPIP )) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 411/1039 net/mlx5e: Fix matching on modified inner ip_ecn bits
In reply to Greg Kroah-HartmanFrom: Paul Blakey <[email protected]>
[ Upstream commit b6dfff21a170af5c695ebaa153b7f5e297ddca03 ]
Tunnel device follows RFC 6040, and during decapsulation inner ip_ecn might change depending on inner and outer ip_ecn as follows:
+---------+----------------------------------------+ |Arriving | Arriving Outer Header | | Inner +---------+---------+---------+----------+ | Header | Not-ECT | ECT(0) | ECT(1) | CE | +---------+---------+---------+---------+----------+ | Not-ECT | Not-ECT | Not-ECT | Not-ECT | <drop> | | ECT(0) | ECT(0) | ECT(0) | ECT(1) | CE* | | ECT(1) | ECT(1) | ECT(1) | ECT(1)* | CE* | | CE | CE | CE | CE | CE | +---------+---------+---------+---------+----------+
Cells marked above are changed from original inner packet ip_ecn value.
Tc then matches on the modified inner ip_ecn, but hw offload which matches the inner ip_ecn value before decap, will fail.
Fix that by mapping all the cases of outer and inner ip_ecn matching, and only supporting cases where we know inner wouldn't be changed by decap, or in the outer ip_ecn=CE case, inner ip_ecn didn't matter.
--- .../net/ethernet/mellanox/mlx5/core/en_tc.c | 120 +++++++++++++++++- 1 file changed, 116 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +116 -4
@@ -1949,6 +1949,111 @@ u8 mlx5e_tc_get_ip_version(struct mlx5_flow_spec *spec, bool outer)return ip_version; } +/* Tunnel device follows RFC 6040, see include/net/inet_ecn.h. +* And changes inner ip_ecn depending on inner and outer ip_ecn as follows: +* +---------+----------------------------------------+ +* |Arriving | Arriving Outer Header | +* | Inner +---------+---------+---------+----------+ +* | Header | Not-ECT | ECT(0) | ECT(1) | CE | +* +---------+---------+---------+---------+----------+ +* | Not-ECT | Not-ECT | Not-ECT | Not-ECT | <drop> | +* | ECT(0) | ECT(0) | ECT(0) | ECT(1) | CE* | +* | ECT(1) | ECT(1) | ECT(1) | ECT(1)* | CE* | +* | CE | CE | CE | CE | CE | +* +---------+---------+---------+---------+----------+ +* +* Tc matches on inner after decapsulation on tunnel device, but hw offload matches +* the inner ip_ecn value before hardware decap action. +* +* Cells marked are changed from original inner packet ip_ecn value during decap, and +* so matching those values on inner ip_ecn before decap will fail. +* +* The following helper allows offload when inner ip_ecn won't be changed by outer ip_ecn, +* except for the outer ip_ecn = CE, where in all cases inner ip_ecn will be changed to CE, +* and such we can drop the inner ip_ecn=CE match. +*/ + +static int mlx5e_tc_verify_tunnel_ecn (struct mlx5e_priv *priv, +struct flow_cls_offload *f, +bool *match_inner_ecn) +{ +u8 outer_ecn_mask =0 , outer_ecn_key =0 , inner_ecn_mask =0 , inner_ecn_key =0 ; +struct flow_rule *rule =flow_cls_offload_flow_rule (f); +struct netlink_ext_ack *extack = f->common.extack; +struct flow_match_ip match; + + *match_inner_ecn = true; + +if (flow_rule_match_key (rule,FLOW_DISSECTOR_KEY_ENC_IP )) { +flow_rule_match_enc_ip (rule, &match); + outer_ecn_key = match.key->tos &INET_ECN_MASK ; + outer_ecn_mask = match.mask->tos &INET_ECN_MASK ; + } + +if (flow_rule_match_key (rule,FLOW_DISSECTOR_KEY_IP )) { +flow_rule_match_ip (rule, &match); + inner_ecn_key = match.key->tos &INET_ECN_MASK ; + inner_ecn_mask = match.mask->tos &INET_ECN_MASK ; + } + +if (outer_ecn_mask !=0 && outer_ecn_mask !=INET_ECN_MASK ) { +NL_SET_ERR_MSG_MOD (extack,"Partial match on enc_tos ecn bits isn't supported" ); +netdev_warn (priv->netdev,"Partial match on enc_tos ecn bits isn't supported" ); +return -EOPNOTSUPP ; + } + +if (!outer_ecn_mask) { +if (!inner_ecn_mask) +return 0 ; + +NL_SET_ERR_MSG_MOD (extack, +"Matching on tos ecn bits without also matching enc_tos ecn bits isn't supported" ); +netdev_warn (priv->netdev, +"Matching on tos ecn bits without also matching enc_tos ecn bits isn't supported" ); +return -EOPNOTSUPP ; + } + +if (inner_ecn_mask && inner_ecn_mask !=INET_ECN_MASK ) { +NL_SET_ERR_MSG_MOD (extack, +"Partial match on tos ecn bits with match on enc_tos ecn bits isn't supported" ); +netdev_warn (priv->netdev, +"Partial match on tos ecn bits with match on enc_tos ecn bits isn't supported" ); +return -EOPNOTSUPP ; + } + +if (!inner_ecn_mask) +return 0 ; + +/* Both inner and outer have full mask on ecn */ + +if (outer_ecn_key ==INET_ECN_ECT_1 ) { +/* inner ecn might change by DECAP action */ + +NL_SET_ERR_MSG_MOD (extack,"Match on enc_tos ecn = ECT(1) isn't supported" ); +netdev_warn (priv->netdev,"Match on enc_tos ecn = ECT(1) isn't supported" ); +return -EOPNOTSUPP ; + } + +if (outer_ecn_key !=INET_ECN_CE ) +return 0 ; + +if (inner_ecn_key !=INET_ECN_CE ) { +/* Can't happen in software, as packet ecn will be changed to CE after decap */ +NL_SET_ERR_MSG_MOD (extack, +"Match on tos enc_tos ecn = CE while match on tos ecn != CE isn't supported" ); +netdev_warn (priv->netdev, +"Match on tos enc_tos ecn = CE while match on tos ecn != CE isn't supported" ); +return -EOPNOTSUPP ; + } + +/* outer ecn = CE, inner ecn = CE, as decap will change inner ecn to CE in anycase, +* drop match on inner ecn +*/ + *match_inner_ecn = false; + +return 0 ; +} + static int parse_tunnel_attr(struct mlx5e_priv *priv, struct mlx5e_tc_flow *flow, struct mlx5_flow_spec *spec,
@@ -2144,6 +2249,7 @@ static int __parse_cls_flower(struct mlx5e_priv *priv,struct flow_rule *rule =flow_cls_offload_flow_rule (f);struct flow_dissector *dissector = rule->match.dissector;enum fs_flow_table_type fs_type; +bool match_inner_ecn = true;u16 addr_type =0 ;u8 ip_proto =0 ;u8 *match_level;
@@ -2197,6 +2303,10 @@ static int __parse_cls_flower(struct mlx5e_priv *priv, headers_c =get_match_inner_headers_criteria (spec); headers_v =get_match_inner_headers_value (spec); } + + err =mlx5e_tc_verify_tunnel_ecn (priv, f, &match_inner_ecn); +if (err) +return err; } err =mlx5e_flower_parse_meta (filter_dev, f);
@@ -2420,10 +2530,12 @@ static int __parse_cls_flower(struct mlx5e_priv *priv,struct flow_match_ip match;flow_rule_match_ip (rule, &match); -MLX5_SET (fte_match_set_lyr_2_4, headers_c, ip_ecn, - match.mask->tos &0x3 ); -MLX5_SET (fte_match_set_lyr_2_4, headers_v, ip_ecn, - match.key->tos &0x3 ); +if (match_inner_ecn) { +MLX5_SET (fte_match_set_lyr_2_4, headers_c, ip_ecn, + match.mask->tos &0x3 ); +MLX5_SET (fte_match_set_lyr_2_4, headers_v, ip_ecn, + match.key->tos &0x3 ); + }MLX5_SET (fte_match_set_lyr_2_4, headers_c, ip_dscp, match.mask->tos >>2 );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 412/1039 net/mlx5: Fix access to sf_dev_table on allocation failure
In reply to Greg Kroah-HartmanFrom: Shay Drory <[email protected]>
[ Upstream commit a1c7c49c2091926962f8c1c866d386febffec5d8 ]
Even when SF devices are supported, the SF device table allocation can still fail.
In such case mlx5_sf_dev_supported still reports true, but SF device table is invalid. This can result in NULL table access.
Hence, fix it by adding NULL table check.
--- drivers/net/ethernet/mellanox/mlx5/core/sf/dev/dev.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/sf/dev/dev.c +1 -4
@@ -30,10 +30,7 @@ bool mlx5_sf_dev_allocated(const struct mlx5_core_dev *dev) {struct mlx5_sf_dev_table *table = dev->priv.sf_dev_table; -if (!mlx5_sf_dev_supported (dev)) -return false; - -return !xa_empty (&table->devices); +return table && !xa_empty (&table->devices); }static ssize_t sfnum_show (struct device *dev,struct device_attribute *attr,char *buf)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 413/1039 net/mlx5e: Sync VXLAN udp ports during uplink representor profile change
In reply to Greg Kroah-HartmanFrom: Maor Dickman <[email protected]>
[ Upstream commit 07f6dc4024ea1d2314b9c8b81fd4e492864fcca1 ]
Currently during NIC profile disablement all VXLAN udp ports offloaded to the HW are flushed and during its enablement the driver send notification to the stack to inform the core that the entire UDP tunnel port state has been lost, uplink representor doesn't have the same behavior which can cause VXLAN udp ports offload to be in bad state while moving between modes while VXLAN interface exist.
Fixed by aligning the uplink representor profile behavior to the NIC behavior.
--- drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +3 -0
@@ -50,6 +50,7 @@#include "fs_core.h" #include "lib/mlx5.h" #include "lib/devcom.h" +#include "lib/vxlan.h" #define CREATE_TRACE_POINTS #include "diag/en_rep_tracepoint.h" #include "en_accel/ipsec.h"
@@ -1027,6 +1028,7 @@ static void mlx5e_uplink_rep_enable(struct mlx5e_priv *priv)rtnl_lock ();if (netif_running (netdev))mlx5e_open (netdev); +udp_tunnel_nic_reset_ntf (priv->netdev);netif_device_attach (netdev);rtnl_unlock (); }
@@ -1048,6 +1050,7 @@ static void mlx5e_uplink_rep_disable(struct mlx5e_priv *priv)mlx5_notifier_unregister (mdev, &priv->events_nb);mlx5e_rep_tc_disable (priv);mlx5_lag_remove_netdev (mdev, priv->netdev); +mlx5_vxlan_reset_to_default (mdev->vxlan); } static MLX5E_DEFINE_STATS_GRP(sw_rep, 0);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 414/1039 net/mlx5: Set command entry semaphore up once got index free
In reply to Greg Kroah-HartmanFrom: Moshe Shemesh <[email protected]>
[ Upstream commit 8e715cd613a1e872b9d918e912d90b399785761a ]
Avoid a race where command work handler may fail to allocate command entry index, by holding the command semaphore down till command entry index is being freed.
--- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/cmd.c +6 -9
@@ -148,8 +148,12 @@ static void cmd_ent_put(struct mlx5_cmd_work_ent *ent)if (!refcount_dec_and_test (&ent->refcnt))return ; -if (ent->idx >=0 ) -cmd_free_index (ent->cmd, ent->idx); +if (ent->idx >=0 ) { +struct mlx5_cmd *cmd = ent->cmd; + +cmd_free_index (cmd, ent->idx); +up (ent->page_queue ? &cmd->pages_sem : &cmd->sem); + }cmd_free_ent (ent); }
@@ -1602,8 +1606,6 @@ static void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vec, bool force vector = vec &0xffffffff ;for (i =0 ; i < (1 << cmd->log_sz); i++) {if (test_bit (i, &vector)) { -struct semaphore *sem; - ent = cmd->ent_arr[i];/* if we already completed the command, ignore it */
@@ -1626,10 +1628,6 @@ static void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vec, bool force dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)cmd_ent_put (ent); -if (ent->page_queue) - sem = &cmd->pages_sem; -else - sem = &cmd->sem; ent->ts2 =ktime_get_ns ();memcpy (ent->out->first.data, ent->lay->out,sizeof (ent->lay->out));dump_command (dev, ent,0 );
@@ -1683,7 +1681,6 @@ static void mlx5_cmd_comp_handler(struct mlx5_core_dev *dev, u64 vec, bool force*/ complete (&ent->done); } -up (sem); } } }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 415/1039 lib/mpi: Add the return value check of kcalloc()
In reply to Greg Kroah-HartmanFrom: Zizhuang Deng <[email protected]>
[ Upstream commit dd827abe296fe4249b2f8c9b95f72f814ea8348c ]
Add the return value check of kcalloc() to avoid potential NULL ptr dereference.
--- lib/mpi/mpi-mod.c | 2 ++ 1 file changed, 2 insertions(+)
lib/mpi/mpi-mod.c +2 -0
@@ -40,6 +40,8 @@ mpi_barrett_t mpi_barrett_init(MPI m, int copy)mpi_normalize (m); ctx =kcalloc (1 ,sizeof (*ctx),GFP_KERNEL ); +if (!ctx) +return NULL ;if (copy) { ctx->m =mpi_copy (m);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 416/1039 Bluetooth: L2CAP: uninitialized variables in l2cap_sock_setsockopt()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 2b70d4f9b20635ac328836e50d183632e1930f94 ]
The "opt" variable is a u32, but on some paths only the top bytes were initialized and the others contained random stack data.
--- net/bluetooth/l2cap_sock.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
net/bluetooth/l2cap_sock.c +8 -6
@@ -903,6 +903,8 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname,struct l2cap_conn *conn;int len, err =0 ;u32 opt; +u16 mtu; +u8 mode;BT_DBG ("sk %p" , sk);
@@ -1085,16 +1087,16 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname,break ; } -if (copy_from_sockptr (&opt, optval,sizeof (u16))) { +if (copy_from_sockptr (&mtu, optval,sizeof (u16))) { err = -EFAULT ;break ; }if (chan->mode ==L2CAP_MODE_EXT_FLOWCTL && sk->sk_state ==BT_CONNECTED ) - err =l2cap_chan_reconfigure (chan, opt); + err =l2cap_chan_reconfigure (chan, mtu);else - chan->imtu = opt; + chan->imtu = mtu;break ;
@@ -1116,14 +1118,14 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname,break ; } -if (copy_from_sockptr (&opt, optval,sizeof (u8))) { +if (copy_from_sockptr (&mode, optval,sizeof (u8))) { err = -EFAULT ;break ; } -BT_DBG ("opt %u" , opt); +BT_DBG ("mode %u" , mode); - err =l2cap_set_mode (chan, opt); + err =l2cap_set_mode (chan, mode);if (err)break ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 417/1039 Bluetooth: hci_sock: fix endian bug in hci_sock_setsockopt()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit b9f9dbad0bd1c302d357fdd327c398f51f5fc2b1 ]
This copies a u16 into the high bits of an int, which works on a big endian system but not on a little endian system.
--- net/bluetooth/hci_sock.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/bluetooth/hci_sock.c +3 -2
@@ -1915,7 +1915,8 @@ static int hci_sock_setsockopt(struct socket *sock, int level, int optname, sockptr_t optval, unsigned int len) {struct sock *sk = sock->sk; -int err =0 , opt =0 ; +int err =0 ; +u16 opt;BT_DBG ("sk %p, opt %d" , sk, optname);
@@ -1941,7 +1942,7 @@ static int hci_sock_setsockopt(struct socket *sock, int level, int optname, goto done; } -if (copy_from_sockptr (&opt, optval,sizeof (u16))) { +if (copy_from_sockptr (&opt, optval,sizeof (opt))) { err = -EFAULT ;break ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 418/1039 mptcp: fix per socket endpoint accounting
In reply to Greg Kroah-HartmanFrom: Paolo Abeni <[email protected]>
[ Upstream commit f7d6a237d7422809d458d754016de2844017cb4d ]
Since full-mesh endpoint support, the reception of a single ADD_ADDR option can cause multiple subflows creation. When such option is accepted we increment 'add_addr_accepted' by one. When we received a paired RM_ADDR option, we deleted all the relevant subflows, decrementing 'add_addr_accepted' by one for each of them.
We have a similar issue for 'local_addr_used'
Fix them moving the pm endpoint accounting outside the subflow traversal.
--- net/mptcp/pm_netlink.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
net/mptcp/pm_netlink.c +12 -6
@@ -710,6 +710,8 @@ static void mptcp_pm_nl_rm_addr_or_subflow(struct mptcp_sock *msk,return ;for (i =0 ; i < rm_list->nr; i++) { +bool removed = false; +list_for_each_entry_safe (subflow, tmp, &msk->conn_list, node) {struct sock *ssk =mptcp_subflow_tcp_sock (subflow);int how =RCV_SHUTDOWN |SEND_SHUTDOWN ;
@@ -729,15 +731,19 @@ static void mptcp_pm_nl_rm_addr_or_subflow(struct mptcp_sock *msk,mptcp_close_ssk (sk, ssk, subflow);spin_lock_bh (&msk->pm.lock); -if (rm_type ==MPTCP_MIB_RMADDR ) { - msk->pm.add_addr_accepted--; -WRITE_ONCE (msk->pm.accept_addr, true); - }else if (rm_type ==MPTCP_MIB_RMSUBFLOW ) { - msk->pm.local_addr_used--; - } + removed = true; msk->pm.subflows--;__MPTCP_INC_STATS (sock_net (sk), rm_type); } +if (!removed) +continue ; + +if (rm_type ==MPTCP_MIB_RMADDR ) { + msk->pm.add_addr_accepted--; +WRITE_ONCE (msk->pm.accept_addr, true); + }else if (rm_type ==MPTCP_MIB_RMSUBFLOW ) { + msk->pm.local_addr_used--; + } } }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 419/1039 mptcp: fix opt size when sending DSS + MP_FAIL
In reply to Greg Kroah-HartmanFrom: Matthieu Baerts <[email protected]>
[ Upstream commit 04fac2cae9422a3401c172571afbcfdd58fa5c7e ]
When these two options had to be sent -- which is not common -- the DSS size was not being taken into account in the remaining size.
Additionally in this situation, the reported size was only the one of the MP_FAIL which can cause issue if at the end, we need to write more in the TCP options than previously said.
Here we use a dedicated variable for MP_FAIL size to keep the WARN_ON_ONCE() just after.
--- net/mptcp/options.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
net/mptcp/options.c +6 -3
@@ -821,10 +821,13 @@ bool mptcp_established_options(struct sock *sk, struct sk_buff *skb,if (mptcp_established_options_mp (sk, skb, snd_data_fin, &opt_size, remaining, opts)) ret = true;else if (mptcp_established_options_dss (sk, skb, snd_data_fin, &opt_size, remaining, opts)) { +unsigned int mp_fail_size; + ret = true; -if (mptcp_established_options_mp_fail (sk, &opt_size, remaining, opts)) { - *size += opt_size; - remaining -= opt_size; +if (mptcp_established_options_mp_fail (sk, &mp_fail_size, + remaining - opt_size, opts)) { + *size += opt_size + mp_fail_size; + remaining -= opt_size - mp_fail_size;return true; } }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 420/1039 mptcp: fix a DSS option writing error
In reply to Greg Kroah-HartmanFrom: Geliang Tang <[email protected]>
[ Upstream commit 110b6d1fe98fd7af9893992459b651594d789293 ]
'ptr += 1;' was omitted in the original code.
If the DSS is the last option -- which is what we have most of the time -- that's not an issue. But it is if we need to send something else after like a RM_ADDR or an MP_PRIO.
--- net/mptcp/options.c | 1 + 1 file changed, 1 insertion(+)
net/mptcp/options.c +1 -0
@@ -1319,6 +1319,7 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp,put_unaligned_be32 (mpext->data_len <<16 |TCPOPT_NOP <<8 |TCPOPT_NOP , ptr); } + ptr +=1 ; } }else if (OPTIONS_MPTCP_MPC & opts->suboptions) {u8 len, flag =MPTCP_CAP_HMAC_SHA256 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 421/1039 mptcp: Check reclaim amount before reducing allocation
In reply to Greg Kroah-HartmanFrom: Mat Martineau <[email protected]>
[ Upstream commit 269bda9e7da48eafb599d01c96199caa2f7547e5 ]
syzbot found a page counter underflow that was triggered by MPTCP's reclaim code:
page_counter underflow: -4294964789 nr_pages=4294967295
WARNING: CPU: 2 PID: 3785 at mm/page_counter.c:56 page_counter_cancel+0xcf/0xe0 mm/page_counter.c:56 Modules linked in: CPU: 2 PID: 3785 Comm: kworker/2:6 Not tainted 5.16.0-rc1-syzkaller #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 Workqueue: events mptcp_worker RIP: 0010:page_counter_cancel+0xcf/0xe0 mm/page_counter.c:56 Code: c7 04 24 00 00 00 00 45 31 f6 eb 97 e8 2a 2b b5 ff 4c 89 ea 48 89 ee 48 c7 c7 00 9e b8 89 c6 05 a0 c1 ba 0b 01 e8 95 e4 4b 07 <0f> 0b eb a8 4c 89 e7 e8 25 5a fb ff eb c7 0f 1f 00 41 56 41 55 49 RSP: 0018:ffffc90002d4f918 EFLAGS: 00010082
RAX: 0000000000000000 RBX: ffff88806a494120 RCX: 0000000000000000 RDX: ffff8880688c41c0 RSI: ffffffff815e8f28 RDI: fffff520005a9f15 RBP: ffffffff000009cb R08: 0000000000000000 R09: 0000000000000000 R10: ffffffff815e2cfe R11: 0000000000000000 R12: ffff88806a494120 R13: 00000000ffffffff R14: 0000000000000000 R15: 0000000000000001 FS: 0000000000000000(0000) GS:ffff88802cc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000001b2de21000 CR3: 000000005ad59000 CR4: 0000000000150ee0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> page_counter_uncharge+0x2e/0x60 mm/page_counter.c:160 drain_stock+0xc1/0x180 mm/memcontrol.c:2219 refill_stock+0x139/0x2f0 mm/memcontrol.c:2271 __sk_mem_reduce_allocated+0x24d/0x550 net/core/sock.c:2945 __mptcp_rmem_reclaim net/mptcp/protocol.c:167 [inline] __mptcp_mem_reclaim_partial+0x124/0x410 net/mptcp/protocol.c:975 mptcp_mem_reclaim_partial net/mptcp/protocol.c:982 [inline] mptcp_alloc_tx_skb net/mptcp/protocol.c:1212 [inline] mptcp_sendmsg_frag+0x18c6/0x2190 net/mptcp/protocol.c:1279 __mptcp_push_pending+0x232/0x720 net/mptcp/protocol.c:1545 mptcp_release_cb+0xfe/0x200 net/mptcp/protocol.c:2975 release_sock+0xb4/0x1b0 net/core/sock.c:3306 mptcp_worker+0x51e/0xc10 net/mptcp/protocol.c:2443 process_one_work+0x9b2/0x1690 kernel/workqueue.c:2298 worker_thread+0x658/0x11f0 kernel/workqueue.c:2445 kthread+0x405/0x4f0 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 </TASK>
__mptcp_mem_reclaim_partial() could call __mptcp_rmem_reclaim() with a negative value, which passed that negative value to __sk_mem_reduce_allocated() and triggered the splat above.
Check for a reclaim amount that is positive and large enough for __mptcp_rmem_reclaim() to actually adjust rmem_fwd_alloc (much like the sk_mem_reclaim_partial() code the function is based on).
v2: Use '>' instead of '>=', since SK_MEM_QUANTUM - 1 would get right-shifted into nothing by __mptcp_rmem_reclaim.
--- net/mptcp/protocol.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/mptcp/protocol.c +3 -1
@@ -972,7 +972,9 @@ static void __mptcp_mem_reclaim_partial(struct sock *sk)lockdep_assert_held_once (&sk->sk_lock.slock); -__mptcp_rmem_reclaim (sk, reclaimable -1 ); +if (reclaimable >SK_MEM_QUANTUM ) +__mptcp_rmem_reclaim (sk, reclaimable -1 ); +sk_mem_reclaim_partial (sk); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 422/1039 spi: spi-meson-spifc: Add missing pm_runtime_disable() in meson_spifc_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 69c1b87516e327a60b39f96b778fe683259408bf ]
If the probe fails, we should use pm_runtime_disable() to balance pm_runtime_enable().
Add missing pm_runtime_disable() for meson_spifc_probe.
--- drivers/spi/spi-meson-spifc.c | 1 + 1 file changed, 1 insertion(+)
drivers/spi/spi-meson-spifc.c +1 -0
@@ -349,6 +349,7 @@ static int meson_spifc_probe(struct platform_device *pdev)return 0 ; out_clk:clk_disable_unprepare (spifc->clk); +pm_runtime_disable (spifc->dev); out_err:spi_master_put (master);return ret;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 423/1039 octeontx2-af: Increment ptp refcount before use
In reply to Greg Kroah-HartmanFrom: Subbaraya Sundeep <[email protected]>
[ Upstream commit 93440f4888cf049dbd22b41aaf94d2e2153b3eb8 ]
Before using the ptp pci device by AF driver increment the reference count of it.
--- drivers/net/ethernet/marvell/octeontx2/af/ptp.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/marvell/octeontx2/af/ptp.c +2 -0
@@ -60,6 +60,8 @@ struct ptp *ptp_get(void)/* Check driver is bound to PTP block */ if (!ptp) ptp =ERR_PTR (-EPROBE_DEFER ); +else +pci_dev_get (ptp->pdev);return ptp; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 424/1039 octeontx2-nicvf: Free VF PTP resources.
In reply to Greg Kroah-HartmanFrom: Rakesh Babu Saladi <[email protected]>
[ Upstream commit eabd0f88b0d2d433c5dfe88218d4ce1c11ef04b8 ]
When a VF is removed respective PTP resources are not being freed currently. This patch fixes it.
--- drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c +4 -1
@@ -684,7 +684,7 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id) err =register_netdev (netdev);if (err) {dev_err (dev,"Failed to register netdevice\n" ); - goto err_detach_rsrc; + goto err_ptp_destroy; } err =otx2_wq_init (vf);
@@ -709,6 +709,8 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id) err_unreg_netdev:unregister_netdev (netdev); +err_ptp_destroy: +otx2_ptp_destroy (vf); err_detach_rsrc:if (test_bit (CN10K_LMTST , &vf->hw.cap_flag))qmem_free (vf->dev, vf->dync_lmt);
@@ -742,6 +744,7 @@ static void otx2vf_remove(struct pci_dev *pdev)unregister_netdev (netdev);if (vf->otx2_wq)destroy_workqueue (vf->otx2_wq); +otx2_ptp_destroy (vf);otx2vf_disable_mbox_intr (vf);otx2_detach_resources (&vf->mbox);if (test_bit (CN10K_LMTST , &vf->hw.cap_flag))
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 425/1039 ax25: uninitialized variable in ax25_setsockopt()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 9371937092d5fd502032c1bb4475b36b39b1f1b3 ]
The "opt" variable is unsigned long but we only copy 4 bytes from the user so the lower 4 bytes are uninitialized.
I have changed the integer overflow checks from ULONG to UINT as well. This is a slight API change but I don't expect it to break anything.
--- net/ax25/af_ax25.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
net/ax25/af_ax25.c +5 -5
@@ -536,7 +536,7 @@ static int ax25_setsockopt(struct socket *sock, int level, int optname,ax25_cb *ax25;struct net_device *dev;char devname[IFNAMSIZ ]; -unsigned long opt; +unsigned int opt;int res =0 ;if (level !=SOL_AX25 )
@@ -568,7 +568,7 @@ static int ax25_setsockopt(struct socket *sock, int level, int optname,break ;case AX25_T1 : -if (opt <1 || opt >ULONG_MAX /HZ ) { +if (opt <1 || opt >UINT_MAX /HZ ) { res = -EINVAL ;break ; }
@@ -577,7 +577,7 @@ static int ax25_setsockopt(struct socket *sock, int level, int optname,break ;case AX25_T2 : -if (opt <1 || opt >ULONG_MAX /HZ ) { +if (opt <1 || opt >UINT_MAX /HZ ) { res = -EINVAL ;break ; }
@@ -593,7 +593,7 @@ static int ax25_setsockopt(struct socket *sock, int level, int optname,break ;case AX25_T3 : -if (opt <1 || opt >ULONG_MAX /HZ ) { +if (opt <1 || opt >UINT_MAX /HZ ) { res = -EINVAL ;break ; }
@@ -601,7 +601,7 @@ static int ax25_setsockopt(struct socket *sock, int level, int optname,break ;case AX25_IDLE : -if (opt >ULONG_MAX / (60 *HZ )) { +if (opt >UINT_MAX / (60 *HZ )) { res = -EINVAL ;break ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 426/1039 netrom: fix api breakage in nr_setsockopt()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit dc35616e6c2907b0c0c391a205802d8880f7fd85 ]
This needs to copy an unsigned int from user space instead of a long to avoid breaking user space with an API change.
I have updated all the integer overflow checks from ULONG to UINT as well. This is a slight API change but I do not expect it to affect anything in real life.
--- net/netrom/af_netrom.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
net/netrom/af_netrom.c +6 -6
@@ -298,7 +298,7 @@ static int nr_setsockopt(struct socket *sock, int level, int optname, {struct sock *sk = sock->sk;struct nr_sock *nr =nr_sk (sk); -unsigned long opt; +unsigned int opt;if (level !=SOL_NETROM )return -ENOPROTOOPT ;
@@ -306,18 +306,18 @@ static int nr_setsockopt(struct socket *sock, int level, int optname,if (optlen <sizeof (unsigned int ))return -EINVAL ; -if (copy_from_sockptr (&opt, optval,sizeof (unsigned long ))) +if (copy_from_sockptr (&opt, optval,sizeof (opt)))return -EFAULT ;switch (optname) {case NETROM_T1 : -if (opt <1 || opt >ULONG_MAX /HZ ) +if (opt <1 || opt >UINT_MAX /HZ )return -EINVAL ; nr->t1 = opt *HZ ;return 0 ;case NETROM_T2 : -if (opt <1 || opt >ULONG_MAX /HZ ) +if (opt <1 || opt >UINT_MAX /HZ )return -EINVAL ; nr->t2 = opt *HZ ;return 0 ;
@@ -329,13 +329,13 @@ static int nr_setsockopt(struct socket *sock, int level, int optname,return 0 ;case NETROM_T4 : -if (opt <1 || opt >ULONG_MAX /HZ ) +if (opt <1 || opt >UINT_MAX /HZ )return -EINVAL ; nr->t4 = opt *HZ ;return 0 ;case NETROM_IDLE : -if (opt >ULONG_MAX / (60 *HZ )) +if (opt >UINT_MAX / (60 *HZ ))return -EINVAL ; nr->idle = opt *60 *HZ ;return 0 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 427/1039 regmap: Call regmap_debugfs_exit() prior to _init()
In reply to Greg Kroah-HartmanFrom: Fabio Estevam <[email protected]>
[ Upstream commit 530792efa6cb86f5612ff093333fec735793b582 ]
Since commit cffa4b2122f5 ("regmap: debugfs: Fix a memory leak when calling regmap_attach_dev"), the following debugfs error is seen on i.MX boards:
debugfs: Directory 'dummy-iomuxc-gpr@20e0000' with parent 'regmap' already present!
In the attempt to fix the memory leak, the above commit added a NULL check for map->debugfs_name. For the first debufs entry, map->debugfs_name is NULL and then the new name is allocated via kasprintf().
For the second debugfs entry, map->debugfs_name() is no longer NULL, so it will keep using the old entry name and the duplicate name error is seen.
Quoting Mark Brown:
"That means that if the device gets freed we'll end up with the old debugfs file hanging around pointing at nothing.
...
To be more explicit this means we need a call to regmap_debugfs_exit() which will clean up all the existing debugfs stuff before we loose references to it."
Call regmap_debugfs_exit() prior to regmap_debugfs_init() to fix the problem.
Tested on i.MX6Q and i.MX6SX boards.
--- drivers/base/regmap/regmap.c | 1 + 1 file changed, 1 insertion(+)
drivers/base/regmap/regmap.c +1 -0
@@ -647,6 +647,7 @@ int regmap_attach_dev(struct device *dev, struct regmap *map,if (ret)return ret; +regmap_debugfs_exit (map);regmap_debugfs_init (map);/* Add a devres resource for dev_get_regmap() */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 428/1039 net: mscc: ocelot: fix incorrect balancing with down LAG ports
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit a14e6b69f393d651913edcbe4ec0dec27b8b4b40 ]
Assuming the test setup described here:
https://patchwork.kernel.org/project/netdevbpf/cover/[email protected]/
(swp1 and swp2 are in bond0, and bond0 is in a bridge with swp0)
it can be seen that when swp1 goes down (on either board A or B), then traffic that should go through that port isn't forwarded anywhere.
A dump of the PGID table shows the following:
PGID_DST[0] = ports 0
PGID_DST[1] = ports 1
PGID_DST[2] = ports 2
PGID_DST[3] = ports 3
PGID_DST[4] = ports 4
PGID_DST[5] = ports 5
PGID_DST[6] = no ports
PGID_AGGR[0] = ports 0, 1, 2, 3, 4, 5
PGID_AGGR[1] = ports 0, 1, 2, 3, 4, 5
PGID_AGGR[2] = ports 0, 1, 2, 3, 4, 5
PGID_AGGR[3] = ports 0, 1, 2, 3, 4, 5
PGID_AGGR[4] = ports 0, 1, 2, 3, 4, 5
PGID_AGGR[5] = ports 0, 1, 2, 3, 4, 5
PGID_AGGR[6] = ports 0, 1, 2, 3, 4, 5
PGID_AGGR[7] = ports 0, 1, 2, 3, 4, 5
PGID_AGGR[8] = ports 0, 1, 2, 3, 4, 5
PGID_AGGR[9] = ports 0, 1, 2, 3, 4, 5
PGID_AGGR[10] = ports 0, 1, 2, 3, 4, 5
PGID_AGGR[11] = ports 0, 1, 2, 3, 4, 5
PGID_AGGR[12] = ports 0, 1, 2, 3, 4, 5
PGID_AGGR[13] = ports 0, 1, 2, 3, 4, 5
PGID_AGGR[14] = ports 0, 1, 2, 3, 4, 5
PGID_AGGR[15] = ports 0, 1, 2, 3, 4, 5
PGID_SRC[0] = ports 1, 2
PGID_SRC[1] = ports 0
PGID_SRC[2] = ports 0
PGID_SRC[3] = no ports
PGID_SRC[4] = no ports
PGID_SRC[5] = no ports
PGID_SRC[6] = ports 0, 1, 2, 3, 4, 5
Whereas a "good" PGID configuration for that setup should have looked like this:
PGID_DST[0] = ports 0
PGID_DST[1] = ports 1, 2
PGID_DST[2] = ports 1, 2
PGID_DST[3] = ports 3
PGID_DST[4] = ports 4
PGID_DST[5] = ports 5
PGID_DST[6] = no ports
PGID_AGGR[0] = ports 0, 2, 3, 4, 5
PGID_AGGR[1] = ports 0, 2, 3, 4, 5
PGID_AGGR[2] = ports 0, 2, 3, 4, 5
PGID_AGGR[3] = ports 0, 2, 3, 4, 5
PGID_AGGR[4] = ports 0, 2, 3, 4, 5
PGID_AGGR[5] = ports 0, 2, 3, 4, 5
PGID_AGGR[6] = ports 0, 2, 3, 4, 5
PGID_AGGR[7] = ports 0, 2, 3, 4, 5
PGID_AGGR[8] = ports 0, 2, 3, 4, 5
PGID_AGGR[9] = ports 0, 2, 3, 4, 5
PGID_AGGR[10] = ports 0, 2, 3, 4, 5
PGID_AGGR[11] = ports 0, 2, 3, 4, 5
PGID_AGGR[12] = ports 0, 2, 3, 4, 5
PGID_AGGR[13] = ports 0, 2, 3, 4, 5
PGID_AGGR[14] = ports 0, 2, 3, 4, 5
PGID_AGGR[15] = ports 0, 2, 3, 4, 5
PGID_SRC[0] = ports 1, 2
PGID_SRC[1] = ports 0
PGID_SRC[2] = ports 0
PGID_SRC[3] = no ports
PGID_SRC[4] = no ports
PGID_SRC[5] = no ports
PGID_SRC[6] = ports 0, 1, 2, 3, 4, 5
In other words, in the "bad" configuration, the attempt is to remove the inactive swp1 from the destination ports via PGID_DST. But when a MAC table entry is learned, it is learned towards PGID_DST 1, because that is the logical port id of the LAG itself (it is equal to the lowest numbered member port). So when swp1 becomes inactive, if we set PGID_DST[1] to contain just swp1 and not swp2, the packet will not have any chance to reach the destination via swp2.
The "correct" way to remove swp1 as a destination is via PGID_AGGR (remove swp1 from the aggregation port groups for all aggregation codes). This means that PGID_DST[1] and PGID_DST[2] must still contain both swp1 and swp2. This makes the MAC table still treat packets destined towards the single-port LAG as "multicast", and the inactive ports are removed via the aggregation code tables.
The change presented here is a design one: the ocelot_get_bond_mask() function used to take an "only_active_ports" argument. We don't need that. The only call site that specifies only_active_ports=true, ocelot_set_aggr_pgids(), must retrieve the entire bonding mask, because it must program that into PGID_DST. Additionally, it must also clear the inactive ports from the bond mask here, which it can't do if bond_mask just contains the active ports:
ac = ocelot_read_rix(ocelot, ANA_PGID_PGID, i); ac &= ~bond_mask; <---- here /* Don't do division by zero if there was no active * port. Just make all aggregation codes zero. */ if (num_active_ports) ac |= BIT(aggr_idx[i % num_active_ports]); ocelot_write_rix(ocelot, ac, ANA_PGID_PGID, i);
So it becomes the responsibility of ocelot_set_aggr_pgids() to take ocelot_port->lag_tx_active into consideration when populating the aggr_idx array.
--- drivers/net/ethernet/mscc/ocelot.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-)
drivers/net/ethernet/mscc/ocelot.c +11 -15
@@ -1688,8 +1688,7 @@ int ocelot_get_ts_info(struct ocelot *ocelot, int port, }EXPORT_SYMBOL (ocelot_get_ts_info); -static u32 ocelot_get_bond_mask (struct ocelot *ocelot,struct net_device *bond, -bool only_active_ports) +static u32 ocelot_get_bond_mask (struct ocelot *ocelot,struct net_device *bond) {u32 mask =0 ;int port;
@@ -1700,12 +1699,8 @@ static u32 ocelot_get_bond_mask(struct ocelot *ocelot, struct net_device *bond,if (!ocelot_port)continue ; -if (ocelot_port->bond == bond) { -if (only_active_ports && !ocelot_port->lag_tx_active) -continue ; - +if (ocelot_port->bond == bond) mask |=BIT (port); - } }return mask;
@@ -1792,10 +1787,8 @@ void ocelot_apply_bridge_fwd_mask(struct ocelot *ocelot) mask =ocelot_get_bridge_fwd_mask (ocelot, port, bridge); mask |= cpu_fwd_mask; mask &= ~BIT (port); -if (bond) { - mask &= ~ocelot_get_bond_mask (ocelot, bond, - false); - } +if (bond) + mask &= ~ocelot_get_bond_mask (ocelot, bond); }else {/* Standalone ports forward only to DSA tag_8021q CPU * ports (if those exist), or to the hardware CPU port
@@ -2112,13 +2105,17 @@ static void ocelot_set_aggr_pgids(struct ocelot *ocelot)if (!bond || (visited &BIT (lag)))continue ; - bond_mask =ocelot_get_bond_mask (ocelot, bond, true); + bond_mask =ocelot_get_bond_mask (ocelot, bond);for_each_set_bit (port, &bond_mask, ocelot->num_phys_ports) { +struct ocelot_port *ocelot_port = ocelot->ports[port]; +// Destination mask ocelot_write_rix (ocelot, bond_mask,ANA_PGID_PGID , port); - aggr_idx[num_active_ports++] = port; + +if (ocelot_port->lag_tx_active) + aggr_idx[num_active_ports++] = port; }for_each_aggr_pgid (ocelot, i) {
@@ -2167,8 +2164,7 @@ static void ocelot_setup_logical_port_ids(struct ocelot *ocelot) bond = ocelot_port->bond;if (bond) { -int lag =__ffs (ocelot_get_bond_mask (ocelot, bond, - false)); +int lag =__ffs (ocelot_get_bond_mask (ocelot, bond)); ocelot_rmw_gix(ocelot, ANA_PORT_PORT_CFG_PORTID_VAL(lag),
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 429/1039 octeontx2-af: Fix interrupt name strings
In reply to Greg Kroah-HartmanFrom: Sunil Goutham <[email protected]>
[ Upstream commit 6dc9a23e29061e50c36523270de60039ccf536fa ]
Fixed interrupt name string logic which currently results in wrong memory location being accessed while dumping /proc/interrupts.
--- drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c | 5 ++--- drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu_cpt.c +2 -3
@@ -172,14 +172,13 @@ static int cpt_10k_register_interrupts(struct rvu_block *block, int off) {struct rvu *rvu = block->rvu;int blkaddr = block->addr; -char irq_name[16 ];int i, ret;for (i =CPT_10K_AF_INT_VEC_FLT0 ; i <CPT_10K_AF_INT_VEC_RVU ; i++) { -snprintf (irq_name,sizeof (irq_name),"CPTAF FLT%d" , i); +sprintf (&rvu->irq_name[(off + i) *NAME_SIZE ],"CPTAF FLT%d" , i); ret =rvu_cpt_do_register_interrupt (block, off + i, rvu_cpt_af_flt_intr_handler, - irq_name); + &rvu->irq_name[(off + i) *NAME_SIZE ]);if (ret) goto err;rvu_write64 (rvu, blkaddr,CPT_AF_FLTX_INT_ENA_W1S (i),0x1 );
drivers/net/ethernet/marvell/octeontx2/af/rvu_devlink.c +1 -1
@@ -41,7 +41,7 @@ static bool rvu_common_request_irq(struct rvu *rvu, int offset,struct rvu_devlink *rvu_dl = rvu->rvu_dl;int rc; -sprintf (&rvu->irq_name[offset *NAME_SIZE ], name); +sprintf (&rvu->irq_name[offset *NAME_SIZE ],"%s" , name); rc =request_irq (pci_irq_vector (rvu->pdev, offset), fn,0 , &rvu->irq_name[offset *NAME_SIZE ], rvu_dl);if (rc)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 430/1039 can: mcp251xfd: add missing newline to printed strings
In reply to Greg Kroah-HartmanFrom: Marc Kleine-Budde <[email protected]>
[ Upstream commit 3bd9d8ce6f8c5c43ee2f1106021db0f98882cc75 ]
This patch adds the missing newline to printed strings.
--- drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c +2 -2
@@ -2625,7 +2625,7 @@ static int mcp251xfd_register_chip_detect(struct mcp251xfd_priv *priv)if (!mcp251xfd_is_251X (priv) && priv->devtype_data.model != devtype_data->model) {netdev_info (ndev, -"Detected %s, but firmware specifies a %s. Fixing up." , +"Detected %s, but firmware specifies a %s. Fixing up.\n" ,__mcp251xfd_get_model_str (devtype_data->model),mcp251xfd_get_model_str (priv)); }
@@ -2662,7 +2662,7 @@ static int mcp251xfd_register_check_rx_int(struct mcp251xfd_priv *priv)return 0 ;netdev_info (priv->ndev, -"RX_INT active after softreset, disabling RX_INT support." ); +"RX_INT active after softreset, disabling RX_INT support.\n" );devm_gpiod_put (&priv->spi->dev, priv->rx_int); priv->rx_int =NULL ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 431/1039 tpm: add request_locality before write TPM_INT_ENABLE
In reply to Greg Kroah-HartmanFrom: Chen Jun <[email protected]>
[ Upstream commit 0ef333f5ba7f24f5d8478425c163d3097f1c7afd ]
Locality is not appropriately requested before writing the int mask. Add the missing boilerplate.
--- drivers/char/tpm/tpm_tis_core.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/char/tpm/tpm_tis_core.c +8 -0
@@ -994,7 +994,15 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, intmask |=TPM_INTF_CMD_READY_INT |TPM_INTF_LOCALITY_CHANGE_INT |TPM_INTF_DATA_AVAIL_INT |TPM_INTF_STS_VALID_INT ; intmask &= ~TPM_GLOBAL_INT_ENABLE ; + + rc =request_locality (chip,0 ); +if (rc <0 ) { + rc = -ENODEV ; + goto out_err; + } +tpm_tis_write32 (priv,TPM_INT_ENABLE (priv->locality), intmask); +release_locality (chip,0 ); rc =tpm_chip_start (chip);if (rc)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 432/1039 tpm_tis: Fix an error handling path in tpm_tis_core_init()
In reply to Greg Kroah-HartmanFrom: Christophe Jaillet <[email protected]>
[ Upstream commit e96d52822f5ac0a25de78f95cd23421bcbc93584 ]
Commit 79ca6f74dae0 ("tpm: fix Atmel TPM crash caused by too frequent queries") has moved some code around without updating the error handling path.
This is now pointless to 'goto out_err' when neither 'clk_enable()' nor 'ioremap()' have been called yet.
Make a direct return instead to avoid undoing things that have not been done.
--- drivers/char/tpm/tpm_tis_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/tpm/tpm_tis_core.c +1 -1
@@ -952,7 +952,7 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq, rc =tpm_tis_read32 (priv,TPM_DID_VID (0 ), &vendor);if (rc <0 ) - goto out_err; +return rc; priv->manufacturer_id = vendor;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 433/1039 can: softing: softing_startstop(): fix set but not used variable warning
In reply to Greg Kroah-HartmanFrom: Marc Kleine-Budde <[email protected]>
[ Upstream commit 370d988cc529598ebaec6487d4f84c2115dc696b ]
In the function softing_startstop() the variable error_reporting is assigned but not used. The code that uses this variable is commented out. Its stated that the functionality is not finally verified.
To fix the warning:
| drivers/net/can/softing/softing_fw.c:424:9: error: variable 'error_reporting' set but not used [-Werror,-Wunused-but-set-variable]
remove the comment, activate the code, but add a "0 &&" to the if expression and rely on the optimizer rather than the preprocessor to remove the code.
--- drivers/net/can/softing/softing_fw.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/can/softing/softing_fw.c +6 -5
@@ -565,18 +565,19 @@ int softing_startstop(struct net_device *dev, int up)if (ret <0 ) goto failed; } -/* enable_error_frame */ -/* + +/* enable_error_frame +* * Error reporting is switched off at the moment since * the receiving of them is not yet 100% verified * This should be enabled sooner or later -* -if (error_reporting) { +*/ +if (0 && error_reporting) { ret =softing_fct_cmd (card,51 ,"enable_error_frame" );if (ret <0 ) goto failed; } -*/ +/* initialize interface */ iowrite16 (1 , &card->dpram[DPRAM_FCT_PARAM +2 ]);iowrite16 (1 , &card->dpram[DPRAM_FCT_PARAM +4 ]);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 434/1039 can: xilinx_can: xcan_probe(): check for error irq
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit c6564c13dae25cd7f8e1de5127b4da4500ee5844 ]
For the possible failure of the platform_get_irq(), the returned irq could be error number and will finally cause the failure of the request_irq().
Consider that platform_get_irq() can now in certain cases return -EPROBE_DEFER, and the consequences of letting request_irq() effectively convert that into -EINVAL, even at probe time rather than later on. So it might be better to check just now.
--- drivers/net/can/xilinx_can.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/can/xilinx_can.c +6 -1
@@ -1761,7 +1761,12 @@ static int xcan_probe(struct platform_device *pdev)spin_lock_init (&priv->tx_lock);/* Get IRQ for the device */ - ndev->irq =platform_get_irq (pdev,0 ); + ret =platform_get_irq (pdev,0 ); +if (ret <0 ) + goto err_free; + + ndev->irq = ret; + ndev->flags |=IFF_ECHO ;/* We support local echo */ platform_set_drvdata (pdev, ndev);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 435/1039 can: rcar_canfd: rcar_canfd_channel_probe(): make sure we free CAN network device
In reply to Greg Kroah-HartmanFrom: Lad Prabhakar <[email protected]>
[ Upstream commit 72b1e360572f9fa7d08ee554f1da29abce23f288 ]
Make sure we free CAN network device in the error path. There are several jumps to fail label after allocating the CAN network device successfully. This patch places the free_candev() under fail label so that in failure path a jump to fail label frees the CAN network device.
--- drivers/net/can/rcar/rcar_canfd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/can/rcar/rcar_canfd.c +2 -3
@@ -1640,8 +1640,7 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch, ndev =alloc_candev (sizeof (*priv),RCANFD_FIFO_DEPTH );if (!ndev) {dev_err (&pdev->dev,"alloc_candev() failed\n" ); - err = -ENOMEM ; - goto fail; +return -ENOMEM ; } priv =netdev_priv (ndev);
@@ -1735,8 +1734,8 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch, fail_candev:netif_napi_del (&priv->napi); -free_candev (ndev); fail: +free_candev (ndev);return err; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 436/1039 pcmcia: fix setting of kthread task states
In reply to Greg Kroah-HartmanFrom: Dominik Brodowski <[email protected]>
[ Upstream commit fbb3485f1f931102d8ba606f1c28123f5b48afa3 ]
We need to set TASK_INTERRUPTIBLE before calling kthread_should_stop(). Otherwise, kthread_stop() might see that the pccardd thread is still in TASK_RUNNING state and fail to wake it up.
Additionally, we only need to set the state back to TASK_RUNNING if kthread_should_stop() breaks the loop.
--- drivers/pcmcia/cs.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/pcmcia/cs.c +3 -5
@@ -666,18 +666,16 @@ static int pccardd(void *__skt)if (events || sysfs_events)continue ; +set_current_state (TASK_INTERRUPTIBLE );if (kthread_should_stop ())break ; -set_current_state (TASK_INTERRUPTIBLE ); -schedule (); -/* make sure we are running */ -__set_current_state (TASK_RUNNING ); -try_to_freeze (); } +/* make sure we are running before we exit */ +__set_current_state (TASK_RUNNING );/* shut down socket, if a device is still present */ if (skt->state &SOCKET_PRESENT ) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 437/1039 netfilter: egress: avoid a lockdep splat
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
[ Upstream commit 6316136ec6e3dd1c302f7e7289a9ee46ecc610ae ]
include/linux/netfilter_netdev.h:97 suspicious rcu_dereference_check() usage! 2 locks held by sd-resolve/1100:
0: ..(rcu_read_lock_bh){1:3}, at: ip_finish_output2
1: ..(rcu_read_lock_bh){1:3}, at: __dev_queue_xmit __dev_queue_xmit+0 ..
The helper has two callers, one uses rcu_read_lock, the other rcu_read_lock_bh(). Annotate the dereference to reflect this.
--- include/linux/netfilter_netdev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/netfilter_netdev.h +1 -1
@@ -94,7 +94,7 @@ static inline struct sk_buff *nf_hook_egress(struct sk_buff *skb, int *rc,return skb;#endif - e =rcu_dereference (dev->nf_hooks_egress); + e =rcu_dereference_check (dev->nf_hooks_egress,rcu_read_lock_bh_held ());if (!e)return skb;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 438/1039 net: openvswitch: Fix ct_state nat flags for conns arriving from tc
In reply to Greg Kroah-HartmanFrom: Paul Blakey <[email protected]>
[ Upstream commit 6f022c2ddbcefaee79502ce5386dfe351d457070 ]
Netfilter conntrack maintains NAT flags per connection indicating whether NAT was configured for the connection. Openvswitch maintains NAT flags on the per packet flow key ct_state field, indicating whether NAT was actually executed on the packet.
When a packet misses from tc to ovs the conntrack NAT flags are set. However, NAT was not necessarily executed on the packet because the connection's state might still be in NEW state. As such, openvswitch wrongly assumes that NAT was executed and sets an incorrect flow key NAT flags.
Fix this, by flagging to openvswitch which NAT was actually done in act_ct via tc_skb_ext and tc_skb_cb to the openvswitch module, so the packet flow key NAT flags will be correctly set.
--- include/linux/skbuff.h | 4 +++- include/net/pkt_sched.h | 4 +++- net/openvswitch/flow.c | 16 +++++++++++++--- net/sched/act_ct.c | 6 ++++++ net/sched/cls_api.c | 2 ++ 5 files changed, 27 insertions(+), 5 deletions(-)
include/linux/skbuff.h +3 -1
@@ -287,7 +287,9 @@ struct tc_skb_ext {__u32 chain;__u16 mru;__u16 zone; - bool post_ct; + u8 post_ct:1; + u8 post_ct_snat:1; + u8 post_ct_dnat:1; };#endif
include/net/pkt_sched.h +3 -1
@@ -197,7 +197,9 @@ struct tc_skb_cb {struct qdisc_skb_cb qdisc_cb;u16 mru; -bool post_ct; + u8 post_ct:1; + u8 post_ct_snat:1; + u8 post_ct_dnat:1;u16 zone;/* Only valid if post_ct = true */ };
net/openvswitch/flow.c +13 -3
@@ -859,7 +859,7 @@ int ovs_flow_key_extract(const struct ip_tunnel_info *tun_info,#if IS_ENABLED (CONFIG_NET_TC_SKB_EXT )struct tc_skb_ext *tc_ext;#endif -bool post_ct = false; +bool post_ct = false, post_ct_snat = false, post_ct_dnat = false;int res, err;u16 zone =0 ;
@@ -900,6 +900,8 @@ int ovs_flow_key_extract(const struct ip_tunnel_info *tun_info, key->recirc_id = tc_ext ? tc_ext->chain :0 ;OVS_CB (skb)->mru = tc_ext ? tc_ext->mru :0 ; post_ct = tc_ext ? tc_ext->post_ct : false; + post_ct_snat = post_ct ? tc_ext->post_ct_snat : false; + post_ct_dnat = post_ct ? tc_ext->post_ct_dnat : false; zone = post_ct ? tc_ext->zone :0 ; }else { key->recirc_id =0 ;
@@ -911,8 +913,16 @@ int ovs_flow_key_extract(const struct ip_tunnel_info *tun_info, err =key_extract (skb, key);if (!err) {ovs_ct_fill_key (skb, key, post_ct);/* Must be after key_extract(). */ -if (post_ct && !skb_get_nfct (skb)) - key->ct_zone = zone; +if (post_ct) { +if (!skb_get_nfct (skb)) { + key->ct_zone = zone; + }else { +if (!post_ct_dnat) + key->ct_state &= ~OVS_CS_F_DST_NAT ; +if (!post_ct_snat) + key->ct_state &= ~OVS_CS_F_SRC_NAT ; + } + } }return err; }
net/sched/act_ct.c +6 -0
@@ -839,6 +839,12 @@ static int ct_nat_execute(struct sk_buff *skb, struct nf_conn *ct, } err =nf_nat_packet (ct, ctinfo, hooknum, skb); +if (err ==NF_ACCEPT ) { +if (maniptype ==NF_NAT_MANIP_SRC ) +tc_skb_cb (skb)->post_ct_snat =1 ; +if (maniptype ==NF_NAT_MANIP_DST ) +tc_skb_cb (skb)->post_ct_dnat =1 ; + } out:return err; }
net/sched/cls_api.c +2 -0
@@ -1625,6 +1625,8 @@ int tcf_classify(struct sk_buff *skb, ext->chain = last_executed_chain; ext->mru = cb->mru; ext->post_ct = cb->post_ct; + ext->post_ct_snat = cb->post_ct_snat; + ext->post_ct_dnat = cb->post_ct_dnat; ext->zone = cb->zone; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 439/1039 iwlwifi: mvm: Use div_s64 instead of do_div in iwl_mvm_ftm_rtt_smoothing()
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 4ccdcc8ffd955490feec05380223db6a48961eb5 ]
When building ARCH=arm allmodconfig:
drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c: In function ‘iwl_mvm_ftm_rtt_smoothing’:./include/asm-generic/div64.h:222:35: error: comparison of distinct pointer types lacks a cast [-Werror]
222 | (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
| ^~drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c:1070:9: note: in expansion of macro ‘do_div’
1070 | do_div(rtt_avg, 100);
| ^~~~~~do_div() has to be used with an unsigned 64-bit integer dividend but rtt_avg is a signed 64-bit integer.
div_s64() expects a signed 64-bit integer dividend and signed 32-bit divisor, which fits this scenario, so use that function here to fix the warning.
--- drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c +1 -2
@@ -1066,8 +1066,7 @@ static void iwl_mvm_ftm_rtt_smoothing(struct iwl_mvm *mvm, overshoot =IWL_MVM_FTM_INITIATOR_SMOOTH_OVERSHOOT ; alpha =IWL_MVM_FTM_INITIATOR_SMOOTH_ALPHA ; - rtt_avg = alpha * rtt + (100 - alpha) * resp->rtt_avg; -do_div (rtt_avg,100 ); + rtt_avg =div_s64 (alpha * rtt + (100 - alpha) * resp->rtt_avg,100 ); IWL_DEBUG_INFO(mvm, "%pM: prev rtt_avg=%lld, new rtt_avg=%lld, rtt=%lld\n",
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 440/1039 bnxt_en: use firmware provided max timeout for messages
In reply to Greg Kroah-HartmanFrom: Edwin Peer <[email protected]>
[ Upstream commit bce9a0b7900836df223ab638090df0cb8430d9e8 ]
Some older devices cannot accommodate the 40 seconds timeout cap for long running commands (such as NVRAM commands) due to hardware limitations. Allow these devices to request more time for these long running commands, but print a warning, since the longer timeout may cause the hung task watchdog to trigger. In the case of a firmware update operation, this is preferable to failing outright.
v2: Use bp->hwrm_cmd_max_timeout directly without the constants.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 6 ++++++ drivers/net/ethernet/broadcom/bnxt/bnxt.h | 3 ++- drivers/net/ethernet/broadcom/bnxt/bnxt_coredump.c | 4 ++-- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 9 +++------ drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.h | 3 +-- 6 files changed, 15 insertions(+), 12 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +6 -0
@@ -8008,6 +8008,12 @@ static int bnxt_hwrm_ver_get(struct bnxt *bp) bp->hwrm_cmd_timeout =le16_to_cpu (resp->def_req_timeout);if (!bp->hwrm_cmd_timeout) bp->hwrm_cmd_timeout =DFLT_HWRM_CMD_TIMEOUT ; + bp->hwrm_cmd_max_timeout =le16_to_cpu (resp->max_req_timeout) *1000 ; +if (!bp->hwrm_cmd_max_timeout) + bp->hwrm_cmd_max_timeout =HWRM_CMD_MAX_TIMEOUT ; +else if (bp->hwrm_cmd_max_timeout >HWRM_CMD_MAX_TIMEOUT ) +netdev_warn (bp->dev,"Device requests max timeout of %d seconds, may trigger hung task watchdog\n" , + bp->hwrm_cmd_max_timeout /1000 );if (resp->hwrm_intf_maj_8b >=1 ) { bp->hwrm_max_req_len =le16_to_cpu (resp->max_req_win_len);
drivers/net/ethernet/broadcom/bnxt/bnxt.h +2 -1
@@ -1985,7 +1985,8 @@ struct bnxt {u16 hwrm_max_req_len;u16 hwrm_max_ext_req_len; -int hwrm_cmd_timeout; +unsigned int hwrm_cmd_timeout; +unsigned int hwrm_cmd_max_timeout;struct mutex hwrm_cmd_lock;/* serialize hwrm messages */ struct hwrm_ver_get_output ver_resp;#define FW_VER_STR_LEN 32
drivers/net/ethernet/broadcom/bnxt/bnxt_coredump.c +2 -2
@@ -32,7 +32,7 @@ static int bnxt_hwrm_dbg_dma_data(struct bnxt *bp, void *msg,return -ENOMEM ; } -hwrm_req_timeout (bp, msg,HWRM_COREDUMP_TIMEOUT ); +hwrm_req_timeout (bp, msg, bp->hwrm_cmd_max_timeout); cmn_resp =hwrm_req_hold (bp, msg); resp = cmn_resp;
@@ -125,7 +125,7 @@ static int bnxt_hwrm_dbg_coredump_initiate(struct bnxt *bp, u16 component_id,if (rc)return rc; -hwrm_req_timeout (bp, req,HWRM_COREDUMP_TIMEOUT ); +hwrm_req_timeout (bp, req, bp->hwrm_cmd_max_timeout); req->component_id =cpu_to_le16 (component_id); req->segment_id =cpu_to_le16 (segment_id);
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +3 -6
@@ -31,9 +31,6 @@#include "bnxt_nvm_defs.h" /* NVRAM content constant and structure defs */ #include "bnxt_fw_hdr.h" /* Firmware hdr constant and structure defs */ #include "bnxt_coredump.h" -#define FLASH_NVRAM_TIMEOUT ((HWRM_CMD_TIMEOUT) * 100) -#define FLASH_PACKAGE_TIMEOUT ((HWRM_CMD_TIMEOUT) * 200) -#define INSTALL_PACKAGE_TIMEOUT ((HWRM_CMD_TIMEOUT) * 200)static u32 bnxt_get_msglevel (struct net_device *dev) {
@@ -2169,7 +2166,7 @@ static int bnxt_flash_nvram(struct net_device *dev, u16 dir_type, req->host_src_addr =cpu_to_le64 (dma_handle); } -hwrm_req_timeout (bp, req,FLASH_NVRAM_TIMEOUT ); +hwrm_req_timeout (bp, req, bp->hwrm_cmd_max_timeout); req->dir_type =cpu_to_le16 (dir_type); req->dir_ordinal =cpu_to_le16 (dir_ordinal); req->dir_ext =cpu_to_le16 (dir_ext);
@@ -2515,8 +2512,8 @@ int bnxt_flash_package_from_fw_obj(struct net_device *dev, const struct firmwarereturn rc; } -hwrm_req_timeout (bp, modify,FLASH_PACKAGE_TIMEOUT ); -hwrm_req_timeout (bp, install,INSTALL_PACKAGE_TIMEOUT ); +hwrm_req_timeout (bp, modify, bp->hwrm_cmd_max_timeout); +hwrm_req_timeout (bp, install, bp->hwrm_cmd_max_timeout);hwrm_req_hold (bp, modify); modify->host_src_addr =cpu_to_le64 (dma_handle);
drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.c +1 -1
@@ -496,7 +496,7 @@ static int __hwrm_send(struct bnxt *bp, struct bnxt_hwrm_ctx *ctx) }/* Limit timeout to an upper limit */ - timeout =min_t (uint, ctx->timeout,HWRM_CMD_MAX_TIMEOUT ); + timeout =min (ctx->timeout, bp->hwrm_cmd_max_timeout ?:HWRM_CMD_MAX_TIMEOUT );/* convert timeout to usec */ timeout *=1000 ;
drivers/net/ethernet/broadcom/bnxt/bnxt_hwrm.h +1 -2
@@ -58,11 +58,10 @@ void hwrm_update_token(struct bnxt *bp, u16 seq, enum bnxt_hwrm_wait_state s);#define BNXT_HWRM_MAX_REQ_LEN (bp->hwrm_max_req_len)#define BNXT_HWRM_SHORT_REQ_LEN sizeof(struct hwrm_short_input) -#define HWRM_CMD_MAX_TIMEOUT 40000 +#define HWRM_CMD_MAX_TIMEOUT 40000U#define SHORT_HWRM_CMD_TIMEOUT 20#define HWRM_CMD_TIMEOUT (bp->hwrm_cmd_timeout)#define HWRM_RESET_TIMEOUT ((HWRM_CMD_TIMEOUT) * 4) -#define HWRM_COREDUMP_TIMEOUT ((HWRM_CMD_TIMEOUT) * 12)#define BNXT_HWRM_TARGET 0xffff#define BNXT_HWRM_NO_CMPL_RING -1#define BNXT_HWRM_REQ_MAX_SIZE 128
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 441/1039 net: mcs7830: handle usb read errors properly
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit d668769eb9c52b150753f1653f7f5a0aeb8239d2 ]
Syzbot reported uninit value in mcs7830_bind(). The problem was in missing validation check for bytes read via usbnet_read_cmd().
usbnet_read_cmd() internally calls usb_control_msg(), that returns number of bytes read. Code should validate that requested number of bytes was actually read.
So, this patch adds missing size validation check inside mcs7830_get_reg() to prevent uninit value bugs
--- drivers/net/usb/mcs7830.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/net/usb/mcs7830.c +10 -2
@@ -108,8 +108,16 @@ static const char driver_name[] = "MOSCHIP usb-ethernet driver";static int mcs7830_get_reg (struct usbnet *dev,u16 index,u16 size,void *data) { -return usbnet_read_cmd (dev,MCS7830_RD_BREQ ,MCS7830_RD_BMREQ , -0x0000 , index, data, size); +int ret; + + ret =usbnet_read_cmd (dev,MCS7830_RD_BREQ ,MCS7830_RD_BMREQ , +0x0000 , index, data, size); +if (ret <0 ) +return ret; +else if (ret < size) +return -ENODATA ; + +return ret; }static int mcs7830_set_reg (struct usbnet *dev,u16 index,u16 size,const void *data)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 442/1039 amt: fix wrong return type of amt_send_membership_update()
In reply to Greg Kroah-HartmanFrom: Taehee Yoo <[email protected]>
[ Upstream commit dd3ca4c5184ea98e40acb8eb293d85b88ea04ee2 ]
amt_send_membership_update() would return -1 but it's return type is bool. So, it should be used TRUE instead of -1.
--- drivers/net/amt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/amt.c +1 -1
@@ -1106,7 +1106,7 @@ static bool amt_send_membership_query(struct amt_dev *amt, rt =ip_route_output_key (amt->net, &fl4);if (IS_ERR (rt)) {netdev_dbg (amt->dev,"no route to %pI4\n" , &tunnel->ip4); -return -1 ; +return true; } amtmq =skb_push (skb,sizeof (*amtmq));
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 443/1039 ext4: avoid trim error on fs with small groups
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
[ Upstream commit 173b6e383d2a204c9921ffc1eca3b87aa2106c33 ]
A user reported FITRIM ioctl failing for him on ext4 on some devices without apparent reason. After some debugging we've found out that these devices (being LVM volumes) report rather large discard granularity of 42MB and the filesystem had 1k blocksize and thus group size of 8MB. Because ext4 FITRIM implementation puts discard granularity into minlen, ext4_trim_fs() declared the trim request as invalid. However just silently doing nothing seems to be a more appropriate reaction to such combination of parameters since user did not specify anything wrong.
--- fs/ext4/ioctl.c | 2 -- fs/ext4/mballoc.c | 8 ++++++++ 2 files changed, 8 insertions(+), 2 deletions(-)
fs/ext4/ioctl.c +0 -2
@@ -1117,8 +1117,6 @@ resizefs_out: sizeof(range)))return -EFAULT ; - range.minlen =max ((unsigned int )range.minlen, - q->limits.discard_granularity); ret =ext4_trim_fs (sb, &range);if (ret <0 )return ret;
fs/ext4/mballoc.c +8 -0
@@ -6404,6 +6404,7 @@ ext4_trim_all_free(struct super_block *sb, ext4_group_t group,*/ int ext4_trim_fs (struct super_block *sb,struct fstrim_range *range) { +struct request_queue *q =bdev_get_queue (sb->s_bdev);struct ext4_group_info *grp;ext4_group_t group, first_group, last_group;ext4_grpblk_t cnt =0 , first_cluster, last_cluster;
@@ -6422,6 +6423,13 @@ int ext4_trim_fs(struct super_block *sb, struct fstrim_range *range) start >= max_blks || range->len < sb->s_blocksize) return -EINVAL; +/* No point to try to trim less than discard granularity */ +if (range->minlen < q->limits.discard_granularity) { + minlen =EXT4_NUM_B2C (EXT4_SB (sb), + q->limits.discard_granularity >> sb->s_blocksize_bits); +if (minlen >EXT4_CLUSTERS_PER_GROUP (sb)) + goto out; + }if (end >= max_blks) end = max_blks -1 ;if (end <= first_data_blk)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 444/1039 ASoC: Intel: sof_sdw: fix jack detection on HP Spectre x360 convertible
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 0527b19fa4f390a6054612e1fa1dd4f8efc96739 ]
Tests on device show the JD2 mode does not work at all, the 'Headphone Jack' and 'Headset Mic Jack' are shown as 'on' always.
JD1 seems to be the better option, with at least a change between the two cases.
Jack not plugged-in:
[root@fedora ~]# amixer -Dhw:0 cget numid=12
numid=12,iface=CARD,name='Headphone Jack'
; type=BOOLEAN,access=r-------,values=1
: values=off
[root@fedora ~]# amixer -Dhw:0 cget numid=13
numid=13,iface=CARD,name='Headset Mic Jack'
; type=BOOLEAN,access=r-------,values=1
: values=off
Jack plugged-in:
[root@fedora ~]# amixer -Dhw:0 cget numid=13
numid=13,iface=CARD,name='Headset Mic Jack'
; type=BOOLEAN,access=r-------,values=1
: values=on
[root@fedora ~]# amixer -Dhw:0 cget numid=13
numid=13,iface=CARD,name='Headset Mic Jack'
; type=BOOLEAN,access=r-------,values=1
: values=on
The 'Headset Mic Jack' is updated with a delay which seems normal with additional calibration needed.
--- sound/soc/intel/boards/sof_sdw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/boards/sof_sdw.c +1 -1
@@ -188,7 +188,7 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = { }, .driver_data = (void *)(SOF_SDW_TGL_HDMI | SOF_SDW_PCH_DMIC | - RT711_JD2), + RT711_JD1), }, {/* NUC15 'Bishop County' LAPBC510 and LAPBC710 skews */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 445/1039 ALSA: jack: Add missing rwsem around snd_ctl_remove() calls
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 06764dc931848c3a9bc01a63bbf76a605408bb54 ]
snd_ctl_remove() has to be called with card->controls_rwsem held (when called after the card instantiation). This patch add the missing rwsem calls around it.
--- sound/core/jack.c | 3 +++ 1 file changed, 3 insertions(+)
sound/core/jack.c +3 -0
@@ -62,10 +62,13 @@ static int snd_jack_dev_free(struct snd_device *device)struct snd_card *card = device->card;struct snd_jack_kctl *jack_kctl, *tmp_jack_kctl; +down_write (&card->controls_rwsem);list_for_each_entry_safe (jack_kctl, tmp_jack_kctl, &jack->kctl_list, list) {list_del_init (&jack_kctl->list);snd_ctl_remove (card, jack_kctl->kctl); } +up_write (&card->controls_rwsem); +if (jack->private_free) jack->private_free (jack);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 446/1039 ALSA: PCM: Add missing rwsem around snd_ctl_remove() calls
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 5471e9762e1af4b7df057a96bfd46cc250979b88 ]
snd_ctl_remove() has to be called with card->controls_rwsem held (when called after the card instantiation). This patch add the missing rwsem calls around it.
--- sound/core/pcm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sound/core/pcm.c +5 -1
@@ -810,7 +810,11 @@ EXPORT_SYMBOL(snd_pcm_new_internal);static void free_chmap (struct snd_pcm_str *pstr) {if (pstr->chmap_kctl) { -snd_ctl_remove (pstr->pcm->card, pstr->chmap_kctl); +struct snd_card *card = pstr->pcm->card; + +down_write (&card->controls_rwsem); +snd_ctl_remove (card, pstr->chmap_kctl); +up_write (&card->controls_rwsem); pstr->chmap_kctl =NULL ; } }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 447/1039 ALSA: hda: Add missing rwsem around snd_ctl_remove() calls
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 80bd64af75b4bb11c0329bc66c35da2ddfb66d88 ]
snd_ctl_remove() has to be called with card->controls_rwsem held (when called after the card instantiation). This patch add the missing rwsem calls around it.
--- sound/pci/hda/hda_codec.c | 3 +++ 1 file changed, 3 insertions(+)
sound/pci/hda/hda_codec.c +3 -0
@@ -1727,8 +1727,11 @@ void snd_hda_ctls_clear(struct hda_codec *codec) {int i;struct hda_nid_item *items = codec->mixers.list; + +down_write (&codec->card->controls_rwsem);for (i =0 ; i < codec->mixers.used; i++)snd_ctl_remove (codec->card, items[i].kctl); +up_write (&codec->card->controls_rwsem);snd_array_free (&codec->mixers);snd_array_free (&codec->nids); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 448/1039 ALSA: hda: Fix potential deadlock at codec unbinding
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 7206998f578d5553989bc01ea2e544b622e79539 ]
When a codec is unbound dynamically via sysfs while its stream is in use, we may face a potential deadlock at the proc remove or a UAF. This happens since the hda_pcm is managed by a linked list, as it handles the hda_pcm object release via kref.
When a PCM is opened at the unbinding time, the release of hda_pcm gets delayed and it ends up with the close of the PCM stream releasing the associated hda_pcm object of its own. The hda_pcm destructor contains the PCM device release that includes the removal of procfs entries. And, this removal has the sync of the close of all in-use files -- which would never finish because it's called from the PCM file descriptor itself, i.e. it's trying to shoot its foot.
For addressing the deadlock above, this patch changes the way to manage and release the hda_pcm object. The kref of hda_pcm is dropped, and instead a simple refcount is introduced in hda_codec for keeping the track of the active PCM streams, and at each PCM open and close, this refcount is adjusted accordingly. At unbinding, the driver calls snd_device_disconnect() for each PCM stream, then synchronizes with the refcount finish, and finally releases the object resources.
--- include/sound/hda_codec.h | 8 +++++--- sound/pci/hda/hda_bind.c | 5 +++++ sound/pci/hda/hda_codec.c | 42 ++++++++++++++++++++++++--------------- sound/pci/hda/hda_local.h | 1 + 4 files changed, 37 insertions(+), 19 deletions(-)
include/sound/hda_codec.h +5 -3
@@ -8,7 +8,7 @@#ifndef __SOUND_HDA_CODEC_H#define __SOUND_HDA_CODEC_H -#include <linux/kref.h> +#include <linux/refcount.h> #include <linux/mod_devicetable.h> #include <sound/info.h> #include <sound/control.h>
@@ -166,8 +166,8 @@ struct hda_pcm {bool own_chmap;/* codec driver provides own channel maps */ /* private: */ struct hda_codec *codec; -struct kref kref;struct list_head list; + unsigned int disconnected:1; };/* codec information */
@@ -187,6 +187,8 @@ struct hda_codec {/* PCM to create, set by patch_ops.build_pcms callback */ struct list_head pcm_list_head; +refcount_t pcm_ref; +wait_queue_head_t remove_sleep;/* codec specific info */ void *spec;
@@ -420,7 +422,7 @@ void snd_hda_codec_cleanup_for_unbind(struct hda_codec *codec);static inline void snd_hda_codec_pcm_get (struct hda_pcm *pcm) { -kref_get (&pcm->kref); +refcount_inc (&pcm->codec->pcm_ref); }void snd_hda_codec_pcm_put (struct hda_pcm *pcm);
sound/pci/hda/hda_bind.c +5 -0
@@ -156,6 +156,11 @@ static int hda_codec_driver_remove(struct device *dev)return codec->bus->core.ext_ops->hdev_detach (&codec->core); } +refcount_dec (&codec->pcm_ref); +snd_hda_codec_disconnect_pcms (codec); +wait_event (codec->remove_sleep, !refcount_read (&codec->pcm_ref)); +snd_power_sync_ref (codec->bus->card); +if (codec->patch_ops.free) codec->patch_ops.free (codec);snd_hda_codec_cleanup_for_unbind (codec);
sound/pci/hda/hda_codec.c +26 -16
92 lines not on this page · raw message
sound/pci/hda/hda_local.h +1 -0
@@ -137,6 +137,7 @@ int __snd_hda_add_vmaster(struct hda_codec *codec, char *name,int snd_hda_codec_reset (struct hda_codec *codec);void snd_hda_codec_register (struct hda_codec *codec);void snd_hda_codec_cleanup_for_unbind (struct hda_codec *codec); +void snd_hda_codec_disconnect_pcms (struct hda_codec *codec);#define snd_hda_regmap_sync (codec) snd_hdac_regmap_sync(&(codec)->core)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 449/1039 RDMA/bnxt_re: Scan the whole bitmap when checking if "disabling RCFW with pending cmd-bit"
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit a917dfb66c0a1fa1caacf3d71edcafcab48e6ff0 ]
The 'cmdq->cmdq_bitmap' bitmap is 'rcfw->cmdq_depth' bits long. The size stored in 'cmdq->bmap_size' is the size of the bitmap in bytes.
Remove this erroneous 'bmap_size' and use 'rcfw->cmdq_depth' directly in 'bnxt_qplib_disable_rcfw_channel()'. Otherwise some error messages may be missing.
Other uses of 'cmdq_bitmap' already take into account 'rcfw->cmdq_depth' directly.
--- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 6 ++---- drivers/infiniband/hw/bnxt_re/qplib_rcfw.h | 1 - 2 files changed, 2 insertions(+), 5 deletions(-)
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +2 -4
@@ -618,8 +618,6 @@ int bnxt_qplib_alloc_rcfw_channel(struct bnxt_qplib_res *res,if (!cmdq->cmdq_bitmap) goto fail; - cmdq->bmap_size = bmap_size; -/* Allocate one extra to hold the QP1 entries */ rcfw->qp_tbl_size = qp_tbl_sz +1 ; rcfw->qp_tbl = kcalloc(rcfw->qp_tbl_size, sizeof(struct bnxt_qplib_qp_node),
@@ -667,8 +665,8 @@ void bnxt_qplib_disable_rcfw_channel(struct bnxt_qplib_rcfw *rcfw)iounmap (cmdq->cmdq_mbox.reg.bar_reg);iounmap (creq->creq_db.reg.bar_reg); - indx =find_first_bit (cmdq->cmdq_bitmap, cmdq->bmap_size); -if (indx != cmdq->bmap_size) + indx =find_first_bit (cmdq->cmdq_bitmap, rcfw->cmdq_depth); +if (indx != rcfw->cmdq_depth)dev_err (&rcfw->pdev->dev,"disabling RCFW with pending cmd-bit %lx\n" , indx);
drivers/infiniband/hw/bnxt_re/qplib_rcfw.h +0 -1
@@ -152,7 +152,6 @@ struct bnxt_qplib_cmdq_ctx {wait_queue_head_t waitq;unsigned long flags;unsigned long *cmdq_bitmap; -u32 bmap_size;u32 seq_num; };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 450/1039 RDMA/hns: Validate the pkey index
In reply to Greg Kroah-HartmanFrom: Kamal Heib <[email protected]>
[ Upstream commit 2a67fcfa0db6b4075515bd23497750849b88850f ]
Before query pkey, make sure that the queried index is valid.
--- drivers/infiniband/hw/hns/hns_roce_main.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/infiniband/hw/hns/hns_roce_main.c +3 -0
@@ -270,6 +270,9 @@ static enum rdma_link_layer hns_roce_get_link_layer(struct ib_device *device,static int hns_roce_query_pkey (struct ib_device *ib_dev,u32 port,u16 index,u16 *pkey) { +if (index >0 ) +return -EINVAL ; + *pkey =PKEY_ID ;return 0 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 451/1039 scsi: pm80xx: Update WARN_ON check in pm8001_mpi_build_cmd()
In reply to Greg Kroah-HartmanFrom: Igor Pylypiv <[email protected]>
[ Upstream commit 606c54ae975ad3af540b505b46b55a687501711f ]
Starting from commit 05c6c029a44d ("scsi: pm80xx: Increase number of supported queues") driver initializes only max_q_num queues. Do not use an invalid queue if the WARN_ON condition is true.
--- drivers/scsi/pm8001/pm8001_hwi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/pm8001/pm8001_hwi.c +3 -1
@@ -1325,7 +1325,9 @@ int pm8001_mpi_build_cmd(struct pm8001_hba_info *pm8001_ha,int q_index = circularQ - pm8001_ha->inbnd_q_tbl;int rv; -WARN_ON (q_index >=PM8001_MAX_INB_NUM ); +if (WARN_ON (q_index >= pm8001_ha->max_q_num)) +return -EINVAL ; +spin_lock_irqsave (&circularQ->iq_lock, flags); rv =pm8001_mpi_msg_free_get (circularQ, pm8001_ha->iomb_size, &pMessage);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 452/1039 clk: renesas: rzg2l: Check return value of pm_genpd_init()
In reply to Greg Kroah-HartmanFrom: Lad Prabhakar <[email protected]>
[ Upstream commit 27527a3d3b162e4512798c058c0e8a216c721187 ]
Make sure we check the return value of pm_genpd_init() which might fail. Also add a devres action to remove the power-domain in-case the probe callback fails further down in the code flow.
--- drivers/clk/renesas/rzg2l-cpg.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/clk/renesas/rzg2l-cpg.c +13 -1
@@ -850,10 +850,16 @@ static void rzg2l_cpg_detach_dev(struct generic_pm_domain *unused, struct devicepm_clk_destroy (dev); } +static void rzg2l_cpg_genpd_remove (void *data) +{ +pm_genpd_remove (data); +} +static int __init rzg2l_cpg_add_clk_domain (struct device *dev) {struct device_node *np = dev->of_node;struct generic_pm_domain *genpd; +int ret; genpd =devm_kzalloc (dev,sizeof (*genpd),GFP_KERNEL );if (!genpd)
@@ -864,7 +870,13 @@ static int __init rzg2l_cpg_add_clk_domain(struct device *dev)GENPD_FLAG_ACTIVE_WAKEUP ; genpd->attach_dev = rzg2l_cpg_attach_dev; genpd->detach_dev = rzg2l_cpg_detach_dev; -pm_genpd_init (genpd, &pm_domain_always_on_gov, false); + ret =pm_genpd_init (genpd, &pm_domain_always_on_gov, false); +if (ret) +return ret; + + ret =devm_add_action_or_reset (dev, rzg2l_cpg_genpd_remove, genpd); +if (ret) +return ret;of_genpd_add_provider_simple (np, genpd);return 0 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 453/1039 clk: renesas: rzg2l: propagate return value of_genpd_add_provider_simple()
In reply to Greg Kroah-HartmanFrom: Lad Prabhakar <[email protected]>
[ Upstream commit 33748744f15a110a233b6ae0380f476006e770f0 ]
of_genpd_add_provider_simple() might fail, this patch makes sure we check the return value of of_genpd_add_provider_simple() by propagating the return value to the caller of rzg2l_cpg_add_clk_domain().
--- drivers/clk/renesas/rzg2l-cpg.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/clk/renesas/rzg2l-cpg.c +1 -2
@@ -878,8 +878,7 @@ static int __init rzg2l_cpg_add_clk_domain(struct device *dev)if (ret)return ret; -of_genpd_add_provider_simple (np, genpd); -return 0 ; +return of_genpd_add_provider_simple (np, genpd); }static int __init rzg2l_cpg_probe (struct platform_device *pdev)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 454/1039 clk: imx8mn: Fix imx8mn_clko1_sels
In reply to Greg Kroah-HartmanFrom: Adam Ford <[email protected]>
[ Upstream commit 570727e9acfac1c2330a01dd5e1272e9c3acec08 ]
When attempting to use sys_pll1_80m as the parent for clko1, the system hangs. This is due to the fact that the source select for sys_pll1_80m was incorrectly pointing to m7_alt_pll_clk, which doesn't yet exist.
According to Rev 3 of the TRM, The imx8mn_clko1_sels also incorrectly references an osc_27m which does not exist, nor does an entry for source select bits 010b. Fix both by inserting a dummy clock into the missing space in the table and renaming the incorrectly name clock with dummy.
--- drivers/clk/imx/clk-imx8mn.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clk/imx/clk-imx8mn.c +3 -3
@@ -277,9 +277,9 @@ static const char * const imx8mn_pdm_sels[] = {"osc_24m", "sys_pll2_100m", "audistatic const char *const imx8mn_dram_core_sels[] = {"dram_pll_out" ,"dram_alt_root" , }; -static const char *const imx8mn_clko1_sels[] = {"osc_24m" ,"sys_pll1_800m" ,"osc_27m" , -"sys_pll1_200m" ,"audio_pll2_out" ,"vpu_pll" , -"sys_pll1_80m" , }; +static const char *const imx8mn_clko1_sels[] = {"osc_24m" ,"sys_pll1_800m" ,"dummy" , +"sys_pll1_200m" ,"audio_pll2_out" ,"sys_pll2_500m" , +"dummy" ,"sys_pll1_80m" , };static const char *const imx8mn_clko2_sels[] = {"osc_24m" ,"sys_pll2_200m" ,"sys_pll1_400m" ,"sys_pll2_166m" ,"sys_pll3_out" ,"audio_pll1_out" ,"video_pll1_out" ,"osc_32k" , };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 455/1039 ASoC: cs42l42: Report initial jack state
In reply to Greg Kroah-HartmanFrom: Richard Fitzgerald <[email protected]>
[ Upstream commit fdd535283779ec9f9c35fda352585c629121214f ]
When a jack handler is registered in cs42l42_set_jack() the initial state should be reported if an attached headphone/headset has already been detected.
The jack detect sequence takes around 1 second: typically long enough for the machine driver to probe and register the jack handler in time to receive the first report from the interrupt handler. So it is possible on some systems that the correct initial state was seen simply because of lucky timing. Modular builds were more likely to miss the reporting of the initial state.
--- sound/soc/codecs/cs42l42.c | 22 ++++++++++++++++++++++ sound/soc/codecs/cs42l42.h | 2 ++ 2 files changed, 24 insertions(+)
sound/soc/codecs/cs42l42.c +22 -0
@@ -521,8 +521,25 @@ static int cs42l42_set_jack(struct snd_soc_component *component, struct snd_soc_ {struct cs42l42_private *cs42l42 =snd_soc_component_get_drvdata (component); +/* Prevent race with interrupt handler */ +mutex_lock (&cs42l42->jack_detect_mutex); cs42l42->jack = jk; +if (jk) { +switch (cs42l42->hs_type) { +case CS42L42_PLUG_CTIA : +case CS42L42_PLUG_OMTP : +snd_soc_jack_report (jk,SND_JACK_HEADSET ,SND_JACK_HEADSET ); +break ; +case CS42L42_PLUG_HEADPHONE : +snd_soc_jack_report (jk,SND_JACK_HEADPHONE ,SND_JACK_HEADPHONE ); +break ; +default : +break ; + } + } +mutex_unlock (&cs42l42->jack_detect_mutex); +return 0 ; }
@@ -1611,6 +1628,8 @@ static irqreturn_t cs42l42_irq_thread(int irq, void *data)CS42L42_M_DETECT_FT_MASK | CS42L42_M_HSBIAS_HIZ_MASK); +mutex_lock (&cs42l42->jack_detect_mutex); +/* Check auto-detect status */ if ((~masks[5 ]) & irq_params_table[5 ].mask) {if (stickies[5 ] &CS42L42_HSDET_AUTO_DONE_MASK ) {
@@ -1689,6 +1708,8 @@ static irqreturn_t cs42l42_irq_thread(int irq, void *data) } } +mutex_unlock (&cs42l42->jack_detect_mutex); +return IRQ_HANDLED ; }
@@ -2033,6 +2054,7 @@ static int cs42l42_i2c_probe(struct i2c_client *i2c_client, cs42l42->dev = &i2c_client->dev;i2c_set_clientdata (i2c_client, cs42l42); +mutex_init (&cs42l42->jack_detect_mutex); cs42l42->regmap =devm_regmap_init_i2c (i2c_client, &cs42l42_regmap);if (IS_ERR (cs42l42->regmap)) {
sound/soc/codecs/cs42l42.h +2 -0
@@ -12,6 +12,7 @@#ifndef __CS42L42_H__#define __CS42L42_H__ +#include <linux/mutex.h> #include <sound/jack.h> #define CS42L42_PAGE_REGISTER 0x00/* Page Select Register */
@@ -838,6 +839,7 @@ struct cs42l42_private {struct gpio_desc *reset_gpio;struct completion pdn_done;struct snd_soc_jack *jack; +struct mutex jack_detect_mutex;int pll_config;int bclk;u32 sclk;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 456/1039 powerpc/prom_init: Fix improper check of prom_getprop()
In reply to Greg Kroah-HartmanFrom: Peiwei Hu <[email protected]>
[ Upstream commit 869fb7e5aecbc163003f93f36dcc26d0554319f6 ]
prom_getprop() can return PROM_ERROR. Binary operator can not identify it.
--- arch/powerpc/kernel/prom_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/kernel/prom_init.c +1 -1
@@ -2991,7 +2991,7 @@ static void __init fixup_device_tree_efika_add_phy(void)/* Check if the phy-handle property exists - bail if it does */ rv =prom_getprop (node,"phy-handle" , prop,sizeof (prop)); -if (!rv) +if (rv <=0 )return ;/*
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 457/1039 ASoC: uniphier: drop selecting non-existing SND_SOC_UNIPHIER_AIO_DMA
In reply to Greg Kroah-HartmanFrom: Lukas Bulwahn <[email protected]>
[ Upstream commit 49f893253ab43566e34332a969324531fea463f6 ]
Commit f37fe2f9987b ("ASoC: uniphier: add support for UniPhier AIO common driver") adds configs SND_SOC_UNIPHIER_{LD11,PXS2}, which select the non-existing config SND_SOC_UNIPHIER_AIO_DMA.
Hence, ./scripts/checkkconfigsymbols.py warns:
SND_SOC_UNIPHIER_AIO_DMA
Referencing files: sound/soc/uniphier/Kconfig
Probably, there is actually no further config intended to be selected here. So, just drop selecting the non-existing config.
--- sound/soc/uniphier/Kconfig | 2 -- 1 file changed, 2 deletions(-)
sound/soc/uniphier/Kconfig +0 -2
@@ -23,7 +23,6 @@ config SND_SOC_UNIPHIER_LD11 tristate "UniPhier LD11/LD20 Device Driver" depends on SND_SOC_UNIPHIER select SND_SOC_UNIPHIER_AIO - select SND_SOC_UNIPHIER_AIO_DMA help This adds ASoC driver for Socionext UniPhier LD11/LD20 input and output that can be used with other codecs.
@@ -34,7 +33,6 @@ config SND_SOC_UNIPHIER_PXS2 tristate "UniPhier PXs2 Device Driver" depends on SND_SOC_UNIPHIER select SND_SOC_UNIPHIER_AIO - select SND_SOC_UNIPHIER_AIO_DMA help This adds ASoC driver for Socionext UniPhier PXs2 input and output that can be used with other codecs.
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 458/1039 ASoC: codecs: wcd938x: add SND_SOC_WCD938_SDW to codec list instead
In reply to Greg Kroah-HartmanFrom: Lukas Bulwahn <[email protected]>
[ Upstream commit 2039cc1da4bee1fd0df644e26b28ed769cd32a81 ]
Commit 045442228868 ("ASoC: codecs: wcd938x: add audio routing and Kconfig") adds SND_SOC_WCD937X, which does not exist, and SND_SOC_WCD938X, which seems not really to be the intended config to be selected, but only a supporting config symbol to the actual config SND_SOC_WCD938X_SDW for the codec.
Add SND_SOC_WCD938_SDW to the list instead of SND_SOC_WCD93{7,8}X.
The issue was identified with ./scripts/checkkconfigsymbols.py.
--- sound/soc/codecs/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/codecs/Kconfig +1 -2
@@ -241,8 +241,7 @@ config SND_SOC_ALL_CODECS imply SND_SOC_UDA1380 imply SND_SOC_WCD9335 imply SND_SOC_WCD934X - imply SND_SOC_WCD937X - imply SND_SOC_WCD938X + imply SND_SOC_WCD938X_SDW imply SND_SOC_LPASS_RX_MACRO imply SND_SOC_LPASS_TX_MACRO imply SND_SOC_WL1273
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 459/1039 RDMA/rtrs-clt: Fix the initial value of min_latency
In reply to Greg Kroah-HartmanFrom: Jack Wang <[email protected]>
[ Upstream commit 925cac6358677d3d64f9b25f205eeb3d31c9f7f8 ]
The type of min_latency is ktime_t, so use KTIME_MAX to initialize the initial value.
--- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/ulp/rtrs/rtrs-clt.c +1 -1
@@ -867,7 +867,7 @@ static struct rtrs_clt_sess *get_next_path_min_latency(struct path_it *it)struct rtrs_clt_sess *min_path =NULL ;struct rtrs_clt *clt = it->clt;struct rtrs_clt_sess *sess; -ktime_t min_latency =INT_MAX ; +ktime_t min_latency =KTIME_MAX ;ktime_t latency;list_for_each_entry_rcu (sess, &clt->paths_list, s.entry) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 460/1039 ALSA: hda: Make proper use of timecounter
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
[ Upstream commit 6dd21ad81bf96478db3403b1bbe251c0612d0431 ]
HDA uses a timecounter to read a hardware clock running at 24 MHz. The conversion factor is set with a mult value of 125 and a shift value of 0, which is not converting the hardware clock to nanoseconds, it is converting to 1/3 nanoseconds because the conversion factor from 24Mhz to nanoseconds is 125/3. The usage sites divide the "nanoseconds" value returned by timecounter_read() by 3 to get a real nanoseconds value.
There is a lengthy comment in azx_timecounter_init() explaining this choice. That comment makes blatantly wrong assumptions about how timecounters work and what can overflow.
The comment says:
* Applying the 1/3 factor as part of the multiplication
* requires at least 20 bits for a decent precision, however
* overflows occur after about 4 hours or less, not a option.
timecounters operate on time deltas between two readouts of a clock and use the mult/shift pair to calculate a precise nanoseconds value:
delta_nsec = (delta_clock * mult) >> shift;
The fractional part is also taken into account and preserved to prevent accumulated rounding errors. For details see cyclecounter_cyc2ns().
The mult/shift pair has to be chosen so that the multiplication of the maximum expected delta value does not result in a 64bit overflow. As the counter wraps around on 32bit, the maximum observable delta between two reads is (1 << 32) - 1 which is about 178.9 seconds.
That in turn means the maximum multiplication factor which fits into an u32 will not cause a 64bit overflow ever because it's guaranteed that:
((1 << 32) - 1) ^ 2 < (1 << 64)
The resulting correct multiplication factor is 2796202667 and the shift value is 26, i.e. 26 bit precision. The overflow of the multiplication would happen exactly at a clock readout delta of 6597069765 which is way after the wrap around of the hardware clock at around 274.8 seconds which is off from the claimed 4 hours by more than an order of magnitude.
If the counter ever wraps around the last read value then the calculation is off by the number of wrap arounds times 178.9 seconds because the overflow cannot be observed.
Use clocks_calc_mult_shift(), which calculates the most accurate mult/shift pair based on the given clock frequency, and remove the bogus comment along with the divisions at the readout sites.
--- sound/hda/hdac_stream.c | 14 ++++---------- sound/pci/hda/hda_controller.c | 1 - sound/soc/intel/skylake/skl-pcm.c | 1 - 3 files changed, 4 insertions(+), 12 deletions(-)
sound/hda/hdac_stream.c +4 -10
@@ -534,17 +534,11 @@ static void azx_timecounter_init(struct hdac_stream *azx_dev, cc->mask =CLOCKSOURCE_MASK (32 );/* -* Converting from 24 MHz to ns means applying a 125/3 factor. -* To avoid any saturation issues in intermediate operations, -* the 125 factor is applied first. The division is applied -* last after reading the timecounter value. -* Applying the 1/3 factor as part of the multiplication -* requires at least 20 bits for a decent precision, however -* overflows occur after about 4 hours or less, not a option. +* Calculate the optimal mult/shift values. The counter wraps +* around after ~178.9 seconds. */ - - cc->mult =125 ;/* saturation after 195 years */ - cc->shift =0 ; +clocks_calc_mult_shift (&cc->mult, &cc->shift,24000000 , +NSEC_PER_SEC ,178 ); nsec =0 ;/* audio time is elapsed time since trigger */ timecounter_init (tc, cc, nsec);
sound/pci/hda/hda_controller.c +0 -1
@@ -504,7 +504,6 @@ static int azx_get_time_info(struct snd_pcm_substream *substream,snd_pcm_gettime (substream->runtime, system_ts); nsec =timecounter_read (&azx_dev->core.tc); - nsec =div_u64 (nsec,3 );/* can be optimized */ if (audio_tstamp_config->report_delay) nsec =azx_adjust_codec_delay (substream, nsec);
sound/soc/intel/skylake/skl-pcm.c +0 -1
@@ -1251,7 +1251,6 @@ static int skl_platform_soc_get_time_info(snd_pcm_gettime (substream->runtime, system_ts); nsec =timecounter_read (&hstr->tc); - nsec =div_u64 (nsec,3 );/* can be optimized */ if (audio_tstamp_config->report_delay) nsec =skl_adjust_codec_delay (substream, nsec);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 461/1039 dt-bindings: thermal: Fix definition of cooling-maps contribution property
In reply to Greg Kroah-HartmanFrom: Niklas Söderlund <[email protected]>
[ Upstream commit 49bcb1506f2e095262c01bda7fd1c0db524c91e2 ]
When converting the thermal-zones bindings to yaml the definition of the contribution property changed. The intention is the same, an integer value expressing a ratio of a sum on how much cooling is provided by the device to the zone. But after the conversion the integer value is limited to the range 0 to 100 and expressed as a percentage.
This is problematic for two reasons.
- This do not match how the binding is used. Out of the 18 files that make use of the property only two (ste-dbx5x0.dtsi and ste-hrefv60plus.dtsi) sets it at a value that satisfy the binding,
100. The remaining 16 files set the value higher and fail to validate.
- Expressing the value as a percentage instead of a ratio of the sum is confusing as there is nothing to enforce the sum in the zone is not greater then 100.
This patch restore the pre yaml conversion description and removes the value limitation allowing the usage of the bindings to validate.
--- .../devicetree/bindings/thermal/thermal-zones.yaml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/thermal/thermal-zones.yaml +4 -5
@@ -199,12 +199,11 @@ patternProperties: contribution: $ref: /schemas/types.yaml#/definitions/uint32 - minimum: 0 - maximum: 100 description: - The percentage contribution of the cooling devices at the - specific trip temperature referenced in this map - to this thermal zone + The cooling contribution to the thermal zone of the referred + cooling device at the referred trip point. The contribution is + a ratio of the sum of all cooling contributions within a + thermal zone. required: - trip
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 462/1039 powerpc/perf: Fix PMU callbacks to clear pending PMI before resetting an overflown PMC
In reply to Greg Kroah-HartmanFrom: Athira Rajeev <[email protected]>
[ Upstream commit 2c9ac51b850d84ee496b0a5d832ce66d411ae552 ]
Running perf fuzzer showed below in dmesg logs:
"Can't find PMC that caused IRQ"
This means a PMU exception happened, but none of the PMC's (Performance Monitor Counter) were found to be overflown. There are some corner cases that clears the PMCs after PMI gets masked. In such cases, the perf interrupt handler will not find the active PMC values that had caused the overflow and thus leads to this message while replaying.
Case 1: PMU Interrupt happens during replay of other interrupts and counter values gets cleared by PMU callbacks before replay:
During replay of interrupts like timer, __do_irq() and doorbell exception, we conditionally enable interrupts via may_hard_irq_enable(). This could potentially create a window to generate a PMI. Since irq soft mask is set to ALL_DISABLED, the PMI will get masked here. We could get IPIs run before perf interrupt is replayed and the PMU events could be deleted or stopped. This will change the PMU SPR values and resets the counters. Snippet of ftrace log showing PMU callbacks invoked in __do_irq():
<idle>-0 [051] dns. 132025441306354: __do_irq <-call_do_irq
<idle>-0 [051] dns. 132025441306430: irq_enter <-__do_irq
<idle>-0 [051] dns. 132025441306503: irq_enter_rcu <-__do_irq
<idle>-0 [051] dnH. 132025441306599: xive_get_irq <-__do_irq
<<>>
<idle>-0 [051] dnH. 132025441307770: generic_smp_call_function_single_interrupt <-smp_ipi_demux_relaxed <idle>-0 [051] dnH. 132025441307839: flush_smp_call_function_queue <-smp_ipi_demux_relaxed <idle>-0 [051] dnH. 132025441308057: _raw_spin_lock <-event_function
<idle>-0 [051] dnH. 132025441308206: power_pmu_disable <-perf_pmu_disable
<idle>-0 [051] dnH. 132025441308337: power_pmu_del <-event_sched_out
<idle>-0 [051] dnH. 132025441308407: power_pmu_read <-power_pmu_del
<idle>-0 [051] dnH. 132025441308477: read_pmc <-power_pmu_read
<idle>-0 [051] dnH. 132025441308590: isa207_disable_pmc <-power_pmu_del
<idle>-0 [051] dnH. 132025441308663: write_pmc <-power_pmu_del
<idle>-0 [051] dnH. 132025441308787: power_pmu_event_idx <-perf_event_update_userpage <idle>-0 [051] dnH. 132025441308859: rcu_read_unlock_strict <-perf_event_update_userpage <idle>-0 [051] dnH. 132025441308975: power_pmu_enable <-perf_pmu_enable
<<>>
<idle>-0 [051] dnH. 132025441311108: irq_exit <-__do_irq
<idle>-0 [051] dns. 132025441311319: performance_monitor_exception <-replay_soft_interrupts
Case 2: PMI's masked during local_* operations, example local_add(). If the local_add() operation happens within a local_irq_save(), replay of PMI will be during local_irq_restore(). Similar to case 1, this could also create a window before replay where PMU events gets deleted or stopped.
Fix it by updating the PMU callback function power_pmu_disable() to check for pending perf interrupt. If there is an overflown PMC and pending perf interrupt indicated in paca, clear the PMI bit in paca to drop that sample. Clearing of PMI bit is done in power_pmu_disable() since disable is invoked before any event gets deleted/stopped. With this fix, if there are more than one event running in the PMU, there is a chance that we clear the PMI bit for the event which is not getting deleted/stopped. The other events may still remain active. Hence to make sure we don't drop valid sample in such cases, another check is added in power_pmu_enable. This checks if there is an overflown PMC found among the active events and if so enable back the PMI bit. Two new helper functions are introduced to clear/set the PMI, ie clear_pmi_irq_pending() and set_pmi_irq_pending(). Helper function pmi_irq_pending() is introduced to give a warning if there is pending PMI bit in paca, but no PMC is overflown.
Also there are corner cases which result in performance monitor interrupts being triggered during power_pmu_disable(). This happens since PMXE bit is not cleared along with disabling of other MMCR0 bits in the pmu_disable. Such PMI's could leave the PMU running and could trigger PMI again which will set MMCR0 PMAO bit. This could lead to spurious interrupts in some corner cases. Example, a timer after power_pmu_del() which will re-enable interrupts and triggers a PMI again since PMAO bit is still set. But fails to find valid overflow since PMC was cleared in power_pmu_del(). Fix that by disabling PMXE along with disabling of other MMCR0 bits in power_pmu_disable().
We can't just replay PMI any time. Hence this approach is preferred rather than replaying PMI before resetting overflown PMC. Patch also documents core-book3s on a race condition which can trigger these PMC messages during idle path in PowerNV.
--- arch/powerpc/include/asm/hw_irq.h | 40 +++++++++++++++++++++ arch/powerpc/perf/core-book3s.c | 58 ++++++++++++++++++++++++++++++- 2 files changed, 97 insertions(+), 1 deletion(-)
arch/powerpc/include/asm/hw_irq.h +40 -0
@@ -224,6 +224,42 @@ static inline bool arch_irqs_disabled(void)return arch_irqs_disabled_flags (arch_local_save_flags ()); } +static inline void set_pmi_irq_pending (void ) +{ +/* +* Invoked from PMU callback functions to set PMI bit in the paca. +* This has to be called with irq's disabled (via hard_irq_disable()). +*/ +if (IS_ENABLED (CONFIG_PPC_IRQ_SOFT_MASK_DEBUG )) +WARN_ON_ONCE (mfmsr () &MSR_EE ); + +get_paca ()->irq_happened |=PACA_IRQ_PMI ; +} + +static inline void clear_pmi_irq_pending (void ) +{ +/* +* Invoked from PMU callback functions to clear the pending PMI bit +* in the paca. +*/ +if (IS_ENABLED (CONFIG_PPC_IRQ_SOFT_MASK_DEBUG )) +WARN_ON_ONCE (mfmsr () &MSR_EE ); + +get_paca ()->irq_happened &= ~PACA_IRQ_PMI ; +} + +static inline bool pmi_irq_pending (void ) +{ +/* +* Invoked from PMU callback functions to check if there is a pending +* PMI bit in the paca. +*/ +if (get_paca ()->irq_happened &PACA_IRQ_PMI ) +return true; + +return false; +} +#ifdef CONFIG_PPC_BOOK3S /* * To support disabling and enabling of irq with PMI, set of
@@ -408,6 +444,10 @@ static inline void do_hard_irq_enable(void)BUILD_BUG (); } +static inline void clear_pmi_irq_pending (void ) { } +static inline void set_pmi_irq_pending (void ) { } +static inline bool pmi_irq_pending (void ) {return false; } +static inline void irq_soft_mask_regs_set_state (struct pt_regs *regs,unsigned long val) { }
arch/powerpc/perf/core-book3s.c +57 -1
98 lines not on this page · raw message
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 463/1039 powerpc/modules: Dont WARN on first module allocation attempt
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit f1797e4de1146009c888bcf8b6bb6648d55394f1 ]
module_alloc() first tries to allocate module text within 24 bits direct jump from kernel text, and tries a wider allocation if first one fails.
When first allocation fails the following is observed in kernel logs:
vmap allocation for size 2400256 failed: use vmalloc=<size> to increase size
systemd-udevd: vmalloc error: size 2395133, vm_struct allocation failed, mode:0xcc0(GFP_KERNEL), nodemask=(null)
CPU: 0 PID: 127 Comm: systemd-udevd Tainted: G W 5.15.5-gentoo-PowerMacG4 #9 Call Trace: [e2a53a50] [c0ba0048] dump_stack_lvl+0x80/0xb0 (unreliable) [e2a53a70] [c0540128] warn_alloc+0x11c/0x2b4 [e2a53b50] [c0531be8] __vmalloc_node_range+0xd8/0x64c [e2a53c10] [c00338c0] module_alloc+0xa0/0xac [e2a53c40] [c027a368] load_module+0x2ae0/0x8148 [e2a53e30] [c027fc78] sys_finit_module+0xfc/0x130 [e2a53f30] [c0035098] ret_from_syscall+0x0/0x28 ...
Add __GFP_NOWARN flag to first allocation so that no warning appears when it fails.
--- arch/powerpc/kernel/module.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
arch/powerpc/kernel/module.c +6 -5
@@ -90,16 +90,17 @@ int module_finalize(const Elf_Ehdr *hdr, } static __always_inline void * -__module_alloc (unsigned long size,unsigned long start,unsigned long end) +__module_alloc (unsigned long size,unsigned long start,unsigned long end,bool nowarn) {pgprot_t prot =strict_module_rwx_enabled () ?PAGE_KERNEL :PAGE_KERNEL_EXEC ; +gfp_t gfp =GFP_KERNEL | (nowarn ? __GFP_NOWARN :0 );/* * Don't do huge page allocations for modules yet until more testing * is done. STRICT_MODULE_RWX may require extra work to support this * too. */ -return __vmalloc_node_range (size,1 , start, end,GFP_KERNEL , prot, +return __vmalloc_node_range (size,1 , start, end, gfp, prot,VM_FLUSH_RESET_PERMS |VM_NO_HUGE_VMAP ,NUMA_NO_NODE ,__builtin_return_address (0 )); }
@@ -114,13 +115,13 @@ void *module_alloc(unsigned long size)/* First try within 32M limit from _etext to avoid branch trampolines */ if (MODULES_VADDR <PAGE_OFFSET &&MODULES_END > limit) - ptr =__module_alloc (size, limit,MODULES_END ); + ptr =__module_alloc (size, limit,MODULES_END , true);if (!ptr) - ptr =__module_alloc (size,MODULES_VADDR ,MODULES_END ); + ptr =__module_alloc (size,MODULES_VADDR ,MODULES_END , false);return ptr;#else -return __module_alloc (size,VMALLOC_START ,VMALLOC_END ); +return __module_alloc (size,VMALLOC_START ,VMALLOC_END , false);#endif }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 464/1039 powerpc/32s: Fix shift-out-of-bounds in KASAN init
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit af11dee4361b3519981fa04d014873f9d9edd6ac ]
================================================================================
UBSAN: shift-out-of-bounds in arch/powerpc/mm/kasan/book3s_32.c:22:23 shift exponent -1 is negative CPU: 0 PID: 0 Comm: swapper Not tainted 5.15.5-gentoo-PowerMacG4 #9 Call Trace: [c214be60] [c0ba0048] dump_stack_lvl+0x80/0xb0 (unreliable) [c214be80] [c0b99288] ubsan_epilogue+0x10/0x5c [c214be90] [c0b98fe0] __ubsan_handle_shift_out_of_bounds+0x94/0x138 [c214bf00] [c1c0f010] kasan_init_region+0xd8/0x26c [c214bf30] [c1c0ed84] kasan_init+0xc0/0x198 [c214bf70] [c1c08024] setup_arch+0x18/0x54c [c214bfc0] [c1c037f0] start_kernel+0x90/0x33c
[c214bff0] [00003610] 0x3610
================================================================================
This happens when the directly mapped memory is a power of 2.
Fix it by checking the shift and set the result to 0 when shift is -1
--- arch/powerpc/mm/kasan/book3s_32.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/mm/kasan/book3s_32.c +2 -1
@@ -19,7 +19,8 @@ int __init kasan_init_region(void *start, size_t size) block =memblock_alloc (k_size, k_size_base);if (block && k_size_base >=SZ_128K && k_start ==ALIGN (k_start, k_size_base)) { -int k_size_more =1 << (ffs (k_size - k_size_base) -1 ); +int shift =ffs (k_size - k_size_base); +int k_size_more = shift ?1 << (shift -1 ) :0 ;setbat (-1 , k_start,__pa (block), k_size_base,PAGE_KERNEL );if (k_size_more >=SZ_128K )
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 465/1039 clocksource: Avoid accidental unstable marking of clocksources
In reply to Greg Kroah-HartmanFrom: Waiman Long <[email protected]>
[ Upstream commit c86ff8c55b8ae68837b2fa59dc0c203907e9a15f ]
Since commit db3a34e17433 ("clocksource: Retry clock read if long delays detected") and commit 2e27e793e280 ("clocksource: Reduce clocksource-skew threshold"), it is found that tsc clocksource fallback to hpet can sometimes happen on both Intel and AMD systems especially when they are running stressful benchmarking workloads. Of the 23 systems tested with a v5.14 kernel, 10 of them have switched to hpet clock source during the test run.
The result of falling back to hpet is a drastic reduction of performance when running benchmarks. For example, the fio performance tests can drop up to 70% whereas the iperf3 performance can drop up to 80%.
4 hpet fallbacks happened during bootup. They were:
[ 8.749399] clocksource: timekeeping watchdog on CPU13: hpet read-back delay of 263750ns, attempt 4, marking unstable [ 12.044610] clocksource: timekeeping watchdog on CPU19: hpet read-back delay of 186166ns, attempt 4, marking unstable [ 17.336941] clocksource: timekeeping watchdog on CPU28: hpet read-back delay of 182291ns, attempt 4, marking unstable [ 17.518565] clocksource: timekeeping watchdog on CPU34: hpet read-back delay of 252196ns, attempt 4, marking unstable
Other fallbacks happen when the systems were running stressful benchmarks. For example:
[ 2685.867873] clocksource: timekeeping watchdog on CPU117: hpet read-back delay of 57269ns, attempt 4, marking unstable [46215.471228] clocksource: timekeeping watchdog on CPU8: hpet read-back delay of 61460ns, attempt 4, marking unstable
Commit 2e27e793e280 ("clocksource: Reduce clocksource-skew threshold"), changed the skew margin from 100us to 50us. I think this is too small and can easily be exceeded when running some stressful workloads on a thermally stressed system. So it is switched back to 100us.
Even a maximum skew margin of 100us may be too small in for some systems when booting up especially if those systems are under thermal stress. To eliminate the case that the large skew is due to the system being too busy slowing down the reading of both the watchdog and the clocksource, an extra consecutive read of watchdog clock is being done to check this.
The consecutive watchdog read delay is compared against WATCHDOG_MAX_SKEW/2. If the delay exceeds the limit, we assume that the system is just too busy. A warning will be printed to the console and the clock skew check is skipped for this round.
--- kernel/time/clocksource.c | 50 ++++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 9 deletions(-)
kernel/time/clocksource.c +41 -9
@@ -107,7 +107,7 @@ static u64 suspend_start;* This delay could be due to SMIs, NMIs, or to VCPU preemptions. Used as * a lower bound for cs->uncertainty_margin values when registering clocks. */ -#define WATCHDOG_MAX_SKEW (50 * NSEC_PER_USEC) +#define WATCHDOG_MAX_SKEW (100 * NSEC_PER_USEC)#ifdef CONFIG_CLOCKSOURCE_WATCHDOG static void clocksource_watchdog_work (struct work_struct *work);
@@ -205,17 +205,24 @@ EXPORT_SYMBOL_GPL(max_cswd_read_retries);static int verify_n_cpus =8 ;module_param (verify_n_cpus, int,0644 ); -static bool cs_watchdog_read (struct clocksource *cs,u64 *csnow,u64 *wdnow) +enum wd_read_status { +WD_READ_SUCCESS , +WD_READ_UNSTABLE , +WD_READ_SKIP +}; + +static enum wd_read_status cs_watchdog_read (struct clocksource *cs,u64 *csnow,u64 *wdnow) {unsigned int nretries; -u64 wd_end, wd_delta; -int64_t wd_delay; +u64 wd_end, wd_end2, wd_delta; +int64_t wd_delay, wd_seq_delay;for (nretries =0 ; nretries <= max_cswd_read_retries; nretries++) {local_irq_disable (); *wdnow = watchdog->read (watchdog); *csnow = cs->read (cs); wd_end = watchdog->read (watchdog); + wd_end2 = watchdog->read (watchdog);local_irq_enable (); wd_delta =clocksource_delta (wd_end, *wdnow, watchdog->mask);
@@ -226,13 +233,34 @@ static bool cs_watchdog_read(struct clocksource *cs, u64 *csnow, u64 *wdnow)pr_warn ("timekeeping watchdog on CPU%d: %s retried %d times before success\n" ,smp_processor_id (), watchdog->name, nretries); } -return true; +return WD_READ_SUCCESS ; } + +/* +* Now compute delay in consecutive watchdog read to see if +* there is too much external interferences that cause +* significant delay in reading both clocksource and watchdog. +* +* If consecutive WD read-back delay > WATCHDOG_MAX_SKEW/2, +* report system busy, reinit the watchdog and skip the current +* watchdog test. +*/ + wd_delta =clocksource_delta (wd_end2, wd_end, watchdog->mask); + wd_seq_delay =clocksource_cyc2ns (wd_delta, watchdog->mult, watchdog->shift); +if (wd_seq_delay >WATCHDOG_MAX_SKEW /2 ) + goto skip_test; }pr_warn ("timekeeping watchdog on CPU%d: %s read-back delay of %lldns, attempt %d, marking unstable\n" ,smp_processor_id (), watchdog->name, wd_delay, nretries); -return false; +return WD_READ_UNSTABLE ; + +skip_test: +pr_info ("timekeeping watchdog on CPU%d: %s wd-wd read-back delay of %lldns\n" , +smp_processor_id (), watchdog->name, wd_seq_delay); +pr_info ("wd-%s-wd read-back delay of %lldns, clock-skew test skipped!\n" , + cs->name, wd_delay); +return WD_READ_SKIP ; }static u64 csnow_mid;
@@ -356,6 +384,7 @@ static void clocksource_watchdog(struct timer_list *unused)int next_cpu, reset_pending;int64_t wd_nsec, cs_nsec;struct clocksource *cs; +enum wd_read_status read_ret;u32 md;spin_lock (&watchdog_lock);
@@ -373,9 +402,12 @@ static void clocksource_watchdog(struct timer_list *unused)continue ; } -if (!cs_watchdog_read (cs, &csnow, &wdnow)) { -/* Clock readout unreliable, so give it up. */ -__clocksource_unstable (cs); + read_ret =cs_watchdog_read (cs, &csnow, &wdnow); + +if (read_ret !=WD_READ_SUCCESS ) { +if (read_ret ==WD_READ_UNSTABLE ) +/* Clock readout unreliable, so give it up. */ +__clocksource_unstable (cs);continue ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 466/1039 ALSA: oss: fix compile error when OSS_DEBUG is enabled
In reply to Greg Kroah-HartmanFrom: Bixuan Cui <[email protected]>
[ Upstream commit 8e7daf318d97f25e18b2fc7eb5909e34cd903575 ]
Fix compile error when OSS_DEBUG is enabled:
sound/core/oss/pcm_oss.c: In function 'snd_pcm_oss_set_trigger':
sound/core/oss/pcm_oss.c:2055:10: error: 'substream' undeclared (first
use in this function); did you mean 'csubstream'?
pcm_dbg(substream->pcm, "pcm_oss: trigger = 0x%x\n", trigger);
^--- sound/core/oss/pcm_oss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/core/oss/pcm_oss.c +1 -1
@@ -2065,7 +2065,7 @@ static int snd_pcm_oss_set_trigger(struct snd_pcm_oss_file *pcm_oss_file, int trint err, cmd;#ifdef OSS_DEBUG -pcm_dbg (substream->pcm,"pcm_oss: trigger = 0x%x\n" , trigger); +pr_debug ("pcm_oss: trigger = 0x%x\n" , trigger);#endif psubstream = pcm_oss_file->streams[SNDRV_PCM_STREAM_PLAYBACK ];
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 467/1039 ALSA: usb-audio: Drop superfluous 0 in Presonus Studio 1810cs ID
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 1e583aef12aa74afd37c1418255cc4b74e023236 ]
The vendor ID of Presonus Studio 1810c had a superfluous '0' in its USB ID. Drop it.
--- sound/usb/format.c | 2 +- sound/usb/mixer_quirks.c | 2 +- sound/usb/quirks.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
sound/usb/format.c +1 -1
@@ -375,7 +375,7 @@ static int parse_uac2_sample_rate_range(struct snd_usb_audio *chip,for (rate = min; rate <= max; rate += res) {/* Filter out invalid rates on Presonus Studio 1810c */ -if (chip->usb_id ==USB_ID (0x0194f ,0x010c ) && +if (chip->usb_id ==USB_ID (0x194f ,0x010c ) && !s1810c_valid_sample_rate (fp, rate)) goto skip_rate;
sound/usb/mixer_quirks.c +1 -1
@@ -3254,7 +3254,7 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer) err =snd_rme_controls_create (mixer);break ; -case USB_ID (0x0194f ,0x010c ):/* Presonus Studio 1810c */ +case USB_ID (0x194f ,0x010c ):/* Presonus Studio 1810c */ err =snd_sc1810_init_mixer (mixer);break ;case USB_ID (0x2a39 ,0x3fb0 ):/* RME Babyface Pro FS */
sound/usb/quirks.c +1 -1
@@ -1290,7 +1290,7 @@ int snd_usb_apply_interface_quirk(struct snd_usb_audio *chip,if (chip->usb_id ==USB_ID (0x0763 ,0x2012 ))return fasttrackpro_skip_setting_quirk (chip, iface, altno);/* presonus studio 1810c: skip altsets incompatible with device_setup */ -if (chip->usb_id ==USB_ID (0x0194f ,0x010c )) +if (chip->usb_id ==USB_ID (0x194f ,0x010c ))return s1810c_skip_setting_quirk (chip, iface, altno);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 468/1039 ASoC: amd: Fix dependency for SPI master
In reply to Greg Kroah-HartmanFrom: Lucas Tanure <[email protected]>
[ Upstream commit 19a628d8f1a6c16263d8037a918427207c8a95a0 ]
Set SPI_MASTER as dependency as is using CS35L41 SPI driver
--- sound/soc/amd/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/amd/Kconfig +1 -1
@@ -68,7 +68,7 @@ config SND_SOC_AMD_VANGOGH_MACH tristate "AMD Vangogh support for NAU8821 CS35L41" select SND_SOC_NAU8821 select SND_SOC_CS35L41_SPI - depends on SND_SOC_AMD_ACP5x && I2C + depends on SND_SOC_AMD_ACP5x && I2C && SPI_MASTER help This option enables machine driver for Vangogh platform using NAU8821 and CS35L41 codecs.
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 469/1039 misc: at25: Make driver OF independent again
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 5b557298d7d09cce04e0565a535fbca63661724a ]
The commit f60e7074902a ("misc: at25: Make use of device property API") made a good job by enabling the driver for non-OF platforms, but the recent commit 604288bc6196 ("nvmem: eeprom: at25: fix type compiler warnings") brought that back.
Restore greatness of the driver once again.
--- drivers/misc/eeprom/at25.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/misc/eeprom/at25.c +6 -7
@@ -17,8 +17,6 @@#include <linux/spi/spi.h> #include <linux/spi/eeprom.h> #include <linux/property.h> -#include <linux/of.h> -#include <linux/of_device.h> #include <linux/math.h> /*
@@ -380,13 +378,14 @@ static int at25_probe(struct spi_device *spi)int sr;u8 id[FM25_ID_LEN ];u8 sernum[FM25_SN_LEN ]; +bool is_fram;int i; -const struct of_device_id *match; -bool is_fram =0 ; - match =of_match_device (of_match_ptr (at25_of_match), &spi->dev); -if (match && !strcmp (match->compatible,"cypress,fm25" )) - is_fram =1 ; + err =device_property_match_string (&spi->dev,"compatible" ,"cypress,fm25" ); +if (err >=0 ) + is_fram = true; +else + is_fram = false; at25 =devm_kzalloc (&spi->dev,sizeof (struct at25_data ),GFP_KERNEL );if (!at25)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 470/1039 char/mwave: Adjust io port register size
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit f5912cc19acd7c24b2dbf65a6340bf194244f085 ]
Using MKWORD() on a byte-sized variable results in OOB read. Expand the size of the reserved area so both MKWORD and MKBYTE continue to work without overflow. Silences this warning on a -Warray-bounds build:
drivers/char/mwave/3780i.h:346:22: error: array subscript 'short unsigned int[0]' is partly outside array bounds of 'DSP_ISA_SLAVE_CONTROL[1]' [-Werror=array-bounds]
346 | #define MKWORD(var) (*((unsigned short *)(&var)))
| ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/char/mwave/3780i.h:356:40: note: in definition of macro 'OutWordDsp'
356 | #define OutWordDsp(index,value) outw(value,usDspBaseIO+index)
| ^~~~~drivers/char/mwave/3780i.c:373:41: note: in expansion of macro 'MKWORD'
373 | OutWordDsp(DSP_IsaSlaveControl, MKWORD(rSlaveControl));
| ^~~~~~drivers/char/mwave/3780i.c:358:31: note: while referencing 'rSlaveControl'
358 | DSP_ISA_SLAVE_CONTROL rSlaveControl;
| ^~~~~~~~~~~~~--- drivers/char/mwave/3780i.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/mwave/3780i.h +1 -1
@@ -68,7 +68,7 @@ typedef struct { unsigned char ClockControl:1; /* RW: Clock control: 0=normal, 1=stop 3780i clocks */ unsigned char SoftReset:1; /* RW: Soft reset 0=normal, 1=soft reset active */ unsigned char ConfigMode:1; /* RW: Configuration mode, 0=normal, 1=config mode */ - unsigned char Reserved:5; /* 0: Reserved */ + unsigned short Reserved:13; /* 0: Reserved */ }DSP_ISA_SLAVE_CONTROL ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 471/1039 binder: fix handling of error during copy
In reply to Greg Kroah-HartmanFrom: Todd Kjos <[email protected]>
[ Upstream commit fe6b1869243f23a485a106c214bcfdc7aa0ed593 ]
If a memory copy function fails to copy the whole buffer, a positive integar with the remaining bytes is returned. In binder_translate_fd_array() this can result in an fd being skipped due to the failed copy, but the loop continues processing fds since the early return condition expects a negative integer on error.
Fix by returning "ret > 0 ? -EINVAL : ret" to handle this case.
--- drivers/android/binder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/android/binder.c +2 -2
@@ -2269,8 +2269,8 @@ static int binder_translate_fd_array(struct binder_fd_array_object *fda,if (!ret) ret =binder_translate_fd (fd, offset, t, thread, in_reply_to); -if (ret <0 ) -return ret; +if (ret) +return ret >0 ? -EINVAL : ret; }return 0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 472/1039 binder: avoid potential data leakage when copying txn
In reply to Greg Kroah-HartmanFrom: Todd Kjos <[email protected]>
[ Upstream commit 6d98eb95b450a75adb4516a1d33652dc78d2b20c ]
Transactions are copied from the sender to the target first and objects like BINDER_TYPE_PTR and BINDER_TYPE_FDA are then fixed up. This means there is a short period where the sender's version of these objects are visible to the target prior to the fixups.
Instead of copying all of the data first, copy data only after any needed fixups have been applied.
--- drivers/android/binder.c | 94 ++++++++++++++++++++++++++++++---------- 1 file changed, 70 insertions(+), 24 deletions(-)
drivers/android/binder.c +70 -24
@@ -1608,15 +1608,21 @@ static void binder_cleanup_transaction(struct binder_transaction *t,/** * binder_get_object() - gets object and checks for valid metadata * @proc: binder_proc owning the buffer +* @u: sender's user pointer to base of buffer * @buffer: binder_buffer that we're parsing. * @offset: offset in the @buffer at which to validate an object. * @object: struct binder_object to read into * -* Return: If there's a valid metadata object at @offset in @buffer, the +* Copy the binder object at the given offset into @object. If @u is +* provided then the copy is from the sender's buffer. If not, then +* it is copied from the target's @buffer. +* +* Return: If there's a valid metadata object at @offset, the * size of that object. Otherwise, it returns zero. The object * is read into the struct binder_object pointed to by @object. */ static size_t binder_get_object (struct binder_proc *proc, +const void __user *u,struct binder_buffer *buffer,unsigned long offset,struct binder_object *object)
@@ -1626,10 +1632,16 @@ static size_t binder_get_object(struct binder_proc *proc,size_t object_size =0 ; read_size =min_t (size_t,sizeof (*object), buffer->data_size - offset); -if (offset > buffer->data_size || read_size <sizeof (*hdr) || -binder_alloc_copy_from_buffer (&proc->alloc, object, buffer, - offset, read_size)) +if (offset > buffer->data_size || read_size <sizeof (*hdr))return 0 ; +if (u) { +if (copy_from_user (object, u + offset, read_size)) +return 0 ; + }else { +if (binder_alloc_copy_from_buffer (&proc->alloc, object, buffer, + offset, read_size)) +return 0 ; + }/* Ok, now see if we read a complete object. */ hdr = &object->hdr;
@@ -1702,7 +1714,7 @@ static struct binder_buffer_object *binder_validate_ptr( b, buffer_offset, sizeof(object_offset)))return NULL ; - object_size =binder_get_object (proc, b, object_offset, object); + object_size =binder_get_object (proc,NULL , b, object_offset, object);if (!object_size || object->hdr.type !=BINDER_TYPE_PTR )return NULL ;if (object_offsetp)
@@ -1767,7 +1779,8 @@ static bool binder_validate_fixup(struct binder_proc *proc,unsigned long buffer_offset;struct binder_object last_object;struct binder_buffer_object *last_bbo; -size_t object_size =binder_get_object (proc, b, last_obj_offset, +size_t object_size =binder_get_object (proc,NULL , b, + last_obj_offset, &last_object);if (object_size !=sizeof (*last_bbo))return false;
@@ -1882,7 +1895,7 @@ static void binder_transaction_buffer_release(struct binder_proc *proc,if (!binder_alloc_copy_from_buffer (&proc->alloc, &object_offset, buffer, buffer_offset,sizeof (object_offset))) - object_size =binder_get_object (proc, buffer, + object_size =binder_get_object (proc,NULL , buffer, object_offset, &object);if (object_size ==0 ) { pr_err("transaction release %d bad object at offset %lld, size %zd\n",
@@ -2455,6 +2468,7 @@ static void binder_transaction(struct binder_proc *proc,binder_size_t off_start_offset, off_end_offset;binder_size_t off_min;binder_size_t sg_buf_offset, sg_buf_end_offset; +binder_size_t user_offset =0 ;struct binder_proc *target_proc =NULL ;struct binder_thread *target_thread =NULL ;struct binder_node *target_node =NULL ;
@@ -2469,6 +2483,8 @@ static void binder_transaction(struct binder_proc *proc,int t_debug_id =atomic_inc_return (&binder_last_id);char *secctx =NULL ;u32 secctx_sz =0 ; +const void __user *user_buffer = (const void __user *) + (uintptr_t )tr->data.ptr.buffer; e =binder_transaction_log_add (&binder_transaction_log); e->debug_id = t_debug_id;
@@ -2780,19 +2796,6 @@ static void binder_transaction(struct binder_proc *proc, t->buffer->clear_on_free = !!(t->flags &TF_CLEAR_BUF );trace_binder_transaction_alloc_buf (t->buffer); -if (binder_alloc_copy_user_to_buffer ( - &target_proc->alloc, - t->buffer,0 , - (const void __user *) - (uintptr_t )tr->data.ptr.buffer, - tr->data_size)) { -binder_user_error ("%d:%d got transaction with invalid data ptr\n" , - proc->pid, thread->pid); - return_error =BR_FAILED_REPLY ; - return_error_param = -EFAULT ; - return_error_line = __LINE__; - goto err_copy_data_failed; - } if (binder_alloc_copy_user_to_buffer( &target_proc->alloc, t->buffer,
@@ -2837,6 +2840,7 @@ static void binder_transaction(struct binder_proc *proc,size_t object_size;struct binder_object object;binder_size_t object_offset; +binder_size_t copy_size; if (binder_alloc_copy_from_buffer(&target_proc->alloc, &object_offset,
@@ -2848,8 +2852,27 @@ static void binder_transaction(struct binder_proc *proc, return_error_line = __LINE__; goto err_bad_offset; } - object_size =binder_get_object (target_proc, t->buffer, - object_offset, &object); + +/* +* Copy the source user buffer up to the next object +* that will be processed. +*/ + copy_size = object_offset - user_offset; +if (copy_size && (user_offset > object_offset || +binder_alloc_copy_user_to_buffer ( + &target_proc->alloc, + t->buffer, user_offset, + user_buffer + user_offset, + copy_size))) { +binder_user_error ("%d:%d got transaction with invalid data ptr\n" , + proc->pid, thread->pid); + return_error =BR_FAILED_REPLY ; + return_error_param = -EFAULT ; + return_error_line = __LINE__; + goto err_copy_data_failed; + } + object_size =binder_get_object (target_proc, user_buffer, + t->buffer, object_offset, &object);if (object_size ==0 || object_offset < off_min) { binder_user_error("%d:%d got transaction with invalid offset (%lld, min %lld max %lld) or object.\n", proc->pid, thread->pid,
@@ -2861,6 +2884,11 @@ static void binder_transaction(struct binder_proc *proc, return_error_line = __LINE__; goto err_bad_offset; } +/* +* Set offset to the next buffer fragment to be +* copied +*/ + user_offset = object_offset + object_size; hdr = &object.hdr; off_min = object_offset + object_size;
@@ -2956,9 +2984,14 @@ static void binder_transaction(struct binder_proc *proc, } ret =binder_translate_fd_array (fda, parent, t, thread, in_reply_to); -if (ret <0 ) { +if (!ret) + ret =binder_alloc_copy_to_buffer (&target_proc->alloc, + t->buffer, + object_offset, + fda,sizeof (*fda)); +if (ret) { return_error =BR_FAILED_REPLY ; - return_error_param = ret; + return_error_param = ret >0 ? -EINVAL : ret; return_error_line = __LINE__; goto err_translate_failed; }
@@ -3028,6 +3061,19 @@ static void binder_transaction(struct binder_proc *proc, goto err_bad_object_type; } } +/* Done processing objects, copy the rest of the buffer */ +if (binder_alloc_copy_user_to_buffer ( + &target_proc->alloc, + t->buffer, user_offset, + user_buffer + user_offset, + tr->data_size - user_offset)) { +binder_user_error ("%d:%d got transaction with invalid data ptr\n" , + proc->pid, thread->pid); + return_error =BR_FAILED_REPLY ; + return_error_param = -EFAULT ; + return_error_line = __LINE__; + goto err_copy_data_failed; + }if (t->buffer->oneway_spam_suspect) tcomplete->type =BINDER_WORK_TRANSACTION_ONEWAY_SPAM_SUSPECT ;else
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 473/1039 openrisc: Add clone3 ABI wrapper
In reply to Greg Kroah-HartmanFrom: Stafford Horne <[email protected]>
[ Upstream commit 433fe39f674d58bc7a3e8254a5d2ffc290b7e04e ]
Like fork and clone the clone3 syscall needs a wrapper to save callee saved registers, which is required by the OpenRISC ABI. This came up after auditing code following a discussion with Rob Landley and Arnd Bergmann [0].
Tested with the clone3 kselftests and there were no issues.
[0] https://lore.kernel.org/all/[email protected]/T/#m9c0cdb2703813b9df4da04cf6b30de1f1aa89944
--- arch/openrisc/include/asm/syscalls.h | 2 ++ arch/openrisc/kernel/entry.S | 5 +++++ 2 files changed, 7 insertions(+)
arch/openrisc/include/asm/syscalls.h +2 -0
@@ -22,9 +22,11 @@ asmlinkage long sys_or1k_atomic(unsigned long type, unsigned long *v1,asmlinkage long __sys_clone (unsigned long clone_flags,unsigned long newsp,void __user *parent_tid,void __user *child_tid,int tls); +asmlinkage long __sys_clone3 (struct clone_args __user *uargs,size_t size);asmlinkage long __sys_fork (void );#define sys_clone __sys_clone +#define sys_clone3 __sys_clone3#define sys_fork __sys_fork#endif /* __ASM_OPENRISC_SYSCALLS_H */
arch/openrisc/kernel/entry.S +5 -0
@@ -1170,6 +1170,11 @@ ENTRY(__sys_clone) l.j _fork_save_extra_regs_and_call l.nop +ENTRY(__sys_clone3) + l.movhi r29,hi(sys_clone3) + l.j _fork_save_extra_regs_and_call + l.ori r29,r29,lo(sys_clone3) + ENTRY(__sys_fork) l.movhi r29,hi(sys_fork) l.ori r29,r29,lo(sys_fork)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 474/1039 uio: uio_dmem_genirq: Catch the Exception
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit eec91694f927d1026974444eb6a3adccd4f1cbc2 ]
The return value of dma_set_coherent_mask() is not always 0. To catch the exception in case that dma is not support the mask.
--- drivers/uio/uio_dmem_genirq.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/uio/uio_dmem_genirq.c +5 -1
@@ -188,7 +188,11 @@ static int uio_dmem_genirq_probe(struct platform_device *pdev)return -ENOMEM ; } -dma_set_coherent_mask (&pdev->dev,DMA_BIT_MASK (32 )); + ret =dma_set_coherent_mask (&pdev->dev,DMA_BIT_MASK (32 )); +if (ret) { +dev_err (&pdev->dev,"DMA enable failed\n" ); +return ret; + } priv->uioinfo = uioinfo;spin_lock_init (&priv->lock);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 475/1039 iommu: Extend mutex lock scope in iommu_probe_device()
In reply to Greg Kroah-HartmanFrom: Lu Baolu <[email protected]>
[ Upstream commit 556f99ac886635e8da15528995f06d1d7028cfca ]
Extend the scope of holding group->mutex so that it can cover the default domain check/attachment and direct mappings of reserved regions.
--- drivers/iommu/iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iommu/iommu.c +2 -1
@@ -288,11 +288,11 @@ int iommu_probe_device(struct device *dev)*/ mutex_lock (&group->mutex);iommu_alloc_default_domain (group, dev); -mutex_unlock (&group->mutex);if (group->default_domain) { ret =__iommu_attach_device (group->default_domain, dev);if (ret) { +mutex_unlock (&group->mutex);iommu_group_put (group); goto err_release; }
@@ -300,6 +300,7 @@ int iommu_probe_device(struct device *dev)iommu_create_device_direct_mappings (group, dev); +mutex_unlock (&group->mutex);iommu_group_put (group);if (ops->probe_finalize)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 476/1039 iommu/io-pgtable-arm: Fix table descriptor paddr formatting
In reply to Greg Kroah-HartmanFrom: Hector Martin <[email protected]>
[ Upstream commit 9abe2ac834851a7d0b0756e295cf7a292c45ca53 ]
Table descriptors were being installed without properly formatting the address using paddr_to_iopte, which does not match up with the iopte_deref in __arm_lpae_map. This is incorrect for the LPAE pte format, as it does not handle the high bits properly.
This was found on Apple T6000 DARTs, which require a new pte format (different shift); adding support for that to paddr_to_iopte/iopte_to_paddr caused it to break badly, as even <48-bit addresses would end up incorrect in that case.
--- drivers/iommu/io-pgtable-arm.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/iommu/io-pgtable-arm.c +5 -4
@@ -315,11 +315,12 @@ static int arm_lpae_init_pte(struct arm_lpae_io_pgtable *data,static arm_lpae_iopte arm_lpae_install_table (arm_lpae_iopte *table,arm_lpae_iopte *ptep,arm_lpae_iopte curr, -struct io_pgtable_cfg *cfg) +struct arm_lpae_io_pgtable *data) {arm_lpae_iopte old, new; +struct io_pgtable_cfg *cfg = &data->iop.cfg; - new =__pa (table) |ARM_LPAE_PTE_TYPE_TABLE ; + new =paddr_to_iopte (__pa (table), data) |ARM_LPAE_PTE_TYPE_TABLE ;if (cfg->quirks &IO_PGTABLE_QUIRK_ARM_NS ) new |=ARM_LPAE_PTE_NSTABLE ;
@@ -380,7 +381,7 @@ static int __arm_lpae_map(struct arm_lpae_io_pgtable *data, unsigned long iova,if (!cptep)return -ENOMEM ; - pte =arm_lpae_install_table (cptep, ptep,0 , cfg); + pte =arm_lpae_install_table (cptep, ptep,0 , data);if (pte)__arm_lpae_free_pages (cptep, tblsz, cfg); }else if (!cfg->coherent_walk && !(pte &ARM_LPAE_PTE_SW_SYNC )) {
@@ -592,7 +593,7 @@ static size_t arm_lpae_split_blk_unmap(struct arm_lpae_io_pgtable *data,__arm_lpae_init_pte (data, blk_paddr, pte, lvl,1 , &tablep[i]); } - pte =arm_lpae_install_table (tablep, ptep, blk_pte, cfg); + pte =arm_lpae_install_table (tablep, ptep, blk_pte, data);if (pte != blk_pte) {__arm_lpae_free_pages (tablep, tablesz, cfg);/*
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 477/1039 ASoC: SOF: Intel: fix build issue related to CODEC_PROBE_ENTRIES
In reply to Greg Kroah-HartmanFrom: Kai Vehmanen <[email protected]>
[ Upstream commit 9a83dfcc5ae8230fbf12b63e281d5bb8450ec0e7 ]
Fix following error:sound/soc/sof/intel/hda-codec.c:132:35: error: use of undeclared identifier 'CODEC_PROBE_RETRIES'
Found with config: i386-randconfig-r033-20211202
(https://download.01.org/0day-ci/archive/20211203/[email protected]/config)
--- sound/soc/sof/intel/hda-codec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/soc/sof/intel/hda-codec.c +2 -1
@@ -20,9 +20,10 @@#include "../../codecs/hdac_hda.h" #endif /* CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC */ +#define CODEC_PROBE_RETRIES 3 +#if IS_ENABLED (CONFIG_SND_SOC_SOF_HDA_AUDIO_CODEC )#define IDISP_VID_INTEL 0x80860000 -#define CODEC_PROBE_RETRIES 3/* load the legacy HDA codec driver */ static int request_codec_module (struct hda_codec *codec)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 478/1039 scsi: core: Fix scsi_device_max_queue_depth()
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
[ Upstream commit 4bc3bffc1a885eb5cb259e4a25146a4c7b1034e3 ]
The comment above scsi_device_max_queue_depth() and also the description of commit ca4453213951 ("scsi: core: Make sure sdev->queue_depth is <= max(shost->can_queue, 1024)") contradict the implementation of the function scsi_device_max_queue_depth(). Additionally, the maximum queue depth of a SCSI LUN never exceeds host->can_queue. Fix scsi_device_max_queue_depth() by changing max_t() into min_t().
--- drivers/scsi/scsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/scsi.c +2 -2
@@ -201,11 +201,11 @@ void scsi_finish_command(struct scsi_cmnd *cmd)/* -* 1024 is big enough for saturating the fast scsi LUN now +* 1024 is big enough for saturating fast SCSI LUNs. */ int scsi_device_max_queue_depth (struct scsi_device *sdev) { -return max_t (int, sdev->host->can_queue,1024 ); +return min_t (int, sdev->host->can_queue,1024 ); }/**
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 479/1039 scsi: ufs: Fix race conditions related to driver data
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
[ Upstream commit 21ad0e49085deb22c094f91f9da57319a97188e4 ]
The driver data pointer must be set before any callbacks are registered that use that pointer. Hence move the initialization of that pointer from after the ufshcd_init() call to inside ufshcd_init().
--- drivers/scsi/ufs/tc-dwc-g210-pci.c | 1 - drivers/scsi/ufs/ufshcd-pci.c | 2 -- drivers/scsi/ufs/ufshcd-pltfrm.c | 2 -- drivers/scsi/ufs/ufshcd.c | 7 +++++++ 4 files changed, 7 insertions(+), 5 deletions(-)
drivers/scsi/ufs/tc-dwc-g210-pci.c +0 -1
@@ -110,7 +110,6 @@ tc_dwc_g210_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)return err; } -pci_set_drvdata (pdev, hba);pm_runtime_put_noidle (&pdev->dev);pm_runtime_allow (&pdev->dev);
drivers/scsi/ufs/ufshcd-pci.c +0 -2
@@ -538,8 +538,6 @@ ufshcd_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)return err; } -pci_set_drvdata (pdev, hba); - hba->vops = (struct ufs_hba_variant_ops *)id->driver_data; err =ufshcd_init (hba, mmio_base, pdev->irq);
drivers/scsi/ufs/ufshcd-pltfrm.c +0 -2
@@ -361,8 +361,6 @@ int ufshcd_pltfrm_init(struct platform_device *pdev, goto dealloc_host; } -platform_set_drvdata (pdev, hba); -pm_runtime_set_active (&pdev->dev);pm_runtime_enable (&pdev->dev);
drivers/scsi/ufs/ufshcd.c +7 -0
@@ -9486,6 +9486,13 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)struct device *dev = hba->dev;char eh_wq_name[sizeof ("ufs_eh_wq_00" )]; +/* +* dev_set_drvdata() must be called before any callbacks are registered +* that use dev_get_drvdata() (frequency scaling, clock scaling, hwmon, +* sysfs). +*/ +dev_set_drvdata (dev, hba); +if (!mmio_base) {dev_err (hba->dev,"Invalid memory reference for mmio_base is NULL\n" );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 480/1039 RDMA/qedr: Fix reporting max_{send/recv}_wr attrs
In reply to Greg Kroah-HartmanFrom: Kamal Heib <[email protected]>
[ Upstream commit b1a4da64bfc189510e08df1ccb1c589e667dc7a3 ]
Fix the wrongly reported max_send_wr and max_recv_wr attributes for user QP by making sure to save their valuse on QP creation, so when query QP is called the attributes will be reported correctly.
--- drivers/infiniband/hw/qedr/verbs.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/hw/qedr/verbs.c +2 -0
@@ -1931,6 +1931,7 @@ static int qedr_create_user_qp(struct qedr_dev *dev,/* db offset was calculated in copy_qp_uresp, now set in the user q */ if (qedr_qp_has_sq (qp)) { qp->usq.db_addr = ctx->dpi_addr + uresp.sq_db_offset; + qp->sq.max_wr = attrs->cap.max_send_wr; rc = qedr_db_recovery_add(dev, qp->usq.db_addr, &qp->usq.db_rec_data->db_data, DB_REC_WIDTH_32B,
@@ -1941,6 +1942,7 @@ static int qedr_create_user_qp(struct qedr_dev *dev,if (qedr_qp_has_rq (qp)) { qp->urq.db_addr = ctx->dpi_addr + uresp.rq_db_offset; + qp->rq.max_wr = attrs->cap.max_recv_wr; rc = qedr_db_recovery_add(dev, qp->urq.db_addr, &qp->urq.db_rec_data->db_data, DB_REC_WIDTH_32B,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 481/1039 PCI/MSI: Fix pci_irq_vector()/pci_irq_get_affinity()
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
[ Upstream commit 29bbc35e29d9b6347780dcacde2deb4b39344167 ]
pci_irq_vector() and pci_irq_get_affinity() use the list position to find the MSI-X descriptor at a given index. That's correct for the normal case where the entry number is the same as the list position.
But it's wrong for cases where MSI-X was allocated with an entries array describing sparse entry numbers into the hardware message descriptor table. That's inconsistent at best.
Make it always check the entry number because that's what the zero base index really means. This change won't break existing users which use a sparse entries array for allocation because these users retrieve the Linux interrupt number from the entries array after allocation and none of them uses pci_irq_vector() or pci_irq_get_affinity().
--- drivers/pci/msi.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-)
drivers/pci/msi.c +18 -8
@@ -1194,19 +1194,24 @@ EXPORT_SYMBOL(pci_free_irq_vectors);/** * pci_irq_vector - return Linux IRQ number of a device vector -* @dev: PCI device to operate on -* @nr: device-relative interrupt vector index (0-based). +* @dev: PCI device to operate on +* @nr: Interrupt vector index (0-based) +* +* @nr has the following meanings depending on the interrupt mode: +* MSI-X: The index in the MSI-X vector table +* MSI: The index of the enabled MSI vectors +* INTx: Must be 0 +* +* Return: The Linux interrupt number or -EINVAl if @nr is out of range. */ int pci_irq_vector (struct pci_dev *dev,unsigned int nr) {if (dev->msix_enabled) {struct msi_desc *entry; -int i =0 ;for_each_pci_msi_entry (entry, dev) { -if (i == nr) +if (entry->msi_attrib.entry_nr == nr)return entry->irq; - i++; }WARN_ON_ONCE (1 );return -EINVAL ;
@@ -1230,17 +1235,22 @@ EXPORT_SYMBOL(pci_irq_vector);* pci_irq_get_affinity - return the affinity of a particular MSI vector * @dev: PCI device to operate on * @nr: device-relative interrupt vector index (0-based). +* +* @nr has the following meanings depending on the interrupt mode: +* MSI-X: The index in the MSI-X vector table +* MSI: The index of the enabled MSI vectors +* INTx: Must be 0 +* +* Return: A cpumask pointer or NULL if @nr is out of range */ const struct cpumask *pci_irq_get_affinity (struct pci_dev *dev,int nr) {if (dev->msix_enabled) {struct msi_desc *entry; -int i =0 ;for_each_pci_msi_entry (entry, dev) { -if (i == nr) +if (entry->msi_attrib.entry_nr == nr)return &entry->affinity->mask; - i++; }WARN_ON_ONCE (1 );return NULL ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 482/1039 powerpc/powermac: Add additional missing lockdep_register_key()
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit b149d5d45ac9171ed699a256f026c8ebef901112 ]
Commit df1f679d19ed ("powerpc/powermac: Add missing lockdep_register_key()") fixed a problem that was causing a WARNING.
There are two other places in the same file with the same problem originating from commit 9e607f72748d ("i2c_powermac: shut up lockdep warning").
Add missing lockdep_register_key()
Depends-on: df1f679d19ed ("powerpc/powermac: Add missing lockdep_register_key()")
--- arch/powerpc/platforms/powermac/low_i2c.c | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/platforms/powermac/low_i2c.c +2 -0
@@ -810,6 +810,7 @@ static void __init pmu_i2c_probe(void) bus->hostdata = bus +1 ; bus->xfer = pmu_i2c_xfer;mutex_init (&bus->mutex); +lockdep_register_key (&bus->lock_key);lockdep_set_class (&bus->mutex, &bus->lock_key); bus->flags = pmac_i2c_multibus;list_add (&bus->link, &pmac_i2c_busses);
@@ -933,6 +934,7 @@ static void __init smu_i2c_probe(void) bus->hostdata = bus +1 ; bus->xfer = smu_i2c_xfer;mutex_init (&bus->mutex); +lockdep_register_key (&bus->lock_key);lockdep_set_class (&bus->mutex, &bus->lock_key); bus->flags =0 ;list_add (&bus->link, &pmac_i2c_busses);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 483/1039 iommu/arm-smmu-qcom: Fix TTBR0 read
In reply to Greg Kroah-HartmanFrom: Rob Clark <[email protected]>
[ Upstream commit c31112fbd4077a51a14ff338038c82e9571dc821 ]
It is a 64b register, lets not lose the upper bits.
--- drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +1 -1
@@ -51,7 +51,7 @@ static void qcom_adreno_smmu_get_fault_info(const void *cookie, info->fsynr1 =arm_smmu_cb_read (smmu, cfg->cbndx,ARM_SMMU_CB_FSYNR1 ); info->far =arm_smmu_cb_readq (smmu, cfg->cbndx,ARM_SMMU_CB_FAR ); info->cbfrsynra =arm_smmu_gr1_read (smmu,ARM_SMMU_GR1_CBFRSYNRA (cfg->cbndx)); - info->ttbr0 =arm_smmu_cb_read (smmu, cfg->cbndx,ARM_SMMU_CB_TTBR0 ); + info->ttbr0 =arm_smmu_cb_readq (smmu, cfg->cbndx,ARM_SMMU_CB_TTBR0 ); info->contextidr =arm_smmu_cb_read (smmu, cfg->cbndx,ARM_SMMU_CB_CONTEXTIDR ); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 484/1039 RDMA/core: Let ib_find_gid() continue search even after empty entry
In reply to Greg Kroah-HartmanFrom: Avihai Horon <[email protected]>
[ Upstream commit 483d805191a23191f8294bbf9b4e94836f5d92e4 ]
Currently, ib_find_gid() will stop searching after encountering the first empty GID table entry. This behavior is wrong since neither IB nor RoCE spec enforce tightly packed GID tables.
For example, when a valid GID entry exists at index N, and if a GID entry is empty at index N-1, ib_find_gid() will fail to find the valid entry.
Fix it by making ib_find_gid() continue searching even after encountering missing entries.
--- drivers/infiniband/core/device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/core/device.c +2 -1
@@ -2461,7 +2461,8 @@ int ib_find_gid(struct ib_device *device, union ib_gid *gid, ++i) { ret =rdma_query_gid (device, port, i, &tmp_gid);if (ret) -return ret; +continue ; +if (!memcmp (&tmp_gid, gid,sizeof *gid)) { *port_num = port;if (index)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 485/1039 RDMA/cma: Let cma_resolve_ib_dev() continue search even after empty entry
In reply to Greg Kroah-HartmanFrom: Avihai Horon <[email protected]>
[ Upstream commit 20679094a0161c94faf77e373fa3f7428a8e14bd ]
Currently, when cma_resolve_ib_dev() searches for a matching GID it will stop searching after encountering the first empty GID table entry. This behavior is wrong since neither IB nor RoCE spec enforce tightly packed GID tables.
For example, when the matching valid GID entry exists at index N, and if a GID entry is empty at index N-1, cma_resolve_ib_dev() will fail to find the matching valid entry.
Fix it by making cma_resolve_ib_dev() continue searching even after encountering missing entries.
--- drivers/infiniband/core/cma.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/infiniband/core/cma.c +9 -3
@@ -766,6 +766,7 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv)unsigned int p;u16 pkey, index;enum ib_port_state port_state; +int ret;int i; cma_dev =NULL ;
@@ -784,9 +785,14 @@ static int cma_resolve_ib_dev(struct rdma_id_private *id_priv)if (ib_get_cached_port_state (cur_dev->device, p, &port_state))continue ; -for (i =0 ; !rdma_query_gid (cur_dev->device, - p, i, &gid); - i++) { + +for (i =0 ; i < cur_dev->device->port_data[p].immutable.gid_tbl_len; + ++i) { + ret =rdma_query_gid (cur_dev->device, p, i, + &gid); +if (ret) +continue ; +if (!memcmp (&gid, dgid,sizeof (gid))) { cma_dev = cur_dev; sgid = gid;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 486/1039 ASoC: rt5663: Handle device_property_read_u32_array error codes
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 2167c0b205960607fb136b4bb3c556a62be1569a ]
The return value of device_property_read_u32_array() is not always 0. To catch the exception in case that devm_kzalloc failed and the rt5663->imp_table was NULL, which caused the failure of device_property_read_u32_array.
--- sound/soc/codecs/rt5663.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
sound/soc/codecs/rt5663.c +9 -3
@@ -3461,6 +3461,7 @@ static void rt5663_calibrate(struct rt5663_priv *rt5663)static int rt5663_parse_dp (struct rt5663_priv *rt5663,struct device *dev) {int table_size; +int ret;device_property_read_u32 (dev,"realtek,dc_offset_l_manual" , &rt5663->pdata.dc_offset_l_manual);
@@ -3477,9 +3478,11 @@ static int rt5663_parse_dp(struct rt5663_priv *rt5663, struct device *dev) table_size =sizeof (struct impedance_mapping_table ) * rt5663->pdata.impedance_sensing_num; rt5663->imp_table =devm_kzalloc (dev, table_size,GFP_KERNEL ); -device_property_read_u32_array (dev, + ret =device_property_read_u32_array (dev,"realtek,impedance_sensing_table" , (u32 *)rt5663->imp_table, table_size); +if (ret) +return ret; }return 0 ;
@@ -3504,8 +3507,11 @@ static int rt5663_i2c_probe(struct i2c_client *i2c,if (pdata) rt5663->pdata = *pdata; -else -rt5663_parse_dp (rt5663, &i2c->dev); +else { + ret =rt5663_parse_dp (rt5663, &i2c->dev); +if (ret) +return ret; + }for (i =0 ; i <ARRAY_SIZE (rt5663->supplies); i++) rt5663->supplies[i].supply = rt5663_supply_names[i];
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 487/1039 of: unittest: fix warning on PowerPC frame size warning
In reply to Greg Kroah-HartmanFrom: Jim Quinlan <[email protected]>
[ Upstream commit a8d61a9112ad0c9216ab45d050991e07bc4f3408 ]
The struct device variable "dev_bogus" was triggering this warning on a PowerPC build:
drivers/of/unittest.c: In function 'of_unittest_dma_ranges_one.constprop':
[...] >> The frame size of 1424 bytes is larger than 1024 bytes
[-Wframe-larger-than=]
This variable is now dynamically allocated.
--- drivers/of/unittest.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/of/unittest.c +12 -4
@@ -911,11 +911,18 @@ static void __init of_unittest_dma_ranges_one(const char *path,if (!rc) {phys_addr_t paddr;dma_addr_t dma_addr; -struct device dev_bogus; +struct device *dev_bogus; - dev_bogus.dma_range_map = map; - paddr =dma_to_phys (&dev_bogus, expect_dma_addr); - dma_addr =phys_to_dma (&dev_bogus, expect_paddr); + dev_bogus =kzalloc (sizeof (struct device ),GFP_KERNEL ); +if (!dev_bogus) { +unittest (0 ,"kzalloc() failed\n" ); +kfree (map); +return ; + } + + dev_bogus->dma_range_map = map; + paddr =dma_to_phys (dev_bogus, expect_dma_addr); + dma_addr =phys_to_dma (dev_bogus, expect_paddr); unittest(paddr == expect_paddr, "of_dma_get_range: wrong phys addr %pap (expecting %llx) on node %pOF\n",
@@ -925,6 +932,7 @@ static void __init of_unittest_dma_ranges_one(const char *path, &dma_addr, expect_dma_addr, np);kfree (map); + kfree(dev_bogus); }of_node_put (np);#endif
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 488/1039 of: unittest: 64 bit dma address test requires arch support
In reply to Greg Kroah-HartmanFrom: Frank Rowand <[email protected]>
[ Upstream commit 9fd4cf5d3571b27d746b8ead494a3f051485b679 ]
If an architecture does not support 64 bit dma addresses then testing for an expected dma address >= 0x100000000 will fail.
--- drivers/of/unittest.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/of/unittest.c +3 -2
@@ -942,8 +942,9 @@ static void __init of_unittest_parse_dma_ranges(void) {of_unittest_dma_ranges_one ("/testcase-data/address-tests/device@70000000" ,0x0 ,0x20000000 ); -of_unittest_dma_ranges_one ("/testcase-data/address-tests/bus@80000000/device@1000" , -0x100000000 ,0x20000000 ); +if (IS_ENABLED (CONFIG_ARCH_DMA_ADDR_T_64BIT )) +of_unittest_dma_ranges_one ("/testcase-data/address-tests/bus@80000000/device@1000" , +0x100000000 ,0x20000000 );of_unittest_dma_ranges_one ("/testcase-data/address-tests/pci@90000000" ,0x80000000 ,0x20000000 ); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 489/1039 clk: stm32: Fix ltdcs clock turn off by clk_disable_unused() after system enter shell
In reply to Greg Kroah-HartmanFrom: Dillon Min <[email protected]>
[ Upstream commit 6fc058a72f3b7b07fc4de6d66ad1f68951b00f6e ]
stm32's clk driver register two ltdc gate clk to clk core by clk_hw_register_gate() and clk_hw_register_composite()
first: 'stm32f429_gates[]', clk name is 'ltdc', which no user to use.
second: 'stm32f429_aux_clk[]', clk name is 'lcd-tft', used by ltdc driver
both of them point to the same offset of stm32's RCC register. after kernel enter console, clk core turn off ltdc's clk as 'stm32f429_gates[]' is no one to use. but, actually 'stm32f429_aux_clk[]' is in use.
stm32f469/746/769 have the same issue, fix it.
--- drivers/clk/clk-stm32f4.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/clk/clk-stm32f4.c +0 -4
@@ -129,7 +129,6 @@ static const struct stm32f4_gate_data stm32f429_gates[] __initconst = { { STM32F4_RCC_APB2ENR, 20, "spi5", "apb2_div" }, { STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" }, { STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" }, - { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, }; static const struct stm32f4_gate_data stm32f469_gates[] __initconst = {
@@ -211,7 +210,6 @@ static const struct stm32f4_gate_data stm32f469_gates[] __initconst = { { STM32F4_RCC_APB2ENR, 20, "spi5", "apb2_div" }, { STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" }, { STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" }, - { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, }; static const struct stm32f4_gate_data stm32f746_gates[] __initconst = {
@@ -286,7 +284,6 @@ static const struct stm32f4_gate_data stm32f746_gates[] __initconst = { { STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" }, { STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" }, { STM32F4_RCC_APB2ENR, 23, "sai2", "apb2_div" }, - { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, }; static const struct stm32f4_gate_data stm32f769_gates[] __initconst = {
@@ -364,7 +361,6 @@ static const struct stm32f4_gate_data stm32f769_gates[] __initconst = { { STM32F4_RCC_APB2ENR, 21, "spi6", "apb2_div" }, { STM32F4_RCC_APB2ENR, 22, "sai1", "apb2_div" }, { STM32F4_RCC_APB2ENR, 23, "sai2", "apb2_div" }, - { STM32F4_RCC_APB2ENR, 26, "ltdc", "apb2_div" }, { STM32F4_RCC_APB2ENR, 30, "mdio", "apb2_div" }, };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 490/1039 mips: add SYS_HAS_CPU_MIPS64_R5 config for MIPS Release 5 support
In reply to Greg Kroah-HartmanFrom: Lukas Bulwahn <[email protected]>
[ Upstream commit fd4eb90b164442cb1e9909f7845e12a0835ac699 ]
Commit ab7c01fdc3cf ("mips: Add MIPS Release 5 support") adds the two configs CPU_MIPS32_R5 and CPU_MIPS64_R5, which depend on the corresponding SYS_HAS_CPU_MIPS32_R5 and SYS_HAS_CPU_MIPS64_R5, respectively.
The config SYS_HAS_CPU_MIPS32_R5 was already introduced with commit c5b367835cfc ("MIPS: Add support for XPA."); the config SYS_HAS_CPU_MIPS64_R5, however, was never introduced.
Hence, ./scripts/checkkconfigsymbols.py warns:
SYS_HAS_CPU_MIPS64_R5
Referencing files: arch/mips/Kconfig, arch/mips/include/asm/cpu-type.h
Add the definition for config SYS_HAS_CPU_MIPS64_R5 under the assumption that SYS_HAS_CPU_MIPS64_R5 follows the same pattern as the existing SYS_HAS_CPU_MIPS32_R5 and SYS_HAS_CPU_MIPS64_R6.
--- arch/mips/Kconfig | 4 ++++ 1 file changed, 4 insertions(+)
arch/mips/Kconfig +4 -0
@@ -1907,6 +1907,10 @@ config SYS_HAS_CPU_MIPS64_R1 config SYS_HAS_CPU_MIPS64_R2 bool +config SYS_HAS_CPU_MIPS64_R5 + bool + select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT + config SYS_HAS_CPU_MIPS64_R6 bool select ARCH_HAS_SYNC_DMA_FOR_CPU if DMA_NONCOHERENT
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 491/1039 mips: fix Kconfig reference to PHYS_ADDR_T_64BIT
In reply to Greg Kroah-HartmanFrom: Lukas Bulwahn <[email protected]>
[ Upstream commit a670c82d9ca4f1e7385d9d6f26ff41a50fbdd944 ]
Commit d4a451d5fc84 ("arch: remove the ARCH_PHYS_ADDR_T_64BIT config symbol") removes config ARCH_PHYS_ADDR_T_64BIT with all instances of that config refactored appropriately. Since then, it is recommended to use the config PHYS_ADDR_T_64BIT instead.
Commit 171543e75272 ("MIPS: Disallow CPU_SUPPORTS_HUGEPAGES for XPA,EVA") introduces the expression "!(32BIT && (ARCH_PHYS_ADDR_T_64BIT || EVA))" for config CPU_SUPPORTS_HUGEPAGES, which unintentionally refers to the non-existing symbol ARCH_PHYS_ADDR_T_64BIT instead of the intended PHYS_ADDR_T_64BIT.
Fix this Kconfig reference to the intended PHYS_ADDR_T_64BIT.
This issue was identified with the script ./scripts/checkkconfigsymbols.py. I then reported it on the mailing list and Paul confirmed the mistake in the linked email thread.
--- arch/mips/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/Kconfig +1 -1
@@ -2069,7 +2069,7 @@ config CPU_SUPPORTS_ADDRWINCFG bool config CPU_SUPPORTS_HUGEPAGES bool - depends on !(32BIT && (ARCH_PHYS_ADDR_T_64BIT || EVA)) + depends on !(32BIT && (PHYS_ADDR_T_64BIT || EVA)) config MIPS_PGD_C0_CONTEXT bool depends on 64BIT
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 492/1039 dmaengine: pxa/mmp: stop referencing config->slave_id
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 134c37fa250a87a7e77c80a7c59ae16c462e46e0 ]
The last driver referencing the slave_id on Marvell PXA and MMP platforms was the SPI driver, but this stopped doing so a long time ago, so the TODO from the earlier patch can no be removed.
--- drivers/dma/mmp_pdma.c | 6 ------ drivers/dma/pxa_dma.c | 7 ------- 2 files changed, 13 deletions(-)
drivers/dma/mmp_pdma.c +0 -6
@@ -727,12 +727,6 @@ static int mmp_pdma_config_write(struct dma_chan *dchan, chan->dir = direction; chan->dev_addr = addr; -/* FIXME: drivers should be ported over to use the filter -* function. Once that's done, the following two lines can -* be removed. -*/ -if (cfg->slave_id) - chan->drcmr = cfg->slave_id;return 0 ; }
drivers/dma/pxa_dma.c +0 -7
@@ -909,13 +909,6 @@ static void pxad_get_config(struct pxad_chan *chan, *dcmd |=PXA_DCMD_BURST16 ; else if (maxburst == 32) *dcmd |= PXA_DCMD_BURST32; - - /* FIXME: drivers should be ported over to use the filter - * function. Once that's done, the following two lines can - * be removed. - */ - if (chan->cfg.slave_id) - chan->drcmr = chan->cfg.slave_id; } static struct dma_async_tx_descriptor *
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 493/1039 iommu/amd: Restore GA log/tail pointer on host resume
In reply to Greg Kroah-HartmanFrom: Maxim Levitsky <[email protected]>
[ Upstream commit a8d4a37d1bb93608501d0d0545f902061152669a ]
This will give IOMMU GA log a chance to work after resume from s3/s4.
--- drivers/iommu/amd/init.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-)
drivers/iommu/amd/init.c +15 -16
@@ -806,16 +806,27 @@ static int iommu_ga_log_enable(struct amd_iommu *iommu) {#ifdef CONFIG_IRQ_REMAP u32 status, i; +u64 entry;if (!iommu->ga_log)return -EINVAL ; - status =readl (iommu->mmio_base +MMIO_STATUS_OFFSET ); -/* Check if already running */ -if (status & (MMIO_STATUS_GALOG_RUN_MASK )) + status =readl (iommu->mmio_base +MMIO_STATUS_OFFSET ); +if (WARN_ON (status & (MMIO_STATUS_GALOG_RUN_MASK )))return 0 ; + entry =iommu_virt_to_phys (iommu->ga_log) |GA_LOG_SIZE_512 ; +memcpy_toio (iommu->mmio_base +MMIO_GA_LOG_BASE_OFFSET , + &entry,sizeof (entry)); + entry = (iommu_virt_to_phys (iommu->ga_log_tail) & + (BIT_ULL (52 )-1 )) & ~7ULL ; +memcpy_toio (iommu->mmio_base +MMIO_GA_LOG_TAIL_OFFSET , + &entry,sizeof (entry)); +writel (0x00 , iommu->mmio_base +MMIO_GA_HEAD_OFFSET ); +writel (0x00 , iommu->mmio_base +MMIO_GA_TAIL_OFFSET ); + +iommu_feature_enable (iommu,CONTROL_GAINT_EN );iommu_feature_enable (iommu,CONTROL_GALOG_EN );
@@ -825,7 +836,7 @@ static int iommu_ga_log_enable(struct amd_iommu *iommu) break; } -if (i >=LOOP_TIMEOUT ) +if (WARN_ON (i >=LOOP_TIMEOUT ))return -EINVAL ;#endif /* CONFIG_IRQ_REMAP */ return 0 ;
@@ -834,8 +845,6 @@ static int iommu_ga_log_enable(struct amd_iommu *iommu)static int iommu_init_ga_log (struct amd_iommu *iommu) {#ifdef CONFIG_IRQ_REMAP -u64 entry; -if (!AMD_IOMMU_GUEST_IR_VAPIC (amd_iommu_guest_ir))return 0 ;
@@ -849,16 +858,6 @@ static int iommu_init_ga_log(struct amd_iommu *iommu)if (!iommu->ga_log_tail) goto err_out; - entry =iommu_virt_to_phys (iommu->ga_log) |GA_LOG_SIZE_512 ; -memcpy_toio (iommu->mmio_base +MMIO_GA_LOG_BASE_OFFSET , - &entry,sizeof (entry)); - entry = (iommu_virt_to_phys (iommu->ga_log_tail) & - (BIT_ULL (52 )-1 )) & ~7ULL ; -memcpy_toio (iommu->mmio_base +MMIO_GA_LOG_TAIL_OFFSET , - &entry,sizeof (entry)); -writel (0x00 , iommu->mmio_base +MMIO_GA_HEAD_OFFSET ); -writel (0x00 , iommu->mmio_base +MMIO_GA_TAIL_OFFSET ); -return 0 ; err_out:free_ga_log (iommu);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 494/1039 iommu/amd: X2apic mode: re-enable after resume
In reply to Greg Kroah-HartmanFrom: Maxim Levitsky <[email protected]>
[ Upstream commit 01b297a48a26bcb96769505ac948db4603b72bd1 ]
Otherwise it is guaranteed to not work after the resume...
--- drivers/iommu/amd/init.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/iommu/amd/init.c +4 -1
@@ -2172,7 +2172,6 @@ static int iommu_setup_intcapxt(struct amd_iommu *iommu)return ret; } -iommu_feature_enable (iommu,CONTROL_INTCAPXT_EN );return 0 ; }
@@ -2195,6 +2194,10 @@ static int iommu_init_irq(struct amd_iommu *iommu) iommu->int_enabled = true; enable_faults: + +if (amd_iommu_xt_mode ==IRQ_REMAP_X2APIC_MODE ) +iommu_feature_enable (iommu,CONTROL_INTCAPXT_EN ); +iommu_feature_enable (iommu,CONTROL_EVT_INT_EN );if (iommu->ppr_log !=NULL )
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 495/1039 iommu/amd: X2apic mode: setup the INTX registers on mask/unmask
In reply to Greg Kroah-HartmanFrom: Maxim Levitsky <[email protected]>
[ Upstream commit 4691f79d62a637958f7b5f55c232a65399500b7a ]
This is more logically correct and will also allow us to to use mask/unmask logic to restore INTX setttings after the resume from s3/s4.
--- drivers/iommu/amd/init.c | 65 ++++++++++++++++++++-------------------- 1 file changed, 33 insertions(+), 32 deletions(-)
drivers/iommu/amd/init.c +33 -32
@@ -2015,48 +2015,18 @@ union intcapxt { }; } __attribute__ ((packed)); -/* -* There isn't really any need to mask/unmask at the irqchip level because -* the 64-bit INTCAPXT registers can be updated atomically without tearing -* when the affinity is being updated. -*/ -static void intcapxt_unmask_irq (struct irq_data *data) -{ -} - -static void intcapxt_mask_irq (struct irq_data *data) -{ -}static struct irq_chip intcapxt_controller;static int intcapxt_irqdomain_activate (struct irq_domain *domain,struct irq_data *irqd,bool reserve) { -struct amd_iommu *iommu = irqd->chip_data; -struct irq_cfg *cfg =irqd_cfg (irqd); -union intcapxt xt; - - xt.capxt =0ULL ; - xt.dest_mode_logical = apic->dest_mode_logical; - xt.vector = cfg->vector; - xt.destid_0_23 = cfg->dest_apicid &GENMASK (23 ,0 ); - xt.destid_24_31 = cfg->dest_apicid >>24 ; - -/** -* Current IOMMU implemtation uses the same IRQ for all -* 3 IOMMU interrupts. -*/ -writeq (xt.capxt, iommu->mmio_base +MMIO_INTCAPXT_EVT_OFFSET ); -writeq (xt.capxt, iommu->mmio_base +MMIO_INTCAPXT_PPR_OFFSET ); -writeq (xt.capxt, iommu->mmio_base +MMIO_INTCAPXT_GALOG_OFFSET );return 0 ; }static void intcapxt_irqdomain_deactivate (struct irq_domain *domain,struct irq_data *irqd) { -intcapxt_mask_irq (irqd); }
@@ -2090,6 +2060,38 @@ static void intcapxt_irqdomain_free(struct irq_domain *domain, unsigned int virqirq_domain_free_irqs_top (domain, virq, nr_irqs); } + +static void intcapxt_unmask_irq (struct irq_data *irqd) +{ +struct amd_iommu *iommu = irqd->chip_data; +struct irq_cfg *cfg =irqd_cfg (irqd); +union intcapxt xt; + + xt.capxt =0ULL ; + xt.dest_mode_logical = apic->dest_mode_logical; + xt.vector = cfg->vector; + xt.destid_0_23 = cfg->dest_apicid &GENMASK (23 ,0 ); + xt.destid_24_31 = cfg->dest_apicid >>24 ; + +/** +* Current IOMMU implementation uses the same IRQ for all +* 3 IOMMU interrupts. +*/ +writeq (xt.capxt, iommu->mmio_base +MMIO_INTCAPXT_EVT_OFFSET ); +writeq (xt.capxt, iommu->mmio_base +MMIO_INTCAPXT_PPR_OFFSET ); +writeq (xt.capxt, iommu->mmio_base +MMIO_INTCAPXT_GALOG_OFFSET ); +} + +static void intcapxt_mask_irq (struct irq_data *irqd) +{ +struct amd_iommu *iommu = irqd->chip_data; + +writeq (0 , iommu->mmio_base +MMIO_INTCAPXT_EVT_OFFSET ); +writeq (0 , iommu->mmio_base +MMIO_INTCAPXT_PPR_OFFSET ); +writeq (0 , iommu->mmio_base +MMIO_INTCAPXT_GALOG_OFFSET ); +} + +static int intcapxt_set_affinity (struct irq_data *irqd,const struct cpumask *mask,bool force) {
@@ -2099,8 +2101,7 @@ static int intcapxt_set_affinity(struct irq_data *irqd, ret = parent->chip->irq_set_affinity (parent, mask, force);if (ret <0 || ret ==IRQ_SET_MASK_OK_DONE )return ret; - -return intcapxt_irqdomain_activate (irqd->domain, irqd, false); +return 0 ; }static struct irq_chip intcapxt_controller = {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 496/1039 iommu/amd: X2apic mode: mask/unmask interrupts on suspend/resume
In reply to Greg Kroah-HartmanFrom: Maxim Levitsky <[email protected]>
[ Upstream commit 1980105e3cfc2215c75b4f6b172661d675c467d1 ]
Use IRQCHIP_MASK_ON_SUSPEND to make the core irq code to mask the iommu interrupt on suspend and unmask it on the resume.
Since now the unmask function updates the INTX settings, that will restore them on resume from s3/s4.
Since IRQCHIP_MASK_ON_SUSPEND is only effective for interrupts which are not wakeup sources, remove IRQCHIP_SKIP_SET_WAKE flag and instead implement a dummy .irq_set_wake which doesn't allow the interrupt to become a wakeup source.
--- drivers/iommu/amd/init.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/iommu/amd/init.c +7 -1
@@ -2104,6 +2104,11 @@ static int intcapxt_set_affinity(struct irq_data *irqd,return 0 ; } +static int intcapxt_set_wake (struct irq_data *irqd,unsigned int on) +{ +return on ? -EOPNOTSUPP :0 ; +} +static struct irq_chip intcapxt_controller = { .name ="IOMMU-MSI" , .irq_unmask = intcapxt_unmask_irq,
@@ -2111,7 +2116,8 @@ static struct irq_chip intcapxt_controller = { .irq_ack = irq_chip_ack_parent, .irq_retrigger = irq_chip_retrigger_hierarchy, .irq_set_affinity = intcapxt_set_affinity, - .flags = IRQCHIP_SKIP_SET_WAKE, + .irq_set_wake = intcapxt_set_wake, + .flags = IRQCHIP_MASK_ON_SUSPEND, };static const struct irq_domain_ops intcapxt_domain_ops = {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 497/1039 iommu/amd: Remove useless irq affinity notifier
In reply to Greg Kroah-HartmanFrom: Maxim Levitsky <[email protected]>
[ Upstream commit 575f5cfb13c84f324f9898383fa4a5694e53c9ef ]
iommu->intcapxt_notify field is no longer used
after a switch to a separate domain was done
--- drivers/iommu/amd/amd_iommu_types.h | 2 -- 1 file changed, 2 deletions(-)
drivers/iommu/amd/amd_iommu_types.h +0 -2
@@ -645,8 +645,6 @@ struct amd_iommu {/* DebugFS Info */ struct dentry *debugfs;#endif -/* IRQ notifier for IntCapXT interrupt */ -struct irq_affinity_notify intcapxt_notify; };static inline struct amd_iommu *dev_to_amd_iommu (struct device *dev)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 498/1039 ASoC: Intel: catpt: Test dmaengine_submit() result before moving on
In reply to Greg Kroah-HartmanFrom: Cezary Rojewski <[email protected]>
[ Upstream commit 2a9a72e290d4a4741e673f86b9fba9bfb319786d ]
After calling dmaengine_submit(), the submitted transfer descriptor belongs to the DMA engine. Pointer to that descriptor may no longer be valid after the call and should be tested before awaiting transfer completion.
--- sound/soc/intel/catpt/dsp.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
sound/soc/intel/catpt/dsp.c +12 -2
@@ -65,6 +65,7 @@ static int catpt_dma_memcpy(struct catpt_dev *cdev, struct dma_chan *chan, {struct dma_async_tx_descriptor *desc;enum dma_status status; +int ret; desc =dmaengine_prep_dma_memcpy (chan, dst_addr, src_addr, size,DMA_CTRL_ACK );
@@ -77,13 +78,22 @@ static int catpt_dma_memcpy(struct catpt_dev *cdev, struct dma_chan *chan,catpt_updatel_shim (cdev,HMDC ,CATPT_HMDC_HDDA (CATPT_DMA_DEVID , chan->chan_id),CATPT_HMDC_HDDA (CATPT_DMA_DEVID , chan->chan_id)); -dmaengine_submit (desc); + + ret =dma_submit_error (dmaengine_submit (desc)); +if (ret) { +dev_err (cdev->dev,"submit tx failed: %d\n" , ret); + goto clear_hdda; + } + status =dma_wait_for_async_tx (desc); + ret = (status ==DMA_COMPLETE ) ?0 : -EPROTO ; + +clear_hdda:/* regardless of status, disable access to HOST memory in demand mode */ catpt_updatel_shim (cdev,HMDC ,CATPT_HMDC_HDDA (CATPT_DMA_DEVID , chan->chan_id),0 ); -return (status ==DMA_COMPLETE ) ?0 : -EPROTO ; +return ret; } int catpt_dma_memcpy_todsp(struct catpt_dev *cdev, struct dma_chan *chan,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 499/1039 iommu/iova: Fix race between FQ timeout and teardown
In reply to Greg Kroah-HartmanFrom: Xiongfeng Wang <[email protected]>
[ Upstream commit d7061627d701c90e1cac1e1e60c45292f64f3470 ]
It turns out to be possible for hotplugging out a device to reach the stage of tearing down the device's group and default domain before the domain's flush queue has drained naturally. At this point, it is then possible for the timeout to expire just before the del_timer() call in free_iova_flush_queue(), such that we then proceed to free the FQ resources while fq_flush_timeout() is still accessing them on another CPU. Crashes due to this have been observed in the wild while removing NVMe devices.
Close the race window by using del_timer_sync() to safely wait for any active timeout handler to finish before we start to free things. We already avoid any locking in free_iova_flush_queue() since the FQ is supposed to be inactive anyway, so the potential deadlock scenario does not apply.
--- drivers/iommu/iova.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/iommu/iova.c +1 -2
@@ -83,8 +83,7 @@ static void free_iova_flush_queue(struct iova_domain *iovad)if (!has_iova_flush_queue (iovad))return ; -if (timer_pending (&iovad->fq_timer)) -del_timer (&iovad->fq_timer); +del_timer_sync (&iovad->fq_timer);fq_destroy_all_entries (iovad);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 500/1039 ASoC: mediatek: mt8195: correct default value
In reply to Greg Kroah-HartmanFrom: Trevor Wu <[email protected]>
[ Upstream commit 30e693ee82d20361f2caacca3b68c79e1a7cb16c ]
mt8195_cg_patch is used to reset the default value of audio cg, so the register value could be consistent with CCF reference count. Nevertheless, AUDIO_TOP_CON1[1:0] is used to control an internal mux, and it's expected to keep the default value 0.
This patch corrects the default value in case an unexpected behavior happens in the future.
--- sound/soc/mediatek/mt8195/mt8195-afe-pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/mediatek/mt8195/mt8195-afe-pcm.c +1 -1
@@ -3028,7 +3028,7 @@ static const struct reg_sequence mt8195_afe_reg_defaults[] = {static const struct reg_sequence mt8195_cg_patch[] = { {AUDIO_TOP_CON0 ,0xfffffffb }, - {AUDIO_TOP_CON1 ,0xfffffffa }, + {AUDIO_TOP_CON1 ,0xfffffff8 }, };static int mt8195_afe_init_registers (struct mtk_base_afe *afe)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 501/1039 counter: 104-quad-8: Fix persistent enabled events bug
In reply to Greg Kroah-HartmanFrom: William Breathitt Gray <[email protected]>
[ Upstream commit c95cc0d95702523f8f361b802c9b7d4eeae07f5d ]
A bug exists if the user executes a COUNTER_ADD_WATCH_IOCTL ioctl call, and then executes a COUNTER_DISABLE_EVENTS_IOCTL ioctl call. Disabling the events should disable the 104-QUAD-8 interrupts, but because of this bug the interrupts are not disabling.
The reason this bug is occurring is because quad8_events_configure() is called when COUNTER_DISABLE_EVENTS_IOCTL is handled, but the next_irq_trigger[] array has not been cleared before it is checked in the loop.
This patch fixes the bug by removing the next_irq_trigger array and instead utilizing a different algorithm of walking the events_list list for the current requested events. When a COUNTER_DISABLE_EVENTS_IOCTL is handled, events_list will be empty and thus all device channels end up with interrupts disabled.
--- drivers/counter/104-quad-8.c | 82 +++++++++++++++++------------------- 1 file changed, 39 insertions(+), 43 deletions(-)
drivers/counter/104-quad-8.c +39 -43
@@ -14,6 +14,7 @@#include <linux/interrupt.h> #include <linux/isa.h> #include <linux/kernel.h> +#include <linux/list.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/types.h>
@@ -44,7 +45,6 @@ MODULE_PARM_DESC(irq, "ACCES 104-QUAD-8 interrupt line numbers");* @ab_enable: array of A and B inputs enable configurations * @preset_enable: array of set_to_preset_on_index attribute configurations * @irq_trigger: array of current IRQ trigger function configurations -* @next_irq_trigger: array of next IRQ trigger function configurations * @synchronous_mode: array of index function synchronous mode configurations * @index_polarity: array of index function polarity configurations * @cable_fault_enable: differential encoder cable status enable configurations
@@ -61,7 +61,6 @@ struct quad8 {unsigned int ab_enable[QUAD8_NUM_COUNTERS ];unsigned int preset_enable[QUAD8_NUM_COUNTERS ];unsigned int irq_trigger[QUAD8_NUM_COUNTERS ]; -unsigned int next_irq_trigger[QUAD8_NUM_COUNTERS ];unsigned int synchronous_mode[QUAD8_NUM_COUNTERS ];unsigned int index_polarity[QUAD8_NUM_COUNTERS ];unsigned int cable_fault_enable;
@@ -390,7 +389,6 @@ static int quad8_action_read(struct counter_device *counter, }enum { -QUAD8_EVENT_NONE =-1 ,QUAD8_EVENT_CARRY =0 ,QUAD8_EVENT_COMPARE =1 ,QUAD8_EVENT_CARRY_BORROW =2 ,
@@ -402,34 +400,49 @@ static int quad8_events_configure(struct counter_device *counter)struct quad8 *const priv = counter->priv;unsigned long irq_enabled =0 ;unsigned long irqflags; -size_t channel; +struct counter_event_node *event_node; +unsigned int next_irq_trigger;unsigned long ior_cfg;unsigned long base_offset;spin_lock_irqsave (&priv->lock, irqflags); -/* Enable interrupts for the requested channels, disable for the rest */ -for (channel =0 ; channel <QUAD8_NUM_COUNTERS ; channel++) { -if (priv->next_irq_trigger[channel] ==QUAD8_EVENT_NONE ) -continue ; +list_for_each_entry (event_node, &counter->events_list, l) { +switch (event_node->event) { +case COUNTER_EVENT_OVERFLOW : + next_irq_trigger =QUAD8_EVENT_CARRY ; +break ; +case COUNTER_EVENT_THRESHOLD : + next_irq_trigger =QUAD8_EVENT_COMPARE ; +break ; +case COUNTER_EVENT_OVERFLOW_UNDERFLOW : + next_irq_trigger =QUAD8_EVENT_CARRY_BORROW ; +break ; +case COUNTER_EVENT_INDEX : + next_irq_trigger =QUAD8_EVENT_INDEX ; +break ; +default : +/* should never reach this path */ +spin_unlock_irqrestore (&priv->lock, irqflags); +return -EINVAL ; + } -if (priv->irq_trigger[channel] != priv->next_irq_trigger[channel]) { -/* Save new IRQ function configuration */ - priv->irq_trigger[channel] = priv->next_irq_trigger[channel]; +/* Skip configuration if it is the same as previously set */ +if (priv->irq_trigger[event_node->channel] == next_irq_trigger) +continue ; -/* Load configuration to I/O Control Register */ - ior_cfg = priv->ab_enable[channel] | - priv->preset_enable[channel] <<1 | - priv->irq_trigger[channel] <<3 ; - base_offset = priv->base +2 * channel +1 ; -outb (QUAD8_CTR_IOR | ior_cfg, base_offset); - } +/* Save new IRQ function configuration */ + priv->irq_trigger[event_node->channel] = next_irq_trigger; -/* Reset next IRQ trigger function configuration */ - priv->next_irq_trigger[channel] =QUAD8_EVENT_NONE ; +/* Load configuration to I/O Control Register */ + ior_cfg = priv->ab_enable[event_node->channel] | + priv->preset_enable[event_node->channel] <<1 | + priv->irq_trigger[event_node->channel] <<3 ; + base_offset = priv->base +2 * event_node->channel +1 ; +outb (QUAD8_CTR_IOR | ior_cfg, base_offset);/* Enable IRQ line */ - irq_enabled |=BIT (channel); + irq_enabled |=BIT (event_node->channel); }outb (irq_enabled, priv->base +QUAD8_REG_INDEX_INTERRUPT );
@@ -442,35 +455,20 @@ static int quad8_events_configure(struct counter_device *counter)static int quad8_watch_validate (struct counter_device *counter,const struct counter_watch *watch) { -struct quad8 *const priv = counter->priv; +struct counter_event_node *event_node;if (watch->channel >QUAD8_NUM_COUNTERS -1 )return -EINVAL ;switch (watch->event) {case COUNTER_EVENT_OVERFLOW : -if (priv->next_irq_trigger[watch->channel] ==QUAD8_EVENT_NONE ) - priv->next_irq_trigger[watch->channel] =QUAD8_EVENT_CARRY ; -else if (priv->next_irq_trigger[watch->channel] !=QUAD8_EVENT_CARRY ) -return -EINVAL ; -return 0 ;case COUNTER_EVENT_THRESHOLD : -if (priv->next_irq_trigger[watch->channel] ==QUAD8_EVENT_NONE ) - priv->next_irq_trigger[watch->channel] =QUAD8_EVENT_COMPARE ; -else if (priv->next_irq_trigger[watch->channel] !=QUAD8_EVENT_COMPARE ) -return -EINVAL ; -return 0 ;case COUNTER_EVENT_OVERFLOW_UNDERFLOW : -if (priv->next_irq_trigger[watch->channel] ==QUAD8_EVENT_NONE ) - priv->next_irq_trigger[watch->channel] =QUAD8_EVENT_CARRY_BORROW ; -else if (priv->next_irq_trigger[watch->channel] !=QUAD8_EVENT_CARRY_BORROW ) -return -EINVAL ; -return 0 ;case COUNTER_EVENT_INDEX : -if (priv->next_irq_trigger[watch->channel] ==QUAD8_EVENT_NONE ) - priv->next_irq_trigger[watch->channel] =QUAD8_EVENT_INDEX ; -else if (priv->next_irq_trigger[watch->channel] !=QUAD8_EVENT_INDEX ) -return -EINVAL ; +list_for_each_entry (event_node, &counter->next_events_list, l) +if (watch->channel == event_node->channel && + watch->event != event_node->event) +return -EINVAL ;return 0 ;default :return -EINVAL ;
@@ -1183,8 +1181,6 @@ static int quad8_probe(struct device *dev, unsigned int id)outb (QUAD8_CTR_IOR , base_offset +1 );/* Disable index function; negative index polarity */ outb (QUAD8_CTR_IDR , base_offset +1 ); -/* Initialize next IRQ trigger function configuration */ - priv->next_irq_trigger[i] =QUAD8_EVENT_NONE ; }/* Disable Differential Encoder Cable Status for all channels */ outb (0xFF , base[id] +QUAD8_DIFF_ENCODER_CABLE_STATUS );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 502/1039 of: fdt: Aggregate the processing of "linux,usable-memory-range"
In reply to Greg Kroah-HartmanFrom: Zhen Lei <[email protected]>
[ Upstream commit 8347b41748c3019157312fbe7f8a6792ae396eb7 ]
Currently, we parse the "linux,usable-memory-range" property in early_init_dt_scan_chosen(), to obtain the specified memory range of the crash kernel. We then reserve the required memory after early_init_dt_scan_memory() has identified all available physical memory. Because the two pieces of code are separated far, the readability and maintainability are reduced. So bring them together.
(change the prototype of early_init_dt_check_for_usable_mem_range(), in order to use it outside)
To: [email protected]
To: [email protected]
--- drivers/of/fdt.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/of/fdt.c +13 -6
@@ -965,18 +965,22 @@ static void __init early_init_dt_check_for_elfcorehdr(unsigned long node) elfcorehdr_addr, elfcorehdr_size); } -static phys_addr_t cap_mem_addr; -static phys_addr_t cap_mem_size; +static unsigned long chosen_node_offset = -FDT_ERR_NOTFOUND ;/** * early_init_dt_check_for_usable_mem_range - Decode usable memory range * location from flat tree -* @node: reference to node containing usable memory range location ('chosen') */ -static void __init early_init_dt_check_for_usable_mem_range (unsigned long node) +static void __init early_init_dt_check_for_usable_mem_range (void ) {const __be32 *prop;int len; +phys_addr_t cap_mem_addr; +phys_addr_t cap_mem_size; +unsigned long node = chosen_node_offset; + +if ((long )node <0 ) +return ;pr_debug ("Looking for usable-memory-range property... " );
@@ -989,6 +993,8 @@ static void __init early_init_dt_check_for_usable_mem_range(unsigned long node)pr_debug ("cap_mem_start=%pa cap_mem_size=%pa\n" , &cap_mem_addr, &cap_mem_size); + +memblock_cap_memory_range (cap_mem_addr, cap_mem_size); }#ifdef CONFIG_SERIAL_EARLYCON
@@ -1137,9 +1143,10 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0))return 0 ; + chosen_node_offset = node; +early_init_dt_check_for_initrd (node);early_init_dt_check_for_elfcorehdr (node); -early_init_dt_check_for_usable_mem_range (node);/* Retrieve command line */ p =of_get_flat_dt_prop (node,"bootargs" , &l);
@@ -1275,7 +1282,7 @@ void __init early_init_dt_scan_nodes(void)of_scan_flat_dt (early_init_dt_scan_memory,NULL );/* Handle linux,usable-memory-range property */ -memblock_cap_memory_range (cap_mem_addr, cap_mem_size); +early_init_dt_check_for_usable_mem_range (); }bool __init early_init_dt_scan (void *params)
Signature · 9 lines
2.34.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 503/1039 efi: apply memblock cap after memblock_add()
In reply to Greg Kroah-HartmanFrom: Pingfan Liu <[email protected]>
[ Upstream commit b398123bff3bcbc1facb0f29bf6e7b9f1bc55931 ]
On arm64, during kdump kernel saves vmcore, it runs into the following bug:
...
[ 15.148919] usercopy: Kernel memory exposure attempt detected from SLUB object 'kmem_cache_node' (offset 0, size 4096)! [ 15.159707] ------------[ cut here ]------------ [ 15.164311] kernel BUG at mm/usercopy.c:99! [ 15.168482] Internal error: Oops - BUG: 0 [#1] SMP [ 15.173261] Modules linked in: xfs libcrc32c crct10dif_ce ghash_ce sha2_ce sha256_arm64 sha1_ce sbsa_gwdt ast i2c_algo_bit drm_vram_helper drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops cec drm_ttm_helper ttm drm nvme nvme_core xgene_hwmon i2c_designware_platform i2c_designware_core dm_mirror dm_region_hash dm_log dm_mod overlay squashfs zstd_decompress loop [ 15.206186] CPU: 0 PID: 542 Comm: cp Not tainted 5.16.0-rc4 #1 [ 15.212006] Hardware name: GIGABYTE R272-P30-JG/MP32-AR0-JG, BIOS F12 (SCP: 1.5.20210426) 05/13/2021 [ 15.221125] pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 15.228073] pc : usercopy_abort+0x9c/0xa0 [ 15.232074] lr : usercopy_abort+0x9c/0xa0 [ 15.236070] sp : ffff8000121abba0 [ 15.239371] x29: ffff8000121abbb0 x28: 0000000000003000 x27: 0000000000000000 [ 15.246494] x26: 0000000080000400 x25: 0000ffff885c7000 x24: 0000000000000000 [ 15.253617] x23: 000007ff80400000 x22: ffff07ff80401000 x21: 0000000000000001 [ 15.260739] x20: 0000000000001000 x19: ffff07ff80400000 x18: ffffffffffffffff [ 15.267861] x17: 656a626f2042554c x16: 53206d6f72662064 x15: 6574636574656420 [ 15.274983] x14: 74706d6574746120 x13: 2129363930342065 x12: 7a6973202c302074 [ 15.282105] x11: ffffc8b041d1b148 x10: 00000000ffff8000 x9 : ffffc8b04012812c [ 15.289228] x8 : 00000000ffff7fff x7 : ffffc8b041d1b148 x6 : 0000000000000000 [ 15.296349] x5 : 0000000000000000 x4 : 0000000000007fff x3 : 0000000000000000 [ 15.303471] x2 : 0000000000000000 x1 : ffff07ff8c064800 x0 : 000000000000006b [ 15.310593] Call trace: [ 15.313027] usercopy_abort+0x9c/0xa0 [ 15.316677] __check_heap_object+0xd4/0xf0 [ 15.320762] __check_object_size.part.0+0x160/0x1e0 [ 15.325628] __check_object_size+0x2c/0x40 [ 15.329711] copy_oldmem_page+0x7c/0x140 [ 15.333623] read_from_oldmem.part.0+0xfc/0x1c0 [ 15.338142] __read_vmcore.constprop.0+0x23c/0x350 [ 15.342920] read_vmcore+0x28/0x34 [ 15.346309] proc_reg_read+0xb4/0xf0 [ 15.349871] vfs_read+0xb8/0x1f0 [ 15.353088] ksys_read+0x74/0x100 [ 15.356390] __arm64_sys_read+0x28/0x34
...
This bug introduced by commit b261dba2fdb2 ("arm64: kdump: Remove custom linux,usable-memory-range handling"), which moves memblock_cap_memory_range() to fdt, but it breaches the rules that memblock_cap_memory_range() should come after memblock_add() etc as said in commit e888fa7bb882 ("memblock: Check memory add/cap ordering").
As a consequence, the virtual address set up by copy_oldmem_page() does not bail out from the test of virt_addr_valid() in check_heap_object(), and finally hits the BUG_ON().
Since memblock allocator has no idea about when the memblock is fully populated, while efi_init() is aware, so tackling this issue by calling the interface early_init_dt_check_for_usable_mem_range() exposed by of/fdt.
To: [email protected]
To: [email protected]
--- drivers/firmware/efi/efi-init.c | 5 +++++ drivers/of/fdt.c | 2 +- include/linux/of_fdt.h | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-)
drivers/firmware/efi/efi-init.c +5 -0
@@ -235,6 +235,11 @@ void __init efi_init(void) }reserve_regions (); +/* +* For memblock manipulation, the cap should come after the memblock_add(). +* And now, memblock is fully populated, it is time to do capping. +*/ +early_init_dt_check_for_usable_mem_range ();efi_esrt_init ();efi_mokvar_table_init ();
drivers/of/fdt.c +1 -1
@@ -971,7 +971,7 @@ static unsigned long chosen_node_offset = -FDT_ERR_NOTFOUND;* early_init_dt_check_for_usable_mem_range - Decode usable memory range * location from flat tree */ -static void __init early_init_dt_check_for_usable_mem_range (void ) +void __init early_init_dt_check_for_usable_mem_range (void ) {const __be32 *prop;int len;
include/linux/of_fdt.h +2 -0
@@ -62,6 +62,7 @@ extern int early_init_dt_scan_chosen(unsigned long node, const char *uname, int depth, void *data);extern int early_init_dt_scan_memory (unsigned long node,const char *uname,int depth,void *data); +extern void early_init_dt_check_for_usable_mem_range (void );extern int early_init_dt_scan_chosen_stdout (void );extern void early_init_fdt_scan_reserved_mem (void );extern void early_init_fdt_reserve_self (void );
@@ -86,6 +87,7 @@ extern void unflatten_and_copy_device_tree(void);extern void early_init_devtree (void *);extern void early_get_first_memblock_info (void *,phys_addr_t *);#else /* CONFIG_OF_EARLY_FLATTREE */ +static inline void early_init_dt_check_for_usable_mem_range (void ) {}static inline int early_init_dt_scan_chosen_stdout (void ) {return -ENODEV ; }static inline void early_init_fdt_scan_reserved_mem (void ) {}static inline void early_init_fdt_reserve_self (void ) {}
Signature · 9 lines
2.34.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 504/1039 scsi: block: pm: Always set request queue runtime active in blk_post_runtime_resume()
In reply to Greg Kroah-HartmanFrom: Alan Stern <[email protected]>
[ Upstream commit 6e1fcab00a23f7fe9f4fe9704905a790efa1eeab ]
John Garry reported a deadlock that occurs when trying to access a runtime-suspended SATA device. For obscure reasons, the rescan procedure causes the link to be hard-reset, which disconnects the device.
The rescan tries to carry out a runtime resume when accessing the device. scsi_rescan_device() holds the SCSI device lock and won't release it until it can put commands onto the device's block queue. This can't happen until the queue is successfully runtime-resumed or the device is unregistered. But the runtime resume fails because the device is disconnected, and __scsi_remove_device() can't do the unregistration because it can't get the device lock.
The best way to resolve this deadlock appears to be to allow the block queue to start running again even after an unsuccessful runtime resume. The idea is that the driver or the SCSI error handler will need to be able to use the queue to resolve the runtime resume failure.
This patch removes the err argument to blk_post_runtime_resume() and makes the routine act as though the resume was successful always. This fixes the deadlock.
--- block/blk-pm.c | 22 +++++++--------------- drivers/scsi/scsi_pm.c | 2 +- include/linux/blk-pm.h | 2 +- 3 files changed, 9 insertions(+), 17 deletions(-)
block/blk-pm.c +7 -15
@@ -163,27 +163,19 @@ EXPORT_SYMBOL(blk_pre_runtime_resume);/** * blk_post_runtime_resume - Post runtime resume processing * @q: the queue of the device -* @err: return value of the device's runtime_resume function * * Description: -* Update the queue's runtime status according to the return value of the -* device's runtime_resume function. If the resume was successful, call -* blk_set_runtime_active() to do the real work of restarting the queue. +* For historical reasons, this routine merely calls blk_set_runtime_active() +* to do the real work of restarting the queue. It does this regardless of +* whether the device's runtime-resume succeeded; even if it failed the +* driver or error handler will need to communicate with the device. * * This function should be called near the end of the device's * runtime_resume callback. */ -void blk_post_runtime_resume (struct request_queue *q,int err) +void blk_post_runtime_resume (struct request_queue *q) { -if (!q->dev) -return ; -if (!err) { -blk_set_runtime_active (q); - }else { -spin_lock_irq (&q->queue_lock); - q->rpm_status =RPM_SUSPENDED ; -spin_unlock_irq (&q->queue_lock); - } +blk_set_runtime_active (q); }EXPORT_SYMBOL (blk_post_runtime_resume);
@@ -201,7 +193,7 @@ EXPORT_SYMBOL(blk_post_runtime_resume);* runtime PM status and re-enable peeking requests from the queue. It * should be called before first request is added to the queue. * -* This function is also called by blk_post_runtime_resume() for successful +* This function is also called by blk_post_runtime_resume() for * runtime resumes. It does everything necessary to restart the queue. */ void blk_set_runtime_active (struct request_queue *q)
drivers/scsi/scsi_pm.c +1 -1
@@ -181,7 +181,7 @@ static int sdev_runtime_resume(struct device *dev)blk_pre_runtime_resume (sdev->request_queue);if (pm && pm->runtime_resume) err = pm->runtime_resume (dev); -blk_post_runtime_resume (sdev->request_queue, err); +blk_post_runtime_resume (sdev->request_queue);return err; }
include/linux/blk-pm.h +1 -1
@@ -14,7 +14,7 @@ extern void blk_pm_runtime_init(struct request_queue *q, struct device *dev);extern int blk_pre_runtime_suspend (struct request_queue *q);extern void blk_post_runtime_suspend (struct request_queue *q,int err);extern void blk_pre_runtime_resume (struct request_queue *q); -extern void blk_post_runtime_resume (struct request_queue *q,int err); +extern void blk_post_runtime_resume (struct request_queue *q);extern void blk_set_runtime_active (struct request_queue *q);#else static inline void blk_pm_runtime_init(struct request_queue *q,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 505/1039 phy: uniphier-usb3ss: fix unintended writing zeros to PHY register
In reply to Greg Kroah-HartmanFrom: Ryuta NAKANISHI <[email protected]>
[ Upstream commit 898c7a9ec81620125f2463714a0f4dea18ad6e54 ]
Similar to commit 4a90bbb478db ("phy: uniphier-pcie: Fix updating phy parameters"), in function uniphier_u3ssphy_set_param(), unintentionally write zeros to other fields when writing PHY registers.
--- drivers/phy/socionext/phy-uniphier-usb3ss.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/phy/socionext/phy-uniphier-usb3ss.c +6 -4
@@ -22,11 +22,13 @@#include <linux/reset.h> #define SSPHY_TESTI 0x0 -#define SSPHY_TESTO 0x4#define TESTI_DAT_MASK GENMASK(13, 6)#define TESTI_ADR_MASK GENMASK(5, 1)#define TESTI_WR_EN BIT(0) +#define SSPHY_TESTO 0x4 +#define TESTO_DAT_MASK GENMASK(7, 0) +#define PHY_F (regno, msb, lsb) { (regno), (msb), (lsb) }#define CDR_CPD_TRIM PHY_F(7, 3, 0)/* RxPLL charge pump current */
@@ -84,12 +86,12 @@ static void uniphier_u3ssphy_set_param(struct uniphier_u3ssphy_priv *priv, val =FIELD_PREP (TESTI_DAT_MASK ,1 ); val |=FIELD_PREP (TESTI_ADR_MASK , p->field.reg_no);uniphier_u3ssphy_testio_write (priv, val); - val =readl (priv->base +SSPHY_TESTO ); + val =readl (priv->base +SSPHY_TESTO ) &TESTO_DAT_MASK ;/* update value */ - val &= ~FIELD_PREP (TESTI_DAT_MASK , field_mask); + val &= ~field_mask; data = field_mask & (p->value << p->field.lsb); - val =FIELD_PREP (TESTI_DAT_MASK , data); + val =FIELD_PREP (TESTI_DAT_MASK , data | val); val |=FIELD_PREP (TESTI_ADR_MASK , p->field.reg_no);uniphier_u3ssphy_testio_write (priv, val);uniphier_u3ssphy_testio_write (priv, val |TESTI_WR_EN );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 506/1039 ASoC: mediatek: Check for error clk pointer
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 9de2b9286a6dd16966959b3cb34fc2ddfd39213e ]
Yes, you are right and now the return code depending on the init_clks().
--- drivers/soc/mediatek/mtk-scpsys.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/soc/mediatek/mtk-scpsys.c +11 -4
@@ -411,12 +411,17 @@ out:return ret; } -static void init_clks (struct platform_device *pdev,struct clk **clk) +static int init_clks (struct platform_device *pdev,struct clk **clk) {int i; -for (i =CLK_NONE +1 ; i <CLK_MAX ; i++) +for (i =CLK_NONE +1 ; i <CLK_MAX ; i++) { clk[i] =devm_clk_get (&pdev->dev, clk_names[i]); +if (IS_ERR (clk[i])) +return PTR_ERR (clk[i]); + } + +return 0 ; } static struct scp *init_scp(struct platform_device *pdev,
@@ -426,7 +431,7 @@ static struct scp *init_scp(struct platform_device *pdev, {struct genpd_onecell_data *pd_data;struct resource *res; -int i, j; +int i, j, ret;struct scp *scp;struct clk *clk[CLK_MAX ];
@@ -481,7 +486,9 @@ static struct scp *init_scp(struct platform_device *pdev, pd_data->num_domains = num; -init_clks (pdev, clk); + ret =init_clks (pdev, clk); +if (ret) +return ERR_PTR (ret);for (i =0 ; i < num; i++) {struct scp_domain *scpd = &scp->domains[i];
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 507/1039 powerpc/64s: Mask NIP before checking against SRR0
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
[ Upstream commit 314f6c23dd8d417281eb9e8a516dd98036f2e7b3 ]
When CONFIG_PPC_RFI_SRR_DEBUG=y we check that NIP and SRR0 match when returning from interrupts. This can trigger falsely if NIP has either of its two low bits set via sigreturn or ptrace, while SRR0 has its low two bits masked in hardware.
As a quick fix make sure to mask the low bits before doing the check.
--- arch/powerpc/kernel/interrupt_64.S | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/kernel/interrupt_64.S +2 -0
@@ -30,6 +30,7 @@ COMPAT_SYS_CALL_TABLE: .ifc \srr,srr mfspr r11,SPRN_SRR0 ld r12,_NIP(r1) + clrrdi r12,r12,2 100: tdne r11,r12 EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) mfspr r11,SPRN_SRR1
@@ -39,6 +40,7 @@ COMPAT_SYS_CALL_TABLE: .else mfspr r11,SPRN_HSRR0 ld r12,_NIP(r1) + clrrdi r12,r12,2 100: tdne r11,r12 EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) mfspr r11,SPRN_HSRR1
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 508/1039 powerpc/64s: Use EMIT_WARN_ENTRY for SRR debug warnings
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
[ Upstream commit fd1eaaaaa6864b5fb8f99880fcefb49760b8fe4e ]
When CONFIG_PPC_RFI_SRR_DEBUG=y we check the SRR values before returning from interrupts. This is done in asm using EMIT_BUG_ENTRY, and passing BUGFLAG_WARNING.
However that fails to create an exception table entry for the warning, and so do_program_check() fails the exception table search and proceeds to call _exception(), resulting in an oops like:
Oops: Exception in kernel mode, sig: 5 [#1] LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA pSeries Modules linked in: CPU: 2 PID: 1204 Comm: sigreturn_unali Tainted: P 5.16.0-rc2-00194-g91ca3d4f77c5 #12 NIP: c00000000000c5b0 LR: 0000000000000000 CTR: 0000000000000000 ... NIP [c00000000000c5b0] system_call_common+0x150/0x268 LR [0000000000000000] 0x0 Call Trace: [c00000000db73e10] [c00000000000c558] system_call_common+0xf8/0x268 (unreliable) ... Instruction dump: 7cc803a6 888d0931 2c240000 4082001c 38800000 988d0931 e8810170 e8a10178 7c9a03a6 7cbb03a6 7d7a02a6 e9810170 <7f0b6088> 7d7b02a6 e9810178 7f0b6088
We should instead use EMIT_WARN_ENTRY, which creates an exception table entry for the warning, allowing the warning to be correctly recognised, and the code to resume after printing the warning.
Note however that because this warning is buried deep in the interrupt return path, we are not able to recover from it (due to MSR_RI being clear), so we still end up in die() with an unrecoverable exception.
--- arch/powerpc/kernel/interrupt_64.S | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/powerpc/kernel/interrupt_64.S +4 -4
@@ -32,21 +32,21 @@ COMPAT_SYS_CALL_TABLE: ld r12,_NIP(r1) clrrdi r12,r12,2 100: tdne r11,r12 - EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) + EMIT_WARN_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) mfspr r11,SPRN_SRR1 ld r12,_MSR(r1) 100: tdne r11,r12 - EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) + EMIT_WARN_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) .else mfspr r11,SPRN_HSRR0 ld r12,_NIP(r1) clrrdi r12,r12,2 100: tdne r11,r12 - EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) + EMIT_WARN_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) mfspr r11,SPRN_HSRR1 ld r12,_MSR(r1) 100: tdne r11,r12 - EMIT_BUG_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) + EMIT_WARN_ENTRY 100b,__FILE__,__LINE__,(BUGFLAG_WARNING | BUGFLAG_ONCE) .endif #endif .endm
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 509/1039 phy: cadence: Sierra: Fix to get correct parent for mux clocks
In reply to Greg Kroah-HartmanFrom: Swapnil Jakhade <[email protected]>
[ Upstream commit da08aab940092a050a4fb2857ed9479d2b0e03c4 ]
Fix get_parent() callback to return the correct index of the parent for PLL_CMNLC1 clock. Add a separate table of register values corresponding to the parent index for PLL_CMNLC1. Update set_parent() callback accordingly.
--- drivers/phy/cadence/phy-cadence-sierra.c | 31 ++++++++++++++++++++---- 1 file changed, 26 insertions(+), 5 deletions(-)
drivers/phy/cadence/phy-cadence-sierra.c +26 -5
@@ -215,7 +215,10 @@ static const int pll_mux_parent_index[][SIERRA_NUM_CMN_PLLC_PARENTS] = { [CMN_PLLLC1] = { PLL1_REFCLK, PLL0_REFCLK }, }; -static u32 cdns_sierra_pll_mux_table[] = {0 ,1 }; +static u32 cdns_sierra_pll_mux_table[][SIERRA_NUM_CMN_PLLC_PARENTS ] = { + [CMN_PLLLC ] = {0 ,1 }, + [CMN_PLLLC1 ] = {1 ,0 }, +};struct cdns_sierra_inst {struct phy *phy;
@@ -436,11 +439,25 @@ static const struct phy_ops ops = {static u8 cdns_sierra_pll_mux_get_parent (struct clk_hw *hw) {struct cdns_sierra_pll_mux *mux =to_cdns_sierra_pll_mux (hw); +struct regmap_field *plllc1en_field = mux->plllc1en_field; +struct regmap_field *termen_field = mux->termen_field;struct regmap_field *field = mux->pfdclk_sel_preg;unsigned int val; +int index;regmap_field_read (field, &val); -return clk_mux_val_to_index (hw, cdns_sierra_pll_mux_table,0 , val); + +if (strstr (clk_hw_get_name (hw), clk_names[CDNS_SIERRA_PLL_CMNLC1 ])) { + index =clk_mux_val_to_index (hw, cdns_sierra_pll_mux_table[CMN_PLLLC1 ],0 , val); +if (index ==1 ) { +regmap_field_write (plllc1en_field,1 ); +regmap_field_write (termen_field,1 ); + } + }else { + index =clk_mux_val_to_index (hw, cdns_sierra_pll_mux_table[CMN_PLLLC ],0 , val); + } + +return index; }static int cdns_sierra_pll_mux_set_parent (struct clk_hw *hw,u8 index)
@@ -458,7 +475,11 @@ static int cdns_sierra_pll_mux_set_parent(struct clk_hw *hw, u8 index) ret |=regmap_field_write (termen_field,1 ); } - val = cdns_sierra_pll_mux_table[index]; +if (strstr (clk_hw_get_name (hw), clk_names[CDNS_SIERRA_PLL_CMNLC1 ])) + val = cdns_sierra_pll_mux_table[CMN_PLLLC1 ][index]; +else + val = cdns_sierra_pll_mux_table[CMN_PLLLC ][index]; + ret |=regmap_field_write (field, val);return ret;
@@ -496,8 +517,8 @@ static int cdns_sierra_pll_mux_register(struct cdns_sierra_phy *sp,for (i =0 ; i < num_parents; i++) { clk = sp->input_clks[pll_mux_parent_index[clk_index][i]];if (IS_ERR_OR_NULL (clk)) { -dev_err (dev,"No parent clock for derived_refclk\n" ); -return PTR_ERR (clk); +dev_err (dev,"No parent clock for PLL mux clocks\n" ); +return IS_ERR (clk) ?PTR_ERR (clk) : -ENOENT ; } parent_names[i] =__clk_get_name (clk); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 510/1039 iio: chemical: sunrise_co2: set val parameter only on success
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
[ Upstream commit 38ac2f038666521f94d4fa37b5a9441cef832ccf ]
Clang static analysis reports this representative warning
sunrise_co2.c:410:9: warning: Assigned value is garbage or undefined
*val = value;
^ ~~~~~The ealier call to sunrise_read_word can fail without setting value. So defer setting val until we know the read was successful.
--- drivers/iio/chemical/sunrise_co2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/chemical/sunrise_co2.c +2 -2
@@ -407,24 +407,24 @@ static int sunrise_read_raw(struct iio_dev *iio_dev,mutex_lock (&sunrise->lock); ret =sunrise_read_word (sunrise,SUNRISE_CO2_FILTERED_COMP_REG , &value); - *val = value;mutex_unlock (&sunrise->lock);if (ret)return ret; + *val = value;return IIO_VAL_INT ;case IIO_TEMP :mutex_lock (&sunrise->lock); ret =sunrise_read_word (sunrise,SUNRISE_CHIP_TEMPERATURE_REG , &value); - *val = value;mutex_unlock (&sunrise->lock);if (ret)return ret; + *val = value;return IIO_VAL_INT ;default :
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 511/1039 ASoC: samsung: idma: Check of ioremap return value
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 3ecb46755eb85456b459a1a9f952c52986bce8ec ]
Because of the potential failure of the ioremap(), the buf->area could be NULL.
Therefore, we need to check it and return -ENOMEM in order to transfer the error.
--- sound/soc/samsung/idma.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/samsung/idma.c +2 -0
@@ -360,6 +360,8 @@ static int preallocate_idma_buffer(struct snd_pcm *pcm, int stream) buf->addr = idma.lp_tx_addr; buf->bytes = idma_hardware.buffer_bytes_max; buf->area = (unsigned char *__force )ioremap (buf->addr, buf->bytes); +if (!buf->area) +return -ENOMEM ;return 0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 512/1039 misc: lattice-ecp3-config: Fix task hung when firmware load failed
In reply to Greg Kroah-HartmanFrom: Wei Yongjun <[email protected]>
[ Upstream commit fcee5ce50bdb21116711e38635e3865594af907e ]
When firmware load failed, kernel report task hung as follows:
INFO: task xrun:5191 blocked for more than 147 seconds.
Tainted: G W 5.16.0-rc5-next-20211220+ #11
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:xrun state:D stack: 0 pid: 5191 ppid: 270 flags:0x00000004
Call Trace:
__schedule+0xc12/0x4b50 kernel/sched/core.c:4986
schedule+0xd7/0x260 kernel/sched/core.c:6369 (discriminator 1)
schedule_timeout+0x7aa/0xa80 kernel/time/timer.c:1857
wait_for_completion+0x181/0x290 kernel/sched/completion.c:85
lattice_ecp3_remove+0x32/0x40 drivers/misc/lattice-ecp3-config.c:221
spi_remove+0x72/0xb0 drivers/spi/spi.c:409lattice_ecp3_remove() wait for signals from firmware loading, but when load failed, firmware_load() does not send this signal. This cause device remove hung. Fix it by sending signal even if load failed.
--- drivers/misc/lattice-ecp3-config.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/misc/lattice-ecp3-config.c +6 -6
@@ -76,12 +76,12 @@ static void firmware_load(const struct firmware *fw, void *context)if (fw ==NULL ) {dev_err (&spi->dev,"Cannot load firmware, aborting\n" ); -return ; + goto out; }if (fw->size ==0 ) {dev_err (&spi->dev,"Error: Firmware size is 0!\n" ); -return ; + goto out; }/* Fill dummy data (24 stuffing bits for commands) */
@@ -103,7 +103,7 @@ static void firmware_load(const struct firmware *fw, void *context)dev_err (&spi->dev,"Error: No supported FPGA detected (JEDEC_ID=%08x)!\n" , jedec_id); -return ; + goto out; }dev_info (&spi->dev,"FPGA %s detected\n" , ecp3_dev[i].name);
@@ -116,7 +116,7 @@ static void firmware_load(const struct firmware *fw, void *context) buffer =kzalloc (fw->size +8 ,GFP_KERNEL );if (!buffer) {dev_err (&spi->dev,"Error: Can't allocate memory!\n" ); -return ; + goto out; }/*
@@ -155,7 +155,7 @@ static void firmware_load(const struct firmware *fw, void *context)"Error: Timeout waiting for FPGA to clear (status=%08x)!\n" , status);kfree (buffer); -return ; + goto out; }dev_info (&spi->dev,"Configuring the FPGA...\n" );
@@ -181,7 +181,7 @@ static void firmware_load(const struct firmware *fw, void *context)release_firmware (fw);kfree (buffer); - +out:complete (&data->fw_loaded); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 513/1039 ASoC: mediatek: mt8195: correct pcmif BE dai control flow
In reply to Greg Kroah-HartmanFrom: Trevor Wu <[email protected]>
[ Upstream commit 2355028c0c54c03afb66c589347f1dc9f6fe2e38 ]
Originally, the conditions for preventing reentry are not correct. dai->component->active is not the state specifically for pcmif dai, so it is not a correct condition to indicate the status of pcmif dai. On the other hand, snd_soc_dai_stream_actvie() in prepare ops for both playback and capture possibly return true at the first entry when these two streams are opened at the same time.
In the patch, I refer to the implementation in mt8192-dai-pcm.c. Clock and enabling bit for PCMIF are managed by DAPM, and the condition for prepare ops is replaced by the status of dai widget.
--- sound/soc/mediatek/mt8195/mt8195-dai-pcm.c | 73 +++++++--------------- sound/soc/mediatek/mt8195/mt8195-reg.h | 1 + 2 files changed, 22 insertions(+), 52 deletions(-)
sound/soc/mediatek/mt8195/mt8195-dai-pcm.c +21 -52
@@ -80,8 +80,15 @@ static const struct snd_soc_dapm_widget mtk_dai_pcm_widgets[] = { mtk_dai_pcm_o001_mix, ARRAY_SIZE(mtk_dai_pcm_o001_mix)), +SND_SOC_DAPM_SUPPLY ("PCM_EN" ,PCM_INTF_CON1 , +PCM_INTF_CON1_PCM_EN_SHIFT ,0 ,NULL ,0 ), +SND_SOC_DAPM_INPUT ("PCM1_INPUT" ),SND_SOC_DAPM_OUTPUT ("PCM1_OUTPUT" ), + +SND_SOC_DAPM_CLOCK_SUPPLY ("aud_asrc11" ), +SND_SOC_DAPM_CLOCK_SUPPLY ("aud_asrc12" ), + SND_SOC_DAPM_CLOCK_SUPPLY("aud_pcmif"), }; static const struct snd_soc_dapm_route mtk_dai_pcm_routes[] = {
@@ -97,22 +104,18 @@ static const struct snd_soc_dapm_route mtk_dai_pcm_routes[] = { {"PCM1 Playback", NULL, "O000"}, {"PCM1 Playback", NULL, "O001"}, + {"PCM1 Playback", NULL, "PCM_EN"}, + {"PCM1 Playback", NULL, "aud_asrc12"}, + {"PCM1 Playback", NULL, "aud_pcmif"}, + + {"PCM1 Capture", NULL, "PCM_EN"}, + {"PCM1 Capture", NULL, "aud_asrc11"}, + {"PCM1 Capture", NULL, "aud_pcmif"}, + {"PCM1_OUTPUT", NULL, "PCM1 Playback"}, {"PCM1 Capture", NULL, "PCM1_INPUT"}, }; -static void mtk_dai_pcm_enable (struct mtk_base_afe *afe) -{ -regmap_update_bits (afe->regmap,PCM_INTF_CON1 , -PCM_INTF_CON1_PCM_EN ,PCM_INTF_CON1_PCM_EN ); -} - -static void mtk_dai_pcm_disable (struct mtk_base_afe *afe) -{ -regmap_update_bits (afe->regmap,PCM_INTF_CON1 , -PCM_INTF_CON1_PCM_EN ,0x0 ); -} -static int mtk_dai_pcm_configure (struct snd_pcm_substream *substream,struct snd_soc_dai *dai) {
@@ -207,54 +210,22 @@ static int mtk_dai_pcm_configure(struct snd_pcm_substream *substream, }/* dai ops */ -static int mtk_dai_pcm_startup (struct snd_pcm_substream *substream, -struct snd_soc_dai *dai) -{ -struct mtk_base_afe *afe =snd_soc_dai_get_drvdata (dai); -struct mt8195_afe_private *afe_priv = afe->platform_priv; - -if (dai->component->active) -return 0 ; - -mt8195_afe_enable_clk (afe, afe_priv->clk[MT8195_CLK_AUD_ASRC11 ]); -mt8195_afe_enable_clk (afe, afe_priv->clk[MT8195_CLK_AUD_ASRC12 ]); -mt8195_afe_enable_clk (afe, afe_priv->clk[MT8195_CLK_AUD_PCMIF ]); - -return 0 ; -} - -static void mtk_dai_pcm_shutdown (struct snd_pcm_substream *substream, -struct snd_soc_dai *dai) -{ -struct mtk_base_afe *afe =snd_soc_dai_get_drvdata (dai); -struct mt8195_afe_private *afe_priv = afe->platform_priv; - -if (dai->component->active) -return ; - -mtk_dai_pcm_disable (afe); - -mt8195_afe_disable_clk (afe, afe_priv->clk[MT8195_CLK_AUD_PCMIF ]); -mt8195_afe_disable_clk (afe, afe_priv->clk[MT8195_CLK_AUD_ASRC12 ]); -mt8195_afe_disable_clk (afe, afe_priv->clk[MT8195_CLK_AUD_ASRC11 ]); -} -static int mtk_dai_pcm_prepare (struct snd_pcm_substream *substream,struct snd_soc_dai *dai) { -struct mtk_base_afe *afe =snd_soc_dai_get_drvdata (dai); -int ret =0 ; +int ret; -if (snd_soc_dai_stream_active (dai,SNDRV_PCM_STREAM_PLAYBACK ) && -snd_soc_dai_stream_active (dai,SNDRV_PCM_STREAM_CAPTURE )) +dev_dbg (dai->dev,"%s(), id %d, stream %d, widget active p %d, c %d\n" , + __func__, dai->id, substream->stream, + dai->playback_widget->active, dai->capture_widget->active); + +if (dai->playback_widget->active || dai->capture_widget->active)return 0 ; ret =mtk_dai_pcm_configure (substream, dai);if (ret)return ret; -mtk_dai_pcm_enable (afe); -return 0 ; }
@@ -316,8 +287,6 @@ static int mtk_dai_pcm_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) }static const struct snd_soc_dai_ops mtk_dai_pcm_ops = { - .startup = mtk_dai_pcm_startup, - .shutdown = mtk_dai_pcm_shutdown, .prepare = mtk_dai_pcm_prepare, .set_fmt = mtk_dai_pcm_set_fmt, };
sound/soc/mediatek/mt8195/mt8195-reg.h +1 -0
@@ -2550,6 +2550,7 @@#define PCM_INTF_CON1_PCM_FMT (x) (((x) & 0x3) << 1)#define PCM_INTF_CON1_PCM_FMT_MASK (0x3 << 1)#define PCM_INTF_CON1_PCM_EN BIT(0) +#define PCM_INTF_CON1_PCM_EN_SHIFT 0/* PCM_INTF_CON2 */ #define PCM_INTF_CON2_CLK_DOMAIN_SEL (x) (((x) & 0x3) << 23)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 514/1039 arm64: tegra: Remove non existent Tegra194 reset
In reply to Greg Kroah-HartmanFrom: Sameer Pujar <[email protected]>
[ Upstream commit 146b3a77af8091cabbd1decc51d67799e69682d2 ]
Tegra194 does not really have "hda2codec_2x" related reset. Hence drop this entry to reflect actual HW.
--- arch/arm64/boot/dts/nvidia/tegra194.dtsi | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/nvidia/tegra194.dtsi +2 -3
@@ -976,9 +976,8 @@ <&bpmp TEGRA194_CLK_HDA2CODEC_2X>; clock-names = "hda", "hda2hdmi", "hda2codec_2x"; resets = <&bpmp TEGRA194_RESET_HDA>, - <&bpmp TEGRA194_RESET_HDA2HDMICODEC>, - <&bpmp TEGRA194_RESET_HDA2CODEC_2X>; - reset-names = "hda", "hda2hdmi", "hda2codec_2x"; + <&bpmp TEGRA194_RESET_HDA2HDMICODEC>; + reset-names = "hda", "hda2hdmi"; power-domains = <&bpmp TEGRA194_POWER_DOMAIN_DISP>; interconnects = <&mc TEGRA194_MEMORY_CLIENT_HDAR &emc>, <&mc TEGRA194_MEMORY_CLIENT_HDAW &emc>;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 515/1039 mips: lantiq: add support for clk_set_parent()
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 76f66dfd60dc5d2f9dec22d99091fea1035c5d03 ]
Provide a simple implementation of clk_set_parent() in the lantiq subarch so that callers of it will build without errors.
Fixes these build errors:
ERROR: modpost: "clk_set_parent" [sound/soc/jz4740/snd-soc-jz4740-i2s.ko] undefined!
ERROR: modpost: "clk_set_parent" [sound/soc/atmel/snd-soc-atmel-i2s.ko] undefined!
[email protected] --cc="John Crispin <[email protected]>" --cc="Jonathan Cameron <[email protected]>" --cc="Russell King <[email protected]>" --cc="Andy Shevchenko <[email protected]>" [email protected] --to="Thomas Bogendoerfer <[email protected]>"
--- arch/mips/lantiq/clk.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/mips/lantiq/clk.c +6 -0
@@ -164,6 +164,12 @@ struct clk *clk_get_parent(struct clk *clk) }EXPORT_SYMBOL (clk_get_parent); +int clk_set_parent (struct clk *clk,struct clk *parent) +{ +return 0 ; +} +EXPORT_SYMBOL (clk_set_parent); +static inline u32 get_counter_resolution (void ) {u32 res;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 516/1039 mips: bcm63xx: add support for clk_set_parent()
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 6f03055d508ff4feb8db02ba3df9303a1db8d381 ]
The MIPS BMC63XX subarch does not provide/support clk_set_parent(). This causes build errors in a few drivers, so add a simple implementation of that function so that callers of it will build without errors.
Fixes these build errors:
ERROR: modpost: "clk_set_parent" [sound/soc/jz4740/snd-soc-jz4740-i2s.ko] undefined!
ERROR: modpost: "clk_set_parent" [sound/soc/atmel/snd-soc-atmel-i2s.ko] undefined!
--- arch/mips/bcm63xx/clk.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/mips/bcm63xx/clk.c +6 -0
@@ -387,6 +387,12 @@ struct clk *clk_get_parent(struct clk *clk) }EXPORT_SYMBOL (clk_get_parent); +int clk_set_parent (struct clk *clk,struct clk *parent) +{ +return 0 ; +} +EXPORT_SYMBOL (clk_set_parent); +unsigned long clk_get_rate (struct clk *clk) {if (!clk)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 517/1039 powerpc/xive: Add missing null check after calling kmalloc
In reply to Greg Kroah-HartmanFrom: Ammar Faizi <[email protected]>
[ Upstream commit 18dbfcdedc802f9500b2c29794f22a31d27639c0 ]
Commit 930914b7d528fc ("powerpc/xive: Add a debugfs file to dump internal XIVE state") forgot to add a null check.
Add it.
--- arch/powerpc/sysdev/xive/spapr.c | 3 +++ 1 file changed, 3 insertions(+)
arch/powerpc/sysdev/xive/spapr.c +3 -0
@@ -653,6 +653,9 @@ static int xive_spapr_debug_show(struct seq_file *m, void *private)struct xive_irq_bitmap *xibm;char *buf =kmalloc (PAGE_SIZE ,GFP_KERNEL ); +if (!buf) +return -ENOMEM ; +list_for_each_entry (xibm, &xive_irq_bitmaps, list) {memset (buf,0 ,PAGE_SIZE );bitmap_print_to_pagebuf (true, buf, xibm->bitmap, xibm->count);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 518/1039 ASoC: fsl_mqs: fix MODULE_ALIAS
In reply to Greg Kroah-HartmanFrom: Alyssa Ross <[email protected]>
[ Upstream commit 9f3d45318dd9e739ed62e4218839a7a824d3cced ]
modprobe can't handle spaces in aliases.
--- sound/soc/fsl/fsl_mqs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/fsl/fsl_mqs.c +1 -1
@@ -337,4 +337,4 @@ module_platform_driver(fsl_mqs_driver);MODULE_AUTHOR ("Shengjiu Wang <[email protected]>" );MODULE_DESCRIPTION ("MQS codec driver" );MODULE_LICENSE ("GPL v2" ); -MODULE_ALIAS ("platform: fsl-mqs" ); +MODULE_ALIAS ("platform:fsl-mqs" );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 519/1039 ALSA: hda/cs8409: Increase delay during jack detection
In reply to Greg Kroah-HartmanFrom: Christian A. Ehrhardt <[email protected]>
[ Upstream commit 8cd07657177006b67cc1610e4466cc75ad781c05 ]
Commit c8b4f0865e82 reduced delays related to cs42l42 jack detection. However, the change was too aggressive. As a result internal speakers on DELL Inspirion 3501 are not detected.
Increase the delay in cs42l42_run_jack_detect() a bit.
--- sound/pci/hda/patch_cs8409.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/hda/patch_cs8409.c +2 -2
@@ -628,8 +628,8 @@ static void cs42l42_run_jack_detect(struct sub_codec *cs42l42)cs8409_i2c_write (cs42l42,0x1b74 ,0x07 );cs8409_i2c_write (cs42l42,0x131b ,0xFD );cs8409_i2c_write (cs42l42,0x1120 ,0x80 ); -/* Wait ~100us*/ -usleep_range (100 ,200 ); +/* Wait ~20ms*/ +usleep_range (20000 ,25000 );cs8409_i2c_write (cs42l42,0x111f ,0x77 );cs8409_i2c_write (cs42l42,0x1120 ,0xc0 ); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 520/1039 ALSA: hda/cs8409: Fix Jack detection after resume
In reply to Greg Kroah-HartmanFrom: Christian A. Ehrhardt <[email protected]>
[ Upstream commit 57f234248ff925d88caedf4019ec84e6ecb83909 ]
The suspend code unconditionally sets ->hp_jack_in and ->mic_jack_in to zero but without reporting this status change to the HDA core. To compensate for this, always assume a status change on the first unsol event after boot or resume.
--- sound/pci/hda/patch_cs8409-tables.c | 3 +++ sound/pci/hda/patch_cs8409.c | 5 ++++- sound/pci/hda/patch_cs8409.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-)
sound/pci/hda/patch_cs8409-tables.c +3 -0
@@ -252,6 +252,7 @@ struct sub_codec cs8409_cs42l42_codec = { .init_seq_num = ARRAY_SIZE(cs42l42_init_reg_seq), .hp_jack_in = 0, .mic_jack_in = 0, + .force_status_change = 1, .paged = 1, .suspended = 1, .no_type_dect = 0,
@@ -443,6 +444,7 @@ struct sub_codec dolphin_cs42l42_0 = { .init_seq_num = ARRAY_SIZE(dolphin_c0_init_reg_seq), .hp_jack_in = 0, .mic_jack_in = 0, + .force_status_change = 1, .paged = 1, .suspended = 1, .no_type_dect = 0,
@@ -456,6 +458,7 @@ struct sub_codec dolphin_cs42l42_1 = { .init_seq_num = ARRAY_SIZE(dolphin_c1_init_reg_seq), .hp_jack_in = 0, .mic_jack_in = 0, + .force_status_change = 1, .paged = 1, .suspended = 1, .no_type_dect = 1,
sound/pci/hda/patch_cs8409.c +4 -1
@@ -636,7 +636,9 @@ static void cs42l42_run_jack_detect(struct sub_codec *cs42l42)static int cs42l42_handle_tip_sense (struct sub_codec *cs42l42,unsigned int reg_ts_status) { -int status_changed =0 ; +int status_changed = cs42l42->force_status_change; + + cs42l42->force_status_change =0 ;/* TIP_SENSE INSERT/REMOVE */ switch (reg_ts_status) {
@@ -791,6 +793,7 @@ static void cs42l42_suspend(struct sub_codec *cs42l42) cs42l42->last_page =0 ; cs42l42->hp_jack_in =0 ; cs42l42->mic_jack_in =0 ; + cs42l42->force_status_change =1 ;/* Put CS42L42 into Reset */ gpio_data =snd_hda_codec_read (codec,CS8409_PIN_AFG ,0 ,AC_VERB_GET_GPIO_DATA ,0 );
sound/pci/hda/patch_cs8409.h +1 -0
@@ -305,6 +305,7 @@ struct sub_codec { unsigned int hp_jack_in:1; unsigned int mic_jack_in:1; + unsigned int force_status_change:1; unsigned int suspended:1; unsigned int paged:1;unsigned int last_page;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 521/1039 cxl/core: Remove cxld_const_init in cxl_decoder_alloc()
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit be185c2988b48db65348d94168c793bdbc8d23c3 ]
Commit 48667f676189 ("cxl/core: Split decoder setup into alloc + add") aimed to fix a large stack frame warning but from v5 to v6, it introduced a new instance of the warning due to allocating cxld_const_init on the stack, which was done due to the use of const on the nr_target member of the cxl_decoder struct. With ARCH=arm allmodconfig minus CONFIG_KASAN:
GCC 11.2.0:
drivers/cxl/core/bus.c: In function ‘cxl_decoder_alloc’:drivers/cxl/core/bus.c:523:1: error: the frame size of 1032 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
523 | }
| ^
cc1: all warnings being treated as errors
Clang 12.0.1:
drivers/cxl/core/bus.c:486:21: error: stack frame size of 1056 bytes in function 'cxl_decoder_alloc' [-Werror,-Wframe-larger-than=] struct cxl_decoder *cxl_decoder_alloc(struct cxl_port *port, int nr_targets)
^
1 error generated.
Revert that part of the change, which makes the stack frame of cxl_decoder_alloc() much more reasonable.
--- drivers/cxl/core/bus.c | 6 ++---- drivers/cxl/cxl.h | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-)
drivers/cxl/core/bus.c +2 -4
@@ -485,9 +485,7 @@ out_unlock:struct cxl_decoder *cxl_decoder_alloc (struct cxl_port *port,int nr_targets) { -struct cxl_decoder *cxld, cxld_const_init = { - .nr_targets = nr_targets, - }; +struct cxl_decoder *cxld;struct device *dev;int rc =0 ;
@@ -497,13 +495,13 @@ struct cxl_decoder *cxl_decoder_alloc(struct cxl_port *port, int nr_targets) cxld =kzalloc (struct_size (cxld, target, nr_targets),GFP_KERNEL );if (!cxld)return ERR_PTR (-ENOMEM ); -memcpy (cxld, &cxld_const_init,sizeof (cxld_const_init)); rc =ida_alloc (&port->decoder_ida,GFP_KERNEL );if (rc <0 ) goto err; cxld->id = rc; + cxld->nr_targets = nr_targets; dev = &cxld->dev;device_initialize (dev);device_set_pm_not_required (dev);
drivers/cxl/cxl.h +1 -1
@@ -191,7 +191,7 @@ struct cxl_decoder {int interleave_granularity;enum cxl_decoder_type target_type;unsigned long flags; -const int nr_targets; +int nr_targets;struct cxl_dport *target[]; };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 522/1039 MIPS: fix local_{add,sub}_return on MIPS64
In reply to Greg Kroah-HartmanFrom: Huang Pei <[email protected]>
[ Upstream commit 277c8cb3e8ac199f075bf9576ad286687ed17173 ]
Use "daddu/dsubu" for long int on MIPS64 instead of "addu/subu"
--- arch/mips/include/asm/local.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
arch/mips/include/asm/local.h +5 -4
@@ -5,6 +5,7 @@#include <linux/percpu.h> #include <linux/bitops.h> #include <linux/atomic.h> +#include <asm/asm.h> #include <asm/cmpxchg.h> #include <asm/compiler.h> #include <asm/war.h>
@@ -39,7 +40,7 @@ static __inline__ long local_add_return(long i, local_t * l)" .set arch=r4000 \n" __SYNC(full, loongson3_war) " \n""1:" __LL"%1, %2 # local_add_return \n" -" addu %0, %1, %3 \n" + __stringify(LONG_ADDU) " %0, %1, %3 \n" __SC"%0, %2 \n" " beqzl %0, 1b \n" " addu %0, %1, %3 \n"
@@ -55,7 +56,7 @@ static __inline__ long local_add_return(long i, local_t * l)" .set " MIPS_ISA_ARCH_LEVEL " \n" __SYNC(full, loongson3_war) " \n""1:" __LL"%1, %2 # local_add_return \n" -" addu %0, %1, %3 \n" + __stringify(LONG_ADDU) " %0, %1, %3 \n" __SC"%0, %2 \n" " beqz %0, 1b \n" " addu %0, %1, %3 \n"
@@ -88,7 +89,7 @@ static __inline__ long local_sub_return(long i, local_t * l)" .set arch=r4000 \n" __SYNC(full, loongson3_war) " \n""1:" __LL"%1, %2 # local_sub_return \n" -" subu %0, %1, %3 \n" + __stringify(LONG_SUBU) " %0, %1, %3 \n" __SC"%0, %2 \n" " beqzl %0, 1b \n" " subu %0, %1, %3 \n"
@@ -104,7 +105,7 @@ static __inline__ long local_sub_return(long i, local_t * l)" .set " MIPS_ISA_ARCH_LEVEL " \n" __SYNC(full, loongson3_war) " \n""1:" __LL"%1, %2 # local_sub_return \n" -" subu %0, %1, %3 \n" + __stringify(LONG_SUBU) " %0, %1, %3 \n" __SC"%0, %2 \n" " beqz %0, 1b \n" " subu %0, %1, %3 \n"
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 523/1039 RDMA/cxgb4: Set queue pair state when being queried
In reply to Greg Kroah-HartmanFrom: Kamal Heib <[email protected]>
[ Upstream commit e375b9c92985e409c4bb95dd43d34915ea7f5e28 ]
The API for ib_query_qp requires the driver to set cur_qp_state on return, add the missing set.
--- drivers/infiniband/hw/cxgb4/qp.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/cxgb4/qp.c +1 -0
@@ -2460,6 +2460,7 @@ int c4iw_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,memset (attr,0 ,sizeof (*attr));memset (init_attr,0 ,sizeof (*init_attr)); attr->qp_state =to_ib_qp_state (qhp->attr.state); + attr->cur_qp_state =to_ib_qp_state (qhp->attr.state); init_attr->cap.max_send_wr = qhp->attr.sq_num_entries; init_attr->cap.max_recv_wr = qhp->attr.rq_num_entries; init_attr->cap.max_send_sge = qhp->attr.sq_max_sges;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 524/1039 clk: qcom: gcc-sc7280: Mark gcc_cfg_noc_lpass_clk always enabled
In reply to Greg Kroah-HartmanFrom: Taniya Das <[email protected]>
[ Upstream commit 9c337073d9d81a145434b22f42dc3128ecd17730 ]
The gcc cfg noc lpass clock is required to be always enabled for the LPASS core and audio drivers to be functional.
--- drivers/clk/qcom/gcc-sc7280.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/gcc-sc7280.c +1 -1
@@ -2917,7 +2917,7 @@ static struct clk_branch gcc_cfg_noc_lpass_clk = { .enable_mask = BIT(0), .hw.init = &(struct clk_init_data ){ .name ="gcc_cfg_noc_lpass_clk" , - .ops = &clk_branch2_ops, + .ops = &clk_branch2_aon_ops, }, }, };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 525/1039 ASoC: imx-card: Need special setting for ak4497 on i.MX8MQ
In reply to Greg Kroah-HartmanFrom: Shengjiu Wang <[email protected]>
[ Upstream commit 3349b3d0c63b8b6fcca58156d72407f0b2e101ac ]
The SAI on i.MX8MQ don't support one2one ratio for mclk:bclk, so the mclk frequency exceeds the supported range of codec for the case that sample rate is larger than 705kHZ and format is S32_LE. Update the supported width for such case.
--- sound/soc/fsl/imx-card.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
sound/soc/fsl/imx-card.c +16 -1
@@ -553,8 +553,23 @@ static int imx_card_parse_of(struct imx_card_data *data) link_data->cpu_sysclk_id =FSL_SAI_CLK_MAST1 ;/* sai may support mclk/bclk = 1 */ -if (of_find_property (np,"fsl,mclk-equal-bclk" ,NULL )) +if (of_find_property (np,"fsl,mclk-equal-bclk" ,NULL )) { link_data->one2one_ratio = true; + }else { +int i; + +/* +* i.MX8MQ don't support one2one ratio, then +* with ak4497 only 16bit case is supported. +*/ +for (i =0 ; i <ARRAY_SIZE (ak4497_fs_mul); i++) { +if (ak4497_fs_mul[i].rmin ==705600 && + ak4497_fs_mul[i].rmax ==768000 ) { + ak4497_fs_mul[i].wmin =32 ; + ak4497_fs_mul[i].wmax =32 ; + } + } + } } link->cpus->of_node = args.np;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 526/1039 ASoC: imx-card: Fix mclk calculation issue for akcodec
In reply to Greg Kroah-HartmanFrom: Shengjiu Wang <[email protected]>
[ Upstream commit f331ae5fa59fbfb748317b290648fc3f1a50d932 ]
Transfer the refined slots and slot_width to akcodec_get_mclk_rate() for mclk calculation, otherwise the mclk frequency does not match with the slots and slot_width for S16_LE format, because the default slot_width is 32.
--- sound/soc/fsl/imx-card.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
sound/soc/fsl/imx-card.c +4 -3
@@ -247,13 +247,14 @@ static bool codec_is_akcodec(unsigned int type) }static unsigned long akcodec_get_mclk_rate (struct snd_pcm_substream *substream, -struct snd_pcm_hw_params *params) +struct snd_pcm_hw_params *params, +int slots,int slot_width) {struct snd_soc_pcm_runtime *rtd = substream->private_data;struct imx_card_data *data =snd_soc_card_get_drvdata (rtd->card);const struct imx_card_plat_data *plat_data = data->plat_data;struct dai_link_data *link_data = &data->link_data[rtd->num]; -unsigned int width = link_data->slots * link_data->slot_width; +unsigned int width = slots * slot_width;unsigned int rate =params_rate (params);int i;
@@ -349,7 +350,7 @@ static int imx_aif_hw_params(struct snd_pcm_substream *substream,/* Set MCLK freq */ if (codec_is_akcodec (plat_data->type)) - mclk_freq =akcodec_get_mclk_rate (substream, params); + mclk_freq =akcodec_get_mclk_rate (substream, params, slots, slot_width);else mclk_freq =params_rate (params) * slots * slot_width;/* Use the maximum freq from DSD512 (512*44100 = 22579200) */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 527/1039 ASoC: imx-card: improve the sound quality for low rate
In reply to Greg Kroah-HartmanFrom: Shengjiu Wang <[email protected]>
[ Upstream commit 3969341813eb56d2dfc39bb64229359a6ae3c195 ]
According to RM, on auto mode:
For codec AK4458 and AK4497, the lowest ratio of MLCK/FS is 256 if sample rate is 8kHz-48kHz,
For codec AK5558, the lowest ratio of MLCK/FS is 512 if sample rate is 8kHz-48kHz.
With these setting the sound quality for 8kHz-48kHz can be improved.
--- sound/soc/fsl/imx-card.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/soc/fsl/imx-card.c +4 -4
@@ -120,7 +120,7 @@ struct imx_card_data {static struct imx_akcodec_fs_mul ak4458_fs_mul[] = {/* Normal, < 32kHz */ - { .rmin =8000 , .rmax =24000 , .wmin =1024 , .wmax =1024 , }, + { .rmin =8000 , .rmax =24000 , .wmin =256 , .wmax =1024 , },/* Normal, 32kHz */ { .rmin =32000 , .rmax =32000 , .wmin =256 , .wmax =1024 , },/* Normal */
@@ -151,8 +151,8 @@ static struct imx_akcodec_fs_mul ak4497_fs_mul[] = {* Table 7 - mapping multiplier and speed mode * Tables 8 & 9 - mapping speed mode and LRCK fs */ - { .rmin = 8000, .rmax = 32000, .wmin = 1024, .wmax = 1024, }, /* Normal, <= 32kHz */ - { .rmin = 44100, .rmax = 48000, .wmin = 512, .wmax = 512, }, /* Normal */ + { .rmin = 8000, .rmax = 32000, .wmin = 256, .wmax = 1024, }, /* Normal, <= 32kHz */ + { .rmin = 44100, .rmax = 48000, .wmin = 256, .wmax = 512, }, /* Normal */ { .rmin = 88200, .rmax = 96000, .wmin = 256, .wmax = 256, }, /* Double */ { .rmin = 176400, .rmax = 192000, .wmin = 128, .wmax = 128, }, /* Quad */ { .rmin = 352800, .rmax = 384000, .wmin = 128, .wmax = 128, }, /* Oct */
@@ -164,7 +164,7 @@ static struct imx_akcodec_fs_mul ak4497_fs_mul[] = {* (Table 4 from datasheet) */ static struct imx_akcodec_fs_mul ak5558_fs_mul[] = { - { .rmin =8000 , .rmax =32000 , .wmin =1024 , .wmax =1024 , }, + { .rmin =8000 , .rmax =32000 , .wmin =512 , .wmax =1024 , }, { .rmin =44100 , .rmax =48000 , .wmin =512 , .wmax =512 , }, { .rmin =88200 , .rmax =96000 , .wmin =256 , .wmax =256 , }, { .rmin =176400 , .rmax =192000 , .wmin =128 , .wmax =128 , },
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 528/1039 ASoC: fsl_asrc: refine the check of available clock divider
In reply to Greg Kroah-HartmanFrom: Shengjiu Wang <[email protected]>
[ Upstream commit 320386343451ab6a3577e0ee200dac56a6182944 ]
According to RM, the clock divider range is from 1 to 8, clock prescaling ratio may be any power of 2 from 1 to 128. So the supported divider is not all the value between 1 and 1024, just limited value in that range.
Create table for the supported divder and add function to check the clock divider is available by comparing with the table.
--- sound/soc/fsl/fsl_asrc.c | 69 +++++++++++++++++++++++++++++++++------- 1 file changed, 58 insertions(+), 11 deletions(-)
sound/soc/fsl/fsl_asrc.c +58 -11
@@ -19,6 +19,7 @@#include "fsl_asrc.h" #define IDEAL_RATIO_DECIMAL_DEPTH 26 +#define DIVIDER_NUM 64#define pair_err (fmt, ...) \ dev_err(&asrc->pdev->dev, "Pair %c: " fmt, 'A' + index, ##__VA_ARGS__)
@@ -101,6 +102,55 @@ static unsigned char clk_map_imx8qxp[2][ASRC_CLK_MAP_LEN] = { }, }; +/* +* According to RM, the divider range is 1 ~ 8, +* prescaler is power of 2 from 1 ~ 128. +*/ +static int asrc_clk_divider[DIVIDER_NUM ] = { +1 ,2 ,4 ,8 ,16 ,32 ,64 ,128 ,/* divider = 1 */ +2 ,4 ,8 ,16 ,32 ,64 ,128 ,256 ,/* divider = 2 */ +3 ,6 ,12 ,24 ,48 ,96 ,192 ,384 ,/* divider = 3 */ +4 ,8 ,16 ,32 ,64 ,128 ,256 ,512 ,/* divider = 4 */ +5 ,10 ,20 ,40 ,80 ,160 ,320 ,640 ,/* divider = 5 */ +6 ,12 ,24 ,48 ,96 ,192 ,384 ,768 ,/* divider = 6 */ +7 ,14 ,28 ,56 ,112 ,224 ,448 ,896 ,/* divider = 7 */ +8 ,16 ,32 ,64 ,128 ,256 ,512 ,1024 ,/* divider = 8 */ +}; + +/* +* Check if the divider is available for internal ratio mode +*/ +static bool fsl_asrc_divider_avail (int clk_rate,int rate,int *div) +{ +u32 rem, i; +u64 n; + +if (div) + *div =0 ; + +if (clk_rate ==0 || rate ==0 ) +return false; + + n = clk_rate; + rem =do_div (n, rate); + +if (div) + *div = n; + +if (rem !=0 ) +return false; + +for (i =0 ; i <DIVIDER_NUM ; i++) { +if (n == asrc_clk_divider[i]) +break ; + } + +if (i ==DIVIDER_NUM ) +return false; + +return true; +} +/** * fsl_asrc_sel_proc - Select the pre-processing and post-processing options * @inrate: input sample rate
@@ -330,12 +380,12 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair *pair, bool use_ideal_rate)enum asrc_word_width input_word_width;enum asrc_word_width output_word_width;u32 inrate, outrate, indiv, outdiv; -u32 clk_index[2 ], div[2 ], rem[2 ]; +u32 clk_index[2 ], div[2 ];u64 clk_rate;int in, out, channels;int pre_proc, post_proc;struct clk *clk; -bool ideal; +bool ideal, div_avail;if (!config) {pair_err ("invalid pair config\n" );
@@ -415,8 +465,7 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair *pair, bool use_ideal_rate) clk = asrc_priv->asrck_clk[clk_index[ideal ?OUT :IN ]]; clk_rate =clk_get_rate (clk); - rem[IN ] =do_div (clk_rate, inrate); - div[IN ] = (u32 )clk_rate; + div_avail =fsl_asrc_divider_avail (clk_rate, inrate, &div[IN ]);/* * The divider range is [1, 1024], defined by the hardware. For non-
@@ -425,7 +474,7 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair *pair, bool use_ideal_rate)* only result in different converting speeds. So remainder does not * matter, as long as we keep the divider within its valid range. */ -if (div[IN ] ==0 || (!ideal && (div[IN ] >1024 || rem[IN ] !=0 ))) { +if (div[IN ] ==0 || (!ideal && !div_avail)) {pair_err ("failed to support input sample rate %dHz by asrck_%x\n" , inrate, clk_index[ideal ?OUT :IN ]);return -EINVAL ;
@@ -436,13 +485,12 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair *pair, bool use_ideal_rate) clk = asrc_priv->asrck_clk[clk_index[OUT ]]; clk_rate =clk_get_rate (clk);if (ideal && use_ideal_rate) - rem[OUT ] =do_div (clk_rate,IDEAL_RATIO_RATE ); + div_avail =fsl_asrc_divider_avail (clk_rate,IDEAL_RATIO_RATE , &div[OUT ]);else - rem[OUT ] =do_div (clk_rate, outrate); - div[OUT ] = clk_rate; + div_avail =fsl_asrc_divider_avail (clk_rate, outrate, &div[OUT ]);/* Output divider has the same limitation as the input one */ -if (div[OUT ] ==0 || (!ideal && (div[OUT ] >1024 || rem[OUT ] !=0 ))) { +if (div[OUT ] ==0 || (!ideal && !div_avail)) {pair_err ("failed to support output sample rate %dHz by asrck_%x\n" , outrate, clk_index[OUT ]);return -EINVAL ;
@@ -621,8 +669,7 @@ static void fsl_asrc_select_clk(struct fsl_asrc_priv *asrc_priv, clk_index = asrc_priv->clk_map[j][i]; clk_rate =clk_get_rate (asrc_priv->asrck_clk[clk_index]);/* Only match a perfect clock source with no remainder */ -if (clk_rate !=0 && (clk_rate / rate[j]) <=1024 && - (clk_rate % rate[j]) ==0 ) +if (fsl_asrc_divider_avail (clk_rate, rate[j],NULL ))break ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 529/1039 clk: bm1880: remove kfrees on static allocations
In reply to Greg Kroah-HartmanFrom: Conor Dooley <[email protected]>
[ Upstream commit c861c1be3897845313a0df47804b1db37c7052e1 ]
bm1880_clk_unregister_pll & bm1880_clk_unregister_div both try to free statically allocated variables, so remove those kfrees.
For example, if we take L703 kfree(div_hw):
- div_hw is a bm1880_div_hw_clock pointer
- in bm1880_clk_register_plls this is pointed to an element of arg1:
struct bm1880_div_hw_clock *clks
- in the probe, where bm1880_clk_register_plls is called arg1 is bm1880_div_clks, defined on L371:
static struct bm1880_div_hw_clock bm1880_div_clks[]
--- drivers/clk/clk-bm1880.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-)
drivers/clk/clk-bm1880.c +2 -18
@@ -522,14 +522,6 @@ static struct clk_hw *bm1880_clk_register_pll(struct bm1880_pll_hw_clock *pll_clreturn hw; } -static void bm1880_clk_unregister_pll (struct clk_hw *hw) -{ -struct bm1880_pll_hw_clock *pll_hw =to_bm1880_pll_clk (hw); - -clk_hw_unregister (hw); -kfree (pll_hw); -} -static int bm1880_clk_register_plls (struct bm1880_pll_hw_clock *clks,int num_clks,struct bm1880_clock_data *data)
@@ -555,7 +547,7 @@ static int bm1880_clk_register_plls(struct bm1880_pll_hw_clock *clks, err_clk:while (i--) -bm1880_clk_unregister_pll (data->hw_data.hws[clks[i].pll.id]); +clk_hw_unregister (data->hw_data.hws[clks[i].pll.id]);return PTR_ERR (hw); }
@@ -695,14 +687,6 @@ static struct clk_hw *bm1880_clk_register_div(struct bm1880_div_hw_clock *div_clreturn hw; } -static void bm1880_clk_unregister_div (struct clk_hw *hw) -{ -struct bm1880_div_hw_clock *div_hw =to_bm1880_div_clk (hw); - -clk_hw_unregister (hw); -kfree (div_hw); -} -static int bm1880_clk_register_divs (struct bm1880_div_hw_clock *clks,int num_clks,struct bm1880_clock_data *data)
@@ -729,7 +713,7 @@ static int bm1880_clk_register_divs(struct bm1880_div_hw_clock *clks, err_clk:while (i--) -bm1880_clk_unregister_div (data->hw_data.hws[clks[i].div.id]); +clk_hw_unregister (data->hw_data.hws[clks[i].div.id]);return PTR_ERR (hw); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 530/1039 of: base: Fix phandle argument length mismatch error message
In reply to Greg Kroah-HartmanFrom: Baruch Siach <[email protected]>
[ Upstream commit 94a4950a4acff39b5847cc1fee4f65e160813493 ]
The cell_count field of of_phandle_iterator is the number of cells we expect in the phandle arguments list when cells_name is missing. The error message should show the number of cells we actually see.
--- drivers/of/base.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/of/base.c +2 -2
@@ -1349,9 +1349,9 @@ int of_phandle_iterator_next(struct of_phandle_iterator *it)* property data length */ if (it->cur + count > it->list_end) { -pr_err ("%pOF: %s = %d found %d\n" , +pr_err ("%pOF: %s = %d found %td\n" , it->parent, it->cells_name, - count, it->cell_count); + count, it->list_end - it->cur); goto err; } }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 531/1039 of/fdt: Dont worry about non-memory region overlap for no-map
In reply to Greg Kroah-HartmanFrom: Stephen Boyd <[email protected]>
[ Upstream commit da17d6905d29ddcdc04b2fdc37ed8cf1e8437cc8 ]
In commit 8a5a75e5e9e5 ("of/fdt: Make sure no-map does not remove already reserved regions") we returned -EBUSY when trying to mark regions as no-map when they intersect with reserved memory. The goal was to find bad no-map reserved memory DT nodes that would unmap the kernel text/data sections.
The problem is the reserved memory check will still trigger if the DT has a /memreserve/ that completely subsumes the no-map memory carveouts in the reserved memory node _and_ that region is also not part of the memory reg property. For example in sc7180.dtsi we have the following reserved-memory and memory node:
memory@80000000 {
/* We expect the bootloader to fill in the size */
reg = <0 0x80000000 0 0>;
};
smem_mem: memory@80900000 {
reg = <0x0 0x80900000 0x0 0x200000>;
no-map;
};and the memreserve filled in by the bootloader is
/memreserve/ 0x80800000 0x400000;
while the /memory node is transformed into
memory@80000000 {
/* The bootloader fills in the size, and adds another region */
reg = <0 0x80000000 0 0x00800000>,
<0 0x80c00000 0 0x7f200000>;
};The smem region is doubly reserved via /memreserve/ and by not being part of the /memory reg property. This leads to the following warning printed at boot.
OF: fdt: Reserved memory: failed to reserve memory for node 'memory@80900000': base 0x0000000080900000, size 2 MiB
Otherwise nothing really goes wrong because the smem region is not going to be mapped by the kernel's direct linear mapping given that it isn't part of the memory node. Therefore, let's only consider this to be a problem if we're trying to mark a region as no-map and it is actually memory that we're intending to keep out of the kernel's direct mapping but it's already been reserved.
--- drivers/of/fdt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/of/fdt.c +4 -2
@@ -482,9 +482,11 @@ static int __init early_init_dt_reserve_memory_arch(phys_addr_t base,if (nomap) {/* * If the memory is already reserved (by another region), we -* should not allow it to be marked nomap. +* should not allow it to be marked nomap, but don't worry +* if the region isn't memory as it won't be mapped. */ -if (memblock_is_region_reserved (base, size)) +if (memblock_overlaps_region (&memblock.memory, base, size) && +memblock_is_region_reserved (base, size))return -EBUSY ;return memblock_mark_nomap (base, size);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 532/1039 MIPS: compressed: Fix build with ZSTD compression
In reply to Greg Kroah-HartmanFrom: Paul Cercueil <[email protected]>
[ Upstream commit c5c7440fe7f74645940d5c9e2c49cd7efb706a4f ]
Fix the following build issues:
mips64el-linux-ld: arch/mips/boot/compressed/decompress.o: in function `FSE_buildDTable_internal':
decompress.c:(.text.FSE_buildDTable_internal+0x2cc): undefined reference to `__clzdi2'
mips64el-linux-ld: arch/mips/boot/compressed/decompress.o: in function `BIT_initDStream':
decompress.c:(.text.BIT_initDStream+0x7c): undefined reference to `__clzdi2'
mips64el-linux-ld: decompress.c:(.text.BIT_initDStream+0x158): undefined reference to `__clzdi2'
mips64el-linux-ld: arch/mips/boot/compressed/decompress.o: in function `ZSTD_buildFSETable_body_default.constprop.0':
decompress.c:(.text.ZSTD_buildFSETable_body_default.constprop.0+0x2a8): undefined reference to `__clzdi2'
mips64el-linux-ld: arch/mips/boot/compressed/decompress.o: in function `FSE_readNCount_body_default':
decompress.c:(.text.FSE_readNCount_body_default+0x130): undefined reference to `__ctzdi2'
mips64el-linux-ld: decompress.c:(.text.FSE_readNCount_body_default+0x1a4): undefined reference to `__ctzdi2'
mips64el-linux-ld: decompress.c:(.text.FSE_readNCount_body_default+0x2e4): undefined reference to `__clzdi2'
mips64el-linux-ld: arch/mips/boot/compressed/decompress.o: in function `HUF_readStats_body_default':
decompress.c:(.text.HUF_readStats_body_default+0x184): undefined reference to `__clzdi2'
mips64el-linux-ld: decompress.c:(.text.HUF_readStats_body_default+0x1b4): undefined reference to `__clzdi2'
mips64el-linux-ld: arch/mips/boot/compressed/decompress.o: in function `ZSTD_DCtx_getParameter':
decompress.c:(.text.ZSTD_DCtx_getParameter+0x60): undefined reference to `__clzdi2'
--- arch/mips/boot/compressed/Makefile | 2 +- arch/mips/boot/compressed/clz_ctz.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 arch/mips/boot/compressed/clz_ctz.c
arch/mips/boot/compressed/Makefile +1 -1
@@ -52,7 +52,7 @@ endif vmlinuzobjs-$(CONFIG_KERNEL_XZ) += $(obj)/ashldi3.o -vmlinuzobjs-$(CONFIG_KERNEL_ZSTD) += $(obj)/bswapdi.o $(obj)/ashldi3.o +vmlinuzobjs-$(CONFIG_KERNEL_ZSTD) += $(obj)/bswapdi.o $(obj)/ashldi3.o $(obj)/clz_ctz.o targets := $(notdir $(vmlinuzobjs-y))
arch/mips/boot/compressed/clz_ctz.c new file +2 -0
@@ -0,0 +1,2 @@ +// SPDX-License-Identifier: GPL-2.0-only +#include "../../../../lib/clz_ctz.c"
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 533/1039 mailbox: fix gce_num of mt8192 driver data
In reply to Greg Kroah-HartmanFrom: jason-jh.lin <[email protected]>
[ Upstream commit 35ca43710f792ce183312fdc7e4b2bb0b721a173 ]
Because mt8192 only have 1 gce, the gce_num should be 1.
--- drivers/mailbox/mtk-cmdq-mailbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mailbox/mtk-cmdq-mailbox.c +1 -1
@@ -658,7 +658,7 @@ static const struct gce_plat gce_plat_v5 = { .thread_nr = 24, .shift = 3, .control_by_sw = true, - .gce_num = 2 + .gce_num = 1 };static const struct gce_plat gce_plat_v6 = {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 534/1039 mailbox: imx: Fix an IS_ERR() vs NULL bug
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 05d06f37196b2e3abeff2b98b785c8803865e646 ]
The devm_kzalloc() function does not return error pointers, it returns NULL on failure.
--- drivers/mailbox/imx-mailbox.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mailbox/imx-mailbox.c +2 -2
@@ -563,8 +563,8 @@ static int imx_mu_probe(struct platform_device *pdev) size =sizeof (struct imx_sc_rpc_msg_max ); priv->msg =devm_kzalloc (dev, size,GFP_KERNEL ); -if (IS_ERR (priv->msg)) -return PTR_ERR (priv->msg); +if (!priv->msg) +return -ENOMEM ; priv->clk =devm_clk_get (dev,NULL );if (IS_ERR (priv->clk)) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 535/1039 mailbox: pcc: Avoid using the uninitialized variable dev
In reply to Greg Kroah-HartmanFrom: Sudeep Holla <[email protected]>
[ Upstream commit 960c4056aadcf61983f8eaac159927a052f8cf01 ]
Smatch static checker warns:
| drivers/mailbox/pcc.c:292 pcc_mbox_request_channel() | error: uninitialized symbol 'dev'.
Fix the same by using pr_err instead of dev_err as the variable 'dev' is uninitialized at that stage.
--- drivers/mailbox/pcc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mailbox/pcc.c +1 -1
@@ -289,7 +289,7 @@ pcc_mbox_request_channel(struct mbox_client *cl, int subspace_id) pchan = chan_info + subspace_id; chan = pchan->chan.mchan;if (IS_ERR (chan) || chan->cl) { -dev_err (dev,"Channel not found for idx: %d\n" , subspace_id); +pr_err ("Channel not found for idx: %d\n" , subspace_id);return ERR_PTR (-EBUSY ); } dev = chan->mbox->dev;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 536/1039 mailbox: pcc: Handle all PCC subtypes correctly in pcc_mbox_irq
In reply to Greg Kroah-HartmanFrom: Sudeep Holla <[email protected]>
[ Upstream commit 7215a7857e796c655ae1184b313556102fa8bc40 ]
Commit c45ded7e1135 ("mailbox: pcc: Add support for PCCT extended PCC subspaces(type 3/4)") enabled the type3/4 of PCCT, but the change in pcc_mbox_irq breaks the other PCC subtypes.
The kernel reports a warning on an Ampere eMag server
-->8
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.16.0-rc4 #127 Hardware name: MiTAC RAPTOR EV-883832-X3-0001/RAPTOR, BIOS 0.14 02/22/2019 Call trace: dump_backtrace+0x0/0x200 show_stack+0x20/0x30 dump_stack_lvl+0x68/0x84 dump_stack+0x18/0x34 __report_bad_irq+0x54/0x17c note_interrupt+0x330/0x428 handle_irq_event_percpu+0x90/0x98 handle_irq_event+0x4c/0x148 handle_fasteoi_irq+0xc4/0x188 generic_handle_domain_irq+0x44/0x68 gic_handle_irq+0x84/0x2ec call_on_irq_stack+0x28/0x34 do_interrupt_handler+0x88/0x90 el1_interrupt+0x48/0xb0 el1h_64_irq_handler+0x18/0x28 el1h_64_irq+0x7c/0x80
--- drivers/mailbox/pcc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/mailbox/pcc.c +5 -3
@@ -241,9 +241,11 @@ static irqreturn_t pcc_mbox_irq(int irq, void *p)if (ret)return IRQ_NONE ; - val &= pchan->cmd_complete.status_mask; -if (!val) -return IRQ_NONE ; +if (val) {/* Ensure GAS exists and value is non-zero */ + val &= pchan->cmd_complete.status_mask; +if (!val) +return IRQ_NONE ; + } ret =pcc_chan_reg_read (&pchan->error, &val);if (ret)
Signature · 1 line
2.34.1