6.13.3-rc1 review
Subsystems (6)
Greg Kroah-Hartman
maintainerPATCH 122/443 drm/xe/oa: Preserve oa_ctrl unused bits
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ashutosh Dixit <[email protected]>
[ Upstream commit 588c20079e17dae9e1f49ba42981a05de1c9136e ]
UMD's have interest in setting unused bits of the oa_ctrl register "out of band" for certain experiments. To facilitate this, don't clobber previous oa_ctrl unused bits, i.e. rmw the values rather than simply write them.
--- drivers/gpu/drm/xe/regs/xe_oa_regs.h | 6 ++++++ drivers/gpu/drm/xe/xe_oa.c | 12 ++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/regs/xe_oa_regs.h +6 -0
@@ -59,6 +59,10 @@/* Common to all OA units */ #define OA_OACONTROL_REPORT_BC_MASK REG_GENMASK(9, 9)#define OA_OACONTROL_COUNTER_SIZE_MASK REG_GENMASK(8, 8) +#define OAG_OACONTROL_USED_BITS \ + (OAG_OACONTROL_OA_PES_DISAG_EN | OAG_OACONTROL_OA_CCS_SELECT_MASK | \ + OAG_OACONTROL_OA_COUNTER_SEL_MASK | OAG_OACONTROL_OA_COUNTER_ENABLE | \ + OA_OACONTROL_REPORT_BC_MASK | OA_OACONTROL_COUNTER_SIZE_MASK)#define OAG_OA_DEBUG XE_REG(0xdaf8, XE_REG_OPTION_MASKED)#define OAG_OA_DEBUG_DISABLE_MMIO_TRG REG_BIT(14)
@@ -85,6 +89,8 @@#define OAM_CONTEXT_CONTROL_OFFSET (0x1bc)#define OAM_CONTROL_OFFSET (0x194)#define OAM_CONTROL_COUNTER_SEL_MASK REG_GENMASK(3, 1) +#define OAM_OACONTROL_USED_BITS \ + (OAM_CONTROL_COUNTER_SEL_MASK | OAG_OACONTROL_OA_COUNTER_ENABLE)#define OAM_DEBUG_OFFSET (0x198)#define OAM_STATUS_OFFSET (0x19c)#define OAM_MMIO_TRG_OFFSET (0x1d0)
drivers/gpu/drm/xe/xe_oa.c +10 -2
@@ -445,6 +445,12 @@ static u32 __oa_ccs_select(struct xe_oa_stream *stream)return val; } +static u32 __oactrl_used_bits (struct xe_oa_stream *stream) +{ +return stream->hwe->oa_unit->type ==DRM_XE_OA_UNIT_TYPE_OAG ? +OAG_OACONTROL_USED_BITS :OAM_OACONTROL_USED_BITS ; +} +static void xe_oa_enable (struct xe_oa_stream *stream) {const struct xe_oa_format *format = stream->oa_buffer.format;
@@ -465,14 +471,14 @@ static void xe_oa_enable(struct xe_oa_stream *stream) stream->hwe->oa_unit->type == DRM_XE_OA_UNIT_TYPE_OAG) val |=OAG_OACONTROL_OA_PES_DISAG_EN ; -xe_mmio_write32 (&stream->gt->mmio, regs->oa_ctrl, val); +xe_mmio_rmw32 (&stream->gt->mmio, regs->oa_ctrl,__oactrl_used_bits (stream), val); }static void xe_oa_disable (struct xe_oa_stream *stream) {struct xe_mmio *mmio = &stream->gt->mmio; -xe_mmio_write32 (mmio,__oa_regs (stream)->oa_ctrl,0 ); +xe_mmio_rmw32 (mmio,__oa_regs (stream)->oa_ctrl,__oactrl_used_bits (stream),0 );if (xe_mmio_wait32 (mmio,__oa_regs (stream)->oa_ctrl,OAG_OACONTROL_OA_COUNTER_ENABLE ,0 ,50000 ,NULL , false)) drm_err(&stream->oa->xe->drm,
@@ -2569,6 +2575,8 @@ static void __xe_oa_init_oa_units(struct xe_gt *gt) u->type =DRM_XE_OA_UNIT_TYPE_OAM ; } +xe_mmio_write32 (>->mmio, u->regs.oa_ctrl,0 ); +/* Ensure MMIO trigger remains disabled till there is a stream */ xe_mmio_write32 (>->mmio, u->regs.oa_debug,oag_configure_mmio_trigger (NULL , false));
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 123/443 drm/xe/pf: Fix migration initialization
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Wajdeczko <[email protected]>
[ Upstream commit 9f706fd8024208b0686bb8ec68589d758f765672 ]
The migration support only needs to be initialized once, but it was incorrectly called from the xe_gt_sriov_pf_init_hw(), which is part of the reset flow and may be called multiple times.
--- drivers/gpu/drm/xe/xe_gt.c | 4 +++- drivers/gpu/drm/xe/xe_gt_sriov_pf.c | 14 +++++++++++++- drivers/gpu/drm/xe/xe_gt_sriov_pf.h | 6 ++++++ 3 files changed, 22 insertions(+), 2 deletions(-)
drivers/gpu/drm/xe/xe_gt.c +3 -1
@@ -532,8 +532,10 @@ static int all_fw_domain_init(struct xe_gt *gt)if (IS_SRIOV_PF (gt_to_xe (gt)) && !xe_gt_is_media_type (gt))xe_lmtt_init_hw (>_to_tile (gt)->sriov.pf.lmtt); -if (IS_SRIOV_PF (gt_to_xe (gt))) +if (IS_SRIOV_PF (gt_to_xe (gt))) { +xe_gt_sriov_pf_init (gt);xe_gt_sriov_pf_init_hw (gt); + }xe_force_wake_put (gt_to_fw (gt), fw_ref);
drivers/gpu/drm/xe/xe_gt_sriov_pf.c +13 -1
@@ -68,6 +68,19 @@ int xe_gt_sriov_pf_init_early(struct xe_gt *gt)return 0 ; } +/** +* xe_gt_sriov_pf_init - Prepare SR-IOV PF data structures on PF. +* @gt: the &xe_gt to initialize +* +* Late one-time initialization of the PF data. +* +* Return: 0 on success or a negative error code on failure. +*/ +int xe_gt_sriov_pf_init (struct xe_gt *gt) +{ +return xe_gt_sriov_pf_migration_init (gt); +} +static bool pf_needs_enable_ggtt_guest_update (struct xe_device *xe) {return GRAPHICS_VERx100 (xe) ==1200 ;
@@ -90,7 +103,6 @@ void xe_gt_sriov_pf_init_hw(struct xe_gt *gt)pf_enable_ggtt_guest_update (gt);xe_gt_sriov_pf_service_update (gt); -xe_gt_sriov_pf_migration_init (gt); }static u32 pf_get_vf_regs_stride (struct xe_device *xe)
drivers/gpu/drm/xe/xe_gt_sriov_pf.h +6 -0
@@ -10,6 +10,7 @@ struct xe_gt;#ifdef CONFIG_PCI_IOV int xe_gt_sriov_pf_init_early (struct xe_gt *gt); +int xe_gt_sriov_pf_init (struct xe_gt *gt);void xe_gt_sriov_pf_init_hw (struct xe_gt *gt);void xe_gt_sriov_pf_sanitize_hw (struct xe_gt *gt,unsigned int vfid);void xe_gt_sriov_pf_restart (struct xe_gt *gt);
@@ -19,6 +20,11 @@ static inline int xe_gt_sriov_pf_init_early(struct xe_gt *gt)return 0 ; } +static inline int xe_gt_sriov_pf_init (struct xe_gt *gt) +{ +return 0 ; +} +static inline void xe_gt_sriov_pf_init_hw (struct xe_gt *gt) { }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 124/443 ethtool: rss: fix hiding unsupported fields in dumps
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 244f8aa46fa9e2f4ea5fe0e04988b395d5e30fc7 ]
Commit ec6e57beaf8b ("ethtool: rss: don't report key if device doesn't support it") intended to stop reporting key fields for additional rss contexts if device has a global hashing key.
Later we added dump support and the filtering wasn't properly added there. So we end up reporting the key fields in dumps but not in dos:
# ./pyynl/cli.py --spec netlink/specs/ethtool.yaml --do rss-get \
--json '{"header": {"dev-index":2}, "context": 1 }'
{
"header": { ... },
"context": 1,
"indir": [0, 1, 2, 3, ...]]
} # ./pyynl/cli.py --spec netlink/specs/ethtool.yaml --dump rss-get
[
... snip context 0 ...
{ "header": { ... },
"context": 1,
"indir": [0, 1, 2, 3, ...],
-> "input_xfrm": 255,
-> "hfunc": 1,
-> "hkey": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
}
]Hide these fields correctly.
The drivers/net/hw/rss_ctx.py selftest catches this when run on a device with single key, already:
# Check| At /root/./ksft-net-drv/drivers/net/hw/rss_ctx.py, line 381, in test_rss_context_dump:
# Check| ksft_ne(set(data.get('hkey', [1])), {0}, "key is all zero")
# Check failed {0} == {0} key is all zero
not ok 8 rss_ctx.test_rss_context_dump
--- net/ethtool/rss.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ethtool/rss.c +2 -1
@@ -107,6 +107,8 @@ rss_prepare_ctx(const struct rss_req_info *request, struct net_device *dev,u32 total_size, indir_bytes;u8 *rss_config; + data->no_key_fields = !dev->ethtool_ops->rxfh_per_ctx_key; + ctx =xa_load (&dev->ethtool->rss_ctx, request->rss_context);if (!ctx)return -ENOENT ;
@@ -153,7 +155,6 @@ rss_prepare_data(const struct ethnl_req_info *req_base,if (!ops->cap_rss_ctx_supported && !ops->create_rxfh_context)return -EOPNOTSUPP ; - data->no_key_fields = !ops->rxfh_per_ctx_key;return rss_prepare_ctx (request, dev, data, info); }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 125/443 ethtool: ntuple: fix rss + ring_cookie check
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 2b91cc1214b165c25ac9b0885db89a0d3224028a ]
The info.flow_type is for RXFH commands, ntuple flow_type is inside the flow spec. The check currently does nothing, as info.flow_type is 0 (or even uninitialized by user space) for ETHTOOL_SRXCLSRLINS.
--- net/ethtool/ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ethtool/ioctl.c +1 -1
@@ -993,7 +993,7 @@ static noinline_for_stack int ethtool_set_rxnfc(struct net_device *dev,return rc;/* Nonzero ring with RSS only makes sense if NIC adds them together */ -if (cmd ==ETHTOOL_SRXCLSRLINS && info.flow_type &FLOW_RSS && +if (cmd ==ETHTOOL_SRXCLSRLINS && info.fs.flow_type &FLOW_RSS && !ops->cap_rss_rxnfc_adds &ðtool_get_flow_spec_ring (info.fs.ring_cookie))return -EINVAL ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 126/443 selftests: drv-net: rss_ctx: add missing cleanup in queue reconfigure
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit de379dfd9ada2995699052f4a1ecebe5d8f8d70f ]
Commit under Fixes adds ntuple rules but never deletes them.
--- tools/testing/selftests/drivers/net/hw/rss_ctx.py | 2 ++ 1 file changed, 2 insertions(+)
tools/testing/selftests/drivers/net/hw/rss_ctx.py +2 -0
@@ -252,6 +252,7 @@ def test_rss_queue_reconfigure(cfg, main_ctx=True): try: # this targets queue 4, which doesn't exist ntuple2 = ethtool_create(cfg, "-N", flow) + defer(ethtool, f"-N {cfg.ifname} delete {ntuple2}") except CmdExitFailure: pass else:
@@ -260,6 +261,7 @@ def test_rss_queue_reconfigure(cfg, main_ctx=True): ethtool(f"-X {cfg.ifname} {ctx_ref} weight 1 0 1 0") # ntuple rule therefore targets queues 1 and 3 ntuple2 = ethtool_create(cfg, "-N", flow) + defer(ethtool, f"-N {cfg.ifname} delete {ntuple2}") # should replace existing filter ksft_eq(ntuple, ntuple2) _send_traffic_check(cfg, port, ctx_ref, { 'target': (1, 3),
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 127/443 rxrpc: Fix the rxrpc_connection attend queue handling
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit 4241a702e0d0c2ca9364cfac08dbf134264962de ]
The rxrpc_connection attend queue is never used because conn::attend_link is never initialised and so is always NULL'd out and thus always appears to be busy. This requires the following fix:
(1) Fix this the attend queue problem by initialising conn::attend_link.
And, consequently, two further fixes for things masked by the above bug:
(2) Fix rxrpc_input_conn_event() to handle being invoked with a NULL sk_buff pointer - something that can now happen with the above change.
(3) Fix the RXRPC_SKB_MARK_SERVICE_CONN_SECURED message to carry a pointer to the connection and a ref on it.
--- include/trace/events/rxrpc.h | 1 + net/rxrpc/conn_event.c | 17 ++++++++++------- net/rxrpc/conn_object.c | 1 + 3 files changed, 12 insertions(+), 7 deletions(-)
include/trace/events/rxrpc.h +1 -0
@@ -218,6 +218,7 @@ EM(rxrpc_conn_get_conn_input, "GET inp-conn") \ EM(rxrpc_conn_get_idle, "GET idle ") \ EM(rxrpc_conn_get_poke_abort, "GET pk-abort") \ + EM(rxrpc_conn_get_poke_secured, "GET secured ") \ EM(rxrpc_conn_get_poke_timer, "GET poke ") \ EM(rxrpc_conn_get_service_conn, "GET svc-conn") \EM (rxrpc_conn_new_client,"NEW client " ) \
net/rxrpc/conn_event.c +10 -7
@@ -266,6 +266,7 @@ static int rxrpc_process_event(struct rxrpc_connection *conn,* we've already received the packet, put it on the * front of the queue. */ + sp->conn =rxrpc_get_connection (conn, rxrpc_conn_get_poke_secured); skb->mark =RXRPC_SKB_MARK_SERVICE_CONN_SECURED ;rxrpc_get_skb (skb, rxrpc_skb_get_conn_secured);skb_queue_head (&conn->local->rx_queue, skb);
@@ -431,14 +432,16 @@ void rxrpc_input_conn_event(struct rxrpc_connection *conn, struct sk_buff *skb)if (test_and_clear_bit (RXRPC_CONN_EV_ABORT_CALLS , &conn->events))rxrpc_abort_calls (conn); -switch (skb->mark) { -case RXRPC_SKB_MARK_SERVICE_CONN_SECURED : -if (conn->state !=RXRPC_CONN_SERVICE ) -break ; +if (skb) { +switch (skb->mark) { +case RXRPC_SKB_MARK_SERVICE_CONN_SECURED : +if (conn->state !=RXRPC_CONN_SERVICE ) +break ; -for (loop =0 ; loop <RXRPC_MAXCALLS ; loop++) -rxrpc_call_is_secure (conn->channels[loop].call); -break ; +for (loop =0 ; loop <RXRPC_MAXCALLS ; loop++) +rxrpc_call_is_secure (conn->channels[loop].call); +break ; + } }/* Process delayed ACKs whose time has come. */
net/rxrpc/conn_object.c +1 -0
@@ -67,6 +67,7 @@ struct rxrpc_connection *rxrpc_alloc_connection(struct rxrpc_net *rxnet,INIT_WORK (&conn->destructor, rxrpc_clean_up_connection);INIT_LIST_HEAD (&conn->proc_link);INIT_LIST_HEAD (&conn->link); +INIT_LIST_HEAD (&conn->attend_link);mutex_init (&conn->security_lock);mutex_init (&conn->tx_data_alloc_lock);skb_queue_head_init (&conn->rx_queue);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 128/443 gpio: pca953x: Improve interrupt support
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Tomlinson <[email protected]>
[ Upstream commit d6179f6c6204f9932aed3a7a2100b4a295dfed9d ]
The GPIO drivers with latch interrupt support (typically types starting with PCAL) have interrupt status registers to determine which particular inputs have caused an interrupt. Unfortunately there is no atomic operation to read these registers and clear the interrupt. Clearing the interrupt is done by reading the input registers.
The code was reading the interrupt status registers, and then reading the input registers. If an input changed between these two events it was lost.
The solution in this patch is to revert to the non-latch version of code, i.e. remembering the previous input status, and looking for the changes. This system results in no more I2C transfers, so is no slower. The latch property of the device still means interrupts will still be noticed if the input changes back to its initial state.
--- drivers/gpio/gpio-pca953x.c | 19 ------------------- 1 file changed, 19 deletions(-)
drivers/gpio/gpio-pca953x.c +0 -19
@@ -841,25 +841,6 @@ static bool pca953x_irq_pending(struct pca953x_chip *chip, unsigned long *pendinDECLARE_BITMAP (trigger,MAX_LINE );int ret; -if (chip->driver_data &PCA_PCAL ) { -/* Read the current interrupt status from the device */ - ret =pca953x_read_regs (chip,PCAL953X_INT_STAT , trigger); -if (ret) -return false; - -/* Check latched inputs and clear interrupt status */ - ret =pca953x_read_regs (chip, chip->regs->input, cur_stat); -if (ret) -return false; - -/* Apply filter for rising/falling edge selection */ -bitmap_replace (new_stat, chip->irq_trig_fall, chip->irq_trig_raise, cur_stat, gc->ngpio); - -bitmap_and (pending, new_stat, trigger, gc->ngpio); - -return !bitmap_empty (pending, gc->ngpio); - } - ret =pca953x_read_regs (chip, chip->regs->input, cur_stat);if (ret)return false;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 129/443 net: atlantic: fix warning during hot unplug
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacob Moroni <[email protected]>
[ Upstream commit 028676bb189ed6d1b550a0fc570a9d695b6acfd3 ]
Firmware deinitialization performs MMIO accesses which are not necessary if the device has already been removed. In some cases, these accesses happen via readx_poll_timeout_atomic which ends up timing out, resulting in a warning at hw_atl2_utils_fw.c:112:
[ 104.595913] Call Trace: [ 104.595915] <TASK> [ 104.595918] ? show_regs+0x6c/0x80 [ 104.595923] ? __warn+0x8d/0x150 [ 104.595925] ? aq_a2_fw_deinit+0xcf/0xe0 [atlantic] [ 104.595934] ? report_bug+0x182/0x1b0 [ 104.595938] ? handle_bug+0x6e/0xb0 [ 104.595940] ? exc_invalid_op+0x18/0x80 [ 104.595942] ? asm_exc_invalid_op+0x1b/0x20 [ 104.595944] ? aq_a2_fw_deinit+0xcf/0xe0 [atlantic] [ 104.595952] ? aq_a2_fw_deinit+0xcf/0xe0 [atlantic] [ 104.595959] aq_nic_deinit.part.0+0xbd/0xf0 [atlantic] [ 104.595964] aq_nic_deinit+0x17/0x30 [atlantic] [ 104.595970] aq_ndev_close+0x2b/0x40 [atlantic] [ 104.595975] __dev_close_many+0xad/0x160 [ 104.595978] dev_close_many+0x99/0x170 [ 104.595979] unregister_netdevice_many_notify+0x18b/0xb20 [ 104.595981] ? __call_rcu_common+0xcd/0x700 [ 104.595984] unregister_netdevice_queue+0xc6/0x110 [ 104.595986] unregister_netdev+0x1c/0x30 [ 104.595988] aq_pci_remove+0xb1/0xc0 [atlantic]
Fix this by skipping firmware deinitialization altogether if the PCI device is no longer present.
Tested with an AQC113 attached via Thunderbolt by performing repeated unplug cycles while traffic was running via iperf.
--- drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +3 -1
@@ -1441,7 +1441,9 @@ void aq_nic_deinit(struct aq_nic_s *self, bool link_down)aq_ptp_ring_free (self);aq_ptp_free (self); -if (likely (self->aq_fw_ops->deinit) && link_down) { +/* May be invoked during hot unplug. */ +if (pci_device_is_present (self->pdev) && +likely (self->aq_fw_ops->deinit) && link_down) {mutex_lock (&self->fwreq_mutex); self->aq_fw_ops->deinit (self->aq_hw);mutex_unlock (&self->fwreq_mutex);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 130/443 net: rose: lock the socket in rose_bind()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit a1300691aed9ee852b0a9192e29e2bdc2411a7e6 ]
syzbot reported a soft lockup in rose_loopback_timer(), with a repro calling bind() from multiple threads.
rose_bind() must lock the socket to avoid this issue.
--- net/rose/af_rose.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
net/rose/af_rose.c +16 -8
@@ -701,11 +701,9 @@ static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)struct net_device *dev;ax25_address *source;ax25_uid_assoc *user; +int err = -EINVAL ;int n; -if (!sock_flag (sk,SOCK_ZAPPED )) -return -EINVAL ; -if (addr_len !=sizeof (struct sockaddr_rose ) && addr_len !=sizeof (struct full_sockaddr_rose ))return -EINVAL ;
@@ -718,8 +716,15 @@ static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)if ((unsigned int ) addr->srose_ndigis >ROSE_MAX_DIGIS )return -EINVAL ; -if ((dev =rose_dev_get (&addr->srose_addr)) ==NULL ) -return -EADDRNOTAVAIL ; +lock_sock (sk); + +if (!sock_flag (sk,SOCK_ZAPPED )) + goto out_release; + + err = -EADDRNOTAVAIL ; + dev =rose_dev_get (&addr->srose_addr); +if (!dev) + goto out_release; source = &addr->srose_call;
@@ -730,7 +735,8 @@ static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) }else {if (ax25_uid_policy && !capable (CAP_NET_BIND_SERVICE )) {dev_put (dev); -return -EACCES ; + err = -EACCES ; + goto out_release; } rose->source_call = *source; }
@@ -753,8 +759,10 @@ static int rose_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)rose_insert_socket (sk);sock_reset_flag (sk,SOCK_ZAPPED ); - -return 0 ; + err =0 ; +out_release: +release_sock (sk); +return err; }static int rose_connect (struct socket *sock,struct sockaddr *uaddr,int addr_len,int flags)
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 131/443 gpio: sim: lock hog configfs items if present
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartosz Golaszewski <[email protected]>
[ Upstream commit 015b7dae084fa95465ff89f6cbf15fe49906a370 ]
Depending on the user config, the leaf entry may be the hog directory, not line. Check it and lock the correct item.
--- drivers/gpio/gpio-sim.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/gpio/gpio-sim.c +8 -5
@@ -1033,20 +1033,23 @@ gpio_sim_device_lockup_configfs(struct gpio_sim_device *dev, bool lock)struct configfs_subsystem *subsys = dev->group.cg_subsys;struct gpio_sim_bank *bank;struct gpio_sim_line *line; +struct config_item *item;/* -* The device only needs to depend on leaf line entries. This is +* The device only needs to depend on leaf entries. This is * sufficient to lock up all the configfs entries that the * instantiated, alive device depends on. */ list_for_each_entry (bank, &dev->bank_list, siblings) {list_for_each_entry (line, &bank->line_list, siblings) { + item = line->hog ? &line->hog->item + : &line->group.cg_item; +if (lock) -WARN_ON (configfs_depend_item_unlocked ( - subsys, &line->group.cg_item)); +WARN_ON (configfs_depend_item_unlocked (subsys, + item));else -configfs_undepend_item_unlocked ( - &line->group.cg_item); +configfs_undepend_item_unlocked (item); } } }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 132/443 gpio: GPIO_GRGPIO should depend on OF
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 5393f40a640b8c4f716bf87e7b0d4328bf1f22b2 ]
While the Aeroflex Gaisler GRGPIO driver has no build-time dependency on gpiolib-of, it supports only DT-based configuration, and is used only on DT systems. Hence add a dependency on OF, to prevent asking the user about this driver when configuring a kernel without DT support.
--- drivers/gpio/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/gpio/Kconfig +1 -0
@@ -338,6 +338,7 @@ config GPIO_GRANITERAPIDS config GPIO_GRGPIO tristate "Aeroflex Gaisler GRGPIO support" + depends on OF || COMPILE_TEST select GPIO_GENERIC select IRQ_DOMAIN help
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 133/443 x86/xen: fix xen_hypercall_hvm() to not clobber %rbx
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
[ Upstream commit 98a5cfd2320966f40fe049a9855f8787f0126825 ]
xen_hypercall_hvm(), which is used when running as a Xen PVH guest at most only once during early boot, is clobbering %rbx. Depending on whether the caller relies on %rbx to be preserved across the call or not, this clobbering might result in an early crash of the system.
This can be avoided by using an already saved register instead of %rbx.
--- arch/x86/xen/xen-head.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/xen/xen-head.S +2 -2
@@ -117,8 +117,8 @@ SYM_FUNC_START(xen_hypercall_hvm) pop %ebx pop %eax #else - lea xen_hypercall_amd(%rip), %rbx - cmp %rax, %rbx + lea xen_hypercall_amd(%rip), %rcx + cmp %rax, %rcx #ifdef CONFIG_FRAME_POINTER pop %rax /* Dummy pop. */ #endif
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 134/443 x86/xen: add FRAME_END to xen_hypercall_hvm()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
[ Upstream commit 0bd797b801bd8ee06c822844e20d73aaea0878dd ]
xen_hypercall_hvm() is missing a FRAME_END at the end, add it.
--- arch/x86/xen/xen-head.S | 1 + 1 file changed, 1 insertion(+)
arch/x86/xen/xen-head.S +1 -0
@@ -132,6 +132,7 @@ SYM_FUNC_START(xen_hypercall_hvm) pop %rcx pop %rax #endif + FRAME_END /* Use correct hypercall function. */ jz xen_hypercall_amd jmp xen_hypercall_intel
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 135/443 ACPI: property: Fix return value for nval == 0 in acpi_data_prop_read()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit ab930483eca9f3e816c35824b5868599af0c61d7 ]
While analysing code for software and OF node for the corner case when caller asks to read zero items in the supposed to be an array of values I found that ACPI behaves differently to what OF does, i.e.
1. It returns -EINVAL when caller asks to read zero items from integer array, while OF returns 0, if no other errors happened.
2. It returns -EINVAL when caller asks to read zero items from string array, while OF returns -ENODATA, if no other errors happened.
Amend ACPI implementation to follow what OF does.
--- drivers/acpi/property.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/acpi/property.c +5 -5
@@ -1187,8 +1187,6 @@ static int acpi_data_prop_read(const struct acpi_device_data *data, }break ; } -if (nval ==0 ) -return -EINVAL ;if (obj->type ==ACPI_TYPE_BUFFER ) {if (proptype !=DEV_PROP_U8 )
@@ -1212,9 +1210,11 @@ static int acpi_data_prop_read(const struct acpi_device_data *data, ret =acpi_copy_property_array_uint (items, (u64 *)val, nval);break ;case DEV_PROP_STRING : - ret =acpi_copy_property_array_string ( - items, (char **)val, -min_t (u32, nval, obj->package.count)); + nval =min_t (u32, nval, obj->package.count); +if (nval ==0 ) +return -ENODATA ; + + ret =acpi_copy_property_array_string (items, (char **)val, nval);break ;default : ret = -EINVAL ;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 136/443 pfifo_tail_enqueue: Drop new packet when sch->limit == 0
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quang Le <[email protected]>
[ Upstream commit 647cef20e649c576dff271e018d5d15d998b629d ]
Expected behaviour:
In case we reach scheduler's limit, pfifo_tail_enqueue() will drop a packet in scheduler's queue and decrease scheduler's qlen by one. Then, pfifo_tail_enqueue() enqueue new packet and increase scheduler's qlen by one. Finally, pfifo_tail_enqueue() return NET_XMIT_CN status code.
Weird behaviour:
In case we set sch->limit == 0 and trigger pfifo_tail_enqueue() on a scheduler that has no packet, the 'drop a packet' step will do nothing. This means the scheduler's qlen still has value equal 0. Then, we continue to enqueue new packet and increase scheduler's qlen by one. In summary, we can leverage pfifo_tail_enqueue() to increase qlen by one and return NET_XMIT_CN status code.
The problem is:
Let's say we have two qdiscs: Qdisc_A and Qdisc_B.
- Qdisc_A's type must have '->graft()' function to create parent/child relationship. Let's say Qdisc_A's type is hfsc. Enqueue packet to this qdisc will trigger hfsc_enqueue.
- Qdisc_B's type is pfifo_head_drop. Enqueue packet to this qdisc will trigger pfifo_tail_enqueue.
- Qdisc_B is configured to have sch->limit == 0.
- Qdisc_A is configured to route the enqueued's packet to Qdisc_B.
Enqueue packet through Qdisc_A will lead to:
- hfsc_enqueue(Qdisc_A) -> pfifo_tail_enqueue(Qdisc_B)
- Qdisc_B->q.qlen += 1
- pfifo_tail_enqueue() return NET_XMIT_CN
- hfsc_enqueue() check for NET_XMIT_SUCCESS and see NET_XMIT_CN => hfsc_enqueue() don't increase qlen of Qdisc_A.
The whole process lead to a situation where Qdisc_A->q.qlen == 0 and Qdisc_B->q.qlen == 1. Replace 'hfsc' with other type (for example: 'drr') still lead to the same problem. This violate the design where parent's qlen should equal to the sum of its childrens'qlen.
Bug impact: This issue can be used for user->kernel privilege escalation when it is reachable.
--- net/sched/sch_fifo.c | 3 +++ 1 file changed, 3 insertions(+)
net/sched/sch_fifo.c +3 -0
@@ -40,6 +40,9 @@ static int pfifo_tail_enqueue(struct sk_buff *skb, struct Qdisc *sch, {unsigned int prev_backlog; +if (unlikely (READ_ONCE (sch->limit) ==0 )) +return qdisc_drop (skb, sch, to_free); +if (likely (sch->q.qlen <READ_ONCE (sch->limit)))return qdisc_enqueue_tail (skb, sch);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 137/443 netem: Update sch->q.qlen before qdisc_tree_reduce_backlog()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cong Wang <[email protected]>
[ Upstream commit 638ba5089324796c2ee49af10427459c2de35f71 ]
qdisc_tree_reduce_backlog() notifies parent qdisc only if child qdisc becomes empty, therefore we need to reduce the backlog of the child qdisc before calling it. Otherwise it would miss the opportunity to call cops->qlen_notify(), in the case of DRR, it resulted in UAF since DRR uses ->qlen_notify() to maintain its active list.
--- net/sched/sch_netem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/sch_netem.c +1 -1
@@ -749,9 +749,9 @@ static struct sk_buff *netem_dequeue(struct Qdisc *sch)if (err !=NET_XMIT_SUCCESS ) {if (net_xmit_drop_count (err))qdisc_qstats_drop (sch); -qdisc_tree_reduce_backlog (sch,1 , pkt_len); sch->qstats.backlog -= pkt_len; sch->q.qlen--; +qdisc_tree_reduce_backlog (sch,1 , pkt_len); } goto tfifo_dequeue; }
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 138/443 tun: revert fix group permission check
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Willem de Bruijn <[email protected]>
[ Upstream commit a70c7b3cbc0688016810bb2e0b9b8a0d6a530045 ]
This reverts commit 3ca459eaba1bf96a8c7878de84fa8872259a01e3.
The blamed commit caused a regression when neither tun->owner nor tun->group is set. This is intended to be allowed, but now requires CAP_NET_ADMIN.
Discussion in the referenced thread pointed out that the original issue that prompted this patch can be resolved in userspace.
The relaxed access control may also make a device accessible when it previously wasn't, while existing users may depend on it to not be.
This is a clean pure git revert, except for fixing the indentation on the gid_valid line that checkpatch correctly flagged.
--- drivers/net/tun.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/net/tun.c +5 -9
@@ -574,18 +574,14 @@ static u16 tun_select_queue(struct net_device *dev, struct sk_buff *skb,return ret; } -static inline bool tun_capable (struct tun_struct *tun) +static inline bool tun_not_capable (struct tun_struct *tun) {const struct cred *cred =current_cred ();struct net *net =dev_net (tun->dev); -if (ns_capable (net->user_ns,CAP_NET_ADMIN )) -return 1 ; -if (uid_valid (tun->owner) &&uid_eq (cred->euid, tun->owner)) -return 1 ; -if (gid_valid (tun->group) &&in_egroup_p (tun->group)) -return 1 ; -return 0 ; +return ((uid_valid (tun->owner) && !uid_eq (cred->euid, tun->owner)) || + (gid_valid (tun->group) && !in_egroup_p (tun->group))) && + !ns_capable (net->user_ns,CAP_NET_ADMIN ); }static void tun_set_real_num_queues (struct tun_struct *tun)
@@ -2782,7 +2778,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr) !!(tun->flags & IFF_MULTI_QUEUE))return -EINVAL ; -if (!tun_capable (tun)) +if (tun_not_capable (tun))return -EPERM ; err =security_tun_dev_open (tun->security);if (err <0 )
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 139/443 net: sched: Fix truncation of offloaded action statistics
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
[ Upstream commit 811b8f534fd85e17077bd2ac0413bcd16cc8fb9b ]
In case of tc offload, when user space queries the kernel for tc action statistics, tc will query the offloaded statistics from device drivers. Among other statistics, drivers are expected to pass the number of packets that hit the action since the last query as a 64-bit number.
Unfortunately, tc treats the number of packets as a 32-bit number, leading to truncation and incorrect statistics when the number of packets since the last query exceeds 0xffffffff:
$ tc -s filter show dev swp2 ingress
filter protocol all pref 1 flower chain 0
filter protocol all pref 1 flower chain 0 handle 0x1
skip_sw
in_hw in_hw_count 1
action order 1: mirred (Egress Redirect to device swp1) stolen
index 1 ref 1 bind 1 installed 58 sec used 0 sec
Action statistics:
Sent 1133877034176 bytes 536959475 pkt (dropped 0, overlimits 0 requeues 0)
[...]According to the above, 2111-byte packets were redirected which is impossible as only 64-byte packets were transmitted and the MTU was 1500.
Fix by treating packets as a 64-bit number:
$ tc -s filter show dev swp2 ingress
filter protocol all pref 1 flower chain 0
filter protocol all pref 1 flower chain 0 handle 0x1
skip_sw
in_hw in_hw_count 1
action order 1: mirred (Egress Redirect to device swp1) stolen
index 1 ref 1 bind 1 installed 61 sec used 0 sec
Action statistics:
Sent 1370624380864 bytes 21416005951 pkt (dropped 0, overlimits 0 requeues 0)
[...]Which shows that only 64-byte packets were redirected (1370624380864 / 21416005951 = 64).
--- include/net/sch_generic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/net/sch_generic.h +1 -1
@@ -851,7 +851,7 @@ static inline int qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch, }static inline void _bstats_update (struct gnet_stats_basic_sync *bstats, -__u64 bytes,__u32 packets) +__u64 bytes,__u64 packets) {u64_stats_update_begin (&bstats->syncp);u64_stats_add (&bstats->bytes, bytes);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 140/443 rxrpc: Fix call state set to not include the SERVER_SECURING state
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit 41b996ce83bf944de5569d6263c8dbd5513e7ed0 ]
The RXRPC_CALL_SERVER_SECURING state doesn't really belong with the other states in the call's state set as the other states govern the call's Rx/Tx phase transition and govern when packets can and can't be received or transmitted. The "Securing" state doesn't actually govern the reception of packets and would need to be split depending on whether or not we've received the last packet yet (to mirror RECV_REQUEST/ACK_REQUEST).
The "Securing" state is more about whether or not we can start forwarding packets to the application as recvmsg will need to decode them and the decoding can't take place until the challenge/response exchange has completed.
Fix this by removing the RXRPC_CALL_SERVER_SECURING state from the state set and, instead, using a flag, RXRPC_CALL_CONN_CHALLENGING, to track whether or not we can queue the call for reception by recvmsg() or notify the kernel app that data is ready. In the event that we've already received all the packets, the connection event handler will poke the app layer in the appropriate manner.
Also there's a race whereby the app layer sees the last packet before rxrpc has managed to end the rx phase and change the state to one amenable to allowing a reply. Fix this by queuing the packet after calling rxrpc_end_rx_phase().
--- net/rxrpc/ar-internal.h | 2 +- net/rxrpc/call_object.c | 6 ++---- net/rxrpc/conn_event.c | 4 +--- net/rxrpc/input.c | 2 +- net/rxrpc/sendmsg.c | 2 +- 5 files changed, 6 insertions(+), 10 deletions(-)
net/rxrpc/ar-internal.h +1 -1
@@ -567,6 +567,7 @@ enum rxrpc_call_flag {RXRPC_CALL_EXCLUSIVE ,/* The call uses a once-only connection */ RXRPC_CALL_RX_IS_IDLE ,/* recvmsg() is idle - send an ACK */ RXRPC_CALL_RECVMSG_READ_ALL ,/* recvmsg() read all of the received data */ + RXRPC_CALL_CONN_CHALLENGING, /* The connection is being challenged */ };/*
@@ -587,7 +588,6 @@ enum rxrpc_call_state {RXRPC_CALL_CLIENT_AWAIT_REPLY ,/* - client awaiting reply */ RXRPC_CALL_CLIENT_RECV_REPLY ,/* - client receiving reply phase */ RXRPC_CALL_SERVER_PREALLOC ,/* - service preallocation */ -RXRPC_CALL_SERVER_SECURING ,/* - server securing request connection */ RXRPC_CALL_SERVER_RECV_REQUEST ,/* - server receiving request */ RXRPC_CALL_SERVER_ACK_REQUEST ,/* - server pending ACK of request */ RXRPC_CALL_SERVER_SEND_REPLY, /* - server sending reply */
net/rxrpc/call_object.c +2 -4
@@ -22,7 +22,6 @@ const char *const rxrpc_call_states[NR__RXRPC_CALL_STATES] = { [RXRPC_CALL_CLIENT_AWAIT_REPLY] = "ClAwtRpl", [RXRPC_CALL_CLIENT_RECV_REPLY] = "ClRcvRpl", [RXRPC_CALL_SERVER_PREALLOC] = "SvPrealc", - [RXRPC_CALL_SERVER_SECURING] = "SvSecure", [RXRPC_CALL_SERVER_RECV_REQUEST] = "SvRcvReq", [RXRPC_CALL_SERVER_ACK_REQUEST] = "SvAckReq", [RXRPC_CALL_SERVER_SEND_REPLY] = "SvSndRpl",
@@ -453,17 +452,16 @@ void rxrpc_incoming_call(struct rxrpc_sock *rx, call->cong_tstamp = skb->tstamp;__set_bit (RXRPC_CALL_EXPOSED , &call->flags); -rxrpc_set_call_state (call,RXRPC_CALL_SERVER_SECURING ); +rxrpc_set_call_state (call,RXRPC_CALL_SERVER_RECV_REQUEST );spin_lock (&conn->state_lock);switch (conn->state) {case RXRPC_CONN_SERVICE_UNSECURED :case RXRPC_CONN_SERVICE_CHALLENGING : -rxrpc_set_call_state (call,RXRPC_CALL_SERVER_SECURING ); +__set_bit (RXRPC_CALL_CONN_CHALLENGING , &call->flags);break ;case RXRPC_CONN_SERVICE : -rxrpc_set_call_state (call,RXRPC_CALL_SERVER_RECV_REQUEST );break ;case RXRPC_CONN_ABORTED :
net/rxrpc/conn_event.c +1 -3
@@ -222,10 +222,8 @@ static void rxrpc_abort_calls(struct rxrpc_connection *conn)*/ static void rxrpc_call_is_secure (struct rxrpc_call *call) { -if (call &&__rxrpc_call_state (call) ==RXRPC_CALL_SERVER_SECURING ) { -rxrpc_set_call_state (call,RXRPC_CALL_SERVER_RECV_REQUEST ); +if (call &&__test_and_clear_bit (RXRPC_CALL_CONN_CHALLENGING , &call->flags))rxrpc_notify_socket (call); - } }/*
net/rxrpc/input.c +1 -1
@@ -573,7 +573,7 @@ static bool rxrpc_input_split_jumbo(struct rxrpc_call *call, struct sk_buff *skbrxrpc_propose_delay_ACK (call, sp->hdr.serial, rxrpc_propose_ack_input_data); } -if (notify) { +if (notify && !test_bit (RXRPC_CALL_CONN_CHALLENGING , &call->flags)) {trace_rxrpc_notify_socket (call->debug_id, sp->hdr.serial);rxrpc_notify_socket (call); }
net/rxrpc/sendmsg.c +1 -1
@@ -655,7 +655,7 @@ int rxrpc_do_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg, size_t len) }else {switch (rxrpc_call_state (call)) {case RXRPC_CALL_CLIENT_AWAIT_CONN : -case RXRPC_CALL_SERVER_SECURING : +case RXRPC_CALL_SERVER_RECV_REQUEST :if (p.command ==RXRPC_CMD_SEND_ABORT )break ; fallthrough;
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 141/443 PCI/TPH: Restore TPH Requester Enable correctly
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robin Murphy <[email protected]>
[ Upstream commit 6f64b83d9fe9729000a0616830cb1606945465d8 ]
When we reenable TPH after changing a Steering Tag value, we need the actual TPH Requester Enable value, not the ST Mode (which only happens to work out by chance for non-extended TPH in interrupt vector mode).
--- drivers/pci/tph.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/tph.c +1 -1
@@ -360,7 +360,7 @@ int pcie_tph_set_st_entry(struct pci_dev *pdev, unsigned int index, u16 tag)return err; } -set_ctrl_reg_req_en (pdev, pdev->tph_mode); +set_ctrl_reg_req_en (pdev, pdev->tph_req_type);pci_dbg (pdev,"set steering tag: %s table, index=%d, tag=%#04x\n" , (loc ==PCI_TPH_LOC_MSIX ) ?"MSI-X" :"ST" , index, tag);
Signature · 1 line
2.39.5
Greg Kroah-Hartman
maintainerPATCH 142/443 cpufreq: fix using cpufreq-dt as module
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Kemnade <[email protected]>
commit f1f010c9d9c62c865d9f54e94075800ba764b4d9 upstream.
This driver can be built as a module since commit 3b062a086984 ("cpufreq:
dt-platdev: Support building as module"), but unfortunately this caused a regression because the cputfreq-dt-platdev.ko module does not autoload.
Usually, this is solved by just using the MODULE_DEVICE_TABLE() macro to export all the device IDs as module aliases. But this driver is special due how matches with devices and decides what platform supports.
There are two of_device_id lists, an allow list that are for CPU devices that always match and a deny list that's for devices that must not match.
The driver registers a cpufreq-dt platform device for all the CPU device nodes that either are in the allow list or contain an operating-points-v2 property and are not in the deny list.
Enforce builtin compile of cpufreq-dt-platdev to make autoload work.
--- drivers/cpufreq/Kconfig | 2 +- drivers/cpufreq/cpufreq-dt-platdev.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/cpufreq/Kconfig +1 -1
@@ -232,7 +232,7 @@ config CPUFREQ_VIRT If in doubt, say N. config CPUFREQ_DT_PLATDEV - tristate "Generic DT based cpufreq platdev driver" + bool "Generic DT based cpufreq platdev driver" depends on OF help This adds a generic DT based cpufreq platdev driver for frequency
drivers/cpufreq/cpufreq-dt-platdev.c +0 -2
@@ -235,5 +235,3 @@ create_pdev: sizeof(struct cpufreq_dt_platform_data))); }core_initcall (cpufreq_dt_platdev_init); -MODULE_DESCRIPTION ("Generic DT based cpufreq platdev driver" ); -MODULE_LICENSE ("GPL" );
Greg Kroah-Hartman
maintainerPATCH 143/443 cpufreq: s3c64xx: Fix compilation warning
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Viresh Kumar <[email protected]>
commit 43855ac61483cb914f060851535ea753c094b3e0 upstream.
The driver generates following warning when regulator support isn't enabled in the kernel. Fix it.
drivers/cpufreq/s3c64xx-cpufreq.c: In function 's3c64xx_cpufreq_set_target':
Quoted 1 line
Quoted 1 line
drivers/cpufreq/s3c64xx-cpufreq.c:55:22: warning: variable 'old_freq' set but not used [-Wunused-but-set-variable]
55 | unsigned int old_freq, new_freq;
| ^~~~~~~~Quoted 1 line
Quoted 1 line
drivers/cpufreq/s3c64xx-cpufreq.c:54:30: warning: variable 'dvfs' set but not used [-Wunused-but-set-variable]
54 | struct s3c64xx_dvfs *dvfs;
| ^~~~--- drivers/cpufreq/s3c64xx-cpufreq.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/cpufreq/s3c64xx-cpufreq.c +7 -4
@@ -24,6 +24,7 @@ struct s3c64xx_dvfs {unsigned int vddarm_max; }; +#ifdef CONFIG_REGULATOR static struct s3c64xx_dvfs s3c64xx_dvfs_table[] = { [0 ] = {1000000 ,1150000 }, [1] = { 1050000, 1150000 },
@@ -31,6 +32,7 @@ static struct s3c64xx_dvfs s3c64xx_dvfs_ [3] = { 1200000, 1350000 }, [4] = { 1300000, 1350000 }, }; +#endif static struct cpufreq_frequency_table s3c64xx_freq_table[] = { {0 ,0 ,66000 },
@@ -51,15 +53,16 @@ static struct cpufreq_frequency_table s3 static int s3c64xx_cpufreq_set_target(struct cpufreq_policy *policy, unsigned int index) { - struct s3c64xx_dvfs *dvfs; - unsigned int old_freq, new_freq; + unsigned int new_freq = s3c64xx_freq_table[index].frequency; int ret; +#ifdef CONFIG_REGULATOR + struct s3c64xx_dvfs *dvfs; + unsigned int old_freq; + old_freq = clk_get_rate(policy->clk) / 1000; - new_freq = s3c64xx_freq_table[index].frequency; dvfs = &s3c64xx_dvfs_table[s3c64xx_freq_table[index].driver_data]; -#ifdef CONFIG_REGULATOR if (vddarm && new_freq > old_freq) { ret = regulator_set_voltage(vddarm, dvfs->vddarm_min,
Greg Kroah-Hartman
maintainerPATCH 144/443 leds: lp8860: Write full EEPROM, not only half of it
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Sverdlin <[email protected]>
commit 0d2e820a86793595e2a776855d04701109e46663 upstream.
I struggle to explain dividing an ARRAY_SIZE() by the size of an element once again. As the latter equals to 2, only the half of EEPROM was ever written. Drop the unexplainable division and write full ARRAY_SIZE().
--- drivers/leds/leds-lp8860.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/leds/leds-lp8860.c +1 -1
@@ -265,7 +265,7 @@ static int lp8860_init(struct lp8860_led goto out; } - reg_count =ARRAY_SIZE (lp8860_eeprom_disp_regs) /sizeof (lp8860_eeprom_disp_regs[0 ]); + reg_count =ARRAY_SIZE (lp8860_eeprom_disp_regs);for (i =0 ; i < reg_count; i++) { ret = regmap_write(led->eeprom_regmap, lp8860_eeprom_disp_regs[i].reg,
Greg Kroah-Hartman
maintainerPATCH 145/443 ALSA: hda/realtek: Enable Mute LED on HP Laptop 14s-fq1xxx
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Wiese-Wagner <[email protected]>
commit 711aad3c43a9853657e00225466d204e46ae528b upstream.
This HP Laptop uses ALC236 codec with COEF 0x07 controlling the mute LED. Enable existing quirk for this device.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -10389,6 +10389,7 @@ static const struct hda_quirk alc269_fixSND_PCI_QUIRK (0x103c ,0x8870 ,"HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC" ,ALC285_FIXUP_HP_GPIO_AMP_INIT ),SND_PCI_QUIRK (0x103c ,0x8873 ,"HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC" ,ALC285_FIXUP_HP_GPIO_AMP_INIT ),SND_PCI_QUIRK (0x103c ,0x887a ,"HP Laptop 15s-eq2xxx" ,ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 ), +SND_PCI_QUIRK (0x103c ,0x887c ,"HP Laptop 14s-fq1xxx" ,ALC236_FIXUP_HP_MUTE_LED_COEFBIT2 ),SND_PCI_QUIRK (0x103c ,0x888a ,"HP ENVY x360 Convertible 15-eu0xxx" ,ALC245_FIXUP_HP_X360_MUTE_LEDS ),SND_PCI_QUIRK (0x103c ,0x888d ,"HP ZBook Power 15.6 inch G8 Mobile Workstation PC" ,ALC236_FIXUP_HP_GPIO_LED ), SND_PCI_QUIRK(0x103c, 0x8895, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED),
Greg Kroah-Hartman
maintainerPATCH 146/443 cifs: Remove intermediate object of failed create SFU call
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pali Rohár <[email protected]>
commit 25f6184e24b3991eae977a29ecf27d537cc930b2 upstream.
Check if the server honored ATTR_SYSTEM flag by CREATE_OPTION_SPECIAL option. If not then server does not support ATTR_SYSTEM and newly created file is not SFU compatible, which means that the call failed.
If CREATE was successful but either setting ATTR_SYSTEM failed or writing type/data information failed then remove the intermediate object created by CREATE. Otherwise intermediate empty object stay on the server.
This ensures that if the creating of SFU files with system attribute is unsupported by the server then no empty file stay on the server as a result of unsupported operation.
This is for example case with Samba server and Linux tmpfs storage without enabled xattr support (where Samba stores ATTR_SYSTEM bit).
--- fs/smb/client/smb2ops.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)
fs/smb/client/smb2ops.c +22 -1
@@ -5077,6 +5077,7 @@ int __cifs_sfu_make_node(unsigned int xi {struct TCP_Server_Info *server = tcon->ses->server;struct cifs_open_parms oparms; +struct cifs_open_info_data idata;struct cifs_io_parms io_parms = {};struct cifs_sb_info *cifs_sb =CIFS_SB (inode->i_sb);struct cifs_fid fid;
@@ -5146,10 +5147,20 @@ int __cifs_sfu_make_node(unsigned int xi CREATE_OPTION_SPECIAL, ACL_NO_MODE); oparms.fid = &fid; - rc = server->ops->open (xid, &oparms, &oplock,NULL ); + rc = server->ops->open (xid, &oparms, &oplock, &idata);if (rc) goto out; +/* +* Check if the server honored ATTR_SYSTEM flag by CREATE_OPTION_SPECIAL +* option. If not then server does not support ATTR_SYSTEM and newly +* created file is not SFU compatible, which means that the call failed. +*/ +if (!(le32_to_cpu (idata.fi.Attributes) &ATTR_SYSTEM )) { + rc = -EOPNOTSUPP ; + goto out_close; + } +if (type_len + data_len >0 ) { io_parms.pid = current->tgid; io_parms.tcon = tcon;
@@ -5164,8 +5175,18 @@ int __cifs_sfu_make_node(unsigned int xi iov, ARRAY_SIZE(iov)-1); } +out_close: server->ops->close (xid, tcon, &fid); +/* +* If CREATE was successful but either setting ATTR_SYSTEM failed or +* writing type/data information failed then remove the intermediate +* object created by CREATE. Otherwise intermediate empty object stay +* on the server. +*/ +if (rc) + server->ops->unlink (xid, tcon, full_path, cifs_sb,NULL ); + out:kfree (symname_utf16);return rc;
Greg Kroah-Hartman
maintainerPATCH 147/443 drm/modeset: Handle tiled displays in pan_display_atomic.
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maarten Lankhorst <[email protected]>
commit f4a9dd57e549a17a7dac1c1defec26abd7e5c2d4 upstream.
Tiled displays have a different x/y offset to begin with. Instead of attempting to remember this, just apply a delta instead.
This fixes the first tile being duplicated on other tiles when vt switching.
--- drivers/gpu/drm/drm_fb_helper.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/gpu/drm/drm_fb_helper.c +8 -6
@@ -1354,14 +1354,14 @@ int drm_fb_helper_set_par(struct fb_info }EXPORT_SYMBOL (drm_fb_helper_set_par); -static void pan_set (struct drm_fb_helper *fb_helper,int x,int y) +static void pan_set (struct drm_fb_helper *fb_helper,int dx,int dy) {struct drm_mode_set *mode_set;mutex_lock (&fb_helper->client.modeset_mutex);drm_client_for_each_modeset (mode_set, &fb_helper->client) { - mode_set->x = x; - mode_set->y = y; + mode_set->x += dx; + mode_set->y += dy; }mutex_unlock (&fb_helper->client.modeset_mutex); }
@@ -1370,16 +1370,18 @@ static int pan_display_atomic(struct fb_ struct fb_info *info) {struct drm_fb_helper *fb_helper = info->par; -int ret; +int ret, dx, dy; -pan_set (fb_helper, var->xoffset, var->yoffset); + dx = var->xoffset - info->var.xoffset; + dy = var->yoffset - info->var.yoffset; +pan_set (fb_helper, dx, dy); ret =drm_client_modeset_commit_locked (&fb_helper->client);if (!ret) { info->var.xoffset = var->xoffset; info->var.yoffset = var->yoffset; }else -pan_set (fb_helper, info->var.xoffset, info->var.yoffset); +pan_set (fb_helper, -dx, -dy);return ret; }
Greg Kroah-Hartman
maintainerPATCH 148/443 drm/client: Handle tiled displays better
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maarten Lankhorst <[email protected]>
commit 10026f536843eb8c9148ef6ffb4c6deeebc26838 upstream.
When testing on my tiled display, initially the tiled display is detected correctly:
[90376.523692] xe 0000:67:00.0: [drm:drm_client_firmware_config.isra.0 [drm]] fallback: Not all outputs enabled [90376.523713] xe 0000:67:00.0: [drm:drm_client_firmware_config.isra.0 [drm]] Enabled: 0, detected: 2 ... [90376.523967] xe 0000:67:00.0: [drm:drm_client_modeset_probe [drm]] [CRTC:82:pipe A] desired mode 1920x2160 set (1920,0) [90376.524020] xe 0000:67:00.0: [drm:drm_client_modeset_probe [drm]] [CRTC:134:pipe B] desired mode 1920x2160 set (0,0)
But then, when modes have been set:
[90379.729525] xe 0000:67:00.0: [drm:drm_client_firmware_config.isra.0 [drm]] [CONNECTOR:287:DP-4] on [CRTC:82:pipe A]: 1920x2160 [90379.729640] xe 0000:67:00.0: [drm:drm_client_firmware_config.isra.0 [drm]] [CONNECTOR:289:DP-5] on [CRTC:134:pipe B]: 1920x2160 ... [90379.730036] xe 0000:67:00.0: [drm:drm_client_modeset_probe [drm]] [CRTC:82:pipe A] desired mode 1920x2160 set (0,0) [90379.730124] xe 0000:67:00.0: [drm:drm_client_modeset_probe [drm]] [CRTC:134:pipe B] desired mode 1920x2160 set (0,0)
Call drm_client_get_tile_offsets() in drm_client_firmware_config() as well, to ensure that the offset is set correctly.
This has to be done as a separate pass, as the tile order may not be equal to the drm connector order.
--- drivers/gpu/drm/drm_client_modeset.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/gpu/drm/drm_client_modeset.c +9 -0
@@ -743,6 +743,15 @@ retry:if ((conn_configured & mask) != mask && conn_configured != conn_seq) goto retry; +for (i =0 ; i < count; i++) { +struct drm_connector *connector = connectors[i]; + +if (connector->has_tile) +drm_client_get_tile_offsets (dev, connectors, connector_count, + modes, offsets, i, + connector->tile_h_loc, connector->tile_v_loc); + } +/* * If the BIOS didn't enable everything it could, fall back to have the * same user experiencing of lighting up as much as possible like the
Greg Kroah-Hartman
maintainerPATCH 149/443 smb: client: fix order of arguments of tracepoints
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ruben Devos <[email protected]>
commit 11f8b80ab9f99291dc88d09855b9f8f43b772335 upstream.
The tracepoints based on smb3_inf_compound_*_class have tcon id and session id swapped around. This results in incorrect output in trace-cmd report.
Fix the order of arguments to resolve this issue. The trace-cmd output below shows the before and after of the smb3_delete_enter and smb3_delete_done events as an example. The smb3_cmd_* events show the correct session and tcon id for reference.
Also fix tracepoint set -> get in the SMB2_OP_GET_REPARSE case.
BEFORE:
rm-2211 [001] ..... 1839.550888: smb3_delete_enter: xid=281 sid=0x5 tid=0x3d path=\hello2.txt rm-2211 [001] ..... 1839.550894: smb3_cmd_enter: sid=0x1ac000000003d tid=0x5 cmd=5 mid=61 rm-2211 [001] ..... 1839.550896: smb3_cmd_enter: sid=0x1ac000000003d tid=0x5 cmd=6 mid=62 rm-2211 [001] ..... 1839.552091: smb3_cmd_done: sid=0x1ac000000003d tid=0x5 cmd=5 mid=61 rm-2211 [001] ..... 1839.552093: smb3_cmd_done: sid=0x1ac000000003d tid=0x5 cmd=6 mid=62 rm-2211 [001] ..... 1839.552103: smb3_delete_done: xid=281 sid=0x5 tid=0x3d
AFTER:
rm-2501 [001] ..... 3237.656110: smb3_delete_enter: xid=88 sid=0x1ac0000000041 tid=0x5 path=\hello2.txt rm-2501 [001] ..... 3237.656122: smb3_cmd_enter: sid=0x1ac0000000041 tid=0x5 cmd=5 mid=84 rm-2501 [001] ..... 3237.656123: smb3_cmd_enter: sid=0x1ac0000000041 tid=0x5 cmd=6 mid=85 rm-2501 [001] ..... 3237.657909: smb3_cmd_done: sid=0x1ac0000000041 tid=0x5 cmd=5 mid=84 rm-2501 [001] ..... 3237.657909: smb3_cmd_done: sid=0x1ac0000000041 tid=0x5 cmd=6 mid=85 rm-2501 [001] ..... 3237.657922: smb3_delete_done: xid=88 sid=0x1ac0000000041 tid=0x5
--- fs/smb/client/dir.c | 6 +- fs/smb/client/smb2inode.c | 108 +++++++++++++++++++++++----------------------- 2 files changed, 57 insertions(+), 57 deletions(-)
fs/smb/client/dir.c +3 -3
@@ -627,7 +627,7 @@ int cifs_mknod(struct mnt_idmap *idmap, goto mknod_out; } -trace_smb3_mknod_enter (xid, tcon->ses->Suid, tcon->tid, full_path); +trace_smb3_mknod_enter (xid, tcon->tid, tcon->ses->Suid, full_path); rc = tcon->ses->server->ops->make_node(xid, inode, direntry, tcon, full_path, mode,
@@ -635,9 +635,9 @@ int cifs_mknod(struct mnt_idmap *idmap, mknod_out:if (rc) -trace_smb3_mknod_err (xid, tcon->ses->Suid, tcon->tid, rc); +trace_smb3_mknod_err (xid, tcon->tid, tcon->ses->Suid, rc);else -trace_smb3_mknod_done (xid, tcon->ses->Suid, tcon->tid); +trace_smb3_mknod_done (xid, tcon->tid, tcon->ses->Suid);free_dentry_path (page);free_xid (xid);
fs/smb/client/smb2inode.c +54 -54
246 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 150/443 smb: client: change lease epoch type from unsigned int to __u16
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Meetakshi Setiya <[email protected]>
commit 57e4a9bd61c308f607bc3e55e8fa02257b06b552 upstream.
MS-SMB2 section 2.2.13.2.10 specifies that 'epoch' should be a 16-bit unsigned integer used to track lease state changes. Change the data type of all instances of 'epoch' from unsigned int to __u16. This simplifies the epoch change comparisons and makes the code more compliant with the protocol spec.
--- fs/smb/client/cifsglob.h | 14 +++++++------- fs/smb/client/smb1ops.c | 2 +- fs/smb/client/smb2ops.c | 18 +++++++++--------- fs/smb/client/smb2pdu.c | 2 +- fs/smb/client/smb2proto.h | 2 +- 5 files changed, 19 insertions(+), 19 deletions(-)
fs/smb/client/cifsglob.h +7 -7
@@ -326,7 +326,7 @@ struct smb_version_operations {int (*handle_cancelled_mid)(struct mid_q_entry *,struct TCP_Server_Info *);void (*downgrade_oplock)(struct TCP_Server_Info *server,struct cifsInodeInfo *cinode,__u32 oplock, -unsigned int epoch,bool *purge_cache); +__u16 epoch,bool *purge_cache);/* process transaction2 response */ bool (*check_trans2)(struct mid_q_entry *,struct TCP_Server_Info *,char *,int );
@@ -521,12 +521,12 @@ struct smb_version_operations {/* if we can do cache read operations */ bool (*is_read_op)(__u32 );/* set oplock level for the inode */ -void (*set_oplock_level)(struct cifsInodeInfo *,__u32 ,unsigned int , -bool *); +void (*set_oplock_level)(struct cifsInodeInfo *cinode,__u32 oplock,__u16 epoch, +bool *purge_cache);/* create lease context buffer for CREATE request */ char * (*create_lease_buf)(u8 *lease_key,u8 oplock);/* parse lease context buffer and return oplock/epoch info */ -__u8 (*parse_lease_buf)(void *buf,unsigned int *epoch,char *lkey); +__u8 (*parse_lease_buf)(void *buf, __u16 *epoch, char *lkey); ssize_t (*copychunk_range)(const unsigned int, struct cifsFileInfo *src_file, struct cifsFileInfo *target_file,
@@ -1422,7 +1422,7 @@ struct cifs_fid {__u8 create_guid[16 ];__u32 access;struct cifs_pending_open *pending_open; -unsigned int epoch; +__u16 epoch;#ifdef CONFIG_CIFS_DEBUG2 __u64 mid;#endif /* CIFS_DEBUG2 */
@@ -1455,7 +1455,7 @@ struct cifsFileInfo { bool oplock_break_cancelled:1; bool status_file_deleted:1; /* file has been deleted */ bool offload:1; /* offload final part of _put to a wq */ -unsigned int oplock_epoch;/* epoch from the lease break */ +__u16 oplock_epoch;/* epoch from the lease break */ __u32 oplock_level;/* oplock/lease level from the lease break */ int count;spinlock_t file_info_lock;/* protects four flag/count fields above */
@@ -1552,7 +1552,7 @@ struct cifsInodeInfo {spinlock_t open_file_lock;/* protects openFileList */ __u32 cifsAttrs;/* e.g. DOS archive bit, sparse, compressed, system */ unsigned int oplock;/* oplock/lease level we have */ -unsigned int epoch;/* used to track lease state changes */ +__u16 epoch;/* used to track lease state changes */ #define CIFS_INODE_PENDING_OPLOCK_BREAK (0)/* oplock break in progress */ #define CIFS_INODE_PENDING_WRITERS (1)/* Writes in progress */ #define CIFS_INODE_FLAG_UNUSED (2)/* Unused flag */
fs/smb/client/smb1ops.c +1 -1
@@ -377,7 +377,7 @@ coalesce_t2(char *second_buf, struct smbstatic void cifs_downgrade_oplock (struct TCP_Server_Info *server,struct cifsInodeInfo *cinode,__u32 oplock, -unsigned int epoch,bool *purge_cache) +__u16 epoch,bool *purge_cache) {cifs_set_oplock_level (cinode, oplock); }
fs/smb/client/smb2ops.c +9 -9
@@ -3904,22 +3904,22 @@ static long smb3_fallocate(struct file *static void smb2_downgrade_oplock (struct TCP_Server_Info *server,struct cifsInodeInfo *cinode,__u32 oplock, -unsigned int epoch,bool *purge_cache) +__u16 epoch,bool *purge_cache) { server->ops->set_oplock_level (cinode, oplock,0 ,NULL ); }static void smb21_set_oplock_level (struct cifsInodeInfo *cinode,__u32 oplock, -unsigned int epoch,bool *purge_cache); +__u16 epoch,bool *purge_cache);static void smb3_downgrade_oplock (struct TCP_Server_Info *server,struct cifsInodeInfo *cinode,__u32 oplock, -unsigned int epoch,bool *purge_cache) +__u16 epoch,bool *purge_cache) {unsigned int old_state = cinode->oplock; -unsigned int old_epoch = cinode->epoch; +__u16 old_epoch = cinode->epoch;unsigned int new_state;if (epoch > old_epoch) {
@@ -3939,7 +3939,7 @@ smb3_downgrade_oplock(struct TCP_Server_static void smb2_set_oplock_level (struct cifsInodeInfo *cinode,__u32 oplock, -unsigned int epoch,bool *purge_cache) +__u16 epoch,bool *purge_cache) { oplock &=0xFF ; cinode->lease_granted = false;
@@ -3963,7 +3963,7 @@ smb2_set_oplock_level(struct cifsInodeInstatic void smb21_set_oplock_level (struct cifsInodeInfo *cinode,__u32 oplock, -unsigned int epoch,bool *purge_cache) +__u16 epoch,bool *purge_cache) {char message[5 ] = {0 };unsigned int new_oplock =0 ;
@@ -4000,7 +4000,7 @@ smb21_set_oplock_level(struct cifsInodeIstatic void smb3_set_oplock_level (struct cifsInodeInfo *cinode,__u32 oplock, -unsigned int epoch,bool *purge_cache) +__u16 epoch,bool *purge_cache) {unsigned int old_oplock = cinode->oplock;
@@ -4114,7 +4114,7 @@ smb3_create_lease_buf(u8 *lease_key, u8 }static __u8 -smb2_parse_lease_buf (void *buf,unsigned int *epoch,char *lease_key) +smb2_parse_lease_buf (void *buf,__u16 *epoch,char *lease_key) {struct create_lease *lc = (struct create_lease *)buf;
@@ -4125,7 +4125,7 @@ smb2_parse_lease_buf(void *buf, unsigned }static __u8 -smb3_parse_lease_buf (void *buf,unsigned int *epoch,char *lease_key) +smb3_parse_lease_buf (void *buf,__u16 *epoch,char *lease_key) {struct create_lease_v2 *lc = (struct create_lease_v2 *)buf;
fs/smb/client/smb2pdu.c +1 -1
@@ -2329,7 +2329,7 @@ parse_posix_ctxt(struct create_context *int smb2_parse_contexts (struct TCP_Server_Info *server,struct kvec *rsp_iov, -unsigned int *epoch, +__u16 *epoch,char *lease_key,__u8 *oplock,struct smb2_file_all_info *buf,struct create_posix_rsp *posix)
fs/smb/client/smb2proto.h +1 -1
@@ -282,7 +282,7 @@ extern enum securityEnum smb2_select_sec enum securityEnum);int smb2_parse_contexts (struct TCP_Server_Info *server,struct kvec *rsp_iov, -unsigned int *epoch, +__u16 *epoch,char *lease_key,__u8 *oplock,struct smb2_file_all_info *buf,struct create_posix_rsp *posix);
Greg Kroah-Hartman
maintainerPATCH 151/443 md: reintroduce md-linear
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
commit 127186cfb184eaccdfe948e6da66940cfa03efc5 upstream.
THe md-linear is removed by commit 849d18e27be9 ("md: Remove deprecated CONFIG_MD_LINEAR") because it has been marked as deprecated for a long time.
However, md-linear is used widely for underlying disks with different size, sadly we didn't know this until now, and it's true useful to create partitions and assemble multiple raid and then append one to the other.
People have to use dm-linear in this case now, however, they will prefer to minimize the number of involved modules.
--- drivers/md/Kconfig | 13 + drivers/md/Makefile | 2 drivers/md/md-autodetect.c | 8 drivers/md/md-linear.c | 354 +++++++++++++++++++++++++++++++++++++++++ drivers/md/md.c | 2 include/uapi/linux/raid/md_p.h | 2 include/uapi/linux/raid/md_u.h | 2 7 files changed, 379 insertions(+), 4 deletions(-) create mode 100644 drivers/md/md-linear.c
drivers/md/Kconfig +13 -0
@@ -61,6 +61,19 @@ config MD_BITMAP_FILE various kernel APIs and can only work with files on a file system not actually sitting on the MD device. +config MD_LINEAR + tristate "Linear (append) mode" + depends on BLK_DEV_MD + help + If you say Y here, then your multiple devices driver will be able to + use the so-called linear mode, i.e. it will combine the hard disk + partitions by simply appending one to the other. + + To compile this as a module, choose M here: the module + will be called linear. + + If unsure, say Y. + config MD_RAID0 tristate "RAID-0 (striping) mode" depends on BLK_DEV_MD
drivers/md/Makefile +2 -0
@@ -29,12 +29,14 @@ dm-zoned-y += dm-zoned-target.o dm-zoned md-mod-y += md.o md-bitmap.o raid456-y += raid5.o raid5-cache.o raid5-ppl.o +linear-y += md-linear.o # Note: link order is important. All raid personalities # and must come before md.o, as they each initialise # themselves, and md.o may use the personalities when it # auto-initialised. +obj-$(CONFIG_MD_LINEAR) += linear.o obj-$(CONFIG_MD_RAID0) += raid0.o obj-$(CONFIG_MD_RAID1) += raid1.o obj-$(CONFIG_MD_RAID10) += raid10.o
drivers/md/md-autodetect.c +6 -2
@@ -49,6 +49,7 @@ static int md_setup_ents __initdata;* instead of just one. -- KTK * 18May2000: Added support for persistent-superblock arrays: * md=n,0,factor,fault,device-list uses RAID0 for device n +* md=n,-1,factor,fault,device-list uses LINEAR for device n * md=n,device-list reads a RAID superblock from the devices * elements in device-list are read by name_to_kdev_t so can be * a hex number or something like /dev/hda1 /dev/sdb
@@ -87,7 +88,7 @@ static int __init md_setup(char *str) md_setup_ents++;switch (get_option (&str, &level)) {/* RAID level */ case 2 :/* could be 0 or -1.. */ -if (level ==0 ) { +if (level ==0 || level ==LEVEL_LINEAR ) {if (get_option (&str, &factor) !=2 ||/* Chunk Size */ get_option (&str, &fault) !=2 ) {printk (KERN_WARNING "md: Too few arguments supplied to md=.\n" );
@@ -95,7 +96,10 @@ static int __init md_setup(char *str) } md_setup_args[ent].level = level; md_setup_args[ent].chunk =1 << (factor+12 ); - pername ="raid0" ; +if (level ==LEVEL_LINEAR ) + pername ="linear" ; +else + pername ="raid0" ;break ; } fallthrough;
drivers/md/md-linear.c new file +354 -0
354 lines not on this page · raw message
drivers/md/md.c +1 -1
@@ -8124,7 +8124,7 @@ void md_error(struct mddev *mddev, strucreturn ; mddev->pers->error_handler (mddev, rdev); -if (mddev->pers->level ==0 ) +if (mddev->pers->level ==0 || mddev->pers->level ==LEVEL_LINEAR )return ;if (mddev->degraded && !test_bit (MD_BROKEN , &mddev->flags))
include/uapi/linux/raid/md_p.h +1 -1
@@ -233,7 +233,7 @@ struct mdp_superblock_1 {char set_name[32 ];/* set and interpreted by user-space */ __le64 ctime;/* lo 40 bits are seconds, top 24 are microseconds or 0*/ -__le32 level;/* 0,1,4,5 */ +__le32 level;/* 0,1,4,5, -1 (linear) */ __le32 layout;/* only for raid5 and raid10 currently */ __le64 size;/* used size of component devices, in 512byte sectors */
include/uapi/linux/raid/md_u.h +2 -0
@@ -103,6 +103,8 @@ typedef struct mdu_array_info_s { } mdu_array_info_t; +#define LEVEL_LINEAR (-1) +/* we need a value for 'no level specified' and 0 * means 'raid0', so we need something else. This is * for internal use only
Greg Kroah-Hartman
maintainerPATCH 152/443 s390/futex: Fix FUTEX_OP_ANDN implementation
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <[email protected]>
commit 26701574cee6777f867f89b4a5c667817e1ee0dd upstream.
The futex operation FUTEX_OP_ANDN is supposed to implement
*(int *)UADDR2 &= ~OPARG;
The s390 implementation just implements an AND instead of ANDN. Add the missing bitwise not operation to oparg to fix this.
This is broken since nearly 19 years, so it looks like user space is not making use of this operation.
--- arch/s390/include/asm/futex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/include/asm/futex.h +1 -1
@@ -44,7 +44,7 @@ static inline int arch_futex_atomic_op_ibreak ;case FUTEX_OP_ANDN :__futex_atomic_op ("lr %2,%1\nnr %2,%5\n" , - ret, oldval, newval, uaddr, oparg); + ret, oldval, newval, uaddr, ~oparg);break ;case FUTEX_OP_XOR : __futex_atomic_op("lr %2,%1\nxr %2,%5\n",
Greg Kroah-Hartman
maintainerPATCH 153/443 arm64: Filter out SVE hwcaps when FEAT_SVE isnt implemented
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Zyngier <[email protected]>
commit 064737920bdbca86df91b96aed256e88018fef3a upstream.
The hwcaps code that exposes SVE features to userspace only considers ID_AA64ZFR0_EL1, while this is only valid when ID_AA64PFR0_EL1.SVE advertises that SVE is actually supported.
The expectations are that when ID_AA64PFR0_EL1.SVE is 0, the ID_AA64ZFR0_EL1 register is also 0. So far, so good.
Things become a bit more interesting if the HW implements SME. In this case, a few ID_AA64ZFR0_EL1 fields indicate *SME* features. And these fields overlap with their SVE interpretations. But the architecture says that the SME and SVE feature sets must match, so we're still hunky-dory.
This goes wrong if the HW implements SME, but not SVE. In this case, we end-up advertising some SVE features to userspace, even if the HW has none. That's because we never consider whether SVE is actually implemented. Oh well.
Fix it by restricting all SVE capabilities to ID_AA64PFR0_EL1.SVE being non-zero. The HWCAPS documentation is amended to reflect the actually checks performed by the kernel.
--- Documentation/arch/arm64/elf_hwcaps.rst | 39 ++++++++++++++++++++----------- arch/arm64/kernel/cpufeature.c | 40 +++++++++++++++++++++----------- 2 files changed, 53 insertions(+), 26 deletions(-)
Documentation/arch/arm64/elf_hwcaps.rst +26 -13
@@ -178,22 +178,28 @@ HWCAP2_DCPODP Functionality implied by ID_AA64ISAR1_EL1.DPB == 0b0010. HWCAP2_SVE2 - Functionality implied by ID_AA64ZFR0_EL1.SVEver == 0b0001. + Functionality implied by ID_AA64PFR0_EL1.SVE == 0b0001 and + ID_AA64ZFR0_EL1.SVEver == 0b0001. HWCAP2_SVEAES - Functionality implied by ID_AA64ZFR0_EL1.AES == 0b0001. + Functionality implied by ID_AA64PFR0_EL1.SVE == 0b0001 and + ID_AA64ZFR0_EL1.AES == 0b0001. HWCAP2_SVEPMULL - Functionality implied by ID_AA64ZFR0_EL1.AES == 0b0010. + Functionality implied by ID_AA64PFR0_EL1.SVE == 0b0001 and + ID_AA64ZFR0_EL1.AES == 0b0010. HWCAP2_SVEBITPERM - Functionality implied by ID_AA64ZFR0_EL1.BitPerm == 0b0001. + Functionality implied by ID_AA64PFR0_EL1.SVE == 0b0001 and + ID_AA64ZFR0_EL1.BitPerm == 0b0001. HWCAP2_SVESHA3 - Functionality implied by ID_AA64ZFR0_EL1.SHA3 == 0b0001. + Functionality implied by ID_AA64PFR0_EL1.SVE == 0b0001 and + ID_AA64ZFR0_EL1.SHA3 == 0b0001. HWCAP2_SVESM4 - Functionality implied by ID_AA64ZFR0_EL1.SM4 == 0b0001. + Functionality implied by ID_AA64PFR0_EL1.SVE == 0b0001 and + ID_AA64ZFR0_EL1.SM4 == 0b0001. HWCAP2_FLAGM2 Functionality implied by ID_AA64ISAR0_EL1.TS == 0b0010.
@@ -202,16 +208,20 @@ HWCAP2_FRINT Functionality implied by ID_AA64ISAR1_EL1.FRINTTS == 0b0001. HWCAP2_SVEI8MM - Functionality implied by ID_AA64ZFR0_EL1.I8MM == 0b0001. + Functionality implied by ID_AA64PFR0_EL1.SVE == 0b0001 and + ID_AA64ZFR0_EL1.I8MM == 0b0001. HWCAP2_SVEF32MM - Functionality implied by ID_AA64ZFR0_EL1.F32MM == 0b0001. + Functionality implied by ID_AA64PFR0_EL1.SVE == 0b0001 and + ID_AA64ZFR0_EL1.F32MM == 0b0001. HWCAP2_SVEF64MM - Functionality implied by ID_AA64ZFR0_EL1.F64MM == 0b0001. + Functionality implied by ID_AA64PFR0_EL1.SVE == 0b0001 and + ID_AA64ZFR0_EL1.F64MM == 0b0001. HWCAP2_SVEBF16 - Functionality implied by ID_AA64ZFR0_EL1.BF16 == 0b0001. + Functionality implied by ID_AA64PFR0_EL1.SVE == 0b0001 and + ID_AA64ZFR0_EL1.BF16 == 0b0001. HWCAP2_I8MM Functionality implied by ID_AA64ISAR1_EL1.I8MM == 0b0001.
@@ -277,7 +287,8 @@ HWCAP2_EBF16 Functionality implied by ID_AA64ISAR1_EL1.BF16 == 0b0010. HWCAP2_SVE_EBF16 - Functionality implied by ID_AA64ZFR0_EL1.BF16 == 0b0010. + Functionality implied by ID_AA64PFR0_EL1.SVE == 0b0001 and + ID_AA64ZFR0_EL1.BF16 == 0b0010. HWCAP2_CSSC Functionality implied by ID_AA64ISAR2_EL1.CSSC == 0b0001.
@@ -286,7 +297,8 @@ HWCAP2_RPRFM Functionality implied by ID_AA64ISAR2_EL1.RPRFM == 0b0001. HWCAP2_SVE2P1 - Functionality implied by ID_AA64ZFR0_EL1.SVEver == 0b0010. + Functionality implied by ID_AA64PFR0_EL1.SVE == 0b0001 and + ID_AA64ZFR0_EL1.SVEver == 0b0010. HWCAP2_SME2 Functionality implied by ID_AA64SMFR0_EL1.SMEver == 0b0001.
@@ -313,7 +325,8 @@ HWCAP2_HBC Functionality implied by ID_AA64ISAR2_EL1.BC == 0b0001. HWCAP2_SVE_B16B16 - Functionality implied by ID_AA64ZFR0_EL1.B16B16 == 0b0001. + Functionality implied by ID_AA64PFR0_EL1.SVE == 0b0001 and + ID_AA64ZFR0_EL1.B16B16 == 0b0001. HWCAP2_LRCPC3 Functionality implied by ID_AA64ISAR1_EL1.LRCPC == 0b0011.
arch/arm64/kernel/cpufeature.c +27 -13
@@ -3022,6 +3022,13 @@ static const struct arm64_cpu_capabiliti .matches = match, \ } +#define HWCAP_CAP_MATCH_ID (match, reg, field, min_value, cap_type, cap) \ + { \ + __HWCAP_CAP(#cap, cap_type, cap) \ + HWCAP_CPUID_MATCH(reg, field, min_value) \ + .matches = match, \ + } + #ifdef CONFIG_ARM64_PTR_AUTH static const struct arm64_cpu_capabilities ptr_auth_hwcap_addr_matches[] = { {
@@ -3050,6 +3057,13 @@ static const struct arm64_cpu_capabiliti };#endif +#ifdef CONFIG_ARM64_SVE +static bool has_sve_feature (const struct arm64_cpu_capabilities *cap,int scope) +{ +return system_supports_sve () &&has_user_cpuid_feature (cap, scope); +} +#endif +static const struct arm64_cpu_capabilities arm64_elf_hwcaps[] = {HWCAP_CAP (ID_AA64ISAR0_EL1 ,AES ,PMULL ,CAP_HWCAP ,KERNEL_HWCAP_PMULL ),HWCAP_CAP (ID_AA64ISAR0_EL1 ,AES ,AES ,CAP_HWCAP ,KERNEL_HWCAP_AES ),
@@ -3092,19 +3106,19 @@ static const struct arm64_cpu_capabiliti HWCAP_CAP(ID_AA64MMFR2_EL1, AT, IMP, CAP_HWCAP, KERNEL_HWCAP_USCAT),#ifdef CONFIG_ARM64_SVE HWCAP_CAP (ID_AA64PFR0_EL1 ,SVE ,IMP ,CAP_HWCAP ,KERNEL_HWCAP_SVE ), -HWCAP_CAP (ID_AA64ZFR0_EL1 , SVEver, SVE2p1,CAP_HWCAP ,KERNEL_HWCAP_SVE2P1 ), -HWCAP_CAP (ID_AA64ZFR0_EL1 , SVEver,SVE2 ,CAP_HWCAP ,KERNEL_HWCAP_SVE2 ), -HWCAP_CAP (ID_AA64ZFR0_EL1 ,AES ,IMP ,CAP_HWCAP ,KERNEL_HWCAP_SVEAES ), -HWCAP_CAP (ID_AA64ZFR0_EL1 ,AES ,PMULL128 ,CAP_HWCAP ,KERNEL_HWCAP_SVEPMULL ), -HWCAP_CAP (ID_AA64ZFR0_EL1 , BitPerm,IMP ,CAP_HWCAP ,KERNEL_HWCAP_SVEBITPERM ), -HWCAP_CAP (ID_AA64ZFR0_EL1 ,B16B16 ,IMP ,CAP_HWCAP ,KERNEL_HWCAP_SVE_B16B16 ), -HWCAP_CAP (ID_AA64ZFR0_EL1 ,BF16 ,IMP ,CAP_HWCAP ,KERNEL_HWCAP_SVEBF16 ), -HWCAP_CAP (ID_AA64ZFR0_EL1 ,BF16 ,EBF16 ,CAP_HWCAP ,KERNEL_HWCAP_SVE_EBF16 ), -HWCAP_CAP (ID_AA64ZFR0_EL1 ,SHA3 ,IMP ,CAP_HWCAP ,KERNEL_HWCAP_SVESHA3 ), -HWCAP_CAP (ID_AA64ZFR0_EL1 ,SM4 ,IMP ,CAP_HWCAP ,KERNEL_HWCAP_SVESM4 ), -HWCAP_CAP (ID_AA64ZFR0_EL1 ,I8MM ,IMP ,CAP_HWCAP ,KERNEL_HWCAP_SVEI8MM ), -HWCAP_CAP (ID_AA64ZFR0_EL1 ,F32MM ,IMP ,CAP_HWCAP ,KERNEL_HWCAP_SVEF32MM ), -HWCAP_CAP (ID_AA64ZFR0_EL1 ,F64MM ,IMP ,CAP_HWCAP ,KERNEL_HWCAP_SVEF64MM ), +HWCAP_CAP_MATCH_ID (has_sve_feature,ID_AA64ZFR0_EL1 , SVEver, SVE2p1,CAP_HWCAP ,KERNEL_HWCAP_SVE2P1 ), +HWCAP_CAP_MATCH_ID (has_sve_feature,ID_AA64ZFR0_EL1 , SVEver,SVE2 ,CAP_HWCAP ,KERNEL_HWCAP_SVE2 ), +HWCAP_CAP_MATCH_ID (has_sve_feature,ID_AA64ZFR0_EL1 ,AES ,IMP ,CAP_HWCAP ,KERNEL_HWCAP_SVEAES ), +HWCAP_CAP_MATCH_ID (has_sve_feature,ID_AA64ZFR0_EL1 ,AES ,PMULL128 ,CAP_HWCAP ,KERNEL_HWCAP_SVEPMULL ), +HWCAP_CAP_MATCH_ID (has_sve_feature,ID_AA64ZFR0_EL1 , BitPerm,IMP ,CAP_HWCAP ,KERNEL_HWCAP_SVEBITPERM ), +HWCAP_CAP_MATCH_ID (has_sve_feature,ID_AA64ZFR0_EL1 ,B16B16 ,IMP ,CAP_HWCAP ,KERNEL_HWCAP_SVE_B16B16 ), +HWCAP_CAP_MATCH_ID (has_sve_feature,ID_AA64ZFR0_EL1 ,BF16 ,IMP ,CAP_HWCAP ,KERNEL_HWCAP_SVEBF16 ), +HWCAP_CAP_MATCH_ID (has_sve_feature,ID_AA64ZFR0_EL1 ,BF16 ,EBF16 ,CAP_HWCAP ,KERNEL_HWCAP_SVE_EBF16 ), +HWCAP_CAP_MATCH_ID (has_sve_feature,ID_AA64ZFR0_EL1 ,SHA3 ,IMP ,CAP_HWCAP ,KERNEL_HWCAP_SVESHA3 ), +HWCAP_CAP_MATCH_ID (has_sve_feature,ID_AA64ZFR0_EL1 ,SM4 ,IMP ,CAP_HWCAP ,KERNEL_HWCAP_SVESM4 ), +HWCAP_CAP_MATCH_ID (has_sve_feature,ID_AA64ZFR0_EL1 ,I8MM ,IMP ,CAP_HWCAP ,KERNEL_HWCAP_SVEI8MM ), +HWCAP_CAP_MATCH_ID (has_sve_feature,ID_AA64ZFR0_EL1 ,F32MM ,IMP ,CAP_HWCAP ,KERNEL_HWCAP_SVEF32MM ), +HWCAP_CAP_MATCH_ID (has_sve_feature,ID_AA64ZFR0_EL1 ,F64MM ,IMP ,CAP_HWCAP ,KERNEL_HWCAP_SVEF64MM ), #endif #ifdef CONFIG_ARM64_GCS HWCAP_CAP(ID_AA64PFR1_EL1, GCS, IMP, CAP_HWCAP, KERNEL_HWCAP_GCS),
Greg Kroah-Hartman
maintainerPATCH 154/443 m68k: vga: Fix I/O defines
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zimmermann <[email protected]>
commit 53036937a101b5faeaf98e7438555fa854a1a844 upstream.
Including m68k's <asm/raw_io.h> in vga.h on nommu platforms results in conflicting defines with io_no.h for various I/O macros from the __raw_read and __raw_write families. An example error is
In file included from arch/m68k/include/asm/vga.h:12,
from include/video/vga.h:22, from include/linux/vgaarb.h:34, from drivers/video/aperture.c:12:
Quoted 1 line
Quoted 1 line
arch/m68k/include/asm/raw_io.h:39: warning: "__raw_readb" redefined
39 | #define __raw_readb in_8
|
In file included from arch/m68k/include/asm/io.h:6,
from include/linux/io.h:13,
from include/linux/irq.h:20,
from include/asm-generic/hardirq.h:17,
from ./arch/m68k/include/generated/asm/hardirq.h:1,
from include/linux/hardirq.h:11,
from include/linux/interrupt.h:11,
from include/linux/trace_recursion.h:5,
from include/linux/ftrace.h:10,
from include/linux/kprobes.h:28,
from include/linux/kgdb.h:19,
from include/linux/fb.h:6,
from drivers/video/aperture.c:5:
arch/m68k/include/asm/io_no.h:16: note: this is the location of the previous definition
16 | #define __raw_readb(addr) \
|Include <asm/io.h>, which avoids raw_io.h on nommu platforms. Also change the defined values of some of the read/write symbols in vga.h to __raw_read/__raw_write as the raw_in/raw_out symbols are not generally available.
--- arch/m68k/include/asm/vga.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/m68k/include/asm/vga.h +4 -4
@@ -9,7 +9,7 @@*/ #ifndef CONFIG_PCI -#include <asm/raw_io.h> +#include <asm/io.h> #include <asm/kmap.h> /*
@@ -29,9 +29,9 @@#define inw_p (port) 0#define outb_p (port, val) do { } while (0)#define outw (port, val) do { } while (0) -#define readb raw_inb -#define writeb raw_outb -#define writew raw_outw +#define readb __raw_readb +#define writeb __raw_writeb +#define writew __raw_writew#endif /* CONFIG_PCI */ #endif /* _ASM_M68K_VGA_H */
Greg Kroah-Hartman
maintainerPATCH 155/443 fs/proc: do_task_stat: Fix ESP not readable during coredump
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nam Cao <[email protected]>
commit ab251dacfbae28772c897f068a4184f478189ff2 upstream.
The field "eip" (instruction pointer) and "esp" (stack pointer) of a task can be read from /proc/PID/stat. These fields can be interesting for coredump.
However, these fields were disabled by commit 0a1eb2d474ed ("fs/proc: Stop reporting eip and esp in /proc/PID/stat"), because it is generally unsafe to do so. But it is safe for a coredumping process, and therefore exceptions were made:
- for a coredumping thread by commit fd7d56270b52 ("fs/proc: Report eip/esp in /prod/PID/stat for coredumping").
- for all other threads in a coredumping process by commit cb8f381f1613 ("fs/proc/array.c: allow reporting eip/esp for all coredumping threads").
The above two commits check the PF_DUMPCORE flag to determine a coredump thread and the PF_EXITING flag for the other threads.
Unfortunately, commit 92307383082d ("coredump: Don't perform any cleanups before dumping core") moved coredump to happen earlier and before PF_EXITING is set. Thus, checking PF_EXITING is no longer the correct way to determine threads in a coredumping process.
Instead of PF_EXITING, use PF_POSTCOREDUMP to determine the other threads.
Checking of PF_EXITING was added for coredumping, so it probably can now be removed. But it doesn't hurt to keep.
--- fs/proc/array.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/proc/array.c +1 -1
@@ -500,7 +500,7 @@ static int do_task_stat(struct seq_file* a program is not able to use ptrace(2) in that case. It is * safe because the task has stopped executing permanently. */ -if (permitted && (task->flags & (PF_EXITING |PF_DUMPCORE ))) { +if (permitted && (task->flags & (PF_EXITING |PF_DUMPCORE |PF_POSTCOREDUMP ))) {if (try_get_task_stack (task)) { eip =KSTK_EIP (task); esp =KSTK_ESP (task);
Greg Kroah-Hartman
maintainerPATCH 156/443 block: mark GFP_NOIO around sysfs ->store()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Lei <[email protected]>
commit 7c0be4ead1f8f5f8be0803f347de0de81e3b8e1c upstream.
sysfs ->store is called with queue freezed, meantime we have several ->store() callbacks(update_nr_requests, wbt, scheduler) to allocate memory with GFP_KERNEL which may run into direct reclaim code path, then potential deadlock can be caused.
Fix the issue by marking NOIO around sysfs ->store()
--- block/blk-sysfs.c | 3 +++ 1 file changed, 3 insertions(+)
block/blk-sysfs.c +3 -0
@@ -681,6 +681,7 @@ queue_attr_store(struct kobject *kobj, sstruct queue_sysfs_entry *entry =to_queue (attr); struct gendisk *disk = container_of(kobj, struct gendisk, queue_kobj);struct request_queue *q = disk->queue; +unsigned int noio_flag;ssize_t res;if (!entry->store_limit && !entry->store)
@@ -711,7 +712,9 @@ queue_attr_store(struct kobject *kobj, smutex_lock (&q->sysfs_lock);blk_mq_freeze_queue (q); + noio_flag =memalloc_noio_save (); res = entry->store (disk, page, length); +memalloc_noio_restore (noio_flag);blk_mq_unfreeze_queue (q);mutex_unlock (&q->sysfs_lock);return res;
Greg Kroah-Hartman
maintainerPATCH 157/443 binfmt_flat: Fix integer overflow bug on 32 bit systems
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 55cf2f4b945f6a6416cc2524ba740b83cc9af25a upstream.
Most of these sizes and counts are capped at 256MB so the math doesn't result in an integer overflow. The "relocs" count needs to be checked as well. Otherwise on 32bit systems the calculation of "full_data" could be wrong.
full_data = data_len + relocs * sizeof(unsigned long);
--- fs/binfmt_flat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/binfmt_flat.c +1 -1
@@ -478,7 +478,7 @@ static int load_flat_file(struct linux_b* 28 bits (256 MB) is way more than reasonable in this case. * If some top bits are set we have probable binary corruption. */ -if ((text_len | data_len | bss_len | stack_len | full_data) >>28 ) { +if ((text_len | data_len | bss_len | stack_len | relocs | full_data) >>28 ) {pr_err ("bad header\n" ); ret = -ENOEXEC ; goto err;
Greg Kroah-Hartman
maintainerPATCH 158/443 perf: imx9_perf: Introduce AXI filter version to refactor the driver and better extension
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xu Yang <[email protected]>
commit f3edf03a4c59e59e52c0c1fd958f64a76a038302 upstream.
The imx93 is the first supported DDR PMU that supports read transaction, write transaction and read beats events which corresponding respecitively to counter 2, 3 and 4.
However, transaction-based AXI match has low accuracy when get total bits compared to beats-based. And imx93 doesn't assign AXI_ID to each master. So axi filter is not used widely on imx93. This could be regards as AXI filter version 1.
To improve the AXI filter capability, imx95 supports 1 read beats and 3 write beats event which corresponding respecitively to counter 2-5. imx95 also detailed AXI_ID allocation so that most of the master could be count individually. This could be regards as AXI filter version 2.
This will introduce AXI filter version to refactor the driver and support better extension, such as coming imx943. This is also a potential fix on imx91 when configure axi filter.
--- drivers/perf/fsl_imx9_ddr_perf.c | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-)
drivers/perf/fsl_imx9_ddr_perf.c +25 -8
@@ -63,8 +63,21 @@static DEFINE_IDA (ddr_ida); +/* +* V1 support 1 read transaction, 1 write transaction and 1 read beats +* event which corresponding respecitively to counter 2, 3 and 4. +*/ +#define DDR_PERF_AXI_FILTER_V1 0x1 + +/* +* V2 support 1 read beats and 3 write beats events which corresponding +* respecitively to counter 2-5. +*/ +#define DDR_PERF_AXI_FILTER_V2 0x2 +struct imx_ddr_devtype_data {const char *identifier;/* system PMU identifier for userspace */ +unsigned int filter_ver;/* AXI filter version */ };struct ddr_pmu {
@@ -83,24 +96,27 @@ struct ddr_pmu {static const struct imx_ddr_devtype_data imx91_devtype_data = { .identifier ="imx91" , + .filter_ver =DDR_PERF_AXI_FILTER_V1 };static const struct imx_ddr_devtype_data imx93_devtype_data = { .identifier ="imx93" , + .filter_ver =DDR_PERF_AXI_FILTER_V1 };static const struct imx_ddr_devtype_data imx95_devtype_data = { .identifier ="imx95" , + .filter_ver =DDR_PERF_AXI_FILTER_V2 }; -static inline bool is_imx93 (struct ddr_pmu *pmu) +static inline bool axi_filter_v1 (struct ddr_pmu *pmu) { -return pmu->devtype_data == &imx93_devtype_data; +return pmu->devtype_data->filter_ver ==DDR_PERF_AXI_FILTER_V1 ; } -static inline bool is_imx95 (struct ddr_pmu *pmu) +static inline bool axi_filter_v2 (struct ddr_pmu *pmu) { -return pmu->devtype_data == &imx95_devtype_data; +return pmu->devtype_data->filter_ver ==DDR_PERF_AXI_FILTER_V2 ; }static const struct of_device_id imx_ddr_pmu_dt_ids[] = {
@@ -155,7 +171,7 @@ static const struct attribute_group ddr_struct imx9_pmu_events_attr {struct device_attribute attr;u64 id; -const void *devtype_data; +const struct imx_ddr_devtype_data *devtype_data; }; static ssize_t ddr_pmu_event_show(struct device *dev,
@@ -307,7 +323,8 @@ ddr_perf_events_attrs_is_visible(structif (!eattr->devtype_data)return attr->mode; -if (eattr->devtype_data != ddr_pmu->devtype_data) +if (eattr->devtype_data != ddr_pmu->devtype_data && + eattr->devtype_data->filter_ver != ddr_pmu->devtype_data->filter_ver)return 0 ;return attr->mode;
@@ -624,11 +641,11 @@ static int ddr_perf_event_add(struct per hwc->idx = counter; hwc->state |=PERF_HES_STOPPED ; -if (is_imx93 (pmu)) +if (axi_filter_v1 (pmu))/* read trans, write trans, read beat */ imx93_ddr_perf_monitor_config (pmu, event_id, counter, cfg1, cfg2); -if (is_imx95 (pmu)) +if (axi_filter_v2 (pmu))/* write beat, read beat2, read beat1, read beat */ imx95_ddr_perf_monitor_config (pmu, event_id, counter, cfg1, cfg2);
Greg Kroah-Hartman
maintainerPATCH 159/443 accel/ivpu: Fix Qemu crash when running in passthrough
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacek Lawrynowicz <[email protected]>
commit 901dd2617c9c3554b2449c8844b6338009112fcf upstream.
Restore PCI state after putting the NPU in D0. Restoring state before powering up the device caused a Qemu crash if NPU was running in passthrough mode and recovery was performed.
--- drivers/accel/ivpu/ivpu_pm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/accel/ivpu/ivpu_pm.c +1 -1
@@ -78,8 +78,8 @@ static int ivpu_resume(struct ivpu_devicint ret; retry: -pci_restore_state (to_pci_dev (vdev->drm.dev));pci_set_power_state (to_pci_dev (vdev->drm.dev),PCI_D0 ); +pci_restore_state (to_pci_dev (vdev->drm.dev)); ret =ivpu_hw_power_up (vdev);if (ret) {
Greg Kroah-Hartman
maintainerPATCH 160/443 arm64/kvm: Configure HYP TCR.PS/DS based on host stage1
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ard Biesheuvel <[email protected]>
commit f0da16992aef7e246b2f3bba1492e3a52c38ca0e upstream.
When the host stage1 is configured for LPA2, the value currently being programmed into TCR_EL2.T0SZ may be invalid unless LPA2 is configured at HYP as well. This means kvm_lpa2_is_enabled() is not the right condition to test when setting TCR_EL2.DS, as it will return false if LPA2 is only available for stage 1 but not for stage 2.
Similary, programming TCR_EL2.PS based on a limited IPA range due to lack of stage2 LPA2 support could potentially result in problems.
So use lpa2_is_enabled() instead, and set the PS field according to the host's IPS, which is capped at 48 bits if LPA2 support is absent or disabled. Whether or not we can make meaningful use of such a configuration is a different question.
--- arch/arm64/kvm/arm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/kvm/arm.c +4 -4
@@ -1990,8 +1990,7 @@ static int kvm_init_vector_slots(void)static void __init cpu_prepare_hyp_mode (int cpu,u32 hyp_va_bits) {struct kvm_nvhe_init_params *params =per_cpu_ptr_nvhe_sym (kvm_init_params, cpu); -u64 mmfr0 =read_sanitised_ftr_reg (SYS_ID_AA64MMFR0_EL1 ); -unsigned long tcr; +unsigned long tcr, ips;/* * Calculate the raw per-cpu offset without a translation from the
@@ -2005,6 +2004,7 @@ static void __init cpu_prepare_hyp_mode( params->mair_el2 =read_sysreg (mair_el1); tcr =read_sysreg (tcr_el1); + ips =FIELD_GET (TCR_IPS_MASK , tcr);if (cpus_have_final_cap (ARM64_KVM_HVHE )) { tcr |=TCR_EPD1_MASK ; }else {
@@ -2014,8 +2014,8 @@ static void __init cpu_prepare_hyp_mode( tcr &= ~TCR_T0SZ_MASK ; tcr |=TCR_T0SZ (hyp_va_bits); tcr &= ~TCR_EL2_PS_MASK ; - tcr |=FIELD_PREP (TCR_EL2_PS_MASK ,kvm_get_parange (mmfr0)); -if (kvm_lpa2_is_enabled ()) + tcr |=FIELD_PREP (TCR_EL2_PS_MASK , ips); +if (lpa2_is_enabled ()) tcr |=TCR_EL2_DS ; params->tcr_el2 = tcr;
Greg Kroah-Hartman
maintainerPATCH 161/443 arm64/mm: Override PARange for !LPA2 and use it consistently
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ard Biesheuvel <[email protected]>
commit 62cffa496aac0c2c4eeca00d080058affd7a0172 upstream.
When FEAT_LPA{,2} are not implemented, the ID_AA64MMFR0_EL1.PARange and TCR.IPS values corresponding with 52-bit physical addressing are reserved.
Setting the TCR.IPS field to 0b110 (52-bit physical addressing) has side effects, such as how the TTBRn_ELx.BADDR fields are interpreted, and so it is important that disabling FEAT_LPA2 (by overriding the ID_AA64MMFR0.TGran fields) also presents a PARange field consistent with that.
So limit the field to 48 bits unless LPA2 is enabled, and update existing references to use the override consistently.
--- arch/arm64/include/asm/assembler.h | 5 +++++ arch/arm64/kernel/cpufeature.c | 2 +- arch/arm64/kernel/pi/idreg-override.c | 9 +++++++++ arch/arm64/kernel/pi/map_kernel.c | 6 ++++++ arch/arm64/mm/init.c | 7 ++++++- 5 files changed, 27 insertions(+), 2 deletions(-)
arch/arm64/include/asm/assembler.h +5 -0
@@ -343,6 +343,11 @@ alternative_cb_end// Narrow PARange to fit the PS field in TCR_ELx ubfx \tmp0, \tmp0, #ID_AA64MMFR0_EL1_PARANGE_SHIFT, #3 mov \tmp1, #ID_AA64MMFR0_EL1_PARANGE_MAX +#ifdef CONFIG_ARM64_LPA2 +alternative_if_not ARM64_HAS_VA52 + mov \tmp1, #ID_AA64MMFR0_EL1_PARANGE_48 +alternative_else_nop_endif +#endif cmp \tmp0, \tmp1 csel \tmp0, \tmp1, \tmp0, hi bfi \tcr, \tmp0, \pos, #3
arch/arm64/kernel/cpufeature.c +1 -1
@@ -3492,7 +3492,7 @@ static void verify_hyp_capabilities(voidreturn ; safe_mmfr1 =read_sanitised_ftr_reg (SYS_ID_AA64MMFR1_EL1 ); - mmfr0 =read_cpuid (ID_AA64MMFR0_EL1 ); + mmfr0 =read_sanitised_ftr_reg (SYS_ID_AA64MMFR0_EL1 ); mmfr1 =read_cpuid (ID_AA64MMFR1_EL1 );/* Verify VMID bits */
arch/arm64/kernel/pi/idreg-override.c +9 -0
@@ -83,6 +83,15 @@ static bool __init mmfr2_varange_filter( id_aa64mmfr0_override.val |= (ID_AA64MMFR0_EL1_TGRAN_LPA2 -1 ) <<ID_AA64MMFR0_EL1_TGRAN_SHIFT ; id_aa64mmfr0_override.mask |=0xfU <<ID_AA64MMFR0_EL1_TGRAN_SHIFT ; + +/* +* Override PARange to 48 bits - the override will just be +* ignored if the actual PARange is smaller, but this is +* unlikely to be the case for LPA2 capable silicon. +*/ + id_aa64mmfr0_override.val |= +ID_AA64MMFR0_EL1_PARANGE_48 <<ID_AA64MMFR0_EL1_PARANGE_SHIFT ; + id_aa64mmfr0_override.mask |= 0xfU << ID_AA64MMFR0_EL1_PARANGE_SHIFT; }#endif return true;
arch/arm64/kernel/pi/map_kernel.c +6 -0
@@ -136,6 +136,12 @@ static void noinline __section(".idmap.t {u64 sctlr =read_sysreg (sctlr_el1);u64 tcr =read_sysreg (tcr_el1) |TCR_DS ; +u64 mmfr0 =read_sysreg (id_aa64mmfr0_el1); +u64 parange =cpuid_feature_extract_unsigned_field (mmfr0, +ID_AA64MMFR0_EL1_PARANGE_SHIFT ); + + tcr &= ~TCR_IPS_MASK ; + tcr |= parange <<TCR_IPS_SHIFT ; asm(" msr sctlr_el1, %0 ;" " isb ;"
arch/arm64/mm/init.c +6 -1
@@ -279,7 +279,12 @@ void __init arm64_memblock_init(void)if (IS_ENABLED (CONFIG_RANDOMIZE_BASE )) {extern u16 memstart_offset_seed; -u64 mmfr0 =read_cpuid (ID_AA64MMFR0_EL1 ); + +/* +* Use the sanitised version of id_aa64mmfr0_el1 so that linear +* map randomization can be enabled by shrinking the IPA space. +*/ +u64 mmfr0 =read_sanitised_ftr_reg (SYS_ID_AA64MMFR0_EL1 );int parange =cpuid_feature_extract_unsigned_field ( mmfr0,ID_AA64MMFR0_EL1_PARANGE_SHIFT ); s64 range = linear_region_size -
Greg Kroah-Hartman
maintainerPATCH 162/443 arm64/sme: Move storage of reg_smidr to __cpuinfo_store_cpu()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit d3c7c48d004f6c8d892f39b5d69884fd0fe98c81 upstream.
In commit 892f7237b3ff ("arm64: Delay initialisation of cpuinfo_arm64::reg_{zcr,smcr}") we moved access to ZCR, SMCR and SMIDR later in the boot process in order to ensure that we don't attempt to interact with them if SVE or SME is disabled on the command line. Unfortunately when initialising the boot CPU in init_cpu_features() we work on a copy of the struct cpuinfo_arm64 for the boot CPU used only during boot, not the percpu copy used by the sysfs code. The expectation of the feature identification code was that the ID registers would be read in __cpuinfo_store_cpu() and the values not modified by init_cpu_features().
The main reason for the original change was to avoid early accesses to ZCR on practical systems that were seen shipping with SVE reported in ID registers but traps enabled at EL3 and handled as fatal errors, SME was rolled in due to the similarity with SVE. Since then we have removed the early accesses to ZCR and SMCR in commits:
abef0695f9665c3d ("arm64/sve: Remove ZCR pseudo register from cpufeature code") 391208485c3ad50f ("arm64/sve: Remove SMCR pseudo register from cpufeature code")
so only the SMIDR_EL1 part of the change remains. Since SMIDR_EL1 is only trapped via FEAT_IDST and not the SME trap it is less likely to be affected by similar issues, and the factors that lead to issues with SVE are less likely to apply to SME.
Since we have not yet seen practical SME systems that need to use a command line override (and are only just beginning to see SME systems at all) and the ID register read is much more likely to be safe let's just store SMIDR_EL1 along with all the other ID register reads in __cpuinfo_store_cpu().
This issue wasn't apparent when testing on emulated platforms that do not report values in SMIDR_EL1.
--- arch/arm64/kernel/cpufeature.c | 13 ------------- arch/arm64/kernel/cpuinfo.c | 10 ++++++++++ 2 files changed, 10 insertions(+), 13 deletions(-)
arch/arm64/kernel/cpufeature.c +0 -13
@@ -1167,12 +1167,6 @@ void __init init_cpu_features(struct cpu id_aa64pfr1_sme(read_sanitised_ftr_reg(SYS_ID_AA64PFR1_EL1))) {unsigned long cpacr =cpacr_save_enable_kernel_sme (); -/* -* We mask out SMPS since even if the hardware -* supports priorities the kernel does not at present -* and we block access to them. -*/ - info->reg_smidr =read_cpuid (SMIDR_EL1 ) & ~SMIDR_EL1_SMPS ;vec_init_vq_map (ARM64_VEC_SME );cpacr_restore (cpacr);
@@ -1423,13 +1417,6 @@ void update_cpu_features(int cpu, id_aa64pfr1_sme(read_sanitised_ftr_reg(SYS_ID_AA64PFR1_EL1))) {unsigned long cpacr =cpacr_save_enable_kernel_sme (); -/* -* We mask out SMPS since even if the hardware -* supports priorities the kernel does not at present -* and we block access to them. -*/ - info->reg_smidr =read_cpuid (SMIDR_EL1 ) & ~SMIDR_EL1_SMPS ; -/* Probe vector lengths */ if (!system_capabilities_finalized ())vec_update_vq_map (ARM64_VEC_SME );
arch/arm64/kernel/cpuinfo.c +10 -0
@@ -482,6 +482,16 @@ static void __cpuinfo_store_cpu(struct cif (id_aa64pfr0_mpam (info->reg_id_aa64pfr0)) info->reg_mpamidr =read_cpuid (MPAMIDR_EL1 ); +if (IS_ENABLED (CONFIG_ARM64_SME ) && +id_aa64pfr1_sme (info->reg_id_aa64pfr1)) { +/* +* We mask out SMPS since even if the hardware +* supports priorities the kernel does not at present +* and we block access to them. +*/ + info->reg_smidr =read_cpuid (SMIDR_EL1 ) & ~SMIDR_EL1_SMPS ; + } +cpuinfo_detect_icache_policy (info); }
Greg Kroah-Hartman
maintainerPATCH 163/443 arm64/mm: Reduce PA space to 48 bits when LPA2 is not enabled
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ard Biesheuvel <[email protected]>
commit bf74bb73cd87c64bd5afc1fd4b749029997b6170 upstream.
Currently, LPA2 kernel support implies support for up to 52 bits of physical addressing, and this is reflected in global definitions such as PHYS_MASK_SHIFT and MAX_PHYSMEM_BITS.
This is potentially problematic, given that LPA2 hardware support is modeled as a CPU feature which can be overridden, and with LPA2 hardware support turned off, attempting to map physical regions with address bits [51:48] set (which may exist on LPA2 capable systems booting with arm64.nolva) will result in corrupted mappings with a truncated output address and bogus shareability attributes.
This means that the accepted physical address range in the mapping routines should be at most 48 bits wide when LPA2 support is configured but not enabled at runtime.
--- arch/arm64/include/asm/pgtable-hwdef.h | 6 ------ arch/arm64/include/asm/pgtable-prot.h | 7 +++++++ arch/arm64/include/asm/sparsemem.h | 5 ++++- 3 files changed, 11 insertions(+), 7 deletions(-)
arch/arm64/include/asm/pgtable-hwdef.h +0 -6
@@ -222,12 +222,6 @@*/ #define S1_TABLE_AP (_AT(pmdval_t, 3) << 61) -/* -* Highest possible physical address supported. -*/ -#define PHYS_MASK_SHIFT (CONFIG_ARM64_PA_BITS) -#define PHYS_MASK ((UL(1) << PHYS_MASK_SHIFT) - 1) -#define TTBR_CNP_BIT (UL(1) << 0)/*
arch/arm64/include/asm/pgtable-prot.h +7 -0
@@ -81,6 +81,7 @@ extern unsigned long prot_ns_shared;#define lpa2_is_enabled () false#define PTE_MAYBE_SHARED PTE_SHARED#define PMD_MAYBE_SHARED PMD_SECT_S +#define PHYS_MASK_SHIFT (CONFIG_ARM64_PA_BITS)#else static inline bool __pure lpa2_is_enabled (void ) {
@@ -89,9 +90,15 @@ static inline bool __pure lpa2_is_enable#define PTE_MAYBE_SHARED (lpa2_is_enabled() ? 0 : PTE_SHARED)#define PMD_MAYBE_SHARED (lpa2_is_enabled() ? 0 : PMD_SECT_S) +#define PHYS_MASK_SHIFT (lpa2_is_enabled() ? CONFIG_ARM64_PA_BITS : 48)#endif /* +* Highest possible physical address supported. +*/ +#define PHYS_MASK ((UL(1) << PHYS_MASK_SHIFT) - 1) + +/* * If we have userspace only BTI we don't want to mark kernel pages * guarded even if the system does support BTI. */
arch/arm64/include/asm/sparsemem.h +4 -1
@@ -5,7 +5,10 @@#ifndef __ASM_SPARSEMEM_H#define __ASM_SPARSEMEM_H -#define MAX_PHYSMEM_BITS CONFIG_ARM64_PA_BITS +#include <asm/pgtable-prot.h> + +#define MAX_PHYSMEM_BITS PHYS_MASK_SHIFT +#define MAX_POSSIBLE_PHYSMEM_BITS (52)/* * Section size must be at least 512MB for 64K base
Greg Kroah-Hartman
maintainerPATCH 164/443 KVM: arm64: timer: Always evaluate the need for a soft timer
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Zyngier <[email protected]>
commit b450dcce93bc2cf6d2bfaf5a0de88a94ebad8f89 upstream.
When updating the interrupt state for an emulated timer, we return early and skip the setup of a soft timer that runs in parallel with the guest.
While this is OK if we have set the interrupt pending, it is pretty wrong if the guest moved CVAL into the future. In that case, no timer is armed and the guest can wait for a very long time (it will take a full put/load cycle for the situation to resolve).
This is specially visible with EDK2 running at EL2, but still using the EL1 virtual timer, which in that case is fully emulated. Any key-press takes ages to be captured, as there is no UART interrupt and EDK2 relies on polling from a timer...
The fix is simply to drop the early return. If the timer interrupt is pending, we will still return early, and otherwise arm the soft timer.
--- arch/arm64/kvm/arch_timer.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/arm64/kvm/arch_timer.c +1 -3
@@ -466,10 +466,8 @@ static void timer_emulate(struct arch_titrace_kvm_timer_emulate (ctx, should_fire); -if (should_fire != ctx->irq.level) { +if (should_fire != ctx->irq.level)kvm_timer_update_irq (ctx->vcpu, should_fire, ctx); -return ; - }/* * If the timer can fire now, we don't need to have a soft timer
Greg Kroah-Hartman
maintainerPATCH 165/443 drm/rockchip: cdn-dp: Use drm_connector_helper_hpd_irq_event()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zimmermann <[email protected]>
commit 666e1960464140cc4bc9203c203097e70b54c95a upstream.
The code for detecting and updating the connector status in cdn_dp_pd_event_work() has a number of problems.
- It does not aquire the locks to call the detect helper and update the connector status. These are struct drm_mode_config.connection_mutex and struct drm_mode_config.mutex.
- It does not use drm_helper_probe_detect(), which helps with the details of locking and detection.
- It uses the connector's status field to determine a change to the connector status. The epoch_counter field is the correct one. The field signals a change even if the connector status' value did not change.
Replace the code with a call to drm_connector_helper_hpd_irq_event(), which fixes all these problems.
--- drivers/gpu/drm/rockchip/cdn-dp-core.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/gpu/drm/rockchip/cdn-dp-core.c +1 -8
@@ -947,9 +947,6 @@ static void cdn_dp_pd_event_work(struct { struct cdn_dp_device *dp = container_of(work, struct cdn_dp_device, event_work); -struct drm_connector *connector = &dp->connector; -enum drm_connector_status old_status; -int ret;mutex_lock (&dp->lock);
@@ -1009,11 +1006,7 @@ static void cdn_dp_pd_event_work(struct out:mutex_unlock (&dp->lock); - - old_status = connector->status; - connector->status = connector->funcs->detect (connector, false); -if (old_status != connector->status) -drm_kms_helper_hotplug_event (dp->drm_dev); +drm_connector_helper_hpd_irq_event (&dp->connector); } static int cdn_dp_pd_event(struct notifier_block *nb,
Greg Kroah-Hartman
maintainerPATCH 166/443 arm64: dts: rockchip: increase gmac rx_delay on rk3399-puma
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakob Unterwurzacher <[email protected]>
commit 9d241b06802c6c2176ae7aa4f9f17f8a577ed337 upstream.
During mass manufacturing, we noticed the mmc_rx_crc_error counter, as reported by "ethtool -S eth0 | grep mmc_rx_crc_error", to increase above zero during nuttcp speedtests. Most of the time, this did not affect the achieved speed, but it prompted this investigation.
Cycling through the rx_delay range on six boards (see table below) of various ages shows that there is a large good region from 0x12 to 0x35 where we see zero crc errors on all tested boards.
The old rx_delay value (0x10) seems to have always been on the edge for the KSZ9031RNX that is usually placed on Puma.
Choose "rx_delay = 0x23" to put us smack in the middle of the good region. This works fine as well with the KSZ9131RNX PHY that was used for a small number of boards during the COVID chip shortages.
Board S/N PHY rx_delay good region --------- --- -------------------- Puma TT0069903 KSZ9031RNX 0x11 0x35 Puma TT0157733 KSZ9031RNX 0x11 0x35 Puma TT0681551 KSZ9031RNX 0x12 0x37 Puma TT0681156 KSZ9031RNX 0x10 0x38 Puma 17496030079 KSZ9031RNX 0x10 0x37 (Puma v1.2 from 2017) Puma TT0681720 KSZ9131RNX 0x02 0x39 (alternative PHY used in very few boards) Intersection of good regions = 0x12 0x35 Middle of good region = 0x23
--- arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi +1 -1
@@ -182,7 +182,7 @@ snps,reset-active-low; snps,reset-delays-us = <0 10000 50000>; tx_delay = <0x10>; - rx_delay = <0x10>; + rx_delay = <0x23>; status = "okay"; };
Greg Kroah-Hartman
maintainerPATCH 167/443 remoteproc: omap: Handle ARM dma_iommu_mapping
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robin Murphy <[email protected]>
commit 1dc7c8ed7cb378dd3974387692dfa833aee718d4 upstream.
It's no longer practical for the OMAP IOMMU driver to trick arm_setup_iommu_dma_ops() into ignoring its presence, so let's use the same tactic as other IOMMU API users on 32-bit ARM and explicitly kick the arch code's dma_iommu_mapping out of the way to avoid problems.
--- drivers/remoteproc/omap_remoteproc.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/remoteproc/omap_remoteproc.c +17 -0
@@ -37,6 +37,10 @@#include <linux/platform_data/dmtimer-omap.h> +#ifdef CONFIG_ARM_DMA_USE_IOMMU +#include <asm/dma-iommu.h> +#endif +#include "omap_remoteproc.h" #include "remoteproc_internal.h"
@@ -1323,6 +1327,19 @@ static int omap_rproc_probe(struct platf/* All existing OMAP IPU and DSP processors have an MMU */ rproc->has_iommu = true; +#ifdef CONFIG_ARM_DMA_USE_IOMMU +/* +* Throw away the ARM DMA mapping that we'll never use, so it doesn't +* interfere with the core rproc->domain and we get the right DMA ops. +*/ +if (pdev->dev.archdata.mapping) { +struct dma_iommu_mapping *mapping =to_dma_iommu_mapping (&pdev->dev); + +arm_iommu_detach_device (&pdev->dev); +arm_iommu_release_mapping (mapping); + } +#endif + ret =omap_rproc_of_get_internal_memories (pdev, rproc);if (ret)return ret;
Greg Kroah-Hartman
maintainerPATCH 168/443 KVM: nVMX: Defer SVI update to vmcs01 on EOI when L2 is active w/o VID
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chao Gao <[email protected]>
commit 04bc93cf49d16d01753b95ddb5d4f230b809a991 upstream.
If KVM emulates an EOI for L1's virtual APIC while L2 is active, defer updating GUEST_INTERUPT_STATUS.SVI, i.e. the VMCS's cache of the highest in-service IRQ, until L1 is active, as vmcs01, not vmcs02, needs to track vISR. The missed SVI update for vmcs01 can result in L1 interrupts being incorrectly blocked, e.g. if there is a pending interrupt with lower priority than the interrupt that was EOI'd.
This bug only affects use cases where L1's vAPIC is effectively passed through to L2, e.g. in a pKVM scenario where L2 is L1's depriveleged host, as KVM will only emulate an EOI for L1's vAPIC if Virtual Interrupt Delivery (VID) is disabled in vmc12, and L1 isn't intercepting L2 accesses to its (virtual) APIC page (or if x2APIC is enabled, the EOI MSR).
WARN() if KVM updates L1's ISR while L2 is active with VID enabled, as an EOI from L2 is supposed to affect L2's vAPIC, but still defer the update, to try to keep L1 alive. Specifically, KVM forwards all APICv-related VM-Exits to L1 via nested_vmx_l1_wants_exit():
case EXIT_REASON_APIC_ACCESS: case EXIT_REASON_APIC_WRITE: case EXIT_REASON_EOI_INDUCED: /* * The controls for "virtualize APIC accesses," "APIC- * register virtualization," and "virtual-interrupt * delivery" only come from vmcs12. */ return true;
--- arch/x86/kvm/lapic.c | 11 +++++++++++ arch/x86/kvm/lapic.h | 1 + arch/x86/kvm/vmx/nested.c | 5 +++++ arch/x86/kvm/vmx/vmx.c | 21 +++++++++++++++++++++ arch/x86/kvm/vmx/vmx.h | 1 + 5 files changed, 39 insertions(+)
arch/x86/kvm/lapic.c +11 -0
@@ -816,6 +816,17 @@ static inline void apic_clear_isr(int ve } } +void kvm_apic_update_hwapic_isr (struct kvm_vcpu *vcpu) +{ +struct kvm_lapic *apic = vcpu->arch.apic; + +if (WARN_ON_ONCE (!lapic_in_kernel (vcpu)) || !apic->apicv_active) +return ; + +kvm_x86_call (hwapic_isr_update)(vcpu,apic_find_highest_isr (apic)); +} +EXPORT_SYMBOL_GPL (kvm_apic_update_hwapic_isr); +int kvm_lapic_find_highest_irr (struct kvm_vcpu *vcpu) {/* This may race with setting of irr in __apic_accept_irq() and
arch/x86/kvm/lapic.h +1 -0
@@ -118,6 +118,7 @@ void kvm_apic_send_ipi(struct kvm_lapicint kvm_apic_set_base (struct kvm_vcpu *vcpu,u64 value,bool host_initiated);int kvm_apic_get_state (struct kvm_vcpu *vcpu,struct kvm_lapic_state *s);int kvm_apic_set_state (struct kvm_vcpu *vcpu,struct kvm_lapic_state *s); +void kvm_apic_update_hwapic_isr (struct kvm_vcpu *vcpu);int kvm_lapic_find_highest_irr (struct kvm_vcpu *vcpu);u64 kvm_get_lapic_tscdeadline_msr (struct kvm_vcpu *vcpu);
arch/x86/kvm/vmx/nested.c +5 -0
@@ -5050,6 +5050,11 @@ void nested_vmx_vmexit(struct kvm_vcpu *kvm_make_request (KVM_REQ_APICV_UPDATE , vcpu); } +if (vmx->nested.update_vmcs01_hwapic_isr) { + vmx->nested.update_vmcs01_hwapic_isr = false; +kvm_apic_update_hwapic_isr (vcpu); + } +if ((vm_exit_reason !=-1 ) && (enable_shadow_vmcs ||nested_vmx_is_evmptr12_valid (vmx))) vmx->nested.need_vmcs12_to_shadow_sync = true;
arch/x86/kvm/vmx/vmx.c +21 -0
@@ -6867,6 +6867,27 @@ void vmx_hwapic_isr_update(struct kvm_vcu16 status;u8 old; +/* +* If L2 is active, defer the SVI update until vmcs01 is loaded, as SVI +* is only relevant for if and only if Virtual Interrupt Delivery is +* enabled in vmcs12, and if VID is enabled then L2 EOIs affect L2's +* vAPIC, not L1's vAPIC. KVM must update vmcs01 on the next nested +* VM-Exit, otherwise L1 with run with a stale SVI. +*/ +if (is_guest_mode (vcpu)) { +/* +* KVM is supposed to forward intercepted L2 EOIs to L1 if VID +* is enabled in vmcs12; as above, the EOIs affect L2's vAPIC. +* Note, userspace can stuff state while L2 is active; assert +* that VID is disabled if and only if the vCPU is in KVM_RUN +* to avoid false positives if userspace is setting APIC state. +*/ +WARN_ON_ONCE (vcpu->wants_to_run && +nested_cpu_has_vid (get_vmcs12 (vcpu))); +to_vmx (vcpu)->nested.update_vmcs01_hwapic_isr = true; +return ; + } +if (max_isr ==-1 ) max_isr =0 ;
arch/x86/kvm/vmx/vmx.h +1 -0
@@ -176,6 +176,7 @@ struct nested_vmx {bool reload_vmcs01_apic_access_page;bool update_vmcs01_cpu_dirty_logging;bool update_vmcs01_apicv_status; +bool update_vmcs01_hwapic_isr;/* * Enlightened VMCS has been enabled. It does not mean that L1 has to
Greg Kroah-Hartman
maintainerPATCH 169/443 KVM: Explicitly verify target vCPU is online in kvm_get_vcpu()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 1e7381f3617d14b3c11da80ff5f8a93ab14cfc46 upstream.
Explicitly verify the target vCPU is fully online _prior_ to clamping the index in kvm_get_vcpu(). If the index is "bad", the nospec clamping will generate '0', i.e. KVM will return vCPU0 instead of NULL.
In practice, the bug is unlikely to cause problems, as it will only come into play if userspace or the guest is buggy or misbehaving, e.g. KVM may send interrupts to vCPU0 instead of dropping them on the floor.
However, returning vCPU0 when it shouldn't exist per online_vcpus is problematic now that KVM uses an xarray for the vCPUs array, as KVM needs to insert into the xarray before publishing the vCPU to userspace (see commit c5b077549136 ("KVM: Convert the kvm->vcpus array to a xarray")), i.e. before vCPU creation is guaranteed to succeed.
As a result, incorrectly providing access to vCPU0 will trigger a use-after-free if vCPU0 is dereferenced and kvm_vm_ioctl_create_vcpu() bails out of vCPU creation due to an error and frees vCPU0. Commit afb2acb2e3a3 ("KVM: Fix vcpu_array[0] races") papered over that issue, but in doing so introduced an unsolvable teardown conundrum. Preventing accesses to vCPU0 before it's fully online will allow reverting commit afb2acb2e3a3, without re-introducing the vcpu_array[0] UAF race.
--- include/linux/kvm_host.h | 9 +++++++++ 1 file changed, 9 insertions(+)
include/linux/kvm_host.h +9 -0
@@ -963,6 +963,15 @@ static inline struct kvm_io_bus *kvm_getstatic inline struct kvm_vcpu *kvm_get_vcpu (struct kvm *kvm,int i) {int num_vcpus =atomic_read (&kvm->online_vcpus); + +/* +* Explicitly verify the target vCPU is online, as the anti-speculation +* logic only limits the CPU's ability to speculate, e.g. given a "bad" +* index, clamping the index to 0 would return vCPU0, not NULL. +*/ +if (i >= num_vcpus) +return NULL ; + i =array_index_nospec (i, num_vcpus);/* Pairs with smp_wmb() in kvm_vm_ioctl_create_vcpu. */
Greg Kroah-Hartman
maintainerPATCH 170/443 kvm: defer huge page recovery vhost task to later
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Keith Busch <[email protected]>
commit 931656b9e2ff7029aee0b36e17780621948a6ac1 upstream.
Some libraries want to ensure they are single threaded before forking, so making the kernel's kvm huge page recovery process a vhost task of the user process breaks those. The minijail library used by crosvm is one such affected application.
Defer the task to after the first VM_RUN call, which occurs after the parent process has forked all its jailed processes. This needs to happen only once for the kvm instance, so introduce some general-purpose infrastructure for that, too. It's similar in concept to pthread_once; except it is actually usable, because the callback takes a parameter.
Message-ID: <[email protected]>
--- arch/x86/include/asm/kvm_host.h | 2 + arch/x86/kvm/mmu/mmu.c | 18 +++++++++++----- arch/x86/kvm/x86.c | 7 +++++- include/linux/call_once.h | 45 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 66 insertions(+), 6 deletions(-) create mode 100644 include/linux/call_once.h
arch/x86/include/asm/kvm_host.h +2 -0
@@ -27,6 +27,7 @@#include <linux/hyperv.h> #include <linux/kfifo.h> #include <linux/sched/vhost_task.h> +#include <linux/call_once.h> #include <asm/apic.h> #include <asm/pvclock-abi.h>
@@ -1445,6 +1446,7 @@ struct kvm_arch {struct kvm_x86_pmu_event_filter __rcu *pmu_event_filter;struct vhost_task *nx_huge_page_recovery_thread;u64 nx_huge_page_last; +struct once nx_once;#ifdef CONFIG_X86_64 /* The number of TDP MMU pages across all roots. */
arch/x86/kvm/mmu/mmu.c +13 -5
@@ -7411,20 +7411,28 @@ static bool kvm_nx_huge_page_recovery_woreturn true; } -int kvm_mmu_post_init_vm (struct kvm *kvm) +static void kvm_mmu_start_lpage_recovery (struct once *once) { -if (nx_hugepage_mitigation_hard_disabled) -return 0 ; + struct kvm_arch *ka = container_of(once, struct kvm_arch, nx_once); + struct kvm *kvm = container_of(ka, struct kvm, arch); kvm->arch.nx_huge_page_last =get_jiffies_64 (); kvm->arch.nx_huge_page_recovery_thread =vhost_task_create ( kvm_nx_huge_page_recovery_worker, kvm_nx_huge_page_recovery_worker_kill, kvm,"kvm-nx-lpage-recovery" ); +if (kvm->arch.nx_huge_page_recovery_thread) +vhost_task_start (kvm->arch.nx_huge_page_recovery_thread); +} + +int kvm_mmu_post_init_vm (struct kvm *kvm) +{ +if (nx_hugepage_mitigation_hard_disabled) +return 0 ; + +call_once (&kvm->arch.nx_once, kvm_mmu_start_lpage_recovery);if (!kvm->arch.nx_huge_page_recovery_thread)return -ENOMEM ; - -vhost_task_start (kvm->arch.nx_huge_page_recovery_thread);return 0 ; }
arch/x86/kvm/x86.c +6 -1
@@ -11463,6 +11463,10 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vstruct kvm_run *kvm_run = vcpu->run;int r; + r =kvm_mmu_post_init_vm (vcpu->kvm); +if (r) +return r; +vcpu_load (vcpu);kvm_sigset_activate (vcpu); kvm_run->flags =0 ;
@@ -12742,7 +12746,8 @@ out:int kvm_arch_post_init_vm (struct kvm *kvm) { -return kvm_mmu_post_init_vm (kvm); +once_init (&kvm->arch.nx_once); +return 0 ; }static void kvm_unload_vcpu_mmu (struct kvm_vcpu *vcpu)
include/linux/call_once.h new file +45 -0
45 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 171/443 KVM: s390: vsie: fix some corner-cases when grabbing vsie pages
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <[email protected]>
commit 5f230f41fdd9e799f43a699348dc572bca7159aa upstream.
We try to reuse the same vsie page when re-executing the vsie with a given SCB address. The result is that we use the same shadow SCB -- residing in the vsie page -- and can avoid flushing the TLB when re-running the vsie on a CPU.
So, when we allocate a fresh vsie page, or when we reuse a vsie page for a different SCB address -- reusing the shadow SCB in different context -- we set ihcpu=0xffff to trigger the flush.
However, after we looked up the SCB address in the radix tree, but before we grabbed the vsie page by raising the refcount to 2, someone could reuse the vsie page for a different SCB address, adjusting page->index and the radix tree. In that case, we would be reusing the vsie page with a wrong page->index.
Another corner case is that we might set the SCB address for a vsie page, but fail the insertion into the radix tree. Whoever would reuse that page would remove the corresponding radix tree entry -- which might now be a valid entry pointing at another page, resulting in the wrong vsie page getting removed from the radix tree.
Let's handle such races better, by validating that the SCB address of a vsie page didn't change after we grabbed it (not reuse for a different SCB; the alternative would be performing another tree lookup), and by setting the SCB address to invalid until the insertion in the tree succeeded (SCB addresses are aligned to 512, so ULONG_MAX is invalid).
These scenarios are rare, the effects a bit unclear, and these issues were only found by code inspection. Let's CC stable to be safe.
Message-ID: <[email protected]>
--- arch/s390/kvm/vsie.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
arch/s390/kvm/vsie.c +19 -6
@@ -1362,8 +1362,14 @@ static struct vsie_page *get_vsie_page(s page =radix_tree_lookup (&kvm->arch.vsie.addr_to_page, addr >>9 );rcu_read_unlock ();if (page) { -if (page_ref_inc_return (page) ==2 ) -return page_to_virt (page); +if (page_ref_inc_return (page) ==2 ) { +if (page->index == addr) +return page_to_virt (page); +/* +* We raced with someone reusing + putting this vsie +* page before we grabbed it. +*/ + }page_ref_dec (page); }
@@ -1393,15 +1399,20 @@ static struct vsie_page *get_vsie_page(s kvm->arch.vsie.next++; kvm->arch.vsie.next %= nr_vcpus; } -radix_tree_delete (&kvm->arch.vsie.addr_to_page, page->index >>9 ); +if (page->index !=ULONG_MAX ) +radix_tree_delete (&kvm->arch.vsie.addr_to_page, + page->index >>9 ); } - page->index = addr; -/* double use of the same address */ +/* Mark it as invalid until it resides in the tree. */ + page->index =ULONG_MAX ; + +/* Double use of the same address or allocation failure. */ if (radix_tree_insert (&kvm->arch.vsie.addr_to_page, addr >>9 , page)) {page_ref_dec (page);mutex_unlock (&kvm->arch.vsie.mutex);return NULL ; } + page->index = addr;mutex_unlock (&kvm->arch.vsie.mutex); vsie_page =page_to_virt (page);
@@ -1496,7 +1507,9 @@ void kvm_s390_vsie_destroy(struct kvm *k vsie_page =page_to_virt (page);release_gmap_shadow (vsie_page);/* free the radix tree entry */ -radix_tree_delete (&kvm->arch.vsie.addr_to_page, page->index >>9 ); +if (page->index !=ULONG_MAX ) +radix_tree_delete (&kvm->arch.vsie.addr_to_page, + page->index >>9 );__free_page (page); } kvm->arch.vsie.page_count =0 ;
Greg Kroah-Hartman
maintainerPATCH 172/443 ksmbd: fix integer overflows on 32 bit systems
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit aab98e2dbd648510f8f51b83fbf4721206ccae45 upstream.
On 32bit systems the addition operations in ipc_msg_alloc() can potentially overflow leading to memory corruption.
Add bounds checking using KSMBD_IPC_MAX_PAYLOAD to avoid overflow.
--- fs/smb/server/transport_ipc.c | 9 +++++++++ 1 file changed, 9 insertions(+)
fs/smb/server/transport_ipc.c +9 -0
@@ -626,6 +626,9 @@ ksmbd_ipc_spnego_authen_request(const chstruct ksmbd_spnego_authen_request *req;struct ksmbd_spnego_authen_response *resp; +if (blob_len >KSMBD_IPC_MAX_PAYLOAD ) +return NULL ; + msg =ipc_msg_alloc (sizeof (struct ksmbd_spnego_authen_request ) + blob_len +1 );if (!msg)
@@ -805,6 +808,9 @@ struct ksmbd_rpc_command *ksmbd_rpc_writstruct ksmbd_rpc_command *req;struct ksmbd_rpc_command *resp; +if (payload_sz >KSMBD_IPC_MAX_PAYLOAD ) +return NULL ; + msg =ipc_msg_alloc (sizeof (struct ksmbd_rpc_command ) + payload_sz +1 );if (!msg)return NULL ;
@@ -853,6 +859,9 @@ struct ksmbd_rpc_command *ksmbd_rpc_ioctstruct ksmbd_rpc_command *req;struct ksmbd_rpc_command *resp; +if (payload_sz >KSMBD_IPC_MAX_PAYLOAD ) +return NULL ; + msg =ipc_msg_alloc (sizeof (struct ksmbd_rpc_command ) + payload_sz +1 );if (!msg)return NULL ;
Greg Kroah-Hartman
maintainerPATCH 173/443 drm/amd/display: Optimize cursor position updates
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aric Cyr <[email protected]>
commit 024771f3fb75dc817e9429d5763f1a6eb84b6f21 upstream.
[why]
Updating the cursor enablement register can be a slow operation and accumulates when high polling rate cursors cause frequent updates asynchronously to the cursor position.
[how]
Since the cursor enable bit is cached there is no need to update the enablement register if there is no change to it. This removes the read-modify-write from the cursor position programming path in HUBP and DPP, leaving only the register writes.
--- drivers/gpu/drm/amd/display/dc/dpp/dcn10/dcn10_dpp.c | 7 ++++--- drivers/gpu/drm/amd/display/dc/dpp/dcn401/dcn401_dpp_cm.c | 6 ++++-- drivers/gpu/drm/amd/display/dc/hubp/dcn20/dcn20_hubp.c | 8 +++++--- drivers/gpu/drm/amd/display/dc/hubp/dcn401/dcn401_hubp.c | 10 ++++++---- 4 files changed, 19 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/display/dc/dpp/dcn10/dcn10_dpp.c +4 -3
@@ -483,10 +483,11 @@ void dpp1_set_cursor_position(if (src_y_offset + cursor_height <=0 ) cur_en =0 ;/* not visible beyond top edge*/ -REG_UPDATE (CURSOR0_CONTROL , -CUR0_ENABLE , cur_en); +if (dpp_base->pos.cur0_ctl.bits.cur0_enable != cur_en) { +REG_UPDATE (CURSOR0_CONTROL ,CUR0_ENABLE , cur_en); - dpp_base->pos.cur0_ctl.bits.cur0_enable = cur_en; + dpp_base->pos.cur0_ctl.bits.cur0_enable = cur_en; + } } void dpp1_cnv_set_optional_cursor_attributes(
drivers/gpu/drm/amd/display/dc/dpp/dcn401/dcn401_dpp_cm.c +4 -2
@@ -154,9 +154,11 @@ void dpp401_set_cursor_position(struct dcn401_dpp *dpp =TO_DCN401_DPP (dpp_base);uint32_t cur_en = pos->enable ?1 :0 ; -REG_UPDATE (CURSOR0_CONTROL ,CUR0_ENABLE , cur_en); +if (dpp_base->pos.cur0_ctl.bits.cur0_enable != cur_en) { +REG_UPDATE (CURSOR0_CONTROL ,CUR0_ENABLE , cur_en); - dpp_base->pos.cur0_ctl.bits.cur0_enable = cur_en; + dpp_base->pos.cur0_ctl.bits.cur0_enable = cur_en; + } } void dpp401_set_optional_cursor_attributes(
drivers/gpu/drm/amd/display/dc/hubp/dcn20/dcn20_hubp.c +5 -3
@@ -1044,11 +1044,13 @@ void hubp2_cursor_set_position(if (src_y_offset + cursor_height <=0 ) cur_en =0 ;/* not visible beyond top edge*/ -if (cur_en &®_READ (CURSOR_SURFACE_ADDRESS ) ==0 ) - hubp->funcs->set_cursor_attributes (hubp, &hubp->curs_attr); +if (hubp->pos.cur_ctl.bits.cur_enable != cur_en) { +if (cur_en &®_READ (CURSOR_SURFACE_ADDRESS ) ==0 ) + hubp->funcs->set_cursor_attributes (hubp, &hubp->curs_attr); -REG_UPDATE (CURSOR_CONTROL , +REG_UPDATE (CURSOR_CONTROL ,CURSOR_ENABLE , cur_en); + } REG_SET_2(CURSOR_POSITION, 0, CURSOR_X_POSITION, pos->x,
drivers/gpu/drm/amd/display/dc/hubp/dcn401/dcn401_hubp.c +6 -4
@@ -718,11 +718,13 @@ void hubp401_cursor_set_position(dc_fixpt_from_int (dst_x_offset), param->h_scale_ratio)); -if (cur_en &®_READ (CURSOR_SURFACE_ADDRESS ) ==0 ) - hubp->funcs->set_cursor_attributes (hubp, &hubp->curs_attr); +if (hubp->pos.cur_ctl.bits.cur_enable != cur_en) { +if (cur_en &®_READ (CURSOR_SURFACE_ADDRESS ) ==0 ) + hubp->funcs->set_cursor_attributes (hubp, &hubp->curs_attr); -REG_UPDATE (CURSOR_CONTROL , -CURSOR_ENABLE , cur_en); +REG_UPDATE (CURSOR_CONTROL , +CURSOR_ENABLE , cur_en); + } REG_SET_2(CURSOR_POSITION, 0, CURSOR_X_POSITION, x_pos,
Greg Kroah-Hartman
maintainerPATCH 174/443 drm/amd/pm: Mark MM activity as unsupported
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lijo Lazar <[email protected]>
commit 819bf6662b93a5a8b0c396d2c7e7fab6264c9808 upstream.
Aldebaran doesn't support querying MM activity percentage. Keep the field as 0xFFs to mark it as unsupported.
--- drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c +0 -1
@@ -1732,7 +1732,6 @@ static ssize_t aldebaran_get_gpu_metrics gpu_metrics->average_gfx_activity = metrics.AverageGfxActivity; gpu_metrics->average_umc_activity = metrics.AverageUclkActivity; - gpu_metrics->average_mm_activity =0 ;/* Valid power data is available only from primary die */ if (aldebaran_is_primary (smu)) {
Greg Kroah-Hartman
maintainerPATCH 175/443 drm/amd/amdgpu: change the config of cgcg on gfx12
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kenneth Feng <[email protected]>
commit 5cda56bd86c455341087dca29c65dc7c87f84340 upstream.
change the config of cgcg on gfx12
--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 11 ----------- 1 file changed, 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +0 -11
@@ -3999,17 +3999,6 @@ static void gfx_v12_0_update_coarse_graiif (def != data)WREG32_SOC15 (GC ,0 , regRLC_CGCG_CGLS_CTRL_3D, data); - - data =RREG32_SOC15 (GC ,0 , regSDMA0_RLC_CGCG_CTRL); - data &= ~SDMA0_RLC_CGCG_CTRL__CGCG_INT_ENABLE_MASK ; -WREG32_SOC15 (GC ,0 , regSDMA0_RLC_CGCG_CTRL, data); - -/* Some ASICs only have one SDMA instance, not need to configure SDMA1 */ -if (adev->sdma.num_instances >1 ) { - data =RREG32_SOC15 (GC ,0 , regSDMA1_RLC_CGCG_CTRL); - data &= ~SDMA1_RLC_CGCG_CTRL__CGCG_INT_ENABLE_MASK ; -WREG32_SOC15 (GC ,0 , regSDMA1_RLC_CGCG_CTRL, data); - } } }
Greg Kroah-Hartman
maintainerPATCH 176/443 drm/amdkfd: only flush the validate MES contex
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Prike Liang <[email protected]>
commit 9078a5bfa21e78ae68b6d7c365d1b92f26720c55 upstream.
The following page fault was observed duringthe KFD process release. In this particular error case, the HIP test (./MemcpyPerformance -h) does not require the queue. As a result, the process_context_addr was not assigned when the KFD process was released, ultimately leading to this page fault during the execution of the function kfd_process_dequeue_from_all_devices().
[345962.294891] amdgpu 0000:03:00.0: amdgpu: [gfxhub] page fault (src_id:0 ring:153 vmid:0 pasid:0) [345962.295333] amdgpu 0000:03:00.0: amdgpu: in page starting at address 0x0000000000000000 from client 10 [345962.295775] amdgpu 0000:03:00.0: amdgpu: GCVM_L2_PROTECTION_FAULT_STATUS:0x00000B33 [345962.296097] amdgpu 0000:03:00.0: amdgpu: Faulty UTCL2 client ID: CPC (0x5) [345962.296394] amdgpu 0000:03:00.0: amdgpu: MORE_FAULTS: 0x1 [345962.296633] amdgpu 0000:03:00.0: amdgpu: WALKER_ERROR: 0x1 [345962.296876] amdgpu 0000:03:00.0: amdgpu: PERMISSION_FAULTS: 0x3 [345962.297135] amdgpu 0000:03:00.0: amdgpu: MAPPING_ERROR: 0x1 [345962.297377] amdgpu 0000:03:00.0: amdgpu: RW: 0x0 [345962.297682] amdgpu 0000:03:00.0: amdgpu: [gfxhub] page fault (src_id:0 ring:169 vmid:0 pasid:0)
--- drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +5 -2
@@ -86,9 +86,12 @@ void kfd_process_dequeue_from_device(strif (pdd->already_dequeued)return ; - +/* The MES context flush needs to filter out the case which the +* KFD process is created without setting up the MES context and +* queue for creating a compute queue. +*/ dev->dqm->ops.process_termination (dev->dqm, &pdd->qpd); -if (dev->kfd->shared_resources.enable_mes && +if (dev->kfd->shared_resources.enable_mes && !!pdd->proc_ctx_gpu_addr &&down_read_trylock (&dev->adev->reset_domain->sem)) {amdgpu_mes_flush_shader_debugger (dev->adev, pdd->proc_ctx_gpu_addr);
Greg Kroah-Hartman
maintainerPATCH 177/443 drm/amdkfd: Block per-queue reset when halt_if_hws_hang=1
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jay Cornwall <[email protected]>
commit f214b7beb00621b983e67ce97477afc3ab4b38f4 upstream.
The purpose of halt_if_hws_hang is to preserve GPU state for driver debugging when queue preemption fails. Issuing per-queue reset may kill wavefronts which caused the preemption failure.
--- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +2 -2
@@ -2325,9 +2325,9 @@ static int unmap_queues_cpsch(struct dev*/ mqd_mgr = dqm->mqd_mgrs[KFD_MQD_TYPE_HIQ ];if (mqd_mgr->check_preemption_failed (mqd_mgr, dqm->packet_mgr.priv_queue->queue->mqd)) { +while (halt_if_hws_hang) +schedule ();if (reset_queues_on_hws_hang (dqm)) { -while (halt_if_hws_hang) -schedule (); dqm->is_hws_hang = true;kfd_hws_hang (dqm); retval = -ETIME ;
Greg Kroah-Hartman
maintainerPATCH 178/443 Revert "drm/amd/display: Use HW lock mgr for PSR1"
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tom Chung <[email protected]>
commit f245b400a223a71d6d5f4c72a2cb9b573a7fc2b6 upstream.
This reverts commita2b5a9956269 ("drm/amd/display: Use HW lock mgr for PSR1")
Because it may cause system hang while connect with two edp panel.
--- drivers/gpu/drm/amd/display/dc/dce/dmub_hw_lock_mgr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dmub_hw_lock_mgr.c +1 -2
@@ -63,8 +63,7 @@ void dmub_hw_lock_mgr_inbox0_cmd(structbool should_use_dmub_lock (struct dc_link *link) { -if (link->psr_settings.psr_version ==DC_PSR_VERSION_SU_1 || - link->psr_settings.psr_version ==DC_PSR_VERSION_1 ) +if (link->psr_settings.psr_version ==DC_PSR_VERSION_SU_1 )return true;if (link->replay_settings.replay_feature_enabled)
Greg Kroah-Hartman
maintainerPATCH 179/443 drm/i915/guc: Debug print LRC state entries only if the context is pinned
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniele Ceraolo Spurio <[email protected]>
commit 57965269896313e1629a518d3971ad55f599b792 upstream.
After the context is unpinned the backing memory can also be unpinned, so any accesses via the lrc_reg_state pointer can end up in unmapped memory. To avoid that, make sure to only access that memory if the context is pinned when printing its info.
v2: fix newline alignment
--- drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +14 -6
@@ -5511,12 +5511,20 @@ static inline void guc_log_context(struc {drm_printf (p,"GuC lrc descriptor %u:\n" , ce->guc_id.id);drm_printf (p,"\tHW Context Desc: 0x%08x\n" , ce->lrc.lrca); -drm_printf (p,"\t\tLRC Head: Internal %u, Memory %u\n" , - ce->ring->head, - ce->lrc_reg_state[CTX_RING_HEAD ]); -drm_printf (p,"\t\tLRC Tail: Internal %u, Memory %u\n" , - ce->ring->tail, - ce->lrc_reg_state[CTX_RING_TAIL ]); +if (intel_context_pin_if_active (ce)) { +drm_printf (p,"\t\tLRC Head: Internal %u, Memory %u\n" , + ce->ring->head, + ce->lrc_reg_state[CTX_RING_HEAD ]); +drm_printf (p,"\t\tLRC Tail: Internal %u, Memory %u\n" , + ce->ring->tail, + ce->lrc_reg_state[CTX_RING_TAIL ]); +intel_context_unpin (ce); + }else { +drm_printf (p,"\t\tLRC Head: Internal %u, Memory not pinned\n" , + ce->ring->head); +drm_printf (p,"\t\tLRC Tail: Internal %u, Memory not pinned\n" , + ce->ring->tail); + }drm_printf (p,"\t\tContext Pin Count: %u\n" ,atomic_read (&ce->pin_count)); drm_printf(p, "\t\tGuC ID Ref Count: %u\n",
Greg Kroah-Hartman
maintainerPATCH 180/443 drm/i915: Fix page cleanup on DMA remap failure
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Geffon <[email protected]>
commit fa6182c8b13ebfdc70ebdc09161a70dd8131f3b1 upstream.
When converting to folios the cleanup path of shmem_get_pages() was missed. When a DMA remap fails and the max segment size is greater than PAGE_SIZE it will attempt to retry the remap with a PAGE_SIZEd segment size. The cleanup code isn't properly using the folio apis and as a result isn't handling compound pages correctly.
v2 -> v3:
(Ville) Just use shmem_sg_free_table() as-is in the failure path of shmem_get_pages(). shmem_sg_free_table() will clear mapping unevictable but it will be reset when it retries in shmem_sg_alloc_table().
v1 -> v2:
(Ville) Fixed locations where we were not clearing mapping unevictable.
--- drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_shmem.c +1 -5
@@ -209,8 +209,6 @@ static int shmem_get_pages(struct drm_i9struct address_space *mapping = obj->base.filp->f_mapping;unsigned int max_segment =i915_sg_segment_size (i915->drm.dev);struct sg_table *st; -struct sgt_iter sgt_iter; -struct page *page;int ret;/*
@@ -239,9 +237,7 @@ rebuild_st:* for PAGE_SIZE chunks instead may be helpful. */ if (max_segment >PAGE_SIZE ) { -for_each_sgt_page (page, sgt_iter, st) -put_page (page); -sg_free_table (st); +shmem_sg_free_table (st, mapping, false, false);kfree (st); max_segment =PAGE_SIZE ;
Greg Kroah-Hartman
maintainerPATCH 181/443 drm/ast: astdp: Fix timeout for enabling video signal
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Zimmermann <[email protected]>
commit fd39c41bcd82d5ebaaebadb944eab5598c668a90 upstream.
The ASTDP transmitter sometimes takes up to 1 second for enabling the video signal, while the timeout is only 200 msec. This results in a kernel error message. Increase the timeout to 1 second. An example of the error message is shown below.
[ 697.084433] ------------[ cut here ]------------ [ 697.091115] ast 0000:02:00.0: [drm] drm_WARN_ON(!__ast_dp_wait_enable(ast, enabled)) [ 697.091233] WARNING: CPU: 1 PID: 160 at drivers/gpu/drm/ast/ast_dp.c:232 ast_dp_set_enable+0x123/0x140 [ast] [...] [ 697.272469] RIP: 0010:ast_dp_set_enable+0x123/0x140 [ast] [...] [ 697.415283] Call Trace: [ 697.420727] <TASK> [ 697.425908] ? show_trace_log_lvl+0x196/0x2c0 [ 697.433304] ? show_trace_log_lvl+0x196/0x2c0 [ 697.440693] ? drm_atomic_helper_commit_modeset_enables+0x30a/0x470 [ 697.450115] ? ast_dp_set_enable+0x123/0x140 [ast] [ 697.458059] ? __warn.cold+0xaf/0xca [ 697.464713] ? ast_dp_set_enable+0x123/0x140 [ast] [ 697.472633] ? report_bug+0x134/0x1d0 [ 697.479544] ? handle_bug+0x58/0x90 [ 697.486127] ? exc_invalid_op+0x13/0x40 [ 697.492975] ? asm_exc_invalid_op+0x16/0x20 [ 697.500224] ? preempt_count_sub+0x14/0xc0 [ 697.507473] ? ast_dp_set_enable+0x123/0x140 [ast] [ 697.515377] ? ast_dp_set_enable+0x123/0x140 [ast] [ 697.523227] drm_atomic_helper_commit_modeset_enables+0x30a/0x470 [ 697.532388] drm_atomic_helper_commit_tail+0x58/0x90 [ 697.540400] ast_mode_config_helper_atomic_commit_tail+0x30/0x40 [ast] [ 697.550009] commit_tail+0xfe/0x1d0 [ 697.556547] drm_atomic_helper_commit+0x198/0x1c0
This is a cosmetical problem. Enabling the video signal still works even with the error message. The problem has always been present, but only recent versions of the ast driver warn about missing the timeout.
--- drivers/gpu/drm/ast/ast_dp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/ast/ast_dp.c +1 -1
@@ -195,7 +195,7 @@ static bool __ast_dp_wait_enable(structif (enabled) vgacrdf_test |=AST_IO_VGACRDF_DP_VIDEO_ENABLE ; -for (i =0 ; i <200 ; ++i) { +for (i =0 ; i <1000 ; ++i) {if (i)mdelay (1 ); vgacrdf = ast_get_index_reg_mask(ast, AST_IO_VGACRI, 0xdf,
Greg Kroah-Hartman
maintainerPATCH 182/443 drm/komeda: Add check for komeda_get_layer_fourcc_list()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Haoxiang Li <[email protected]>
commit 79fc672a092d93a7eac24fe20a571d4efd8fa5a4 upstream.
Add check for the return value of komeda_get_layer_fourcc_list() to catch the potential exception.
--- drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/arm/display/komeda/komeda_wb_connector.c +4 -0
@@ -160,6 +160,10 @@ static int komeda_wb_connector_add(struc formats =komeda_get_layer_fourcc_list (&mdev->fmt_tbl, kwb_conn->wb_layer->layer_type, &n_formats); +if (!formats) { +kfree (kwb_conn); +return -ENOMEM ; + } err = drm_writeback_connector_init(&kms->base, wb_conn, &komeda_wb_connector_funcs,
Greg Kroah-Hartman
maintainerPATCH 183/443 drm/xe/devcoredump: Move exec queue snapshot to Contexts section
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lucas De Marchi <[email protected]>
commit 042c48b73699c47d84b6ace73036e5a31a0d4cfc upstream.
Having the exec queue snapshot inside a "GuC CT" section was always wrong. Commit c28fd6c358db ("drm/xe/devcoredump: Improve section headings and add tile info") tried to fix that bug, but with that also broke the mesa tool that parses the devcoredump, hence it was reverted in commit a53da2fb25a3 ("drm/xe: Revert some changes that break a mesa debug tool").
With the mesa tool also fixed, this can propagate as a fix on both kernel and userspace side to avoid unnecessary headache for a debug feature.
--- drivers/gpu/drm/xe/xe_devcoredump.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpu/drm/xe/xe_devcoredump.c +1 -5
@@ -109,11 +109,7 @@ static ssize_t __xe_devcoredump_read(chadrm_puts (&p,"\n**** GuC CT ****\n" );xe_guc_ct_snapshot_print (ss->guc.ct, &p); -/* -* Don't add a new section header here because the mesa debug decoder -* tool expects the context information to be in the 'GuC CT' section. -*/ -/* drm_puts(&p, "\n**** Contexts ****\n"); */ +drm_puts (&p,"\n**** Contexts ****\n" );xe_guc_exec_queue_snapshot_print (ss->ge, &p);drm_puts (&p,"\n**** Job ****\n" );
Greg Kroah-Hartman
maintainerPATCH 184/443 drm/i915/dp: Iterate DSC BPP from high to low on all platforms
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jani Nikula <[email protected]>
commit 230b19bc2bcc5897d0e20b4ce7e9790a469a2db0 upstream.
Commit 1c56e9a39833 ("drm/i915/dp: Get optimal link config to have best compressed bpp") tries to find the best compressed bpp for the link. However, it iterates from max to min bpp on display 13+, and from min to max on other platforms. This presumably leads to minimum compressed bpp always being chosen on display 11-12.
Iterate from high to low on all platforms to actually use the best possible compressed bpp.
--- drivers/gpu/drm/i915/display/intel_dp.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/display/intel_dp.c +3 -4
@@ -2049,11 +2049,10 @@ icl_dsc_compute_link_config(struct intel/* Compressed BPP should be less than the Input DSC bpp */ dsc_max_bpp =min (dsc_max_bpp, pipe_bpp -1 ); -for (i =0 ; i <ARRAY_SIZE (valid_dsc_bpp); i++) { -if (valid_dsc_bpp[i] < dsc_min_bpp) +for (i =ARRAY_SIZE (valid_dsc_bpp) -1 ; i >=0 ; i--) { +if (valid_dsc_bpp[i] < dsc_min_bpp || + valid_dsc_bpp[i] > dsc_max_bpp)continue ; -if (valid_dsc_bpp[i] > dsc_max_bpp) -break ; ret = dsc_compute_link_config(intel_dp, pipe_config,
Greg Kroah-Hartman
maintainerPATCH 185/443 drm/i915: Drop 64bpp YUV formats from ICL+ SDR planes
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ville Syrjälä <[email protected]>
commit c7b49506b3ba7a62335e6f666a43f67d5cd9fd1e upstream.
I'm seeing underruns with these 64bpp YUV formats on TGL.
The weird details:
- only happens on pipe B/C/D SDR planes, pipe A SDR planes seem fine, as do all HDR planes
- somehow CDCLK related, higher CDCLK allows for bigger plane with these formats without underruns. With 300MHz CDCLK I can only go up to 1200 pixels wide or so, with 650MHz even a 3840 pixel wide plane was OK
- ICL and ADL so far appear unaffected
So not really sure what's the deal with this, but bspec does state "64-bit formats supported only on the HDR planes" so let's just drop these formats from the SDR planes. We already disallow 64bpp RGB formats.
--- drivers/gpu/drm/i915/display/skl_universal_plane.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/gpu/drm/i915/display/skl_universal_plane.c +0 -4
@@ -106,8 +106,6 @@ static const u32 icl_sdr_y_plane_formatsDRM_FORMAT_Y216 ,DRM_FORMAT_XYUV8888 , DRM_FORMAT_XVYU2101010, -DRM_FORMAT_XVYU12_16161616 , - DRM_FORMAT_XVYU16161616, }; static const u32 icl_sdr_uv_plane_formats[] = {
@@ -134,8 +132,6 @@ static const u32 icl_sdr_uv_plane_formatDRM_FORMAT_Y216 ,DRM_FORMAT_XYUV8888 , DRM_FORMAT_XVYU2101010, -DRM_FORMAT_XVYU12_16161616 , - DRM_FORMAT_XVYU16161616, }; static const u32 icl_hdr_plane_formats[] = {
Greg Kroah-Hartman
maintainerPATCH 186/443 drm/amdgpu: add a BO metadata flag to disable write compression for Vulkan
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Olšák <[email protected]>
commit 2255b40cacc2e5ef1b127770fc1808c60de4a2fc upstream.
Vulkan can't support DCC and Z/S compression on GFX12 without WRITE_COMPRESS_DISABLE in this commit or a completely different DCC interface.
AMDGPU_TILING_GFX12_SCANOUT is added because it's already used by userspace.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 8 ++++++-- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h | 2 ++ drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c | 5 +++-- include/uapi/drm/amdgpu_drm.h | 9 ++++++++- 5 files changed, 21 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -1
@@ -119,9 +119,10 @@* - 3.57.0 - Compute tunneling on GFX10+ * - 3.58.0 - Add GFX12 DCC support * - 3.59.0 - Cleared VRAM +* - 3.60.0 - Add AMDGPU_TILING_GFX12_DCC_WRITE_COMPRESS_DISABLE (Vulkan requirement) */ #define KMS_DRIVER_MAJOR 3 -#define KMS_DRIVER_MINOR 59 +#define KMS_DRIVER_MINOR 60#define KMS_DRIVER_PATCHLEVEL 0/*
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +6 -2
@@ -309,7 +309,7 @@ int amdgpu_ttm_copy_mem_to_mem(struct ammutex_lock (&adev->mman.gtt_window_lock);while (src_mm.remaining) {uint64_t from, to, cur_size, tiling_flags; -uint32_t num_type, data_format, max_com; +uint32_t num_type, data_format, max_com, write_compress_disable;struct dma_fence *next;/* Never copy more than 256MiB at once to avoid a timeout */
@@ -340,9 +340,13 @@ int amdgpu_ttm_copy_mem_to_mem(struct am max_com =AMDGPU_TILING_GET (tiling_flags,GFX12_DCC_MAX_COMPRESSED_BLOCK ); num_type =AMDGPU_TILING_GET (tiling_flags,GFX12_DCC_NUMBER_TYPE ); data_format =AMDGPU_TILING_GET (tiling_flags,GFX12_DCC_DATA_FORMAT ); + write_compress_disable = +AMDGPU_TILING_GET (tiling_flags,GFX12_DCC_WRITE_COMPRESS_DISABLE ); copy_flags |= (AMDGPU_COPY_FLAGS_SET (MAX_COMPRESSED , max_com) |AMDGPU_COPY_FLAGS_SET (NUMBER_TYPE , num_type) | -AMDGPU_COPY_FLAGS_SET (DATA_FORMAT , data_format)); +AMDGPU_COPY_FLAGS_SET (DATA_FORMAT , data_format) | +AMDGPU_COPY_FLAGS_SET (WRITE_COMPRESS_DISABLE , + write_compress_disable)); } r = amdgpu_copy_buffer(ring, from, to, cur_size, resv,
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h +2 -0
@@ -119,6 +119,8 @@ struct amdgpu_copy_mem {#define AMDGPU_COPY_FLAGS_NUMBER_TYPE_MASK 0x07#define AMDGPU_COPY_FLAGS_DATA_FORMAT_SHIFT 8#define AMDGPU_COPY_FLAGS_DATA_FORMAT_MASK 0x3f +#define AMDGPU_COPY_FLAGS_WRITE_COMPRESS_DISABLE_SHIFT 14 +#define AMDGPU_COPY_FLAGS_WRITE_COMPRESS_DISABLE_MASK 0x1#define AMDGPU_COPY_FLAGS_SET (field, value) \ (((__u32)(value) & AMDGPU_COPY_FLAGS_##field##_MASK) << AMDGPU_COPY_FLAGS_##field##_SHIFT)
drivers/gpu/drm/amd/amdgpu/sdma_v7_0.c +3 -2
@@ -1684,11 +1684,12 @@ static void sdma_v7_0_emit_copy_buffer(suint32_t byte_count, uint32_t copy_flags) { - uint32_t num_type, data_format, max_com; + uint32_t num_type, data_format, max_com, write_cm; max_com =AMDGPU_COPY_FLAGS_GET (copy_flags,MAX_COMPRESSED ); data_format =AMDGPU_COPY_FLAGS_GET (copy_flags,DATA_FORMAT ); num_type =AMDGPU_COPY_FLAGS_GET (copy_flags,NUMBER_TYPE ); + write_cm =AMDGPU_COPY_FLAGS_GET (copy_flags,WRITE_COMPRESS_DISABLE ) ?2 :1 ; ib->ptr[ib->length_dw++] =SDMA_PKT_COPY_LINEAR_HEADER_OP (SDMA_OP_COPY ) | SDMA_PKT_COPY_LINEAR_HEADER_SUB_OP(SDMA_SUBOP_COPY_LINEAR) |
@@ -1705,7 +1706,7 @@ static void sdma_v7_0_emit_copy_buffer(sif ((copy_flags & (AMDGPU_COPY_FLAGS_READ_DECOMPRESSED |AMDGPU_COPY_FLAGS_WRITE_COMPRESSED ))) ib->ptr[ib->length_dw++] =SDMA_DCC_DATA_FORMAT (data_format) |SDMA_DCC_NUM_TYPE (num_type) | ((copy_flags &AMDGPU_COPY_FLAGS_READ_DECOMPRESSED ) ?SDMA_DCC_READ_CM (2 ) :0 ) | - ((copy_flags &AMDGPU_COPY_FLAGS_WRITE_COMPRESSED ) ?SDMA_DCC_WRITE_CM (1 ) :0 ) | + ((copy_flags &AMDGPU_COPY_FLAGS_WRITE_COMPRESSED ) ?SDMA_DCC_WRITE_CM (write_cm) :0 ) |SDMA_DCC_MAX_COM (max_com) |SDMA_DCC_MAX_UCOM (1 );else ib->ptr[ib->length_dw++] =0 ;
include/uapi/drm/amdgpu_drm.h +8 -1
@@ -411,13 +411,20 @@ struct drm_amdgpu_gem_userptr {/* GFX12 and later: */ #define AMDGPU_TILING_GFX12_SWIZZLE_MODE_SHIFT 0#define AMDGPU_TILING_GFX12_SWIZZLE_MODE_MASK 0x7 -/* These are DCC recompression setting for memory management: */ +/* These are DCC recompression settings for memory management: */ #define AMDGPU_TILING_GFX12_DCC_MAX_COMPRESSED_BLOCK_SHIFT 3#define AMDGPU_TILING_GFX12_DCC_MAX_COMPRESSED_BLOCK_MASK 0x3/* 0:64B, 1:128B, 2:256B */ #define AMDGPU_TILING_GFX12_DCC_NUMBER_TYPE_SHIFT 5#define AMDGPU_TILING_GFX12_DCC_NUMBER_TYPE_MASK 0x7/* CB_COLOR0_INFO.NUMBER_TYPE */ #define AMDGPU_TILING_GFX12_DCC_DATA_FORMAT_SHIFT 8#define AMDGPU_TILING_GFX12_DCC_DATA_FORMAT_MASK 0x3f/* [0:4]:CB_COLOR0_INFO.FORMAT, [5]:MM */ +/* When clearing the buffer or moving it from VRAM to GTT, don't compress and set DCC metadata +* to uncompressed. Set when parts of an allocation bypass DCC and read raw data. */ +#define AMDGPU_TILING_GFX12_DCC_WRITE_COMPRESS_DISABLE_SHIFT 14 +#define AMDGPU_TILING_GFX12_DCC_WRITE_COMPRESS_DISABLE_MASK 0x1 +/* bit gap */ +#define AMDGPU_TILING_GFX12_SCANOUT_SHIFT 63 +#define AMDGPU_TILING_GFX12_SCANOUT_MASK 0x1/* Set/Get helpers for tiling flags. */ #define AMDGPU_TILING_SET (field, value) \
Greg Kroah-Hartman
maintainerPATCH 187/443 drm/amd/display: Fix seamless boot sequence
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lo-an Chen <[email protected]>
commit e01f07cb92513ca4b9b219ab9caa34d607bc1e2d upstream.
[WHY]
When the system powers up eDP with external monitors in seamless boot sequence, stutter get enabled before TTU and HUBP registers being programmed, which resulting in underflow.
[HOW]
Enable TTU in hubp_init.
Change the sequence that do not perpare_bandwidth and optimize_bandwidth while having seamless boot streams.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 2 +- drivers/gpu/drm/amd/display/dc/hubbub/dcn30/dcn30_hubbub.c | 3 ++- drivers/gpu/drm/amd/display/dc/hubbub/dcn31/dcn31_hubbub.c | 3 ++- drivers/gpu/drm/amd/display/dc/hubbub/dcn32/dcn32_hubbub.c | 3 ++- drivers/gpu/drm/amd/display/dc/hubbub/dcn35/dcn35_hubbub.c | 3 ++- drivers/gpu/drm/amd/display/dc/hubp/dcn30/dcn30_hubp.c | 2 ++ drivers/gpu/drm/amd/display/dc/hubp/dcn32/dcn32_hubp.c | 2 ++ drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c | 3 ++- 8 files changed, 15 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +1 -1
@@ -2063,7 +2063,7 @@ static enum dc_status dc_commit_state_nodc_enable_stereo (dc, context, dc_streams, context->stream_count); -if (context->stream_count >get_seamless_boot_stream_count (context) || +if (get_seamless_boot_stream_count (context) ==0 || context->stream_count ==0 ) {/* Must wait for no flips to be pending before doing optimize bw */ hwss_wait_for_no_pipes_pending (dc, context);
drivers/gpu/drm/amd/display/dc/hubbub/dcn30/dcn30_hubbub.c +2 -1
@@ -129,7 +129,8 @@ bool hubbub3_program_watermarks(REG_UPDATE (DCHUBBUB_ARB_DF_REQ_OUTSTAND ,DCHUBBUB_ARB_MIN_REQ_OUTSTAND ,0x1FF ); -hubbub1_allow_self_refresh_control (hubbub, !hubbub->ctx->dc->debug.disable_stutter); +if (safe_to_lower || hubbub->ctx->dc->debug.disable_stutter) +hubbub1_allow_self_refresh_control (hubbub, !hubbub->ctx->dc->debug.disable_stutter);return wm_pending; }
drivers/gpu/drm/amd/display/dc/hubbub/dcn31/dcn31_hubbub.c +2 -1
@@ -750,7 +750,8 @@ static bool hubbub31_program_watermarks(REG_UPDATE(DCHUBBUB_ARB_DF_REQ_OUTSTAND, DCHUBBUB_ARB_MIN_REQ_OUTSTAND, 0x1FF);*/ -hubbub1_allow_self_refresh_control (hubbub, !hubbub->ctx->dc->debug.disable_stutter); +if (safe_to_lower || hubbub->ctx->dc->debug.disable_stutter) +hubbub1_allow_self_refresh_control (hubbub, !hubbub->ctx->dc->debug.disable_stutter);return wm_pending; }
drivers/gpu/drm/amd/display/dc/hubbub/dcn32/dcn32_hubbub.c +2 -1
@@ -786,7 +786,8 @@ static bool hubbub32_program_watermarks(REG_UPDATE(DCHUBBUB_ARB_DF_REQ_OUTSTAND, DCHUBBUB_ARB_MIN_REQ_OUTSTAND, 0x1FF);*/ -hubbub1_allow_self_refresh_control (hubbub, !hubbub->ctx->dc->debug.disable_stutter); +if (safe_to_lower || hubbub->ctx->dc->debug.disable_stutter) +hubbub1_allow_self_refresh_control (hubbub, !hubbub->ctx->dc->debug.disable_stutter);hubbub32_force_usr_retraining_allow (hubbub, hubbub->ctx->dc->debug.force_usr_allow);
drivers/gpu/drm/amd/display/dc/hubbub/dcn35/dcn35_hubbub.c +2 -1
@@ -326,7 +326,8 @@ static bool hubbub35_program_watermarks( DCHUBBUB_ARB_MIN_REQ_OUTSTAND_COMMIT_THRESHOLD, 0xA);/*hw delta*/REG_UPDATE (DCHUBBUB_ARB_HOSTVM_CNTL ,DCHUBBUB_ARB_MAX_QOS_COMMIT_THRESHOLD ,0xF ); -hubbub1_allow_self_refresh_control (hubbub, !hubbub->ctx->dc->debug.disable_stutter); +if (safe_to_lower || hubbub->ctx->dc->debug.disable_stutter) +hubbub1_allow_self_refresh_control (hubbub, !hubbub->ctx->dc->debug.disable_stutter);hubbub32_force_usr_retraining_allow (hubbub, hubbub->ctx->dc->debug.force_usr_allow);
drivers/gpu/drm/amd/display/dc/hubp/dcn30/dcn30_hubp.c +2 -0
@@ -484,6 +484,8 @@ void hubp3_init(struct hubp *hubp)//hubp[i].HUBPREQ_DEBUG.HUBPREQ_DEBUG[26] = 1; REG_WRITE (HUBPREQ_DEBUG ,1 <<26 ); +REG_UPDATE (DCHUBP_CNTL ,HUBP_TTU_DISABLE ,0 ); +hubp_reset (hubp); }
drivers/gpu/drm/amd/display/dc/hubp/dcn32/dcn32_hubp.c +2 -0
@@ -168,6 +168,8 @@ void hubp32_init(struct hubp *hubp) {struct dcn20_hubp *hubp2 =TO_DCN20_HUBP (hubp);REG_WRITE (HUBPREQ_DEBUG_DB ,1 <<8 ); + +REG_UPDATE (DCHUBP_CNTL ,HUBP_TTU_DISABLE ,0 ); }static struct hubp_funcs dcn32_hubp_funcs = { .hubp_enable_tripleBuffer = hubp2_enable_triplebuffer,
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c +2 -1
@@ -236,7 +236,8 @@ void dcn35_init_hw(struct dc *dc) } hws->funcs.init_pipes (dc, dc->current_state); -if (dc->res_pool->hubbub->funcs->allow_self_refresh_control) +if (dc->res_pool->hubbub->funcs->allow_self_refresh_control && + !dc->res_pool->hubbub->ctx->dc->debug.disable_stutter) dc->res_pool->hubbub->funcs->allow_self_refresh_control (dc->res_pool->hubbub, !dc->res_pool->hubbub->ctx->dc->debug.disable_stutter); }
Greg Kroah-Hartman
maintainerPATCH 188/443 drm/xe: Fix and re-enable xe_print_blob_ascii85()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lucas De Marchi <[email protected]>
commit a9ab6591b45258b79af1cb66112fd9f83c8855da upstream.
Commit 70fb86a85dc9 ("drm/xe: Revert some changes that break a mesa debug tool") partially reverted some changes to workaround breakage caused to mesa tools. However, in doing so it also broke fetching the GuC log via debugfs since xe_print_blob_ascii85() simply bails out.
The fix is to avoid the extra newlines: the devcoredump interface is line-oriented and adding random newlines in the middle breaks it. If a tool is able to parse it by looking at the data and checking for chars that are out of the ascii85 space, it can still do so. A format change that breaks the line-oriented output on devcoredump however needs better coordination with existing tools.
v2: Add suffix description comment
v3: Reword explanation of xe_print_blob_ascii85() calling drm_puts()
in a loop
--- drivers/gpu/drm/xe/xe_devcoredump.c | 34 +++++++++++++--------------------- drivers/gpu/drm/xe/xe_devcoredump.h | 2 +- drivers/gpu/drm/xe/xe_guc_ct.c | 3 ++- drivers/gpu/drm/xe/xe_guc_log.c | 4 +++- 4 files changed, 19 insertions(+), 24 deletions(-)
drivers/gpu/drm/xe/xe_devcoredump.c +13 -21
@@ -338,42 +338,34 @@ int xe_devcoredump_init(struct xe_device/** * xe_print_blob_ascii85 - print a BLOB to some useful location in ASCII85 * -* The output is split to multiple lines because some print targets, e.g. dmesg -* cannot handle arbitrarily long lines. Note also that printing to dmesg in -* piece-meal fashion is not possible, each separate call to drm_puts() has a -* line-feed automatically added! Therefore, the entire output line must be -* constructed in a local buffer first, then printed in one atomic output call. +* The output is split into multiple calls to drm_puts() because some print +* targets, e.g. dmesg, cannot handle arbitrarily long lines. These targets may +* add newlines, as is the case with dmesg: each drm_puts() call creates a +* separate line. * * There is also a scheduler yield call to prevent the 'task has been stuck for * 120s' kernel hang check feature from firing when printing to a slow target * such as dmesg over a serial port. * -* TODO: Add compression prior to the ASCII85 encoding to shrink huge buffers down. -* * @p: the printer object to output to * @prefix: optional prefix to add to output string +* @suffix: optional suffix to add at the end. 0 disables it and is +* not added to the output, which is useful when using multiple calls +* to dump data to @p * @blob: the Binary Large OBject to dump out * @offset: offset in bytes to skip from the front of the BLOB, must be a multiple of sizeof(u32) * @size: the size in bytes of the BLOB, must be a multiple of sizeof(u32) */ -void xe_print_blob_ascii85 (struct drm_printer *p,const char *prefix, +void xe_print_blob_ascii85 (struct drm_printer *p,const char *prefix,char suffix,const void *blob,size_t offset,size_t size) {const u32 *blob32 = (const u32 *)blob;char buff[ASCII85_BUFSZ ], *line_buff;size_t line_pos =0 ; -/* -* Splitting blobs across multiple lines is not compatible with the mesa -* debug decoder tool. Note that even dropping the explicit '\n' below -* doesn't help because the GuC log is so big some underlying implementation -* still splits the lines at 512K characters. So just bail completely for -* the moment. -*/ -return ; -#define DMESG_MAX_LINE_LEN 800 -#define MIN_SPACE (ASCII85_BUFSZ + 2)/* 85 + "\n\0" */ +/* Always leave space for the suffix char and the \0 */ +#define MIN_SPACE (ASCII85_BUFSZ + 2)/* 85 + "<suffix>\0" */ if (size &3 )drm_printf (p,"Size not word aligned: %zu" , size);
@@ -405,7 +397,6 @@ void xe_print_blob_ascii85(struct drm_pr line_pos +=strlen (line_buff + line_pos);if ((line_pos +MIN_SPACE ) >=DMESG_MAX_LINE_LEN ) { - line_buff[line_pos++] ='\n' ; line_buff[line_pos++] =0 ;drm_puts (p, line_buff);
@@ -417,10 +408,11 @@ void xe_print_blob_ascii85(struct drm_pr } } +if (suffix) + line_buff[line_pos++] = suffix; +if (line_pos) { - line_buff[line_pos++] ='\n' ; line_buff[line_pos++] =0 ; -drm_puts (p, line_buff); }
drivers/gpu/drm/xe/xe_devcoredump.h +1 -1
@@ -26,7 +26,7 @@ static inline int xe_devcoredump_init(st }#endif -void xe_print_blob_ascii85 (struct drm_printer *p,const char *prefix, +void xe_print_blob_ascii85 (struct drm_printer *p,const char *prefix,char suffix,const void *blob,size_t offset,size_t size);#endif
drivers/gpu/drm/xe/xe_guc_ct.c +2 -1
@@ -1700,7 +1700,8 @@ void xe_guc_ct_snapshot_print(struct xe_ snapshot->g2h_outstanding);if (snapshot->ctb) -xe_print_blob_ascii85 (p,"CTB data" , snapshot->ctb,0 , snapshot->ctb_size); +xe_print_blob_ascii85 (p,"CTB data" ,'\n' , + snapshot->ctb,0 , snapshot->ctb_size); }else {drm_puts (p,"CT disabled\n" ); }
drivers/gpu/drm/xe/xe_guc_log.c +3 -1
@@ -211,8 +211,10 @@ void xe_guc_log_snapshot_print(struct xe remain = snapshot->size;for (i =0 ; i < snapshot->num_chunks; i++) {size_t size =min (GUC_LOG_CHUNK_SIZE , remain); +const char *prefix = i ?NULL :"Log data" ; +char suffix = i == snapshot->num_chunks -1 ?'\n' :0 ; -xe_print_blob_ascii85 (p, i ?NULL :"Log data" , snapshot->copy[i],0 , size); +xe_print_blob_ascii85 (p, prefix, suffix, snapshot->copy[i],0 , size); remain -= size; } }
Greg Kroah-Hartman
maintainerPATCH 189/443 Bluetooth: L2CAP: handle NULL sock pointer in l2cap_sock_alloc
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
commit 5f397409f8ee5bc82901eeaf799e1cbc4f8edcf1 upstream.
A NULL sock pointer is passed into l2cap_sock_alloc() when it is called from l2cap_sock_new_connection_cb() and the error handling paths should also be aware of it.
Seemingly a more elegant solution would be to swap bt_sock_alloc() and l2cap_chan_create() calls since they are not interdependent to that moment but then l2cap_chan_create() adds the soon to be deallocated and still dummy-initialized channel to the global list accessible by many L2CAP paths. The channel would be removed from the list in short period of time but be a bit more straight-forward here and just check for NULL instead of changing the order of function calls.
Found by Linux Verification Center (linuxtesting.org) with SVACE static analysis tool.
--- net/bluetooth/l2cap_sock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/bluetooth/l2cap_sock.c +2 -1
@@ -1888,7 +1888,8 @@ static struct sock *l2cap_sock_alloc(str chan =l2cap_chan_create ();if (!chan) {sk_free (sk); - sock->sk =NULL ; +if (sock) + sock->sk =NULL ;return NULL ; }
Greg Kroah-Hartman
maintainerPATCH 190/443 Bluetooth: L2CAP: accept zero as a special value for MTU auto-selection
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fedor Pchelkin <[email protected]>
commit 5c61419e02033eaf01733d66e2fcd4044808f482 upstream.
One of the possible ways to enable the input MTU auto-selection for L2CAP connections is supposed to be through passing a special "0" value for it as a socket option. Commit [1] added one of those into avdtp. However, it simply wouldn't work because the kernel still treats the specified value as invalid and denies the setting attempt. Recorded BlueZ logs include the following:
bluetoothd[496]: profiles/audio/avdtp.c:l2cap_connect() setsockopt(L2CAP_OPTIONS): Invalid argument (22)
[1]: https://github.com/bluez/bluez/commit/ae5be371a9f53fed33d2b34748a95a5498fd4b77
Found by Linux Verification Center (linuxtesting.org).
--- net/bluetooth/l2cap_sock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/bluetooth/l2cap_sock.c +2 -2
@@ -710,12 +710,12 @@ static bool l2cap_valid_mtu(struct l2cap {switch (chan->scid) {case L2CAP_CID_ATT : -if (mtu <L2CAP_LE_MIN_MTU ) +if (mtu && mtu <L2CAP_LE_MIN_MTU )return false;break ;default : -if (mtu <L2CAP_DEFAULT_MIN_MTU ) +if (mtu && mtu <L2CAP_DEFAULT_MIN_MTU )return false; }
Greg Kroah-Hartman
maintainerPATCH 191/443 KEYS: trusted: dcp: fix improper sg use with CONFIG_VMAP_STACK=y
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Gstir <[email protected]>
commit e8d9fab39d1f87b52932646b2f1e7877aa3fc0f4 upstream.
With vmalloc stack addresses enabled (CONFIG_VMAP_STACK=y) DCP trusted keys can crash during en- and decryption of the blob encryption key via the DCP crypto driver. This is caused by improperly using sg_init_one() with vmalloc'd stack buffers (plain_key_blob).
Fix this by always using kmalloc() for buffers we give to the DCP crypto driver.
--- security/keys/trusted-keys/trusted_dcp.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
security/keys/trusted-keys/trusted_dcp.c +18 -4
@@ -201,12 +201,16 @@ static int trusted_dcp_seal(struct trust {struct dcp_blob_fmt *b = (struct dcp_blob_fmt *)p->blob;int blen, ret; -u8 plain_blob_key[AES_KEYSIZE_128 ]; +u8 *plain_blob_key; blen =calc_blob_len (p->key_len);if (blen >MAX_BLOB_SIZE )return -E2BIG ; + plain_blob_key =kmalloc (AES_KEYSIZE_128 ,GFP_KERNEL ); +if (!plain_blob_key) +return -ENOMEM ; + b->fmt_version =DCP_BLOB_VERSION ;get_random_bytes (b->nonce,AES_KEYSIZE_128 );get_random_bytes (plain_blob_key,AES_KEYSIZE_128 );
@@ -229,7 +233,8 @@ static int trusted_dcp_seal(struct trust ret =0 ; out: -memzero_explicit (plain_blob_key,sizeof (plain_blob_key)); +memzero_explicit (plain_blob_key,AES_KEYSIZE_128 ); +kfree (plain_blob_key);return ret; }
@@ -238,7 +243,7 @@ static int trusted_dcp_unseal(struct tru {struct dcp_blob_fmt *b = (struct dcp_blob_fmt *)p->blob;int blen, ret; -u8 plain_blob_key[AES_KEYSIZE_128 ]; +u8 *plain_blob_key =NULL ;if (b->fmt_version !=DCP_BLOB_VERSION ) { pr_err("DCP blob has bad version: %i, expected %i\n",
@@ -256,6 +261,12 @@ static int trusted_dcp_unseal(struct tru goto out; } + plain_blob_key =kmalloc (AES_KEYSIZE_128 ,GFP_KERNEL ); +if (!plain_blob_key) { + ret = -ENOMEM ; + goto out; + } + ret =decrypt_blob_key (b->blob_key, plain_blob_key);if (ret) {pr_err ("Unable to decrypt blob key: %i\n" , ret);
@@ -271,7 +282,10 @@ static int trusted_dcp_unseal(struct tru ret =0 ; out: -memzero_explicit (plain_blob_key,sizeof (plain_blob_key)); +if (plain_blob_key) { +memzero_explicit (plain_blob_key,AES_KEYSIZE_128 ); +kfree (plain_blob_key); + }return ret; }
Greg Kroah-Hartman
maintainerPATCH 192/443 Input: synaptics - fix crash when enabling pass-through port
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Torokhov <[email protected]>
commit 08bd5b7c9a2401faabdaa1472d45c7de0755fd7e upstream.
When enabling a pass-through port an interrupt might come before psmouse driver binds to the pass-through port. However synaptics sub-driver tries to access psmouse instance presumably associated with the pass-through port to figure out if only 1 byte of response or entire protocol packet needs to be forwarded to the pass-through port and may crash if psmouse instance has not been attached to the port yet.
Fix the crash by introducing open() and close() methods for the port and check if the port is open before trying to access psmouse instance. Because psmouse calls serio_open() only after attaching psmouse instance to serio port instance this prevents the potential crash.
--- drivers/input/mouse/synaptics.c | 56 ++++++++++++++++++++++++++++++---------- drivers/input/mouse/synaptics.h | 1 2 files changed, 43 insertions(+), 14 deletions(-)
drivers/input/mouse/synaptics.c +42 -14
@@ -665,23 +665,50 @@ static void synaptics_pt_stop(struct ser priv->pt_port =NULL ; } +static int synaptics_pt_open (struct serio *serio) +{ +struct psmouse *parent =psmouse_from_serio (serio->parent); +struct synaptics_data *priv = parent->private; + +guard (serio_pause_rx)(parent->ps2dev.serio); + priv->pt_port_open = true; + +return 0 ; +} + +static void synaptics_pt_close (struct serio *serio) +{ +struct psmouse *parent =psmouse_from_serio (serio->parent); +struct synaptics_data *priv = parent->private; + +guard (serio_pause_rx)(parent->ps2dev.serio); + priv->pt_port_open = false; +} +static int synaptics_is_pt_packet (u8 *buf) {return (buf[0 ] &0xFC ) ==0x84 && (buf[3 ] &0xCC ) ==0xC4 ; } -static void synaptics_pass_pt_packet (struct serio *ptport,u8 *packet) +static void synaptics_pass_pt_packet (struct synaptics_data *priv,u8 *packet) { -struct psmouse *child =psmouse_from_serio (ptport); +struct serio *ptport; -if (child && child->state ==PSMOUSE_ACTIVATED ) { -serio_interrupt (ptport, packet[1 ],0 ); -serio_interrupt (ptport, packet[4 ],0 ); -serio_interrupt (ptport, packet[5 ],0 ); -if (child->pktsize ==4 ) -serio_interrupt (ptport, packet[2 ],0 ); - }else { -serio_interrupt (ptport, packet[1 ],0 ); + ptport = priv->pt_port; +if (!ptport) +return ; + +serio_interrupt (ptport, packet[1 ],0 ); + +if (priv->pt_port_open) { +struct psmouse *child =psmouse_from_serio (ptport); + +if (child->state ==PSMOUSE_ACTIVATED ) { +serio_interrupt (ptport, packet[4 ],0 ); +serio_interrupt (ptport, packet[5 ],0 ); +if (child->pktsize ==4 ) +serio_interrupt (ptport, packet[2 ],0 ); + } } }
@@ -720,6 +747,8 @@ static void synaptics_pt_create(struct p serio->write = synaptics_pt_write; serio->start = synaptics_pt_start; serio->stop = synaptics_pt_stop; + serio->open = synaptics_pt_open; + serio->close = synaptics_pt_close; serio->parent = psmouse->ps2dev.serio; psmouse->pt_activate = synaptics_pt_activate;
@@ -1216,11 +1245,10 @@ static psmouse_ret_t synaptics_process_bif (SYN_CAP_PASS_THROUGH (priv->info.capabilities) &&synaptics_is_pt_packet (psmouse->packet)) { -if (priv->pt_port) -synaptics_pass_pt_packet (priv->pt_port, - psmouse->packet); - }else +synaptics_pass_pt_packet (priv, psmouse->packet); + }else {synaptics_process_packet (psmouse); + }return PSMOUSE_FULL_PACKET ; }
drivers/input/mouse/synaptics.h +1 -0
@@ -188,6 +188,7 @@ struct synaptics_data {bool disable_gesture;/* disable gestures */ struct serio *pt_port;/* Pass-through serio port */ +bool pt_port_open;/* * Last received Advanced Gesture Mode (AGM) packet. An AGM packet
Greg Kroah-Hartman
maintainerPATCH 193/443 clk: sunxi-ng: a100: enable MMC clock reparenting
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cody Eksal <[email protected]>
commit 16414720045de30945b8d14b7907e0cbf81a4b49 upstream.
While testing the MMC nodes proposed in [1], it was noted that mmc0/1 would fail to initialize, with "mmc: fatal err update clk timeout" in the kernel logs. A closer look at the clock definitions showed that the MMC MPs had the "CLK_SET_RATE_NO_REPARENT" flag set. No reason was given for adding this flag in the first place, and its original purpose is unknown, but it doesn't seem to make sense and results in severe limitations to MMC speeds. Thus, remove this flag from the 3 MMC MPs.
[1] https://msgid.link/[email protected]
--- drivers/clk/sunxi-ng/ccu-sun50i-a100.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clk/sunxi-ng/ccu-sun50i-a100.c +3 -3
@@ -436,7 +436,7 @@ static SUNXI_CCU_MP_WITH_MUX_GATE_POSTDI24 ,2 ,/* mux */ BIT (31 ),/* gate */ 2 ,/* post-div */ - CLK_SET_RATE_NO_REPARENT); + 0); static SUNXI_CCU_MP_WITH_MUX_GATE_POSTDIV(mmc1_clk, "mmc1", mmc_parents, 0x834, 0, 4, /* M */
@@ -444,7 +444,7 @@ static SUNXI_CCU_MP_WITH_MUX_GATE_POSTDI24 ,2 ,/* mux */ BIT (31 ),/* gate */ 2 ,/* post-div */ - CLK_SET_RATE_NO_REPARENT); + 0); static SUNXI_CCU_MP_WITH_MUX_GATE_POSTDIV(mmc2_clk, "mmc2", mmc_parents, 0x838, 0, 4, /* M */
@@ -452,7 +452,7 @@ static SUNXI_CCU_MP_WITH_MUX_GATE_POSTDI24 ,2 ,/* mux */ BIT (31 ),/* gate */ 2 ,/* post-div */ - CLK_SET_RATE_NO_REPARENT); + 0); static SUNXI_CCU_GATE(bus_mmc0_clk, "bus-mmc0", "ahb3", 0x84c, BIT(0), 0); static SUNXI_CCU_GATE(bus_mmc1_clk, "bus-mmc1", "ahb3", 0x84c, BIT(1), 0);
Greg Kroah-Hartman
maintainerPATCH 194/443 clk: mmp2: call pm_genpd_init() only after genpd.name is set
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lubomir Rintel <[email protected]>
commit e24b15d4704dcb73920c3d18a6157abd18df08c1 upstream.
Setting the genpd's struct device's name with dev_set_name() is happening within pm_genpd_init(). If it remains NULL, things can blow up later, such as when crafting the devfs hierarchy for the power domain:
Unable to handle kernel NULL pointer dereference at virtual address 00000000 when read ... Call trace: strlen from start_creating+0x90/0x138 start_creating from debugfs_create_dir+0x20/0x178 debugfs_create_dir from genpd_debug_add.part.0+0x4c/0x144 genpd_debug_add.part.0 from genpd_debug_init+0x74/0x90 genpd_debug_init from do_one_initcall+0x5c/0x244 do_one_initcall from kernel_init_freeable+0x19c/0x1f4 kernel_init_freeable from kernel_init+0x1c/0x12c kernel_init from ret_from_fork+0x14/0x28
Bisecting tracks this crash back to commit 899f44531fe6 ("pmdomain: core:
Add GENPD_FLAG_DEV_NAME_FW flag"), which exchanges use of genpd->name with dev_name(&genpd->dev) in genpd_debug_add.part().
--- drivers/clk/mmp/pwr-island.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/mmp/pwr-island.c +1 -1
@@ -106,10 +106,10 @@ struct generic_pm_domain *mmp_pm_domain_ pm_domain->flags = flags; pm_domain->lock = lock; -pm_genpd_init (&pm_domain->genpd,NULL , true); pm_domain->genpd.name = name; pm_domain->genpd.power_on = mmp_pm_domain_power_on; pm_domain->genpd.power_off = mmp_pm_domain_power_off; +pm_genpd_init (&pm_domain->genpd,NULL , true);return &pm_domain->genpd; }
Greg Kroah-Hartman
maintainerPATCH 195/443 media: i2c: ds90ub960: Fix UB9702 refclk register access
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomi Valkeinen <[email protected]>
commit ba3bdb93947c90f098061de1fb2458e2ca040093 upstream.
UB9702 has the refclk freq register at a different offset than UB960, but the code uses the UB960's offset for both chips. Fix this.
The refclk freq is only used for a debug print, so there's no functional change here.
--- drivers/media/i2c/ds90ub960.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/media/i2c/ds90ub960.c +6 -1
@@ -351,6 +351,8 @@#define UB960_SR_I2C_RX_ID (n) (0xf8 + (n))/* < UB960_FPD_RX_NPORTS */ +#define UB9702_SR_REFCLK_FREQ 0x3d +/* Indirect register blocks */ #define UB960_IND_TARGET_PAT_GEN 0x00#define UB960_IND_TARGET_RX_ANA (n) (0x01 + (n))
@@ -3834,7 +3836,10 @@ static int ub960_enable_core_hw(struct uif (ret) goto err_pd_gpio; - ret =ub960_read (priv,UB960_XR_REFCLK_FREQ , &refclk_freq); +if (priv->hw_data->is_ub9702) + ret =ub960_read (priv,UB9702_SR_REFCLK_FREQ , &refclk_freq); +else + ret =ub960_read (priv,UB960_XR_REFCLK_FREQ , &refclk_freq);if (ret) goto err_pd_gpio;
Greg Kroah-Hartman
maintainerPATCH 196/443 clk: clk-loongson2: Fix the number count of clk provider
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Binbin Zhou <[email protected]>
commit 5fb33b6797633ce60908d13dc06c54a101621845 upstream.
Since commit 02fb4f008433 ("clk: clk-loongson2: Fix potential buffer overflow in flexible-array member access"), the clk provider register is failed.
The count of clks_num is shown below:
for (p = data; p->name; p++) clks_num++;
In fact, clks_num represents the number of SoC clocks and should be expressed as the maximum value of the clock binding id in use (p->id + 1).
Now we fix it to avoid the following error when trying to register a clk provider:
[ 13.409595] of_clk_hw_onecell_get: invalid index 17
--- drivers/clk/clk-loongson2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/clk/clk-loongson2.c +4 -1
@@ -294,7 +294,7 @@ static int loongson2_clk_probe(struct plreturn -EINVAL ;for (p = data; p->name; p++) - clks_num++; + clks_num =max (clks_num, p->id +1 ); clp =devm_kzalloc (dev,struct_size (clp, clk_data.hws, clks_num),GFP_KERNEL );
@@ -309,6 +309,9 @@ static int loongson2_clk_probe(struct pl clp->clk_data.num = clks_num; clp->dev = dev; +/* Avoid returning NULL for unused id */ +memset_p ((void **)clp->clk_data.hws,ERR_PTR (-ENOENT ), clks_num); +for (i =0 ; i < clks_num; i++) { p = &data[i];switch (p->type) {
Greg Kroah-Hartman
maintainerPATCH 197/443 clk: qcom: clk-alpha-pll: fix alpha mode configuration
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabor Juhos <[email protected]>
commit 33f1722eb86e45320a3dd7b3d42f6593a1d595c2 upstream.
Commit c45ae598fc16 ("clk: qcom: support for alpha mode configuration") added support for configuring alpha mode, but it seems that the feature was never working in practice.
The value of the alpha_{en,mode}_mask members of the configuration gets added to the value parameter passed to the regmap_update_bits() function, however the same values are not getting applied to the bitmask. As the result, the respective bits in the USER_CTL register are never modifed which leads to improper configuration of several PLLs.
The following table shows the PLL configurations where the 'alpha_en_mask' member is set and which are passed as a parameter for the clk_alpha_pll_configure() function. In the table the 'expected rate' column shows the rate the PLL should run at with the given configuration, and the 'real rate' column shows the rate the PLL runs at actually. The real rates has been verified on hardwareOn IPQ* platforms, on other platforms, those are computed values only.
file pll expected rate real rate dispcc-qcm2290.c disp_cc_pll0 768.0 MHz 768.0 MHz dispcc-sm6115.c disp_cc_pll0 768.0 MHz 768.0 MHz gcc-ipq5018.c ubi32_pll 1000.0 MHz != 984.0 MHz gcc-ipq6018.c nss_crypto_pll 1200.0 MHz 1200.0 MHz gcc-ipq6018.c ubi32_pll 1497.6 MHz != 1488.0 MHz gcc-ipq8074.c nss_crypto_pll 1200.0 MHz != 1190.4 MHz gcc-qcm2290.c gpll11 532.0 MHz != 518.4 MHz gcc-qcm2290.c gpll8 533.2 MHz != 518.4 MHz gcc-qcs404.c gpll3 921.6 MHz 921.6 MHz gcc-sm6115.c gpll11 600.0 MHz != 595.2 MHz gcc-sm6115.c gpll8 800.0 MHz != 787.2 MHz gpucc-sdm660.c gpu_cc_pll0 800.0 MHz != 787.2 MHz gpucc-sdm660.c gpu_cc_pll1 740.0 MHz != 729.6 MHz gpucc-sm6115.c gpu_cc_pll0 1200.0 MHz != 1190.4 MHz gpucc-sm6115.c gpu_cc_pll1 640.0 MHz != 633.6 MHz gpucc-sm6125.c gpu_pll0 1020.0 MHz != 1017.6 MHz gpucc-sm6125.c gpu_pll1 930.0 MHz != 921.6 MHz mmcc-sdm660.c mmpll8 930.0 MHz != 921.6 MHz mmcc-sdm660.c mmpll5 825.0 MHz != 806.4 MHz
As it can be seen from the above, there are several PLLs which are configured incorrectly.
Change the code to apply both 'alpha_en_mask' and 'alpha_mode_mask' values to the bitmask in order to configure the alpha mode correctly.
Applying the 'alpha_en_mask' fixes the initial rate of the PLLs showed in the table above. Since the 'alpha_mode_mask' is not used by any driver currently, that part of the change causes no functional changes.
--- drivers/clk/qcom/clk-alpha-pll.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/qcom/clk-alpha-pll.c +2 -0
@@ -432,6 +432,8 @@ void clk_alpha_pll_configure(struct clk_ mask |= config->pre_div_mask; mask |= config->post_div_mask; mask |= config->vco_mask; + mask |= config->alpha_en_mask; + mask |= config->alpha_mode_mask;regmap_update_bits (regmap,PLL_USER_CTL (pll), mask, val);
Greg Kroah-Hartman
maintainerPATCH 198/443 clk: qcom: gcc-sm8550: Do not turn off PCIe GDSCs during gdsc_disable()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
commit 967e011013eda287dbec9e8bd3a19ebe730b8a08 upstream.
With PWRSTS_OFF_ON, PCIe GDSCs are turned off during gdsc_disable(). This can happen during scenarios such as system suspend and breaks the resume of PCIe controllers from suspend.
So use PWRSTS_RET_ON to indicate the GDSC driver to not turn off the GDSCs during gdsc_disable() and allow the hardware to transition the GDSCs to retention when the parent domain enters low power state during system suspend.
--- drivers/clk/qcom/gcc-sm8550.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/clk/qcom/gcc-sm8550.c +4 -4
@@ -3003,7 +3003,7 @@ static struct gdsc pcie_0_gdsc = { .pd = { .name = "pcie_0_gdsc", }, - .pwrsts = PWRSTS_OFF_ON, + .pwrsts = PWRSTS_RET_ON, .flags = VOTABLE | POLL_CFG_GDSCR | RETAIN_FF_ENABLE, };
@@ -3014,7 +3014,7 @@ static struct gdsc pcie_0_phy_gdsc = { .pd = { .name = "pcie_0_phy_gdsc", }, - .pwrsts = PWRSTS_OFF_ON, + .pwrsts = PWRSTS_RET_ON, .flags = VOTABLE | POLL_CFG_GDSCR | RETAIN_FF_ENABLE, };
@@ -3025,7 +3025,7 @@ static struct gdsc pcie_1_gdsc = { .pd = { .name = "pcie_1_gdsc", }, - .pwrsts = PWRSTS_OFF_ON, + .pwrsts = PWRSTS_RET_ON, .flags = VOTABLE | POLL_CFG_GDSCR | RETAIN_FF_ENABLE, };
@@ -3036,7 +3036,7 @@ static struct gdsc pcie_1_phy_gdsc = { .pd = { .name = "pcie_1_phy_gdsc", }, - .pwrsts = PWRSTS_OFF_ON, + .pwrsts = PWRSTS_RET_ON, .flags = VOTABLE | POLL_CFG_GDSCR | RETAIN_FF_ENABLE, };
Greg Kroah-Hartman
maintainerPATCH 199/443 clk: qcom: gcc-sm8650: Do not turn off PCIe GDSCs during gdsc_disable()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manivannan Sadhasivam <[email protected]>
commit a57465766a91c6e173876f9cbb424340e214313f upstream.
With PWRSTS_OFF_ON, PCIe GDSCs are turned off during gdsc_disable(). This can happen during scenarios such as system suspend and breaks the resume of PCIe controllers from suspend.
So use PWRSTS_RET_ON to indicate the GDSC driver to not turn off the GDSCs during gdsc_disable() and allow the hardware to transition the GDSCs to retention when the parent domain enters low power state during system suspend.
--- drivers/clk/qcom/gcc-sm8650.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/clk/qcom/gcc-sm8650.c +4 -4
@@ -3437,7 +3437,7 @@ static struct gdsc pcie_0_gdsc = { .pd = { .name = "pcie_0_gdsc", }, - .pwrsts = PWRSTS_OFF_ON, + .pwrsts = PWRSTS_RET_ON, .flags = POLL_CFG_GDSCR | RETAIN_FF_ENABLE | VOTABLE, };
@@ -3448,7 +3448,7 @@ static struct gdsc pcie_0_phy_gdsc = { .pd = { .name = "pcie_0_phy_gdsc", }, - .pwrsts = PWRSTS_OFF_ON, + .pwrsts = PWRSTS_RET_ON, .flags = POLL_CFG_GDSCR | RETAIN_FF_ENABLE | VOTABLE, };
@@ -3459,7 +3459,7 @@ static struct gdsc pcie_1_gdsc = { .pd = { .name = "pcie_1_gdsc", }, - .pwrsts = PWRSTS_OFF_ON, + .pwrsts = PWRSTS_RET_ON, .flags = POLL_CFG_GDSCR | RETAIN_FF_ENABLE | VOTABLE, };
@@ -3470,7 +3470,7 @@ static struct gdsc pcie_1_phy_gdsc = { .pd = { .name = "pcie_1_phy_gdsc", }, - .pwrsts = PWRSTS_OFF_ON, + .pwrsts = PWRSTS_RET_ON, .flags = POLL_CFG_GDSCR | RETAIN_FF_ENABLE | VOTABLE, };
Greg Kroah-Hartman
maintainerPATCH 200/443 clk: qcom: gcc-sm6350: Add missing parent_map for two clocks
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luca Weiss <[email protected]>
commit 96fe1a7ee477d701cfc98ab9d3c730c35d966861 upstream.
If a clk_rcg2 has a parent, it should also have parent_map defined, otherwise we'll get a NULL pointer dereference when calling clk_set_rate like the following:
[ 3.388105] Call trace: [ 3.390664] qcom_find_src_index+0x3c/0x70 (P) [ 3.395301] qcom_find_src_index+0x1c/0x70 (L) [ 3.399934] _freq_tbl_determine_rate+0x48/0x100 [ 3.404753] clk_rcg2_determine_rate+0x1c/0x28 [ 3.409387] clk_core_determine_round_nolock+0x58/0xe4 [ 3.421414] clk_core_round_rate_nolock+0x48/0xfc [ 3.432974] clk_core_round_rate_nolock+0xd0/0xfc [ 3.444483] clk_core_set_rate_nolock+0x8c/0x300 [ 3.455886] clk_set_rate+0x38/0x14c
Add the parent_map property for two clocks where it's missing and also un-inline the parent_data as well to keep the matching parent_map and parent_data together.
--- drivers/clk/qcom/gcc-sm6350.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)
drivers/clk/qcom/gcc-sm6350.c +14 -8
@@ -182,6 +182,14 @@ static const struct clk_parent_data gcc_ { .hw = &gpll0_out_odd.clkr.hw }, }; +static const struct parent_map gcc_parent_map_3[] = { + {P_BI_TCXO ,0 }, +}; + +static const struct clk_parent_data gcc_parent_data_3[] = { + { .fw_name ="bi_tcxo" }, +}; +static const struct parent_map gcc_parent_map_4[] = { {P_BI_TCXO ,0 }, {P_GPLL0_OUT_MAIN ,1 },
@@ -701,13 +709,12 @@ static struct clk_rcg2 gcc_ufs_phy_phy_a .cmd_rcgr = 0x3a0b0, .mnd_width = 0, .hid_width = 5, + .parent_map = gcc_parent_map_3, .freq_tbl = ftbl_gcc_ufs_phy_phy_aux_clk_src, .clkr.hw.init = &(struct clk_init_data ){ .name ="gcc_ufs_phy_phy_aux_clk_src" , - .parent_data = &(const struct clk_parent_data ){ - .fw_name ="bi_tcxo" , - }, - .num_parents =1 , + .parent_data = gcc_parent_data_3, + .num_parents =ARRAY_SIZE (gcc_parent_data_3), .ops = &clk_rcg2_ops, }, };
@@ -764,13 +771,12 @@ static struct clk_rcg2 gcc_usb30_prim_mo .cmd_rcgr = 0x1a034, .mnd_width = 0, .hid_width = 5, + .parent_map = gcc_parent_map_3, .freq_tbl = ftbl_gcc_usb30_prim_mock_utmi_clk_src, .clkr.hw.init = &(struct clk_init_data ){ .name ="gcc_usb30_prim_mock_utmi_clk_src" , - .parent_data = &(const struct clk_parent_data ){ - .fw_name ="bi_tcxo" , - }, - .num_parents =1 , + .parent_data = gcc_parent_data_3, + .num_parents =ARRAY_SIZE (gcc_parent_data_3), .ops = &clk_rcg2_ops, }, };
Greg Kroah-Hartman
maintainerPATCH 201/443 clk: qcom: dispcc-sm6350: Add missing parent_map for a clock
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luca Weiss <[email protected]>
commit d4cdb196f182d2fbe336c968228be00d8c3fed05 upstream.
If a clk_rcg2 has a parent, it should also have parent_map defined, otherwise we'll get a NULL pointer dereference when calling clk_set_rate like the following:
[ 3.388105] Call trace: [ 3.390664] qcom_find_src_index+0x3c/0x70 (P) [ 3.395301] qcom_find_src_index+0x1c/0x70 (L) [ 3.399934] _freq_tbl_determine_rate+0x48/0x100 [ 3.404753] clk_rcg2_determine_rate+0x1c/0x28 [ 3.409387] clk_core_determine_round_nolock+0x58/0xe4 [ 3.421414] clk_core_round_rate_nolock+0x48/0xfc [ 3.432974] clk_core_round_rate_nolock+0xd0/0xfc [ 3.444483] clk_core_set_rate_nolock+0x8c/0x300 [ 3.455886] clk_set_rate+0x38/0x14c
Add the parent_map property for the clock where it's missing and also un-inline the parent_data as well to keep the matching parent_map and parent_data together.
--- drivers/clk/qcom/dispcc-sm6350.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/clk/qcom/dispcc-sm6350.c +3 -4
@@ -187,13 +187,12 @@ static struct clk_rcg2 disp_cc_mdss_dp_a .cmd_rcgr = 0x1144, .mnd_width = 0, .hid_width = 5, + .parent_map = disp_cc_parent_map_6, .freq_tbl = ftbl_disp_cc_mdss_dp_aux_clk_src, .clkr.hw.init = &(struct clk_init_data ){ .name ="disp_cc_mdss_dp_aux_clk_src" , - .parent_data = &(const struct clk_parent_data ){ - .fw_name ="bi_tcxo" , - }, - .num_parents =1 , + .parent_data = disp_cc_parent_data_6, + .num_parents =ARRAY_SIZE (disp_cc_parent_data_6), .ops = &clk_rcg2_ops, }, };
Greg Kroah-Hartman
maintainerPATCH 202/443 clk: qcom: gcc-mdm9607: Fix cmd_rcgr offset for blsp1_uart6 rcg
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Satya Priya Kakitapalli <[email protected]>
commit 88d9dca36aac9659446be1e569d8fbe3462b5741 upstream.
Fix cmd_rcgr offset for blsp1_uart6_apps_clk_src on mdm9607 platform.
--- drivers/clk/qcom/gcc-mdm9607.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/gcc-mdm9607.c +1 -1
@@ -535,7 +535,7 @@ static struct clk_rcg2 blsp1_uart5_apps_ };static struct clk_rcg2 blsp1_uart6_apps_clk_src = { - .cmd_rcgr =0x6044 , + .cmd_rcgr =0x7044 , .mnd_width =16 , .hid_width =5 , .parent_map = gcc_xo_gpll0_map,
Greg Kroah-Hartman
maintainerPATCH 203/443 clk: qcom: clk-rpmh: prevent integer overflow in recalc_rate
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anastasia Belova <[email protected]>
commit 89aa5925d201b90a48416784831916ca203658f9 upstream.
aggr_state and unit fields are u32. The result of their multiplication may not fit in this type.
Add explicit casting to prevent overflow.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/clk/qcom/clk-rpmh.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/clk-rpmh.c +1 -1
@@ -329,7 +329,7 @@ static unsigned long clk_rpmh_bcm_recalc {struct clk_rpmh *c =to_clk_rpmh (hw); -return c->aggr_state * c->unit; +return (unsigned long )c->aggr_state * c->unit; }static const struct clk_ops clk_rpmh_bcm_ops = {
Greg Kroah-Hartman
maintainerPATCH 204/443 clk: mediatek: mt2701-vdec: fix conversion to mtk_clk_simple_probe
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Golle <[email protected]>
commit 7c8746126a4e256fcf1af9174ee7d92cc3f3bc31 upstream.
Commit 973d1607d936 ("clk: mediatek: mt2701: use mtk_clk_simple_probe to simplify driver") broke DT bindings as the highest index was reduced by 1 because the id count starts from 1 and not from 0.
Fix this, like for other drivers which had the same issue, by adding a dummy clk at index 0.
--- drivers/clk/mediatek/clk-mt2701-vdec.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/mediatek/clk-mt2701-vdec.c +1 -0
@@ -31,6 +31,7 @@ static const struct mtk_gate_regs vdec1_ GATE_MTK(_id, _name, _parent, &vdec1_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv)static const struct mtk_gate vdec_clks[] = { +GATE_DUMMY (CLK_DUMMY ,"vdec_dummy" ),GATE_VDEC0 (CLK_VDEC_CKGEN ,"vdec_cken" ,"vdec_sel" ,0 ),GATE_VDEC1 (CLK_VDEC_LARB ,"vdec_larb_cken" ,"mm_sel" ,0 ), };
Greg Kroah-Hartman
maintainerPATCH 205/443 clk: mediatek: mt2701-aud: fix conversion to mtk_clk_simple_probe
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Golle <[email protected]>
commit 5fba40be5fbad563914e3ce9d5129a6baaea1ff5 upstream.
Some of the audio subsystem clocks defined in clk-mt2701.h aren't actually used by the driver. This broke conversion to mtk_clk_simple_probe which expects that the highest possible clk id is defined by the ARRAY_SIZE.
Add additional dummy clocks to fill the gaps and remain compatible with the existing DT bindings.
--- drivers/clk/mediatek/clk-mt2701-aud.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/clk/mediatek/clk-mt2701-aud.c +10 -0
@@ -55,10 +55,16 @@ static const struct mtk_gate audio_clks[GATE_DUMMY (CLK_DUMMY ,"aud_dummy" ),/* AUDIO0 */ GATE_AUDIO0 (CLK_AUD_AFE ,"audio_afe" ,"aud_intbus_sel" ,2 ), +GATE_DUMMY (CLK_AUD_LRCK_DETECT ,"audio_lrck_detect_dummy" ), +GATE_DUMMY (CLK_AUD_I2S ,"audio_i2c_dummy" ), +GATE_DUMMY (CLK_AUD_APLL_TUNER ,"audio_apll_tuner_dummy" ),GATE_AUDIO0 (CLK_AUD_HDMI ,"audio_hdmi" ,"audpll_sel" ,20 ),GATE_AUDIO0 (CLK_AUD_SPDF ,"audio_spdf" ,"audpll_sel" ,21 ),GATE_AUDIO0 (CLK_AUD_SPDF2 ,"audio_spdf2" ,"audpll_sel" ,22 ),GATE_AUDIO0 (CLK_AUD_APLL ,"audio_apll" ,"audpll_sel" ,23 ), +GATE_DUMMY (CLK_AUD_TML ,"audio_tml_dummy" ), +GATE_DUMMY (CLK_AUD_AHB_IDLE_EXT ,"audio_ahb_idle_ext_dummy" ), +GATE_DUMMY (CLK_AUD_AHB_IDLE_INT ,"audio_ahb_idle_int_dummy" ),/* AUDIO1 */ GATE_AUDIO1 (CLK_AUD_I2SIN1 ,"audio_i2sin1" ,"aud_mux1_sel" ,0 ), GATE_AUDIO1(CLK_AUD_I2SIN2, "audio_i2sin2", "aud_mux1_sel", 1),
@@ -76,10 +82,12 @@ static const struct mtk_gate audio_clks[GATE_AUDIO1 (CLK_AUD_ASRCI2 ,"audio_asrci2" ,"asm_h_sel" ,13 ),GATE_AUDIO1 (CLK_AUD_ASRCO1 ,"audio_asrco1" ,"asm_h_sel" ,14 ),GATE_AUDIO1 (CLK_AUD_ASRCO2 ,"audio_asrco2" ,"asm_h_sel" ,15 ), +GATE_DUMMY (CLK_AUD_HDMIRX ,"audio_hdmirx_dummy" ),GATE_AUDIO1 (CLK_AUD_INTDIR ,"audio_intdir" ,"intdir_sel" ,20 ),GATE_AUDIO1 (CLK_AUD_A1SYS ,"audio_a1sys" ,"aud_mux1_sel" ,21 ),GATE_AUDIO1 (CLK_AUD_A2SYS ,"audio_a2sys" ,"aud_mux2_sel" ,22 ),GATE_AUDIO1 (CLK_AUD_AFE_CONN ,"audio_afe_conn" ,"aud_mux1_sel" ,23 ), +GATE_DUMMY (CLK_AUD_AFE_PCMIF ,"audio_afe_pcmif_dummy" ),GATE_AUDIO1 (CLK_AUD_AFE_MRGIF ,"audio_afe_mrgif" ,"aud_mux1_sel" ,25 ),/* AUDIO2 */ GATE_AUDIO2(CLK_AUD_MMIF_UL1, "audio_ul1", "aud_mux1_sel", 0),
@@ -100,6 +108,8 @@ static const struct mtk_gate audio_clks[GATE_AUDIO2 (CLK_AUD_MMIF_AWB2 ,"audio_awb2" ,"aud_mux1_sel" ,15 ),GATE_AUDIO2 (CLK_AUD_MMIF_DAI ,"audio_dai" ,"aud_mux1_sel" ,16 ),/* AUDIO3 */ +GATE_DUMMY (CLK_AUD_DMIC1 ,"audio_dmic1_dummy" ), +GATE_DUMMY (CLK_AUD_DMIC2 ,"audio_dmic2_dummy" ),GATE_AUDIO3 (CLK_AUD_ASRCI3 ,"audio_asrci3" ,"asm_h_sel" ,2 ),GATE_AUDIO3 (CLK_AUD_ASRCI4 ,"audio_asrci4" ,"asm_h_sel" ,3 ), GATE_AUDIO3(CLK_AUD_ASRCI5, "audio_asrci5", "asm_h_sel", 4),
Greg Kroah-Hartman
maintainerPATCH 206/443 clk: mediatek: mt2701-bdp: add missing dummy clk
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Golle <[email protected]>
commit fd291adc5e9a4ee6cd91e57f148f3b427f80647b upstream.
Add dummy clk for index 0 which was missed during the conversion to mtk_clk_simple_probe().
--- drivers/clk/mediatek/clk-mt2701-bdp.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/mediatek/clk-mt2701-bdp.c +1 -0
@@ -31,6 +31,7 @@ static const struct mtk_gate_regs bdp1_c GATE_MTK(_id, _name, _parent, &bdp1_cg_regs, _shift, &mtk_clk_gate_ops_setclr_inv)static const struct mtk_gate bdp_clks[] = { +GATE_DUMMY (CLK_DUMMY ,"bdp_dummy" ),GATE_BDP0 (CLK_BDP_BRG_BA ,"brg_baclk" ,"mm_sel" ,0 ),GATE_BDP0 (CLK_BDP_BRG_DRAM ,"brg_dram" ,"mm_sel" ,1 ),GATE_BDP0 (CLK_BDP_LARB_DRAM ,"larb_dram" ,"mm_sel" ,2 ),
Greg Kroah-Hartman
maintainerPATCH 207/443 clk: mediatek: mt2701-img: add missing dummy clk
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Golle <[email protected]>
commit 366640868ccb4a7991aebe8442b01340fab218e2 upstream.
Add dummy clk for index 0 which was missed during the conversion to mtk_clk_simple_probe().
--- drivers/clk/mediatek/clk-mt2701-img.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/mediatek/clk-mt2701-img.c +1 -0
@@ -22,6 +22,7 @@ static const struct mtk_gate_regs img_cg GATE_MTK(_id, _name, _parent, &img_cg_regs, _shift, &mtk_clk_gate_ops_setclr)static const struct mtk_gate img_clks[] = { +GATE_DUMMY (CLK_DUMMY ,"img_dummy" ),GATE_IMG (CLK_IMG_SMI_COMM ,"img_smi_comm" ,"mm_sel" ,0 ),GATE_IMG (CLK_IMG_RESZ ,"img_resz" ,"mm_sel" ,1 ),GATE_IMG (CLK_IMG_JPGDEC_SMI ,"img_jpgdec_smi" ,"mm_sel" ,5 ),
Greg Kroah-Hartman
maintainerPATCH 208/443 clk: mediatek: mt2701-mm: add missing dummy clk
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Golle <[email protected]>
commit 67aea188f23a5dde51c31a720ccf66aed0ce4187 upstream.
Add dummy clk which was missed during the conversion to mtk_clk_pdev_probe() and is required for the existing DT bindings to keep working.
--- drivers/clk/mediatek/clk-mt2701-mm.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/mediatek/clk-mt2701-mm.c +1 -0
@@ -31,6 +31,7 @@ static const struct mtk_gate_regs disp1_ GATE_MTK(_id, _name, _parent, &disp1_cg_regs, _shift, &mtk_clk_gate_ops_setclr)static const struct mtk_gate mm_clks[] = { +GATE_DUMMY (CLK_DUMMY ,"mm_dummy" ),GATE_DISP0 (CLK_MM_SMI_COMMON ,"mm_smi_comm" ,"mm_sel" ,0 ),GATE_DISP0 (CLK_MM_SMI_LARB0 ,"mm_smi_larb0" ,"mm_sel" ,1 ),GATE_DISP0 (CLK_MM_CMDQ ,"mm_cmdq" ,"mm_sel" ,2 ),
Greg Kroah-Hartman
maintainerPATCH 209/443 seccomp: passthrough uretprobe systemcall without filtering
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eyal Birger <[email protected]>
commit cf6cb56ef24410fb5308f9655087f1eddf4452e6 upstream.
When attaching uretprobes to processes running inside docker, the attached process is segfaulted when encountering the retprobe.
The reason is that now that uretprobe is a system call the default seccomp filters in docker block it as they only allow a specific set of known syscalls. This is true for other userspace applications which use seccomp to control their syscall surface.
Since uretprobe is a "kernel implementation detail" system call which is not used by userspace application code directly, it is impractical and there's very little point in forcing all userspace applications to explicitly allow it in order to avoid crashing tracked processes.
Pass this systemcall through seccomp without depending on configuration.
Note: uretprobe is currently only x86_64 and isn't expected to ever be supported in i386.
--- kernel/seccomp.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
kernel/seccomp.c +12 -0
@@ -749,6 +749,15 @@ static bool seccomp_is_const_allow(strucif (WARN_ON_ONCE (!fprog))return false; +/* Our single exception to filtering. */ +#ifdef __NR_uretprobe +#ifdef SECCOMP_ARCH_COMPAT + if (sd->arch == SECCOMP_ARCH_NATIVE) +#endif +if (sd->nr == __NR_uretprobe) +return true; +#endif +for (pc =0 ; pc < fprog->len; pc++) {struct sock_filter *insn = &fprog->filter[pc];u16 code = insn->code;
@@ -1023,6 +1032,9 @@ static inline void seccomp_log(unsigned*/ static const int mode1_syscalls[] = { __NR_seccomp_read, __NR_seccomp_write, __NR_seccomp_exit, __NR_seccomp_sigreturn, +#ifdef __NR_uretprobe + __NR_uretprobe, +#endif-1 ,/* negative terminated */ };
Greg Kroah-Hartman
maintainerPATCH 210/443 blk-cgroup: Fix class @block_classs subsystem refcount leakage
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit d1248436cbef1f924c04255367ff4845ccd9025e upstream.
blkcg_fill_root_iostats() iterates over @block_class's devices by class_dev_iter_(init|next)(), but does not end iterating with class_dev_iter_exit(), so causes the class's subsystem refcount leakage.
Fix by ending the iterating with class_dev_iter_exit().
--- block/blk-cgroup.c | 1 + 1 file changed, 1 insertion(+)
block/blk-cgroup.c +1 -0
@@ -1138,6 +1138,7 @@ static void blkcg_fill_root_iostats(voidblkg_iostat_set (&blkg->iostat.cur, &tmp);u64_stats_update_end_irqrestore (&blkg->iostat.sync, flags); } +class_dev_iter_exit (&iter); }static void blkcg_print_one_stat (struct blkcg_gq *blkg,struct seq_file *s)
Greg Kroah-Hartman
maintainerPATCH 211/443 efi: libstub: Use -std=gnu11 to fix build with GCC 15
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
commit 8ba14d9f490aef9fd535c04e9e62e1169eb7a055 upstream.
GCC 15 changed the default C standard version to C23, which should not have impacted the kernel because it requests the gnu11 standard via '-std=' in the main Makefile. However, the EFI libstub Makefile uses its own set of KBUILD_CFLAGS for x86 without a '-std=' value (i.e., using the default), resulting in errors from the kernel's definitions of bool, true, and false in stddef.h, which are reserved keywords under C23.
./include/linux/stddef.h:11:9: error: expected identifier before ‘false’
11 | false = 0,
./include/linux/types.h:35:33: error: two or more data types in declaration specifiers
35 | typedef _Bool bool;
Set '-std=gnu11' in the x86 cflags to resolve the error and consistently use the same C standard version for the entire kernel. All other architectures reuse KBUILD_CFLAGS from the rest of the kernel, so this issue is not visible for them.
--- drivers/firmware/efi/libstub/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/efi/libstub/Makefile +1 -1
@@ -11,7 +11,7 @@ cflags-y := $(KBUILD_CFLAGS) cflags-$(CONFIG_X86_32) := -march=i386 cflags-$(CONFIG_X86_64) := -mcmodel=small -cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ \ +cflags-$(CONFIG_X86) += -m$(BITS) -D__KERNEL__ -std=gnu11 \ -fPIC -fno-strict-aliasing -mno-red-zone \ -mno-mmx -mno-sse -fshort-wchar \ -Wno-pointer-sign \
Greg Kroah-Hartman
maintainerPATCH 212/443 x86/efi: skip memattr table on kexec boot
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Young <[email protected]>
commit 64b45dd46e154ee7641d7e0457f3fa266e57179f upstream.
efi_memattr_init() added a sanity check to avoid firmware caused corruption. The check is based on efi memmap entry numbers, but kexec only takes the runtime related memmap entries thus this caused many false warnings, see below thread for details:
https://lore.kernel.org/all/[email protected]/
Ard suggests to skip the efi memattr table in kexec, this makes sense because those memattr fixups are not critical.
--- arch/x86/platform/efi/quirks.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/x86/platform/efi/quirks.c +5 -0
@@ -561,6 +561,11 @@ int __init efi_reuse_config(u64 tables, int nr_tables)if (!efi_guidcmp (guid,SMBIOS_TABLE_GUID )) ((efi_config_table_64_t *)p)->table = data->smbios; + +/* Do not bother to play with mem attr table across kexec */ +if (!efi_guidcmp (guid,EFI_MEMORY_ATTRIBUTES_TABLE_GUID )) + ((efi_config_table_64_t *)p)->table =EFI_INVALID_TABLE_ADDR ; + p += sz; }early_memunmap (tablep, nr_tables * sz);
Signature · 1 line
2.48.1
Greg Kroah-Hartman
maintainerPATCH 213/443 perf bench: Fix undefined behavior in cmpworker()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuan-Wei Chiu <[email protected]>
commit 62892e77b8a64b9dc0e1da75980aa145347b6820 upstream.
The comparison function cmpworker() violates the C standard's requirements for qsort() comparison functions, which mandate symmetry and transitivity:
Symmetry: If x < y, then y > x.
Transitivity: If x < y and y < z, then x < z.
In its current implementation, cmpworker() incorrectly returns 0 when w1->tid < w2->tid, which breaks both symmetry and transitivity. This violation causes undefined behavior, potentially leading to issues such as memory corruption in glibc [1].
Fix the issue by returning -1 when w1->tid < w2->tid, ensuring compliance with the C standard and preventing undefined behavior.
--- tools/perf/bench/epoll-wait.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
tools/perf/bench/epoll-wait.c +6 -1
@@ -420,7 +420,12 @@ static int cmpworker(const void *p1, construct worker *w1 = (struct worker *) p1;struct worker *w2 = (struct worker *) p2; -return w1->tid > w2->tid; + +if (w1->tid > w2->tid) +return 1 ; +if (w1->tid < w2->tid) +return -1 ; +return 0 ; }int bench_epoll_wait (int argc,const char **argv)
Greg Kroah-Hartman
maintainerPATCH 214/443 scsi: ufs: core: Fix the HIGH/LOW_TEMP Bit Definitions
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bao D. Nguyen <[email protected]>
commit 1b3e2d4ec0c5848776cc56d2624998aa5b2f0d27 upstream.
According to the UFS Device Specification, the dExtendedUFSFeaturesSupport defines the support for TOO_HIGH_TEMPERATURE as bit[4] and the TOO_LOW_TEMPERATURE as bit[5]. Correct the code to match with the UFS device specification definition.
--- include/ufs/ufs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/ufs/ufs.h +2 -2
@@ -386,8 +386,8 @@ enum {/* Possible values for dExtendedUFSFeaturesSupport */ enum { -UFS_DEV_LOW_TEMP_NOTIF =BIT (4 ), -UFS_DEV_HIGH_TEMP_NOTIF =BIT (5 ), +UFS_DEV_HIGH_TEMP_NOTIF =BIT (4 ), +UFS_DEV_LOW_TEMP_NOTIF =BIT (5 ),UFS_DEV_EXT_TEMP_NOTIF =BIT (6 ),UFS_DEV_HPB_SUPPORT =BIT (7 ),UFS_DEV_WRITE_BOOSTER_SUP =BIT (8 ),
Greg Kroah-Hartman
maintainerPATCH 215/443 of: Correct child specifier used as input of the 2nd nexus node
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit e4c00c9b1f70cd11792ff5b825899a6ee0234a62 upstream.
API of_parse_phandle_with_args_map() will use wrong input for nexus node Nexus_2 as shown below:
Node_1 Nexus_1 Nexus_2
&Nexus_1,arg_1 -> arg_1,&Nexus_2,arg_2' -> &Nexus_2,arg_2 -> arg_2,...
map-pass-thru=<...>
Nexus_1's output arg_2 should be used as input of Nexus_2, but the API wrongly uses arg_2' instead which != arg_2 due to Nexus_1's map-pass-thru.
Fix by always making @match_array point to @initial_match_array into which to store nexus output.
--- drivers/of/base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/of/base.c +1 -1
@@ -1546,7 +1546,6 @@ int of_parse_phandle_with_args_map(const* specifier into the out_args structure, keeping the * bits specified in <list>-map-pass-thru. */ - match_array = map - new_size;for (i =0 ; i < new_size; i++) {__be32 val = *(map - new_size + i);
@@ -1555,6 +1554,7 @@ int of_parse_phandle_with_args_map(const val |=cpu_to_be32 (out_args->args[i]) & pass[i]; } + initial_match_array[i] = val; out_args->args[i] =be32_to_cpu (val); } out_args->args_count = list_size = new_size;
Greg Kroah-Hartman
maintainerPATCH 216/443 of: address: Fix empty resource handling in __of_address_resource_bounds()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Weißschuh <[email protected]>
commit 15e2f65f2ecfeb8e39315522e2b5cfdc5651fc10 upstream.
"resource->end" needs to always be equal to "resource->start + size - 1". The previous version of the function did not perform the "- 1" in case of an empty resource.
Also make sure to allow an empty resource at address 0.
--- drivers/of/address.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/of/address.c +5 -7
@@ -200,17 +200,15 @@ static u64 of_bus_pci_map(__be32 *addr,static int __of_address_resource_bounds (struct resource *r,u64 start,u64 size) { -u64 end = start; -if (overflows_type (start, r->start))return -EOVERFLOW ; -if (size &&check_add_overflow (end, size -1 , &end)) -return -EOVERFLOW ; -if (overflows_type (end, r->end)) -return -EOVERFLOW ; r->start = start; - r->end = end; + +if (!size) + r->end =wrapping_sub (typeof (r->end), r->start,1 ); +else if (size &&check_add_overflow (r->start, size -1 , &r->end)) +return -EOVERFLOW ;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 217/443 of: Fix of_find_node_opts_by_path() handling of alias+path+options
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit b9e58c934c56aa35b0fb436d9afd86ef326bae0e upstream.
of_find_node_opts_by_path() fails to find OF device node when its @path parameter have pattern below:
"alias-name/node-name-1/.../node-name-N:options".
The reason is that alias name length calculated by the API is wrong, as explained by example below:
"testcase-alias/phandle-tests/consumer-a:testaliasoption".
^ ^ ^ 0 14 39
The right length of alias 'testcase-alias' is 14, but the result worked out by the API is 39 which is obvious wrong.
Fix by using index of either '/' or ':' as the length who comes earlier.
--- drivers/of/base.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/of/base.c +3 -3
@@ -894,10 +894,10 @@ struct device_node *of_find_node_opts_by/* The path could begin with an alias */ if (*path !='/' ) {int len; -const char *p = separator; +const char *p =strchrnul (path,'/' ); -if (!p) - p =strchrnul (path,'/' ); +if (separator && separator < p) + p = separator; len = p - path;/* of_aliases must not be NULL */
Greg Kroah-Hartman
maintainerPATCH 218/443 of: reserved-memory: Fix using wrong number of cells to get property alignment
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit 267b21d0bef8e67dbe6c591c9991444e58237ec9 upstream.
According to DT spec, size of property 'alignment' is based on parent node’s #size-cells property.
But __reserved_mem_alloc_size() wrongly uses @dt_root_addr_cells to get the property obviously.
Fix by using @dt_root_size_cells instead of @dt_root_addr_cells.
--- drivers/of/of_reserved_mem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/of/of_reserved_mem.c +2 -2
@@ -410,12 +410,12 @@ static int __init __reserved_mem_alloc_s prop =of_get_flat_dt_prop (node,"alignment" , &len);if (prop) { -if (len != dt_root_addr_cells *sizeof (__be32)) { +if (len != dt_root_size_cells *sizeof (__be32)) {pr_err ("invalid alignment property in '%s' node.\n" , uname);return -EINVAL ; } - align =dt_mem_next_cell (dt_root_addr_cells, &prop); + align =dt_mem_next_cell (dt_root_size_cells, &prop); } nomap =of_get_flat_dt_prop (node,"no-map" ,NULL ) !=NULL ;
Greg Kroah-Hartman
maintainerPATCH 219/443 of: reserved-memory: Warn for missing static reserved memory regions
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit 81dfedd5234b42df11a473eefe7328ea4a0416ad upstream.
For child node of /reserved-memory, its property 'reg' may contain multiple regions, but fdt_scan_reserved_mem_reg_nodes() only takes into account the first region, and miss remaining regions.
But there are no simple approach to fix it, so give user warning message when miss remaining regions.
--- drivers/of/of_reserved_mem.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/of/of_reserved_mem.c +5 -0
@@ -263,6 +263,11 @@ void __init fdt_scan_reserved_mem_reg_no uname);continue ; } + +if (len > t_len) +pr_warn ("%s() ignores %d regions in node '%s'\n" , + __func__, len / t_len -1 , uname); + base =dt_mem_next_cell (dt_root_addr_cells, &prop); size =dt_mem_next_cell (dt_root_size_cells, &prop);
Greg Kroah-Hartman
maintainerPATCH 220/443 Input: bbnsm_pwrkey - add remove hook
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peng Fan <[email protected]>
commit 55b75306c3edf369285ce22ba1ced45e335094c2 upstream.
Without remove hook to clear wake irq, there will be kernel dump when doing module test.
"bbnsm_pwrkey 44440000.bbnsm:pwrkey: wake irq already initialized"
Add remove hook to clear wake irq and set wakeup to false.
--- drivers/input/misc/nxp-bbnsm-pwrkey.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/input/misc/nxp-bbnsm-pwrkey.c +8 -0
@@ -187,6 +187,12 @@ static int bbnsm_pwrkey_probe(struct plareturn 0 ; } +static void bbnsm_pwrkey_remove (struct platform_device *pdev) +{ +dev_pm_clear_wake_irq (&pdev->dev); +device_init_wakeup (&pdev->dev, false); +} +static int __maybe_unused bbnsm_pwrkey_suspend (struct device *dev) {struct platform_device *pdev =to_platform_device (dev);
@@ -223,6 +229,8 @@ static struct platform_driver bbnsm_pwrk .of_match_table = bbnsm_pwrkey_ids, }, .probe = bbnsm_pwrkey_probe, + .remove = bbnsm_pwrkey_remove, + };module_platform_driver (bbnsm_pwrkey_driver);
Greg Kroah-Hartman
maintainerPATCH 221/443 HID: hid-sensor-hub: dont use stale platform-data on remove
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Stuebner <[email protected]>
commit 8a5b38c3fd709e8acd2bfdedf66c25e6af759576 upstream.
The hid-sensor-hub creates the individual device structs and transfers them to the created mfd platform-devices via the platform_data in the mfd_cell.
Before e651a1da442a ("HID: hid-sensor-hub: Allow parallel synchronous reads") the sensor-hub was managing access centrally, with one "completion" in the hub's data structure, which needed to be finished on removal at the latest.
The mentioned commit then moved this central management to each hid sensor device, resulting on a completion in each struct hid_sensor_hub_device. The remove procedure was adapted to go through all sensor devices and finish any pending "completion".
What this didn't take into account was, platform_device_add_data() that is used by mfd_add{_hotplug}_devices() does a kmemdup on the submitted platform-data. So the data the platform-device gets is a copy of the original data, meaning that the device worked on a different completion than what sensor_hub_remove() currently wants to access.
To fix that, use device_for_each_child() to go through each child-device similar to how mfd_remove_devices() unregisters the devices later and with that get the live platform_data to finalize the correct completion.
--- drivers/hid/hid-sensor-hub.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/hid/hid-sensor-hub.c +14 -7
@@ -730,23 +730,30 @@ err_stop_hw:return ret; } +static int sensor_hub_finalize_pending_fn (struct device *dev,void *data) +{ +struct hid_sensor_hub_device *hsdev = dev->platform_data; + +if (hsdev->pending.status) +complete (&hsdev->pending.ready); + +return 0 ; +} +static void sensor_hub_remove (struct hid_device *hdev) {struct sensor_hub_data *data =hid_get_drvdata (hdev);unsigned long flags; -int i;hid_dbg (hdev," hardware removed\n" );hid_hw_close (hdev);hid_hw_stop (hdev); +spin_lock_irqsave (&data->lock, flags); -for (i =0 ; i < data->hid_sensor_client_cnt; ++i) { -struct hid_sensor_hub_device *hsdev = - data->hid_sensor_hub_client_devs[i].platform_data; -if (hsdev->pending.status) -complete (&hsdev->pending.ready); - } +device_for_each_child (&hdev->dev,NULL , + sensor_hub_finalize_pending_fn);spin_unlock_irqrestore (&data->lock, flags); +mfd_remove_devices (&hdev->dev);mutex_destroy (&data->mutex); }
Greg Kroah-Hartman
maintainerPATCH 222/443 ring-buffer: Do not allow events in NMI with generic atomic64 cmpxchg()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
commit cd2375a3567fd3d93aa6c68e0027a5756213bda0 upstream.
Some architectures can not safely do atomic64 operations in NMI context. Since the ring buffer relies on atomic64 operations to do its time keeping, if an event is requested in NMI context, reject it for these architectures.
--- kernel/trace/ring_buffer.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
kernel/trace/ring_buffer.c +7 -2
@@ -4398,8 +4398,13 @@ rb_reserve_next_event(struct trace_buffeint nr_loops =0 ;int add_ts_default; -/* ring buffer does cmpxchg, make sure it is safe in NMI context */ -if (!IS_ENABLED (CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG ) && +/* +* ring buffer does cmpxchg as well as atomic64 operations +* (which some archs use locking for atomic64), make sure this +* is safe in NMI context +*/ +if ((!IS_ENABLED (CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG ) || +IS_ENABLED (CONFIG_GENERIC_ATOMIC64 )) && (unlikely (in_nmi ()))) {return NULL ; }
Greg Kroah-Hartman
maintainerPATCH 223/443 atomic64: Use arch_spin_locks instead of raw_spin_locks
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
commit 6c8ad3ab45ad0e94bfb7a9c71f2fa9c6cacea4b2 upstream.
raw_spin_locks can be traced by lockdep or tracing itself. Atomic64 operations can be used in the tracing infrastructure. When an architecture does not have true atomic64 operations it can use the generic version that disables interrupts and uses spin_locks.
The tracing ring buffer code uses atomic64 operations for the time keeping. But because some architectures use the default operations, the locking inside the atomic operations can cause an infinite recursion.
As atomic64 implementation is architecture specific, it should not be using raw_spin_locks() but instead arch_spin_locks as that is the purpose of arch_spin_locks. To be used in architecture specific implementations of generic infrastructure like atomic64 operations.
Note, by switching from raw_spin_locks to arch_spin_locks, the locks taken to emulate the atomic64 operations will not have lockdep, mmio, or any kind of checks done on them. They will not even disable preemption, although the code will disable interrupts preventing the tasks that hold the locks from being preempted. As the locks held are done so for very short periods of time, and the logic is only done to emulate atomic64, not having them be instrumented should not be an issue.
--- lib/atomic64.c | 78 +++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 48 insertions(+), 30 deletions(-)
lib/atomic64.c +48 -30
@@ -25,15 +25,15 @@* Ensure each lock is in a separate cacheline. */ static union { -raw_spinlock_t lock; +arch_spinlock_t lock;char pad[L1_CACHE_BYTES ]; } atomic64_lock[NR_LOCKS] __cacheline_aligned_in_smp = { [0 ... (NR_LOCKS -1 )] = { - .lock =__RAW_SPIN_LOCK_UNLOCKED (atomic64_lock.lock), + .lock = __ARCH_SPIN_LOCK_UNLOCKED, }, }; -static inline raw_spinlock_t *lock_addr (const atomic64_t *v) +static inline arch_spinlock_t *lock_addr (const atomic64_t *v) {unsigned long addr = (unsigned long ) v;
@@ -45,12 +45,14 @@ static inline raw_spinlock_t *lock_addr(s64 generic_atomic64_read (const atomic64_t *v) {unsigned long flags; -raw_spinlock_t *lock =lock_addr (v); +arch_spinlock_t *lock =lock_addr (v);s64 val; -raw_spin_lock_irqsave (lock, flags); +local_irq_save (flags); +arch_spin_lock (lock); val = v->counter; -raw_spin_unlock_irqrestore (lock, flags); +arch_spin_unlock (lock); +local_irq_restore (flags);return val; }EXPORT_SYMBOL (generic_atomic64_read);
@@ -58,11 +60,13 @@ EXPORT_SYMBOL(generic_atomic64_read);void generic_atomic64_set (atomic64_t *v,s64 i) {unsigned long flags; -raw_spinlock_t *lock =lock_addr (v); +arch_spinlock_t *lock =lock_addr (v); -raw_spin_lock_irqsave (lock, flags); +local_irq_save (flags); +arch_spin_lock (lock); v->counter = i; -raw_spin_unlock_irqrestore (lock, flags); +arch_spin_unlock (lock); +local_irq_restore (flags); }EXPORT_SYMBOL (generic_atomic64_set);
@@ -70,11 +74,13 @@ EXPORT_SYMBOL(generic_atomic64_set); void generic_atomic64_##op(s64 a, atomic64_t *v) \ { \ unsigned long flags; \ - raw_spinlock_t *lock = lock_addr(v); \ + arch_spinlock_t *lock = lock_addr(v); \ \ - raw_spin_lock_irqsave(lock, flags); \ + local_irq_save(flags); \ + arch_spin_lock(lock); \ v->counter c_op a; \ - raw_spin_unlock_irqrestore(lock, flags); \ + arch_spin_unlock(lock); \ + local_irq_restore(flags); \ } \ EXPORT_SYMBOL(generic_atomic64_##op);
@@ -82,12 +88,14 @@ EXPORT_SYMBOL(generic_atomic64_##op); s64 generic_atomic64_##op##_return(s64 a, atomic64_t *v) \ { \ unsigned long flags; \ - raw_spinlock_t *lock = lock_addr(v); \ + arch_spinlock_t *lock = lock_addr(v); \ s64 val; \ \ - raw_spin_lock_irqsave(lock, flags); \ + local_irq_save(flags); \ + arch_spin_lock(lock); \ val = (v->counter c_op a); \ - raw_spin_unlock_irqrestore(lock, flags); \ + arch_spin_unlock(lock); \ + local_irq_restore(flags); \ return val; \ } \ EXPORT_SYMBOL(generic_atomic64_##op##_return);
@@ -96,13 +104,15 @@ EXPORT_SYMBOL(generic_atomic64_##op##_re s64 generic_atomic64_fetch_##op(s64 a, atomic64_t *v) \ { \ unsigned long flags; \ - raw_spinlock_t *lock = lock_addr(v); \ + arch_spinlock_t *lock = lock_addr(v); \ s64 val; \ \ - raw_spin_lock_irqsave(lock, flags); \ + local_irq_save(flags); \ + arch_spin_lock(lock); \ val = v->counter; \ v->counter c_op a; \ - raw_spin_unlock_irqrestore(lock, flags); \ + arch_spin_unlock(lock); \ + local_irq_restore(flags); \ return val; \ } \ EXPORT_SYMBOL(generic_atomic64_fetch_##op);
@@ -131,14 +141,16 @@ ATOMIC64_OPS(xor, ^=)s64 generic_atomic64_dec_if_positive (atomic64_t *v) {unsigned long flags; -raw_spinlock_t *lock =lock_addr (v); +arch_spinlock_t *lock =lock_addr (v);s64 val; -raw_spin_lock_irqsave (lock, flags); +local_irq_save (flags); +arch_spin_lock (lock); val = v->counter -1 ;if (val >=0 ) v->counter = val; -raw_spin_unlock_irqrestore (lock, flags); +arch_spin_unlock (lock); +local_irq_restore (flags);return val; }EXPORT_SYMBOL (generic_atomic64_dec_if_positive);
@@ -146,14 +158,16 @@ EXPORT_SYMBOL(generic_atomic64_dec_if_pos64 generic_atomic64_cmpxchg (atomic64_t *v,s64 o,s64 n) {unsigned long flags; -raw_spinlock_t *lock =lock_addr (v); +arch_spinlock_t *lock =lock_addr (v);s64 val; -raw_spin_lock_irqsave (lock, flags); +local_irq_save (flags); +arch_spin_lock (lock); val = v->counter;if (val == o) v->counter = n; -raw_spin_unlock_irqrestore (lock, flags); +arch_spin_unlock (lock); +local_irq_restore (flags);return val; }EXPORT_SYMBOL (generic_atomic64_cmpxchg);
@@ -161,13 +175,15 @@ EXPORT_SYMBOL(generic_atomic64_cmpxchg);s64 generic_atomic64_xchg (atomic64_t *v,s64 new) {unsigned long flags; -raw_spinlock_t *lock =lock_addr (v); +arch_spinlock_t *lock =lock_addr (v);s64 val; -raw_spin_lock_irqsave (lock, flags); +local_irq_save (flags); +arch_spin_lock (lock); val = v->counter; v->counter = new; -raw_spin_unlock_irqrestore (lock, flags); +arch_spin_unlock (lock); +local_irq_restore (flags);return val; }EXPORT_SYMBOL (generic_atomic64_xchg);
@@ -175,14 +191,16 @@ EXPORT_SYMBOL(generic_atomic64_xchg);s64 generic_atomic64_fetch_add_unless (atomic64_t *v,s64 a,s64 u) {unsigned long flags; -raw_spinlock_t *lock =lock_addr (v); +arch_spinlock_t *lock =lock_addr (v);s64 val; -raw_spin_lock_irqsave (lock, flags); +local_irq_save (flags); +arch_spin_lock (lock); val = v->counter;if (val != u) v->counter += a; -raw_spin_unlock_irqrestore (lock, flags); +arch_spin_unlock (lock); +local_irq_restore (flags);return val; }
Greg Kroah-Hartman
maintainerPATCH 224/443 wifi: rtlwifi: rtl8821ae: Fix media status report
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bitterblue Smith <[email protected]>
commit 66ef0289ac99e155d206ddaa0fdfad09ae3cd007 upstream.
RTL8821AE is stuck transmitting at the lowest rate allowed by the rate mask. This is because the firmware doesn't know the device is connected to a network.
Fix the macros SET_H2CCMD_MSRRPT_PARM_OPMODE and SET_H2CCMD_MSRRPT_PARM_MACID_IND to work on the first byte of __cmd, not the second. Now the firmware is correctly notified when the device is connected to a network and it activates the rate control.
Before (MCS3):
[ 5] 0.00-1.00 sec 12.5 MBytes 105 Mbits/sec 0 339 KBytes [ 5] 1.00-2.00 sec 10.6 MBytes 89.1 Mbits/sec 0 339 KBytes [ 5] 2.00-3.00 sec 10.6 MBytes 89.1 Mbits/sec 0 386 KBytes [ 5] 3.00-4.00 sec 10.6 MBytes 89.1 Mbits/sec 0 386 KBytes [ 5] 4.00-5.00 sec 10.2 MBytes 86.0 Mbits/sec 0 427 KBytes
After (MCS9):
[ 5] 0.00-1.00 sec 33.9 MBytes 284 Mbits/sec 0 771 KBytes [ 5] 1.00-2.00 sec 31.6 MBytes 265 Mbits/sec 0 865 KBytes [ 5] 2.00-3.00 sec 29.9 MBytes 251 Mbits/sec 0 963 KBytes [ 5] 3.00-4.00 sec 28.2 MBytes 237 Mbits/sec 0 963 KBytes [ 5] 4.00-5.00 sec 26.8 MBytes 224 Mbits/sec 0 963 KBytes
--- drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtlwifi/rtl8821ae/fw.h +2 -2
@@ -197,9 +197,9 @@ enum rtl8821a_h2c_cmd {/* _MEDIA_STATUS_RPT_PARM_CMD1 */ #define SET_H2CCMD_MSRRPT_PARM_OPMODE (__cmd, __value) \ - u8p_replace_bits(__cmd + 1, __value, BIT(0)) + u8p_replace_bits(__cmd, __value, BIT(0))#define SET_H2CCMD_MSRRPT_PARM_MACID_IND (__cmd, __value) \ - u8p_replace_bits(__cmd + 1, __value, BIT(1)) + u8p_replace_bits(__cmd, __value, BIT(1))/* AP_OFFLOAD */ #define SET_H2CCMD_AP_OFFLOAD_ON (__cmd, __value) \
Greg Kroah-Hartman
maintainerPATCH 225/443 wifi: brcmfmac: fix NULL pointer dereference in brcmf_txfinalize()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcel Hamer <[email protected]>
commit 68abd0c4ebf24cd499841a488b97a6873d5efabb upstream.
On removal of the device or unloading of the kernel module a potential NULL pointer dereference occurs.
The following sequence deletes the interface:
brcmf_detach()
brcmf_remove_interface()
brcmf_del_if()Inside the brcmf_del_if() function the drvr->if2bss[ifidx] is updated to BRCMF_BSSIDX_INVALID (-1) if the bsscfgidx matches.
After brcmf_remove_interface() call the brcmf_proto_detach() function is called providing the following sequence:
brcmf_detach()
brcmf_proto_detach()
brcmf_proto_msgbuf_detach()
brcmf_flowring_detach()
brcmf_msgbuf_delete_flowring()
brcmf_msgbuf_remove_flowring()
brcmf_flowring_delete()
brcmf_get_ifp()
brcmf_txfinalize()Since brcmf_get_ip() can and actually will return NULL in this case the call to brcmf_txfinalize() will result in a NULL pointer dereference inside brcmf_txfinalize() when trying to update ifp->ndev->stats.tx_errors.
This will only happen if a flowring still has an skb.
Although the NULL pointer dereference has only been seen when trying to update the tx statistic, all other uses of the ifp pointer have been guarded as well with an early return if ifp is NULL.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +5 -0
@@ -540,6 +540,11 @@ void brcmf_txfinalize(struct brcmf_if *istruct ethhdr *eh;u16 type; +if (!ifp) { +brcmu_pkt_buf_free_skb (txp); +return ; + } + eh = (struct ethhdr *)(txp->data); type =ntohs (eh->h_proto);
Greg Kroah-Hartman
maintainerPATCH 226/443 wifi: mt76: mt7921u: Add VID/PID for TP-Link TXE50UH
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nick Morrow <[email protected]>
commit 47d9a8ba1d7f31c674b6936b3c34ee934aa9b420 upstream.
Add VID/PID 35bc/0107 for recently released TP-Link TXE50UH USB WiFi adapter.
--- drivers/net/wireless/mediatek/mt76/mt7921/usb.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7921/usb.c +3 -0
@@ -21,6 +21,9 @@ static const struct usb_device_id mt7921/* Netgear, Inc. [A8000,AXE3000] */ { USB_DEVICE_AND_INTERFACE_INFO(0x0846, 0x9060, 0xff, 0xff, 0xff), .driver_info = (kernel_ulong_t)MT7921_FIRMWARE_WM }, + /* TP-Link TXE50UH */ + { USB_DEVICE_AND_INTERFACE_INFO(0x35bc, 0x0107, 0xff, 0xff, 0xff), + .driver_info = (kernel_ulong_t)MT7921_FIRMWARE_WM }, { }, };
Greg Kroah-Hartman
maintainerPATCH 227/443 wifi: rtw88: sdio: Fix disconnection after beacon loss
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fiona Klute <[email protected]>
commit fb2fcfbe5eef9ae26b0425978435ae1308951e51 upstream.
This is the equivalent of commit 28818b4d871b ("wifi: rtw88: usb: Fix disconnection after beacon loss") for SDIO chips.
Tested on Pinephone (RTL8723CS), random disconnections became rare, instead of a frequent nuisance.
--- drivers/net/wireless/realtek/rtw88/sdio.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/realtek/rtw88/sdio.c +2 -0
@@ -1192,6 +1192,8 @@ static void rtw_sdio_indicate_tx_status(struct ieee80211_tx_info *info =IEEE80211_SKB_CB (skb);struct ieee80211_hw *hw = rtwdev->hw; +skb_pull (skb, rtwdev->chip->tx_pkt_desc_sz); +/* enqueue to wait for tx report */ if (info->flags &IEEE80211_TX_CTL_REQ_TX_STATUS ) {rtw_tx_report_enqueue (rtwdev, skb, tx_data->sn);
Greg Kroah-Hartman
maintainerPATCH 228/443 wifi: mt76: mt7915: add module param to select 5 GHz or 6 GHz on MT7916
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shayne Chen <[email protected]>
commit 57af267d2b8f5d88485c6372761386d79c5e6a1a upstream.
Due to a limitation in available memory, the MT7916 firmware can only handle either 5 GHz or 6 GHz at a time. It does not support runtime switching without a full restart.
On older firmware, this accidentally worked to some degree due to missing checks, but couldn't be supported properly, because it left the 6 GHz channels uncalibrated.
Newer firmware refuses to start on either band if the passed EEPROM data indicates support for both.
Deal with this limitation by using a module parameter to specify the preferred band in case both are supported.
--- drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c | 21 +++++++++++++++++++-- drivers/net/wireless/mediatek/mt76/mt7915/init.c | 4 ++-- 2 files changed, 21 insertions(+), 4 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/eeprom.c +19 -2
@@ -2,9 +2,14 @@/* Copyright (C) 2020 MediaTek Inc. */ #include <linux/firmware.h> +#include <linux/moduleparam.h> #include "mt7915.h" #include "eeprom.h" +static bool enable_6ghz; +module_param (enable_6ghz, bool,0644 ); +MODULE_PARM_DESC (enable_6ghz,"Enable 6 GHz instead of 5 GHz on hardware that supports both" ); +static int mt7915_eeprom_load_precal (struct mt7915_dev *dev) {struct mt76_dev *mdev = &dev->mt76;
@@ -170,8 +175,20 @@ static void mt7915_eeprom_parse_band_con phy->mt76->cap.has_6ghz = true;return ;case MT_EE_V2_BAND_SEL_5GHZ_6GHZ : - phy->mt76->cap.has_5ghz = true; - phy->mt76->cap.has_6ghz = true; +if (enable_6ghz) { + phy->mt76->cap.has_6ghz = true; +u8p_replace_bits (&eeprom[MT_EE_WIFI_CONF + band], +MT_EE_V2_BAND_SEL_6GHZ , +MT_EE_WIFI_CONF0_BAND_SEL ); + }else { + phy->mt76->cap.has_5ghz = true; +u8p_replace_bits (&eeprom[MT_EE_WIFI_CONF + band], +MT_EE_V2_BAND_SEL_5GHZ , +MT_EE_WIFI_CONF0_BAND_SEL ); + } +/* force to buffer mode */ + dev->flash_mode = true; +return ;default : phy->mt76->cap.has_2ghz = true;
drivers/net/wireless/mediatek/mt76/mt7915/init.c +2 -2
@@ -1239,14 +1239,14 @@ int mt7915_register_device(struct mt7915if (ret) goto unreg_dev; -ieee80211_queue_work (mt76_hw (dev), &dev->init_work); -if (phy2) { ret =mt7915_register_ext_phy (dev, phy2);if (ret) goto unreg_thermal; } +ieee80211_queue_work (mt76_hw (dev), &dev->init_work); + dev->recovery.hw_init_done = true; ret =mt7915_init_debugfs (&dev->phy);
Greg Kroah-Hartman
maintainerPATCH 229/443 wifi: rtw88: 8703b: Fix RX/TX issues
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasily Khoruzhick <[email protected]>
commit a806a8160a0fcaff368bb510c8a52eff37faf727 upstream.
Fix 3 typos in 8703b driver. 2 typos in calibration routines are not fatal and do not seem to have any impact, just fix them to match vendor driver.
However the last one in rtw8703b_set_channel_bb() clears too many bits in REG_OFDM0_TX_PSD_NOISE, causing TX and RX issues (neither rate goes above MCS0-MCS1). Vendor driver clears only 2 most significant bits.
With the last typo fixed, the driver is able to reach MCS7 on Pinebook
--- drivers/net/wireless/realtek/rtw88/rtw8703b.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/realtek/rtw88/rtw8703b.c +4 -4
@@ -903,7 +903,7 @@ static void rtw8703b_set_channel_bb(strurtw_write32_mask (rtwdev,REG_FPGA0_RFMOD ,BIT_MASK_RFMOD ,0x0 );rtw_write32_mask (rtwdev,REG_FPGA1_RFMOD ,BIT_MASK_RFMOD ,0x0 );rtw_write32_mask (rtwdev,REG_OFDM0_TX_PSD_NOISE , -GENMASK (31 ,20 ),0x0 ); +GENMASK (31 ,30 ),0x0 );rtw_write32 (rtwdev,REG_BBRX_DFIR ,0x4A880000 );rtw_write32 (rtwdev,REG_OFDM0_A_TX_AFE ,0x19F60000 );break ;
@@ -1198,9 +1198,9 @@ static u8 rtw8703b_iqk_rx_path(struct rtrtw_write32 (rtwdev,REG_RXIQK_TONE_A_11N ,0x38008c1c );rtw_write32 (rtwdev,REG_TX_IQK_TONE_B ,0x38008c1c );rtw_write32 (rtwdev,REG_RX_IQK_TONE_B ,0x38008c1c ); -rtw_write32 (rtwdev,REG_TXIQK_PI_A_11N ,0x8216000f ); +rtw_write32 (rtwdev,REG_TXIQK_PI_A_11N ,0x8214030f );rtw_write32 (rtwdev,REG_RXIQK_PI_A_11N ,0x28110000 ); -rtw_write32 (rtwdev,REG_TXIQK_PI_B ,0x28110000 ); +rtw_write32 (rtwdev,REG_TXIQK_PI_B ,0x82110000 );rtw_write32 (rtwdev,REG_RXIQK_PI_B ,0x28110000 );/* LOK setting */
@@ -1372,7 +1372,7 @@ void rtw8703b_iqk_fill_a_matrix(struct rreturn ; tmp_rx_iqi |=FIELD_PREP (BIT_MASK_RXIQ_S1_X , result[IQK_S1_RX_X ]); - tmp_rx_iqi |=FIELD_PREP (BIT_MASK_RXIQ_S1_Y1 , result[IQK_S1_RX_X ]); + tmp_rx_iqi |=FIELD_PREP (BIT_MASK_RXIQ_S1_Y1 , result[IQK_S1_RX_Y ]);rtw_write32 (rtwdev,REG_A_RXIQI , tmp_rx_iqi);rtw_write32_mask (rtwdev,REG_RXIQK_MATRIX_LSB_11N ,BIT_MASK_RXIQ_S1_Y2 ,BIT_SET_RXIQ_S1_Y2 (result[IQK_S1_RX_Y ]));
Greg Kroah-Hartman
maintainerPATCH 230/443 usb: gadget: f_tcm: Translate error to sense
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <[email protected]>
commit 98fa00fd3ae43b857b4976984a135483d89d9281 upstream.
When respond with check_condition error status, clear from_transport input so the target layer can translate the sense reason reported by f_tcm.
--- drivers/usb/gadget/function/f_tcm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/gadget/function/f_tcm.c +2 -2
@@ -1065,7 +1065,7 @@ static void usbg_cmd_work(struct work_st out:transport_send_check_condition_and_sense (se_cmd, -TCM_UNSUPPORTED_SCSI_OPCODE ,1 ); +TCM_UNSUPPORTED_SCSI_OPCODE ,0 ); } static struct usbg_cmd *usbg_get_cmd(struct f_uas *fu,
@@ -1193,7 +1193,7 @@ static void bot_cmd_work(struct work_str out:transport_send_check_condition_and_sense (se_cmd, -TCM_UNSUPPORTED_SCSI_OPCODE ,1 ); +TCM_UNSUPPORTED_SCSI_OPCODE ,0 ); } static int bot_submit_command(struct f_uas *fu,
Greg Kroah-Hartman
maintainerPATCH 231/443 usb: gadget: f_tcm: Decrement command ref count on cleanup
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <[email protected]>
commit 3b2a52e88ab0c9469eaadd4d4c8f57d072477820 upstream.
We submitted the command with TARGET_SCF_ACK_KREF, which requires acknowledgment of command completion. If the command fails, make sure to decrement the ref count.
--- drivers/usb/gadget/function/f_tcm.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/gadget/function/f_tcm.c +1 -0
@@ -973,6 +973,7 @@ static void usbg_data_write_cmpl(structreturn ; cleanup: +target_put_sess_cmd (se_cmd);transport_generic_free_cmd (&cmd->se_cmd,0 ); }
Greg Kroah-Hartman
maintainerPATCH 232/443 usb: gadget: f_tcm: ep_autoconfig with fullspeed endpoint
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <[email protected]>
commit 25224c1f07d31c261d04dfbc705a7a0f314a825d upstream.
Match usb endpoint using fullspeed endpoint descriptor to make sure the wMaxPacketSize for fullspeed descriptors is automatically configured.
--- drivers/usb/gadget/function/f_tcm.c | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-)
drivers/usb/gadget/function/f_tcm.c +13 -17
@@ -1970,43 +1970,39 @@ static int tcm_bind(struct usb_configura bot_intf_desc.bInterfaceNumber = iface; uasp_intf_desc.bInterfaceNumber = iface; fu->iface = iface; - ep =usb_ep_autoconfig_ss (gadget, &uasp_ss_bi_desc, - &uasp_bi_ep_comp_desc); + ep =usb_ep_autoconfig (gadget, &uasp_fs_bi_desc);if (!ep) goto ep_fail; fu->ep_in = ep; - ep =usb_ep_autoconfig_ss (gadget, &uasp_ss_bo_desc, - &uasp_bo_ep_comp_desc); + ep =usb_ep_autoconfig (gadget, &uasp_fs_bo_desc);if (!ep) goto ep_fail; fu->ep_out = ep; - ep =usb_ep_autoconfig_ss (gadget, &uasp_ss_status_desc, - &uasp_status_in_ep_comp_desc); + ep =usb_ep_autoconfig (gadget, &uasp_fs_status_desc);if (!ep) goto ep_fail; fu->ep_status = ep; - ep =usb_ep_autoconfig_ss (gadget, &uasp_ss_cmd_desc, - &uasp_cmd_comp_desc); + ep =usb_ep_autoconfig (gadget, &uasp_fs_cmd_desc);if (!ep) goto ep_fail; fu->ep_cmd = ep;/* Assume endpoint addresses are the same for both speeds */ - uasp_bi_desc.bEndpointAddress = uasp_ss_bi_desc.bEndpointAddress; - uasp_bo_desc.bEndpointAddress = uasp_ss_bo_desc.bEndpointAddress; + uasp_bi_desc.bEndpointAddress = uasp_fs_bi_desc.bEndpointAddress; + uasp_bo_desc.bEndpointAddress = uasp_fs_bo_desc.bEndpointAddress; uasp_status_desc.bEndpointAddress = - uasp_ss_status_desc.bEndpointAddress; - uasp_cmd_desc.bEndpointAddress = uasp_ss_cmd_desc.bEndpointAddress; + uasp_fs_status_desc.bEndpointAddress; + uasp_cmd_desc.bEndpointAddress = uasp_fs_cmd_desc.bEndpointAddress; - uasp_fs_bi_desc.bEndpointAddress = uasp_ss_bi_desc.bEndpointAddress; - uasp_fs_bo_desc.bEndpointAddress = uasp_ss_bo_desc.bEndpointAddress; - uasp_fs_status_desc.bEndpointAddress = - uasp_ss_status_desc.bEndpointAddress; - uasp_fs_cmd_desc.bEndpointAddress = uasp_ss_cmd_desc.bEndpointAddress; + uasp_ss_bi_desc.bEndpointAddress = uasp_fs_bi_desc.bEndpointAddress; + uasp_ss_bo_desc.bEndpointAddress = uasp_fs_bo_desc.bEndpointAddress; + uasp_ss_status_desc.bEndpointAddress = + uasp_fs_status_desc.bEndpointAddress; + uasp_ss_cmd_desc.bEndpointAddress = uasp_fs_cmd_desc.bEndpointAddress; ret = usb_assign_descriptors(f, uasp_fs_function_desc, uasp_hs_function_desc, uasp_ss_function_desc,
Greg Kroah-Hartman
maintainerPATCH 233/443 usb: gadget: f_tcm: Dont prepare BOT write request twice
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thinh Nguyen <[email protected]>
commit 94d9bf671ae314cacc2d7bf96bd233b4abc7cede upstream.
The duplicate kmalloc here is causing memory leak. The request preparation in bot_send_write_request is also done in usbg_prepare_w_request. Remove the duplicate work.
--- drivers/usb/gadget/function/f_tcm.c | 17 ----------------- 1 file changed, 17 deletions(-)
drivers/usb/gadget/function/f_tcm.c +0 -17
@@ -245,7 +245,6 @@ static int bot_send_write_request(struct {struct f_uas *fu = cmd->fu;struct se_cmd *se_cmd = &cmd->se_cmd; -struct usb_gadget *gadget =fuas_to_gadget (fu);int ret;init_completion (&cmd->write_complete);
@@ -256,22 +255,6 @@ static int bot_send_write_request(structreturn -EINVAL ; } -if (!gadget->sg_supported) { - cmd->data_buf =kmalloc (se_cmd->data_length,GFP_KERNEL ); -if (!cmd->data_buf) -return -ENOMEM ; - - fu->bot_req_out->buf = cmd->data_buf; - }else { - fu->bot_req_out->buf =NULL ; - fu->bot_req_out->num_sgs = se_cmd->t_data_nents; - fu->bot_req_out->sg = se_cmd->t_data_sg; - } - - fu->bot_req_out->complete = usbg_data_write_cmpl; - fu->bot_req_out->length = se_cmd->data_length; - fu->bot_req_out->context = cmd; - ret =usbg_prepare_w_request (cmd, fu->bot_req_out);if (ret) goto cleanup;
Greg Kroah-Hartman
maintainerPATCH 234/443 usbnet: ipheth: fix possible overflow in DPE length check
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Foster Snowhill <[email protected]>
commit c219427ed296f94bb4b91d08626776dc7719ee27 upstream.
Originally, it was possible for the DPE length check to overflow if wDatagramIndex + wDatagramLength > U16_MAX. This could lead to an OoB read.
Move the wDatagramIndex term to the other side of the inequality.
An existing condition ensures that wDatagramIndex < urb->actual_length.
--- drivers/net/usb/ipheth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/usb/ipheth.c +2 -2
@@ -243,8 +243,8 @@ static int ipheth_rcvbulk_callback_ncm(swhile (le16_to_cpu (dpe->wDatagramIndex) !=0 &&le16_to_cpu (dpe->wDatagramLength) !=0 ) {if (le16_to_cpu (dpe->wDatagramIndex) >= urb->actual_length || -le16_to_cpu (dpe->wDatagramIndex) + -le16_to_cpu (dpe->wDatagramLength) > urb->actual_length) { +le16_to_cpu (dpe->wDatagramLength) > urb->actual_length - +le16_to_cpu (dpe->wDatagramIndex)) { dev->net->stats.rx_length_errors++;return retval; }
Greg Kroah-Hartman
maintainerPATCH 235/443 usbnet: ipheth: use static NDP16 location in URB
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Foster Snowhill <[email protected]>
commit 86586dcb75cb8fd062a518aca8ee667938b91efb upstream.
Original code allowed for the start of NDP16 to be anywhere within the URB based on the wNdpIndex value in NTH16. Only the start position of NDP16 was checked, so it was possible for even the fixed-length part of NDP16 to extend past the end of URB, leading to an out-of-bounds read.
On iOS devices, the NDP16 header always directly follows NTH16. Rely on and check for this specific format.
This, along with NCM-specific minimal URB length check that already exists, will ensure that the fixed-length part of NDP16 plus a set amount of DPEs fit within the URB.
Note that this commit alone does not fully address the OoB read. The limit on the amount of DPEs needs to be enforced separately.
--- drivers/net/usb/ipheth.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/usb/ipheth.c +4 -5
@@ -226,15 +226,14 @@ static int ipheth_rcvbulk_callback_ncm(s ncmh = urb->transfer_buffer;if (ncmh->dwSignature !=cpu_to_le32 (USB_CDC_NCM_NTH16_SIGN ) || -le16_to_cpu (ncmh->wNdpIndex) >= urb->actual_length) { +/* On iOS, NDP16 directly follows NTH16 */ + ncmh->wNdpIndex !=cpu_to_le16 (sizeof (struct usb_cdc_ncm_nth16 ))) { dev->net->stats.rx_errors++;return retval; } - ncm0 = urb->transfer_buffer +le16_to_cpu (ncmh->wNdpIndex); -if (ncm0->dwSignature !=cpu_to_le32 (USB_CDC_NCM_NDP16_NOCRC_SIGN ) || -le16_to_cpu (ncmh->wHeaderLength) +le16_to_cpu (ncm0->wLength) >= - urb->actual_length) { + ncm0 = urb->transfer_buffer +sizeof (struct usb_cdc_ncm_nth16 ); +if (ncm0->dwSignature !=cpu_to_le32 (USB_CDC_NCM_NDP16_NOCRC_SIGN )) { dev->net->stats.rx_errors++;return retval; }
Greg Kroah-Hartman
maintainerPATCH 236/443 usbnet: ipheth: check that DPE points past NCM header
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Foster Snowhill <[email protected]>
commit 429fa68b58cefb9aa9de27e4089637298b46b757 upstream.
By definition, a DPE points at the start of a network frame/datagram. Thus it makes no sense for it to point at anything that's part of the NCM header. It is not a security issue, but merely an indication of a malformed DPE.
Enforce that all DPEs point at the data portion of the URB, past the NCM header.
--- drivers/net/usb/ipheth.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/usb/ipheth.c +2 -1
@@ -241,7 +241,8 @@ static int ipheth_rcvbulk_callback_ncm(s dpe = ncm0->dpe16;while (le16_to_cpu (dpe->wDatagramIndex) !=0 &&le16_to_cpu (dpe->wDatagramLength) !=0 ) { -if (le16_to_cpu (dpe->wDatagramIndex) >= urb->actual_length || +if (le16_to_cpu (dpe->wDatagramIndex) <IPHETH_NCM_HEADER_SIZE || +le16_to_cpu (dpe->wDatagramIndex) >= urb->actual_length ||le16_to_cpu (dpe->wDatagramLength) > urb->actual_length -le16_to_cpu (dpe->wDatagramIndex)) { dev->net->stats.rx_length_errors++;
Greg Kroah-Hartman
maintainerPATCH 237/443 usbnet: ipheth: refactor NCM datagram loop
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Foster Snowhill <[email protected]>
commit 2a9a196429e98fcc64078366c2679bc40aba5466 upstream.
Introduce an rx_error label to reduce repetitions in the header signature checks.
Store wDatagramIndex and wDatagramLength after endianness conversion to avoid repeated le16_to_cpu() calls.
Rewrite the loop to return on a null trailing DPE, which is required by the CDC NCM spec. In case it is missing, fall through to rx_error.
This change does not fix any particular issue. Its purpose is to simplify a subsequent commit that fixes a potential OoB read by limiting the maximum amount of processed DPEs.
--- drivers/net/usb/ipheth.c | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-)
drivers/net/usb/ipheth.c +23 -19
@@ -213,9 +213,9 @@ static int ipheth_rcvbulk_callback_ncm(sstruct usb_cdc_ncm_ndp16 *ncm0;struct usb_cdc_ncm_dpe16 *dpe;struct ipheth_device *dev; +u16 dg_idx, dg_len;int retval = -EINVAL ;char *buf; -int len; dev = urb->context;
@@ -227,39 +227,43 @@ static int ipheth_rcvbulk_callback_ncm(s ncmh = urb->transfer_buffer;if (ncmh->dwSignature !=cpu_to_le32 (USB_CDC_NCM_NTH16_SIGN ) ||/* On iOS, NDP16 directly follows NTH16 */ - ncmh->wNdpIndex !=cpu_to_le16 (sizeof (struct usb_cdc_ncm_nth16 ))) { - dev->net->stats.rx_errors++; -return retval; - } + ncmh->wNdpIndex !=cpu_to_le16 (sizeof (struct usb_cdc_ncm_nth16 ))) + goto rx_error; ncm0 = urb->transfer_buffer +sizeof (struct usb_cdc_ncm_nth16 ); -if (ncm0->dwSignature !=cpu_to_le32 (USB_CDC_NCM_NDP16_NOCRC_SIGN )) { - dev->net->stats.rx_errors++; -return retval; - } +if (ncm0->dwSignature !=cpu_to_le32 (USB_CDC_NCM_NDP16_NOCRC_SIGN )) + goto rx_error; dpe = ncm0->dpe16; -while (le16_to_cpu (dpe->wDatagramIndex) !=0 && -le16_to_cpu (dpe->wDatagramLength) !=0 ) { -if (le16_to_cpu (dpe->wDatagramIndex) <IPHETH_NCM_HEADER_SIZE || -le16_to_cpu (dpe->wDatagramIndex) >= urb->actual_length || -le16_to_cpu (dpe->wDatagramLength) > urb->actual_length - -le16_to_cpu (dpe->wDatagramIndex)) { +while (true) { + dg_idx =le16_to_cpu (dpe->wDatagramIndex); + dg_len =le16_to_cpu (dpe->wDatagramLength); + +/* Null DPE must be present after last datagram pointer entry +* (3.3.1 USB CDC NCM spec v1.0) +*/ +if (dg_idx ==0 && dg_len ==0 ) +return 0 ; + +if (dg_idx <IPHETH_NCM_HEADER_SIZE || + dg_idx >= urb->actual_length || + dg_len > urb->actual_length - dg_idx) { dev->net->stats.rx_length_errors++;return retval; } - buf = urb->transfer_buffer +le16_to_cpu (dpe->wDatagramIndex); - len =le16_to_cpu (dpe->wDatagramLength); + buf = urb->transfer_buffer + dg_idx; - retval =ipheth_consume_skb (buf, len, dev); + retval =ipheth_consume_skb (buf, dg_len, dev);if (retval !=0 )return retval; dpe++; } -return 0 ; +rx_error: + dev->net->stats.rx_errors++; +return retval; }static void ipheth_rcvbulk_callback (struct urb *urb)
Greg Kroah-Hartman
maintainerPATCH 238/443 usbnet: ipheth: break up NCM header size computation
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Foster Snowhill <[email protected]>
commit efcbc678a14be268040ffc1fa33c98faf2d55141 upstream.
Originally, the total NCM header size was computed as the sum of two vaguely labelled constants. While accurate, it wasn't particularly clear where they were coming from.
Use sizes of existing NCM structs where available. Define the total NDP16 size based on the maximum amount of DPEs that can fit into the iOS-specific fixed-size header.
This change does not fix any particular issue. Rather, it introduces intermediate constants that will simplify subsequent commits. It should also make it clearer for the reader where the constant values come from.
--- drivers/net/usb/ipheth.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/net/usb/ipheth.c +12 -1
@@ -61,7 +61,18 @@#define IPHETH_USBINTF_PROTO 1#define IPHETH_IP_ALIGN 2/* padding at front of URB */ -#define IPHETH_NCM_HEADER_SIZE (12 + 96)/* NCMH + NCM0 */ +/* On iOS devices, NCM headers in RX have a fixed size regardless of DPE count: +* - NTH16 (NCMH): 12 bytes, as per CDC NCM 1.0 spec +* - NDP16 (NCM0): 96 bytes, of which +* - NDP16 fixed header: 8 bytes +* - maximum of 22 DPEs (21 datagrams + trailer), 4 bytes each +*/ +#define IPHETH_NDP16_MAX_DPE 22 +#define IPHETH_NDP16_HEADER_SIZE (sizeof(struct usb_cdc_ncm_ndp16) + \ + IPHETH_NDP16_MAX_DPE * \ + sizeof(struct usb_cdc_ncm_dpe16)) +#define IPHETH_NCM_HEADER_SIZE (sizeof(struct usb_cdc_ncm_nth16) + \ + IPHETH_NDP16_HEADER_SIZE)#define IPHETH_TX_BUF_SIZE ETH_FRAME_LEN#define IPHETH_RX_BUF_SIZE_LEGACY (IPHETH_IP_ALIGN + ETH_FRAME_LEN)#define IPHETH_RX_BUF_SIZE_NCM 65536
Greg Kroah-Hartman
maintainerPATCH 239/443 usbnet: ipheth: fix DPE OoB read
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Foster Snowhill <[email protected]>
commit ee591f2b281721171896117f9946fced31441418 upstream.
Fix an out-of-bounds DPE read, limit the number of processed DPEs to the amount that fits into the fixed-size NDP16 header.
--- drivers/net/usb/ipheth.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/usb/ipheth.c +1 -3
@@ -246,7 +246,7 @@ static int ipheth_rcvbulk_callback_ncm(s goto rx_error; dpe = ncm0->dpe16; -while (true) { +for (int dpe_i =0 ; dpe_i <IPHETH_NDP16_MAX_DPE ; ++dpe_i, ++dpe) { dg_idx =le16_to_cpu (dpe->wDatagramIndex); dg_len =le16_to_cpu (dpe->wDatagramLength);
@@ -268,8 +268,6 @@ static int ipheth_rcvbulk_callback_ncm(s retval =ipheth_consume_skb (buf, dg_len, dev);if (retval !=0 )return retval; - - dpe++; } rx_error:
Greg Kroah-Hartman
maintainerPATCH 240/443 usbnet: ipheth: document scope of NCM implementation
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Foster Snowhill <[email protected]>
commit be154b598fa54136e2be17d6dd13c8a8bc0078ce upstream.
Clarify that the "NCM" implementation in ipheth is very limited, as iOS devices aren't compatible with the CDC NCM specification in regular tethering mode.
For a standards-compliant implementation, one shall turn to the cdc_ncm module.
--- drivers/net/usb/ipheth.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/usb/ipheth.c +8 -0
@@ -218,6 +218,14 @@ static int ipheth_rcvbulk_callback_legacreturn ipheth_consume_skb (buf, len, dev); } +/* In "NCM mode", the iOS device encapsulates RX (phone->computer) traffic +* in NCM Transfer Blocks (similarly to CDC NCM). However, unlike reverse +* tethering (handled by the `cdc_ncm` driver), regular tethering is not +* compliant with the CDC NCM spec, as the device is missing the necessary +* descriptors, and TX (computer->phone) traffic is not encapsulated +* at all. Thus `ipheth` implements a very limited subset of the spec with +* the sole purpose of parsing RX URBs. +*/ static int ipheth_rcvbulk_callback_ncm (struct urb *urb) {struct usb_cdc_ncm_nth16 *ncmh;
Greg Kroah-Hartman
maintainerPATCH 241/443 arm64: dts: qcom: x1e80100-asus-vivobook-s15: Fix USB QMP PHY supplies
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephan Gerhold <[email protected]>
commit bf5e9aa844ca74e9c202d8de2ce7390d24ec38a4 upstream.
On the X1E80100 CRD, &vreg_l3e_1p2 only powers &usb_mp_qmpphy0/1 (i.e. USBSS_3 and USBSS_4). The QMP PHYs for USB_0, USB_1 and USB_2 are actually powered by &vreg_l2j_1p2.
Since x1e80100-asus-vivobook-s15 mostly just mirrors the power supplies from the x1e80100-crd device tree, assume that the fix also applies here.
--- arch/arm64/boot/dts/qcom/x1e80100-asus-vivobook-s15.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/x1e80100-asus-vivobook-s15.dts +2 -2
@@ -591,7 +591,7 @@ }; &usb_1_ss0_qmpphy { - vdda-phy-supply = <&vreg_l3e_1p2>; + vdda-phy-supply = <&vreg_l2j_1p2>; vdda-pll-supply = <&vreg_l1j_0p8>; status = "okay";
@@ -623,7 +623,7 @@ }; &usb_1_ss1_qmpphy { - vdda-phy-supply = <&vreg_l3e_1p2>; + vdda-phy-supply = <&vreg_l2j_1p2>; vdda-pll-supply = <&vreg_l2d_0p9>; status = "okay";
Greg Kroah-Hartman
maintainerPATCH 242/443 arm64: dts: qcom: x1e80100-dell-xps13-9345: Fix USB QMP PHY supplies
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephan Gerhold <[email protected]>
commit 26a1b22aaf0c6f5128f8d0242caf3d983d5a2836 upstream.
On the X1E80100 CRD, &vreg_l3e_1p2 only powers &usb_mp_qmpphy0/1 (i.e. USBSS_3 and USBSS_4). The QMP PHYs for USB_0, USB_1 and USB_2 are actually powered by &vreg_l2j_1p2.
Since x1e80100-dell-xps13-9345 mostly just mirrors the power supplies from the x1e80100-crd device tree, assume that the fix also applies here.
--- arch/arm64/boot/dts/qcom/x1e80100-dell-xps13-9345.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/x1e80100-dell-xps13-9345.dts +2 -2
@@ -820,7 +820,7 @@ }; &usb_1_ss0_qmpphy { - vdda-phy-supply = <&vreg_l3e_1p2>; + vdda-phy-supply = <&vreg_l2j_1p2>; vdda-pll-supply = <&vreg_l1j_0p9>; status = "okay";
@@ -852,7 +852,7 @@ }; &usb_1_ss1_qmpphy { - vdda-phy-supply = <&vreg_l3e_1p2>; + vdda-phy-supply = <&vreg_l2j_1p2>; vdda-pll-supply = <&vreg_l2d_0p9>; status = "okay";
Greg Kroah-Hartman
maintainerPATCH 243/443 arm64: dts: qcom: x1e80100-qcp: Fix USB QMP PHY supplies
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephan Gerhold <[email protected]>
commit 4861ba7cf5a49969dee258dda2bf8d4e819135d1 upstream.
On the X1E80100 QCP, &vreg_l3e_1p2 only powers &usb_mp_qmpphy0/1 (i.e. USBSS_3 and USBSS_4). The QMP PHYs for USB_0, USB_1 and USB_2 are actually powered by &vreg_l2j_1p2.
--- arch/arm64/boot/dts/qcom/x1e80100-qcp.dts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/qcom/x1e80100-qcp.dts +3 -3
@@ -896,7 +896,7 @@ }; &usb_1_ss0_qmpphy { - vdda-phy-supply = <&vreg_l3e_1p2>; + vdda-phy-supply = <&vreg_l2j_1p2>; vdda-pll-supply = <&vreg_l1j_0p8>; status = "okay";
@@ -928,7 +928,7 @@ }; &usb_1_ss1_qmpphy { - vdda-phy-supply = <&vreg_l3e_1p2>; + vdda-phy-supply = <&vreg_l2j_1p2>; vdda-pll-supply = <&vreg_l2d_0p9>; status = "okay";
@@ -960,7 +960,7 @@ }; &usb_1_ss2_qmpphy { - vdda-phy-supply = <&vreg_l3e_1p2>; + vdda-phy-supply = <&vreg_l2j_1p2>; vdda-pll-supply = <&vreg_l2d_0p9>; status = "okay";
Greg Kroah-Hartman
maintainerPATCH 244/443 arm64: dts: qcom: x1e78100-lenovo-thinkpad-t14s: Fix USB QMP PHY supplies
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephan Gerhold <[email protected]>
commit 6efc01b75f819a2988aa9392f93a4d6501871525 upstream.
On the X1E80100 CRD, &vreg_l3e_1p2 only powers &usb_mp_qmpphy0/1 (i.e. USBSS_3 and USBSS_4). The QMP PHYs for USB_0, USB_1 and USB_2 are actually powered by &vreg_l2j_1p2.
Since x1e78100-lenovo-thinkpad-t14s mostly just mirrors the power supplies from the x1e80100-crd device tree, assume that the fix also applies here.
--- arch/arm64/boot/dts/qcom/x1e78100-lenovo-thinkpad-t14s.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/x1e78100-lenovo-thinkpad-t14s.dts +2 -2
@@ -763,7 +763,7 @@ }; &usb_1_ss0_qmpphy { - vdda-phy-supply = <&vreg_l3e_1p2>; + vdda-phy-supply = <&vreg_l2j_1p2>; vdda-pll-supply = <&vreg_l1j_0p8>; status = "okay";
@@ -795,7 +795,7 @@ }; &usb_1_ss1_qmpphy { - vdda-phy-supply = <&vreg_l3e_1p2>; + vdda-phy-supply = <&vreg_l2j_1p2>; vdda-pll-supply = <&vreg_l2d_0p9>; status = "okay";
Greg Kroah-Hartman
maintainerPATCH 245/443 arm64: dts: qcom: x1e80100-crd: Fix USB QMP PHY supplies
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephan Gerhold <[email protected]>
commit 789209dd08124da448bfa7524b21049a04d98f83 upstream.
On the X1E80100 CRD, &vreg_l3e_1p2 only powers &usb_mp_qmpphy0/1 (i.e. USBSS_3 and USBSS_4). The QMP PHYs for USB_0, USB_1 and USB_2 are actually powered by &vreg_l2j_1p2.
--- arch/arm64/boot/dts/qcom/x1e80100-crd.dts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/qcom/x1e80100-crd.dts +3 -3
@@ -1187,7 +1187,7 @@ }; &usb_1_ss0_qmpphy { - vdda-phy-supply = <&vreg_l3e_1p2>; + vdda-phy-supply = <&vreg_l2j_1p2>; vdda-pll-supply = <&vreg_l1j_0p8>; status = "okay";
@@ -1219,7 +1219,7 @@ }; &usb_1_ss1_qmpphy { - vdda-phy-supply = <&vreg_l3e_1p2>; + vdda-phy-supply = <&vreg_l2j_1p2>; vdda-pll-supply = <&vreg_l2d_0p9>; status = "okay";
@@ -1251,7 +1251,7 @@ }; &usb_1_ss2_qmpphy { - vdda-phy-supply = <&vreg_l3e_1p2>; + vdda-phy-supply = <&vreg_l2j_1p2>; vdda-pll-supply = <&vreg_l2d_0p9>; status = "okay";
Greg Kroah-Hartman
maintainerPATCH 246/443 arm64: dts: qcom: x1e80100-lenovo-yoga-slim7x: Fix USB QMP PHY supplies
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephan Gerhold <[email protected]>
commit 6ba8e1b8242d27dd83ed4ce58a104c709e72f45f upstream.
On the X1E80100 CRD, &vreg_l3e_1p2 only powers &usb_mp_qmpphy0/1 (i.e. USBSS_3 and USBSS_4). The QMP PHYs for USB_0, USB_1 and USB_2 are actually powered by &vreg_l2j_1p2.
Since x1e80100-lenovo-yoga-slim7x mostly just mirrors the power supplies from the x1e80100-crd device tree, assume that the fix also applies here.
--- arch/arm64/boot/dts/qcom/x1e80100-lenovo-yoga-slim7x.dts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/qcom/x1e80100-lenovo-yoga-slim7x.dts +3 -3
@@ -908,7 +908,7 @@ }; &usb_1_ss0_qmpphy { - vdda-phy-supply = <&vreg_l3e_1p2>; + vdda-phy-supply = <&vreg_l2j_1p2>; vdda-pll-supply = <&vreg_l1j_0p8>; status = "okay";
@@ -940,7 +940,7 @@ }; &usb_1_ss1_qmpphy { - vdda-phy-supply = <&vreg_l3e_1p2>; + vdda-phy-supply = <&vreg_l2j_1p2>; vdda-pll-supply = <&vreg_l2d_0p9>; status = "okay";
@@ -972,7 +972,7 @@ }; &usb_1_ss2_qmpphy { - vdda-phy-supply = <&vreg_l3e_1p2>; + vdda-phy-supply = <&vreg_l2j_1p2>; vdda-pll-supply = <&vreg_l2d_0p9>; status = "okay";
Greg Kroah-Hartman
maintainerPATCH 247/443 arm64: dts: qcom: x1e80100-microsoft-romulus: Fix USB QMP PHY supplies
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephan Gerhold <[email protected]>
commit c0562f51b177d49829a378b5aeda73f78c60d0fc upstream.
On the X1E80100 CRD, &vreg_l3e_1p2 only powers &usb_mp_qmpphy0/1 (i.e. USBSS_3 and USBSS_4). The QMP PHYs for USB_0, USB_1 and USB_2 are actually powered by &vreg_l2j_1p2.
Since x1e80100-microsoft-romulus mostly just mirrors the power supplies from the x1e80100-crd device tree, assume that the fix also applies here.
--- arch/arm64/boot/dts/qcom/x1e80100-microsoft-romulus.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/x1e80100-microsoft-romulus.dtsi +2 -2
@@ -823,7 +823,7 @@ }; &usb_1_ss0_qmpphy { - vdda-phy-supply = <&vreg_l3e>; + vdda-phy-supply = <&vreg_l2j>; vdda-pll-supply = <&vreg_l1j>; status = "okay";
@@ -855,7 +855,7 @@ }; &usb_1_ss1_qmpphy { - vdda-phy-supply = <&vreg_l3e>; + vdda-phy-supply = <&vreg_l2j>; vdda-pll-supply = <&vreg_l2d>; status = "okay";
Greg Kroah-Hartman
maintainerPATCH 248/443 arm64: dts: qcom: x1e80100: Fix usb_2 controller interrupts
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abel Vesa <[email protected]>
commit 680421056216efe727ff4ed48f481691d5873b9e upstream.
Back when the CRD support was brought up, the usb_2 controller didn't have anything connected to it in order to test it properly, so it was never enabled.
On the Lenovo ThinkPad T14s, the usb_2 controller has the fingerprint controller connected to it. So enabling it, proved that the interrupts lines were wrong from the start.
Fix both the pwr_event and the DWC ctrl_irq lines, according to documentation.
--- arch/arm64/boot/dts/qcom/x1e80100.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/x1e80100.dtsi +2 -2
@@ -4118,7 +4118,7 @@ <&gcc GCC_USB20_MASTER_CLK>; assigned-clock-rates = <19200000>, <200000000>; - interrupts-extended = <&intc GIC_SPI 240 IRQ_TYPE_LEVEL_HIGH>, + interrupts-extended = <&intc GIC_SPI 245 IRQ_TYPE_LEVEL_HIGH>, <&pdc 50 IRQ_TYPE_EDGE_BOTH>, <&pdc 49 IRQ_TYPE_EDGE_BOTH>; interrupt-names = "pwr_event",
@@ -4144,7 +4144,7 @@ usb_2_dwc3: usb@a200000 { compatible = "snps,dwc3"; reg = <0 0x0a200000 0 0xcd00>; - interrupts = <GIC_SPI 241 IRQ_TYPE_LEVEL_HIGH>; + interrupts = <GIC_SPI 240 IRQ_TYPE_LEVEL_HIGH>; iommus = <&apps_smmu 0x14e0 0x0>; phys = <&usb_2_hsphy>; phy-names = "usb2-phy";
Greg Kroah-Hartman
maintainerPATCH 249/443 ASoC: renesas: rz-ssi: Terminate all the DMA transactions
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudiu Beznea <[email protected]>
commit 541011dc2d7c4c82523706f726f422a5e23cc86f upstream.
The stop trigger invokes rz_ssi_stop() and rz_ssi_stream_quit().
- The purpose of rz_ssi_stop() is to disable TX/RX, terminate DMA transactions, and set the controller to idle.
- The purpose of rz_ssi_stream_quit() is to reset the substream-specific software data by setting strm->running and strm->substream appropriately.
The function rz_ssi_is_stream_running() checks if both strm->substream and strm->running are valid and returns true if so. Its implementation is as follows:
static inline bool rz_ssi_is_stream_running(struct rz_ssi_stream *strm)
{
return strm->substream && strm->running;
}When the controller is configured in full-duplex mode (with both playback and capture active), the rz_ssi_stop() function does not modify the controller settings when called for the first substream in the full-duplex setup. Instead, it simply sets strm->running = 0 and returns if the companion substream is still running. The following code illustrates this:
static int rz_ssi_stop(struct rz_ssi_priv *ssi, struct rz_ssi_stream *strm)
{
strm->running = 0;
if (rz_ssi_is_stream_running(&ssi->playback) ||
rz_ssi_is_stream_running(&ssi->capture))
return 0;
// ...
}The controller settings, along with the DMA termination (for the last stopped substream), are only applied when the last substream in the full-duplex setup is stopped.
While applying the controller settings only when the last substream stops is not problematic, terminating the DMA operations for only one substream causes failures when starting and stopping full-duplex operations multiple times in a loop.
To address this issue, call dmaengine_terminate_async() for both substreams involved in the full-duplex setup when the last substream in the setup is stopped.
--- sound/soc/renesas/rz-ssi.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/soc/renesas/rz-ssi.c +6 -2
@@ -414,8 +414,12 @@ static int rz_ssi_stop(struct rz_ssi_prirz_ssi_reg_mask_setl (ssi,SSICR ,SSICR_TEN |SSICR_REN ,0 );/* Cancel all remaining DMA transactions */ -if (rz_ssi_is_dma_enabled (ssi)) -dmaengine_terminate_async (strm->dma_ch); +if (rz_ssi_is_dma_enabled (ssi)) { +if (ssi->playback.dma_ch) +dmaengine_terminate_async (ssi->playback.dma_ch); +if (ssi->capture.dma_ch) +dmaengine_terminate_async (ssi->capture.dma_ch); + }rz_ssi_set_idle (ssi);
Greg Kroah-Hartman
maintainerPATCH 250/443 ASoC: renesas: rz-ssi: Add a check for negative sample_space
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 82a0a3e6f8c02b3236b55e784a083fa4ee07c321 upstream.
My static checker rule complains about this code. The concern is that if "sample_space" is negative then the "sample_space >= runtime->channels" condition will not work as intended because it will be type promoted to a high unsigned int value.
strm->fifo_sample_size is SSI_FIFO_DEPTH (32). The SSIFSR_TDC_MASK is 0x3f. Without any further context it does seem like a reasonable warning and it can't hurt to add a check for negatives.
--- sound/soc/renesas/rz-ssi.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/renesas/rz-ssi.c +2 -0
@@ -526,6 +526,8 @@ static int rz_ssi_pio_send(struct rz_ssi sample_space = strm->fifo_sample_size; ssifsr =rz_ssi_reg_readl (ssi,SSIFSR ); sample_space -= (ssifsr >>SSIFSR_TDC_SHIFT ) &SSIFSR_TDC_MASK ; +if (sample_space <0 ) +return -EINVAL ;/* Only add full frames at a time */ while (frames_left && (sample_space >= runtime->channels)) {
Greg Kroah-Hartman
maintainerPATCH 251/443 ASoC: acp: Support microphone from Lenovo Go S
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Limonciello <[email protected]>
commit b9a8ea185f3f8024619b2e74b74375493c87df8c upstream.
On Lenovo Go S there is a DMIC connected to the ACP but the firmware has no AcpDmicConnected ACPI _DSD.
Add a DMI entry for all possible Lenovo Go S SKUs to enable DMIC.
--- sound/soc/amd/yc/acp6x-mach.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
sound/soc/amd/yc/acp6x-mach.c +28 -0
@@ -307,6 +307,34 @@ static const struct dmi_system_id yc_acp { .driver_data = &acp6x_card, .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "83L3"), + } + }, + { + .driver_data = &acp6x_card, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "83N6"), + } + }, + { + .driver_data = &acp6x_card, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "83Q2"), + } + }, + { + .driver_data = &acp6x_card, + .matches = { +DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_NAME, "83Q3"), + } + }, + { + .driver_data = &acp6x_card, + .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"ASUSTeK COMPUTER INC." ), DMI_MATCH(DMI_PRODUCT_NAME, "UM5302TA"), }
Greg Kroah-Hartman
maintainerPATCH 252/443 soc: qcom: socinfo: Avoid out of bounds read of serial number
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephan Gerhold <[email protected]>
commit 22cf4fae6660b6e1a583a41cbf84e3046ca9ccd0 upstream.
On MSM8916 devices, the serial number exposed in sysfs is constant and does not change across individual devices. It's always:
db410c:/sys/devices/soc0$ cat serial_number 2644893864
The firmware used on MSM8916 exposes SOCINFO_VERSION(0, 8), which does not have support for the serial_num field in the socinfo struct. There is an existing check to avoid exposing the serial number in that case, but it's not correct: When checking the item_size returned by SMEM, we need to make sure the *end* of the serial_num is within bounds, instead of comparing with the *start* offset. The serial_number currently exposed on MSM8916 devices is just an out of bounds read of whatever comes after the socinfo struct in SMEM.
Fix this by changing offsetof() to offsetofend(), so that the size of the field is also taken into account.
--- drivers/soc/qcom/socinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/qcom/socinfo.c +1 -1
@@ -796,7 +796,7 @@ static int qcom_socinfo_probe(struct plaif (!qs->attr.soc_id || !qs->attr.revision)return -ENOMEM ; -if (offsetof(struct socinfo , serial_num) <= item_size) { + if (offsetofend(struct socinfo, serial_num) <= item_size) { qs->attr.serial_number =devm_kasprintf (&pdev->dev,GFP_KERNEL ,"%u" ,le32_to_cpu (info->serial_num));
Greg Kroah-Hartman
maintainerPATCH 253/443 serial: sh-sci: Drop __initdata macro for port_cfg
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudiu Beznea <[email protected]>
commit eaeee4225dba30bef4d424bdf134a07b7f423e8b upstream.
The port_cfg object is used by serial_console_write(), which serves as the write function for the earlycon device. Marking port_cfg as __initdata causes it to be freed after kernel initialization, resulting in earlycon becoming unavailable thereafter. Remove the __initdata macro from port_cfg to resolve this issue.
--- drivers/tty/serial/sh-sci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/sh-sci.c +1 -1
@@ -3562,7 +3562,7 @@ sh_early_platform_init_buffer("earlyprin early_serial_buf, ARRAY_SIZE(early_serial_buf));#endif #ifdef CONFIG_SERIAL_SH_SCI_EARLYCON -static struct plat_sci_port port_cfg__initdata ; +static struct plat_sci_port port_cfg;static int __init early_console_setup (struct earlycon_device *device,int type)
Greg Kroah-Hartman
maintainerPATCH 254/443 serial: sh-sci: Do not probe the serial port if its slot in sci_ports[] is in use
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudiu Beznea <[email protected]>
commit 9f7dea875cc7f9c1a56a5c688290634a59cd1420 upstream.
In the sh-sci driver, sci_ports[0] is used by earlycon. If the earlycon is still active when sci_probe() is called and the new serial port is supposed to map to sci_ports[0], return -EBUSY to prevent breaking the earlycon.
This situation should occurs in debug scenarios, and users should be aware of the potential conflict.
--- drivers/tty/serial/sh-sci.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/tty/serial/sh-sci.c +23 -0
@@ -165,6 +165,7 @@ struct sci_port {static struct sci_port sci_ports[SCI_NPORTS ];static unsigned long sci_ports_in_use;static struct uart_driver sci_uart_driver; +static bool sci_uart_earlycon;static inline struct sci_port *to_sci_port (struct uart_port *uart)
@@ -3450,6 +3451,7 @@ static int sci_probe_single(struct platfstatic int sci_probe (struct platform_device *dev) {struct plat_sci_port *p; +struct resource *res;struct sci_port *sp;unsigned int dev_id;int ret;
@@ -3479,6 +3481,26 @@ static int sci_probe(struct platform_dev } sp = &sci_ports[dev_id]; + +/* +* In case: +* - the probed port alias is zero (as the one used by earlycon), and +* - the earlycon is still active (e.g., "earlycon keep_bootcon" in +* bootargs) +* +* defer the probe of this serial. This is a debug scenario and the user +* must be aware of it. +* +* Except when the probed port is the same as the earlycon port. +*/ + + res =platform_get_resource (dev,IORESOURCE_MEM ,0 ); +if (!res) +return -ENODEV ; + +if (sci_uart_earlycon && sp == &sci_ports[0 ] && sp->port.mapbase != res->start) +return dev_err_probe (&dev->dev, -EBUSY ,"sci_port[0] is used by earlycon!\n" ); +platform_set_drvdata (dev, sp); ret =sci_probe_single (dev, dev_id, p, sp);
@@ -3575,6 +3597,7 @@ static int __init early_console_setup(st port_cfg.type = type; sci_ports[0 ].cfg = &port_cfg; sci_ports[0 ].params =sci_probe_regmap (&port_cfg); + sci_uart_earlycon = true; port_cfg.scscr =sci_serial_in (&sci_ports[0 ].port,SCSCR );sci_serial_out (&sci_ports[0 ].port,SCSCR ,SCSCR_RE |SCSCR_TE | port_cfg.scscr);
Greg Kroah-Hartman
maintainerPATCH 255/443 MIPS: Loongson64: remove ROM Size unit in boardinfo
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kexy Biscuit <[email protected]>
commit bd2212d658d7659b9d83c7e2f3a06789d4db1e90 upstream.
Per Appendix A.7 in Q/LS 0013-2014 (龙芯CPU开发系统固件与内核接口规范 V2.2, lit. Loongson DevSys Firmware Kernel Interface Specification V2.2), interface_info.size is size of this interface, not size of the LEFI BIOS ROM.
In any case, the BIOS ROM Size just cannot be several kilobytes (KB) on Loongson64 LEFI platforms.
--- arch/mips/loongson64/boardinfo.c | 2 -- 1 file changed, 2 deletions(-)
arch/mips/loongson64/boardinfo.c +0 -2
@@ -21,13 +21,11 @@ static ssize_t boardinfo_show(struct kob"BIOS Info\n" "Vendor\t\t\t: %s\n" "Version\t\t\t: %s\n" -"ROM Size\t\t: %d KB\n" "Release Date\t\t: %s\n" ,strsep (&tmp_board_manufacturer,"-" ), eboard->name,strsep (&tmp_bios_vendor,"-" ), einter->description, - einter->size, especial->special_name); } static struct kobj_attribute boardinfo_attr = __ATTR(boardinfo, 0444,
Greg Kroah-Hartman
maintainerPATCH 256/443 LoongArch: Extend the maximum number of watchpoints
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiezhu Yang <[email protected]>
commit 531936dee53e471a3ec668de3c94ca357f54b7e8 upstream.
The maximum number of load/store watchpoints and fetch instruction watchpoints is 14 each according to LoongArch Reference Manual, so extend the maximum number of watchpoints from 8 to 14 for ptrace.
By the way, just simply change 8 to 14 for the definition in struct user_watch_state at the beginning, but it may corrupt uapi, then add a new struct user_watch_state_v2 directly.
As far as I can tell, the only users for this struct in the userspace are GDB and LLDB, there are no any problems of software compatibility between the application and kernel according to the analysis.
The compatibility problem has been considered while developing and testing. When the applications in the userspace get watchpoint state, the length will be specified which is no bigger than the sizeof struct user_watch_state or user_watch_state_v2, the actual length is assigned as the minimal value of the application and kernel in the generic code of ptrace:
kernel/ptrace.c: ptrace_regset():
kiov->iov_len = min(kiov->iov_len, (__kernel_size_t) (regset->n * regset->size)); if (req == PTRACE_GETREGSET) return copy_regset_to_user(task, view, regset_no, 0, kiov->iov_len, kiov->iov_base); else return copy_regset_from_user(task, view, regset_no, 0, kiov->iov_len, kiov->iov_base);
For example, there are four kind of combinations, all of them work well.
(1) "older kernel + older gdb", the actual length is 8+(8+8+4+4)*8=200;
(2) "newer kernel + newer gdb", the actual length is 8+(8+8+4+4)*14=344;
(3) "older kernel + newer gdb", the actual length is 8+(8+8+4+4)*8=200;
(4) "newer kernel + older gdb", the actual length is 8+(8+8+4+4)*8=200.
--- arch/loongarch/include/uapi/asm/ptrace.h | 10 ++++++++++ arch/loongarch/kernel/ptrace.c | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-)
arch/loongarch/include/uapi/asm/ptrace.h +10 -0
@@ -72,6 +72,16 @@ struct user_watch_state { } dbg_regs[8 ]; }; +struct user_watch_state_v2 { +uint64_t dbg_info; +struct { +uint64_t addr; +uint64_t mask; +uint32_t ctrl; +uint32_t pad; + } dbg_regs[14 ]; +}; +#define PTRACE_SYSEMU 0x1f#define PTRACE_SYSEMU_SINGLESTEP 0x20
arch/loongarch/kernel/ptrace.c +3 -3
@@ -720,7 +720,7 @@ static int hw_break_set(struct task_struunsigned int note_type = regset->core_note_type;/* Resource info */ - offset = offsetof(struct user_watch_state , dbg_regs); + offset = offsetof(struct user_watch_state_v2 , dbg_regs);user_regset_copyin_ignore (&pos, &count, &kbuf, &ubuf,0 , offset);/* (address, mask, ctrl) registers */
@@ -920,7 +920,7 @@ static const struct user_regset loongarc #ifdef CONFIG_HAVE_HW_BREAKPOINT [REGSET_HW_BREAK ] = { .core_note_type =NT_LOONGARCH_HW_BREAK , - .n =sizeof (struct user_watch_state ) /sizeof (u32), + .n =sizeof (struct user_watch_state_v2 ) /sizeof (u32), .size =sizeof (u32), .align =sizeof (u32), .regset_get = hw_break_get,
@@ -928,7 +928,7 @@ static const struct user_regset loongarc }, [REGSET_HW_WATCH] = { .core_note_type = NT_LOONGARCH_HW_WATCH, - .n = sizeof(struct user_watch_state) / sizeof(u32), + .n = sizeof(struct user_watch_state_v2) / sizeof(u32), .size = sizeof(u32), .align = sizeof(u32), .regset_get = hw_break_get,
Greg Kroah-Hartman
maintainerPATCH 257/443 powerpc/pseries/eeh: Fix get PE state translation
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Narayana Murty N <[email protected]>
commit 11b93559000c686ad7e5ab0547e76f21cc143844 upstream.
The PE Reset State "0" returned by RTAS calls "ibm_read_slot_reset_[state|state2]" indicates that the reset is deactivated and the PE is in a state where MMIO and DMA are allowed. However, the current implementation of "pseries_eeh_get_state()" does not reflect this, causing drivers to incorrectly assume that MMIO and DMA operations cannot be resumed.
The userspace drivers as a part of EEH recovery using VFIO ioctls fail to detect when the recovery process is complete. The VFIO_EEH_PE_GET_STATE ioctl does not report the expected EEH_PE_STATE_NORMAL state, preventing userspace drivers from functioning properly on pseries systems.
The patch addresses this issue by updating 'pseries_eeh_get_state()' to include "EEH_STATE_MMIO_ENABLED" and "EEH_STATE_DMA_ENABLED" in the result mask for PE Reset State "0". This ensures correct state reporting to the callers, aligning the behavior with the PAPR specification and fixing the bug in EEH recovery for VFIO user workflows.
--- arch/powerpc/platforms/pseries/eeh_pseries.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/powerpc/platforms/pseries/eeh_pseries.c +4 -2
@@ -580,8 +580,10 @@ static int pseries_eeh_get_state(structswitch (rets[0 ]) {case 0 : - result =EEH_STATE_MMIO_ACTIVE | -EEH_STATE_DMA_ACTIVE ; + result =EEH_STATE_MMIO_ACTIVE | +EEH_STATE_DMA_ACTIVE | +EEH_STATE_MMIO_ENABLED | +EEH_STATE_DMA_ENABLED ;break ;case 1 : result = EEH_STATE_RESET_ACTIVE |
Greg Kroah-Hartman
maintainerPATCH 258/443 dm-crypt: dont update io->sector after kcryptd_crypt_write_io_submit()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hou Tao <[email protected]>
commit 9fdbbdbbc92b1474a87b89f8b964892a63734492 upstream.
The updates of io->sector are the leftovers when dm-crypt allocated pages for partial write request. However, since commit cf2f1abfbd0db ("dm crypt: don't allocate pages for a partial request"), there is no partial request anymore.
After the introduction of write request rb-tree, the updates of io->sectors may interfere the insertion procedure, because ->sectors of these write requests which have already been added in the rb-tree may be changed during the insertion of new write request.
Fix it by removing these buggy updates of io->sectors. Considering these updates only effect the write request rb-tree, the commit which introduces the write request rb-tree is used as the fix tag.
--- drivers/md/dm-crypt.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/md/dm-crypt.c +3 -11
@@ -2092,7 +2092,6 @@ static void kcryptd_crypt_write_continuestruct crypt_config *cc = io->cc;struct convert_context *ctx = &io->ctx;int crypt_finished; -sector_t sector = io->sector;blk_status_t r;wait_for_completion (&ctx->restart);
@@ -2109,10 +2108,8 @@ static void kcryptd_crypt_write_continue }/* Encryption was already finished, submit io now */ -if (crypt_finished) { +if (crypt_finished)kcryptd_crypt_write_io_submit (io,0 ); - io->sector = sector; - }crypt_dec_pending (io); }
@@ -2123,14 +2120,13 @@ static void kcryptd_crypt_write_convert(struct convert_context *ctx = &io->ctx;struct bio *clone;int crypt_finished; -sector_t sector = io->sector;blk_status_t r;/* * Prevent io from disappearing until this function completes. */ crypt_inc_pending (io); -crypt_convert_init (cc, ctx,NULL , io->base_bio, sector); +crypt_convert_init (cc, ctx,NULL , io->base_bio, io->sector); clone =crypt_alloc_buffer (io, io->base_bio->bi_iter.bi_size);if (unlikely (!clone)) {
@@ -2147,8 +2143,6 @@ static void kcryptd_crypt_write_convert( io->ctx.iter_in = clone->bi_iter; } - sector +=bio_sectors (clone); -crypt_inc_pending (io); r =crypt_convert (cc, ctx,test_bit (DM_CRYPT_NO_WRITE_WORKQUEUE , &cc->flags), true);
@@ -2172,10 +2166,8 @@ static void kcryptd_crypt_write_convert( }/* Encryption was already finished, submit io now */ -if (crypt_finished) { +if (crypt_finished)kcryptd_crypt_write_io_submit (io,0 ); - io->sector = sector; - } dec:crypt_dec_pending (io);
Greg Kroah-Hartman
maintainerPATCH 259/443 dm-crypt: track tag_offset in convert_context
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hou Tao <[email protected]>
commit 8b8f8037765757861f899ed3a2bfb34525b5c065 upstream.
dm-crypt uses tag_offset to index the integrity metadata for each crypt sector. When the initial crypt_convert() returns BLK_STS_DEV_RESOURCE, dm-crypt will try to continue the crypt/decrypt procedure in a kworker. However, it resets tag_offset as zero instead of using the tag_offset related with current sector. It may return unexpected data when using random IV or return unexpected integrity related error.
Fix the problem by tracking tag_offset in per-IO convert_context. Therefore, when the crypt/decrypt procedure continues in a kworker, it could use the next tag_offset saved in convert_context.
--- drivers/md/dm-crypt.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/md/dm-crypt.c +7 -6
@@ -59,6 +59,7 @@ struct convert_context {struct bio *bio_out;struct bvec_iter iter_out;atomic_t cc_pending; +unsigned int tag_offset;u64 cc_sector;union {struct skcipher_request *req;
@@ -1256,6 +1257,7 @@ static void crypt_convert_init(struct crif (bio_out) ctx->iter_out = bio_out->bi_iter; ctx->cc_sector = sector + cc->iv_offset; + ctx->tag_offset =0 ;init_completion (&ctx->restart); }
@@ -1588,7 +1590,6 @@ static void crypt_free_req(struct crypt_static blk_status_t crypt_convert (struct crypt_config *cc,struct convert_context *ctx,bool atomic,bool reset_pending) { -unsigned int tag_offset =0 ;unsigned int sector_step = cc->sector_size >>SECTOR_SHIFT ;int r;
@@ -1611,9 +1612,9 @@ static blk_status_t crypt_convert(structatomic_inc (&ctx->cc_pending);if (crypt_integrity_aead (cc)) - r =crypt_convert_block_aead (cc, ctx, ctx->r.req_aead, tag_offset); + r =crypt_convert_block_aead (cc, ctx, ctx->r.req_aead, ctx->tag_offset);else - r =crypt_convert_block_skcipher (cc, ctx, ctx->r.req, tag_offset); + r =crypt_convert_block_skcipher (cc, ctx, ctx->r.req, ctx->tag_offset);switch (r) {/*
@@ -1633,8 +1634,8 @@ static blk_status_t crypt_convert(struct* exit and continue processing in a workqueue */ ctx->r.req =NULL ; + ctx->tag_offset++; ctx->cc_sector += sector_step; - tag_offset++;return BLK_STS_DEV_RESOURCE ; } }else {
@@ -1648,8 +1649,8 @@ static blk_status_t crypt_convert(struct*/ case -EINPROGRESS : ctx->r.req =NULL ; + ctx->tag_offset++; ctx->cc_sector += sector_step; - tag_offset++;continue ;/* * The request was already processed (synchronously).
@@ -1657,7 +1658,7 @@ static blk_status_t crypt_convert(structcase 0 :atomic_dec (&ctx->cc_pending); ctx->cc_sector += sector_step; - tag_offset++; + ctx->tag_offset++;if (!atomic)cond_resched ();continue ;
Greg Kroah-Hartman
maintainerPATCH 260/443 mips/math-emu: fix emulation of the prefx instruction
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mateusz Jończyk <[email protected]>
commit 42a39e4aa59a10aa4afdc14194f3ee63d2db94e1 upstream.
Currently, installation of Debian 12.8 for mipsel fails on machines without an FPU [1]. This is caused by the fact that zstd (which is used for initramfs compression) executes the prefx instruction, which is not emulated properly by the kernel.
The prefx (Prefetch Indexed) instruction fetches data from memory into the cache without any side effects. Though functionally unrelated, it requires an FPU [2].
Bytecode format of this instruction ends on "001111" binary:
(prefx instruction format) & 0x0000003f = 0x0000000f
The code in fpux_emu() runs like so:
#define MIPSInst(x) x
#define MIPSInst_FMA_FFMT(x) (MIPSInst(x) & 0x00000007)
#define MIPSInst_FUNC(x) (MIPSInst(x) & 0x0000003f)
enum cop1x_func { ..., pfetch_op = 0x0f, ... };
...
switch (MIPSInst_FMA_FFMT(ir)) {
...
case 0x3:
if (MIPSInst_FUNC(ir) != pfetch_op)
return SIGILL;
/* ignore prefx operation */
break;
default:
return SIGILL;
}That snippet above contains a logic error and the
if (MIPSInst_FUNC(ir) != pfetch_op)
comparison always fires.
When MIPSInst_FUNC(ir) is equal to pfetch_op, ir must end on 001111 binary. In this case, MIPSInst_FMA_FFMT(ir) must be equal to 0x7, which does not match that case label.
This causes emulation failure for the prefx instruction. Fix it.
This has been broken by
commit 919af8b96c89 ("MIPS: Make definitions of MIPSInst_FMA_{FUNC,FMTM} consistent with MIPS64 manual") which modified the MIPSInst_FMA_FFMT macro without updating the users.
[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1091858
[2] MIPS Architecture For Programmers Volume II-A: The MIPS32 Instruction Set
--- arch/mips/math-emu/cp1emu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/math-emu/cp1emu.c +1 -1
@@ -1660,7 +1660,7 @@ static int fpux_emu(struct pt_regs *xcp,break ; } -case 0x3 : +case 0x7 :if (MIPSInst_FUNC (ir) != pfetch_op)return SIGILL ;
Greg Kroah-Hartman
maintainerPATCH 261/443 MIPS: pci-legacy: Override pci_address_to_pio
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiaxun Yang <[email protected]>
commit df1b8d6e89db0edd572a1e375f5d3dd5575b9a9b upstream.
pci-legacy systems are not using logic_pio to managed PIO allocations, thus the generic pci_address_to_pio won't work when PCI_IOBASE is defined.
Override the function to use architecture implementation to fix the problem.
--- arch/mips/pci/pci-legacy.c | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/mips/pci/pci-legacy.c +8 -0
@@ -29,6 +29,14 @@ static LIST_HEAD(controllers);static int pci_initialized; +unsigned long pci_address_to_pio (phys_addr_t address) +{ +if (address >IO_SPACE_LIMIT ) +return (unsigned long )-1 ; + +return (unsigned long ) address; +} +/* * We need to avoid collisions with `mirrored' VGA ports * and other strange ISA hardware, so we always want the
Greg Kroah-Hartman
maintainerPATCH 262/443 Revert "MIPS: csrc-r4k: Select HAVE_UNSTABLE_SCHED_CLOCK if SMP && 64BIT"
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xi Ruoyao <[email protected]>
commit 078b831638e1aa06dd7ffa9f244c8ac6b2995561 upstream.
This reverts commit 426fa8e4fe7bb914b5977cbce453a9926bf5b2e6.
The commit has caused two issues on Loongson 3A4000:
1. The timestamp in dmesg become erratic, like:
[3.736957] amdgpu 0000:04:00.0: ... ...
[3.748895] [drm] Initialized amdgpu ... ...
[18446744073.381141] amdgpu 0000:04:00:0: ... ...
[1.613326] igb 0000:03:00.0 enp3s0: ... ...2. More seriously, some workloads (for example, the test stdlib/test-cxa_atexit2 in the Glibc test suite) triggers an RCU stall and hang the system with a high probably (4 hangs out of 5 tests).
Revert this commit to use jiffie on Loongson MIPS systems and fix these issues for now. The root cause may need more investigation.
--- arch/mips/Kconfig | 1 - 1 file changed, 1 deletion(-)
arch/mips/Kconfig +0 -1
@@ -1084,7 +1084,6 @@ config CSRC_IOASIC config CSRC_R4K select CLOCKSOURCE_WATCHDOG if CPU_FREQ - select HAVE_UNSTABLE_SCHED_CLOCK if SMP && 64BIT bool config CSRC_SB1250
Greg Kroah-Hartman
maintainerPATCH 263/443 block: dont revert iter for -EIOCBQUEUED
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Axboe <[email protected]>
commit b13ee668e8280ca5b07f8ce2846b9957a8a10853 upstream.
blkdev_read_iter() has a few odd checks, like gating the position and count adjustment on whether or not the result is bigger-than-or-equal to zero (where bigger than makes more sense), and not checking the return value of blkdev_direct_IO() before doing an iov_iter_revert(). The latter can lead to attempting to revert with a negative value, which when passed to iov_iter_revert() as an unsigned value will lead to throwing a WARN_ON() because unroll is bigger than MAX_RW_COUNT.
Be sane and don't revert for -EIOCBQUEUED, like what is done in other spots.
--- block/fops.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
block/fops.c +3 -2
@@ -758,11 +758,12 @@ static ssize_t blkdev_read_iter(struct kfile_accessed (iocb->ki_filp); ret =blkdev_direct_IO (iocb, to); -if (ret >=0 ) { +if (ret >0 ) { iocb->ki_pos += ret; count -= ret; } -iov_iter_revert (to, count -iov_iter_count (to)); +if (ret != -EIOCBQUEUED ) +iov_iter_revert (to, count -iov_iter_count (to));if (ret <0 || !count) goto reexpand; }
Greg Kroah-Hartman
maintainerPATCH 264/443 Revert "media: uvcvideo: Require entities to have a non-zero unique ID"
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thadeu Lima de Souza Cascardo <[email protected]>
commit 8004d635f27bbccaa5c083c50d4d5302a6ffa00e upstream.
This reverts commit 3dd075fe8ebbc6fcbf998f81a75b8c4b159a6195.
Tomasz has reported that his device, Generalplus Technology Inc. 808 Camera, with ID 1b3f:2002, stopped being detected:
$ ls -l /dev/video* zsh: no matches found: /dev/video* [ 7.230599] usb 3-2: Found multiple Units with ID 5
This particular device is non-compliant, having both the Output Terminal and Processing Unit with ID 5. uvc_scan_fallback, though, is able to build a chain. However, when media elements are added and uvc_mc_create_links call uvc_entity_by_id, it will get the incorrect entity, media_create_pad_link will WARN, and it will fail to register the entities.
In order to reinstate support for such devices in a timely fashion, reverting the fix for these warnings is appropriate. A proper fix that considers the existence of such non-compliant devices will be submitted in a later development cycle.
--- drivers/media/usb/uvc/uvc_driver.c | 70 ++++++++++++++----------------------- 1 file changed, 27 insertions(+), 43 deletions(-)
drivers/media/usb/uvc/uvc_driver.c +27 -43
@@ -775,27 +775,14 @@ static const u8 uvc_media_transport_inpuUVC_GUID_UVC_MEDIA_TRANSPORT_INPUT ;static const u8 uvc_processing_guid[16 ] =UVC_GUID_UVC_PROCESSING ; -static struct uvc_entity *uvc_alloc_new_entity (struct uvc_device *dev,u16 type, -u16 id,unsigned int num_pads, -unsigned int extra_size) +static struct uvc_entity *uvc_alloc_entity (u16 type,u16 id, +unsigned int num_pads,unsigned int extra_size) {struct uvc_entity *entity;unsigned int num_inputs;unsigned int size;unsigned int i; -/* Per UVC 1.1+ spec 3.7.2, the ID should be non-zero. */ -if (id ==0 ) { -dev_err (&dev->udev->dev,"Found Unit with invalid ID 0.\n" ); -return ERR_PTR (-EINVAL ); - } - -/* Per UVC 1.1+ spec 3.7.2, the ID is unique. */ -if (uvc_entity_by_id (dev, id)) { -dev_err (&dev->udev->dev,"Found multiple Units with ID %u\n" , id); -return ERR_PTR (-EINVAL ); - } - extra_size =roundup (extra_size,sizeof (*entity->pads));if (num_pads) num_inputs = type &UVC_TERM_OUTPUT ? num_pads : num_pads -1 ;
@@ -805,7 +792,7 @@ static struct uvc_entity *uvc_alloc_new_ + num_inputs; entity =kzalloc (size,GFP_KERNEL );if (entity ==NULL ) -return ERR_PTR (-ENOMEM ); +return NULL ; entity->id = id; entity->type = type;
@@ -917,10 +904,10 @@ static int uvc_parse_vendor_control(strubreak ; } - unit =uvc_alloc_new_entity (dev,UVC_VC_EXTENSION_UNIT , - buffer[3 ], p +1 ,2 * n); -if (IS_ERR (unit)) -return PTR_ERR (unit); + unit =uvc_alloc_entity (UVC_VC_EXTENSION_UNIT , buffer[3 ], + p +1 ,2 *n); +if (unit ==NULL ) +return -ENOMEM ;memcpy (unit->guid, &buffer[4 ],16 ); unit->extension.bNumControls = buffer[20 ];
@@ -1029,10 +1016,10 @@ static int uvc_parse_standard_control(streturn -EINVAL ; } - term =uvc_alloc_new_entity (dev, type |UVC_TERM_INPUT , - buffer[3 ],1 , n + p); -if (IS_ERR (term)) -return PTR_ERR (term); + term =uvc_alloc_entity (type |UVC_TERM_INPUT , buffer[3 ], +1 , n + p); +if (term ==NULL ) +return -ENOMEM ;if (UVC_ENTITY_TYPE (term) ==UVC_ITT_CAMERA ) { term->camera.bControlSize = n;
@@ -1088,10 +1075,10 @@ static int uvc_parse_standard_control(streturn 0 ; } - term =uvc_alloc_new_entity (dev, type |UVC_TERM_OUTPUT , - buffer[3 ],1 ,0 ); -if (IS_ERR (term)) -return PTR_ERR (term); + term =uvc_alloc_entity (type |UVC_TERM_OUTPUT , buffer[3 ], +1 ,0 ); +if (term ==NULL ) +return -ENOMEM ;memcpy (term->baSourceID, &buffer[7 ],1 );
@@ -1110,10 +1097,9 @@ static int uvc_parse_standard_control(streturn -EINVAL ; } - unit =uvc_alloc_new_entity (dev, buffer[2 ], buffer[3 ], - p +1 ,0 ); -if (IS_ERR (unit)) -return PTR_ERR (unit); + unit =uvc_alloc_entity (buffer[2 ], buffer[3 ], p +1 ,0 ); +if (unit ==NULL ) +return -ENOMEM ;memcpy (unit->baSourceID, &buffer[5 ], p);
@@ -1133,9 +1119,9 @@ static int uvc_parse_standard_control(streturn -EINVAL ; } - unit =uvc_alloc_new_entity (dev, buffer[2 ], buffer[3 ],2 , n); -if (IS_ERR (unit)) -return PTR_ERR (unit); + unit =uvc_alloc_entity (buffer[2 ], buffer[3 ],2 , n); +if (unit ==NULL ) +return -ENOMEM ;memcpy (unit->baSourceID, &buffer[4 ],1 ); unit->processing.wMaxMultiplier =
@@ -1162,10 +1148,9 @@ static int uvc_parse_standard_control(streturn -EINVAL ; } - unit =uvc_alloc_new_entity (dev, buffer[2 ], buffer[3 ], - p +1 , n); -if (IS_ERR (unit)) -return PTR_ERR (unit); + unit =uvc_alloc_entity (buffer[2 ], buffer[3 ], p +1 , n); +if (unit ==NULL ) +return -ENOMEM ;memcpy (unit->guid, &buffer[4 ],16 ); unit->extension.bNumControls = buffer[20 ];
@@ -1305,10 +1290,9 @@ static int uvc_gpio_parse(struct uvc_devreturn dev_err_probe (&dev->udev->dev, irq,"No IRQ for privacy GPIO\n" ); - unit =uvc_alloc_new_entity (dev,UVC_EXT_GPIO_UNIT , -UVC_EXT_GPIO_UNIT_ID ,0 ,1 ); -if (IS_ERR (unit)) -return PTR_ERR (unit); + unit =uvc_alloc_entity (UVC_EXT_GPIO_UNIT ,UVC_EXT_GPIO_UNIT_ID ,0 ,1 ); +if (!unit) +return -ENOMEM ; unit->gpio.gpio_privacy = gpio_privacy; unit->gpio.irq = irq;
Greg Kroah-Hartman
maintainerPATCH 265/443 firmware: qcom: scm: Fix missing read barrier in qcom_scm_is_available()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 0a744cceebd0480cb39587b3b1339d66a9d14063 upstream.
Commit 2e4955167ec5 ("firmware: qcom: scm: Fix __scm and waitq completion variable initialization") introduced a write barrier in probe function to store global '__scm' variable. It also claimed that it added a read barrier, because as we all known barriers are paired (see memory-barriers.txt: "Note that write barriers should normally be paired with read or address-dependency barriers"), however it did not really add it.
The offending commit used READ_ONCE() to access '__scm' global which is not a barrier.
The barrier is needed so the store to '__scm' will be properly visible. This is most likely not fatal in current driver design, because missing read barrier would mean qcom_scm_is_available() callers will access old value, NULL. Driver does not support unbinding and does not correctly handle probe failures, thus there is no risk of stale or old pointer in '__scm' variable.
However for code correctness, readability and to be sure that we did not mess up something in this tricky topic of SMP barriers, add a read barrier for accessing '__scm'. Change also comment from useless/obvious what does barrier do, to what is expected: which other parts of the code are involved here.
--- drivers/firmware/qcom/qcom_scm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/firmware/qcom/qcom_scm.c +3 -2
@@ -1867,7 +1867,8 @@ static int qcom_scm_qseecom_init(struct*/ bool qcom_scm_is_available (void ) { -return !!READ_ONCE (__scm); +/* Paired with smp_store_release() in qcom_scm_probe */ +return !!smp_load_acquire (&__scm); }EXPORT_SYMBOL_GPL (qcom_scm_is_available);
@@ -2024,7 +2025,7 @@ static int qcom_scm_probe(struct platforif (ret)return ret; -/* Let all above stores be available after this */ +/* Paired with smp_load_acquire() in qcom_scm_is_available(). */ smp_store_release (&__scm, scm); irq =platform_get_irq_optional (pdev,0 );
Greg Kroah-Hartman
maintainerPATCH 266/443 firmware: qcom: scm: Fix missing read barrier in qcom_scm_get_tzmem_pool()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit b628510397b5cafa1f5d3e848a28affd1c635302 upstream.
Commit 2e4955167ec5 ("firmware: qcom: scm: Fix __scm and waitq completion variable initialization") introduced a write barrier in probe function to store global '__scm' variable. We all known barriers are paired (see memory-barriers.txt: "Note that write barriers should normally be paired with read or address-dependency barriers"), therefore accessing it from concurrent contexts requires read barrier. Previous commit added such barrier in qcom_scm_is_available(), so let's use that directly.
Lack of this read barrier can result in fetching stale '__scm' variable value, NULL, and dereferencing it.
Note that barrier in qcom_scm_is_available() satisfies here the control dependency.
--- drivers/firmware/qcom/qcom_scm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/firmware/qcom/qcom_scm.c +4 -1
@@ -217,7 +217,10 @@ static DEFINE_SPINLOCK(scm_query_lock);struct qcom_tzmem_pool *qcom_scm_get_tzmem_pool (void ) { -return __scm ? __scm->mempool :NULL ; +if (!qcom_scm_is_available ()) +return NULL ; + +return __scm->mempool; }static enum qcom_scm_convention __get_convention (void )
Greg Kroah-Hartman
maintainerPATCH 267/443 ALSA: hda/realtek: Enable headset mic on Positivo C6400
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Edson Juliano Drosdeck <[email protected]>
commit 1aec3ed2e3e1512aba15e7e790196a44efd5f0a7 upstream.
Positivo C6400 is equipped with ALC269VB, and it needs ALC269VB_FIXUP_ASUS_ZENBOOK quirk to make its headset mic work. Also must to limits the microphone boost.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -10965,6 +10965,7 @@ static const struct hda_quirk alc269_fixSND_PCI_QUIRK (0x17aa ,0x511f ,"Thinkpad" ,ALC298_FIXUP_TPT470_DOCK ),SND_PCI_QUIRK (0x17aa ,0x9e54 ,"LENOVO NB" ,ALC269_FIXUP_LENOVO_EAPD ),SND_PCI_QUIRK (0x17aa ,0x9e56 ,"Lenovo ZhaoYang CF4620Z" ,ALC286_FIXUP_SONY_MIC_NO_PRESENCE ), +SND_PCI_QUIRK (0x1849 ,0x0269 ,"Positivo Master C6400" ,ALC269VB_FIXUP_ASUS_ZENBOOK ),SND_PCI_QUIRK (0x1849 ,0x1233 ,"ASRock NUC Box 1100" ,ALC233_FIXUP_NO_AUDIO_JACK ),SND_PCI_QUIRK (0x1849 ,0xa233 ,"Positivo Master C6300" ,ALC269_FIXUP_HEADSET_MIC ), SND_PCI_QUIRK(0x1854, 0x0440, "LG CQ6", ALC256_FIXUP_HEADPHONE_AMP_VOL),
Greg Kroah-Hartman
maintainerPATCH 268/443 ALSA: hda/realtek: Fix quirk matching for Legion Pro 7
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 0f3a822ae2254a1e7ce3a130a1efd94e2cab73ee upstream.
The recent cleanup of the quirk table entries with the codec ID matching caused a regression on some Lenovo Legion 7 models with PCI SSID 17aa:386f: it assumed wrongly as if the codec SSID on the machine were also 17aa:386f, but in this case, it was 17aa:38a8. This made the binding with a wrong sub-codec, instead of TAS2781, the Cirrus codec was bound.
For addressing the regression, correct the quirk entry to the right value 17aa:38a8.
Note that this makes the entry appearing in an unsorted position. This exception is needed because the entry must match before the PCI SSID 17aa:386f.
Also there is another entry for 17aa:38a8, but the latter is for PCI SSID matching while the new entry is for the codec SSID matching.
--- sound/pci/hda/patch_realtek.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/patch_realtek.c +1 -1
@@ -10890,7 +10890,7 @@ static const struct hda_quirk alc269_fixSND_PCI_QUIRK (0x17aa ,0x3869 ,"Lenovo Yoga7 14IAL7" ,ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN ),HDA_CODEC_QUIRK (0x17aa ,0x386e ,"Legion Y9000X 2022 IAH7" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x17aa ,0x386e ,"Yoga Pro 7 14ARP8" ,ALC285_FIXUP_SPEAKER2_TO_DAC1 ), -HDA_CODEC_QUIRK (0x17aa ,0x386f ,"Legion Pro 7 16ARX8H" ,ALC287_FIXUP_TAS2781_I2C ), +HDA_CODEC_QUIRK (0x17aa ,0x38a8 ,"Legion Pro 7 16ARX8H" ,ALC287_FIXUP_TAS2781_I2C ),/* this must match before PCI SSID 17aa:386f below */ SND_PCI_QUIRK (0x17aa ,0x386f ,"Legion Pro 7i 16IAX7" ,ALC287_FIXUP_CS35L41_I2C_2 ),SND_PCI_QUIRK (0x17aa ,0x3870 ,"Lenovo Yoga 7 14ARB7" ,ALC287_FIXUP_YOGA7_14ARB7_I2C ), SND_PCI_QUIRK(0x17aa, 0x3877, "Lenovo Legion 7 Slim 16ARHA7", ALC287_FIXUP_CS35L41_I2C_2),
Greg Kroah-Hartman
maintainerPATCH 269/443 ALSA: hda: Fix headset detection failure due to unstable sort
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuan-Wei Chiu <[email protected]>
commit 3b4309546b48fc167aa615a2d881a09c0a97971f upstream.
The auto_parser assumed sort() was stable, but the kernel's sort() uses heapsort, which has never been stable. After commit 0e02ca29a563 ("lib/sort: optimize heapsort with double-pop variation"), the order of equal elements changed, causing the headset to fail to work.
Fix the issue by recording the original order of elements before sorting and using it as a tiebreaker for equal elements in the comparison function.
--- sound/pci/hda/hda_auto_parser.c | 8 +++++++- sound/pci/hda/hda_auto_parser.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-)
sound/pci/hda/hda_auto_parser.c +7 -1
@@ -80,7 +80,11 @@ static int compare_input_type(const void/* In case one has boost and the other one has not, pick the one with boost first. */ -return (int )(b->has_boost_on_pin - a->has_boost_on_pin); +if (a->has_boost_on_pin != b->has_boost_on_pin) +return (int )(b->has_boost_on_pin - a->has_boost_on_pin); + +/* Keep the original order */ +return a->order - b->order; }/* Reorder the surround channels
@@ -400,6 +404,8 @@ int snd_hda_parse_pin_defcfg(struct hda_reorder_outputs (cfg->speaker_outs, cfg->speaker_pins);/* sort inputs in the order of AUTO_PIN_* type */ +for (i =0 ; i < cfg->num_inputs; i++) + cfg->inputs[i].order = i;sort (cfg->inputs, cfg->num_inputs,sizeof (cfg->inputs[0 ]), compare_input_type,NULL );
sound/pci/hda/hda_auto_parser.h +1 -0
@@ -37,6 +37,7 @@ struct auto_pin_cfg_item { unsigned int is_headset_mic:1; unsigned int is_headphone_mic:1; /* Mic-only in headphone jack */ unsigned int has_boost_on_pin:1; +int order; };struct auto_pin_cfg ;
Greg Kroah-Hartman
maintainerPATCH 270/443 ALSA: hda/realtek: Workaround for resume on Dell Venue 11 Pro 7130
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 8c2fa44132e8cd1b05c77a705adb8d1f5a5daf3f upstream.
It was reported that the headphone output on Dell Venue 11 Pro 7130 becomes mono after PM resume. The cause seems to be the BIOS setting up the codec COEF 0x0d bit 0x40 wrongly by some reason, and restoring the original value 0x2800 fixes the problem.
This patch adds the quirk entry to perform the COEF restore.
--- sound/pci/hda/patch_realtek.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
sound/pci/hda/patch_realtek.c +16 -0
@@ -7485,6 +7485,16 @@ static void alc287_fixup_lenovo_thinkpad spec->gen.pcm_playback_hook = alc287_alc1318_playback_pcm_hook; } +/* +* Clear COEF 0x0d (PCBEEP passthrough) bit 0x40 where BIOS sets it wrongly +* at PM resume +*/ +static void alc283_fixup_dell_hp_resume (struct hda_codec *codec, +const struct hda_fixup *fix,int action) +{ +if (action ==HDA_FIXUP_ACT_INIT ) +alc_write_coef_idx (codec,0xd ,0x2800 ); +}enum {ALC269_FIXUP_GPIO2 ,
@@ -7785,6 +7795,7 @@ enum {ALC269_FIXUP_VAIO_VJFH52_MIC_NO_PRESENCE ,ALC233_FIXUP_MEDION_MTL_SPK ,ALC294_FIXUP_BASS_SPEAKER_15 , + ALC283_FIXUP_DELL_HP_RESUME, };/* A special fixup for Lenovo C940 and Yoga Duet 7;
@@ -10117,6 +10128,10 @@ static const struct hda_fixup alc269_fix .type = HDA_FIXUP_FUNC, .v.func = alc294_fixup_bass_speaker_15, }, + [ALC283_FIXUP_DELL_HP_RESUME] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc283_fixup_dell_hp_resume, + }, }; static const struct hda_quirk alc269_fixup_tbl[] = {
@@ -10177,6 +10192,7 @@ static const struct hda_quirk alc269_fixSND_PCI_QUIRK (0x1028 ,0x05f4 ,"Dell" ,ALC269_FIXUP_DELL1_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1028 ,0x05f5 ,"Dell" ,ALC269_FIXUP_DELL1_MIC_NO_PRESENCE ),SND_PCI_QUIRK (0x1028 ,0x05f6 ,"Dell" ,ALC269_FIXUP_DELL1_MIC_NO_PRESENCE ), +SND_PCI_QUIRK (0x1028 ,0x0604 ,"Dell Venue 11 Pro 7130" ,ALC283_FIXUP_DELL_HP_RESUME ),SND_PCI_QUIRK (0x1028 ,0x0615 ,"Dell Vostro 5470" ,ALC290_FIXUP_SUBWOOFER_HSJACK ),SND_PCI_QUIRK (0x1028 ,0x0616 ,"Dell Vostro 5470" ,ALC290_FIXUP_SUBWOOFER_HSJACK ), SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
Greg Kroah-Hartman
maintainerPATCH 271/443 arm64: tegra: Fix Tegra234 PCIe interrupt-map
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brad Griffis <[email protected]>
commit b615fbd70fce8582d92b3bdbbf3c9b80cadcfb55 upstream.
For interrupt-map entries, the DTS specification requires that #address-cells is defined for both the child node and the interrupt parent. For the PCIe interrupt-map entries, the parent node ("gic") has not specified #address-cells. The existing layout of the PCIe interrupt-map entries indicates that it assumes that #address-cells is zero for this node.
Explicitly set #address-cells to zero for "gic" so that it complies with the device tree specification.
NVIDIA EDK2 works around this issue by assuming #address-cells is zero in this scenario, but that workaround is being removed and so this update is needed or else NVIDIA EDK2 cannot successfully parse the device tree and the board cannot boot.
--- arch/arm64/boot/dts/nvidia/tegra234.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/nvidia/tegra234.dtsi +2 -0
@@ -4018,6 +4018,8 @@ #redistributor-regions = <1>; #interrupt-cells = <3>; interrupt-controller; + + #address-cells = <0>; }; smmu_iso: iommu@10000000 {
Greg Kroah-Hartman
maintainerPATCH 272/443 s390/pci: Fix SR-IOV for PFs initially in standby
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Schnelle <[email protected]>
commit dc287e4c9149ab54a5003b4d4da007818b5fda3d upstream.
Since commit 25f39d3dcb48 ("s390/pci: Ignore RID for isolated VFs") PFs which are not initially configured but in standby are considered isolated. That is they create only a single function PCI domain. Due to the PCI domains being created on discovery, this means that even if they are configured later on, sibling PFs and their child VFs will not be added to their PCI domain breaking SR-IOV expectations.
The reason the referenced commit ignored standby PFs for the creation of multi-function PCI subhierarchies, was to work around a PCI domain renumbering scenario on reboot. The renumbering would occur after removing a previously in standby PF, whose domain number is used for its configured sibling PFs and their child VFs, but which itself remained in standby. When this is followed by a reboot, the sibling PF is used instead to determine the PCI domain number of it and its child VFs.
In principle it is not possible to know which standby PFs will be configured later and which may be removed. The PCI domain and root bus are pre-requisites for hotplug slots so the decision of which functions belong to which domain can not be postponed. With the renumbering occurring only in rare circumstances and being generally benign, accept it as an oddity and fix SR-IOV for initially standby PFs simply by allowing them to create PCI domains.
--- arch/s390/pci/pci_bus.c | 1 - 1 file changed, 1 deletion(-)
arch/s390/pci/pci_bus.c +0 -1
@@ -171,7 +171,6 @@ void zpci_bus_scan_busses(void)static bool zpci_bus_is_multifunction_root (struct zpci_dev *zdev) {return !s390_pci_no_rid && zdev->rid_available && -zpci_is_device_configured (zdev) && !zdev->vfn; }
Greg Kroah-Hartman
maintainerPATCH 273/443 PCI: Avoid putting some root ports into D3 on TUXEDO Sirius Gen1
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Werner Sembach <[email protected]>
commit b1049f2d68693c80a576c4578d96774a68df2bad upstream.
commit 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during suspend") sets the policy that all PCIe ports are allowed to use D3. When the system is suspended if the port is not power manageable by the platform and won't be used for wakeup via a PME this sets up the policy for these ports to go into D3hot.
This policy generally makes sense from an OSPM perspective but it leads to problems with wakeup from suspend on the TUXEDO Sirius 16 Gen 1 with a specific old BIOS. This manifests as a system hang.
On the affected Device + BIOS combination, add a quirk for the root port of the problematic controller to ensure that these root ports are not put into D3hot at suspend.
This patch is based on
https://lore.kernel.org/linux-pci/[email protected]
but with the added condition both in the documentation and in the code to apply only to the TUXEDO Sirius 16 Gen 1 with a specific old BIOS and only the affected root ports.
--- arch/x86/pci/fixup.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
arch/x86/pci/fixup.c +30 -0
@@ -1010,4 +1010,34 @@ DECLARE_PCI_FIXUP_SUSPEND(PCI_VENDOR_ID_DECLARE_PCI_FIXUP_RESUME (PCI_VENDOR_ID_AMD ,0x1668 , amd_rp_pme_resume);DECLARE_PCI_FIXUP_SUSPEND (PCI_VENDOR_ID_AMD ,0x1669 , amd_rp_pme_suspend);DECLARE_PCI_FIXUP_RESUME (PCI_VENDOR_ID_AMD ,0x1669 , amd_rp_pme_resume); + +/* +* Putting PCIe root ports on Ryzen SoCs with USB4 controllers into D3hot +* may cause problems when the system attempts wake up from s2idle. +* +* On the TUXEDO Sirius 16 Gen 1 with a specific old BIOS this manifests as +* a system hang. +*/ +static const struct dmi_system_id quirk_tuxeo_rp_d3_dmi_table[] = { + { + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), +DMI_EXACT_MATCH (DMI_BOARD_NAME ,"APX958" ), +DMI_EXACT_MATCH (DMI_BIOS_VERSION ,"V1.00A00_20240108" ), + }, + }, + {} +}; + +static void quirk_tuxeo_rp_d3 (struct pci_dev *pdev) +{ +struct pci_dev *root_pdev; + +if (dmi_check_system (quirk_tuxeo_rp_d3_dmi_table)) { + root_pdev =pcie_find_root_port (pdev); +if (root_pdev) + root_pdev->dev_flags |=PCI_DEV_FLAGS_NO_D3 ; + } +} +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_AMD ,0x1502 , quirk_tuxeo_rp_d3);#endif /* CONFIG_SUSPEND */
Greg Kroah-Hartman
maintainerPATCH 274/443 PCI: endpoint: Finish virtual EP removal in pci_epf_remove_vepf()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit 3b9f942eb21c92041905e3943a8d5177c9a9d89d upstream.
When removing a virtual Endpoint, pci_epf_remove_vepf() failed to clear epf_vf->epf_pf, which caused a subsequent pci_epf_add_vepf() to incorrectly return -EBUSY:
pci_epf_add_vepf(epf_pf, epf_vf) // add pci_epf_remove_vepf(epf_pf, epf_vf) // remove pci_epf_add_vepf(epf_pf, epf_vf) // add again, -EBUSY error
Fix by clearing epf_vf->epf_pf in pci_epf_remove_vepf().
--- drivers/pci/endpoint/pci-epf-core.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/endpoint/pci-epf-core.c +1 -0
@@ -202,6 +202,7 @@ void pci_epf_remove_vepf(struct pci_epfmutex_lock (&epf_pf->lock);clear_bit (epf_vf->vfunc_no, &epf_pf->vfunction_num_map); + epf_vf->epf_pf =NULL ;list_del (&epf_vf->list);mutex_unlock (&epf_pf->lock); }