6.11.2-rc1 review
Subsystems (5)
Greg Kroah-Hartman
maintainerPATCH 116/695 net: tipc: avoid possible garbage value
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Su Hui <[email protected]>
[ Upstream commit 99655a304e450baaae6b396cb942b9e47659d644 ]
Clang static checker (scan-build) warning:net/tipc/bcast.c:305:4:
The expression is an uninitialized value. The computed value will also be garbage [core.uninitialized.Assign]
305 | (*cong_link_cnt)++;
| ^~~~~~~~~~~~~~~~~~tipc_rcast_xmit() will increase cong_link_cnt's value, but cong_link_cnt is uninitialized. Although it won't really cause a problem, it's better to fix it.
--- net/tipc/bcast.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/tipc/bcast.c +1 -1
@@ -320,8 +320,8 @@ static int tipc_mcast_send_sync(struct net *net, struct sk_buff *skb, {struct tipc_msg *hdr, *_hdr;struct sk_buff_head tmpq; +u16 cong_link_cnt =0 ;struct sk_buff *_skb; -u16 cong_link_cnt;int rc =0 ;/* Is a cluster supporting with new capabilities ? */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 117/695 ipv6: avoid possible NULL deref in rt6_uncached_list_flush_dev()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 04ccecfa959d3b9ae7348780d8e379c6486176ac ]
Blamed commit accidentally removed a check for rt->rt6i_idev being NULL, as spotted by syzbot:
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN PTI KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007] CPU: 1 UID: 0 PID: 10998 Comm: syz-executor Not tainted 6.11.0-rc6-syzkaller-00208-g625403177711 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 RIP: 0010:rt6_uncached_list_flush_dev net/ipv6/route.c:177 [inline] RIP: 0010:rt6_disable_ip+0x33e/0x7e0 net/ipv6/route.c:4914 Code: 41 80 3c 04 00 74 0a e8 90 d0 9b f7 48 8b 7c 24 08 48 8b 07 48 89 44 24 10 4c 89 f0 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <80> 3c 08 00 74 08 4c 89 f7 e8 64 d0 9b f7 48 8b 44 24 18 49 39 06 RSP: 0018:ffffc900047374e0 EFLAGS: 00010246 RAX: 0000000000000000 RBX: 1ffff1100fdf8f33 RCX: dffffc0000000000 RDX: 0000000000000000 RSI: 0000000000000004 RDI: ffff88807efc78c0 RBP: ffffc900047375d0 R08: 0000000000000003 R09: fffff520008e6e8c R10: dffffc0000000000 R11: fffff520008e6e8c R12: 1ffff1100fdf8f18 R13: ffff88807efc7998 R14: 0000000000000000 R15: ffff88807efc7930 FS: 0000000000000000(0000) GS:ffff8880b8900000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000020002a80 CR3: 0000000022f62000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> addrconf_ifdown+0x15d/0x1bd0 net/ipv6/addrconf.c:3856 addrconf_notify+0x3cb/0x1020 notifier_call_chain+0x19f/0x3e0 kernel/notifier.c:93 call_netdevice_notifiers_extack net/core/dev.c:2032 [inline] call_netdevice_notifiers net/core/dev.c:2046 [inline] unregister_netdevice_many_notify+0xd81/0x1c40 net/core/dev.c:11352 unregister_netdevice_many net/core/dev.c:11414 [inline] unregister_netdevice_queue+0x303/0x370 net/core/dev.c:11289 unregister_netdevice include/linux/netdevice.h:3129 [inline] __tun_detach+0x6b9/0x1600 drivers/net/tun.c:685 tun_detach drivers/net/tun.c:701 [inline] tun_chr_close+0x108/0x1b0 drivers/net/tun.c:3510 __fput+0x24a/0x8a0 fs/file_table.c:422 task_work_run+0x24f/0x310 kernel/task_work.c:228 exit_task_work include/linux/task_work.h:40 [inline] do_exit+0xa2f/0x27f0 kernel/exit.c:882 do_group_exit+0x207/0x2c0 kernel/exit.c:1031 __do_sys_exit_group kernel/exit.c:1042 [inline] __se_sys_exit_group kernel/exit.c:1040 [inline] __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1040 x64_sys_call+0x2634/0x2640 arch/x86/include/generated/asm/syscalls_64.h:232 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f1acc77def9 Code: Unable to access opcode bytes at 0x7f1acc77decf. RSP: 002b:00007ffeb26fa738 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f1acc77def9 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000043 RBP: 00007f1acc7dd508 R08: 00007ffeb26f84d7 R09: 0000000000000003 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000001 R13: 0000000000000003 R14: 00000000ffffffff R15: 00007ffeb26fa8e0 </TASK> Modules linked in: ---[ end trace 0000000000000000 ]--- RIP: 0010:rt6_uncached_list_flush_dev net/ipv6/route.c:177 [inline] RIP: 0010:rt6_disable_ip+0x33e/0x7e0 net/ipv6/route.c:4914 Code: 41 80 3c 04 00 74 0a e8 90 d0 9b f7 48 8b 7c 24 08 48 8b 07 48 89 44 24 10 4c 89 f0 48 c1 e8 03 48 b9 00 00 00 00 00 fc ff df <80> 3c 08 00 74 08 4c 89 f7 e8 64 d0 9b f7 48 8b 44 24 18 49 39 06 RSP: 0018:ffffc900047374e0 EFLAGS: 00010246 RAX: 0000000000000000 RBX: 1ffff1100fdf8f33 RCX: dffffc0000000000 RDX: 0000000000000000 RSI: 0000000000000004 RDI: ffff88807efc78c0 RBP: ffffc900047375d0 R08: 0000000000000003 R09: fffff520008e6e8c R10: dffffc0000000000 R11: fffff520008e6e8c R12: 1ffff1100fdf8f18 R13: ffff88807efc7998 R14: 0000000000000000 R15: ffff88807efc7930 FS: 0000000000000000(0000) GS:ffff8880b8900000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000020002a80 CR3: 0000000022f62000 CR4: 00000000003506f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
--- net/ipv6/route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/route.c +1 -1
@@ -174,7 +174,7 @@ static void rt6_uncached_list_flush_dev(struct net_device *dev)struct net_device *rt_dev = rt->dst.dev;bool handled = false; -if (rt_idev->dev == dev) { +if (rt_idev && rt_idev->dev == dev) { rt->rt6i_idev =in6_dev_get (blackhole_netdev);in6_dev_put (rt_idev); handled = true;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 118/695 ublk: move zone report data out of request pdu
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Lei <[email protected]>
[ Upstream commit 9327b51c9a9c864f5177127e09851da9d78b4943 ]
ublk zoned takes 16 bytes in each request pdu just for handling REPORT_ZONE operation, this way does waste memory since request pdu is allocated statically.
Store the transient zone report data into one global xarray, and remove it after the report zone request is completed. This way is reasonable since report zone is run in slow code path.
--- drivers/block/ublk_drv.c | 62 +++++++++++++++++++++++++++++----------- 1 file changed, 46 insertions(+), 16 deletions(-)
drivers/block/ublk_drv.c +46 -16
@@ -71,9 +71,6 @@ struct ublk_rq_data {struct llist_node node;struct kref ref; -__u64 sector; -__u32 operation; -__u32 nr_zones; };struct ublk_uring_cmd_pdu {
@@ -214,6 +211,33 @@ static inline bool ublk_queue_is_zoned(struct ublk_queue *ubq)#ifdef CONFIG_BLK_DEV_ZONED +struct ublk_zoned_report_desc { +__u64 sector; +__u32 operation; +__u32 nr_zones; +}; + +static DEFINE_XARRAY (ublk_zoned_report_descs); + +static int ublk_zoned_insert_report_desc (const struct request *req, +struct ublk_zoned_report_desc *desc) +{ +return xa_insert (&ublk_zoned_report_descs, (unsigned long )req, + desc,GFP_KERNEL ); +} + +static struct ublk_zoned_report_desc *ublk_zoned_erase_report_desc ( +const struct request *req) +{ +return xa_erase (&ublk_zoned_report_descs, (unsigned long )req); +} + +static struct ublk_zoned_report_desc *ublk_zoned_get_report_desc ( +const struct request *req) +{ +return xa_load (&ublk_zoned_report_descs, (unsigned long )req); +} +static int ublk_get_nr_zones (const struct ublk_device *ub) {const struct ublk_param_basic *p = &ub->params.basic;
@@ -308,7 +332,7 @@ static int ublk_report_zones(struct gendisk *disk, sector_t sector,unsigned int zones_in_request = min_t(unsigned int, remaining_zones, max_zones_per_request);struct request *req; -struct ublk_rq_data *pdu; +struct ublk_zoned_report_desc desc;blk_status_t status;memset (buffer,0 , buffer_length);
@@ -319,20 +343,23 @@ static int ublk_report_zones(struct gendisk *disk, sector_t sector, goto out; } - pdu =blk_mq_rq_to_pdu (req); - pdu->operation =UBLK_IO_OP_REPORT_ZONES ; - pdu->sector = sector; - pdu->nr_zones = zones_in_request; + desc.operation =UBLK_IO_OP_REPORT_ZONES ; + desc.sector = sector; + desc.nr_zones = zones_in_request; + ret =ublk_zoned_insert_report_desc (req, &desc); +if (ret) + goto free_req; ret =blk_rq_map_kern (disk->queue, req, buffer, buffer_length,GFP_KERNEL ); -if (ret) { -blk_mq_free_request (req); - goto out; - } +if (ret) + goto erase_desc; status =blk_execute_rq (req,0 ); ret =blk_status_to_errno (status); +erase_desc: +ublk_zoned_erase_report_desc (req); +free_req:blk_mq_free_request (req);if (ret) goto out;
@@ -366,7 +393,7 @@ static blk_status_t ublk_setup_iod_zoned(struct ublk_queue *ubq, {struct ublksrv_io_desc *iod =ublk_get_iod (ubq, req->tag);struct ublk_io *io = &ubq->ios[req->tag]; -struct ublk_rq_data *pdu =blk_mq_rq_to_pdu (req); +struct ublk_zoned_report_desc *desc;u32 ublk_op;switch (req_op (req)) {
@@ -389,12 +416,15 @@ static blk_status_t ublk_setup_iod_zoned(struct ublk_queue *ubq, ublk_op =UBLK_IO_OP_ZONE_RESET_ALL ;break ;case REQ_OP_DRV_IN : - ublk_op = pdu->operation; + desc =ublk_zoned_get_report_desc (req); +if (!desc) +return BLK_STS_IOERR ; + ublk_op = desc->operation;switch (ublk_op) {case UBLK_IO_OP_REPORT_ZONES : iod->op_flags = ublk_op |ublk_req_build_flags (req); - iod->nr_zones = pdu->nr_zones; - iod->start_sector = pdu->sector; + iod->nr_zones = desc->nr_zones; + iod->start_sector = desc->sector;return BLK_STS_OK ;default :return BLK_STS_IOERR ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 119/695 nbd: fix race between timeout and normal completion
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ming Lei <[email protected]>
[ Upstream commit c9ea57c91f03bcad415e1a20113bdb2077bcf990 ]
If request timetout is handled by nbd_requeue_cmd(), normal completion has to be stopped for avoiding to complete this requeued request, other use-after-free can be triggered.
Fix the race by clearing NBD_CMD_INFLIGHT in nbd_requeue_cmd(), meantime make sure that cmd->lock is grabbed for clearing the flag and the requeue.
--- drivers/block/nbd.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/block/nbd.c +12 -1
@@ -181,6 +181,17 @@ static void nbd_requeue_cmd(struct nbd_cmd *cmd) {struct request *req =blk_mq_rq_from_pdu (cmd); +lockdep_assert_held (&cmd->lock); + +/* +* Clear INFLIGHT flag so that this cmd won't be completed in +* normal completion path +* +* INFLIGHT flag will be set when the cmd is queued to nbd next +* time. +*/ +__clear_bit (NBD_CMD_INFLIGHT , &cmd->flags); +if (!test_and_set_bit (NBD_CMD_REQUEUED , &cmd->flags))blk_mq_requeue_request (req, true); }
@@ -488,8 +499,8 @@ static enum blk_eh_timer_return nbd_xmit_timeout(struct request *req)nbd_mark_nsock_dead (nbd, nsock,1 );mutex_unlock (&nsock->tx_lock); } -mutex_unlock (&cmd->lock);nbd_requeue_cmd (cmd); +mutex_unlock (&cmd->lock);nbd_config_put (nbd);return BLK_EH_DONE ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 120/695 block, bfq: fix possible UAF for bfqq->bic with merge chain
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
[ Upstream commit 18ad4df091dd5d067d2faa8fce1180b79f7041a7 ]
1) initial state, three tasks:
Process 1 Process 2 Process 3
(BIC1) (BIC2) (BIC3)
| Λ | Λ | Λ
| | | | | |
V | V | V |
bfqq1 bfqq2 bfqq3
process ref: 1 1 1
2) bfqq1 merged to bfqq2:
Process 1 Process 2 Process 3 (BIC1) (BIC2) (BIC3) | | | Λ \--------------\| | | V V | bfqq1--------->bfqq2 bfqq3
process ref: 0 2 1
3) bfqq2 merged to bfqq3:
Process 1 Process 2 Process 3 (BIC1) (BIC2) (BIC3) here -> Λ | | \--------------\ \-------------\| V V bfqq1--------->bfqq2---------->bfqq3
process ref: 0 1 3
In this case, IO from Process 1 will get bfqq2 from BIC1 first, and then get bfqq3 through merge chain, and finially handle IO by bfqq3. Howerver, current code will think bfqq2 is owned by BIC1, like initial state, and set bfqq2->bic to BIC1.
bfq_insert_request
-> by Process 1
bfqq = bfq_init_rq(rq)
bfqq = bfq_get_bfqq_handle_split
bfqq = bic_to_bfqq
-> get bfqq2 from BIC1
bfqq->ref++
rq->elv.priv[0] = bic
rq->elv.priv[1] = bfqq
if (bfqq_process_refs(bfqq) == 1)
bfqq->bic = bic
-> record BIC1 to bfqq2
__bfq_insert_request
new_bfqq = bfq_setup_cooperator
-> get bfqq3 from bfqq2->new_bfqq
bfqq_request_freed(bfqq)
new_bfqq->ref++
rq->elv.priv[1] = new_bfqq
-> handle IO by bfqq3
Fix the problem by checking bfqq is from merge chain fist. And this might fix a following problem reported by our syzkaller(unreproducible):
==================================================================
BUG: KASAN: slab-use-after-free in bfq_do_early_stable_merge block/bfq-iosched.c:5692 [inline] BUG: KASAN: slab-use-after-free in bfq_do_or_sched_stable_merge block/bfq-iosched.c:5805 [inline] BUG: KASAN: slab-use-after-free in bfq_get_queue+0x25b0/0x2610 block/bfq-iosched.c:5889 Write of size 1 at addr ffff888123839eb8 by task kworker/0:1H/18595 CPU: 0 PID: 18595 Comm: kworker/0:1H Tainted: G L 6.6.0-07439-gba2303cacfda #6 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 Workqueue: kblockd blk_mq_requeue_work Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x91/0xf0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:364 [inline] print_report+0x10d/0x610 mm/kasan/report.c:475 kasan_report+0x8e/0xc0 mm/kasan/report.c:588 bfq_do_early_stable_merge block/bfq-iosched.c:5692 [inline] bfq_do_or_sched_stable_merge block/bfq-iosched.c:5805 [inline] bfq_get_queue+0x25b0/0x2610 block/bfq-iosched.c:5889 bfq_get_bfqq_handle_split+0x169/0x5d0 block/bfq-iosched.c:6757 bfq_init_rq block/bfq-iosched.c:6876 [inline] bfq_insert_request block/bfq-iosched.c:6254 [inline] bfq_insert_requests+0x1112/0x5cf0 block/bfq-iosched.c:6304 blk_mq_insert_request+0x290/0x8d0 block/blk-mq.c:2593 blk_mq_requeue_work+0x6bc/0xa70 block/blk-mq.c:1502 process_one_work kernel/workqueue.c:2627 [inline] process_scheduled_works+0x432/0x13f0 kernel/workqueue.c:2700 worker_thread+0x6f2/0x1160 kernel/workqueue.c:2781 kthread+0x33c/0x440 kernel/kthread.c:388 ret_from_fork+0x4d/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1b/0x30 arch/x86/entry/entry_64.S:305 </TASK> Allocated by task 20776: kasan_save_stack+0x20/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 __kasan_slab_alloc+0x87/0x90 mm/kasan/common.c:328 kasan_slab_alloc include/linux/kasan.h:188 [inline] slab_post_alloc_hook mm/slab.h:763 [inline] slab_alloc_node mm/slub.c:3458 [inline] kmem_cache_alloc_node+0x1a4/0x6f0 mm/slub.c:3503 ioc_create_icq block/blk-ioc.c:370 [inline] ioc_find_get_icq+0x180/0xaa0 block/blk-ioc.c:436 bfq_prepare_request+0x39/0xf0 block/bfq-iosched.c:6812 blk_mq_rq_ctx_init.isra.7+0x6ac/0xa00 block/blk-mq.c:403 __blk_mq_alloc_requests+0xcc0/0x1070 block/blk-mq.c:517 blk_mq_get_new_requests block/blk-mq.c:2940 [inline] blk_mq_submit_bio+0x624/0x27c0 block/blk-mq.c:3042 __submit_bio+0x331/0x6f0 block/blk-core.c:624 __submit_bio_noacct_mq block/blk-core.c:703 [inline] submit_bio_noacct_nocheck+0x816/0xb40 block/blk-core.c:732 submit_bio_noacct+0x7a6/0x1b50 block/blk-core.c:826 xlog_write_iclog+0x7d5/0xa00 fs/xfs/xfs_log.c:1958 xlog_state_release_iclog+0x3b8/0x720 fs/xfs/xfs_log.c:619 xlog_cil_push_work+0x19c5/0x2270 fs/xfs/xfs_log_cil.c:1330 process_one_work kernel/workqueue.c:2627 [inline] process_scheduled_works+0x432/0x13f0 kernel/workqueue.c:2700 worker_thread+0x6f2/0x1160 kernel/workqueue.c:2781 kthread+0x33c/0x440 kernel/kthread.c:388 ret_from_fork+0x4d/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1b/0x30 arch/x86/entry/entry_64.S:305 Freed by task 946: kasan_save_stack+0x20/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x50 mm/kasan/generic.c:522 ____kasan_slab_free mm/kasan/common.c:236 [inline] __kasan_slab_free+0x12c/0x1c0 mm/kasan/common.c:244 kasan_slab_free include/linux/kasan.h:164 [inline] slab_free_hook mm/slub.c:1815 [inline] slab_free_freelist_hook mm/slub.c:1841 [inline] slab_free mm/slub.c:3786 [inline] kmem_cache_free+0x118/0x6f0 mm/slub.c:3808 rcu_do_batch+0x35c/0xe30 kernel/rcu/tree.c:2189 rcu_core+0x819/0xd90 kernel/rcu/tree.c:2462 __do_softirq+0x1b0/0x7a2 kernel/softirq.c:553 Last potentially related work creation: kasan_save_stack+0x20/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0xaf/0xc0 mm/kasan/generic.c:492 __call_rcu_common kernel/rcu/tree.c:2712 [inline] call_rcu+0xce/0x1020 kernel/rcu/tree.c:2826 ioc_destroy_icq+0x54c/0x830 block/blk-ioc.c:105 ioc_release_fn+0xf0/0x360 block/blk-ioc.c:124 process_one_work kernel/workqueue.c:2627 [inline] process_scheduled_works+0x432/0x13f0 kernel/workqueue.c:2700 worker_thread+0x6f2/0x1160 kernel/workqueue.c:2781 kthread+0x33c/0x440 kernel/kthread.c:388 ret_from_fork+0x4d/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1b/0x30 arch/x86/entry/entry_64.S:305 Second to last potentially related work creation: kasan_save_stack+0x20/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0xaf/0xc0 mm/kasan/generic.c:492 __call_rcu_common kernel/rcu/tree.c:2712 [inline] call_rcu+0xce/0x1020 kernel/rcu/tree.c:2826 ioc_destroy_icq+0x54c/0x830 block/blk-ioc.c:105 ioc_release_fn+0xf0/0x360 block/blk-ioc.c:124 process_one_work kernel/workqueue.c:2627 [inline] process_scheduled_works+0x432/0x13f0 kernel/workqueue.c:2700 worker_thread+0x6f2/0x1160 kernel/workqueue.c:2781 kthread+0x33c/0x440 kernel/kthread.c:388 ret_from_fork+0x4d/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1b/0x30 arch/x86/entry/entry_64.S:305 The buggy address belongs to the object at ffff888123839d68 which belongs to the cache bfq_io_cq of size 1360
The buggy address is located 336 bytes inside of
freed 1360-byte region [ffff888123839d68, ffff88812383a2b8)
The buggy address belongs to the physical page:
page:ffffea00048e0e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88812383f588 pfn:0x123838 head:ffffea00048e0e00 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0x17ffffc0000a40(workingset|slab|head|node=0|zone=2|lastcpupid=0x1fffff)page_type: 0xffffffff()
raw: 0017ffffc0000a40 ffff88810588c200 ffffea00048ffa10 ffff888105889488
raw: ffff88812383f588 0000000000150006 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff888123839d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888123839e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888123839e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888123839f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888123839f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================--- block/bfq-iosched.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
block/bfq-iosched.c +2 -1
@@ -6934,7 +6934,8 @@ static struct bfq_queue *bfq_init_rq(struct request *rq)* addition, if the queue has also just been split, we have to * resume its state. */ -if (likely (bfqq != &bfqd->oom_bfqq) &&bfqq_process_refs (bfqq) ==1 ) { +if (likely (bfqq != &bfqd->oom_bfqq) && !bfqq->new_bfqq && +bfqq_process_refs (bfqq) ==1 ) { bfqq->bic = bic;if (split) {/*
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 121/695 block, bfq: choose the last bfqq from merge chain in bfq_setup_cooperator()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
[ Upstream commit 0e456dba86c7f9a19792204a044835f1ca2c8dbb ]
Consider the following merge chain:
Process 1 Process 2 Process 3 Process 4
(BIC1) (BIC2) (BIC3) (BIC4)
Λ | | |
\--------------\ \-------------\ \-------------\|
V V V
bfqq1--------->bfqq2---------->bfqq3----------->bfqq4
IO from Process 1 will get bfqf2 from BIC1 first, then bfq_setup_cooperator() will found bfqq2 already merged to bfqq3 and then handle this IO from bfqq3. However, the merge chain can be much deeper and bfqq3 can be merged to other bfqq as well.
Fix this problem by iterating to the last bfqq inbfq_setup_cooperator().
--- block/bfq-iosched.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
block/bfq-iosched.c +6 -2
@@ -2911,8 +2911,12 @@ bfq_setup_cooperator(struct bfq_data *bfqd, struct bfq_queue *bfqq,struct bfq_iocq_bfqq_data *bfqq_data = &bic->bfqq_data[a_idx];/* if a merge has already been setup, then proceed with that first */ -if (bfqq->new_bfqq) -return bfqq->new_bfqq; + new_bfqq = bfqq->new_bfqq; +if (new_bfqq) { +while (new_bfqq->new_bfqq) + new_bfqq = new_bfqq->new_bfqq; +return new_bfqq; + }/* * Check delayed stable merge for rotational or non-queueing
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 122/695 block, bfq: dont break merge chain in bfq_split_bfqq()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
[ Upstream commit 42c306ed723321af4003b2a41bb73728cab54f85 ]
Consider the following scenario:
Process 1 Process 2 Process 3 Process 4
(BIC1) (BIC2) (BIC3) (BIC4)
Λ | | |
\-------------\ \-------------\ \--------------\|
V V V
bfqq1--------->bfqq2---------->bfqq3----------->bfqq4
ref 0 1 2 4
If Process 1 issue a new IO and bfqq2 is found, and then bfq_init_rq() decide to spilt bfqq2 by bfq_split_bfqq(). Howerver, procress reference of bfqq2 is 1 and bfq_split_bfqq() just clear the coop flag, which will break the merge chain.
Expected result: caller will allocate a new bfqq for BIC1
Process 1 Process 2 Process 3 Process 4
(BIC1) (BIC2) (BIC3) (BIC4)
| | |
\-------------\ \--------------\|
V V
bfqq1--------->bfqq2---------->bfqq3----------->bfqq4
ref 0 0 1 3
Since the condition is only used for the last bfqq4 when the previous bfqq2 and bfqq3 are already splited. Fix the problem by checking if bfqq is the last one in the merge chain as well.
--- block/bfq-iosched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/bfq-iosched.c +1 -1
@@ -6727,7 +6727,7 @@ bfq_split_bfqq(struct bfq_io_cq *bic, struct bfq_queue *bfqq) {bfq_log_bfqq (bfqq->bfqd, bfqq,"splitting queue" ); -if (bfqq_process_refs (bfqq) ==1 ) { +if (bfqq_process_refs (bfqq) ==1 && !bfqq->new_bfqq) { bfqq->pid = current->pid;bfq_clear_bfqq_coop (bfqq);bfq_clear_bfqq_split_coop (bfqq);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 123/695 cachefiles: Fix non-taking of sb_writers around set/removexattr
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
[ Upstream commit 80887f31672970abae3aaa9cf62ac72a124e7c89 ]
Unlike other vfs_xxxx() calls, vfs_setxattr() and vfs_removexattr() don't take the sb_writers lock, so the caller should do it for them.
Fix cachefiles to do this.
--- fs/cachefiles/xattr.c | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-)
fs/cachefiles/xattr.c +26 -8
@@ -64,9 +64,15 @@ int cachefiles_set_object_xattr(struct cachefiles_object *object)memcpy (buf->data,fscache_get_aux (object->cookie), len); ret =cachefiles_inject_write_error (); -if (ret ==0 ) - ret =vfs_setxattr (&nop_mnt_idmap, dentry, cachefiles_xattr_cache, - buf,sizeof (struct cachefiles_xattr ) + len,0 ); +if (ret ==0 ) { + ret =mnt_want_write_file (file); +if (ret ==0 ) { + ret =vfs_setxattr (&nop_mnt_idmap, dentry, + cachefiles_xattr_cache, buf, +sizeof (struct cachefiles_xattr ) + len,0 ); +mnt_drop_write_file (file); + } + }if (ret <0 ) {trace_cachefiles_vfs_error (object,file_inode (file), ret, cachefiles_trace_setxattr_error);
@@ -151,8 +157,14 @@ int cachefiles_remove_object_xattr(struct cachefiles_cache *cache,int ret; ret =cachefiles_inject_remove_error (); -if (ret ==0 ) - ret =vfs_removexattr (&nop_mnt_idmap, dentry, cachefiles_xattr_cache); +if (ret ==0 ) { + ret =mnt_want_write (cache->mnt); +if (ret ==0 ) { + ret =vfs_removexattr (&nop_mnt_idmap, dentry, + cachefiles_xattr_cache); +mnt_drop_write (cache->mnt); + } + }if (ret <0 ) {trace_cachefiles_vfs_error (object,d_inode (dentry), ret, cachefiles_trace_remxattr_error);
@@ -208,9 +220,15 @@ bool cachefiles_set_volume_xattr(struct cachefiles_volume *volume)memcpy (buf->data, p, volume->vcookie->coherency_len); ret =cachefiles_inject_write_error (); -if (ret ==0 ) - ret =vfs_setxattr (&nop_mnt_idmap, dentry, cachefiles_xattr_cache, - buf, len,0 ); +if (ret ==0 ) { + ret =mnt_want_write (volume->cache->mnt); +if (ret ==0 ) { + ret =vfs_setxattr (&nop_mnt_idmap, dentry, + cachefiles_xattr_cache, + buf, len,0 ); +mnt_drop_write (volume->cache->mnt); + } + }if (ret <0 ) {trace_cachefiles_vfs_error (NULL ,d_inode (dentry), ret, cachefiles_trace_setxattr_error);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 124/695 nbd: correct the maximum value for discard sectors
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wouter Verhelst <[email protected]>
[ Upstream commit 296dbc72d29085d5fc34430d0760423071e9e81d ]
The version of the NBD protocol implemented by the kernel driver currently has a 32 bit field for length values. As the NBD protocol uses bytes as a unit of length, length values larger than 2^32 bytes cannot be expressed.
Update the max_hw_discard_sectors field to match that.
--- drivers/block/nbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/nbd.c +1 -1
@@ -350,7 +350,7 @@ static int __nbd_set_size(struct nbd_device *nbd, loff_t bytesize, lim =queue_limits_start_update (nbd->disk->queue);if (nbd->config->flags &NBD_FLAG_SEND_TRIM ) - lim.max_hw_discard_sectors =UINT_MAX ; + lim.max_hw_discard_sectors =UINT_MAX >>SECTOR_SHIFT ;else lim.max_hw_discard_sectors =0 ;if (!(nbd->config->flags &NBD_FLAG_SEND_FLUSH )) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 125/695 erofs: fix incorrect symlink detection in fast symlink
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gao Xiang <[email protected]>
[ Upstream commit 9ed50b8231e37b1ae863f5dec8153b98d9f389b4 ]
Fast symlink can be used if the on-disk symlink data is stored in the same block as the on-disk inode, so we don’t need to trigger another I/O for symlink data. However, currently fs correction could be reported _incorrectly_ if inode xattrs are too large.
In fact, these should be valid images although they cannot be handled as fast symlinks.
Many thanks to Colin for reporting this!
--- fs/erofs/inode.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-)
fs/erofs/inode.c +6 -14
@@ -178,12 +178,14 @@ static int erofs_fill_symlink(struct inode *inode, void *kaddr, unsigned int m_pofs) {struct erofs_inode *vi =EROFS_I (inode); -unsigned int bsz =i_blocksize (inode); +loff_t off;char *lnk; -/* if it cannot be handled with fast symlink scheme */ -if (vi->datalayout !=EROFS_INODE_FLAT_INLINE || - inode->i_size >= bsz || inode->i_size <0 ) { + m_pofs += vi->xattr_isize; +/* check if it cannot be handled with fast symlink scheme */ +if (vi->datalayout !=EROFS_INODE_FLAT_INLINE || inode->i_size <0 || +check_add_overflow (m_pofs, inode->i_size, &off) || + off >i_blocksize (inode)) { inode->i_op = &erofs_symlink_iops;return 0 ; }
@@ -192,16 +194,6 @@ static int erofs_fill_symlink(struct inode *inode, void *kaddr,if (!lnk)return -ENOMEM ; - m_pofs += vi->xattr_isize; -/* inline symlink data shouldn't cross block boundary */ -if (m_pofs + inode->i_size > bsz) { -kfree (lnk); -erofs_err (inode->i_sb, -"inline data cross block boundary @ nid %llu" , - vi->nid); -DBG_BUGON (1 ); -return -EFSCORRUPTED ; - }memcpy (lnk, kaddr + m_pofs, inode->i_size); lnk[inode->i_size] ='\0' ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 126/695 erofs: fix error handling in z_erofs_init_decompressor
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sandeep Dhavale <[email protected]>
[ Upstream commit 3fc3e45fcdeaad4b7660b560fcbc827eb733f58e ]
If we get a failure at the first decompressor init (i = 0), the clean up while loop could enter infinite loop due to wrong while check. Check the value of i now to see if we need any clean up at all.
--- fs/erofs/decompressor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/erofs/decompressor.c +1 -1
@@ -539,7 +539,7 @@ int __init z_erofs_init_decompressor(void)for (i =0 ; i <Z_EROFS_COMPRESSION_MAX ; ++i) { err = z_erofs_decomp[i] ? z_erofs_decomp[i]->init () :0 ;if (err) { -while (--i) +while (i--)if (z_erofs_decomp[i]) z_erofs_decomp[i]->exit ();return err;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 127/695 erofs: handle overlapped pclusters out of crafted images properly
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gao Xiang <[email protected]>
[ Upstream commit 9e2f9d34dd12e6e5b244ec488bcebd0c2d566c50 ]
syzbot reported a task hang issue due to a deadlock case where it is waiting for the folio lock of a cached folio that will be used for cache I/Os.
After looking into the crafted fuzzed image, I found it's formed with several overlapped big pclusters as below:
Ext: logical offset | length : physical offset | length 0: 0.. 16384 | 16384 : 151552.. 167936 | 16384 1: 16384.. 32768 | 16384 : 155648.. 172032 | 16384 2: 32768.. 49152 | 16384 : 537223168.. 537239552 | 16384
...
Here, extent 0/1 are physically overlapped although it's entirely _impossible_ for normal filesystem images generated by mkfs.
First, managed folios containing compressed data will be marked as up-to-date and then unlocked immediately (unlike in-place folios) when compressed I/Os are complete. If physical blocks are not submitted in the incremental order, there should be separate BIOs to avoid dependency issues. However, the current code mis-arranges z_erofs_fill_bio_vec() and BIO submission which causes unexpected BIO waits.
Second, managed folios will be connected to their own pclusters for efficient inter-queries. However, this is somewhat hard to implement easily if overlapped big pclusters exist. Again, these only appear in fuzzed images so let's simply fall back to temporary short-lived pages for correctness.
Additionally, it justifies that referenced managed folios cannot be truncated for now and reverts part of commit 2080ca1ed3e4 ("erofs: tidy up struct z_erofs_bvec") for simplicity although it shouldn't be any difference.
--- fs/erofs/zdata.c | 71 ++++++++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 33 deletions(-)
fs/erofs/zdata.c +38 -33
@@ -1428,6 +1428,7 @@ static void z_erofs_fill_bio_vec(struct bio_vec *bvec,struct z_erofs_bvec zbv;struct address_space *mapping;struct folio *folio; +struct page *page;int bs =i_blocksize (f->inode);/* Except for inplace folios, the entire folio can be used for I/Os */
@@ -1450,7 +1451,6 @@ static void z_erofs_fill_bio_vec(struct bio_vec *bvec,* file-backed folios will be used instead. */ if (folio->private == (void *)Z_EROFS_PREALLOCATED_PAGE ) { - folio->private =0 ; tocache = true; goto out_tocache; }
@@ -1468,7 +1468,7 @@ static void z_erofs_fill_bio_vec(struct bio_vec *bvec, }folio_lock (folio); -if (folio->mapping == mc) { +if (likely (folio->mapping == mc)) {/* * The cached folio is still in managed cache but without * a valid `->private` pcluster hint. Let's reconnect them.
@@ -1478,41 +1478,44 @@ static void z_erofs_fill_bio_vec(struct bio_vec *bvec,/* compressed_bvecs[] already takes a ref before */ folio_put (folio); } - -/* no need to submit if it is already up-to-date */ -if (folio_test_uptodate (folio)) { -folio_unlock (folio); - bvec->bv_page =NULL ; +if (likely (folio->private == pcl)) { +/* don't submit cache I/Os again if already uptodate */ +if (folio_test_uptodate (folio)) { +folio_unlock (folio); + bvec->bv_page =NULL ; + } +return ; } -return ; +/* +* Already linked with another pcluster, which only appears in +* crafted images by fuzzers for now. But handle this anyway. +*/ + tocache = false;/* use temporary short-lived pages */ + }else { +DBG_BUGON (1 );/* referenced managed folios can't be truncated */ + tocache = true; } - -/* -* It has been truncated, so it's unsafe to reuse this one. Let's -* allocate a new page for compressed data. -*/ -DBG_BUGON (folio->mapping); - tocache = true;folio_unlock (folio);folio_put (folio); out_allocfolio: - zbv.page =erofs_allocpage (&f->pagepool, gfp | __GFP_NOFAIL); + page =erofs_allocpage (&f->pagepool, gfp | __GFP_NOFAIL);spin_lock (&pcl->obj.lockref.lock); -if (pcl->compressed_bvecs[nr].page) { -erofs_pagepool_add (&f->pagepool, zbv.page); +if (unlikely (pcl->compressed_bvecs[nr].page != zbv.page)) { +erofs_pagepool_add (&f->pagepool, page);spin_unlock (&pcl->obj.lockref.lock);cond_resched (); goto repeat; } - bvec->bv_page = pcl->compressed_bvecs[nr].page = zbv.page; - folio =page_folio (zbv.page); -/* first mark it as a temporary shortlived folio (now 1 ref) */ - folio->private = (void *)Z_EROFS_SHORTLIVED_PAGE ; + bvec->bv_page = pcl->compressed_bvecs[nr].page = page; + folio =page_folio (page);spin_unlock (&pcl->obj.lockref.lock); out_tocache:if (!tocache || bs !=PAGE_SIZE || -filemap_add_folio (mc, folio, pcl->obj.index + nr, gfp)) +filemap_add_folio (mc, folio, pcl->obj.index + nr, gfp)) { +/* turn into a temporary shortlived folio (1 ref) */ + folio->private = (void *)Z_EROFS_SHORTLIVED_PAGE ;return ; + }folio_attach_private (folio, pcl);/* drop a refcount added by allocpage (then 2 refs in total here) */ folio_put (folio);
@@ -1647,13 +1650,10 @@ static void z_erofs_submit_queue(struct z_erofs_decompress_frontend *f, cur = mdev.m_pa; end = cur + pcl->pclustersize; do { - z_erofs_fill_bio_vec(&bvec, f, pcl, i++, mc); - if (!bvec.bv_page) - continue; - + bvec.bv_page = NULL; if (bio && (cur != last_pa || bio->bi_bdev != mdev.m_bdev)) { -io_retry: +drain_io: if (!erofs_is_fscache_mode(sb)) submit_bio(bio); else
@@ -1666,6 +1666,15 @@ static void z_erofs_submit_queue(struct z_erofs_decompress_frontend *f, bio =NULL ; } +if (!bvec.bv_page) { +z_erofs_fill_bio_vec (&bvec, f, pcl, i++, mc); +if (!bvec.bv_page) +continue ; +if (cur + bvec.bv_len > end) + bvec.bv_len = end - cur; +DBG_BUGON (bvec.bv_len < sb->s_blocksize); + } +if (unlikely (PageWorkingset (bvec.bv_page)) && !memstall) {psi_memstall_enter (&pflags);
@@ -1685,13 +1694,9 @@ static void z_erofs_submit_queue(struct z_erofs_decompress_frontend *f, ++nr_bios; } -if (cur + bvec.bv_len > end) - bvec.bv_len = end - cur; -DBG_BUGON (bvec.bv_len < sb->s_blocksize);if (!bio_add_page (bio, bvec.bv_page, bvec.bv_len, bvec.bv_offset)) - goto io_retry; - + goto drain_io; last_pa = cur + bvec.bv_len; bypass = false; }while ((cur += bvec.bv_len) < end);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 128/695 block, bfq: fix uaf for accessing waker_bfqq after splitting
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
[ Upstream commit 1ba0403ac6447f2d63914fb760c44a3b19c44eaf ]
After commit 42c306ed7233 ("block, bfq: don't break merge chain in bfq_split_bfqq()"), if the current procress is the last holder of bfqq, the bfqq can be freed after bfq_split_bfqq(). Hence recored the bfqq and then access bfqq->waker_bfqq may trigger UAF. What's more, the waker_bfqq may in the merge chain of bfqq, hence just recored waker_bfqq is still not safe.
Fix the problem by adding a helper bfq_waker_bfqq() to check if bfqq->waker_bfqq is in the merge chain, and current procress is the only holder.
--- block/bfq-iosched.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-)
block/bfq-iosched.c +28 -3
@@ -6825,6 +6825,31 @@ static void bfq_prepare_request(struct request *rq) rq->elv.priv[0 ] = rq->elv.priv[1 ] =NULL ; } +static struct bfq_queue *bfq_waker_bfqq (struct bfq_queue *bfqq) +{ +struct bfq_queue *new_bfqq = bfqq->new_bfqq; +struct bfq_queue *waker_bfqq = bfqq->waker_bfqq; + +if (!waker_bfqq) +return NULL ; + +while (new_bfqq) { +if (new_bfqq == waker_bfqq) { +/* +* If waker_bfqq is in the merge chain, and current +* is the only procress. +*/ +if (bfqq_process_refs (waker_bfqq) ==1 ) +return NULL ; +break ; + } + + new_bfqq = new_bfqq->new_bfqq; + } + +return waker_bfqq; +} +/* * If needed, init rq, allocate bfq data structures associated with * rq, and increment reference counters in the destination bfq_queue
@@ -6886,7 +6911,7 @@ static struct bfq_queue *bfq_init_rq(struct request *rq)/* If the queue was seeky for too long, break it apart. */ if (bfq_bfqq_coop (bfqq) &&bfq_bfqq_split_coop (bfqq) && !bic->bfqq_data[a_idx].stably_merged) { -struct bfq_queue *old_bfqq = bfqq; +struct bfq_queue *waker_bfqq =bfq_waker_bfqq (bfqq);/* Update bic before losing reference to bfqq */ if (bfq_bfqq_in_large_burst (bfqq))
@@ -6906,7 +6931,7 @@ static struct bfq_queue *bfq_init_rq(struct request *rq) bfqq_already_existing = true;if (!bfqq_already_existing) { - bfqq->waker_bfqq = old_bfqq->waker_bfqq; + bfqq->waker_bfqq = waker_bfqq; bfqq->tentative_waker_bfqq =NULL ;/*
@@ -6916,7 +6941,7 @@ static struct bfq_queue *bfq_init_rq(struct request *rq)* woken_list of the waker. See * bfq_check_waker for details. */ -if (bfqq->waker_bfqq) +if (waker_bfqq)hlist_add_head (&bfqq->woken_list_node, &bfqq->waker_bfqq->woken_list); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 129/695 block, bfq: fix procress reference leakage for bfqq in merge chain
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yu Kuai <[email protected]>
[ Upstream commit 73aeab373557fa6ee4ae0b742c6211ccd9859280 ]
Original state:
Process 1 Process 2 Process 3 Process 4
(BIC1) (BIC2) (BIC3) (BIC4)
Λ | | |
\--------------\ \-------------\ \-------------\|
V V V
bfqq1--------->bfqq2---------->bfqq3----------->bfqq4
ref 0 1 2 4
After commit 0e456dba86c7 ("block, bfq: choose the last bfqq from merge chain in bfq_setup_cooperator()"), if P1 issues a new IO:
Without the patch:
Process 1 Process 2 Process 3 Process 4
(BIC1) (BIC2) (BIC3) (BIC4)
Λ | | |
\------------------------------\ \-------------\|
V V
bfqq1--------->bfqq2---------->bfqq3----------->bfqq4
ref 0 0 2 4
bfqq3 will be used to handle IO from P1, this is not expected, IO should be redirected to bfqq4;
With the patch:
-------------------------------------------
| |
Process 1 Process 2 Process 3 | Process 4
(BIC1) (BIC2) (BIC3) | (BIC4)
| | | |
\-------------\ \-------------\|
V V
bfqq1--------->bfqq2---------->bfqq3----------->bfqq4
ref 0 0 2 4
IO is redirected to bfqq4, however, procress reference of bfqq3 is still 2, while there is only P2 using it.
Fix the problem by calling bfq_merge_bfqqs() for each bfqq in the merge chain. Also change bfqq_merge_bfqqs() to return new_bfqq to simplify code.
--- block/bfq-iosched.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-)
block/bfq-iosched.c +17 -20
@@ -3129,10 +3129,12 @@ void bfq_release_process_ref(struct bfq_data *bfqd, struct bfq_queue *bfqq)bfq_put_queue (bfqq); } -static void -bfq_merge_bfqqs (struct bfq_data *bfqd,struct bfq_io_cq *bic, -struct bfq_queue *bfqq,struct bfq_queue *new_bfqq) +static struct bfq_queue *bfq_merge_bfqqs (struct bfq_data *bfqd, +struct bfq_io_cq *bic, +struct bfq_queue *bfqq) { +struct bfq_queue *new_bfqq = bfqq->new_bfqq; +bfq_log_bfqq (bfqd, bfqq,"merging with queue %lu" , (unsigned long )new_bfqq->pid);/* Save weight raising and idle window of the merged queues */
@@ -3226,6 +3228,8 @@ bfq_merge_bfqqs(struct bfq_data *bfqd, struct bfq_io_cq *bic,bfq_reassign_last_bfqq (bfqq, new_bfqq);bfq_release_process_ref (bfqd, bfqq); + +return new_bfqq; } static bool bfq_allow_bio_merge(struct request_queue *q, struct request *rq,
@@ -3261,14 +3265,8 @@ static bool bfq_allow_bio_merge(struct request_queue *q, struct request *rq,* fulfilled, i.e., bic can be redirected to new_bfqq * and bfqq can be put. */ -bfq_merge_bfqqs (bfqd, bfqd->bio_bic, bfqq, - new_bfqq); -/* -* If we get here, bio will be queued into new_queue, -* so use new_bfqq to decide whether bio and rq can be -* merged. -*/ - bfqq = new_bfqq; +while (bfqq != new_bfqq) + bfqq =bfq_merge_bfqqs (bfqd, bfqd->bio_bic, bfqq);/* * Change also bqfd->bio_bfqq, as
@@ -5705,9 +5703,7 @@ bfq_do_early_stable_merge(struct bfq_data *bfqd, struct bfq_queue *bfqq,* state before killing it. */ bfqq->bic = bic; -bfq_merge_bfqqs (bfqd, bic, bfqq, new_bfqq); - -return new_bfqq; +return bfq_merge_bfqqs (bfqd, bic, bfqq); }/*
@@ -6162,6 +6158,7 @@ static bool __bfq_insert_request(struct bfq_data *bfqd, struct request *rq)bool waiting, idle_timer_disabled = false;if (new_bfqq) { +struct bfq_queue *old_bfqq = bfqq;/* * Release the request's reference to the old bfqq * and make sure one is taken to the shared queue.
@@ -6178,18 +6175,18 @@ static bool __bfq_insert_request(struct bfq_data *bfqd, struct request *rq)* new_bfqq. */ if (bic_to_bfqq (RQ_BIC (rq), true, -bfq_actuator_index (bfqd, rq->bio)) == bfqq) -bfq_merge_bfqqs (bfqd,RQ_BIC (rq), - bfqq, new_bfqq); +bfq_actuator_index (bfqd, rq->bio)) == bfqq) { +while (bfqq != new_bfqq) + bfqq =bfq_merge_bfqqs (bfqd,RQ_BIC (rq), bfqq); + } -bfq_clear_bfqq_just_created (bfqq); +bfq_clear_bfqq_just_created (old_bfqq);/* * rq is about to be enqueued into new_bfqq, * release rq reference on bfqq */ -bfq_put_queue (bfqq); +bfq_put_queue (old_bfqq); rq->elv.priv[1 ] = new_bfqq; - bfqq = new_bfqq; }bfq_update_io_thinktime (bfqd, bfqq);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 130/695 io_uring/io-wq: do not allow pinning outside of cpuset
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Moessbauer <[email protected]>
[ Upstream commit 0997aa5497c714edbb349ca366d28bd550ba3408 ]
The io worker threads are userland threads that just never exit to the userland. By that, they are also assigned to a cgroup (the group of the creating task).
When changing the affinity of the io_wq thread via syscall, we must only allow cpumasks within the limits defined by the cpuset controller of the cgroup (if enabled).
--- io_uring/io-wq.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-)
io_uring/io-wq.c +18 -5
@@ -13,6 +13,7 @@#include <linux/slab.h> #include <linux/rculist_nulls.h> #include <linux/cpu.h> +#include <linux/cpuset.h> #include <linux/task_work.h> #include <linux/audit.h> #include <linux/mmu_context.h>
@@ -1322,17 +1323,29 @@ static int io_wq_cpu_offline(unsigned int cpu, struct hlist_node *node)int io_wq_cpu_affinity (struct io_uring_task *tctx,cpumask_var_t mask) { +cpumask_var_t allowed_mask; +int ret =0 ; +if (!tctx || !tctx->io_wq)return -EINVAL ; +if (!alloc_cpumask_var (&allowed_mask,GFP_KERNEL )) +return -ENOMEM ; +rcu_read_lock (); -if (mask) -cpumask_copy (tctx->io_wq->cpu_mask, mask); -else -cpumask_copy (tctx->io_wq->cpu_mask, cpu_possible_mask); +cpuset_cpus_allowed (tctx->io_wq->task, allowed_mask); +if (mask) { +if (cpumask_subset (mask, allowed_mask)) +cpumask_copy (tctx->io_wq->cpu_mask, mask); +else + ret = -EINVAL ; + }else { +cpumask_copy (tctx->io_wq->cpu_mask, allowed_mask); + }rcu_read_unlock (); -return 0 ; +free_cpumask_var (allowed_mask); +return ret; }/*
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 131/695 io_uring/io-wq: inherit cpuset of cgroup in io worker
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Moessbauer <[email protected]>
[ Upstream commit 84eacf177faa605853c58e5b1c0d9544b88c16fd ]
The io worker threads are userland threads that just never exit to the userland. By that, they are also assigned to a cgroup (the group of the creating task).
When creating a new io worker, this worker should inherit the cpuset of the cgroup.
--- io_uring/io-wq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
io_uring/io-wq.c +1 -1
@@ -1168,7 +1168,7 @@ struct io_wq *io_wq_create(unsigned bounded, struct io_wq_data *data)if (!alloc_cpumask_var (&wq->cpu_mask,GFP_KERNEL )) goto err; -cpumask_copy (wq->cpu_mask, cpu_possible_mask); +cpuset_cpus_allowed (data->task, wq->cpu_mask); wq->acct[IO_WQ_ACCT_BOUND ].max_workers = bounded; wq->acct[IO_WQ_ACCT_UNBOUND ].max_workers =task_rlimit (current,RLIMIT_NPROC );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 132/695 block: fix potential invalid pointer dereference in blk_add_partition
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Riyan Dhiman <[email protected]>
[ Upstream commit 26e197b7f9240a4ac301dd0ad520c0c697c2ea7d ]
The blk_add_partition() function initially used a single if-condition (IS_ERR(part)) to check for errors when adding a partition. This was modified to handle the specific case of -ENXIO separately, allowing the function to proceed without logging the error in this case. However, this change unintentionally left a path where md_autodetect_dev() could be called without confirming that part is a valid pointer.
This commit separates the error handling logic by splitting the initial if-condition, improving code readability and handling specific error scenarios explicitly. The function now distinguishes the general error case from -ENXIO without altering the existing behavior of md_autodetect_dev() calls.
--- block/partitions/core.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
block/partitions/core.c +5 -3
@@ -555,9 +555,11 @@ static bool blk_add_partition(struct gendisk *disk, part =add_partition (disk, p, from, size, state->parts[p].flags, &state->parts[p].info); -if (IS_ERR (part) &&PTR_ERR (part) != -ENXIO ) { -printk (KERN_ERR " %s: p%d could not be added: %pe\n" , - disk->disk_name, p, part); +if (IS_ERR (part)) { +if (PTR_ERR (part) != -ENXIO ) { +printk (KERN_ERR " %s: p%d could not be added: %pe\n" , + disk->disk_name, p, part); + }return true; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 133/695 spi: ppc4xx: handle irq_of_parse_and_map() errors
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ma Ke <[email protected]>
[ Upstream commit 0f245463b01ea254ae90e1d0389e90b0e7d8dc75 ]
Zero and negative number is not a valid IRQ for in-kernel code and the irq_of_parse_and_map() function returns zero on error. So this check for valid IRQs should only accept values > 0.
--- drivers/spi/spi-ppc4xx.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/spi/spi-ppc4xx.c +3 -0
@@ -413,6 +413,9 @@ static int spi_ppc4xx_of_probe(struct platform_device *op)/* Request IRQ */ hw->irqnum =irq_of_parse_and_map (np,0 ); +if (hw->irqnum <=0 ) + goto free_host; + ret =request_irq (hw->irqnum, spi_ppc4xx_int,0 ,"spi_ppc4xx_of" , (void *)hw);if (ret) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 134/695 arm64: dts: exynos: exynos7885-jackpotlte: Correct RAM amount to 4GB
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Virag <[email protected]>
[ Upstream commit d281814b8f7a710a75258da883fb0dfe1329c031 ]
All known jackpotlte variants have 4GB of RAM, let's use it all. RAM was set to 3GB from a mistake in the vendor provided DTS file.
--- arch/arm64/boot/dts/exynos/exynos7885-jackpotlte.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/exynos/exynos7885-jackpotlte.dts +1 -1
@@ -32,7 +32,7 @@ device_type = "memory"; reg = <0x0 0x80000000 0x3da00000>, <0x0 0xc0000000 0x40000000>, - <0x8 0x80000000 0x40000000>; + <0x8 0x80000000 0x80000000>; }; gpio-keys {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 135/695 arm64: dts: mediatek: mt8186: Fix supported-hw mask for GPU OPPs
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit 2317d018b835842df0501d8f9e9efa843068a101 ]
The speedbin eFuse reads a value 'x' from 0 to 7 and, in order to make that compatible with opp-supported-hw, it gets post processed as BIT(x).
Change all of the 0x30 supported-hw to 0x20 to avoid getting duplicate OPPs for speedbin 4, and also change all of the 0x8 to 0xcf because speedbins different from 4 and 5 do support 900MHz, 950MHz, 1000MHz with the higher voltage of 850mV, 900mV, 950mV respectively.
--- arch/arm64/boot/dts/mediatek/mt8186.dtsi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/mediatek/mt8186.dtsi +6 -6
@@ -731,7 +731,7 @@ opp-900000000-3 { opp-hz = /bits/ 64 <900000000>; opp-microvolt = <850000>; - opp-supported-hw = <0x8>; + opp-supported-hw = <0xcf>; }; opp-900000000-4 {
@@ -743,13 +743,13 @@ opp-900000000-5 { opp-hz = /bits/ 64 <900000000>; opp-microvolt = <825000>; - opp-supported-hw = <0x30>; + opp-supported-hw = <0x20>; }; opp-950000000-3 { opp-hz = /bits/ 64 <950000000>; opp-microvolt = <900000>; - opp-supported-hw = <0x8>; + opp-supported-hw = <0xcf>; }; opp-950000000-4 {
@@ -761,13 +761,13 @@ opp-950000000-5 { opp-hz = /bits/ 64 <950000000>; opp-microvolt = <850000>; - opp-supported-hw = <0x30>; + opp-supported-hw = <0x20>; }; opp-1000000000-3 { opp-hz = /bits/ 64 <1000000000>; opp-microvolt = <950000>; - opp-supported-hw = <0x8>; + opp-supported-hw = <0xcf>; }; opp-1000000000-4 {
@@ -779,7 +779,7 @@ opp-1000000000-5 { opp-hz = /bits/ 64 <1000000000>; opp-microvolt = <875000>; - opp-supported-hw = <0x30>; + opp-supported-hw = <0x20>; }; };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 136/695 firmware: arm_scmi: Fix double free in OPTEE transport
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cristian Marussi <[email protected]>
[ Upstream commit e98dba934b2fc587eafb83f47ad64d9053b18ae0 ]
Channels can be shared between protocols, avoid freeing the same channel descriptors twice when unloading the stack.
Message-Id: <[email protected]>
--- drivers/firmware/arm_scmi/optee.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/firmware/arm_scmi/optee.c +7 -0
@@ -473,6 +473,13 @@ static int scmi_optee_chan_free(int id, void *p, void *data)struct scmi_chan_info *cinfo = p;struct scmi_optee_channel *channel = cinfo->transport_info; +/* +* Different protocols might share the same chan info, so a previous +* call might have already freed the structure. +*/ +if (!channel) +return 0 ; +mutex_lock (&scmi_optee_private->mu);list_del (&channel->link);mutex_unlock (&scmi_optee_private->mu);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 137/695 spi: ppc4xx: Avoid returning 0 when failed to parse and map IRQ
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit 7781f1d120fec8624fc654eda900fc8748262082 ]
0 is incorrect error code when failed to parse and map IRQ. Replace OF specific old API for IRQ retrieval with a generic one to fix this issue.
--- drivers/spi/spi-ppc4xx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/spi/spi-ppc4xx.c +3 -3
@@ -27,7 +27,6 @@#include <linux/wait.h> #include <linux/platform_device.h> #include <linux/of_address.h> -#include <linux/of_irq.h> #include <linux/of_platform.h> #include <linux/interrupt.h> #include <linux/delay.h>
@@ -412,9 +411,10 @@ static int spi_ppc4xx_of_probe(struct platform_device *op) }/* Request IRQ */ - hw->irqnum =irq_of_parse_and_map (np,0 ); -if (hw->irqnum <=0 ) + ret =platform_get_irq (op,0 ); +if (ret <0 ) goto free_host; + hw->irqnum = ret; ret =request_irq (hw->irqnum, spi_ppc4xx_int,0 ,"spi_ppc4xx_of" , (void *)hw);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 138/695 firmware: qcom: scm: Disable SDI and write no dump to dump mode
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mukesh Ojha <[email protected]>
[ Upstream commit 79cb2cb8d89b7eca87e8dac031dadea4aeafeaa7 ]
SDI is enabled for most of the Qualcomm SoCs and as per commit ff4aa3bc9825 ("firmware: qcom_scm: disable SDI if required") it was recommended to disable SDI by mentioning it in device tree to avoid hang during watchdog or during reboot.
However, for some cases if download mode tcsr register already configured from boot firmware to collect dumps and if SDI is disabled via means of mentioning it in device tree we could still end up with dump collection. Disabling SDI alone is not completely enough to disable dump mode and we also need to zero out the bits download bits from tcsr register.
Current commit now, unconditionally call qcom_scm_set_download_mode() based on download_mode flag, at max if TCSR register is not mentioned or available for a SoC it will fallback to legacy way of setting download mode through command which may be no-ops or return error in case current firmware does not implements QCOM_SCM_INFO_IS_CALL_AVAIL so, at worst it does nothing if it fails.
It also does to call SDI disable call if dload mode is disabled, which looks fine to do as intention is to disable dump collection even if system crashes.
--- drivers/firmware/qcom/qcom_scm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/firmware/qcom/qcom_scm.c +2 -4
@@ -1954,14 +1954,12 @@ static int qcom_scm_probe(struct platform_device *pdev)* will cause the boot stages to enter download mode, unless * disabled below by a clean shutdown/reboot. */ -if (download_mode) -qcom_scm_set_download_mode (true); - +qcom_scm_set_download_mode (download_mode);/* * Disable SDI if indicated by DT that it is enabled by default. */ -if (of_property_read_bool (pdev->dev.of_node,"qcom,sdi-enabled" )) +if (of_property_read_bool (pdev->dev.of_node,"qcom,sdi-enabled" ) || !download_mode)qcom_scm_disable_sdi (); ret =of_reserved_mem_device_init (__scm->dev);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 139/695 regulator: Return actual error in of_regulator_bulk_get_all()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
[ Upstream commit 395a41a1d3e377462f3eea8a205ee72be8885ff6 ]
If regulator_get() in of_regulator_bulk_get_all() returns an error, that error gets overridden and -EINVAL is always passed out. This masks probe deferral requests and likely won't work properly in all cases.
Fix this by letting of_regulator_bulk_get_all() return the original error code.
--- drivers/regulator/of_regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/of_regulator.c +1 -1
@@ -777,7 +777,7 @@ int of_regulator_bulk_get_all(struct device *dev, struct device_node *np, name[i] ='\0' ; tmp =regulator_get (dev, name);if (IS_ERR (tmp)) { - ret = -EINVAL ; + ret =PTR_ERR (tmp); goto error; } (*consumers)[n].consumer = tmp;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 140/695 arm64: dts: renesas: r9a08g045: Correct GICD and GICR sizes
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lad Prabhakar <[email protected]>
[ Upstream commit ec9532628eb9d82282b8e52fd9c4a3800d87feec ]
The RZ/G3S SoC is equipped with the GIC-600. The GICD is 64KiB + 64KiB for the MBI alias (in total 128KiB), and the GICR is 128KiB per CPU.
Despite the RZ/G3S SoC being single-core, it has two instances of GICR.
--- arch/arm64/boot/dts/renesas/r9a08g045.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/renesas/r9a08g045.dtsi +2 -2
@@ -269,8 +269,8 @@ #interrupt-cells = <3>; #address-cells = <0>; interrupt-controller; - reg = <0x0 0x12400000 0 0x40000>, - <0x0 0x12440000 0 0x60000>; + reg = <0x0 0x12400000 0 0x20000>, + <0x0 0x12440000 0 0x40000>; interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_LOW>; };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 141/695 arm64: dts: renesas: r9a07g043u: Correct GICD and GICR sizes
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lad Prabhakar <[email protected]>
[ Upstream commit ab39547f739236e7f16b8b0a51fdca95cc9cadd3 ]
The RZ/G2UL SoC is equipped with the GIC-600. The GICD is 64KiB + 64KiB for the MBI alias (in total 128KiB), and the GICR is 128KiB per CPU.
Despite the RZ/G2UL SoC being single-core, it has two instances of GICR.
--- arch/arm64/boot/dts/renesas/r9a07g043u.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/renesas/r9a07g043u.dtsi +2 -2
@@ -210,8 +210,8 @@ #interrupt-cells = <3>; #address-cells = <0>; interrupt-controller; - reg = <0x0 0x11900000 0 0x40000>, - <0x0 0x11940000 0 0x60000>; + reg = <0x0 0x11900000 0 0x20000>, + <0x0 0x11940000 0 0x40000>; interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_LOW>; }; };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 142/695 arm64: dts: renesas: r9a07g054: Correct GICD and GICR sizes
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lad Prabhakar <[email protected]>
[ Upstream commit 45afa9eacb59b258d2e53c7f63430ea1e8344803 ]
The RZ/V2L SoC is equipped with the GIC-600. The GICD is 64KiB + 64KiB for the MBI alias (in total 128KiB), and the GICR is 128KiB per CPU.
--- arch/arm64/boot/dts/renesas/r9a07g054.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/renesas/r9a07g054.dtsi +2 -2
@@ -1051,8 +1051,8 @@ #interrupt-cells = <3>; #address-cells = <0>; interrupt-controller; - reg = <0x0 0x11900000 0 0x40000>, - <0x0 0x11940000 0 0x60000>; + reg = <0x0 0x11900000 0 0x20000>, + <0x0 0x11940000 0 0x40000>; interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_LOW>; };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 143/695 arm64: dts: renesas: r9a07g044: Correct GICD and GICR sizes
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lad Prabhakar <[email protected]>
[ Upstream commit 833948fb2b63155847ab691a54800f801555429b ]
The RZ/G2L(C) SoC is equipped with the GIC-600. The GICD is 64KiB + 64KiB for the MBI alias (in total 128KiB), and the GICR is 128KiB per CPU.
--- arch/arm64/boot/dts/renesas/r9a07g044.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/renesas/r9a07g044.dtsi +2 -2
@@ -1043,8 +1043,8 @@ #interrupt-cells = <3>; #address-cells = <0>; interrupt-controller; - reg = <0x0 0x11900000 0 0x40000>, - <0x0 0x11940000 0 0x60000>; + reg = <0x0 0x11900000 0 0x20000>, + <0x0 0x11940000 0 0x40000>; interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_LOW>; };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 144/695 ARM: dts: microchip: sam9x60: Fix rtc/rtt clocks
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Dahl <[email protected]>
[ Upstream commit d355c895fa4ddd8bec15569eee540baeed7df8c5 ]
The RTC and RTT peripherals use the timing domain slow clock (TD_SLCK), sourced from the 32.768 kHz crystal oscillator or slow rc oscillator.
The previously used Monitoring domain slow clock (MD_SLCK) is sourced from an internal RC oscillator which is most probably not precise enough for real time clock purposes.
[claudiu.beznea: removed () around the last commit description paragraph,
removed " in front of "timing domain slow clock", described that TD_SLCK can also be sourced from slow rc oscillator]
--- arch/arm/boot/dts/microchip/sam9x60.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/microchip/sam9x60.dtsi +2 -2
@@ -1312,7 +1312,7 @@ compatible = "microchip,sam9x60-rtt", "atmel,at91sam9260-rtt"; reg = <0xfffffe20 0x20>; interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>; - clocks = <&clk32k 0>; + clocks = <&clk32k 1>; }; pit: timer@fffffe40 {
@@ -1338,7 +1338,7 @@ compatible = "microchip,sam9x60-rtc", "atmel,at91sam9x5-rtc"; reg = <0xfffffea8 0x100>; interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>; - clocks = <&clk32k 0>; + clocks = <&clk32k 1>; }; watchdog: watchdog@ffffff80 {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 145/695 arm64: tegra: Correct location of power-sensors for IGX Orin
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jon Hunter <[email protected]>
[ Upstream commit b93679b8f165467e1584f9b23055db83f45c32ce ]
The power-sensors are located on the carrier board and not the module board and so update the IGX Orin device-tree files to fix this.
--- .../boot/dts/nvidia/tegra234-p3701-0008.dtsi | 33 ------------------- .../boot/dts/nvidia/tegra234-p3740-0002.dtsi | 33 +++++++++++++++++++ 2 files changed, 33 insertions(+), 33 deletions(-)
arch/arm64/boot/dts/nvidia/tegra234-p3701-0008.dtsi +0 -33
@@ -44,39 +44,6 @@ status = "okay"; }; - i2c@c250000 { - power-sensor@41 { - compatible = "ti,ina3221"; - reg = <0x41>; - #address-cells = <1>; - #size-cells = <0>; - - input@0 { - reg = <0x0>; - label = "CVB_ATX_12V"; - shunt-resistor-micro-ohms = <2000>; - }; - - input@1 { - reg = <0x1>; - label = "CVB_ATX_3V3"; - shunt-resistor-micro-ohms = <2000>; - }; - - input@2 { - reg = <0x2>; - label = "CVB_ATX_5V"; - shunt-resistor-micro-ohms = <2000>; - }; - }; - - power-sensor@44 { - compatible = "ti,ina219"; - reg = <0x44>; - shunt-resistor = <2000>; - }; - }; - rtc@c2a0000 { status = "okay"; };
arch/arm64/boot/dts/nvidia/tegra234-p3740-0002.dtsi +33 -0
@@ -183,6 +183,39 @@ phy-names = "usb2-0", "usb2-1", "usb2-2", "usb2-3", "usb3-0", "usb3-1", "usb3-2"; }; + + i2c@c250000 { + power-sensor@41 { + compatible = "ti,ina3221"; + reg = <0x41>; + #address-cells = <1>; + #size-cells = <0>; + + input@0 { + reg = <0x0>; + label = "CVB_ATX_12V"; + shunt-resistor-micro-ohms = <2000>; + }; + + input@1 { + reg = <0x1>; + label = "CVB_ATX_3V3"; + shunt-resistor-micro-ohms = <2000>; + }; + + input@2 { + reg = <0x2>; + label = "CVB_ATX_5V"; + shunt-resistor-micro-ohms = <2000>; + }; + }; + + power-sensor@44 { + compatible = "ti,ina219"; + reg = <0x44>; + shunt-resistor = <2000>; + }; + }; }; vdd_3v3_dp: regulator-vdd-3v3-dp {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 146/695 arm64: dts: rockchip: Correct vendor prefix for Hardkernel ODROID-M1
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonas Karlman <[email protected]>
[ Upstream commit 735065e774dcfc62e38df01a535862138b6c92ed ]
The vendor prefix for Hardkernel ODROID-M1 is incorrectly listed as rockchip. Use the proper hardkernel vendor prefix for this board, while at it also drop the redundant soc prefix.
--- arch/arm64/boot/dts/rockchip/rk3568-odroid-m1.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/rockchip/rk3568-odroid-m1.dts +1 -1
@@ -13,7 +13,7 @@ / { model = "Hardkernel ODROID-M1"; - compatible = "rockchip,rk3568-odroid-m1", "rockchip,rk3568"; + compatible = "hardkernel,odroid-m1", "rockchip,rk3568"; aliases { ethernet0 = &gmac0;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 147/695 arm64: dts: ti: k3-j721e-sk: Fix reversed C6x carveout locations
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Davis <[email protected]>
[ Upstream commit 9f3814a7c06b7c7296cf8c1622078ad71820454b ]
The DMA carveout for the C6x core 0 is at 0xa6000000 and core 1 is at 0xa7000000. These are reversed in DT. While both C6x can access either region, so this is not normally a problem, but if we start restricting the memory each core can access (such as with firewalls) the cores accessing the regions for the wrong core will not work. Fix this here.
--- arch/arm64/boot/dts/ti/k3-j721e-sk.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/ti/k3-j721e-sk.dts +2 -2
@@ -120,7 +120,7 @@ no-map; }; - c66_1_dma_memory_region: c66-dma-memory@a6000000 { + c66_0_dma_memory_region: c66-dma-memory@a6000000 { compatible = "shared-dma-pool"; reg = <0x00 0xa6000000 0x00 0x100000>; no-map;
@@ -132,7 +132,7 @@ no-map; }; - c66_0_dma_memory_region: c66-dma-memory@a7000000 { + c66_1_dma_memory_region: c66-dma-memory@a7000000 { compatible = "shared-dma-pool"; reg = <0x00 0xa7000000 0x00 0x100000>; no-map;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 148/695 arm64: dts: ti: k3-j721e-beagleboneai64: Fix reversed C6x carveout locations
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Davis <[email protected]>
[ Upstream commit 1a314099b7559690fe23cdf3300dfff6e830ecb1 ]
The DMA carveout for the C6x core 0 is at 0xa6000000 and core 1 is at 0xa7000000. These are reversed in DT. While both C6x can access either region, so this is not normally a problem, but if we start restricting the memory each core can access (such as with firewalls) the cores accessing the regions for the wrong core will not work. Fix this here.
--- arch/arm64/boot/dts/ti/k3-j721e-beagleboneai64.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/ti/k3-j721e-beagleboneai64.dts +2 -2
@@ -123,7 +123,7 @@ no-map; }; - c66_1_dma_memory_region: c66-dma-memory@a6000000 { + c66_0_dma_memory_region: c66-dma-memory@a6000000 { compatible = "shared-dma-pool"; reg = <0x00 0xa6000000 0x00 0x100000>; no-map;
@@ -135,7 +135,7 @@ no-map; }; - c66_0_dma_memory_region: c66-dma-memory@a7000000 { + c66_1_dma_memory_region: c66-dma-memory@a7000000 { compatible = "shared-dma-pool"; reg = <0x00 0xa7000000 0x00 0x100000>; no-map;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 149/695 spi: bcmbca-hsspi: Fix missing pm_runtime_disable()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinjie Ruan <[email protected]>
[ Upstream commit 4439a2e92cb89028b22c5d7ba1b99e75d7d889f6 ]
The pm_runtime_disable() is missing in remove function, use devm_pm_runtime_enable() to fix it. So the pm_runtime_disable() in the probe error path can also be removed.
--- drivers/spi/spi-bcmbca-hsspi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/spi/spi-bcmbca-hsspi.c +4 -4
@@ -546,12 +546,14 @@ static int bcmbca_hsspi_probe(struct platform_device *pdev) goto out_put_host; } -pm_runtime_enable (&pdev->dev); + ret =devm_pm_runtime_enable (&pdev->dev); +if (ret) + goto out_put_host; ret =sysfs_create_group (&pdev->dev.kobj, &bcmbca_hsspi_group);if (ret) {dev_err (&pdev->dev,"couldn't register sysfs group\n" ); - goto out_pm_disable; + goto out_put_host; }/* register and we are done */
@@ -565,8 +567,6 @@ static int bcmbca_hsspi_probe(struct platform_device *pdev) out_sysgroup_disable:sysfs_remove_group (&pdev->dev.kobj, &bcmbca_hsspi_group); -out_pm_disable: -pm_runtime_disable (&pdev->dev); out_put_host:spi_controller_put (host); out_disable_pll_clk:
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 150/695 arm64: dts: qcom: x1e80100: Fix PHY for DP2
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abel Vesa <[email protected]>
[ Upstream commit ba728bda663b0e812cb20450d18af5d0edd803a2 ]
The actual PHY used by MDSS DP2 is the USB SS2 QMP one. So switch to it instead. This is needed to get external DP support on boards like CRD where the 3rd Type-C USB port (right-hand side) is connected to DP2.
--- arch/arm64/boot/dts/qcom/x1e80100.dtsi | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/arm64/boot/dts/qcom/x1e80100.dtsi +5 -5
@@ -4402,14 +4402,14 @@ assigned-clocks = <&dispcc DISP_CC_MDSS_DPTX2_LINK_CLK_SRC>, <&dispcc DISP_CC_MDSS_DPTX2_PIXEL0_CLK_SRC>; - assigned-clock-parents = <&mdss_dp2_phy 0>, - <&mdss_dp2_phy 1>; + assigned-clock-parents = <&usb_1_ss2_qmpphy QMP_USB43DP_DP_LINK_CLK>, + <&usb_1_ss2_qmpphy QMP_USB43DP_DP_VCO_DIV_CLK>; operating-points-v2 = <&mdss_dp2_opp_table>; power-domains = <&rpmhpd RPMHPD_MMCX>; - phys = <&mdss_dp2_phy>; + phys = <&usb_1_ss2_qmpphy QMP_USB43DP_DP_PHY>; phy-names = "dp"; #sound-dai-cells = <0>;
@@ -4597,8 +4597,8 @@ <&usb_1_ss0_qmpphy QMP_USB43DP_DP_VCO_DIV_CLK>, <&usb_1_ss1_qmpphy QMP_USB43DP_DP_LINK_CLK>, /* dp1 */ <&usb_1_ss1_qmpphy QMP_USB43DP_DP_VCO_DIV_CLK>, - <&mdss_dp2_phy 0>, /* dp2 */ - <&mdss_dp2_phy 1>, + <&usb_1_ss2_qmpphy QMP_USB43DP_DP_LINK_CLK>, /* dp2 */ + <&usb_1_ss2_qmpphy QMP_USB43DP_DP_VCO_DIV_CLK>, <&mdss_dp3_phy 0>, /* dp3 */ <&mdss_dp3_phy 1>; power-domains = <&rpmhpd RPMHPD_MMCX>;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 151/695 ARM: dts: microchip: sama7g5: Fix RTT clock
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudiu Beznea <[email protected]>
[ Upstream commit 867bf1923200e6ad82bad0289f43bf20b4ac7ff9 ]
According to datasheet, Chapter 34. Clock Generator, section 34.2, Embedded characteristics, source clock for RTT is the TD_SLCK, registered with ID 1 by the slow clock controller driver. Fix RTT clock.
--- arch/arm/boot/dts/microchip/sama7g5.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/microchip/sama7g5.dtsi +1 -1
@@ -272,7 +272,7 @@ compatible = "microchip,sama7g5-rtt", "microchip,sam9x60-rtt", "atmel,at91sam9260-rtt"; reg = <0xe001d020 0x30>; interrupts = <GIC_SPI 8 IRQ_TYPE_LEVEL_HIGH>; - clocks = <&clk32k 0>; + clocks = <&clk32k 1>; }; clk32k: clock-controller@e001d050 {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 152/695 ARM: dts: imx7d-zii-rmu2: fix Ethernet PHY pinctrl property
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 0e49cfe364dea4345551516eb2fe53135a10432b ]
There is no "fsl,phy" property in pin controller pincfg nodes:
imx7d-zii-rmu2.dtb: pinctrl@302c0000: enet1phyinterruptgrp: 'fsl,pins' is a required property imx7d-zii-rmu2.dtb: pinctrl@302c0000: enet1phyinterruptgrp: 'fsl,phy' does not match any of the regexes: 'pinctrl-[0-9]+'
--- arch/arm/boot/dts/nxp/imx/imx7d-zii-rmu2.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/nxp/imx/imx7d-zii-rmu2.dts +1 -1
@@ -350,7 +350,7 @@ &iomuxc_lpsr { pinctrl_enet1_phy_interrupt: enet1phyinterruptgrp { - fsl,phy = < + fsl,pins = < MX7D_PAD_LPSR_GPIO1_IO02__GPIO1_IO2 0x08 >; };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 153/695 arm64: dts: ti: k3-am654-idk: Fix dtbs_check warning in ICSSG dmas
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: MD Danish Anwar <[email protected]>
[ Upstream commit 2bea7920da8001172f54359395700616269ccb70 ]
ICSSG doesn't use mgmnt rsp dmas. But these are added in the dmas for icssg1-eth and icssg0-eth node.
These mgmnt rsp dmas result in below dtbs_check warnings.
/workdir/arch/arm64/boot/dts/ti/k3-am654-idk.dtb: icssg1-eth: dmas: [[39, 49664], [39, 49665], [39, 49666], [39, 49667], [39, 49668], [39, 49669], [39, 49670], [39, 49671], [39, 16896], [39, 16897], [39, 16898], [39, 16899]] is too long
from schema $id: http://devicetree.org/schemas/net/ti,icssg-prueth.yaml#
/workdir/arch/arm64/boot/dts/ti/k3-am654-idk.dtb: icssg0-eth: dmas: [[39, 49408], [39, 49409], [39, 49410], [39, 49411], [39, 49412], [39, 49413], [39, 49414], [39, 49415], [39, 16640], [39, 16641], [39, 16642], [39, 16643]] is too long
from schema $id: http://devicetree.org/schemas/net/ti,icssg-prueth.yaml#
Fix these warnings by removing mgmnt rsp dmas from icssg1-eth and icssg0-eth nodes.
--- arch/arm64/boot/dts/ti/k3-am654-idk.dtso | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/ti/k3-am654-idk.dtso +2 -6
@@ -58,9 +58,7 @@ <&main_udmap 0xc107>, /* egress slice 1 */ <&main_udmap 0x4100>, /* ingress slice 0 */ - <&main_udmap 0x4101>, /* ingress slice 1 */ - <&main_udmap 0x4102>, /* mgmnt rsp slice 0 */ - <&main_udmap 0x4103>; /* mgmnt rsp slice 1 */ + <&main_udmap 0x4101>; /* ingress slice 1 */ dma-names = "tx0-0", "tx0-1", "tx0-2", "tx0-3", "tx1-0", "tx1-1", "tx1-2", "tx1-3", "rx0", "rx1";
@@ -126,9 +124,7 @@ <&main_udmap 0xc207>, /* egress slice 1 */ <&main_udmap 0x4200>, /* ingress slice 0 */ - <&main_udmap 0x4201>, /* ingress slice 1 */ - <&main_udmap 0x4202>, /* mgmnt rsp slice 0 */ - <&main_udmap 0x4203>; /* mgmnt rsp slice 1 */ + <&main_udmap 0x4201>; /* ingress slice 1 */ dma-names = "tx0-0", "tx0-1", "tx0-2", "tx0-3", "tx1-0", "tx1-1", "tx1-2", "tx1-3", "rx0", "rx1";
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 154/695 ARM: versatile: fix OF node leak in CPUs prepare
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit f2642d97f2105ed17b2ece0c597450f2ff95d704 ]
Machine code is leaking OF node reference from of_find_matching_node() in realview_smp_prepare_cpus().
--- arch/arm/mach-versatile/platsmp-realview.c | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-versatile/platsmp-realview.c +1 -0
@@ -70,6 +70,7 @@ static void __init realview_smp_prepare_cpus(unsigned int max_cpus)return ; } map =syscon_node_to_regmap (np); +of_node_put (np);if (IS_ERR (map)) {pr_err ("PLATSMP: No syscon regmap\n" );return ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 155/695 reset: berlin: fix OF node leak in probe() error path
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 5f58a88cc91075be38cec69b7cb70aaa4ba69e8b ]
Driver is leaking OF node reference on memory allocation failure. Acquire the OF node reference after memory allocation to fix this and keep it simple.
--- drivers/reset/reset-berlin.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/reset/reset-berlin.c +2 -1
@@ -68,13 +68,14 @@ static int berlin_reset_xlate(struct reset_controller_dev *rcdev,static int berlin2_reset_probe (struct platform_device *pdev) { -struct device_node *parent_np =of_get_parent (pdev->dev.of_node); +struct device_node *parent_np;struct berlin_reset_priv *priv; priv =devm_kzalloc (&pdev->dev,sizeof (*priv),GFP_KERNEL );if (!priv)return -ENOMEM ; + parent_np =of_get_parent (pdev->dev.of_node); priv->regmap =syscon_node_to_regmap (parent_np);of_node_put (parent_np);if (IS_ERR (priv->regmap))
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 156/695 reset: k210: fix OF node leak in probe() error path
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
[ Upstream commit b14e40f5dc7cd0dd7e958010e6ca9ad32ff2ddad ]
Driver is leaking OF node reference on memory allocation failure. Acquire the OF node reference after memory allocation to fix this and keep it simple.
--- drivers/reset/reset-k210.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/reset/reset-k210.c +2 -1
@@ -90,7 +90,7 @@ static const struct reset_control_ops k210_rst_ops = {static int k210_rst_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; -struct device_node *parent_np =of_get_parent (dev->of_node); +struct device_node *parent_np;struct k210_rst *ksr;dev_info (dev,"K210 reset controller\n" );
@@ -99,6 +99,7 @@ static int k210_rst_probe(struct platform_device *pdev)if (!ksr)return -ENOMEM ; + parent_np =of_get_parent (dev->of_node); ksr->map =syscon_node_to_regmap (parent_np);of_node_put (parent_np);if (IS_ERR (ksr->map))
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 157/695 platform: cznic: turris-omnia-mcu: Fix error check in omnia_mcu_register_trng()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 2d516b8fc0f18ce9c0347a1aea6edb3d8ca1d692 ]
The gpiod_to_irq() function never returns zero. It returns negative error codes or a positive IRQ number. Update the checking to check for negatives.
--- drivers/platform/cznic/turris-omnia-mcu-trng.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/platform/cznic/turris-omnia-mcu-trng.c +2 -2
@@ -70,8 +70,8 @@ int omnia_mcu_register_trng(struct omnia_mcu *mcu) irq_idx = omnia_int_to_gpio_idx[__bf_shf (OMNIA_INT_TRNG )]; irq =gpiod_to_irq (gpio_device_get_desc (mcu->gc.gpiodev, irq_idx)); -if (!irq) -return dev_err_probe (dev, -ENXIO ,"Cannot get TRNG IRQ\n" ); +if (irq <0 ) +return dev_err_probe (dev, irq,"Cannot get TRNG IRQ\n" );/* * If someone else cleared the TRNG interrupt but did not read the
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 158/695 clocksource/drivers/qcom: Add missing iounmap() on errors in msm_dt_timer_init()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ankit Agrawal <[email protected]>
[ Upstream commit ca140a0dc0a18acd4653b56db211fec9b2339986 ]
Add the missing iounmap() when clock frequency fails to get read by the of_property_read_u32() call, or if the call to msm_timer_init() fails.
--- drivers/clocksource/timer-qcom.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/clocksource/timer-qcom.c +6 -1
@@ -233,6 +233,7 @@ static int __init msm_dt_timer_init(struct device_node *np) }if (of_property_read_u32 (np,"clock-frequency" , &freq)) { +iounmap (cpu0_base);pr_err ("Unknown frequency\n" );return -EINVAL ; }
@@ -243,7 +244,11 @@ static int __init msm_dt_timer_init(struct device_node *np) freq /=4 ;writel_relaxed (DGT_CLK_CTL_DIV_4 , source_base +DGT_CLK_CTL ); -return msm_timer_init (freq,32 , irq, !!percpu_offset); + ret =msm_timer_init (freq,32 , irq, !!percpu_offset); +if (ret) +iounmap (cpu0_base); + +return ret; }TIMER_OF_DECLARE (kpss_timer,"qcom,kpss-timer" , msm_dt_timer_init);TIMER_OF_DECLARE (scss_timer,"qcom,scss-timer" , msm_dt_timer_init);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 159/695 arm64: dts: mediatek: mt8195: Correct clock order for dp_intf*
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
[ Upstream commit 51bc68debab9e30b50c6352315950f3cfc309b32 ]
The clocks for dp_intf* device nodes are given in the wrong order, causing the binding validation to fail.
--- arch/arm64/boot/dts/mediatek/mt8195.dtsi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/mediatek/mt8195.dtsi +6 -6
@@ -3251,10 +3251,10 @@ compatible = "mediatek,mt8195-dp-intf"; reg = <0 0x1c015000 0 0x1000>; interrupts = <GIC_SPI 657 IRQ_TYPE_LEVEL_HIGH 0>; - clocks = <&vdosys0 CLK_VDO0_DP_INTF0>, - <&vdosys0 CLK_VDO0_DP_INTF0_DP_INTF>, + clocks = <&vdosys0 CLK_VDO0_DP_INTF0_DP_INTF>, + <&vdosys0 CLK_VDO0_DP_INTF0>, <&apmixedsys CLK_APMIXED_TVDPLL1>; - clock-names = "engine", "pixel", "pll"; + clock-names = "pixel", "engine", "pll"; status = "disabled"; };
@@ -3521,10 +3521,10 @@ reg = <0 0x1c113000 0 0x1000>; interrupts = <GIC_SPI 513 IRQ_TYPE_LEVEL_HIGH 0>; power-domains = <&spm MT8195_POWER_DOMAIN_VDOSYS1>; - clocks = <&vdosys1 CLK_VDO1_DP_INTF0_MM>, - <&vdosys1 CLK_VDO1_DPINTF>, + clocks = <&vdosys1 CLK_VDO1_DPINTF>, + <&vdosys1 CLK_VDO1_DP_INTF0_MM>, <&apmixedsys CLK_APMIXED_TVDPLL2>; - clock-names = "engine", "pixel", "pll"; + clock-names = "pixel", "engine", "pll"; status = "disabled"; };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 160/695 x86/mm: Use IPIs to synchronize LAM enablement
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yosry Ahmed <[email protected]>
[ Upstream commit 3b299b99556c1753923f8d9bbd9304bcd139282f ]
LAM can only be enabled when a process is single-threaded. But _kernel_ threads can temporarily use a single-threaded process's mm.
If LAM is enabled by a userspace process while a kthread is using its mm, the kthread will not observe LAM enablement (i.e. LAM will be disabled in CR3). This could be fine for the kthread itself, as LAM only affects userspace addresses. However, if the kthread context switches to a thread in the same userspace process, CR3 may or may not be updated because the mm_struct doesn't change (based on pending TLB flushes). If CR3 is not updated, the userspace thread will run incorrectly with LAM disabled, which may cause page faults when using tagged addresses. Example scenario:
CPU 1 CPU 2
/* kthread */kthread_use_mm()
/* user thread */
prctl_enable_tagged_addr()
/* LAM enabled on CPU 2 */
/* LAM disabled on CPU 1 */
context_switch() /* to CPU 1 *//* Switching to user thread */switch_mm_irqs_off()
/* CR3 not updated */
/* LAM is still disabled on CPU 1 */
Synchronize LAM enablement by sending an IPI to all CPUs running with the mm_struct to enable LAM. This makes sure LAM is enabled on CPU 1 in the above scenario before prctl_enable_tagged_addr() returns and userspace starts using tagged addresses, and before it's possible to run the userspace process on CPU 1.
In switch_mm_irqs_off(), move reading the LAM mask until after mm_cpumask() is updated. This ensures that if an outdated LAM mask is written to CR3, an IPI is received to update it right after IRQs are re-enabled.
[ dhansen: Add a LAM enabling helper and comment it ]
--- arch/x86/kernel/process_64.c | 29 ++++++++++++++++++++++++++--- arch/x86/mm/tlb.c | 7 +++---- 2 files changed, 29 insertions(+), 7 deletions(-)
arch/x86/kernel/process_64.c +26 -3
@@ -798,6 +798,27 @@ static long prctl_map_vdso(const struct vdso_image *image, unsigned long addr)#define LAM_U57_BITS 6 +static void enable_lam_func (void *__mm) +{ +struct mm_struct *mm = __mm; + +if (this_cpu_read (cpu_tlbstate.loaded_mm) == mm) { +write_cr3 (__read_cr3 () | mm->context.lam_cr3_mask); +set_tlbstate_lam_mode (mm); + } +} + +static void mm_enable_lam (struct mm_struct *mm) +{ +/* +* Even though the process must still be single-threaded at this +* point, kernel threads may be using the mm. IPI those kernel +* threads if they exist. +*/ +on_each_cpu_mask (mm_cpumask (mm), enable_lam_func, mm, true); +set_bit (MM_CONTEXT_LOCK_LAM , &mm->context.flags); +} +static int prctl_enable_tagged_addr (struct mm_struct *mm,unsigned long nr_bits) {if (!cpu_feature_enabled (X86_FEATURE_LAM ))
@@ -814,6 +835,10 @@ static int prctl_enable_tagged_addr(struct mm_struct *mm, unsigned long nr_bits)if (mmap_write_lock_killable (mm))return -EINTR ; +/* +* MM_CONTEXT_LOCK_LAM is set on clone. Prevent LAM from +* being enabled unless the process is single threaded: +*/ if (test_bit (MM_CONTEXT_LOCK_LAM , &mm->context.flags)) {mmap_write_unlock (mm);return -EBUSY ;
@@ -830,9 +855,7 @@ static int prctl_enable_tagged_addr(struct mm_struct *mm, unsigned long nr_bits)return -EINVAL ; } -write_cr3 (__read_cr3 () | mm->context.lam_cr3_mask); -set_tlbstate_lam_mode (mm); -set_bit (MM_CONTEXT_LOCK_LAM , &mm->context.flags); +mm_enable_lam (mm);mmap_write_unlock (mm);
arch/x86/mm/tlb.c +3 -4
@@ -503,9 +503,9 @@ void switch_mm_irqs_off(struct mm_struct *unused, struct mm_struct *next, {struct mm_struct *prev =this_cpu_read (cpu_tlbstate.loaded_mm);u16 prev_asid =this_cpu_read (cpu_tlbstate.loaded_mm_asid); -unsigned long new_lam =mm_lam_cr3_mask (next);bool was_lazy =this_cpu_read (cpu_tlbstate_shared.is_lazy);unsigned cpu =smp_processor_id (); +unsigned long new_lam;u64 next_tlb_gen;bool need_flush;u16 new_asid;
@@ -619,9 +619,7 @@ void switch_mm_irqs_off(struct mm_struct *unused, struct mm_struct *next,cpumask_clear_cpu (cpu,mm_cpumask (prev)); } -/* -* Start remote flushes and then read tlb_gen. -*/ +/* Start receiving IPIs and then read tlb_gen (and LAM below) */ if (next != &init_mm)cpumask_set_cpu (cpu,mm_cpumask (next)); next_tlb_gen =atomic64_read (&next->context.tlb_gen);
@@ -633,6 +631,7 @@ void switch_mm_irqs_off(struct mm_struct *unused, struct mm_struct *next,barrier (); } + new_lam =mm_lam_cr3_mask (next);set_tlbstate_lam_mode (next);if (need_flush) {this_cpu_write (cpu_tlbstate.ctxs[new_asid].ctx_id, next->context.ctx_id);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 161/695 ASoC: rt5682s: Return devm_of_clk_add_hw_provider to transfer the error
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ma Ke <[email protected]>
[ Upstream commit 3ff810b9bebe5578a245cfa97c252ab602e703f1 ]
Return devm_of_clk_add_hw_provider() in order to transfer the error, if it fails due to resource allocation failure or device tree clock provider registration failure.
--- sound/soc/codecs/rt5682s.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
sound/soc/codecs/rt5682s.c +3 -1
@@ -2828,7 +2828,9 @@ static int rt5682s_register_dai_clks(struct snd_soc_component *component) }if (dev->of_node) { -devm_of_clk_add_hw_provider (dev, of_clk_hw_simple_get, dai_clk_hw); + ret =devm_of_clk_add_hw_provider (dev, of_clk_hw_simple_get, dai_clk_hw); +if (ret) +return ret; }else { ret =devm_clk_hw_register_clkdev (dev, dai_clk_hw, init.name,dev_name (dev));
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 162/695 ASoC: tas2781: Fix a compiling warning reported by robot kernel test due to adding tas2563_dvc_table
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shenghao Ding <[email protected]>
[ Upstream commit 92b796845a4a8789c2d9434c6a77baa88a99121e ]
Move tas2563_dvc_table into a separate Header file, as only tas2781 codec driver use this table, and hda side codec driver won't use it.
--- include/sound/tas2563-tlv.h | 279 +++++++++++++++++++++++++++++++++ include/sound/tas2781-tlv.h | 260 ------------------------------ sound/soc/codecs/tas2781-i2c.c | 1 + 3 files changed, 280 insertions(+), 260 deletions(-) create mode 100644 include/sound/tas2563-tlv.h
include/sound/tas2563-tlv.h new file +279 -0
@@ -0,0 +1,279 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +// +// ALSA SoC Texas Instruments TAS2563 Audio Smart Amplifier +// +// Copyright (C) 2022 - 2024 Texas Instruments Incorporated +// https://www.ti.com +// +// The TAS2563 driver implements a flexible and configurable +// algo coefficient setting for one, two, or even multiple +// TAS2563 chips. +// +// Author: Shenghao Ding <[email protected]> +// + +#ifndef __TAS2563_TLV_H__ +#define __TAS2563_TLV_H__ + +static const __maybe_unused DECLARE_TLV_DB_SCALE(tas2563_dvc_tlv, -12150, 50, 1); + +/* pow(10, db/20) * pow(2,30) */ +static const unsigned char tas2563_dvc_table[][4 ] = { + {0X00 ,0X00 ,0X00 ,0X00 },/* -121.5db */ + {0X00 ,0X00 ,0X03 ,0XBC },/* -121.0db */ + {0X00 ,0X00 ,0X03 ,0XF5 },/* -120.5db */ + {0X00 ,0X00 ,0X04 ,0X31 },/* -120.0db */ + {0X00 ,0X00 ,0X04 ,0X71 },/* -119.5db */ + {0X00 ,0X00 ,0X04 ,0XB4 },/* -119.0db */ + {0X00 ,0X00 ,0X04 ,0XFC },/* -118.5db */ + {0X00 ,0X00 ,0X05 ,0X47 },/* -118.0db */ + {0X00 ,0X00 ,0X05 ,0X97 },/* -117.5db */ + {0X00 ,0X00 ,0X05 ,0XEC },/* -117.0db */ + {0X00 ,0X00 ,0X06 ,0X46 },/* -116.5db */ + {0X00 ,0X00 ,0X06 ,0XA5 },/* -116.0db */ + {0X00 ,0X00 ,0X07 ,0X0A },/* -115.5db */ + {0X00 ,0X00 ,0X07 ,0X75 },/* -115.0db */ + {0X00 ,0X00 ,0X07 ,0XE6 },/* -114.5db */ + {0X00 ,0X00 ,0X08 ,0X5E },/* -114.0db */ + {0X00 ,0X00 ,0X08 ,0XDD },/* -113.5db */ + {0X00 ,0X00 ,0X09 ,0X63 },/* -113.0db */ + {0X00 ,0X00 ,0X09 ,0XF2 },/* -112.5db */ + {0X00 ,0X00 ,0X0A ,0X89 },/* -112.0db */ + {0X00 ,0X00 ,0X0B ,0X28 },/* -111.5db */ + {0X00 ,0X00 ,0X0B ,0XD2 },/* -111.0db */ + {0X00 ,0X00 ,0X0C ,0X85 },/* -110.5db */ + {0X00 ,0X00 ,0X0D ,0X43 },/* -110.0db */ + {0X00 ,0X00 ,0X0E ,0X0C },/* -109.5db */ + {0X00 ,0X00 ,0X0E ,0XE1 },/* -109.0db */ + {0X00 ,0X00 ,0X0F ,0XC3 },/* -108.5db */ + {0X00 ,0X00 ,0X10 ,0XB2 },/* -108.0db */ + {0X00 ,0X00 ,0X11 ,0XAF },/* -107.5db */ + {0X00 ,0X00 ,0X12 ,0XBC },/* -107.0db */ + {0X00 ,0X00 ,0X13 ,0XD8 },/* -106.5db */ + {0X00 ,0X00 ,0X15 ,0X05 },/* -106.0db */ + {0X00 ,0X00 ,0X16 ,0X44 },/* -105.5db */ + {0X00 ,0X00 ,0X17 ,0X96 },/* -105.0db */ + {0X00 ,0X00 ,0X18 ,0XFB },/* -104.5db */ + {0X00 ,0X00 ,0X1A ,0X76 },/* -104.0db */ + {0X00 ,0X00 ,0X1C ,0X08 },/* -103.5db */ + {0X00 ,0X00 ,0X1D ,0XB1 },/* -103.0db */ + {0X00 ,0X00 ,0X1F ,0X73 },/* -102.5db */ + {0X00 ,0X00 ,0X21 ,0X51 },/* -102.0db */ + {0X00 ,0X00 ,0X23 ,0X4A },/* -101.5db */ + {0X00 ,0X00 ,0X25 ,0X61 },/* -101.0db */ + {0X00 ,0X00 ,0X27 ,0X98 },/* -100.5db */ + {0X00 ,0X00 ,0X29 ,0XF1 },/* -100.0db */ + {0X00 ,0X00 ,0X2C ,0X6D },/* -99.5db */ + {0X00 ,0X00 ,0X2F ,0X0F },/* -99.0db */ + {0X00 ,0X00 ,0X31 ,0XD9 },/* -98.5db */ + {0X00 ,0X00 ,0X34 ,0XCD },/* -98.0db */ + {0X00 ,0X00 ,0X37 ,0XEE },/* -97.5db */ + {0X00 ,0X00 ,0X3B ,0X3F },/* -97.0db */ + {0X00 ,0X00 ,0X3E ,0XC1 },/* -96.5db */ + {0X00 ,0X00 ,0X42 ,0X79 },/* -96.0db */ + {0X00 ,0X00 ,0X46 ,0X6A },/* -95.5db */ + {0X00 ,0X00 ,0X4A ,0X96 },/* -95.0db */ + {0X00 ,0X00 ,0X4F ,0X01 },/* -94.5db */ + {0X00 ,0X00 ,0X53 ,0XAF },/* -94.0db */ + {0X00 ,0X00 ,0X58 ,0XA5 },/* -93.5db */ + {0X00 ,0X00 ,0X5D ,0XE6 },/* -93.0db */ + {0X00 ,0X00 ,0X63 ,0X76 },/* -92.5db */ + {0X00 ,0X00 ,0X69 ,0X5B },/* -92.0db */ + {0X00 ,0X00 ,0X6F ,0X99 },/* -91.5db */ + {0X00 ,0X00 ,0X76 ,0X36 },/* -91.0db */ + {0X00 ,0X00 ,0X7D ,0X37 },/* -90.5db */ + {0X00 ,0X00 ,0X84 ,0XA2 },/* -90.0db */ + {0X00 ,0X00 ,0X8C ,0X7E },/* -89.5db */ + {0X00 ,0X00 ,0X94 ,0XD1 },/* -89.0db */ + {0X00 ,0X00 ,0X9D ,0XA3 },/* -88.5db */ + {0X00 ,0X00 ,0XA6 ,0XFA },/* -88.0db */ + {0X00 ,0X00 ,0XB0 ,0XDF },/* -87.5db */ + {0X00 ,0X00 ,0XBB ,0X5A },/* -87.0db */ + {0X00 ,0X00 ,0XC6 ,0X74 },/* -86.5db */ + {0X00 ,0X00 ,0XD2 ,0X36 },/* -86.0db */ + {0X00 ,0X00 ,0XDE ,0XAB },/* -85.5db */ + {0X00 ,0X00 ,0XEB ,0XDC },/* -85.0db */ + {0X00 ,0X00 ,0XF9 ,0XD6 },/* -84.5db */ + {0X00 ,0X01 ,0X08 ,0XA4 },/* -84.0db */ + {0X00 ,0X01 ,0X18 ,0X52 },/* -83.5db */ + {0X00 ,0X01 ,0X28 ,0XEF },/* -83.0db */ + {0X00 ,0X01 ,0X3A ,0X87 },/* -82.5db */ + {0X00 ,0X01 ,0X4D ,0X2A },/* -82.0db */ + {0X00 ,0X01 ,0X60 ,0XE8 },/* -81.5db */ + {0X00 ,0X01 ,0X75 ,0XD1 },/* -81.0db */ + {0X00 ,0X01 ,0X8B ,0XF7 },/* -80.5db */ + {0X00 ,0X01 ,0XA3 ,0X6E },/* -80.0db */ + {0X00 ,0X01 ,0XBC ,0X48 },/* -79.5db */ + {0X00 ,0X01 ,0XD6 ,0X9B },/* -79.0db */ + {0X00 ,0X01 ,0XF2 ,0X7E },/* -78.5db */ + {0X00 ,0X02 ,0X10 ,0X08 },/* -78.0db */ + {0X00 ,0X02 ,0X2F ,0X51 },/* -77.5db */ + {0X00 ,0X02 ,0X50 ,0X76 },/* -77.0db */ + {0X00 ,0X02 ,0X73 ,0X91 },/* -76.5db */ + {0X00 ,0X02 ,0X98 ,0XC0 },/* -76.0db */ + {0X00 ,0X02 ,0XC0 ,0X24 },/* -75.5db */ + {0X00 ,0X02 ,0XE9 ,0XDD },/* -75.0db */ + {0X00 ,0X03 ,0X16 ,0X0F },/* -74.5db */ + {0X00 ,0X03 ,0X44 ,0XDF },/* -74.0db */ + {0X00 ,0X03 ,0X76 ,0X76 },/* -73.5db */ + {0X00 ,0X03 ,0XAA ,0XFC },/* -73.0db */ + {0X00 ,0X03 ,0XE2 ,0XA0 },/* -72.5db */ + {0X00 ,0X04 ,0X1D ,0X8F },/* -72.0db */ + {0X00 ,0X04 ,0X5B ,0XFD },/* -71.5db */ + {0X00 ,0X04 ,0X9E ,0X1D },/* -71.0db */ + {0X00 ,0X04 ,0XE4 ,0X29 },/* -70.5db */ + {0X00 ,0X05 ,0X2E ,0X5A },/* -70.0db */ + {0X00 ,0X05 ,0X7C ,0XF2 },/* -69.5db */ + {0X00 ,0X05 ,0XD0 ,0X31 },/* -69.0db */ + {0X00 ,0X06 ,0X28 ,0X60 },/* -68.5db */ + {0X00 ,0X06 ,0X85 ,0XC8 },/* -68.0db */ + {0X00 ,0X06 ,0XE8 ,0XB9 },/* -67.5db */ + {0X00 ,0X07 ,0X51 ,0X86 },/* -67.0db */ + {0X00 ,0X07 ,0XC0 ,0X8A },/* -66.5db */ + {0X00 ,0X08 ,0X36 ,0X21 },/* -66.0db */ + {0X00 ,0X08 ,0XB2 ,0XB0 },/* -65.5db */ + {0X00 ,0X09 ,0X36 ,0XA1 },/* -65.0db */ + {0X00 ,0X09 ,0XC2 ,0X63 },/* -64.5db */ + {0X00 ,0X0A ,0X56 ,0X6D },/* -64.0db */ + {0X00 ,0X0A ,0XF3 ,0X3C },/* -63.5db */ + {0X00 ,0X0B ,0X99 ,0X56 },/* -63.0db */ + {0X00 ,0X0C ,0X49 ,0X48 },/* -62.5db */ + {0X00 ,0X0D ,0X03 ,0XA7 },/* -62.0db */ + {0X00 ,0X0D ,0XC9 ,0X11 },/* -61.5db */ + {0X00 ,0X0E ,0X9A ,0X2D },/* -61.0db */ + {0X00 ,0X0F ,0X77 ,0XAD },/* -60.5db */ + {0X00 ,0X10 ,0X62 ,0X4D },/* -60.0db */ + {0X00 ,0X11 ,0X5A ,0XD5 },/* -59.5db */ + {0X00 ,0X12 ,0X62 ,0X16 },/* -59.0db */ + {0X00 ,0X13 ,0X78 ,0XF0 },/* -58.5db */ + {0X00 ,0X14 ,0XA0 ,0X50 },/* -58.0db */ + {0X00 ,0X15 ,0XD9 ,0X31 },/* -57.5db */ + {0X00 ,0X17 ,0X24 ,0X9C },/* -57.0db */ + {0X00 ,0X18 ,0X83 ,0XAA },/* -56.5db */ + {0X00 ,0X19 ,0XF7 ,0X86 },/* -56.0db */ + {0X00 ,0X1B ,0X81 ,0X6A },/* -55.5db */ + {0X00 ,0X1D ,0X22 ,0XA4 },/* -55.0db */ + {0X00 ,0X1E ,0XDC ,0X98 },/* -54.5db */ + {0X00 ,0X20 ,0XB0 ,0XBC },/* -54.0db */ + {0X00 ,0X22 ,0XA0 ,0X9D },/* -53.5db */ + {0X00 ,0X24 ,0XAD ,0XE0 },/* -53.0db */ + {0X00 ,0X26 ,0XDA ,0X43 },/* -52.5db */ + {0X00 ,0X29 ,0X27 ,0X9D },/* -52.0db */ + {0X00 ,0X2B ,0X97 ,0XE3 },/* -51.5db */ + {0X00 ,0X2E ,0X2D ,0X27 },/* -51.0db */ + {0X00 ,0X30 ,0XE9 ,0X9A },/* -50.5db */ + {0X00 ,0X33 ,0XCF ,0X8D },/* -50.0db */ + {0X00 ,0X36 ,0XE1 ,0X78 },/* -49.5db */ + {0X00 ,0X3A ,0X21 ,0XF3 },/* -49.0db */ + {0X00 ,0X3D ,0X93 ,0XC3 },/* -48.5db */ + {0X00 ,0X41 ,0X39 ,0XD3 },/* -48.0db */ + {0X00 ,0X45 ,0X17 ,0X3B },/* -47.5db */ + {0X00 ,0X49 ,0X2F ,0X44 },/* -47.0db */ + {0X00 ,0X4D ,0X85 ,0X66 },/* -46.5db */ + {0X00 ,0X52 ,0X1D ,0X50 },/* -46.0db */ + {0X00 ,0X56 ,0XFA ,0XE8 },/* -45.5db */ + {0X00 ,0X5C ,0X22 ,0X4E },/* -45.0db */ + {0X00 ,0X61 ,0X97 ,0XE1 },/* -44.5db */ + {0X00 ,0X67 ,0X60 ,0X44 },/* -44.0db */ + {0X00 ,0X6D ,0X80 ,0X60 },/* -43.5db */ + {0X00 ,0X73 ,0XFD ,0X65 },/* -43.0db */ + {0X00 ,0X7A ,0XDC ,0XD7 },/* -42.5db */ + {0X00 ,0X82 ,0X24 ,0X8A },/* -42.0db */ + {0X00 ,0X89 ,0XDA ,0XAB },/* -41.5db */ + {0X00 ,0X92 ,0X05 ,0XC6 },/* -41.0db */ + {0X00 ,0X9A ,0XAC ,0XC8 },/* -40.5db */ + {0X00 ,0XA3 ,0XD7 ,0X0A },/* -40.0db */ + {0X00 ,0XAD ,0X8C ,0X52 },/* -39.5db */ + {0X00 ,0XB7 ,0XD4 ,0XDD },/* -39.0db */ + {0X00 ,0XC2 ,0XB9 ,0X65 },/* -38.5db */ + {0X00 ,0XCE ,0X43 ,0X28 },/* -38.0db */ + {0X00 ,0XDA ,0X7B ,0XF1 },/* -37.5db */ + {0X00 ,0XE7 ,0X6E ,0X1E },/* -37.0db */ + {0X00 ,0XF5 ,0X24 ,0XAC },/* -36.5db */ + {0X01 ,0X03 ,0XAB ,0X3D },/* -36.0db */ + {0X01 ,0X13 ,0X0E ,0X24 },/* -35.5db */ + {0X01 ,0X23 ,0X5A ,0X71 },/* -35.0db */ + {0X01 ,0X34 ,0X9D ,0XF8 },/* -34.5db */ + {0X01 ,0X46 ,0XE7 ,0X5D },/* -34.0db */ + {0X01 ,0X5A ,0X46 ,0X27 },/* -33.5db */ + {0X01 ,0X6E ,0XCA ,0XC5 },/* -33.0db */ + {0X01 ,0X84 ,0X86 ,0X9F },/* -32.5db */ + {0X01 ,0X9B ,0X8C ,0X27 },/* -32.0db */ + {0X01 ,0XB3 ,0XEE ,0XE5 },/* -31.5db */ + {0X01 ,0XCD ,0XC3 ,0X8C },/* -31.0db */ + {0X01 ,0XE9 ,0X20 ,0X05 },/* -30.5db */ + {0X02 ,0X06 ,0X1B ,0X89 },/* -30.0db */ + {0X02 ,0X24 ,0XCE ,0XB0 },/* -29.5db */ + {0X02 ,0X45 ,0X53 ,0X85 },/* -29.0db */ + {0X02 ,0X67 ,0XC5 ,0XA2 },/* -28.5db */ + {0X02 ,0X8C ,0X42 ,0X3F },/* -28.0db */ + {0X02 ,0XB2 ,0XE8 ,0X55 },/* -27.5db */ + {0X02 ,0XDB ,0XD8 ,0XAD },/* -27.0db */ + {0X03 ,0X07 ,0X36 ,0X05 },/* -26.5db */ + {0X03 ,0X35 ,0X25 ,0X29 },/* -26.0db */ + {0X03 ,0X65 ,0XCD ,0X13 },/* -25.5db */ + {0X03 ,0X99 ,0X57 ,0X0C },/* -25.0db */ + {0X03 ,0XCF ,0XEE ,0XCF },/* -24.5db */ + {0X04 ,0X09 ,0XC2 ,0XB0 },/* -24.0db */ + {0X04 ,0X47 ,0X03 ,0XC1 },/* -23.5db */ + {0X04 ,0X87 ,0XE5 ,0XFB },/* -23.0db */ + {0X04 ,0XCC ,0XA0 ,0X6D },/* -22.5db */ + {0X05 ,0X15 ,0X6D ,0X68 },/* -22.0db */ + {0X05 ,0X62 ,0X8A ,0XB3 },/* -21.5db */ + {0X05 ,0XB4 ,0X39 ,0XBC },/* -21.0db */ + {0X06 ,0X0A ,0XBF ,0XD4 },/* -20.5db */ + {0X06 ,0X66 ,0X66 ,0X66 },/* -20.0db */ + {0X06 ,0XC7 ,0X7B ,0X36 },/* -19.5db */ + {0X07 ,0X2E ,0X50 ,0XA6 },/* -19.0db */ + {0X07 ,0X9B ,0X3D ,0XF6 },/* -18.5db */ + {0X08 ,0X0E ,0X9F ,0X96 },/* -18.0db */ + {0X08 ,0X88 ,0XD7 ,0X6D },/* -17.5db */ + {0X09 ,0X0A ,0X4D ,0X2F },/* -17.0db */ + {0X09 ,0X93 ,0X6E ,0XB8 },/* -16.5db */ + {0X0A ,0X24 ,0XB0 ,0X62 },/* -16.0db */ + {0X0A ,0XBE ,0X8D ,0X70 },/* -15.5db */ + {0X0B ,0X61 ,0X88 ,0X71 },/* -15.0db */ + {0X0C ,0X0E ,0X2B ,0XB0 },/* -14.5db */ + {0X0C ,0XC5 ,0X09 ,0XAB },/* -14.0db */ + {0X0D ,0X86 ,0XBD ,0X8D },/* -13.5db */ + {0X0E ,0X53 ,0XEB ,0XB3 },/* -13.0db */ + {0X0F ,0X2D ,0X42 ,0X38 },/* -12.5db */ + {0X10 ,0X13 ,0X79 ,0X87 },/* -12.0db */ + {0X11 ,0X07 ,0X54 ,0XF9 },/* -11.5db */ + {0X12 ,0X09 ,0XA3 ,0X7A },/* -11.0db */ + {0X13 ,0X1B ,0X40 ,0X39 },/* -10.5db */ + {0X14 ,0X3D ,0X13 ,0X62 },/* -10.0db */ + {0X15 ,0X70 ,0X12 ,0XE1 },/* -9.5db */ + {0X16 ,0XB5 ,0X43 ,0X37 },/* -9.0db */ + {0X18 ,0X0D ,0XB8 ,0X54 },/* -8.5db */ + {0X19 ,0X7A ,0X96 ,0X7F },/* -8.0db */ + {0X1A ,0XFD ,0X13 ,0X54 },/* -7.5db */ + {0X1C ,0X96 ,0X76 ,0XC6 },/* -7.0db */ + {0X1E ,0X48 ,0X1C ,0X37 },/* -6.5db */ + {0X20 ,0X13 ,0X73 ,0X9E },/* -6.0db */ + {0X21 ,0XFA ,0X02 ,0XBF },/* -5.5db */ + {0X23 ,0XFD ,0X66 ,0X78 },/* -5.0db */ + {0X26 ,0X1F ,0X54 ,0X1C },/* -4.5db */ + {0X28 ,0X61 ,0X9A ,0XE9 },/* -4.0db */ + {0X2A ,0XC6 ,0X25 ,0X91 },/* -3.5db */ + {0X2D ,0X4E ,0XFB ,0XD5 },/* -3.0db */ + {0X2F ,0XFE ,0X44 ,0X48 },/* -2.5db */ + {0X32 ,0XD6 ,0X46 ,0X17 },/* -2.0db */ + {0X35 ,0XD9 ,0X6B ,0X02 },/* -1.5db */ + {0X39 ,0X0A ,0X41 ,0X5F },/* -1.0db */ + {0X3C ,0X6B ,0X7E ,0X4F },/* -0.5db */ + {0X40 ,0X00 ,0X00 ,0X00 },/* 0.0db */ + {0X43 ,0XCA ,0XD0 ,0X22 },/* 0.5db */ + {0X47 ,0XCF ,0X26 ,0X7D },/* 1.0db */ + {0X4C ,0X10 ,0X6B ,0XA5 },/* 1.5db */ + {0X50 ,0X92 ,0X3B ,0XE3 },/* 2.0db */ + {0X55 ,0X58 ,0X6A ,0X46 },/* 2.5db */ + {0X5A ,0X67 ,0X03 ,0XDF },/* 3.0db */ + {0X5F ,0XC2 ,0X53 ,0X32 },/* 3.5db */ + {0X65 ,0X6E ,0XE3 ,0XDB },/* 4.0db */ + {0X6B ,0X71 ,0X86 ,0X68 },/* 4.5db */ + {0X71 ,0XCF ,0X54 ,0X71 },/* 5.0db */ + {0X78 ,0X8D ,0XB4 ,0XE9 },/* 5.5db */ + {0X7F ,0XFF ,0XFF ,0XFF },/* 6.0db */ +}; +#endif
include/sound/tas2781-tlv.h +0 -260
265 lines not on this page · raw message
sound/soc/codecs/tas2781-i2c.c +1 -0
@@ -30,6 +30,7 @@#include <sound/soc.h> #include <sound/tas2781.h> #include <sound/tlv.h> +#include <sound/tas2563-tlv.h> #include <sound/tas2781-tlv.h> #include <asm/unaligned.h>
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 163/695 ASoC: tas2781-i2c: Drop weird GPIO code
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <[email protected]>
[ Upstream commit c2c0b67dca3cb3b3cea0dd60075a1c5ba77e2fcd ]
The tas2781-i2c driver gets an IRQ from either ACPI or device tree, then proceeds to check if the IRQ has a corresponding GPIO and in case it does enforce the GPIO as input and set a label on it.
This is abuse of the API:
- First we cannot guarantee that the numberspaces of the GPIOs and the IRQs are the same, i.e that an IRQ number corresponds to a GPIO number like that.
- Second, GPIO chips and IRQ chips should be treated as orthogonal APIs, the irqchip needs to ascertain that the backing GPIO line is set to input etc just using the irqchip.
- Third it is using the legacy <linux/gpio.h> API which should not be used in new code yet this was added just a year ago.
Delete the offending code.
If this creates problems the GPIO and irqchip maintainers can help to fix the issues.
It *should* not create any problems, because the irq isn't used anywhere in the driver, it's just obtained and then left unused.
--- include/sound/tas2781.h | 7 +------ sound/pci/hda/tas2781_hda_i2c.c | 2 +- sound/soc/codecs/tas2781-comlib.c | 3 --- sound/soc/codecs/tas2781-fmwlib.c | 1 - sound/soc/codecs/tas2781-i2c.c | 24 +++--------------------- 5 files changed, 5 insertions(+), 32 deletions(-)
include/sound/tas2781.h +1 -6
@@ -81,11 +81,6 @@ struct tasdevice {bool is_loaderr; }; -struct tasdevice_irqinfo { -int irq_gpio; -int irq; -}; -struct calidata {unsigned char *data;unsigned long total_sz;
@@ -93,7 +88,6 @@ struct calidata {struct tasdevice_priv {struct tasdevice tasdevice[TASDEVICE_MAX_CHANNELS ]; -struct tasdevice_irqinfo irq_info;struct tasdevice_rca rcabin;struct calidata cali_data;struct tasdevice_fw *fmw;
@@ -115,6 +109,7 @@ struct tasdevice_priv {unsigned int chip_id;unsigned int sysclk; +int irq;int cur_prog;int cur_conf;int fw_state;
sound/pci/hda/tas2781_hda_i2c.c +1 -1
@@ -818,7 +818,7 @@ static int tas2781_hda_i2c_probe(struct i2c_client *clt) }else return -ENODEV ; - tas_hda->priv->irq_info.irq = clt->irq; + tas_hda->priv->irq = clt->irq; ret =tas2781_read_acpi (tas_hda->priv, device_name);if (ret) return dev_err_probe(tas_hda->dev, ret,
sound/soc/codecs/tas2781-comlib.c +0 -3
@@ -14,7 +14,6 @@#include <linux/interrupt.h> #include <linux/module.h> #include <linux/of.h> -#include <linux/of_gpio.h> #include <linux/of_irq.h> #include <linux/regmap.h> #include <linux/slab.h>
@@ -411,8 +410,6 @@ EXPORT_SYMBOL_GPL(tasdevice_dsp_remove);void tasdevice_remove (struct tasdevice_priv *tas_priv) { -if (gpio_is_valid (tas_priv->irq_info.irq_gpio)) -gpio_free (tas_priv->irq_info.irq_gpio);mutex_destroy (&tas_priv->codec_lock); }EXPORT_SYMBOL_GPL (tasdevice_remove);
sound/soc/codecs/tas2781-fmwlib.c +0 -1
@@ -13,7 +13,6 @@#include <linux/interrupt.h> #include <linux/module.h> #include <linux/of.h> -#include <linux/of_gpio.h> #include <linux/of_irq.h> #include <linux/regmap.h> #include <linux/slab.h>
sound/soc/codecs/tas2781-i2c.c +3 -21
@@ -22,7 +22,6 @@#include <linux/module.h> #include <linux/of.h> #include <linux/of_address.h> -#include <linux/of_gpio.h> #include <linux/of_irq.h> #include <linux/regmap.h> #include <linux/slab.h>
@@ -758,7 +757,7 @@ static void tasdevice_parse_dt(struct tasdevice_priv *tas_priv) {struct i2c_client *client = (struct i2c_client *)tas_priv->client;unsigned int dev_addrs[TASDEVICE_MAX_CHANNELS ]; -int rc, i, ndev =0 ; +int i, ndev =0 ;if (tas_priv->isacpi) { ndev = device_property_read_u32_array(&client->dev,
@@ -773,7 +772,7 @@ static void tasdevice_parse_dt(struct tasdevice_priv *tas_priv) "ti,audio-slots", dev_addrs, ndev); } - tas_priv->irq_info.irq_gpio = + tas_priv->irq =acpi_dev_gpio_irq_get (ACPI_COMPANION (&client->dev),0 ); }else if (IS_ENABLED (CONFIG_OF )) {struct device_node *np = tas_priv->dev->of_node;
@@ -785,7 +784,7 @@ static void tasdevice_parse_dt(struct tasdevice_priv *tas_priv) dev_addrs[ndev++] = addr; } - tas_priv->irq_info.irq_gpio =of_irq_get (np,0 ); + tas_priv->irq =of_irq_get (np,0 ); }else { ndev =1 ; dev_addrs[0 ] = client->addr;
@@ -801,23 +800,6 @@ static void tasdevice_parse_dt(struct tasdevice_priv *tas_priv) __func__);strcpy (tas_priv->dev_name, tasdevice_id[tas_priv->chip_id].name); - -if (gpio_is_valid (tas_priv->irq_info.irq_gpio)) { - rc =gpio_request (tas_priv->irq_info.irq_gpio, -"AUDEV-IRQ" ); -if (!rc) { -gpio_direction_input ( - tas_priv->irq_info.irq_gpio); - - tas_priv->irq_info.irq = -gpio_to_irq (tas_priv->irq_info.irq_gpio); - }else -dev_err (tas_priv->dev,"%s: GPIO %d request error\n" , - __func__, tas_priv->irq_info.irq_gpio); - }else -dev_err (tas_priv->dev, -"Looking up irq-gpio property failed %d\n" , - tas_priv->irq_info.irq_gpio); }static int tasdevice_i2c_probe (struct i2c_client *i2c)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 164/695 ASoC: tas2781-i2c: Get the right GPIO line
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <[email protected]>
[ Upstream commit 1c4b509edad15192bfb64c81d3c305bbae8070db ]
The code is obtaining a GPIO reset using the reset GPIO name "reset-gpios", but the gpiolib is already adding the suffix "-gpios" to anything passed to this function and will be looking for "reset-gpios-gpios" which is most certainly not what the author desired.
Fix it up.
--- sound/soc/codecs/tas2781-i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/tas2781-i2c.c +1 -1
@@ -794,7 +794,7 @@ static void tasdevice_parse_dt(struct tasdevice_priv *tas_priv) tas_priv->tasdevice[i].dev_addr = dev_addrs[i]; tas_priv->reset =devm_gpiod_get_optional (&client->dev, -"reset-gpios" ,GPIOD_OUT_HIGH ); +"reset" ,GPIOD_OUT_HIGH );if (IS_ERR (tas_priv->reset))dev_err (tas_priv->dev,"%s Can't get reset GPIO\n" , __func__);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 165/695 selftests/ftrace: Add required dependency for kprobe tests
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <[email protected]>
[ Upstream commit 41f37c852ac3fbfd072a00281b60dc7ba056be8c ]
kprobe_args_{char,string}.tc are using available_filter_functions file which is provided by function tracer. Thus if function tracer is disabled, these tests are failed on recent kernels because tracefs_create_dir is not raised events by adding a dynamic event.
Add available_filter_functions to requires line.
--- .../testing/selftests/ftrace/test.d/kprobe/kprobe_args_char.tc | 2 +- .../selftests/ftrace/test.d/kprobe/kprobe_args_string.tc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_char.tc +1 -1
@@ -1,7 +1,7 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 # description: Kprobe event char type argument -# requires: kprobe_events +# requires: kprobe_events available_filter_functions case `uname -m` in x86_64)
tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_string.tc +1 -1
@@ -1,7 +1,7 @@ #!/bin/sh # SPDX-License-Identifier: GPL-2.0 # description: Kprobe event string type argument -# requires: kprobe_events +# requires: kprobe_events available_filter_functions case `uname -m` in x86_64)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 166/695 ALSA: hda: cs35l41: fix module autoloading
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuntao Liu <[email protected]>
[ Upstream commit 48f1434a4632c7da1a6a94e159512ebddbe13392 ]
Add MODULE_DEVICE_TABLE(), so modules could be properly autoloaded based on the alias from spi_device_id table.
--- sound/pci/hda/cs35l41_hda_spi.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/cs35l41_hda_spi.c +1 -0
@@ -38,6 +38,7 @@ static const struct spi_device_id cs35l41_hda_spi_id[] = { { "cs35l41-hda", 0 }, {} }; +MODULE_DEVICE_TABLE (spi, cs35l41_hda_spi_id);static const struct acpi_device_id cs35l41_acpi_hda_match[] = { { "CSC3551", 0 },
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 167/695 selftests/ftrace: Fix test to handle both old and new kernels
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt (Google) <[email protected]>
[ Upstream commit c049acee3c71cfc26c739f82617a84e13e471a45 ]
The function "scheduler_tick" was renamed to "sched_tick" and a selftest that used that function for testing function trace filtering used that function as part of the test.
But the change causes it to fail when run on older kernels. As tests should not fail on older kernels, add a check to see which name is available before testing.
--- .../ftrace/test.d/ftrace/func_set_ftrace_file.tc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
tools/testing/selftests/ftrace/test.d/ftrace/func_set_ftrace_file.tc +8 -1
@@ -19,7 +19,14 @@ fail() { # mesg FILTER=set_ftrace_filter FUNC1="schedule" -FUNC2="sched_tick" +if grep '^sched_tick\b' available_filter_functions; then + FUNC2="sched_tick" +elif grep '^scheduler_tick\b' available_filter_functions; then + FUNC2="scheduler_tick" +else + exit_unresolved +fi + ALL_FUNCS="#### all functions enabled ####"
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 168/695 x86/boot/64: Strip percpu address space when setting up GDT descriptors
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uros Bizjak <[email protected]>
[ Upstream commit b51207dc02ec3aeaa849e419f79055d7334845b6 ]
init_per_cpu_var() returns a pointer in the percpu address space while rip_rel_ptr() expects a pointer in the generic address space.
When strict address space checks are enabled, GCC's named address space checks fail:
asm.h:124:63: error: passing argument 1 of 'rip_rel_ptr' from
pointer to non-enclosed address space
Add a explicit cast to remove address space of the returned pointer.
--- arch/x86/kernel/head64.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kernel/head64.c +2 -1
@@ -559,10 +559,11 @@ void early_setup_idt(void)*/ void __head startup_64_setup_gdt_idt(void) { +struct desc_struct *gdt = (void *)(__force unsigned long )init_per_cpu_var (gdt_page.gdt);void *handler =NULL ;struct desc_ptr startup_gdt_descr = { - .address = (unsigned long )&RIP_REL_REF (init_per_cpu_var (gdt_page.gdt)), + .address = (unsigned long )&RIP_REL_REF (*gdt), .size =GDT_SIZE -1 , };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 169/695 m68k: Fix kernel_clone_args.flags in m68k_clone()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit 09b3d870faa7bc3e96c0978ab3cf4e96e4b15571 ]
Stan Johnson recently reported a failure from the 'dump' command:
DUMP: Date of this level 0 dump: Fri Aug 9 23:37:15 2024
DUMP: Dumping /dev/sda (an unlisted file system) to /dev/null
DUMP: Label: none
DUMP: Writing 10 Kilobyte records
DUMP: mapping (Pass I) [regular files]
DUMP: mapping (Pass II) [directories]
DUMP: estimated 3595695 blocks.
DUMP: Context save fork fails in parent 671
The dump program uses the clone syscall with the CLONE_IO flag, that is, flags == 0x80000000. When that value is promoted from long int to u64 by m68k_clone(), it undergoes sign-extension. The new value includes CLONE_INTO_CGROUP so the validation in cgroup_css_set_fork() fails and the syscall returns -EBADF. Avoid sign-extension by casting to u32.
--- arch/m68k/kernel/process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/m68k/kernel/process.c +1 -1
@@ -117,7 +117,7 @@ asmlinkage int m68k_clone(struct pt_regs *regs) {/* regs will be equal to current_pt_regs() */ struct kernel_clone_args args = { - .flags = regs->d1 & ~CSIGNAL , + .flags = (u32)(regs->d1) & ~CSIGNAL , .pidfd = (int __user *)regs->d3, .child_tid = (int __user *)regs->d4, .parent_tid = (int __user *)regs->d3,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 170/695 ASoC: loongson: fix error release
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: tangbin <[email protected]>
[ Upstream commit 97688a9c5b1fd2b826c682cdfa36d411a5c99828 ]
In function loongson_card_parse_of(), when get device_node 'codec' failed, the function of_node_put(codec) should not be invoked, thus fix error release.
--- sound/soc/loongson/loongson_card.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/loongson/loongson_card.c +2 -2
@@ -127,8 +127,8 @@ static int loongson_card_parse_of(struct loongson_card_data *data) codec =of_get_child_by_name (dev->of_node,"codec" );if (!codec) {dev_err (dev,"audio-codec property missing or invalid\n" ); - ret = -EINVAL ; - goto err; +of_node_put (cpu); +return -EINVAL ; }for (i =0 ; i < card->num_links; i++) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 171/695 selftests/ftrace: Fix eventfs ownership testcase to find mount point
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Masami Hiramatsu (Google) <[email protected]>
[ Upstream commit f0a6ecebd858658df213d114b0530f8f0b96e396 ]
Fix eventfs ownership testcase to find mount point if stat -c "%m" failed. This can happen on the system based on busybox. In this case, this will try to use the current working directory, which should be a tracefs top directory (and eventfs is mounted as a part of tracefs.)
If it does not work, the test is skipped as UNRESOLVED because of the environmental problem.
--- .../ftrace/test.d/00basic/test_ownership.tc | 12 ++++++++++++ 1 file changed, 12 insertions(+)
tools/testing/selftests/ftrace/test.d/00basic/test_ownership.tc +12 -0
@@ -6,6 +6,18 @@ original_group=`stat -c "%g" .` original_owner=`stat -c "%u" .` mount_point=`stat -c '%m' .` + +# If stat -c '%m' does not work (e.g. busybox) or failed, try to use the +# current working directory (which should be a tracefs) as the mount point. +if [ ! -d "$mount_point" ]; then + if mount | grep -qw $PWD ; then + mount_point=$PWD + else + # If PWD doesn't work, that is an environmental problem. + exit_unresolved + fi +fi + mount_options=`mount | grep "$mount_point" | sed -e 's/.*(\(.*\)).*/\1/'` # find another owner and group that is not the original
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 172/695 selftests:resctrl: Fix build failure on archs without __cpuid_count()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuah Khan <[email protected]>
[ Upstream commit 7beaf1da074f7ea25454d6c11da142c3892d3c4e ]
When resctrl is built on architectures without __cpuid_count() support, build fails. resctrl uses __cpuid_count() defined in kselftest.h.
Even though the problem is seen while building resctrl on aarch64, this error can be seen on any platform that doesn't support CPUID.
CPUID is a x86/x86-64 feature and code paths with CPUID asm commands will fail to build on all other architectures.
All others tests call __cpuid_count() do so from x86/x86_64 code paths when _i386__ or __x86_64__ are defined. resctrl is an exception.
Fix the problem by defining __cpuid_count() only when __i386__ or __x86_64__ are defined in kselftest.h and changing resctrl to call __cpuid_count() only when __i386__ or __x86_64__ are defined.
In file included from resctrl.h:24,
from cat_test.c:11:
In function ‘arch_supports_noncont_cat’,
inlined from ‘noncont_cat_run_test’ at cat_test.c:326:6:
../kselftest.h:74:9: error: impossible constraint in ‘asm’
74 | __asm__ __volatile__ ("cpuid\n\t" \
| ^~~~~~~
cat_test.c:304:17: note: in expansion of macro ‘__cpuid_count’
304 | __cpuid_count(0x10, 1, eax, ebx, ecx, edx);
| ^~~~~~~~~~~~~
../kselftest.h:74:9: error: impossible constraint in ‘asm’
74 | __asm__ __volatile__ ("cpuid\n\t" \
| ^~~~~~~cat_test.c:306:17: note: in expansion of macro ‘__cpuid_count’
306 | __cpuid_count(0x10, 2, eax, ebx, ecx, edx);
--- tools/testing/selftests/kselftest.h | 2 ++ tools/testing/selftests/resctrl/cat_test.c | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-)
tools/testing/selftests/kselftest.h +2 -0
@@ -61,6 +61,7 @@#define ARRAY_SIZE (arr) (sizeof(arr) / sizeof((arr)[0]))#endif +#if defined(__i386__) || defined(__x86_64__)/* arch */ /* * gcc cpuid.h provides __cpuid_count() since v4.4. * Clang/LLVM cpuid.h provides __cpuid_count() since v3.4.0.
@@ -75,6 +76,7 @@ : "=a" (a), "=b" (b), "=c" (c), "=d" (d) \ : "0" (level), "2" (count))#endif +#endif /* end arch */ /* define kselftest exit codes */ #define KSFT_PASS 0
tools/testing/selftests/resctrl/cat_test.c +5 -2
@@ -290,12 +290,12 @@ static int cat_run_test(const struct resctrl_test *test, const struct user_paramstatic bool arch_supports_noncont_cat (const struct resctrl_test *test) { -unsigned int eax, ebx, ecx, edx; -/* AMD always supports non-contiguous CBM. */ if (get_vendor () ==ARCH_AMD )return true; +#if defined(__i386__) || defined(__x86_64__)/* arch */ +unsigned int eax, ebx, ecx, edx;/* Intel support for non-contiguous CBM needs to be discovered. */ if (!strcmp (test->resource,"L3" ))__cpuid_count (0x10 ,1 , eax, ebx, ecx, edx);
@@ -305,6 +305,9 @@ static bool arch_supports_noncont_cat(const struct resctrl_test *test)return false;return ((ecx >>3 ) &1 ); +#endif /* end arch */ + +return false; } static int noncont_cat_run_test(const struct resctrl_test *test,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 173/695 cgroup/pids: Avoid spurious event notification
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiu Jianfeng <[email protected]>
[ Upstream commit d72a00a8485d1cb11ac1a57bf89b02cbd3a405bf ]
Currently when a process in a group forks and fails due to it's parent's max restriction, all the cgroups from 'pids_forking' to root will generate event notifications but only the cgroups from 'pids_over_limit' to root will increase the counter of PIDCG_MAX.
Consider this scenario: there are 4 groups A, B, C,and D, the relationships are as follows, and user is watching on C.pids.events.
root->A->B->C->D
When a process in D forks and fails due to B.max restriction, the user will get a spurious event notification because when he wakes up and reads C.pids.events, he will find that the content has not changed.
To address this issue, only the cgroups from 'pids_over_limit' to root will have their PIDCG_MAX counters increased and event notifications generated.
--- kernel/cgroup/pids.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-)
kernel/cgroup/pids.c +7 -11
@@ -244,7 +244,6 @@ static void pids_event(struct pids_cgroup *pids_forking, struct pids_cgroup *pids_over_limit) {struct pids_cgroup *p = pids_forking; -bool limit = false;/* Only log the first time limit is hit. */ if (atomic64_inc_return (&p->events_local[PIDCG_FORKFAIL ]) ==1 ) {
@@ -252,20 +251,17 @@ static void pids_event(struct pids_cgroup *pids_forking,pr_cont_cgroup_path (p->css.cgroup);pr_cont ("\n" ); } -cgroup_file_notify (&p->events_local_file);if (!cgroup_subsys_on_dfl (pids_cgrp_subsys) || - cgrp_dfl_root.flags &CGRP_ROOT_PIDS_LOCAL_EVENTS ) + cgrp_dfl_root.flags &CGRP_ROOT_PIDS_LOCAL_EVENTS ) { +cgroup_file_notify (&p->events_local_file);return ; + } -for (;parent_pids (p); p =parent_pids (p)) { -if (p == pids_over_limit) { - limit = true; -atomic64_inc (&p->events_local[PIDCG_MAX ]); -cgroup_file_notify (&p->events_local_file); - } -if (limit) -atomic64_inc (&p->events[PIDCG_MAX ]); +atomic64_inc (&pids_over_limit->events_local[PIDCG_MAX ]); +cgroup_file_notify (&pids_over_limit->events_local_file); +for (p = pids_over_limit;parent_pids (p); p =parent_pids (p)) { +atomic64_inc (&p->events[PIDCG_MAX ]);cgroup_file_notify (&p->events_file); } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 174/695 hwmon: (max16065) Fix overflows seen when writing limits
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
[ Upstream commit 744ec4477b11c42e2c8de9eb8364675ae7a0bd81 ]
Writing large limits resulted in overflows as reported by module tests.
in0_lcrit: Suspected overflow: [max=5538, read 0, written 2147483647]in0_crit: Suspected overflow: [max=5538, read 0, written 2147483647]in0_min: Suspected overflow: [max=5538, read 0, written 2147483647]
Fix the problem by clamping prior to multiplications and the use of DIV_ROUND_CLOSEST, and by using consistent variable types.
--- drivers/hwmon/max16065.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/hwmon/max16065.c +3 -2
@@ -114,9 +114,10 @@ static inline int LIMIT_TO_MV(int limit, int range)return limit * range /256 ; } -static inline int MV_TO_LIMIT (int mv,int range) +static inline int MV_TO_LIMIT (unsigned long mv,int range) { -return clamp_val (DIV_ROUND_CLOSEST (mv *256 , range),0 ,255 ); + mv =clamp_val (mv,0 ,ULONG_MAX /256 ); +return DIV_ROUND_CLOSEST (clamp_val (mv *256 ,0 , range *255 ), range); }static inline int ADC_TO_CURR (int adc,int gain)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 175/695 hwmon: (max16065) Fix alarm attributes
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
[ Upstream commit 119abf7d1815f098f7f91ae7abc84324a19943d7 ]
Chips reporting overcurrent alarms report it in the second alarm register. That means the second alarm register has to be read, even if the chip only supports 8 or fewer ADC channels.
MAX16067 and MAX16068 report undervoltage and overvoltage alarms in separate registers. Fold register contents together to report both with the existing alarm attribute. This requires actually storing the chip type in struct max16065_data. Rename the variable 'chip' to match the variable name used in the probe function.
--- drivers/hwmon/max16065.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/hwmon/max16065.c +10 -2
@@ -79,7 +79,7 @@ static const bool max16065_have_current[] = { };struct max16065_data { -enum chips type; +enum chips chip;struct i2c_client *client;const struct attribute_group *groups[4 ];struct mutex update_lock;
@@ -162,10 +162,17 @@ static struct max16065_data *max16065_update_device(struct device *dev) MAX16065_CURR_SENSE); } -for (i =0 ; i <DIV_ROUND_UP (data->num_adc,8 ); i++) +for (i =0 ; i <2 ; i++) data->fault[i] =i2c_smbus_read_byte_data (client,MAX16065_FAULT (i)); +/* +* MAX16067 and MAX16068 have separate undervoltage and +* overvoltage alarm bits. Squash them together. +*/ +if (data->chip == max16067 || data->chip == max16068) + data->fault[0 ] |= data->fault[1 ]; + data->last_updated = jiffies; data->valid = true; }
@@ -514,6 +521,7 @@ static int max16065_probe(struct i2c_client *client)if (unlikely (!data))return -ENOMEM ; + data->chip = chip; data->client = client;mutex_init (&data->update_lock);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 176/695 iommu/arm-smmu: Un-demote unhandled-fault msg
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rob Clark <[email protected]>
[ Upstream commit 98db56e4900837e4d5d3892b332dca76c8c9f68a ]
Previously this was dev_err_ratelimited() but it got changed to a ratelimited dev_dbg(). Change it back to dev_err().
--- drivers/iommu/arm/arm-smmu/arm-smmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/arm/arm-smmu/arm-smmu.c +1 -1
@@ -417,7 +417,7 @@ void arm_smmu_read_context_fault_info(struct arm_smmu_device *smmu, int idx,void arm_smmu_print_context_fault_info (struct arm_smmu_device *smmu,int idx,const struct arm_smmu_context_fault_info *cfi) { -dev_dbg (smmu->dev, +dev_err (smmu->dev,"Unhandled context fault: fsr=0x%x, iova=0x%08lx, fsynr=0x%x, cbfrsynra=0x%x, cb=%d\n" , cfi->fsr, cfi->iova, cfi->fsynr, cfi->cbfrsynra, idx);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 177/695 iommu/arm-smmu-v3: Fix a NULL vs IS_ERR() check
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit af048ec9c05178206e845a88bfd3cb2884a43da7 ]
The arm_smmu_domain_alloc() function returns error pointers on error. It doesn't return NULL. Update the error checking to match.
--- drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c +2 -2
@@ -3062,8 +3062,8 @@ arm_smmu_domain_alloc_user(struct device *dev, u32 flags,return ERR_PTR (-EOPNOTSUPP ); smmu_domain =arm_smmu_domain_alloc (); -if (!smmu_domain) -return ERR_PTR (-ENOMEM ); +if (IS_ERR (smmu_domain)) +return ERR_CAST (smmu_domain); smmu_domain->domain.type =IOMMU_DOMAIN_UNMANAGED ; smmu_domain->domain.ops = arm_smmu_ops.default_domain_ops;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 178/695 mtd: slram: insert break after errors in parsing the map
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mirsad Todorovac <[email protected]>
[ Upstream commit 336c218dd7f0588ed8a7345f367975a00a4f003f ]
GCC 12.3.0 compiler on linux-next next-20240709 tree found the execution path in which, due to lazy evaluation, devlength isn't initialised with the parsed string:
289 while (map) {
290 devname = devstart = devlength = NULL;
291
292 if (!(devname = strsep(&map, ","))) {
293 E("slram: No devicename specified.\n");
294 break;
295 }
296 T("slram: devname = %s\n", devname);
297 if ((!map) || (!(devstart = strsep(&map, ",")))) {
298 E("slram: No devicestart specified.\n");
299 }
300 T("slram: devstart = %s\n", devstart);
→ 301 if ((!map) || (!(devlength = strsep(&map, ",")))) {
302 E("slram: No devicelength / -end specified.\n");
303 }
→ 304 T("slram: devlength = %s\n", devlength);
305 if (parse_cmdline(devname, devstart, devlength) != 0) {
306 return(-EINVAL);
307 }
Parsing should be finished after map == NULL, so a break is best inserted after each E("slram: ... \n") error message.
--- drivers/mtd/devices/slram.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/mtd/devices/slram.c +2 -0
@@ -296,10 +296,12 @@ static int __init init_slram(void)T ("slram: devname = %s\n" , devname);if ((!map) || (!(devstart =strsep (&map,"," )))) {E ("slram: No devicestart specified.\n" ); +break ; }T ("slram: devstart = %s\n" , devstart);if ((!map) || (!(devlength =strsep (&map,"," )))) {E ("slram: No devicelength / -end specified.\n" ); +break ; }T ("slram: devlength = %s\n" , devlength);if (parse_cmdline (devname, devstart, devlength) !=0 ) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 179/695 hwmon: (ntc_thermistor) fix module autoloading
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuntao Liu <[email protected]>
[ Upstream commit b6964d66a07a9003868e428a956949e17ab44d7e ]
Add MODULE_DEVICE_TABLE(), so modules could be properly autoloaded based on the alias from of_device_id table.
Message-ID: <[email protected]>
--- drivers/hwmon/ntc_thermistor.c | 1 + 1 file changed, 1 insertion(+)
drivers/hwmon/ntc_thermistor.c +1 -0
@@ -62,6 +62,7 @@ static const struct platform_device_id ntc_thermistor_id[] = { [NTC_SSG1404001221] = { "ssg1404_001221", TYPE_NCPXXWB473 }, [NTC_LAST ] = { }, }; +MODULE_DEVICE_TABLE (platform ,ntc_thermistor_id );/* * A compensation table should be sorted by the values of .ohm
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 180/695 power: supply: axp20x_battery: Remove design from min and max voltage
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Morgan <[email protected]>
[ Upstream commit 61978807b00f8a1817b0e5580981af1cd2f428a5 ]
The POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN and POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN values should be immutable properties of the battery, but for this driver they are writable values and used as the minimum and maximum values for charging. Remove the DESIGN designation from these values.
--- drivers/power/supply/axp20x_battery.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/power/supply/axp20x_battery.c +8 -8
@@ -303,11 +303,11 @@ static int axp20x_battery_get_prop(struct power_supply *psy, val->intval = reg &AXP209_FG_PERCENT ;break ; -case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN : +case POWER_SUPPLY_PROP_VOLTAGE_MAX :return axp20x_batt->data->get_max_voltage (axp20x_batt, &val->intval); -case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN : +case POWER_SUPPLY_PROP_VOLTAGE_MIN : ret =regmap_read (axp20x_batt->regmap,AXP20X_V_OFF , ®);if (ret)return ret;
@@ -455,10 +455,10 @@ static int axp20x_battery_set_prop(struct power_supply *psy,struct axp20x_batt_ps *axp20x_batt =power_supply_get_drvdata (psy);switch (psp) { -case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN : +case POWER_SUPPLY_PROP_VOLTAGE_MIN :return axp20x_set_voltage_min_design (axp20x_batt, val->intval); -case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN : +case POWER_SUPPLY_PROP_VOLTAGE_MAX :return axp20x_batt->data->set_max_voltage (axp20x_batt, val->intval);case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT :
@@ -493,8 +493,8 @@ static enum power_supply_property axp20x_battery_props[] = {POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT ,POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX ,POWER_SUPPLY_PROP_HEALTH , -POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN , -POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN , +POWER_SUPPLY_PROP_VOLTAGE_MAX , +POWER_SUPPLY_PROP_VOLTAGE_MIN , POWER_SUPPLY_PROP_CAPACITY, };
@@ -502,8 +502,8 @@ static int axp20x_battery_prop_writeable(struct power_supply *psy, enum power_supply_property psp) {return psp ==POWER_SUPPLY_PROP_STATUS || - psp ==POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN || - psp ==POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN || + psp ==POWER_SUPPLY_PROP_VOLTAGE_MIN || + psp ==POWER_SUPPLY_PROP_VOLTAGE_MAX || psp ==POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT || psp ==POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 181/695 power: supply: max17042_battery: Fix SOC threshold calc w/ no current sense
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Artur Weber <[email protected]>
[ Upstream commit 3a3acf839b2cedf092bdd1ff65b0e9895df1656b ]
Commit 223a3b82834f ("power: supply: max17042_battery: use VFSOC for capacity when no rsns") made it so that capacity on systems without current sensing would be read from VFSOC instead of RepSOC. However, the SOC threshold calculation still read RepSOC to get the SOC regardless of the current sensing option state.
Fix this by applying the same conditional to determine which register should be read.
This also seems to be the intended behavior as per the datasheet - SOC alert config value in MiscCFG on setups without current sensing is set to a value of 0b11, indicating SOC alerts being generated based on VFSOC, instead of 0b00 which indicates SOC alerts being generated based on RepSOC.
This fixes an issue on the Galaxy S3/Midas boards, where the alert interrupt would be constantly retriggered, causing high CPU usage on idle (around ~12%-15%).
--- drivers/power/supply/max17042_battery.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/power/supply/max17042_battery.c +4 -1
@@ -853,7 +853,10 @@ static void max17042_set_soc_threshold(struct max17042_chip *chip, u16 off)/* program interrupt thresholds such that we should * get interrupt for every 'off' perc change in the soc */ -regmap_read (map, MAX17042_RepSOC, &soc); +if (chip->pdata->enable_current_sense) +regmap_read (map, MAX17042_RepSOC, &soc); +else +regmap_read (map,MAX17042_VFSOC , &soc); soc >>=8 ; soc_tr = (soc + off) <<8 ;if (off < soc)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 182/695 fbdev: hpfb: Fix an error handling path in hpfb_dio_probe()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit aa578e897520f32ae12bec487f2474357d01ca9c ]
If an error occurs after request_mem_region(), a corresponding release_mem_region() should be called, as already done in the remove function.
--- drivers/video/fbdev/hpfb.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/fbdev/hpfb.c +1 -0
@@ -345,6 +345,7 @@ static int hpfb_dio_probe(struct dio_dev *d, const struct dio_device_id *ent)if (hpfb_init_one (paddr, vaddr)) {if (d->scode >=DIOII_SCBASE )iounmap ((void *)vaddr); +release_mem_region (d->resource.start,resource_size (&d->resource));return -ENOMEM ; }return 0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 183/695 iommu/amd: Handle error path in amd_iommu_probe_device()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasant Hegde <[email protected]>
[ Upstream commit 293aa9ec694e633bff83ab93715a2684e15fe214 ]
Do not try to set max_pasids in error path as dev_data is not allocated.
--- drivers/iommu/amd/iommu.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/iommu/amd/iommu.c +5 -3
@@ -2185,11 +2185,12 @@ static struct iommu_device *amd_iommu_probe_device(struct device *dev)dev_err (dev,"Failed to initialize - trying to proceed anyway\n" ); iommu_dev =ERR_PTR (ret);iommu_ignore_device (iommu, dev); - }else { -amd_iommu_set_pci_msi_domain (dev, iommu); - iommu_dev = &iommu->iommu; + goto out_err; } +amd_iommu_set_pci_msi_domain (dev, iommu); + iommu_dev = &iommu->iommu; +/* * If IOMMU and device supports PASID then it will contain max * supported PASIDs, else it will be zero.
@@ -2201,6 +2202,7 @@ static struct iommu_device *amd_iommu_probe_device(struct device *dev) pci_max_pasids(to_pci_dev(dev))); } +out_err:iommu_completion_wait (iommu);return iommu_dev;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 184/695 iommu/amd: Allocate the page table root using GFP_KERNEL
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gunthorpe <[email protected]>
[ Upstream commit b0a6c883bcd42eeb0850135e529b34b64d57673c ]
Domain allocation is always done under a sleepable context, the v1 path and other drivers use GFP_KERNEL already. Fix the v2 path to also use GFP_KERNEL.
--- drivers/iommu/amd/io_pgtable_v2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/amd/io_pgtable_v2.c +1 -1
@@ -362,7 +362,7 @@ static struct io_pgtable *v2_alloc_pgtable(struct io_pgtable_cfg *cfg, void *coostruct protection_domain *pdom = (struct protection_domain *)cookie;int ias =IOMMU_IN_ADDR_BIT_SIZE ; - pgtable->pgd =iommu_alloc_page_node (pdom->nid,GFP_ATOMIC ); + pgtable->pgd =iommu_alloc_page_node (pdom->nid,GFP_KERNEL );if (!pgtable->pgd)return NULL ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 185/695 iommu/amd: Move allocation of the top table into v1_alloc_pgtable
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gunthorpe <[email protected]>
[ Upstream commit 8d00b77a52ef4b2091696ca25753d0ab95e4d839 ]
All the page table memory should be allocated/free within the io_pgtable struct. The v2 path is already doing this, make it consistent.
It is hard to see but the free of the root in protection_domain_free() is a NOP on the success path because v1_free_pgtable() does amd_iommu_domain_clr_pt_root().
The root memory is already freed because free_sub_pt() put it on the freelist. The free path in protection_domain_free() is only used during error unwind of protection_domain_alloc().
Stable-dep-of: 7a41dcb52f9d ("iommu/amd: Set the pgsize_bitmap correctly")
--- drivers/iommu/amd/io_pgtable.c | 8 ++++++-- drivers/iommu/amd/iommu.c | 21 ++------------------- 2 files changed, 8 insertions(+), 21 deletions(-)
drivers/iommu/amd/io_pgtable.c +6 -2
@@ -574,20 +574,24 @@ static void v1_free_pgtable(struct io_pgtable *iop) pgtable->mode > PAGE_MODE_6_LEVEL);free_sub_pt (pgtable->root, pgtable->mode, &freelist); +iommu_put_pages_list (&freelist);/* Update data structure */ amd_iommu_domain_clr_pt_root (dom);/* Make changes visible to IOMMUs */ amd_iommu_domain_update (dom); - -iommu_put_pages_list (&freelist); }static struct io_pgtable *v1_alloc_pgtable (struct io_pgtable_cfg *cfg,void *cookie) {struct amd_io_pgtable *pgtable =io_pgtable_cfg_to_data (cfg); + pgtable->root =iommu_alloc_page (GFP_KERNEL ); +if (!pgtable->root) +return NULL ; + pgtable->mode =PAGE_MODE_3_LEVEL ; + cfg->pgsize_bitmap =AMD_IOMMU_PGSIZES ; cfg->ias =IOMMU_IN_ADDR_BIT_SIZE ; cfg->oas =IOMMU_OUT_ADDR_BIT_SIZE ;
drivers/iommu/amd/iommu.c +2 -19
@@ -52,8 +52,6 @@#define HT_RANGE_START (0xfd00000000ULL)#define HT_RANGE_END (0xffffffffffULL) -#define DEFAULT_PGTABLE_LEVEL PAGE_MODE_3_LEVEL -static DEFINE_SPINLOCK (pd_bitmap_lock);LIST_HEAD (ioapic_map);
@@ -2267,30 +2265,15 @@ void protection_domain_free(struct protection_domain *domain)if (domain->iop.pgtbl_cfg.tlb)free_io_pgtable_ops (&domain->iop.iop.ops); -if (domain->iop.root) -iommu_free_page (domain->iop.root); -if (domain->id)domain_id_free (domain->id);kfree (domain); } -static int protection_domain_init_v1 (struct protection_domain *domain,int mode) +static int protection_domain_init_v1 (struct protection_domain *domain) { -u64 *pt_root =NULL ; - -BUG_ON (mode <PAGE_MODE_NONE || mode >PAGE_MODE_6_LEVEL ); - -if (mode !=PAGE_MODE_NONE ) { - pt_root =iommu_alloc_page (GFP_KERNEL ); -if (!pt_root) -return -ENOMEM ; - } - domain->pd_mode =PD_MODE_V1 ; -amd_iommu_domain_set_pgtable (domain, pt_root, mode); -return 0 ; }
@@ -2343,7 +2326,7 @@ struct protection_domain *protection_domain_alloc(unsigned int type)switch (pgtable) {case AMD_IOMMU_V1 : - ret =protection_domain_init_v1 (domain,DEFAULT_PGTABLE_LEVEL ); + ret =protection_domain_init_v1 (domain);break ;case AMD_IOMMU_V2 : ret =protection_domain_init_v2 (domain);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 186/695 iommu/amd: Set the pgsize_bitmap correctly
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gunthorpe <[email protected]>
[ Upstream commit 7a41dcb52f9de6079621fc31c3b84c7fc290934b ]
When using io_pgtable the correct pgsize_bitmap is stored in the cfg, both v1_alloc_pgtable() and v2_alloc_pgtable() set it correctly.
This fixes a bug where the v2 pgtable had the wrong pgsize as protection_domain_init_v2() would set it and then do_iommu_domain_alloc() immediately resets it.
Remove the confusing ops.pgsize_bitmap since that is not used if the driver sets domain.pgsize_bitmap.
--- drivers/iommu/amd/iommu.c | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-)
drivers/iommu/amd/iommu.c +4 -24
@@ -2271,26 +2271,11 @@ void protection_domain_free(struct protection_domain *domain)kfree (domain); } -static int protection_domain_init_v1 (struct protection_domain *domain) -{ - domain->pd_mode =PD_MODE_V1 ; -return 0 ; -} - -static int protection_domain_init_v2 (struct protection_domain *pdom) -{ - pdom->pd_mode =PD_MODE_V2 ; - pdom->domain.pgsize_bitmap =AMD_IOMMU_PGSIZES_V2 ; - -return 0 ; -} -struct protection_domain *protection_domain_alloc (unsigned int type) {struct io_pgtable_ops *pgtbl_ops;struct protection_domain *domain;int pgtable; -int ret; domain =kzalloc (sizeof (*domain),GFP_KERNEL );if (!domain)
@@ -2326,18 +2311,14 @@ struct protection_domain *protection_domain_alloc(unsigned int type)switch (pgtable) {case AMD_IOMMU_V1 : - ret =protection_domain_init_v1 (domain); + domain->pd_mode =PD_MODE_V1 ;break ;case AMD_IOMMU_V2 : - ret =protection_domain_init_v2 (domain); + domain->pd_mode =PD_MODE_V2 ;break ;default : - ret = -EINVAL ; -break ; - } - -if (ret) goto out_err; + } pgtbl_ops =alloc_io_pgtable_ops (pgtable, &domain->iop.pgtbl_cfg, domain);if (!pgtbl_ops)
@@ -2390,10 +2371,10 @@ static struct iommu_domain *do_iommu_domain_alloc(unsigned int type, domain->domain.geometry.aperture_start =0 ; domain->domain.geometry.aperture_end =dma_max_address (); domain->domain.geometry.force_aperture = true; + domain->domain.pgsize_bitmap = domain->iop.iop.cfg.pgsize_bitmap;if (iommu) { domain->domain.type = type; - domain->domain.pgsize_bitmap = iommu->iommu.ops->pgsize_bitmap; domain->domain.ops = iommu->iommu.ops->default_domain_ops;if (dirty_tracking)
@@ -2852,7 +2833,6 @@ const struct iommu_ops amd_iommu_ops = { .device_group = amd_iommu_device_group, .get_resv_regions = amd_iommu_get_resv_regions, .is_attach_deferred = amd_iommu_is_attach_deferred, - .pgsize_bitmap = AMD_IOMMU_PGSIZES, .def_domain_type = amd_iommu_def_domain_type, .dev_enable_feat = amd_iommu_dev_enable_feature, .dev_disable_feat = amd_iommu_dev_disable_feature,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 187/695 iommu/amd: Do not set the D bit on AMD v2 table entries
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gunthorpe <[email protected]>
[ Upstream commit 2910a7fa1be090fc7637cef0b2e70bcd15bf5469 ]
The manual says that bit 6 is IGN for all Page-Table Base Address pointers, don't set it.
--- drivers/iommu/amd/io_pgtable_v2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/amd/io_pgtable_v2.c +1 -1
@@ -51,7 +51,7 @@ static inline u64 set_pgtable_attr(u64 *page)u64 prot; prot =IOMMU_PAGE_PRESENT |IOMMU_PAGE_RW |IOMMU_PAGE_USER ; - prot |=IOMMU_PAGE_ACCESS |IOMMU_PAGE_DIRTY ; + prot |=IOMMU_PAGE_ACCESS ;return (iommu_virt_to_phys (page) | prot); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 188/695 mtd: powernv: Add check devm_kasprintf() returned value
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Han <[email protected]>
[ Upstream commit 395999829880a106bb95f0ce34e6e4c2b43c6a5d ]
devm_kasprintf() can return a NULL pointer on failure but this returned value is not checked.
--- drivers/mtd/devices/powernv_flash.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/mtd/devices/powernv_flash.c +3 -0
@@ -207,6 +207,9 @@ static int powernv_flash_set_driver_info(struct device *dev,* get them */ mtd->name =devm_kasprintf (dev,GFP_KERNEL ,"%pOFP" , dev->of_node); +if (!mtd->name) +return -ENOMEM ; + mtd->type =MTD_NORFLASH ; mtd->flags =MTD_WRITEABLE ; mtd->size = size;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 189/695 rcu/nocb: Fix RT throttling hrtimer armed from offline CPU
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frederic Weisbecker <[email protected]>
[ Upstream commit 9139f93209d1ffd7f489ab19dee01b7c3a1a43d2 ]
After a CPU is marked offline and until it reaches its final trip to idle, rcuo has several opportunities to be woken up, either because a callback has been queued in the meantime or because rcutree_report_cpu_dead() has issued the final deferred NOCB wake up.
If RCU-boosting is enabled, RCU kthreads are set to SCHED_FIFO policy. And if RT-bandwidth is enabled, the related hrtimer might be armed. However this then happens after hrtimers have been migrated at the CPUHP_AP_HRTIMERS_DYING stage, which is broken as reported by the following warning:
Call trace: enqueue_hrtimer+0x7c/0xf8 hrtimer_start_range_ns+0x2b8/0x300 enqueue_task_rt+0x298/0x3f0 enqueue_task+0x94/0x188 ttwu_do_activate+0xb4/0x27c try_to_wake_up+0x2d8/0x79c wake_up_process+0x18/0x28 __wake_nocb_gp+0x80/0x1a0 do_nocb_deferred_wakeup_common+0x3c/0xcc rcu_report_dead+0x68/0x1ac cpuhp_report_idle_dead+0x48/0x9c do_idle+0x288/0x294 cpu_startup_entry+0x34/0x3c secondary_start_kernel+0x138/0x158
Fix this with waking up rcuo using an IPI if necessary. Since the existing API to deal with this situation only handles swait queue, rcuo is only woken up from offline CPUs if it's not already waiting on a grace period. In the worst case some callbacks will just wait for a grace period to complete before being assigned to a subsequent one.
--- kernel/rcu/tree_nocb.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
kernel/rcu/tree_nocb.h +4 -1
@@ -220,7 +220,10 @@ static bool __wake_nocb_gp(struct rcu_data *rdp_gp,raw_spin_unlock_irqrestore (&rdp_gp->nocb_gp_lock, flags);if (needwake) {trace_rcu_nocb_wake (rcu_state.name, rdp->cpu,TPS ("DoWake" )); -wake_up_process (rdp_gp->nocb_gp_kthread); +if (cpu_is_offline (raw_smp_processor_id ())) +swake_up_one_online (&rdp_gp->nocb_gp_wq); +else +wake_up_process (rdp_gp->nocb_gp_kthread); }return needwake;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 190/695 mtd: rawnand: mtk: Use for_each_child_of_node_scoped()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jinjie Ruan <[email protected]>
[ Upstream commit 8795952679494b111b7b2ba08bb54ac408daca3b ]
Avoids the need for manual cleanup of_node_put() in early exits from the loop.
Stable-dep-of: 2073ae37d550 ("mtd: rawnand: mtk: Fix init error path")
--- drivers/mtd/nand/raw/mtk_nand.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/mtd/nand/raw/mtk_nand.c +2 -5
@@ -1432,15 +1432,12 @@ static int mtk_nfc_nand_chip_init(struct device *dev, struct mtk_nfc *nfc,static int mtk_nfc_nand_chips_init (struct device *dev,struct mtk_nfc *nfc) {struct device_node *np = dev->of_node; -struct device_node *nand_np;int ret; -for_each_child_of_node (np, nand_np) { +for_each_child_of_node_scoped (np, nand_np) { ret =mtk_nfc_nand_chip_init (dev, nfc, nand_np); -if (ret) { -of_node_put (nand_np); +if (ret)return ret; - } }return 0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 191/695 mtd: rawnand: mtk: Factorize out the logic cleaning mtk chips
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miquel Raynal <[email protected]>
[ Upstream commit 81cb3be3261e766a1f8efab9e3154a4f4fd9d03d ]
There are some un-freed resources in one of the error path which would benefit from a helper going through all the registered mtk chips one by one and perform all the necessary cleanup. This is precisely what the remove path does, so let's extract the logic in a helper.
There is no functional change.
Stable-dep-of: 2073ae37d550 ("mtd: rawnand: mtk: Fix init error path")
--- drivers/mtd/nand/raw/mtk_nand.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-)
drivers/mtd/nand/raw/mtk_nand.c +18 -13
@@ -1429,6 +1429,23 @@ static int mtk_nfc_nand_chip_init(struct device *dev, struct mtk_nfc *nfc,return 0 ; } +static void mtk_nfc_nand_chips_cleanup (struct mtk_nfc *nfc) +{ +struct mtk_nfc_nand_chip *mtk_chip; +struct nand_chip *chip; +int ret; + +while (!list_empty (&nfc->chips)) { + mtk_chip =list_first_entry (&nfc->chips, + struct mtk_nfc_nand_chip, node); + chip = &mtk_chip->nand; + ret =mtd_device_unregister (nand_to_mtd (chip)); +WARN_ON (ret); +nand_cleanup (chip); +list_del (&mtk_chip->node); + } +} +static int mtk_nfc_nand_chips_init (struct device *dev,struct mtk_nfc *nfc) {struct device_node *np = dev->of_node;
@@ -1567,20 +1584,8 @@ static int mtk_nfc_probe(struct platform_device *pdev)static void mtk_nfc_remove (struct platform_device *pdev) {struct mtk_nfc *nfc =platform_get_drvdata (pdev); -struct mtk_nfc_nand_chip *mtk_chip; -struct nand_chip *chip; -int ret; - -while (!list_empty (&nfc->chips)) { - mtk_chip =list_first_entry (&nfc->chips, - struct mtk_nfc_nand_chip, node); - chip = &mtk_chip->nand; - ret =mtd_device_unregister (nand_to_mtd (chip)); -WARN_ON (ret); -nand_cleanup (chip); -list_del (&mtk_chip->node); - } +mtk_nfc_nand_chips_cleanup (nfc);mtk_ecc_release (nfc->ecc); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 192/695 mtd: rawnand: mtk: Fix init error path
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miquel Raynal <[email protected]>
[ Upstream commit 2073ae37d550ea32e8545edaa94ef10b4fef7235 ]
Reviewing a series converting the for_each_chil_of_node() loops into their _scoped variants made me realize there was no cleanup of the already registered NAND devices upon error which may leak memory on systems with more than a chip when this error occurs. We should call the _nand_chips_cleanup() function when this happens.
--- drivers/mtd/nand/raw/mtk_nand.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mtd/nand/raw/mtk_nand.c +3 -1
@@ -1453,8 +1453,10 @@ static int mtk_nfc_nand_chips_init(struct device *dev, struct mtk_nfc *nfc)for_each_child_of_node_scoped (np, nand_np) { ret =mtk_nfc_nand_chip_init (dev, nfc, nand_np); -if (ret) +if (ret) { +mtk_nfc_nand_chips_cleanup (nfc);return ret; + } }return 0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 193/695 iommu/arm-smmu-qcom: hide last LPASS SMMU context bank from linux
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marc Gonzalez <[email protected]>
[ Upstream commit 3a8990b8a778219327c5f8ecf10b5d81377b925a ]
On qcom msm8998, writing to the last context bank of lpass_q6_smmu (base address 0x05100000) produces a system freeze & reboot.
The hardware/hypervisor reports 13 context banks for the LPASS SMMU on msm8998, but only the first 12 are accessible... Override the number of context banks
[ 2.546101] arm-smmu 5100000.iommu: probing hardware configuration... [ 2.552439] arm-smmu 5100000.iommu: SMMUv2 with: [ 2.558945] arm-smmu 5100000.iommu: stage 1 translation [ 2.563627] arm-smmu 5100000.iommu: address translation ops [ 2.568923] arm-smmu 5100000.iommu: non-coherent table walk [ 2.574566] arm-smmu 5100000.iommu: (IDR0.CTTW overridden by FW configuration) [ 2.580220] arm-smmu 5100000.iommu: stream matching with 12 register groups [ 2.587263] arm-smmu 5100000.iommu: 13 context banks (0 stage-2 only) [ 2.614447] arm-smmu 5100000.iommu: Supported page sizes: 0x63315000 [ 2.621358] arm-smmu 5100000.iommu: Stage-1: 36-bit VA -> 36-bit IPA [ 2.627772] arm-smmu 5100000.iommu: preserved 0 boot mappings
Specifically, the crashes occur here:
qsmmu->bypass_cbndx = smmu->num_context_banks - 1; arm_smmu_cb_write(smmu, qsmmu->bypass_cbndx, ARM_SMMU_CB_SCTLR, 0);
and here:
arm_smmu_write_context_bank(smmu, i); arm_smmu_cb_write(smmu, i, ARM_SMMU_CB_FSR, ARM_SMMU_CB_FSR_FAULT);
It is likely that FW reserves the last context bank for its own use, thus a simple work-around is: DON'T USE IT in Linux.
If we decrease the number of context banks, last one will be "hidden".
Stable-dep-of: 19eb465c969f ("iommu/arm-smmu-qcom: apply num_context_bank fixes for SDM630 / SDM660")
--- drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +7 -0
@@ -282,6 +282,13 @@ static int qcom_smmu_cfg_probe(struct arm_smmu_device *smmu)u32 smr;int i; +/* +* MSM8998 LPASS SMMU reports 13 context banks, but accessing +* the last context bank crashes the system. +*/ +if (of_device_is_compatible (smmu->dev->of_node,"qcom,msm8998-smmu-v2" ) && smmu->num_context_banks ==13 ) + smmu->num_context_banks =12 ; +/* * Some platforms support more than the Arm SMMU architected maximum of * 128 stream matching groups. For unknown reasons, the additional
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 194/695 iommu/arm-smmu-qcom: Work around SDM845 Adreno SMMU w/ 16K pages
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
[ Upstream commit 2d42d3ba443706c9164fa0bef4e5fd1c36bc1bd9 ]
SDM845's Adreno SMMU is unique in that it actually advertizes support for 16K (and 32M) pages, which doesn't hold for newer SoCs.
This however, seems either broken in the hardware implementation, the hypervisor middleware that abstracts the SMMU, or there's a bug in the Linux kernel somewhere down the line that nobody managed to track down.
Booting SDM845 with 16K page sizes and drm/msm results in:
*** gpu fault: ttbr0=0000000000000000 iova=000100000000c000 dir=READ type=TRANSLATION source=CP (0,0,0,0)
right after loading the firmware. The GPU then starts spitting out illegal intstruction errors, as it's quite obvious that it got a bogus pointer.
Moreover, it seems like this issue also concerns other implementations of SMMUv2 on Qualcomm SoCs, such as the one on SC7180.
Hide 16K support on such instances to work around this.
Stable-dep-of: 19eb465c969f ("iommu/arm-smmu-qcom: apply num_context_bank fixes for SDM630 / SDM660")
--- drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +9 -0
@@ -345,6 +345,14 @@ static int qcom_smmu_cfg_probe(struct arm_smmu_device *smmu)return 0 ; } +static int qcom_adreno_smmuv2_cfg_probe (struct arm_smmu_device *smmu) +{ +/* Support for 16K pages is advertised on some SoCs, but it doesn't seem to work */ + smmu->features &= ~ARM_SMMU_FEAT_FMT_AARCH64_16K ; + +return 0 ; +} +static void qcom_smmu_write_s2cr (struct arm_smmu_device *smmu,int idx) {struct arm_smmu_s2cr *s2cr = smmu->s2crs + idx;
@@ -443,6 +451,7 @@ static const struct arm_smmu_impl sdm845_smmu_500_impl = {static const struct arm_smmu_impl qcom_adreno_smmu_v2_impl = { .init_context = qcom_adreno_smmu_init_context, + .cfg_probe = qcom_adreno_smmuv2_cfg_probe, .def_domain_type = qcom_smmu_def_domain_type, .alloc_context_bank = qcom_adreno_smmu_alloc_context_bank, .write_sctlr = qcom_adreno_smmu_write_sctlr,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 195/695 iommu/arm-smmu-qcom: apply num_context_bank fixes for SDM630 / SDM660
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 19eb465c969f3d6ed1b98506d3e470e863b41e16 ]
The Qualcomm SDM630 / SDM660 platform requires the same kind of workaround as MSM8998: some IOMMUs have context banks reserved by firmware / TZ, touching those banks resets the board.
Apply the num_context_bank workaround to those two SMMU devices in order to allow them to be used by Linux.
--- drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c +13 -1
@@ -286,8 +286,15 @@ static int qcom_smmu_cfg_probe(struct arm_smmu_device *smmu)* MSM8998 LPASS SMMU reports 13 context banks, but accessing * the last context bank crashes the system. */ -if (of_device_is_compatible (smmu->dev->of_node,"qcom,msm8998-smmu-v2" ) && smmu->num_context_banks ==13 ) +if (of_device_is_compatible (smmu->dev->of_node,"qcom,msm8998-smmu-v2" ) && + smmu->num_context_banks ==13 ) { smmu->num_context_banks =12 ; + }else if (of_device_is_compatible (smmu->dev->of_node,"qcom,sdm630-smmu-v2" )) { +if (smmu->num_context_banks ==21 )/* SDM630 / SDM660 A2NOC SMMU */ + smmu->num_context_banks =7 ; +else if (smmu->num_context_banks ==14 )/* SDM630 / SDM660 LPASS SMMU */ + smmu->num_context_banks =13 ; + }/* * Some platforms support more than the Arm SMMU architected maximum of
@@ -350,6 +357,11 @@ static int qcom_adreno_smmuv2_cfg_probe(struct arm_smmu_device *smmu)/* Support for 16K pages is advertised on some SoCs, but it doesn't seem to work */ smmu->features &= ~ARM_SMMU_FEAT_FMT_AARCH64_16K ; +/* TZ protects several last context banks, hide them from Linux */ +if (of_device_is_compatible (smmu->dev->of_node,"qcom,sdm630-smmu-v2" ) && + smmu->num_context_banks ==5 ) + smmu->num_context_banks =2 ; +return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 196/695 pmdomain: core: Harden inter-column space in debug summary
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 692c20c4d075bd452acfbbc68200fc226c7c9496 ]
The inter-column space in the debug summary is two spaces. However, in one case, the extra space is handled implicitly in a field width specifier. Make inter-column space explicit to ease future maintenance.
--- drivers/pmdomain/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pmdomain/core.c +1 -1
@@ -3226,7 +3226,7 @@ static int genpd_summary_one(struct seq_file *s,else snprintf (state,sizeof (state),"%s" , status_lookup[genpd->status]); -seq_printf (s,"%-30s %-50s %u" , genpd->name, state, genpd->performance_state); +seq_printf (s,"%-30s %-49s %u" , genpd->name, state, genpd->performance_state);/* * Modifications on the list require holding locks on both
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 197/695 pmdomain: core: Fix "managed by" alignment in debug summary
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 987a43e89ec67cc68518c0558db42ba542581597 ]
The "performance" column contains variable-width values. Hence when their printed values contain more than one digit, all values in successive columns become misaligned.
Fix this by formatting it as a fixed-width field. Adjust successive spaces and field widths to retain the exiting layout.
--- drivers/pmdomain/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pmdomain/core.c +2 -2
@@ -3190,7 +3190,7 @@ static void mode_status_str(struct seq_file *s, struct device *dev) gpd_data =to_gpd_data (dev->power.subsys_data->domain_data); -seq_printf (s,"%20s" , gpd_data->hw_mode ?"HW" :"SW" ); +seq_printf (s,"%9s" , gpd_data->hw_mode ?"HW" :"SW" ); }static void perf_status_str (struct seq_file *s,struct device *dev)
@@ -3198,7 +3198,7 @@ static void perf_status_str(struct seq_file *s, struct device *dev)struct generic_pm_domain_data *gpd_data; gpd_data =to_gpd_data (dev->power.subsys_data->domain_data); -seq_put_decimal_ull (s,"" , gpd_data->performance_state); +seq_printf (s,"%-10u " , gpd_data->performance_state); } static int genpd_summary_one(struct seq_file *s,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 198/695 drm/stm: Fix an error handling path in stm_drm_platform_probe()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit ce7c90bfda2656418c69ba0dd8f8a7536b8928d4 ]
If drm_dev_register() fails, a call to drv_load() must be undone, as already done in the remove function.
--- drivers/gpu/drm/stm/drv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/stm/drv.c +3 -1
@@ -203,12 +203,14 @@ static int stm_drm_platform_probe(struct platform_device *pdev) ret =drm_dev_register (ddev,0 );if (ret) - goto err_put; + goto err_unload;drm_fbdev_dma_setup (ddev,16 );return 0 ; +err_unload: +drv_unload (ddev); err_put:drm_dev_put (ddev);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 199/695 drm/stm: ltdc: check memory returned by devm_kzalloc()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Claudiu Beznea <[email protected]>
[ Upstream commit fd39730c58890cd7f0a594231e19bb357f28877c ]
devm_kzalloc() can fail and return NULL pointer. Check its return status. Identified with Coccinelle (kmerr.cocci script).
--- drivers/gpu/drm/stm/ltdc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/stm/ltdc.c +2 -0
@@ -1580,6 +1580,8 @@ static struct drm_plane *ltdc_plane_create(struct drm_device *ddev,ARRAY_SIZE (ltdc_drm_fmt_ycbcr_sp) + ARRAY_SIZE(ltdc_drm_fmt_ycbcr_fp)) * sizeof(*formats), GFP_KERNEL); +if (!formats) +return NULL ;for (i =0 ; i < ldev->caps.pix_fmt_nb; i++) { drm_fmt = ldev->caps.pix_fmt_drm[i];
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 200/695 drm/amd/display: free bo used for dmub bounding box
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aurabindo Pillai <[email protected]>
[ Upstream commit f59549c7e705be0087d08bc116ccc767b86d8362 ]
fix a memleak introduced by not removing the buffer object for use with early dmub bounding box value storage
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +11 -2
@@ -1740,7 +1740,7 @@ static struct dml2_soc_bb *dm_dmub_get_vbios_bounding_box(struct amdgpu_device */* Send the chunk */ ret =dm_dmub_send_vbios_gpint_command (adev, send_addrs[i], chunk,30000 );if (ret !=DMUB_STATUS_OK ) -/* No need to free bb here since it shall be done unconditionally <elsewhere> */ +/* No need to free bb here since it shall be done in dm_sw_fini() */ return NULL ; }
@@ -2489,8 +2489,17 @@ static int dm_sw_init(void *handle)static int dm_sw_fini (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle; +struct dal_allocation *da; + +list_for_each_entry (da, &adev->dm.da_list, list) { +if (adev->dm.bb_from_dmub == (void *) da->cpu_ptr) { +amdgpu_bo_free_kernel (&da->bo, &da->gpu_addr, &da->cpu_ptr); +list_del (&da->list); +kfree (da); +break ; + } + } -kfree (adev->dm.bb_from_dmub); adev->dm.bb_from_dmub =NULL ;kfree (adev->dm.dmub_fb_info);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 201/695 drm/amd/display: Check link_res->hpo_dp_link_enc before using it
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Hung <[email protected]>
[ Upstream commit 0beca868cde8742240cd0038141c30482d2b7eb8 ]
[WHAT & HOW]
Functions dp_enable_link_phy and dp_disable_link_phy can pass link_res without initializing hpo_dp_link_enc and it is necessary to check for null before dereferencing.
This fixes 2 FORWARD_NULL issues reported by Coverity.
--- .../gpu/drm/amd/display/dc/link/hwss/link_hwss_hpo_dp.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/display/dc/link/hwss/link_hwss_hpo_dp.c +7 -0
@@ -28,6 +28,8 @@#include "dccg.h" #include "clk_mgr.h" +#define DC_LOGGER link->ctx->logger +void set_hpo_dp_throttled_vcp_size (struct pipe_ctx *pipe_ctx,struct fixed31_32 throttled_vcp_size) {
@@ -124,6 +126,11 @@ void disable_hpo_dp_link_output(struct dc_link *link,const struct link_resource *link_res, enum signal_type signal) { + if (!link_res->hpo_dp_link_enc) { + DC_LOG_ERROR("%s: invalid hpo_dp_link_enc\n", __func__); +return ; + } + link_res->hpo_dp_link_enc->funcs->link_disable (link_res->hpo_dp_link_enc); link_res->hpo_dp_link_enc->funcs->disable_link_phy ( link_res->hpo_dp_link_enc, signal);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 202/695 drm/amd/display: Add null check for set_output_gamma in dcn30_set_output_transfer_func
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivasan Shanmugam <[email protected]>
[ Upstream commit 08ae395ea22fb3d9b318c8bde28c0dfd2f5fa4d2 ]
This commit adds a null check for the set_output_gamma function pointer in the dcn30_set_output_transfer_func function. Previously, set_output_gamma was being checked for nullity at line 386, but then it was being dereferenced without any nullity check at line 401. This could potentially lead to a null pointer dereference error if set_output_gamma is indeed null.
To fix this, we now ensure that set_output_gamma is not null before dereferencing it. We do this by adding a nullity check for set_output_gamma before the call to set_output_gamma at line 401. If set_output_gamma is null, we log an error message and do not call the function.
This fix prevents a potential null pointer dereference error.
drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn30/dcn30_hwseq.c:401 dcn30_set_output_transfer_func()
error: we previously assumed 'mpc->funcs->set_output_gamma' could be null (see line 386)
drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn30/dcn30_hwseq.c
373 bool dcn30_set_output_transfer_func(struct dc *dc,
374 struct pipe_ctx *pipe_ctx,
375 const struct dc_stream_state *stream)
376 {
377 int mpcc_id = pipe_ctx->plane_res.hubp->inst;
378 struct mpc *mpc = pipe_ctx->stream_res.opp->ctx->dc->res_pool->mpc;
379 const struct pwl_params *params = NULL;
380 bool ret = false;
381
382 /* program OGAM or 3DLUT only for the top pipe*/
383 if (pipe_ctx->top_pipe == NULL) {
384 /*program rmu shaper and 3dlut in MPC*/
385 ret = dcn30_set_mpc_shaper_3dlut(pipe_ctx, stream);
386 if (ret == false && mpc->funcs->set_output_gamma) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ If this is NULL
387 if (stream->out_transfer_func.type == TF_TYPE_HWPWL)
388 params = &stream->out_transfer_func.pwl;
389 else if (pipe_ctx->stream->out_transfer_func.type ==
390 TF_TYPE_DISTRIBUTED_POINTS &&
391 cm3_helper_translate_curve_to_hw_format(
392 &stream->out_transfer_func,
393 &mpc->blender_params, false))
394 params = &mpc->blender_params;
395 /* there are no ROM LUTs in OUTGAM */
396 if (stream->out_transfer_func.type == TF_TYPE_PREDEFINED)
397 BREAK_TO_DEBUGGER();
398 }
399 }
400
--> 401 mpc->funcs->set_output_gamma(mpc, mpcc_id, params);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Then it will crash
402 return ret;
403 }--- drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c +5 -1
@@ -398,7 +398,11 @@ bool dcn30_set_output_transfer_func(struct dc *dc, } } - mpc->funcs->set_output_gamma (mpc, mpcc_id, params); +if (mpc->funcs->set_output_gamma) + mpc->funcs->set_output_gamma (mpc, mpcc_id, params); +else +DC_LOG_ERROR ("%s: set_output_gamma function pointer is NULL.\n" , __func__); +return ret; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 203/695 drm/amdgpu: properly handle vbios fake edid sizing
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
[ Upstream commit 8155566a26b8d6c1dd914f06a0c652e4e2f2adf1 ]
The comment in the vbios structure says:
// = 128 means EDID length is 128 bytes, otherwise the EDID length = ucFakeEDIDLength*128
This fake edid struct has not been used in a long time, so I'm not sure if there were actually any boards out there with a non-128 byte EDID, but align the code with the comment.
--- .../gpu/drm/amd/amdgpu/atombios_encoders.c | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/amdgpu/atombios_encoders.c +16 -13
@@ -2065,26 +2065,29 @@ amdgpu_atombios_encoder_get_lcd_info(struct amdgpu_encoder *encoder) fake_edid_record = (ATOM_FAKE_EDID_PATCH_RECORD *)record;if (fake_edid_record->ucFakeEDIDLength) {struct edid *edid; -int edid_size = -max ((int )EDID_LENGTH , (int )fake_edid_record->ucFakeEDIDLength); - edid =kmalloc (edid_size,GFP_KERNEL ); +int edid_size; + +if (fake_edid_record->ucFakeEDIDLength ==128 ) + edid_size = fake_edid_record->ucFakeEDIDLength; +else + edid_size = fake_edid_record->ucFakeEDIDLength *128 ; + edid =kmemdup (&fake_edid_record->ucFakeEDIDString[0 ], + edid_size,GFP_KERNEL );if (edid) { -memcpy ((u8 *)edid, (u8 *)&fake_edid_record->ucFakeEDIDString[0 ], - fake_edid_record->ucFakeEDIDLength); -if (drm_edid_is_valid (edid)) { adev->mode_info.bios_hardcoded_edid = edid; adev->mode_info.bios_hardcoded_edid_size = edid_size; - }else + }else {kfree (edid); + } } + record +=struct_size (fake_edid_record, + ucFakeEDIDString, + edid_size); + }else { +/* empty fake edid record must be 3 bytes long */ + record +=sizeof (ATOM_FAKE_EDID_PATCH_RECORD ) +1 ; } - record += fake_edid_record->ucFakeEDIDLength ? -struct_size (fake_edid_record, - ucFakeEDIDString, - fake_edid_record->ucFakeEDIDLength) : -/* empty fake edid record must be 3 bytes long */ -sizeof (ATOM_FAKE_EDID_PATCH_RECORD ) +1 ;break ;case LCD_PANEL_RESOLUTION_RECORD_TYPE : panel_res_record = (ATOM_PANEL_RESOLUTION_PATCH_RECORD *)record;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 204/695 drm/radeon: properly handle vbios fake edid sizing
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
[ Upstream commit 17c6baff3d5f65c8da164137a58742541a060b2f ]
The comment in the vbios structure says:
// = 128 means EDID length is 128 bytes, otherwise the EDID length = ucFakeEDIDLength*128
This fake edid struct has not been used in a long time, so I'm not sure if there were actually any boards out there with a non-128 byte EDID, but align the code with the comment.
--- drivers/gpu/drm/radeon/radeon_atombios.c | 29 +++++++++++++----------- 1 file changed, 16 insertions(+), 13 deletions(-)
drivers/gpu/drm/radeon/radeon_atombios.c +16 -13
@@ -1717,26 +1717,29 @@ struct radeon_encoder_atom_dig *radeon_atombios_get_lvds_info(struct fake_edid_record = (ATOM_FAKE_EDID_PATCH_RECORD *)record;if (fake_edid_record->ucFakeEDIDLength) {struct edid *edid; -int edid_size = -max ((int )EDID_LENGTH , (int )fake_edid_record->ucFakeEDIDLength); - edid =kmalloc (edid_size,GFP_KERNEL ); +int edid_size; + +if (fake_edid_record->ucFakeEDIDLength ==128 ) + edid_size = fake_edid_record->ucFakeEDIDLength; +else + edid_size = fake_edid_record->ucFakeEDIDLength *128 ; + edid =kmemdup (&fake_edid_record->ucFakeEDIDString[0 ], + edid_size,GFP_KERNEL );if (edid) { -memcpy ((u8 *)edid, (u8 *)&fake_edid_record->ucFakeEDIDString[0 ], - fake_edid_record->ucFakeEDIDLength); -if (drm_edid_is_valid (edid)) { rdev->mode_info.bios_hardcoded_edid = edid; rdev->mode_info.bios_hardcoded_edid_size = edid_size; - }else + }else {kfree (edid); + } } + record +=struct_size (fake_edid_record, + ucFakeEDIDString, + edid_size); + }else { +/* empty fake edid record must be 3 bytes long */ + record +=sizeof (ATOM_FAKE_EDID_PATCH_RECORD ) +1 ; } - record += fake_edid_record->ucFakeEDIDLength ? -struct_size (fake_edid_record, - ucFakeEDIDString, - fake_edid_record->ucFakeEDIDLength) : -/* empty fake edid record must be 3 bytes long */ -sizeof (ATOM_FAKE_EDID_PATCH_RECORD ) +1 ;break ;case LCD_PANEL_RESOLUTION_RECORD_TYPE : panel_res_record = (ATOM_PANEL_RESOLUTION_PATCH_RECORD *)record;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 205/695 drm/amd/display: Reset VRR config during resume
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tom Chung <[email protected]>
[ Upstream commit df18a4de9e77ad92c472fd1eb0fb1255d52dd4cd ]
[Why]
After resume the system, the new_crtc_state->vrr_infopacket does not synchronize with the current state. It will affect the update_freesync_state_on_stream() does not update the state correctly.
The previous patch causes a PSR SU regression that cannot let panel go into self-refresh mode.
[How]
Reset the VRR config during resume to force update the VRR config later.
--- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +5 -1
@@ -176,6 +176,7 @@ MODULE_FIRMWARE(FIRMWARE_DCN_401_DMUB);static int amdgpu_dm_init (struct amdgpu_device *adev);static void amdgpu_dm_fini (struct amdgpu_device *adev);static bool is_freesync_video_mode (const struct drm_display_mode *mode,struct amdgpu_dm_connector *aconnector); +static void reset_freesync_config_for_crtc (struct dm_crtc_state *new_crtc_state);static enum drm_mode_subconnector get_subconnector_type (struct dc_link *link) {
@@ -3239,8 +3240,11 @@ static int dm_resume(void *handle)drm_connector_list_iter_end (&iter);/* Force mode set in atomic commit */ -for_each_new_crtc_in_state (dm->cached_state, crtc, new_crtc_state, i) +for_each_new_crtc_in_state (dm->cached_state, crtc, new_crtc_state, i) { new_crtc_state->active_changed = true; + dm_new_crtc_state =to_dm_crtc_state (new_crtc_state); +reset_freesync_config_for_crtc (dm_new_crtc_state); + }/* * atomic_check is expected to create the dc states. We need to release
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 206/695 scsi: smartpqi: revert propagate-the-multipath-failure-to-SML-quickly
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gilbert Wu <[email protected]>
[ Upstream commit f1393d52e6cda9c20f12643cbecf1e1dc357e0e2 ]
Correct a rare multipath failure issue by reverting commit 94a68c814328 ("scsi: smartpqi: Quickly propagate path failures to SCSI midlayer") [1].
Reason for revert: The patch propagated the path failure to SML quickly when one of the path fails during IO and AIO path gets disabled for a multipath device.
But it created a new issue: when creating a volume on an encryption-enabled controller, the firmware reports the AIO path is disabled, which cause the driver to report a path failure to SML for a multipath device.
There will be a new fix to handle "Illegal request" and "Invalid field in parameter list" on RAID path when the AIO path is disabled on a multipath device.
[1] https://lore.kernel.org/all/[email protected]/
--- drivers/scsi/smartpqi/smartpqi_init.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-)
drivers/scsi/smartpqi/smartpqi_init.c +2 -18
@@ -2354,14 +2354,6 @@ static inline void pqi_mask_device(u8 *scsi3addr) scsi3addr[3 ] |=0xc0 ; } -static inline bool pqi_is_multipath_device (struct pqi_scsi_dev *device) -{ -if (pqi_is_logical_device (device)) -return false; - -return (device->path_map & (device->path_map -1 )) !=0 ; -} -static inline bool pqi_expose_device (struct pqi_scsi_dev *device) {return !device->is_physical_device || !pqi_skip_device (device->scsi3addr);
@@ -3258,14 +3250,12 @@ static void pqi_process_aio_io_error(struct pqi_io_request *io_request)int residual_count;int xfer_count;bool device_offline; -struct pqi_scsi_dev *device; scmd = io_request->scmd; error_info = io_request->error_info; host_byte =DID_OK ; sense_data_length =0 ; device_offline = false; - device = scmd->device->hostdata;switch (error_info->service_response) {case PQI_AIO_SERV_RESPONSE_COMPLETE :
@@ -3290,14 +3280,8 @@ static void pqi_process_aio_io_error(struct pqi_io_request *io_request)break ;case PQI_AIO_STATUS_AIO_PATH_DISABLED :pqi_aio_path_disabled (io_request); -if (pqi_is_multipath_device (device)) { -pqi_device_remove_start (device); - host_byte =DID_NO_CONNECT ; - scsi_status =SAM_STAT_CHECK_CONDITION ; - }else { - scsi_status =SAM_STAT_GOOD ; - io_request->status = -EAGAIN ; - } + scsi_status =SAM_STAT_GOOD ; + io_request->status = -EAGAIN ;break ;case PQI_AIO_STATUS_NO_PATH_TO_DEVICE :case PQI_AIO_STATUS_INVALID_DEVICE :
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 207/695 scsi: sd: Dont check if a write for REQ_ATOMIC
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Garry <[email protected]>
[ Upstream commit 0c150b30d3d51a8c2e09fadd004a640fa12985c6 ]
Flag REQ_ATOMIC can only be set for writes, so don't check if the operation is also a write in sd_setup_read_write_cmnd().
--- drivers/scsi/sd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/sd.c +1 -1
@@ -1382,7 +1382,7 @@ static blk_status_t sd_setup_read_write_cmnd(struct scsi_cmnd *cmd)if (protect && sdkp->protection_type ==T10_PI_TYPE2_PROTECTION ) { ret =sd_setup_rw32_cmnd (cmd, write, lba, nr_blocks, protect | fua, dld); - }else if (rq->cmd_flags &REQ_ATOMIC && write) { + }else if (rq->cmd_flags &REQ_ATOMIC ) { ret =sd_setup_atomic_cmnd (cmd, lba, nr_blocks, sdkp->use_atomic_write_boundary, protect | fua);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 208/695 scsi: block: Dont check REQ_ATOMIC for reads
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Garry <[email protected]>
[ Upstream commit ea6787c695ab7595d851c3506f67c157f3b593c0 ]
We check in submit_bio_noacct() if flag REQ_ATOMIC is set for both read and write operations, and then validate the atomic operation if set. Flag REQ_ATOMIC can only be set for writes, so don't bother checking for reads.
--- block/blk-core.c | 1 + 1 file changed, 1 insertion(+)
block/blk-core.c +1 -0
@@ -799,6 +799,7 @@ void submit_bio_noacct(struct bio *bio)switch (bio_op (bio)) {case REQ_OP_READ : +break ;case REQ_OP_WRITE :if (bio->bi_opf &REQ_ATOMIC ) { status =blk_validate_atomic_write_op_size (q, bio);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 209/695 scsi: NCR5380: Check for phase match during PDMA fixup
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit 5768718da9417331803fc4bc090544c2a93b88dc ]
It's not an error for a target to change the bus phase during a transfer. Unfortunately, the FLAG_DMA_FIXUP workaround does not allow for that -- a phase change produces a DRQ timeout error and the device borken flag will be set.
Check the phase match bit during FLAG_DMA_FIXUP processing. Don't forget to decrement the command residual. While we are here, change shost_printk() into scmd_printk() for better consistency with other DMA error messages.
--- drivers/scsi/NCR5380.c | 78 +++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 39 deletions(-)
drivers/scsi/NCR5380.c +39 -39
@@ -1485,6 +1485,7 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance, unsigned char **data) {struct NCR5380_hostdata *hostdata =shost_priv (instance); +struct NCR5380_cmd *ncmd =NCR5380_to_ncmd (hostdata->connected);int c = *count;unsigned char p = *phase;unsigned char *d = *data;
@@ -1496,7 +1497,7 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance,return -1 ; } -NCR5380_to_ncmd (hostdata->connected)->phase = p; + ncmd->phase = p;if (p &SR_IO ) {if (hostdata->read_overruns)
@@ -1608,45 +1609,44 @@ static int NCR5380_transfer_dma(struct Scsi_Host *instance,* request. */ -if (hostdata->flags &FLAG_DMA_FIXUP ) { -if (p &SR_IO ) { -/* -* The workaround was to transfer fewer bytes than we -* intended to with the pseudo-DMA read function, wait for -* the chip to latch the last byte, read it, and then disable -* pseudo-DMA mode. -* -* After REQ is asserted, the NCR5380 asserts DRQ and ACK. -* REQ is deasserted when ACK is asserted, and not reasserted -* until ACK goes false. Since the NCR5380 won't lower ACK -* until DACK is asserted, which won't happen unless we twiddle -* the DMA port or we take the NCR5380 out of DMA mode, we -* can guarantee that we won't handshake another extra -* byte. -*/ - -if (NCR5380_poll_politely (hostdata,BUS_AND_STATUS_REG , -BASR_DRQ ,BASR_DRQ ,0 ) <0 ) { - result =-1 ; -shost_printk (KERN_ERR , instance,"PDMA read: DRQ timeout\n" ); - } -if (NCR5380_poll_politely (hostdata,STATUS_REG , -SR_REQ ,0 ,0 ) <0 ) { - result =-1 ; -shost_printk (KERN_ERR , instance,"PDMA read: !REQ timeout\n" ); - } - d[*count -1 ] =NCR5380_read (INPUT_DATA_REG ); - }else { -/* -* Wait for the last byte to be sent. If REQ is being asserted for -* the byte we're interested, we'll ACK it and it will go false. -*/ -if (NCR5380_poll_politely2 (hostdata, -BUS_AND_STATUS_REG ,BASR_DRQ ,BASR_DRQ , -BUS_AND_STATUS_REG ,BASR_PHASE_MATCH ,0 ,0 ) <0 ) { - result =-1 ; -shost_printk (KERN_ERR , instance,"PDMA write: DRQ and phase timeout\n" ); +if ((hostdata->flags &FLAG_DMA_FIXUP ) && + (NCR5380_read (BUS_AND_STATUS_REG ) &BASR_PHASE_MATCH )) { +/* +* The workaround was to transfer fewer bytes than we +* intended to with the pseudo-DMA receive function, wait for +* the chip to latch the last byte, read it, and then disable +* DMA mode. +* +* After REQ is asserted, the NCR5380 asserts DRQ and ACK. +* REQ is deasserted when ACK is asserted, and not reasserted +* until ACK goes false. Since the NCR5380 won't lower ACK +* until DACK is asserted, which won't happen unless we twiddle +* the DMA port or we take the NCR5380 out of DMA mode, we +* can guarantee that we won't handshake another extra +* byte. +* +* If sending, wait for the last byte to be sent. If REQ is +* being asserted for the byte we're interested, we'll ACK it +* and it will go false. +*/ +if (!NCR5380_poll_politely (hostdata,BUS_AND_STATUS_REG , +BASR_DRQ ,BASR_DRQ ,0 )) { +if ((p &SR_IO ) && + (NCR5380_read (BUS_AND_STATUS_REG ) &BASR_PHASE_MATCH )) { +if (!NCR5380_poll_politely (hostdata,STATUS_REG , +SR_REQ ,0 ,0 )) { + d[c] =NCR5380_read (INPUT_DATA_REG ); + --ncmd->this_residual; + }else { + result =-1 ; +scmd_printk (KERN_ERR , hostdata->connected, +"PDMA fixup: !REQ timeout\n" ); + } } + }else if (NCR5380_read (BUS_AND_STATUS_REG ) &BASR_PHASE_MATCH ) { + result =-1 ; +scmd_printk (KERN_ERR , hostdata->connected, +"PDMA fixup: DRQ timeout\n" ); } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 210/695 drm/amd/amdgpu: Properly tune the size of struct
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: WangYuli <[email protected]>
[ Upstream commit 0cee47cde41e22712c034ae961076067d4ac13a0 ]
The struct assertion is failed because sparse cannot parse #pragma pack(push, 1) and #pragma pack(pop) correctly. GCC's output is still 1-byte-aligned. No harm to memory layout.
The error can be filtered out by sparse-diff, but sometimes multiple lines queezed into one, making the sparse-diff thinks its a new error. I'm trying to aviod this by fixing errors.
--- drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h +2 -2
@@ -213,7 +213,7 @@ struct amd_sriov_msg_pf2vf_info {uint32_t gpu_capacity;/* reserved */ uint32_t reserved[256 -AMD_SRIOV_MSG_PF2VF_INFO_FILLED_SIZE ]; -}; +} __packed;struct amd_sriov_msg_vf2pf_info_header {/* the total structure size in byte */
@@ -273,7 +273,7 @@ struct amd_sriov_msg_vf2pf_info {uint32_t mes_info_size;/* reserved */ uint32_t reserved[256 -AMD_SRIOV_MSG_VF2PF_INFO_FILLED_SIZE ]; -}; +} __packed;/* mailbox message send from guest to host */ enum amd_sriov_mailbox_request_message {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 211/695 drm/amd/display: Improve FAM control for DCN401
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rodrigo Siqueira <[email protected]>
[ Upstream commit 17b6527dcfb3249401e037734ed3fd0f4752572f ]
[why & how]
When the commit 5324e2b205a2 ("drm/amd/display: Add driver support for future FAMS versions") was introduced, it missed some of the FAM2 code. This commit introduces the code that control the FAM enable and disable.
--- .../gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c +12 -1
@@ -982,8 +982,19 @@ void dcn32_init_hw(struct dc *dc) dc->caps.dmub_caps.gecc_enable = dc->ctx->dmub_srv->dmub->feature_caps.gecc_enable; dc->caps.dmub_caps.mclk_sw = dc->ctx->dmub_srv->dmub->feature_caps.fw_assisted_mclk_switch_ver; -if (dc->ctx->dmub_srv->dmub->fw_version < +/* for DCN401 testing only */ + dc->caps.dmub_caps.fams_ver = dc->ctx->dmub_srv->dmub->feature_caps.fw_assisted_mclk_switch_ver; +if (dc->caps.dmub_caps.fams_ver ==2 ) { +/* FAMS2 is enabled */ + dc->debug.fams2_config.bits.enable &= true; + }else if (dc->ctx->dmub_srv->dmub->fw_version <DMUB_FW_VERSION (7 ,0 ,35 )) { +/* FAMS2 is disabled */ + dc->debug.fams2_config.bits.enable = false; +if (dc->debug.using_dml2 && dc->res_pool->funcs->update_bw_bounding_box) { +/* update bounding box if FAMS2 disabled */ + dc->res_pool->funcs->update_bw_bounding_box (dc, dc->clk_mgr->bw_params); + } dc->debug.force_disable_subvp = true; dc->debug.disable_fpo_optimizations = true; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 212/695 drm/rockchip: vop: Allow 4096px width scaling
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Bee <[email protected]>
[ Upstream commit 0ef968d91a20b5da581839f093f98f7a03a804f7 ]
There is no reason to limit VOP scaling to 3840px width, the limit of RK3288, when there are newer VOP versions that support 4096px width.
Change to enforce a maximum of 4096px width plane scaling, the maximum supported output width of the VOP versions supported by this driver.
--- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/rockchip/rockchip_drm_vop.c +2 -2
@@ -396,8 +396,8 @@ static void scl_vop_cal_scl_fac(struct vop *vop, const struct vop_win_data *win,if (info->is_yuv) is_yuv = true; -if (dst_w >3840 ) { -DRM_DEV_ERROR (vop->dev,"Maximum dst width (3840) exceeded\n" ); +if (dst_w >4096 ) { +DRM_DEV_ERROR (vop->dev,"Maximum dst width (4096) exceeded\n" );return ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 213/695 drm/rockchip: dw_hdmi: Fix reading EDID when using a forced mode
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonas Karlman <[email protected]>
[ Upstream commit a5d024541ec466f428e6c514577d511a40779c7b ]
EDID cannot be read on RK3328 until after read_hpd has been called and correct io voltage has been configured based on connection status.
When a forced mode is used, e.g. video=1920x1080@60e, the connector detect ops, that in turn normally calls the read_hpd, never gets called.
This result in reading EDID to fail in connector get_modes ops.
Call dw_hdmi_rk3328_read_hpd at end of dw_hdmi_rk3328_setup_hpd to correct io voltage and allow reading EDID after setup_hpd.
--- drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +2 -0
@@ -434,6 +434,8 @@ static void dw_hdmi_rk3328_setup_hpd(struct dw_hdmi *dw_hdmi, void *data)HIWORD_UPDATE (RK3328_HDMI_SDAIN_MSK |RK3328_HDMI_SCLIN_MSK ,RK3328_HDMI_SDAIN_MSK |RK3328_HDMI_SCLIN_MSK | RK3328_HDMI_HPD_IOE)); + +dw_hdmi_rk3328_read_hpd (dw_hdmi, data); }static const struct dw_hdmi_phy_ops rk3228_hdmi_phy_ops = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 214/695 drm/radeon/evergreen_cs: fix int overflow errors in cs track offsets
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikita Zhandarovich <[email protected]>
[ Upstream commit 3fbaf475a5b8361ebee7da18964db809e37518b7 ]
Several cs track offsets (such as 'track->db_s_read_offset') either are initialized with or plainly take big enough values that, once shifted 8 bits left, may be hit with integer overflow if the resulting values end up going over u32 limit.
Same goes for a few instances of 'surf.layer_size * mslice' multiplications that are added to 'offset' variable - they may potentially overflow as well and need to be validated properly.
While some debug prints in this code section take possible overflow issues into account, simply casting to (unsigned long) may be erroneous in its own way, as depending on CPU architecture one is liable to get different results.
Fix said problems by:
- casting 'offset' to fixed u64 data type instead of ambiguous unsigned long.
- casting one of the operands in vulnerable to integer overflow cases to u64.
- adjust format specifiers in debug prints to properly represent 'offset' values.
Found by Linux Verification Center (linuxtesting.org) with static analysis tool SVACE.
--- drivers/gpu/drm/radeon/evergreen_cs.c | 62 +++++++++++++-------------- 1 file changed, 31 insertions(+), 31 deletions(-)
drivers/gpu/drm/radeon/evergreen_cs.c +31 -31
@@ -397,7 +397,7 @@ static int evergreen_cs_track_validate_cb(struct radeon_cs_parser *p, unsigned istruct evergreen_cs_track *track = p->track;struct eg_surface surf;unsigned pitch, slice, mslice; -unsigned long offset; +u64 offset;int r; mslice =G_028C6C_SLICE_MAX (track->cb_color_view[id]) +1 ;
@@ -435,14 +435,14 @@ static int evergreen_cs_track_validate_cb(struct radeon_cs_parser *p, unsigned ireturn r; } - offset = track->cb_color_bo_offset[id] <<8 ; + offset = (u64 )track->cb_color_bo_offset[id] <<8 ;if (offset & (surf.base_align -1 )) { -dev_warn (p->dev,"%s:%d cb[%d] bo base %ld not aligned with %ld\n" , +dev_warn (p->dev,"%s:%d cb[%d] bo base %llu not aligned with %ld\n" , __func__, __LINE__, id, offset, surf.base_align);return -EINVAL ; } - offset += surf.layer_size * mslice; + offset += (u64 )surf.layer_size * mslice;if (offset >radeon_bo_size (track->cb_color_bo[id])) {/* old ddx are broken they allocate bo with w*h*bpp but * program slice with ALIGN(h, 8), catch this and patch
@@ -450,14 +450,14 @@ static int evergreen_cs_track_validate_cb(struct radeon_cs_parser *p, unsigned i*/ if (!surf.mode) {uint32_t *ib = p->ib.ptr; -unsigned long tmp, nby, bsize, size, min =0 ; +u64 tmp, nby, bsize, size, min =0 ;/* find the height the ddx wants */ if (surf.nby >8 ) { min = surf.nby -8 ; } bsize =radeon_bo_size (track->cb_color_bo[id]); - tmp = track->cb_color_bo_offset[id] <<8 ; + tmp = (u64 )track->cb_color_bo_offset[id] <<8 ;for (nby = surf.nby; nby > min; nby--) { size = nby * surf.nbx * surf.bpe * surf.nsamples;if ((tmp + size * mslice) <= bsize) {
@@ -469,7 +469,7 @@ static int evergreen_cs_track_validate_cb(struct radeon_cs_parser *p, unsigned i slice = ((nby * surf.nbx) /64 ) -1 ;if (!evergreen_surface_check (p, &surf,"cb" )) {/* check if this one works */ - tmp += surf.layer_size * mslice; + tmp += (u64 )surf.layer_size * mslice;if (tmp <= bsize) { ib[track->cb_color_slice_idx[id]] = slice; goto old_ddx_ok;
@@ -478,9 +478,9 @@ static int evergreen_cs_track_validate_cb(struct radeon_cs_parser *p, unsigned i } }dev_warn (p->dev,"%s:%d cb[%d] bo too small (layer size %d, " -"offset %d, max layer %d, bo size %ld, slice %d)\n" , +"offset %llu, max layer %d, bo size %ld, slice %d)\n" , __func__, __LINE__, id, surf.layer_size, - track->cb_color_bo_offset[id] <<8 , mslice, + (u64 )track->cb_color_bo_offset[id] <<8 , mslice,radeon_bo_size (track->cb_color_bo[id]), slice); dev_warn(p->dev, "%s:%d problematic surf: (%d %d) (%d %d %d %d %d %d %d)\n", __func__, __LINE__, surf.nbx, surf.nby,
@@ -564,7 +564,7 @@ static int evergreen_cs_track_validate_stencil(struct radeon_cs_parser *p)struct evergreen_cs_track *track = p->track;struct eg_surface surf;unsigned pitch, slice, mslice; -unsigned long offset; +u64 offset;int r; mslice =G_028008_SLICE_MAX (track->db_depth_view) +1 ;
@@ -610,18 +610,18 @@ static int evergreen_cs_track_validate_stencil(struct radeon_cs_parser *p)return r; } - offset = track->db_s_read_offset <<8 ; + offset = (u64 )track->db_s_read_offset <<8 ;if (offset & (surf.base_align -1 )) { -dev_warn (p->dev,"%s:%d stencil read bo base %ld not aligned with %ld\n" , +dev_warn (p->dev,"%s:%d stencil read bo base %llu not aligned with %ld\n" , __func__, __LINE__, offset, surf.base_align);return -EINVAL ; } - offset += surf.layer_size * mslice; + offset += (u64 )surf.layer_size * mslice;if (offset >radeon_bo_size (track->db_s_read_bo)) {dev_warn (p->dev,"%s:%d stencil read bo too small (layer size %d, " -"offset %ld, max layer %d, bo size %ld)\n" , +"offset %llu, max layer %d, bo size %ld)\n" , __func__, __LINE__, surf.layer_size, - (unsigned long )track->db_s_read_offset <<8 , mslice, + (u64 )track->db_s_read_offset <<8 , mslice,radeon_bo_size (track->db_s_read_bo)); dev_warn(p->dev, "%s:%d stencil invalid (0x%08x 0x%08x 0x%08x 0x%08x)\n", __func__, __LINE__, track->db_depth_size,
@@ -629,18 +629,18 @@ static int evergreen_cs_track_validate_stencil(struct radeon_cs_parser *p)return -EINVAL ; } - offset = track->db_s_write_offset <<8 ; + offset = (u64 )track->db_s_write_offset <<8 ;if (offset & (surf.base_align -1 )) { -dev_warn (p->dev,"%s:%d stencil write bo base %ld not aligned with %ld\n" , +dev_warn (p->dev,"%s:%d stencil write bo base %llu not aligned with %ld\n" , __func__, __LINE__, offset, surf.base_align);return -EINVAL ; } - offset += surf.layer_size * mslice; + offset += (u64 )surf.layer_size * mslice;if (offset >radeon_bo_size (track->db_s_write_bo)) {dev_warn (p->dev,"%s:%d stencil write bo too small (layer size %d, " -"offset %ld, max layer %d, bo size %ld)\n" , +"offset %llu, max layer %d, bo size %ld)\n" , __func__, __LINE__, surf.layer_size, - (unsigned long )track->db_s_write_offset <<8 , mslice, + (u64 )track->db_s_write_offset <<8 , mslice,radeon_bo_size (track->db_s_write_bo));return -EINVAL ; }
@@ -661,7 +661,7 @@ static int evergreen_cs_track_validate_depth(struct radeon_cs_parser *p)struct evergreen_cs_track *track = p->track;struct eg_surface surf;unsigned pitch, slice, mslice; -unsigned long offset; +u64 offset;int r; mslice =G_028008_SLICE_MAX (track->db_depth_view) +1 ;
@@ -708,34 +708,34 @@ static int evergreen_cs_track_validate_depth(struct radeon_cs_parser *p)return r; } - offset = track->db_z_read_offset <<8 ; + offset = (u64 )track->db_z_read_offset <<8 ;if (offset & (surf.base_align -1 )) { -dev_warn (p->dev,"%s:%d stencil read bo base %ld not aligned with %ld\n" , +dev_warn (p->dev,"%s:%d stencil read bo base %llu not aligned with %ld\n" , __func__, __LINE__, offset, surf.base_align);return -EINVAL ; } - offset += surf.layer_size * mslice; + offset += (u64 )surf.layer_size * mslice;if (offset >radeon_bo_size (track->db_z_read_bo)) {dev_warn (p->dev,"%s:%d depth read bo too small (layer size %d, " -"offset %ld, max layer %d, bo size %ld)\n" , +"offset %llu, max layer %d, bo size %ld)\n" , __func__, __LINE__, surf.layer_size, - (unsigned long )track->db_z_read_offset <<8 , mslice, + (u64 )track->db_z_read_offset <<8 , mslice,radeon_bo_size (track->db_z_read_bo));return -EINVAL ; } - offset = track->db_z_write_offset <<8 ; + offset = (u64 )track->db_z_write_offset <<8 ;if (offset & (surf.base_align -1 )) { -dev_warn (p->dev,"%s:%d stencil write bo base %ld not aligned with %ld\n" , +dev_warn (p->dev,"%s:%d stencil write bo base %llu not aligned with %ld\n" , __func__, __LINE__, offset, surf.base_align);return -EINVAL ; } - offset += surf.layer_size * mslice; + offset += (u64 )surf.layer_size * mslice;if (offset >radeon_bo_size (track->db_z_write_bo)) {dev_warn (p->dev,"%s:%d depth write bo too small (layer size %d, " -"offset %ld, max layer %d, bo size %ld)\n" , +"offset %llu, max layer %d, bo size %ld)\n" , __func__, __LINE__, surf.layer_size, - (unsigned long )track->db_z_write_offset <<8 , mslice, + (u64 )track->db_z_write_offset <<8 , mslice,radeon_bo_size (track->db_z_write_bo));return -EINVAL ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 215/695 drm/xe: Move and export xe_hw_engine lookup.
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dominik Grzegorzek <[email protected]>
[ Upstream commit 6f20fc09936e786a4ba18f5514fe185e0451ada9 ]
Move and export xe_hw_engine lookup. This is in preparation to use this in eudebug code where we want to find active engine.
v2: s/tile/gt due to uapi changes (Mika)
Stable-dep-of: 852856e3b6f6 ("drm/xe: Use reserved copy engine for user binds on faulting devices")
--- drivers/gpu/drm/xe/xe_exec_queue.c | 37 ++++-------------------------- drivers/gpu/drm/xe/xe_hw_engine.c | 31 +++++++++++++++++++++++++ drivers/gpu/drm/xe/xe_hw_engine.h | 7 ++++++ 3 files changed, 42 insertions(+), 33 deletions(-)
drivers/gpu/drm/xe/xe_exec_queue.c +4 -33
@@ -418,34 +418,6 @@ static int exec_queue_user_extensions(struct xe_device *xe, struct xe_exec_queuereturn 0 ; } -static const enum xe_engine_class user_to_xe_engine_class[] = { - [DRM_XE_ENGINE_CLASS_RENDER ] =XE_ENGINE_CLASS_RENDER , - [DRM_XE_ENGINE_CLASS_COPY ] =XE_ENGINE_CLASS_COPY , - [DRM_XE_ENGINE_CLASS_VIDEO_DECODE ] =XE_ENGINE_CLASS_VIDEO_DECODE , - [DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE ] =XE_ENGINE_CLASS_VIDEO_ENHANCE , - [DRM_XE_ENGINE_CLASS_COMPUTE ] =XE_ENGINE_CLASS_COMPUTE , -}; - -static struct xe_hw_engine * -find_hw_engine (struct xe_device *xe, -struct drm_xe_engine_class_instance eci) -{ -u32 idx; - -if (eci.engine_class >=ARRAY_SIZE (user_to_xe_engine_class)) -return NULL ; - -if (eci.gt_id >= xe->info.gt_count) -return NULL ; - - idx =array_index_nospec (eci.engine_class, -ARRAY_SIZE (user_to_xe_engine_class)); - -return xe_gt_hw_engine (xe_device_get_gt (xe, eci.gt_id), - user_to_xe_engine_class[idx], - eci.engine_instance, true); -} -static u32 bind_exec_queue_logical_mask (struct xe_device *xe,struct xe_gt *gt,struct drm_xe_engine_class_instance *eci,u16 width,u16 num_placements)
@@ -467,8 +439,7 @@ static u32 bind_exec_queue_logical_mask(struct xe_device *xe, struct xe_gt *gt,if (xe_hw_engine_is_reserved (hwe))continue ; -if (hwe->class == - user_to_xe_engine_class[DRM_XE_ENGINE_CLASS_COPY ]) +if (hwe->class ==XE_ENGINE_CLASS_COPY ) logical_mask |=BIT (hwe->logical_instance); }
@@ -497,7 +468,7 @@ static u32 calc_validate_logical_mask(struct xe_device *xe, struct xe_gt *gt, n = j * width + i; - hwe =find_hw_engine (xe, eci[n]); + hwe =xe_hw_engine_lookup (xe, eci[n]);if (XE_IOCTL_DBG (xe, !hwe))return 0 ;
@@ -576,7 +547,7 @@ int xe_exec_queue_create_ioctl(struct drm_device *dev, void *data,if (XE_IOCTL_DBG (xe, !logical_mask))return -EINVAL ; - hwe =find_hw_engine (xe, eci[0 ]); + hwe =xe_hw_engine_lookup (xe, eci[0 ]);if (XE_IOCTL_DBG (xe, !hwe))return -EINVAL ;
@@ -613,7 +584,7 @@ int xe_exec_queue_create_ioctl(struct drm_device *dev, void *data,if (XE_IOCTL_DBG (xe, !logical_mask))return -EINVAL ; - hwe =find_hw_engine (xe, eci[0 ]); + hwe =xe_hw_engine_lookup (xe, eci[0 ]);if (XE_IOCTL_DBG (xe, !hwe))return -EINVAL ;
drivers/gpu/drm/xe/xe_hw_engine.c +31 -0
@@ -5,7 +5,10 @@#include "xe_hw_engine.h" +#include <linux/nospec.h> +#include <drm/drm_managed.h> +#include <drm/xe_drm.h> #include "regs/xe_engine_regs.h" #include "regs/xe_gt_regs.h"
@@ -1135,3 +1138,31 @@ enum xe_force_wake_domains xe_hw_engine_to_fw_domain(struct xe_hw_engine *hwe) {return engine_infos[hwe->engine_id].domain; } + +static const enum xe_engine_class user_to_xe_engine_class[] = { + [DRM_XE_ENGINE_CLASS_RENDER ] =XE_ENGINE_CLASS_RENDER , + [DRM_XE_ENGINE_CLASS_COPY ] =XE_ENGINE_CLASS_COPY , + [DRM_XE_ENGINE_CLASS_VIDEO_DECODE ] =XE_ENGINE_CLASS_VIDEO_DECODE , + [DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE ] =XE_ENGINE_CLASS_VIDEO_ENHANCE , + [DRM_XE_ENGINE_CLASS_COMPUTE ] =XE_ENGINE_CLASS_COMPUTE , +}; + +struct xe_hw_engine * +xe_hw_engine_lookup (struct xe_device *xe, +struct drm_xe_engine_class_instance eci) +{ +unsigned int idx; + +if (eci.engine_class >ARRAY_SIZE (user_to_xe_engine_class)) +return NULL ; + +if (eci.gt_id >= xe->info.gt_count) +return NULL ; + + idx =array_index_nospec (eci.engine_class, +ARRAY_SIZE (user_to_xe_engine_class)); + +return xe_gt_hw_engine (xe_device_get_gt (xe, eci.gt_id), + user_to_xe_engine_class[idx], + eci.engine_instance, true); +}
drivers/gpu/drm/xe/xe_hw_engine.h +7 -0
@@ -9,6 +9,8 @@#include "xe_hw_engine_types.h" struct drm_printer ; +struct drm_xe_engine_class_instance ; +struct xe_device ;#ifdef CONFIG_DRM_XE_JOB_TIMEOUT_MIN #define XE_HW_ENGINE_JOB_TIMEOUT_MIN CONFIG_DRM_XE_JOB_TIMEOUT_MIN
@@ -62,6 +64,11 @@ void xe_hw_engine_print(struct xe_hw_engine *hwe, struct drm_printer *p);void xe_hw_engine_setup_default_lrc_state (struct xe_hw_engine *hwe);bool xe_hw_engine_is_reserved (struct xe_hw_engine *hwe); + +struct xe_hw_engine * +xe_hw_engine_lookup (struct xe_device *xe, +struct drm_xe_engine_class_instance eci); +static inline bool xe_hw_engine_is_valid (struct xe_hw_engine *hwe) {return hwe->name;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 216/695 drm/xe: Use reserved copy engine for user binds on faulting devices
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Brost <[email protected]>
[ Upstream commit 852856e3b6f679c694dd5ec41e5a3c11aa46640b ]
User binds map to engines with can fault, faults depend on user binds completion, thus we can deadlock. Avoid this by using reserved copy engine for user binds on faulting devices.
While we are here, normalize bind queue creation with a helper.
v2:
- Pass in extensions to bind queue creation (CI)
v3:
- s/resevered/reserved (Lucas)
- Fix NULL hwe check (Jonathan)
--- drivers/gpu/drm/xe/xe_exec_queue.c | 122 +++++++++++++++-------------- drivers/gpu/drm/xe/xe_exec_queue.h | 6 +- drivers/gpu/drm/xe/xe_migrate.c | 2 +- drivers/gpu/drm/xe/xe_vm.c | 8 +- 4 files changed, 70 insertions(+), 68 deletions(-)
drivers/gpu/drm/xe/xe_exec_queue.c +63 -59
@@ -166,7 +166,8 @@ struct xe_exec_queue *xe_exec_queue_create(struct xe_device *xe, struct xe_vm *vstruct xe_exec_queue *xe_exec_queue_create_class (struct xe_device *xe,struct xe_gt *gt,struct xe_vm *vm, -enum xe_engine_class class,u32 flags) +enum xe_engine_class class, +u32 flags,u64 extensions) {struct xe_hw_engine *hwe, *hwe0 =NULL ;enum xe_hw_engine_id id;
@@ -186,7 +187,54 @@ struct xe_exec_queue *xe_exec_queue_create_class(struct xe_device *xe, struct xeif (!logical_mask)return ERR_PTR (-ENODEV ); -return xe_exec_queue_create (xe, vm, logical_mask,1 , hwe0, flags,0 ); +return xe_exec_queue_create (xe, vm, logical_mask,1 , hwe0, flags, extensions); +} + +/** +* xe_exec_queue_create_bind() - Create bind exec queue. +* @xe: Xe device. +* @tile: tile which bind exec queue belongs to. +* @flags: exec queue creation flags +* @extensions: exec queue creation extensions +* +* Normalize bind exec queue creation. Bind exec queue is tied to migration VM +* for access to physical memory required for page table programming. On a +* faulting devices the reserved copy engine instance must be used to avoid +* deadlocking (user binds cannot get stuck behind faults as kernel binds which +* resolve faults depend on user binds). On non-faulting devices any copy engine +* can be used. +* +* Returns exec queue on success, ERR_PTR on failure +*/ +struct xe_exec_queue *xe_exec_queue_create_bind (struct xe_device *xe, +struct xe_tile *tile, +u32 flags,u64 extensions) +{ +struct xe_gt *gt = tile->primary_gt; +struct xe_exec_queue *q; +struct xe_vm *migrate_vm; + + migrate_vm =xe_migrate_get_vm (tile->migrate); +if (xe->info.has_usm) { +struct xe_hw_engine *hwe =xe_gt_hw_engine (gt, +XE_ENGINE_CLASS_COPY , + gt->usm.reserved_bcs_instance, + false); + +if (!hwe) +return ERR_PTR (-EINVAL ); + + q =xe_exec_queue_create (xe, migrate_vm, +BIT (hwe->logical_instance),1 , hwe, + flags, extensions); + }else { + q =xe_exec_queue_create_class (xe, gt, migrate_vm, +XE_ENGINE_CLASS_COPY , flags, + extensions); + } +xe_vm_put (migrate_vm); + +return q; }void xe_exec_queue_destroy (struct kref *ref)
@@ -418,34 +466,6 @@ static int exec_queue_user_extensions(struct xe_device *xe, struct xe_exec_queuereturn 0 ; } -static u32 bind_exec_queue_logical_mask (struct xe_device *xe,struct xe_gt *gt, -struct drm_xe_engine_class_instance *eci, -u16 width,u16 num_placements) -{ -struct xe_hw_engine *hwe; -enum xe_hw_engine_id id; -u32 logical_mask =0 ; - -if (XE_IOCTL_DBG (xe, width !=1 )) -return 0 ; -if (XE_IOCTL_DBG (xe, num_placements !=1 )) -return 0 ; -if (XE_IOCTL_DBG (xe, eci[0 ].engine_instance !=0 )) -return 0 ; - - eci[0 ].engine_class =DRM_XE_ENGINE_CLASS_COPY ; - -for_each_hw_engine (hwe, gt, id) { -if (xe_hw_engine_is_reserved (hwe)) -continue ; - -if (hwe->class ==XE_ENGINE_CLASS_COPY ) - logical_mask |=BIT (hwe->logical_instance); - } - -return logical_mask; -} -static u32 calc_validate_logical_mask (struct xe_device *xe,struct xe_gt *gt,struct drm_xe_engine_class_instance *eci,u16 width,u16 num_placements)
@@ -507,8 +527,9 @@ int xe_exec_queue_create_ioctl(struct drm_device *dev, void *data,struct drm_xe_engine_class_instance __user *user_eci =u64_to_user_ptr (args->instances);struct xe_hw_engine *hwe; -struct xe_vm *vm, *migrate_vm; +struct xe_vm *vm;struct xe_gt *gt; +struct xe_tile *tile;struct xe_exec_queue *q =NULL ;u32 logical_mask;u32 id;
@@ -533,37 +554,20 @@ int xe_exec_queue_create_ioctl(struct drm_device *dev, void *data,return -EINVAL ;if (eci[0 ].engine_class ==DRM_XE_ENGINE_CLASS_VM_BIND ) { -for_each_gt (gt, xe, id) { -struct xe_exec_queue *new; -u32 flags; - -if (xe_gt_is_media_type (gt)) -continue ; - - eci[0 ].gt_id = gt->info.id; - logical_mask =bind_exec_queue_logical_mask (xe, gt, eci, - args->width, - args->num_placements); -if (XE_IOCTL_DBG (xe, !logical_mask)) -return -EINVAL ; - - hwe =xe_hw_engine_lookup (xe, eci[0 ]); -if (XE_IOCTL_DBG (xe, !hwe)) -return -EINVAL ; - -/* The migration vm doesn't hold rpm ref */ -xe_pm_runtime_get_noresume (xe); - - flags =EXEC_QUEUE_FLAG_VM | (id ?EXEC_QUEUE_FLAG_BIND_ENGINE_CHILD :0 ); +if (XE_IOCTL_DBG (xe, args->width !=1 ) || +XE_IOCTL_DBG (xe, args->num_placements !=1 ) || +XE_IOCTL_DBG (xe, eci[0 ].engine_instance !=0 )) +return -EINVAL ; - migrate_vm =xe_migrate_get_vm (gt_to_tile (gt)->migrate); - new =xe_exec_queue_create (xe, migrate_vm, logical_mask, - args->width, hwe, flags, - args->extensions); +for_each_tile (tile, xe, id) { +struct xe_exec_queue *new; +u32 flags =EXEC_QUEUE_FLAG_VM ; -xe_pm_runtime_put (xe);/* now held by engine */ +if (id) + flags |=EXEC_QUEUE_FLAG_BIND_ENGINE_CHILD ; -xe_vm_put (migrate_vm); + new =xe_exec_queue_create_bind (xe, tile, flags, + args->extensions);if (IS_ERR (new)) { err =PTR_ERR (new);if (q)
drivers/gpu/drm/xe/xe_exec_queue.h +5 -1
@@ -20,7 +20,11 @@ struct xe_exec_queue *xe_exec_queue_create(struct xe_device *xe, struct xe_vm *v u64 extensions);struct xe_exec_queue *xe_exec_queue_create_class (struct xe_device *xe,struct xe_gt *gt,struct xe_vm *vm, -enum xe_engine_class class,u32 flags); +enum xe_engine_class class, +u32 flags,u64 extensions); +struct xe_exec_queue *xe_exec_queue_create_bind (struct xe_device *xe, +struct xe_tile *tile, +u32 flags,u64 extensions);void xe_exec_queue_fini (struct xe_exec_queue *q);void xe_exec_queue_destroy (struct kref *ref);
drivers/gpu/drm/xe/xe_migrate.c +1 -1
@@ -404,7 +404,7 @@ struct xe_migrate *xe_migrate_init(struct xe_tile *tile) m->q =xe_exec_queue_create_class (xe, primary_gt, vm,XE_ENGINE_CLASS_COPY ,EXEC_QUEUE_FLAG_KERNEL | -EXEC_QUEUE_FLAG_PERMANENT ); +EXEC_QUEUE_FLAG_PERMANENT ,0 ); }if (IS_ERR (m->q)) {xe_vm_close_and_put (vm);
drivers/gpu/drm/xe/xe_vm.c +1 -7
@@ -1412,19 +1412,13 @@ struct xe_vm *xe_vm_create(struct xe_device *xe, u32 flags)/* Kernel migration VM shouldn't have a circular loop.. */ if (!(flags &XE_VM_FLAG_MIGRATION )) {for_each_tile (tile, xe, id) { -struct xe_gt *gt = tile->primary_gt; -struct xe_vm *migrate_vm;struct xe_exec_queue *q;u32 create_flags =EXEC_QUEUE_FLAG_VM ;if (!vm->pt_root[id])continue ; - migrate_vm =xe_migrate_get_vm (tile->migrate); - q =xe_exec_queue_create_class (xe, gt, migrate_vm, -XE_ENGINE_CLASS_COPY , - create_flags); -xe_vm_put (migrate_vm); + q =xe_exec_queue_create_bind (xe, tile, create_flags,0 );if (IS_ERR (q)) { err =PTR_ERR (q); goto err_close;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 217/695 drm/bridge: lontium-lt8912b: Validate mode in drm_bridge_funcs::mode_valid()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liu Ying <[email protected]>
[ Upstream commit fe828fbd87786238b30f44cafd698d975d956c97 ]
If the bridge is attached with the DRM_BRIDGE_ATTACH_NO_CONNECTOR flag set, this driver won't initialize a connector and hence display mode won't be validated in drm_connector_helper_funcs::mode_valid(). So, move the mode validation from drm_connector_helper_funcs::mode_valid() to drm_bridge_funcs::mode_valid(), because the mode validation is always done for the bridge.
--- drivers/gpu/drm/bridge/lontium-lt8912b.c | 35 ++++++++++++------------ 1 file changed, 18 insertions(+), 17 deletions(-)
drivers/gpu/drm/bridge/lontium-lt8912b.c +18 -17
@@ -422,22 +422,6 @@ static const struct drm_connector_funcs lt8912_connector_funcs = { .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; -static enum drm_mode_status -lt8912_connector_mode_valid (struct drm_connector *connector, -struct drm_display_mode *mode) -{ -if (mode->clock >150000 ) -return MODE_CLOCK_HIGH ; - -if (mode->hdisplay >1920 ) -return MODE_BAD_HVALUE ; - -if (mode->vdisplay >1080 ) -return MODE_BAD_VVALUE ; - -return MODE_OK ; -} -static int lt8912_connector_get_modes (struct drm_connector *connector) {const struct drm_edid *drm_edid;
@@ -463,7 +447,6 @@ static int lt8912_connector_get_modes(struct drm_connector *connector)static const struct drm_connector_helper_funcs lt8912_connector_helper_funcs = { .get_modes = lt8912_connector_get_modes, - .mode_valid = lt8912_connector_mode_valid, }; static void lt8912_bridge_mode_set(struct drm_bridge *bridge,
@@ -605,6 +588,23 @@ static void lt8912_bridge_detach(struct drm_bridge *bridge)drm_bridge_hpd_disable (lt->hdmi_port); } +static enum drm_mode_status +lt8912_bridge_mode_valid (struct drm_bridge *bridge, +const struct drm_display_info *info, +const struct drm_display_mode *mode) +{ +if (mode->clock >150000 ) +return MODE_CLOCK_HIGH ; + +if (mode->hdisplay >1920 ) +return MODE_BAD_HVALUE ; + +if (mode->vdisplay >1080 ) +return MODE_BAD_VVALUE ; + +return MODE_OK ; +} +static enum drm_connector_status lt8912_bridge_detect (struct drm_bridge *bridge) {
@@ -635,6 +635,7 @@ static const struct drm_edid *lt8912_bridge_edid_read(struct drm_bridge *bridge,static const struct drm_bridge_funcs lt8912_bridge_funcs = { .attach = lt8912_bridge_attach, .detach = lt8912_bridge_detach, + .mode_valid = lt8912_bridge_mode_valid, .mode_set = lt8912_bridge_mode_set, .enable = lt8912_bridge_enable, .detect = lt8912_bridge_detect,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 218/695 drm/vc4: hdmi: Handle error case of pm_runtime_resume_and_get
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Wahren <[email protected]>
[ Upstream commit f1a54e860b1bc8d824925b5a77f510913880e8d6 ]
The commit 0f5251339eda ("drm/vc4: hdmi: Make sure the controller is powered in detect") introduced the necessary power management handling to avoid register access while controller is powered down. Unfortunately it just print a warning if pm_runtime_resume_and_get() fails and proceed anyway.
This could happen during suspend to idle. So we must assume it is unsafe to access the HDMI register. So bail out properly.
--- drivers/gpu/drm/vc4/vc4_hdmi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/vc4/vc4_hdmi.c +7 -1
@@ -429,6 +429,7 @@ static int vc4_hdmi_connector_detect_ctx(struct drm_connector *connector, {struct vc4_hdmi *vc4_hdmi =connector_to_vc4_hdmi (connector);enum drm_connector_status status = connector_status_disconnected; +int ret;/* * NOTE: This function should really take vc4_hdmi->mutex, but
@@ -441,7 +442,12 @@ static int vc4_hdmi_connector_detect_ctx(struct drm_connector *connector,* the lock for now. */ -WARN_ON (pm_runtime_resume_and_get (&vc4_hdmi->pdev->dev)); + ret =pm_runtime_resume_and_get (&vc4_hdmi->pdev->dev); +if (ret) { +drm_err_once (connector->dev,"Failed to retain HDMI power domain: %d\n" , + ret); +return connector_status_unknown; + }if (vc4_hdmi->hpd_gpio) {if (gpiod_get_value_cansleep (vc4_hdmi->hpd_gpio))
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 219/695 scsi: elx: libefc: Fix potential use after free in efc_nport_vport_del()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 2e4b02fad094976763af08fec2c620f4f8edd9ae ]
The kref_put() function will call nport->release if the refcount drops to zero. The nport->release release function is _efc_nport_free() which frees "nport". But then we dereference "nport" on the next line which is a use after free. Re-order these lines to avoid the use after free.
--- drivers/scsi/elx/libefc/efc_nport.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/elx/libefc/efc_nport.c +1 -1
@@ -705,9 +705,9 @@ efc_nport_vport_del(struct efc *efc, struct efc_domain *domain,spin_lock_irqsave (&efc->lock, flags);list_for_each_entry (nport, &domain->nport_list, list_entry) {if (nport->wwpn == wwpn && nport->wwnn == wwnn) { -kref_put (&nport->ref, nport->release);/* Shutdown this NPORT */ efc_sm_post_event (&nport->sm,EFC_EVT_SHUTDOWN ,NULL ); +kref_put (&nport->ref, nport->release);break ; } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 220/695 jfs: fix out-of-bounds in dbNextAG() and diAlloc()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeongjun Park <[email protected]>
[ Upstream commit e63866a475562810500ea7f784099bfe341e761a ]
In dbNextAG() , there is no check for the case where bmp->db_numag is greater or same than MAXAG due to a polluted image, which causes an out-of-bounds. Therefore, a bounds check should be added in dbMount().
And in dbNextAG(), a check for the case where agpref is greater than bmp->db_numag should be added, so an out-of-bounds exception should be prevented.
Additionally, a check for the case where agno is greater or same than MAXAG should be added in diAlloc() to prevent out-of-bounds.
--- fs/jfs/jfs_dmap.c | 4 ++-- fs/jfs/jfs_imap.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
fs/jfs/jfs_dmap.c +2 -2
@@ -187,7 +187,7 @@ int dbMount(struct inode *ipbmap) } bmp->db_numag =le32_to_cpu (dbmp_le->dn_numag); -if (!bmp->db_numag) { +if (!bmp->db_numag || bmp->db_numag >=MAXAG ) { err = -EINVAL ; goto err_release_metapage; }
@@ -652,7 +652,7 @@ int dbNextAG(struct inode *ipbmap)* average free space. */ for (i =0 ; i < bmp->db_numag; i++, agpref++) { -if (agpref == bmp->db_numag) +if (agpref >= bmp->db_numag) agpref =0 ;if (atomic_read (&bmp->db_active[agpref]))
fs/jfs/jfs_imap.c +1 -1
@@ -1360,7 +1360,7 @@ int diAlloc(struct inode *pip, bool dir, struct inode *ip)/* get the ag number of this iag */ agno =BLKTOAG (JFS_IP (pip)->agstart,JFS_SBI (pip->i_sb)); dn_numag =JFS_SBI (pip->i_sb)->bmap->db_numag; -if (agno <0 || agno > dn_numag) +if (agno <0 || agno > dn_numag || agno >=MAXAG )return -EIO ;if (atomic_read (&JFS_SBI (pip->i_sb)->bmap->db_active[agno])) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 221/695 drm/mediatek: Fix missing configuration flags in mtk_crtc_ddp_config()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason-JH.Lin <[email protected]>
[ Upstream commit fe30bae552ce27b9fefe0b12db1544e73d07325f ]
In mtk_crtc_ddp_config(), mtk_crtc will use some configuration flags to generate instructions to cmdq_handle, such as:
state->pending_config
mtk_crtc->pending_planes
plane_state->pending.config
mtk_crtc->pending_async_planes plane_state->pending.async_config
These configuration flags may be set to false when a GCE IRQ comes calling ddp_cmdq_cb(). This may result in missing prepare instructions, especially if mtk_crtc_update_config() with the flase need_vblank (no need to wait for vblank) cases.
Therefore, the mtk_crtc->config_updating flag is set at the beginning of mtk_crtc_update_config() to ensure that these configuration flags won't be changed when the mtk_crtc_ddp_config() is preparing instructions. But somehow the ddp_cmdq_cb() didn't use the mtk_crtc->config_updating flag to prevent those pending config flags from being cleared.
To avoid missing the configuration when generating the config instruction, the config_updating flag should be added into ddp_cmdq_cb() and be protected with spin_lock.
--- drivers/gpu/drm/mediatek/mtk_crtc.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
drivers/gpu/drm/mediatek/mtk_crtc.c +27 -0
@@ -69,6 +69,8 @@ struct mtk_crtc {/* lock for display hardware access */ struct mutex hw_lock;bool config_updating; +/* lock for config_updating to cmd buffer */ +spinlock_t config_lock; };struct mtk_crtc_state {
@@ -106,11 +108,16 @@ static void mtk_crtc_finish_page_flip(struct mtk_crtc *mtk_crtc)static void mtk_drm_finish_page_flip (struct mtk_crtc *mtk_crtc) { +unsigned long flags; +drm_crtc_handle_vblank (&mtk_crtc->base); + +spin_lock_irqsave (&mtk_crtc->config_lock, flags);if (!mtk_crtc->config_updating && mtk_crtc->pending_needs_vblank) {mtk_crtc_finish_page_flip (mtk_crtc); mtk_crtc->pending_needs_vblank = false; } +spin_unlock_irqrestore (&mtk_crtc->config_lock, flags); }#if IS_REACHABLE (CONFIG_MTK_CMDQ )
@@ -308,12 +315,19 @@ static void ddp_cmdq_cb(struct mbox_client *cl, void *mssg) struct mtk_crtc *mtk_crtc = container_of(cmdq_cl, struct mtk_crtc, cmdq_client);struct mtk_crtc_state *state;unsigned int i; +unsigned long flags;if (data->sta <0 )return ; state =to_mtk_crtc_state (mtk_crtc->base.state); +spin_lock_irqsave (&mtk_crtc->config_lock, flags); +if (mtk_crtc->config_updating) { +spin_unlock_irqrestore (&mtk_crtc->config_lock, flags); + goto ddp_cmdq_cb_out; + } + state->pending_config = false;if (mtk_crtc->pending_planes) {
@@ -340,6 +354,10 @@ static void ddp_cmdq_cb(struct mbox_client *cl, void *mssg) mtk_crtc->pending_async_planes = false; } +spin_unlock_irqrestore (&mtk_crtc->config_lock, flags); + +ddp_cmdq_cb_out: + mtk_crtc->cmdq_vblank_cnt =0 ;wake_up (&mtk_crtc->cb_blocking_queue); }
@@ -569,9 +587,14 @@ static void mtk_crtc_update_config(struct mtk_crtc *mtk_crtc, bool needs_vblank)struct mtk_drm_private *priv = crtc->dev->dev_private;unsigned int pending_planes =0 , pending_async_planes =0 ;int i; +unsigned long flags;mutex_lock (&mtk_crtc->hw_lock); + +spin_lock_irqsave (&mtk_crtc->config_lock, flags); mtk_crtc->config_updating = true; +spin_unlock_irqrestore (&mtk_crtc->config_lock, flags); +if (needs_vblank) mtk_crtc->pending_needs_vblank = true;
@@ -625,7 +648,10 @@ static void mtk_crtc_update_config(struct mtk_crtc *mtk_crtc, bool needs_vblank) mbox_client_txdone(mtk_crtc->cmdq_client.chan, 0); }#endif +spin_lock_irqsave (&mtk_crtc->config_lock, flags); mtk_crtc->config_updating = false; +spin_unlock_irqrestore (&mtk_crtc->config_lock, flags); +mutex_unlock (&mtk_crtc->hw_lock); }
@@ -1068,6 +1094,7 @@ int mtk_crtc_create(struct drm_device *drm_dev, const unsigned int *path,drm_mode_crtc_set_gamma_size (&mtk_crtc->base, gamma_lut_size);drm_crtc_enable_color_mgmt (&mtk_crtc->base,0 , has_ctm, gamma_lut_size);mutex_init (&mtk_crtc->hw_lock); +spin_lock_init (&mtk_crtc->config_lock);#if IS_REACHABLE (CONFIG_MTK_CMDQ ) i = priv->mbox_index++;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 222/695 drm/mediatek: Use spin_lock_irqsave() for CRTC event lock
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fei Shao <[email protected]>
[ Upstream commit be03b30b7aa99aca876fbc7c1c1b73b2d0339321 ]
Use the state-aware spin_lock_irqsave() and spin_unlock_irqrestore() to avoid unconditionally re-enabling the local interrupts.
--- drivers/gpu/drm/mediatek/mtk_crtc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/mediatek/mtk_crtc.c +3 -2
@@ -467,6 +467,7 @@ static void mtk_crtc_ddp_hw_fini(struct mtk_crtc *mtk_crtc) {struct drm_device *drm = mtk_crtc->base.dev;struct drm_crtc *crtc = &mtk_crtc->base; +unsigned long flags;int i;for (i =0 ; i < mtk_crtc->ddp_comp_nr; i++) {
@@ -498,10 +499,10 @@ static void mtk_crtc_ddp_hw_fini(struct mtk_crtc *mtk_crtc)pm_runtime_put (drm->dev);if (crtc->state->event && !crtc->state->active) { -spin_lock_irq (&crtc->dev->event_lock); +spin_lock_irqsave (&crtc->dev->event_lock, flags);drm_crtc_send_vblank_event (crtc, crtc->state->event); crtc->state->event =NULL ; -spin_unlock_irq (&crtc->dev->event_lock); +spin_unlock_irqrestore (&crtc->dev->event_lock, flags); } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 223/695 powerpc/8xx: Fix initial memory mapping
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Leroy <[email protected]>
[ Upstream commit f9f2bff64c2f0dbee57be3d8c2741357ad3d05e6 ]
Commit cf209951fa7f ("powerpc/8xx: Map linear memory with huge pages") introduced an initial mapping of kernel TEXT using PAGE_KERNEL_TEXT, but the pages that contain kernel TEXT may also contain kernel RODATA, and depending on selected debug options PAGE_KERNEL_TEXT may be either RWX or ROX. RODATA must be writable during init because it also contains ro_after_init data.
So use PAGE_KERNEL_X instead to be sure it is RWX.
--- arch/powerpc/mm/nohash/8xx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/mm/nohash/8xx.c +2 -2
@@ -150,11 +150,11 @@ unsigned long __init mmu_mapin_ram(unsigned long base, unsigned long top)mmu_mapin_immr (); -mmu_mapin_ram_chunk (0 , boundary,PAGE_KERNEL_TEXT , true); +mmu_mapin_ram_chunk (0 , boundary,PAGE_KERNEL_X , true);if (debug_pagealloc_enabled_or_kfence ()) { top = boundary; }else { -mmu_mapin_ram_chunk (boundary, einittext8,PAGE_KERNEL_TEXT , true); +mmu_mapin_ram_chunk (boundary, einittext8,PAGE_KERNEL_X , true);mmu_mapin_ram_chunk (einittext8, top,PAGE_KERNEL , true); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 224/695 powerpc/8xx: Fix kernel vs user address comparison
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Leroy <[email protected]>
[ Upstream commit 65a82e117ffeeab0baf6f871a1cab11a28ace183 ]
Since commit 9132a2e82adc ("powerpc/8xx: Define a MODULE area below kernel text"), module exec space is below PAGE_OFFSET so not only space above PAGE_OFFSET, but space above TASK_SIZE need to be seen as kernel space.
Until now the problem went undetected because by default TASK_SIZE is 0x8000000 which means address space is determined by just checking upper address bit. But when TASK_SIZE is over 0x80000000, PAGE_OFFSET is used for comparison, leading to thinking module addresses are part of user space.
Fix it by using TASK_SIZE instead of PAGE_OFFSET for address comparison.
--- arch/powerpc/kernel/head_8xx.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/powerpc/kernel/head_8xx.S +3 -3
@@ -41,12 +41,12 @@ #include "head_32.h" .macro compare_to_kernel_boundary scratch, addr -#if CONFIG_TASK_SIZE <= 0x80000000 && CONFIG_PAGE_OFFSET >= 0x80000000 +#if CONFIG_TASK_SIZE <= 0x80000000 && MODULES_VADDR >= 0x80000000 /* By simply checking Address >= 0x80000000, we know if its a kernel address */ not. \scratch, \addr #else rlwinm \scratch, \addr, 16, 0xfff8 - cmpli cr0, \scratch, PAGE_OFFSET@h + cmpli cr0, \scratch, TASK_SIZE@h #endif .endm
@@ -404,7 +404,7 @@ FixupDAR:/* Entry point for dcbx workaround. */ mfspr r10, SPRN_SRR0 mtspr SPRN_MD_EPN, r10 rlwinm r11, r10, 16, 0xfff8 - cmpli cr1, r11, PAGE_OFFSET@h + cmpli cr1, r11, TASK_SIZE@h mfspr r11, SPRN_M_TWB /* Get level 1 table */ blt+ cr1, 3f
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 225/695 powerpc/vdso: Inconditionally use CFUNC macro
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe Leroy <[email protected]>
[ Upstream commit 65948b0e716a47382731889ee6bbb18642b8b003 ]
During merge of commit 4e991e3c16a3 ("powerpc: add CFUNC assembly label annotation") a fallback version of CFUNC macro was added at the last minute, so it can be used inconditionally.
--- arch/powerpc/kernel/vdso/gettimeofday.S | 4 ---- 1 file changed, 4 deletions(-)
arch/powerpc/kernel/vdso/gettimeofday.S +0 -4
@@ -38,11 +38,7 @@ .else addi r4, r5, VDSO_DATA_OFFSET .endif -#ifdef __powerpc64__ bl CFUNC(DOTSYM(\funct)) -#else - bl \funct -#endif PPC_LL r0, PPC_MIN_STKFRM + PPC_LR_STKOFF(r1) #ifdef __powerpc64__ PPC_LL r2, PPC_MIN_STKFRM + STK_GOT(r1)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 226/695 drm/msm: Use a7xx family directly in gpu_state
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Connor Abbott <[email protected]>
[ Upstream commit db75ef03d72ea75515f5282fe8a4925ae8373fe1 ]
With a7xx, we need to import a new header for each new generation and switch to a different list of registers, instead of making backwards-compatible changes. Using the helpers inadvertently made a750 use the a740 list of registers, instead use the family directly to fix this.
Patchwork: https://patchwork.freedesktop.org/patch/607392/
--- drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c | 41 ++++++++++----------- 1 file changed, 20 insertions(+), 21 deletions(-)
drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c +20 -21
@@ -388,18 +388,18 @@ static void a7xx_get_debugbus_blocks(struct msm_gpu *gpu,const u32 *debugbus_blocks, *gbif_debugbus_blocks;int i; -if (adreno_is_a730 (adreno_gpu)) { +if (adreno_gpu->info->family ==ADRENO_7XX_GEN1 ) { debugbus_blocks = gen7_0_0_debugbus_blocks; debugbus_blocks_count =ARRAY_SIZE (gen7_0_0_debugbus_blocks); gbif_debugbus_blocks = a7xx_gbif_debugbus_blocks; gbif_debugbus_blocks_count =ARRAY_SIZE (a7xx_gbif_debugbus_blocks); - }else if (adreno_is_a740_family (adreno_gpu)) { + }else if (adreno_gpu->info->family ==ADRENO_7XX_GEN2 ) { debugbus_blocks = gen7_2_0_debugbus_blocks; debugbus_blocks_count =ARRAY_SIZE (gen7_2_0_debugbus_blocks); gbif_debugbus_blocks = a7xx_gbif_debugbus_blocks; gbif_debugbus_blocks_count =ARRAY_SIZE (a7xx_gbif_debugbus_blocks); }else { -BUG_ON (!adreno_is_a750 (adreno_gpu)); +BUG_ON (adreno_gpu->info->family !=ADRENO_7XX_GEN3 ); debugbus_blocks = gen7_9_0_debugbus_blocks; debugbus_blocks_count =ARRAY_SIZE (gen7_9_0_debugbus_blocks); gbif_debugbus_blocks = gen7_9_0_gbif_debugbus_blocks;
@@ -509,7 +509,7 @@ static void a6xx_get_debugbus(struct msm_gpu *gpu,const struct a6xx_debugbus_block *cx_debugbus_blocks;if (adreno_is_a7xx (adreno_gpu)) { -BUG_ON (!(adreno_is_a730 (adreno_gpu) ||adreno_is_a740_family (adreno_gpu))); +BUG_ON (adreno_gpu->info->family >ADRENO_7XX_GEN3 ); cx_debugbus_blocks = a7xx_cx_debugbus_blocks; nr_cx_debugbus_blocks =ARRAY_SIZE (a7xx_cx_debugbus_blocks); }else {
@@ -660,11 +660,11 @@ static void a7xx_get_dbgahb_clusters(struct msm_gpu *gpu,const struct gen7_sptp_cluster_registers *dbgahb_clusters;unsigned dbgahb_clusters_size; -if (adreno_is_a730 (adreno_gpu)) { +if (adreno_gpu->info->family ==ADRENO_7XX_GEN1 ) { dbgahb_clusters = gen7_0_0_sptp_clusters; dbgahb_clusters_size =ARRAY_SIZE (gen7_0_0_sptp_clusters); }else { -BUG_ON (!adreno_is_a740_family (adreno_gpu)); +BUG_ON (adreno_gpu->info->family >ADRENO_7XX_GEN3 ); dbgahb_clusters = gen7_2_0_sptp_clusters; dbgahb_clusters_size =ARRAY_SIZE (gen7_2_0_sptp_clusters); }
@@ -818,14 +818,14 @@ static void a7xx_get_clusters(struct msm_gpu *gpu,const struct gen7_cluster_registers *clusters;unsigned clusters_size; -if (adreno_is_a730 (adreno_gpu)) { +if (adreno_gpu->info->family ==ADRENO_7XX_GEN1 ) { clusters = gen7_0_0_clusters; clusters_size =ARRAY_SIZE (gen7_0_0_clusters); - }else if (adreno_is_a740_family (adreno_gpu)) { + }else if (adreno_gpu->info->family ==ADRENO_7XX_GEN2 ) { clusters = gen7_2_0_clusters; clusters_size =ARRAY_SIZE (gen7_2_0_clusters); }else { -BUG_ON (!adreno_is_a750 (adreno_gpu)); +BUG_ON (adreno_gpu->info->family !=ADRENO_7XX_GEN3 ); clusters = gen7_9_0_clusters; clusters_size =ARRAY_SIZE (gen7_9_0_clusters); }
@@ -893,7 +893,7 @@ static void a7xx_get_shader_block(struct msm_gpu *gpu,if (WARN_ON (datasize >A6XX_CD_DATA_SIZE ))return ; -if (adreno_is_a730 (adreno_gpu)) { +if (adreno_gpu->info->family ==ADRENO_7XX_GEN1 ) {gpu_rmw (gpu,REG_A7XX_SP_DBG_CNTL ,GENMASK (1 ,0 ),3 ); }
@@ -923,7 +923,7 @@ static void a7xx_get_shader_block(struct msm_gpu *gpu, datasize); out: -if (adreno_is_a730 (adreno_gpu)) { +if (adreno_gpu->info->family ==ADRENO_7XX_GEN1 ) {gpu_rmw (gpu,REG_A7XX_SP_DBG_CNTL ,GENMASK (1 ,0 ),0 ); } }
@@ -956,14 +956,14 @@ static void a7xx_get_shaders(struct msm_gpu *gpu,unsigned num_shader_blocks;int i; -if (adreno_is_a730 (adreno_gpu)) { +if (adreno_gpu->info->family ==ADRENO_7XX_GEN1 ) { shader_blocks = gen7_0_0_shader_blocks; num_shader_blocks =ARRAY_SIZE (gen7_0_0_shader_blocks); - }else if (adreno_is_a740_family (adreno_gpu)) { + }else if (adreno_gpu->info->family ==ADRENO_7XX_GEN2 ) { shader_blocks = gen7_2_0_shader_blocks; num_shader_blocks =ARRAY_SIZE (gen7_2_0_shader_blocks); }else { -BUG_ON (!adreno_is_a750 (adreno_gpu)); +BUG_ON (adreno_gpu->info->family !=ADRENO_7XX_GEN3 ); shader_blocks = gen7_9_0_shader_blocks; num_shader_blocks =ARRAY_SIZE (gen7_9_0_shader_blocks); }
@@ -1348,14 +1348,14 @@ static void a7xx_get_registers(struct msm_gpu *gpu,const u32 *pre_crashdumper_regs;const struct gen7_reg_list *reglist; -if (adreno_is_a730 (adreno_gpu)) { +if (adreno_gpu->info->family ==ADRENO_7XX_GEN1 ) { reglist = gen7_0_0_reg_list; pre_crashdumper_regs = gen7_0_0_pre_crashdumper_gpu_registers; - }else if (adreno_is_a740_family (adreno_gpu)) { + }else if (adreno_gpu->info->family ==ADRENO_7XX_GEN2 ) { reglist = gen7_2_0_reg_list; pre_crashdumper_regs = gen7_0_0_pre_crashdumper_gpu_registers; }else { -BUG_ON (!adreno_is_a750 (adreno_gpu)); +BUG_ON (adreno_gpu->info->family !=ADRENO_7XX_GEN3 ); reglist = gen7_9_0_reg_list; pre_crashdumper_regs = gen7_9_0_pre_crashdumper_gpu_registers; }
@@ -1405,8 +1405,7 @@ static void a7xx_get_post_crashdumper_registers(struct msm_gpu *gpu,struct adreno_gpu *adreno_gpu =to_adreno_gpu (gpu);const u32 *regs; -BUG_ON (!(adreno_is_a730 (adreno_gpu) ||adreno_is_a740_family (adreno_gpu) || -adreno_is_a750 (adreno_gpu))); +BUG_ON (adreno_gpu->info->family >ADRENO_7XX_GEN3 ); regs = gen7_0_0_post_crashdumper_registers; a7xx_get_ahb_gpu_registers(gpu,
@@ -1514,11 +1513,11 @@ static void a7xx_get_indexed_registers(struct msm_gpu *gpu,const struct a6xx_indexed_registers *indexed_regs;int i, indexed_count, mempool_count; -if (adreno_is_a730 (adreno_gpu) ||adreno_is_a740_family (adreno_gpu)) { +if (adreno_gpu->info->family <=ADRENO_7XX_GEN2 ) { indexed_regs = a7xx_indexed_reglist; indexed_count =ARRAY_SIZE (a7xx_indexed_reglist); }else { -BUG_ON (!adreno_is_a750 (adreno_gpu)); +BUG_ON (adreno_gpu->info->family !=ADRENO_7XX_GEN3 ); indexed_regs = gen7_9_0_cp_indexed_reg_list; indexed_count =ARRAY_SIZE (gen7_9_0_cp_indexed_reg_list); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 227/695 drm/msm: Dump correct dbgahb clusters on a750
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Connor Abbott <[email protected]>
[ Upstream commit d8c17d7aadc2463a395f9340f44c7c34399f1d48 ]
This was missed thanks to the family mixup fixed in the previous commit.
Patchwork: https://patchwork.freedesktop.org/patch/607393/
--- drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c +5 -2
@@ -663,10 +663,13 @@ static void a7xx_get_dbgahb_clusters(struct msm_gpu *gpu,if (adreno_gpu->info->family ==ADRENO_7XX_GEN1 ) { dbgahb_clusters = gen7_0_0_sptp_clusters; dbgahb_clusters_size =ARRAY_SIZE (gen7_0_0_sptp_clusters); - }else { -BUG_ON (adreno_gpu->info->family >ADRENO_7XX_GEN3 ); + }else if (adreno_gpu->info->family ==ADRENO_7XX_GEN2 ) { dbgahb_clusters = gen7_2_0_sptp_clusters; dbgahb_clusters_size =ARRAY_SIZE (gen7_2_0_sptp_clusters); + }else { +BUG_ON (adreno_gpu->info->family !=ADRENO_7XX_GEN3 ); + dbgahb_clusters = gen7_9_0_sptp_clusters; + dbgahb_clusters_size =ARRAY_SIZE (gen7_9_0_sptp_clusters); } a6xx_state->dbgahb_clusters = state_kcalloc(a6xx_state,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 228/695 drm/msm: Fix CP_BV_DRAW_STATE_ADDR name
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Connor Abbott <[email protected]>
[ Upstream commit a47cfb688d78217983c4a0051449aa88e2ff5ebb ]
This was missed because we weren't using the a750-specific indexed regs.
Patchwork: https://patchwork.freedesktop.org/patch/607394/
--- drivers/gpu/drm/msm/adreno/adreno_gen7_9_0_snapshot.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/adreno/adreno_gen7_9_0_snapshot.h +1 -1
@@ -1303,7 +1303,7 @@ static struct a6xx_indexed_registers gen7_9_0_cp_indexed_reg_list[] = { REG_A6XX_CP_ROQ_DBG_DATA, 0x00800}, {"CP_UCODE_DBG_DATA" ,REG_A6XX_CP_SQE_UCODE_DBG_ADDR , REG_A6XX_CP_SQE_UCODE_DBG_DATA, 0x08000}, - { "CP_BV_SQE_STAT_ADDR", REG_A7XX_CP_BV_DRAW_STATE_ADDR, + { "CP_BV_DRAW_STATE_ADDR", REG_A7XX_CP_BV_DRAW_STATE_ADDR, REG_A7XX_CP_BV_DRAW_STATE_DATA, 0x00200}, { "CP_BV_ROQ_DBG_ADDR", REG_A7XX_CP_BV_ROQ_DBG_ADDR, REG_A7XX_CP_BV_ROQ_DBG_DATA, 0x00800},
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 229/695 drm/msm: Fix incorrect file name output in adreno_request_fw()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Mishin <[email protected]>
[ Upstream commit e19366911340c2313a1abbb09c54eaf9bdea4f58 ]
In adreno_request_fw() when debugging information is printed to the log after firmware load, an incorrect filename is printed. 'newname' is used instead of 'fwname', so prefix "qcom/" is being added to filename. Looks like "copy-paste" mistake.
Fix this mistake by replacing 'newname' with 'fwname'.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Patchwork: https://patchwork.freedesktop.org/patch/602382/
--- drivers/gpu/drm/msm/adreno/adreno_gpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/adreno/adreno_gpu.c +1 -1
@@ -478,7 +478,7 @@ adreno_request_fw(struct adreno_gpu *adreno_gpu, const char *fwname) ret =request_firmware_direct (&fw, fwname, drm->dev);if (!ret) {DRM_DEV_INFO (drm->dev,"loaded %s from legacy location\n" , - newname); + fwname); adreno_gpu->fwloc =FW_LOCATION_LEGACY ; goto out; }else if (adreno_gpu->fwloc !=FW_LOCATION_UNKNOWN ) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 230/695 drm/msm/a5xx: disable preemption in submits by default
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Lypak <[email protected]>
[ Upstream commit db9dec2db76146d65e1cfbb6afb2e2bd5dab67f8 ]
Fine grain preemption (switching from/to points within submits) requires extra handling in command stream of those submits, especially when rendering with tiling (using GMEM). However this handling is missing at this point in mesa (and always was). For this reason we get random GPU faults and hangs if more than one priority level is used because local preemption is enabled prior to executing command stream from submit.
With that said it was ahead of time to enable local preemption by default considering the fact that even on downstream kernel it is only enabled if requested via UAPI.
Patchwork: https://patchwork.freedesktop.org/patch/612041/
--- drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/adreno/a5xx_gpu.c +6 -2
@@ -150,9 +150,13 @@ static void a5xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit)OUT_PKT7 (ring,CP_SET_PROTECTED_MODE ,1 );OUT_RING (ring,1 ); -/* Enable local preemption for finegrain preemption */ +/* +* Disable local preemption by default because it requires +* user-space to be aware of it and provide additional handling +* to restore rendering state or do various flushes on switch. +*/ OUT_PKT7 (ring,CP_PREEMPT_ENABLE_LOCAL ,1 ); -OUT_RING (ring,0x1 ); +OUT_RING (ring,0x0 );/* Allow CP_CONTEXT_SWITCH_YIELD packets in the IB2 */ OUT_PKT7 (ring,CP_YIELD_ENABLE ,1 );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 231/695 drm/msm/a5xx: properly clear preemption records on resume
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Lypak <[email protected]>
[ Upstream commit 64fd6d01a52904bdbda0ce810a45a428c995a4ca ]
Two fields of preempt_record which are used by CP aren't reset on
resume: "data" and "info". This is the reason behind faults which happen when we try to switch to the ring that was active last before suspend. In addition those faults can't be recovered from because we use suspend and resume to do so (keeping values of those fields again).
Patchwork: https://patchwork.freedesktop.org/patch/612043/
--- drivers/gpu/drm/msm/adreno/a5xx_preempt.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/msm/adreno/a5xx_preempt.c +2 -0
@@ -204,6 +204,8 @@ void a5xx_preempt_hw_init(struct msm_gpu *gpu)return ;for (i =0 ; i < gpu->nr_rings; i++) { + a5xx_gpu->preempt[i]->data =0 ; + a5xx_gpu->preempt[i]->info =0 ; a5xx_gpu->preempt[i]->wptr =0 ; a5xx_gpu->preempt[i]->rptr =0 ; a5xx_gpu->preempt[i]->rbase = gpu->rb[i]->iova;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 232/695 drm/msm/a5xx: fix races in preemption evaluation stage
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Lypak <[email protected]>
[ Upstream commit ce050f307ad93bcc5958d0dd35fc276fd394d274 ]
On A5XX GPUs when preemption is used it's invietable to enter a soft lock-up state in which GPU is stuck at empty ring-buffer doing nothing. This appears as full UI lockup and not detected as GPU hang (because it's not). This happens due to not triggering preemption when it was needed. Sometimes this state can be recovered by some new submit but generally it won't happen because applications are waiting for old submits to retire.
One of the reasons why this happens is a race between a5xx_submit and a5xx_preempt_trigger called from IRQ during submit retire. Former thread updates ring->cur of previously empty and not current ring right after latter checks it for emptiness. Then both threads can just exit because for first one preempt_state wasn't NONE yet and for second one all rings appeared to be empty.
To prevent such situations from happening we need to establish guarantee for preempt_trigger to make decision after each submit or retire. To implement this we serialize preemption initiation using spinlock. If switch is already in progress we need to re-trigger preemption when it finishes.
Patchwork: https://patchwork.freedesktop.org/patch/612045/
--- drivers/gpu/drm/msm/adreno/a5xx_gpu.h | 1 + drivers/gpu/drm/msm/adreno/a5xx_preempt.c | 24 +++++++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/adreno/a5xx_gpu.h +1 -0
@@ -36,6 +36,7 @@ struct a5xx_gpu {uint64_t preempt_iova[MSM_GPU_MAX_RINGS ];atomic_t preempt_state; +spinlock_t preempt_start_lock;struct timer_list preempt_timer;struct drm_gem_object *shadow_bo;
drivers/gpu/drm/msm/adreno/a5xx_preempt.c +22 -2
@@ -97,12 +97,19 @@ void a5xx_preempt_trigger(struct msm_gpu *gpu)if (gpu->nr_rings ==1 )return ; +/* +* Serialize preemption start to ensure that we always make +* decision on latest state. Otherwise we can get stuck in +* lower priority or empty ring. +*/ +spin_lock_irqsave (&a5xx_gpu->preempt_start_lock, flags); +/* * Try to start preemption by moving from NONE to START. If * unsuccessful, a preemption is already in flight */ if (!try_preempt_state (a5xx_gpu,PREEMPT_NONE ,PREEMPT_START )) -return ; + goto out;/* Get the next ring to preempt to */ ring =get_next_ring (gpu);
@@ -127,9 +134,11 @@ void a5xx_preempt_trigger(struct msm_gpu *gpu)set_preempt_state (a5xx_gpu,PREEMPT_ABORT );update_wptr (gpu, a5xx_gpu->cur_ring);set_preempt_state (a5xx_gpu,PREEMPT_NONE ); -return ; + goto out; } +spin_unlock_irqrestore (&a5xx_gpu->preempt_start_lock, flags); +/* Make sure the wptr doesn't update while we're in motion */ spin_lock_irqsave (&ring->preempt_lock, flags); a5xx_gpu->preempt[ring->id]->wptr =get_wptr (ring);
@@ -152,6 +161,10 @@ void a5xx_preempt_trigger(struct msm_gpu *gpu)/* And actually start the preemption */ gpu_write (gpu,REG_A5XX_CP_CONTEXT_SWITCH_CNTL ,1 ); +return ; + +out: +spin_unlock_irqrestore (&a5xx_gpu->preempt_start_lock, flags); }void a5xx_preempt_irq (struct msm_gpu *gpu)
@@ -188,6 +201,12 @@ void a5xx_preempt_irq(struct msm_gpu *gpu)update_wptr (gpu, a5xx_gpu->cur_ring);set_preempt_state (a5xx_gpu,PREEMPT_NONE ); + +/* +* Try to trigger preemption again in case there was a submit or +* retire during ring switch +*/ +a5xx_preempt_trigger (gpu); }void a5xx_preempt_hw_init (struct msm_gpu *gpu)
@@ -300,5 +319,6 @@ void a5xx_preempt_init(struct msm_gpu *gpu) } } +spin_lock_init (&a5xx_gpu->preempt_start_lock);timer_setup (&a5xx_gpu->preempt_timer, a5xx_preempt_timer,0 ); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 233/695 drm/msm/a5xx: workaround early ring-buffer emptiness check
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vladimir Lypak <[email protected]>
[ Upstream commit a30f9f65b5ac82d4390548c32ed9c7f05de7ddf5 ]
There is another cause for soft lock-up of GPU in empty ring-buffer:
race between GPU executing last commands and CPU checking ring for emptiness. On GPU side IRQ for retire is triggered by CACHE_FLUSH_TS event and RPTR shadow (which is used to check ring emptiness) is updated a bit later from CP_CONTEXT_SWITCH_YIELD. Thus if GPU is executing its last commands slow enough or we check that ring too fast we will miss a chance to trigger switch to lower priority ring because current ring isn't empty just yet. This can escalate to lock-up situation described in previous patch.
To work-around this issue we keep track of last submit sequence number for each ring and compare it with one written to memptrs from GPU during execution of CACHE_FLUSH_TS event.
Patchwork: https://patchwork.freedesktop.org/patch/612047/
--- drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 4 ++++ drivers/gpu/drm/msm/adreno/a5xx_gpu.h | 1 + drivers/gpu/drm/msm/adreno/a5xx_preempt.c | 4 ++++ 3 files changed, 9 insertions(+)
drivers/gpu/drm/msm/adreno/a5xx_gpu.c +4 -0
@@ -65,6 +65,8 @@ void a5xx_flush(struct msm_gpu *gpu, struct msm_ringbuffer *ring,static void a5xx_submit_in_rb (struct msm_gpu *gpu,struct msm_gem_submit *submit) { +struct adreno_gpu *adreno_gpu =to_adreno_gpu (gpu); +struct a5xx_gpu *a5xx_gpu =to_a5xx_gpu (adreno_gpu);struct msm_ringbuffer *ring = submit->ring;struct drm_gem_object *obj;uint32_t *ptr, dwords;
@@ -109,6 +111,7 @@ static void a5xx_submit_in_rb(struct msm_gpu *gpu, struct msm_gem_submit *submit } } + a5xx_gpu->last_seqno[ring->id] = submit->seqno;a5xx_flush (gpu, ring, true);a5xx_preempt_trigger (gpu);
@@ -210,6 +213,7 @@ static void a5xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit)/* Write the fence to the scratch register */ OUT_PKT4 (ring,REG_A5XX_CP_SCRATCH_REG (2 ),1 );OUT_RING (ring, submit->seqno); + a5xx_gpu->last_seqno[ring->id] = submit->seqno;/* * Execute a CACHE_FLUSH_TS event. This will ensure that the
drivers/gpu/drm/msm/adreno/a5xx_gpu.h +1 -0
@@ -34,6 +34,7 @@ struct a5xx_gpu {struct drm_gem_object *preempt_counters_bo[MSM_GPU_MAX_RINGS ];struct a5xx_preempt_record *preempt[MSM_GPU_MAX_RINGS ];uint64_t preempt_iova[MSM_GPU_MAX_RINGS ]; +uint32_t last_seqno[MSM_GPU_MAX_RINGS ];atomic_t preempt_state;spinlock_t preempt_start_lock;
drivers/gpu/drm/msm/adreno/a5xx_preempt.c +4 -0
@@ -55,6 +55,8 @@ static inline void update_wptr(struct msm_gpu *gpu, struct msm_ringbuffer *ring)/* Return the highest priority ringbuffer with something in it */ static struct msm_ringbuffer *get_next_ring (struct msm_gpu *gpu) { +struct adreno_gpu *adreno_gpu =to_adreno_gpu (gpu); +struct a5xx_gpu *a5xx_gpu =to_a5xx_gpu (adreno_gpu);unsigned long flags;int i;
@@ -64,6 +66,8 @@ static struct msm_ringbuffer *get_next_ring(struct msm_gpu *gpu)spin_lock_irqsave (&ring->preempt_lock, flags); empty = (get_wptr (ring) == gpu->funcs->get_rptr (gpu, ring)); +if (!empty && ring == a5xx_gpu->cur_ring) + empty = ring->memptrs->fence == a5xx_gpu->last_seqno[i];spin_unlock_irqrestore (&ring->preempt_lock, flags);if (!empty)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 234/695 ipmi: docs: dont advertise deprecated sysfs entries
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wolfram Sang <[email protected]>
[ Upstream commit 64dce81f8c373c681e62d5ffe0397c45a35d48a2 ]
"i2c-adapter" class entries are deprecated since 2009. Switch to the proper location.
Message-Id: <[email protected]>
--- Documentation/driver-api/ipmi.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/driver-api/ipmi.rst +1 -1
@@ -540,7 +540,7 @@ at module load time (for a module) with:: alerts_broken The addresses are normal I2C addresses. The adapter is the string -name of the adapter, as shown in /sys/class/i2c-adapter/i2c-<n>/name. +name of the adapter, as shown in /sys/bus/i2c/devices/i2c-<n>/name. It is *NOT* i2c-<n> itself. Also, the comparison is done ignoring spaces, so if the name is "This is an I2C chip" you can say adapter_name=ThisisanI2cchip. This is because it's hard to pass in
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 235/695 drm/msm/dp: enable widebus on all relevant chipsets
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Abhinav Kumar <[email protected]>
[ Upstream commit c7c412202623951dcfc22316f5255fd84fd56186 ]
Hardware document indicates that widebus is recommended on DP on all MDSS chipsets starting version 5.x.x and above.
Follow the guideline and mark widebus support on all relevant chipsets for DP.
Patchwork: https://patchwork.freedesktop.org/patch/606556/
--- drivers/gpu/drm/msm/dp/dp_display.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/msm/dp/dp_display.c +5 -5
@@ -119,7 +119,7 @@ struct msm_dp_desc { };static const struct msm_dp_desc sc7180_dp_descs[] = { - { .io_start =0x0ae90000 , .id =MSM_DP_CONTROLLER_0 }, + { .io_start =0x0ae90000 , .id =MSM_DP_CONTROLLER_0 , .wide_bus_supported = true }, {} };
@@ -130,9 +130,9 @@ static const struct msm_dp_desc sc7280_dp_descs[] = { };static const struct msm_dp_desc sc8180x_dp_descs[] = { - { .io_start =0x0ae90000 , .id =MSM_DP_CONTROLLER_0 }, - { .io_start =0x0ae98000 , .id =MSM_DP_CONTROLLER_1 }, - { .io_start =0x0ae9a000 , .id =MSM_DP_CONTROLLER_2 }, + { .io_start =0x0ae90000 , .id =MSM_DP_CONTROLLER_0 , .wide_bus_supported = true }, + { .io_start =0x0ae98000 , .id =MSM_DP_CONTROLLER_1 , .wide_bus_supported = true }, + { .io_start =0x0ae9a000 , .id =MSM_DP_CONTROLLER_2 , .wide_bus_supported = true }, {} };
@@ -149,7 +149,7 @@ static const struct msm_dp_desc sc8280xp_dp_descs[] = { };static const struct msm_dp_desc sm8650_dp_descs[] = { - { .io_start =0x0af54000 , .id =MSM_DP_CONTROLLER_0 }, + { .io_start =0x0af54000 , .id =MSM_DP_CONTROLLER_0 , .wide_bus_supported = true }, {} };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 236/695 drm/msm/dsi: correct programming sequence for SM8350 / SM8450
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 1328cb7c34bf6d056df9ff694ee5194537548258 ]
According to the display-drivers, 5nm DSI PLL (v4.2, v4.3) have different boundaries for pll_clock_inverters programming. Follow the vendor code and use correct values.
Patchwork: https://patchwork.freedesktop.org/patch/606947/
--- drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c +11 -1
@@ -135,7 +135,7 @@ static void dsi_pll_calc_dec_frac(struct dsi_pll_7nm *pll, struct dsi_pll_config config->pll_clock_inverters =0x00 ; else config->pll_clock_inverters = 0x40; - }else { + }else if (pll->phy->cfg->quirks &DSI_PHY_7NM_QUIRK_V4_1 ) {if (pll_freq <=1000000000ULL ) config->pll_clock_inverters =0xa0 ;else if (pll_freq <=2500000000ULL )
@@ -144,6 +144,16 @@ static void dsi_pll_calc_dec_frac(struct dsi_pll_7nm *pll, struct dsi_pll_config config->pll_clock_inverters =0x00 ; else config->pll_clock_inverters = 0x40; + }else { +/* 4.2, 4.3 */ +if (pll_freq <=1000000000ULL ) + config->pll_clock_inverters =0xa0 ; +else if (pll_freq <=2500000000ULL ) + config->pll_clock_inverters =0x20 ; +else if (pll_freq <=3500000000ULL ) + config->pll_clock_inverters =0x00 ; +else + config->pll_clock_inverters =0x40 ; } config->decimal_div_start = dec;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 237/695 drm/msm: fix %s null argument error
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sherry Yang <[email protected]>
[ Upstream commit 25b85075150fe8adddb096db8a4b950353045ee1 ]
The following build error was triggered because of NULL string argument:
BUILDSTDERR: drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c: In function 'mdp5_smp_dump': BUILDSTDERR: drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c:352:51: error: '%s' directive argument is null [-Werror=format-overflow=] BUILDSTDERR: 352 | drm_printf(p, "%s:%d\t%d\t%s\n", BUILDSTDERR: | ^~ BUILDSTDERR: drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c:352:51: error: '%s' directive argument is null [-Werror=format-overflow=]
This happens from the commit a61ddb4393ad ("drm: enable (most) W=1 warnings by default across the subsystem"). Using "(null)" instead to fix it.
Patchwork: https://patchwork.freedesktop.org/patch/611071/
--- drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/mdp5/mdp5_smp.c +1 -1
@@ -351,7 +351,7 @@ void mdp5_smp_dump(struct mdp5_smp *smp, struct drm_printer *p,drm_printf (p,"%s:%d\t%d\t%s\n" ,pipe2name (pipe), j, inuse, - plane ? plane->name :NULL ); + plane ? plane->name :"(null)" ); total += inuse; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 238/695 platform/x86: ideapad-laptop: Make the scope_guard() clear of its scope
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
[ Upstream commit a093cb667c3ff5eadd4b23ddf996d9ccae9b7ac6 ]
First of all, it's a bit counterintuitive to have something like
int err; ... scoped_guard(...) err = foo(...); if (err) return err;
Second, with a particular kernel configuration and compiler version in one of such cases the objtool is not happy:
ideapad-laptop.o: warning: objtool: .text.fan_mode_show: unexpected end of section
I'm not an expert on all this, but the theory is that compiler and linker in this case can't understand that 'result' variable will be always initialized as long as no error has been returned. Assigning 'result' to a dummy value helps with this. Note, that fixing the scoped_guard() scope (as per above) does not make issue gone.
That said, assign dummy value and make the scope_guard() clear of its scope. For the sake of consistency do it in the entire file.
--- drivers/platform/x86/ideapad-laptop.c | 48 +++++++++++++++------------ 1 file changed, 27 insertions(+), 21 deletions(-)
drivers/platform/x86/ideapad-laptop.c +27 -21
@@ -419,13 +419,14 @@ static ssize_t camera_power_show(struct device *dev, char *buf) {struct ideapad_private *priv =dev_get_drvdata (dev); -unsigned long result; +unsigned long result =0 ;int err; -scoped_guard (mutex, &priv->vpc_mutex) + scoped_guard(mutex, &priv->vpc_mutex) { err =read_ec_data (priv->adev->handle,VPCCMD_R_CAMERA , &result); -if (err) -return err; +if (err) +return err; + }return sysfs_emit (buf,"%d\n" , !!result); }
@@ -442,10 +443,11 @@ static ssize_t camera_power_store(struct device *dev,if (err)return err; -scoped_guard (mutex, &priv->vpc_mutex) + scoped_guard(mutex, &priv->vpc_mutex) { err =write_ec_cmd (priv->adev->handle,VPCCMD_W_CAMERA , state); -if (err) -return err; +if (err) +return err; + }return count; }
@@ -493,13 +495,14 @@ static ssize_t fan_mode_show(struct device *dev, char *buf) {struct ideapad_private *priv =dev_get_drvdata (dev); -unsigned long result; +unsigned long result =0 ;int err; -scoped_guard (mutex, &priv->vpc_mutex) + scoped_guard(mutex, &priv->vpc_mutex) { err =read_ec_data (priv->adev->handle,VPCCMD_R_FAN , &result); -if (err) -return err; +if (err) +return err; + }return sysfs_emit (buf,"%lu\n" , result); }
@@ -519,10 +522,11 @@ static ssize_t fan_mode_store(struct device *dev,if (state >4 || state ==3 )return -EINVAL ; -scoped_guard (mutex, &priv->vpc_mutex) + scoped_guard(mutex, &priv->vpc_mutex) { err =write_ec_cmd (priv->adev->handle,VPCCMD_W_FAN , state); -if (err) -return err; +if (err) +return err; + }return count; }
@@ -602,13 +606,14 @@ static ssize_t touchpad_show(struct device *dev, char *buf) {struct ideapad_private *priv =dev_get_drvdata (dev); -unsigned long result; +unsigned long result =0 ;int err; -scoped_guard (mutex, &priv->vpc_mutex) + scoped_guard(mutex, &priv->vpc_mutex) { err =read_ec_data (priv->adev->handle,VPCCMD_R_TOUCHPAD , &result); -if (err) -return err; +if (err) +return err; + } priv->r_touchpad_val = result;
@@ -627,10 +632,11 @@ static ssize_t touchpad_store(struct device *dev,if (err)return err; -scoped_guard (mutex, &priv->vpc_mutex) + scoped_guard(mutex, &priv->vpc_mutex) { err =write_ec_cmd (priv->adev->handle,VPCCMD_W_TOUCHPAD , state); -if (err) -return err; +if (err) +return err; + } priv->r_touchpad_val = state;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 239/695 kselftest: dt: Ignore nodes that have ancestors disabled
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit 05144ab7b7eaf531fc728fcb79dcf36b621ff42d ]
Filter out nodes that have one of its ancestors disabled as they aren't expected to probe.
This removes the following false-positive failures on the sc7180-trogdor-lazor-limozeen-nots-r5 platform:
/soc@0/geniqup@8c0000/i2c@894000/proximity@28 /soc@0/geniqup@ac0000/spi@a90000/ec@0 /soc@0/remoteproc@62400000/glink-edge/apr /soc@0/remoteproc@62400000/glink-edge/apr/service@3 /soc@0/remoteproc@62400000/glink-edge/apr/service@4 /soc@0/remoteproc@62400000/glink-edge/apr/service@4/clock-controller /soc@0/remoteproc@62400000/glink-edge/apr/service@4/dais /soc@0/remoteproc@62400000/glink-edge/apr/service@7 /soc@0/remoteproc@62400000/glink-edge/apr/service@7/dais /soc@0/remoteproc@62400000/glink-edge/apr/service@8 /soc@0/remoteproc@62400000/glink-edge/apr/service@8/routing /soc@0/remoteproc@62400000/glink-edge/fastrpc /soc@0/remoteproc@62400000/glink-edge/fastrpc/compute-cb@3 /soc@0/remoteproc@62400000/glink-edge/fastrpc/compute-cb@4 /soc@0/remoteproc@62400000/glink-edge/fastrpc/compute-cb@5 /soc@0/spmi@c440000/pmic@0/pon@800/pwrkey
--- .../testing/selftests/dt/test_unprobed_devices.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
tools/testing/selftests/dt/test_unprobed_devices.sh +14 -1
@@ -34,8 +34,21 @@ nodes_compatible=$( # Check if node is available if [[ -e "${node}"/status ]]; then status=$(tr -d '\000' < "${node}"/status) - [[ "${status}" != "okay" && "${status}" != "ok" ]] && continue + if [[ "${status}" != "okay" && "${status}" != "ok" ]]; then + if [ -n "${disabled_nodes_regex}" ]; then + disabled_nodes_regex="${disabled_nodes_regex}|${node}" + else + disabled_nodes_regex="${node}" + fi + continue + fi fi + + # Ignore this node if one of its ancestors was disabled + if [ -n "${disabled_nodes_regex}" ]; then + echo "${node}" | grep -q -E "${disabled_nodes_regex}" && continue + fi + echo "${node}" | sed -e 's|\/proc\/device-tree||' done | sort )
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 240/695 drivers:drm:exynos_drm_gsc:Fix wrong assignment in gsc_bind()
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuesong Li <[email protected]>
[ Upstream commit 94ebc3d3235c5c516f67315059ce657e5090e94b ]
cocci reported a double assignment problem. Upon reviewing previous commits, it appears this may actually be an incorrect assignment.
--- drivers/gpu/drm/exynos/exynos_drm_gsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/exynos/exynos_drm_gsc.c +1 -1
@@ -1174,7 +1174,7 @@ static int gsc_bind(struct device *dev, struct device *master, void *data)struct exynos_drm_ipp *ipp = &ctx->ipp; ctx->drm_dev = drm_dev; - ctx->drm_dev = drm_dev; + ipp->drm_dev = drm_dev;exynos_drm_register_dma (drm_dev, dev, &ctx->dma_priv); exynos_drm_ipp_register(dev, ipp, &ipp_funcs,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 241/695 drm/amdgpu: fix invalid fence handling in amdgpu_vm_tlb_flush
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lang Yu <[email protected]>
[ Upstream commit 4453808d9eab0461dea338e89372ffc4a3c50acc ]
CPU based update doesn't produce a fence, handle such cases properly.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +4 -2
@@ -902,10 +902,12 @@ amdgpu_vm_tlb_flush(struct amdgpu_vm_update_params *params, {struct amdgpu_vm *vm = params->vm; -if (!fence || !*fence) + tlb_cb->vm = vm; +if (!fence || !*fence) { +amdgpu_vm_tlb_seq_cb (NULL , &tlb_cb->cb);return ; + } - tlb_cb->vm = vm;if (!dma_fence_add_callback (*fence, &tlb_cb->cb, amdgpu_vm_tlb_seq_cb)) {dma_fence_put (vm->last_tlb_flush);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 242/695 xen: use correct end address of kernel for conflict checking
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
[ Upstream commit fac1bceeeb04886fc2ee952672e6e6c85ce41dca ]
When running as a Xen PV dom0 the kernel is loaded by the hypervisor using a different memory map than that of the host. In order to minimize the required changes in the kernel, the kernel adapts its memory map to that of the host. In order to do that it is checking for conflicts of its load address with the host memory map.
Unfortunately the tested memory range does not include the .brk area, which might result in crashes or memory corruption when this area does conflict with the memory map of the host.
Fix the test by using the _end label instead of __bss_stop.
--- arch/x86/xen/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/xen/setup.c +1 -1
@@ -825,7 +825,7 @@ char * __init xen_memory_setup(void)* to relocating (and even reusing) pages with kernel text or data. */ if (xen_is_e820_reserved (__pa_symbol (_text), -__pa_symbol (__bss_stop) -__pa_symbol (_text))) { +__pa_symbol (_end) -__pa_symbol (_text))) {xen_raw_console_write ("Xen hypervisor allocated kernel memory conflicts with E820 map\n" );BUG (); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 243/695 HID: wacom: Support sequence numbers smaller than 16-bit
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gerecke <[email protected]>
[ Upstream commit 359673ea3a203611b4f6d0f28922a4b9d2cfbcc8 ]
The current dropped packet reporting assumes that all sequence numbers are 16 bits in length. This results in misleading "Dropped" messages if the hardware uses fewer bits. For example, if a tablet uses only 8 bits to store its sequence number, once it rolls over from 255 -> 0, the driver will still be expecting a packet "256". This patch adjusts the logic to reset the next expected packet to logical_minimum whenever it overflows beyond logical_maximum.
--- drivers/hid/wacom_wac.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/hid/wacom_wac.c +7 -2
@@ -2446,9 +2446,14 @@ static void wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field wacom_wac->hid_data.barrelswitch3 = value;return ;case WACOM_HID_WD_SEQUENCENUMBER : -if (wacom_wac->hid_data.sequence_number != value) -hid_warn (hdev,"Dropped %hu packets" , (unsigned short )(value - wacom_wac->hid_data.sequence_number)); +if (wacom_wac->hid_data.sequence_number != value) { +int sequence_size = field->logical_maximum - field->logical_minimum +1 ; +int drop_count = (value - wacom_wac->hid_data.sequence_number) % sequence_size; +hid_warn (hdev,"Dropped %d packets" , drop_count); + } wacom_wac->hid_data.sequence_number = value +1 ; +if (wacom_wac->hid_data.sequence_number > field->logical_maximum) + wacom_wac->hid_data.sequence_number = field->logical_minimum;return ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 244/695 HID: wacom: Do not warn about dropped packets for first packet
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Gerecke <[email protected]>
[ Upstream commit 84aecf2d251a3359bc78b7c8e58f54b9fc966e89 ]
The driver currently assumes that the first sequence number it will see is going to be 0. This is not a realiable assumption and can break if, for example, the tablet has already been running for some time prior to the kernel driver connecting to the device. This commit initializes the expected sequence number to -1 and will only print the "Dropped" warning the it has been updated to a non-negative value.
--- drivers/hid/wacom_wac.c | 6 +++++- drivers/hid/wacom_wac.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/hid/wacom_wac.c +5 -1
@@ -2322,6 +2322,9 @@ static void wacom_wac_pen_usage_mapping(struct hid_device *hdev,wacom_map_usage (input, usage, field,EV_KEY ,BTN_STYLUS3 ,0 ); features->quirks &= ~WACOM_QUIRK_PEN_BUTTON3 ;break ; +case WACOM_HID_WD_SEQUENCENUMBER : + wacom_wac->hid_data.sequence_number =-1 ; +break ; } }
@@ -2446,7 +2449,8 @@ static void wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field wacom_wac->hid_data.barrelswitch3 = value;return ;case WACOM_HID_WD_SEQUENCENUMBER : -if (wacom_wac->hid_data.sequence_number != value) { +if (wacom_wac->hid_data.sequence_number != value && + wacom_wac->hid_data.sequence_number >=0 ) {int sequence_size = field->logical_maximum - field->logical_minimum +1 ;int drop_count = (value - wacom_wac->hid_data.sequence_number) % sequence_size;hid_warn (hdev,"Dropped %d packets" , drop_count);
drivers/hid/wacom_wac.h +1 -1
@@ -324,7 +324,7 @@ struct hid_data {int bat_connected;int ps_connected;bool pad_input_event_flag; -unsigned short sequence_number; +int sequence_number;ktime_t time_delayed; };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 245/695 ata: libata: Clear DID_TIME_OUT for ATA PT commands with sense data
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <[email protected]>
[ Upstream commit e5dd410acb34c7341a0a93b429dcf3dabf9e3323 ]
When ata_qc_complete() schedules a command for EH using ata_qc_schedule_eh(), blk_abort_request() will be called, which leads to req->q->mq_ops->timeout() / scsi_timeout() being called.
scsi_timeout(), if the LLDD has no abort handler (libata has no abort handler), will set host byte to DID_TIME_OUT, and then call scsi_eh_scmd_add() to add the command to EH.
Thus, when commands first enter libata's EH strategy_handler, all the commands that have been added to EH will have DID_TIME_OUT set.
libata has its own flag (AC_ERR_TIMEOUT), that it sets for commands that have not received a completion at the time of entering EH.
Thus, libata doesn't really care about DID_TIME_OUT at all, and currently clears the host byte at the end of EH, in ata_scsi_qc_complete(), before scsi_eh_finish_cmd() is called.
However, this clearing in ata_scsi_qc_complete() is currently only done for commands that are not ATA passthrough commands.
Since the host byte is visible in the completion that we return to user space for ATA passthrough commands, for ATA passthrough commands that got completed via EH (commands with sense data), the user will incorrectly see:
ATA pass-through(16): transport error: Host_status=0x03 [DID_TIME_OUT]
Fix this by moving the clearing of the host byte (which is currently only done for commands that are not ATA passthrough commands) from ata_scsi_qc_complete() to the start of EH (regardless if the command is ATA passthrough or not).
While at it, use the proper helper function to clear the host byte, rather than open coding the clearing.
This will make sure that we:
-Correctly clear DID_TIME_OUT for both ATA passthrough commands and
commands that are not ATA passthrough commands.
-Do not needlessly clear the host byte for commands that did not go via EH.
ata_scsi_qc_complete() is called both for commands that are completed normally (without going via EH), and for commands that went via EH, however, only commands that went via EH will have DID_TIME_OUT set.
--- drivers/ata/libata-eh.c | 8 ++++++++ drivers/ata/libata-scsi.c | 3 --- 2 files changed, 8 insertions(+), 3 deletions(-)
drivers/ata/libata-eh.c +8 -0
@@ -630,6 +630,14 @@ void ata_scsi_cmd_error_handler(struct Scsi_Host *host, struct ata_port *ap,list_for_each_entry_safe (scmd, tmp, eh_work_q, eh_entry) {struct ata_queued_cmd *qc; +/* +* If the scmd was added to EH, via ata_qc_schedule_eh() -> +* scsi_timeout() -> scsi_eh_scmd_add(), scsi_timeout() will +* have set DID_TIME_OUT (since libata does not have an abort +* handler). Thus, to clear DID_TIME_OUT, clear the host byte. +*/ +set_host_byte (scmd,DID_OK ); +ata_qc_for_each_raw (ap, qc, i) {if (qc->flags &ATA_QCFLAG_ACTIVE && qc->scsicmd == scmd)
drivers/ata/libata-scsi.c +0 -3
@@ -1691,9 +1691,6 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)set_status_byte (qc->scsicmd,SAM_STAT_CHECK_CONDITION ); }else if (is_error && !have_sense) {ata_gen_ata_sense (qc); - }else { -/* Keep the SCSI ML and status byte, clear host byte. */ - cmd->result &=0x0000ffff ; }ata_qc_done (qc);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 246/695 xen: introduce generic helper checking for memory map conflicts
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
[ Upstream commit ba88829706e2c5b7238638fc2b0713edf596495e ]
When booting as a Xen PV dom0 the memory layout of the dom0 is modified to match that of the host, as this requires less changes in the kernel for supporting Xen.
There are some cases, though, which are problematic, as it is the Xen hypervisor selecting the kernel's load address plus some other data, which might conflict with the host's memory map.
These conflicts are detected at boot time and result in a boot error. In order to support handling at least some of these conflicts in future, introduce a generic helper function which will later gain the ability to adapt the memory layout when possible.
Add the missing check for the xen_start_info area.
Note that possible p2m map and initrd memory conflicts are handled already by copying the data to memory areas not conflicting with the memory map. The initial stack allocated by Xen doesn't need to be checked, as early boot code is switching to the statically allocated initial kernel stack. Initial page tables and the kernel itself will be handled later.
Stable-dep-of: be35d91c8880 ("xen: tolerate ACPI NVS memory overlapping with Xen allocated memory")
--- arch/x86/xen/mmu_pv.c | 5 +---- arch/x86/xen/setup.c | 34 ++++++++++++++++++++++++++++------ arch/x86/xen/xen-ops.h | 3 ++- 3 files changed, 31 insertions(+), 11 deletions(-)
arch/x86/xen/mmu_pv.c +1 -4
@@ -2018,10 +2018,7 @@ void __init xen_reserve_special_pages(void)void __init xen_pt_check_e820 (void ) { -if (xen_is_e820_reserved (xen_pt_base, xen_pt_size)) { -xen_raw_console_write ("Xen hypervisor allocated page table memory conflicts with E820 map\n" ); -BUG (); - } +xen_chk_is_e820_usable (xen_pt_base, xen_pt_size,"page table" ); } static unsigned char dummy_mapping[PAGE_SIZE] __page_aligned_bss;
arch/x86/xen/setup.c +28 -6
@@ -567,7 +567,7 @@ static void __init xen_ignore_unusable(void) } } -bool __init xen_is_e820_reserved (phys_addr_t start,phys_addr_t size) +static bool __init xen_is_e820_reserved (phys_addr_t start,phys_addr_t size) {struct e820_entry *entry;unsigned mapcnt;
@@ -624,6 +624,23 @@ phys_addr_t __init xen_find_free_area(phys_addr_t size)return 0 ; } +/* +* Check for an area in physical memory to be usable for non-movable purposes. +* An area is considered to usable if the used E820 map lists it to be RAM. +* In case the area is not usable, crash the system with an error message. +*/ +void __init xen_chk_is_e820_usable (phys_addr_t start,phys_addr_t size, +const char *component) +{ +if (!xen_is_e820_reserved (start, size)) +return ; + +xen_raw_console_write ("Xen hypervisor allocated " ); +xen_raw_console_write (component); +xen_raw_console_write (" memory conflicts with E820 map\n" ); +BUG (); +} +/* * Like memcpy, but with physical addresses for dest and src. */
@@ -824,11 +841,16 @@ char * __init xen_memory_setup(void)* Failing now is better than running into weird problems later due * to relocating (and even reusing) pages with kernel text or data. */ -if (xen_is_e820_reserved (__pa_symbol (_text), -__pa_symbol (_end) -__pa_symbol (_text))) { -xen_raw_console_write ("Xen hypervisor allocated kernel memory conflicts with E820 map\n" ); -BUG (); - } +xen_chk_is_e820_usable (__pa_symbol (_text), +__pa_symbol (_end) -__pa_symbol (_text), +"kernel" ); + +/* +* Check for a conflict of the xen_start_info memory with the target +* E820 map. +*/ +xen_chk_is_e820_usable (__pa (xen_start_info),sizeof (*xen_start_info), +"xen_start_info" );/* * Check for a conflict of the hypervisor supplied page tables with
arch/x86/xen/xen-ops.h +2 -1
@@ -48,7 +48,8 @@ void xen_mm_unpin_all(void);void __init xen_relocate_p2m (void );#endif -bool __init xen_is_e820_reserved (phys_addr_t start,phys_addr_t size); +void __init xen_chk_is_e820_usable (phys_addr_t start,phys_addr_t size, +const char *component);unsigned long __ref xen_chk_extra_mem (unsigned long pfn);void __init xen_inv_extra_mem (void );void __init xen_remap_memory (void );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 247/695 xen: move max_pfn in xen_memory_setup() out of function scope
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
[ Upstream commit 43dc2a0f479b9cd30f6674986d7a40517e999d31 ]
Instead of having max_pfn as a local variable of xen_memory_setup(), make it a static variable in setup.c instead. This avoids having to pass it to subfunctions, which will be needed in more cases in future.
Rename it to ini_nr_pages, as the value denotes the currently usable number of memory pages as passed from the hypervisor at boot time.
Stable-dep-of: be35d91c8880 ("xen: tolerate ACPI NVS memory overlapping with Xen allocated memory")
--- arch/x86/xen/setup.c | 52 ++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 26 deletions(-)
arch/x86/xen/setup.c +26 -26
@@ -46,6 +46,9 @@ bool xen_pv_pci_possible;/* E820 map used during setting up memory. */ static struct e820_table xen_e820_table__initdata ; +/* Number of initially usable memory pages. */ +static unsigned long ini_nr_pages__initdata ; +/* * Buffer used to remap identity mapped pages. We only need the virtual space. * The physical page behind this address is remapped as needed to different
@@ -212,7 +215,7 @@ static int __init xen_free_mfn(unsigned long mfn)* as a fallback if the remapping fails. */ static void __init xen_set_identity_and_release_chunk (unsigned long start_pfn, -unsigned long end_pfn,unsigned long nr_pages) +unsigned long end_pfn) {unsigned long pfn, end;int ret;
@@ -220,7 +223,7 @@ static void __init xen_set_identity_and_release_chunk(unsigned long start_pfn,WARN_ON (start_pfn > end_pfn);/* Release pages first. */ - end =min (end_pfn, nr_pages); + end =min (end_pfn, ini_nr_pages);for (pfn = start_pfn; pfn < end; pfn++) {unsigned long mfn =pfn_to_mfn (pfn);
@@ -341,15 +344,14 @@ static void __init xen_do_set_identity_and_remap_chunk(* to Xen and not remapped. */ static unsigned long __init xen_set_identity_and_remap_chunk ( -unsigned long start_pfn,unsigned long end_pfn,unsigned long nr_pages, -unsigned long remap_pfn) +unsigned long start_pfn,unsigned long end_pfn,unsigned long remap_pfn) {unsigned long pfn;unsigned long i =0 ;unsigned long n = end_pfn - start_pfn;if (remap_pfn ==0 ) - remap_pfn = nr_pages; + remap_pfn = ini_nr_pages;while (i < n) {unsigned long cur_pfn = start_pfn + i;
@@ -358,19 +360,19 @@ static unsigned long __init xen_set_identity_and_remap_chunk(unsigned long remap_range_size;/* Do not remap pages beyond the current allocation */ -if (cur_pfn >= nr_pages) { +if (cur_pfn >= ini_nr_pages) {/* Identity map remaining pages */ set_phys_range_identity (cur_pfn, cur_pfn + size);break ; } -if (cur_pfn + size > nr_pages) - size = nr_pages - cur_pfn; +if (cur_pfn + size > ini_nr_pages) + size = ini_nr_pages - cur_pfn; remap_range_size =xen_find_pfn_range (&remap_pfn);if (!remap_range_size) {pr_warn ("Unable to find available pfn range, not remapping identity pages\n" );xen_set_identity_and_release_chunk (cur_pfn, - cur_pfn + left, nr_pages); + cur_pfn + left);break ; }/* Adjust size to fit in current e820 RAM region */
@@ -397,18 +399,18 @@ static unsigned long __init xen_set_identity_and_remap_chunk( }static unsigned long __init xen_count_remap_pages ( -unsigned long start_pfn,unsigned long end_pfn,unsigned long nr_pages, +unsigned long start_pfn,unsigned long end_pfn,unsigned long remap_pages) { -if (start_pfn >= nr_pages) +if (start_pfn >= ini_nr_pages)return remap_pages; -return remap_pages +min (end_pfn, nr_pages) - start_pfn; +return remap_pages +min (end_pfn, ini_nr_pages) - start_pfn; } -static unsigned long __init xen_foreach_remap_area (unsigned long nr_pages, +static unsigned long __init xen_foreach_remap_area (unsigned long (*func)(unsigned long start_pfn,unsigned long end_pfn, -unsigned long nr_pages,unsigned long last_val)) +unsigned long last_val)) {phys_addr_t start =0 ;unsigned long ret_val =0 ;
@@ -436,8 +438,7 @@ static unsigned long __init xen_foreach_remap_area(unsigned long nr_pages, end_pfn =PFN_UP (entry->addr);if (start_pfn < end_pfn) - ret_val =func (start_pfn, end_pfn, nr_pages, - ret_val); + ret_val =func (start_pfn, end_pfn, ret_val); start = end; } }
@@ -700,7 +701,7 @@ static void __init xen_reserve_xen_mfnlist(void)**/ char *__init xen_memory_setup (void ) { -unsigned long max_pfn, pfn_s, n_pfns; +unsigned long pfn_s, n_pfns;phys_addr_t mem_end, addr, size, chunk_size;u32 type;int rc;
@@ -712,9 +713,8 @@ char * __init xen_memory_setup(void)int op;xen_parse_512gb (); - max_pfn =xen_get_pages_limit (); - max_pfn =min (max_pfn, xen_start_info->nr_pages); - mem_end =PFN_PHYS (max_pfn); + ini_nr_pages =min (xen_get_pages_limit (), xen_start_info->nr_pages); + mem_end =PFN_PHYS (ini_nr_pages); memmap.nr_entries =ARRAY_SIZE (xen_e820_table.entries);set_xen_guest_handle (memmap.buffer, xen_e820_table.entries);
@@ -767,10 +767,10 @@ char * __init xen_memory_setup(void) max_pages =xen_get_max_pages ();/* How many extra pages do we need due to remapping? */ - max_pages +=xen_foreach_remap_area (max_pfn, xen_count_remap_pages); + max_pages +=xen_foreach_remap_area (xen_count_remap_pages); -if (max_pages > max_pfn) - extra_pages += max_pages - max_pfn; +if (max_pages > ini_nr_pages) + extra_pages += max_pages - ini_nr_pages;/* * Clamp the amount of extra memory to a EXTRA_MEM_RATIO
@@ -779,8 +779,8 @@ char * __init xen_memory_setup(void)* Make sure we have no memory above max_pages, as this area * isn't handled by the p2m management. */ - maxmem_pages =EXTRA_MEM_RATIO *min (max_pfn,PFN_DOWN (MAXMEM )); - extra_pages =min3 (maxmem_pages, extra_pages, max_pages - max_pfn); + maxmem_pages =EXTRA_MEM_RATIO *min (ini_nr_pages,PFN_DOWN (MAXMEM )); + extra_pages =min3 (maxmem_pages, extra_pages, max_pages - ini_nr_pages); i =0 ; addr = xen_e820_table.entries[0 ].addr; size = xen_e820_table.entries[0 ].size;
@@ -885,7 +885,7 @@ char * __init xen_memory_setup(void)* Set identity map on non-RAM pages and prepare remapping the * underlying RAM. */ -xen_foreach_remap_area (max_pfn, xen_set_identity_and_remap_chunk); +xen_foreach_remap_area (xen_set_identity_and_remap_chunk);pr_info ("Released %ld page(s)\n" , xen_released_pages);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 248/695 xen: add capability to remap non-RAM pages to different PFNs
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
[ Upstream commit d05208cf7f05420ad10cc7f9550f91d485523659 ]
When running as a Xen PV dom0 it can happen that the kernel is being loaded to a guest physical address conflicting with the host memory map.
In order to be able to resolve this conflict, add the capability to remap non-RAM areas to different guest PFNs. A function to use this remapping information for other purposes than doing the remap will be added when needed.
As the number of conflicts should be rather low (currently only machines with max. 1 conflict are known), save the remap data in a small statically allocated array.
Stable-dep-of: be35d91c8880 ("xen: tolerate ACPI NVS memory overlapping with Xen allocated memory")
--- arch/x86/xen/p2m.c | 63 ++++++++++++++++++++++++++++++++++++++++++ arch/x86/xen/xen-ops.h | 3 ++ 2 files changed, 66 insertions(+)
arch/x86/xen/p2m.c +63 -0
@@ -80,6 +80,7 @@#include <asm/xen/hypervisor.h> #include <xen/balloon.h> #include <xen/grant_table.h> +#include <xen/hvc-console.h> #include "xen-ops.h"
@@ -792,6 +793,68 @@ int clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref *unmap_ops,return ret; } +/* Remapped non-RAM areas */ +#define NR_NONRAM_REMAP 4 +static struct nonram_remap { +phys_addr_t maddr; +phys_addr_t paddr; +size_t size; +} xen_nonram_remap[NR_NONRAM_REMAP ]__ro_after_init ; +static unsigned int nr_nonram_remap__ro_after_init ; + +/* +* Do the real remapping of non-RAM regions as specified in the +* xen_nonram_remap[] array. +* In case of an error just crash the system. +*/ +void __init xen_do_remap_nonram (void ) +{ +unsigned int i; +unsigned int remapped =0 ; +const struct nonram_remap *remap = xen_nonram_remap; +unsigned long pfn, mfn, end_pfn; + +for (i =0 ; i < nr_nonram_remap; i++) { + end_pfn =PFN_UP (remap->paddr + remap->size); + pfn =PFN_DOWN (remap->paddr); + mfn =PFN_DOWN (remap->maddr); +while (pfn < end_pfn) { +if (!set_phys_to_machine (pfn, mfn)) +panic ("Failed to set p2m mapping for pfn=%lx mfn=%lx\n" , + pfn, mfn); + + pfn++; + mfn++; + remapped++; + } + + remap++; + } + +pr_info ("Remapped %u non-RAM page(s)\n" , remapped); +} + +/* +* Add a new non-RAM remap entry. +* In case of no free entry found, just crash the system. +*/ +void __init xen_add_remap_nonram (phys_addr_t maddr,phys_addr_t paddr, +unsigned long size) +{ +BUG_ON ((maddr & ~PAGE_MASK ) != (paddr & ~PAGE_MASK )); + +if (nr_nonram_remap ==NR_NONRAM_REMAP ) { +xen_raw_console_write ("Number of required E820 entry remapping actions exceed maximum value\n" ); +BUG (); + } + + xen_nonram_remap[nr_nonram_remap].maddr = maddr; + xen_nonram_remap[nr_nonram_remap].paddr = paddr; + xen_nonram_remap[nr_nonram_remap].size = size; + + nr_nonram_remap++; +} +#ifdef CONFIG_XEN_DEBUG_FS #include <linux/debugfs.h> static int p2m_dump_show (struct seq_file *m,void *v)
arch/x86/xen/xen-ops.h +3 -0
@@ -47,6 +47,9 @@ void xen_mm_unpin_all(void);#ifdef CONFIG_X86_64 void __init xen_relocate_p2m (void );#endif +void __init xen_do_remap_nonram (void ); +void __init xen_add_remap_nonram (phys_addr_t maddr,phys_addr_t paddr, +unsigned long size);void __init xen_chk_is_e820_usable (phys_addr_t start,phys_addr_t size,const char *component);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 249/695 xen: tolerate ACPI NVS memory overlapping with Xen allocated memory
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
[ Upstream commit be35d91c8880650404f3bf813573222dfb106935 ]
In order to minimize required special handling for running as Xen PV dom0, the memory layout is modified to match that of the host. This requires to have only RAM at the locations where Xen allocated memory is living. Unfortunately there seem to be some machines, where ACPI NVS is located at 64 MB, resulting in a conflict with the loaded kernel or the initial page tables built by Xen.
Avoid this conflict by swapping the ACPI NVS area in the memory map with unused RAM. This is possible via modification of the dom0 P2M map. Accesses to the ACPI NVS area are done either for saving and restoring it across suspend operations (this will work the same way as before), or by ACPI code when NVS memory is referenced from other ACPI tables. The latter case is handled by a Xen specific indirection of acpi_os_ioremap().
While the E820 map can (and should) be modified right away, the P2M map can be updated only after memory allocation is working, as the P2M map might need to be extended.
--- arch/x86/xen/setup.c | 92 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 91 insertions(+), 1 deletion(-)
arch/x86/xen/setup.c +91 -1
@@ -495,6 +495,8 @@ void __init xen_remap_memory(void)set_pte_mfn (buf, mfn_save,PAGE_KERNEL );pr_info ("Remapped %ld page(s)\n" , remapped); + +xen_do_remap_nonram (); }static unsigned long __init xen_get_pages_limit (void )
@@ -625,14 +627,102 @@ phys_addr_t __init xen_find_free_area(phys_addr_t size)return 0 ; } +/* +* Swap a non-RAM E820 map entry with RAM above ini_nr_pages. +* Note that the E820 map is modified accordingly, but the P2M map isn't yet. +* The adaption of the P2M must be deferred until page allocation is possible. +*/ +static void __init xen_e820_swap_entry_with_ram (struct e820_entry *swap_entry) +{ +struct e820_entry *entry; +unsigned int mapcnt; +phys_addr_t mem_end =PFN_PHYS (ini_nr_pages); +phys_addr_t swap_addr, swap_size, entry_end; + + swap_addr =PAGE_ALIGN_DOWN (swap_entry->addr); + swap_size =PAGE_ALIGN (swap_entry->addr - swap_addr + swap_entry->size); + entry = xen_e820_table.entries; + +for (mapcnt =0 ; mapcnt < xen_e820_table.nr_entries; mapcnt++) { + entry_end = entry->addr + entry->size; +if (entry->type ==E820_TYPE_RAM && entry->size >= swap_size && + entry_end - swap_size >= mem_end) { +/* Reduce RAM entry by needed space (whole pages). */ + entry->size -= swap_size; + +/* Add new entry at the end of E820 map. */ + entry = xen_e820_table.entries + + xen_e820_table.nr_entries; + xen_e820_table.nr_entries++; + +/* Fill new entry (keep size and page offset). */ + entry->type = swap_entry->type; + entry->addr = entry_end - swap_size + + swap_addr - swap_entry->addr; + entry->size = swap_entry->size; + +/* Convert old entry to RAM, align to pages. */ + swap_entry->type =E820_TYPE_RAM ; + swap_entry->addr = swap_addr; + swap_entry->size = swap_size; + +/* Remember PFN<->MFN relation for P2M update. */ +xen_add_remap_nonram (swap_addr, entry_end - swap_size, + swap_size); + +/* Order E820 table and merge entries. */ +e820__update_table (&xen_e820_table); + +return ; + } + + entry++; + } + +xen_raw_console_write ("No suitable area found for required E820 entry remapping action\n" ); +BUG (); +} + +/* +* Look for non-RAM memory types in a specific guest physical area and move +* those away if possible (ACPI NVS only for now). +*/ +static void __init xen_e820_resolve_conflicts (phys_addr_t start, +phys_addr_t size) +{ +struct e820_entry *entry; +unsigned int mapcnt; +phys_addr_t end; + +if (!size) +return ; + + end = start + size; + entry = xen_e820_table.entries; + +for (mapcnt =0 ; mapcnt < xen_e820_table.nr_entries; mapcnt++) { +if (entry->addr >= end) +return ; + +if (entry->addr + entry->size > start && + entry->type ==E820_TYPE_NVS ) +xen_e820_swap_entry_with_ram (entry); + + entry++; + } +} +/* * Check for an area in physical memory to be usable for non-movable purposes. -* An area is considered to usable if the used E820 map lists it to be RAM. +* An area is considered to usable if the used E820 map lists it to be RAM or +* some other type which can be moved to higher PFNs while keeping the MFNs. * In case the area is not usable, crash the system with an error message. */ void __init xen_chk_is_e820_usable (phys_addr_t start,phys_addr_t size,const char *component) { +xen_e820_resolve_conflicts (start, size); +if (!xen_is_e820_reserved (start, size))return ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 250/695 drm/xe: fix missing xe_vm_put
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dafna Hirschfeld <[email protected]>
[ Upstream commit 2efba0c095419f93f8913f1cbae8bf3fb030db20 ]
Fix memleak caused by missing xe_vm_put
--- drivers/gpu/drm/xe/xe_exec_queue.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_exec_queue.c +3 -1
@@ -221,8 +221,10 @@ struct xe_exec_queue *xe_exec_queue_create_bind(struct xe_device *xe, gt->usm.reserved_bcs_instance, false); -if (!hwe) +if (!hwe) { +xe_vm_put (migrate_vm);return ERR_PTR (-EINVAL ); + } q = xe_exec_queue_create(xe, migrate_vm, BIT(hwe->logical_instance), 1, hwe,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 251/695 xen/swiotlb: add alignment check for dma buffers
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
[ Upstream commit 9f40ec84a7976d95c34e7cc070939deb103652b0 ]
When checking a memory buffer to be consecutive in machine memory, the alignment needs to be checked, too. Failing to do so might result in DMA memory not being aligned according to its requested size, leading to error messages like:
4xxx 0000:2b:00.0: enabling device (0140 -> 0142) 4xxx 0000:2b:00.0: Ring address not aligned
4xxx 0000:2b:00.0: Failed to initialise service qat_crypto 4xxx 0000:2b:00.0: Resetting device qat_dev0 4xxx: probe of 0000:2b:00.0 failed with error -14
--- drivers/xen/swiotlb-xen.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/xen/swiotlb-xen.c +6 -0
@@ -78,9 +78,15 @@ static inline int range_straddles_page_boundary(phys_addr_t p, size_t size) {unsigned long next_bfn, xen_pfn =XEN_PFN_DOWN (p);unsigned int i, nr_pages =XEN_PFN_UP (xen_offset_in_page (p) + size); +phys_addr_t algn =1ULL << (get_order (size) +PAGE_SHIFT ); next_bfn =pfn_to_bfn (xen_pfn); +/* If buffer is physically aligned, ensure DMA alignment. */ +if (IS_ALIGNED (p, algn) && + !IS_ALIGNED ((phys_addr_t )next_bfn <<XEN_PAGE_SHIFT , algn)) +return 1 ; +for (i =1 ; i < nr_pages; i++)if (pfn_to_bfn (++xen_pfn) != ++next_bfn)return 1 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 252/695 xen/swiotlb: fix allocated size
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
[ Upstream commit c3dea3d54f4d399f8044547f0f1abdccbdfb0fee ]
The allocated size in xen_swiotlb_alloc_coherent() and xen_swiotlb_free_coherent() is calculated wrong for the case of XEN_PAGE_SIZE not matching PAGE_SIZE. Fix that.
--- drivers/xen/swiotlb-xen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/xen/swiotlb-xen.c +2 -2
@@ -147,7 +147,7 @@ xen_swiotlb_alloc_coherent(struct device *dev, size_t size,void *ret;/* Align the allocation to the Xen page size */ - size =1UL << (order +XEN_PAGE_SHIFT ); + size =ALIGN (size,XEN_PAGE_SIZE ); ret = (void *)__get_free_pages (flags,get_order (size));if (!ret)
@@ -179,7 +179,7 @@ xen_swiotlb_free_coherent(struct device *dev, size_t size, void *vaddr,int order =get_order (size);/* Convert the size to actually allocated. */ - size =1UL << (order +XEN_PAGE_SHIFT ); + size =ALIGN (size,XEN_PAGE_SIZE );if (WARN_ON_ONCE (dma_handle + size -1 > dev->coherent_dma_mask) ||WARN_ON_ONCE (range_straddles_page_boundary (phys, size)))
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 253/695 tpm: Clean up TPM space after command failure
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jonathan McDowell <[email protected]>
[ Upstream commit e3aaebcbb7c6b403416f442d1de70d437ce313a7 ]
tpm_dev_transmit prepares the TPM space before attempting command transmission. However if the command fails no rollback of this preparation is done. This can result in transient handles being leaked if the device is subsequently closed with no further commands performed.
Fix this by flushing the space in the event of command transmission failure.
--- drivers/char/tpm/tpm-dev-common.c | 2 ++ drivers/char/tpm/tpm2-space.c | 3 +++ 2 files changed, 5 insertions(+)
drivers/char/tpm/tpm-dev-common.c +2 -0
@@ -47,6 +47,8 @@ static ssize_t tpm_dev_transmit(struct tpm_chip *chip, struct tpm_space *space,if (!ret) ret =tpm2_commit_space (chip, space, buf, &len); +else +tpm2_flush_space (chip); out_rc:return ret ? ret : len;
drivers/char/tpm/tpm2-space.c +3 -0
@@ -169,6 +169,9 @@ void tpm2_flush_space(struct tpm_chip *chip)struct tpm_space *space = &chip->work_space;int i; +if (!space) +return ; +for (i =0 ; i <ARRAY_SIZE (space->context_tbl); i++)if (space->context_tbl[i] && ~space->context_tbl[i])tpm2_flush_context (chip, space->context_tbl[i]);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 254/695 sched/fair: Make SCHED_IDLE entity be preempted in strict hierarchy
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tianchen Ding <[email protected]>
[ Upstream commit faa42d29419def58d3c3e5b14ad4037f0af3b496 ]
Consider the following cgroup:
root
|
------------------------
| |
normal_cgroup idle_cgroup
| | SCHED_IDLE task_A SCHED_NORMAL task_B
According to the cgroup hierarchy, A should preempt B. But current check_preempt_wakeup_fair() treats cgroup se and task separately, so B will preempt A unexpectedly.
Unify the wakeup logic by {c,p}se_is_idle only. This makes SCHED_IDLE of a task a relative policy that is effective only within its own cgroup, similar to the behavior of NICE.
Also fix se_is_idle() definition when !CONFIG_FAIR_GROUP_SCHED.
--- kernel/sched/fair.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-)
kernel/sched/fair.c +9 -13
@@ -511,7 +511,7 @@ static int cfs_rq_is_idle(struct cfs_rq *cfs_rq)static int se_is_idle (struct sched_entity *se) { -return 0 ; +return task_has_idle_policy (task_of (se)); }#endif /* CONFIG_FAIR_GROUP_SCHED */
@@ -8381,16 +8381,7 @@ static void check_preempt_wakeup_fair(struct rq *rq, struct task_struct *p, intif (test_tsk_need_resched (curr))return ; -/* Idle tasks are by definition preempted by non-idle tasks. */ -if (unlikely (task_has_idle_policy (curr)) && -likely (!task_has_idle_policy (p))) - goto preempt; - -/* -* Batch and idle tasks do not preempt non-idle tasks (their preemption -* is driven by the tick): -*/ -if (unlikely (p->policy !=SCHED_NORMAL ) || !sched_feat (WAKEUP_PREEMPTION )) +if (!sched_feat (WAKEUP_PREEMPTION ))return ;find_matching_se (&se, &pse);
@@ -8400,7 +8391,7 @@ static void check_preempt_wakeup_fair(struct rq *rq, struct task_struct *p, int pse_is_idle =se_is_idle (pse);/* -* Preempt an idle group in favor of a non-idle group (and don't preempt +* Preempt an idle entity in favor of a non-idle entity (and don't preempt * in the inverse case). */ if (cse_is_idle && !pse_is_idle)
@@ -8408,9 +8399,14 @@ static void check_preempt_wakeup_fair(struct rq *rq, struct task_struct *p, intif (cse_is_idle != pse_is_idle)return ; +/* +* BATCH and IDLE tasks do not preempt others. +*/ +if (unlikely (p->policy !=SCHED_NORMAL )) +return ; + cfs_rq =cfs_rq_of (se);update_curr (cfs_rq); -/* * XXX pick_eevdf(cfs_rq) != se ? */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 255/695 bpf, x64: Fix tailcall hierarchy
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leon Hwang <[email protected]>
[ Upstream commit 116e04ba1459fc08f80cf27b8c9f9f188be0fcb2 ]
This patch fixes a tailcall issue caused by abusing the tailcall in bpf2bpf feature.
As we know, tail_call_cnt propagates by rax from caller to callee when to call subprog in tailcall context. But, like the following example, MAX_TAIL_CALL_CNT won't work because of missing tail_call_cnt back-propagation from callee to caller.
\#include <linux/bpf.h>
\#include <bpf/bpf_helpers.h>
\#include "bpf_legacy.h"
struct {
__uint(type, BPF_MAP_TYPE_PROG_ARRAY);
__uint(max_entries, 1);
__uint(key_size, sizeof(__u32));
__uint(value_size, sizeof(__u32));
} jmp_table SEC(".maps");int count = 0;
static __noinline
int subprog_tail1(struct __sk_buff *skb)
{
bpf_tail_call_static(skb, &jmp_table, 0);
return 0;
}static __noinline
int subprog_tail2(struct __sk_buff *skb)
{
bpf_tail_call_static(skb, &jmp_table, 0);
return 0;
}SEC("tc")
int entry(struct __sk_buff *skb)
{
volatile int ret = 1;
count++;
subprog_tail1(skb);
subprog_tail2(skb);
return ret;
}char __license[] SEC("license") = "GPL";
At run time, the tail_call_cnt in entry() will be propagated to subprog_tail1() and subprog_tail2(). But, when the tail_call_cnt in subprog_tail1() updates when bpf_tail_call_static(), the tail_call_cnt in entry() won't be updated at the same time. As a result, in entry(), when tail_call_cnt in entry() is less than MAX_TAIL_CALL_CNT and subprog_tail1() returns because of MAX_TAIL_CALL_CNT limit, bpf_tail_call_static() in suprog_tail2() is able to run because the tail_call_cnt in subprog_tail2() propagated from entry() is less than MAX_TAIL_CALL_CNT.
So, how many tailcalls are there for this case if no error happens?
Quoted 1 line
From top-down view, does it look like hierarchy layer and layer?
With this view, there will be 2+4+8+...+2^33 = 2^34 - 2 = 17,179,869,182 tailcalls for this case.
How about there are N subprog_tail() in entry()? There will be almost N^34 tailcalls.
Then, in this patch, it resolves this case on x86_64.
In stead of propagating tail_call_cnt from caller to callee, it propagates its pointer, tail_call_cnt_ptr, tcc_ptr for short.
However, where does it store tail_call_cnt?
It stores tail_call_cnt on the stack of main prog. When tail call happens in subprog, it increments tail_call_cnt by tcc_ptr.
Meanwhile, it stores tail_call_cnt_ptr on the stack of main prog, too.
And, before jump to tail callee, it has to pop tail_call_cnt and tail_call_cnt_ptr.
Then, at the prologue of subprog, it must not make rax as tail_call_cnt_ptr again. It has to reuse tail_call_cnt_ptr from caller.
As a result, at run time, it has to recognize rax is tail_call_cnt or tail_call_cnt_ptr at prologue by:
1. rax is tail_call_cnt if rax is <= MAX_TAIL_CALL_CNT.
2. rax is tail_call_cnt_ptr if rax is > MAX_TAIL_CALL_CNT, because a pointer won't be <= MAX_TAIL_CALL_CNT.
Here's an example to dump JITed.
struct {
__uint(type, BPF_MAP_TYPE_PROG_ARRAY);
__uint(max_entries, 1);
__uint(key_size, sizeof(__u32));
__uint(value_size, sizeof(__u32));
} jmp_table SEC(".maps");int count = 0;
static __noinline
int subprog_tail(struct __sk_buff *skb)
{
bpf_tail_call_static(skb, &jmp_table, 0);
return 0;
}SEC("tc")
int entry(struct __sk_buff *skb)
{
int ret = 1;
count++;
subprog_tail(skb);
subprog_tail(skb);
return ret;
}When bpftool p d j id 42:
int entry(struct __sk_buff * skb):bpf_prog_0c0f4c2413ef19b1_entry:
; int entry(struct __sk_buff *skb)
0: endbr64
4: nopl (%rax,%rax)
9: xorq %rax, %rax ;; rax = 0 (tail_call_cnt)
c: pushq %rbp
d: movq %rsp, %rbp
10: endbr64
14: cmpq $33, %rax ;; if rax > 33, rax = tcc_ptr
18: ja 0x20 ;; if rax > 33 goto 0x20 ---+
1a: pushq %rax ;; [rbp - 8] = rax = 0 |
1b: movq %rsp, %rax ;; rax = rbp - 8 |
1e: jmp 0x21 ;; ---------+ |
20: pushq %rax ;; <--------|---------------+
21: pushq %rax ;; <--------+ [rbp - 16] = rax
22: pushq %rbx ;; callee saved
23: movq %rdi, %rbx ;; rbx = skb (callee saved)
; count++;
26: movabsq $-82417199407104, %rdi
30: movl (%rdi), %esi
33: addl $1, %esi
36: movl %esi, (%rdi)
; subprog_tail(skb);
39: movq %rbx, %rdi ;; rdi = skb
3c: movq -16(%rbp), %rax ;; rax = tcc_ptr
43: callq 0x80 ;; call subprog_tail()
; subprog_tail(skb);
48: movq %rbx, %rdi ;; rdi = skb
4b: movq -16(%rbp), %rax ;; rax = tcc_ptr
52: callq 0x80 ;; call subprog_tail()
; return ret;
57: movl $1, %eax
5c: popq %rbx
5d: leave
5e: retq
int subprog_tail(struct __sk_buff * skb):bpf_prog_3a140cef239a4b4f_subprog_tail:
; int subprog_tail(struct __sk_buff *skb)
0: endbr64
4: nopl (%rax,%rax)
9: nopl (%rax) ;; do not touch tail_call_cnt
c: pushq %rbp
d: movq %rsp, %rbp
10: endbr64
14: pushq %rax ;; [rbp - 8] = rax (tcc_ptr)
15: pushq %rax ;; [rbp - 16] = rax (tcc_ptr)
16: pushq %rbx ;; callee saved
17: pushq %r13 ;; callee saved
19: movq %rdi, %rbx ;; rbx = skb
; asm volatile("r1 = %[ctx]\n\t"
1c: movabsq $-105487587488768, %r13 ;; r13 = jmp_table
26: movq %rbx, %rdi ;; 1st arg, skb
29: movq %r13, %rsi ;; 2nd arg, jmp_table
2c: xorl %edx, %edx ;; 3rd arg, index = 0
2e: movq -16(%rbp), %rax ;; rax = [rbp - 16] (tcc_ptr)
35: cmpq $33, (%rax)
39: jae 0x4e ;; if *tcc_ptr >= 33 goto 0x4e --------+
3b: jmp 0x4e ;; jmp bypass, toggled by poking |
40: addq $1, (%rax) ;; (*tcc_ptr)++ |
44: popq %r13 ;; callee saved | 46: popq %rbx ;; callee saved | 47: popq %rax ;; undo rbp-16 push | 48: popq %rax ;; undo rbp-8 push |
49: nopl (%rax,%rax) ;; tail call target, toggled by poking |
; return 0; ;; |
4e: popq %r13 ;; restore callee saved <--------------+
50: popq %rbx ;; restore callee saved
51: leave
52: retq
Furthermore, when trampoline is the caller of bpf prog, which is tail_call_reachable, it is required to propagate rax through trampoline.
--- arch/x86/net/bpf_jit_comp.c | 107 ++++++++++++++++++++++++++---------- 1 file changed, 79 insertions(+), 28 deletions(-)
arch/x86/net/bpf_jit_comp.c +79 -28
@@ -273,7 +273,7 @@ struct jit_context {/* Number of bytes emit_patch() needs to generate instructions */ #define X86_PATCH_SIZE 5/* Number of bytes that will be skipped on tailcall */ -#define X86_TAIL_CALL_OFFSET (11 + ENDBR_INSN_SIZE) +#define X86_TAIL_CALL_OFFSET (12 + ENDBR_INSN_SIZE)static void push_r12 (u8 **pprog) {
@@ -403,6 +403,37 @@ static void emit_cfi(u8 **pprog, u32 hash) *pprog = prog; } +static void emit_prologue_tail_call (u8 **pprog,bool is_subprog) +{ +u8 *prog = *pprog; + +if (!is_subprog) { +/* cmp rax, MAX_TAIL_CALL_CNT */ +EMIT4 (0x48 ,0x83 ,0xF8 ,MAX_TAIL_CALL_CNT ); +EMIT2 (X86_JA ,6 );/* ja 6 */ +/* rax is tail_call_cnt if <= MAX_TAIL_CALL_CNT. +* case1: entry of main prog. +* case2: tail callee of main prog. +*/ +EMIT1 (0x50 );/* push rax */ +/* Make rax as tail_call_cnt_ptr. */ +EMIT3 (0x48 ,0x89 ,0xE0 );/* mov rax, rsp */ +EMIT2 (0xEB ,1 );/* jmp 1 */ +/* rax is tail_call_cnt_ptr if > MAX_TAIL_CALL_CNT. +* case: tail callee of subprog. +*/ +EMIT1 (0x50 );/* push rax */ +/* push tail_call_cnt_ptr */ +EMIT1 (0x50 );/* push rax */ + }else {/* is_subprog */ +/* rax is tail_call_cnt_ptr. */ +EMIT1 (0x50 );/* push rax */ +EMIT1 (0x50 );/* push rax */ + } + + *pprog = prog; +} +/* * Emit x86-64 prologue code for BPF program. * bpf_tail_call helper will skip the first X86_TAIL_CALL_OFFSET bytes
@@ -424,10 +455,10 @@ static void emit_prologue(u8 **pprog, u32 stack_depth, bool ebpf_from_cbpf,/* When it's the entry of the whole tailcall context, * zeroing rax means initialising tail_call_cnt. */ -EMIT2 (0x31 ,0xC0 );/* xor eax, eax */ +EMIT3 (0x48 ,0x31 ,0xC0 );/* xor rax, rax */ else/* Keep the same instruction layout. */ - EMIT2(0x66, 0x90); /* nop2 */ + emit_nops(&prog, 3); /* nop3 */ }/* Exception callback receives FP as third parameter */ if (is_exception_cb) {
@@ -453,7 +484,7 @@ static void emit_prologue(u8 **pprog, u32 stack_depth, bool ebpf_from_cbpf,if (stack_depth)EMIT3_off32 (0x48 ,0x81 ,0xEC ,round_up (stack_depth,8 ));if (tail_call_reachable) -EMIT1 (0x50 );/* push rax */ +emit_prologue_tail_call (&prog, is_subprog); *pprog = prog; }
@@ -589,13 +620,15 @@ static void emit_return(u8 **pprog, u8 *ip) *pprog = prog; } +#define BPF_TAIL_CALL_CNT_PTR_STACK_OFF (stack) (-16 - round_up(stack, 8)) +/* * Generate the following code: * * ... bpf_tail_call(void *ctx, struct bpf_array *array, u64 index) ... * if (index >= array->map.max_entries) * goto out; -* if (tail_call_cnt++ >= MAX_TAIL_CALL_CNT) +* if ((*tcc_ptr)++ >= MAX_TAIL_CALL_CNT) * goto out; * prog = array->ptrs[index]; * if (prog == NULL)
@@ -608,7 +641,7 @@ static void emit_bpf_tail_call_indirect(struct bpf_prog *bpf_prog, u32 stack_depth, u8 *ip, struct jit_context *ctx) { - int tcc_off = -4 - round_up(stack_depth, 8); + int tcc_ptr_off = BPF_TAIL_CALL_CNT_PTR_STACK_OFF(stack_depth);u8 *prog = *pprog, *start = *pprog;int offset;
@@ -630,16 +663,14 @@ static void emit_bpf_tail_call_indirect(struct bpf_prog *bpf_prog,EMIT2 (X86_JBE , offset);/* jbe out */ /* -* if (tail_call_cnt++ >= MAX_TAIL_CALL_CNT) +* if ((*tcc_ptr)++ >= MAX_TAIL_CALL_CNT) * goto out; */ -EMIT2_off32 (0x8B ,0x85 , tcc_off);/* mov eax, dword ptr [rbp - tcc_off] */ -EMIT3 (0x83 ,0xF8 ,MAX_TAIL_CALL_CNT );/* cmp eax, MAX_TAIL_CALL_CNT */ +EMIT3_off32 (0x48 ,0x8B ,0x85 , tcc_ptr_off);/* mov rax, qword ptr [rbp - tcc_ptr_off] */ +EMIT4 (0x48 ,0x83 ,0x38 ,MAX_TAIL_CALL_CNT );/* cmp qword ptr [rax], MAX_TAIL_CALL_CNT */ offset = ctx->tail_call_indirect_label - (prog +2 - start);EMIT2 (X86_JAE , offset);/* jae out */ -EMIT3 (0x83 ,0xC0 ,0x01 );/* add eax, 1 */ -EMIT2_off32 (0x89 ,0x85 , tcc_off);/* mov dword ptr [rbp - tcc_off], eax */ /* prog = array->ptrs[index]; */ EMIT4_off32(0x48, 0x8B, 0x8C, 0xD6, /* mov rcx, [rsi + rdx * 8 + offsetof(...)] */
@@ -654,6 +685,9 @@ static void emit_bpf_tail_call_indirect(struct bpf_prog *bpf_prog, offset = ctx->tail_call_indirect_label - (prog +2 - start);EMIT2 (X86_JE , offset);/* je out */ +/* Inc tail_call_cnt if the slot is populated. */ +EMIT4 (0x48 ,0x83 ,0x00 ,0x01 );/* add qword ptr [rax], 1 */ +if (bpf_prog->aux->exception_boundary) {pop_callee_regs (&prog, all_callee_regs_used);pop_r12 (&prog);
@@ -663,6 +697,11 @@ static void emit_bpf_tail_call_indirect(struct bpf_prog *bpf_prog,pop_r12 (&prog); } +/* Pop tail_call_cnt_ptr. */ +EMIT1 (0x58 );/* pop rax */ +/* Pop tail_call_cnt, if it's main prog. +* Pop tail_call_cnt_ptr, if it's subprog. +*/ EMIT1 (0x58 );/* pop rax */ if (stack_depth) EMIT3_off32(0x48, 0x81, 0xC4, /* add rsp, sd */
@@ -691,21 +730,19 @@ static void emit_bpf_tail_call_direct(struct bpf_prog *bpf_prog, bool *callee_regs_used, u32 stack_depth, struct jit_context *ctx) { - int tcc_off = -4 - round_up(stack_depth, 8); + int tcc_ptr_off = BPF_TAIL_CALL_CNT_PTR_STACK_OFF(stack_depth);u8 *prog = *pprog, *start = *pprog;int offset;/* -* if (tail_call_cnt++ >= MAX_TAIL_CALL_CNT) +* if ((*tcc_ptr)++ >= MAX_TAIL_CALL_CNT) * goto out; */ -EMIT2_off32 (0x8B ,0x85 , tcc_off);/* mov eax, dword ptr [rbp - tcc_off] */ -EMIT3 (0x83 ,0xF8 ,MAX_TAIL_CALL_CNT );/* cmp eax, MAX_TAIL_CALL_CNT */ +EMIT3_off32 (0x48 ,0x8B ,0x85 , tcc_ptr_off);/* mov rax, qword ptr [rbp - tcc_ptr_off] */ +EMIT4 (0x48 ,0x83 ,0x38 ,MAX_TAIL_CALL_CNT );/* cmp qword ptr [rax], MAX_TAIL_CALL_CNT */ offset = ctx->tail_call_direct_label - (prog +2 - start);EMIT2 (X86_JAE , offset);/* jae out */ -EMIT3 (0x83 ,0xC0 ,0x01 );/* add eax, 1 */ -EMIT2_off32 (0x89 ,0x85 , tcc_off);/* mov dword ptr [rbp - tcc_off], eax */ poke->tailcall_bypass = ip + (prog - start); poke->adj_off =X86_TAIL_CALL_OFFSET ;
@@ -715,6 +752,9 @@ static void emit_bpf_tail_call_direct(struct bpf_prog *bpf_prog,emit_jump (&prog, (u8 *)poke->tailcall_target +X86_PATCH_SIZE , poke->tailcall_bypass); +/* Inc tail_call_cnt if the slot is populated. */ +EMIT4 (0x48 ,0x83 ,0x00 ,0x01 );/* add qword ptr [rax], 1 */ +if (bpf_prog->aux->exception_boundary) {pop_callee_regs (&prog, all_callee_regs_used);pop_r12 (&prog);
@@ -724,6 +764,11 @@ static void emit_bpf_tail_call_direct(struct bpf_prog *bpf_prog,pop_r12 (&prog); } +/* Pop tail_call_cnt_ptr. */ +EMIT1 (0x58 );/* pop rax */ +/* Pop tail_call_cnt, if it's main prog. +* Pop tail_call_cnt_ptr, if it's subprog. +*/ EMIT1 (0x58 );/* pop rax */ if (stack_depth)EMIT3_off32 (0x48 ,0x81 ,0xC4 ,round_up (stack_depth,8 ));
@@ -1311,9 +1356,11 @@ static void emit_shiftx(u8 **pprog, u32 dst_reg, u8 src_reg, bool is64, u8 op)#define INSN_SZ_DIFF (((addrs[i] - addrs[i - 1]) - (prog - temp))) -/* mov rax, qword ptr [rbp - rounded_stack_depth - 8] */ -#define RESTORE_TAIL_CALL_CNT (stack) \ - EMIT3_off32(0x48, 0x8B, 0x85, -round_up(stack, 8) - 8) +#define __LOAD_TCC_PTR (off) \ + EMIT3_off32(0x48, 0x8B, 0x85, off) +/* mov rax, qword ptr [rbp - rounded_stack_depth - 16] */ +#define LOAD_TAIL_CALL_CNT_PTR (stack) \ + __LOAD_TCC_PTR(BPF_TAIL_CALL_CNT_PTR_STACK_OFF(stack))static int do_jit (struct bpf_prog *bpf_prog,int *addrs,u8 *image,u8 *rw_image,int oldproglen,struct jit_context *ctx,bool jmp_padding)
@@ -2031,7 +2078,7 @@ st: if (is_imm8(insn->off)) func = (u8 *) __bpf_call_base + imm32;if (tail_call_reachable) { -RESTORE_TAIL_CALL_CNT (bpf_prog->aux->stack_depth); +LOAD_TAIL_CALL_CNT_PTR (bpf_prog->aux->stack_depth); ip +=7 ; }if (!imm32)
@@ -2706,6 +2753,10 @@ static int invoke_bpf_mod_ret(const struct btf_func_model *m, u8 **pprog,return 0 ; } +/* mov rax, qword ptr [rbp - rounded_stack_depth - 8] */ +#define LOAD_TRAMP_TAIL_CALL_CNT_PTR (stack) \ + __LOAD_TCC_PTR(-round_up(stack, 8) - 8) +/* Example: * __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev); * its 'struct btf_func_model' will be nr_args=2
@@ -2826,7 +2877,7 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *rw_im* [ ... ] * [ stack_arg2 ] * RBP - arg_stack_off [ stack_arg1 ] -* RSP [ tail_call_cnt ] BPF_TRAMP_F_TAIL_CALL_CTX +* RSP [ tail_call_cnt_ptr ] BPF_TRAMP_F_TAIL_CALL_CTX */ /* room for return value of orig_call or fentry prog */
@@ -2955,10 +3006,10 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *rw_imsave_args (m, &prog, arg_stack_off, true);if (flags &BPF_TRAMP_F_TAIL_CALL_CTX ) { -/* Before calling the original function, restore the -* tail_call_cnt from stack to rax. +/* Before calling the original function, load the +* tail_call_cnt_ptr from stack to rax. */ -RESTORE_TAIL_CALL_CNT (stack_size); +LOAD_TRAMP_TAIL_CALL_CNT_PTR (stack_size); }if (flags &BPF_TRAMP_F_ORIG_STACK ) {
@@ -3017,10 +3068,10 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *rw_im goto cleanup; } }else if (flags &BPF_TRAMP_F_TAIL_CALL_CTX ) { -/* Before running the original function, restore the -* tail_call_cnt from stack to rax. +/* Before running the original function, load the +* tail_call_cnt_ptr from stack to rax. */ -RESTORE_TAIL_CALL_CNT (stack_size); +LOAD_TRAMP_TAIL_CALL_CNT_PTR (stack_size); }/* restore return value of orig_call or fentry prog back into RAX */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 256/695 bpf, arm64: Fix tailcall hierarchy
In reply to Greg Kroah-Hartman6.11-stable review patch. If anyone has any objections, please let me know.
------------------
From: Leon Hwang <[email protected]>
[ Upstream commit 66ff4d61dc124eafe9efaeaef696a09b7f236da2 ]
This patch fixes a tailcall issue caused by abusing the tailcall in bpf2bpf feature on arm64 like the way of "bpf, x64: Fix tailcall hierarchy".
On arm64, when a tail call happens, it uses tail_call_cnt_ptr to increment tail_call_cnt, too.
At the prologue of main prog, it has to initialize tail_call_cnt and prepare tail_call_cnt_ptr.
At the prologue of subprog, it pushes x26 register twice, and does not initialize tail_call_cnt.
At the epilogue, it pops x26 twice, no matter whether it is main prog or subprog.
--- arch/arm64/net/bpf_jit_comp.c | 57 +++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 16 deletions(-)
arch/arm64/net/bpf_jit_comp.c +41 -16
@@ -26,7 +26,7 @@#define TMP_REG_1 (MAX_BPF_JIT_REG + 0)#define TMP_REG_2 (MAX_BPF_JIT_REG + 1) -#define TCALL_CNT (MAX_BPF_JIT_REG + 2) +#define TCCNT_PTR (MAX_BPF_JIT_REG + 2)#define TMP_REG_3 (MAX_BPF_JIT_REG + 3)#define FP_BOTTOM (MAX_BPF_JIT_REG + 4)#define ARENA_VM_START (MAX_BPF_JIT_REG + 5)
@@ -63,8 +63,8 @@ static const int bpf2a64[] = { [TMP_REG_1] = A64_R(10), [TMP_REG_2] = A64_R(11), [TMP_REG_3] = A64_R(12), -/* tail_call_cnt */ - [TCALL_CNT] = A64_R(26), +/* tail_call_cnt_ptr */ + [TCCNT_PTR] = A64_R(26),/* temporary register for blinding constants */ [BPF_REG_AX] = A64_R(9), [FP_BOTTOM] = A64_R(27),
@@ -282,13 +282,35 @@ static bool is_lsi_offset(int offset, int scale)* mov x29, sp * stp x19, x20, [sp, #-16]! * stp x21, x22, [sp, #-16]! -* stp x25, x26, [sp, #-16]! +* stp x26, x25, [sp, #-16]! +* stp x26, x25, [sp, #-16]! * stp x27, x28, [sp, #-16]! * mov x25, sp * mov tcc, #0 * // PROLOGUE_OFFSET */ +static void prepare_bpf_tail_call_cnt (struct jit_ctx *ctx) +{ +const struct bpf_prog *prog = ctx->prog; +const bool is_main_prog = !bpf_is_subprog (prog); +const u8 ptr = bpf2a64[TCCNT_PTR ]; +const u8 fp = bpf2a64[BPF_REG_FP ]; +const u8 tcc = ptr; + +emit (A64_PUSH (ptr, fp,A64_SP ), ctx); +if (is_main_prog) { +/* Initialize tail_call_cnt. */ +emit (A64_MOVZ (1 , tcc,0 ,0 ), ctx); +emit (A64_PUSH (tcc, fp,A64_SP ), ctx); +emit (A64_MOV (1 , ptr,A64_SP ), ctx); + }else { +emit (A64_PUSH (ptr, fp,A64_SP ), ctx); +emit (A64_NOP , ctx); +emit (A64_NOP , ctx); + } +} +#define BTI_INSNS (IS_ENABLED(CONFIG_ARM64_BTI_KERNEL) ? 1 : 0)#define PAC_INSNS (IS_ENABLED(CONFIG_ARM64_PTR_AUTH_KERNEL) ? 1 : 0)
@@ -296,7 +318,7 @@ static bool is_lsi_offset(int offset, int scale)#define POKE_OFFSET (BTI_INSNS + 1)/* Tail call offset to jump into */ -#define PROLOGUE_OFFSET (BTI_INSNS + 2 + PAC_INSNS + 8) +#define PROLOGUE_OFFSET (BTI_INSNS + 2 + PAC_INSNS + 10)static int build_prologue (struct jit_ctx *ctx,bool ebpf_from_cbpf,bool is_exception_cb,u64 arena_vm_start)
@@ -308,7 +330,6 @@ static int build_prologue(struct jit_ctx *ctx, bool ebpf_from_cbpf,const u8 r8 = bpf2a64[BPF_REG_8 ];const u8 r9 = bpf2a64[BPF_REG_9 ];const u8 fp = bpf2a64[BPF_REG_FP ]; -const u8 tcc = bpf2a64[TCALL_CNT ];const u8 fpb = bpf2a64[FP_BOTTOM ];const u8 arena_vm_base = bpf2a64[ARENA_VM_START ];const int idx0 = ctx->idx;
@@ -359,7 +380,7 @@ static int build_prologue(struct jit_ctx *ctx, bool ebpf_from_cbpf,/* Save callee-saved registers */ emit (A64_PUSH (r6, r7,A64_SP ), ctx);emit (A64_PUSH (r8, r9,A64_SP ), ctx); -emit (A64_PUSH (fp, tcc,A64_SP ), ctx); +prepare_bpf_tail_call_cnt (ctx);emit (A64_PUSH (fpb,A64_R (28 ),A64_SP ), ctx); }else {/*
@@ -372,18 +393,15 @@ static int build_prologue(struct jit_ctx *ctx, bool ebpf_from_cbpf,* callee-saved registers. The exception callback will not push * anything and re-use the main program's stack. * -* 10 registers are on the stack +* 12 registers are on the stack */ -emit (A64_SUB_I (1 ,A64_SP ,A64_FP ,80 ), ctx); +emit (A64_SUB_I (1 ,A64_SP ,A64_FP ,96 ), ctx); }/* Set up BPF prog stack base register */ emit (A64_MOV (1 , fp,A64_SP ), ctx);if (!ebpf_from_cbpf && is_main_prog) { -/* Initialize tail_call_cnt */ -emit (A64_MOVZ (1 , tcc,0 ,0 ), ctx); - cur_offset = ctx->idx - idx0;if (cur_offset !=PROLOGUE_OFFSET ) { pr_err_once("PROLOGUE_OFFSET = %d, expected %d!\n",
@@ -432,7 +450,8 @@ static int emit_bpf_tail_call(struct jit_ctx *ctx)const u8 tmp = bpf2a64[TMP_REG_1 ];const u8 prg = bpf2a64[TMP_REG_2 ]; -const u8 tcc = bpf2a64[TCALL_CNT ]; +const u8 tcc = bpf2a64[TMP_REG_3 ]; +const u8 ptr = bpf2a64[TCCNT_PTR ];const int idx0 = ctx->idx;#define cur_offset (ctx->idx - idx0)#define jmp_offset (out_offset - (cur_offset))
@@ -449,11 +468,12 @@ static int emit_bpf_tail_call(struct jit_ctx *ctx)emit (A64_B_ (A64_COND_CS , jmp_offset), ctx);/* -* if (tail_call_cnt >= MAX_TAIL_CALL_CNT) +* if ((*tail_call_cnt_ptr) >= MAX_TAIL_CALL_CNT) * goto out; -* tail_call_cnt++; +* (*tail_call_cnt_ptr)++; */ emit_a64_mov_i64 (tmp,MAX_TAIL_CALL_CNT , ctx); +emit (A64_LDR64I (tcc, ptr,0 ), ctx);emit (A64_CMP (1 , tcc, tmp), ctx);emit (A64_B_ (A64_COND_CS , jmp_offset), ctx);emit (A64_ADD_I (1 , tcc, tcc,1 ), ctx);
@@ -469,6 +489,9 @@ static int emit_bpf_tail_call(struct jit_ctx *ctx)emit (A64_LDR64 (prg, tmp, prg), ctx);emit (A64_CBZ (1 , prg, jmp_offset), ctx); +/* Update tail_call_cnt if the slot is populated. */ +emit (A64_STR64I (tcc, ptr,0 ), ctx); +/* goto *(prog->bpf_func + prologue_offset); */ off = offsetof(struct bpf_prog , bpf_func);emit_a64_mov_i64 (tmp, off, ctx);
@@ -721,6 +744,7 @@ static void build_epilogue(struct jit_ctx *ctx, bool is_exception_cb)const u8 r8 = bpf2a64[BPF_REG_8 ];const u8 r9 = bpf2a64[BPF_REG_9 ];const u8 fp = bpf2a64[BPF_REG_FP ]; +const u8 ptr = bpf2a64[TCCNT_PTR ];const u8 fpb = bpf2a64[FP_BOTTOM ];/* We're done with BPF stack */
@@ -738,7 +762,8 @@ static void build_epilogue(struct jit_ctx *ctx, bool is_exception_cb)/* Restore x27 and x28 */ emit (A64_POP (fpb,A64_R (28 ),A64_SP ), ctx);/* Restore fs (x25) and x26 */ -emit (A64_POP (fp,A64_R (26 ),A64_SP ), ctx); +emit (A64_POP (ptr, fp,A64_SP ), ctx); +emit (A64_POP (ptr, fp,A64_SP ), ctx);/* Restore callee-saved register */ emit (A64_POP (r8, r9,A64_SP ), ctx);
Signature · 1 line
2.43.0