batman-adv: Fix DAT candidate selection on little endian systems
Subsystems (14)
Sasha Levin
maintainerPATCH 1/107 batman-adv: Fix DAT candidate selection on little endian systems
From: Sven Eckelmann <[email protected]>
[ Upstream commit 4cc4a1708903f404d2ca0dfde30e71e052c6cbc9 ]
The distributed arp table is using a DHT to store and retrieve MAC address information for an IP address. This is done using unicast messages to selected peers. The potential peers are looked up using the IP address and the VID.
While the IP address is always stored in big endian byte order, this is not the case of the VID. It can (depending on the host system) either be big endian or little endian. The host must therefore always convert it to big endian to ensure that all devices calculate the same peers for the same lookup data.
--- net/batman-adv/distributed-arp-table.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/batman-adv/distributed-arp-table.c +3 -1
@@ -285,6 +285,7 @@ static u32 batadv_hash_dat(const void *data, u32 size)u32 hash =0 ;const struct batadv_dat_entry *dat = data;const unsigned char *key; +__be16 vid;u32 i; key = (const unsigned char *)&dat->ip;
@@ -294,7 +295,8 @@ static u32 batadv_hash_dat(const void *data, u32 size) hash ^= (hash >>6 ); } - key = (const unsigned char *)&dat->vid; + vid =htons (dat->vid); + key = (__force const unsigned char *)&vid;for (i =0 ; i <sizeof (dat->vid); i++) { hash += key[i]; hash += (hash <<10 );
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 6/107 ARM: OMAP2+: Fix ti_sysc_find_one_clockdomain to check for to_clk_hw_omap
From: Tony Lindgren <[email protected]>
[ Upstream commit 90bdfa0b05e3cc809a7c1aa3b1f162b46ea1b330 ]
We must bail out early if the clock is not hw_omap. Otherwise we will try to access invalid address with hwclk->clkdm_name:
Unable to handle kernel paging request at virtual address ffffffff Internal error: Oops: 27 [#1] ARM
...
(strcmp) from [<c011b348>] (clkdm_lookup+0x40/0x60)
[<c011b348>] (clkdm_lookup) from [<c011cb84>] (ti_sysc_clkdm_init+0x5c/0x64) [<c011cb84>] (ti_sysc_clkdm_init) from [<c03680a8>] (sysc_probe+0x948/0x117c) [<c03680a8>] (sysc_probe) from [<c03d0af4>] (platform_drv_probe+0x48/0x98)
...
--- arch/arm/mach-omap2/pdata-quirks.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
arch/arm/mach-omap2/pdata-quirks.c +5 -1
@@ -368,10 +368,14 @@ static void __init dra7x_evm_mmc_quirk(void)static struct clockdomain *ti_sysc_find_one_clockdomain (struct clk *clk) { +struct clk_hw *hw =__clk_get_hw (clk);struct clockdomain *clkdm =NULL ;struct clk_hw_omap *hwclk; - hwclk =to_clk_hw_omap (__clk_get_hw (clk)); + hwclk =to_clk_hw_omap (hw); +if (!omap2_clk_is_hw_omap (hw)) +return NULL ; +if (hwclk && hwclk->clkdm_name) clkdm =clkdm_lookup (hwclk->clkdm_name);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 9/107 ARM: dts: am57xx-beagle-x15/am57xx-idk: Remove "gpios" for endpoint dt nodes
In reply to Sasha LevinFrom: Kishon Vijay Abraham I <[email protected]>
[ Upstream commit 81cc0877840f72210e809bbedd6346d686560fc1 ]
PERST# line in the PCIE connector is driven by the host mode and not EP mode. The gpios property here is used for driving the PERST# line. Remove gpios property from all endpoint device tree nodes.
--- arch/arm/boot/dts/am571x-idk.dts | 4 ---- arch/arm/boot/dts/am572x-idk-common.dtsi | 4 ---- arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi | 4 ---- 3 files changed, 12 deletions(-)
arch/arm/boot/dts/am571x-idk.dts +0 -4
@@ -170,10 +170,6 @@ gpios = <&gpio3 23 GPIO_ACTIVE_HIGH>; }; -&pcie1_ep { - gpios = <&gpio3 23 GPIO_ACTIVE_HIGH>; -}; - &mmc1 { pinctrl-names = "default", "hs"; pinctrl-0 = <&mmc1_pins_default_no_clk_pu>;
arch/arm/boot/dts/am572x-idk-common.dtsi +0 -4
@@ -147,10 +147,6 @@ gpios = <&gpio3 23 GPIO_ACTIVE_HIGH>; }; -&pcie1_ep { - gpios = <&gpio3 23 GPIO_ACTIVE_HIGH>; -}; - &mailbox5 { status = "okay"; mbox_ipu1_ipc3x: mbox_ipu1_ipc3x {
arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi +0 -4
@@ -547,10 +547,6 @@ gpios = <&gpio2 8 GPIO_ACTIVE_LOW>; }; -&pcie1_ep { - gpios = <&gpio2 8 GPIO_ACTIVE_LOW>; -}; - &mcasp3 { #sound-dai-cells = <0>; assigned-clocks = <&l4per2_clkctrl DRA7_L4PER2_MCASP3_CLKCTRL 24>;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 10/107 ARM: dts: beagle-x15-common: Model 5V0 regulator
In reply to Sasha LevinFrom: Kishon Vijay Abraham I <[email protected]>
[ Upstream commit e17e7c498d4f734df93c300441e100818ed58168 ]
On am57xx-beagle-x15, 5V0 is connected to P16, P17, P18 and P19 connectors. On am57xx-evm, 5V0 regulator is used to get 3V6 regulator which is connected to the COMQ port. Model 5V0 regulator here in order for it to be used in am57xx-evm to model 3V6 regulator.
--- .../boot/dts/am57xx-beagle-x15-common.dtsi | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+)
arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi +21 -0
@@ -29,6 +29,27 @@ reg = <0x0 0x80000000 0x0 0x80000000>; }; + main_12v0: fixedregulator-main_12v0 { + /* main supply */ + compatible = "regulator-fixed"; + regulator-name = "main_12v0"; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + regulator-always-on; + regulator-boot-on; + }; + + evm_5v0: fixedregulator-evm_5v0 { + /* Output of TPS54531D */ + compatible = "regulator-fixed"; + regulator-name = "evm_5v0"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&main_12v0>; + regulator-always-on; + regulator-boot-on; + }; + vdd_3v3: fixedregulator-vdd_3v3 { compatible = "regulator-fixed"; regulator-name = "vdd_3v3";
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 38/107 i40e: Fix virtchnl_queue_select bitmap validation
In reply to Sasha LevinFrom: Brett Creeley <[email protected]>
[ Upstream commit d9d6a9aed3f66f8ce5fa3ca6ca26007d75032296 ]
Currently in i40e_vc_disable_queues_msg() we are incorrectly validating the virtchnl queue select bitmaps. The virtchnl_queue_select rx_queues and tx_queue bitmap is being compared against ICE_MAX_VF_QUEUES, but the problem is that these bitmaps can have a value greater than I40E_MAX_VF_QUEUES. Fix this by comparing the bitmaps against BIT(I40E_MAX_VF_QUEUES).
Also, add the function i40e_vc_validate_vqs_bitmaps() that checks to see if both virtchnl_queue_select bitmaps are empty along with checking that the bitmaps only have valid bits set. This function can then be used in both the queue enable and disable flows.
--- .../ethernet/intel/i40e/i40e_virtchnl_pf.c | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +18 -4
@@ -2322,6 +2322,22 @@ static int i40e_ctrl_vf_rx_rings(struct i40e_vsi *vsi, unsigned long q_map,return ret; } +/** +* i40e_vc_validate_vqs_bitmaps - validate Rx/Tx queue bitmaps from VIRTHCHNL +* @vqs: virtchnl_queue_select structure containing bitmaps to validate +* +* Returns true if validation was successful, else false. +*/ +static bool i40e_vc_validate_vqs_bitmaps (struct virtchnl_queue_select *vqs) +{ +if ((!vqs->rx_queues && !vqs->tx_queues) || + vqs->rx_queues >=BIT (I40E_MAX_VF_QUEUES ) || + vqs->tx_queues >=BIT (I40E_MAX_VF_QUEUES )) +return false; + +return true; +} +/** * i40e_vc_enable_queues_msg * @vf: pointer to the VF info
@@ -2347,7 +2363,7 @@ static int i40e_vc_enable_queues_msg(struct i40e_vf *vf, u8 *msg) goto error_param; } -if ((0 == vqs->rx_queues) && (0 == vqs->tx_queues)) { +if (i40e_vc_validate_vqs_bitmaps (vqs)) { aq_ret =I40E_ERR_PARAM ; goto error_param; }
@@ -2409,9 +2425,7 @@ static int i40e_vc_disable_queues_msg(struct i40e_vf *vf, u8 *msg) goto error_param; } -if ((vqs->rx_queues ==0 && vqs->tx_queues ==0 ) || - vqs->rx_queues >I40E_MAX_VF_QUEUES || - vqs->tx_queues >I40E_MAX_VF_QUEUES ) { +if (i40e_vc_validate_vqs_bitmaps (vqs)) { aq_ret =I40E_ERR_PARAM ; goto error_param; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 39/107 ixgbevf: Remove limit of 10 entries for unicast filter list
In reply to Sasha LevinFrom: Radoslaw Tyl <[email protected]>
[ Upstream commit aa604651d523b1493988d0bf6710339f3ee60272 ]
Currently, though the FDB entry is added to VF, it does not appear in RAR filters. VF driver only allows to add 10 entries. Attempting to add another causes an error. This patch removes limitation and allows use of all free RAR entries for the FDB if needed.
--- drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +0 -5
@@ -2081,11 +2081,6 @@ static int ixgbevf_write_uc_addr_list(struct net_device *netdev)struct ixgbe_hw *hw = &adapter->hw;int count =0 ; -if ((netdev_uc_count (netdev)) >10 ) { -pr_err ("Too many unicast filters - No Space\n" ); -return -ENOSPC ; - } -if (!netdev_uc_empty (netdev)) {struct netdev_hw_addr *ha;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 40/107 ixgbe: Fix calculation of queue with VFs and flow director on interface flap
In reply to Sasha LevinFrom: Cambda Zhu <[email protected]>
[ Upstream commit 4fad78ad6422d9bca62135bbed8b6abc4cbb85b8 ]
This patch fixes the calculation of queue when we restore flow director filters after resetting adapter. In ixgbe_fdir_filter_restore(), filter's vf may be zero which makes the queue outside of the rx_ring array.
The calculation is changed to the same as ixgbe_add_ethtool_fdir_entry().
--- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 37 ++++++++++++++----- 1 file changed, 27 insertions(+), 10 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +27 -10
@@ -5239,7 +5239,7 @@ static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter)struct ixgbe_hw *hw = &adapter->hw;struct hlist_node *node2;struct ixgbe_fdir_filter *filter; -u64 action; +u8 queue;spin_lock (&adapter->fdir_perfect_lock);
@@ -5248,17 +5248,34 @@ static void ixgbe_fdir_filter_restore(struct ixgbe_adapter *adapter)hlist_for_each_entry_safe (filter, node2, &adapter->fdir_filter_list, fdir_node) { - action = filter->action; -if (action !=IXGBE_FDIR_DROP_QUEUE && action !=0 ) - action = - (action >>ETHTOOL_RX_FLOW_SPEC_RING_VF_OFF ) -1 ; +if (filter->action ==IXGBE_FDIR_DROP_QUEUE ) { + queue =IXGBE_FDIR_DROP_QUEUE ; + }else { +u32 ring =ethtool_get_flow_spec_ring (filter->action); +u8 vf =ethtool_get_flow_spec_ring_vf (filter->action); + +if (!vf && (ring >= adapter->num_rx_queues)) { +e_err (drv,"FDIR restore failed without VF, ring: %u\n" , + ring); +continue ; + }else if (vf && + ((vf > adapter->num_vfs) || + ring >= adapter->num_rx_queues_per_pool)) { +e_err (drv,"FDIR restore failed with VF, vf: %hhu, ring: %u\n" , + vf, ring); +continue ; + } + +/* Map the ring onto the absolute queue index */ +if (!vf) + queue = adapter->rx_ring[ring]->reg_idx; +else + queue = ((vf -1 ) * + adapter->num_rx_queues_per_pool) + ring; + }ixgbe_fdir_write_perfect_filter_82599 (hw, - &filter->filter, - filter->sw_idx, - (action ==IXGBE_FDIR_DROP_QUEUE ) ? -IXGBE_FDIR_DROP_QUEUE : - adapter->rx_ring[action]->reg_idx); + &filter->filter, filter->sw_idx, queue); }spin_unlock (&adapter->fdir_perfect_lock);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 41/107 igb: Fix SGMII SFP module discovery for 100FX/LX.
In reply to Sasha LevinFrom: Manfred Rudigier <[email protected]>
[ Upstream commit 5365ec1aeff5b9f2962a9c9b31d63f9dad7e0e2d ]
Changing the link mode should also be done for 100BaseFX SGMII modules, otherwise they just don't work when the default link mode in CTRL_EXT coming from the EEPROM is SERDES.
Additionally 100Base-LX SGMII SFP modules are also supported now, which was not the case before.
Tested with an i210 using Flexoptix S.1303.2M.G 100FX and S.1303.10.G 100LX SGMII SFP modules.
--- drivers/net/ethernet/intel/igb/e1000_82575.c | 8 ++------ drivers/net/ethernet/intel/igb/igb_ethtool.c | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/igb/e1000_82575.c +2 -6
@@ -530,7 +530,7 @@ static s32 igb_set_sfp_media_type_82575(struct e1000_hw *hw) dev_spec->module_plugged = true;if (eth_flags->e1000_base_lx || eth_flags->e1000_base_sx) { hw->phy.media_type = e1000_media_type_internal_serdes; - }else if (eth_flags->e100_base_fx) { + }else if (eth_flags->e100_base_fx || eth_flags->e100_base_lx) { dev_spec->sgmii_active = true; hw->phy.media_type = e1000_media_type_internal_serdes; }else if (eth_flags->e1000_base_t) {
@@ -657,14 +657,10 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw)break ; } -/* do not change link mode for 100BaseFX */ -if (dev_spec->eth_flags.e100_base_fx) -break ; -/* change current link mode setting */ ctrl_ext &= ~E1000_CTRL_EXT_LINK_MODE_MASK ; -if (hw->phy.media_type == e1000_media_type_copper) +if (dev_spec->sgmii_active) ctrl_ext |=E1000_CTRL_EXT_LINK_MODE_SGMII ;else ctrl_ext |=E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES ;
drivers/net/ethernet/intel/igb/igb_ethtool.c +1 -1
@@ -181,7 +181,7 @@ static int igb_get_link_ksettings(struct net_device *netdev, advertising &= ~ADVERTISED_1000baseKX_Full; } } -if (eth_flags->e100_base_fx) { +if (eth_flags->e100_base_fx || eth_flags->e100_base_lx) { supported |= SUPPORTED_100baseT_Full; advertising |= ADVERTISED_100baseT_Full; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 42/107 iavf: remove current MAC address filter on VF reset
In reply to Sasha LevinFrom: Stefan Assmann <[email protected]>
[ Upstream commit 9e05229190380f6b8f702da39aaeb97a0fc80dc3 ]
Currently MAC filters are not altered during a VF reset event. This may lead to a stale filter when an administratively set MAC is forced by the PF.
For an administratively set MAC the PF driver deletes the VFs filters, overwrites the VFs MAC address and triggers a VF reset. However the VF driver itself is not aware of the filter removal, which is what the VF reset is for.
The VF reset queues all filters present in the VF driver to be re-added to the PF filter list (including the filter for the now stale VF MAC address) and triggers a VIRTCHNL_OP_GET_VF_RESOURCES event, which provides the new MAC address to the VF.
When this happens i40e will complain and reject the stale MAC filter,
at least in the untrusted VF case.
i40e 0000:08:00.0: Setting MAC 3c:fa:fa:fa:fa:01 on VF 0
iavf 0000:08:02.0: Reset warning received from the PF
iavf 0000:08:02.0: Scheduling reset task
i40e 0000:08:00.0: Bring down and up the VF interface to make this change effective.
i40e 0000:08:00.0: VF attempting to override administratively set MAC address, bring down and up the VF interface to resume normal operation i40e 0000:08:00.0: VF 0 failed opcode 10, retval: -1
iavf 0000:08:02.0: Failed to add MAC filter, error IAVF_ERR_NVM
To avoid re-adding the stale MAC filter it needs to be removed from the VF driver's filter list before queuing the existing filters. Then during the VIRTCHNL_OP_GET_VF_RESOURCES event the correct filter needs to be added again, at which point the MAC address has been updated.
As a bonus this change makes bringing the VF down and up again superfluous for the administratively set MAC case.
--- drivers/net/ethernet/intel/iavf/iavf.h | 2 ++ drivers/net/ethernet/intel/iavf/iavf_main.c | 17 +++++++++++++---- drivers/net/ethernet/intel/iavf/iavf_virtchnl.c | 3 +++ 3 files changed, 18 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/iavf/iavf.h +2 -0
@@ -415,4 +415,6 @@ void iavf_enable_channels(struct iavf_adapter *adapter);void iavf_disable_channels (struct iavf_adapter *adapter);void iavf_add_cloud_filter (struct iavf_adapter *adapter);void iavf_del_cloud_filter (struct iavf_adapter *adapter); +struct iavf_mac_filter *iavf_add_filter (struct iavf_adapter *adapter, +const u8 *macaddr);#endif /* _IAVF_H_ */
drivers/net/ethernet/intel/iavf/iavf_main.c +13 -4
@@ -743,9 +743,8 @@ iavf_mac_filter *iavf_find_filter(struct iavf_adapter *adapter,* * Returns ptr to the filter object or NULL when no memory available. **/ -static struct -iavf_mac_filter *iavf_add_filter (struct iavf_adapter *adapter, -const u8 *macaddr) +struct iavf_mac_filter *iavf_add_filter (struct iavf_adapter *adapter, +const u8 *macaddr) {struct iavf_mac_filter *f;
@@ -2065,9 +2064,9 @@ static void iavf_reset_task(struct work_struct *work)struct virtchnl_vf_resource *vfres = adapter->vf_res;struct net_device *netdev = adapter->netdev;struct iavf_hw *hw = &adapter->hw; +struct iavf_mac_filter *f, *ftmp;struct iavf_vlan_filter *vlf;struct iavf_cloud_filter *cf; -struct iavf_mac_filter *f;u32 reg_val;int i =0 , err;bool running;
@@ -2181,6 +2180,16 @@ continue_reset:spin_lock_bh (&adapter->mac_vlan_list_lock); +/* Delete filter for the current MAC address, it could have +* been changed by the PF via administratively set MAC. +* Will be re-added via VIRTCHNL_OP_GET_VF_RESOURCES. +*/ +list_for_each_entry_safe (f, ftmp, &adapter->mac_filter_list, list) { +if (ether_addr_equal (f->macaddr, adapter->hw.mac.addr)) { +list_del (&f->list); +kfree (f); + } + }/* re-add all MAC filters */ list_for_each_entry (f, &adapter->mac_filter_list, list) { f->add = true;
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +3 -0
@@ -1359,6 +1359,9 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter,ether_addr_copy (netdev->perm_addr, adapter->hw.mac.addr); } +spin_lock_bh (&adapter->mac_vlan_list_lock); +iavf_add_filter (adapter, adapter->hw.mac.addr); +spin_unlock_bh (&adapter->mac_vlan_list_lock);iavf_process_config (adapter); }break ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 45/107 sh_eth: check sh_eth_cpu_data::dual_port when dumping registers
In reply to Sasha LevinFrom: Sergei Shtylyov <[email protected]>
[ Upstream commit 3249b1e442a1be1a6b9f1026785b519d1443f807 ]
When adding the sh_eth_cpu_data::dual_port flag I forgot to add the flag checks to __sh_eth_get_regs(), causing the non-existing TSU registers to be dumped by 'ethtool' on the single port Ether controllers having TSU...
--- drivers/net/ethernet/renesas/sh_eth.c | 38 +++++++++++++++------------ 1 file changed, 21 insertions(+), 17 deletions(-)
drivers/net/ethernet/renesas/sh_eth.c +21 -17
@@ -2204,24 +2204,28 @@ static size_t __sh_eth_get_regs(struct net_device *ndev, u32 *buf)if (cd->tsu) {add_tsu_reg (ARSTR );add_tsu_reg (TSU_CTRST ); -add_tsu_reg (TSU_FWEN0 ); -add_tsu_reg (TSU_FWEN1 ); -add_tsu_reg (TSU_FCM ); -add_tsu_reg (TSU_BSYSL0 ); -add_tsu_reg (TSU_BSYSL1 ); -add_tsu_reg (TSU_PRISL0 ); -add_tsu_reg (TSU_PRISL1 ); -add_tsu_reg (TSU_FWSL0 ); -add_tsu_reg (TSU_FWSL1 ); +if (cd->dual_port) { +add_tsu_reg (TSU_FWEN0 ); +add_tsu_reg (TSU_FWEN1 ); +add_tsu_reg (TSU_FCM ); +add_tsu_reg (TSU_BSYSL0 ); +add_tsu_reg (TSU_BSYSL1 ); +add_tsu_reg (TSU_PRISL0 ); +add_tsu_reg (TSU_PRISL1 ); +add_tsu_reg (TSU_FWSL0 ); +add_tsu_reg (TSU_FWSL1 ); + }add_tsu_reg (TSU_FWSLC ); -add_tsu_reg (TSU_QTAGM0 ); -add_tsu_reg (TSU_QTAGM1 ); -add_tsu_reg (TSU_FWSR ); -add_tsu_reg (TSU_FWINMK ); -add_tsu_reg (TSU_ADQT0 ); -add_tsu_reg (TSU_ADQT1 ); -add_tsu_reg (TSU_VTAG0 ); -add_tsu_reg (TSU_VTAG1 ); +if (cd->dual_port) { +add_tsu_reg (TSU_QTAGM0 ); +add_tsu_reg (TSU_QTAGM1 ); +add_tsu_reg (TSU_FWSR ); +add_tsu_reg (TSU_FWINMK ); +add_tsu_reg (TSU_ADQT0 ); +add_tsu_reg (TSU_ADQT1 ); +add_tsu_reg (TSU_VTAG0 ); +add_tsu_reg (TSU_VTAG1 ); + }add_tsu_reg (TSU_ADSBSY );add_tsu_reg (TSU_TEN );add_tsu_reg (TSU_POST1 );
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 51/107 platform/x86: GPD pocket fan: Allow somewhat lower/higher temperature limits
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 1f27dbd8265dbb379926c8f6a4453fe7fe26d7a3 ]
Allow the user to configure the fan to turn on / speed-up at lower thresholds then before (20 degrees Celcius as minimum instead of 40) and likewise also allow the user to delay the fan speeding-up till the temperature hits 90 degrees Celcius (was 70).
--- drivers/platform/x86/gpd-pocket-fan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/gpd-pocket-fan.c +1 -1
@@ -127,7 +127,7 @@ static int gpd_pocket_fan_probe(struct platform_device *pdev)int i;for (i =0 ; i <ARRAY_SIZE (temp_limits); i++) { -if (temp_limits[i] <40000 || temp_limits[i] >70000 ) { +if (temp_limits[i] <20000 || temp_limits[i] >90000 ) {dev_err (&pdev->dev,"Invalid temp-limit %d (must be between 40000 and 70000)\n" , temp_limits[i]); temp_limits[0 ] =TEMP_LIMIT0_DEFAULT ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 52/107 platform/x86: intel_pmc_core: update Comet Lake platform driver
In reply to Sasha LevinFrom: Harry Pan <[email protected]>
[ Upstream commit 515ff674bb9bf06186052e352c4587dab8defaf0 ]
Adding new CML CPU model ID into platform driver support list.
--- drivers/platform/x86/intel_pmc_core_pltdrv.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/platform/x86/intel_pmc_core_pltdrv.c +2 -0
@@ -44,6 +44,8 @@ static const struct x86_cpu_id intel_pmc_core_platform_ids[] = {INTEL_CPU_FAM6 (KABYLAKE , pmc_core_device),INTEL_CPU_FAM6 (CANNONLAKE_L , pmc_core_device),INTEL_CPU_FAM6 (ICELAKE_L , pmc_core_device), +INTEL_CPU_FAM6 (COMETLAKE , pmc_core_device), +INTEL_CPU_FAM6 (COMETLAKE_L , pmc_core_device), {} };MODULE_DEVICE_TABLE (x86cpu, intel_pmc_core_platform_ids);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 77/107 selftests: mlxsw: qos_mc_aware: Fix mausezahn invocation
In reply to Sasha LevinFrom: Petr Machata <[email protected]>
[ Upstream commit fef6d6704944c7be72fd2b77c021f1aed3d5df0d ]
Mausezahn does not recognize "own" as a keyword on source IP address. As a result, the MC stream is not running at all, and therefore no UC degradation can be observed even in principle.
Fix the invocation, and tighten the test: due to the minimum shaper configured at the MC TCs, we always expect about 20% degradation. Fail the test if it is lower.
--- tools/testing/selftests/drivers/net/mlxsw/qos_mc_aware.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
tools/testing/selftests/drivers/net/mlxsw/qos_mc_aware.sh +6 -2
@@ -232,7 +232,7 @@ test_mc_aware() stop_traffic local ucth1=${uc_rate[1]} - start_traffic $h1 own bc bc + start_traffic $h1 192.0.2.65 bc bc local d0=$(date +%s) local t0=$(ethtool_stats_get $h3 rx_octets_prio_0)
@@ -254,7 +254,11 @@ test_mc_aware() ret = 100 * ($ucth1 - $ucth2) / $ucth1 if (ret > 0) { ret } else { 0 } ") - check_err $(bc <<< "$deg > 25") + + # Minimum shaper of 200Mbps on MC TCs should cause about 20% of + # degradation on 1Gbps link. + check_err $(bc <<< "$deg < 15") "Minimum shaper not in effect" + check_err $(bc <<< "$deg > 25") "MC traffic degrades UC performance too much" local interval=$((d1 - d0)) local mc_ir=$(rate $u0 $u1 $interval)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 79/107 i2c: iop3xx: Fix memory leak in probe error path
In reply to Sasha LevinFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit e64175776d06a8ceebbfd349d7e66a4a46ca39ef ]
When handling devm_gpiod_get_optional() errors, free the memory already allocated. This fixes Smatch warnings:
drivers/i2c/busses/i2c-iop3xx.c:437 iop3xx_i2c_probe() warn: possible memory leak of 'new_adapter' drivers/i2c/busses/i2c-iop3xx.c:442 iop3xx_i2c_probe() warn: possible memory leak of 'new_adapter'
--- drivers/i2c/busses/i2c-iop3xx.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/i2c/busses/i2c-iop3xx.c +8 -4
@@ -433,13 +433,17 @@ iop3xx_i2c_probe(struct platform_device *pdev) adapter_data->gpio_scl =devm_gpiod_get_optional (&pdev->dev,"scl" ,GPIOD_ASIS ); -if (IS_ERR (adapter_data->gpio_scl)) -return PTR_ERR (adapter_data->gpio_scl); +if (IS_ERR (adapter_data->gpio_scl)) { + ret =PTR_ERR (adapter_data->gpio_scl); + goto free_both; + } adapter_data->gpio_sda =devm_gpiod_get_optional (&pdev->dev,"sda" ,GPIOD_ASIS ); -if (IS_ERR (adapter_data->gpio_sda)) -return PTR_ERR (adapter_data->gpio_sda); +if (IS_ERR (adapter_data->gpio_sda)) { + ret =PTR_ERR (adapter_data->gpio_sda); + goto free_both; + } res =platform_get_resource (pdev,IORESOURCE_MEM ,0 );if (!res) {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 2/107 clk: sunxi-ng: v3s: Fix incorrect number of hw_clks.
In reply to Sasha LevinFrom: Yunhao Tian <[email protected]>
[ Upstream commit 4ff40d140e2a2060ef6051800a4a9eab07624f42 ]
The hws field of sun8i_v3s_hw_clks has only 74 members. However, the number specified by CLK_NUMBER is 77 (= CLK_I2S0 + 1). This leads to runtime segmentation fault that is not always reproducible.
This patch fixes the problem by specifying correct clock number.
--- drivers/clk/sunxi-ng/ccu-sun8i-v3s.c | 4 ++-- drivers/clk/sunxi-ng/ccu-sun8i-v3s.h | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/clk/sunxi-ng/ccu-sun8i-v3s.c +2 -2
@@ -618,7 +618,7 @@ static struct clk_hw_onecell_data sun8i_v3s_hw_clks = { [CLK_MBUS] = &mbus_clk.common.hw, [CLK_MIPI_CSI] = &mipi_csi_clk.common.hw, }, - .num = CLK_NUMBER, + .num = CLK_PLL_DDR1 + 1, };static struct clk_hw_onecell_data sun8i_v3_hw_clks = {
@@ -700,7 +700,7 @@ static struct clk_hw_onecell_data sun8i_v3_hw_clks = { [CLK_MBUS] = &mbus_clk.common.hw, [CLK_MIPI_CSI] = &mipi_csi_clk.common.hw, }, - .num = CLK_NUMBER, + .num = CLK_I2S0 + 1, };static struct ccu_reset_map sun8i_v3s_ccu_resets[] = {
drivers/clk/sunxi-ng/ccu-sun8i-v3s.h +0 -2
@@ -51,6 +51,4 @@#define CLK_PLL_DDR1 74 -#define CLK_NUMBER (CLK_I2S0 + 1) -#endif /* _CCU_SUN8I_H3_H_ */
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 5/107 arm64: dts: meson-sm1-sei610: add gpio bluetooth interrupt
In reply to Sasha LevinFrom: Guillaume La Roque <[email protected]>
[ Upstream commit 30388cc075720aa0af4f2cb5933afa1f8f39d313 ]
add gpio irq to support interrupt trigger mode.
--- arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts +2 -0
@@ -361,6 +361,8 @@ bluetooth { compatible = "brcm,bcm43438-bt"; + interrupt-parent = <&gpio_intc>; + interrupts = <95 IRQ_TYPE_LEVEL_HIGH>; shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>; max-speed = <2000000>; clocks = <&wifi32k>;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 7/107 bus: ti-sysc: Fix iterating over clocks
In reply to Sasha LevinFrom: Tony Lindgren <[email protected]>
[ Upstream commit 2c81f0f6d3f52ac222a5dc07a6e5c06e1543e88b ]
Commit d878970f6ce1 ("bus: ti-sysc: Add separate functions for handling clocks") separated handling of optional clocks from the main clocks, but introduced an issue where we do not necessarily allocate a slot for both fck and ick clocks, but still assume fixed slots for enumerating over the clocks.
Let's fix the issue by ensuring we always have slots for both fck and ick even if we don't use ick, and don't attempt to enumerate optional clocks if not allocated.
In the long run we might want to simplify things a bit by only allocating space only for the optional clocks as we have only few devices with optional clocks.
--- drivers/bus/ti-sysc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/bus/ti-sysc.c +8 -2
@@ -343,6 +343,12 @@ static int sysc_get_clocks(struct sysc *ddata)return -EINVAL ; } +/* Always add a slot for main clocks fck and ick even if unused */ +if (!nr_fck) + ddata->nr_clocks++; +if (!nr_ick) + ddata->nr_clocks++; + ddata->clocks =devm_kcalloc (ddata->dev, ddata->nr_clocks,sizeof (*ddata->clocks),GFP_KERNEL );
@@ -421,7 +427,7 @@ static int sysc_enable_opt_clocks(struct sysc *ddata)struct clk *clock;int i, error; -if (!ddata->clocks) +if (!ddata->clocks || ddata->nr_clocks <SYSC_OPTFCK0 +1 )return 0 ;for (i =SYSC_OPTFCK0 ; i <SYSC_MAX_CLOCKS ; i++) {
@@ -455,7 +461,7 @@ static void sysc_disable_opt_clocks(struct sysc *ddata)struct clk *clock;int i; -if (!ddata->clocks) +if (!ddata->clocks || ddata->nr_clocks <SYSC_OPTFCK0 +1 )return ;for (i =SYSC_OPTFCK0 ; i <SYSC_MAX_CLOCKS ; i++) {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 12/107 tools lib traceevent: Fix memory leakage in filter_event
In reply to Sasha LevinFrom: Hewenliang <[email protected]>
[ Upstream commit f84ae29a6169318f9c929720c49d96323d2bbab9 ]
It is necessary to call free_arg(arg) when add_filter_type() returns NULL in filter_event().
--- tools/lib/traceevent/parse-filter.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/lib/traceevent/parse-filter.c +3 -1
@@ -1228,8 +1228,10 @@ filter_event(struct tep_event_filter *filter, struct tep_event *event, } filter_type =add_filter_type (filter, event->id); -if (filter_type ==NULL ) +if (filter_type ==NULL ) { +free_arg (arg);return TEP_ERRNO__MEM_ALLOC_FAILED ; + }if (filter_type->filter)free_arg (filter_type->filter);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 15/107 arm64: dts: imx8mm: Change SDMA1 ahb clock for imx8mm
In reply to Sasha LevinFrom: Adam Ford <[email protected]>
[ Upstream commit 24a572bf67994223e722cadfe663e15ba221882a ]
Using SDMA1 with UART1 is causing a "Timeout waiting for CH0" error. This patch changes to ahb clock from SDMA1_ROOT to AHB which fixes the timeout error.
--- arch/arm64/boot/dts/freescale/imx8mm.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mm.dtsi +1 -1
@@ -741,7 +741,7 @@ reg = <0x30bd0000 0x10000>; interrupts = <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clk IMX8MM_CLK_SDMA1_ROOT>, - <&clk IMX8MM_CLK_SDMA1_ROOT>; + <&clk IMX8MM_CLK_AHB>; clock-names = "ipg", "ahb"; #dma-cells = <3>; fsl,sdma-ram-script-name = "imx/sdma/sdma-imx7d.bin";
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 16/107 ARM: dts: imx7ulp: fix reg of cpu node
In reply to Sasha LevinFrom: Peng Fan <[email protected]>
[ Upstream commit b8ab62ff7199fac8ce27fa4a149929034fabe7f8 ]
According to arm cpus binding doc,
"
On 32-bit ARM v7 or later systems this property is
required and matches the CPU MPIDR[23:0] register bits.
Bits [23:0] in the reg cell must be set to bits [23:0] in MPIDR.
All other bits in the reg cell must be set to 0.
"
In i.MX7ULP, the MPIDR[23:0] is 0xf00, not 0, so fix it. Otherwise there will be warning:
"DT missing boot CPU MPIDR[23:0], fall back to default cpu_logical_map"
--- arch/arm/boot/dts/imx7ulp.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/imx7ulp.dtsi +2 -2
@@ -37,10 +37,10 @@ #address-cells = <1>; #size-cells = <0>; - cpu0: cpu@0 { + cpu0: cpu@f00 { compatible = "arm,cortex-a7"; device_type = "cpu"; - reg = <0>; + reg = <0xf00>; }; };
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 17/107 ARM: dts: imx6q-dhcom: Fix SGTL5000 VDDIO regulator connection
In reply to Sasha LevinFrom: Marek Vasut <[email protected]>
[ Upstream commit fe6a6689d1815b63528796886853890d8ee7f021 ]
The SGTL5000 VDDIO is connected to the PMIC SW2 output, not to a fixed 3V3 rail. Describe this correctly in the DT.
--- arch/arm/boot/dts/imx6q-dhcom-pdk2.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/imx6q-dhcom-pdk2.dts +1 -1
@@ -55,7 +55,7 @@ #sound-dai-cells = <0>; clocks = <&clk_ext_audio_codec>; VDDA-supply = <®_3p3v>; - VDDIO-supply = <®_3p3v>; + VDDIO-supply = <&sw2_reg>; }; };
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 19/107 rseq: Unregister rseq for clone CLONE_VM
In reply to Sasha LevinFrom: Mathieu Desnoyers <[email protected]>
[ Upstream commit 463f550fb47bede3a5d7d5177f363a6c3b45d50b ]
It has been reported by Google that rseq is not behaving properly with respect to clone when CLONE_VM is used without CLONE_THREAD.
It keeps the prior thread's rseq TLS registered when the TLS of the thread has moved, so the kernel can corrupt the TLS of the parent.
The approach of clearing the per task-struct rseq registration on clone with CLONE_THREAD flag is incomplete. It does not cover the use-case of clone with CLONE_VM set, but without CLONE_THREAD.
Here is the rationale for unregistering rseq on clone with CLONE_VM flag set:
1) CLONE_THREAD requires CLONE_SIGHAND, which requires CLONE_VM to be set. Therefore, just checking for CLONE_VM covers all CLONE_THREAD uses. There is no point in checking for both CLONE_THREAD and CLONE_VM,
2) There is the possibility of an unlikely scenario where CLONE_SETTLS is used without CLONE_VM. In order to be an issue, it would require that the rseq TLS is in a shared memory area.
I do not plan on adding CLONE_SETTLS to the set of clone flags which unregister RSEQ, because it would require that we also unregister RSEQ on set_thread_area(2) and arch_prctl(2) ARCH_SET_FS for completeness. So rather than doing a partial solution, it appears better to let user-space explicitly perform rseq unregistration across clone if needed in scenarios where CLONE_VM is not set.
--- include/linux/sched.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/sched.h +2 -2
@@ -1915,11 +1915,11 @@ static inline void rseq_migrate(struct task_struct *t)/* * If parent process has a registered restartable sequences area, the -* child inherits. Only applies when forking a process, not a thread. +* child inherits. Unregister rseq for a clone with CLONE_VM set. */ static inline void rseq_fork (struct task_struct *t,unsigned long clone_flags) { -if (clone_flags &CLONE_THREAD ) { +if (clone_flags &CLONE_VM ) { t->rseq =NULL ; t->rseq_sig =0 ; t->rseq_event_mask =0 ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 20/107 locking/lockdep: Fix buffer overrun problem in stack_trace[]
In reply to Sasha LevinFrom: Waiman Long <[email protected]>
[ Upstream commit d91f3057263ceb691ef527e71b41a56b17f6c869 ]
If the lockdep code is really running out of the stack_trace entries, it is likely that buffer overrun can happen and the data immediately after stack_trace[] will be corrupted.
If there is less than LOCK_TRACE_SIZE_IN_LONGS entries left before the call to save_trace(), the max_entries computation will leave it with a very large positive number because of its unsigned nature. The subsequent call to stack_trace_save() will then corrupt the data after stack_trace[]. Fix that by changing max_entries to a signed integer and check for negative value before calling stack_trace_save().
--- kernel/locking/lockdep.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
kernel/locking/lockdep.c +3 -4
@@ -482,7 +482,7 @@ static struct lock_trace *save_trace(void)struct lock_trace *trace, *t2;struct hlist_head *hash_head;u32 hash; -unsigned int max_entries; +int max_entries;BUILD_BUG_ON_NOT_POWER_OF_2 (STACK_TRACE_HASH_SIZE );BUILD_BUG_ON (LOCK_TRACE_SIZE_IN_LONGS >=MAX_STACK_TRACE_ENTRIES );
@@ -490,10 +490,8 @@ static struct lock_trace *save_trace(void) trace = (struct lock_trace *)(stack_trace + nr_stack_trace_entries); max_entries =MAX_STACK_TRACE_ENTRIES - nr_stack_trace_entries -LOCK_TRACE_SIZE_IN_LONGS ; - trace->nr_entries =stack_trace_save (trace->entries, max_entries,3 ); -if (nr_stack_trace_entries >=MAX_STACK_TRACE_ENTRIES - -LOCK_TRACE_SIZE_IN_LONGS -1 ) { +if (max_entries <=0 ) {if (!debug_locks_off_graph_unlock ())return NULL ;
@@ -502,6 +500,7 @@ static struct lock_trace *save_trace(void)return NULL ; } + trace->nr_entries =stack_trace_save (trace->entries, max_entries,3 ); hash =jhash (trace->entries, trace->nr_entries *sizeof (trace->entries[0 ]),0 );
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 21/107 efi/earlycon: Fix write-combine mapping on x86
In reply to Sasha LevinFrom: Arvind Sankar <[email protected]>
[ Upstream commit d92b54570d24d017d2630e314b525ed792f5aa6c ]
On x86, until PAT is initialized, WC translates into UC-. Since we calculate and store pgprot_writecombine(PAGE_KERNEL) when earlycon is initialized, this means we actually use UC- mappings instead of WC mappings, which makes scrolling very slow.
Instead store a boolean flag to indicate whether we want to use writeback or write-combine mappings, and recalculate the actual pgprot_t we need on every mapping. Once PAT is initialized, we will start using write-combine mappings, which speeds up the scrolling considerably.
--- drivers/firmware/efi/earlycon.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/firmware/efi/earlycon.c +7 -9
@@ -17,7 +17,7 @@ static const struct console *earlycon_console __initdata;static const struct font_desc *font;static u32 efi_x, efi_y;static u64 fb_base; -static pgprot_t fb_prot; +static bool fb_wb;static void *efi_fb;/*
@@ -33,10 +33,8 @@ static int __init efi_earlycon_remap_fb(void)if (!earlycon_console || !(earlycon_console->flags &CON_ENABLED ))return 0 ; -if (pgprot_val (fb_prot) ==pgprot_val (PAGE_KERNEL )) - efi_fb =memremap (fb_base, screen_info.lfb_size,MEMREMAP_WB ); -else - efi_fb =memremap (fb_base, screen_info.lfb_size,MEMREMAP_WC ); + efi_fb =memremap (fb_base, screen_info.lfb_size, + fb_wb ?MEMREMAP_WB :MEMREMAP_WC );return efi_fb ?0 : -ENOMEM ; }
@@ -53,9 +51,12 @@ late_initcall(efi_earlycon_unmap_fb);static __ref void *efi_earlycon_map (unsigned long start,unsigned long len) { +pgprot_t fb_prot; +if (efi_fb)return efi_fb + start; + fb_prot = fb_wb ?PAGE_KERNEL :pgprot_writecombine (PAGE_KERNEL );return early_memremap_prot (fb_base + start, len,pgprot_val (fb_prot)); }
@@ -215,10 +216,7 @@ static int __init efi_earlycon_setup(struct earlycon_device *device,if (screen_info.capabilities &VIDEO_CAPABILITY_64BIT_BASE ) fb_base |= (u64 )screen_info.ext_lfb_base <<32 ; -if (opt && !strcmp (opt,"ram" )) - fb_prot =PAGE_KERNEL ; -else - fb_prot =pgprot_writecombine (PAGE_KERNEL ); + fb_wb = opt && !strcmp (opt,"ram" ); si = &screen_info; xres = si->lfb_width;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 3/107 ARM: dts: meson8: fix the size of the PMU registers
In reply to Sasha LevinFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit 46c9585ed4af688ff1be6d4e76d7ed2f04de4fba ]
The PMU registers are at least 0x18 bytes wide. Meson8b already uses a size of 0x18. The structure of the PMU registers on Meson8 and Meson8b is similar but not identical.
Meson8 and Meson8b have the following registers in common (starting at AOBUS + 0xe0):
#define AO_RTI_PWR_A9_CNTL0 0xe0 (0x38 << 2)
#define AO_RTI_PWR_A9_CNTL1 0xe4 (0x39 << 2)
#define AO_RTI_GEN_PWR_SLEEP0 0xe8 (0x3a << 2)
#define AO_RTI_GEN_PWR_ISO0 0x4c (0x3b << 2)
Meson8b additionally has these three registers:
#define AO_RTI_GEN_PWR_ACK0 0xf0 (0x3c << 2)
#define AO_RTI_PWR_A9_MEM_PD0 0xf4 (0x3d << 2)
#define AO_RTI_PWR_A9_MEM_PD1 0xf8 (0x3e << 2)
Thus we can assume that the register size of the PMU IP blocks is identical on both SoCs (and Meson8 just contains some reserved registers in that area) because the CEC registers start right after the PMU (AO_RTI_*) registers at AOBUS + 0x100 (0x40 << 2).
The upcoming power domain driver will need to read and write the AO_RTI_GEN_PWR_SLEEP0 and AO_RTI_GEN_PWR_ISO0 registers, so the updated size is needed for that driver to work.
--- arch/arm/boot/dts/meson8.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/meson8.dtsi +1 -1
@@ -253,7 +253,7 @@ &aobus { pmu: pmu@e0 { compatible = "amlogic,meson8-pmu", "syscon"; - reg = <0xe0 0x8>; + reg = <0xe0 0x18>; }; pinctrl_aobus: pinctrl@84 {
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 23/107 clk: sunxi-ng: sun8i-r: Fix divider on APB0 clock
In reply to Sasha LevinFrom: Samuel Holland <[email protected]>
[ Upstream commit 47d64fef1f3ffbdf960d3330b9865fc9f12fdf84 ]
According to the BSP source code, the APB0 clock on the H3 and H5 has a normal M divider, not a power-of-two divider. This matches the hardware in the A83T (as described in both the BSP source code and the manual). Since the A83T and H3/A64 clocks are actually the same, we can merge the definitions.
--- drivers/clk/sunxi-ng/ccu-sun8i-r.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-)
drivers/clk/sunxi-ng/ccu-sun8i-r.c +3 -18
@@ -51,19 +51,7 @@ static struct ccu_div ar100_clk = { static CLK_FIXED_FACTOR_HW(ahb0_clk, "ahb0", &ar100_clk.common.hw, 1, 1, 0); -static struct ccu_div apb0_clk = { - .div =_SUNXI_CCU_DIV_FLAGS (0 ,2 ,CLK_DIVIDER_POWER_OF_TWO ), - - .common = { - .reg =0x0c , - .hw.init =CLK_HW_INIT_HW ("apb0" , - &ahb0_clk.hw, - &ccu_div_ops, -0 ), - }, -}; - -static SUNXI_CCU_M(a83t_apb0_clk, "apb0", "ahb0", 0x0c, 0, 2, 0); +static SUNXI_CCU_M(apb0_clk, "apb0", "ahb0", 0x0c, 0, 2, 0);/* * Define the parent as an array that can be reused to save space
@@ -127,7 +115,7 @@ static struct ccu_mp a83t_ir_clk = {static struct ccu_common *sun8i_a83t_r_ccu_clks[] = { &ar100_clk.common, - &a83t_apb0_clk.common, + &apb0_clk.common, &apb0_pio_clk.common, &apb0_ir_clk.common, &apb0_timer_clk.common,
@@ -167,7 +155,7 @@ static struct clk_hw_onecell_data sun8i_a83t_r_hw_clks = { .hws = { [CLK_AR100] = &ar100_clk.common.hw, [CLK_AHB0] = &ahb0_clk.hw, - [CLK_APB0] = &a83t_apb0_clk.common.hw, + [CLK_APB0] = &apb0_clk.common.hw, [CLK_APB0_PIO] = &apb0_pio_clk.common.hw, [CLK_APB0_IR] = &apb0_ir_clk.common.hw, [CLK_APB0_TIMER] = &apb0_timer_clk.common.hw,
@@ -282,9 +270,6 @@ static void __init sunxi_r_ccu_init(struct device_node *node,static void __init sun8i_a83t_r_ccu_setup (struct device_node *node) { -/* Fix apb0 bus gate parents here */ - apb0_gate_parent[0 ] = &a83t_apb0_clk.common.hw; -sunxi_r_ccu_init (node, &sun8i_a83t_r_ccu_desc); } CLK_OF_DECLARE(sun8i_a83t_r_ccu, "allwinner,sun8i-a83t-r-ccu",
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 24/107 clk: sunxi-ng: h6-r: Fix AR100/R_APB2 parent order
In reply to Sasha LevinFrom: Samuel Holland <[email protected]>
[ Upstream commit 0c545240aebc2ccb8f661dc54283a14d64659804 ]
According to the BSP source code, both the AR100 and R_APB2 clocks have PLL_PERIPH0 as mux index 3, not 2 as it was on previous chips. The pre- divider used for PLL_PERIPH0 should be changed to index 3 to match.
This was verified by running a rough benchmark on the AR100 with various clock settings:
| mux | pre-divider | iterations/second | clock source |
|=====|=============|===================|==============|
| 0 | 0 | 19033 (stable) | osc24M |
| 2 | 5 | 11466 (unstable) | iosc/osc16M |
| 2 | 17 | 11422 (unstable) | iosc/osc16M |
| 3 | 5 | 85338 (stable) | pll-periph0 |
| 3 | 17 | 27167 (stable) | pll-periph0 |The relative performance numbers all match up (with pll-periph0 running at its default 600MHz).
--- drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/sunxi-ng/ccu-sun50i-h6-r.c +2 -2
@@ -23,9 +23,9 @@*/ static const char *const ar100_r_apb2_parents[] = {"osc24M" ,"osc32k" , -"pll-periph0" ,"iosc" }; +"iosc" ,"pll-periph0" };static const struct ccu_mux_var_prediv ar100_r_apb2_predivs[] = { - { .index =2 , .shift =0 , .width =5 }, + { .index =3 , .shift =0 , .width =5 }, };static struct ccu_div ar100_clk = {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 31/107 ARM: dts: imx6qdl-sabresd: Remove incorrect power supply assignment
In reply to Sasha LevinFrom: Anson Huang <[email protected]>
[ Upstream commit 4521de30fbb3f5be0db58de93582ebce72c9d44f ]
The vdd3p0 LDO's input should be from external USB VBUS directly, NOT PMIC's power supply, the vdd3p0 LDO's target output voltage can be controlled by SW, and it requires input voltage to be high enough, with incorrect power supply assigned, if the power supply's voltage is lower than the LDO target output voltage, it will return fail and skip the LDO voltage adjustment, so remove the power supply assignment for vdd3p0 to avoid such scenario.
--- arch/arm/boot/dts/imx6qdl-sabresd.dtsi | 4 ---- 1 file changed, 4 deletions(-)
arch/arm/boot/dts/imx6qdl-sabresd.dtsi +0 -4
@@ -749,10 +749,6 @@ vin-supply = <&vgen5_reg>; }; -®_vdd3p0 { - vin-supply = <&sw2_reg>; -}; - ®_vdd2p5 { vin-supply = <&vgen5_reg>; };
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 29/107 ASoC: rt5640: Fix NULL dereference on module unload
In reply to Sasha LevinFrom: Dmitry Osipenko <[email protected]>
[ Upstream commit 89b71b3f02d8ae5a08a1dd6f4a2098b7b868d498 ]
The rt5640->jack is NULL if jack is already disabled at the time of driver's module unloading.
--- sound/soc/codecs/rt5640.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/soc/codecs/rt5640.c +7 -0
@@ -2432,6 +2432,13 @@ static void rt5640_disable_jack_detect(struct snd_soc_component *component) {struct rt5640_priv *rt5640 =snd_soc_component_get_drvdata (component); +/* +* soc_remove_component() force-disables jack and thus rt5640->jack +* could be NULL at the time of driver's module unloading. +*/ +if (!rt5640->jack) +return ; +disable_irq (rt5640->irq);rt5640_cancel_work (rt5640);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 36/107 s390/zcrypt: move ap device reset from bus to driver code
In reply to Sasha LevinFrom: Harald Freudenberger <[email protected]>
[ Upstream commit 0c874cd04292c7ee22d70eefc341fa2648f41f46 ]
This patch moves the reset invocation of an ap device when fresh detected from the ap bus to the probe() function of the driver responsible for this device.
The virtualisation of ap devices makes it necessary to remove unconditioned resets on fresh appearing apqn devices. It may be that such a device is already enabled for guest usage. So there may be a race condition between host ap bus and guest ap bus doing the reset. This patch moves the reset from the ap bus to the zcrypt drivers. So if there is no zcrypt driver bound to an ap device - for example the ap device is bound to the vfio device driver - the ap device is untouched passed to the vfio device driver.
--- drivers/s390/crypto/ap_bus.c | 2 -- drivers/s390/crypto/ap_bus.h | 2 +- drivers/s390/crypto/ap_queue.c | 5 +++-- drivers/s390/crypto/zcrypt_cex2a.c | 1 + drivers/s390/crypto/zcrypt_cex2c.c | 2 ++ drivers/s390/crypto/zcrypt_cex4.c | 1 + 6 files changed, 8 insertions(+), 5 deletions(-)
drivers/s390/crypto/ap_bus.c +0 -2
@@ -793,8 +793,6 @@ static int ap_device_probe(struct device *dev) drvres = ap_drv->flags &AP_DRIVER_FLAG_DEFAULT ;if (!!devres != !!drvres)return -ENODEV ; -/* (re-)init queue's state machine */ -ap_queue_reinit_state (to_ap_queue (dev)); }/* Add queue/card to list of active queues/cards */
drivers/s390/crypto/ap_bus.h +1 -1
@@ -261,7 +261,7 @@ void ap_queue_prepare_remove(struct ap_queue *aq);void ap_queue_remove (struct ap_queue *aq);void ap_queue_suspend (struct ap_device *ap_dev);void ap_queue_resume (struct ap_device *ap_dev); -void ap_queue_reinit_state (struct ap_queue *aq); +void ap_queue_init_state (struct ap_queue *aq);struct ap_card *ap_card_create (int id,int queue_depth,int raw_device_type,int comp_device_type,unsigned int functions);
drivers/s390/crypto/ap_queue.c +3 -2
@@ -638,7 +638,7 @@ struct ap_queue *ap_queue_create(ap_qid_t qid, int device_type) aq->ap_dev.device.type = &ap_queue_type; aq->ap_dev.device_type = device_type; aq->qid = qid; - aq->state =AP_STATE_RESET_START ; + aq->state =AP_STATE_UNBOUND ; aq->interrupt =AP_INTR_DISABLED ;spin_lock_init (&aq->lock);INIT_LIST_HEAD (&aq->list);
@@ -771,10 +771,11 @@ void ap_queue_remove(struct ap_queue *aq)spin_unlock_bh (&aq->lock); } -void ap_queue_reinit_state (struct ap_queue *aq) +void ap_queue_init_state (struct ap_queue *aq) {spin_lock_bh (&aq->lock); aq->state =AP_STATE_RESET_START ;ap_wait (ap_sm_event (aq,AP_EVENT_POLL ));spin_unlock_bh (&aq->lock); } +EXPORT_SYMBOL (ap_queue_init_state);
drivers/s390/crypto/zcrypt_cex2a.c +1 -0
@@ -175,6 +175,7 @@ static int zcrypt_cex2a_queue_probe(struct ap_device *ap_dev) zq->queue = aq; zq->online =1 ;atomic_set (&zq->load,0 ); +ap_queue_init_state (aq);ap_queue_init_reply (aq, &zq->reply); aq->request_timeout =CEX2A_CLEANUP_TIME , aq->private = zq;
drivers/s390/crypto/zcrypt_cex2c.c +2 -0
@@ -220,6 +220,7 @@ static int zcrypt_cex2c_queue_probe(struct ap_device *ap_dev) zq->queue = aq; zq->online =1 ;atomic_set (&zq->load,0 ); +ap_rapq (aq->qid); rc =zcrypt_cex2c_rng_supported (aq);if (rc <0 ) {zcrypt_queue_free (zq);
@@ -231,6 +232,7 @@ static int zcrypt_cex2c_queue_probe(struct ap_device *ap_dev)else zq->ops =zcrypt_msgtype (MSGTYPE06_NAME ,MSGTYPE06_VARIANT_NORNG ); +ap_queue_init_state (aq);ap_queue_init_reply (aq, &zq->reply); aq->request_timeout =CEX2C_CLEANUP_TIME ; aq->private = zq;
drivers/s390/crypto/zcrypt_cex4.c +1 -0
@@ -381,6 +381,7 @@ static int zcrypt_cex4_queue_probe(struct ap_device *ap_dev) zq->queue = aq; zq->online =1 ;atomic_set (&zq->load,0 ); +ap_queue_init_state (aq);ap_queue_init_reply (aq, &zq->reply); aq->request_timeout =CEX4_CLEANUP_TIME , aq->private = zq;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 35/107 ARM: dts: imx7: Fix Toradex Colibri iMX7S 256MB NAND flash support
In reply to Sasha LevinFrom: Marcel Ziswiler <[email protected]>
[ Upstream commit 4b0b97e651ecf29f20248420b52b6864fbd40bc2 ]
Turns out when introducing the eMMC version the gpmi node required for NAND flash support got enabled exclusively on Colibri iMX7D 512MB.
--- arch/arm/boot/dts/imx7s-colibri.dtsi | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/boot/dts/imx7s-colibri.dtsi +4 -0
@@ -49,3 +49,7 @@ reg = <0x80000000 0x10000000>; }; }; + +&gpmi { + status = "okay"; +};
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 37/107 s390/setup: Fix secure ipl message
In reply to Sasha LevinFrom: Philipp Rudo <[email protected]>
[ Upstream commit 40260b01d029ba374637838213af500e03305326 ]
The new machine loader on z15 always creates an IPL Report block and thus sets the IPL_PL_FLAG_IPLSR even when secure boot is disabled. This causes the wrong message being printed at boot. Fix this by checking for IPL_PL_FLAG_SIPL instead.
--- arch/s390/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/kernel/setup.c +1 -1
@@ -1059,7 +1059,7 @@ static void __init log_component_list(void)if (!early_ipl_comp_list_addr)return ; -if (ipl_block.hdr.flags &IPL_PL_FLAG_IPLSR ) +if (ipl_block.hdr.flags &IPL_PL_FLAG_SIPL )pr_info ("Linux is running with Secure-IPL enabled\n" );else pr_info ("Linux is running with Secure-IPL disabled\n" );
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 34/107 ARM: dts: imx6sll-evk: Remove incorrect power supply assignment
In reply to Sasha LevinFrom: Anson Huang <[email protected]>
[ Upstream commit 3479b2843c78ffb60247f522226ba68f93aee355 ]
The vdd3p0 LDO's input should be from external USB VBUS directly, NOT PMIC's power supply, the vdd3p0 LDO's target output voltage can be controlled by SW, and it requires input voltage to be high enough, with incorrect power supply assigned, if the power supply's voltage is lower than the LDO target output voltage, it will return fail and skip the LDO voltage adjustment, so remove the power supply assignment for vdd3p0 to avoid such scenario.
--- arch/arm/boot/dts/imx6sll-evk.dts | 4 ---- 1 file changed, 4 deletions(-)
arch/arm/boot/dts/imx6sll-evk.dts +0 -4
@@ -265,10 +265,6 @@ status = "okay"; }; -®_3p0 { - vin-supply = <&sw2_reg>; -}; - &snvs_poweroff { status = "okay"; };
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 4/107 dt-bindings: reset: meson8b: fix duplicate reset IDs
In reply to Sasha LevinFrom: Martin Blumenstingl <[email protected]>
[ Upstream commit 4881873f4cc1460f63d85fa81363d56be328ccdc ]
According to the public S805 datasheet the RESET2 register uses the following bits for the PIC_DC, PSC and NAND reset lines:
- PIC_DC is at bit 3 (meaning: RESET_VD_RMEM + 3)
- PSC is at bit 4 (meaning: RESET_VD_RMEM + 4)
- NAND is at bit 5 (meaning: RESET_VD_RMEM + 4)
Update the reset IDs of these three reset lines so they don't conflict with PIC_DC and map to the actual hardware reset lines.
--- include/dt-bindings/reset/amlogic,meson8b-reset.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/dt-bindings/reset/amlogic,meson8b-reset.h +3 -3
@@ -46,9 +46,9 @@#define RESET_VD_RMEM 64#define RESET_AUDIN 65#define RESET_DBLK 66 -#define RESET_PIC_DC 66 -#define RESET_PSC 66 -#define RESET_NAND 66 +#define RESET_PIC_DC 67 +#define RESET_PSC 68 +#define RESET_NAND 69#define RESET_GE2D 70#define RESET_PARSER_REG 71#define RESET_PARSER_FETCH 72
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 47/107 net: bpf: Don't leak time wait and request sockets
In reply to Sasha LevinFrom: Lorenz Bauer <[email protected]>
[ Upstream commit 2e012c74823629d9db27963c79caa3f5b2010746 ]
It's possible to leak time wait and request sockets via the following BPF pseudo code:
sk = bpf_skc_lookup_tcp(...)
if (sk)
bpf_sk_release(sk)
If sk->sk_state is TCP_NEW_SYN_RECV or TCP_TIME_WAIT the refcount taken by bpf_skc_lookup_tcp is not undone by bpf_sk_release. This is because sk_flags is re-used for other data in both kinds of sockets. The check
!sock_flag(sk, SOCK_RCU_FREE)
therefore returns a bogus result. Check that sk_flags is valid by calling sk_fullsock. Skip checking SOCK_RCU_FREE if we already know that sk is not a full socket.
--- net/core/filter.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
net/core/filter.c +4 -5
@@ -5305,8 +5305,7 @@ __bpf_sk_lookup(struct sk_buff *skb, struct bpf_sock_tuple *tuple, u32 len,if (sk) { sk =sk_to_full_sk (sk);if (!sk_fullsock (sk)) { -if (!sock_flag (sk,SOCK_RCU_FREE )) -sock_gen_put (sk); +sock_gen_put (sk);return NULL ; } }
@@ -5343,8 +5342,7 @@ bpf_sk_lookup(struct sk_buff *skb, struct bpf_sock_tuple *tuple, u32 len,if (sk) { sk =sk_to_full_sk (sk);if (!sk_fullsock (sk)) { -if (!sock_flag (sk,SOCK_RCU_FREE )) -sock_gen_put (sk); +sock_gen_put (sk);return NULL ; } }
@@ -5411,7 +5409,8 @@ static const struct bpf_func_proto bpf_sk_lookup_udp_proto = { BPF_CALL_1(bpf_sk_release, struct sock *, sk) { -if (!sock_flag (sk,SOCK_RCU_FREE )) +/* Only full sockets have sk->sk_flags. */ +if (!sk_fullsock (sk) || !sock_flag (sk,SOCK_RCU_FREE ))sock_gen_put (sk);return 0 ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 50/107 bpftool: Fix printing incorrect pointer in btf_dump_ptr
In reply to Sasha LevinFrom: Martin KaFai Lau <[email protected]>
[ Upstream commit 555089fdfc37ad65e0ee9b42ca40c238ff546f83 ]
For plain text output, it incorrectly prints the pointer value "void *data". The "void *data" is actually pointing to memory that contains a bpf-map's value. The intention is to print the content of the bpf-map's value instead of printing the pointer pointing to the bpf-map's value.
In this case, a member of the bpf-map's value is a pointer type. Thus, it should print the "*(void **)data".
--- tools/bpf/bpftool/btf_dumper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bpf/bpftool/btf_dumper.c +1 -1
@@ -26,7 +26,7 @@ static void btf_dumper_ptr(const void *data, json_writer_t *jw, bool is_plain_text) {if (is_plain_text) -jsonw_printf (jw,"%p" , data); +jsonw_printf (jw,"%p" , *(void **)data);else jsonw_printf (jw,"%lu" , *(unsigned long *)data); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 54/107 ASoC: hdac_hda: Fix error in driver removal after failed probe
In reply to Sasha LevinFrom: Kai Vehmanen <[email protected]>
[ Upstream commit 552b1a85da9f63856e7e341b81c16e0e078204f1 ]
In case system has multiple HDA codecs, and codec probe fails for at least one but not all codecs, driver will end up cancelling a non-initialized timer context upon driver removal.
Call trace of typical case:
[ 60.593646] WARNING: CPU: 1 PID: 1147 at kernel/workqueue.c:3032 __flush_work+0x18b/0x1a0 [...] [ 60.593670] __cancel_work_timer+0x11f/0x1a0 [ 60.593673] hdac_hda_dev_remove+0x25/0x30 [snd_soc_hdac_hda] [ 60.593674] device_release_driver_internal+0xe0/0x1c0 [ 60.593675] bus_remove_device+0xd6/0x140 [ 60.593677] device_del+0x175/0x3e0 [ 60.593679] ? widget_tree_free.isra.7+0x90/0xb0 [snd_hda_core] [ 60.593680] snd_hdac_device_unregister+0x34/0x50 [snd_hda_core] [ 60.593682] snd_hdac_ext_bus_device_remove+0x2a/0x60 [snd_hda_ext_core] [ 60.593684] hda_dsp_remove+0x26/0x100 [snd_sof_intel_hda_common] [ 60.593686] snd_sof_device_remove+0x84/0xa0 [snd_sof] [ 60.593687] sof_pci_remove+0x10/0x30 [snd_sof_pci] [ 60.593689] pci_device_remove+0x36/0xb0
--- sound/soc/codecs/hdac_hda.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/codecs/hdac_hda.c +3 -1
@@ -498,7 +498,9 @@ static int hdac_hda_dev_remove(struct hdac_device *hdev)struct hdac_hda_priv *hda_pvt; hda_pvt =dev_get_drvdata (&hdev->dev); -cancel_delayed_work_sync (&hda_pvt->codec.jackpoll_work); +if (hda_pvt && hda_pvt->codec.registered) +cancel_delayed_work_sync (&hda_pvt->codec.jackpoll_work); +return 0 ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 55/107 ASoC: msm8916-wcd-analog: Fix selected events for MIC BIAS External1
In reply to Sasha LevinFrom: Stephan Gerhold <[email protected]>
[ Upstream commit e0beec88397b163c7c4ea6fcfb67e8e07a2671dc ]
MIC BIAS External1 sets pm8916_wcd_analog_enable_micbias_ext1() as event handler, which ends up in pm8916_wcd_analog_enable_micbias_ext().
But pm8916_wcd_analog_enable_micbias_ext() only handles the POST_PMU event, which is not specified in the event flags for MIC BIAS External1. This means that the code in the event handler is never actually run.
Set SND_SOC_DAPM_POST_PMU as the only event for the handler to fix this.
--- sound/soc/codecs/msm8916-wcd-analog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/msm8916-wcd-analog.c +2 -2
@@ -888,10 +888,10 @@ static const struct snd_soc_dapm_widget pm8916_wcd_analog_dapm_widgets[] = {SND_SOC_DAPM_SUPPLY ("MIC BIAS External1" ,CDC_A_MICB_1_EN ,7 ,0 , pm8916_wcd_analog_enable_micbias_ext1, -SND_SOC_DAPM_PRE_PMU |SND_SOC_DAPM_POST_PMD ), +SND_SOC_DAPM_POST_PMU ),SND_SOC_DAPM_SUPPLY ("MIC BIAS External2" ,CDC_A_MICB_2_EN ,7 ,0 , pm8916_wcd_analog_enable_micbias_ext2, -SND_SOC_DAPM_POST_PMU |SND_SOC_DAPM_POST_PMD ), +SND_SOC_DAPM_POST_PMU ), SND_SOC_DAPM_ADC_E("ADC1", NULL, CDC_A_TX_1_EN, 7, 0, pm8916_wcd_analog_enable_adc,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 53/107 ASoC: SOF: Intel: fix HDA codec driver probe with multiple controllers
In reply to Sasha LevinFrom: Kai Vehmanen <[email protected]>
[ Upstream commit 2c63bea714780f8e1fc9cb7bc10deda26fada25b ]
In case system has multiple HDA controllers, it can happen that same HDA codec driver is used for codecs of multiple controllers. In this case, SOF may fail to probe the HDA driver and SOF initialization fails.
SOF HDA code currently relies that a call to request_module() will also run device matching logic to attach driver to the codec instance. However if driver for another HDA controller was already loaded and it already loaded the HDA codec driver, this breaks current logic in SOF. In this case the request_module() SOF does becomes a no-op and HDA Codec driver is not attached to the codec instance sitting on the HDA bus SOF is controlling. Typical scenario would be a system with both external and internal GPUs, with driver of the external GPU loaded first.
Fix this by adding similar logic as is used in legacy HDA driver where an explicit device_attach() call is done after request_module().
Also add logic to propagate errors reported by device_attach() back to caller. This also works in the case where drivers are not built as modules.
--- sound/soc/sof/intel/hda-codec.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
sound/soc/sof/intel/hda-codec.c +12 -7
@@ -24,19 +24,18 @@#define IDISP_VID_INTEL 0x80860000/* load the legacy HDA codec driver */ -#ifdef MODULE -static void hda_codec_load_module (struct hda_codec *codec) +static int hda_codec_load_module (struct hda_codec *codec) { +#ifdef MODULE char alias[MODULE_NAME_LEN ];const char *module = alias;snd_hdac_codec_modalias (&codec->core, alias,sizeof (alias));dev_dbg (&codec->core.dev,"loading codec module: %s\n" , module);request_module (module); -} -#else -static void hda_codec_load_module (struct hda_codec *codec) {}#endif +return device_attach (hda_codec_dev (codec)); +}/* enable controller wake up event for all codecs with jack connectors */ void hda_codec_jack_wake_enable (struct snd_sof_dev *sdev)
@@ -116,10 +115,16 @@ static int hda_codec_probe(struct snd_sof_dev *sdev, int address)/* use legacy bus only for HDA codecs, idisp uses ext bus */ if ((resp &0xFFFF0000 ) !=IDISP_VID_INTEL ) { hdev->type =HDA_DEV_LEGACY ; -hda_codec_load_module (&hda_priv->codec); + ret =hda_codec_load_module (&hda_priv->codec); +/* +* handle ret==0 (no driver bound) as an error, but pass +* other return codes without modification +*/ +if (ret ==0 ) + ret = -ENOENT ; } -return 0 ; +return ret;#else hdev =devm_kzalloc (sdev->dev,sizeof (*hdev),GFP_KERNEL );if (!hdev)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 56/107 ASoC: sti: fix possible sleep-in-atomic
In reply to Sasha LevinFrom: Arnaud Pouliquen <[email protected]>
[ Upstream commit ce780a47c3c01e1e179d0792df6b853a913928f1 ]
Change mutex and spinlock management to avoid sleep in atomic issue.
--- sound/soc/sti/uniperif_player.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
sound/soc/sti/uniperif_player.c +4 -3
@@ -226,7 +226,6 @@ static void uni_player_set_channel_status(struct uniperif *player,* sampling frequency. If no sample rate is already specified, then * set one. */ -mutex_lock (&player->ctrl_lock);if (runtime) {switch (runtime->rate) {case 22050 :
@@ -303,7 +302,6 @@ static void uni_player_set_channel_status(struct uniperif *player, player->stream_settings.iec958.status[3 + (n *4 )] <<24 ;SET_UNIPERIF_CHANNEL_STA_REGN (player, n, status); } -mutex_unlock (&player->ctrl_lock);/* Update the channel status */ if (player->ver <SND_ST_UNIPERIF_VERSION_UNI_PLR_TOP_1_0 )
@@ -365,8 +363,10 @@ static int uni_player_prepare_iec958(struct uniperif *player,SET_UNIPERIF_CTRL_ZERO_STUFF_HW (player); +mutex_lock (&player->ctrl_lock);/* Update the channel status */ uni_player_set_channel_status (player, runtime); +mutex_unlock (&player->ctrl_lock);/* Clear the user validity user bits */ SET_UNIPERIF_USER_VALIDITY_VALIDITY_LR (player,0 );
@@ -598,7 +598,6 @@ static int uni_player_ctl_iec958_put(struct snd_kcontrol *kcontrol, iec958->status[1 ] = ucontrol->value.iec958.status[1 ]; iec958->status[2 ] = ucontrol->value.iec958.status[2 ]; iec958->status[3 ] = ucontrol->value.iec958.status[3 ]; -mutex_unlock (&player->ctrl_lock);spin_lock_irqsave (&player->irq_lock, flags);if (player->substream && player->substream->runtime)
@@ -608,6 +607,8 @@ static int uni_player_ctl_iec958_put(struct snd_kcontrol *kcontrol,uni_player_set_channel_status (player,NULL );spin_unlock_irqrestore (&player->irq_lock, flags); +mutex_unlock (&player->ctrl_lock); +return 0 ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 57/107 ASoC: msm8916-wcd-analog: Fix MIC BIAS Internal1
In reply to Sasha LevinFrom: Stephan Gerhold <[email protected]>
[ Upstream commit 057efcf9faea4769cf1020677d93d040db9b23f3 ]
MIC BIAS Internal1 is broken at the moment because we always enable the internal rbias resistor to the TX2 line (connected to the headset microphone), rather than enabling the resistor connected to TX1.
Move the RBIAS code to pm8916_wcd_analog_enable_micbias_int1/2() to fix this.
--- sound/soc/codecs/msm8916-wcd-analog.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
sound/soc/codecs/msm8916-wcd-analog.c +13 -3
@@ -391,9 +391,6 @@ static int pm8916_wcd_analog_enable_micbias_int(struct snd_soc_componentswitch (event) {case SND_SOC_DAPM_PRE_PMU : -snd_soc_component_update_bits (component,CDC_A_MICB_1_INT_RBIAS , -MICB_1_INT_TX2_INT_RBIAS_EN_MASK , -MICB_1_INT_TX2_INT_RBIAS_EN_ENABLE );snd_soc_component_update_bits (component, reg,MICB_1_EN_PULL_DOWN_EN_MASK ,0 ); snd_soc_component_update_bits(component, CDC_A_MICB_1_EN, MICB_1_EN_OPA_STG2_TAIL_CURR_MASK,
@@ -443,6 +440,14 @@ static int pm8916_wcd_analog_enable_micbias_int1(structstruct snd_soc_component *component =snd_soc_dapm_to_component (w->dapm);struct pm8916_wcd_analog_priv *wcd =snd_soc_component_get_drvdata (component); +switch (event) { +case SND_SOC_DAPM_PRE_PMU : +snd_soc_component_update_bits (component,CDC_A_MICB_1_INT_RBIAS , +MICB_1_INT_TX1_INT_RBIAS_EN_MASK , +MICB_1_INT_TX1_INT_RBIAS_EN_ENABLE ); +break ; + } +return pm8916_wcd_analog_enable_micbias_int (component, event, w->reg, wcd->micbias1_cap_mode); }
@@ -553,6 +558,11 @@ static int pm8916_wcd_analog_enable_micbias_int2(structstruct pm8916_wcd_analog_priv *wcd =snd_soc_component_get_drvdata (component);switch (event) { +case SND_SOC_DAPM_PRE_PMU : +snd_soc_component_update_bits (component,CDC_A_MICB_1_INT_RBIAS , +MICB_1_INT_TX2_INT_RBIAS_EN_MASK , +MICB_1_INT_TX2_INT_RBIAS_EN_ENABLE ); +break ;case SND_SOC_DAPM_POST_PMU :pm8916_mbhc_configure_bias (wcd, true);break ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 63/107 parisc: Use proper printk format for resource_size_t
In reply to Sasha LevinFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 4f80b70e1953cb846dbdd1ce72cb17333d4c8d11 ]
resource_size_t should be printed with its own size-independent format to fix warnings when compiling on 64-bit platform (e.g. with COMPILE_TEST):
arch/parisc/kernel/drivers.c: In function 'print_parisc_device':
arch/parisc/kernel/drivers.c:892:9: warning:
format '%p' expects argument of type 'void *',
but argument 4 has type 'resource_size_t {aka unsigned int}' [-Wformat=]
--- arch/parisc/kernel/drivers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/parisc/kernel/drivers.c +2 -2
@@ -889,8 +889,8 @@ static void print_parisc_device(struct parisc_device *dev)static int count;print_pa_hwpath (dev, hw_path); -pr_info ("%d. %s at 0x%px [%s] { %d, 0x%x, 0x%.3x, 0x%.5x }" , - ++count, dev->name, (void *) dev->hpa.start, hw_path, dev->id.hw_type, +pr_info ("%d. %s at %pap [%s] { %d, 0x%x, 0x%.3x, 0x%.5x }" , + ++count, dev->name, &(dev->hpa.start), hw_path, dev->id.hw_type, dev->id.hversion_rev, dev->id.hversion, dev->id.sversion);if (dev->num_addrs) {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 65/107 ptp: free ptp device pin descriptors properly
In reply to Sasha LevinFrom: Vladis Dronov <[email protected]>
[ Upstream commit 75718584cb3c64e6269109d4d54f888ac5a5fd15 ]
There is a bug in ptp_clock_unregister(), where ptp_cleanup_pin_groups() first frees ptp->pin_{,dev_}attr, but then posix_clock_unregister() needs them to destroy a related sysfs device.
These functions can not be just swapped, as posix_clock_unregister() frees ptp which is needed in the ptp_cleanup_pin_groups(). Fix this by calling ptp_cleanup_pin_groups() in ptp_clock_release(), right before ptp is freed.
This makes this patch fix an UAF bug in a patch which fixes an UAF bug.
--- drivers/ptp/ptp_clock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/ptp/ptp_clock.c +2 -2
@@ -170,6 +170,7 @@ static void ptp_clock_release(struct device *dev) { struct ptp_clock *ptp = container_of(dev, struct ptp_clock, dev); +ptp_cleanup_pin_groups (ptp);mutex_destroy (&ptp->tsevq_mux);mutex_destroy (&ptp->pincfg_mux);ida_simple_remove (&ptp_clocks_map, ptp->index);
@@ -302,9 +303,8 @@ int ptp_clock_unregister(struct ptp_clock *ptp)if (ptp->pps_source)pps_unregister_source (ptp->pps_source); -ptp_cleanup_pin_groups (ptp); -posix_clock_unregister (&ptp->clock); +return 0 ; }EXPORT_SYMBOL (ptp_clock_unregister);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 67/107 r8152: add missing endpoint sanity check
In reply to Sasha LevinFrom: Johan Hovold <[email protected]>
[ Upstream commit 86f3f4cd53707ceeec079b83205c8d3c756eca93 ]
Add missing endpoint sanity check to probe in order to prevent a NULL-pointer dereference (or slab out-of-bounds access) when retrieving the interrupt-endpoint bInterval on ndo_open() in case a device lacks the expected endpoints.
--- drivers/net/usb/r8152.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/usb/r8152.c +3 -0
@@ -5587,6 +5587,9 @@ static int rtl8152_probe(struct usb_interface *intf,return -ENODEV ; } +if (intf->cur_altsetting->desc.bNumEndpoints <3 ) +return -ENODEV ; +usb_reset_device (udev); netdev =alloc_etherdev (sizeof (struct r8152 ));if (!netdev) {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 59/107 netfilter: fix a use-after-free in mtype_destroy()
In reply to Sasha LevinFrom: Cong Wang <[email protected]>
[ Upstream commit c120959387efa51479056fd01dc90adfba7a590c ]
map->members is freed by ip_set_free() right before using it in mtype_ext_cleanup() again. So we just have to move it down.
--- net/netfilter/ipset/ip_set_bitmap_gen.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/ipset/ip_set_bitmap_gen.h +1 -1
@@ -60,9 +60,9 @@ mtype_destroy(struct ip_set *set)if (SET_WITH_TIMEOUT (set))del_timer_sync (&map->gc); -ip_set_free (map->members);if (set->dsize && set->extensions &IPSET_EXT_DESTROY )mtype_ext_cleanup (set); +ip_set_free (map->members);ip_set_free (map); set->data =NULL ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 66/107 net: usb: lan78xx: limit size of local TSO packets
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit f8d7408a4d7f60f8b2df0f81decdc882dd9c20dc ]
lan78xx_tx_bh() makes sure to not exceed MAX_SINGLE_PACKET_SIZE bytes in the aggregated packets it builds, but does nothing to prevent large GSO packets being submitted.
Pierre-Francois reported various hangs when/if TSO is enabled.
For localy generated packets, we can use netif_set_gso_max_size() to limit the size of TSO packets.
Note that forwarded packets could still hit the issue, so a complete fix might require implementing .ndo_features_check for this driver, forcing a software segmentation if the size of the TSO packet exceeds MAX_SINGLE_PACKET_SIZE.
--- drivers/net/usb/lan78xx.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/lan78xx.c +1 -0
@@ -3750,6 +3750,7 @@ static int lan78xx_probe(struct usb_interface *intf,/* MTU range: 68 - 9000 */ netdev->max_mtu =MAX_SINGLE_PACKET_SIZE ; +netif_set_gso_max_size (netdev,MAX_SINGLE_PACKET_SIZE -MAX_HEADER ); dev->ep_blkin = (intf->cur_altsetting)->endpoint +0 ; dev->ep_blkout = (intf->cur_altsetting)->endpoint +1 ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 82/107 bpf: Fix incorrect verifier simulation of ARSH under ALU32
In reply to Sasha LevinFrom: Daniel Borkmann <[email protected]>
[ Upstream commit 0af2ffc93a4b50948f9dad2786b7f1bd253bf0b9 ]
Anatoly has been fuzzing with kBdysch harness and reported a hang in one of the outcomes:
0: R1=ctx(id=0,off=0,imm=0) R10=fp0
0: (85) call bpf_get_socket_cookie#46
1: R0_w=invP(id=0) R10=fp0
1: (57) r0 &= 808464432
2: R0_w=invP(id=0,umax_value=808464432,var_off=(0x0; 0x30303030)) R10=fp0
2: (14) w0 -= 810299440
3: R0_w=invP(id=0,umax_value=4294967295,var_off=(0xcf800000; 0x3077fff0)) R10=fp0
3: (c4) w0 s>>= 1
4: R0_w=invP(id=0,umin_value=1740636160,umax_value=2147221496,var_off=(0x67c00000; 0x183bfff8)) R10=fp0 4: (76) if w0 s>= 0x30303030 goto pc+216
221: R0_w=invP(id=0,umin_value=1740636160,umax_value=2147221496,var_off=(0x67c00000; 0x183bfff8)) R10=fp0 221: (95) exit
processed 6 insns (limit 1000000) [...]
Taking a closer look, the program was xlated as follows:
# ./bpftool p d x i 12 0: (85) call bpf_get_socket_cookie#7800896 1: (bf) r6 = r0 2: (57) r6 &= 808464432 3: (14) w6 -= 810299440 4: (c4) w6 s>>= 1 5: (76) if w6 s>= 0x30303030 goto pc+216 6: (05) goto pc-1 7: (05) goto pc-1 8: (05) goto pc-1 [...] 220: (05) goto pc-1 221: (05) goto pc-1 222: (95) exit
Meaning, the visible effect is very similar to f54c7898ed1c ("bpf: Fix precision tracking for unbounded scalars"), that is, the fall-through branch in the instruction 5 is considered to be never taken given the conclusion from the min/max bounds tracking in w6, and therefore the dead-code sanitation rewrites it as goto pc-1. However, real-life input disagrees with verification analysis since a soft-lockup was observed.
The bug sits in the analysis of the ARSH. The definition is that we shift the target register value right by K bits through shifting in copies of its sign bit. In adjust_scalar_min_max_vals(), we do first coerce the register into 32 bit mode, same happens after simulating the operation. However, for the case of simulating the actual ARSH, we don't take the mode into account and act as if it's always 64 bit, but location of sign bit is different:
dst_reg->smin_value >>= umin_val; dst_reg->smax_value >>= umin_val; dst_reg->var_off = tnum_arshift(dst_reg->var_off, umin_val);
Consider an unknown R0 where bpf_get_socket_cookie() (or others) would for example return 0xffff. With the above ARSH simulation, we'd see the following results:
[...]
1: R1=ctx(id=0,off=0,imm=0) R2_w=invP65535 R10=fp0 1: (85) call bpf_get_socket_cookie#46
2: R0_w=invP(id=0) R10=fp0
2: (57) r0 &= 808464432
-> R0_runtime = 0x3030
3: R0_w=invP(id=0,umax_value=808464432,var_off=(0x0; 0x30303030)) R10=fp0
3: (14) w0 -= 810299440
-> R0_runtime = 0xcfb40000
4: R0_w=invP(id=0,umax_value=4294967295,var_off=(0xcf800000; 0x3077fff0)) R10=fp0
(0xffffffff)
4: (c4) w0 s>>= 1
-> R0_runtime = 0xe7da0000
5: R0_w=invP(id=0,umin_value=1740636160,umax_value=2147221496,var_off=(0x67c00000; 0x183bfff8)) R10=fp0
(0x67c00000) (0x7ffbfff8)[...]
In insn 3, we have a runtime value of 0xcfb40000, which is '1100 1111 1011 0100 0000 0000 0000 0000', the result after the shift has 0xe7da0000 that is '1110 0111 1101 1010 0000 0000 0000 0000', where the sign bit is correctly retained in 32 bit mode. In insn4, the umax was 0xffffffff, and changed into 0x7ffbfff8 after the shift, that is, '0111 1111 1111 1011 1111 1111 1111 1000' and means here that the simulation didn't retain the sign bit. With above logic, the updates happen on the 64 bit min/max bounds and given we coerced the register, the sign bits of the bounds are cleared as well, meaning, we need to force the simulation into s32 space for 32 bit alu mode.
Verification after the fix below. We're first analyzing the fall-through branch on 32 bit signed >= test eventually leading to rejection of the program in this specific case:
0: R1=ctx(id=0,off=0,imm=0) R10=fp0
0: (b7) r2 = 808464432
1: R1=ctx(id=0,off=0,imm=0) R2_w=invP808464432 R10=fp0
1: (85) call bpf_get_socket_cookie#46
2: R0_w=invP(id=0) R10=fp0
2: (bf) r6 = r0
3: R0_w=invP(id=0) R6_w=invP(id=0) R10=fp0
3: (57) r6 &= 808464432
4: R0_w=invP(id=0) R6_w=invP(id=0,umax_value=808464432,var_off=(0x0; 0x30303030)) R10=fp0
4: (14) w6 -= 810299440
5: R0_w=invP(id=0) R6_w=invP(id=0,umax_value=4294967295,var_off=(0xcf800000; 0x3077fff0)) R10=fp0 5: (c4) w6 s>>= 1
6: R0_w=invP(id=0) R6_w=invP(id=0,umin_value=3888119808,umax_value=4294705144,var_off=(0xe7c00000; 0x183bfff8)) R10=fp0
(0x67c00000) (0xfffbfff8)
6: (76) if w6 s>= 0x30303030 goto pc+216
7: R0_w=invP(id=0) R6_w=invP(id=0,umin_value=3888119808,umax_value=4294705144,var_off=(0xe7c00000; 0x183bfff8)) R10=fp0 7: (30) r0 = *(u8 *)skb[808464432]
BPF_LD_[ABS|IND] uses reserved fields
processed 8 insns (limit 1000000) [...]
--- include/linux/tnum.h | 2 +- kernel/bpf/tnum.c | 9 +++++++-- kernel/bpf/verifier.c | 13 ++++++++++--- 3 files changed, 18 insertions(+), 6 deletions(-)
include/linux/tnum.h +1 -1
@@ -30,7 +30,7 @@ struct tnum tnum_lshift(struct tnum a, u8 shift);/* Shift (rsh) a tnum right (by a fixed shift) */ struct tnum tnum_rshift (struct tnum a,u8 shift);/* Shift (arsh) a tnum right (by a fixed min_shift) */ -struct tnum tnum_arshift (struct tnum a,u8 min_shift); +struct tnum tnum_arshift (struct tnum a,u8 min_shift,u8 insn_bitness);/* Add two tnums, return @a + @b */ struct tnum tnum_add (struct tnum a,struct tnum b);/* Subtract two tnums, return @a - @b */
kernel/bpf/tnum.c +7 -2
@@ -44,14 +44,19 @@ struct tnum tnum_rshift(struct tnum a, u8 shift)return TNUM (a.value >> shift, a.mask >> shift); } -struct tnum tnum_arshift (struct tnum a,u8 min_shift) +struct tnum tnum_arshift (struct tnum a,u8 min_shift,u8 insn_bitness) {/* if a.value is negative, arithmetic shifting by minimum shift * will have larger negative offset compared to more shifting. * If a.value is nonnegative, arithmetic shifting by minimum shift * will have larger positive offset compare to more shifting. */ -return TNUM ((s64 )a.value >> min_shift, (s64 )a.mask >> min_shift); +if (insn_bitness ==32 ) +return TNUM ((u32)(((s32 )a.value) >> min_shift), + (u32)(((s32 )a.mask) >> min_shift)); +else +return TNUM ((s64 )a.value >> min_shift, + (s64 )a.mask >> min_shift); }struct tnum tnum_add (struct tnum a,struct tnum b)
kernel/bpf/verifier.c +10 -3
@@ -4824,9 +4824,16 @@ static int adjust_scalar_min_max_vals(struct bpf_verifier_env *env,/* Upon reaching here, src_known is true and * umax_val is equal to umin_val. */ - dst_reg->smin_value >>= umin_val; - dst_reg->smax_value >>= umin_val; - dst_reg->var_off =tnum_arshift (dst_reg->var_off, umin_val); +if (insn_bitness ==32 ) { + dst_reg->smin_value = (u32)(((s32 )dst_reg->smin_value) >> umin_val); + dst_reg->smax_value = (u32)(((s32 )dst_reg->smax_value) >> umin_val); + }else { + dst_reg->smin_value >>= umin_val; + dst_reg->smax_value >>= umin_val; + } + + dst_reg->var_off =tnum_arshift (dst_reg->var_off, umin_val, + insn_bitness);/* blow away the dst_reg umin_value/umax_value and rely on * dst_reg var_off to refine the result.
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 84/107 net: stmmac: selftests: Make it work in Synopsys AXS101 boards
In reply to Sasha LevinFrom: Jose Abreu <[email protected]>
[ Upstream commit 0b9f932edc1a461933bfde08e620362e2190e0dd ]
Synopsys AXS101 boards do not support unaligned memory loads or stores. Change the selftests mechanism to explicity:
- Not add extra alignment in TX SKB
- Use the unaligned version of ether_addr_equal()
--- .../stmicro/stmmac/stmmac_selftests.c | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +11 -9
@@ -80,7 +80,7 @@ static struct sk_buff *stmmac_test_get_udp_skb(struct stmmac_priv *priv,if (attr->max_size && (attr->max_size > size)) size = attr->max_size; - skb =netdev_alloc_skb_ip_align (priv->dev, size); + skb =netdev_alloc_skb (priv->dev, size);if (!skb)return NULL ;
@@ -244,6 +244,8 @@ static int stmmac_test_loopback_validate(struct sk_buff *skb, struct net_device *orig_ndev) {struct stmmac_test_priv *tpriv = pt->af_packet_priv; +unsigned char *src = tpriv->packet->src; +unsigned char *dst = tpriv->packet->dst;struct stmmachdr *shdr;struct ethhdr *ehdr;struct udphdr *uhdr;
@@ -260,15 +262,15 @@ static int stmmac_test_loopback_validate(struct sk_buff *skb, goto out; ehdr = (struct ethhdr *)skb_mac_header (skb); -if (tpriv->packet->dst) { -if (!ether_addr_equal (ehdr->h_dest, tpriv->packet->dst)) +if (dst) { +if (!ether_addr_equal_unaligned (ehdr->h_dest, dst)) goto out; }if (tpriv->packet->sarc) { -if (!ether_addr_equal (ehdr->h_source, ehdr->h_dest)) +if (!ether_addr_equal_unaligned (ehdr->h_source, ehdr->h_dest)) goto out; - }else if (tpriv->packet->src) { -if (!ether_addr_equal (ehdr->h_source, tpriv->packet->src)) + }else if (src) { +if (!ether_addr_equal_unaligned (ehdr->h_source, src)) goto out; }
@@ -714,7 +716,7 @@ static int stmmac_test_flowctrl_validate(struct sk_buff *skb,struct ethhdr *ehdr; ehdr = (struct ethhdr *)skb_mac_header (skb); -if (!ether_addr_equal (ehdr->h_source, orig_ndev->dev_addr)) +if (!ether_addr_equal_unaligned (ehdr->h_source, orig_ndev->dev_addr)) goto out;if (ehdr->h_proto !=htons (ETH_P_PAUSE )) goto out;
@@ -856,7 +858,7 @@ static int stmmac_test_vlan_validate(struct sk_buff *skb, } ehdr = (struct ethhdr *)skb_mac_header (skb); -if (!ether_addr_equal (ehdr->h_dest, tpriv->packet->dst)) +if (!ether_addr_equal_unaligned (ehdr->h_dest, tpriv->packet->dst)) goto out; ihdr =ip_hdr (skb);
@@ -1554,7 +1556,7 @@ static int stmmac_test_arp_validate(struct sk_buff *skb,struct arphdr *ahdr; ehdr = (struct ethhdr *)skb_mac_header (skb); -if (!ether_addr_equal (ehdr->h_dest, tpriv->packet->src)) +if (!ether_addr_equal_unaligned (ehdr->h_dest, tpriv->packet->src)) goto out; ahdr =arp_hdr (skb);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 89/107 net: ethernet: ave: Avoid lockdep warning
In reply to Sasha LevinFrom: Kunihiko Hayashi <[email protected]>
[ Upstream commit 82d5d6a638cbd12b7dfe8acafd9efd87a656cc06 ]
When building with PROVE_LOCKING=y, lockdep shows the following dump message.
INFO: trying to register non-static key. the code is fine but needs lockdep annotation. turning off the locking correctness validator.
...
Calling device_set_wakeup_enable() directly occurs this issue, and it isn't necessary for initialization, so this patch creates internal function __ave_ethtool_set_wol() and replaces with this in ave_init() and ave_resume().
--- drivers/net/ethernet/socionext/sni_ave.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
drivers/net/ethernet/socionext/sni_ave.c +13 -7
@@ -424,16 +424,22 @@ static void ave_ethtool_get_wol(struct net_device *ndev,phy_ethtool_get_wol (ndev->phydev, wol); } -static int ave_ethtool_set_wol (struct net_device *ndev, -struct ethtool_wolinfo *wol) +static int __ave_ethtool_set_wol (struct net_device *ndev, +struct ethtool_wolinfo *wol) { -int ret; -if (!ndev->phydev || (wol->wolopts & (WAKE_ARP |WAKE_MAGICSECURE )))return -EOPNOTSUPP ; - ret =phy_ethtool_set_wol (ndev->phydev, wol); +return phy_ethtool_set_wol (ndev->phydev, wol); +} + +static int ave_ethtool_set_wol (struct net_device *ndev, +struct ethtool_wolinfo *wol) +{ +int ret; + + ret =__ave_ethtool_set_wol (ndev, wol);if (!ret)device_set_wakeup_enable (&ndev->dev, !!wol->wolopts);
@@ -1216,7 +1222,7 @@ static int ave_init(struct net_device *ndev)/* set wol initial state disabled */ wol.wolopts =0 ; -ave_ethtool_set_wol (ndev, &wol); +__ave_ethtool_set_wol (ndev, &wol);if (!phy_interface_is_rgmii (phydev))phy_set_max_speed (phydev,SPEED_100 );
@@ -1768,7 +1774,7 @@ static int ave_resume(struct device *dev)ave_ethtool_get_wol (ndev, &wol); wol.wolopts = priv->wolopts; -ave_ethtool_set_wol (ndev, &wol); +__ave_ethtool_set_wol (ndev, &wol);if (ndev->phydev) { ret =phy_resume (ndev->phydev);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 76/107 mlxsw: switchx2: Do not modify cloned SKBs during xmit
In reply to Sasha LevinFrom: Ido Schimmel <[email protected]>
[ Upstream commit 63963d0f9d17be83d0e419e03282847ecc2c3715 ]
The driver needs to prepend a Tx header to each packet it is transmitting. The header includes information such as the egress port and traffic class.
The addition of the header requires the driver to modify the SKB's header and therefore it must not be shared. Otherwise, we risk hitting various race conditions.
For example, when a packet is flooded (cloned) by the bridge driver to two switch ports swp1 and swp2:
t0 - mlxsw_sp_port_xmit() is called for swp1. Tx header is prepended with
swp1's port number
t1 - mlxsw_sp_port_xmit() is called for swp2. Tx header is prepended with
swp2's port number, overwriting swp1's port number
t2 - The device processes data buffer from t0. Packet is transmitted via
swp2
t3 - The device processes data buffer from t1. Packet is transmitted via
swp2
Usually, the device is fast enough and transmits the packet before its Tx header is overwritten, but this is not the case in emulated environments.
Fix this by making sure the SKB's header is writable by calling skb_cow_head(). Since the function ensures we have headroom to push the Tx header, the check further in the function can be removed.
v2:
* Use skb_cow_head() instead of skb_unshare() as suggested by Jakub
* Remove unnecessary check regarding headroom
--- drivers/net/ethernet/mellanox/mlxsw/switchx2.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/switchx2.c +6 -11
@@ -299,22 +299,17 @@ static netdev_tx_t mlxsw_sx_port_xmit(struct sk_buff *skb,u64 len;int err; +if (skb_cow_head (skb,MLXSW_TXHDR_LEN )) { +this_cpu_inc (mlxsw_sx_port->pcpu_stats->tx_dropped); +dev_kfree_skb_any (skb); +return NETDEV_TX_OK ; + } +memset (skb->cb,0 ,sizeof (struct mlxsw_skb_cb ));if (mlxsw_core_skb_transmit_busy (mlxsw_sx->core, &tx_info))return NETDEV_TX_BUSY ; -if (unlikely (skb_headroom (skb) <MLXSW_TXHDR_LEN )) { -struct sk_buff *skb_orig = skb; - - skb =skb_realloc_headroom (skb,MLXSW_TXHDR_LEN ); -if (!skb) { -this_cpu_inc (mlxsw_sx_port->pcpu_stats->tx_dropped); -dev_kfree_skb_any (skb_orig); -return NETDEV_TX_OK ; - } -dev_consume_skb_any (skb_orig); - }mlxsw_sx_txhdr_construct (skb, &tx_info);/* TX header is consumed by HW on the way so we shouldn't count its * bytes as being sent.
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 91/107 netfilter: nft_tunnel: fix null-attribute check
In reply to Sasha LevinFrom: Florian Westphal <[email protected]>
[ Upstream commit 1c702bf902bd37349f6d91cd7f4b372b1e46d0ed ]
else we get null deref when one of the attributes is missing, both must be non-null.
--- net/netfilter/nft_tunnel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nft_tunnel.c +1 -1
@@ -76,7 +76,7 @@ static int nft_tunnel_get_init(const struct nft_ctx *ctx,struct nft_tunnel *priv =nft_expr_priv (expr);u32 len; -if (!tb[NFTA_TUNNEL_KEY ] && +if (!tb[NFTA_TUNNEL_KEY ] || !tb[NFTA_TUNNEL_DREG ])return -EINVAL ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 93/107 netfilter: nf_tables: remove WARN and add NLA_STRING upper limits
In reply to Sasha LevinFrom: Florian Westphal <[email protected]>
[ Upstream commit 9332d27d7918182add34e8043f6a754530fdd022 ]
This WARN can trigger because some of the names fed to the module autoload function can be of arbitrary length.
Remove the WARN and add limits for all NLA_STRING attributes.
--- net/netfilter/nf_tables_api.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
net/netfilter/nf_tables_api.c +9 -4
@@ -22,6 +22,8 @@#include <net/net_namespace.h> #include <net/sock.h> +#define NFT_MODULE_AUTOLOAD_LIMIT (MODULE_NAME_LEN - sizeof("nft-expr-255-")) +static LIST_HEAD (nf_tables_expressions);static LIST_HEAD (nf_tables_objects);static LIST_HEAD (nf_tables_flowtables);
@@ -519,7 +521,7 @@ static void nft_request_module(struct net *net, const char *fmt, ...)va_start (args, fmt); ret =vsnprintf (module_name,MODULE_NAME_LEN , fmt, args);va_end (args); -if (WARN (ret >=MODULE_NAME_LEN ,"truncated: '%s' (len %d)" , module_name, ret)) +if (ret >=MODULE_NAME_LEN )return ;mutex_unlock (&net->nft.commit_mutex);
@@ -1175,7 +1177,8 @@ static const struct nla_policy nft_chain_policy[NFTA_CHAIN_MAX + 1] = { .len = NFT_CHAIN_MAXNAMELEN - 1 }, [NFTA_CHAIN_HOOK] = { .type = NLA_NESTED }, [NFTA_CHAIN_POLICY] = { .type = NLA_U32 }, - [NFTA_CHAIN_TYPE] = { .type = NLA_STRING }, + [NFTA_CHAIN_TYPE] = { .type = NLA_STRING, + .len = NFT_MODULE_AUTOLOAD_LIMIT }, [NFTA_CHAIN_COUNTERS] = { .type = NLA_NESTED }, [NFTA_CHAIN_FLAGS] = { .type = NLA_U32 }, };
@@ -2089,7 +2092,8 @@ static const struct nft_expr_type *nft_expr_type_get(struct net *net, }static const struct nla_policy nft_expr_policy[NFTA_EXPR_MAX +1 ] = { - [NFTA_EXPR_NAME ] = { .type =NLA_STRING }, + [NFTA_EXPR_NAME ] = { .type =NLA_STRING , + .len =NFT_MODULE_AUTOLOAD_LIMIT }, [NFTA_EXPR_DATA ] = { .type =NLA_NESTED }, };
@@ -3932,7 +3936,8 @@ static const struct nla_policy nft_set_elem_policy[NFTA_SET_ELEM_MAX + 1] = { [NFTA_SET_ELEM_USERDATA ] = { .type =NLA_BINARY , .len = NFT_USERDATA_MAXLEN }, [NFTA_SET_ELEM_EXPR] = { .type = NLA_NESTED }, - [NFTA_SET_ELEM_OBJREF] = { .type = NLA_STRING }, + [NFTA_SET_ELEM_OBJREF ] = { .type =NLA_STRING , + .len = NFT_OBJ_MAXNAMELEN - 1 }, };static const struct nla_policy nft_set_elem_list_policy[NFTA_SET_ELEM_LIST_MAX +1 ] = {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 81/107 hv_netvsc: Fix memory leak when removing rndis device
In reply to Sasha LevinFrom: Mohammed Gamal <[email protected]>
[ Upstream commit 536dc5df2808efbefc5acee334d3c4f701790ec0 ]
kmemleak detects the following memory leak when hot removing a network device:
unreferenced object 0xffff888083f63600 (size 256):
comm "kworker/0:1", pid 12, jiffies 4294831717 (age 1113.676s) hex dump (first 32 bytes):
00 40 c7 33 80 88 ff ff 00 00 00 00 10 00 00 00 [email protected]............ 00 00 00 00 ad 4e ad de ff ff ff ff 00 00 00 00 .....N.......... backtrace: [<00000000d4a8f5be>] rndis_filter_device_add+0x117/0x11c0 [hv_netvsc] [<000000009c02d75b>] netvsc_probe+0x5e7/0xbf0 [hv_netvsc] [<00000000ddafce23>] vmbus_probe+0x74/0x170 [hv_vmbus] [<00000000046e64f1>] really_probe+0x22f/0xb50 [<000000005cc35eb7>] driver_probe_device+0x25e/0x370 [<0000000043c642b2>] bus_for_each_drv+0x11f/0x1b0 [<000000005e3d09f0>] __device_attach+0x1c6/0x2f0 [<00000000a72c362f>] bus_probe_device+0x1a6/0x260 [<0000000008478399>] device_add+0x10a3/0x18e0 [<00000000cf07b48c>] vmbus_device_register+0xe7/0x1e0 [hv_vmbus] [<00000000d46cf032>] vmbus_add_channel_work+0x8ab/0x1770 [hv_vmbus] [<000000002c94bb64>] process_one_work+0x919/0x17d0 [<0000000096de6781>] worker_thread+0x87/0xb40 [<00000000fbe7397e>] kthread+0x333/0x3f0 [<000000004f844269>] ret_from_fork+0x3a/0x50
rndis_filter_device_add() allocates an instance of struct rndis_device which never gets deallocated as rndis_filter_device_remove() sets net_device->extension which points to the rndis_device struct to NULL, leaving the rndis_device dangling.
Since net_device->extension is eventually freed in free_netvsc_device(), we refrain from setting it to NULL inside rndis_filter_device_remove()
--- drivers/net/hyperv/rndis_filter.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/hyperv/rndis_filter.c +0 -2
@@ -1436,8 +1436,6 @@ void rndis_filter_device_remove(struct hv_device *dev,/* Halt and release the rndis device */ rndis_filter_halt_device (net_dev, rndis_dev); - net_dev->extension =NULL ; -netvsc_device_remove (dev); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 86/107 scsi: storvsc: Correctly set number of hardware queues for IDE disk
In reply to Sasha LevinFrom: Long Li <[email protected]>
[ Upstream commit 7b571c19d4c0b78d27dd3bf1f3c42e4032390af6 ]
Commit 0ed881027690 ("scsi: storvsc: setup 1:1 mapping between hardware queue and CPU queue") introduced a regression for disks attached to IDE. For these disks the host VSP only offers one VMBUS channel. Setting multiple queues can overload the VMBUS channel and result in performance drop for high queue depth workload on system with large number of CPUs.
Fix it by leaving the number of hardware queues to 1 (default value) for IDE disks.
--- drivers/scsi/storvsc_drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/storvsc_drv.c +3 -1
@@ -1835,9 +1835,11 @@ static int storvsc_probe(struct hv_device *device,*/ host->sg_tablesize = (stor_device->max_transfer_bytes >>PAGE_SHIFT );/* +* For non-IDE disks, the host supports multiple channels. * Set the number of HW queues we are supporting. */ - host->nr_hw_queues =num_present_cpus (); +if (!dev_is_ide) + host->nr_hw_queues =num_present_cpus ();/* * Set the error handler work queue.
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 8/107 ARM: dts: sun8i: a83t: Correct USB3503 GPIOs polarity
In reply to Sasha LevinFrom: Marek Szyprowski <[email protected]>
[ Upstream commit 1c226017d3ec93547b58082bdf778d9db7401c95 ]
Current USB3503 driver ignores GPIO polarity and always operates as if the GPIO lines were flagged as ACTIVE_HIGH. Fix the polarity for the existing USB3503 chip applications to match the chip specification and common convention for naming the pins. The only pin, which has to be ACTIVE_LOW is the reset pin. The remaining are ACTIVE_HIGH. This change allows later to fix the USB3503 driver to properly use generic GPIO bindings and read polarity from DT.
--- arch/arm/boot/dts/sun8i-a83t-cubietruck-plus.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/sun8i-a83t-cubietruck-plus.dts +1 -1
@@ -101,7 +101,7 @@ initial-mode = <1>; /* initialize in HUB mode */ disabled-ports = <1>; intn-gpios = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */ - reset-gpios = <&pio 4 16 GPIO_ACTIVE_HIGH>; /* PE16 */ + reset-gpios = <&pio 4 16 GPIO_ACTIVE_LOW>; /* PE16 */ connect-gpios = <&pio 4 17 GPIO_ACTIVE_HIGH>; /* PE17 */ refclk-frequency = <19200000>; };
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 43/107 ASoC: stm32: sai: fix possible circular locking
In reply to Sasha LevinFrom: Olivier Moysan <[email protected]>
[ Upstream commit a14bf98c045bf119b7e779f186528e38c6428830 ]
In current driver, locks can be taken as follows:
- Register access: take a lock on regmap config and then on clock.
- Master clock provider: take a lock on clock and then on regmap config. This can lead to the circular locking summarized below.
Remove peripheral clock management through regmap framework, and manage peripheral clock in driver instead. On register access, lock on clock is taken first, which allows to avoid possible locking issue.
[ 6696.561513] ======================================================
[ 6696.567670] WARNING: possible circular locking dependency detected
[ 6696.573842] 4.19.49 #866 Not tainted
[ 6696.577397] ------------------------------------------------------
[ 6696.583566] pulseaudio/6439 is trying to acquire lock:
[ 6696.588697] 87b0a25b (enable_lock){..-.}, at: clk_enable_lock+0x64/0x128
[ 6696.595377]
[ 6696.595377] but task is already holding lock:
[ 6696.601197] d858f825 (stm32_sai_sub:1342:(sai->regmap_config)->lock){....}
...
[ 6696.812513] Possible unsafe locking scenario:
[ 6696.812513]
[ 6696.818418] CPU0 CPU1
[ 6696.822935] ---- ----
[ 6696.827451] lock(stm32_sai_sub:1342:(sai->regmap_config)->lock);
[ 6696.833618] lock(enable_lock);
[ 6696.839350] lock(stm32_sai_sub:1342:
(sai->regmap_config)->lock);
[ 6696.848035] lock(enable_lock);--- sound/soc/stm/stm32_sai_sub.c | 194 ++++++++++++++++++++++++---------- 1 file changed, 140 insertions(+), 54 deletions(-)
sound/soc/stm/stm32_sai_sub.c +140 -54
@@ -184,6 +184,56 @@ static bool stm32_sai_sub_writeable_reg(struct device *dev, unsigned int reg) } } +static int stm32_sai_sub_reg_up (struct stm32_sai_sub_data *sai, +unsigned int reg,unsigned int mask, +unsigned int val) +{ +int ret; + + ret =clk_enable (sai->pdata->pclk); +if (ret <0 ) +return ret; + + ret =regmap_update_bits (sai->regmap, reg, mask, val); + +clk_disable (sai->pdata->pclk); + +return ret; +} + +static int stm32_sai_sub_reg_wr (struct stm32_sai_sub_data *sai, +unsigned int reg,unsigned int mask, +unsigned int val) +{ +int ret; + + ret =clk_enable (sai->pdata->pclk); +if (ret <0 ) +return ret; + + ret =regmap_write_bits (sai->regmap, reg, mask, val); + +clk_disable (sai->pdata->pclk); + +return ret; +} + +static int stm32_sai_sub_reg_rd (struct stm32_sai_sub_data *sai, +unsigned int reg,unsigned int *val) +{ +int ret; + + ret =clk_enable (sai->pdata->pclk); +if (ret <0 ) +return ret; + + ret =regmap_read (sai->regmap, reg, val); + +clk_disable (sai->pdata->pclk); + +return ret; +} +static const struct regmap_config stm32_sai_sub_regmap_config_f4 = { .reg_bits =32 , .reg_stride =4 ,
@@ -295,7 +345,7 @@ static int stm32_sai_set_clk_div(struct stm32_sai_sub_data *sai, mask =SAI_XCR1_MCKDIV_MASK (SAI_XCR1_MCKDIV_WIDTH (version)); cr1 =SAI_XCR1_MCKDIV_SET (div); - ret =regmap_update_bits (sai->regmap,STM_SAI_CR1_REGX , mask, cr1); + ret =stm32_sai_sub_reg_up (sai,STM_SAI_CR1_REGX , mask, cr1);if (ret <0 )dev_err (&sai->pdev->dev,"Failed to update CR1 register\n" );
@@ -372,8 +422,8 @@ static int stm32_sai_mclk_enable(struct clk_hw *hw)dev_dbg (&sai->pdev->dev,"Enable master clock\n" ); -return regmap_update_bits (sai->regmap,STM_SAI_CR1_REGX , -SAI_XCR1_MCKEN ,SAI_XCR1_MCKEN ); +return stm32_sai_sub_reg_up (sai,STM_SAI_CR1_REGX , +SAI_XCR1_MCKEN ,SAI_XCR1_MCKEN ); }static void stm32_sai_mclk_disable (struct clk_hw *hw)
@@ -383,7 +433,7 @@ static void stm32_sai_mclk_disable(struct clk_hw *hw)dev_dbg (&sai->pdev->dev,"Disable master clock\n" ); -regmap_update_bits (sai->regmap,STM_SAI_CR1_REGX ,SAI_XCR1_MCKEN ,0 ); +stm32_sai_sub_reg_up (sai,STM_SAI_CR1_REGX ,SAI_XCR1_MCKEN ,0 ); }static const struct clk_ops mclk_ops = {
@@ -446,15 +496,15 @@ static irqreturn_t stm32_sai_isr(int irq, void *devid)unsigned int sr, imr, flags;snd_pcm_state_t status =SNDRV_PCM_STATE_RUNNING ; -regmap_read (sai->regmap,STM_SAI_IMR_REGX , &imr); -regmap_read (sai->regmap,STM_SAI_SR_REGX , &sr); +stm32_sai_sub_reg_rd (sai,STM_SAI_IMR_REGX , &imr); +stm32_sai_sub_reg_rd (sai,STM_SAI_SR_REGX , &sr); flags = sr & imr;if (!flags)return IRQ_NONE ; -regmap_write_bits (sai->regmap,STM_SAI_CLRFR_REGX ,SAI_XCLRFR_MASK , -SAI_XCLRFR_MASK ); +stm32_sai_sub_reg_wr (sai,STM_SAI_CLRFR_REGX ,SAI_XCLRFR_MASK , +SAI_XCLRFR_MASK );if (!sai->substream) {dev_err (&pdev->dev,"Device stopped. Spurious IRQ 0x%x\n" , sr);
@@ -503,8 +553,8 @@ static int stm32_sai_set_sysclk(struct snd_soc_dai *cpu_dai,int ret;if (dir ==SND_SOC_CLOCK_OUT && sai->sai_mclk) { - ret =regmap_update_bits (sai->regmap,STM_SAI_CR1_REGX , -SAI_XCR1_NODIV , + ret =stm32_sai_sub_reg_up (sai,STM_SAI_CR1_REGX , +SAI_XCR1_NODIV , freq ?0 :SAI_XCR1_NODIV );if (ret <0 )return ret;
@@ -583,7 +633,7 @@ static int stm32_sai_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai, u32 tx_mask, slotr_mask |=SAI_XSLOTR_SLOTEN_MASK ; -regmap_update_bits (sai->regmap,STM_SAI_SLOTR_REGX , slotr_mask, slotr); +stm32_sai_sub_reg_up (sai,STM_SAI_SLOTR_REGX , slotr_mask, slotr); sai->slot_width = slot_width; sai->slots = slots;
@@ -665,7 +715,7 @@ static int stm32_sai_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) cr1_mask |=SAI_XCR1_CKSTR ; frcr_mask |=SAI_XFRCR_FSPOL ; -regmap_update_bits (sai->regmap,STM_SAI_FRCR_REGX , frcr_mask, frcr); +stm32_sai_sub_reg_up (sai,STM_SAI_FRCR_REGX , frcr_mask, frcr);/* DAI clock master masks */ switch (fmt &SND_SOC_DAIFMT_MASTER_MASK ) {
@@ -693,7 +743,7 @@ static int stm32_sai_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) cr1_mask |=SAI_XCR1_SLAVE ; conf_update: - ret =regmap_update_bits (sai->regmap,STM_SAI_CR1_REGX , cr1_mask, cr1); + ret =stm32_sai_sub_reg_up (sai,STM_SAI_CR1_REGX , cr1_mask, cr1);if (ret <0 ) {dev_err (cpu_dai->dev,"Failed to update CR1 register\n" );return ret;
@@ -730,12 +780,12 @@ static int stm32_sai_startup(struct snd_pcm_substream *substream, }/* Enable ITs */ -regmap_write_bits (sai->regmap,STM_SAI_CLRFR_REGX , -SAI_XCLRFR_MASK ,SAI_XCLRFR_MASK ); +stm32_sai_sub_reg_wr (sai,STM_SAI_CLRFR_REGX , +SAI_XCLRFR_MASK ,SAI_XCLRFR_MASK ); imr =SAI_XIMR_OVRUDRIE ;if (STM_SAI_IS_CAPTURE (sai)) { -regmap_read (sai->regmap,STM_SAI_CR2_REGX , &cr2); +stm32_sai_sub_reg_rd (sai,STM_SAI_CR2_REGX , &cr2);if (cr2 &SAI_XCR2_MUTECNT_MASK ) imr |=SAI_XIMR_MUTEDETIE ; }
@@ -745,8 +795,8 @@ static int stm32_sai_startup(struct snd_pcm_substream *substream,else imr |=SAI_XIMR_AFSDETIE |SAI_XIMR_LFSDETIE ; -regmap_update_bits (sai->regmap,STM_SAI_IMR_REGX , -SAI_XIMR_MASK , imr); +stm32_sai_sub_reg_up (sai,STM_SAI_IMR_REGX , +SAI_XIMR_MASK , imr);return 0 ; }
@@ -763,10 +813,10 @@ static int stm32_sai_set_config(struct snd_soc_dai *cpu_dai,* SAI fifo threshold is set to half fifo, to keep enough space * for DMA incoming bursts. */ -regmap_write_bits (sai->regmap,STM_SAI_CR2_REGX , -SAI_XCR2_FFLUSH |SAI_XCR2_FTH_MASK , -SAI_XCR2_FFLUSH | -SAI_XCR2_FTH_SET (STM_SAI_FIFO_TH_HALF )); +stm32_sai_sub_reg_wr (sai,STM_SAI_CR2_REGX , +SAI_XCR2_FFLUSH |SAI_XCR2_FTH_MASK , +SAI_XCR2_FFLUSH | +SAI_XCR2_FTH_SET (STM_SAI_FIFO_TH_HALF ));/* DS bits in CR1 not set for SPDIF (size forced to 24 bits).*/ if (STM_SAI_PROTOCOL_IS_SPDIF (sai)) {
@@ -795,7 +845,7 @@ static int stm32_sai_set_config(struct snd_soc_dai *cpu_dai,if ((sai->slots ==2 ) && (params_channels (params) ==1 )) cr1 |=SAI_XCR1_MONO ; - ret =regmap_update_bits (sai->regmap,STM_SAI_CR1_REGX , cr1_mask, cr1); + ret =stm32_sai_sub_reg_up (sai,STM_SAI_CR1_REGX , cr1_mask, cr1);if (ret <0 ) {dev_err (cpu_dai->dev,"Failed to update CR1 register\n" );return ret;
@@ -809,7 +859,7 @@ static int stm32_sai_set_slots(struct snd_soc_dai *cpu_dai)struct stm32_sai_sub_data *sai =snd_soc_dai_get_drvdata (cpu_dai);int slotr, slot_sz; -regmap_read (sai->regmap,STM_SAI_SLOTR_REGX , &slotr); +stm32_sai_sub_reg_rd (sai,STM_SAI_SLOTR_REGX , &slotr);/* * If SLOTSZ is set to auto in SLOTR, align slot width on data size
@@ -831,16 +881,16 @@ static int stm32_sai_set_slots(struct snd_soc_dai *cpu_dai) sai->slots =2 ;/* The number of slots in the audio frame is equal to NBSLOT[3:0] + 1*/ -regmap_update_bits (sai->regmap,STM_SAI_SLOTR_REGX , -SAI_XSLOTR_NBSLOT_MASK , -SAI_XSLOTR_NBSLOT_SET ((sai->slots -1 ))); +stm32_sai_sub_reg_up (sai,STM_SAI_SLOTR_REGX , +SAI_XSLOTR_NBSLOT_MASK , +SAI_XSLOTR_NBSLOT_SET ((sai->slots -1 )));/* Set default slots mask if not already set from DT */ if (!(slotr &SAI_XSLOTR_SLOTEN_MASK )) { sai->slot_mask = (1 << sai->slots) -1 ; -regmap_update_bits (sai->regmap, -STM_SAI_SLOTR_REGX ,SAI_XSLOTR_SLOTEN_MASK , -SAI_XSLOTR_SLOTEN_SET (sai->slot_mask)); +stm32_sai_sub_reg_up (sai, +STM_SAI_SLOTR_REGX ,SAI_XSLOTR_SLOTEN_MASK , +SAI_XSLOTR_SLOTEN_SET (sai->slot_mask)); } dev_dbg(cpu_dai->dev, "Slots %d, slot width %d\n",
@@ -870,14 +920,14 @@ static void stm32_sai_set_frame(struct snd_soc_dai *cpu_dai)dev_dbg (cpu_dai->dev,"Frame length %d, frame active %d\n" , sai->fs_length, fs_active); -regmap_update_bits (sai->regmap,STM_SAI_FRCR_REGX , frcr_mask, frcr); +stm32_sai_sub_reg_up (sai,STM_SAI_FRCR_REGX , frcr_mask, frcr);if ((sai->fmt &SND_SOC_DAIFMT_FORMAT_MASK ) ==SND_SOC_DAIFMT_LSB ) { offset = sai->slot_width - sai->data_size; -regmap_update_bits (sai->regmap,STM_SAI_SLOTR_REGX , -SAI_XSLOTR_FBOFF_MASK , -SAI_XSLOTR_FBOFF_SET (offset)); +stm32_sai_sub_reg_up (sai,STM_SAI_SLOTR_REGX , +SAI_XSLOTR_FBOFF_MASK , +SAI_XSLOTR_FBOFF_SET (offset)); } }
@@ -994,9 +1044,9 @@ static int stm32_sai_configure_clock(struct snd_soc_dai *cpu_dai,return -EINVAL ; } -regmap_update_bits (sai->regmap, -STM_SAI_CR1_REGX , -SAI_XCR1_OSR , cr1); +stm32_sai_sub_reg_up (sai, +STM_SAI_CR1_REGX , +SAI_XCR1_OSR , cr1); div =stm32_sai_get_clk_div (sai, sai_clk_rate, sai->mclk_rate);
@@ -1058,12 +1108,12 @@ static int stm32_sai_trigger(struct snd_pcm_substream *substream, int cmd,case SNDRV_PCM_TRIGGER_PAUSE_RELEASE :dev_dbg (cpu_dai->dev,"Enable DMA and SAI\n" ); -regmap_update_bits (sai->regmap,STM_SAI_CR1_REGX , -SAI_XCR1_DMAEN ,SAI_XCR1_DMAEN ); +stm32_sai_sub_reg_up (sai,STM_SAI_CR1_REGX , +SAI_XCR1_DMAEN ,SAI_XCR1_DMAEN );/* Enable SAI */ - ret =regmap_update_bits (sai->regmap,STM_SAI_CR1_REGX , -SAI_XCR1_SAIEN ,SAI_XCR1_SAIEN ); + ret =stm32_sai_sub_reg_up (sai,STM_SAI_CR1_REGX , +SAI_XCR1_SAIEN ,SAI_XCR1_SAIEN );if (ret <0 )dev_err (cpu_dai->dev,"Failed to update CR1 register\n" );break ;
@@ -1072,16 +1122,16 @@ static int stm32_sai_trigger(struct snd_pcm_substream *substream, int cmd,case SNDRV_PCM_TRIGGER_STOP :dev_dbg (cpu_dai->dev,"Disable DMA and SAI\n" ); -regmap_update_bits (sai->regmap,STM_SAI_IMR_REGX , -SAI_XIMR_MASK ,0 ); +stm32_sai_sub_reg_up (sai,STM_SAI_IMR_REGX , +SAI_XIMR_MASK ,0 ); -regmap_update_bits (sai->regmap,STM_SAI_CR1_REGX , -SAI_XCR1_SAIEN , - (unsigned int )~SAI_XCR1_SAIEN ); +stm32_sai_sub_reg_up (sai,STM_SAI_CR1_REGX , +SAI_XCR1_SAIEN , + (unsigned int )~SAI_XCR1_SAIEN ); - ret =regmap_update_bits (sai->regmap,STM_SAI_CR1_REGX , -SAI_XCR1_DMAEN , - (unsigned int )~SAI_XCR1_DMAEN ); + ret =stm32_sai_sub_reg_up (sai,STM_SAI_CR1_REGX , +SAI_XCR1_DMAEN , + (unsigned int )~SAI_XCR1_DMAEN );if (ret <0 )dev_err (cpu_dai->dev,"Failed to update CR1 register\n" );
@@ -1101,7 +1151,7 @@ static void stm32_sai_shutdown(struct snd_pcm_substream *substream,struct stm32_sai_sub_data *sai =snd_soc_dai_get_drvdata (cpu_dai);unsigned long flags; -regmap_update_bits (sai->regmap,STM_SAI_IMR_REGX ,SAI_XIMR_MASK ,0 ); +stm32_sai_sub_reg_up (sai,STM_SAI_IMR_REGX ,SAI_XIMR_MASK ,0 );clk_disable_unprepare (sai->sai_ck);
@@ -1169,7 +1219,7 @@ static int stm32_sai_dai_probe(struct snd_soc_dai *cpu_dai) cr1_mask |=SAI_XCR1_SYNCEN_MASK ; cr1 |=SAI_XCR1_SYNCEN_SET (sai->sync); -return regmap_update_bits (sai->regmap,STM_SAI_CR1_REGX , cr1_mask, cr1); +return stm32_sai_sub_reg_up (sai,STM_SAI_CR1_REGX , cr1_mask, cr1); }static const struct snd_soc_dai_ops stm32_sai_pcm_dai_ops = {
@@ -1322,8 +1372,13 @@ static int stm32_sai_sub_parse_of(struct platform_device *pdev,if (STM_SAI_HAS_PDM (sai) &&STM_SAI_IS_SUB_A (sai)) sai->regmap_config = &stm32_sai_sub_regmap_config_h7; - sai->regmap =devm_regmap_init_mmio_clk (&pdev->dev,"sai_ck" , - base, sai->regmap_config); +/* +* Do not manage peripheral clock through regmap framework as this +* can lead to circular locking issue with sai master clock provider. +* Manage peripheral clock directly in driver instead. +*/ + sai->regmap =devm_regmap_init_mmio (&pdev->dev, base, + sai->regmap_config);if (IS_ERR (sai->regmap)) {dev_err (&pdev->dev,"Failed to initialize MMIO\n" );return PTR_ERR (sai->regmap);
@@ -1420,6 +1475,10 @@ static int stm32_sai_sub_parse_of(struct platform_device *pdev,return PTR_ERR (sai->sai_ck); } + ret =clk_prepare (sai->pdata->pclk); +if (ret <0 ) +return ret; +if (STM_SAI_IS_F4 (sai->pdata))return 0 ;
@@ -1501,22 +1560,48 @@ static int stm32_sai_sub_probe(struct platform_device *pdev)return 0 ; } +static int stm32_sai_sub_remove (struct platform_device *pdev) +{ +struct stm32_sai_sub_data *sai =dev_get_drvdata (&pdev->dev); + +clk_unprepare (sai->pdata->pclk); + +return 0 ; +} +#ifdef CONFIG_PM_SLEEP static int stm32_sai_sub_suspend (struct device *dev) {struct stm32_sai_sub_data *sai =dev_get_drvdata (dev); +int ret; + + ret =clk_enable (sai->pdata->pclk); +if (ret <0 ) +return ret;regcache_cache_only (sai->regmap, true);regcache_mark_dirty (sai->regmap); + +clk_disable (sai->pdata->pclk); +return 0 ; }static int stm32_sai_sub_resume (struct device *dev) {struct stm32_sai_sub_data *sai =dev_get_drvdata (dev); +int ret; + + ret =clk_enable (sai->pdata->pclk); +if (ret <0 ) +return ret;regcache_cache_only (sai->regmap, false); -return regcache_sync (sai->regmap); + ret =regcache_sync (sai->regmap); + +clk_disable (sai->pdata->pclk); + +return ret; }#endif /* CONFIG_PM_SLEEP */
@@ -1531,6 +1616,7 @@ static struct platform_driver stm32_sai_sub_driver = { .pm = &stm32_sai_sub_pm_ops, }, .probe = stm32_sai_sub_probe, + .remove = stm32_sai_sub_remove, };module_platform_driver (stm32_sai_sub_driver);
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Sasha Levin
maintainerPATCH 11/107 soc: ti: wkup_m3_ipc: Fix race condition with rproc_boot
In reply to Sasha LevinFrom: Dave Gerlach <[email protected]>
[ Upstream commit 03729cfa0d543bc996bf959e762ec999afc8f3d2 ]
Any user of wkup_m3_ipc calls wkup_m3_ipc_get to get a handle and this checks the value of the static variable m3_ipc_state to see if the wkup_m3 is ready. Currently this is populated during probe before rproc_boot has been called, meaning there is a window of time that wkup_m3_ipc_get can return a valid handle but the wkup_m3 itself is not ready, leading to invalid IPC calls to the wkup_m3 and system instability.
To avoid this, move the population of the m3_ipc_state variable until after rproc_boot has succeeded to guarantee a valid and usable handle is always returned.
--- drivers/soc/ti/wkup_m3_ipc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/soc/ti/wkup_m3_ipc.c +2 -2
@@ -419,6 +419,8 @@ static void wkup_m3_rproc_boot_thread(struct wkup_m3_ipc *m3_ipc) ret =rproc_boot (m3_ipc->rproc);if (ret)dev_err (dev,"rproc_boot failed\n" ); +else + m3_ipc_state = m3_ipc;do_exit (0 ); }
@@ -505,8 +507,6 @@ static int wkup_m3_ipc_probe(struct platform_device *pdev) goto err_put_rproc; } - m3_ipc_state = m3_ipc; -return 0 ; err_put_rproc:
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 13/107 ARM: dts: imx6q-dhcom: fix rtc compatible
In reply to Sasha LevinFrom: Alexandre Belloni <[email protected]>
[ Upstream commit 7d7778b1396bc9e2a3875009af522beb4ea9355a ]
The only correct and documented compatible string for the rv3029 is microcrystal,rv3029. Fix it up.
--- arch/arm/boot/dts/imx6q-dhcom-som.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/imx6q-dhcom-som.dtsi +1 -1
@@ -206,7 +206,7 @@ }; rtc@56 { - compatible = "rv3029c2"; + compatible = "microcrystal,rv3029"; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_rtc_hw300>; reg = <0x56>;
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 46/107 ASoC: stm32: dfsdm: fix 16 bits record
In reply to Sasha LevinFrom: Olivier Moysan <[email protected]>
[ Upstream commit 8e55ea19125b65cffe42747359af99d545e85f2f ]
In stm32_afsdm_pcm_cb function, the transfer size is provided in bytes. However, samples are copied as 16 bits words from iio buffer. Divide by two the transfer size, to copy the right number of samples.
--- sound/soc/stm/stm32_adfsdm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
sound/soc/stm/stm32_adfsdm.c +6 -6
@@ -153,13 +153,13 @@ static const struct snd_soc_component_driver stm32_adfsdm_dai_component = { .name = "stm32_dfsdm_audio", }; -static void memcpy_32to16 (void *dest,const void *src,size_t n) +static void stm32_memcpy_32to16 (void *dest,const void *src,size_t n) {unsigned int i =0 ;u16 *d = (u16 *)dest, *s = (u16 *)src; s++; -for (i = n; i >0 ; i--) { +for (i = n >>1 ; i >0 ; i--) { *d++ = *s++; s++; }
@@ -186,8 +186,8 @@ static int stm32_afsdm_pcm_cb(const void *data, size_t size, void *private)if ((priv->pos + src_size) > buff_size) {if (format ==SNDRV_PCM_FORMAT_S16_LE ) -memcpy_32to16 (&pcm_buff[priv->pos], src_buff, - buff_size - priv->pos); +stm32_memcpy_32to16 (&pcm_buff[priv->pos], src_buff, + buff_size - priv->pos);else memcpy (&pcm_buff[priv->pos], src_buff, buff_size - priv->pos);
@@ -196,8 +196,8 @@ static int stm32_afsdm_pcm_cb(const void *data, size_t size, void *private) }if (format ==SNDRV_PCM_FORMAT_S16_LE ) -memcpy_32to16 (&pcm_buff[priv->pos], - &src_buff[src_size - cur_size], cur_size); +stm32_memcpy_32to16 (&pcm_buff[priv->pos], + &src_buff[src_size - cur_size], cur_size);else memcpy (&pcm_buff[priv->pos], &src_buff[src_size - cur_size], cur_size);
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Sasha Levin
maintainerPATCH 18/107 arm64: dts: imx8mq-librem5-devkit: use correct interrupt for the magnetometer
In reply to Sasha LevinFrom: "Angus Ainslie (Purism)" <[email protected]>
[ Upstream commit 106f7b3bf943d267eb657f34616adcaadb2ab07f ]
The LSM9DS1 uses a high level interrupt.
--- arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/imx8mq-librem5-devkit.dts +1 -1
@@ -421,7 +421,7 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_imu>; interrupt-parent = <&gpio3>; - interrupts = <19 IRQ_TYPE_LEVEL_LOW>; + interrupts = <19 IRQ_TYPE_LEVEL_HIGH>; vdd-supply = <®_3v3_p>; vddio-supply = <®_3v3_p>; };
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 14/107 arm64: dts: ls1028a: fix endian setting for dcfg
In reply to Sasha LevinFrom: Yinbo Zhu <[email protected]>
[ Upstream commit 33eae7fb2e593fdbaac15d843e2558379c6d1149 ]
DCFG block uses little endian. Fix it so that register access becomes correct.
--- arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +1 -1
@@ -158,7 +158,7 @@ dcfg: syscon@1e00000 { compatible = "fsl,ls1028a-dcfg", "syscon"; reg = <0x0 0x1e00000 0x0 0x10000>; - big-endian; + little-endian; }; rst: syscon@1e60000 {
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 30/107 ARM: dts: imx6q-icore-mipi: Use 1.5 version of i.Core MX6DL
In reply to Sasha LevinFrom: Jagan Teki <[email protected]>
[ Upstream commit 4a132f60808ae3a751e107a373f8572012352d3c ]
The EDIMM STARTER KIT i.Core 1.5 MIPI Evaluation is based on the 1.5 version of the i.Core MX6 cpu module. The 1.5 version differs from the original one for a few details, including the ethernet PHY interface clock provider.
With this commit, the ethernet interface works properly:
SMSC LAN8710/LAN8720 2188000.ethernet-1:00: attached PHY driver
While before using the 1.5 version, ethernet failed to startup do to un-clocked PHY interface:
fec 2188000.ethernet eth0: could not attach to PHY
Similar fix has merged for i.Core MX6Q but missed to update for DL.
--- arch/arm/boot/dts/imx6dl-icore-mipi.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/imx6dl-icore-mipi.dts +1 -1
@@ -8,7 +8,7 @@ /dts-v1/; #include "imx6dl.dtsi" -#include "imx6qdl-icore.dtsi" +#include "imx6qdl-icore-1.5.dtsi" / { model = "Engicam i.CoreM6 DualLite/Solo MIPI Starter Kit";
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 32/107 ARM: dts: imx6sx-sdb: Remove incorrect power supply assignment
In reply to Sasha LevinFrom: Anson Huang <[email protected]>
[ Upstream commit d4918ebb5c256d26696a13e78ac68c146111191a ]
The vdd3p0 LDO's input should be from external USB VBUS directly, NOT PMIC's power supply, the vdd3p0 LDO's target output voltage can be controlled by SW, and it requires input voltage to be high enough, with incorrect power supply assigned, if the power supply's voltage is lower than the LDO target output voltage, it will return fail and skip the LDO voltage adjustment, so remove the power supply assignment for vdd3p0 to avoid such scenario.
--- arch/arm/boot/dts/imx6sx-sdb-reva.dts | 4 ---- arch/arm/boot/dts/imx6sx-sdb.dts | 4 ---- 2 files changed, 8 deletions(-)
arch/arm/boot/dts/imx6sx-sdb-reva.dts +0 -4
@@ -159,10 +159,6 @@ vin-supply = <&vgen6_reg>; }; -®_vdd3p0 { - vin-supply = <&sw2_reg>; -}; - ®_vdd2p5 { vin-supply = <&vgen6_reg>; };
arch/arm/boot/dts/imx6sx-sdb.dts +0 -4
@@ -141,10 +141,6 @@ vin-supply = <&vgen6_reg>; }; -®_vdd3p0 { - vin-supply = <&sw2_reg>; -}; - ®_vdd2p5 { vin-supply = <&vgen6_reg>; };
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 33/107 ARM: dts: imx6sl-evk: Remove incorrect power supply assignment
In reply to Sasha LevinFrom: Anson Huang <[email protected]>
[ Upstream commit b4eb9ef0e29cd28c6fd684e0ab77bda824acb20e ]
The vdd3p0 LDO's input should be from external USB VBUS directly, NOT PMIC's power supply, the vdd3p0 LDO's target output voltage can be controlled by SW, and it requires input voltage to be high enough, with incorrect power supply assigned, if the power supply's voltage is lower than the LDO target output voltage, it will return fail and skip the LDO voltage adjustment, so remove the power supply assignment for vdd3p0 to avoid such scenario.
--- arch/arm/boot/dts/imx6sl-evk.dts | 4 ---- 1 file changed, 4 deletions(-)
arch/arm/boot/dts/imx6sl-evk.dts +0 -4
@@ -584,10 +584,6 @@ vin-supply = <&sw2_reg>; }; -®_vdd3p0 { - vin-supply = <&sw2_reg>; -}; - ®_vdd2p5 { vin-supply = <&sw2_reg>; };
Signature · 7 lines
2.20.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Sasha Levin
maintainerPATCH 58/107 ASoC: msm8916-wcd-digital: Reset RX interpolation path after use
In reply to Sasha LevinFrom: Stephan Gerhold <[email protected]>
[ Upstream commit 85578bbd642f65065039b1765ebe1a867d5435b0 ]
For some reason, attempting to route audio through QDSP6 on MSM8916 causes the RX interpolation path to get "stuck" after playing audio a few times. In this situation, the analog codec part is still working, but the RX path in the digital codec stops working, so you only hear the analog parts powering up. After a reboot everything works again.
So far I was not able to reproduce the problem when using lpass-cpu.
The downstream kernel driver avoids this by resetting the RX interpolation path after use. In mainline we do something similar for the TX decimator (LPASS_CDC_CLK_TX_RESET_B1_CTL), but the interpolator reset (LPASS_CDC_CLK_RX_RESET_CTL) got lost when the msm8916-wcd driver was split into analog and digital.
Fix this problem by adding the reset tomsm8916_wcd_digital_enable_interpolator().
--- sound/soc/codecs/msm8916-wcd-digital.c | 6 ++++++ 1 file changed, 6 insertions(+)
sound/soc/codecs/msm8916-wcd-digital.c +6 -0
@@ -586,6 +586,12 @@ static int msm8916_wcd_digital_enable_interpolator(snd_soc_component_write (component, rx_gain_reg[w->shift],snd_soc_component_read32 (component, rx_gain_reg[w->shift]));break ; +case SND_SOC_DAPM_POST_PMD : +snd_soc_component_update_bits (component,LPASS_CDC_CLK_RX_RESET_CTL , +1 << w->shift,1 << w->shift); +snd_soc_component_update_bits (component,LPASS_CDC_CLK_RX_RESET_CTL , +1 << w->shift,0x0 ); +break ; }return 0 ; }
Signature · 6 lines
2.20.1 _______________________________________________ Alsa-devel mailing list [email protected] https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Sasha Levin
maintainerPATCH 87/107 scsi: mptfusion: Fix double fetch bug in ioctl
In reply to Sasha LevinFrom: Dan Carpenter <[email protected]>
[ Upstream commit 28d76df18f0ad5bcf5fa48510b225f0ed262a99b ]
Tom Hatskevich reported that we look up "iocp" then, in the called functions we do a second copy_from_user() and look it up again. The problem that could cause is:
drivers/message/fusion/mptctl.c
674 /* All of these commands require an interrupt or
675 * are unknown/illegal.
676 */
677 if ((ret = mptctl_syscall_down(iocp, nonblock)) != 0)
^^^^
We take this lock.
678 return ret;
679
680 if (cmd == MPTFWDOWNLOAD)
681 ret = mptctl_fw_download(arg);
^^^Then the user memory changes and we look up "iocp" again but a different one so now we are holding the incorrect lock and have a race condition.
682 else if (cmd == MPTCOMMAND) 683 ret = mptctl_mpt_command(arg);
The security impact of this bug is not as bad as it could have been because these operations are all privileged and root already has enormous destructive power. But it's still worth fixing.
This patch passes the "iocp" pointer to the functions to avoid the second lookup. That deletes 100 lines of code from the driver so it's a nice clean up as well.
--- drivers/message/fusion/mptctl.c | 213 ++++++++------------------------ 1 file changed, 50 insertions(+), 163 deletions(-)
drivers/message/fusion/mptctl.c +50 -163
@@ -100,19 +100,19 @@ struct buflist {* Function prototypes. Called from OS entry point mptctl_ioctl. * arg contents specific to function. */ -static int mptctl_fw_download (unsigned long arg); -static int mptctl_getiocinfo (unsigned long arg,unsigned int cmd); -static int mptctl_gettargetinfo (unsigned long arg); -static int mptctl_readtest (unsigned long arg); -static int mptctl_mpt_command (unsigned long arg); -static int mptctl_eventquery (unsigned long arg); -static int mptctl_eventenable (unsigned long arg); -static int mptctl_eventreport (unsigned long arg); -static int mptctl_replace_fw (unsigned long arg); - -static int mptctl_do_reset (unsigned long arg); -static int mptctl_hp_hostinfo (unsigned long arg,unsigned int cmd); -static int mptctl_hp_targetinfo (unsigned long arg); +static int mptctl_fw_download (MPT_ADAPTER *iocp,unsigned long arg); +static int mptctl_getiocinfo (MPT_ADAPTER *iocp,unsigned long arg,unsigned int cmd); +static int mptctl_gettargetinfo (MPT_ADAPTER *iocp,unsigned long arg); +static int mptctl_readtest (MPT_ADAPTER *iocp,unsigned long arg); +static int mptctl_mpt_command (MPT_ADAPTER *iocp,unsigned long arg); +static int mptctl_eventquery (MPT_ADAPTER *iocp,unsigned long arg); +static int mptctl_eventenable (MPT_ADAPTER *iocp,unsigned long arg); +static int mptctl_eventreport (MPT_ADAPTER *iocp,unsigned long arg); +static int mptctl_replace_fw (MPT_ADAPTER *iocp,unsigned long arg); + +static int mptctl_do_reset (MPT_ADAPTER *iocp,unsigned long arg); +static int mptctl_hp_hostinfo (MPT_ADAPTER *iocp,unsigned long arg,unsigned int cmd); +static int mptctl_hp_targetinfo (MPT_ADAPTER *iocp,unsigned long arg);static int mptctl_probe (struct pci_dev *,const struct pci_device_id *);static void mptctl_remove (struct pci_dev *);
@@ -123,8 +123,8 @@ static long compat_mpctl_ioctl(struct file *f, unsigned cmd, unsigned long arg);/* * Private function calls. */ -static int mptctl_do_mpt_command (struct mpt_ioctl_command karg,void __user *mfPtr); -static int mptctl_do_fw_download (int ioc,char __user *ufwbuf,size_t fwlen); +static int mptctl_do_mpt_command (MPT_ADAPTER *iocp,struct mpt_ioctl_command karg,void __user *mfPtr); +static int mptctl_do_fw_download (MPT_ADAPTER *iocp,char __user *ufwbuf,size_t fwlen);static MptSge_t *kbuf_alloc_2_sgl (int bytes,u32 dir,int sge_offset,int *frags,struct buflist **blp,dma_addr_t *sglbuf_dma,MPT_ADAPTER *ioc); static void kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma,
@@ -656,19 +656,19 @@ __mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)* by TM and FW reloads. */ if ((cmd & ~IOCSIZE_MASK ) == (MPTIOCINFO & ~IOCSIZE_MASK )) { -return mptctl_getiocinfo (arg,_IOC_SIZE (cmd)); +return mptctl_getiocinfo (iocp, arg,_IOC_SIZE (cmd)); }else if (cmd ==MPTTARGETINFO ) { -return mptctl_gettargetinfo (arg); +return mptctl_gettargetinfo (iocp, arg); }else if (cmd ==MPTTEST ) { -return mptctl_readtest (arg); +return mptctl_readtest (iocp, arg); }else if (cmd ==MPTEVENTQUERY ) { -return mptctl_eventquery (arg); +return mptctl_eventquery (iocp, arg); }else if (cmd ==MPTEVENTENABLE ) { -return mptctl_eventenable (arg); +return mptctl_eventenable (iocp, arg); }else if (cmd ==MPTEVENTREPORT ) { -return mptctl_eventreport (arg); +return mptctl_eventreport (iocp, arg); }else if (cmd ==MPTFWREPLACE ) { -return mptctl_replace_fw (arg); +return mptctl_replace_fw (iocp, arg); }/* All of these commands require an interrupt or
@@ -678,15 +678,15 @@ __mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)return ret;if (cmd ==MPTFWDOWNLOAD ) - ret =mptctl_fw_download (arg); + ret =mptctl_fw_download (iocp, arg);else if (cmd ==MPTCOMMAND ) - ret =mptctl_mpt_command (arg); + ret =mptctl_mpt_command (iocp, arg);else if (cmd ==MPTHARDRESET ) - ret =mptctl_do_reset (arg); + ret =mptctl_do_reset (iocp, arg);else if ((cmd & ~IOCSIZE_MASK ) == (HP_GETHOSTINFO & ~IOCSIZE_MASK )) - ret =mptctl_hp_hostinfo (arg,_IOC_SIZE (cmd)); + ret =mptctl_hp_hostinfo (iocp, arg,_IOC_SIZE (cmd));else if (cmd ==HP_GETTARGETINFO ) - ret =mptctl_hp_targetinfo (arg); + ret =mptctl_hp_targetinfo (iocp, arg);else ret = -EINVAL ;
@@ -705,11 +705,10 @@ mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)return ret; } -static int mptctl_do_reset (unsigned long arg) +static int mptctl_do_reset (MPT_ADAPTER *iocp,unsigned long arg) {struct mpt_ioctl_diag_reset __user *urinfo = (void __user *) arg;struct mpt_ioctl_diag_reset krinfo; -MPT_ADAPTER *iocp;if (copy_from_user (&krinfo, urinfo,sizeof (struct mpt_ioctl_diag_reset ))) { printk(KERN_ERR MYNAM "%s@%d::mptctl_do_reset - "
@@ -718,12 +717,6 @@ static int mptctl_do_reset(unsigned long arg)return -EFAULT ; } -if (mpt_verify_adapter (krinfo.hdr.iocnum, &iocp) <0 ) { - printk(KERN_DEBUG MYNAM "%s@%d::mptctl_do_reset - ioc%d not found!\n", - __FILE__, __LINE__, krinfo.hdr.iocnum); -return -ENODEV ;/* (-6) No such device or address */ - } -dctlprintk (iocp,printk (MYIOC_s_DEBUG_FMT"mptctl_do_reset called.\n" , iocp->name));
@@ -754,7 +747,7 @@ static int mptctl_do_reset(unsigned long arg)* -ENOMSG if FW upload returned bad status */ static int -mptctl_fw_download (unsigned long arg) +mptctl_fw_download (MPT_ADAPTER *iocp,unsigned long arg) {struct mpt_fw_xfer __user *ufwdl = (void __user *) arg;struct mpt_fw_xfer kfwdl;
@@ -766,7 +759,7 @@ mptctl_fw_download(unsigned long arg)return -EFAULT ; } -return mptctl_do_fw_download (kfwdl.iocnum, kfwdl.bufp, kfwdl.fwlen); +return mptctl_do_fw_download (iocp, kfwdl.bufp, kfwdl.fwlen); }/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -784,11 +777,10 @@ mptctl_fw_download(unsigned long arg)* -ENOMSG if FW upload returned bad status */ static int -mptctl_do_fw_download (int ioc,char __user *ufwbuf,size_t fwlen) +mptctl_do_fw_download (MPT_ADAPTER *iocp,char __user *ufwbuf,size_t fwlen) {FWDownload_t *dlmsg;MPT_FRAME_HDR *mf; -MPT_ADAPTER *iocp;FWDownloadTCSGE_t *ptsge;MptSge_t *sgl, *sgIn;char *sgOut;
@@ -808,17 +800,10 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen)pFWDownloadReply_t ReplyMsg =NULL ;unsigned long timeleft; -if (mpt_verify_adapter (ioc, &iocp) <0 ) { - printk(KERN_DEBUG MYNAM "ioctl_fwdl - ioc%d not found!\n", - ioc); -return -ENODEV ;/* (-6) No such device or address */ - }else { - -/* Valid device. Get a message frame and construct the FW download message. -*/ -if ((mf =mpt_get_msg_frame (mptctl_id, iocp)) ==NULL ) -return -EAGAIN ; - } +/* Valid device. Get a message frame and construct the FW download message. +*/ +if ((mf =mpt_get_msg_frame (mptctl_id, iocp)) ==NULL ) +return -EAGAIN ;dctlprintk (iocp,printk (MYIOC_s_DEBUG_FMT"mptctl_do_fwdl called. mptctl_id = %xh.\n" , iocp->name, mptctl_id));
@@ -826,8 +811,6 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen) iocp->name, ufwbuf));dctlprintk (iocp,printk (MYIOC_s_DEBUG_FMT"DbG: kfwdl.fwlen = %d\n" , iocp->name, (int )fwlen)); -dctlprintk (iocp,printk (MYIOC_s_DEBUG_FMT"DbG: kfwdl.ioc = %04xh\n" , - iocp->name, ioc)); dlmsg = (FWDownload_t *) mf; ptsge = (FWDownloadTCSGE_t *) &dlmsg->SGL;
@@ -1238,13 +1221,11 @@ kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma, struct buflist *buflist, MPT_ADAPTE* -ENODEV if no such device/adapter */ static int -mptctl_getiocinfo (unsigned long arg,unsigned int data_size) +mptctl_getiocinfo (MPT_ADAPTER *ioc,unsigned long arg,unsigned int data_size) {struct mpt_ioctl_iocinfo __user *uarg = (void __user *) arg;struct mpt_ioctl_iocinfo *karg; -MPT_ADAPTER *ioc;struct pci_dev *pdev; -int iocnum;unsigned int port;int cim_rev;struct scsi_device *sdev;
@@ -1272,14 +1253,6 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)return PTR_ERR (karg); } -if (((iocnum =mpt_verify_adapter (karg->hdr.iocnum, &ioc)) <0 ) || - (ioc ==NULL )) { - printk(KERN_DEBUG MYNAM "%s::mptctl_getiocinfo() @%d - ioc%d not found!\n", - __FILE__, __LINE__, iocnum); -kfree (karg); -return -ENODEV ; - } -/* Verify the data transfer size is correct. */ if (karg->hdr.maxDataSize != data_size) { printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_getiocinfo - "
@@ -1385,15 +1358,13 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)* -ENODEV if no such device/adapter */ static int -mptctl_gettargetinfo (unsigned long arg) +mptctl_gettargetinfo (MPT_ADAPTER *ioc,unsigned long arg) {struct mpt_ioctl_targetinfo __user *uarg = (void __user *) arg;struct mpt_ioctl_targetinfo karg; -MPT_ADAPTER *ioc;VirtDevice *vdevice;char *pmem;int *pdata; -int iocnum;int numDevices =0 ;int lun;int maxWordsLeft;
@@ -1408,13 +1379,6 @@ mptctl_gettargetinfo (unsigned long arg)return -EFAULT ; } -if (((iocnum =mpt_verify_adapter (karg.hdr.iocnum, &ioc)) <0 ) || - (ioc ==NULL )) { - printk(KERN_DEBUG MYNAM "%s::mptctl_gettargetinfo() @%d - ioc%d not found!\n", - __FILE__, __LINE__, iocnum); -return -ENODEV ; - } -dctlprintk (ioc,printk (MYIOC_s_DEBUG_FMT"mptctl_gettargetinfo called.\n" , ioc->name));/* Get the port number and set the maximum number of bytes
@@ -1510,12 +1474,10 @@ mptctl_gettargetinfo (unsigned long arg)* -ENODEV if no such device/adapter */ static int -mptctl_readtest (unsigned long arg) +mptctl_readtest (MPT_ADAPTER *ioc,unsigned long arg) {struct mpt_ioctl_test __user *uarg = (void __user *) arg;struct mpt_ioctl_test karg; -MPT_ADAPTER *ioc; -int iocnum;if (copy_from_user (&karg, uarg,sizeof (struct mpt_ioctl_test ))) { printk(KERN_ERR MYNAM "%s@%d::mptctl_readtest - "
@@ -1524,13 +1486,6 @@ mptctl_readtest (unsigned long arg)return -EFAULT ; } -if (((iocnum =mpt_verify_adapter (karg.hdr.iocnum, &ioc)) <0 ) || - (ioc ==NULL )) { - printk(KERN_DEBUG MYNAM "%s::mptctl_readtest() @%d - ioc%d not found!\n", - __FILE__, __LINE__, iocnum); -return -ENODEV ; - } -dctlprintk (ioc,printk (MYIOC_s_DEBUG_FMT"mptctl_readtest called.\n" , ioc->name));/* Fill in the data and return the structure to the calling
@@ -1571,12 +1526,10 @@ mptctl_readtest (unsigned long arg)* -ENODEV if no such device/adapter */ static int -mptctl_eventquery (unsigned long arg) +mptctl_eventquery (MPT_ADAPTER *ioc,unsigned long arg) {struct mpt_ioctl_eventquery __user *uarg = (void __user *) arg;struct mpt_ioctl_eventquery karg; -MPT_ADAPTER *ioc; -int iocnum;if (copy_from_user (&karg, uarg,sizeof (struct mpt_ioctl_eventquery ))) { printk(KERN_ERR MYNAM "%s@%d::mptctl_eventquery - "
@@ -1585,13 +1538,6 @@ mptctl_eventquery (unsigned long arg)return -EFAULT ; } -if (((iocnum =mpt_verify_adapter (karg.hdr.iocnum, &ioc)) <0 ) || - (ioc ==NULL )) { - printk(KERN_DEBUG MYNAM "%s::mptctl_eventquery() @%d - ioc%d not found!\n", - __FILE__, __LINE__, iocnum); -return -ENODEV ; - } -dctlprintk (ioc,printk (MYIOC_s_DEBUG_FMT"mptctl_eventquery called.\n" , ioc->name)); karg.eventEntries =MPTCTL_EVENT_LOG_SIZE ;
@@ -1610,12 +1556,10 @@ mptctl_eventquery (unsigned long arg)/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ static int -mptctl_eventenable (unsigned long arg) +mptctl_eventenable (MPT_ADAPTER *ioc,unsigned long arg) {struct mpt_ioctl_eventenable __user *uarg = (void __user *) arg;struct mpt_ioctl_eventenable karg; -MPT_ADAPTER *ioc; -int iocnum;if (copy_from_user (&karg, uarg,sizeof (struct mpt_ioctl_eventenable ))) { printk(KERN_ERR MYNAM "%s@%d::mptctl_eventenable - "
@@ -1624,13 +1568,6 @@ mptctl_eventenable (unsigned long arg)return -EFAULT ; } -if (((iocnum =mpt_verify_adapter (karg.hdr.iocnum, &ioc)) <0 ) || - (ioc ==NULL )) { - printk(KERN_DEBUG MYNAM "%s::mptctl_eventenable() @%d - ioc%d not found!\n", - __FILE__, __LINE__, iocnum); -return -ENODEV ; - } -dctlprintk (ioc,printk (MYIOC_s_DEBUG_FMT"mptctl_eventenable called.\n" , ioc->name));if (ioc->events ==NULL ) {
@@ -1658,12 +1595,10 @@ mptctl_eventenable (unsigned long arg)/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ static int -mptctl_eventreport (unsigned long arg) +mptctl_eventreport (MPT_ADAPTER *ioc,unsigned long arg) {struct mpt_ioctl_eventreport __user *uarg = (void __user *) arg;struct mpt_ioctl_eventreport karg; -MPT_ADAPTER *ioc; -int iocnum;int numBytes, maxEvents, max;if (copy_from_user (&karg, uarg,sizeof (struct mpt_ioctl_eventreport ))) {
@@ -1673,12 +1608,6 @@ mptctl_eventreport (unsigned long arg)return -EFAULT ; } -if (((iocnum =mpt_verify_adapter (karg.hdr.iocnum, &ioc)) <0 ) || - (ioc ==NULL )) { - printk(KERN_DEBUG MYNAM "%s::mptctl_eventreport() @%d - ioc%d not found!\n", - __FILE__, __LINE__, iocnum); -return -ENODEV ; - }dctlprintk (ioc,printk (MYIOC_s_DEBUG_FMT"mptctl_eventreport called.\n" , ioc->name));
@@ -1712,12 +1641,10 @@ mptctl_eventreport (unsigned long arg)/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ static int -mptctl_replace_fw (unsigned long arg) +mptctl_replace_fw (MPT_ADAPTER *ioc,unsigned long arg) {struct mpt_ioctl_replace_fw __user *uarg = (void __user *) arg;struct mpt_ioctl_replace_fw karg; -MPT_ADAPTER *ioc; -int iocnum;int newFwSize;if (copy_from_user (&karg, uarg,sizeof (struct mpt_ioctl_replace_fw ))) {
@@ -1727,13 +1654,6 @@ mptctl_replace_fw (unsigned long arg)return -EFAULT ; } -if (((iocnum =mpt_verify_adapter (karg.hdr.iocnum, &ioc)) <0 ) || - (ioc ==NULL )) { - printk(KERN_DEBUG MYNAM "%s::mptctl_replace_fw() @%d - ioc%d not found!\n", - __FILE__, __LINE__, iocnum); -return -ENODEV ; - } -dctlprintk (ioc,printk (MYIOC_s_DEBUG_FMT"mptctl_replace_fw called.\n" , ioc->name));/* If caching FW, Free the old FW image
@@ -1780,12 +1700,10 @@ mptctl_replace_fw (unsigned long arg)* -ENOMEM if memory allocation error */ static int -mptctl_mpt_command (unsigned long arg) +mptctl_mpt_command (MPT_ADAPTER *ioc,unsigned long arg) {struct mpt_ioctl_command __user *uarg = (void __user *) arg;struct mpt_ioctl_command karg; -MPT_ADAPTER *ioc; -int iocnum;int rc;
@@ -1796,14 +1714,7 @@ mptctl_mpt_command (unsigned long arg)return -EFAULT ; } -if (((iocnum =mpt_verify_adapter (karg.hdr.iocnum, &ioc)) <0 ) || - (ioc ==NULL )) { - printk(KERN_DEBUG MYNAM "%s::mptctl_mpt_command() @%d - ioc%d not found!\n", - __FILE__, __LINE__, iocnum); -return -ENODEV ; - } - - rc =mptctl_do_mpt_command (karg, &uarg->MF); + rc =mptctl_do_mpt_command (ioc, karg, &uarg->MF);return rc; }
@@ -1821,9 +1732,8 @@ mptctl_mpt_command (unsigned long arg)* -EPERM if SCSI I/O and target is untagged */ static int -mptctl_do_mpt_command (struct mpt_ioctl_command karg,void __user *mfPtr) +mptctl_do_mpt_command (MPT_ADAPTER *ioc,struct mpt_ioctl_command karg,void __user *mfPtr) { -MPT_ADAPTER *ioc;MPT_FRAME_HDR *mf =NULL ;MPIHeader_t *hdr;char *psge;
@@ -1832,7 +1742,7 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)dma_addr_t dma_addr_in;dma_addr_t dma_addr_out;int sgSize =0 ;/* Num SG elements */ -int iocnum, flagsLength; +int flagsLength;int sz, rc =0 ;int msgContext;u16 req_idx;
@@ -1847,13 +1757,6 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr) bufIn.kptr = bufOut.kptr =NULL ; bufIn.len = bufOut.len =0 ; -if (((iocnum =mpt_verify_adapter (karg.hdr.iocnum, &ioc)) <0 ) || - (ioc ==NULL )) { - printk(KERN_DEBUG MYNAM "%s::mptctl_do_mpt_command() @%d - ioc%d not found!\n", - __FILE__, __LINE__, iocnum); -return -ENODEV ; - } -spin_lock_irqsave (&ioc->taskmgmt_lock, flags);if (ioc->ioc_reset_in_progress) {spin_unlock_irqrestore (&ioc->taskmgmt_lock, flags);
@@ -2418,17 +2321,15 @@ done_free_mem:* -ENOMEM if memory allocation error */ static int -mptctl_hp_hostinfo (unsigned long arg,unsigned int data_size) +mptctl_hp_hostinfo (MPT_ADAPTER *ioc,unsigned long arg,unsigned int data_size) {hp_host_info_t __user *uarg = (void __user *) arg; -MPT_ADAPTER *ioc;struct pci_dev *pdev;char *pbuf=NULL ;dma_addr_t buf_dma;hp_host_info_t karg;CONFIGPARMS cfg;ConfigPageHeader_t hdr; -int iocnum;int rc, cim_rev;ToolboxIstwiReadWriteRequest_t *IstwiRWRequest;MPT_FRAME_HDR *mf =NULL ;
@@ -2452,12 +2353,6 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)return -EFAULT ; } -if (((iocnum =mpt_verify_adapter (karg.hdr.iocnum, &ioc)) <0 ) || - (ioc ==NULL )) { - printk(KERN_DEBUG MYNAM "%s::mptctl_hp_hostinfo() @%d - ioc%d not found!\n", - __FILE__, __LINE__, iocnum); -return -ENODEV ; - }dctlprintk (ioc,printk (MYIOC_s_DEBUG_FMT": mptctl_hp_hostinfo called.\n" , ioc->name));
@@ -2659,15 +2554,13 @@ retry_wait:* -ENOMEM if memory allocation error */ static int -mptctl_hp_targetinfo (unsigned long arg) +mptctl_hp_targetinfo (MPT_ADAPTER *ioc,unsigned long arg) {hp_target_info_t __user *uarg = (void __user *) arg;SCSIDevicePage0_t *pg0_alloc;SCSIDevicePage3_t *pg3_alloc; -MPT_ADAPTER *ioc;MPT_SCSI_HOST *hd =NULL ;hp_target_info_t karg; -int iocnum;int data_sz;dma_addr_t page_dma;CONFIGPARMS cfg;
@@ -2681,12 +2574,6 @@ mptctl_hp_targetinfo(unsigned long arg)return -EFAULT ; } -if (((iocnum =mpt_verify_adapter (karg.hdr.iocnum, &ioc)) <0 ) || - (ioc ==NULL )) { - printk(KERN_DEBUG MYNAM "%s::mptctl_hp_targetinfo() @%d - ioc%d not found!\n", - __FILE__, __LINE__, iocnum); -return -ENODEV ; - }if (karg.hdr.id >=MPT_MAX_FC_DEVICES )return -EINVAL ; dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_hp_targetinfo called.\n",
@@ -2854,7 +2741,7 @@ compat_mptfwxfer_ioctl(struct file *filp, unsigned int cmd, kfw.fwlen = kfw32.fwlen; kfw.bufp =compat_ptr (kfw32.bufp); - ret =mptctl_do_fw_download (kfw.iocnum, kfw.bufp, kfw.fwlen); + ret =mptctl_do_fw_download (iocp, kfw.bufp, kfw.fwlen);mutex_unlock (&iocp->ioctl_cmds.mutex);
@@ -2908,7 +2795,7 @@ compat_mpt_command(struct file *filp, unsigned int cmd,/* Pass new structure to do_mpt_command */ - ret =mptctl_do_mpt_command (karg, &uarg->MF); + ret =mptctl_do_mpt_command (iocp, karg, &uarg->MF);mutex_unlock (&iocp->ioctl_cmds.mutex);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 96/107 net: hns: fix soft lockup when there is not enough memory
In reply to Sasha LevinFrom: Yonglong Liu <[email protected]>
[ Upstream commit 49edd6a2c456150870ddcef5b7ed11b21d849e13 ]
When there is not enough memory and napi_alloc_skb() return NULL, the HNS driver will print error message, and than try again, if the memory is not enough for a while, huge error message and the retry operation will cause soft lockup.
When napi_alloc_skb() return NULL because of no memory, we can get a warn_alloc() call trace, so this patch deletes the error message. We already use polling mode to handle irq, but the retry operation will render the polling weight inactive, this patch just return budget when the rx is not completed to avoid dead loop.
--- drivers/net/ethernet/hisilicon/hns/hns_enet.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/hisilicon/hns/hns_enet.c +1 -3
@@ -565,7 +565,6 @@ static int hns_nic_poll_rx_skb(struct hns_nic_ring_data *ring_data, skb = *out_skb =napi_alloc_skb (&ring_data->napi,HNS_RX_HEAD_SIZE );if (unlikely (!skb)) { -netdev_err (ndev,"alloc rx skb fail\n" ); ring->stats.sw_err_cnt++;return -ENOMEM ; }
@@ -1056,7 +1055,6 @@ static int hns_nic_common_poll(struct napi_struct *napi, int budget) container_of(napi, struct hns_nic_ring_data, napi);struct hnae_ring *ring = ring_data->ring; -try_again: clean_complete += ring_data->poll_one ( ring_data, budget - clean_complete, ring_data->ex_process);
@@ -1066,7 +1064,7 @@ try_again:napi_complete (napi); ring->q->handle->dev->ops->toggle_ring_irq (ring,0 ); }else { - goto try_again; +return budget; } }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 95/107 netfilter: nat: fix ICMP header corruption on ICMP errors
In reply to Sasha LevinFrom: Eyal Birger <[email protected]>
[ Upstream commit 61177e911dad660df86a4553eb01c95ece2f6a82 ]
Commit 8303b7e8f018 ("netfilter: nat: fix spurious connection timeouts") made nf_nat_icmp_reply_translation() use icmp_manip_pkt() as the l4 manipulation function for the outer packet on ICMP errors.
However, icmp_manip_pkt() assumes the packet has an 'id' field which is not correct for all types of ICMP messages.
This is not correct for ICMP error packets, and leads to bogus bytes being written the ICMP header, which can be wrongfully regarded as 'length' bytes by RFC 4884 compliant receivers.
Fix by assigning the 'id' field only for ICMP messages that have this semantic.
--- net/netfilter/nf_nat_proto.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
net/netfilter/nf_nat_proto.c +13 -0
@@ -233,6 +233,19 @@ icmp_manip_pkt(struct sk_buff *skb,return false; hdr = (struct icmphdr *)(skb->data + hdroff); +switch (hdr->type) { +case ICMP_ECHO : +case ICMP_ECHOREPLY : +case ICMP_TIMESTAMP : +case ICMP_TIMESTAMPREPLY : +case ICMP_INFO_REQUEST : +case ICMP_INFO_REPLY : +case ICMP_ADDRESS : +case ICMP_ADDRESSREPLY : +break ; +default : +return true; + }inet_proto_csum_replace2 (&hdr->checksum, skb, hdr->un.echo.id, tuple->src.u.icmp.id, false); hdr->un.echo.id = tuple->src.u.icmp.id;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 94/107 netfilter: nf_tables: fix flowtable list del corruption
In reply to Sasha LevinFrom: Florian Westphal <[email protected]>
[ Upstream commit 335178d5429c4cee61b58f4ac80688f556630818 ]
syzbot reported following crash:
list_del corruption, ffff88808c9bb000->prev is LIST_POISON2 (dead000000000122) [..]
Call Trace: __list_del_entry include/linux/list.h:131 [inline] list_del_rcu include/linux/rculist.h:148 [inline] nf_tables_commit+0x1068/0x3b30 net/netfilter/nf_tables_api.c:7183 [..]
The commit transaction list has:
NFT_MSG_NEWTABLENFT_MSG_NEWFLOWTABLENFT_MSG_DELFLOWTABLENFT_MSG_DELTABLE
A missing generation check during DELTABLE processing causes it to queue the DELFLOWTABLE operation a second time, so we corrupt the list here:
case NFT_MSG_DELFLOWTABLE:
list_del_rcu(&nft_trans_flowtable(trans)->list);
nf_tables_flowtable_notify(&trans->ctx,because we have two different DELFLOWTABLE transactions for the same flowtable. We then call list_del_rcu() twice for the same flowtable->list.
The object handling seems to suffer from the same bug so add a generation check too and only queue delete transactions for flowtables/objects that are still active in the next generation.
--- net/netfilter/nf_tables_api.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/netfilter/nf_tables_api.c +6 -0
@@ -981,12 +981,18 @@ static int nft_flush_table(struct nft_ctx *ctx) }list_for_each_entry_safe (flowtable, nft, &ctx->table->flowtables, list) { +if (!nft_is_active_next (ctx->net, flowtable)) +continue ; + err =nft_delflowtable (ctx, flowtable);if (err <0 ) goto out; }list_for_each_entry_safe (obj, ne, &ctx->table->objects, list) { +if (!nft_is_active_next (ctx->net, obj)) +continue ; + err =nft_delobj (ctx, obj);if (err <0 ) goto out;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 92/107 netfilter: nft_tunnel: ERSPAN_VERSION must not be null
In reply to Sasha LevinFrom: Florian Westphal <[email protected]>
[ Upstream commit 9ec22d7c6c69146180577f3ad5fdf504beeaee62 ]
--- net/netfilter/nft_tunnel.c | 3 +++ 1 file changed, 3 insertions(+)
net/netfilter/nft_tunnel.c +3 -0
@@ -266,6 +266,9 @@ static int nft_tunnel_obj_erspan_init(const struct nlattr *attr,if (err <0 )return err; +if (!tb[NFTA_TUNNEL_KEY_ERSPAN_VERSION ]) +return -EINVAL ; + version =ntohl (nla_get_be32 (tb[NFTA_TUNNEL_KEY_ERSPAN_VERSION ]));switch (version) {case ERSPAN_VERSION :
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 90/107 netfilter: nf_tables: store transaction list locally while requesting module
In reply to Sasha LevinFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit ec7470b834fe7b5d7eff11b6677f5d7fdf5e9a91 ]
This patch fixes a WARN_ON in nft_set_destroy() due to missing set reference count drop from the preparation phase. This is triggered by the module autoload path. Do not exercise the abort path from nft_request_module() while preparation phase cleaning up is still pending.
WARNING: CPU: 3 PID: 3456 at net/netfilter/nf_tables_api.c:3740 nft_set_destroy+0x45/0x50 [nf_tables] [...] CPU: 3 PID: 3456 Comm: nft Not tainted 5.4.6-arch3-1 #1 RIP: 0010:nft_set_destroy+0x45/0x50 [nf_tables] Code: e8 30 eb 83 c6 48 8b 85 80 00 00 00 48 8b b8 90 00 00 00 e8 dd 6b d7 c5 48 8b 7d 30 e8 24 dd eb c5 48 89 ef 5d e9 6b c6 e5 c5 <0f> 0b c3 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 8b 7f 10 e9 52 RSP: 0018:ffffac4f43e53700 EFLAGS: 00010202 RAX: 0000000000000001 RBX: ffff99d63a154d80 RCX: 0000000001f88e03 RDX: 0000000001f88c03 RSI: ffff99d6560ef0c0 RDI: ffff99d63a101200 RBP: ffff99d617721de0 R08: 0000000000000000 R09: 0000000000000318 R10: 00000000f0000000 R11: 0000000000000001 R12: ffffffff880fabf0 R13: dead000000000122 R14: dead000000000100 R15: ffff99d63a154d80 FS: 00007ff3dbd5b740(0000) GS:ffff99d6560c0000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00001cb5de6a9000 CR3: 000000016eb6a004 CR4: 00000000001606e0 Call Trace: __nf_tables_abort+0x3e3/0x6d0 [nf_tables] nft_request_module+0x6f/0x110 [nf_tables] nft_expr_type_request_module+0x28/0x50 [nf_tables] nf_tables_expr_parse+0x198/0x1f0 [nf_tables] nft_expr_init+0x3b/0xf0 [nf_tables] nft_dynset_init+0x1e2/0x410 [nf_tables] nf_tables_newrule+0x30a/0x930 [nf_tables] nfnetlink_rcv_batch+0x2a0/0x640 [nfnetlink] nfnetlink_rcv+0x125/0x171 [nfnetlink] netlink_unicast+0x179/0x210 netlink_sendmsg+0x208/0x3d0 sock_sendmsg+0x5e/0x60 ____sys_sendmsg+0x21b/0x290
Update comment on the code to describe the new behaviour.
--- net/netfilter/nf_tables_api.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
net/netfilter/nf_tables_api.c +10 -9
@@ -500,23 +500,21 @@ __nf_tables_chain_type_lookup(const struct nlattr *nla, u8 family) }/* -* Loading a module requires dropping mutex that guards the -* transaction. -* We first need to abort any pending transactions as once -* mutex is unlocked a different client could start a new -* transaction. It must not see any 'future generation' -* changes * as these changes will never happen. +* Loading a module requires dropping mutex that guards the transaction. +* A different client might race to start a new transaction meanwhile. Zap the +* list of pending transaction and then restore it once the mutex is grabbed +* again. Users of this function return EAGAIN which implicitly triggers the +* transaction abort path to clean up the list of pending transactions. */ #ifdef CONFIG_MODULES -static int __nf_tables_abort (struct net *net); -static void nft_request_module (struct net *net,const char *fmt, ...) {char module_name[MODULE_NAME_LEN ]; +LIST_HEAD (commit_list);va_list args;int ret; -__nf_tables_abort (net); +list_splice_init (&net->nft.commit_list, &commit_list);va_start (args, fmt); ret =vsnprintf (module_name,MODULE_NAME_LEN , fmt, args);
@@ -527,6 +525,9 @@ static void nft_request_module(struct net *net, const char *fmt, ...)mutex_unlock (&net->nft.commit_mutex);request_module ("%s" , module_name);mutex_lock (&net->nft.commit_mutex); + +WARN_ON_ONCE (!list_empty (&net->nft.commit_list)); + list_splice(&commit_list, &net->nft.commit_list); }#endif
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 75/107 mlxsw: spectrum: Do not modify cloned SKBs during xmit
In reply to Sasha LevinFrom: Ido Schimmel <[email protected]>
[ Upstream commit 2da51ce75d86ab1f7770ac1391a9a1697ddaa60c ]
The driver needs to prepend a Tx header to each packet it is transmitting. The header includes information such as the egress port and traffic class.
The addition of the header requires the driver to modify the SKB's header and therefore it must not be shared. Otherwise, we risk hitting various race conditions.
For example, when a packet is flooded (cloned) by the bridge driver to two switch ports swp1 and swp2:
t0 - mlxsw_sp_port_xmit() is called for swp1. Tx header is prepended with
swp1's port number
t1 - mlxsw_sp_port_xmit() is called for swp2. Tx header is prepended with
swp2's port number, overwriting swp1's port number
t2 - The device processes data buffer from t0. Packet is transmitted via
swp2
t3 - The device processes data buffer from t1. Packet is transmitted via
swp2
Usually, the device is fast enough and transmits the packet before its Tx header is overwritten, but this is not the case in emulated environments.
Fix this by making sure the SKB's header is writable by calling skb_cow_head(). Since the function ensures we have headroom to push the Tx header, the check further in the function can be removed.
v2:
* Use skb_cow_head() instead of skb_unshare() as suggested by Jakub
* Remove unnecessary check regarding headroom
--- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum.c +6 -12
@@ -812,23 +812,17 @@ static netdev_tx_t mlxsw_sp_port_xmit(struct sk_buff *skb,u64 len;int err; +if (skb_cow_head (skb,MLXSW_TXHDR_LEN )) { +this_cpu_inc (mlxsw_sp_port->pcpu_stats->tx_dropped); +dev_kfree_skb_any (skb); +return NETDEV_TX_OK ; + } +memset (skb->cb,0 ,sizeof (struct mlxsw_skb_cb ));if (mlxsw_core_skb_transmit_busy (mlxsw_sp->core, &tx_info))return NETDEV_TX_BUSY ; -if (unlikely (skb_headroom (skb) <MLXSW_TXHDR_LEN )) { -struct sk_buff *skb_orig = skb; - - skb =skb_realloc_headroom (skb,MLXSW_TXHDR_LEN ); -if (!skb) { -this_cpu_inc (mlxsw_sp_port->pcpu_stats->tx_dropped); -dev_kfree_skb_any (skb_orig); -return NETDEV_TX_OK ; - } -dev_consume_skb_any (skb_orig); - } -if (eth_skb_pad (skb)) {this_cpu_inc (mlxsw_sp_port->pcpu_stats->tx_dropped);return NETDEV_TX_OK ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 88/107 net: hns3: pad the short frame before sending to the hardware
In reply to Sasha LevinFrom: Yunsheng Lin <[email protected]>
[ Upstream commit 36c67349a1a1c88b9cf11d7ca7762ababdb38867 ]
The hardware can not handle short frames below or equal to 32 bytes according to the hardware user manual, and it will trigger a RAS error when the frame's length is below 33 bytes.
This patch pads the SKB when skb->len is below 33 bytes before sending it to hardware.
--- drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +6 -0
@@ -54,6 +54,8 @@ MODULE_PARM_DESC(debug, " Network interface message level setting");#define HNS3_INNER_VLAN_TAG 1#define HNS3_OUTER_VLAN_TAG 2 +#define HNS3_MIN_TX_LEN 33U +/* hns3_pci_tbl - PCI Device ID Table * * Last entry must be all 0s
@@ -1329,6 +1331,10 @@ netdev_tx_t hns3_nic_net_xmit(struct sk_buff *skb, struct net_device *netdev)int ret;int i; +/* Hardware can only handle short frames above 32 bytes */ +if (skb_put_padto (skb,HNS3_MIN_TX_LEN )) +return NETDEV_TX_OK ; +/* Prefetch the data used later */ prefetch (skb->data);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 72/107 cfg80211: check for set_wiphy_params
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 24953de0a5e31dcca7e82c8a3c79abc2dfe8fb6e ]
Check if set_wiphy_params is assigned and return an error if not, some drivers (e.g. virt_wifi where syzbot reported it) don't have it.
--- net/wireless/rdev-ops.h | 4 ++++ 1 file changed, 4 insertions(+)
net/wireless/rdev-ops.h +4 -0
@@ -538,6 +538,10 @@ static inline int rdev_set_wiphy_params(struct cfg80211_registered_device *rdev, u32 changed) { int ret; + +if (!rdev->ops->set_wiphy_params) +return -EOPNOTSUPP ; +trace_rdev_set_wiphy_params (&rdev->wiphy, changed); ret = rdev->ops->set_wiphy_params (&rdev->wiphy, changed);trace_rdev_return_int (&rdev->wiphy, ret);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 85/107 net: stmmac: selftests: Mark as fail when received VLAN ID != expected
In reply to Sasha LevinFrom: Jose Abreu <[email protected]>
[ Upstream commit d39b68e5a736afa67d2e9cfb158efdd237d99dbd ]
When the VLAN ID does not match the expected one it means filter failed in HW. Fix it.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +5 -1
@@ -853,8 +853,12 @@ static int stmmac_test_vlan_validate(struct sk_buff *skb,if (tpriv->vlan_id) {if (skb->vlan_proto !=htons (proto)) goto out; -if (skb->vlan_tci != tpriv->vlan_id) +if (skb->vlan_tci != tpriv->vlan_id) { +/* Means filter did not work. */ + tpriv->ok = false; +complete (&tpriv->comp); goto out; + } } ehdr = (struct ethhdr *)skb_mac_header (skb);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 83/107 net/wan/fsl_ucc_hdlc: fix out of bounds write on array utdm_info
In reply to Sasha LevinFrom: Colin Ian King <[email protected]>
[ Upstream commit ddf420390526ede3b9ff559ac89f58cb59d9db2f ]
Array utdm_info is declared as an array of MAX_HDLC_NUM (4) elements however up to UCC_MAX_NUM (8) elements are potentially being written to it. Currently we have an array out-of-bounds write error on the last 4 elements. Fix this by making utdm_info UCC_MAX_NUM elements in size.
Addresses-Coverity: ("Out-of-bounds write")
--- drivers/net/wan/fsl_ucc_hdlc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wan/fsl_ucc_hdlc.c +1 -1
@@ -73,7 +73,7 @@ static struct ucc_tdm_info utdm_primary_info = { }, }; -static struct ucc_tdm_info utdm_info[MAX_HDLC_NUM ]; +static struct ucc_tdm_info utdm_info[UCC_MAX_NUM ];static int uhdlc_init (struct ucc_hdlc_private *priv) {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 80/107 Fix built-in early-load Intel microcode alignment
In reply to Sasha LevinFrom: Jari Ruusu <[email protected]>
[ Upstream commit f5ae2ea6347a308cfe91f53b53682ce635497d0d ]
Intel Software Developer's Manual, volume 3, chapter 9.11.6 says:
"Note that the microcode update must be aligned on a 16-byte boundary
and the size of the microcode update must be 1-KByte granular"
When early-load Intel microcode is loaded from initramfs, userspace tool 'iucode_tool' has already 16-byte aligned those microcode bits in that initramfs image. Image that was created something like this:
iucode_tool --write-earlyfw=FOO.cpio microcode-files...
However, when early-load Intel microcode is loaded from built-in firmware BLOB using CONFIG_EXTRA_FIRMWARE= kernel config option, that 16-byte alignment is not guaranteed.
Fix this by forcing all built-in firmware BLOBs to 16-byte alignment.
[ If we end up having other firmware with much bigger alignment
requirements, we might need to introduce some method for the firmware to specify it, this is the minimal "just increase the alignment a bit
to account for this one special case" patch - Linus ]
--- drivers/base/firmware_loader/builtin/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/firmware_loader/builtin/Makefile +1 -1
@@ -17,7 +17,7 @@ PROGBITS = $(if $(CONFIG_ARM),%,@)progbits filechk_fwbin = \ echo "/* Generated by $(src)/Makefile */" ;\ echo " .section .rodata" ;\ - echo " .p2align $(ASM_ALIGN)" ;\ + echo " .p2align 4" ;\ echo "_fw_$(FWSTR)_bin:" ;\ echo " .incbin \"$(fwdir)/$(FWNAME)\"" ;\ echo "_fw_end:" ;\
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 78/107 mlxsw: spectrum: Wipe xstats.backlog of down ports
In reply to Sasha LevinFrom: Petr Machata <[email protected]>
[ Upstream commit ca7609ff3680c51d6c29897f3117aa2ad904f92a ]
Per-port counter cache used by Qdiscs is updated periodically, unless the port is down. The fact that the cache is not updated for down ports is no problem for most counters, which are relative in nature. However, backlog is absolute in nature, and if there is a non-zero value in the cache around the time that the port goes down, that value just stays there. This value then leaks to offloaded Qdiscs that report non-zero backlog even if there (obviously) is no traffic.
The HW does not keep backlog of a downed port, so do likewise: as the port goes down, wipe the backlog value from xstats.
--- drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/net/ethernet/mellanox/mlxsw/spectrum.c +13 -0
@@ -1161,6 +1161,9 @@ static void update_stats_cache(struct work_struct *work) periodic_hw_stats.update_dw.work);if (!netif_carrier_ok (mlxsw_sp_port->dev)) +/* Note: mlxsw_sp_port_down_wipe_counters() clears the cache as +* necessary when port goes down. +*/ goto out; mlxsw_sp_port_get_hw_stats(mlxsw_sp_port->dev,
@@ -4170,6 +4173,15 @@ static int mlxsw_sp_port_unsplit(struct mlxsw_core *mlxsw_core, u8 local_port,return 0 ; } +static void +mlxsw_sp_port_down_wipe_counters (struct mlxsw_sp_port *mlxsw_sp_port) +{ +int i; + +for (i =0 ; i <TC_MAX_QUEUE ; i++) + mlxsw_sp_port->periodic_hw_stats.xstats.backlog[i] =0 ; +} +static void mlxsw_sp_pude_event_func (const struct mlxsw_reg_info *reg,char *pude_pl,void *priv) {
@@ -4191,6 +4203,7 @@ static void mlxsw_sp_pude_event_func(const struct mlxsw_reg_info *reg, }else {netdev_info (mlxsw_sp_port->dev,"link down\n" );netif_carrier_off (mlxsw_sp_port->dev); +mlxsw_sp_port_down_wipe_counters (mlxsw_sp_port); } }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 74/107 Revert "gpio: thunderx: Switch to GPIOLIB_IRQCHIP"
In reply to Sasha LevinFrom: Kevin Hao <[email protected]>
[ Upstream commit a564ac35d60564dd5b509e32afdc04e7aafee40e ]
This reverts commit a7fc89f9d5fcc10a5474cfe555f5a9e5df8b0f1f because there are some bugs in this commit, and we don't have a simple way to fix these bugs. So revert this commit to make the thunderx gpio work on the stable kernel at least. We will switch to GPIOLIB_IRQCHIP for thunderx gpio by following patches.
--- drivers/gpio/Kconfig | 1 - drivers/gpio/gpio-thunderx.c | 163 +++++++++++++++++++++++------------ 2 files changed, 107 insertions(+), 57 deletions(-)
drivers/gpio/Kconfig +0 -1
@@ -546,7 +546,6 @@ config GPIO_THUNDERX tristate "Cavium ThunderX/OCTEON-TX GPIO" depends on ARCH_THUNDER || (64BIT && COMPILE_TEST) depends on PCI_MSI - select GPIOLIB_IRQCHIP select IRQ_DOMAIN_HIERARCHY select IRQ_FASTEOI_HIERARCHY_HANDLERS help
drivers/gpio/gpio-thunderx.c +107 -56
262 lines not on this page · raw message
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 73/107 tick/sched: Annotate lockless access to last_jiffies_update
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit de95a991bb72e009f47e0c4bbc90fc5f594588d5 ]
syzbot (KCSAN) reported a data-race in tick_do_update_jiffies64():
BUG: KCSAN: data-race in tick_do_update_jiffies64 / tick_do_update_jiffies64
write to 0xffffffff8603d008 of 8 bytes by interrupt on cpu 1:
tick_do_update_jiffies64+0x100/0x250 kernel/time/tick-sched.c:73 tick_sched_do_timer+0xd4/0xe0 kernel/time/tick-sched.c:138 tick_sched_timer+0x43/0xe0 kernel/time/tick-sched.c:1292 __run_hrtimer kernel/time/hrtimer.c:1514 [inline] __hrtimer_run_queues+0x274/0x5f0 kernel/time/hrtimer.c:1576 hrtimer_interrupt+0x22a/0x480 kernel/time/hrtimer.c:1638 local_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1110 [inline] smp_apic_timer_interrupt+0xdc/0x280 arch/x86/kernel/apic/apic.c:1135 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:830 arch_local_irq_restore arch/x86/include/asm/paravirt.h:756 [inline] kcsan_setup_watchpoint+0x1d4/0x460 kernel/kcsan/core.c:436 check_access kernel/kcsan/core.c:466 [inline] __tsan_read1 kernel/kcsan/core.c:593 [inline] __tsan_read1+0xc2/0x100 kernel/kcsan/core.c:593 kallsyms_expand_symbol.constprop.0+0x70/0x160 kernel/kallsyms.c:79 kallsyms_lookup_name+0x7f/0x120 kernel/kallsyms.c:170 insert_report_filterlist kernel/kcsan/debugfs.c:155 [inline] debugfs_write+0x14b/0x2d0 kernel/kcsan/debugfs.c:256 full_proxy_write+0xbd/0x100 fs/debugfs/file.c:225 __vfs_write+0x67/0xc0 fs/read_write.c:494 vfs_write fs/read_write.c:558 [inline] vfs_write+0x18a/0x390 fs/read_write.c:542 ksys_write+0xd5/0x1b0 fs/read_write.c:611 __do_sys_write fs/read_write.c:623 [inline] __se_sys_write fs/read_write.c:620 [inline] __x64_sys_write+0x4c/0x60 fs/read_write.c:620 do_syscall_64+0xcc/0x370 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9
read to 0xffffffff8603d008 of 8 bytes by task 0 on cpu 0:
tick_do_update_jiffies64+0x2b/0x250 kernel/time/tick-sched.c:62 tick_nohz_update_jiffies kernel/time/tick-sched.c:505 [inline] tick_nohz_irq_enter kernel/time/tick-sched.c:1257 [inline] tick_irq_enter+0x139/0x1c0 kernel/time/tick-sched.c:1274 irq_enter+0x4f/0x60 kernel/softirq.c:354 entering_irq arch/x86/include/asm/apic.h:517 [inline] entering_ack_irq arch/x86/include/asm/apic.h:523 [inline] smp_apic_timer_interrupt+0x55/0x280 arch/x86/kernel/apic/apic.c:1133 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:830 native_safe_halt+0xe/0x10 arch/x86/include/asm/irqflags.h:60 arch_cpu_idle+0xa/0x10 arch/x86/kernel/process.c:571 default_idle_call+0x1e/0x40 kernel/sched/idle.c:94 cpuidle_idle_call kernel/sched/idle.c:154 [inline] do_idle+0x1af/0x280 kernel/sched/idle.c:263 cpu_startup_entry+0x1b/0x20 kernel/sched/idle.c:355 rest_init+0xec/0xf6 init/main.c:452 arch_call_rest_init+0x17/0x37 start_kernel+0x838/0x85e init/main.c:786 x86_64_start_reservations+0x29/0x2b arch/x86/kernel/head64.c:490 x86_64_start_kernel+0x72/0x76 arch/x86/kernel/head64.c:471 secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:241
Reported by Kernel Concurrency Sanitizer on:
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.4.0-rc7+ #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Use READ_ONCE() and WRITE_ONCE() to annotate this expected race.
--- kernel/time/tick-sched.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
kernel/time/tick-sched.c +9 -5
@@ -58,8 +58,9 @@ static void tick_do_update_jiffies64(ktime_t now)/* * Do a quick check without holding jiffies_lock: +* The READ_ONCE() pairs with two updates done later in this function. */ - delta =ktime_sub (now, last_jiffies_update); + delta =ktime_sub (now,READ_ONCE (last_jiffies_update));if (delta < tick_period)return ;
@@ -70,8 +71,9 @@ static void tick_do_update_jiffies64(ktime_t now)if (delta >= tick_period) { delta =ktime_sub (delta, tick_period); - last_jiffies_update =ktime_add (last_jiffies_update, - tick_period); +/* Pairs with the lockless read in this function. */ +WRITE_ONCE (last_jiffies_update, +ktime_add (last_jiffies_update, tick_period));/* Slow path for long timeouts */ if (unlikely (delta >= tick_period)) {
@@ -79,8 +81,10 @@ static void tick_do_update_jiffies64(ktime_t now) ticks =ktime_divns (delta, incr); - last_jiffies_update =ktime_add_ns (last_jiffies_update, - incr * ticks); +/* Pairs with the lockless read in this function. */ +WRITE_ONCE (last_jiffies_update, +ktime_add_ns (last_jiffies_update, + incr * ticks)); }do_timer (++ticks);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 70/107 mac80211: Fix TKIP replay protection immediately after key setup
In reply to Sasha LevinFrom: Jouni Malinen <[email protected]>
[ Upstream commit 6f601265215a421f425ba3a4850a35861d024643 ]
TKIP replay protection was skipped for the very first frame received after a new key is configured. While this is potentially needed to avoid dropping a frame in some cases, this does leave a window for replay attacks with group-addressed frames at the station side. Any earlier frame sent by the AP using the same key would be accepted as a valid frame and the internal RSC would then be updated to the TSC from that frame. This would allow multiple previously transmitted group-addressed frames to be replayed until the next valid new group-addressed frame from the AP is received by the station.
Fix this by limiting the no-replay-protection exception to apply only for the case where TSC=0, i.e., when this is for the very first frame protected using the new key, and the local RSC had not been set to a higher value when configuring the key (which may happen with GTK).
--- net/mac80211/tkip.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
net/mac80211/tkip.c +15 -3
@@ -263,9 +263,21 @@ int ieee80211_tkip_decrypt_data(struct arc4_ctx *ctx,if ((keyid >>6 ) != key->conf.keyidx)return TKIP_DECRYPT_INVALID_KEYIDX ; -if (rx_ctx->ctx.state !=TKIP_STATE_NOT_INIT && - (iv32 < rx_ctx->iv32 || - (iv32 == rx_ctx->iv32 && iv16 <= rx_ctx->iv16))) +/* Reject replays if the received TSC is smaller than or equal to the +* last received value in a valid message, but with an exception for +* the case where a new key has been set and no valid frame using that +* key has yet received and the local RSC was initialized to 0. This +* exception allows the very first frame sent by the transmitter to be +* accepted even if that transmitter were to use TSC 0 (IEEE 802.11 +* described TSC to be initialized to 1 whenever a new key is taken into +* use). +*/ +if (iv32 < rx_ctx->iv32 || + (iv32 == rx_ctx->iv32 && + (iv16 < rx_ctx->iv16 || + (iv16 == rx_ctx->iv16 && + (rx_ctx->iv32 || rx_ctx->iv16 || + rx_ctx->ctx.state !=TKIP_STATE_NOT_INIT )))))return TKIP_DECRYPT_REPLAY ;if (only_iv) {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 71/107 wireless: wext: avoid gcc -O3 warning
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit e16119655c9e6c4aa5767cd971baa9c491f41b13 ]
After the introduction of CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3, the wext code produces a bogus warning:
In function 'iw_handler_get_iwstats',
inlined from 'ioctl_standard_call' at net/wireless/wext-core.c:1015:9, inlined from 'wireless_process_ioctl' at net/wireless/wext-core.c:935:10, inlined from 'wext_ioctl_dispatch.part.8' at net/wireless/wext-core.c:986:8, inlined from 'wext_handle_ioctl':net/wireless/wext-core.c:671:3: error: argument 1 null where non-null expected [-Werror=nonnull]
memcpy(extra, stats, sizeof(struct iw_statistics)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from arch/x86/include/asm/string.h:5,net/wireless/wext-core.c: In function 'wext_handle_ioctl':arch/x86/include/asm/string_64.h:14:14: note: in a call to function 'memcpy' declared here
The problem is that ioctl_standard_call() sometimes calls the handler with a NULL argument that would cause a problem for iw_handler_get_iwstats. However, iw_handler_get_iwstats never actually gets called that way.
Marking that function as noinline avoids the warning and leads to slightly smaller object code as well.
--- net/wireless/wext-core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/wireless/wext-core.c +2 -1
@@ -657,7 +657,8 @@ struct iw_statistics *get_wireless_stats(struct net_device *dev)return NULL ; } -static int iw_handler_get_iwstats (struct net_device * dev, +/* noinline to avoid a bogus warning with -O3 */ +static noinline int iw_handler_get_iwstats(struct net_device * dev,struct iw_request_info * info,union iwreq_data * wrqu,char * extra)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 69/107 cfg80211: Fix radar event during another phy CAC
In reply to Sasha LevinFrom: Orr Mazor <[email protected]>
[ Upstream commit 26ec17a1dc5ecdd8d91aba63ead6f8b5ad5dea0d ]
In case a radar event of CAC_FINISHED or RADAR_DETECTED happens during another phy is during CAC we might need to cancel that CAC.
If we got a radar in a channel that another phy is now doing CAC on then the CAC should be canceled there.
If, for example, 2 phys doing CAC on the same channels, or on comptable channels, once on of them will finish his CAC the other might need to cancel his CAC, since it is no longer relevant.
To fix that the commit adds an callback and implement it in mac80211 to end CAC.
This commit also adds a call to said callback if after a radar event we see the CAC is no longer relevant
--- include/net/cfg80211.h | 5 +++++ net/mac80211/cfg.c | 23 +++++++++++++++++++++++ net/wireless/rdev-ops.h | 10 ++++++++++ net/wireless/reg.c | 23 ++++++++++++++++++++++- net/wireless/trace.h | 5 +++++ 5 files changed, 65 insertions(+), 1 deletion(-)
include/net/cfg80211.h +5 -0
@@ -3537,6 +3537,9 @@ struct cfg80211_update_owe_info {* * @start_radar_detection: Start radar detection in the driver. * +* @end_cac: End running CAC, probably because a related CAC +* was finished on another phy. +* * @update_ft_ies: Provide updated Fast BSS Transition information to the * driver. If the SME is in the driver/firmware, this information can be * used in building Authentication and Reassociation Request frames.
@@ -3863,6 +3866,8 @@ struct cfg80211_ops {struct net_device *dev, struct cfg80211_chan_def *chandef, u32 cac_time_ms); +void (*end_cac)(struct wiphy *wiphy, +struct net_device *dev);int (*update_ft_ies)(struct wiphy *wiphy,struct net_device *dev,struct cfg80211_update_ft_ies_params *ftie); int (*crit_proto_start)(struct wiphy *wiphy,
net/mac80211/cfg.c +23 -0
@@ -2954,6 +2954,28 @@ static int ieee80211_start_radar_detection(struct wiphy *wiphy,return err; } +static void ieee80211_end_cac (struct wiphy *wiphy, +struct net_device *dev) +{ +struct ieee80211_sub_if_data *sdata =IEEE80211_DEV_TO_SUB_IF (dev); +struct ieee80211_local *local = sdata->local; + +mutex_lock (&local->mtx); +list_for_each_entry (sdata, &local->interfaces, list) { +/* it might be waiting for the local->mtx, but then +* by the time it gets it, sdata->wdev.cac_started +* will no longer be true +*/ +cancel_delayed_work (&sdata->dfs_cac_timer_work); + +if (sdata->wdev.cac_started) { +ieee80211_vif_release_channel (sdata); + sdata->wdev.cac_started = false; + } + } +mutex_unlock (&local->mtx); +} +static struct cfg80211_beacon_data *cfg80211_beacon_dup (struct cfg80211_beacon_data *beacon) {
@@ -4023,6 +4045,7 @@ const struct cfg80211_ops mac80211_config_ops = {#endif .get_channel = ieee80211_cfg_get_channel, .start_radar_detection = ieee80211_start_radar_detection, + .end_cac = ieee80211_end_cac, .channel_switch = ieee80211_channel_switch, .set_qos_map = ieee80211_set_qos_map, .set_ap_chanwidth = ieee80211_set_ap_chanwidth,
net/wireless/rdev-ops.h +10 -0
@@ -1167,6 +1167,16 @@ rdev_start_radar_detection(struct cfg80211_registered_device *rdev,return ret; } +static inline void +rdev_end_cac (struct cfg80211_registered_device *rdev, +struct net_device *dev) +{ +trace_rdev_end_cac (&rdev->wiphy, dev); +if (rdev->ops->end_cac) + rdev->ops->end_cac (&rdev->wiphy, dev); +trace_rdev_return_void (&rdev->wiphy); +} + static inline int rdev_set_mcast_rate(struct cfg80211_registered_device *rdev, struct net_device *dev,
net/wireless/reg.c +22 -1
@@ -3892,6 +3892,25 @@ bool regulatory_pre_cac_allowed(struct wiphy *wiphy) }EXPORT_SYMBOL (regulatory_pre_cac_allowed); +static void cfg80211_check_and_end_cac (struct cfg80211_registered_device *rdev) +{ +struct wireless_dev *wdev; +/* If we finished CAC or received radar, we should end any +* CAC running on the same channels. +* the check !cfg80211_chandef_dfs_usable contain 2 options: +* either all channels are available - those the CAC_FINISHED +* event has effected another wdev state, or there is a channel +* in unavailable state in wdev chandef - those the RADAR_DETECTED +* event has effected another wdev state. +* In both cases we should end the CAC on the wdev. +*/ +list_for_each_entry (wdev, &rdev->wiphy.wdev_list, list) { +if (wdev->cac_started && + !cfg80211_chandef_dfs_usable (&rdev->wiphy, &wdev->chandef)) +rdev_end_cac (rdev, wdev->netdev); + } +} + void regulatory_propagate_dfs_state(struct wiphy *wiphy, struct cfg80211_chan_def *chandef, enum nl80211_dfs_state dfs_state,
@@ -3918,8 +3937,10 @@ void regulatory_propagate_dfs_state(struct wiphy *wiphy,cfg80211_set_dfs_state (&rdev->wiphy, chandef, dfs_state);if (event ==NL80211_RADAR_DETECTED || - event ==NL80211_RADAR_CAC_FINISHED ) + event ==NL80211_RADAR_CAC_FINISHED ) {cfg80211_sched_dfs_chan_update (rdev); +cfg80211_check_and_end_cac (rdev); + }nl80211_radar_notify (rdev, chandef, event,NULL ,GFP_KERNEL ); }
net/wireless/trace.h +5 -0
@@ -646,6 +646,11 @@ DEFINE_EVENT(wiphy_netdev_evt, rdev_flush_pmksa,TP_ARGS (wiphy, netdev) ); +DEFINE_EVENT (wiphy_netdev_evt, rdev_end_cac, + TP_PROTO(struct wiphy *wiphy, struct net_device *netdev), +TP_ARGS (wiphy, netdev) +); + DECLARE_EVENT_CLASS(station_add_change, TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u8 *mac, struct station_parameters *params),
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 68/107 wireless: fix enabling channel 12 for custom regulatory domain
In reply to Sasha LevinFrom: Ganapathi Bhat <[email protected]>
[ Upstream commit c4b9d655e445a8be0bff624aedea190606b5ebbc ]
Commit e33e2241e272 ("Revert "cfg80211: Use 5MHz bandwidth by default when checking usable channels"") fixed a broken regulatory (leaving channel 12 open for AP where not permitted). Apply a similar fix to custom regulatory domain processing.
--- net/wireless/reg.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
net/wireless/reg.c +10 -3
@@ -2261,14 +2261,15 @@ static void update_all_wiphy_regulatory(enum nl80211_reg_initiator initiator)static void handle_channel_custom (struct wiphy *wiphy,struct ieee80211_channel *chan, -const struct ieee80211_regdomain *regd) +const struct ieee80211_regdomain *regd, +u32 min_bw) {u32 bw_flags =0 ;const struct ieee80211_reg_rule *reg_rule =NULL ;const struct ieee80211_power_rule *power_rule =NULL ;u32 bw; -for (bw =MHZ_TO_KHZ (20 ); bw >=MHZ_TO_KHZ (5 ); bw = bw /2 ) { +for (bw =MHZ_TO_KHZ (20 ); bw >= min_bw; bw = bw /2 ) { reg_rule =freq_reg_info_regd (MHZ_TO_KHZ (chan->center_freq), regd, bw);if (!IS_ERR (reg_rule))
@@ -2324,8 +2325,14 @@ static void handle_band_custom(struct wiphy *wiphy,if (!sband)return ; +/* +* We currently assume that you always want at least 20 MHz, +* otherwise channel 12 might get enabled if this rule is +* compatible to US, which permits 2402 - 2472 MHz. +*/ for (i =0 ; i < sband->n_channels; i++) -handle_channel_custom (wiphy, &sband->channels[i], regd); +handle_channel_custom (wiphy, &sband->channels[i], regd, +MHZ_TO_KHZ (20 )); }/* Used by drivers prior to wiphy registration */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 64/107 lkdtm/bugs: fix build error in lkdtm_UNSET_SMEP
In reply to Sasha LevinFrom: Brendan Higgins <[email protected]>
[ Upstream commit 0e31e3573f0cd94d7b821117db854187ffc85765 ]
When building ARCH=um with CONFIG_UML_X86=y and CONFIG_64BIT=y we get the build errors:
drivers/misc/lkdtm/bugs.c: In function ‘lkdtm_UNSET_SMEP’:drivers/misc/lkdtm/bugs.c:288:8: error: implicit declaration of function ‘native_read_cr4’ [-Werror=implicit-function-declaration]
cr4 = native_read_cr4();
^~~~~~~~~~~~~~~
drivers/misc/lkdtm/bugs.c:290:13: error: ‘X86_CR4_SMEP’ undeclared (first use in this function); did you mean ‘X86_FEATURE_SMEP’?
if ((cr4 & X86_CR4_SMEP) != X86_CR4_SMEP) {
^~~~~~~~~~~~
X86_FEATURE_SMEPdrivers/misc/lkdtm/bugs.c:290:13: note: each undeclared identifier is reported only once for each function it appears in drivers/misc/lkdtm/bugs.c:297:2: error: implicit declaration of function ‘native_write_cr4’; did you mean ‘direct_write_cr4’? [-Werror=implicit-function-declaration]
native_write_cr4(cr4);
^~~~~~~~~~~~~~~~
direct_write_cr4
So specify that this block of code should only build when CONFIG_X86_64=y *AND* CONFIG_UML is unset.
--- drivers/misc/lkdtm/bugs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/lkdtm/bugs.c +1 -1
@@ -274,7 +274,7 @@ void lkdtm_STACK_GUARD_PAGE_TRAILING(void)void lkdtm_UNSET_SMEP (void ) { -#ifdef CONFIG_X86_64 +#if IS_ENABLED (CONFIG_X86_64 ) && !IS_ENABLED (CONFIG_UML )#define MOV_CR4_DEPTH 64void (*direct_write_cr4)(unsigned long val);unsigned char *insn;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 61/107 qmi_wwan: Add support for Quectel RM500Q
In reply to Sasha LevinFrom: Kristian Evensen <[email protected]>
[ Upstream commit a9ff44f0e61d074f29770413fef6a5452be7b83e ]
RM500Q is a 5G module from Quectel, supporting both standalone and non-standalone modes. The normal Quectel quirks apply (DTR and dynamic interface numbers).
--- drivers/net/usb/qmi_wwan.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/qmi_wwan.c +1 -0
@@ -1062,6 +1062,7 @@ static const struct usb_device_id products[] = { {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0125)}, /* Quectel EC25, EC20 R2.0 Mini PCIe */ {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0306)}, /* Quectel EP06/EG06/EM06 */ {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0512)}, /* Quectel EG12/EM12 */ + {QMI_QUIRK_QUECTEL_DYNCFG(0x2c7c, 0x0800)}, /* Quectel RM500Q-GL *//* 3. Combined interface devices matching on interface number */ {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 62/107 NFC: pn533: fix bulk-message timeout
In reply to Sasha LevinFrom: Johan Hovold <[email protected]>
[ Upstream commit a112adafcb47760feff959ee1ecd10b74d2c5467 ]
The driver was doing a synchronous uninterruptible bulk-transfer without using a timeout. This could lead to the driver hanging on probe due to a malfunctioning (or malicious) device until the device is physically disconnected. While sleeping in probe the driver prevents other devices connected to the same hub from being added to (or removed from) the bus.
An arbitrary limit of five seconds should be more than enough.
--- drivers/nfc/pn533/usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nfc/pn533/usb.c +1 -1
@@ -391,7 +391,7 @@ static int pn533_acr122_poweron_rdr(struct pn533_usb_phy *phy) cmd, sizeof(cmd), false); rc =usb_bulk_msg (phy->udev, phy->out_urb->pipe, buffer,sizeof (cmd), - &transferred,0 ); + &transferred,5000 );kfree (buffer);if (rc || (transferred !=sizeof (cmd))) { nfc_err(&phy->udev->dev,
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 60/107 netfilter: arp_tables: init netns pointer in xt_tgdtor_param struct
In reply to Sasha LevinFrom: Florian Westphal <[email protected]>
[ Upstream commit 212e7f56605ef9688d0846db60c6c6ec06544095 ]
An earlier commit (1b789577f655060d98d20e,
"netfilter: arp_tables: init netns pointer in xt_tgchk_param struct") fixed missing net initialization for arptables, but turns out it was incomplete. We can get a very similar struct net NULL deref during error unwinding:
general protection fault: 0000 [#1] PREEMPT SMP KASAN RIP: 0010:xt_rateest_put+0xa1/0x440 net/netfilter/xt_RATEEST.c:77 xt_rateest_tg_destroy+0x72/0xa0 net/netfilter/xt_RATEEST.c:175 cleanup_entry net/ipv4/netfilter/arp_tables.c:509 [inline] translate_table+0x11f4/0x1d80 net/ipv4/netfilter/arp_tables.c:587 do_replace net/ipv4/netfilter/arp_tables.c:981 [inline] do_arpt_set_ctl+0x317/0x650 net/ipv4/netfilter/arp_tables.c:1461
Also init the netns pointer in xt_tgdtor_param struct.
--- net/ipv4/netfilter/arp_tables.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
net/ipv4/netfilter/arp_tables.c +10 -9
@@ -496,12 +496,13 @@ static inline int check_entry_size_and_hooks(struct arpt_entry *e,return 0 ; } -static inline void cleanup_entry (struct arpt_entry *e) +static void cleanup_entry (struct arpt_entry *e,struct net *net) {struct xt_tgdtor_param par;struct xt_entry_target *t; t =arpt_get_target (e); + par.net = net; par.target = t->u.kernel.target; par.targinfo = t->data; par.family =NFPROTO_ARP ;
@@ -584,7 +585,7 @@ static int translate_table(struct net *net, xt_entry_foreach(iter, entry0, newinfo->size) {if (i-- ==0 )break ; -cleanup_entry (iter); +cleanup_entry (iter, net); }return ret; }
@@ -927,7 +928,7 @@ static int __do_replace(struct net *net, const char *name,/* Decrease module usage counts and free resource */ loc_cpu_old_entry = oldinfo->entries; xt_entry_foreach(iter, loc_cpu_old_entry, oldinfo->size) -cleanup_entry (iter); +cleanup_entry (iter, net);xt_free_table_info (oldinfo); if (copy_to_user(counters_ptr, counters,
@@ -990,7 +991,7 @@ static int do_replace(struct net *net, const void __user *user, free_newinfo_untrans: xt_entry_foreach(iter, loc_cpu_entry, newinfo->size) -cleanup_entry (iter); +cleanup_entry (iter, net); free_newinfo:xt_free_table_info (newinfo);return ret;
@@ -1287,7 +1288,7 @@ static int compat_do_replace(struct net *net, void __user *user, free_newinfo_untrans: xt_entry_foreach(iter, loc_cpu_entry, newinfo->size) -cleanup_entry (iter); +cleanup_entry (iter, net); free_newinfo:xt_free_table_info (newinfo);return ret;
@@ -1514,7 +1515,7 @@ static int do_arpt_get_ctl(struct sock *sk, int cmd, void __user *user, int *lenreturn ret; } -static void __arpt_unregister_table (struct xt_table *table) +static void __arpt_unregister_table (struct net *net,struct xt_table *table) {struct xt_table_info *private;void *loc_cpu_entry;
@@ -1526,7 +1527,7 @@ static void __arpt_unregister_table(struct xt_table *table)/* Decrease module usage counts and free resources */ loc_cpu_entry = private->entries; xt_entry_foreach(iter, loc_cpu_entry, private->size) -cleanup_entry (iter); +cleanup_entry (iter, net);if (private->number > private->initial_entries)module_put (table_owner);xt_free_table_info (private);
@@ -1566,7 +1567,7 @@ int arpt_register_table(struct net *net, ret =nf_register_net_hooks (net, ops,hweight32 (table->valid_hooks));if (ret !=0 ) { -__arpt_unregister_table (new_table); +__arpt_unregister_table (net, new_table); *res =NULL ; }
@@ -1581,7 +1582,7 @@ void arpt_unregister_table(struct net *net, struct xt_table *table, const struct nf_hook_ops *ops) {nf_unregister_net_hooks (net, ops,hweight32 (table->valid_hooks)); -__arpt_unregister_table (table); +__arpt_unregister_table (net, table); }/* The built-in targets: standard (NULL) and error. */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 44/107 bpf/sockmap: Read psock ingress_msg before sk_receive_queue
In reply to Sasha LevinFrom: Lingpeng Chen <[email protected]>
[ Upstream commit e7a5f1f1cd0008e5ad379270a8657e121eedb669 ]
Right now in tcp_bpf_recvmsg, sock read data first from sk_receive_queue if not empty than psock->ingress_msg otherwise. If a FIN packet arrives and there's also some data in psock->ingress_msg, the data in psock->ingress_msg will be purged. It is always happen when request to a HTTP1.0 server like python SimpleHTTPServer since the server send FIN packet after data is sent out.
--- net/ipv4/tcp_bpf.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
net/ipv4/tcp_bpf.c +6 -6
@@ -121,14 +121,14 @@ int tcp_bpf_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,struct sk_psock *psock;int copied, ret; -if (unlikely (flags &MSG_ERRQUEUE )) -return inet_recv_error (sk, msg, len, addr_len); -if (!skb_queue_empty (&sk->sk_receive_queue)) -return tcp_recvmsg (sk, msg, len, nonblock, flags, addr_len); - psock =sk_psock_get (sk);if (unlikely (!psock))return tcp_recvmsg (sk, msg, len, nonblock, flags, addr_len); +if (unlikely (flags &MSG_ERRQUEUE )) +return inet_recv_error (sk, msg, len, addr_len); +if (!skb_queue_empty (&sk->sk_receive_queue) && +sk_psock_queue_empty (psock)) +return tcp_recvmsg (sk, msg, len, nonblock, flags, addr_len);lock_sock (sk); msg_bytes_ready: copied =__tcp_bpf_recvmsg (sk, psock, msg, len, flags);
@@ -139,7 +139,7 @@ msg_bytes_ready: timeo =sock_rcvtimeo (sk, nonblock); data =tcp_bpf_wait_data (sk, psock, flags, timeo, &err);if (data) { -if (skb_queue_empty (&sk->sk_receive_queue)) +if (!sk_psock_queue_empty (psock)) goto msg_bytes_ready;release_sock (sk);sk_psock_put (sk, psock);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 49/107 net: stmmac: tc: Do not setup flower filtering if RSS is enabled
In reply to Sasha LevinFrom: Jose Abreu <[email protected]>
[ Upstream commit 7bd754c47dd3ad1b048c9641294b0234fcce2c58 ]
RSS, when enabled, will bypass the L3 and L4 filtering causing it not to work. Add a check before trying to setup the filters.
--- drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +4 -0
@@ -579,6 +579,10 @@ static int tc_setup_cls(struct stmmac_priv *priv, {int ret =0 ; +/* When RSS is enabled, the filtering will be bypassed */ +if (priv->rss.enable) +return -EBUSY ; +switch (cls->command) {case FLOW_CLS_REPLACE : ret =tc_add_flow (priv, cls);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 48/107 net: stmmac: selftests: Update status when disabling RSS
In reply to Sasha LevinFrom: Jose Abreu <[email protected]>
[ Upstream commit e715d74504352968cf24ac95476706bc911a69cd ]
We are disabling RSS on HW but not updating the internal private status to the 'disabled' state. This is needed for next tc commit that will check if RSS is disabled before trying to apply filters.
--- .../stmicro/stmmac/stmmac_selftests.c | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c +14 -6
@@ -1291,16 +1291,19 @@ static int __stmmac_test_l3filt(struct stmmac_priv *priv, u32 dst, u32 src,struct stmmac_packet_attrs attr = { };struct flow_dissector *dissector;struct flow_cls_offload *cls; +int ret, old_enable =0 ;struct flow_rule *rule; -int ret;if (!tc_can_offload (priv->dev))return -EOPNOTSUPP ;if (!priv->dma_cap.l3l4fnum)return -EOPNOTSUPP ; -if (priv->rss.enable) +if (priv->rss.enable) { + old_enable = priv->rss.enable; + priv->rss.enable = false;stmmac_rss_configure (priv, priv->hw,NULL , priv->plat->rx_queues_to_use); + } dissector =kzalloc (sizeof (*dissector),GFP_KERNEL );if (!dissector) {
@@ -1367,7 +1370,8 @@ cleanup_cls: cleanup_dissector:kfree (dissector); cleanup_rss: -if (priv->rss.enable) { +if (old_enable) { + priv->rss.enable = old_enable;stmmac_rss_configure (priv, priv->hw, &priv->rss, priv->plat->rx_queues_to_use); }
@@ -1412,16 +1416,19 @@ static int __stmmac_test_l4filt(struct stmmac_priv *priv, u32 dst, u32 src,struct stmmac_packet_attrs attr = { };struct flow_dissector *dissector;struct flow_cls_offload *cls; +int ret, old_enable =0 ;struct flow_rule *rule; -int ret;if (!tc_can_offload (priv->dev))return -EOPNOTSUPP ;if (!priv->dma_cap.l3l4fnum)return -EOPNOTSUPP ; -if (priv->rss.enable) +if (priv->rss.enable) { + old_enable = priv->rss.enable; + priv->rss.enable = false;stmmac_rss_configure (priv, priv->hw,NULL , priv->plat->rx_queues_to_use); + } dissector =kzalloc (sizeof (*dissector),GFP_KERNEL );if (!dissector) {
@@ -1493,7 +1500,8 @@ cleanup_cls: cleanup_dissector:kfree (dissector); cleanup_rss: -if (priv->rss.enable) { +if (old_enable) { + priv->rss.enable = old_enable;stmmac_rss_configure (priv, priv->hw, &priv->rss, priv->plat->rx_queues_to_use); }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 28/107 clk: mmp2: Fix the order of timer mux parents
In reply to Sasha LevinFrom: Lubomir Rintel <[email protected]>
[ Upstream commit 8bea5ac0fbc5b2103f8779ddff216122e3c2e1ad ]
Determined empirically, no documentation is available.
The OLPC XO-1.75 laptop used parent 1, that one being VCTCXO/4 (65MHz), but thought it's a VCTCXO/2 (130MHz). The mmp2 timer driver, not knowing what is going on, ended up just dividing the rate as of
commit f36797ee4380 ("ARM: mmp/mmp2: dt: enable the clock")'
--- drivers/clk/mmp/clk-of-mmp2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/mmp/clk-of-mmp2.c +1 -1
@@ -134,7 +134,7 @@ static DEFINE_SPINLOCK(ssp3_lock);static const char *ssp_parent_names[] = {"vctcxo_4" ,"vctcxo_2" ,"vctcxo" ,"pll1_16" };static DEFINE_SPINLOCK (timer_lock); -static const char *timer_parent_names[] = {"clk32" ,"vctcxo_2" ,"vctcxo_4" ,"vctcxo" }; +static const char *timer_parent_names[] = {"clk32" ,"vctcxo_4" ,"vctcxo_2" ,"vctcxo" };static DEFINE_SPINLOCK (reset_lock);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 27/107 clk: qcom: gcc-sdm845: Add missing flag to votable GDSCs
In reply to Sasha LevinFrom: Georgi Djakov <[email protected]>
[ Upstream commit 5e82548e26ef62e257dc2ff37c11acb5eb72728e ]
On sdm845 devices, during boot we see the following warnings (unless we have added 'pd_ignore_unused' to the kernel command line):
hlos1_vote_mmnoc_mmu_tbu_sf_gdsc status stuck at 'on' hlos1_vote_mmnoc_mmu_tbu_hf1_gdsc status stuck at 'on' hlos1_vote_mmnoc_mmu_tbu_hf0_gdsc status stuck at 'on' hlos1_vote_aggre_noc_mmu_tbu2_gdsc status stuck at 'on' hlos1_vote_aggre_noc_mmu_tbu1_gdsc status stuck at 'on' hlos1_vote_aggre_noc_mmu_pcie_tbu_gdsc status stuck at 'on' hlos1_vote_aggre_noc_mmu_audio_tbu_gdsc status stuck at 'on'
As the name of these GDSCs suggests, they are "votable" and in downstream DT, they all have the property "qcom,no-status-check-on-disable", which means that we should not poll the status bit when we disable them.
Luckily the VOTABLE flag already exists and it does exactly what we need, so let's make use of it to make the warnings disappear.
--- drivers/clk/qcom/gcc-sdm845.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/clk/qcom/gcc-sdm845.c +7 -0
@@ -3255,6 +3255,7 @@ static struct gdsc hlos1_vote_aggre_noc_mmu_audio_tbu_gdsc = { .name = "hlos1_vote_aggre_noc_mmu_audio_tbu_gdsc", }, .pwrsts = PWRSTS_OFF_ON, + .flags = VOTABLE, }; static struct gdsc hlos1_vote_aggre_noc_mmu_pcie_tbu_gdsc = {
@@ -3263,6 +3264,7 @@ static struct gdsc hlos1_vote_aggre_noc_mmu_pcie_tbu_gdsc = { .name = "hlos1_vote_aggre_noc_mmu_pcie_tbu_gdsc", }, .pwrsts = PWRSTS_OFF_ON, + .flags = VOTABLE, }; static struct gdsc hlos1_vote_aggre_noc_mmu_tbu1_gdsc = {
@@ -3271,6 +3273,7 @@ static struct gdsc hlos1_vote_aggre_noc_mmu_tbu1_gdsc = { .name = "hlos1_vote_aggre_noc_mmu_tbu1_gdsc", }, .pwrsts = PWRSTS_OFF_ON, + .flags = VOTABLE, }; static struct gdsc hlos1_vote_aggre_noc_mmu_tbu2_gdsc = {
@@ -3279,6 +3282,7 @@ static struct gdsc hlos1_vote_aggre_noc_mmu_tbu2_gdsc = { .name = "hlos1_vote_aggre_noc_mmu_tbu2_gdsc", }, .pwrsts = PWRSTS_OFF_ON, + .flags = VOTABLE, }; static struct gdsc hlos1_vote_mmnoc_mmu_tbu_hf0_gdsc = {
@@ -3287,6 +3291,7 @@ static struct gdsc hlos1_vote_mmnoc_mmu_tbu_hf0_gdsc = { .name = "hlos1_vote_mmnoc_mmu_tbu_hf0_gdsc", }, .pwrsts = PWRSTS_OFF_ON, + .flags = VOTABLE, }; static struct gdsc hlos1_vote_mmnoc_mmu_tbu_hf1_gdsc = {
@@ -3295,6 +3300,7 @@ static struct gdsc hlos1_vote_mmnoc_mmu_tbu_hf1_gdsc = { .name = "hlos1_vote_mmnoc_mmu_tbu_hf1_gdsc", }, .pwrsts = PWRSTS_OFF_ON, + .flags = VOTABLE, }; static struct gdsc hlos1_vote_mmnoc_mmu_tbu_sf_gdsc = {
@@ -3303,6 +3309,7 @@ static struct gdsc hlos1_vote_mmnoc_mmu_tbu_sf_gdsc = { .name = "hlos1_vote_mmnoc_mmu_tbu_sf_gdsc", }, .pwrsts = PWRSTS_OFF_ON, + .flags = VOTABLE, }; static struct clk_regmap *gcc_sdm845_clocks[] = {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 26/107 x86/resctrl: Fix potential memory leak
In reply to Sasha LevinFrom: Shakeel Butt <[email protected]>
[ Upstream commit ab6a2114433a3b5b555983dcb9b752a85255f04b ]
set_cache_qos_cfg() is leaking memory when the given level is not RDT_RESOURCE_L3 or RDT_RESOURCE_L2. At the moment, this function is called with only valid levels but move the allocation after the valid level checks in order to make it more robust and future proof.
[ bp: Massage commit message. ]
--- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/kernel/cpu/resctrl/rdtgroup.c +3 -3
@@ -1741,9 +1741,6 @@ static int set_cache_qos_cfg(int level, bool enable)struct rdt_domain *d;int cpu; -if (!zalloc_cpumask_var (&cpu_mask,GFP_KERNEL )) -return -ENOMEM ; -if (level ==RDT_RESOURCE_L3 ) update = l3_qos_cfg_update;else if (level ==RDT_RESOURCE_L2 )
@@ -1751,6 +1748,9 @@ static int set_cache_qos_cfg(int level, bool enable)else return -EINVAL ; +if (!zalloc_cpumask_var (&cpu_mask,GFP_KERNEL )) +return -ENOMEM ; + r_l = &rdt_resources_all[level];list_for_each_entry (d, &r_l->domains, list) {/* Pick one CPU from each domain instance to update MSR */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 25/107 mac80211: mesh: restrict airtime metric to peered established plinks
In reply to Sasha LevinFrom: Markus Theil <[email protected]>
[ Upstream commit 02a614499600af836137c3fbc4404cd96365fff2 ]
The following warning is triggered every time an unestablished mesh peer gets dumped. Checks if a peer link is established before retrieving the airtime link metric.
[ 9563.022567] WARNING: CPU: 0 PID: 6287 at net/mac80211/mesh_hwmp.c:345
airtime_link_metric_get+0xa2/0xb0 [mac80211]
[ 9563.022697] Hardware name: PC Engines apu2/apu2, BIOS v4.10.0.3
[ 9563.022756] RIP: 0010:airtime_link_metric_get+0xa2/0xb0 [mac80211]
[ 9563.022838] Call Trace:
[ 9563.022897] sta_set_sinfo+0x936/0xa10 [mac80211]
[ 9563.022964] ieee80211_dump_station+0x6d/0x90 [mac80211]
[ 9563.023062] nl80211_dump_station+0x154/0x2a0 [cfg80211]
[ 9563.023120] netlink_dump+0x17b/0x370
[ 9563.023130] netlink_recvmsg+0x2a4/0x480
[ 9563.023140] ____sys_recvmsg+0xa6/0x160
[ 9563.023154] ___sys_recvmsg+0x93/0xe0
[ 9563.023169] __sys_recvmsg+0x7e/0xd0
[ 9563.023210] do_syscall_64+0x4e/0x140
[ 9563.023217] entry_SYSCALL_64_after_hwframe+0x44/0xa9--- net/mac80211/mesh_hwmp.c | 3 +++ 1 file changed, 3 insertions(+)
net/mac80211/mesh_hwmp.c +3 -0
@@ -328,6 +328,9 @@ u32 airtime_link_metric_get(struct ieee80211_local *local,unsigned long fail_avg =ewma_mesh_fail_avg_read (&sta->mesh->fail_avg); +if (sta->mesh->plink_state !=NL80211_PLINK_ESTAB ) +return MAX_METRIC ; +/* Try to get rate based on HW/SW RC algorithm. * Rate is returned in units of Kbps, correct this * to comply with airtime calculation units
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 22/107 clk: Don't try to enable critical clocks if prepare failed
In reply to Sasha LevinFrom: Guenter Roeck <[email protected]>
[ Upstream commit 12ead77432f2ce32dea797742316d15c5800cb32 ]
The following traceback is seen if a critical clock fails to prepare.
bcm2835-clk 3f101000.cprman: plld: couldn't lock PLL
------------[ cut here ]------------ Enabling unprepared plld_per WARNING: CPU: 1 PID: 1 at drivers/clk/clk.c:1014 clk_core_enable+0xcc/0x2c0 ... Call trace: clk_core_enable+0xcc/0x2c0 __clk_register+0x5c4/0x788 devm_clk_hw_register+0x4c/0xb0 bcm2835_register_pll_divider+0xc0/0x150 bcm2835_clk_probe+0x134/0x1e8 platform_drv_probe+0x50/0xa0 really_probe+0xd4/0x308 driver_probe_device+0x54/0xe8 device_driver_attach+0x6c/0x78 __driver_attach+0x54/0xd8
...
Check return values from clk_core_prepare() and clk_core_enable() and bail out if any of those functions returns an error.
--- drivers/clk/clk.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/clk/clk.c +8 -2
@@ -3408,11 +3408,17 @@ static int __clk_core_init(struct clk_core *core)if (core->flags &CLK_IS_CRITICAL ) {unsigned long flags; -clk_core_prepare (core); + ret =clk_core_prepare (core); +if (ret) + goto out; flags =clk_enable_lock (); -clk_core_enable (core); + ret =clk_core_enable (core);clk_enable_unlock (flags); +if (ret) { +clk_core_unprepare (core); + goto out; + } }clk_core_reparent_orphans_nolock ();
Signature · 1 line
2.20.1
Re: [PATCH AUTOSEL 5.4 028/107] clk: mmp2: Fix the order of timer mux parents
In reply to Sasha LevinQuoted 10 lines · Sasha Levin
From: Lubomir Rintel <[email protected]>
[ Upstream commit
8bea5ac0fbc5b2103f8779ddff216122e3c2e1ad]Determined empirically, no documentation is available.
The OLPC XO-1.75 laptop used parent 1, that one being VCTCXO/4 (65MHz), but thought it's a VCTCXO/2 (130MHz). The mmp2 timer driver, not knowing what is going on, ended up just dividing the rate as of
commitf36797ee4380("ARM: mmp/mmp2: dt: enable the clock")'
Hi,
this has to go together with this one (in other stable trees too):
commit 0bd0f30bbf060891f58866a46083a9931f71787c
Author: Lubomir Rintel <[email protected]>
Date: Wed Dec 18 20:04:53 2019 +0100
ARM: mmp: do not divide the clock rate
This was done because the clock driver returned the wrong rate, which is fixed in "clk: mmp2: Fix the order of timer mux parents" patch.
It removes a workaround for the same issue from before it was understood what is going on. If it stays, the clock will run twice as fast.
Thanks
Lubo
Quoted 26 lines
Signed-off-by Lubomir Rintel <[email protected]>Acked-by Stephen Boyd <[email protected]>Signed-off-by Olof Johansson <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- drivers/clk/mmp/clk-of-mmp2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/clk/mmp/clk-of-mmp2.c +1
-1@@ -134,7 +134,7 @@ static DEFINE_SPINLOCK(ssp3_lock);static const char *ssp_parent_names[] = {"vctcxo_4" ,"vctcxo_2" ,"vctcxo" ,"pll1_16" };static DEFINE_SPINLOCK (timer_lock); -static const char *timer_parent_names[] = {"clk32" ,"vctcxo_2" ,"vctcxo_4" ,"vctcxo" }; +static const char *timer_parent_names[] = {"clk32" ,"vctcxo_4" ,"vctcxo_2" ,"vctcxo" };static DEFINE_SPINLOCK (reset_lock);Signature · 1 line
2.20.1