From: Sasha Levin Date: Fri, 12 May 2023 06:32:35 +0000 (-0400) Subject: Fixes for 6.2 X-Git-Tag: v4.14.315~108 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9d4005800a4cc7d9deb2dc723724b14893c02690;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 6.2 Signed-off-by: Sasha Levin --- diff --git a/queue-6.2/af_packet-don-t-send-zero-byte-data-in-packet_sendms.patch b/queue-6.2/af_packet-don-t-send-zero-byte-data-in-packet_sendms.patch new file mode 100644 index 00000000000..8181dce90e1 --- /dev/null +++ b/queue-6.2/af_packet-don-t-send-zero-byte-data-in-packet_sendms.patch @@ -0,0 +1,111 @@ +From 315f68dbae733eb8b1e9314e375d61dfad76a39b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 1 May 2023 13:28:57 -0700 +Subject: af_packet: Don't send zero-byte data in packet_sendmsg_spkt(). + +From: Kuniyuki Iwashima + +[ Upstream commit 6a341729fb31b4c5df9f74f24b4b1c98410c9b87 ] + +syzkaller reported a warning below [0]. + +We can reproduce it by sending 0-byte data from the (AF_PACKET, +SOCK_PACKET) socket via some devices whose dev->hard_header_len +is 0. + + struct sockaddr_pkt addr = { + .spkt_family = AF_PACKET, + .spkt_device = "tun0", + }; + int fd; + + fd = socket(AF_PACKET, SOCK_PACKET, 0); + sendto(fd, NULL, 0, 0, (struct sockaddr *)&addr, sizeof(addr)); + +We have a similar fix for the (AF_PACKET, SOCK_RAW) socket as +commit dc633700f00f ("net/af_packet: check len when min_header_len +equals to 0"). + +Let's add the same test for the SOCK_PACKET socket. + +[0]: +skb_assert_len +WARNING: CPU: 1 PID: 19945 at include/linux/skbuff.h:2552 skb_assert_len include/linux/skbuff.h:2552 [inline] +WARNING: CPU: 1 PID: 19945 at include/linux/skbuff.h:2552 __dev_queue_xmit+0x1f26/0x31d0 net/core/dev.c:4159 +Modules linked in: +CPU: 1 PID: 19945 Comm: syz-executor.0 Not tainted 6.3.0-rc7-02330-gca6270c12e20 #1 +Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014 +RIP: 0010:skb_assert_len include/linux/skbuff.h:2552 [inline] +RIP: 0010:__dev_queue_xmit+0x1f26/0x31d0 net/core/dev.c:4159 +Code: 89 de e8 1d a2 85 fd 84 db 75 21 e8 64 a9 85 fd 48 c7 c6 80 2a 1f 86 48 c7 c7 c0 06 1f 86 c6 05 23 cf 27 04 01 e8 fa ee 56 fd <0f> 0b e8 43 a9 85 fd 0f b6 1d 0f cf 27 04 31 ff 89 de e8 e3 a1 85 +RSP: 0018:ffff8880217af6e0 EFLAGS: 00010282 +RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffc90001133000 +RDX: 0000000000040000 RSI: ffffffff81186922 RDI: 0000000000000001 +RBP: ffff8880217af8b0 R08: 0000000000000001 R09: 0000000000000000 +R10: 0000000000000001 R11: 0000000000000001 R12: ffff888030045640 +R13: ffff8880300456b0 R14: ffff888030045650 R15: ffff888030045718 +FS: 00007fc5864da640(0000) GS:ffff88806cd00000(0000) knlGS:0000000000000000 +CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 +CR2: 0000000020005740 CR3: 000000003f856003 CR4: 0000000000770ee0 +DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 +DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 +PKRU: 55555554 +Call Trace: + + dev_queue_xmit include/linux/netdevice.h:3085 [inline] + packet_sendmsg_spkt+0xc4b/0x1230 net/packet/af_packet.c:2066 + sock_sendmsg_nosec net/socket.c:724 [inline] + sock_sendmsg+0x1b4/0x200 net/socket.c:747 + ____sys_sendmsg+0x331/0x970 net/socket.c:2503 + ___sys_sendmsg+0x11d/0x1c0 net/socket.c:2557 + __sys_sendmmsg+0x18c/0x430 net/socket.c:2643 + __do_sys_sendmmsg net/socket.c:2672 [inline] + __se_sys_sendmmsg net/socket.c:2669 [inline] + __x64_sys_sendmmsg+0x9c/0x100 net/socket.c:2669 + do_syscall_x64 arch/x86/entry/common.c:50 [inline] + do_syscall_64+0x3c/0x90 arch/x86/entry/common.c:80 + entry_SYSCALL_64_after_hwframe+0x72/0xdc +RIP: 0033:0x7fc58791de5d +Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 73 9f 1b 00 f7 d8 64 89 01 48 +RSP: 002b:00007fc5864d9cc8 EFLAGS: 00000246 ORIG_RAX: 0000000000000133 +RAX: ffffffffffffffda RBX: 00000000004bbf80 RCX: 00007fc58791de5d +RDX: 0000000000000001 RSI: 0000000020005740 RDI: 0000000000000004 +RBP: 00000000004bbf80 R08: 0000000000000000 R09: 0000000000000000 +R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 +R13: 000000000000000b R14: 00007fc58797e530 R15: 0000000000000000 + +---[ end trace 0000000000000000 ]--- +skb len=0 headroom=16 headlen=0 tailroom=304 +mac=(16,0) net=(16,-1) trans=-1 +shinfo(txflags=0 nr_frags=0 gso(size=0 type=0 segs=0)) +csum(0x0 ip_summed=0 complete_sw=0 valid=0 level=0) +hash(0x0 sw=0 l4=0) proto=0x0000 pkttype=0 iif=0 +dev name=sit0 feat=0x00000006401d7869 +sk family=17 type=10 proto=0 + +Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") +Reported-by: syzbot +Signed-off-by: Kuniyuki Iwashima +Reviewed-by: Willem de Bruijn +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/packet/af_packet.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c +index 1259b34a28ebe..cc7a42ba94f93 100644 +--- a/net/packet/af_packet.c ++++ b/net/packet/af_packet.c +@@ -2036,7 +2036,7 @@ static int packet_sendmsg_spkt(struct socket *sock, struct msghdr *msg, + goto retry; + } + +- if (!dev_validate_header(dev, skb->data, len)) { ++ if (!dev_validate_header(dev, skb->data, len) || !skb->len) { + err = -EINVAL; + goto out_unlock; + } +-- +2.39.2 + diff --git a/queue-6.2/alsa-caiaq-input-add-error-handling-for-unsupported-.patch b/queue-6.2/alsa-caiaq-input-add-error-handling-for-unsupported-.patch new file mode 100644 index 00000000000..2d35cfc8cb9 --- /dev/null +++ b/queue-6.2/alsa-caiaq-input-add-error-handling-for-unsupported-.patch @@ -0,0 +1,44 @@ +From b640c8a55792fd3f523a561e2376014a2a097f4c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 4 May 2023 14:50:53 +0800 +Subject: ALSA: caiaq: input: Add error handling for unsupported input methods + in `snd_usb_caiaq_input_init` + +From: Ruliang Lin + +[ Upstream commit 0d727e1856ef22dd9337199430258cb64cbbc658 ] + +Smatch complains that: +snd_usb_caiaq_input_init() warn: missing error code 'ret' + +This patch adds a new case to handle the situation where the +device does not support any input methods in the +`snd_usb_caiaq_input_init` function. It returns an `-EINVAL` error code +to indicate that no input methods are supported on the device. + +Fixes: 523f1dce3743 ("[ALSA] Add Native Instrument usb audio device support") +Signed-off-by: Ruliang Lin +Reviewed-by: Dongliang Mu +Acked-by: Daniel Mack +Link: https://lore.kernel.org/r/20230504065054.3309-1-u202112092@hust.edu.cn +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/usb/caiaq/input.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/sound/usb/caiaq/input.c b/sound/usb/caiaq/input.c +index 1e2cf2f08eecd..84f26dce7f5d0 100644 +--- a/sound/usb/caiaq/input.c ++++ b/sound/usb/caiaq/input.c +@@ -804,6 +804,7 @@ int snd_usb_caiaq_input_init(struct snd_usb_caiaqdev *cdev) + + default: + /* no input methods supported on this device */ ++ ret = -EINVAL; + goto exit_free_idev; + } + +-- +2.39.2 + diff --git a/queue-6.2/asoc-intel-soc-acpi-byt-fix-wm510205-match-no-longer.patch b/queue-6.2/asoc-intel-soc-acpi-byt-fix-wm510205-match-no-longer.patch new file mode 100644 index 00000000000..a66c3d66d54 --- /dev/null +++ b/queue-6.2/asoc-intel-soc-acpi-byt-fix-wm510205-match-no-longer.patch @@ -0,0 +1,42 @@ +From 84f87bfd2dbc66645991fa0d3ee723c31fcde44d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Apr 2023 20:37:14 +0200 +Subject: ASoC: Intel: soc-acpi-byt: Fix "WM510205" match no longer working + +From: Hans de Goede + +[ Upstream commit c963e2ec095cb3f855890be53f56f5a6c6fbe371 ] + +Commit 7e1d728a94ca ("ASoC: Intel: soc-acpi-byt: Add new WM5102 ACPI HID") +added an extra HID to wm5102_comp_ids.codecs, but it forgot to bump +wm5102_comp_ids.num_codecs, causing the last codec HID in the codecs list +to no longer work. + +Bump wm5102_comp_ids.num_codecs to fix this. + +Fixes: 7e1d728a94ca ("ASoC: Intel: soc-acpi-byt: Add new WM5102 ACPI HID") +Signed-off-by: Hans de Goede +Acked-by: Pierre-Louis Bossart +Link: https://lore.kernel.org/r/20230421183714.35186-1-hdegoede@redhat.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/intel/common/soc-acpi-intel-byt-match.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sound/soc/intel/common/soc-acpi-intel-byt-match.c b/sound/soc/intel/common/soc-acpi-intel-byt-match.c +index db5a92b9875a8..87c44f284971a 100644 +--- a/sound/soc/intel/common/soc-acpi-intel-byt-match.c ++++ b/sound/soc/intel/common/soc-acpi-intel-byt-match.c +@@ -124,7 +124,7 @@ static const struct snd_soc_acpi_codecs rt5640_comp_ids = { + }; + + static const struct snd_soc_acpi_codecs wm5102_comp_ids = { +- .num_codecs = 2, ++ .num_codecs = 3, + .codecs = { "10WM5102", "WM510204", "WM510205"}, + }; + +-- +2.39.2 + diff --git a/queue-6.2/block-skip-destroyed-blkg-when-restart-in-blkg_destr.patch b/queue-6.2/block-skip-destroyed-blkg-when-restart-in-blkg_destr.patch new file mode 100644 index 00000000000..0f6475c1a51 --- /dev/null +++ b/queue-6.2/block-skip-destroyed-blkg-when-restart-in-blkg_destr.patch @@ -0,0 +1,48 @@ +From eaeb212b688ff5e2e98acc4f5f6c5a9be7723230 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 28 Apr 2023 12:51:49 +0800 +Subject: block: Skip destroyed blkg when restart in blkg_destroy_all() + +From: Tao Su + +[ Upstream commit 8176080d59e6d4ff9fc97ae534063073b4f7a715 ] + +Kernel hang in blkg_destroy_all() when total blkg greater than +BLKG_DESTROY_BATCH_SIZE, because of not removing destroyed blkg in +blkg_list. So the size of blkg_list is same after destroying a +batch of blkg, and the infinite 'restart' occurs. + +Since blkg should stay on the queue list until blkg_free_workfn(), +skip destroyed blkg when restart a new round, which will solve this +kernel hang issue and satisfy the previous will to restart. + +Reported-by: Xiangfei Ma +Tested-by: Xiangfei Ma +Tested-by: Farrah Chen +Signed-off-by: Tao Su +Fixes: f1c006f1c685 ("blk-cgroup: synchronize pd_free_fn() from blkg_free_workfn() and blkcg_deactivate_policy()") +Suggested-and-reviewed-by: Yu Kuai +Link: https://lore.kernel.org/r/20230428045149.1310073-1-tao1.su@linux.intel.com +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + block/blk-cgroup.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c +index 9ac1efb053e08..2d8a28e4e22f7 100644 +--- a/block/blk-cgroup.c ++++ b/block/blk-cgroup.c +@@ -501,6 +501,9 @@ static void blkg_destroy_all(struct gendisk *disk) + list_for_each_entry_safe(blkg, n, &q->blkg_list, q_node) { + struct blkcg *blkcg = blkg->blkcg; + ++ if (hlist_unhashed(&blkg->blkcg_node)) ++ continue; ++ + spin_lock(&blkcg->lock); + blkg_destroy(blkg); + spin_unlock(&blkcg->lock); +-- +2.39.2 + diff --git a/queue-6.2/crypto-api-add-scaffolding-to-change-completion-func.patch b/queue-6.2/crypto-api-add-scaffolding-to-change-completion-func.patch new file mode 100644 index 00000000000..335b3cda06f --- /dev/null +++ b/queue-6.2/crypto-api-add-scaffolding-to-change-completion-func.patch @@ -0,0 +1,79 @@ +From b706c3e9325a71e8f3c86250bf171aae19dbde14 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 31 Jan 2023 16:01:45 +0800 +Subject: crypto: api - Add scaffolding to change completion function signature + +From: Herbert Xu + +[ Upstream commit c35e03eaece71101ff6cbf776b86403860ac8cc3 ] + +The crypto completion function currently takes a pointer to a +struct crypto_async_request object. However, in reality the API +does not allow the use of any part of the object apart from the +data field. For example, ahash/shash will create a fake object +on the stack to pass along a different data field. + +This leads to potential bugs where the user may try to dereference +or otherwise use the crypto_async_request object. + +This patch adds some temporary scaffolding so that the completion +function can take a void * instead. Once affected users have been +converted this can be removed. + +The helper crypto_request_complete will remain even after the +conversion is complete. It should be used instead of calling +the completion function directly. + +Signed-off-by: Herbert Xu +Reviewed-by: Giovanni Cabiddu +Signed-off-by: Herbert Xu +Stable-dep-of: 4140aafcff16 ("crypto: engine - fix crypto_queue backlog handling") +Signed-off-by: Sasha Levin +--- + include/crypto/algapi.h | 7 +++++++ + include/linux/crypto.h | 6 ++++++ + 2 files changed, 13 insertions(+) + +diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h +index 61b327206b557..1fd81e74a174f 100644 +--- a/include/crypto/algapi.h ++++ b/include/crypto/algapi.h +@@ -302,4 +302,11 @@ enum { + CRYPTO_MSG_ALG_LOADED, + }; + ++static inline void crypto_request_complete(struct crypto_async_request *req, ++ int err) ++{ ++ crypto_completion_t complete = req->complete; ++ complete(req, err); ++} ++ + #endif /* _CRYPTO_ALGAPI_H */ +diff --git a/include/linux/crypto.h b/include/linux/crypto.h +index 5d1e961f810ec..b18f6e669fb10 100644 +--- a/include/linux/crypto.h ++++ b/include/linux/crypto.h +@@ -176,6 +176,7 @@ struct crypto_async_request; + struct crypto_tfm; + struct crypto_type; + ++typedef struct crypto_async_request crypto_completion_data_t; + typedef void (*crypto_completion_t)(struct crypto_async_request *req, int err); + + /** +@@ -595,6 +596,11 @@ struct crypto_wait { + /* + * Async ops completion helper functioons + */ ++static inline void *crypto_get_completion_data(crypto_completion_data_t *req) ++{ ++ return req->data; ++} ++ + void crypto_req_done(struct crypto_async_request *req, int err); + + static inline int crypto_wait_req(int err, struct crypto_wait *wait) +-- +2.39.2 + diff --git a/queue-6.2/crypto-engine-fix-crypto_queue-backlog-handling.patch b/queue-6.2/crypto-engine-fix-crypto_queue-backlog-handling.patch new file mode 100644 index 00000000000..f461be64c03 --- /dev/null +++ b/queue-6.2/crypto-engine-fix-crypto_queue-backlog-handling.patch @@ -0,0 +1,87 @@ +From 271804fc1a893883555eff0c60eb937057ca8aa5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 Apr 2023 11:00:35 -0400 +Subject: crypto: engine - fix crypto_queue backlog handling + +From: Olivier Bacon + +[ Upstream commit 4140aafcff167b5b9e8dae6a1709a6de7cac6f74 ] + +CRYPTO_TFM_REQ_MAY_BACKLOG tells the crypto driver that it should +internally backlog requests until the crypto hw's queue becomes +full. At that point, crypto_engine backlogs the request and returns +-EBUSY. Calling driver such as dm-crypt then waits until the +complete() function is called with a status of -EINPROGRESS before +sending a new request. + +The problem lies in the call to complete() with a value of -EINPROGRESS +that is made when a backlog item is present on the queue. The call is +done before the successful execution of the crypto request. In the case +that do_one_request() returns < 0 and the retry support is available, +the request is put back in the queue. This leads upper drivers to send +a new request even if the queue is still full. + +The problem can be reproduced by doing a large dd into a crypto +dm-crypt device. This is pretty easy to see when using +Freescale CAAM crypto driver and SWIOTLB dma. Since the actual amount +of requests that can be hold in the queue is unlimited we get IOs error +and dma allocation. + +The fix is to call complete with a value of -EINPROGRESS only if +the request is not enqueued back in crypto_queue. This is done +by calling complete() later in the code. In order to delay the decision, +crypto_queue is modified to correctly set the backlog pointer +when a request is enqueued back. + +Fixes: 6a89f492f8e5 ("crypto: engine - support for parallel requests based on retry mechanism") +Co-developed-by: Sylvain Ouellet +Signed-off-by: Sylvain Ouellet +Signed-off-by: Olivier Bacon +Signed-off-by: Herbert Xu +Signed-off-by: Sasha Levin +--- + crypto/algapi.c | 3 +++ + crypto/crypto_engine.c | 6 +++--- + 2 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/crypto/algapi.c b/crypto/algapi.c +index 9de0677b3643d..60b98d2c400e3 100644 +--- a/crypto/algapi.c ++++ b/crypto/algapi.c +@@ -963,6 +963,9 @@ EXPORT_SYMBOL_GPL(crypto_enqueue_request); + void crypto_enqueue_request_head(struct crypto_queue *queue, + struct crypto_async_request *request) + { ++ if (unlikely(queue->qlen >= queue->max_qlen)) ++ queue->backlog = queue->backlog->prev; ++ + queue->qlen++; + list_add(&request->list, &queue->list); + } +diff --git a/crypto/crypto_engine.c b/crypto/crypto_engine.c +index 48c15f4079bb8..50bac2ab55f17 100644 +--- a/crypto/crypto_engine.c ++++ b/crypto/crypto_engine.c +@@ -129,9 +129,6 @@ static void crypto_pump_requests(struct crypto_engine *engine, + if (!engine->retry_support) + engine->cur_req = async_req; + +- if (backlog) +- crypto_request_complete(backlog, -EINPROGRESS); +- + if (engine->busy) + was_busy = true; + else +@@ -217,6 +214,9 @@ static void crypto_pump_requests(struct crypto_engine *engine, + crypto_request_complete(async_req, ret); + + retry: ++ if (backlog) ++ crypto_request_complete(backlog, -EINPROGRESS); ++ + /* If retry mechanism is supported, send new requests to engine */ + if (engine->retry_support) { + spin_lock_irqsave(&engine->queue_lock, flags); +-- +2.39.2 + diff --git a/queue-6.2/crypto-engine-use-crypto_request_complete.patch b/queue-6.2/crypto-engine-use-crypto_request_complete.patch new file mode 100644 index 00000000000..da014df07c8 --- /dev/null +++ b/queue-6.2/crypto-engine-use-crypto_request_complete.patch @@ -0,0 +1,53 @@ +From c6d3e3c3138a7b5ef8f594d90007bb58b6a09a78 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 31 Jan 2023 16:02:02 +0800 +Subject: crypto: engine - Use crypto_request_complete + +From: Herbert Xu + +[ Upstream commit 6909823d47c17cba84e9244d04050b5db8d53789 ] + +Use the crypto_request_complete helper instead of calling the +completion function directly. + +Signed-off-by: Herbert Xu +Stable-dep-of: 4140aafcff16 ("crypto: engine - fix crypto_queue backlog handling") +Signed-off-by: Sasha Levin +--- + crypto/crypto_engine.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/crypto/crypto_engine.c b/crypto/crypto_engine.c +index bb8e77077f020..48c15f4079bb8 100644 +--- a/crypto/crypto_engine.c ++++ b/crypto/crypto_engine.c +@@ -54,7 +54,7 @@ static void crypto_finalize_request(struct crypto_engine *engine, + } + } + lockdep_assert_in_softirq(); +- req->complete(req, err); ++ crypto_request_complete(req, err); + + kthread_queue_work(engine->kworker, &engine->pump_requests); + } +@@ -130,7 +130,7 @@ static void crypto_pump_requests(struct crypto_engine *engine, + engine->cur_req = async_req; + + if (backlog) +- backlog->complete(backlog, -EINPROGRESS); ++ crypto_request_complete(backlog, -EINPROGRESS); + + if (engine->busy) + was_busy = true; +@@ -214,7 +214,7 @@ static void crypto_pump_requests(struct crypto_engine *engine, + } + + req_err_2: +- async_req->complete(async_req, ret); ++ crypto_request_complete(async_req, ret); + + retry: + /* If retry mechanism is supported, send new requests to engine */ +-- +2.39.2 + diff --git a/queue-6.2/crypto-sun8i-ss-fix-a-test-in-sun8i_ss_setup_ivs.patch b/queue-6.2/crypto-sun8i-ss-fix-a-test-in-sun8i_ss_setup_ivs.patch new file mode 100644 index 00000000000..0728ae2bd5a --- /dev/null +++ b/queue-6.2/crypto-sun8i-ss-fix-a-test-in-sun8i_ss_setup_ivs.patch @@ -0,0 +1,38 @@ +From f9e0669dee1e524b50ba68d277a3d3f560933c69 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 17 Apr 2023 22:25:09 +0200 +Subject: crypto: sun8i-ss - Fix a test in sun8i_ss_setup_ivs() + +From: Christophe JAILLET + +[ Upstream commit 8fd91151ebcb21b3f2f2bf158ac6092192550b2b ] + +SS_ENCRYPTION is (0 << 7 = 0), so the test can never be true. +Use a direct comparison to SS_ENCRYPTION instead. + +The same king of test is already done the same way in sun8i_ss_run_task(). + +Fixes: 359e893e8af4 ("crypto: sun8i-ss - rework handling of IV") +Signed-off-by: Christophe JAILLET +Signed-off-by: Herbert Xu +Signed-off-by: Sasha Levin +--- + drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c +index 902f6be057ec6..e97fb203690ae 100644 +--- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c ++++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c +@@ -151,7 +151,7 @@ static int sun8i_ss_setup_ivs(struct skcipher_request *areq) + } + rctx->p_iv[i] = a; + /* we need to setup all others IVs only in the decrypt way */ +- if (rctx->op_dir & SS_ENCRYPTION) ++ if (rctx->op_dir == SS_ENCRYPTION) + return 0; + todo = min(len, sg_dma_len(sg)); + len -= todo; +-- +2.39.2 + diff --git a/queue-6.2/drm-amd-display-add-missing-wa-and-mclk-validation.patch b/queue-6.2/drm-amd-display-add-missing-wa-and-mclk-validation.patch new file mode 100644 index 00000000000..f7def0e8368 --- /dev/null +++ b/queue-6.2/drm-amd-display-add-missing-wa-and-mclk-validation.patch @@ -0,0 +1,89 @@ +From b4c1d6e751096a8c30aed9da2d405eaa2fee03f2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 4 Apr 2023 14:54:05 -0600 +Subject: drm/amd/display: Add missing WA and MCLK validation + +From: Rodrigo Siqueira + +[ Upstream commit 822b84ecfc646da0f87fd947fa00dc3be5e45ecc ] + +When the commit fff7eb56b376 ("drm/amd/display: Don't set dram clock +change requirement for SubVP") was merged, we missed some parts +associated with the MCLK switch. This commit adds all the missing parts. + +Fixes: fff7eb56b376 ("drm/amd/display: Don't set dram clock change requirement for SubVP") +Reviewed-by: Aurabindo Pillai +Signed-off-by: Rodrigo Siqueira +Tested-by: Daniel Wheeler +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + .../gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c | 1 + + .../drm/amd/display/dc/dcn32/dcn32_resource.c | 2 +- + .../drm/amd/display/dc/dml/dcn30/dcn30_fpu.c | 18 +++++++++++++++++- + 3 files changed, 19 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c +index 30d15a94f720d..578a715040ac3 100644 +--- a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c ++++ b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c +@@ -992,6 +992,7 @@ void dcn32_init_hw(struct dc *dc) + if (dc->ctx->dmub_srv) { + dc_dmub_srv_query_caps_cmd(dc->ctx->dmub_srv->dmub); + dc->caps.dmub_caps.psr = dc->ctx->dmub_srv->dmub->feature_caps.psr; ++ dc->caps.dmub_caps.mclk_sw = dc->ctx->dmub_srv->dmub->feature_caps.fw_assisted_mclk_switch; + } + } + +diff --git a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c +index 6187aba1362b8..41c3620546c2b 100644 +--- a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c ++++ b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c +@@ -2021,7 +2021,7 @@ int dcn32_populate_dml_pipes_from_context( + // In general cases we want to keep the dram clock change requirement + // (prefer configs that support MCLK switch). Only override to false + // for SubVP +- if (subvp_in_use) ++ if (context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching || subvp_in_use) + context->bw_ctx.dml.soc.dram_clock_change_requirement_final = false; + else + context->bw_ctx.dml.soc.dram_clock_change_requirement_final = true; +diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn30/dcn30_fpu.c b/drivers/gpu/drm/amd/display/dc/dml/dcn30/dcn30_fpu.c +index 4fa6363647937..fdfb19337ea6e 100644 +--- a/drivers/gpu/drm/amd/display/dc/dml/dcn30/dcn30_fpu.c ++++ b/drivers/gpu/drm/amd/display/dc/dml/dcn30/dcn30_fpu.c +@@ -368,7 +368,9 @@ void dcn30_fpu_update_soc_for_wm_a(struct dc *dc, struct dc_state *context) + dc_assert_fp_enabled(); + + if (dc->clk_mgr->bw_params->wm_table.nv_entries[WM_A].valid) { +- context->bw_ctx.dml.soc.dram_clock_change_latency_us = dc->clk_mgr->bw_params->wm_table.nv_entries[WM_A].dml_input.pstate_latency_us; ++ if (!context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching || ++ context->bw_ctx.dml.soc.dram_clock_change_latency_us == 0) ++ context->bw_ctx.dml.soc.dram_clock_change_latency_us = dc->clk_mgr->bw_params->wm_table.nv_entries[WM_A].dml_input.pstate_latency_us; + context->bw_ctx.dml.soc.sr_enter_plus_exit_time_us = dc->clk_mgr->bw_params->wm_table.nv_entries[WM_A].dml_input.sr_enter_plus_exit_time_us; + context->bw_ctx.dml.soc.sr_exit_time_us = dc->clk_mgr->bw_params->wm_table.nv_entries[WM_A].dml_input.sr_exit_time_us; + } +@@ -520,6 +522,20 @@ void dcn30_fpu_calculate_wm_and_dlg( + pipe_idx++; + } + ++ // WA: restrict FPO to use first non-strobe mode (NV24 BW issue) ++ if (context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching && ++ dc->dml.soc.num_chans <= 4 && ++ context->bw_ctx.dml.vba.DRAMSpeed <= 1700 && ++ context->bw_ctx.dml.vba.DRAMSpeed >= 1500) { ++ ++ for (i = 0; i < dc->dml.soc.num_states; i++) { ++ if (dc->dml.soc.clock_limits[i].dram_speed_mts > 1700) { ++ context->bw_ctx.dml.vba.DRAMSpeed = dc->dml.soc.clock_limits[i].dram_speed_mts; ++ break; ++ } ++ } ++ } ++ + dcn20_calculate_dlg_params(dc, context, pipes, pipe_cnt, vlevel); + + if (!pstate_en) +-- +2.39.2 + diff --git a/queue-6.2/drm-amd-display-do-not-clear-gpint-register-when-rel.patch b/queue-6.2/drm-amd-display-do-not-clear-gpint-register-when-rel.patch new file mode 100644 index 00000000000..b5e572c0245 --- /dev/null +++ b/queue-6.2/drm-amd-display-do-not-clear-gpint-register-when-rel.patch @@ -0,0 +1,39 @@ +From a52cd4dcee7d486f26117c1fc44ada59f3657c7c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 6 Apr 2023 15:48:48 -0400 +Subject: drm/amd/display: Do not clear GPINT register when releasing DMUB from + reset + +From: Aurabindo Pillai + +[ Upstream commit 99d92eaca5d915763b240aae24669f5bf3227ecf ] + +[Why & How] +There's no need to clear GPINT register for DMUB +when releasing it from reset. Fix that. + +Fixes: ac2e555e0a7f ("drm/amd/display: Add DMCUB source files and changes for DCN32/321") +Reviewed-by: Leo Li +Signed-off-by: Aurabindo Pillai +Tested-by: Daniel Wheeler +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/display/dmub/src/dmub_dcn32.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/gpu/drm/amd/display/dmub/src/dmub_dcn32.c b/drivers/gpu/drm/amd/display/dmub/src/dmub_dcn32.c +index b0adbf783aae9..9c20516be066c 100644 +--- a/drivers/gpu/drm/amd/display/dmub/src/dmub_dcn32.c ++++ b/drivers/gpu/drm/amd/display/dmub/src/dmub_dcn32.c +@@ -137,7 +137,6 @@ void dmub_dcn32_reset(struct dmub_srv *dmub) + + void dmub_dcn32_reset_release(struct dmub_srv *dmub) + { +- REG_WRITE(DMCUB_GPINT_DATAIN1, 0); + REG_UPDATE(MMHUBBUB_SOFT_RESET, DMUIF_SOFT_RESET, 0); + REG_WRITE(DMCUB_SCRATCH15, dmub->psp_version & 0x001100FF); + REG_UPDATE_2(DMCUB_CNTL, DMCUB_ENABLE, 1, DMCUB_TRACEPORT_EN, 1); +-- +2.39.2 + diff --git a/queue-6.2/drm-amd-display-fixes-for-dcn32_clk_mgr-implementati.patch b/queue-6.2/drm-amd-display-fixes-for-dcn32_clk_mgr-implementati.patch new file mode 100644 index 00000000000..dd7b9fc406b --- /dev/null +++ b/queue-6.2/drm-amd-display-fixes-for-dcn32_clk_mgr-implementati.patch @@ -0,0 +1,56 @@ +From 918952a45a8b1f2c059e76a36a2363b3c0cf8672 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 6 Apr 2023 12:28:59 -0400 +Subject: drm/amd/display: Fixes for dcn32_clk_mgr implementation + +From: Aurabindo Pillai + +[ Upstream commit d1c5c3e252b8a911a524e6ee33b82aca81397745 ] + +[Why&How] +Fix CLK MGR early initialization and add logging. + +Fixes: 265280b99822 ("drm/amd/display: add CLKMGR changes for DCN32/321") +Reviewed-by: Leo Li +Reviewed-by: Qingqing Zhuo +Signed-off-by: Aurabindo Pillai +Tested-by: Daniel Wheeler +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c +index 200fcec191861..1859b2e4a98a1 100644 +--- a/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c ++++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/dcn32/dcn32_clk_mgr.c +@@ -719,6 +719,8 @@ void dcn32_clk_mgr_construct( + struct pp_smu_funcs *pp_smu, + struct dccg *dccg) + { ++ struct clk_log_info log_info = {0}; ++ + clk_mgr->base.ctx = ctx; + clk_mgr->base.funcs = &dcn32_funcs; + if (ASICREV_IS_GC_11_0_2(clk_mgr->base.ctx->asic_id.hw_internal_rev)) { +@@ -752,6 +754,7 @@ void dcn32_clk_mgr_construct( + clk_mgr->base.clks.ref_dtbclk_khz = 268750; + } + ++ + /* integer part is now VCO frequency in kHz */ + clk_mgr->base.dentist_vco_freq_khz = dcn32_get_vco_frequency_from_reg(clk_mgr); + +@@ -759,6 +762,8 @@ void dcn32_clk_mgr_construct( + if (clk_mgr->base.dentist_vco_freq_khz == 0) + clk_mgr->base.dentist_vco_freq_khz = 4300000; /* Updated as per HW docs */ + ++ dcn32_dump_clk_registers(&clk_mgr->base.boot_snapshot, &clk_mgr->base, &log_info); ++ + if (ctx->dc->debug.disable_dtb_ref_clk_switch && + clk_mgr->base.clks.ref_dtbclk_khz != clk_mgr->base.boot_snapshot.dtbclk) { + clk_mgr->base.clks.ref_dtbclk_khz = clk_mgr->base.boot_snapshot.dtbclk; +-- +2.39.2 + diff --git a/queue-6.2/drm-amd-display-reset-outbox0-r-w-pointer-on-dmub-re.patch b/queue-6.2/drm-amd-display-reset-outbox0-r-w-pointer-on-dmub-re.patch new file mode 100644 index 00000000000..5eced66580a --- /dev/null +++ b/queue-6.2/drm-amd-display-reset-outbox0-r-w-pointer-on-dmub-re.patch @@ -0,0 +1,39 @@ +From 2e91a87bbe1b786ca45948185ead58966183982f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 13 May 2022 09:16:42 +0800 +Subject: drm/amd/display: Reset OUTBOX0 r/w pointer on DMUB reset + +From: Cruise Hung + +[ Upstream commit 425afa0ac99a05b39e6cd00704fa0e3e925cee2b ] + +[Why & How] +We missed resetting OUTBOX0 mailbox r/w pointer on DMUB reset. +Fix it. + +Fixes: 6ecf9773a503 ("drm/amd/display: Fix DMUB outbox trace in S4 (#4465)") +Signed-off-by: Cruise Hung +Acked-by: Aurabindo Pillai +Tested-by: Daniel Wheeler +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/display/dmub/src/dmub_dcn32.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/gpu/drm/amd/display/dmub/src/dmub_dcn32.c b/drivers/gpu/drm/amd/display/dmub/src/dmub_dcn32.c +index a76da0131addd..b0adbf783aae9 100644 +--- a/drivers/gpu/drm/amd/display/dmub/src/dmub_dcn32.c ++++ b/drivers/gpu/drm/amd/display/dmub/src/dmub_dcn32.c +@@ -130,6 +130,8 @@ void dmub_dcn32_reset(struct dmub_srv *dmub) + REG_WRITE(DMCUB_INBOX1_WPTR, 0); + REG_WRITE(DMCUB_OUTBOX1_RPTR, 0); + REG_WRITE(DMCUB_OUTBOX1_WPTR, 0); ++ REG_WRITE(DMCUB_OUTBOX0_RPTR, 0); ++ REG_WRITE(DMCUB_OUTBOX0_WPTR, 0); + REG_WRITE(DMCUB_SCRATCH0, 0); + } + +-- +2.39.2 + diff --git a/queue-6.2/drm-amd-display-return-error-code-on-dsc-atomic-chec.patch b/queue-6.2/drm-amd-display-return-error-code-on-dsc-atomic-chec.patch new file mode 100644 index 00000000000..88e9eba5735 --- /dev/null +++ b/queue-6.2/drm-amd-display-return-error-code-on-dsc-atomic-chec.patch @@ -0,0 +1,50 @@ +From bc1603e673a6751fb055f61394123f94a4518c24 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 29 May 2022 10:54:30 -0400 +Subject: drm/amd/display: Return error code on DSC atomic check failure + +From: Hersen Wu + +[ Upstream commit dd24662d9dfbad281bbf030f06d68c7938fa0c66 ] + +[Why&How] +We were not returning -EINVAL on DSC atomic check fail. Add it. + +Fixes: 71be4b16d39a ("drm/amd/display: dsc validate fail not pass to atomic check") +Reviewed-by: Aurabindo Pillai +Signed-off-by: Hersen Wu +Tested-by: Daniel Wheeler +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 1 + + drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +index 58fdd39f5bde9..324cfaeb744cd 100644 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +@@ -9859,6 +9859,7 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev, + ret = compute_mst_dsc_configs_for_state(state, dm_state->context, vars); + if (ret) { + DRM_DEBUG_DRIVER("compute_mst_dsc_configs_for_state() failed\n"); ++ ret = -EINVAL; + goto fail; + } + +diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +index 60dd88666437d..994a37003217d 100644 +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +@@ -1375,6 +1375,7 @@ int pre_validate_dsc(struct drm_atomic_state *state, + ret = pre_compute_mst_dsc_configs_for_state(state, local_dc_state, vars); + if (ret != 0) { + DRM_INFO_ONCE("pre_compute_mst_dsc_configs_for_state() failed\n"); ++ ret = -EINVAL; + goto clean_exit; + } + +-- +2.39.2 + diff --git a/queue-6.2/drm-amd-display-update-bounding-box-values-for-dcn32.patch b/queue-6.2/drm-amd-display-update-bounding-box-values-for-dcn32.patch new file mode 100644 index 00000000000..b6e9e57c6bc --- /dev/null +++ b/queue-6.2/drm-amd-display-update-bounding-box-values-for-dcn32.patch @@ -0,0 +1,74 @@ +From a6aee73282ff17b65a9884dbc54e9cbb8e061af3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 6 Apr 2023 15:59:45 -0400 +Subject: drm/amd/display: Update bounding box values for DCN321 + +From: Aurabindo Pillai + +[ Upstream commit 989cd3e76a4aab76fe7dd50090ac3fa501c537f6 ] + +[Why&how] + +Update bounding box values as per hardware spec + +Fixes: 197485c69543 ("drm/amd/display: Create dcn321_fpu file") +Acked-by: Leo Li +Signed-off-by: Aurabindo Pillai +Tested-by: Daniel Wheeler +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + .../amd/display/dc/dml/dcn321/dcn321_fpu.c | 24 +++++++++---------- + 1 file changed, 12 insertions(+), 12 deletions(-) + +diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn321/dcn321_fpu.c b/drivers/gpu/drm/amd/display/dc/dml/dcn321/dcn321_fpu.c +index b80cef70fa60f..383a409a3f54c 100644 +--- a/drivers/gpu/drm/amd/display/dc/dml/dcn321/dcn321_fpu.c ++++ b/drivers/gpu/drm/amd/display/dc/dml/dcn321/dcn321_fpu.c +@@ -106,16 +106,16 @@ struct _vcs_dpi_soc_bounding_box_st dcn3_21_soc = { + .clock_limits = { + { + .state = 0, +- .dcfclk_mhz = 1564.0, +- .fabricclk_mhz = 400.0, +- .dispclk_mhz = 2150.0, +- .dppclk_mhz = 2150.0, ++ .dcfclk_mhz = 1434.0, ++ .fabricclk_mhz = 2250.0, ++ .dispclk_mhz = 1720.0, ++ .dppclk_mhz = 1720.0, + .phyclk_mhz = 810.0, + .phyclk_d18_mhz = 667.0, +- .phyclk_d32_mhz = 625.0, ++ .phyclk_d32_mhz = 313.0, + .socclk_mhz = 1200.0, +- .dscclk_mhz = 716.667, +- .dram_speed_mts = 1600.0, ++ .dscclk_mhz = 573.333, ++ .dram_speed_mts = 16000.0, + .dtbclk_mhz = 1564.0, + }, + }, +@@ -125,14 +125,14 @@ struct _vcs_dpi_soc_bounding_box_st dcn3_21_soc = { + .sr_exit_z8_time_us = 285.0, + .sr_enter_plus_exit_z8_time_us = 320, + .writeback_latency_us = 12.0, +- .round_trip_ping_latency_dcfclk_cycles = 263, ++ .round_trip_ping_latency_dcfclk_cycles = 207, + .urgent_latency_pixel_data_only_us = 4, + .urgent_latency_pixel_mixed_with_vm_data_us = 4, + .urgent_latency_vm_data_only_us = 4, +- .fclk_change_latency_us = 20, +- .usr_retraining_latency_us = 2, +- .smn_latency_us = 2, +- .mall_allocated_for_dcn_mbytes = 64, ++ .fclk_change_latency_us = 7, ++ .usr_retraining_latency_us = 0, ++ .smn_latency_us = 0, ++ .mall_allocated_for_dcn_mbytes = 32, + .urgent_out_of_order_return_per_channel_pixel_only_bytes = 4096, + .urgent_out_of_order_return_per_channel_pixel_and_vm_bytes = 4096, + .urgent_out_of_order_return_per_channel_vm_only_bytes = 4096, +-- +2.39.2 + diff --git a/queue-6.2/drm-amdgpu-add-a-missing-lock-for-amdgpu_sched.patch b/queue-6.2/drm-amdgpu-add-a-missing-lock-for-amdgpu_sched.patch new file mode 100644 index 00000000000..76da1a1f27f --- /dev/null +++ b/queue-6.2/drm-amdgpu-add-a-missing-lock-for-amdgpu_sched.patch @@ -0,0 +1,54 @@ +From 839795447cad5e09afaaf4694110702f203804dc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Apr 2023 15:54:55 -0700 +Subject: drm/amdgpu: add a missing lock for AMDGPU_SCHED +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Chia-I Wu + +[ Upstream commit 2397e3d8d2e120355201a8310b61929f5a8bd2c0 ] + +mgr->ctx_handles should be protected by mgr->lock. + +v2: improve commit message +v3: add a Fixes tag + +Signed-off-by: Chia-I Wu +Reviewed-by: Christian König +Fixes: 52c6a62c64fa ("drm/amdgpu: add interface for editing a foreign process's priority v3") +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c +index e9b45089a28a6..863b2a34b2d64 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c +@@ -38,6 +38,7 @@ static int amdgpu_sched_process_priority_override(struct amdgpu_device *adev, + { + struct fd f = fdget(fd); + struct amdgpu_fpriv *fpriv; ++ struct amdgpu_ctx_mgr *mgr; + struct amdgpu_ctx *ctx; + uint32_t id; + int r; +@@ -51,8 +52,11 @@ static int amdgpu_sched_process_priority_override(struct amdgpu_device *adev, + return r; + } + +- idr_for_each_entry(&fpriv->ctx_mgr.ctx_handles, ctx, id) ++ mgr = &fpriv->ctx_mgr; ++ mutex_lock(&mgr->lock); ++ idr_for_each_entry(&mgr->ctx_handles, ctx, id) + amdgpu_ctx_priority_override(ctx, priority); ++ mutex_unlock(&mgr->lock); + + fdput(f); + return 0; +-- +2.39.2 + diff --git a/queue-6.2/drm-i915-mtl-add-the-missing-cpu-transcoder-mask-in-.patch b/queue-6.2/drm-i915-mtl-add-the-missing-cpu-transcoder-mask-in-.patch new file mode 100644 index 00000000000..56d4a2108e8 --- /dev/null +++ b/queue-6.2/drm-i915-mtl-add-the-missing-cpu-transcoder-mask-in-.patch @@ -0,0 +1,53 @@ +From 0dc092ee4a80a03cf8cdf85e9e0bf4d951816c4b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 20 Apr 2023 15:12:47 -0700 +Subject: drm/i915/mtl: Add the missing CPU transcoder mask in + intel_device_info +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Radhakrishna Sripada + +[ Upstream commit 6ece90e3665a9b7fb2637fcca26cebd42991580b ] + +CPU transcoder mask is used to iterate over the available +CPU transcoders in the macro for_each_cpu_transcoder(). + +The macro is broken on MTL and got highlighted when audio +state was being tracked for each transcoder added in [1]. + +Add the missing CPU transcoder mask which is similar to ADL-P +mask but without DSI transcoders. + +[1]: https://patchwork.freedesktop.org/patch/523723/ + +Fixes: 7835303982d1 ("drm/i915/mtl: Add MeteorLake PCI IDs") +Cc: Ville Syrjälä +Signed-off-by: Radhakrishna Sripada +Acked-by: Haridhar Kalvala +Reviewed-by: Gustavo Sousa +Link: https://patchwork.freedesktop.org/patch/msgid/20230420221248.2511314-1-radhakrishna.sripada@intel.com +(cherry picked from commit bddc18913bd44adae5c828fd514d570f43ba1576) +Signed-off-by: Joonas Lahtinen +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/i915/i915_pci.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c +index 4fada7ebe8d82..36cc4fc87c48c 100644 +--- a/drivers/gpu/drm/i915/i915_pci.c ++++ b/drivers/gpu/drm/i915/i915_pci.c +@@ -1133,6 +1133,8 @@ static const struct intel_gt_definition xelpmp_extra_gt[] = { + static const struct intel_device_info mtl_info = { + XE_HP_FEATURES, + XE_LPDP_FEATURES, ++ .__runtime.cpu_transcoder_mask = BIT(TRANSCODER_A) | BIT(TRANSCODER_B) | ++ BIT(TRANSCODER_C) | BIT(TRANSCODER_D), + /* + * Real graphics IP version will be obtained from hardware GMD_ID + * register. Value provided here is just for sanity checking. +-- +2.39.2 + diff --git a/queue-6.2/ethtool-fix-uninitialized-number-of-lanes.patch b/queue-6.2/ethtool-fix-uninitialized-number-of-lanes.patch new file mode 100644 index 00000000000..01e35727649 --- /dev/null +++ b/queue-6.2/ethtool-fix-uninitialized-number-of-lanes.patch @@ -0,0 +1,130 @@ +From f5e855f4961b4032a2d0805193af625f4520315b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 2 May 2023 15:20:50 +0300 +Subject: ethtool: Fix uninitialized number of lanes + +From: Ido Schimmel + +[ Upstream commit 9ad685dbfe7e856bbf17a7177b64676d324d6ed7 ] + +It is not possible to set the number of lanes when setting link modes +using the legacy IOCTL ethtool interface. Since 'struct +ethtool_link_ksettings' is not initialized in this path, drivers receive +an uninitialized number of lanes in 'struct +ethtool_link_ksettings::lanes'. + +When this information is later queried from drivers, it results in the +ethtool code making decisions based on uninitialized memory, leading to +the following KMSAN splat [1]. In practice, this most likely only +happens with the tun driver that simply returns whatever it got in the +set operation. + +As far as I can tell, this uninitialized memory is not leaked to user +space thanks to the 'ethtool_ops->cap_link_lanes_supported' check in +linkmodes_prepare_data(). + +Fix by initializing the structure in the IOCTL path. Did not find any +more call sites that pass an uninitialized structure when calling +'ethtool_ops::set_link_ksettings()'. + +[1] +BUG: KMSAN: uninit-value in ethnl_update_linkmodes net/ethtool/linkmodes.c:273 [inline] +BUG: KMSAN: uninit-value in ethnl_set_linkmodes+0x190b/0x19d0 net/ethtool/linkmodes.c:333 + ethnl_update_linkmodes net/ethtool/linkmodes.c:273 [inline] + ethnl_set_linkmodes+0x190b/0x19d0 net/ethtool/linkmodes.c:333 + ethnl_default_set_doit+0x88d/0xde0 net/ethtool/netlink.c:640 + genl_family_rcv_msg_doit net/netlink/genetlink.c:968 [inline] + genl_family_rcv_msg net/netlink/genetlink.c:1048 [inline] + genl_rcv_msg+0x141a/0x14c0 net/netlink/genetlink.c:1065 + netlink_rcv_skb+0x3f8/0x750 net/netlink/af_netlink.c:2577 + genl_rcv+0x40/0x60 net/netlink/genetlink.c:1076 + netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline] + netlink_unicast+0xf41/0x1270 net/netlink/af_netlink.c:1365 + netlink_sendmsg+0x127d/0x1430 net/netlink/af_netlink.c:1942 + sock_sendmsg_nosec net/socket.c:724 [inline] + sock_sendmsg net/socket.c:747 [inline] + ____sys_sendmsg+0xa24/0xe40 net/socket.c:2501 + ___sys_sendmsg+0x2a1/0x3f0 net/socket.c:2555 + __sys_sendmsg net/socket.c:2584 [inline] + __do_sys_sendmsg net/socket.c:2593 [inline] + __se_sys_sendmsg net/socket.c:2591 [inline] + __x64_sys_sendmsg+0x36b/0x540 net/socket.c:2591 + do_syscall_x64 arch/x86/entry/common.c:50 [inline] + do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 + entry_SYSCALL_64_after_hwframe+0x63/0xcd + +Uninit was stored to memory at: + tun_get_link_ksettings+0x37/0x60 drivers/net/tun.c:3544 + __ethtool_get_link_ksettings+0x17b/0x260 net/ethtool/ioctl.c:441 + ethnl_set_linkmodes+0xee/0x19d0 net/ethtool/linkmodes.c:327 + ethnl_default_set_doit+0x88d/0xde0 net/ethtool/netlink.c:640 + genl_family_rcv_msg_doit net/netlink/genetlink.c:968 [inline] + genl_family_rcv_msg net/netlink/genetlink.c:1048 [inline] + genl_rcv_msg+0x141a/0x14c0 net/netlink/genetlink.c:1065 + netlink_rcv_skb+0x3f8/0x750 net/netlink/af_netlink.c:2577 + genl_rcv+0x40/0x60 net/netlink/genetlink.c:1076 + netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline] + netlink_unicast+0xf41/0x1270 net/netlink/af_netlink.c:1365 + netlink_sendmsg+0x127d/0x1430 net/netlink/af_netlink.c:1942 + sock_sendmsg_nosec net/socket.c:724 [inline] + sock_sendmsg net/socket.c:747 [inline] + ____sys_sendmsg+0xa24/0xe40 net/socket.c:2501 + ___sys_sendmsg+0x2a1/0x3f0 net/socket.c:2555 + __sys_sendmsg net/socket.c:2584 [inline] + __do_sys_sendmsg net/socket.c:2593 [inline] + __se_sys_sendmsg net/socket.c:2591 [inline] + __x64_sys_sendmsg+0x36b/0x540 net/socket.c:2591 + do_syscall_x64 arch/x86/entry/common.c:50 [inline] + do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 + entry_SYSCALL_64_after_hwframe+0x63/0xcd + +Uninit was stored to memory at: + tun_set_link_ksettings+0x37/0x60 drivers/net/tun.c:3553 + ethtool_set_link_ksettings+0x600/0x690 net/ethtool/ioctl.c:609 + __dev_ethtool net/ethtool/ioctl.c:3024 [inline] + dev_ethtool+0x1db9/0x2a70 net/ethtool/ioctl.c:3078 + dev_ioctl+0xb07/0x1270 net/core/dev_ioctl.c:524 + sock_do_ioctl+0x295/0x540 net/socket.c:1213 + sock_ioctl+0x729/0xd90 net/socket.c:1316 + vfs_ioctl fs/ioctl.c:51 [inline] + __do_sys_ioctl fs/ioctl.c:870 [inline] + __se_sys_ioctl+0x222/0x400 fs/ioctl.c:856 + __x64_sys_ioctl+0x96/0xe0 fs/ioctl.c:856 + do_syscall_x64 arch/x86/entry/common.c:50 [inline] + do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 + entry_SYSCALL_64_after_hwframe+0x63/0xcd + +Local variable link_ksettings created at: + ethtool_set_link_ksettings+0x54/0x690 net/ethtool/ioctl.c:577 + __dev_ethtool net/ethtool/ioctl.c:3024 [inline] + dev_ethtool+0x1db9/0x2a70 net/ethtool/ioctl.c:3078 + +Fixes: 012ce4dd3102 ("ethtool: Extend link modes settings uAPI with lanes") +Reported-and-tested-by: syzbot+ef6edd9f1baaa54d6235@syzkaller.appspotmail.com +Link: https://lore.kernel.org/netdev/0000000000004bb41105fa70f361@google.com/ +Reviewed-by: Danielle Ratson +Signed-off-by: Ido Schimmel +Reviewed-by: Leon Romanovsky +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/ethtool/ioctl.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c +index 646b3e490c71a..f0c646a17700f 100644 +--- a/net/ethtool/ioctl.c ++++ b/net/ethtool/ioctl.c +@@ -573,8 +573,8 @@ static int ethtool_get_link_ksettings(struct net_device *dev, + static int ethtool_set_link_ksettings(struct net_device *dev, + void __user *useraddr) + { ++ struct ethtool_link_ksettings link_ksettings = {}; + int err; +- struct ethtool_link_ksettings link_ksettings; + + ASSERT_RTNL(); + +-- +2.39.2 + diff --git a/queue-6.2/i2c-tegra-fix-pec-support-for-smbus-block-read.patch b/queue-6.2/i2c-tegra-fix-pec-support-for-smbus-block-read.patch new file mode 100644 index 00000000000..ff77cb0986b --- /dev/null +++ b/queue-6.2/i2c-tegra-fix-pec-support-for-smbus-block-read.patch @@ -0,0 +1,127 @@ +From 14b609a73680bd4ba56a6f311747d775198315bf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 Apr 2023 18:09:14 +0530 +Subject: i2c: tegra: Fix PEC support for SMBUS block read + +From: Akhil R + +[ Upstream commit 9f855779a3874eee70e9f6be57b5f7774f14e510 ] + +Update the msg->len value correctly for SMBUS block read. The discrepancy +went unnoticed as msg->len is used in SMBUS transfers only when a PEC +byte is added. + +Fixes: d7583c8a5748 ("i2c: tegra: Add SMBus block read function") +Signed-off-by: Akhil R +Acked-by: Thierry Reding +Signed-off-by: Wolfram Sang +Signed-off-by: Sasha Levin +--- + drivers/i2c/busses/i2c-tegra.c | 40 +++++++++++++++++++++++----------- + 1 file changed, 27 insertions(+), 13 deletions(-) + +diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c +index 6aab84c8d22b4..157066f06a32d 100644 +--- a/drivers/i2c/busses/i2c-tegra.c ++++ b/drivers/i2c/busses/i2c-tegra.c +@@ -242,9 +242,10 @@ struct tegra_i2c_hw_feature { + * @is_dvc: identifies the DVC I2C controller, has a different register layout + * @is_vi: identifies the VI I2C controller, has a different register layout + * @msg_complete: transfer completion notifier ++ * @msg_buf_remaining: size of unsent data in the message buffer ++ * @msg_len: length of message in current transfer + * @msg_err: error code for completed message + * @msg_buf: pointer to current message data +- * @msg_buf_remaining: size of unsent data in the message buffer + * @msg_read: indicates that the transfer is a read access + * @timings: i2c timings information like bus frequency + * @multimaster_mode: indicates that I2C controller is in multi-master mode +@@ -277,6 +278,7 @@ struct tegra_i2c_dev { + + struct completion msg_complete; + size_t msg_buf_remaining; ++ unsigned int msg_len; + int msg_err; + u8 *msg_buf; + +@@ -1169,7 +1171,7 @@ static void tegra_i2c_push_packet_header(struct tegra_i2c_dev *i2c_dev, + else + i2c_writel(i2c_dev, packet_header, I2C_TX_FIFO); + +- packet_header = msg->len - 1; ++ packet_header = i2c_dev->msg_len - 1; + + if (i2c_dev->dma_mode && !i2c_dev->msg_read) + *dma_buf++ = packet_header; +@@ -1242,20 +1244,32 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev, + return err; + + i2c_dev->msg_buf = msg->buf; ++ i2c_dev->msg_len = msg->len; + +- /* The condition true implies smbus block read and len is already read */ +- if (msg->flags & I2C_M_RECV_LEN && end_state != MSG_END_CONTINUE) +- i2c_dev->msg_buf = msg->buf + 1; +- +- i2c_dev->msg_buf_remaining = msg->len; + i2c_dev->msg_err = I2C_ERR_NONE; + i2c_dev->msg_read = !!(msg->flags & I2C_M_RD); + reinit_completion(&i2c_dev->msg_complete); + ++ /* ++ * For SMBUS block read command, read only 1 byte in the first transfer. ++ * Adjust that 1 byte for the next transfer in the msg buffer and msg ++ * length. ++ */ ++ if (msg->flags & I2C_M_RECV_LEN) { ++ if (end_state == MSG_END_CONTINUE) { ++ i2c_dev->msg_len = 1; ++ } else { ++ i2c_dev->msg_buf += 1; ++ i2c_dev->msg_len -= 1; ++ } ++ } ++ ++ i2c_dev->msg_buf_remaining = i2c_dev->msg_len; ++ + if (i2c_dev->msg_read) +- xfer_size = msg->len; ++ xfer_size = i2c_dev->msg_len; + else +- xfer_size = msg->len + I2C_PACKET_HEADER_SIZE; ++ xfer_size = i2c_dev->msg_len + I2C_PACKET_HEADER_SIZE; + + xfer_size = ALIGN(xfer_size, BYTES_PER_FIFO_WORD); + +@@ -1295,7 +1309,7 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev, + if (!i2c_dev->msg_read) { + if (i2c_dev->dma_mode) { + memcpy(i2c_dev->dma_buf + I2C_PACKET_HEADER_SIZE, +- msg->buf, msg->len); ++ msg->buf, i2c_dev->msg_len); + + dma_sync_single_for_device(i2c_dev->dma_dev, + i2c_dev->dma_phys, +@@ -1352,7 +1366,7 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev, + i2c_dev->dma_phys, + xfer_size, DMA_FROM_DEVICE); + +- memcpy(i2c_dev->msg_buf, i2c_dev->dma_buf, msg->len); ++ memcpy(i2c_dev->msg_buf, i2c_dev->dma_buf, i2c_dev->msg_len); + } + } + +@@ -1408,8 +1422,8 @@ static int tegra_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], + ret = tegra_i2c_xfer_msg(i2c_dev, &msgs[i], MSG_END_CONTINUE); + if (ret) + break; +- /* Set the read byte as msg len */ +- msgs[i].len = msgs[i].buf[0]; ++ /* Set the msg length from first byte */ ++ msgs[i].len += msgs[i].buf[0]; + dev_dbg(i2c_dev->dev, "reading %d bytes\n", msgs[i].len); + } + ret = tegra_i2c_xfer_msg(i2c_dev, &msgs[i], end_type); +-- +2.39.2 + diff --git a/queue-6.2/ice-block-lan-in-case-of-vf-to-vf-offload.patch b/queue-6.2/ice-block-lan-in-case-of-vf-to-vf-offload.patch new file mode 100644 index 00000000000..9977a638218 --- /dev/null +++ b/queue-6.2/ice-block-lan-in-case-of-vf-to-vf-offload.patch @@ -0,0 +1,52 @@ +From 771787058a9a0a36c4b34f3b3e5082b0e0953d32 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 3 May 2023 08:39:35 -0700 +Subject: ice: block LAN in case of VF to VF offload + +From: Michal Swiatkowski + +[ Upstream commit 9f699b71c2f31c51bd1483a20e1c8ddc5986a8c9 ] + +VF to VF traffic shouldn't go outside. To enforce it, set only the loopback +enable bit in case of all ingress type rules added via the tc tool. + +Fixes: 0d08a441fb1a ("ice: ndo_setup_tc implementation for PF") +Reported-by: Sujai Buvaneswaran +Signed-off-by: Michal Swiatkowski +Tested-by: George Kuruvinakunnel +Reviewed-by: Simon Horman +Signed-off-by: Tony Nguyen +Reviewed-by: Leon Romanovsky +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/intel/ice/ice_tc_lib.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/intel/ice/ice_tc_lib.c b/drivers/net/ethernet/intel/ice/ice_tc_lib.c +index ce72d512eddf9..a9db9bdd72629 100644 +--- a/drivers/net/ethernet/intel/ice/ice_tc_lib.c ++++ b/drivers/net/ethernet/intel/ice/ice_tc_lib.c +@@ -693,17 +693,18 @@ ice_eswitch_add_tc_fltr(struct ice_vsi *vsi, struct ice_tc_flower_fltr *fltr) + * results into order of switch rule evaluation. + */ + rule_info.priority = 7; ++ rule_info.flags_info.act_valid = true; + + if (fltr->direction == ICE_ESWITCH_FLTR_INGRESS) { + rule_info.sw_act.flag |= ICE_FLTR_RX; + rule_info.sw_act.src = hw->pf_id; + rule_info.rx = true; ++ rule_info.flags_info.act = ICE_SINGLE_ACT_LB_ENABLE; + } else { + rule_info.sw_act.flag |= ICE_FLTR_TX; + rule_info.sw_act.src = vsi->idx; + rule_info.rx = false; + rule_info.flags_info.act = ICE_SINGLE_ACT_LAN_ENABLE; +- rule_info.flags_info.act_valid = true; + } + + /* specify the cookie as filter_rule_id */ +-- +2.39.2 + diff --git a/queue-6.2/ionic-catch-failure-from-devlink_alloc.patch b/queue-6.2/ionic-catch-failure-from-devlink_alloc.patch new file mode 100644 index 00000000000..5f571451fe3 --- /dev/null +++ b/queue-6.2/ionic-catch-failure-from-devlink_alloc.patch @@ -0,0 +1,40 @@ +From 1475c36fc9c49467d8fc45f9c96ae62e7e49a336 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 2 May 2023 11:35:36 -0700 +Subject: ionic: catch failure from devlink_alloc + +From: Shannon Nelson + +[ Upstream commit 4a54903ff68ddb33b6463c94b4eb37fc584ef760 ] + +Add a check for NULL on the alloc return. If devlink_alloc() fails and +we try to use devlink_priv() on the NULL return, the kernel gets very +unhappy and panics. With this fix, the driver load will still fail, +but at least it won't panic the kernel. + +Fixes: df69ba43217d ("ionic: Add basic framework for IONIC Network device driver") +Signed-off-by: Shannon Nelson +Reviewed-by: Simon Horman +Reviewed-by: Jiri Pirko +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/pensando/ionic/ionic_devlink.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/net/ethernet/pensando/ionic/ionic_devlink.c b/drivers/net/ethernet/pensando/ionic/ionic_devlink.c +index e6ff757895abb..4ec66a6be0738 100644 +--- a/drivers/net/ethernet/pensando/ionic/ionic_devlink.c ++++ b/drivers/net/ethernet/pensando/ionic/ionic_devlink.c +@@ -61,6 +61,8 @@ struct ionic *ionic_devlink_alloc(struct device *dev) + struct devlink *dl; + + dl = devlink_alloc(&ionic_dl_ops, sizeof(struct ionic), dev); ++ if (!dl) ++ return NULL; + + return devlink_priv(dl); + } +-- +2.39.2 + diff --git a/queue-6.2/ionic-remove-noise-from-ethtool-rxnfc-error-msg.patch b/queue-6.2/ionic-remove-noise-from-ethtool-rxnfc-error-msg.patch new file mode 100644 index 00000000000..bc58d54279b --- /dev/null +++ b/queue-6.2/ionic-remove-noise-from-ethtool-rxnfc-error-msg.patch @@ -0,0 +1,38 @@ +From 13d8abb045ba456a3e84650db85c229e78cd85b8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 2 May 2023 11:47:40 -0700 +Subject: ionic: remove noise from ethtool rxnfc error msg + +From: Shannon Nelson + +[ Upstream commit 3711d44fac1f80ea69ecb7315fed05b3812a7401 ] + +It seems that ethtool is calling into .get_rxnfc more often with +ETHTOOL_GRXCLSRLCNT which ionic doesn't know about. We don't +need to log a message about it, just return not supported. + +Fixes: aa3198819bea6 ("ionic: Add RSS support") +Signed-off-by: Shannon Nelson +Reviewed-by: Simon Horman +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/pensando/ionic/ionic_ethtool.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c +index 01c22701482d9..d7370fb60a168 100644 +--- a/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c ++++ b/drivers/net/ethernet/pensando/ionic/ionic_ethtool.c +@@ -691,7 +691,7 @@ static int ionic_get_rxnfc(struct net_device *netdev, + info->data = lif->nxqs; + break; + default: +- netdev_err(netdev, "Command parameter %d is not supported\n", ++ netdev_dbg(netdev, "Command parameter %d is not supported\n", + info->cmd); + err = -EOPNOTSUPP; + } +-- +2.39.2 + diff --git a/queue-6.2/ixgbe-fix-panic-during-xdp_tx-with-64-cpus.patch b/queue-6.2/ixgbe-fix-panic-during-xdp_tx-with-64-cpus.patch new file mode 100644 index 00000000000..f027e43fc19 --- /dev/null +++ b/queue-6.2/ixgbe-fix-panic-during-xdp_tx-with-64-cpus.patch @@ -0,0 +1,145 @@ +From 99519a6fcb0693cfc929fe1349c9c8cc2fceefc2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 Apr 2023 10:03:08 -0700 +Subject: ixgbe: Fix panic during XDP_TX with > 64 CPUs + +From: John Hickey + +[ Upstream commit c23ae5091a8b3e50fe755257df020907e7c029bb ] + +Commit 4fe815850bdc ("ixgbe: let the xdpdrv work with more than 64 cpus") +adds support to allow XDP programs to run on systems with more than +64 CPUs by locking the XDP TX rings and indexing them using cpu % 64 +(IXGBE_MAX_XDP_QS). + +Upon trying this out patch on a system with more than 64 cores, +the kernel paniced with an array-index-out-of-bounds at the return in +ixgbe_determine_xdp_ring in ixgbe.h, which means ixgbe_determine_xdp_q_idx +was just returning the cpu instead of cpu % IXGBE_MAX_XDP_QS. An example +splat: + + ========================================================================== + UBSAN: array-index-out-of-bounds in + /var/lib/dkms/ixgbe/5.18.6+focal-1/build/src/ixgbe.h:1147:26 + index 65 is out of range for type 'ixgbe_ring *[64]' + ========================================================================== + BUG: kernel NULL pointer dereference, address: 0000000000000058 + #PF: supervisor read access in kernel mode + #PF: error_code(0x0000) - not-present page + PGD 0 P4D 0 + Oops: 0000 [#1] SMP NOPTI + CPU: 65 PID: 408 Comm: ksoftirqd/65 + Tainted: G IOE 5.15.0-48-generic #54~20.04.1-Ubuntu + Hardware name: Dell Inc. PowerEdge R640/0W23H8, BIOS 2.5.4 01/13/2020 + RIP: 0010:ixgbe_xmit_xdp_ring+0x1b/0x1c0 [ixgbe] + Code: 3b 52 d4 cf e9 42 f2 ff ff 66 0f 1f 44 00 00 0f 1f 44 00 00 55 b9 + 00 00 00 00 48 89 e5 41 57 41 56 41 55 41 54 53 48 83 ec 08 <44> 0f b7 + 47 58 0f b7 47 5a 0f b7 57 54 44 0f b7 76 08 66 41 39 c0 + RSP: 0018:ffffbc3fcd88fcb0 EFLAGS: 00010282 + RAX: ffff92a253260980 RBX: ffffbc3fe68b00a0 RCX: 0000000000000000 + RDX: ffff928b5f659000 RSI: ffff928b5f659000 RDI: 0000000000000000 + RBP: ffffbc3fcd88fce0 R08: ffff92b9dfc20580 R09: 0000000000000001 + R10: 3d3d3d3d3d3d3d3d R11: 3d3d3d3d3d3d3d3d R12: 0000000000000000 + R13: ffff928b2f0fa8c0 R14: ffff928b9be20050 R15: 000000000000003c + FS: 0000000000000000(0000) GS:ffff92b9dfc00000(0000) + knlGS:0000000000000000 + CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 + CR2: 0000000000000058 CR3: 000000011dd6a002 CR4: 00000000007706e0 + DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 + DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 + PKRU: 55555554 + Call Trace: + + ixgbe_poll+0x103e/0x1280 [ixgbe] + ? sched_clock_cpu+0x12/0xe0 + __napi_poll+0x30/0x160 + net_rx_action+0x11c/0x270 + __do_softirq+0xda/0x2ee + run_ksoftirqd+0x2f/0x50 + smpboot_thread_fn+0xb7/0x150 + ? sort_range+0x30/0x30 + kthread+0x127/0x150 + ? set_kthread_struct+0x50/0x50 + ret_from_fork+0x1f/0x30 + + +I think this is how it happens: + +Upon loading the first XDP program on a system with more than 64 CPUs, +ixgbe_xdp_locking_key is incremented in ixgbe_xdp_setup. However, +immediately after this, the rings are reconfigured by ixgbe_setup_tc. +ixgbe_setup_tc calls ixgbe_clear_interrupt_scheme which calls +ixgbe_free_q_vectors which calls ixgbe_free_q_vector in a loop. +ixgbe_free_q_vector decrements ixgbe_xdp_locking_key once per call if +it is non-zero. Commenting out the decrement in ixgbe_free_q_vector +stopped my system from panicing. + +I suspect to make the original patch work, I would need to load an XDP +program and then replace it in order to get ixgbe_xdp_locking_key back +above 0 since ixgbe_setup_tc is only called when transitioning between +XDP and non-XDP ring configurations, while ixgbe_xdp_locking_key is +incremented every time ixgbe_xdp_setup is called. + +Also, ixgbe_setup_tc can be called via ethtool --set-channels, so this +becomes another path to decrement ixgbe_xdp_locking_key to 0 on systems +with more than 64 CPUs. + +Since ixgbe_xdp_locking_key only protects the XDP_TX path and is tied +to the number of CPUs present, there is no reason to disable it upon +unloading an XDP program. To avoid confusion, I have moved enabling +ixgbe_xdp_locking_key into ixgbe_sw_init, which is part of the probe path. + +Fixes: 4fe815850bdc ("ixgbe: let the xdpdrv work with more than 64 cpus") +Signed-off-by: John Hickey +Reviewed-by: Maciej Fijalkowski +Tested-by: Chandan Kumar Rout (A Contingent Worker at Intel) +Signed-off-by: Tony Nguyen +Link: https://lore.kernel.org/r/20230425170308.2522429-1-anthony.l.nguyen@intel.com +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c | 3 --- + drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 6 ++++-- + 2 files changed, 4 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c +index f8156fe4b1dc4..0ee943db3dc92 100644 +--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c ++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c +@@ -1035,9 +1035,6 @@ static void ixgbe_free_q_vector(struct ixgbe_adapter *adapter, int v_idx) + adapter->q_vector[v_idx] = NULL; + __netif_napi_del(&q_vector->napi); + +- if (static_key_enabled(&ixgbe_xdp_locking_key)) +- static_branch_dec(&ixgbe_xdp_locking_key); +- + /* + * after a call to __netif_napi_del() napi may still be used and + * ixgbe_get_stats64() might access the rings on this vector, +diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +index 4507fba8747a7..03e583cf48153 100644 +--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c ++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +@@ -6495,6 +6495,10 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter, + set_bit(0, adapter->fwd_bitmask); + set_bit(__IXGBE_DOWN, &adapter->state); + ++ /* enable locking for XDP_TX if we have more CPUs than queues */ ++ if (nr_cpu_ids > IXGBE_MAX_XDP_QS) ++ static_branch_enable(&ixgbe_xdp_locking_key); ++ + return 0; + } + +@@ -10288,8 +10292,6 @@ static int ixgbe_xdp_setup(struct net_device *dev, struct bpf_prog *prog) + */ + if (nr_cpu_ids > IXGBE_MAX_XDP_QS * 2) + return -ENOMEM; +- else if (nr_cpu_ids > IXGBE_MAX_XDP_QS) +- static_branch_inc(&ixgbe_xdp_locking_key); + + old_prog = xchg(&adapter->xdp_prog, prog); + need_reset = (!!prog != !!old_prog); +-- +2.39.2 + diff --git a/queue-6.2/kvm-s390-fix-race-in-gmap_make_secure.patch b/queue-6.2/kvm-s390-fix-race-in-gmap_make_secure.patch new file mode 100644 index 00000000000..e9468077187 --- /dev/null +++ b/queue-6.2/kvm-s390-fix-race-in-gmap_make_secure.patch @@ -0,0 +1,94 @@ +From 9ccbf81c5a26d77a2b44904d61fc7ceee108ab96 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 28 Apr 2023 11:27:53 +0200 +Subject: KVM: s390: fix race in gmap_make_secure() + +From: Claudio Imbrenda + +[ Upstream commit c148dc8e2fa403be501612ee409db866eeed35c0 ] + +Fix a potential race in gmap_make_secure() and remove the last user of +follow_page() without FOLL_GET. + +The old code is locking something it doesn't have a reference to, and +as explained by Jason and David in this discussion: +https://lore.kernel.org/linux-mm/Y9J4P%2FRNvY1Ztn0Q@nvidia.com/ +it can lead to all kind of bad things, including the page getting +unmapped (MADV_DONTNEED), freed, reallocated as a larger folio and the +unlock_page() would target the wrong bit. +There is also another race with the FOLL_WRITE, which could race +between the follow_page() and the get_locked_pte(). + +The main point is to remove the last use of follow_page() without +FOLL_GET or FOLL_PIN, removing the races can be considered a nice +bonus. + +Link: https://lore.kernel.org/linux-mm/Y9J4P%2FRNvY1Ztn0Q@nvidia.com/ +Suggested-by: Jason Gunthorpe +Fixes: 214d9bbcd3a6 ("s390/mm: provide memory management functions for protected KVM guests") +Reviewed-by: Jason Gunthorpe +Signed-off-by: Claudio Imbrenda +Message-Id: <20230428092753.27913-2-imbrenda@linux.ibm.com> +Signed-off-by: Sasha Levin +--- + arch/s390/kernel/uv.c | 32 +++++++++++--------------------- + 1 file changed, 11 insertions(+), 21 deletions(-) + +diff --git a/arch/s390/kernel/uv.c b/arch/s390/kernel/uv.c +index 9f18a4af9c131..cb2ee06df286c 100644 +--- a/arch/s390/kernel/uv.c ++++ b/arch/s390/kernel/uv.c +@@ -192,21 +192,10 @@ static int expected_page_refs(struct page *page) + return res; + } + +-static int make_secure_pte(pte_t *ptep, unsigned long addr, +- struct page *exp_page, struct uv_cb_header *uvcb) ++static int make_page_secure(struct page *page, struct uv_cb_header *uvcb) + { +- pte_t entry = READ_ONCE(*ptep); +- struct page *page; + int expected, cc = 0; + +- if (!pte_present(entry)) +- return -ENXIO; +- if (pte_val(entry) & _PAGE_INVALID) +- return -ENXIO; +- +- page = pte_page(entry); +- if (page != exp_page) +- return -ENXIO; + if (PageWriteback(page)) + return -EAGAIN; + expected = expected_page_refs(page); +@@ -304,17 +293,18 @@ int gmap_make_secure(struct gmap *gmap, unsigned long gaddr, void *uvcb) + goto out; + + rc = -ENXIO; +- page = follow_page(vma, uaddr, FOLL_WRITE); +- if (IS_ERR_OR_NULL(page)) +- goto out; +- +- lock_page(page); + ptep = get_locked_pte(gmap->mm, uaddr, &ptelock); +- if (should_export_before_import(uvcb, gmap->mm)) +- uv_convert_from_secure(page_to_phys(page)); +- rc = make_secure_pte(ptep, uaddr, page, uvcb); ++ if (pte_present(*ptep) && !(pte_val(*ptep) & _PAGE_INVALID) && pte_write(*ptep)) { ++ page = pte_page(*ptep); ++ rc = -EAGAIN; ++ if (trylock_page(page)) { ++ if (should_export_before_import(uvcb, gmap->mm)) ++ uv_convert_from_secure(page_to_phys(page)); ++ rc = make_page_secure(page, uvcb); ++ unlock_page(page); ++ } ++ } + pte_unmap_unlock(ptep, ptelock); +- unlock_page(page); + out: + mmap_read_unlock(gmap->mm); + +-- +2.39.2 + diff --git a/queue-6.2/kvm-s390-pv-fix-asynchronous-teardown-for-small-vms.patch b/queue-6.2/kvm-s390-pv-fix-asynchronous-teardown-for-small-vms.patch new file mode 100644 index 00000000000..0b9ea0a7a44 --- /dev/null +++ b/queue-6.2/kvm-s390-pv-fix-asynchronous-teardown-for-small-vms.patch @@ -0,0 +1,83 @@ +From eb6e78a53015a4472443e4c6379d8ef6c5400ceb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Apr 2023 10:50:36 +0200 +Subject: KVM: s390: pv: fix asynchronous teardown for small VMs + +From: Claudio Imbrenda + +[ Upstream commit 292a7d6fca33df70ca4b8e9b0d0e74adf87582dc ] + +On machines without the Destroy Secure Configuration Fast UVC, the +topmost level of page tables is set aside and freed asynchronously +as last step of the asynchronous teardown. + +Each gmap has a host_to_guest radix tree mapping host (userspace) +addresses (with 1M granularity) to gmap segment table entries (pmds). + +If a guest is smaller than 2GB, the topmost level of page tables is the +segment table (i.e. there are only 2 levels). Replacing it means that +the pointers in the host_to_guest mapping would become stale and cause +all kinds of nasty issues. + +This patch fixes the issue by disallowing asynchronous teardown for +guests with only 2 levels of page tables. Userspace should (and already +does) try using the normal destroy if the asynchronous one fails. + +Update s390_replace_asce so it refuses to replace segment type ASCEs. +This is still needed in case the normal destroy VM fails. + +Fixes: fb491d5500a7 ("KVM: s390: pv: asynchronous destroy for reboot") +Reviewed-by: Marc Hartmayer +Reviewed-by: Janosch Frank +Signed-off-by: Claudio Imbrenda +Message-Id: <20230421085036.52511-2-imbrenda@linux.ibm.com> +Signed-off-by: Sasha Levin +--- + arch/s390/kvm/pv.c | 5 +++++ + arch/s390/mm/gmap.c | 7 +++++++ + 2 files changed, 12 insertions(+) + +diff --git a/arch/s390/kvm/pv.c b/arch/s390/kvm/pv.c +index e032ebbf51b97..3ce5f4351156a 100644 +--- a/arch/s390/kvm/pv.c ++++ b/arch/s390/kvm/pv.c +@@ -314,6 +314,11 @@ int kvm_s390_pv_set_aside(struct kvm *kvm, u16 *rc, u16 *rrc) + */ + if (kvm->arch.pv.set_aside) + return -EINVAL; ++ ++ /* Guest with segment type ASCE, refuse to destroy asynchronously */ ++ if ((kvm->arch.gmap->asce & _ASCE_TYPE_MASK) == _ASCE_TYPE_SEGMENT) ++ return -EINVAL; ++ + priv = kzalloc(sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; +diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c +index 74e1d873dce05..784fc6cbddb1a 100644 +--- a/arch/s390/mm/gmap.c ++++ b/arch/s390/mm/gmap.c +@@ -2830,6 +2830,9 @@ EXPORT_SYMBOL_GPL(s390_unlist_old_asce); + * s390_replace_asce - Try to replace the current ASCE of a gmap with a copy + * @gmap: the gmap whose ASCE needs to be replaced + * ++ * If the ASCE is a SEGMENT type then this function will return -EINVAL, ++ * otherwise the pointers in the host_to_guest radix tree will keep pointing ++ * to the wrong pages, causing use-after-free and memory corruption. + * If the allocation of the new top level page table fails, the ASCE is not + * replaced. + * In any case, the old ASCE is always removed from the gmap CRST list. +@@ -2844,6 +2847,10 @@ int s390_replace_asce(struct gmap *gmap) + + s390_unlist_old_asce(gmap); + ++ /* Replacing segment type ASCEs would cause serious issues */ ++ if ((gmap->asce & _ASCE_TYPE_MASK) == _ASCE_TYPE_SEGMENT) ++ return -EINVAL; ++ + page = alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); + if (!page) + return -ENOMEM; +-- +2.39.2 + diff --git a/queue-6.2/net-bcmgenet-remove-phy_stop-from-bcmgenet_netif_sto.patch b/queue-6.2/net-bcmgenet-remove-phy_stop-from-bcmgenet_netif_sto.patch new file mode 100644 index 00000000000..a2df2ba0fbc --- /dev/null +++ b/queue-6.2/net-bcmgenet-remove-phy_stop-from-bcmgenet_netif_sto.patch @@ -0,0 +1,37 @@ +From c6cbebae2731beb9c56aab2a2b620bcdd6bead0f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 4 May 2023 16:07:27 -0700 +Subject: net: bcmgenet: Remove phy_stop() from bcmgenet_netif_stop() + +From: Florian Fainelli + +[ Upstream commit 93e0401e0fc0c54b0ac05b687cd135c2ac38187c ] + +The call to phy_stop() races with the later call to phy_disconnect(), +resulting in concurrent phy_suspend() calls being run from different +CPUs. The final call to phy_disconnect() ensures that the PHY is +stopped and suspended, too. + +Fixes: c96e731c93ff ("net: bcmgenet: connect and disconnect from the PHY state machine") +Signed-off-by: Florian Fainelli +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/broadcom/genet/bcmgenet.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c +index d937daa8ee883..f28ffc31df220 100644 +--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c ++++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c +@@ -3465,7 +3465,6 @@ static void bcmgenet_netif_stop(struct net_device *dev) + /* Disable MAC transmit. TX DMA disabled must be done before this */ + umac_enable_set(priv, CMD_TX_EN, false); + +- phy_stop(dev->phydev); + bcmgenet_disable_rx_napi(priv); + bcmgenet_intr_disable(priv); + +-- +2.39.2 + diff --git a/queue-6.2/net-dsa-mt7530-fix-corrupt-frames-using-trgmii-on-40.patch b/queue-6.2/net-dsa-mt7530-fix-corrupt-frames-using-trgmii-on-40.patch new file mode 100644 index 00000000000..f0b184824ec --- /dev/null +++ b/queue-6.2/net-dsa-mt7530-fix-corrupt-frames-using-trgmii-on-40.patch @@ -0,0 +1,65 @@ +From 8a9d6cb8833fca0e02eadc027397cfc9f91a75a8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 3 May 2023 00:09:46 +0300 +Subject: net: dsa: mt7530: fix corrupt frames using trgmii on 40 MHz XTAL + MT7621 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Arınç ÜNAL + +[ Upstream commit 37c218d8021e36e226add4bab93d071d30fe0704 ] + +The multi-chip module MT7530 switch with a 40 MHz oscillator on the +MT7621AT, MT7621DAT, and MT7621ST SoCs forwards corrupt frames using +trgmii. + +This is caused by the assumption that MT7621 SoCs have got 150 MHz PLL, +hence using the ncpo1 value, 0x0780. + +My testing shows this value works on Unielec U7621-06, Bartel's testing +shows it won't work on Hi-Link HLK-MT7621A and Netgear WAC104. All devices +tested have got 40 MHz oscillators. + +Using the value for 125 MHz PLL, 0x0640, works on all boards at hand. The +definitions for 125 MHz PLL exist on the Banana Pi BPI-R2 BSP source code +whilst 150 MHz PLL don't. + +Forwarding frames using trgmii on the MCM MT7530 switch with a 25 MHz +oscillator on the said MT7621 SoCs works fine because the ncpo1 value +defined for it is for 125 MHz PLL. + +Change the 150 MHz PLL comment to 125 MHz PLL, and use the 125 MHz PLL +ncpo1 values for both oscillator frequencies. + +Link: https://github.com/BPI-SINOVOIP/BPI-R2-bsp/blob/81d24bbce7d99524d0771a8bdb2d6663e4eb4faa/u-boot-mt/drivers/net/rt2880_eth.c#L2195 +Fixes: 7ef6f6f8d237 ("net: dsa: mt7530: Add MT7621 TRGMII mode support") +Tested-by: Bartel Eerdekens +Signed-off-by: Arınç ÜNAL +Reviewed-by: Florian Fainelli +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/dsa/mt7530.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c +index 326f992536a7e..f61e6e89339e1 100644 +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -446,9 +446,9 @@ mt7530_pad_clk_setup(struct dsa_switch *ds, phy_interface_t interface) + else + ssc_delta = 0x87; + if (priv->id == ID_MT7621) { +- /* PLL frequency: 150MHz: 1.2GBit */ ++ /* PLL frequency: 125MHz: 1.0GBit */ + if (xtal == HWTRAP_XTAL_40MHZ) +- ncpo1 = 0x0780; ++ ncpo1 = 0x0640; + if (xtal == HWTRAP_XTAL_25MHZ) + ncpo1 = 0x0a00; + } else { /* PLL frequency: 250MHz: 2.0Gbit */ +-- +2.39.2 + diff --git a/queue-6.2/net-dsa-mt7530-fix-network-connectivity-with-multipl.patch b/queue-6.2/net-dsa-mt7530-fix-network-connectivity-with-multipl.patch new file mode 100644 index 00000000000..06b39c990f8 --- /dev/null +++ b/queue-6.2/net-dsa-mt7530-fix-network-connectivity-with-multipl.patch @@ -0,0 +1,78 @@ +From 76131e87257caa01a00b4eaff7bb58e3f7faf212 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 3 May 2023 00:09:47 +0300 +Subject: net: dsa: mt7530: fix network connectivity with multiple CPU ports +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Arınç ÜNAL + +[ Upstream commit 120a56b01beed51ab5956a734adcfd2760307107 ] + +On mt753x_cpu_port_enable() there's code that enables flooding for the CPU +port only. Since mt753x_cpu_port_enable() runs twice when both CPU ports +are enabled, port 6 becomes the only port to forward the frames to. But +port 5 is the active port, so no frames received from the user ports will +be forwarded to port 5 which breaks network connectivity. + +Every bit of the BC_FFP, UNM_FFP, and UNU_FFP bits represents a port. Fix +this issue by setting the bit that corresponds to the CPU port without +overwriting the other bits. + +Clear the bits beforehand only for the MT7531 switch. According to the +documents MT7621 Giga Switch Programming Guide v0.3 and MT7531 Reference +Manual for Development Board v1.0, after reset, the BC_FFP, UNM_FFP, and +UNU_FFP bits are set to 1 for MT7531, 0 for MT7530. + +The commit 5e5502e012b8 ("net: dsa: mt7530: fix roaming from DSA user +ports") silently changed the method to set the bits on the MT7530_MFC. +Instead of clearing the relevant bits before mt7530_cpu_port_enable() +which runs under a for loop, the commit started doing it on +mt7530_cpu_port_enable(). + +Back then, this didn't really matter as only a single CPU port could be +used since the CPU port number was hardcoded. The driver was later changed +with commit 1f9a6abecf53 ("net: dsa: mt7530: get cpu-port via dp->cpu_dp +instead of constant") to retrieve the CPU port via dp->cpu_dp. With that, +this silent change became an issue for when using multiple CPU ports. + +Fixes: 5e5502e012b8 ("net: dsa: mt7530: fix roaming from DSA user ports") +Signed-off-by: Arınç ÜNAL +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/dsa/mt7530.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c +index 54babe1f2b751..69b6a9265e4e4 100644 +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -1015,9 +1015,9 @@ mt753x_cpu_port_enable(struct dsa_switch *ds, int port) + mt7530_write(priv, MT7530_PVC_P(port), + PORT_SPEC_TAG); + +- /* Disable flooding by default */ +- mt7530_rmw(priv, MT7530_MFC, BC_FFP_MASK | UNM_FFP_MASK | UNU_FFP_MASK, +- BC_FFP(BIT(port)) | UNM_FFP(BIT(port)) | UNU_FFP(BIT(port))); ++ /* Enable flooding on the CPU port */ ++ mt7530_set(priv, MT7530_MFC, BC_FFP(BIT(port)) | UNM_FFP(BIT(port)) | ++ UNU_FFP(BIT(port))); + + /* Set CPU port number */ + if (priv->id == ID_MT7621) +@@ -2331,6 +2331,10 @@ mt7531_setup_common(struct dsa_switch *ds) + /* Enable and reset MIB counters */ + mt7530_mib_reset(ds); + ++ /* Disable flooding on all ports */ ++ mt7530_clear(priv, MT7530_MFC, BC_FFP_MASK | UNM_FFP_MASK | ++ UNU_FFP_MASK); ++ + for (i = 0; i < MT7530_NUM_PORTS; i++) { + /* Disable forwarding by default on all ports */ + mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK, +-- +2.39.2 + diff --git a/queue-6.2/net-dsa-mt7530-split-off-common-parts-from-mt7531_se.patch b/queue-6.2/net-dsa-mt7530-split-off-common-parts-from-mt7531_se.patch new file mode 100644 index 00000000000..eeffdefe23a --- /dev/null +++ b/queue-6.2/net-dsa-mt7530-split-off-common-parts-from-mt7531_se.patch @@ -0,0 +1,154 @@ +From c1dd6a3465f79554bec503a0a4d63325e0bc9a45 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 3 Apr 2023 02:19:02 +0100 +Subject: net: dsa: mt7530: split-off common parts from mt7531_setup + +From: Daniel Golle + +[ Upstream commit 7f54cc9772ced2d76ac11832f0ada43798443ac9 ] + +MT7988 shares a significant part of the setup function with MT7531. +Split-off those parts into a shared function which is going to be used +also by mt7988_setup. + +Signed-off-by: Daniel Golle +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +Stable-dep-of: 120a56b01bee ("net: dsa: mt7530: fix network connectivity with multiple CPU ports") +Signed-off-by: Sasha Levin +--- + drivers/net/dsa/mt7530.c | 99 ++++++++++++++++++++++------------------ + 1 file changed, 55 insertions(+), 44 deletions(-) + +diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c +index f61e6e89339e1..54babe1f2b751 100644 +--- a/drivers/net/dsa/mt7530.c ++++ b/drivers/net/dsa/mt7530.c +@@ -2312,12 +2312,65 @@ mt7530_setup(struct dsa_switch *ds) + return 0; + } + ++static int ++mt7531_setup_common(struct dsa_switch *ds) ++{ ++ struct mt7530_priv *priv = ds->priv; ++ struct dsa_port *cpu_dp; ++ int ret, i; ++ ++ /* BPDU to CPU port */ ++ dsa_switch_for_each_cpu_port(cpu_dp, ds) { ++ mt7530_rmw(priv, MT7531_CFC, MT7531_CPU_PMAP_MASK, ++ BIT(cpu_dp->index)); ++ break; ++ } ++ mt7530_rmw(priv, MT753X_BPC, MT753X_BPDU_PORT_FW_MASK, ++ MT753X_BPDU_CPU_ONLY); ++ ++ /* Enable and reset MIB counters */ ++ mt7530_mib_reset(ds); ++ ++ for (i = 0; i < MT7530_NUM_PORTS; i++) { ++ /* Disable forwarding by default on all ports */ ++ mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK, ++ PCR_MATRIX_CLR); ++ ++ /* Disable learning by default on all ports */ ++ mt7530_set(priv, MT7530_PSC_P(i), SA_DIS); ++ ++ mt7530_set(priv, MT7531_DBG_CNT(i), MT7531_DIS_CLR); ++ ++ if (dsa_is_cpu_port(ds, i)) { ++ ret = mt753x_cpu_port_enable(ds, i); ++ if (ret) ++ return ret; ++ } else { ++ mt7530_port_disable(ds, i); ++ ++ /* Set default PVID to 0 on all user ports */ ++ mt7530_rmw(priv, MT7530_PPBV1_P(i), G0_PORT_VID_MASK, ++ G0_PORT_VID_DEF); ++ } ++ ++ /* Enable consistent egress tag */ ++ mt7530_rmw(priv, MT7530_PVC_P(i), PVC_EG_TAG_MASK, ++ PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT)); ++ } ++ ++ /* Flush the FDB table */ ++ ret = mt7530_fdb_cmd(priv, MT7530_FDB_FLUSH, NULL); ++ if (ret < 0) ++ return ret; ++ ++ return 0; ++} ++ + static int + mt7531_setup(struct dsa_switch *ds) + { + struct mt7530_priv *priv = ds->priv; + struct mt7530_dummy_poll p; +- struct dsa_port *cpu_dp; + u32 val, id; + int ret, i; + +@@ -2395,44 +2448,7 @@ mt7531_setup(struct dsa_switch *ds) + mt7531_ind_c45_phy_write(priv, MT753X_CTRL_PHY_ADDR, MDIO_MMD_VEND2, + CORE_PLL_GROUP4, val); + +- /* BPDU to CPU port */ +- dsa_switch_for_each_cpu_port(cpu_dp, ds) { +- mt7530_rmw(priv, MT7531_CFC, MT7531_CPU_PMAP_MASK, +- BIT(cpu_dp->index)); +- break; +- } +- mt7530_rmw(priv, MT753X_BPC, MT753X_BPDU_PORT_FW_MASK, +- MT753X_BPDU_CPU_ONLY); +- +- /* Enable and reset MIB counters */ +- mt7530_mib_reset(ds); +- +- for (i = 0; i < MT7530_NUM_PORTS; i++) { +- /* Disable forwarding by default on all ports */ +- mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK, +- PCR_MATRIX_CLR); +- +- /* Disable learning by default on all ports */ +- mt7530_set(priv, MT7530_PSC_P(i), SA_DIS); +- +- mt7530_set(priv, MT7531_DBG_CNT(i), MT7531_DIS_CLR); +- +- if (dsa_is_cpu_port(ds, i)) { +- ret = mt753x_cpu_port_enable(ds, i); +- if (ret) +- return ret; +- } else { +- mt7530_port_disable(ds, i); +- +- /* Set default PVID to 0 on all user ports */ +- mt7530_rmw(priv, MT7530_PPBV1_P(i), G0_PORT_VID_MASK, +- G0_PORT_VID_DEF); +- } +- +- /* Enable consistent egress tag */ +- mt7530_rmw(priv, MT7530_PVC_P(i), PVC_EG_TAG_MASK, +- PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT)); +- } ++ mt7531_setup_common(ds); + + /* Setup VLAN ID 0 for VLAN-unaware bridges */ + ret = mt7530_setup_vlan0(priv); +@@ -2442,11 +2458,6 @@ mt7531_setup(struct dsa_switch *ds) + ds->assisted_learning_on_cpu_port = true; + ds->mtu_enforcement_ingress = true; + +- /* Flush the FDB table */ +- ret = mt7530_fdb_cmd(priv, MT7530_FDB_FLUSH, NULL); +- if (ret < 0) +- return ret; +- + return 0; + } + +-- +2.39.2 + diff --git a/queue-6.2/net-dsa-mv88e6xxx-add-mv88e6321-rsvd2cpu.patch b/queue-6.2/net-dsa-mv88e6xxx-add-mv88e6321-rsvd2cpu.patch new file mode 100644 index 00000000000..69d30ba5457 --- /dev/null +++ b/queue-6.2/net-dsa-mv88e6xxx-add-mv88e6321-rsvd2cpu.patch @@ -0,0 +1,36 @@ +From 003c7ca61a93f430d6edf00d01cfd9382c64d408 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Apr 2023 22:28:15 +0200 +Subject: net: dsa: mv88e6xxx: add mv88e6321 rsvd2cpu + +From: Angelo Dureghello + +[ Upstream commit 6686317855c6997671982d4489ccdd946f644957 ] + +Add rsvd2cpu capability for mv88e6321 model, to allow proper bpdu +processing. + +Signed-off-by: Angelo Dureghello +Fixes: 51c901a775621 ("net: dsa: mv88e6xxx: distinguish Global 2 Rsvd2CPU") +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/dsa/mv88e6xxx/chip.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c +index e57d86484a3a4..9959262ebad2c 100644 +--- a/drivers/net/dsa/mv88e6xxx/chip.c ++++ b/drivers/net/dsa/mv88e6xxx/chip.c +@@ -5113,6 +5113,7 @@ static const struct mv88e6xxx_ops mv88e6321_ops = { + .set_cpu_port = mv88e6095_g1_set_cpu_port, + .set_egress_port = mv88e6095_g1_set_egress_port, + .watchdog_ops = &mv88e6390_watchdog_ops, ++ .mgmt_rsvd2cpu = mv88e6352_g2_mgmt_rsvd2cpu, + .reset = mv88e6352_g1_reset, + .vtu_getnext = mv88e6185_g1_vtu_getnext, + .vtu_loadpurge = mv88e6185_g1_vtu_loadpurge, +-- +2.39.2 + diff --git a/queue-6.2/net-enetc-check-the-index-of-the-sfi-rather-than-the.patch b/queue-6.2/net-enetc-check-the-index-of-the-sfi-rather-than-the.patch new file mode 100644 index 00000000000..53f0a5c8b51 --- /dev/null +++ b/queue-6.2/net-enetc-check-the-index-of-the-sfi-rather-than-the.patch @@ -0,0 +1,38 @@ +From 44882eae812f117b330ba4566f9d87e08dfb87c1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 4 May 2023 16:03:59 +0800 +Subject: net: enetc: check the index of the SFI rather than the handle + +From: Wei Fang + +[ Upstream commit 299efdc2380aac588557f4d0b2ce7bee05bd0cf2 ] + +We should check whether the current SFI (Stream Filter Instance) table +is full before creating a new SFI entry. However, the previous logic +checks the handle by mistake and might lead to unpredictable behavior. + +Fixes: 888ae5a3952b ("net: enetc: add tc flower psfp offload driver") +Signed-off-by: Wei Fang +Reviewed-by: Leon Romanovsky +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/freescale/enetc/enetc_qos.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/freescale/enetc/enetc_qos.c b/drivers/net/ethernet/freescale/enetc/enetc_qos.c +index fcebb54224c09..a8539a8554a13 100644 +--- a/drivers/net/ethernet/freescale/enetc/enetc_qos.c ++++ b/drivers/net/ethernet/freescale/enetc/enetc_qos.c +@@ -1255,7 +1255,7 @@ static int enetc_psfp_parse_clsflower(struct enetc_ndev_priv *priv, + int index; + + index = enetc_get_free_index(priv); +- if (sfi->handle < 0) { ++ if (index < 0) { + NL_SET_ERR_MSG_MOD(extack, "No Stream Filter resource!"); + err = -ENOSPC; + goto free_fmi; +-- +2.39.2 + diff --git a/queue-6.2/net-ethernet-mtk_eth_soc-drop-generic-vlan-rx-offloa.patch b/queue-6.2/net-ethernet-mtk_eth_soc-drop-generic-vlan-rx-offloa.patch new file mode 100644 index 00000000000..655bda4e580 --- /dev/null +++ b/queue-6.2/net-ethernet-mtk_eth_soc-drop-generic-vlan-rx-offloa.patch @@ -0,0 +1,224 @@ +From fe68d3a783a815f87dcf5722a32aaa3124e7233b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Apr 2023 19:21:53 +0200 +Subject: net: ethernet: mtk_eth_soc: drop generic vlan rx offload, only use + DSA untagging +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Felix Fietkau + +[ Upstream commit c6d96df9fa2c1d19525239d4262889cce594ce6c ] + +Through testing I found out that hardware vlan rx offload support seems to +have some hardware issues. At least when using multiple MACs and when +receiving tagged packets on the secondary MAC, the hardware can sometimes +start to emit wrong tags on the first MAC as well. + +In order to avoid such issues, drop the feature configuration and use +the offload feature only for DSA hardware untagging on MT7621/MT7622 +devices where this feature works properly. + +Fixes: 08666cbb7dd5 ("net: ethernet: mtk_eth_soc: add support for configuring vlan rx offload") +Tested-by: Frank Wunderlich +Signed-off-by: Felix Fietkau +Signed-off-by: Frank Wunderlich +Tested-by: Arınç ÜNAL +Acked-by: Arınç ÜNAL +Link: https://lore.kernel.org/r/20230426172153.8352-1-linux@fw-web.de +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/mediatek/mtk_eth_soc.c | 106 ++++++++------------ + drivers/net/ethernet/mediatek/mtk_eth_soc.h | 1 - + 2 files changed, 40 insertions(+), 67 deletions(-) + +diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +index f56d4e7d4ae5d..4671d738a37c7 100644 +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c +@@ -1870,9 +1870,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget, + + while (done < budget) { + unsigned int pktlen, *rxdcsum; +- bool has_hwaccel_tag = false; + struct net_device *netdev; +- u16 vlan_proto, vlan_tci; + dma_addr_t dma_addr; + u32 hash, reason; + int mac = 0; +@@ -2007,31 +2005,16 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget, + skb_checksum_none_assert(skb); + skb->protocol = eth_type_trans(skb, netdev); + +- if (netdev->features & NETIF_F_HW_VLAN_CTAG_RX) { +- if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { +- if (trxd.rxd3 & RX_DMA_VTAG_V2) { +- vlan_proto = RX_DMA_VPID(trxd.rxd4); +- vlan_tci = RX_DMA_VID(trxd.rxd4); +- has_hwaccel_tag = true; +- } +- } else if (trxd.rxd2 & RX_DMA_VTAG) { +- vlan_proto = RX_DMA_VPID(trxd.rxd3); +- vlan_tci = RX_DMA_VID(trxd.rxd3); +- has_hwaccel_tag = true; +- } +- } +- + /* When using VLAN untagging in combination with DSA, the + * hardware treats the MTK special tag as a VLAN and untags it. + */ +- if (has_hwaccel_tag && netdev_uses_dsa(netdev)) { +- unsigned int port = vlan_proto & GENMASK(2, 0); ++ if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2) && ++ (trxd.rxd2 & RX_DMA_VTAG) && netdev_uses_dsa(netdev)) { ++ unsigned int port = RX_DMA_VPID(trxd.rxd3) & GENMASK(2, 0); + + if (port < ARRAY_SIZE(eth->dsa_meta) && + eth->dsa_meta[port]) + skb_dst_set_noref(skb, ð->dsa_meta[port]->dst); +- } else if (has_hwaccel_tag) { +- __vlan_hwaccel_put_tag(skb, htons(vlan_proto), vlan_tci); + } + + if (reason == MTK_PPE_CPU_REASON_HIT_UNBIND_RATE_REACHED) +@@ -2859,29 +2842,11 @@ static netdev_features_t mtk_fix_features(struct net_device *dev, + + static int mtk_set_features(struct net_device *dev, netdev_features_t features) + { +- struct mtk_mac *mac = netdev_priv(dev); +- struct mtk_eth *eth = mac->hw; + netdev_features_t diff = dev->features ^ features; +- int i; + + if ((diff & NETIF_F_LRO) && !(features & NETIF_F_LRO)) + mtk_hwlro_netdev_disable(dev); + +- /* Set RX VLAN offloading */ +- if (!(diff & NETIF_F_HW_VLAN_CTAG_RX)) +- return 0; +- +- mtk_w32(eth, !!(features & NETIF_F_HW_VLAN_CTAG_RX), +- MTK_CDMP_EG_CTRL); +- +- /* sync features with other MAC */ +- for (i = 0; i < MTK_MAC_COUNT; i++) { +- if (!eth->netdev[i] || eth->netdev[i] == dev) +- continue; +- eth->netdev[i]->features &= ~NETIF_F_HW_VLAN_CTAG_RX; +- eth->netdev[i]->features |= features & NETIF_F_HW_VLAN_CTAG_RX; +- } +- + return 0; + } + +@@ -3184,30 +3149,6 @@ static int mtk_open(struct net_device *dev) + struct mtk_eth *eth = mac->hw; + int i, err; + +- if (mtk_uses_dsa(dev) && !eth->prog) { +- for (i = 0; i < ARRAY_SIZE(eth->dsa_meta); i++) { +- struct metadata_dst *md_dst = eth->dsa_meta[i]; +- +- if (md_dst) +- continue; +- +- md_dst = metadata_dst_alloc(0, METADATA_HW_PORT_MUX, +- GFP_KERNEL); +- if (!md_dst) +- return -ENOMEM; +- +- md_dst->u.port_info.port_id = i; +- eth->dsa_meta[i] = md_dst; +- } +- } else { +- /* Hardware special tag parsing needs to be disabled if at least +- * one MAC does not use DSA. +- */ +- u32 val = mtk_r32(eth, MTK_CDMP_IG_CTRL); +- val &= ~MTK_CDMP_STAG_EN; +- mtk_w32(eth, val, MTK_CDMP_IG_CTRL); +- } +- + err = phylink_of_phy_connect(mac->phylink, mac->of_node, 0); + if (err) { + netdev_err(dev, "%s: could not attach PHY: %d\n", __func__, +@@ -3246,6 +3187,40 @@ static int mtk_open(struct net_device *dev) + phylink_start(mac->phylink); + netif_tx_start_all_queues(dev); + ++ if (MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) ++ return 0; ++ ++ if (mtk_uses_dsa(dev) && !eth->prog) { ++ for (i = 0; i < ARRAY_SIZE(eth->dsa_meta); i++) { ++ struct metadata_dst *md_dst = eth->dsa_meta[i]; ++ ++ if (md_dst) ++ continue; ++ ++ md_dst = metadata_dst_alloc(0, METADATA_HW_PORT_MUX, ++ GFP_KERNEL); ++ if (!md_dst) ++ return -ENOMEM; ++ ++ md_dst->u.port_info.port_id = i; ++ eth->dsa_meta[i] = md_dst; ++ } ++ } else { ++ /* Hardware special tag parsing needs to be disabled if at least ++ * one MAC does not use DSA. ++ */ ++ u32 val = mtk_r32(eth, MTK_CDMP_IG_CTRL); ++ ++ val &= ~MTK_CDMP_STAG_EN; ++ mtk_w32(eth, val, MTK_CDMP_IG_CTRL); ++ ++ val = mtk_r32(eth, MTK_CDMQ_IG_CTRL); ++ val &= ~MTK_CDMQ_STAG_EN; ++ mtk_w32(eth, val, MTK_CDMQ_IG_CTRL); ++ ++ mtk_w32(eth, 0, MTK_CDMP_EG_CTRL); ++ } ++ + return 0; + } + +@@ -3572,10 +3547,9 @@ static int mtk_hw_init(struct mtk_eth *eth) + if (!MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2)) { + val = mtk_r32(eth, MTK_CDMP_IG_CTRL); + mtk_w32(eth, val | MTK_CDMP_STAG_EN, MTK_CDMP_IG_CTRL); +- } + +- /* Enable RX VLan Offloading */ +- mtk_w32(eth, 1, MTK_CDMP_EG_CTRL); ++ mtk_w32(eth, 1, MTK_CDMP_EG_CTRL); ++ } + + /* set interrupt delays based on current Net DIM sample */ + mtk_dim_rx(ð->rx_dim.work); +@@ -4176,7 +4150,7 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np) + eth->netdev[id]->hw_features |= NETIF_F_LRO; + + eth->netdev[id]->vlan_features = eth->soc->hw_features & +- ~(NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_CTAG_RX); ++ ~NETIF_F_HW_VLAN_CTAG_TX; + eth->netdev[id]->features |= eth->soc->hw_features; + eth->netdev[id]->ethtool_ops = &mtk_ethtool_ops; + +diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +index d4b4f9eaa4419..79112bd3e952e 100644 +--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h ++++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h +@@ -48,7 +48,6 @@ + #define MTK_HW_FEATURES (NETIF_F_IP_CSUM | \ + NETIF_F_RXCSUM | \ + NETIF_F_HW_VLAN_CTAG_TX | \ +- NETIF_F_HW_VLAN_CTAG_RX | \ + NETIF_F_SG | NETIF_F_TSO | \ + NETIF_F_TSO6 | \ + NETIF_F_IPV6_CSUM |\ +-- +2.39.2 + diff --git a/queue-6.2/net-fec-correct-the-counting-of-xdp-sent-frames.patch b/queue-6.2/net-fec-correct-the-counting-of-xdp-sent-frames.patch new file mode 100644 index 00000000000..7a02d4543be --- /dev/null +++ b/queue-6.2/net-fec-correct-the-counting-of-xdp-sent-frames.patch @@ -0,0 +1,75 @@ +From 01b6aba433a463f3bfb33b83b9b9ef5026e8302f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 4 May 2023 10:35:17 -0500 +Subject: net: fec: correct the counting of XDP sent frames + +From: Shenwei Wang + +[ Upstream commit 26312c685ae0bca61e06ac75ee158b1e69546415 ] + +In the current xdp_xmit implementation, if any single frame fails to +transmit due to insufficient buffer descriptors, the function nevertheless +reports success in sending all frames. This results in erroneously +indicating that frames were transmitted when in fact they were dropped. + +This patch fixes the issue by ensureing the return value properly +indicates the actual number of frames successfully transmitted, rather than +potentially reporting success for all frames when some could not transmit. + +Fixes: 6d6b39f180b8 ("net: fec: add initial XDP support") +Signed-off-by: Gagandeep Singh +Signed-off-by: Shenwei Wang +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/freescale/fec_main.c | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c +index 2341597408d12..5fd3b41319827 100644 +--- a/drivers/net/ethernet/freescale/fec_main.c ++++ b/drivers/net/ethernet/freescale/fec_main.c +@@ -3737,7 +3737,8 @@ static int fec_enet_txq_xmit_frame(struct fec_enet_private *fep, + entries_free = fec_enet_get_free_txdesc_num(txq); + if (entries_free < MAX_SKB_FRAGS + 1) { + netdev_err(fep->netdev, "NOT enough BD for SG!\n"); +- return NETDEV_TX_OK; ++ xdp_return_frame(frame); ++ return NETDEV_TX_BUSY; + } + + /* Fill in a Tx ring entry */ +@@ -3795,6 +3796,7 @@ static int fec_enet_xdp_xmit(struct net_device *dev, + struct fec_enet_private *fep = netdev_priv(dev); + struct fec_enet_priv_tx_q *txq; + int cpu = smp_processor_id(); ++ unsigned int sent_frames = 0; + struct netdev_queue *nq; + unsigned int queue; + int i; +@@ -3805,8 +3807,11 @@ static int fec_enet_xdp_xmit(struct net_device *dev, + + __netif_tx_lock(nq, cpu); + +- for (i = 0; i < num_frames; i++) +- fec_enet_txq_xmit_frame(fep, txq, frames[i]); ++ for (i = 0; i < num_frames; i++) { ++ if (fec_enet_txq_xmit_frame(fep, txq, frames[i]) != 0) ++ break; ++ sent_frames++; ++ } + + /* Make sure the update to bdp and tx_skbuff are performed. */ + wmb(); +@@ -3816,7 +3821,7 @@ static int fec_enet_xdp_xmit(struct net_device *dev, + + __netif_tx_unlock(nq); + +- return num_frames; ++ return sent_frames; + } + + static const struct net_device_ops fec_netdev_ops = { +-- +2.39.2 + diff --git a/queue-6.2/net-ipv6-fix-skb-hash-for-some-rst-packets.patch b/queue-6.2/net-ipv6-fix-skb-hash-for-some-rst-packets.patch new file mode 100644 index 00000000000..ffbd9461562 --- /dev/null +++ b/queue-6.2/net-ipv6-fix-skb-hash-for-some-rst-packets.patch @@ -0,0 +1,53 @@ +From 30b433c4c059c4c4315ef686ee5141cf579b2dae Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 Apr 2023 11:21:59 +0200 +Subject: net: ipv6: fix skb hash for some RST packets + +From: Antoine Tenart + +[ Upstream commit dc6456e938e938d64ffb6383a286b2ac9790a37f ] + +The skb hash comes from sk->sk_txhash when using TCP, except for some +IPv6 RST packets. This is because in tcp_v6_send_reset when not in +TIME_WAIT the hash is taken from sk->sk_hash, while it should come from +sk->sk_txhash as those two hashes are not computed the same way. + +Packetdrill script to test the above, + + 0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 + +0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 + +0 connect(3, ..., ...) = -1 EINPROGRESS (Operation now in progress) + + +0 > (flowlabel 0x1) S 0:0(0) <...> + + // Wrong ack seq, trigger a rst. + +0 < S. 0:0(0) ack 0 win 4000 + + // Check the flowlabel matches prior one from SYN. + +0 > (flowlabel 0x1) R 0:0(0) <...> + +Fixes: 9258b8b1be2e ("ipv6: tcp: send consistent autoflowlabel in RST packets") +Signed-off-by: Antoine Tenart +Reviewed-by: Eric Dumazet +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/ipv6/tcp_ipv6.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c +index e4da7267ed4bd..e0706c33e5472 100644 +--- a/net/ipv6/tcp_ipv6.c ++++ b/net/ipv6/tcp_ipv6.c +@@ -1064,7 +1064,7 @@ static void tcp_v6_send_reset(const struct sock *sk, struct sk_buff *skb) + if (np->repflow) + label = ip6_flowlabel(ipv6h); + priority = sk->sk_priority; +- txhash = sk->sk_hash; ++ txhash = sk->sk_txhash; + } + if (sk->sk_state == TCP_TIME_WAIT) { + label = cpu_to_be32(inet_twsk(sk)->tw_flowlabel); +-- +2.39.2 + diff --git a/queue-6.2/net-ncsi-clear-tx-enable-mode-when-handling-a-config.patch b/queue-6.2/net-ncsi-clear-tx-enable-mode-when-handling-a-config.patch new file mode 100644 index 00000000000..2cc51a1fb7a --- /dev/null +++ b/queue-6.2/net-ncsi-clear-tx-enable-mode-when-handling-a-config.patch @@ -0,0 +1,41 @@ +From eeee1559e763cb3d1929cff0a88985a63b670f63 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Apr 2023 16:13:50 +0800 +Subject: net/ncsi: clear Tx enable mode when handling a Config required AEN + +From: Cosmo Chou + +[ Upstream commit 6f75cd166a5a3c0bc50441faa8b8304f60522fdd ] + +ncsi_channel_is_tx() determines whether a given channel should be +used for Tx or not. However, when reconfiguring the channel by +handling a Configuration Required AEN, there is a misjudgment that +the channel Tx has already been enabled, which results in the Enable +Channel Network Tx command not being sent. + +Clear the channel Tx enable flag before reconfiguring the channel to +avoid the misjudgment. + +Fixes: 8d951a75d022 ("net/ncsi: Configure multi-package, multi-channel modes with failover") +Signed-off-by: Cosmo Chou +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/ncsi/ncsi-aen.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/net/ncsi/ncsi-aen.c b/net/ncsi/ncsi-aen.c +index b635c194f0a85..62fb1031763d1 100644 +--- a/net/ncsi/ncsi-aen.c ++++ b/net/ncsi/ncsi-aen.c +@@ -165,6 +165,7 @@ static int ncsi_aen_handler_cr(struct ncsi_dev_priv *ndp, + nc->state = NCSI_CHANNEL_INACTIVE; + list_add_tail_rcu(&nc->link, &ndp->channel_queue); + spin_unlock_irqrestore(&ndp->lock, flags); ++ nc->modes[NCSI_MODE_TX_ENABLE].enable = 0; + + return ncsi_process_next_channel(ndp); + } +-- +2.39.2 + diff --git a/queue-6.2/net-sched-act_mirred-add-carrier-check.patch b/queue-6.2/net-sched-act_mirred-add-carrier-check.patch new file mode 100644 index 00000000000..2084f9790ed --- /dev/null +++ b/queue-6.2/net-sched-act_mirred-add-carrier-check.patch @@ -0,0 +1,49 @@ +From 7d98048a3066f2f3720c960545cd4d42fb38550d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Apr 2023 15:19:40 +0000 +Subject: net/sched: act_mirred: Add carrier check + +From: Victor Nogueira + +[ Upstream commit 526f28bd0fbdc699cda31426928802650c1528e5 ] + +There are cases where the device is adminstratively UP, but operationally +down. For example, we have a physical device (Nvidia ConnectX-6 Dx, 25Gbps) +who's cable was pulled out, here is its ip link output: + +5: ens2f1: mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000 + link/ether b8:ce:f6:4b:68:35 brd ff:ff:ff:ff:ff:ff + altname enp179s0f1np1 + +As you can see, it's administratively UP but operationally down. +In this case, sending a packet to this port caused a nasty kernel hang (so +nasty that we were unable to capture it). Aborting a transmit based on +operational status (in addition to administrative status) fixes the issue. + +Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") +Acked-by: Jamal Hadi Salim +Signed-off-by: Victor Nogueira +v1->v2: Add fixes tag +v2->v3: Remove blank line between tags + add change log, suggested by Leon +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/sched/act_mirred.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c +index 8037ec9b1d311..a61482c5edbe7 100644 +--- a/net/sched/act_mirred.c ++++ b/net/sched/act_mirred.c +@@ -264,7 +264,7 @@ TC_INDIRECT_SCOPE int tcf_mirred_act(struct sk_buff *skb, + goto out; + } + +- if (unlikely(!(dev->flags & IFF_UP))) { ++ if (unlikely(!(dev->flags & IFF_UP)) || !netif_carrier_ok(dev)) { + net_notice_ratelimited("tc mirred to Houston: device %s is down\n", + dev->name); + goto out; +-- +2.39.2 + diff --git a/queue-6.2/net-sched-cls_api-remove-block_cb-from-driver_list-b.patch b/queue-6.2/net-sched-cls_api-remove-block_cb-from-driver_list-b.patch new file mode 100644 index 00000000000..a96c227f146 --- /dev/null +++ b/queue-6.2/net-sched-cls_api-remove-block_cb-from-driver_list-b.patch @@ -0,0 +1,192 @@ +From 8fb4731ebe327af95d4ee08ffb7fd2b65dffc120 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Apr 2023 14:31:11 +0200 +Subject: net/sched: cls_api: remove block_cb from driver_list before freeing + +From: Vlad Buslov + +[ Upstream commit da94a7781fc3c92e7df7832bc2746f4d39bc624e ] + +Error handler of tcf_block_bind() frees the whole bo->cb_list on error. +However, by that time the flow_block_cb instances are already in the driver +list because driver ndo_setup_tc() callback is called before that up the +call chain in tcf_block_offload_cmd(). This leaves dangling pointers to +freed objects in the list and causes use-after-free[0]. Fix it by also +removing flow_block_cb instances from driver_list before deallocating them. + +[0]: +[ 279.868433] ================================================================== +[ 279.869964] BUG: KASAN: slab-use-after-free in flow_block_cb_setup_simple+0x631/0x7c0 +[ 279.871527] Read of size 8 at addr ffff888147e2bf20 by task tc/2963 + +[ 279.873151] CPU: 6 PID: 2963 Comm: tc Not tainted 6.3.0-rc6+ #4 +[ 279.874273] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 +[ 279.876295] Call Trace: +[ 279.876882] +[ 279.877413] dump_stack_lvl+0x33/0x50 +[ 279.878198] print_report+0xc2/0x610 +[ 279.878987] ? flow_block_cb_setup_simple+0x631/0x7c0 +[ 279.879994] kasan_report+0xae/0xe0 +[ 279.880750] ? flow_block_cb_setup_simple+0x631/0x7c0 +[ 279.881744] ? mlx5e_tc_reoffload_flows_work+0x240/0x240 [mlx5_core] +[ 279.883047] flow_block_cb_setup_simple+0x631/0x7c0 +[ 279.884027] tcf_block_offload_cmd.isra.0+0x189/0x2d0 +[ 279.885037] ? tcf_block_setup+0x6b0/0x6b0 +[ 279.885901] ? mutex_lock+0x7d/0xd0 +[ 279.886669] ? __mutex_unlock_slowpath.constprop.0+0x2d0/0x2d0 +[ 279.887844] ? ingress_init+0x1c0/0x1c0 [sch_ingress] +[ 279.888846] tcf_block_get_ext+0x61c/0x1200 +[ 279.889711] ingress_init+0x112/0x1c0 [sch_ingress] +[ 279.890682] ? clsact_init+0x2b0/0x2b0 [sch_ingress] +[ 279.891701] qdisc_create+0x401/0xea0 +[ 279.892485] ? qdisc_tree_reduce_backlog+0x470/0x470 +[ 279.893473] tc_modify_qdisc+0x6f7/0x16d0 +[ 279.894344] ? tc_get_qdisc+0xac0/0xac0 +[ 279.895213] ? mutex_lock+0x7d/0xd0 +[ 279.896005] ? __mutex_lock_slowpath+0x10/0x10 +[ 279.896910] rtnetlink_rcv_msg+0x5fe/0x9d0 +[ 279.897770] ? rtnl_calcit.isra.0+0x2b0/0x2b0 +[ 279.898672] ? __sys_sendmsg+0xb5/0x140 +[ 279.899494] ? do_syscall_64+0x3d/0x90 +[ 279.900302] ? entry_SYSCALL_64_after_hwframe+0x46/0xb0 +[ 279.901337] ? kasan_save_stack+0x2e/0x40 +[ 279.902177] ? kasan_save_stack+0x1e/0x40 +[ 279.903058] ? kasan_set_track+0x21/0x30 +[ 279.903913] ? kasan_save_free_info+0x2a/0x40 +[ 279.904836] ? ____kasan_slab_free+0x11a/0x1b0 +[ 279.905741] ? kmem_cache_free+0x179/0x400 +[ 279.906599] netlink_rcv_skb+0x12c/0x360 +[ 279.907450] ? rtnl_calcit.isra.0+0x2b0/0x2b0 +[ 279.908360] ? netlink_ack+0x1550/0x1550 +[ 279.909192] ? rhashtable_walk_peek+0x170/0x170 +[ 279.910135] ? kmem_cache_alloc_node+0x1af/0x390 +[ 279.911086] ? _copy_from_iter+0x3d6/0xc70 +[ 279.912031] netlink_unicast+0x553/0x790 +[ 279.912864] ? netlink_attachskb+0x6a0/0x6a0 +[ 279.913763] ? netlink_recvmsg+0x416/0xb50 +[ 279.914627] netlink_sendmsg+0x7a1/0xcb0 +[ 279.915473] ? netlink_unicast+0x790/0x790 +[ 279.916334] ? iovec_from_user.part.0+0x4d/0x220 +[ 279.917293] ? netlink_unicast+0x790/0x790 +[ 279.918159] sock_sendmsg+0xc5/0x190 +[ 279.918938] ____sys_sendmsg+0x535/0x6b0 +[ 279.919813] ? import_iovec+0x7/0x10 +[ 279.920601] ? kernel_sendmsg+0x30/0x30 +[ 279.921423] ? __copy_msghdr+0x3c0/0x3c0 +[ 279.922254] ? import_iovec+0x7/0x10 +[ 279.923041] ___sys_sendmsg+0xeb/0x170 +[ 279.923854] ? copy_msghdr_from_user+0x110/0x110 +[ 279.924797] ? ___sys_recvmsg+0xd9/0x130 +[ 279.925630] ? __perf_event_task_sched_in+0x183/0x470 +[ 279.926656] ? ___sys_sendmsg+0x170/0x170 +[ 279.927529] ? ctx_sched_in+0x530/0x530 +[ 279.928369] ? update_curr+0x283/0x4f0 +[ 279.929185] ? perf_event_update_userpage+0x570/0x570 +[ 279.930201] ? __fget_light+0x57/0x520 +[ 279.931023] ? __switch_to+0x53d/0xe70 +[ 279.931846] ? sockfd_lookup_light+0x1a/0x140 +[ 279.932761] __sys_sendmsg+0xb5/0x140 +[ 279.933560] ? __sys_sendmsg_sock+0x20/0x20 +[ 279.934436] ? fpregs_assert_state_consistent+0x1d/0xa0 +[ 279.935490] do_syscall_64+0x3d/0x90 +[ 279.936300] entry_SYSCALL_64_after_hwframe+0x46/0xb0 +[ 279.937311] RIP: 0033:0x7f21c814f887 +[ 279.938085] Code: 0a 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b9 0f 1f 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 89 54 24 1c 48 89 74 24 10 +[ 279.941448] RSP: 002b:00007fff11efd478 EFLAGS: 00000246 ORIG_RAX: 000000000000002e +[ 279.942964] RAX: ffffffffffffffda RBX: 0000000064401979 RCX: 00007f21c814f887 +[ 279.944337] RDX: 0000000000000000 RSI: 00007fff11efd4e0 RDI: 0000000000000003 +[ 279.945660] RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000 +[ 279.947003] R10: 00007f21c8008708 R11: 0000000000000246 R12: 0000000000000001 +[ 279.948345] R13: 0000000000409980 R14: 000000000047e538 R15: 0000000000485400 +[ 279.949690] + +[ 279.950706] Allocated by task 2960: +[ 279.951471] kasan_save_stack+0x1e/0x40 +[ 279.952338] kasan_set_track+0x21/0x30 +[ 279.953165] __kasan_kmalloc+0x77/0x90 +[ 279.954006] flow_block_cb_setup_simple+0x3dd/0x7c0 +[ 279.955001] tcf_block_offload_cmd.isra.0+0x189/0x2d0 +[ 279.956020] tcf_block_get_ext+0x61c/0x1200 +[ 279.956881] ingress_init+0x112/0x1c0 [sch_ingress] +[ 279.957873] qdisc_create+0x401/0xea0 +[ 279.958656] tc_modify_qdisc+0x6f7/0x16d0 +[ 279.959506] rtnetlink_rcv_msg+0x5fe/0x9d0 +[ 279.960392] netlink_rcv_skb+0x12c/0x360 +[ 279.961216] netlink_unicast+0x553/0x790 +[ 279.962044] netlink_sendmsg+0x7a1/0xcb0 +[ 279.962906] sock_sendmsg+0xc5/0x190 +[ 279.963702] ____sys_sendmsg+0x535/0x6b0 +[ 279.964534] ___sys_sendmsg+0xeb/0x170 +[ 279.965343] __sys_sendmsg+0xb5/0x140 +[ 279.966132] do_syscall_64+0x3d/0x90 +[ 279.966908] entry_SYSCALL_64_after_hwframe+0x46/0xb0 + +[ 279.968407] Freed by task 2960: +[ 279.969114] kasan_save_stack+0x1e/0x40 +[ 279.969929] kasan_set_track+0x21/0x30 +[ 279.970729] kasan_save_free_info+0x2a/0x40 +[ 279.971603] ____kasan_slab_free+0x11a/0x1b0 +[ 279.972483] __kmem_cache_free+0x14d/0x280 +[ 279.973337] tcf_block_setup+0x29d/0x6b0 +[ 279.974173] tcf_block_offload_cmd.isra.0+0x226/0x2d0 +[ 279.975186] tcf_block_get_ext+0x61c/0x1200 +[ 279.976080] ingress_init+0x112/0x1c0 [sch_ingress] +[ 279.977065] qdisc_create+0x401/0xea0 +[ 279.977857] tc_modify_qdisc+0x6f7/0x16d0 +[ 279.978695] rtnetlink_rcv_msg+0x5fe/0x9d0 +[ 279.979562] netlink_rcv_skb+0x12c/0x360 +[ 279.980388] netlink_unicast+0x553/0x790 +[ 279.981214] netlink_sendmsg+0x7a1/0xcb0 +[ 279.982043] sock_sendmsg+0xc5/0x190 +[ 279.982827] ____sys_sendmsg+0x535/0x6b0 +[ 279.983703] ___sys_sendmsg+0xeb/0x170 +[ 279.984510] __sys_sendmsg+0xb5/0x140 +[ 279.985298] do_syscall_64+0x3d/0x90 +[ 279.986076] entry_SYSCALL_64_after_hwframe+0x46/0xb0 + +[ 279.987532] The buggy address belongs to the object at ffff888147e2bf00 + which belongs to the cache kmalloc-192 of size 192 +[ 279.989747] The buggy address is located 32 bytes inside of + freed 192-byte region [ffff888147e2bf00, ffff888147e2bfc0) + +[ 279.992367] The buggy address belongs to the physical page: +[ 279.993430] page:00000000550f405c refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x147e2a +[ 279.995182] head:00000000550f405c order:1 entire_mapcount:0 nr_pages_mapped:0 pincount:0 +[ 279.996713] anon flags: 0x200000000010200(slab|head|node=0|zone=2) +[ 279.997878] raw: 0200000000010200 ffff888100042a00 0000000000000000 dead000000000001 +[ 279.999384] raw: 0000000000000000 0000000000200020 00000001ffffffff 0000000000000000 +[ 280.000894] page dumped because: kasan: bad access detected + +[ 280.002386] Memory state around the buggy address: +[ 280.003338] ffff888147e2be00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb +[ 280.004781] ffff888147e2be80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc +[ 280.006224] >ffff888147e2bf00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb +[ 280.007700] ^ +[ 280.008592] ffff888147e2bf80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc +[ 280.010035] ffff888147e2c000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb +[ 280.011564] ================================================================== + +Fixes: 59094b1e5094 ("net: sched: use flow block API") +Signed-off-by: Vlad Buslov +Reviewed-by: Simon Horman +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/sched/cls_api.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c +index 668130f089034..3f37e9c10af4d 100644 +--- a/net/sched/cls_api.c ++++ b/net/sched/cls_api.c +@@ -1484,6 +1484,7 @@ static int tcf_block_bind(struct tcf_block *block, + + err_unroll: + list_for_each_entry_safe(block_cb, next, &bo->cb_list, list) { ++ list_del(&block_cb->driver_list); + if (i-- > 0) { + list_del(&block_cb->list); + tcf_block_playback_offloads(block, block_cb->cb, +-- +2.39.2 + diff --git a/queue-6.2/octeontx2-af-add-validation-for-lmac-type.patch b/queue-6.2/octeontx2-af-add-validation-for-lmac-type.patch new file mode 100644 index 00000000000..5d523b3f4d1 --- /dev/null +++ b/queue-6.2/octeontx2-af-add-validation-for-lmac-type.patch @@ -0,0 +1,60 @@ +From bb8e264ff8a82e1c030087085ccda7b34f5ff90d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 3 May 2023 12:39:38 +0530 +Subject: octeontx2-af: Add validation for lmac type + +From: Hariprasad Kelam + +[ Upstream commit cb5edce271764524b88b1a6866b3e626686d9a33 ] + +Upon physical link change, firmware reports to the kernel about the +change along with the details like speed, lmac_type_id, etc. +Kernel derives lmac_type based on lmac_type_id received from firmware. + +In a few scenarios, firmware returns an invalid lmac_type_id, which +is resulting in below kernel panic. This patch adds the missing +validation of the lmac_type_id field. + +Internal error: Oops: 96000005 [#1] PREEMPT SMP +[ 35.321595] Modules linked in: +[ 35.328982] CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted +5.4.210-g2e3169d8e1bc-dirty #17 +[ 35.337014] Hardware name: Marvell CN103XX board (DT) +[ 35.344297] Workqueue: events work_for_cpu_fn +[ 35.352730] pstate: 40400089 (nZcv daIf +PAN -UAO) +[ 35.360267] pc : strncpy+0x10/0x30 +[ 35.366595] lr : cgx_link_change_handler+0x90/0x180 + +Fixes: 61071a871ea6 ("octeontx2-af: Forward CGX link notifications to PFs") +Signed-off-by: Hariprasad Kelam +Signed-off-by: Sunil Kovvuri Goutham +Signed-off-by: Sai Krishna +Reviewed-by: Simon Horman +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c +index 724df6398bbe2..bd77152bb8d7c 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c ++++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c +@@ -1231,6 +1231,14 @@ static inline void link_status_user_format(u64 lstat, + linfo->an = FIELD_GET(RESP_LINKSTAT_AN, lstat); + linfo->fec = FIELD_GET(RESP_LINKSTAT_FEC, lstat); + linfo->lmac_type_id = FIELD_GET(RESP_LINKSTAT_LMAC_TYPE, lstat); ++ ++ if (linfo->lmac_type_id >= LMAC_MODE_MAX) { ++ dev_err(&cgx->pdev->dev, "Unknown lmac_type_id %d reported by firmware on cgx port%d:%d", ++ linfo->lmac_type_id, cgx->cgx_id, lmac_id); ++ strncpy(linfo->lmac_type, "Unknown", LMACTYPE_STR_LEN - 1); ++ return; ++ } ++ + lmac_string = cgx_lmactype_string[linfo->lmac_type_id]; + strncpy(linfo->lmac_type, lmac_string, LMACTYPE_STR_LEN - 1); + } +-- +2.39.2 + diff --git a/queue-6.2/octeontx2-af-fix-depth-of-cam-and-mem-table.patch b/queue-6.2/octeontx2-af-fix-depth-of-cam-and-mem-table.patch new file mode 100644 index 00000000000..567dd90175a --- /dev/null +++ b/queue-6.2/octeontx2-af-fix-depth-of-cam-and-mem-table.patch @@ -0,0 +1,43 @@ +From 949c554d3a21ca9080cd4aa901a7fbd7081816fe Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 3 May 2023 12:39:36 +0530 +Subject: octeontx2-af: Fix depth of cam and mem table. + +From: Ratheesh Kannoth + +[ Upstream commit 60999cb83554ebcf6cfff8894bc2c3d99ea858ba ] + +In current driver, NPC cam and mem table sizes are read from wrong +register offset. This patch fixes the register offset so that correct +values are populated on read. + +Fixes: b747923afff8 ("octeontx2-af: Exact match support") +Signed-off-by: Ratheesh Kannoth +Signed-off-by: Sunil Kovvuri Goutham +Signed-off-by: Sai Krishna +Reviewed-by: Simon Horman +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c +index f69102d20c903..f2d7156262ff1 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c ++++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c +@@ -1878,9 +1878,9 @@ int rvu_npc_exact_init(struct rvu *rvu) + rvu->hw->table = table; + + /* Read table size, ways and depth */ +- table->mem_table.depth = FIELD_GET(GENMASK_ULL(31, 24), npc_const3); + table->mem_table.ways = FIELD_GET(GENMASK_ULL(19, 16), npc_const3); +- table->cam_table.depth = FIELD_GET(GENMASK_ULL(15, 0), npc_const3); ++ table->mem_table.depth = FIELD_GET(GENMASK_ULL(15, 0), npc_const3); ++ table->cam_table.depth = FIELD_GET(GENMASK_ULL(31, 24), npc_const3); + + dev_dbg(rvu->dev, "%s: NPC exact match 4way_2k table(ways=%d, depth=%d)\n", + __func__, table->mem_table.ways, table->cam_table.depth); +-- +2.39.2 + diff --git a/queue-6.2/octeontx2-af-fix-issues-with-npc-field-hash-extract.patch b/queue-6.2/octeontx2-af-fix-issues-with-npc-field-hash-extract.patch new file mode 100644 index 00000000000..8ef8a3b54c0 --- /dev/null +++ b/queue-6.2/octeontx2-af-fix-issues-with-npc-field-hash-extract.patch @@ -0,0 +1,273 @@ +From a9049454e947b822bce0738df8967c44e6a07027 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 3 May 2023 12:39:41 +0530 +Subject: octeontx2-af: Fix issues with NPC field hash extract + +From: Ratheesh Kannoth + +[ Upstream commit f66155905959076619c9c519fb099e8ae6cb6f7b ] + +1. Allow field hash configuration for both source and destination IPv6. +2. Configure hardware parser based on hash extract feature enable flag + for IPv6. +3. Fix IPv6 endianness issue while updating the source/destination IP + address via ntuple rule. + +Fixes: 56d9f5fd2246 ("octeontx2-af: Use hashed field in MCAM key") +Signed-off-by: Ratheesh Kannoth +Signed-off-by: Sunil Kovvuri Goutham +Signed-off-by: Sai Krishna +Reviewed-by: Simon Horman +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + .../marvell/octeontx2/af/rvu_npc_fs.c | 23 +++-- + .../marvell/octeontx2/af/rvu_npc_fs.h | 4 + + .../marvell/octeontx2/af/rvu_npc_hash.c | 88 ++++++++++--------- + .../marvell/octeontx2/af/rvu_npc_hash.h | 4 +- + 4 files changed, 69 insertions(+), 50 deletions(-) + +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c +index f15efd41972ee..952319453701b 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c ++++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c +@@ -13,11 +13,6 @@ + #include "rvu_npc_fs.h" + #include "rvu_npc_hash.h" + +-#define NPC_BYTESM GENMASK_ULL(19, 16) +-#define NPC_HDR_OFFSET GENMASK_ULL(15, 8) +-#define NPC_KEY_OFFSET GENMASK_ULL(5, 0) +-#define NPC_LDATA_EN BIT_ULL(7) +- + static const char * const npc_flow_names[] = { + [NPC_DMAC] = "dmac", + [NPC_SMAC] = "smac", +@@ -442,6 +437,7 @@ static void npc_handle_multi_layer_fields(struct rvu *rvu, int blkaddr, u8 intf) + static void npc_scan_ldata(struct rvu *rvu, int blkaddr, u8 lid, + u8 lt, u64 cfg, u8 intf) + { ++ struct npc_mcam_kex_hash *mkex_hash = rvu->kpu.mkex_hash; + struct npc_mcam *mcam = &rvu->hw->mcam; + u8 hdr, key, nr_bytes, bit_offset; + u8 la_ltype, la_start; +@@ -490,8 +486,21 @@ do { \ + NPC_SCAN_HDR(NPC_SIP_IPV4, NPC_LID_LC, NPC_LT_LC_IP, 12, 4); + NPC_SCAN_HDR(NPC_DIP_IPV4, NPC_LID_LC, NPC_LT_LC_IP, 16, 4); + NPC_SCAN_HDR(NPC_IPFRAG_IPV6, NPC_LID_LC, NPC_LT_LC_IP6_EXT, 6, 1); +- NPC_SCAN_HDR(NPC_SIP_IPV6, NPC_LID_LC, NPC_LT_LC_IP6, 8, 16); +- NPC_SCAN_HDR(NPC_DIP_IPV6, NPC_LID_LC, NPC_LT_LC_IP6, 24, 16); ++ if (rvu->hw->cap.npc_hash_extract) { ++ if (mkex_hash->lid_lt_ld_hash_en[intf][lid][lt][0]) ++ NPC_SCAN_HDR(NPC_SIP_IPV6, NPC_LID_LC, NPC_LT_LC_IP6, 8, 4); ++ else ++ NPC_SCAN_HDR(NPC_SIP_IPV6, NPC_LID_LC, NPC_LT_LC_IP6, 8, 16); ++ ++ if (mkex_hash->lid_lt_ld_hash_en[intf][lid][lt][1]) ++ NPC_SCAN_HDR(NPC_DIP_IPV6, NPC_LID_LC, NPC_LT_LC_IP6, 24, 4); ++ else ++ NPC_SCAN_HDR(NPC_DIP_IPV6, NPC_LID_LC, NPC_LT_LC_IP6, 24, 16); ++ } else { ++ NPC_SCAN_HDR(NPC_SIP_IPV6, NPC_LID_LC, NPC_LT_LC_IP6, 8, 16); ++ NPC_SCAN_HDR(NPC_DIP_IPV6, NPC_LID_LC, NPC_LT_LC_IP6, 24, 16); ++ } ++ + NPC_SCAN_HDR(NPC_SPORT_UDP, NPC_LID_LD, NPC_LT_LD_UDP, 0, 2); + NPC_SCAN_HDR(NPC_DPORT_UDP, NPC_LID_LD, NPC_LT_LD_UDP, 2, 2); + NPC_SCAN_HDR(NPC_SPORT_TCP, NPC_LID_LD, NPC_LT_LD_TCP, 0, 2); +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.h b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.h +index bdd65ce56a32d..3f5c9042d10e7 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.h ++++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.h +@@ -9,6 +9,10 @@ + #define __RVU_NPC_FS_H + + #define IPV6_WORDS 4 ++#define NPC_BYTESM GENMASK_ULL(19, 16) ++#define NPC_HDR_OFFSET GENMASK_ULL(15, 8) ++#define NPC_KEY_OFFSET GENMASK_ULL(5, 0) ++#define NPC_LDATA_EN BIT_ULL(7) + + void npc_update_entry(struct rvu *rvu, enum key_fields type, + struct mcam_entry *entry, u64 val_lo, +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c +index 9ec5b3c65020b..b6e885263245c 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c ++++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c +@@ -78,42 +78,43 @@ static u32 rvu_npc_toeplitz_hash(const u64 *data, u64 *key, size_t data_bit_len, + return hash_out; + } + +-u32 npc_field_hash_calc(u64 *ldata, struct npc_mcam_kex_hash *mkex_hash, +- u64 *secret_key, u8 intf, u8 hash_idx) ++u32 npc_field_hash_calc(u64 *ldata, struct npc_get_field_hash_info_rsp rsp, ++ u8 intf, u8 hash_idx) + { + u64 hash_key[3]; + u64 data_padded[2]; + u32 field_hash; + +- hash_key[0] = secret_key[1] << 31; +- hash_key[0] |= secret_key[2]; +- hash_key[1] = secret_key[1] >> 33; +- hash_key[1] |= secret_key[0] << 31; +- hash_key[2] = secret_key[0] >> 33; ++ hash_key[0] = rsp.secret_key[1] << 31; ++ hash_key[0] |= rsp.secret_key[2]; ++ hash_key[1] = rsp.secret_key[1] >> 33; ++ hash_key[1] |= rsp.secret_key[0] << 31; ++ hash_key[2] = rsp.secret_key[0] >> 33; + +- data_padded[0] = mkex_hash->hash_mask[intf][hash_idx][0] & ldata[0]; +- data_padded[1] = mkex_hash->hash_mask[intf][hash_idx][1] & ldata[1]; ++ data_padded[0] = rsp.hash_mask[intf][hash_idx][0] & ldata[0]; ++ data_padded[1] = rsp.hash_mask[intf][hash_idx][1] & ldata[1]; + field_hash = rvu_npc_toeplitz_hash(data_padded, hash_key, 128, 159); + +- field_hash &= mkex_hash->hash_ctrl[intf][hash_idx] >> 32; +- field_hash |= mkex_hash->hash_ctrl[intf][hash_idx]; ++ field_hash &= FIELD_GET(GENMASK(63, 32), rsp.hash_ctrl[intf][hash_idx]); ++ field_hash += FIELD_GET(GENMASK(31, 0), rsp.hash_ctrl[intf][hash_idx]); + return field_hash; + } + +-static u64 npc_update_use_hash(int lt, int ld) ++static u64 npc_update_use_hash(struct rvu *rvu, int blkaddr, ++ u8 intf, int lid, int lt, int ld) + { +- u64 cfg = 0; +- +- switch (lt) { +- case NPC_LT_LC_IP6: +- /* Update use_hash(bit-20) and bytesm1 (bit-16:19) +- * in KEX_LD_CFG +- */ +- cfg = KEX_LD_CFG_USE_HASH(0x1, 0x03, +- ld ? 0x18 : 0x8, +- 0x1, 0x0, ld ? 0x14 : 0x10); +- break; +- } ++ u8 hdr, key; ++ u64 cfg; ++ ++ cfg = rvu_read64(rvu, blkaddr, NPC_AF_INTFX_LIDX_LTX_LDX_CFG(intf, lid, lt, ld)); ++ hdr = FIELD_GET(NPC_HDR_OFFSET, cfg); ++ key = FIELD_GET(NPC_KEY_OFFSET, cfg); ++ ++ /* Update use_hash(bit-20) to 'true' and ++ * bytesm1(bit-16:19) to '0x3' in KEX_LD_CFG ++ */ ++ cfg = KEX_LD_CFG_USE_HASH(0x1, 0x03, ++ hdr, 0x1, 0x0, key); + + return cfg; + } +@@ -132,11 +133,13 @@ static void npc_program_mkex_hash_rx(struct rvu *rvu, int blkaddr, + for (lt = 0; lt < NPC_MAX_LT; lt++) { + for (ld = 0; ld < NPC_MAX_LD; ld++) { + if (mkex_hash->lid_lt_ld_hash_en[intf][lid][lt][ld]) { +- u64 cfg = npc_update_use_hash(lt, ld); ++ u64 cfg; + + if (hash_cnt == NPC_MAX_HASH) + return; + ++ cfg = npc_update_use_hash(rvu, blkaddr, ++ intf, lid, lt, ld); + /* Set updated KEX configuration */ + SET_KEX_LD(intf, lid, lt, ld, cfg); + /* Set HASH configuration */ +@@ -170,11 +173,13 @@ static void npc_program_mkex_hash_tx(struct rvu *rvu, int blkaddr, + for (lt = 0; lt < NPC_MAX_LT; lt++) { + for (ld = 0; ld < NPC_MAX_LD; ld++) + if (mkex_hash->lid_lt_ld_hash_en[intf][lid][lt][ld]) { +- u64 cfg = npc_update_use_hash(lt, ld); ++ u64 cfg; + + if (hash_cnt == NPC_MAX_HASH) + return; + ++ cfg = npc_update_use_hash(rvu, blkaddr, ++ intf, lid, lt, ld); + /* Set updated KEX configuration */ + SET_KEX_LD(intf, lid, lt, ld, cfg); + /* Set HASH configuration */ +@@ -268,44 +273,45 @@ void npc_update_field_hash(struct rvu *rvu, u8 intf, + * is hashed to 32 bit value. + */ + case NPC_LT_LC_IP6: +- if (features & BIT_ULL(NPC_SIP_IPV6)) { ++ /* ld[0] == hash_idx[0] == Source IPv6 ++ * ld[1] == hash_idx[1] == Destination IPv6 ++ */ ++ if ((features & BIT_ULL(NPC_SIP_IPV6)) && !hash_idx) { + u32 src_ip[IPV6_WORDS]; + + be32_to_cpu_array(src_ip, pkt->ip6src, IPV6_WORDS); +- ldata[0] = (u64)src_ip[0] << 32 | src_ip[1]; +- ldata[1] = (u64)src_ip[2] << 32 | src_ip[3]; ++ ldata[1] = (u64)src_ip[0] << 32 | src_ip[1]; ++ ldata[0] = (u64)src_ip[2] << 32 | src_ip[3]; + field_hash = npc_field_hash_calc(ldata, +- mkex_hash, +- rsp.secret_key, ++ rsp, + intf, + hash_idx); + npc_update_entry(rvu, NPC_SIP_IPV6, entry, +- field_hash, 0, 32, 0, intf); ++ field_hash, 0, ++ GENMASK(31, 0), 0, intf); + memcpy(&opkt->ip6src, &pkt->ip6src, + sizeof(pkt->ip6src)); + memcpy(&omask->ip6src, &mask->ip6src, + sizeof(mask->ip6src)); +- break; +- } +- +- if (features & BIT_ULL(NPC_DIP_IPV6)) { ++ } else if ((features & BIT_ULL(NPC_DIP_IPV6)) && hash_idx) { + u32 dst_ip[IPV6_WORDS]; + + be32_to_cpu_array(dst_ip, pkt->ip6dst, IPV6_WORDS); +- ldata[0] = (u64)dst_ip[0] << 32 | dst_ip[1]; +- ldata[1] = (u64)dst_ip[2] << 32 | dst_ip[3]; ++ ldata[1] = (u64)dst_ip[0] << 32 | dst_ip[1]; ++ ldata[0] = (u64)dst_ip[2] << 32 | dst_ip[3]; + field_hash = npc_field_hash_calc(ldata, +- mkex_hash, +- rsp.secret_key, ++ rsp, + intf, + hash_idx); + npc_update_entry(rvu, NPC_DIP_IPV6, entry, +- field_hash, 0, 32, 0, intf); ++ field_hash, 0, ++ GENMASK(31, 0), 0, intf); + memcpy(&opkt->ip6dst, &pkt->ip6dst, + sizeof(pkt->ip6dst)); + memcpy(&omask->ip6dst, &mask->ip6dst, + sizeof(mask->ip6dst)); + } ++ + break; + } + } +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.h b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.h +index 65936f4aeaacf..a1c3d987b8044 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.h ++++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.h +@@ -62,8 +62,8 @@ void npc_update_field_hash(struct rvu *rvu, u8 intf, + struct flow_msg *omask); + void npc_config_secret_key(struct rvu *rvu, int blkaddr); + void npc_program_mkex_hash(struct rvu *rvu, int blkaddr); +-u32 npc_field_hash_calc(u64 *ldata, struct npc_mcam_kex_hash *mkex_hash, +- u64 *secret_key, u8 intf, u8 hash_idx); ++u32 npc_field_hash_calc(u64 *ldata, struct npc_get_field_hash_info_rsp rsp, ++ u8 intf, u8 hash_idx); + + static struct npc_mcam_kex_hash npc_mkex_hash_default __maybe_unused = { + .lid_lt_ld_hash_en = { +-- +2.39.2 + diff --git a/queue-6.2/octeontx2-af-fix-start-and-end-bit-for-scan-config.patch b/queue-6.2/octeontx2-af-fix-start-and-end-bit-for-scan-config.patch new file mode 100644 index 00000000000..4243e27affc --- /dev/null +++ b/queue-6.2/octeontx2-af-fix-start-and-end-bit-for-scan-config.patch @@ -0,0 +1,42 @@ +From 8fd4a8643092b1ab92ad470570b75c9dee85a9bb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 3 May 2023 12:39:35 +0530 +Subject: octeontx2-af: Fix start and end bit for scan config + +From: Ratheesh Kannoth + +[ Upstream commit c60a6b90e7890453f09e0d2163d6acadabe3415b ] + +In the current driver, NPC exact match feature was not getting +enabled as configured bit was not read properly. +for_each_set_bit_from() need end bit as one bit post +position in the bit map to read NPC exact nibble enable +bits properly. This patch fixes the same. + +Fixes: b747923afff8 ("octeontx2-af: Exact match support") +Signed-off-by: Ratheesh Kannoth +Signed-off-by: Sunil Kovvuri Goutham +Signed-off-by: Sai Krishna +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c +index 006beb5cf98dd..f15efd41972ee 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c ++++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c +@@ -594,8 +594,7 @@ static int npc_scan_kex(struct rvu *rvu, int blkaddr, u8 intf) + */ + masked_cfg = cfg & NPC_EXACT_NIBBLE; + bitnr = NPC_EXACT_NIBBLE_START; +- for_each_set_bit_from(bitnr, (unsigned long *)&masked_cfg, +- NPC_EXACT_NIBBLE_START) { ++ for_each_set_bit_from(bitnr, (unsigned long *)&masked_cfg, NPC_EXACT_NIBBLE_END + 1) { + npc_scan_exact_result(mcam, bitnr, key_nibble, intf); + key_nibble++; + } +-- +2.39.2 + diff --git a/queue-6.2/octeontx2-af-mcs-config-parser-to-skip-8b-header.patch b/queue-6.2/octeontx2-af-mcs-config-parser-to-skip-8b-header.patch new file mode 100644 index 00000000000..28e99702561 --- /dev/null +++ b/queue-6.2/octeontx2-af-mcs-config-parser-to-skip-8b-header.patch @@ -0,0 +1,124 @@ +From 97c512cf4927f5c87f624ae09cd0dc3e4c347c6b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Apr 2023 11:55:22 +0530 +Subject: octeontx2-af: mcs: Config parser to skip 8B header + +From: Geetha sowjanya + +[ Upstream commit 65cdc2b637a5749c7dec0ce14fe2c48f1f91f671 ] + +When ptp timestamp is enabled in RPM, RPM will append 8B +timestamp header for all RX traffic. MCS need to skip these +8 bytes header while parsing the packet header, so that +correct tcam key is created for lookup. +This patch fixes the mcs parser configuration to skip this +8B header for ptp packets. + +Fixes: ca7f49ff8846 ("octeontx2-af: cn10k: Introduce driver for macsec block.") +Signed-off-by: Sunil Goutham +Signed-off-by: Geetha sowjanya +Reviewed-by: Leon Romanovsky +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + .../ethernet/marvell/octeontx2/af/mcs_reg.h | 1 + + .../marvell/octeontx2/af/mcs_rvu_if.c | 37 +++++++++++++++++++ + .../net/ethernet/marvell/octeontx2/af/rvu.h | 1 + + .../ethernet/marvell/octeontx2/af/rvu_cgx.c | 2 + + 4 files changed, 41 insertions(+) + +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mcs_reg.h b/drivers/net/ethernet/marvell/octeontx2/af/mcs_reg.h +index c95a8b8f5eaf7..7427e3b1490f4 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/af/mcs_reg.h ++++ b/drivers/net/ethernet/marvell/octeontx2/af/mcs_reg.h +@@ -97,6 +97,7 @@ + #define MCSX_PEX_TX_SLAVE_VLAN_CFGX(a) (0x46f8ull + (a) * 0x8ull) + #define MCSX_PEX_TX_SLAVE_CUSTOM_TAG_REL_MODE_SEL(a) (0x788ull + (a) * 0x8ull) + #define MCSX_PEX_TX_SLAVE_PORT_CONFIG(a) (0x4738ull + (a) * 0x8ull) ++#define MCSX_PEX_RX_SLAVE_PORT_CFGX(a) (0x3b98ull + (a) * 0x8ull) + #define MCSX_PEX_RX_SLAVE_RULE_ETYPE_CFGX(a) ({ \ + u64 offset; \ + \ +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mcs_rvu_if.c b/drivers/net/ethernet/marvell/octeontx2/af/mcs_rvu_if.c +index eb25e458266ca..dfd23580e3b8e 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/af/mcs_rvu_if.c ++++ b/drivers/net/ethernet/marvell/octeontx2/af/mcs_rvu_if.c +@@ -11,6 +11,7 @@ + + #include "mcs.h" + #include "rvu.h" ++#include "mcs_reg.h" + #include "lmac_common.h" + + #define M(_name, _id, _fn_name, _req_type, _rsp_type) \ +@@ -32,6 +33,42 @@ static struct _req_type __maybe_unused \ + MBOX_UP_MCS_MESSAGES + #undef M + ++void rvu_mcs_ptp_cfg(struct rvu *rvu, u8 rpm_id, u8 lmac_id, bool ena) ++{ ++ struct mcs *mcs; ++ u64 cfg; ++ u8 port; ++ ++ if (!rvu->mcs_blk_cnt) ++ return; ++ ++ /* When ptp is enabled, RPM appends 8B header for all ++ * RX packets. MCS PEX need to configure to skip 8B ++ * during packet parsing. ++ */ ++ ++ /* CNF10K-B */ ++ if (rvu->mcs_blk_cnt > 1) { ++ mcs = mcs_get_pdata(rpm_id); ++ cfg = mcs_reg_read(mcs, MCSX_PEX_RX_SLAVE_PEX_CONFIGURATION); ++ if (ena) ++ cfg |= BIT_ULL(lmac_id); ++ else ++ cfg &= ~BIT_ULL(lmac_id); ++ mcs_reg_write(mcs, MCSX_PEX_RX_SLAVE_PEX_CONFIGURATION, cfg); ++ return; ++ } ++ /* CN10KB */ ++ mcs = mcs_get_pdata(0); ++ port = (rpm_id * rvu->hw->lmac_per_cgx) + lmac_id; ++ cfg = mcs_reg_read(mcs, MCSX_PEX_RX_SLAVE_PORT_CFGX(port)); ++ if (ena) ++ cfg |= BIT_ULL(0); ++ else ++ cfg &= ~BIT_ULL(0); ++ mcs_reg_write(mcs, MCSX_PEX_RX_SLAVE_PORT_CFGX(port), cfg); ++} ++ + int rvu_mbox_handler_mcs_set_lmac_mode(struct rvu *rvu, + struct mcs_set_lmac_mode *req, + struct msg_rsp *rsp) +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.h b/drivers/net/ethernet/marvell/octeontx2/af/rvu.h +index f6c45cf27caf4..f0502556d127f 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.h ++++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.h +@@ -899,6 +899,7 @@ int rvu_get_hwvf(struct rvu *rvu, int pcifunc); + /* CN10K MCS */ + int rvu_mcs_init(struct rvu *rvu); + int rvu_mcs_flr_handler(struct rvu *rvu, u16 pcifunc); ++void rvu_mcs_ptp_cfg(struct rvu *rvu, u8 rpm_id, u8 lmac_id, bool ena); + void rvu_mcs_exit(struct rvu *rvu); + + #endif /* RVU_H */ +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c +index 438b212fb54a7..83b342fa8d753 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c ++++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cgx.c +@@ -773,6 +773,8 @@ static int rvu_cgx_ptp_rx_cfg(struct rvu *rvu, u16 pcifunc, bool enable) + /* This flag is required to clean up CGX conf if app gets killed */ + pfvf->hw_rx_tstamp_en = enable; + ++ /* Inform MCS about 8B RX header */ ++ rvu_mcs_ptp_cfg(rvu, cgx_id, lmac_id, enable); + return 0; + } + +-- +2.39.2 + diff --git a/queue-6.2/octeontx2-af-mcs-fix-mcs-block-interrupt.patch b/queue-6.2/octeontx2-af-mcs-fix-mcs-block-interrupt.patch new file mode 100644 index 00000000000..ae9f6ad184e --- /dev/null +++ b/queue-6.2/octeontx2-af-mcs-fix-mcs-block-interrupt.patch @@ -0,0 +1,404 @@ +From 5f901395648e8bd64c4a4206bf50a6ada22abf04 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Apr 2023 11:55:23 +0530 +Subject: octeontx2-af: mcs: Fix MCS block interrupt + +From: Geetha sowjanya + +[ Upstream commit b8aebeaaf9ffb1e99c642eb3751e28981f9be475 ] + +On CN10KB, MCS IP vector number, BBE and PAB interrupt mask +got changed to support more block level interrupts. +To address this changes, this patch fixes the bbe and pab +interrupt handlers. + +Fixes: 6c635f78c474 ("octeontx2-af: cn10k: mcs: Handle MCS block interrupts") +Signed-off-by: Sunil Goutham +Signed-off-by: Geetha sowjanya +Reviewed-by: Leon Romanovsky +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + .../net/ethernet/marvell/octeontx2/af/mcs.c | 95 ++++++++----------- + .../net/ethernet/marvell/octeontx2/af/mcs.h | 26 +++-- + .../marvell/octeontx2/af/mcs_cnf10kb.c | 63 ++++++++++++ + .../ethernet/marvell/octeontx2/af/mcs_reg.h | 5 +- + 4 files changed, 119 insertions(+), 70 deletions(-) + +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mcs.c b/drivers/net/ethernet/marvell/octeontx2/af/mcs.c +index 148417d633a56..c43f19dfbd744 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/af/mcs.c ++++ b/drivers/net/ethernet/marvell/octeontx2/af/mcs.c +@@ -936,60 +936,42 @@ static void mcs_tx_misc_intr_handler(struct mcs *mcs, u64 intr) + mcs_add_intr_wq_entry(mcs, &event); + } + +-static void mcs_bbe_intr_handler(struct mcs *mcs, u64 intr, enum mcs_direction dir) ++void cn10kb_mcs_bbe_intr_handler(struct mcs *mcs, u64 intr, ++ enum mcs_direction dir) + { +- struct mcs_intr_event event = { 0 }; +- int i; ++ u64 val, reg; ++ int lmac; + +- if (!(intr & MCS_BBE_INT_MASK)) ++ if (!(intr & 0x6ULL)) + return; + +- event.mcs_id = mcs->mcs_id; +- event.pcifunc = mcs->pf_map[0]; ++ if (intr & BIT_ULL(1)) ++ reg = (dir == MCS_RX) ? MCSX_BBE_RX_SLAVE_DFIFO_OVERFLOW_0 : ++ MCSX_BBE_TX_SLAVE_DFIFO_OVERFLOW_0; ++ else ++ reg = (dir == MCS_RX) ? MCSX_BBE_RX_SLAVE_PLFIFO_OVERFLOW_0 : ++ MCSX_BBE_TX_SLAVE_PLFIFO_OVERFLOW_0; ++ val = mcs_reg_read(mcs, reg); + +- for (i = 0; i < MCS_MAX_BBE_INT; i++) { +- if (!(intr & BIT_ULL(i))) ++ /* policy/data over flow occurred */ ++ for (lmac = 0; lmac < mcs->hw->lmac_cnt; lmac++) { ++ if (!(val & BIT_ULL(lmac))) + continue; +- +- /* Lower nibble denotes data fifo overflow interrupts and +- * upper nibble indicates policy fifo overflow interrupts. +- */ +- if (intr & 0xFULL) +- event.intr_mask = (dir == MCS_RX) ? +- MCS_BBE_RX_DFIFO_OVERFLOW_INT : +- MCS_BBE_TX_DFIFO_OVERFLOW_INT; +- else +- event.intr_mask = (dir == MCS_RX) ? +- MCS_BBE_RX_PLFIFO_OVERFLOW_INT : +- MCS_BBE_TX_PLFIFO_OVERFLOW_INT; +- +- /* Notify the lmac_id info which ran into BBE fatal error */ +- event.lmac_id = i & 0x3ULL; +- mcs_add_intr_wq_entry(mcs, &event); ++ dev_warn(mcs->dev, "BEE:Policy or data overflow occurred on lmac:%d\n", lmac); + } + } + +-static void mcs_pab_intr_handler(struct mcs *mcs, u64 intr, enum mcs_direction dir) ++void cn10kb_mcs_pab_intr_handler(struct mcs *mcs, u64 intr, ++ enum mcs_direction dir) + { +- struct mcs_intr_event event = { 0 }; +- int i; ++ int lmac; + +- if (!(intr & MCS_PAB_INT_MASK)) ++ if (!(intr & 0xFFFFFULL)) + return; + +- event.mcs_id = mcs->mcs_id; +- event.pcifunc = mcs->pf_map[0]; +- +- for (i = 0; i < MCS_MAX_PAB_INT; i++) { +- if (!(intr & BIT_ULL(i))) +- continue; +- +- event.intr_mask = (dir == MCS_RX) ? MCS_PAB_RX_CHAN_OVERFLOW_INT : +- MCS_PAB_TX_CHAN_OVERFLOW_INT; +- +- /* Notify the lmac_id info which ran into PAB fatal error */ +- event.lmac_id = i; +- mcs_add_intr_wq_entry(mcs, &event); ++ for (lmac = 0; lmac < mcs->hw->lmac_cnt; lmac++) { ++ if (intr & BIT_ULL(lmac)) ++ dev_warn(mcs->dev, "PAB: overflow occurred on lmac:%d\n", lmac); + } + } + +@@ -998,9 +980,8 @@ static irqreturn_t mcs_ip_intr_handler(int irq, void *mcs_irq) + struct mcs *mcs = (struct mcs *)mcs_irq; + u64 intr, cpm_intr, bbe_intr, pab_intr; + +- /* Disable and clear the interrupt */ ++ /* Disable the interrupt */ + mcs_reg_write(mcs, MCSX_IP_INT_ENA_W1C, BIT_ULL(0)); +- mcs_reg_write(mcs, MCSX_IP_INT, BIT_ULL(0)); + + /* Check which block has interrupt*/ + intr = mcs_reg_read(mcs, MCSX_TOP_SLAVE_INT_SUM); +@@ -1047,7 +1028,7 @@ static irqreturn_t mcs_ip_intr_handler(int irq, void *mcs_irq) + /* BBE RX */ + if (intr & MCS_BBE_RX_INT_ENA) { + bbe_intr = mcs_reg_read(mcs, MCSX_BBE_RX_SLAVE_BBE_INT); +- mcs_bbe_intr_handler(mcs, bbe_intr, MCS_RX); ++ mcs->mcs_ops->mcs_bbe_intr_handler(mcs, bbe_intr, MCS_RX); + + /* Clear the interrupt */ + mcs_reg_write(mcs, MCSX_BBE_RX_SLAVE_BBE_INT_INTR_RW, 0); +@@ -1057,7 +1038,7 @@ static irqreturn_t mcs_ip_intr_handler(int irq, void *mcs_irq) + /* BBE TX */ + if (intr & MCS_BBE_TX_INT_ENA) { + bbe_intr = mcs_reg_read(mcs, MCSX_BBE_TX_SLAVE_BBE_INT); +- mcs_bbe_intr_handler(mcs, bbe_intr, MCS_TX); ++ mcs->mcs_ops->mcs_bbe_intr_handler(mcs, bbe_intr, MCS_TX); + + /* Clear the interrupt */ + mcs_reg_write(mcs, MCSX_BBE_TX_SLAVE_BBE_INT_INTR_RW, 0); +@@ -1067,7 +1048,7 @@ static irqreturn_t mcs_ip_intr_handler(int irq, void *mcs_irq) + /* PAB RX */ + if (intr & MCS_PAB_RX_INT_ENA) { + pab_intr = mcs_reg_read(mcs, MCSX_PAB_RX_SLAVE_PAB_INT); +- mcs_pab_intr_handler(mcs, pab_intr, MCS_RX); ++ mcs->mcs_ops->mcs_pab_intr_handler(mcs, pab_intr, MCS_RX); + + /* Clear the interrupt */ + mcs_reg_write(mcs, MCSX_PAB_RX_SLAVE_PAB_INT_INTR_RW, 0); +@@ -1077,14 +1058,15 @@ static irqreturn_t mcs_ip_intr_handler(int irq, void *mcs_irq) + /* PAB TX */ + if (intr & MCS_PAB_TX_INT_ENA) { + pab_intr = mcs_reg_read(mcs, MCSX_PAB_TX_SLAVE_PAB_INT); +- mcs_pab_intr_handler(mcs, pab_intr, MCS_TX); ++ mcs->mcs_ops->mcs_pab_intr_handler(mcs, pab_intr, MCS_TX); + + /* Clear the interrupt */ + mcs_reg_write(mcs, MCSX_PAB_TX_SLAVE_PAB_INT_INTR_RW, 0); + mcs_reg_write(mcs, MCSX_PAB_TX_SLAVE_PAB_INT, pab_intr); + } + +- /* Enable the interrupt */ ++ /* Clear and enable the interrupt */ ++ mcs_reg_write(mcs, MCSX_IP_INT, BIT_ULL(0)); + mcs_reg_write(mcs, MCSX_IP_INT_ENA_W1S, BIT_ULL(0)); + + return IRQ_HANDLED; +@@ -1166,7 +1148,7 @@ static int mcs_register_interrupts(struct mcs *mcs) + return ret; + } + +- ret = request_irq(pci_irq_vector(mcs->pdev, MCS_INT_VEC_IP), ++ ret = request_irq(pci_irq_vector(mcs->pdev, mcs->hw->ip_vec), + mcs_ip_intr_handler, 0, "MCS_IP", mcs); + if (ret) { + dev_err(mcs->dev, "MCS IP irq registration failed\n"); +@@ -1185,11 +1167,11 @@ static int mcs_register_interrupts(struct mcs *mcs) + mcs_reg_write(mcs, MCSX_CPM_TX_SLAVE_TX_INT_ENB, 0x7ULL); + mcs_reg_write(mcs, MCSX_CPM_RX_SLAVE_RX_INT_ENB, 0x7FULL); + +- mcs_reg_write(mcs, MCSX_BBE_RX_SLAVE_BBE_INT_ENB, 0xff); +- mcs_reg_write(mcs, MCSX_BBE_TX_SLAVE_BBE_INT_ENB, 0xff); ++ mcs_reg_write(mcs, MCSX_BBE_RX_SLAVE_BBE_INT_ENB, 0xFFULL); ++ mcs_reg_write(mcs, MCSX_BBE_TX_SLAVE_BBE_INT_ENB, 0xFFULL); + +- mcs_reg_write(mcs, MCSX_PAB_RX_SLAVE_PAB_INT_ENB, 0xff); +- mcs_reg_write(mcs, MCSX_PAB_TX_SLAVE_PAB_INT_ENB, 0xff); ++ mcs_reg_write(mcs, MCSX_PAB_RX_SLAVE_PAB_INT_ENB, 0xFFFFFULL); ++ mcs_reg_write(mcs, MCSX_PAB_TX_SLAVE_PAB_INT_ENB, 0xFFFFFULL); + + mcs->tx_sa_active = alloc_mem(mcs, mcs->hw->sc_entries); + if (!mcs->tx_sa_active) { +@@ -1200,7 +1182,7 @@ static int mcs_register_interrupts(struct mcs *mcs) + return ret; + + free_irq: +- free_irq(pci_irq_vector(mcs->pdev, MCS_INT_VEC_IP), mcs); ++ free_irq(pci_irq_vector(mcs->pdev, mcs->hw->ip_vec), mcs); + exit: + pci_free_irq_vectors(mcs->pdev); + mcs->num_vec = 0; +@@ -1497,6 +1479,7 @@ void cn10kb_mcs_set_hw_capabilities(struct mcs *mcs) + hw->lmac_cnt = 20; /* lmacs/ports per mcs block */ + hw->mcs_x2p_intf = 5; /* x2p clabration intf */ + hw->mcs_blks = 1; /* MCS blocks */ ++ hw->ip_vec = MCS_CN10KB_INT_VEC_IP; /* IP vector */ + } + + static struct mcs_ops cn10kb_mcs_ops = { +@@ -1505,6 +1488,8 @@ static struct mcs_ops cn10kb_mcs_ops = { + .mcs_tx_sa_mem_map_write = cn10kb_mcs_tx_sa_mem_map_write, + .mcs_rx_sa_mem_map_write = cn10kb_mcs_rx_sa_mem_map_write, + .mcs_flowid_secy_map = cn10kb_mcs_flowid_secy_map, ++ .mcs_bbe_intr_handler = cn10kb_mcs_bbe_intr_handler, ++ .mcs_pab_intr_handler = cn10kb_mcs_pab_intr_handler, + }; + + static int mcs_probe(struct pci_dev *pdev, const struct pci_device_id *id) +@@ -1605,7 +1590,7 @@ static void mcs_remove(struct pci_dev *pdev) + + /* Set MCS to external bypass */ + mcs_set_external_bypass(mcs, true); +- free_irq(pci_irq_vector(pdev, MCS_INT_VEC_IP), mcs); ++ free_irq(pci_irq_vector(pdev, mcs->hw->ip_vec), mcs); + pci_free_irq_vectors(pdev); + pci_release_regions(pdev); + pci_disable_device(pdev); +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mcs.h b/drivers/net/ethernet/marvell/octeontx2/af/mcs.h +index 64dc2b80e15dd..0f89dcb764654 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/af/mcs.h ++++ b/drivers/net/ethernet/marvell/octeontx2/af/mcs.h +@@ -43,24 +43,15 @@ + /* Reserved resources for default bypass entry */ + #define MCS_RSRC_RSVD_CNT 1 + +-/* MCS Interrupt Vector Enumeration */ +-enum mcs_int_vec_e { +- MCS_INT_VEC_MIL_RX_GBL = 0x0, +- MCS_INT_VEC_MIL_RX_LMACX = 0x1, +- MCS_INT_VEC_MIL_TX_LMACX = 0x5, +- MCS_INT_VEC_HIL_RX_GBL = 0x9, +- MCS_INT_VEC_HIL_RX_LMACX = 0xa, +- MCS_INT_VEC_HIL_TX_GBL = 0xe, +- MCS_INT_VEC_HIL_TX_LMACX = 0xf, +- MCS_INT_VEC_IP = 0x13, +- MCS_INT_VEC_CNT = 0x14, +-}; ++/* MCS Interrupt Vector */ ++#define MCS_CNF10KB_INT_VEC_IP 0x13 ++#define MCS_CN10KB_INT_VEC_IP 0x53 + + #define MCS_MAX_BBE_INT 8ULL + #define MCS_BBE_INT_MASK 0xFFULL + +-#define MCS_MAX_PAB_INT 4ULL +-#define MCS_PAB_INT_MASK 0xFULL ++#define MCS_MAX_PAB_INT 8ULL ++#define MCS_PAB_INT_MASK 0xFULL + + #define MCS_BBE_RX_INT_ENA BIT_ULL(0) + #define MCS_BBE_TX_INT_ENA BIT_ULL(1) +@@ -137,6 +128,7 @@ struct hwinfo { + u8 lmac_cnt; + u8 mcs_blks; + unsigned long lmac_bmap; /* bitmap of enabled mcs lmac */ ++ u16 ip_vec; + }; + + struct mcs { +@@ -165,6 +157,8 @@ struct mcs_ops { + void (*mcs_tx_sa_mem_map_write)(struct mcs *mcs, struct mcs_tx_sc_sa_map *map); + void (*mcs_rx_sa_mem_map_write)(struct mcs *mcs, struct mcs_rx_sc_sa_map *map); + void (*mcs_flowid_secy_map)(struct mcs *mcs, struct secy_mem_map *map, int dir); ++ void (*mcs_bbe_intr_handler)(struct mcs *mcs, u64 intr, enum mcs_direction dir); ++ void (*mcs_pab_intr_handler)(struct mcs *mcs, u64 intr, enum mcs_direction dir); + }; + + extern struct pci_driver mcs_driver; +@@ -219,6 +213,8 @@ void cn10kb_mcs_tx_sa_mem_map_write(struct mcs *mcs, struct mcs_tx_sc_sa_map *ma + void cn10kb_mcs_flowid_secy_map(struct mcs *mcs, struct secy_mem_map *map, int dir); + void cn10kb_mcs_rx_sa_mem_map_write(struct mcs *mcs, struct mcs_rx_sc_sa_map *map); + void cn10kb_mcs_parser_cfg(struct mcs *mcs); ++void cn10kb_mcs_pab_intr_handler(struct mcs *mcs, u64 intr, enum mcs_direction dir); ++void cn10kb_mcs_bbe_intr_handler(struct mcs *mcs, u64 intr, enum mcs_direction dir); + + /* CNF10K-B APIs */ + struct mcs_ops *cnf10kb_get_mac_ops(void); +@@ -229,6 +225,8 @@ void cnf10kb_mcs_rx_sa_mem_map_write(struct mcs *mcs, struct mcs_rx_sc_sa_map *m + void cnf10kb_mcs_parser_cfg(struct mcs *mcs); + void cnf10kb_mcs_tx_pn_thresh_reached_handler(struct mcs *mcs); + void cnf10kb_mcs_tx_pn_wrapped_handler(struct mcs *mcs); ++void cnf10kb_mcs_bbe_intr_handler(struct mcs *mcs, u64 intr, enum mcs_direction dir); ++void cnf10kb_mcs_pab_intr_handler(struct mcs *mcs, u64 intr, enum mcs_direction dir); + + /* Stats APIs */ + void mcs_get_sc_stats(struct mcs *mcs, struct mcs_sc_stats *stats, int id, int dir); +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mcs_cnf10kb.c b/drivers/net/ethernet/marvell/octeontx2/af/mcs_cnf10kb.c +index 7b62054144286..9f9b904ab2cd0 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/af/mcs_cnf10kb.c ++++ b/drivers/net/ethernet/marvell/octeontx2/af/mcs_cnf10kb.c +@@ -13,6 +13,8 @@ static struct mcs_ops cnf10kb_mcs_ops = { + .mcs_tx_sa_mem_map_write = cnf10kb_mcs_tx_sa_mem_map_write, + .mcs_rx_sa_mem_map_write = cnf10kb_mcs_rx_sa_mem_map_write, + .mcs_flowid_secy_map = cnf10kb_mcs_flowid_secy_map, ++ .mcs_bbe_intr_handler = cnf10kb_mcs_bbe_intr_handler, ++ .mcs_pab_intr_handler = cnf10kb_mcs_pab_intr_handler, + }; + + struct mcs_ops *cnf10kb_get_mac_ops(void) +@@ -31,6 +33,7 @@ void cnf10kb_mcs_set_hw_capabilities(struct mcs *mcs) + hw->lmac_cnt = 4; /* lmacs/ports per mcs block */ + hw->mcs_x2p_intf = 1; /* x2p clabration intf */ + hw->mcs_blks = 7; /* MCS blocks */ ++ hw->ip_vec = MCS_CNF10KB_INT_VEC_IP; /* IP vector */ + } + + void cnf10kb_mcs_parser_cfg(struct mcs *mcs) +@@ -212,3 +215,63 @@ void cnf10kb_mcs_tx_pn_wrapped_handler(struct mcs *mcs) + mcs_add_intr_wq_entry(mcs, &event); + } + } ++ ++void cnf10kb_mcs_bbe_intr_handler(struct mcs *mcs, u64 intr, ++ enum mcs_direction dir) ++{ ++ struct mcs_intr_event event = { 0 }; ++ int i; ++ ++ if (!(intr & MCS_BBE_INT_MASK)) ++ return; ++ ++ event.mcs_id = mcs->mcs_id; ++ event.pcifunc = mcs->pf_map[0]; ++ ++ for (i = 0; i < MCS_MAX_BBE_INT; i++) { ++ if (!(intr & BIT_ULL(i))) ++ continue; ++ ++ /* Lower nibble denotes data fifo overflow interrupts and ++ * upper nibble indicates policy fifo overflow interrupts. ++ */ ++ if (intr & 0xFULL) ++ event.intr_mask = (dir == MCS_RX) ? ++ MCS_BBE_RX_DFIFO_OVERFLOW_INT : ++ MCS_BBE_TX_DFIFO_OVERFLOW_INT; ++ else ++ event.intr_mask = (dir == MCS_RX) ? ++ MCS_BBE_RX_PLFIFO_OVERFLOW_INT : ++ MCS_BBE_TX_PLFIFO_OVERFLOW_INT; ++ ++ /* Notify the lmac_id info which ran into BBE fatal error */ ++ event.lmac_id = i & 0x3ULL; ++ mcs_add_intr_wq_entry(mcs, &event); ++ } ++} ++ ++void cnf10kb_mcs_pab_intr_handler(struct mcs *mcs, u64 intr, ++ enum mcs_direction dir) ++{ ++ struct mcs_intr_event event = { 0 }; ++ int i; ++ ++ if (!(intr & MCS_PAB_INT_MASK)) ++ return; ++ ++ event.mcs_id = mcs->mcs_id; ++ event.pcifunc = mcs->pf_map[0]; ++ ++ for (i = 0; i < MCS_MAX_PAB_INT; i++) { ++ if (!(intr & BIT_ULL(i))) ++ continue; ++ ++ event.intr_mask = (dir == MCS_RX) ? ++ MCS_PAB_RX_CHAN_OVERFLOW_INT : ++ MCS_PAB_TX_CHAN_OVERFLOW_INT; ++ ++ /* Notify the lmac_id info which ran into PAB fatal error */ ++ event.lmac_id = i; ++ mcs_add_intr_wq_entry(mcs, &event); ++ } ++} +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mcs_reg.h b/drivers/net/ethernet/marvell/octeontx2/af/mcs_reg.h +index 7427e3b1490f4..f3ab01fc363c8 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/af/mcs_reg.h ++++ b/drivers/net/ethernet/marvell/octeontx2/af/mcs_reg.h +@@ -276,7 +276,10 @@ + #define MCSX_BBE_RX_SLAVE_CAL_ENTRY 0x180ull + #define MCSX_BBE_RX_SLAVE_CAL_LEN 0x188ull + #define MCSX_PAB_RX_SLAVE_FIFO_SKID_CFGX(a) (0x290ull + (a) * 0x40ull) +- ++#define MCSX_BBE_RX_SLAVE_DFIFO_OVERFLOW_0 0xe20 ++#define MCSX_BBE_TX_SLAVE_DFIFO_OVERFLOW_0 0x1298 ++#define MCSX_BBE_RX_SLAVE_PLFIFO_OVERFLOW_0 0xe40 ++#define MCSX_BBE_TX_SLAVE_PLFIFO_OVERFLOW_0 0x12b8 + #define MCSX_BBE_RX_SLAVE_BBE_INT ({ \ + u64 offset; \ + \ +-- +2.39.2 + diff --git a/queue-6.2/octeontx2-af-mcs-write-tcam_data-and-tcam_mask-regis.patch b/queue-6.2/octeontx2-af-mcs-write-tcam_data-and-tcam_mask-regis.patch new file mode 100644 index 00000000000..11b22a3a13b --- /dev/null +++ b/queue-6.2/octeontx2-af-mcs-write-tcam_data-and-tcam_mask-regis.patch @@ -0,0 +1,50 @@ +From 4b8e9656478a462b4efe4d48aceecaf3214d5382 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Apr 2023 11:55:21 +0530 +Subject: octeontx2-af: mcs: Write TCAM_DATA and TCAM_MASK registers at once + +From: Subbaraya Sundeep + +[ Upstream commit b51612198603fce33d6cf57b4864e3018a1cd9b8 ] + +As per hardware errata on CN10KB, all the four TCAM_DATA +and TCAM_MASK registers has to be written at once otherwise +write to individual registers will fail. Hence write to all +TCAM_DATA registers and then to all TCAM_MASK registers. + +Fixes: cfc14181d497 ("octeontx2-af: cn10k: mcs: Manage the MCS block hardware resources") +Signed-off-by: Subbaraya Sundeep +Signed-off-by: Sunil Kovvuri Goutham +Signed-off-by: Geetha sowjanya +Reviewed-by: Leon Romanovsky +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/marvell/octeontx2/af/mcs.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mcs.c b/drivers/net/ethernet/marvell/octeontx2/af/mcs.c +index 492baa0b594ce..148417d633a56 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/af/mcs.c ++++ b/drivers/net/ethernet/marvell/octeontx2/af/mcs.c +@@ -473,6 +473,8 @@ void mcs_flowid_entry_write(struct mcs *mcs, u64 *data, u64 *mask, int flow_id, + for (reg_id = 0; reg_id < 4; reg_id++) { + reg = MCSX_CPM_RX_SLAVE_FLOWID_TCAM_DATAX(reg_id, flow_id); + mcs_reg_write(mcs, reg, data[reg_id]); ++ } ++ for (reg_id = 0; reg_id < 4; reg_id++) { + reg = MCSX_CPM_RX_SLAVE_FLOWID_TCAM_MASKX(reg_id, flow_id); + mcs_reg_write(mcs, reg, mask[reg_id]); + } +@@ -480,6 +482,8 @@ void mcs_flowid_entry_write(struct mcs *mcs, u64 *data, u64 *mask, int flow_id, + for (reg_id = 0; reg_id < 4; reg_id++) { + reg = MCSX_CPM_TX_SLAVE_FLOWID_TCAM_DATAX(reg_id, flow_id); + mcs_reg_write(mcs, reg, data[reg_id]); ++ } ++ for (reg_id = 0; reg_id < 4; reg_id++) { + reg = MCSX_CPM_TX_SLAVE_FLOWID_TCAM_MASKX(reg_id, flow_id); + mcs_reg_write(mcs, reg, mask[reg_id]); + } +-- +2.39.2 + diff --git a/queue-6.2/octeontx2-af-secure-apr-table-update-with-the-lock.patch b/queue-6.2/octeontx2-af-secure-apr-table-update-with-the-lock.patch new file mode 100644 index 00000000000..3741cf06978 --- /dev/null +++ b/queue-6.2/octeontx2-af-secure-apr-table-update-with-the-lock.patch @@ -0,0 +1,81 @@ +From c0193821d270effc28e70b84bb180737cc80bb84 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 3 May 2023 12:39:34 +0530 +Subject: octeontx2-af: Secure APR table update with the lock + +From: Geetha sowjanya + +[ Upstream commit 048486f81d01db4d100af021ee2ea211d19732a0 ] + +APR table contains the lmtst base address of PF/VFs. These entries +are updated by the PF/VF during the device probe. The lmtst address +is fetched from HW using "TXN_REQ" and "ADDR_RSP_STS" registers. +The lock tries to protect these registers from getting overwritten +when multiple PFs invokes rvu_get_lmtaddr() simultaneously. + +For example, if PF1 submit the request and got permitted before it +reads the response and PF2 got scheduled submit the request then the +response of PF1 is overwritten by the PF2 response. + +Fixes: 893ae97214c3 ("octeontx2-af: cn10k: Support configurable LMTST regions") +Signed-off-by: Geetha sowjanya +Signed-off-by: Sunil Kovvuri Goutham +Signed-off-by: Sai Krishna +Reviewed-by: Simon Horman +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + .../net/ethernet/marvell/octeontx2/af/rvu_cn10k.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c +index 7dbbc115cde42..f9faa5b23bb9d 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c ++++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c +@@ -60,13 +60,14 @@ static int rvu_get_lmtaddr(struct rvu *rvu, u16 pcifunc, + u64 iova, u64 *lmt_addr) + { + u64 pa, val, pf; +- int err; ++ int err = 0; + + if (!iova) { + dev_err(rvu->dev, "%s Requested Null address for transulation\n", __func__); + return -EINVAL; + } + ++ mutex_lock(&rvu->rsrc_lock); + rvu_write64(rvu, BLKADDR_RVUM, RVU_AF_SMMU_ADDR_REQ, iova); + pf = rvu_get_pf(pcifunc) & 0x1F; + val = BIT_ULL(63) | BIT_ULL(14) | BIT_ULL(13) | pf << 8 | +@@ -76,12 +77,13 @@ static int rvu_get_lmtaddr(struct rvu *rvu, u16 pcifunc, + err = rvu_poll_reg(rvu, BLKADDR_RVUM, RVU_AF_SMMU_ADDR_RSP_STS, BIT_ULL(0), false); + if (err) { + dev_err(rvu->dev, "%s LMTLINE iova transulation failed\n", __func__); +- return err; ++ goto exit; + } + val = rvu_read64(rvu, BLKADDR_RVUM, RVU_AF_SMMU_ADDR_RSP_STS); + if (val & ~0x1ULL) { + dev_err(rvu->dev, "%s LMTLINE iova transulation failed err:%llx\n", __func__, val); +- return -EIO; ++ err = -EIO; ++ goto exit; + } + /* PA[51:12] = RVU_AF_SMMU_TLN_FLIT0[57:18] + * PA[11:0] = IOVA[11:0] +@@ -89,8 +91,9 @@ static int rvu_get_lmtaddr(struct rvu *rvu, u16 pcifunc, + pa = rvu_read64(rvu, BLKADDR_RVUM, RVU_AF_SMMU_TLN_FLIT0) >> 18; + pa &= GENMASK_ULL(39, 0); + *lmt_addr = (pa << 12) | (iova & 0xFFF); +- +- return 0; ++exit: ++ mutex_unlock(&rvu->rsrc_lock); ++ return err; + } + + static int rvu_update_lmtaddr(struct rvu *rvu, u16 pcifunc, u64 lmt_addr) +-- +2.39.2 + diff --git a/queue-6.2/octeontx2-af-skip-pfs-if-not-enabled.patch b/queue-6.2/octeontx2-af-skip-pfs-if-not-enabled.patch new file mode 100644 index 00000000000..bf5a72ba634 --- /dev/null +++ b/queue-6.2/octeontx2-af-skip-pfs-if-not-enabled.patch @@ -0,0 +1,196 @@ +From e55a52310744b38c14139de9a215089b10f1b8aa Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 3 May 2023 12:39:42 +0530 +Subject: octeontx2-af: Skip PFs if not enabled + +From: Ratheesh Kannoth + +[ Upstream commit 5eb1b7220948a69298a436148a735f32ec325289 ] + +Firmware enables PFs and allocate mbox resources for each of the PFs. +Currently PF driver configures mbox resources without checking whether +PF is enabled or not. This results in crash. This patch fixes this issue +by skipping disabled PF's mbox initialization. + +Fixes: 9bdc47a6e328 ("octeontx2-af: Mbox communication support btw AF and it's VFs") +Signed-off-by: Ratheesh Kannoth +Signed-off-by: Sunil Kovvuri Goutham +Signed-off-by: Sai Krishna +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + .../net/ethernet/marvell/octeontx2/af/mbox.c | 5 +- + .../net/ethernet/marvell/octeontx2/af/mbox.h | 3 +- + .../net/ethernet/marvell/octeontx2/af/rvu.c | 49 +++++++++++++++---- + 3 files changed, 46 insertions(+), 11 deletions(-) + +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mbox.c b/drivers/net/ethernet/marvell/octeontx2/af/mbox.c +index 2898931d5260a..9690ac01f02c8 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/af/mbox.c ++++ b/drivers/net/ethernet/marvell/octeontx2/af/mbox.c +@@ -157,7 +157,7 @@ EXPORT_SYMBOL(otx2_mbox_init); + */ + int otx2_mbox_regions_init(struct otx2_mbox *mbox, void **hwbase, + struct pci_dev *pdev, void *reg_base, +- int direction, int ndevs) ++ int direction, int ndevs, unsigned long *pf_bmap) + { + struct otx2_mbox_dev *mdev; + int devid, err; +@@ -169,6 +169,9 @@ int otx2_mbox_regions_init(struct otx2_mbox *mbox, void **hwbase, + mbox->hwbase = hwbase[0]; + + for (devid = 0; devid < ndevs; devid++) { ++ if (!test_bit(devid, pf_bmap)) ++ continue; ++ + mdev = &mbox->dev[devid]; + mdev->mbase = hwbase[devid]; + mdev->hwbase = hwbase[devid]; +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mbox.h b/drivers/net/ethernet/marvell/octeontx2/af/mbox.h +index ac90131d5b4ad..d9ee56ff73b46 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/af/mbox.h ++++ b/drivers/net/ethernet/marvell/octeontx2/af/mbox.h +@@ -96,9 +96,10 @@ void otx2_mbox_destroy(struct otx2_mbox *mbox); + int otx2_mbox_init(struct otx2_mbox *mbox, void __force *hwbase, + struct pci_dev *pdev, void __force *reg_base, + int direction, int ndevs); ++ + int otx2_mbox_regions_init(struct otx2_mbox *mbox, void __force **hwbase, + struct pci_dev *pdev, void __force *reg_base, +- int direction, int ndevs); ++ int direction, int ndevs, unsigned long *bmap); + void otx2_mbox_msg_send(struct otx2_mbox *mbox, int devid); + int otx2_mbox_wait_for_rsp(struct otx2_mbox *mbox, int devid); + int otx2_mbox_busy_poll_for_rsp(struct otx2_mbox *mbox, int devid); +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c +index 3f5e09b77d4bd..873f081c030de 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c ++++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c +@@ -2274,7 +2274,7 @@ static inline void rvu_afvf_mbox_up_handler(struct work_struct *work) + } + + static int rvu_get_mbox_regions(struct rvu *rvu, void **mbox_addr, +- int num, int type) ++ int num, int type, unsigned long *pf_bmap) + { + struct rvu_hwinfo *hw = rvu->hw; + int region; +@@ -2286,6 +2286,9 @@ static int rvu_get_mbox_regions(struct rvu *rvu, void **mbox_addr, + */ + if (type == TYPE_AFVF) { + for (region = 0; region < num; region++) { ++ if (!test_bit(region, pf_bmap)) ++ continue; ++ + if (hw->cap.per_pf_mbox_regs) { + bar4 = rvu_read64(rvu, BLKADDR_RVUM, + RVU_AF_PFX_BAR4_ADDR(0)) + +@@ -2307,6 +2310,9 @@ static int rvu_get_mbox_regions(struct rvu *rvu, void **mbox_addr, + * RVU_AF_PF_BAR4_ADDR register. + */ + for (region = 0; region < num; region++) { ++ if (!test_bit(region, pf_bmap)) ++ continue; ++ + if (hw->cap.per_pf_mbox_regs) { + bar4 = rvu_read64(rvu, BLKADDR_RVUM, + RVU_AF_PFX_BAR4_ADDR(region)); +@@ -2335,20 +2341,41 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw, + int err = -EINVAL, i, dir, dir_up; + void __iomem *reg_base; + struct rvu_work *mwork; ++ unsigned long *pf_bmap; + void **mbox_regions; + const char *name; ++ u64 cfg; + +- mbox_regions = kcalloc(num, sizeof(void *), GFP_KERNEL); +- if (!mbox_regions) ++ pf_bmap = bitmap_zalloc(num, GFP_KERNEL); ++ if (!pf_bmap) + return -ENOMEM; + ++ /* RVU VFs */ ++ if (type == TYPE_AFVF) ++ bitmap_set(pf_bmap, 0, num); ++ ++ if (type == TYPE_AFPF) { ++ /* Mark enabled PFs in bitmap */ ++ for (i = 0; i < num; i++) { ++ cfg = rvu_read64(rvu, BLKADDR_RVUM, RVU_PRIV_PFX_CFG(i)); ++ if (cfg & BIT_ULL(20)) ++ set_bit(i, pf_bmap); ++ } ++ } ++ ++ mbox_regions = kcalloc(num, sizeof(void *), GFP_KERNEL); ++ if (!mbox_regions) { ++ err = -ENOMEM; ++ goto free_bitmap; ++ } ++ + switch (type) { + case TYPE_AFPF: + name = "rvu_afpf_mailbox"; + dir = MBOX_DIR_AFPF; + dir_up = MBOX_DIR_AFPF_UP; + reg_base = rvu->afreg_base; +- err = rvu_get_mbox_regions(rvu, mbox_regions, num, TYPE_AFPF); ++ err = rvu_get_mbox_regions(rvu, mbox_regions, num, TYPE_AFPF, pf_bmap); + if (err) + goto free_regions; + break; +@@ -2357,7 +2384,7 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw, + dir = MBOX_DIR_PFVF; + dir_up = MBOX_DIR_PFVF_UP; + reg_base = rvu->pfreg_base; +- err = rvu_get_mbox_regions(rvu, mbox_regions, num, TYPE_AFVF); ++ err = rvu_get_mbox_regions(rvu, mbox_regions, num, TYPE_AFVF, pf_bmap); + if (err) + goto free_regions; + break; +@@ -2388,16 +2415,19 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw, + } + + err = otx2_mbox_regions_init(&mw->mbox, mbox_regions, rvu->pdev, +- reg_base, dir, num); ++ reg_base, dir, num, pf_bmap); + if (err) + goto exit; + + err = otx2_mbox_regions_init(&mw->mbox_up, mbox_regions, rvu->pdev, +- reg_base, dir_up, num); ++ reg_base, dir_up, num, pf_bmap); + if (err) + goto exit; + + for (i = 0; i < num; i++) { ++ if (!test_bit(i, pf_bmap)) ++ continue; ++ + mwork = &mw->mbox_wrk[i]; + mwork->rvu = rvu; + INIT_WORK(&mwork->work, mbox_handler); +@@ -2406,8 +2436,7 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw, + mwork->rvu = rvu; + INIT_WORK(&mwork->work, mbox_up_handler); + } +- kfree(mbox_regions); +- return 0; ++ goto free_regions; + + exit: + destroy_workqueue(mw->mbox_wq); +@@ -2416,6 +2445,8 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw, + iounmap((void __iomem *)mbox_regions[num]); + free_regions: + kfree(mbox_regions); ++free_bitmap: ++ bitmap_free(pf_bmap); + return err; + } + +-- +2.39.2 + diff --git a/queue-6.2/octeontx2-af-update-correct-mask-to-filter-ipv4-frag.patch b/queue-6.2/octeontx2-af-update-correct-mask-to-filter-ipv4-frag.patch new file mode 100644 index 00000000000..46109c58a05 --- /dev/null +++ b/queue-6.2/octeontx2-af-update-correct-mask-to-filter-ipv4-frag.patch @@ -0,0 +1,41 @@ +From b727980f83bedaa20d31b5d2c0576924aa06c43d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 3 May 2023 12:39:39 +0530 +Subject: octeontx2-af: Update correct mask to filter IPv4 fragments + +From: Suman Ghosh + +[ Upstream commit 2075bf150ddf320df02c05e242774dc0f73be1a1 ] + +During the initial design, the IPv4 ip_flag mask was set to 0xff. +Which results to filter only fragmets with (fragment_offset == 0). +As part of the fix, updated the mask to 0x20 to filter all the +fragmented packets irrespective of the fragment_offset value. + +Fixes: c672e3727989 ("octeontx2-pf: Add support to filter packet based on IP fragment") +Signed-off-by: Suman Ghosh +Signed-off-by: Sunil Kovvuri Goutham +Signed-off-by: Sai Krishna +Reviewed-by: Simon Horman +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c +index 044cc211424ed..8392f63e433fc 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c ++++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c +@@ -544,7 +544,7 @@ static int otx2_tc_prepare_flow(struct otx2_nic *nic, struct otx2_tc_flow *node, + if (match.mask->flags & FLOW_DIS_IS_FRAGMENT) { + if (ntohs(flow_spec->etype) == ETH_P_IP) { + flow_spec->ip_flag = IPV4_FLAG_MORE; +- flow_mask->ip_flag = 0xff; ++ flow_mask->ip_flag = IPV4_FLAG_MORE; + req->features |= BIT_ULL(NPC_IPFRAG_IPV4); + } else if (ntohs(flow_spec->etype) == ETH_P_IPV6) { + flow_spec->next_header = IPPROTO_FRAGMENT; +-- +2.39.2 + diff --git a/queue-6.2/octeontx2-af-update-fix-npc-field-hash-extract-featu.patch b/queue-6.2/octeontx2-af-update-fix-npc-field-hash-extract-featu.patch new file mode 100644 index 00000000000..b835ed918b2 --- /dev/null +++ b/queue-6.2/octeontx2-af-update-fix-npc-field-hash-extract-featu.patch @@ -0,0 +1,197 @@ +From 514683d0d88c81eb8cd467346de7670f312a34fe Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 3 May 2023 12:39:40 +0530 +Subject: octeontx2-af: Update/Fix NPC field hash extract feature + +From: Ratheesh Kannoth + +[ Upstream commit 406bed11fb91a0b35c26fe633d8700febaec6439 ] + +1. As per previous implementation, mask and control parameter to +generate the field hash value was not passed to the caller program. +Updated the secret key mbox to share that information as well, +as a part of the fix. +2. Earlier implementation did not consider hash reduction of both +source and destination IPv6 addresses. Only source IPv6 address +was considered. This fix solves that and provides option to hash + +Fixes: 56d9f5fd2246 ("octeontx2-af: Use hashed field in MCAM key") +Signed-off-by: Ratheesh Kannoth +Signed-off-by: Sunil Kovvuri Goutham +Signed-off-by: Sai Krishna +Reviewed-by: Simon Horman +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + .../net/ethernet/marvell/octeontx2/af/mbox.h | 16 +++++--- + .../marvell/octeontx2/af/rvu_npc_hash.c | 37 ++++++++++++------- + .../marvell/octeontx2/af/rvu_npc_hash.h | 6 +++ + 3 files changed, 41 insertions(+), 18 deletions(-) + +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mbox.h b/drivers/net/ethernet/marvell/octeontx2/af/mbox.h +index d2584ebb7a70c..ac90131d5b4ad 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/af/mbox.h ++++ b/drivers/net/ethernet/marvell/octeontx2/af/mbox.h +@@ -242,9 +242,9 @@ M(NPC_MCAM_READ_BASE_RULE, 0x6011, npc_read_base_steer_rule, \ + M(NPC_MCAM_GET_STATS, 0x6012, npc_mcam_entry_stats, \ + npc_mcam_get_stats_req, \ + npc_mcam_get_stats_rsp) \ +-M(NPC_GET_SECRET_KEY, 0x6013, npc_get_secret_key, \ +- npc_get_secret_key_req, \ +- npc_get_secret_key_rsp) \ ++M(NPC_GET_FIELD_HASH_INFO, 0x6013, npc_get_field_hash_info, \ ++ npc_get_field_hash_info_req, \ ++ npc_get_field_hash_info_rsp) \ + M(NPC_GET_FIELD_STATUS, 0x6014, npc_get_field_status, \ + npc_get_field_status_req, \ + npc_get_field_status_rsp) \ +@@ -1517,14 +1517,20 @@ struct npc_mcam_get_stats_rsp { + u8 stat_ena; /* enabled */ + }; + +-struct npc_get_secret_key_req { ++struct npc_get_field_hash_info_req { + struct mbox_msghdr hdr; + u8 intf; + }; + +-struct npc_get_secret_key_rsp { ++struct npc_get_field_hash_info_rsp { + struct mbox_msghdr hdr; + u64 secret_key[3]; ++#define NPC_MAX_HASH 2 ++#define NPC_MAX_HASH_MASK 2 ++ /* NPC_AF_INTF(0..1)_HASH(0..1)_MASK(0..1) */ ++ u64 hash_mask[NPC_MAX_INTF][NPC_MAX_HASH][NPC_MAX_HASH_MASK]; ++ /* NPC_AF_INTF(0..1)_HASH(0..1)_RESULT_CTRL */ ++ u64 hash_ctrl[NPC_MAX_INTF][NPC_MAX_HASH]; + }; + + enum ptp_op { +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c +index f2d7156262ff1..9ec5b3c65020b 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c ++++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c +@@ -110,8 +110,8 @@ static u64 npc_update_use_hash(int lt, int ld) + * in KEX_LD_CFG + */ + cfg = KEX_LD_CFG_USE_HASH(0x1, 0x03, +- ld ? 0x8 : 0x18, +- 0x1, 0x0, 0x10); ++ ld ? 0x18 : 0x8, ++ 0x1, 0x0, ld ? 0x14 : 0x10); + break; + } + +@@ -134,7 +134,6 @@ static void npc_program_mkex_hash_rx(struct rvu *rvu, int blkaddr, + if (mkex_hash->lid_lt_ld_hash_en[intf][lid][lt][ld]) { + u64 cfg = npc_update_use_hash(lt, ld); + +- hash_cnt++; + if (hash_cnt == NPC_MAX_HASH) + return; + +@@ -149,6 +148,8 @@ static void npc_program_mkex_hash_rx(struct rvu *rvu, int blkaddr, + mkex_hash->hash_mask[intf][ld][1]); + SET_KEX_LD_HASH_CTRL(intf, ld, + mkex_hash->hash_ctrl[intf][ld]); ++ ++ hash_cnt++; + } + } + } +@@ -171,7 +172,6 @@ static void npc_program_mkex_hash_tx(struct rvu *rvu, int blkaddr, + if (mkex_hash->lid_lt_ld_hash_en[intf][lid][lt][ld]) { + u64 cfg = npc_update_use_hash(lt, ld); + +- hash_cnt++; + if (hash_cnt == NPC_MAX_HASH) + return; + +@@ -187,8 +187,6 @@ static void npc_program_mkex_hash_tx(struct rvu *rvu, int blkaddr, + SET_KEX_LD_HASH_CTRL(intf, ld, + mkex_hash->hash_ctrl[intf][ld]); + hash_cnt++; +- if (hash_cnt == NPC_MAX_HASH) +- return; + } + } + } +@@ -242,8 +240,8 @@ void npc_update_field_hash(struct rvu *rvu, u8 intf, + struct flow_msg *omask) + { + struct npc_mcam_kex_hash *mkex_hash = rvu->kpu.mkex_hash; +- struct npc_get_secret_key_req req; +- struct npc_get_secret_key_rsp rsp; ++ struct npc_get_field_hash_info_req req; ++ struct npc_get_field_hash_info_rsp rsp; + u64 ldata[2], cfg; + u32 field_hash; + u8 hash_idx; +@@ -254,7 +252,7 @@ void npc_update_field_hash(struct rvu *rvu, u8 intf, + } + + req.intf = intf; +- rvu_mbox_handler_npc_get_secret_key(rvu, &req, &rsp); ++ rvu_mbox_handler_npc_get_field_hash_info(rvu, &req, &rsp); + + for (hash_idx = 0; hash_idx < NPC_MAX_HASH; hash_idx++) { + cfg = rvu_read64(rvu, blkaddr, NPC_AF_INTFX_HASHX_CFG(intf, hash_idx)); +@@ -315,13 +313,13 @@ void npc_update_field_hash(struct rvu *rvu, u8 intf, + } + } + +-int rvu_mbox_handler_npc_get_secret_key(struct rvu *rvu, +- struct npc_get_secret_key_req *req, +- struct npc_get_secret_key_rsp *rsp) ++int rvu_mbox_handler_npc_get_field_hash_info(struct rvu *rvu, ++ struct npc_get_field_hash_info_req *req, ++ struct npc_get_field_hash_info_rsp *rsp) + { + u64 *secret_key = rsp->secret_key; + u8 intf = req->intf; +- int blkaddr; ++ int i, j, blkaddr; + + blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NPC, 0); + if (blkaddr < 0) { +@@ -333,6 +331,19 @@ int rvu_mbox_handler_npc_get_secret_key(struct rvu *rvu, + secret_key[1] = rvu_read64(rvu, blkaddr, NPC_AF_INTFX_SECRET_KEY1(intf)); + secret_key[2] = rvu_read64(rvu, blkaddr, NPC_AF_INTFX_SECRET_KEY2(intf)); + ++ for (i = 0; i < NPC_MAX_HASH; i++) { ++ for (j = 0; j < NPC_MAX_HASH_MASK; j++) { ++ rsp->hash_mask[NIX_INTF_RX][i][j] = ++ GET_KEX_LD_HASH_MASK(NIX_INTF_RX, i, j); ++ rsp->hash_mask[NIX_INTF_TX][i][j] = ++ GET_KEX_LD_HASH_MASK(NIX_INTF_TX, i, j); ++ } ++ } ++ ++ for (i = 0; i < NPC_MAX_INTF; i++) ++ for (j = 0; j < NPC_MAX_HASH; j++) ++ rsp->hash_ctrl[i][j] = GET_KEX_LD_HASH_CTRL(i, j); ++ + return 0; + } + +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.h b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.h +index 3efeb09c58dec..65936f4aeaacf 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.h ++++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.h +@@ -31,6 +31,12 @@ + rvu_write64(rvu, blkaddr, \ + NPC_AF_INTFX_HASHX_MASKX(intf, ld, mask_idx), cfg) + ++#define GET_KEX_LD_HASH_CTRL(intf, ld) \ ++ rvu_read64(rvu, blkaddr, NPC_AF_INTFX_HASHX_RESULT_CTRL(intf, ld)) ++ ++#define GET_KEX_LD_HASH_MASK(intf, ld, mask_idx) \ ++ rvu_read64(rvu, blkaddr, NPC_AF_INTFX_HASHX_MASKX(intf, ld, mask_idx)) ++ + #define SET_KEX_LD_HASH_CTRL(intf, ld, cfg) \ + rvu_write64(rvu, blkaddr, \ + NPC_AF_INTFX_HASHX_RESULT_CTRL(intf, ld), cfg) +-- +2.39.2 + diff --git a/queue-6.2/octeontx2-pf-disable-packet-i-o-for-graceful-exit.patch b/queue-6.2/octeontx2-pf-disable-packet-i-o-for-graceful-exit.patch new file mode 100644 index 00000000000..3329562ad38 --- /dev/null +++ b/queue-6.2/octeontx2-pf-disable-packet-i-o-for-graceful-exit.patch @@ -0,0 +1,55 @@ +From 7dabc27ff580a4267585b8b07db341765ac4b1c4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 3 May 2023 12:39:43 +0530 +Subject: octeontx2-pf: Disable packet I/O for graceful exit + +From: Subbaraya Sundeep + +[ Upstream commit c926252205c424c4842dbdbe02f8e3296f623204 ] + +At the stage of enabling packet I/O in otx2_open, If mailbox +timeout occurs then interface ends up in down state where as +hardware packet I/O is enabled. Hence disable packet I/O also +before bailing out. + +Fixes: 1ea0166da050 ("octeontx2-pf: Fix the device state on error") +Signed-off-by: Subbaraya Sundeep +Signed-off-by: Sunil Kovvuri Goutham +Signed-off-by: Sai Krishna +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +index 3489553ad7010..23eee2b3d4081 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c ++++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +@@ -1835,13 +1835,22 @@ int otx2_open(struct net_device *netdev) + otx2_dmacflt_reinstall_flows(pf); + + err = otx2_rxtx_enable(pf, true); +- if (err) ++ /* If a mbox communication error happens at this point then interface ++ * will end up in a state such that it is in down state but hardware ++ * mcam entries are enabled to receive the packets. Hence disable the ++ * packet I/O. ++ */ ++ if (err == EIO) ++ goto err_disable_rxtx; ++ else if (err) + goto err_tx_stop_queues; + + otx2_do_set_rx_mode(pf); + + return 0; + ++err_disable_rxtx: ++ otx2_rxtx_enable(pf, false); + err_tx_stop_queues: + netif_tx_stop_all_queues(netdev); + netif_carrier_off(netdev); +-- +2.39.2 + diff --git a/queue-6.2/octeontx2-pf-increase-the-size-of-dmac-filter-flows.patch b/queue-6.2/octeontx2-pf-increase-the-size-of-dmac-filter-flows.patch new file mode 100644 index 00000000000..f2d63baecf7 --- /dev/null +++ b/queue-6.2/octeontx2-pf-increase-the-size-of-dmac-filter-flows.patch @@ -0,0 +1,44 @@ +From dd276e3c8599fd7b50986dcf0d66d96c02a2d379 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 3 May 2023 12:39:37 +0530 +Subject: octeontx2-pf: Increase the size of dmac filter flows + +From: Ratheesh Kannoth + +[ Upstream commit 2a6eecc592b4d59a04d513aa25fc0f30d52100cd ] + +CN10kb supports large number of dmac filter flows to be +inserted. Increase the field size to accommodate the same + +Fixes: b747923afff8 ("octeontx2-af: Exact match support") +Signed-off-by: Ratheesh Kannoth +Signed-off-by: Sunil Kovvuri Goutham +Signed-off-by: Sai Krishna +Reviewed-by: Simon Horman +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +index f42b2b65bfd7b..0c8fc66ade82d 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h ++++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +@@ -335,11 +335,11 @@ struct otx2_flow_config { + #define OTX2_PER_VF_VLAN_FLOWS 2 /* Rx + Tx per VF */ + #define OTX2_VF_VLAN_RX_INDEX 0 + #define OTX2_VF_VLAN_TX_INDEX 1 +- u16 max_flows; +- u8 dmacflt_max_flows; + u32 *bmap_to_dmacindex; + unsigned long *dmacflt_bmap; + struct list_head flow_list; ++ u32 dmacflt_max_flows; ++ u16 max_flows; + }; + + struct otx2_tc_info { +-- +2.39.2 + diff --git a/queue-6.2/octeontx2-pf-mcs-clear-stats-before-freeing-resource.patch b/queue-6.2/octeontx2-pf-mcs-clear-stats-before-freeing-resource.patch new file mode 100644 index 00000000000..8480d13dcba --- /dev/null +++ b/queue-6.2/octeontx2-pf-mcs-clear-stats-before-freeing-resource.patch @@ -0,0 +1,52 @@ +From b2abacb80a4b8e85faf8292cc01a3bde4ad29801 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Apr 2023 11:55:26 +0530 +Subject: octeontx2-pf: mcs: Clear stats before freeing resource + +From: Subbaraya Sundeep + +[ Upstream commit 815debbbf7b52026462c37eea3be70d6377a7a9a ] + +When freeing MCS hardware resources like SecY, SC and +SA the corresponding stats needs to be cleared. Otherwise +previous stats are shown in newly created macsec interfaces. + +Fixes: c54ffc73601c ("octeontx2-pf: mcs: Introduce MACSEC hardware offloading") +Signed-off-by: Subbaraya Sundeep +Signed-off-by: Sunil Goutham +Signed-off-by: Geetha sowjanya +Reviewed-by: Leon Romanovsky +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + .../net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c +index f699209978fef..13faca9add9f4 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c ++++ b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c +@@ -150,11 +150,20 @@ static void cn10k_mcs_free_rsrc(struct otx2_nic *pfvf, enum mcs_direction dir, + enum mcs_rsrc_type type, u16 hw_rsrc_id, + bool all) + { ++ struct mcs_clear_stats *clear_req; + struct mbox *mbox = &pfvf->mbox; + struct mcs_free_rsrc_req *req; + + mutex_lock(&mbox->lock); + ++ clear_req = otx2_mbox_alloc_msg_mcs_clear_stats(mbox); ++ if (!clear_req) ++ goto fail; ++ ++ clear_req->id = hw_rsrc_id; ++ clear_req->type = type; ++ clear_req->dir = dir; ++ + req = otx2_mbox_alloc_msg_mcs_free_resources(mbox); + if (!req) + goto fail; +-- +2.39.2 + diff --git a/queue-6.2/octeontx2-pf-mcs-do-not-reset-pn-while-updating-secy.patch b/queue-6.2/octeontx2-pf-mcs-do-not-reset-pn-while-updating-secy.patch new file mode 100644 index 00000000000..c69e816a33a --- /dev/null +++ b/queue-6.2/octeontx2-pf-mcs-do-not-reset-pn-while-updating-secy.patch @@ -0,0 +1,66 @@ +From f1dae5d9554cd0947882f54ef8468af312c45dc6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Apr 2023 11:55:28 +0530 +Subject: octeontx2-pf: mcs: Do not reset PN while updating secy + +From: Subbaraya Sundeep + +[ Upstream commit 3c99bace4ad08ad0264285ba8ad73117560992c2 ] + +After creating SecYs, SCs and SAs a SecY can be modified +to change attributes like validation mode, protect frames +mode etc. During this SecY update, packet number is reset to +initial user given value by mistake. Hence do not reset +PN when updating SecY parameters. + +Fixes: c54ffc73601c ("octeontx2-pf: mcs: Introduce MACSEC hardware offloading") +Signed-off-by: Subbaraya Sundeep +Signed-off-by: Sunil Goutham +Signed-off-by: Geetha sowjanya +Reviewed-by: Leon Romanovsky +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + .../ethernet/marvell/octeontx2/nic/cn10k_macsec.c | 15 ++++++++++----- + 1 file changed, 10 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c +index 3ad8d7ef20be6..a487a98eac88c 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c ++++ b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c +@@ -1134,6 +1134,7 @@ static int cn10k_mdo_upd_secy(struct macsec_context *ctx) + struct macsec_secy *secy = ctx->secy; + struct macsec_tx_sa *sw_tx_sa; + struct cn10k_mcs_txsc *txsc; ++ bool active; + u8 sa_num; + int err; + +@@ -1141,15 +1142,19 @@ static int cn10k_mdo_upd_secy(struct macsec_context *ctx) + if (!txsc) + return -ENOENT; + +- txsc->encoding_sa = secy->tx_sc.encoding_sa; +- +- sa_num = txsc->encoding_sa; +- sw_tx_sa = rcu_dereference_bh(secy->tx_sc.sa[sa_num]); ++ /* Encoding SA got changed */ ++ if (txsc->encoding_sa != secy->tx_sc.encoding_sa) { ++ txsc->encoding_sa = secy->tx_sc.encoding_sa; ++ sa_num = txsc->encoding_sa; ++ sw_tx_sa = rcu_dereference_bh(secy->tx_sc.sa[sa_num]); ++ active = sw_tx_sa ? sw_tx_sa->active : false; ++ cn10k_mcs_link_tx_sa2sc(pfvf, secy, txsc, sa_num, active); ++ } + + if (netif_running(secy->netdev)) { + cn10k_mcs_sync_stats(pfvf, secy, txsc); + +- err = cn10k_mcs_secy_tx_cfg(pfvf, secy, txsc, sw_tx_sa, sa_num); ++ err = cn10k_mcs_secy_tx_cfg(pfvf, secy, txsc, NULL, 0); + if (err) + return err; + } +-- +2.39.2 + diff --git a/queue-6.2/octeontx2-pf-mcs-fix-null-pointer-dereferences.patch b/queue-6.2/octeontx2-pf-mcs-fix-null-pointer-dereferences.patch new file mode 100644 index 00000000000..1bea1ef5cf2 --- /dev/null +++ b/queue-6.2/octeontx2-pf-mcs-fix-null-pointer-dereferences.patch @@ -0,0 +1,104 @@ +From ef50d5007b3f8b32dd12cfb710c325bb1d860bac Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Apr 2023 11:55:24 +0530 +Subject: octeontx2-pf: mcs: Fix NULL pointer dereferences + +From: Subbaraya Sundeep + +[ Upstream commit 699af748c61574125d269db260dabbe20436d74e ] + +When system is rebooted after creating macsec interface +below NULL pointer dereference crashes occurred. This +patch fixes those crashes by using correct order of teardown + +[ 3324.406942] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 +[ 3324.415726] Mem abort info: +[ 3324.418510] ESR = 0x96000006 +[ 3324.421557] EC = 0x25: DABT (current EL), IL = 32 bits +[ 3324.426865] SET = 0, FnV = 0 +[ 3324.429913] EA = 0, S1PTW = 0 +[ 3324.433047] Data abort info: +[ 3324.435921] ISV = 0, ISS = 0x00000006 +[ 3324.439748] CM = 0, WnR = 0 +.... +[ 3324.575915] Call trace: +[ 3324.578353] cn10k_mdo_del_secy+0x24/0x180 +[ 3324.582440] macsec_common_dellink+0xec/0x120 +[ 3324.586788] macsec_notify+0x17c/0x1c0 +[ 3324.590529] raw_notifier_call_chain+0x50/0x70 +[ 3324.594965] call_netdevice_notifiers_info+0x34/0x7c +[ 3324.599921] rollback_registered_many+0x354/0x5bc +[ 3324.604616] unregister_netdevice_queue+0x88/0x10c +[ 3324.609399] unregister_netdev+0x20/0x30 +[ 3324.613313] otx2_remove+0x8c/0x310 +[ 3324.616794] pci_device_shutdown+0x30/0x70 +[ 3324.620882] device_shutdown+0x11c/0x204 + +[ 966.664930] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 +[ 966.673712] Mem abort info: +[ 966.676497] ESR = 0x96000006 +[ 966.679543] EC = 0x25: DABT (current EL), IL = 32 bits +[ 966.684848] SET = 0, FnV = 0 +[ 966.687895] EA = 0, S1PTW = 0 +[ 966.691028] Data abort info: +[ 966.693900] ISV = 0, ISS = 0x00000006 +[ 966.697729] CM = 0, WnR = 0 +[ 966.833467] Call trace: +[ 966.835904] cn10k_mdo_stop+0x20/0xa0 +[ 966.839557] macsec_dev_stop+0xe8/0x11c +[ 966.843384] __dev_close_many+0xbc/0x140 +[ 966.847298] dev_close_many+0x84/0x120 +[ 966.851039] rollback_registered_many+0x114/0x5bc +[ 966.855735] unregister_netdevice_many.part.0+0x14/0xa0 +[ 966.860952] unregister_netdevice_many+0x18/0x24 +[ 966.865560] macsec_notify+0x1ac/0x1c0 +[ 966.869303] raw_notifier_call_chain+0x50/0x70 +[ 966.873738] call_netdevice_notifiers_info+0x34/0x7c +[ 966.878694] rollback_registered_many+0x354/0x5bc +[ 966.883390] unregister_netdevice_queue+0x88/0x10c +[ 966.888173] unregister_netdev+0x20/0x30 +[ 966.892090] otx2_remove+0x8c/0x310 +[ 966.895571] pci_device_shutdown+0x30/0x70 +[ 966.899660] device_shutdown+0x11c/0x204 +[ 966.903574] __do_sys_reboot+0x208/0x290 +[ 966.907487] __arm64_sys_reboot+0x20/0x30 +[ 966.911489] el0_svc_handler+0x80/0x1c0 +[ 966.915316] el0_svc+0x8/0x180 +[ 966.918362] Code: f9400000 f9400a64 91220014 f94b3403 (f9400060) +[ 966.924448] ---[ end trace 341778e799c3d8d7 ]--- + +Fixes: c54ffc73601c ("octeontx2-pf: mcs: Introduce MACSEC hardware offloading") +Signed-off-by: Subbaraya Sundeep +Signed-off-by: Sunil Goutham +Signed-off-by: Geetha sowjanya +Reviewed-by: Leon Romanovsky +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +index c1ea60bc2630e..3489553ad7010 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c ++++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +@@ -3069,8 +3069,6 @@ static void otx2_remove(struct pci_dev *pdev) + otx2_config_pause_frm(pf); + } + +- cn10k_mcs_free(pf); +- + #ifdef CONFIG_DCB + /* Disable PFC config */ + if (pf->pfc_en) { +@@ -3084,6 +3082,7 @@ static void otx2_remove(struct pci_dev *pdev) + + otx2_unregister_dl(pf); + unregister_netdev(netdev); ++ cn10k_mcs_free(pf); + otx2_sriov_disable(pf->pdev); + otx2_sriov_vfcfg_cleanup(pf); + if (pf->otx2_wq) +-- +2.39.2 + diff --git a/queue-6.2/octeontx2-pf-mcs-fix-shared-counters-logic.patch b/queue-6.2/octeontx2-pf-mcs-fix-shared-counters-logic.patch new file mode 100644 index 00000000000..a424278cb27 --- /dev/null +++ b/queue-6.2/octeontx2-pf-mcs-fix-shared-counters-logic.patch @@ -0,0 +1,106 @@ +From 178fa33f6c80b61385adebc7c96d2cb6d1933b16 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Apr 2023 11:55:27 +0530 +Subject: octeontx2-pf: mcs: Fix shared counters logic + +From: Subbaraya Sundeep + +[ Upstream commit 9bdfe61054fb2b989eb58df20bf99c0cf67e3038 ] + +Macsec stats like InPktsLate and InPktsDelayed share +same counter in hardware. If SecY replay_protect is true +then counter represents InPktsLate otherwise InPktsDelayed. +This mode change was tracked based on protect_frames +instead of replay_protect mistakenly. Similarly InPktsUnchecked +and InPktsOk share same counter and mode change was tracked +based on validate_check instead of validate_disabled. +This patch fixes those problems. + +Fixes: c54ffc73601c ("octeontx2-pf: mcs: Introduce MACSEC hardware offloading") +Signed-off-by: Subbaraya Sundeep +Signed-off-by: Sunil Goutham +Signed-off-by: Geetha sowjanya +Reviewed-by: Leon Romanovsky +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + .../ethernet/marvell/octeontx2/nic/cn10k_macsec.c | 14 +++++++------- + .../ethernet/marvell/octeontx2/nic/otx2_common.h | 2 +- + 2 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c +index 13faca9add9f4..3ad8d7ef20be6 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c ++++ b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c +@@ -1014,7 +1014,7 @@ static void cn10k_mcs_sync_stats(struct otx2_nic *pfvf, struct macsec_secy *secy + + /* Check if sync is really needed */ + if (secy->validate_frames == txsc->last_validate_frames && +- secy->protect_frames == txsc->last_protect_frames) ++ secy->replay_protect == txsc->last_replay_protect) + return; + + cn10k_mcs_secy_stats(pfvf, txsc->hw_secy_id_rx, &rx_rsp, MCS_RX, true); +@@ -1036,19 +1036,19 @@ static void cn10k_mcs_sync_stats(struct otx2_nic *pfvf, struct macsec_secy *secy + rxsc->stats.InPktsInvalid += sc_rsp.pkt_invalid_cnt; + rxsc->stats.InPktsNotValid += sc_rsp.pkt_notvalid_cnt; + +- if (txsc->last_protect_frames) ++ if (txsc->last_replay_protect) + rxsc->stats.InPktsLate += sc_rsp.pkt_late_cnt; + else + rxsc->stats.InPktsDelayed += sc_rsp.pkt_late_cnt; + +- if (txsc->last_validate_frames == MACSEC_VALIDATE_CHECK) ++ if (txsc->last_validate_frames == MACSEC_VALIDATE_DISABLED) + rxsc->stats.InPktsUnchecked += sc_rsp.pkt_unchecked_cnt; + else + rxsc->stats.InPktsOK += sc_rsp.pkt_unchecked_cnt; + } + + txsc->last_validate_frames = secy->validate_frames; +- txsc->last_protect_frames = secy->protect_frames; ++ txsc->last_replay_protect = secy->replay_protect; + } + + static int cn10k_mdo_open(struct macsec_context *ctx) +@@ -1117,7 +1117,7 @@ static int cn10k_mdo_add_secy(struct macsec_context *ctx) + txsc->sw_secy = secy; + txsc->encoding_sa = secy->tx_sc.encoding_sa; + txsc->last_validate_frames = secy->validate_frames; +- txsc->last_protect_frames = secy->protect_frames; ++ txsc->last_replay_protect = secy->replay_protect; + + list_add(&txsc->entry, &cfg->txsc_list); + +@@ -1538,12 +1538,12 @@ static int cn10k_mdo_get_rx_sc_stats(struct macsec_context *ctx) + rxsc->stats.InPktsInvalid += rsp.pkt_invalid_cnt; + rxsc->stats.InPktsNotValid += rsp.pkt_notvalid_cnt; + +- if (secy->protect_frames) ++ if (secy->replay_protect) + rxsc->stats.InPktsLate += rsp.pkt_late_cnt; + else + rxsc->stats.InPktsDelayed += rsp.pkt_late_cnt; + +- if (secy->validate_frames == MACSEC_VALIDATE_CHECK) ++ if (secy->validate_frames == MACSEC_VALIDATE_DISABLED) + rxsc->stats.InPktsUnchecked += rsp.pkt_unchecked_cnt; + else + rxsc->stats.InPktsOK += rsp.pkt_unchecked_cnt; +diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +index 3d22cc6a2804a..f42b2b65bfd7b 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h ++++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +@@ -389,7 +389,7 @@ struct cn10k_mcs_txsc { + struct cn10k_txsc_stats stats; + struct list_head entry; + enum macsec_validation_type last_validate_frames; +- bool last_protect_frames; ++ bool last_replay_protect; + u16 hw_secy_id_tx; + u16 hw_secy_id_rx; + u16 hw_flow_id; +-- +2.39.2 + diff --git a/queue-6.2/octeontx2-pf-mcs-match-macsec-ethertype-along-with-d.patch b/queue-6.2/octeontx2-pf-mcs-match-macsec-ethertype-along-with-d.patch new file mode 100644 index 00000000000..659cedd2539 --- /dev/null +++ b/queue-6.2/octeontx2-pf-mcs-match-macsec-ethertype-along-with-d.patch @@ -0,0 +1,72 @@ +From 32d620330b92b0b84ecb7648be3dae68149277d7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Apr 2023 11:55:25 +0530 +Subject: octeontx2-pf: mcs: Match macsec ethertype along with DMAC + +From: Subbaraya Sundeep + +[ Upstream commit 57d00d4364f314485092667d2a48718985515deb ] + +On CN10KB silicon a single hardware macsec block is +present and offloads macsec operations for all the +ethernet LMACs. TCAM match with macsec ethertype 0x88e5 +alone at RX side is not sufficient to distinguish all the +macsec interfaces created on top of netdevs. Hence append +the DMAC of the macsec interface too. Otherwise the first +created macsec interface only receives all the macsec traffic. + +Fixes: c54ffc73601c ("octeontx2-pf: mcs: Introduce MACSEC hardware offloading") +Signed-off-by: Subbaraya Sundeep +Signed-off-by: Sunil Goutham +Signed-off-by: Geetha sowjanya +Reviewed-by: Leon Romanovsky +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + .../net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c +index 9ec5f38d38a84..f699209978fef 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c ++++ b/drivers/net/ethernet/marvell/octeontx2/nic/cn10k_macsec.c +@@ -9,6 +9,7 @@ + #include + #include "otx2_common.h" + ++#define MCS_TCAM0_MAC_DA_MASK GENMASK_ULL(47, 0) + #define MCS_TCAM0_MAC_SA_MASK GENMASK_ULL(63, 48) + #define MCS_TCAM1_MAC_SA_MASK GENMASK_ULL(31, 0) + #define MCS_TCAM1_ETYPE_MASK GENMASK_ULL(47, 32) +@@ -237,8 +238,10 @@ static int cn10k_mcs_write_rx_flowid(struct otx2_nic *pfvf, + struct cn10k_mcs_rxsc *rxsc, u8 hw_secy_id) + { + struct macsec_rx_sc *sw_rx_sc = rxsc->sw_rxsc; ++ struct macsec_secy *secy = rxsc->sw_secy; + struct mcs_flowid_entry_write_req *req; + struct mbox *mbox = &pfvf->mbox; ++ u64 mac_da; + int ret; + + mutex_lock(&mbox->lock); +@@ -249,11 +252,16 @@ static int cn10k_mcs_write_rx_flowid(struct otx2_nic *pfvf, + goto fail; + } + ++ mac_da = ether_addr_to_u64(secy->netdev->dev_addr); ++ ++ req->data[0] = FIELD_PREP(MCS_TCAM0_MAC_DA_MASK, mac_da); ++ req->mask[0] = ~0ULL; ++ req->mask[0] = ~MCS_TCAM0_MAC_DA_MASK; ++ + req->data[1] = FIELD_PREP(MCS_TCAM1_ETYPE_MASK, ETH_P_MACSEC); + req->mask[1] = ~0ULL; + req->mask[1] &= ~MCS_TCAM1_ETYPE_MASK; + +- req->mask[0] = ~0ULL; + req->mask[2] = ~0ULL; + req->mask[3] = ~0ULL; + +-- +2.39.2 + diff --git a/queue-6.2/octeontx2-vf-detach-lf-resources-on-probe-cleanup.patch b/queue-6.2/octeontx2-vf-detach-lf-resources-on-probe-cleanup.patch new file mode 100644 index 00000000000..5d03dd7516e --- /dev/null +++ b/queue-6.2/octeontx2-vf-detach-lf-resources-on-probe-cleanup.patch @@ -0,0 +1,39 @@ +From cbd01cd2ed8ea842a5e184ff704418602bfd093a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 3 May 2023 12:39:44 +0530 +Subject: octeontx2-vf: Detach LF resources on probe cleanup + +From: Subbaraya Sundeep + +[ Upstream commit 99ae1260fdb5f15beab8a3adfb93a9041c87a2c1 ] + +When a VF device probe fails due to error in MSIX vector allocation then +the resources NIX and NPA LFs were not detached. Fix this by detaching +the LFs when MSIX vector allocation fails. + +Fixes: 3184fb5ba96e ("octeontx2-vf: Virtual function driver support") +Signed-off-by: Subbaraya Sundeep +Signed-off-by: Sunil Kovvuri Goutham +Signed-off-by: Sai Krishna +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c +index ab126f8706c74..53366dbfbf27c 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c ++++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c +@@ -621,7 +621,7 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id) + + err = otx2vf_realloc_msix_vectors(vf); + if (err) +- goto err_mbox_destroy; ++ goto err_detach_rsrc; + + err = otx2_set_real_num_queues(netdev, qcount, qcount); + if (err) +-- +2.39.2 + diff --git a/queue-6.2/octeonxt2-af-mcs-fix-per-port-bypass-config.patch b/queue-6.2/octeonxt2-af-mcs-fix-per-port-bypass-config.patch new file mode 100644 index 00000000000..10a0dd87b55 --- /dev/null +++ b/queue-6.2/octeonxt2-af-mcs-fix-per-port-bypass-config.patch @@ -0,0 +1,89 @@ +From f2376fefbe949486208d2a33bd3300396fb5ce79 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Apr 2023 11:55:20 +0530 +Subject: octeonxt2-af: mcs: Fix per port bypass config + +From: Geetha sowjanya + +[ Upstream commit c222b292a3568754828ffd30338d2909b14ed160 ] + +For each lmac port, MCS has two MCS_TOP_SLAVE_CHANNEL_CONFIGX +registers. For CN10KB both register need to be configured for the +port level mcs bypass to work. This patch also sets bitmap +of flowid/secy entry reserved for default bypass so that these +entries can be shown in debugfs. + +Fixes: bd69476e86fc ("octeontx2-af: cn10k: mcs: Install a default TCAM for normal traffic") +Signed-off-by: Geetha sowjanya +Signed-off-by: Sunil Goutham +Reviewed-by: Leon Romanovsky +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/marvell/octeontx2/af/mcs.c | 11 ++++++++++- + .../net/ethernet/marvell/octeontx2/af/rvu_debugfs.c | 5 +++-- + 2 files changed, 13 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mcs.c b/drivers/net/ethernet/marvell/octeontx2/af/mcs.c +index f68a6a0e3aa41..492baa0b594ce 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/af/mcs.c ++++ b/drivers/net/ethernet/marvell/octeontx2/af/mcs.c +@@ -494,6 +494,9 @@ int mcs_install_flowid_bypass_entry(struct mcs *mcs) + + /* Flow entry */ + flow_id = mcs->hw->tcam_entries - MCS_RSRC_RSVD_CNT; ++ __set_bit(flow_id, mcs->rx.flow_ids.bmap); ++ __set_bit(flow_id, mcs->tx.flow_ids.bmap); ++ + for (reg_id = 0; reg_id < 4; reg_id++) { + reg = MCSX_CPM_RX_SLAVE_FLOWID_TCAM_MASKX(reg_id, flow_id); + mcs_reg_write(mcs, reg, GENMASK_ULL(63, 0)); +@@ -504,6 +507,8 @@ int mcs_install_flowid_bypass_entry(struct mcs *mcs) + } + /* secy */ + secy_id = mcs->hw->secy_entries - MCS_RSRC_RSVD_CNT; ++ __set_bit(secy_id, mcs->rx.secy.bmap); ++ __set_bit(secy_id, mcs->tx.secy.bmap); + + /* Set validate frames to NULL and enable control port */ + plcy = 0x7ull; +@@ -528,6 +533,7 @@ int mcs_install_flowid_bypass_entry(struct mcs *mcs) + /* Enable Flowid entry */ + mcs_ena_dis_flowid_entry(mcs, flow_id, MCS_RX, true); + mcs_ena_dis_flowid_entry(mcs, flow_id, MCS_TX, true); ++ + return 0; + } + +@@ -1325,8 +1331,11 @@ void mcs_reset_port(struct mcs *mcs, u8 port_id, u8 reset) + void mcs_set_lmac_mode(struct mcs *mcs, int lmac_id, u8 mode) + { + u64 reg; ++ int id = lmac_id * 2; + +- reg = MCSX_MCS_TOP_SLAVE_CHANNEL_CFG(lmac_id * 2); ++ reg = MCSX_MCS_TOP_SLAVE_CHANNEL_CFG(id); ++ mcs_reg_write(mcs, reg, (u64)mode); ++ reg = MCSX_MCS_TOP_SLAVE_CHANNEL_CFG((id + 1)); + mcs_reg_write(mcs, reg, (u64)mode); + } + +diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c +index 26cfa501f1a11..9533b1d929604 100644 +--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c ++++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c +@@ -497,8 +497,9 @@ static int rvu_dbg_mcs_rx_secy_stats_display(struct seq_file *filp, void *unused + stats.octet_validated_cnt); + seq_printf(filp, "secy%d: Pkts on disable port: %lld\n", secy_id, + stats.pkt_port_disabled_cnt); +- seq_printf(filp, "secy%d: Octets validated: %lld\n", secy_id, stats.pkt_badtag_cnt); +- seq_printf(filp, "secy%d: Octets validated: %lld\n", secy_id, stats.pkt_nosa_cnt); ++ seq_printf(filp, "secy%d: Pkts with badtag: %lld\n", secy_id, stats.pkt_badtag_cnt); ++ seq_printf(filp, "secy%d: Pkts with no SA(sectag.tci.c=0): %lld\n", secy_id, ++ stats.pkt_nosa_cnt); + seq_printf(filp, "secy%d: Pkts with nosaerror: %lld\n", secy_id, + stats.pkt_nosaerror_cnt); + seq_printf(filp, "secy%d: Tagged ctrl pkts: %lld\n", secy_id, +-- +2.39.2 + diff --git a/queue-6.2/perf-build-support-python-perf.so-testing.patch b/queue-6.2/perf-build-support-python-perf.so-testing.patch new file mode 100644 index 00000000000..5c3b26f3b72 --- /dev/null +++ b/queue-6.2/perf-build-support-python-perf.so-testing.patch @@ -0,0 +1,107 @@ +From 540e0150e58d804c66c2eb703f02e87fd96d7cbb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 10 Mar 2023 22:57:41 -0800 +Subject: perf build: Support python/perf.so testing +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Ian Rogers + +[ Upstream commit 7a9b223ca0761a7c7c72e569b86b84a907aa0f92 ] + +Add a build target to echo the python/perf.so's name from +Makefile.perf. Use it in tests/make so the correct target is built and +tested for. + +Fixes: caec54705adb73b0 ("perf build: Fix python/perf.so library's name") +Signed-off-by: Ian Rogers +Cc: Adrian Hunter +Cc: Alexander Shishkin +Cc: Andres Freund +Cc: Ian Rogers +Cc: Ingo Molnar +Cc: Jiri Olsa +Cc: Leo Yan +Cc: Mark Rutland +Cc: Martin LiÅ¡ka +Cc: Namhyung Kim +Cc: Nathan Chancellor +Cc: Nick Desaulniers +Cc: Pavithra Gurushankar +Cc: Peter Zijlstra +Cc: Quentin Monnet +Cc: Roberto Sassu +Cc: Stephane Eranian +Cc: Tiezhu Yang +Cc: Tom Rix +Cc: Yang Jihong +Cc: llvm@lists.linux.dev +Link: https://lore.kernel.org/r/20230311065753.3012826-2-irogers@google.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/Makefile.perf | 7 +++++-- + tools/perf/tests/make | 5 +++-- + 2 files changed, 8 insertions(+), 4 deletions(-) + +diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf +index b7d9c42062300..cc2b0ace54bac 100644 +--- a/tools/perf/Makefile.perf ++++ b/tools/perf/Makefile.perf +@@ -647,13 +647,16 @@ all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS) + # Create python binding output directory if not already present + _dummy := $(shell [ -d '$(OUTPUT)python' ] || mkdir -p '$(OUTPUT)python') + +-$(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX): $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBPERF) ++$(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX): $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBPERF) $(LIBSUBCMD) + $(QUIET_GEN)LDSHARED="$(CC) -pthread -shared" \ + CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' \ + $(PYTHON_WORD) util/setup.py \ + --quiet build_ext; \ + cp $(PYTHON_EXTBUILD_LIB)perf*.so $(OUTPUT)python/ + ++python_perf_target: ++ @echo "Target is: $(OUTPUT)python/perf$(PYTHON_EXTENSION_SUFFIX)" ++ + please_set_SHELL_PATH_to_a_more_modern_shell: + $(Q)$$(:) + +@@ -1151,7 +1154,7 @@ FORCE: + .PHONY: all install clean config-clean strip install-gtk + .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell + .PHONY: .FORCE-PERF-VERSION-FILE TAGS tags cscope FORCE prepare +-.PHONY: archheaders ++.PHONY: archheaders python_perf_target + + endif # force_fixdep + +diff --git a/tools/perf/tests/make b/tools/perf/tests/make +index 009d6efb673ce..deb37fb982e97 100644 +--- a/tools/perf/tests/make ++++ b/tools/perf/tests/make +@@ -62,10 +62,11 @@ lib = lib + endif + + has = $(shell which $1 2>/dev/null) ++python_perf_so := $(shell $(MAKE) python_perf_target|grep "Target is:"|awk '{print $$3}') + + # standard single make variable specified + make_clean_all := clean all +-make_python_perf_so := python/perf.so ++make_python_perf_so := $(python_perf_so) + make_debug := DEBUG=1 + make_no_libperl := NO_LIBPERL=1 + make_no_libpython := NO_LIBPYTHON=1 +@@ -204,7 +205,7 @@ test_make_doc := $(test_ok) + test_make_help_O := $(test_ok) + test_make_doc_O := $(test_ok) + +-test_make_python_perf_so := test -f $(PERF_O)/python/perf.so ++test_make_python_perf_so := test -f $(PERF_O)/$(python_perf_so) + + test_make_perf_o := test -f $(PERF_O)/perf.o + test_make_util_map_o := test -f $(PERF_O)/util/map.o +-- +2.39.2 + diff --git a/queue-6.2/perf-cs-etm-fix-timeless-decode-mode-detection.patch b/queue-6.2/perf-cs-etm-fix-timeless-decode-mode-detection.patch new file mode 100644 index 00000000000..ac15a63a7fc --- /dev/null +++ b/queue-6.2/perf-cs-etm-fix-timeless-decode-mode-detection.patch @@ -0,0 +1,121 @@ +From dd3c69a5950d2928913c57d1774fed7d7774851f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 24 Apr 2023 14:47:41 +0100 +Subject: perf cs-etm: Fix timeless decode mode detection + +From: James Clark + +[ Upstream commit 449067f3fc9f340da54e383738286881e6634d0b ] + +In this context, timeless refers to the trace data rather than the perf +event data. But when detecting whether there are timestamps in the trace +data or not, the presence of a timestamp flag on any perf event is used. + +Since commit f42c0ce573df ("perf record: Always get text_poke events +with --kcore option") timestamps were added to a tracking event when +--kcore is used which breaks this detection mechanism. Fix it by +detecting if trace timestamps exist by looking at the ETM config flags. +This would have always been a more accurate way of doing it anyway. + +This fixes the following error message when using --kcore with +Coresight: + + $ perf record --kcore -e cs_etm// --per-thread + $ perf report + The perf.data/data data has no samples! + +Fixes: f42c0ce573df79d1 ("perf record: Always get text_poke events with --kcore option") +Reported-by: Yang Shi +Signed-off-by: James Clark +Cc: Adrian Hunter +Cc: Alexander Shishkin +Cc: Ian Rogers +Cc: Ingo Molnar +Cc: Jiri Olsa +Cc: John Garry +Cc: Leo Yan +Cc: Mark Rutland +Cc: Mathieu Poirier +Cc: Mike Leach +Cc: Namhyung Kim +Cc: Peter Zijlstra +Cc: Suzuki Poulouse +Cc: Will Deacon +Cc: coresight@lists.linaro.org +Cc: denik@google.com +Cc: linux-arm-kernel@lists.infradead.org +Link: https://lore.kernel.org/lkml/CAHbLzkrJQTrYBtPkf=jf3OpQ-yBcJe7XkvQstX9j2frz4WF-SQ@mail.gmail.com/ +Link: https://lore.kernel.org/r/20230424134748.228137-2-james.clark@arm.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/util/cs-etm.c | 30 ++++++++++++++++++------------ + 1 file changed, 18 insertions(+), 12 deletions(-) + +diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c +index 33303d03c2fa4..2f327986090e1 100644 +--- a/tools/perf/util/cs-etm.c ++++ b/tools/perf/util/cs-etm.c +@@ -2488,26 +2488,29 @@ static int cs_etm__process_auxtrace_event(struct perf_session *session, + return 0; + } + +-static bool cs_etm__is_timeless_decoding(struct cs_etm_auxtrace *etm) ++static int cs_etm__setup_timeless_decoding(struct cs_etm_auxtrace *etm) + { + struct evsel *evsel; + struct evlist *evlist = etm->session->evlist; +- bool timeless_decoding = true; + + /* Override timeless mode with user input from --itrace=Z */ +- if (etm->synth_opts.timeless_decoding) +- return true; ++ if (etm->synth_opts.timeless_decoding) { ++ etm->timeless_decoding = true; ++ return 0; ++ } + + /* +- * Circle through the list of event and complain if we find one +- * with the time bit set. ++ * Find the cs_etm evsel and look at what its timestamp setting was + */ +- evlist__for_each_entry(evlist, evsel) { +- if ((evsel->core.attr.sample_type & PERF_SAMPLE_TIME)) +- timeless_decoding = false; +- } ++ evlist__for_each_entry(evlist, evsel) ++ if (cs_etm__evsel_is_auxtrace(etm->session, evsel)) { ++ etm->timeless_decoding = ++ !(evsel->core.attr.config & BIT(ETM_OPT_TS)); ++ return 0; ++ } + +- return timeless_decoding; ++ pr_err("CS ETM: Couldn't find ETM evsel\n"); ++ return -EINVAL; + } + + /* +@@ -2884,7 +2887,6 @@ int cs_etm__process_auxtrace_info_full(union perf_event *event, + etm->snapshot_mode = (ptr[CS_ETM_SNAPSHOT] != 0); + etm->metadata = metadata; + etm->auxtrace_type = auxtrace_info->type; +- etm->timeless_decoding = cs_etm__is_timeless_decoding(etm); + + etm->auxtrace.process_event = cs_etm__process_event; + etm->auxtrace.process_auxtrace_event = cs_etm__process_auxtrace_event; +@@ -2894,6 +2896,10 @@ int cs_etm__process_auxtrace_info_full(union perf_event *event, + etm->auxtrace.evsel_is_auxtrace = cs_etm__evsel_is_auxtrace; + session->auxtrace = &etm->auxtrace; + ++ err = cs_etm__setup_timeless_decoding(etm); ++ if (err) ++ return err; ++ + etm->unknown_thread = thread__new(999999999, 999999999); + if (!etm->unknown_thread) { + err = -ENOMEM; +-- +2.39.2 + diff --git a/queue-6.2/perf-ftrace-make-system-wide-the-default-target-for-.patch b/queue-6.2/perf-ftrace-make-system-wide-the-default-target-for-.patch new file mode 100644 index 00000000000..843e8feffea --- /dev/null +++ b/queue-6.2/perf-ftrace-make-system-wide-the-default-target-for-.patch @@ -0,0 +1,86 @@ +From f6df32eec37274693db1c9081f7a2f054fd9edab Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 24 Mar 2023 03:27:02 +0000 +Subject: perf ftrace: Make system wide the default target for latency + subcommand + +From: Yang Jihong + +[ Upstream commit ecd4960d908e27e40b63a7046df2f942c148c6f6 ] + +If no target is specified for 'latency' subcommand, the execution fails +because - 1 (invalid value) is written to set_ftrace_pid tracefs file. +Make system wide the default target, which is the same as the default +behavior of 'trace' subcommand. + +Before the fix: + + # perf ftrace latency -T schedule + failed to set ftrace pid + +After the fix: + + # perf ftrace latency -T schedule + ^C# DURATION | COUNT | GRAPH | + 0 - 1 us | 0 | | + 1 - 2 us | 0 | | + 2 - 4 us | 0 | | + 4 - 8 us | 2828 | #### | + 8 - 16 us | 23953 | ######################################## | + 16 - 32 us | 408 | | + 32 - 64 us | 318 | | + 64 - 128 us | 4 | | + 128 - 256 us | 3 | | + 256 - 512 us | 0 | | + 512 - 1024 us | 1 | | + 1 - 2 ms | 4 | | + 2 - 4 ms | 0 | | + 4 - 8 ms | 0 | | + 8 - 16 ms | 0 | | + 16 - 32 ms | 0 | | + 32 - 64 ms | 0 | | + 64 - 128 ms | 0 | | + 128 - 256 ms | 4 | | + 256 - 512 ms | 2 | | + 512 - 1024 ms | 0 | | + 1 - ... s | 0 | | + +Fixes: 53be50282269b46c ("perf ftrace: Add 'latency' subcommand") +Signed-off-by: Yang Jihong +Acked-by: Namhyung Kim +Cc: Adrian Hunter +Cc: Alexander Shishkin +Cc: Ian Rogers +Cc: Ingo Molnar +Cc: Jiri Olsa +Cc: Mark Rutland +Cc: Peter Zijlstra +Link: https://lore.kernel.org/r/20230324032702.109964-1-yangjihong1@huawei.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/builtin-ftrace.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/tools/perf/builtin-ftrace.c b/tools/perf/builtin-ftrace.c +index d7fe00f66b831..fb1b66ef2e167 100644 +--- a/tools/perf/builtin-ftrace.c ++++ b/tools/perf/builtin-ftrace.c +@@ -1228,10 +1228,12 @@ int cmd_ftrace(int argc, const char **argv) + goto out_delete_filters; + } + ++ /* Make system wide (-a) the default target. */ ++ if (!argc && target__none(&ftrace.target)) ++ ftrace.target.system_wide = true; ++ + switch (subcmd) { + case PERF_FTRACE_TRACE: +- if (!argc && target__none(&ftrace.target)) +- ftrace.target.system_wide = true; + cmd_func = __cmd_ftrace; + break; + case PERF_FTRACE_LATENCY: +-- +2.39.2 + diff --git a/queue-6.2/perf-hist-improve-srcfile-sort-key-performance-reall.patch b/queue-6.2/perf-hist-improve-srcfile-sort-key-performance-reall.patch new file mode 100644 index 00000000000..726b39ad5b2 --- /dev/null +++ b/queue-6.2/perf-hist-improve-srcfile-sort-key-performance-reall.patch @@ -0,0 +1,54 @@ +From 17c0c8eab4126578d617dcb8a0efd530ba095186 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 22 Mar 2023 19:50:05 -0700 +Subject: perf hist: Improve srcfile sort key performance (really) + +From: Namhyung Kim + +[ Upstream commit 6094c7744bb0563e833e81d8df8513f9a4e7a257 ] + +The earlier commit f0cdde28fecc0d7f ("perf hist: Improve srcfile sort +key performance") updated the srcfile logic but missed to change the +->cmp() callback which is called for every sample. + +It should use the same logic like in the srcline to speed up the +processing because it'd return the same information repeatedly for the +same address. The real processing will be done in +sort__srcfile_collapse(). + +Fixes: f0cdde28fecc0d7f ("perf hist: Improve srcfile sort key performance") +Signed-off-by: Namhyung Kim +Cc: Adrian Hunter +Cc: Ian Rogers +Cc: Ingo Molnar +Cc: Jiri Olsa +Cc: Namhyung Kim +Cc: Peter Zijlstra +Link: https://lore.kernel.org/r/20230323025005.191239-1-namhyung@kernel.org +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/util/sort.c | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c +index 37662cdec5eef..2bf3f88276972 100644 +--- a/tools/perf/util/sort.c ++++ b/tools/perf/util/sort.c +@@ -603,12 +603,7 @@ static char *hist_entry__get_srcfile(struct hist_entry *e) + static int64_t + sort__srcfile_cmp(struct hist_entry *left, struct hist_entry *right) + { +- if (!left->srcfile) +- left->srcfile = hist_entry__get_srcfile(left); +- if (!right->srcfile) +- right->srcfile = hist_entry__get_srcfile(right); +- +- return strcmp(right->srcfile, left->srcfile); ++ return sort__srcline_cmp(left, right); + } + + static int64_t +-- +2.39.2 + diff --git a/queue-6.2/perf-map-delete-two-variable-initialisations-before-.patch b/queue-6.2/perf-map-delete-two-variable-initialisations-before-.patch new file mode 100644 index 00000000000..041739311dd --- /dev/null +++ b/queue-6.2/perf-map-delete-two-variable-initialisations-before-.patch @@ -0,0 +1,60 @@ +From fb76d84b5509300798e6792b47764968284e3e59 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 13 Apr 2023 14:46:39 +0200 +Subject: perf map: Delete two variable initialisations before null pointer + checks in sort__sym_from_cmp() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Markus Elfring + +[ Upstream commit c160118a90d4acf335993d8d59b02ae2147a524e ] + +Addresses of two data structure members were determined before +corresponding null pointer checks in the implementation of the function +“sort__sym_from_cmp”. + +Thus avoid the risk for undefined behaviour by removing extra +initialisations for the local variables “from_l” and “from_r” (also +because they were already reassigned with the same value behind this +pointer check). + +This issue was detected by using the Coccinelle software. + +Fixes: 1b9e97a2a95e4941 ("perf tools: Fix report -F symbol_from for data without branch info") +Signed-off-by: +Acked-by: Ian Rogers +Cc: Adrian Hunter +Cc: Alexander Shishkin +Cc: Andi Kleen +Cc: German Gomez +Cc: Ingo Molnar +Cc: Jiri Olsa +Cc: Kan Liang +Cc: Mark Rutland +Cc: Namhyung Kim +Link: https://lore.kernel.org/cocci/54a21fea-64e3-de67-82ef-d61b90ffad05@web.de/ +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/util/sort.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c +index 2bf3f88276972..22808643ab725 100644 +--- a/tools/perf/util/sort.c ++++ b/tools/perf/util/sort.c +@@ -966,8 +966,7 @@ static int hist_entry__dso_to_filter(struct hist_entry *he, int type, + static int64_t + sort__sym_from_cmp(struct hist_entry *left, struct hist_entry *right) + { +- struct addr_map_symbol *from_l = &left->branch_info->from; +- struct addr_map_symbol *from_r = &right->branch_info->from; ++ struct addr_map_symbol *from_l, *from_r; + + if (!left->branch_info || !right->branch_info) + return cmp_null(left->branch_info, right->branch_info); +-- +2.39.2 + diff --git a/queue-6.2/perf-pmu-zfree-expects-a-pointer-to-a-pointer-to-zer.patch b/queue-6.2/perf-pmu-zfree-expects-a-pointer-to-a-pointer-to-zer.patch new file mode 100644 index 00000000000..7104d08eabc --- /dev/null +++ b/queue-6.2/perf-pmu-zfree-expects-a-pointer-to-a-pointer-to-zer.patch @@ -0,0 +1,35 @@ +From 736161e8770e7db680d55898abaf2af0e2080e83 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 12 Apr 2023 10:23:35 -0300 +Subject: perf pmu: zfree() expects a pointer to a pointer to zero it after + freeing its contents + +From: Arnaldo Carvalho de Melo + +[ Upstream commit 57f14b5ae1a97537f2abd2828ee7212cada7036e ] + +An audit showed just this one problem with zfree(), fix it. + +Fixes: 9fbc61f832ebf432 ("perf pmu: Add support for PMU capabilities") +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/util/pmu.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c +index 2bdeb89352e7a..be49be366c05c 100644 +--- a/tools/perf/util/pmu.c ++++ b/tools/perf/util/pmu.c +@@ -1833,7 +1833,7 @@ static int perf_pmu__new_caps(struct list_head *list, char *name, char *value) + return 0; + + free_name: +- zfree(caps->name); ++ zfree(&caps->name); + free_caps: + free(caps); + +-- +2.39.2 + diff --git a/queue-6.2/perf-record-fix-read-lost-count-failed-msg-with-samp.patch b/queue-6.2/perf-record-fix-read-lost-count-failed-msg-with-samp.patch new file mode 100644 index 00000000000..5b537ec3ae1 --- /dev/null +++ b/queue-6.2/perf-record-fix-read-lost-count-failed-msg-with-samp.patch @@ -0,0 +1,59 @@ +From 183c8fc3d5a79c5a714e4de2aa5e1e66aeb4a076 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 1 Mar 2023 07:04:13 -0800 +Subject: perf record: Fix "read LOST count failed" msg with sample read + +From: Kan Liang + +[ Upstream commit 07d85ba9d04e1ebd282f656a29ddf08c5b7b32a2 ] + +Hundreds of "read LOST count failed" error messages may be displayed, +when the below command is launched. + +perf record -e '{cpu/mem-loads-aux/,cpu/event=0xcd,umask=0x1/}:S' -a + +According to the commit 89e3106fa25fb1b6 ("libperf: Handle read format +in perf_evsel__read()"), the PERF_FORMAT_GROUP is only available for +the leader. However, the record__read_lost_samples() goes through every +entry of an evlist, which includes both leader and member. The member +event errors out and triggers the error message. Since there may be +hundreds of CPUs on a server, the message will be printed hundreds of +times, which is very annoying. + +The message itself is correct, but the pr_err is a overkill. Other error +messages in the record__read_lost_samples() are all pr_debug. To make +the output format consistent, change the pr_err("read LOST count +failed\n"); to pr_debug("read LOST count failed\n");. +User can still get the message via -v option. + +Fixes: e3a23261ad06d598 ("perf record: Read and inject LOST_SAMPLES events") +Signed-off-by: Kan Liang +Acked-by: Namhyung Kim +Cc: Ian Rogers +Cc: Ingo Molnar +Cc: Jiri Olsa +Cc: Namhyung Kim +Cc: Peter Zijlstra +Link: https://lore.kernel.org/r/20230301150413.27011-1-kan.liang@linux.intel.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/builtin-record.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c +index 8374117e66f6e..be7c0c29d15b0 100644 +--- a/tools/perf/builtin-record.c ++++ b/tools/perf/builtin-record.c +@@ -1866,7 +1866,7 @@ static void __record__read_lost_samples(struct record *rec, struct evsel *evsel, + int id_hdr_size; + + if (perf_evsel__read(&evsel->core, cpu_idx, thread_idx, &count) < 0) { +- pr_err("read LOST count failed\n"); ++ pr_debug("read LOST count failed\n"); + return; + } + +-- +2.39.2 + diff --git a/queue-6.2/perf-script-fix-python-support-when-no-libtraceevent.patch b/queue-6.2/perf-script-fix-python-support-when-no-libtraceevent.patch new file mode 100644 index 00000000000..892a57dcea6 --- /dev/null +++ b/queue-6.2/perf-script-fix-python-support-when-no-libtraceevent.patch @@ -0,0 +1,370 @@ +From d66c4262ee9bd05a46aa161396ed1847c6d415df Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 15 Mar 2023 10:43:21 +0200 +Subject: perf script: Fix Python support when no libtraceevent + +From: Adrian Hunter + +[ Upstream commit 80c3a7d9f20401169283b5670dbb8d7ac07a1d55 ] + +Python scripting can be used without libtraceevent. In particular, +scripting for Intel PT does not use tracepoints, and so does not need +libtraceevent support. + +Alter the build and employ conditional compilation to allow Python +scripting without libtraceevent. + +Example: + + Before: + + $ ldd `which perf` | grep -i python + $ ldd `which perf` | grep -i libtraceevent + $ perf record -e intel_pt//u uname + Linux + [ perf record: Woken up 1 times to write data ] + [ perf record: Captured and wrote 0.031 MB perf.data ] + $ perf script intel-pt-events.py |& head -3 + Error: Couldn't find script `intel-pt-events.py' + + See perf script -l for available scripts. + + After: + + $ ldd `which perf` | grep -i python + libpython3.10.so.1.0 => /lib/x86_64-linux-gnu/libpython3.10.so.1.0 (0x00007f4bac400000) + $ ldd `which perf` | grep -i libtraceevent + $ perf script intel-pt-events.py | head + Intel PT Branch Trace, Power Events, Event Trace and PTWRITE + Switch In 8021/8021 [000] 11234.097713404 0/0 + perf-exec 8021/8021 [000] 11234.098041726 psb offset: 0x0 0 [unknown] ([unknown]) + perf-exec 8021/8021 [000] 11234.098041726 cbr 45 freq: 4505 MHz (161%) 0 [unknown] ([unknown]) + uname 8021/8021 [000] 11234.098082170 branches:uH tr strt 0 [unknown] ([unknown]) => 7f3a8b9422b0 _start+0x0 (/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2) + uname 8021/8021 [000] 11234.098082379 branches:uH tr end 7f3a8b9422b0 _start+0x0 (/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2) => 0 [unknown] ([unknown]) + uname 8021/8021 [000] 11234.098083629 branches:uH tr strt 0 [unknown] ([unknown]) => 7f3a8b9422b0 _start+0x0 (/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2) + uname 8021/8021 [000] 11234.098083629 branches:uH call 7f3a8b9422b3 _start+0x3 (/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2) => 7f3a8b943050 _dl_start+0x0 (/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2) + uname 8021/8021 [000] 11234.098083837 branches:uH tr end 7f3a8b943060 _dl_start+0x10 (/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2) => 0 [unknown] ([unknown]) IPC: 0.01 (9/938) + uname 8021/8021 [000] 11234.098084670 branches:uH tr strt 0 [unknown] ([unknown]) => 7f3a8b943060 _dl_start+0x10 (/usr/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2) + +Fixes: 378ef0f5d9d7f465 ("perf build: Use libtraceevent from the system") +Signed-off-by: Adrian Hunter +Cc: Ian Rogers +Cc: Jiri Olsa +Cc: Namhyung Kim +Link: https://lore.kernel.org/r/20230315084321.14563-1-adrian.hunter@intel.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/Build | 2 +- + tools/perf/builtin-script.c | 2 +- + tools/perf/scripts/Build | 4 +- + .../perf/scripts/python/Perf-Trace-Util/Build | 2 +- + .../scripts/python/Perf-Trace-Util/Context.c | 4 + + tools/perf/util/Build | 2 +- + tools/perf/util/scripting-engines/Build | 2 +- + .../scripting-engines/trace-event-python.c | 75 +++++++++++++------ + tools/perf/util/trace-event-scripting.c | 9 ++- + 9 files changed, 72 insertions(+), 30 deletions(-) + +diff --git a/tools/perf/Build b/tools/perf/Build +index 6dd67e5022955..aa76236228349 100644 +--- a/tools/perf/Build ++++ b/tools/perf/Build +@@ -56,6 +56,6 @@ CFLAGS_builtin-report.o += -DDOCDIR="BUILD_STR($(srcdir_SQ)/Documentation)" + perf-y += util/ + perf-y += arch/ + perf-y += ui/ +-perf-$(CONFIG_LIBTRACEEVENT) += scripts/ ++perf-y += scripts/ + + gtk-y += ui/gtk/ +diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c +index 69394ac0a20dc..2f185012b9dda 100644 +--- a/tools/perf/builtin-script.c ++++ b/tools/perf/builtin-script.c +@@ -2288,8 +2288,8 @@ static void setup_scripting(void) + { + #ifdef HAVE_LIBTRACEEVENT + setup_perl_scripting(); +- setup_python_scripting(); + #endif ++ setup_python_scripting(); + } + + static int flush_scripting(void) +diff --git a/tools/perf/scripts/Build b/tools/perf/scripts/Build +index 68d4b54574adb..7d8e2e57faac5 100644 +--- a/tools/perf/scripts/Build ++++ b/tools/perf/scripts/Build +@@ -1,2 +1,4 @@ +-perf-$(CONFIG_LIBPERL) += perl/Perf-Trace-Util/ ++ifeq ($(CONFIG_LIBTRACEEVENT),y) ++ perf-$(CONFIG_LIBPERL) += perl/Perf-Trace-Util/ ++endif + perf-$(CONFIG_LIBPYTHON) += python/Perf-Trace-Util/ +diff --git a/tools/perf/scripts/python/Perf-Trace-Util/Build b/tools/perf/scripts/python/Perf-Trace-Util/Build +index d5fed4e426179..7d0e33ce6aba4 100644 +--- a/tools/perf/scripts/python/Perf-Trace-Util/Build ++++ b/tools/perf/scripts/python/Perf-Trace-Util/Build +@@ -1,3 +1,3 @@ +-perf-$(CONFIG_LIBTRACEEVENT) += Context.o ++perf-y += Context.o + + CFLAGS_Context.o += $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs +diff --git a/tools/perf/scripts/python/Perf-Trace-Util/Context.c b/tools/perf/scripts/python/Perf-Trace-Util/Context.c +index 895f5fc239653..b0d449f41650f 100644 +--- a/tools/perf/scripts/python/Perf-Trace-Util/Context.c ++++ b/tools/perf/scripts/python/Perf-Trace-Util/Context.c +@@ -59,6 +59,7 @@ static struct scripting_context *get_scripting_context(PyObject *args) + return get_args(args, "context", NULL); + } + ++#ifdef HAVE_LIBTRACEEVENT + static PyObject *perf_trace_context_common_pc(PyObject *obj, PyObject *args) + { + struct scripting_context *c = get_scripting_context(args); +@@ -90,6 +91,7 @@ static PyObject *perf_trace_context_common_lock_depth(PyObject *obj, + + return Py_BuildValue("i", common_lock_depth(c)); + } ++#endif + + static PyObject *perf_sample_insn(PyObject *obj, PyObject *args) + { +@@ -178,12 +180,14 @@ static PyObject *perf_sample_srccode(PyObject *obj, PyObject *args) + } + + static PyMethodDef ContextMethods[] = { ++#ifdef HAVE_LIBTRACEEVENT + { "common_pc", perf_trace_context_common_pc, METH_VARARGS, + "Get the common preempt count event field value."}, + { "common_flags", perf_trace_context_common_flags, METH_VARARGS, + "Get the common flags event field value."}, + { "common_lock_depth", perf_trace_context_common_lock_depth, + METH_VARARGS, "Get the common lock depth event field value."}, ++#endif + { "perf_sample_insn", perf_sample_insn, + METH_VARARGS, "Get the machine code instruction."}, + { "perf_set_itrace_options", perf_set_itrace_options, +diff --git a/tools/perf/util/Build b/tools/perf/util/Build +index 79b9498886a20..fa87597398780 100644 +--- a/tools/perf/util/Build ++++ b/tools/perf/util/Build +@@ -78,7 +78,7 @@ perf-y += pmu-bison.o + perf-y += pmu-hybrid.o + perf-y += svghelper.o + perf-$(CONFIG_LIBTRACEEVENT) += trace-event-info.o +-perf-$(CONFIG_LIBTRACEEVENT) += trace-event-scripting.o ++perf-y += trace-event-scripting.o + perf-$(CONFIG_LIBTRACEEVENT) += trace-event.o + perf-$(CONFIG_LIBTRACEEVENT) += trace-event-parse.o + perf-$(CONFIG_LIBTRACEEVENT) += trace-event-read.o +diff --git a/tools/perf/util/scripting-engines/Build b/tools/perf/util/scripting-engines/Build +index 2c96aa3cc1ec8..c220fec970324 100644 +--- a/tools/perf/util/scripting-engines/Build ++++ b/tools/perf/util/scripting-engines/Build +@@ -1,7 +1,7 @@ + ifeq ($(CONFIG_LIBTRACEEVENT),y) + perf-$(CONFIG_LIBPERL) += trace-event-perl.o +- perf-$(CONFIG_LIBPYTHON) += trace-event-python.o + endif ++perf-$(CONFIG_LIBPYTHON) += trace-event-python.o + + CFLAGS_trace-event-perl.o += $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow -Wno-nested-externs -Wno-undef -Wno-switch-default -Wno-bad-function-cast -Wno-declaration-after-statement -Wno-switch-enum + +diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c +index e930f5f1f36d2..53c32b75c0cab 100644 +--- a/tools/perf/util/scripting-engines/trace-event-python.c ++++ b/tools/perf/util/scripting-engines/trace-event-python.c +@@ -30,7 +30,9 @@ + #include + #include + #include ++#ifdef HAVE_LIBTRACEEVENT + #include ++#endif + + #include "../build-id.h" + #include "../counts.h" +@@ -87,18 +89,21 @@ PyMODINIT_FUNC initperf_trace_context(void); + PyMODINIT_FUNC PyInit_perf_trace_context(void); + #endif + ++#ifdef HAVE_LIBTRACEEVENT + #define TRACE_EVENT_TYPE_MAX \ + ((1 << (sizeof(unsigned short) * 8)) - 1) + + static DECLARE_BITMAP(events_defined, TRACE_EVENT_TYPE_MAX); + +-#define MAX_FIELDS 64 + #define N_COMMON_FIELDS 7 + +-extern struct scripting_context *scripting_context; +- + static char *cur_field_name; + static int zero_flag_atom; ++#endif ++ ++#define MAX_FIELDS 64 ++ ++extern struct scripting_context *scripting_context; + + static PyObject *main_module, *main_dict; + +@@ -153,6 +158,26 @@ static PyObject *get_handler(const char *handler_name) + return handler; + } + ++static void call_object(PyObject *handler, PyObject *args, const char *die_msg) ++{ ++ PyObject *retval; ++ ++ retval = PyObject_CallObject(handler, args); ++ if (retval == NULL) ++ handler_call_die(die_msg); ++ Py_DECREF(retval); ++} ++ ++static void try_call_object(const char *handler_name, PyObject *args) ++{ ++ PyObject *handler; ++ ++ handler = get_handler(handler_name); ++ if (handler) ++ call_object(handler, args, handler_name); ++} ++ ++#ifdef HAVE_LIBTRACEEVENT + static int get_argument_count(PyObject *handler) + { + int arg_count = 0; +@@ -181,25 +206,6 @@ static int get_argument_count(PyObject *handler) + return arg_count; + } + +-static void call_object(PyObject *handler, PyObject *args, const char *die_msg) +-{ +- PyObject *retval; +- +- retval = PyObject_CallObject(handler, args); +- if (retval == NULL) +- handler_call_die(die_msg); +- Py_DECREF(retval); +-} +- +-static void try_call_object(const char *handler_name, PyObject *args) +-{ +- PyObject *handler; +- +- handler = get_handler(handler_name); +- if (handler) +- call_object(handler, args, handler_name); +-} +- + static void define_value(enum tep_print_arg_type field_type, + const char *ev_name, + const char *field_name, +@@ -379,6 +385,7 @@ static PyObject *get_field_numeric_entry(struct tep_event *event, + obj = list; + return obj; + } ++#endif + + static const char *get_dsoname(struct map *map) + { +@@ -906,6 +913,7 @@ static PyObject *get_perf_sample_dict(struct perf_sample *sample, + return dict; + } + ++#ifdef HAVE_LIBTRACEEVENT + static void python_process_tracepoint(struct perf_sample *sample, + struct evsel *evsel, + struct addr_location *al, +@@ -1037,6 +1045,16 @@ static void python_process_tracepoint(struct perf_sample *sample, + + Py_DECREF(t); + } ++#else ++static void python_process_tracepoint(struct perf_sample *sample __maybe_unused, ++ struct evsel *evsel __maybe_unused, ++ struct addr_location *al __maybe_unused, ++ struct addr_location *addr_al __maybe_unused) ++{ ++ fprintf(stderr, "Tracepoint events are not supported because " ++ "perf is not linked with libtraceevent.\n"); ++} ++#endif + + static PyObject *tuple_new(unsigned int sz) + { +@@ -1967,6 +1985,7 @@ static int python_stop_script(void) + return 0; + } + ++#ifdef HAVE_LIBTRACEEVENT + static int python_generate_script(struct tep_handle *pevent, const char *outfile) + { + int i, not_first, count, nr_events; +@@ -2157,6 +2176,18 @@ static int python_generate_script(struct tep_handle *pevent, const char *outfile + + return 0; + } ++#else ++static int python_generate_script(struct tep_handle *pevent __maybe_unused, ++ const char *outfile __maybe_unused) ++{ ++ fprintf(stderr, "Generating Python perf-script is not supported." ++ " Install libtraceevent and rebuild perf to enable it.\n" ++ "For example:\n # apt install libtraceevent-dev (ubuntu)" ++ "\n # yum install libtraceevent-devel (Fedora)" ++ "\n etc.\n"); ++ return -1; ++} ++#endif + + struct scripting_ops python_scripting_ops = { + .name = "Python", +diff --git a/tools/perf/util/trace-event-scripting.c b/tools/perf/util/trace-event-scripting.c +index 56175c53f9af7..bd0000300c774 100644 +--- a/tools/perf/util/trace-event-scripting.c ++++ b/tools/perf/util/trace-event-scripting.c +@@ -9,7 +9,9 @@ + #include + #include + #include ++#ifdef HAVE_LIBTRACEEVENT + #include ++#endif + + #include "debug.h" + #include "trace-event.h" +@@ -27,10 +29,11 @@ void scripting_context__update(struct scripting_context *c, + struct addr_location *addr_al) + { + c->event_data = sample->raw_data; ++ c->pevent = NULL; ++#ifdef HAVE_LIBTRACEEVENT + if (evsel->tp_format) + c->pevent = evsel->tp_format->tep; +- else +- c->pevent = NULL; ++#endif + c->event = event; + c->sample = sample; + c->evsel = evsel; +@@ -122,6 +125,7 @@ void setup_python_scripting(void) + } + #endif + ++#ifdef HAVE_LIBTRACEEVENT + static void print_perl_unsupported_msg(void) + { + fprintf(stderr, "Perl scripting not supported." +@@ -186,3 +190,4 @@ void setup_perl_scripting(void) + register_perl_scripting(&perl_scripting_ops); + } + #endif ++#endif +-- +2.39.2 + diff --git a/queue-6.2/perf-scripts-intel-pt-events.py-fix-ipc-output-for-p.patch b/queue-6.2/perf-scripts-intel-pt-events.py-fix-ipc-output-for-p.patch new file mode 100644 index 00000000000..e9c06427985 --- /dev/null +++ b/queue-6.2/perf-scripts-intel-pt-events.py-fix-ipc-output-for-p.patch @@ -0,0 +1,40 @@ +From aa8ad0a7492cea81d8ef938fca049a3709d9554c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 10 Mar 2023 15:04:45 +0000 +Subject: perf scripts intel-pt-events.py: Fix IPC output for Python 2 + +From: Roman Lozko + +[ Upstream commit 1f64cfdebfe0494264271e8d7a3a47faf5f58ec7 ] + +Integers are not converted to floats during division in Python 2 which +results in incorrect IPC values. Fix by switching to new division +behavior. + +Fixes: a483e64c0b62e93a ("perf scripting python: intel-pt-events.py: Add --insn-trace and --src-trace") +Signed-off-by: Roman Lozko +Acked-by: Adrian Hunter +Cc: Adrian Hunter +Link: https://lore.kernel.org/r/20230310150445.2925841-1-lozko.roma@gmail.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/scripts/python/intel-pt-events.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/perf/scripts/python/intel-pt-events.py b/tools/perf/scripts/python/intel-pt-events.py +index 08862a2582f44..1c76368f13c1a 100644 +--- a/tools/perf/scripts/python/intel-pt-events.py ++++ b/tools/perf/scripts/python/intel-pt-events.py +@@ -11,7 +11,7 @@ + # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + # more details. + +-from __future__ import print_function ++from __future__ import division, print_function + + import io + import os +-- +2.39.2 + diff --git a/queue-6.2/perf-stat-separate-bperf-from-bpf_profiler.patch b/queue-6.2/perf-stat-separate-bperf-from-bpf_profiler.patch new file mode 100644 index 00000000000..eed7d318b55 --- /dev/null +++ b/queue-6.2/perf-stat-separate-bperf-from-bpf_profiler.patch @@ -0,0 +1,103 @@ +From 0b2e9bd62c437e6cc33a177ec2d3bfd6ad3dbc99 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 12 Apr 2023 20:23:16 +0200 +Subject: perf stat: Separate bperf from bpf_profiler + +From: Dmitrii Dolgov <9erthalion6@gmail.com> + +[ Upstream commit ecc68ee216c6c5b2f84915e1441adf436f1b019b ] + +It seems that perf stat -b doesn't produce any results: + + $ perf stat -e cycles -b 4 -I 10000 -vvv + Control descriptor is not initialized + cycles: 0 0 0 + time counts unit events + 10.007641640 cycles + +Looks like this happens because fentry/fexit progs are getting loaded, but the +corresponding perf event is not enabled and not added into the events bpf map. +I think there is some mixing up between two type of bpf support, one for bperf +and one for bpf_profiler. Both are identified via evsel__is_bpf, based on which +perf events are enabled, but for the latter (bpf_profiler) a perf event is +required. Using evsel__is_bperf to check only bperf produces expected results: + + $ perf stat -e cycles -b 4 -I 10000 -vvv + Control descriptor is not initialized + ------------------------------------------------------------ + perf_event_attr: + size 136 + sample_type IDENTIFIER + read_format TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING + disabled 1 + exclude_guest 1 + ------------------------------------------------------------ + sys_perf_event_open: pid -1 cpu 0 group_fd -1 flags 0x8 = 3 + ------------------------------------------------------------ + [...perf_event_attr for other CPUs...] + ------------------------------------------------------------ + cycles: 309426 169009 169009 + time counts unit events + 10.010091271 309426 cycles + +The final numbers correspond (at least in the level of magnitude) to the +same metric obtained via bpftool. + +Fixes: 112cb56164bc2108 ("perf stat: Introduce config stat.bpf-counter-events") +Reviewed-by: Song Liu +Signed-off-by: Dmitrii Dolgov <9erthalion6@gmail.com> +Tested-by: Song Liu +Cc: Ian Rogers +Cc: Ingo Molnar +Cc: Jiri Olsa +Cc: Namhyung Kim +Cc: Song Liu +Link: https://lore.kernel.org/r/20230412182316.11628-1-9erthalion6@gmail.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/builtin-stat.c | 4 ++-- + tools/perf/util/evsel.h | 5 +++++ + 2 files changed, 7 insertions(+), 2 deletions(-) + +diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c +index 387dc9c9e7bee..682db49eef4cb 100644 +--- a/tools/perf/builtin-stat.c ++++ b/tools/perf/builtin-stat.c +@@ -773,7 +773,7 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx) + counter->reset_group = false; + if (bpf_counter__load(counter, &target)) + return -1; +- if (!evsel__is_bpf(counter)) ++ if (!(evsel__is_bperf(counter))) + all_counters_use_bpf = false; + } + +@@ -789,7 +789,7 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx) + + if (counter->reset_group || counter->errored) + continue; +- if (evsel__is_bpf(counter)) ++ if (evsel__is_bperf(counter)) + continue; + try_again: + if (create_perf_stat_counter(counter, &stat_config, &target, +diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h +index d572be41b9608..2899c97d997cd 100644 +--- a/tools/perf/util/evsel.h ++++ b/tools/perf/util/evsel.h +@@ -269,6 +269,11 @@ static inline bool evsel__is_bpf(struct evsel *evsel) + return evsel->bpf_counter_ops != NULL; + } + ++static inline bool evsel__is_bperf(struct evsel *evsel) ++{ ++ return evsel->bpf_counter_ops != NULL && list_empty(&evsel->bpf_counter_list); ++} ++ + #define EVSEL__MAX_ALIASES 8 + + extern const char *const evsel__hw_cache[PERF_COUNT_HW_CACHE_MAX][EVSEL__MAX_ALIASES]; +-- +2.39.2 + diff --git a/queue-6.2/perf-symbols-fix-return-incorrect-build_id-size-in-e.patch b/queue-6.2/perf-symbols-fix-return-incorrect-build_id-size-in-e.patch new file mode 100644 index 00000000000..46ebb97c218 --- /dev/null +++ b/queue-6.2/perf-symbols-fix-return-incorrect-build_id-size-in-e.patch @@ -0,0 +1,52 @@ +From fd429f8acba098526781654f30d54191f69b1f9b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 Apr 2023 01:28:41 +0000 +Subject: perf symbols: Fix return incorrect build_id size in + elf_read_build_id() + +From: Yang Jihong + +[ Upstream commit 1511e4696acb715a4fe48be89e1e691daec91c0e ] + +In elf_read_build_id(), if gnu build_id is found, should return the size of +the actually copied data. If descsz is greater thanBuild_ID_SIZE, +write_buildid data access may occur. + +Fixes: be96ea8ffa788dcc ("perf symbols: Fix issue with binaries using 16-bytes buildids (v2)") +Reported-by: Will Ochowicz +Signed-off-by: Yang Jihong +Tested-by: Will Ochowicz +Acked-by: Adrian Hunter +Cc: Alexander Shishkin +Cc: Ian Rogers +Cc: Ingo Molnar +Cc: Jiri Olsa +Cc: Leo Yan +Cc: Mark Rutland +Cc: Namhyung Kim +Cc: Peter Zijlstra +Cc: Stephane Eranian +Link: https://lore.kernel.org/lkml/CWLP265MB49702F7BA3D6D8F13E4B1A719C649@CWLP265MB4970.GBRP265.PROD.OUTLOOK.COM/T/ +Link: https://lore.kernel.org/r/20230427012841.231729-1-yangjihong1@huawei.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/util/symbol-elf.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c +index 96767d1b3f1c2..714fd9d0b51ef 100644 +--- a/tools/perf/util/symbol-elf.c ++++ b/tools/perf/util/symbol-elf.c +@@ -581,7 +581,7 @@ static int elf_read_build_id(Elf *elf, void *bf, size_t size) + size_t sz = min(size, descsz); + memcpy(bf, ptr, sz); + memset(bf + sz, 0, size - sz); +- err = descsz; ++ err = sz; + break; + } + } +-- +2.39.2 + diff --git a/queue-6.2/perf-tests-record_offcpu.sh-fix-redirection-of-stder.patch b/queue-6.2/perf-tests-record_offcpu.sh-fix-redirection-of-stder.patch new file mode 100644 index 00000000000..d44aeb34d63 --- /dev/null +++ b/queue-6.2/perf-tests-record_offcpu.sh-fix-redirection-of-stder.patch @@ -0,0 +1,38 @@ +From 5c671f97cc1f0a018227dee4b2b8a7810a9eeae7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 3 Mar 2023 20:30:58 +0100 +Subject: perf tests record_offcpu.sh: Fix redirection of stderr to stdin + +From: Patrice Duroux + +[ Upstream commit 9835b742ac3ee16dee361e7ccda8022f99d1cd94 ] + +It's not 2&>1, the correct is 2>&1 + +Fixes: ade1d0307b2fb3d9 ("perf offcpu: Update offcpu test for child process") +Signed-off-by: Patrice Duroux +Acked-by: Ian Rogers +Cc: Namhyung Kim +Link: https://lore.kernel.org/r/20230303193058.21274-1-patrice.duroux@gmail.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/tests/shell/record_offcpu.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/perf/tests/shell/record_offcpu.sh b/tools/perf/tests/shell/record_offcpu.sh +index e01973d4e0fba..f062ae9a95e1a 100755 +--- a/tools/perf/tests/shell/record_offcpu.sh ++++ b/tools/perf/tests/shell/record_offcpu.sh +@@ -65,7 +65,7 @@ test_offcpu_child() { + + # perf bench sched messaging creates 400 processes + if ! perf record --off-cpu -e dummy -o ${perfdata} -- \ +- perf bench sched messaging -g 10 > /dev/null 2&>1 ++ perf bench sched messaging -g 10 > /dev/null 2>&1 + then + echo "Child task off-cpu test [Failed record]" + err=1 +-- +2.39.2 + diff --git a/queue-6.2/perf-tracepoint-fix-memory-leak-in-is_valid_tracepoi.patch b/queue-6.2/perf-tracepoint-fix-memory-leak-in-is_valid_tracepoi.patch new file mode 100644 index 00000000000..494d7852455 --- /dev/null +++ b/queue-6.2/perf-tracepoint-fix-memory-leak-in-is_valid_tracepoi.patch @@ -0,0 +1,44 @@ +From afd11565301683d4fef4df2a17b5eb527c5930aa Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Apr 2023 02:59:53 +0000 +Subject: perf tracepoint: Fix memory leak in is_valid_tracepoint() + +From: Yang Jihong + +[ Upstream commit 9b86c49710eec7b4fbb78a0232b2dd0972a2b576 ] + +When is_valid_tracepoint() returns 1, need to call put_events_file() to +free `dir_path`. + +Fixes: 25a7d914274de386 ("perf parse-events: Use get/put_events_file()") +Signed-off-by: Yang Jihong +Cc: Adrian Hunter +Cc: Alexander Shishkin +Cc: Ian Rogers +Cc: Ingo Molnar +Cc: Jiri Olsa +Cc: Mark Rutland +Cc: Namhyung Kim +Cc: Peter Zijlstra +Link: https://lore.kernel.org/r/20230421025953.173826-1-yangjihong1@huawei.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/util/tracepoint.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tools/perf/util/tracepoint.c b/tools/perf/util/tracepoint.c +index 89ef56c433110..92dd8b455b902 100644 +--- a/tools/perf/util/tracepoint.c ++++ b/tools/perf/util/tracepoint.c +@@ -50,6 +50,7 @@ int is_valid_tracepoint(const char *event_string) + sys_dirent->d_name, evt_dirent->d_name); + if (!strcmp(evt_path, event_string)) { + closedir(evt_dir); ++ put_events_file(dir_path); + closedir(sys_dir); + return 1; + } +-- +2.39.2 + diff --git a/queue-6.2/perf-vendor-events-power9-remove-utf-8-characters-fr.patch b/queue-6.2/perf-vendor-events-power9-remove-utf-8-characters-fr.patch new file mode 100644 index 00000000000..e23013a71e1 --- /dev/null +++ b/queue-6.2/perf-vendor-events-power9-remove-utf-8-characters-fr.patch @@ -0,0 +1,108 @@ +From 1fedc5f3080c0e7b98f31b3d04db12e84f664b3d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 28 Mar 2023 16:59:08 +0530 +Subject: perf vendor events power9: Remove UTF-8 characters from JSON files + +From: Kajol Jain + +[ Upstream commit 5d9df8731c0941f3add30f96745a62586a0c9d52 ] + +Commit 3c22ba5243040c13 ("perf vendor events powerpc: Update POWER9 +events") added and updated power9 PMU JSON events. However some of the +JSON events which are part of other.json and pipeline.json files, +contains UTF-8 characters in their brief description. Having UTF-8 +character could breaks the perf build on some distros. + +Fix this issue by removing the UTF-8 characters from other.json and +pipeline.json files. + +Result without the fix: + + [command]# file -i pmu-events/arch/powerpc/power9/* + pmu-events/arch/powerpc/power9/cache.json: application/json; charset=us-ascii + pmu-events/arch/powerpc/power9/floating-point.json: application/json; charset=us-ascii + pmu-events/arch/powerpc/power9/frontend.json: application/json; charset=us-ascii + pmu-events/arch/powerpc/power9/marked.json: application/json; charset=us-ascii + pmu-events/arch/powerpc/power9/memory.json: application/json; charset=us-ascii + pmu-events/arch/powerpc/power9/metrics.json: application/json; charset=us-ascii + pmu-events/arch/powerpc/power9/nest_metrics.json: application/json; charset=us-ascii + pmu-events/arch/powerpc/power9/other.json: application/json; charset=utf-8 + pmu-events/arch/powerpc/power9/pipeline.json: application/json; charset=utf-8 + pmu-events/arch/powerpc/power9/pmc.json: application/json; charset=us-ascii + pmu-events/arch/powerpc/power9/translation.json: application/json; charset=us-ascii + [command]# + +Result with the fix: + + [command]# file -i pmu-events/arch/powerpc/power9/* + pmu-events/arch/powerpc/power9/cache.json: application/json; charset=us-ascii + pmu-events/arch/powerpc/power9/floating-point.json: application/json; charset=us-ascii + pmu-events/arch/powerpc/power9/frontend.json: application/json; charset=us-ascii + pmu-events/arch/powerpc/power9/marked.json: application/json; charset=us-ascii + pmu-events/arch/powerpc/power9/memory.json: application/json; charset=us-ascii + pmu-events/arch/powerpc/power9/metrics.json: application/json; charset=us-ascii + pmu-events/arch/powerpc/power9/nest_metrics.json: application/json; charset=us-ascii + pmu-events/arch/powerpc/power9/other.json: application/json; charset=us-ascii + pmu-events/arch/powerpc/power9/pipeline.json: application/json; charset=us-ascii + pmu-events/arch/powerpc/power9/pmc.json: application/json; charset=us-ascii + pmu-events/arch/powerpc/power9/translation.json: application/json; charset=us-ascii + [command]# + +Fixes: 3c22ba5243040c13 ("perf vendor events powerpc: Update POWER9 events") +Reported-by: Arnaldo Carvalho de Melo +Signed-off-by: Kajol Jain +Acked-by: Ian Rogers +Tested-by: Arnaldo Carvalho de Melo +Cc: Athira Rajeev +Cc: Disha Goel +Cc: Jiri Olsa +Cc: Madhavan Srinivasan +Cc: Sukadev Bhattiprolu +Cc: linuxppc-dev@lists.ozlabs.org +Link: https://lore.kernel.org/lkml/ZBxP77deq7ikTxwG@kernel.org/ +Link: https://lore.kernel.org/r/20230328112908.113158-1-kjain@linux.ibm.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/pmu-events/arch/powerpc/power9/other.json | 4 ++-- + tools/perf/pmu-events/arch/powerpc/power9/pipeline.json | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/tools/perf/pmu-events/arch/powerpc/power9/other.json b/tools/perf/pmu-events/arch/powerpc/power9/other.json +index 3f69422c21f99..f10bd554521a0 100644 +--- a/tools/perf/pmu-events/arch/powerpc/power9/other.json ++++ b/tools/perf/pmu-events/arch/powerpc/power9/other.json +@@ -1417,7 +1417,7 @@ + { + "EventCode": "0x45054", + "EventName": "PM_FMA_CMPL", +- "BriefDescription": "two flops operation completed (fmadd, fnmadd, fmsub, fnmsub) Scalar instructions only. " ++ "BriefDescription": "two flops operation completed (fmadd, fnmadd, fmsub, fnmsub) Scalar instructions only." + }, + { + "EventCode": "0x201E8", +@@ -2017,7 +2017,7 @@ + { + "EventCode": "0xC0BC", + "EventName": "PM_LSU_FLUSH_OTHER", +- "BriefDescription": "Other LSU flushes including: Sync (sync ack from L2 caused search of LRQ for oldest snooped load, This will either signal a Precise Flush of the oldest snooped loa or a Flush Next PPC); Data Valid Flush Next (several cases of this, one example is store and reload are lined up such that a store-hit-reload scenario exists and the CDF has already launched and has gotten bad/stale data); Bad Data Valid Flush Next (might be a few cases of this, one example is a larxa (D$ hit) return data and dval but can't allocate to LMQ (LMQ full or other reason). Already gave dval but can't watch it for snoop_hit_larx. Need to take the “bad dval” back and flush all younger ops)" ++ "BriefDescription": "Other LSU flushes including: Sync (sync ack from L2 caused search of LRQ for oldest snooped load, This will either signal a Precise Flush of the oldest snooped loa or a Flush Next PPC); Data Valid Flush Next (several cases of this, one example is store and reload are lined up such that a store-hit-reload scenario exists and the CDF has already launched and has gotten bad/stale data); Bad Data Valid Flush Next (might be a few cases of this, one example is a larxa (D$ hit) return data and dval but can't allocate to LMQ (LMQ full or other reason). Already gave dval but can't watch it for snoop_hit_larx. Need to take the 'bad dval' back and flush all younger ops)" + }, + { + "EventCode": "0x5094", +diff --git a/tools/perf/pmu-events/arch/powerpc/power9/pipeline.json b/tools/perf/pmu-events/arch/powerpc/power9/pipeline.json +index d0265f255de2b..723bffa41c448 100644 +--- a/tools/perf/pmu-events/arch/powerpc/power9/pipeline.json ++++ b/tools/perf/pmu-events/arch/powerpc/power9/pipeline.json +@@ -442,7 +442,7 @@ + { + "EventCode": "0x4D052", + "EventName": "PM_2FLOP_CMPL", +- "BriefDescription": "DP vector version of fmul, fsub, fcmp, fsel, fabs, fnabs, fres ,fsqrte, fneg " ++ "BriefDescription": "DP vector version of fmul, fsub, fcmp, fsel, fabs, fnabs, fres ,fsqrte, fneg" + }, + { + "EventCode": "0x1F142", +-- +2.39.2 + diff --git a/queue-6.2/perf-vendor-events-s390-remove-utf-8-characters-from.patch b/queue-6.2/perf-vendor-events-s390-remove-utf-8-characters-from.patch new file mode 100644 index 00000000000..088ca74dcd8 --- /dev/null +++ b/queue-6.2/perf-vendor-events-s390-remove-utf-8-characters-from.patch @@ -0,0 +1,82 @@ +From 47e0cbfc4a4502ed36e1cd454bfa02cb4975291f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 23 Mar 2023 13:25:32 +0100 +Subject: perf vendor events s390: Remove UTF-8 characters from JSON file + +From: Thomas Richter + +[ Upstream commit eb2feb68cb7d404288493c41480843bc9f404789 ] + +Commit 7f76b31130680fb3 ("perf list: Add IBM z16 event description for +s390") contains the verbal description for z16 extended counter set. + +However some entries of the public description contain UTF-8 characters +which breaks the build on some distros. + +Fix this and remove the UTF-8 characters. + +Fixes: 7f76b31130680fb3 ("perf list: Add IBM z16 event description for s390") +Reported-by: Arnaldo Carvalho de Melo +Suggested-by: Heiko Carstens +Signed-off-by: Thomas Richter +Tested-by: Arnaldo Carvalho de Melo +Cc: Sumanth Korikkar +Cc: Sven Schnelle +Cc: Thomas Richter +Cc: Vasily Gorbik +Link: https://lore.kernel.org/r/ZBwkl77/I31AQk12@osiris +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/pmu-events/arch/s390/cf_z16/extended.json | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/tools/perf/pmu-events/arch/s390/cf_z16/extended.json b/tools/perf/pmu-events/arch/s390/cf_z16/extended.json +index c306190fc06f2..c2b10ec1c6e01 100644 +--- a/tools/perf/pmu-events/arch/s390/cf_z16/extended.json ++++ b/tools/perf/pmu-events/arch/s390/cf_z16/extended.json +@@ -95,28 +95,28 @@ + "EventCode": "145", + "EventName": "DCW_REQ", + "BriefDescription": "Directory Write Level 1 Data Cache from Cache", +- "PublicDescription": "A directory write to the Level-1 Data cache directory where the returned cache line was sourced from the requestor’s Level-2 cache." ++ "PublicDescription": "A directory write to the Level-1 Data cache directory where the returned cache line was sourced from the requestors Level-2 cache." + }, + { + "Unit": "CPU-M-CF", + "EventCode": "146", + "EventName": "DCW_REQ_IV", + "BriefDescription": "Directory Write Level 1 Data Cache from Cache with Intervention", +- "PublicDescription": "A directory write to the Level-1 Data cache directory where the returned cache line was sourced from the requestor’s Level-2 cache with intervention." ++ "PublicDescription": "A directory write to the Level-1 Data cache directory where the returned cache line was sourced from the requestors Level-2 cache with intervention." + }, + { + "Unit": "CPU-M-CF", + "EventCode": "147", + "EventName": "DCW_REQ_CHIP_HIT", + "BriefDescription": "Directory Write Level 1 Data Cache from Cache with Chip HP Hit", +- "PublicDescription": "A directory write to the Level-1 Data cache directory where the returned cache line was sourced from the requestor’s Level-2 cache after using chip level horizontal persistence, Chip-HP hit." ++ "PublicDescription": "A directory write to the Level-1 Data cache directory where the returned cache line was sourced from the requestors Level-2 cache after using chip level horizontal persistence, Chip-HP hit." + }, + { + "Unit": "CPU-M-CF", + "EventCode": "148", + "EventName": "DCW_REQ_DRAWER_HIT", + "BriefDescription": "Directory Write Level 1 Data Cache from Cache with Drawer HP Hit", +- "PublicDescription": "A directory write to the Level-1 Data cache directory where the returned cache line was sourced from the requestor’s Level-2 cache after using drawer level horizontal persistence, Drawer-HP hit." ++ "PublicDescription": "A directory write to the Level-1 Data cache directory where the returned cache line was sourced from the requestors Level-2 cache after using drawer level horizontal persistence, Drawer-HP hit." + }, + { + "Unit": "CPU-M-CF", +@@ -284,7 +284,7 @@ + "EventCode": "172", + "EventName": "ICW_REQ_DRAWER_HIT", + "BriefDescription": "Directory Write Level 1 Instruction Cache from Cache with Drawer HP Hit", +- "PublicDescription": "A directory write to the Level-1 Instruction cache directory where the returned cache line was sourced from the requestor’s Level-2 cache using drawer level horizontal persistence, Drawer-HP hit." ++ "PublicDescription": "A directory write to the Level-1 Instruction cache directory where the returned cache line was sourced from the requestors Level-2 cache using drawer level horizontal persistence, Drawer-HP hit." + }, + { + "Unit": "CPU-M-CF", +-- +2.39.2 + diff --git a/queue-6.2/r8152-fix-flow-control-issue-of-rtl8156a.patch b/queue-6.2/r8152-fix-flow-control-issue-of-rtl8156a.patch new file mode 100644 index 00000000000..a6d27a3704c --- /dev/null +++ b/queue-6.2/r8152-fix-flow-control-issue-of-rtl8156a.patch @@ -0,0 +1,129 @@ +From cb8cb7a20386b13631ccec284b931f90e0609fe0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 28 Apr 2023 16:53:29 +0800 +Subject: r8152: fix flow control issue of RTL8156A + +From: Hayes Wang + +[ Upstream commit 8ceda6d5a1e5402fd852e6cc59a286ce3dc545ee ] + +The feature of flow control becomes abnormal, if the device sends a +pause frame and the tx/rx is disabled before sending a release frame. It +causes the lost of packets. + +Set PLA_RX_FIFO_FULL and PLA_RX_FIFO_EMPTY to zeros before disabling the +tx/rx. And, toggle FC_PATCH_TASK before enabling tx/rx to reset the flow +control patch and timer. Then, the hardware could clear the state and +the flow control becomes normal after enabling tx/rx. + +Besides, remove inline for fc_pause_on_auto() and fc_pause_off_auto(). + +Fixes: 195aae321c82 ("r8152: support new chips") +Signed-off-by: Hayes Wang +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/usb/r8152.c | 56 ++++++++++++++++++++++++++--------------- + 1 file changed, 36 insertions(+), 20 deletions(-) + +diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c +index 23da1d9dafd1f..b0ce524ef1a50 100644 +--- a/drivers/net/usb/r8152.c ++++ b/drivers/net/usb/r8152.c +@@ -5986,6 +5986,25 @@ static void rtl8153_disable(struct r8152 *tp) + r8153_aldps_en(tp, true); + } + ++static u32 fc_pause_on_auto(struct r8152 *tp) ++{ ++ return (ALIGN(mtu_to_size(tp->netdev->mtu), 1024) + 6 * 1024); ++} ++ ++static u32 fc_pause_off_auto(struct r8152 *tp) ++{ ++ return (ALIGN(mtu_to_size(tp->netdev->mtu), 1024) + 14 * 1024); ++} ++ ++static void r8156_fc_parameter(struct r8152 *tp) ++{ ++ u32 pause_on = tp->fc_pause_on ? tp->fc_pause_on : fc_pause_on_auto(tp); ++ u32 pause_off = tp->fc_pause_off ? tp->fc_pause_off : fc_pause_off_auto(tp); ++ ++ ocp_write_word(tp, MCU_TYPE_PLA, PLA_RX_FIFO_FULL, pause_on / 16); ++ ocp_write_word(tp, MCU_TYPE_PLA, PLA_RX_FIFO_EMPTY, pause_off / 16); ++} ++ + static int rtl8156_enable(struct r8152 *tp) + { + u32 ocp_data; +@@ -5994,6 +6013,7 @@ static int rtl8156_enable(struct r8152 *tp) + if (test_bit(RTL8152_UNPLUG, &tp->flags)) + return -ENODEV; + ++ r8156_fc_parameter(tp); + set_tx_qlen(tp); + rtl_set_eee_plus(tp); + r8153_set_rx_early_timeout(tp); +@@ -6025,9 +6045,24 @@ static int rtl8156_enable(struct r8152 *tp) + ocp_write_word(tp, MCU_TYPE_USB, USB_L1_CTRL, ocp_data); + } + ++ ocp_data = ocp_read_word(tp, MCU_TYPE_USB, USB_FW_TASK); ++ ocp_data &= ~FC_PATCH_TASK; ++ ocp_write_word(tp, MCU_TYPE_USB, USB_FW_TASK, ocp_data); ++ usleep_range(1000, 2000); ++ ocp_data |= FC_PATCH_TASK; ++ ocp_write_word(tp, MCU_TYPE_USB, USB_FW_TASK, ocp_data); ++ + return rtl_enable(tp); + } + ++static void rtl8156_disable(struct r8152 *tp) ++{ ++ ocp_write_word(tp, MCU_TYPE_PLA, PLA_RX_FIFO_FULL, 0); ++ ocp_write_word(tp, MCU_TYPE_PLA, PLA_RX_FIFO_EMPTY, 0); ++ ++ rtl8153_disable(tp); ++} ++ + static int rtl8156b_enable(struct r8152 *tp) + { + u32 ocp_data; +@@ -6429,25 +6464,6 @@ static void rtl8153c_up(struct r8152 *tp) + r8153b_u1u2en(tp, true); + } + +-static inline u32 fc_pause_on_auto(struct r8152 *tp) +-{ +- return (ALIGN(mtu_to_size(tp->netdev->mtu), 1024) + 6 * 1024); +-} +- +-static inline u32 fc_pause_off_auto(struct r8152 *tp) +-{ +- return (ALIGN(mtu_to_size(tp->netdev->mtu), 1024) + 14 * 1024); +-} +- +-static void r8156_fc_parameter(struct r8152 *tp) +-{ +- u32 pause_on = tp->fc_pause_on ? tp->fc_pause_on : fc_pause_on_auto(tp); +- u32 pause_off = tp->fc_pause_off ? tp->fc_pause_off : fc_pause_off_auto(tp); +- +- ocp_write_word(tp, MCU_TYPE_PLA, PLA_RX_FIFO_FULL, pause_on / 16); +- ocp_write_word(tp, MCU_TYPE_PLA, PLA_RX_FIFO_EMPTY, pause_off / 16); +-} +- + static void rtl8156_change_mtu(struct r8152 *tp) + { + u32 rx_max_size = mtu_to_size(tp->netdev->mtu); +@@ -9377,7 +9393,7 @@ static int rtl_ops_init(struct r8152 *tp) + case RTL_VER_10: + ops->init = r8156_init; + ops->enable = rtl8156_enable; +- ops->disable = rtl8153_disable; ++ ops->disable = rtl8156_disable; + ops->up = rtl8156_up; + ops->down = rtl8156_down; + ops->unload = rtl8153_unload; +-- +2.39.2 + diff --git a/queue-6.2/r8152-fix-the-poor-throughput-for-2.5g-devices.patch b/queue-6.2/r8152-fix-the-poor-throughput-for-2.5g-devices.patch new file mode 100644 index 00000000000..6aa4c3a683c --- /dev/null +++ b/queue-6.2/r8152-fix-the-poor-throughput-for-2.5g-devices.patch @@ -0,0 +1,71 @@ +From de140f071859003956990a9bf4183febf0d4088c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 28 Apr 2023 16:53:30 +0800 +Subject: r8152: fix the poor throughput for 2.5G devices + +From: Hayes Wang + +[ Upstream commit 61b0ad6f58e2066e054c6d4839d67974d2861a7d ] + +Fix the poor throughput for 2.5G devices, when changing the speed from +auto mode to force mode. This patch is used to notify the MAC when the +mode is changed. + +Fixes: 195aae321c82 ("r8152: support new chips") +Signed-off-by: Hayes Wang +Reviewed-by: Andrew Lunn +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/usb/r8152.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c +index b0ce524ef1a50..a7665accc81c8 100644 +--- a/drivers/net/usb/r8152.c ++++ b/drivers/net/usb/r8152.c +@@ -199,6 +199,7 @@ + #define OCP_EEE_AR 0xa41a + #define OCP_EEE_DATA 0xa41c + #define OCP_PHY_STATUS 0xa420 ++#define OCP_INTR_EN 0xa424 + #define OCP_NCTL_CFG 0xa42c + #define OCP_POWER_CFG 0xa430 + #define OCP_EEE_CFG 0xa432 +@@ -620,6 +621,9 @@ enum spd_duplex { + #define PHY_STAT_LAN_ON 3 + #define PHY_STAT_PWRDN 5 + ++/* OCP_INTR_EN */ ++#define INTR_SPEED_FORCE BIT(3) ++ + /* OCP_NCTL_CFG */ + #define PGA_RETURN_EN BIT(1) + +@@ -7554,6 +7558,11 @@ static void r8156_hw_phy_cfg(struct r8152 *tp) + ((swap_a & 0x1f) << 8) | + ((swap_a >> 8) & 0x1f)); + } ++ ++ /* Notify the MAC when the speed is changed to force mode. */ ++ data = ocp_reg_read(tp, OCP_INTR_EN); ++ data |= INTR_SPEED_FORCE; ++ ocp_reg_write(tp, OCP_INTR_EN, data); + break; + default: + break; +@@ -7949,6 +7958,11 @@ static void r8156b_hw_phy_cfg(struct r8152 *tp) + break; + } + ++ /* Notify the MAC when the speed is changed to force mode. */ ++ data = ocp_reg_read(tp, OCP_INTR_EN); ++ data |= INTR_SPEED_FORCE; ++ ocp_reg_write(tp, OCP_INTR_EN, data); ++ + if (rtl_phy_patch_request(tp, true, true)) + return; + +-- +2.39.2 + diff --git a/queue-6.2/r8152-move-setting-r8153b_rx_agg_chg_indicate.patch b/queue-6.2/r8152-move-setting-r8153b_rx_agg_chg_indicate.patch new file mode 100644 index 00000000000..e9f5b5091f6 --- /dev/null +++ b/queue-6.2/r8152-move-setting-r8153b_rx_agg_chg_indicate.patch @@ -0,0 +1,65 @@ +From a0e8b14e45a8651c4eef83593b05e2d991105aef Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 28 Apr 2023 16:53:31 +0800 +Subject: r8152: move setting r8153b_rx_agg_chg_indicate() + +From: Hayes Wang + +[ Upstream commit cce8334f4aacd9936309a002d4a4de92a07cd2c2 ] + +Move setting r8153b_rx_agg_chg_indicate() for 2.5G devices. The +r8153b_rx_agg_chg_indicate() has to be called after enabling tx/rx. +Otherwise, the coalescing settings are useless. + +Fixes: 195aae321c82 ("r8152: support new chips") +Signed-off-by: Hayes Wang +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/usb/r8152.c | 14 ++++++++------ + 1 file changed, 8 insertions(+), 6 deletions(-) + +diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c +index a7665accc81c8..059d610901d84 100644 +--- a/drivers/net/usb/r8152.c ++++ b/drivers/net/usb/r8152.c +@@ -3027,12 +3027,16 @@ static int rtl_enable(struct r8152 *tp) + ocp_write_byte(tp, MCU_TYPE_PLA, PLA_CR, ocp_data); + + switch (tp->version) { +- case RTL_VER_08: +- case RTL_VER_09: +- case RTL_VER_14: +- r8153b_rx_agg_chg_indicate(tp); ++ case RTL_VER_01: ++ case RTL_VER_02: ++ case RTL_VER_03: ++ case RTL_VER_04: ++ case RTL_VER_05: ++ case RTL_VER_06: ++ case RTL_VER_07: + break; + default: ++ r8153b_rx_agg_chg_indicate(tp); + break; + } + +@@ -3086,7 +3090,6 @@ static void r8153_set_rx_early_timeout(struct r8152 *tp) + 640 / 8); + ocp_write_word(tp, MCU_TYPE_USB, USB_RX_EXTRA_AGGR_TMR, + ocp_data); +- r8153b_rx_agg_chg_indicate(tp); + break; + + default: +@@ -3120,7 +3123,6 @@ static void r8153_set_rx_early_size(struct r8152 *tp) + case RTL_VER_15: + ocp_write_word(tp, MCU_TYPE_USB, USB_RX_EARLY_SIZE, + ocp_data / 8); +- r8153b_rx_agg_chg_indicate(tp); + break; + default: + WARN_ON_ONCE(1); +-- +2.39.2 + diff --git a/queue-6.2/rdma-rxe-change-rxe_dbg-to-rxe_dbg_dev.patch b/queue-6.2/rdma-rxe-change-rxe_dbg-to-rxe_dbg_dev.patch new file mode 100644 index 00000000000..8485b8e63d0 --- /dev/null +++ b/queue-6.2/rdma-rxe-change-rxe_dbg-to-rxe_dbg_dev.patch @@ -0,0 +1,275 @@ +From abe58b7d033152e3f367bf18ab7a60aa75b29fc8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 3 Mar 2023 16:16:22 -0600 +Subject: RDMA/rxe: Change rxe_dbg to rxe_dbg_dev + +From: Bob Pearson + +[ Upstream commit a9fb3287211e64b94ceb2b6b4791cc2b829d0d56 ] + +Replace the name rxe_dbg with rxe_dbg_dev which better matches +the remaining rxe_dbg_xxx macros for debug messages with a +rxe device parameter. Reuse the name rxe_dbg for debug messages +which do not have a rxe device parameter. + +Link: https://lore.kernel.org/r/20230303221623.8053-3-rpearsonhpe@gmail.com +Signed-off-by: Bob Pearson +Signed-off-by: Jason Gunthorpe +Stable-dep-of: 78b26a335310 ("RDMA/rxe: Remove tasklet call from rxe_cq.c") +Signed-off-by: Sasha Levin +--- + drivers/infiniband/sw/rxe/rxe.c | 2 +- + drivers/infiniband/sw/rxe/rxe.h | 3 ++- + drivers/infiniband/sw/rxe/rxe_cq.c | 6 +++--- + drivers/infiniband/sw/rxe/rxe_icrc.c | 4 ++-- + drivers/infiniband/sw/rxe/rxe_mmap.c | 6 +++--- + drivers/infiniband/sw/rxe/rxe_net.c | 4 ++-- + drivers/infiniband/sw/rxe/rxe_qp.c | 16 ++++++++-------- + drivers/infiniband/sw/rxe/rxe_srq.c | 6 +++--- + drivers/infiniband/sw/rxe/rxe_verbs.c | 2 +- + 9 files changed, 25 insertions(+), 24 deletions(-) + +diff --git a/drivers/infiniband/sw/rxe/rxe.c b/drivers/infiniband/sw/rxe/rxe.c +index a3f05fdd9fac2..d57ba7a5964b9 100644 +--- a/drivers/infiniband/sw/rxe/rxe.c ++++ b/drivers/infiniband/sw/rxe/rxe.c +@@ -187,7 +187,7 @@ static int rxe_newlink(const char *ibdev_name, struct net_device *ndev) + rxe = rxe_get_dev_from_net(ndev); + if (rxe) { + ib_device_put(&rxe->ib_dev); +- rxe_dbg(rxe, "already configured on %s\n", ndev->name); ++ rxe_dbg_dev(rxe, "already configured on %s\n", ndev->name); + err = -EEXIST; + goto err; + } +diff --git a/drivers/infiniband/sw/rxe/rxe.h b/drivers/infiniband/sw/rxe/rxe.h +index 2415f3704f576..0757acc381038 100644 +--- a/drivers/infiniband/sw/rxe/rxe.h ++++ b/drivers/infiniband/sw/rxe/rxe.h +@@ -38,7 +38,8 @@ + + #define RXE_ROCE_V2_SPORT (0xc000) + +-#define rxe_dbg(rxe, fmt, ...) ibdev_dbg(&(rxe)->ib_dev, \ ++#define rxe_dbg(fmt, ...) pr_debug("%s: " fmt "\n", __func__, ##__VA_ARGS__) ++#define rxe_dbg_dev(rxe, fmt, ...) ibdev_dbg(&(rxe)->ib_dev, \ + "%s: " fmt, __func__, ##__VA_ARGS__) + #define rxe_dbg_uc(uc, fmt, ...) ibdev_dbg((uc)->ibuc.device, \ + "uc#%d %s: " fmt, (uc)->elem.index, __func__, ##__VA_ARGS__) +diff --git a/drivers/infiniband/sw/rxe/rxe_cq.c b/drivers/infiniband/sw/rxe/rxe_cq.c +index faf49c50bbaba..519ddec29b4ba 100644 +--- a/drivers/infiniband/sw/rxe/rxe_cq.c ++++ b/drivers/infiniband/sw/rxe/rxe_cq.c +@@ -14,12 +14,12 @@ int rxe_cq_chk_attr(struct rxe_dev *rxe, struct rxe_cq *cq, + int count; + + if (cqe <= 0) { +- rxe_dbg(rxe, "cqe(%d) <= 0\n", cqe); ++ rxe_dbg_dev(rxe, "cqe(%d) <= 0\n", cqe); + goto err1; + } + + if (cqe > rxe->attr.max_cqe) { +- rxe_dbg(rxe, "cqe(%d) > max_cqe(%d)\n", ++ rxe_dbg_dev(rxe, "cqe(%d) > max_cqe(%d)\n", + cqe, rxe->attr.max_cqe); + goto err1; + } +@@ -50,7 +50,7 @@ int rxe_cq_from_init(struct rxe_dev *rxe, struct rxe_cq *cq, int cqe, + cq->queue = rxe_queue_init(rxe, &cqe, + sizeof(struct rxe_cqe), type); + if (!cq->queue) { +- rxe_dbg(rxe, "unable to create cq\n"); ++ rxe_dbg_dev(rxe, "unable to create cq\n"); + return -ENOMEM; + } + +diff --git a/drivers/infiniband/sw/rxe/rxe_icrc.c b/drivers/infiniband/sw/rxe/rxe_icrc.c +index 71bc2c1895888..fdf5f08cd8f17 100644 +--- a/drivers/infiniband/sw/rxe/rxe_icrc.c ++++ b/drivers/infiniband/sw/rxe/rxe_icrc.c +@@ -21,7 +21,7 @@ int rxe_icrc_init(struct rxe_dev *rxe) + + tfm = crypto_alloc_shash("crc32", 0, 0); + if (IS_ERR(tfm)) { +- rxe_dbg(rxe, "failed to init crc32 algorithm err: %ld\n", ++ rxe_dbg_dev(rxe, "failed to init crc32 algorithm err: %ld\n", + PTR_ERR(tfm)); + return PTR_ERR(tfm); + } +@@ -51,7 +51,7 @@ static __be32 rxe_crc32(struct rxe_dev *rxe, __be32 crc, void *next, size_t len) + *(__be32 *)shash_desc_ctx(shash) = crc; + err = crypto_shash_update(shash, next, len); + if (unlikely(err)) { +- rxe_dbg(rxe, "failed crc calculation, err: %d\n", err); ++ rxe_dbg_dev(rxe, "failed crc calculation, err: %d\n", err); + return (__force __be32)crc32_le((__force u32)crc, next, len); + } + +diff --git a/drivers/infiniband/sw/rxe/rxe_mmap.c b/drivers/infiniband/sw/rxe/rxe_mmap.c +index a47d72dbc5376..6b7f2bd698799 100644 +--- a/drivers/infiniband/sw/rxe/rxe_mmap.c ++++ b/drivers/infiniband/sw/rxe/rxe_mmap.c +@@ -79,7 +79,7 @@ int rxe_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) + + /* Don't allow a mmap larger than the object. */ + if (size > ip->info.size) { +- rxe_dbg(rxe, "mmap region is larger than the object!\n"); ++ rxe_dbg_dev(rxe, "mmap region is larger than the object!\n"); + spin_unlock_bh(&rxe->pending_lock); + ret = -EINVAL; + goto done; +@@ -87,7 +87,7 @@ int rxe_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) + + goto found_it; + } +- rxe_dbg(rxe, "unable to find pending mmap info\n"); ++ rxe_dbg_dev(rxe, "unable to find pending mmap info\n"); + spin_unlock_bh(&rxe->pending_lock); + ret = -EINVAL; + goto done; +@@ -98,7 +98,7 @@ int rxe_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) + + ret = remap_vmalloc_range(vma, ip->obj, 0); + if (ret) { +- rxe_dbg(rxe, "err %d from remap_vmalloc_range\n", ret); ++ rxe_dbg_dev(rxe, "err %d from remap_vmalloc_range\n", ret); + goto done; + } + +diff --git a/drivers/infiniband/sw/rxe/rxe_net.c b/drivers/infiniband/sw/rxe/rxe_net.c +index e02e1624bcf4d..a2ace42e95366 100644 +--- a/drivers/infiniband/sw/rxe/rxe_net.c ++++ b/drivers/infiniband/sw/rxe/rxe_net.c +@@ -596,7 +596,7 @@ static int rxe_notify(struct notifier_block *not_blk, + rxe_port_down(rxe); + break; + case NETDEV_CHANGEMTU: +- rxe_dbg(rxe, "%s changed mtu to %d\n", ndev->name, ndev->mtu); ++ rxe_dbg_dev(rxe, "%s changed mtu to %d\n", ndev->name, ndev->mtu); + rxe_set_mtu(rxe, ndev->mtu); + break; + case NETDEV_CHANGE: +@@ -608,7 +608,7 @@ static int rxe_notify(struct notifier_block *not_blk, + case NETDEV_CHANGENAME: + case NETDEV_FEAT_CHANGE: + default: +- rxe_dbg(rxe, "ignoring netdev event = %ld for %s\n", ++ rxe_dbg_dev(rxe, "ignoring netdev event = %ld for %s\n", + event, ndev->name); + break; + } +diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c +index 13283ec06f95e..d5de5ba6940f1 100644 +--- a/drivers/infiniband/sw/rxe/rxe_qp.c ++++ b/drivers/infiniband/sw/rxe/rxe_qp.c +@@ -19,33 +19,33 @@ static int rxe_qp_chk_cap(struct rxe_dev *rxe, struct ib_qp_cap *cap, + int has_srq) + { + if (cap->max_send_wr > rxe->attr.max_qp_wr) { +- rxe_dbg(rxe, "invalid send wr = %u > %d\n", ++ rxe_dbg_dev(rxe, "invalid send wr = %u > %d\n", + cap->max_send_wr, rxe->attr.max_qp_wr); + goto err1; + } + + if (cap->max_send_sge > rxe->attr.max_send_sge) { +- rxe_dbg(rxe, "invalid send sge = %u > %d\n", ++ rxe_dbg_dev(rxe, "invalid send sge = %u > %d\n", + cap->max_send_sge, rxe->attr.max_send_sge); + goto err1; + } + + if (!has_srq) { + if (cap->max_recv_wr > rxe->attr.max_qp_wr) { +- rxe_dbg(rxe, "invalid recv wr = %u > %d\n", ++ rxe_dbg_dev(rxe, "invalid recv wr = %u > %d\n", + cap->max_recv_wr, rxe->attr.max_qp_wr); + goto err1; + } + + if (cap->max_recv_sge > rxe->attr.max_recv_sge) { +- rxe_dbg(rxe, "invalid recv sge = %u > %d\n", ++ rxe_dbg_dev(rxe, "invalid recv sge = %u > %d\n", + cap->max_recv_sge, rxe->attr.max_recv_sge); + goto err1; + } + } + + if (cap->max_inline_data > rxe->max_inline_data) { +- rxe_dbg(rxe, "invalid max inline data = %u > %d\n", ++ rxe_dbg_dev(rxe, "invalid max inline data = %u > %d\n", + cap->max_inline_data, rxe->max_inline_data); + goto err1; + } +@@ -73,7 +73,7 @@ int rxe_qp_chk_init(struct rxe_dev *rxe, struct ib_qp_init_attr *init) + } + + if (!init->recv_cq || !init->send_cq) { +- rxe_dbg(rxe, "missing cq\n"); ++ rxe_dbg_dev(rxe, "missing cq\n"); + goto err1; + } + +@@ -82,14 +82,14 @@ int rxe_qp_chk_init(struct rxe_dev *rxe, struct ib_qp_init_attr *init) + + if (init->qp_type == IB_QPT_GSI) { + if (!rdma_is_port_valid(&rxe->ib_dev, port_num)) { +- rxe_dbg(rxe, "invalid port = %d\n", port_num); ++ rxe_dbg_dev(rxe, "invalid port = %d\n", port_num); + goto err1; + } + + port = &rxe->port; + + if (init->qp_type == IB_QPT_GSI && port->qp_gsi_index) { +- rxe_dbg(rxe, "GSI QP exists for port %d\n", port_num); ++ rxe_dbg_dev(rxe, "GSI QP exists for port %d\n", port_num); + goto err1; + } + } +diff --git a/drivers/infiniband/sw/rxe/rxe_srq.c b/drivers/infiniband/sw/rxe/rxe_srq.c +index 82e37a41ced40..27ca82ec0826b 100644 +--- a/drivers/infiniband/sw/rxe/rxe_srq.c ++++ b/drivers/infiniband/sw/rxe/rxe_srq.c +@@ -13,13 +13,13 @@ int rxe_srq_chk_init(struct rxe_dev *rxe, struct ib_srq_init_attr *init) + struct ib_srq_attr *attr = &init->attr; + + if (attr->max_wr > rxe->attr.max_srq_wr) { +- rxe_dbg(rxe, "max_wr(%d) > max_srq_wr(%d)\n", ++ rxe_dbg_dev(rxe, "max_wr(%d) > max_srq_wr(%d)\n", + attr->max_wr, rxe->attr.max_srq_wr); + goto err1; + } + + if (attr->max_wr <= 0) { +- rxe_dbg(rxe, "max_wr(%d) <= 0\n", attr->max_wr); ++ rxe_dbg_dev(rxe, "max_wr(%d) <= 0\n", attr->max_wr); + goto err1; + } + +@@ -27,7 +27,7 @@ int rxe_srq_chk_init(struct rxe_dev *rxe, struct ib_srq_init_attr *init) + attr->max_wr = RXE_MIN_SRQ_WR; + + if (attr->max_sge > rxe->attr.max_srq_sge) { +- rxe_dbg(rxe, "max_sge(%d) > max_srq_sge(%d)\n", ++ rxe_dbg_dev(rxe, "max_sge(%d) > max_srq_sge(%d)\n", + attr->max_sge, rxe->attr.max_srq_sge); + goto err1; + } +diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c +index 6803ac76ae572..a40a6d0581500 100644 +--- a/drivers/infiniband/sw/rxe/rxe_verbs.c ++++ b/drivers/infiniband/sw/rxe/rxe_verbs.c +@@ -1093,7 +1093,7 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name) + + err = ib_register_device(dev, ibdev_name, NULL); + if (err) +- rxe_dbg(rxe, "failed with error %d\n", err); ++ rxe_dbg_dev(rxe, "failed with error %d\n", err); + + /* + * Note that rxe may be invalid at this point if another thread +-- +2.39.2 + diff --git a/queue-6.2/rdma-rxe-extend-dbg-log-messages-to-err-and-info.patch b/queue-6.2/rdma-rxe-extend-dbg-log-messages-to-err-and-info.patch new file mode 100644 index 00000000000..2f0c8dff431 --- /dev/null +++ b/queue-6.2/rdma-rxe-extend-dbg-log-messages-to-err-and-info.patch @@ -0,0 +1,118 @@ +From b17dbd363bb4888fa6b6103b54ac5c9775c6a775 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 3 Mar 2023 16:16:23 -0600 +Subject: RDMA/rxe: Extend dbg log messages to err and info + +From: Bob Pearson + +[ Upstream commit 9ac01f434a1eb56ea94611bd75cf62fa276b41f4 ] + +Extend the dbg log messages (e.g. rxe_dbg_xxx) to include +err and info types. rxe.c is modified to use these new log +messages as examples. + +Link: https://lore.kernel.org/r/20230303221623.8053-4-rpearsonhpe@gmail.com +Signed-off-by: Bob Pearson +Signed-off-by: Jason Gunthorpe +Stable-dep-of: 78b26a335310 ("RDMA/rxe: Remove tasklet call from rxe_cq.c") +Signed-off-by: Sasha Levin +--- + drivers/infiniband/sw/rxe/rxe.c | 8 ++++--- + drivers/infiniband/sw/rxe/rxe.h | 42 +++++++++++++++++++++++++++++++++ + 2 files changed, 47 insertions(+), 3 deletions(-) + +diff --git a/drivers/infiniband/sw/rxe/rxe.c b/drivers/infiniband/sw/rxe/rxe.c +index d57ba7a5964b9..7a7e713de52db 100644 +--- a/drivers/infiniband/sw/rxe/rxe.c ++++ b/drivers/infiniband/sw/rxe/rxe.c +@@ -160,6 +160,8 @@ void rxe_set_mtu(struct rxe_dev *rxe, unsigned int ndev_mtu) + + port->attr.active_mtu = mtu; + port->mtu_cap = ib_mtu_enum_to_int(mtu); ++ ++ rxe_info_dev(rxe, "Set mtu to %d", port->mtu_cap); + } + + /* called by ifc layer to create new rxe device. +@@ -179,7 +181,7 @@ static int rxe_newlink(const char *ibdev_name, struct net_device *ndev) + int err = 0; + + if (is_vlan_dev(ndev)) { +- pr_err("rxe creation allowed on top of a real device only\n"); ++ rxe_err("rxe creation allowed on top of a real device only"); + err = -EPERM; + goto err; + } +@@ -187,14 +189,14 @@ static int rxe_newlink(const char *ibdev_name, struct net_device *ndev) + rxe = rxe_get_dev_from_net(ndev); + if (rxe) { + ib_device_put(&rxe->ib_dev); +- rxe_dbg_dev(rxe, "already configured on %s\n", ndev->name); ++ rxe_err_dev(rxe, "already configured on %s", ndev->name); + err = -EEXIST; + goto err; + } + + err = rxe_net_add(ibdev_name, ndev); + if (err) { +- pr_debug("failed to add %s\n", ndev->name); ++ rxe_err("failed to add %s\n", ndev->name); + goto err; + } + err: +diff --git a/drivers/infiniband/sw/rxe/rxe.h b/drivers/infiniband/sw/rxe/rxe.h +index 0757acc381038..bd8a8ea4ea8fd 100644 +--- a/drivers/infiniband/sw/rxe/rxe.h ++++ b/drivers/infiniband/sw/rxe/rxe.h +@@ -58,6 +58,48 @@ + #define rxe_dbg_mw(mw, fmt, ...) ibdev_dbg((mw)->ibmw.device, \ + "mw#%d %s: " fmt, (mw)->elem.index, __func__, ##__VA_ARGS__) + ++#define rxe_err(fmt, ...) pr_err_ratelimited("%s: " fmt "\n", __func__, \ ++ ##__VA_ARGS__) ++#define rxe_err_dev(rxe, fmt, ...) ibdev_err_ratelimited(&(rxe)->ib_dev, \ ++ "%s: " fmt, __func__, ##__VA_ARGS__) ++#define rxe_err_uc(uc, fmt, ...) ibdev_err_ratelimited((uc)->ibuc.device, \ ++ "uc#%d %s: " fmt, (uc)->elem.index, __func__, ##__VA_ARGS__) ++#define rxe_err_pd(pd, fmt, ...) ibdev_err_ratelimited((pd)->ibpd.device, \ ++ "pd#%d %s: " fmt, (pd)->elem.index, __func__, ##__VA_ARGS__) ++#define rxe_err_ah(ah, fmt, ...) ibdev_err_ratelimited((ah)->ibah.device, \ ++ "ah#%d %s: " fmt, (ah)->elem.index, __func__, ##__VA_ARGS__) ++#define rxe_err_srq(srq, fmt, ...) ibdev_err_ratelimited((srq)->ibsrq.device, \ ++ "srq#%d %s: " fmt, (srq)->elem.index, __func__, ##__VA_ARGS__) ++#define rxe_err_qp(qp, fmt, ...) ibdev_err_ratelimited((qp)->ibqp.device, \ ++ "qp#%d %s: " fmt, (qp)->elem.index, __func__, ##__VA_ARGS__) ++#define rxe_err_cq(cq, fmt, ...) ibdev_err_ratelimited((cq)->ibcq.device, \ ++ "cq#%d %s: " fmt, (cq)->elem.index, __func__, ##__VA_ARGS__) ++#define rxe_err_mr(mr, fmt, ...) ibdev_err_ratelimited((mr)->ibmr.device, \ ++ "mr#%d %s: " fmt, (mr)->elem.index, __func__, ##__VA_ARGS__) ++#define rxe_err_mw(mw, fmt, ...) ibdev_err_ratelimited((mw)->ibmw.device, \ ++ "mw#%d %s: " fmt, (mw)->elem.index, __func__, ##__VA_ARGS__) ++ ++#define rxe_info(fmt, ...) pr_info_ratelimited("%s: " fmt "\n", __func__, \ ++ ##__VA_ARGS__) ++#define rxe_info_dev(rxe, fmt, ...) ibdev_info_ratelimited(&(rxe)->ib_dev, \ ++ "%s: " fmt, __func__, ##__VA_ARGS__) ++#define rxe_info_uc(uc, fmt, ...) ibdev_info_ratelimited((uc)->ibuc.device, \ ++ "uc#%d %s: " fmt, (uc)->elem.index, __func__, ##__VA_ARGS__) ++#define rxe_info_pd(pd, fmt, ...) ibdev_info_ratelimited((pd)->ibpd.device, \ ++ "pd#%d %s: " fmt, (pd)->elem.index, __func__, ##__VA_ARGS__) ++#define rxe_info_ah(ah, fmt, ...) ibdev_info_ratelimited((ah)->ibah.device, \ ++ "ah#%d %s: " fmt, (ah)->elem.index, __func__, ##__VA_ARGS__) ++#define rxe_info_srq(srq, fmt, ...) ibdev_info_ratelimited((srq)->ibsrq.device, \ ++ "srq#%d %s: " fmt, (srq)->elem.index, __func__, ##__VA_ARGS__) ++#define rxe_info_qp(qp, fmt, ...) ibdev_info_ratelimited((qp)->ibqp.device, \ ++ "qp#%d %s: " fmt, (qp)->elem.index, __func__, ##__VA_ARGS__) ++#define rxe_info_cq(cq, fmt, ...) ibdev_info_ratelimited((cq)->ibcq.device, \ ++ "cq#%d %s: " fmt, (cq)->elem.index, __func__, ##__VA_ARGS__) ++#define rxe_info_mr(mr, fmt, ...) ibdev_info_ratelimited((mr)->ibmr.device, \ ++ "mr#%d %s: " fmt, (mr)->elem.index, __func__, ##__VA_ARGS__) ++#define rxe_info_mw(mw, fmt, ...) ibdev_info_ratelimited((mw)->ibmw.device, \ ++ "mw#%d %s: " fmt, (mw)->elem.index, __func__, ##__VA_ARGS__) ++ + /* responder states */ + enum resp_states { + RESPST_NONE, +-- +2.39.2 + diff --git a/queue-6.2/rdma-rxe-remove-rxe_alloc.patch b/queue-6.2/rdma-rxe-remove-rxe_alloc.patch new file mode 100644 index 00000000000..10fd212019c --- /dev/null +++ b/queue-6.2/rdma-rxe-remove-rxe_alloc.patch @@ -0,0 +1,251 @@ +From 564df6e7256fa7b6f5435e808b739261e01d91f9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 13 Feb 2023 16:55:52 -0600 +Subject: RDMA/rxe: Remove rxe_alloc() + +From: Bob Pearson + +[ Upstream commit 72a03627443d5bc7032ab98bd784740cd8a76f8a ] + +Currently all the object types in the rxe driver are allocated in +rdma-core except for MRs. By moving tha kzalloc() call outside of +the pool code the rxe_alloc() subroutine can be eliminated and code +checking for MR as a special case can be removed. + +This patch moves the kzalloc() and kfree_rcu() calls into the mr +registration and destruction verbs. It removes that code from +rxe_pool.c including the rxe_alloc() subroutine which is no longer +used. + +Link: https://lore.kernel.org/r/20230213225551.12437-1-rpearsonhpe@gmail.com +Signed-off-by: Bob Pearson +Reviewed-by: Devesh Sharma +Reviewed-by: Devesh Sharma +Reviewed-by: Zhu Yanjun +Signed-off-by: Jason Gunthorpe +Stable-dep-of: 78b26a335310 ("RDMA/rxe: Remove tasklet call from rxe_cq.c") +Signed-off-by: Sasha Levin +--- + drivers/infiniband/sw/rxe/rxe_mr.c | 2 +- + drivers/infiniband/sw/rxe/rxe_pool.c | 46 --------------------- + drivers/infiniband/sw/rxe/rxe_pool.h | 3 -- + drivers/infiniband/sw/rxe/rxe_verbs.c | 59 +++++++++++++++++++-------- + 4 files changed, 44 insertions(+), 66 deletions(-) + +diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c +index 5e9a03831bf9f..b10aa1580a644 100644 +--- a/drivers/infiniband/sw/rxe/rxe_mr.c ++++ b/drivers/infiniband/sw/rxe/rxe_mr.c +@@ -731,7 +731,7 @@ int rxe_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata) + return -EINVAL; + + rxe_cleanup(mr); +- ++ kfree_rcu(mr); + return 0; + } + +diff --git a/drivers/infiniband/sw/rxe/rxe_pool.c b/drivers/infiniband/sw/rxe/rxe_pool.c +index 1151c0b5cceab..6215c6de3a840 100644 +--- a/drivers/infiniband/sw/rxe/rxe_pool.c ++++ b/drivers/infiniband/sw/rxe/rxe_pool.c +@@ -116,55 +116,12 @@ void rxe_pool_cleanup(struct rxe_pool *pool) + WARN_ON(!xa_empty(&pool->xa)); + } + +-void *rxe_alloc(struct rxe_pool *pool) +-{ +- struct rxe_pool_elem *elem; +- void *obj; +- int err; +- +- if (WARN_ON(!(pool->type == RXE_TYPE_MR))) +- return NULL; +- +- if (atomic_inc_return(&pool->num_elem) > pool->max_elem) +- goto err_cnt; +- +- obj = kzalloc(pool->elem_size, GFP_KERNEL); +- if (!obj) +- goto err_cnt; +- +- elem = (struct rxe_pool_elem *)((u8 *)obj + pool->elem_offset); +- +- elem->pool = pool; +- elem->obj = obj; +- kref_init(&elem->ref_cnt); +- init_completion(&elem->complete); +- +- /* allocate index in array but leave pointer as NULL so it +- * can't be looked up until rxe_finalize() is called +- */ +- err = xa_alloc_cyclic(&pool->xa, &elem->index, NULL, pool->limit, +- &pool->next, GFP_KERNEL); +- if (err < 0) +- goto err_free; +- +- return obj; +- +-err_free: +- kfree(obj); +-err_cnt: +- atomic_dec(&pool->num_elem); +- return NULL; +-} +- + int __rxe_add_to_pool(struct rxe_pool *pool, struct rxe_pool_elem *elem, + bool sleepable) + { + int err; + gfp_t gfp_flags; + +- if (WARN_ON(pool->type == RXE_TYPE_MR)) +- return -EINVAL; +- + if (atomic_inc_return(&pool->num_elem) > pool->max_elem) + goto err_cnt; + +@@ -275,9 +232,6 @@ int __rxe_cleanup(struct rxe_pool_elem *elem, bool sleepable) + if (pool->cleanup) + pool->cleanup(elem); + +- if (pool->type == RXE_TYPE_MR) +- kfree_rcu(elem->obj); +- + atomic_dec(&pool->num_elem); + + return err; +diff --git a/drivers/infiniband/sw/rxe/rxe_pool.h b/drivers/infiniband/sw/rxe/rxe_pool.h +index 9d83cb32092ff..b42e26427a702 100644 +--- a/drivers/infiniband/sw/rxe/rxe_pool.h ++++ b/drivers/infiniband/sw/rxe/rxe_pool.h +@@ -54,9 +54,6 @@ void rxe_pool_init(struct rxe_dev *rxe, struct rxe_pool *pool, + /* free resources from object pool */ + void rxe_pool_cleanup(struct rxe_pool *pool); + +-/* allocate an object from pool */ +-void *rxe_alloc(struct rxe_pool *pool); +- + /* connect already allocated object to pool */ + int __rxe_add_to_pool(struct rxe_pool *pool, struct rxe_pool_elem *elem, + bool sleepable); +diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c +index 9ae7cf93365c7..6803ac76ae572 100644 +--- a/drivers/infiniband/sw/rxe/rxe_verbs.c ++++ b/drivers/infiniband/sw/rxe/rxe_verbs.c +@@ -867,10 +867,17 @@ static struct ib_mr *rxe_get_dma_mr(struct ib_pd *ibpd, int access) + struct rxe_dev *rxe = to_rdev(ibpd->device); + struct rxe_pd *pd = to_rpd(ibpd); + struct rxe_mr *mr; ++ int err; + +- mr = rxe_alloc(&rxe->mr_pool); +- if (!mr) +- return ERR_PTR(-ENOMEM); ++ mr = kzalloc(sizeof(*mr), GFP_KERNEL); ++ if (!mr) { ++ err = -ENOMEM; ++ goto err_out; ++ } ++ ++ err = rxe_add_to_pool(&rxe->mr_pool, mr); ++ if (err) ++ goto err_free; + + rxe_get(pd); + mr->ibmr.pd = ibpd; +@@ -878,8 +885,12 @@ static struct ib_mr *rxe_get_dma_mr(struct ib_pd *ibpd, int access) + + rxe_mr_init_dma(access, mr); + rxe_finalize(mr); +- + return &mr->ibmr; ++ ++err_free: ++ kfree(mr); ++err_out: ++ return ERR_PTR(err); + } + + static struct ib_mr *rxe_reg_user_mr(struct ib_pd *ibpd, +@@ -893,9 +904,15 @@ static struct ib_mr *rxe_reg_user_mr(struct ib_pd *ibpd, + struct rxe_pd *pd = to_rpd(ibpd); + struct rxe_mr *mr; + +- mr = rxe_alloc(&rxe->mr_pool); +- if (!mr) +- return ERR_PTR(-ENOMEM); ++ mr = kzalloc(sizeof(*mr), GFP_KERNEL); ++ if (!mr) { ++ err = -ENOMEM; ++ goto err_out; ++ } ++ ++ err = rxe_add_to_pool(&rxe->mr_pool, mr); ++ if (err) ++ goto err_free; + + rxe_get(pd); + mr->ibmr.pd = ibpd; +@@ -903,14 +920,16 @@ static struct ib_mr *rxe_reg_user_mr(struct ib_pd *ibpd, + + err = rxe_mr_init_user(rxe, start, length, iova, access, mr); + if (err) +- goto err1; ++ goto err_cleanup; + + rxe_finalize(mr); +- + return &mr->ibmr; + +-err1: ++err_cleanup: + rxe_cleanup(mr); ++err_free: ++ kfree(mr); ++err_out: + return ERR_PTR(err); + } + +@@ -925,9 +944,15 @@ static struct ib_mr *rxe_alloc_mr(struct ib_pd *ibpd, enum ib_mr_type mr_type, + if (mr_type != IB_MR_TYPE_MEM_REG) + return ERR_PTR(-EINVAL); + +- mr = rxe_alloc(&rxe->mr_pool); +- if (!mr) +- return ERR_PTR(-ENOMEM); ++ mr = kzalloc(sizeof(*mr), GFP_KERNEL); ++ if (!mr) { ++ err = -ENOMEM; ++ goto err_out; ++ } ++ ++ err = rxe_add_to_pool(&rxe->mr_pool, mr); ++ if (err) ++ goto err_free; + + rxe_get(pd); + mr->ibmr.pd = ibpd; +@@ -935,14 +960,16 @@ static struct ib_mr *rxe_alloc_mr(struct ib_pd *ibpd, enum ib_mr_type mr_type, + + err = rxe_mr_init_fast(max_num_sg, mr); + if (err) +- goto err1; ++ goto err_cleanup; + + rxe_finalize(mr); +- + return &mr->ibmr; + +-err1: ++err_cleanup: + rxe_cleanup(mr); ++err_free: ++ kfree(mr); ++err_out: + return ERR_PTR(err); + } + +-- +2.39.2 + diff --git a/queue-6.2/risc-v-mm-enable-huge-page-support-to-kernel_page_pr.patch b/queue-6.2/risc-v-mm-enable-huge-page-support-to-kernel_page_pr.patch new file mode 100644 index 00000000000..6e2d47c4db6 --- /dev/null +++ b/queue-6.2/risc-v-mm-enable-huge-page-support-to-kernel_page_pr.patch @@ -0,0 +1,63 @@ +From 23586d078b806e6eec57d8041a0d41f1b2cf4991 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 30 Mar 2023 14:43:20 +0800 +Subject: RISC-V: mm: Enable huge page support to kernel_page_present() + function + +From: Sia Jee Heng + +[ Upstream commit a15c90b67a662c75f469822a7f95c7aaa049e28f ] + +Currently kernel_page_present() function doesn't support huge page +detection causes the function to mistakenly return false to the +hibernation core. + +Add huge page detection to the function to solve the problem. + +Fixes: 9e953cda5cdf ("riscv: Introduce huge page support for 32/64bit kernel") +Signed-off-by: Sia Jee Heng +Reviewed-by: Ley Foon Tan +Reviewed-by: Mason Huo +Reviewed-by: Andrew Jones +Reviewed-by: Alexandre Ghiti +Link: https://lore.kernel.org/r/20230330064321.1008373-4-jeeheng.sia@starfivetech.com +Signed-off-by: Palmer Dabbelt +Signed-off-by: Sasha Levin +--- + arch/riscv/mm/pageattr.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/arch/riscv/mm/pageattr.c b/arch/riscv/mm/pageattr.c +index 86c56616e5dea..ea3d61de065b3 100644 +--- a/arch/riscv/mm/pageattr.c ++++ b/arch/riscv/mm/pageattr.c +@@ -217,18 +217,26 @@ bool kernel_page_present(struct page *page) + pgd = pgd_offset_k(addr); + if (!pgd_present(*pgd)) + return false; ++ if (pgd_leaf(*pgd)) ++ return true; + + p4d = p4d_offset(pgd, addr); + if (!p4d_present(*p4d)) + return false; ++ if (p4d_leaf(*p4d)) ++ return true; + + pud = pud_offset(p4d, addr); + if (!pud_present(*pud)) + return false; ++ if (pud_leaf(*pud)) ++ return true; + + pmd = pmd_offset(pud, addr); + if (!pmd_present(*pmd)) + return false; ++ if (pmd_leaf(*pmd)) ++ return true; + + pte = pte_offset_kernel(pmd, addr); + return pte_present(*pte); +-- +2.39.2 + diff --git a/queue-6.2/riscv-compat_syscall_table-fixup-compile-warning.patch b/queue-6.2/riscv-compat_syscall_table-fixup-compile-warning.patch new file mode 100644 index 00000000000..c0375300687 --- /dev/null +++ b/queue-6.2/riscv-compat_syscall_table-fixup-compile-warning.patch @@ -0,0 +1,46 @@ +From f77b4facf5574abf4d16117f9190874405b01cc5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 1 May 2023 15:33:54 -0700 +Subject: riscv: compat_syscall_table: Fixup compile warning + +From: Guo Ren + +[ Upstream commit f9c4bbddece7eff1155c70d48e3c9c2a01b9d778 ] + +../arch/riscv/kernel/compat_syscall_table.c:12:41: warning: initialized +field overwritten [-Woverride-init] + 12 | #define __SYSCALL(nr, call) [nr] = (call), + | ^ +../include/uapi/asm-generic/unistd.h:567:1: note: in expansion of macro +'__SYSCALL' + 567 | __SYSCALL(__NR_semget, sys_semget) + +Fixes: 59c10c52f573 ("riscv: compat: syscall: Add compat_sys_call_table implementation") +Reviewed-by: Conor Dooley +Reported-by: kernel test robot +Tested-by: Jisheng Zhang +Signed-off-by: Guo Ren +Signed-off-by: Guo Ren +Signed-off-by: Drew Fustini +Link: https://lore.kernel.org/r/20230501223353.2833899-1-dfustini@baylibre.com +Signed-off-by: Palmer Dabbelt +Signed-off-by: Sasha Levin +--- + arch/riscv/kernel/Makefile | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/riscv/kernel/Makefile b/arch/riscv/kernel/Makefile +index 4cf303a779ab9..8d02b9d05738d 100644 +--- a/arch/riscv/kernel/Makefile ++++ b/arch/riscv/kernel/Makefile +@@ -9,6 +9,7 @@ CFLAGS_REMOVE_patch.o = $(CC_FLAGS_FTRACE) + CFLAGS_REMOVE_sbi.o = $(CC_FLAGS_FTRACE) + endif + CFLAGS_syscall_table.o += $(call cc-option,-Wno-override-init,) ++CFLAGS_compat_syscall_table.o += $(call cc-option,-Wno-override-init,) + + ifdef CONFIG_KEXEC + AFLAGS_kexec_relocate.o := -mcmodel=medany $(call cc-option,-mno-relax) +-- +2.39.2 + diff --git a/queue-6.2/rxrpc-fix-hard-call-timeout-units.patch b/queue-6.2/rxrpc-fix-hard-call-timeout-units.patch new file mode 100644 index 00000000000..a31777fb6d4 --- /dev/null +++ b/queue-6.2/rxrpc-fix-hard-call-timeout-units.patch @@ -0,0 +1,45 @@ +From 117d7498bb01dc73e95c4eae9815d11103cac814 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 28 Apr 2023 21:27:54 +0100 +Subject: rxrpc: Fix hard call timeout units + +From: David Howells + +[ Upstream commit 0d098d83c5d9e107b2df7f5e11f81492f56d2fe7 ] + +The hard call timeout is specified in the RXRPC_SET_CALL_TIMEOUT cmsg in +seconds, so fix the point at which sendmsg() applies it to the call to +convert to jiffies from seconds, not milliseconds. + +Fixes: a158bdd3247b ("rxrpc: Fix timeout of a call that hasn't yet been granted a channel") +Signed-off-by: David Howells +cc: Marc Dionne +cc: "David S. Miller" +cc: Eric Dumazet +cc: Jakub Kicinski +cc: Paolo Abeni +cc: linux-afs@lists.infradead.org +cc: netdev@vger.kernel.org +cc: linux-kernel@vger.kernel.org +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/rxrpc/sendmsg.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/rxrpc/sendmsg.c b/net/rxrpc/sendmsg.c +index 6caa47d352ed6..7498a77b5d397 100644 +--- a/net/rxrpc/sendmsg.c ++++ b/net/rxrpc/sendmsg.c +@@ -699,7 +699,7 @@ int rxrpc_do_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg, size_t len) + fallthrough; + case 1: + if (p.call.timeouts.hard > 0) { +- j = msecs_to_jiffies(p.call.timeouts.hard); ++ j = p.call.timeouts.hard * HZ; + now = jiffies; + j += now; + WRITE_ONCE(call->expect_term_by, j); +-- +2.39.2 + diff --git a/queue-6.2/rxrpc-fix-potential-data-race-in-rxrpc_wait_to_be_co.patch b/queue-6.2/rxrpc-fix-potential-data-race-in-rxrpc_wait_to_be_co.patch new file mode 100644 index 00000000000..37443cf4913 --- /dev/null +++ b/queue-6.2/rxrpc-fix-potential-data-race-in-rxrpc_wait_to_be_co.patch @@ -0,0 +1,116 @@ +From 1cac97b29ba831fbb940dfdc996c78f0b2a145f1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 Apr 2023 13:56:35 +0100 +Subject: rxrpc: Fix potential data race in rxrpc_wait_to_be_connected() + +From: David Howells + +[ Upstream commit 2b5fdc0f5caa505afe34d608e2eefadadf2ee67a ] + +Inside the loop in rxrpc_wait_to_be_connected() it checks call->error to +see if it should exit the loop without first checking the call state. This +is probably safe as if call->error is set, the call is dead anyway, but we +should probably wait for the call state to have been set to completion +first, lest it cause surprise on the way out. + +Fix this by only accessing call->error if the call is complete. We don't +actually need to access the error inside the loop as we'll do that after. + +This caused the following report: + + BUG: KCSAN: data-race in rxrpc_send_data / rxrpc_set_call_completion + + write to 0xffff888159cf3c50 of 4 bytes by task 25673 on cpu 1: + rxrpc_set_call_completion+0x71/0x1c0 net/rxrpc/call_state.c:22 + rxrpc_send_data_packet+0xba9/0x1650 net/rxrpc/output.c:479 + rxrpc_transmit_one+0x1e/0x130 net/rxrpc/output.c:714 + rxrpc_decant_prepared_tx net/rxrpc/call_event.c:326 [inline] + rxrpc_transmit_some_data+0x496/0x600 net/rxrpc/call_event.c:350 + rxrpc_input_call_event+0x564/0x1220 net/rxrpc/call_event.c:464 + rxrpc_io_thread+0x307/0x1d80 net/rxrpc/io_thread.c:461 + kthread+0x1ac/0x1e0 kernel/kthread.c:376 + ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 + + read to 0xffff888159cf3c50 of 4 bytes by task 25672 on cpu 0: + rxrpc_send_data+0x29e/0x1950 net/rxrpc/sendmsg.c:296 + rxrpc_do_sendmsg+0xb7a/0xc20 net/rxrpc/sendmsg.c:726 + rxrpc_sendmsg+0x413/0x520 net/rxrpc/af_rxrpc.c:565 + sock_sendmsg_nosec net/socket.c:724 [inline] + sock_sendmsg net/socket.c:747 [inline] + ____sys_sendmsg+0x375/0x4c0 net/socket.c:2501 + ___sys_sendmsg net/socket.c:2555 [inline] + __sys_sendmmsg+0x263/0x500 net/socket.c:2641 + __do_sys_sendmmsg net/socket.c:2670 [inline] + __se_sys_sendmmsg net/socket.c:2667 [inline] + __x64_sys_sendmmsg+0x57/0x60 net/socket.c:2667 + do_syscall_x64 arch/x86/entry/common.c:50 [inline] + do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 + entry_SYSCALL_64_after_hwframe+0x63/0xcd + + value changed: 0x00000000 -> 0xffffffea + +Fixes: 9d35d880e0e4 ("rxrpc: Move client call connection to the I/O thread") +Reported-by: syzbot+ebc945fdb4acd72cba78@syzkaller.appspotmail.com +Link: https://lore.kernel.org/r/000000000000e7c6d205fa10a3cd@google.com/ +Signed-off-by: David Howells +cc: Marc Dionne +cc: Dmitry Vyukov +cc: "David S. Miller" +cc: Eric Dumazet +cc: Jakub Kicinski +cc: Paolo Abeni +cc: linux-afs@lists.infradead.org +cc: linux-fsdevel@vger.kernel.org +cc: netdev@vger.kernel.org +Link: https://lore.kernel.org/r/508133.1682427395@warthog.procyon.org.uk +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + net/rxrpc/sendmsg.c | 12 ++++-------- + 1 file changed, 4 insertions(+), 8 deletions(-) + +diff --git a/net/rxrpc/sendmsg.c b/net/rxrpc/sendmsg.c +index da49fcf1c4567..6caa47d352ed6 100644 +--- a/net/rxrpc/sendmsg.c ++++ b/net/rxrpc/sendmsg.c +@@ -50,15 +50,11 @@ static int rxrpc_wait_to_be_connected(struct rxrpc_call *call, long *timeo) + _enter("%d", call->debug_id); + + if (rxrpc_call_state(call) != RXRPC_CALL_CLIENT_AWAIT_CONN) +- return call->error; ++ goto no_wait; + + add_wait_queue_exclusive(&call->waitq, &myself); + + for (;;) { +- ret = call->error; +- if (ret < 0) +- break; +- + switch (call->interruptibility) { + case RXRPC_INTERRUPTIBLE: + case RXRPC_PREINTERRUPTIBLE: +@@ -69,10 +65,9 @@ static int rxrpc_wait_to_be_connected(struct rxrpc_call *call, long *timeo) + set_current_state(TASK_UNINTERRUPTIBLE); + break; + } +- if (rxrpc_call_state(call) != RXRPC_CALL_CLIENT_AWAIT_CONN) { +- ret = call->error; ++ ++ if (rxrpc_call_state(call) != RXRPC_CALL_CLIENT_AWAIT_CONN) + break; +- } + if ((call->interruptibility == RXRPC_INTERRUPTIBLE || + call->interruptibility == RXRPC_PREINTERRUPTIBLE) && + signal_pending(current)) { +@@ -85,6 +80,7 @@ static int rxrpc_wait_to_be_connected(struct rxrpc_call *call, long *timeo) + remove_wait_queue(&call->waitq, &myself); + __set_current_state(TASK_RUNNING); + ++no_wait: + if (ret == 0 && rxrpc_call_is_complete(call)) + ret = call->error; + +-- +2.39.2 + diff --git a/queue-6.2/rxrpc-fix-timeout-of-a-call-that-hasn-t-yet-been-gra.patch b/queue-6.2/rxrpc-fix-timeout-of-a-call-that-hasn-t-yet-been-gra.patch new file mode 100644 index 00000000000..2a05cb5b839 --- /dev/null +++ b/queue-6.2/rxrpc-fix-timeout-of-a-call-that-hasn-t-yet-been-gra.patch @@ -0,0 +1,230 @@ +From 581f76716f487bde751d14a54d20f5ed4b3a9911 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 28 Apr 2023 21:27:56 +0100 +Subject: rxrpc: Fix timeout of a call that hasn't yet been granted a channel + +From: David Howells + +[ Upstream commit db099c625b13a74d462521a46d98a8ce5b53af5d ] + +afs_make_call() calls rxrpc_kernel_begin_call() to begin a call (which may +get stalled in the background waiting for a connection to become +available); it then calls rxrpc_kernel_set_max_life() to set the timeouts - +but that starts the call timer so the call timer might then expire before +we get a connection assigned - leading to the following oops if the call +stalled: + + BUG: kernel NULL pointer dereference, address: 0000000000000000 + ... + CPU: 1 PID: 5111 Comm: krxrpcio/0 Not tainted 6.3.0-rc7-build3+ #701 + RIP: 0010:rxrpc_alloc_txbuf+0xc0/0x157 + ... + Call Trace: + + rxrpc_send_ACK+0x50/0x13b + rxrpc_input_call_event+0x16a/0x67d + rxrpc_io_thread+0x1b6/0x45f + ? _raw_spin_unlock_irqrestore+0x1f/0x35 + ? rxrpc_input_packet+0x519/0x519 + kthread+0xe7/0xef + ? kthread_complete_and_exit+0x1b/0x1b + ret_from_fork+0x22/0x30 + +Fix this by noting the timeouts in struct rxrpc_call when the call is +created. The timer will be started when the first packet is transmitted. + +It shouldn't be possible to trigger this directly from userspace through +AF_RXRPC as sendmsg() will return EBUSY if the call is in the +waiting-for-conn state if it dropped out of the wait due to a signal. + +Fixes: 9d35d880e0e4 ("rxrpc: Move client call connection to the I/O thread") +Reported-by: Marc Dionne +Signed-off-by: David Howells +cc: "David S. Miller" +cc: Eric Dumazet +cc: Jakub Kicinski +cc: Paolo Abeni +cc: linux-afs@lists.infradead.org +cc: netdev@vger.kernel.org +cc: linux-kernel@vger.kernel.org +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + fs/afs/afs.h | 4 ++-- + fs/afs/internal.h | 2 +- + fs/afs/rxrpc.c | 8 +++----- + include/net/af_rxrpc.h | 21 +++++++++++---------- + net/rxrpc/af_rxrpc.c | 3 +++ + net/rxrpc/ar-internal.h | 1 + + net/rxrpc/call_object.c | 9 ++++++++- + net/rxrpc/sendmsg.c | 1 + + 8 files changed, 30 insertions(+), 19 deletions(-) + +diff --git a/fs/afs/afs.h b/fs/afs/afs.h +index 432cb4b239614..81815724db6c9 100644 +--- a/fs/afs/afs.h ++++ b/fs/afs/afs.h +@@ -19,8 +19,8 @@ + #define AFSPATHMAX 1024 /* Maximum length of a pathname plus NUL */ + #define AFSOPAQUEMAX 1024 /* Maximum length of an opaque field */ + +-#define AFS_VL_MAX_LIFESPAN (120 * HZ) +-#define AFS_PROBE_MAX_LIFESPAN (30 * HZ) ++#define AFS_VL_MAX_LIFESPAN 120 ++#define AFS_PROBE_MAX_LIFESPAN 30 + + typedef u64 afs_volid_t; + typedef u64 afs_vnodeid_t; +diff --git a/fs/afs/internal.h b/fs/afs/internal.h +index fd8567b98e2bb..cd23a3c5b6ace 100644 +--- a/fs/afs/internal.h ++++ b/fs/afs/internal.h +@@ -127,7 +127,7 @@ struct afs_call { + spinlock_t state_lock; + int error; /* error code */ + u32 abort_code; /* Remote abort ID or 0 */ +- unsigned int max_lifespan; /* Maximum lifespan to set if not 0 */ ++ unsigned int max_lifespan; /* Maximum lifespan in secs to set if not 0 */ + unsigned request_size; /* size of request data */ + unsigned reply_max; /* maximum size of reply */ + unsigned count2; /* count used in unmarshalling */ +diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c +index 7817e2b860e5e..6862e3dde364b 100644 +--- a/fs/afs/rxrpc.c ++++ b/fs/afs/rxrpc.c +@@ -334,7 +334,9 @@ void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp) + /* create a call */ + rxcall = rxrpc_kernel_begin_call(call->net->socket, srx, call->key, + (unsigned long)call, +- tx_total_len, gfp, ++ tx_total_len, ++ call->max_lifespan, ++ gfp, + (call->async ? + afs_wake_up_async_call : + afs_wake_up_call_waiter), +@@ -349,10 +351,6 @@ void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp) + } + + call->rxcall = rxcall; +- +- if (call->max_lifespan) +- rxrpc_kernel_set_max_life(call->net->socket, rxcall, +- call->max_lifespan); + call->issue_time = ktime_get_real(); + + /* send the request */ +diff --git a/include/net/af_rxrpc.h b/include/net/af_rxrpc.h +index ba717eac0229a..73644bd42a3f9 100644 +--- a/include/net/af_rxrpc.h ++++ b/include/net/af_rxrpc.h +@@ -40,16 +40,17 @@ typedef void (*rxrpc_user_attach_call_t)(struct rxrpc_call *, unsigned long); + void rxrpc_kernel_new_call_notification(struct socket *, + rxrpc_notify_new_call_t, + rxrpc_discard_new_call_t); +-struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *, +- struct sockaddr_rxrpc *, +- struct key *, +- unsigned long, +- s64, +- gfp_t, +- rxrpc_notify_rx_t, +- bool, +- enum rxrpc_interruptibility, +- unsigned int); ++struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *sock, ++ struct sockaddr_rxrpc *srx, ++ struct key *key, ++ unsigned long user_call_ID, ++ s64 tx_total_len, ++ u32 hard_timeout, ++ gfp_t gfp, ++ rxrpc_notify_rx_t notify_rx, ++ bool upgrade, ++ enum rxrpc_interruptibility interruptibility, ++ unsigned int debug_id); + int rxrpc_kernel_send_data(struct socket *, struct rxrpc_call *, + struct msghdr *, size_t, + rxrpc_notify_end_tx_t); +diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c +index ebbd4a1c3f86e..de5bebc99a4b5 100644 +--- a/net/rxrpc/af_rxrpc.c ++++ b/net/rxrpc/af_rxrpc.c +@@ -265,6 +265,7 @@ static int rxrpc_listen(struct socket *sock, int backlog) + * @key: The security context to use (defaults to socket setting) + * @user_call_ID: The ID to use + * @tx_total_len: Total length of data to transmit during the call (or -1) ++ * @hard_timeout: The maximum lifespan of the call in sec + * @gfp: The allocation constraints + * @notify_rx: Where to send notifications instead of socket queue + * @upgrade: Request service upgrade for call +@@ -283,6 +284,7 @@ struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *sock, + struct key *key, + unsigned long user_call_ID, + s64 tx_total_len, ++ u32 hard_timeout, + gfp_t gfp, + rxrpc_notify_rx_t notify_rx, + bool upgrade, +@@ -313,6 +315,7 @@ struct rxrpc_call *rxrpc_kernel_begin_call(struct socket *sock, + p.tx_total_len = tx_total_len; + p.interruptibility = interruptibility; + p.kernel = true; ++ p.timeouts.hard = hard_timeout; + + memset(&cp, 0, sizeof(cp)); + cp.local = rx->local; +diff --git a/net/rxrpc/ar-internal.h b/net/rxrpc/ar-internal.h +index 433060cade038..ed0ef2dbd592b 100644 +--- a/net/rxrpc/ar-internal.h ++++ b/net/rxrpc/ar-internal.h +@@ -614,6 +614,7 @@ struct rxrpc_call { + unsigned long expect_term_by; /* When we expect call termination by */ + u32 next_rx_timo; /* Timeout for next Rx packet (jif) */ + u32 next_req_timo; /* Timeout for next Rx request packet (jif) */ ++ u32 hard_timo; /* Maximum lifetime or 0 (jif) */ + struct timer_list timer; /* Combined event timer */ + struct work_struct destroyer; /* In-process-context destroyer */ + rxrpc_notify_rx_t notify_rx; /* kernel service Rx notification function */ +diff --git a/net/rxrpc/call_object.c b/net/rxrpc/call_object.c +index 7ce562f6dc8d5..80ed67f4f3a7d 100644 +--- a/net/rxrpc/call_object.c ++++ b/net/rxrpc/call_object.c +@@ -225,6 +225,13 @@ static struct rxrpc_call *rxrpc_alloc_client_call(struct rxrpc_sock *rx, + if (cp->exclusive) + __set_bit(RXRPC_CALL_EXCLUSIVE, &call->flags); + ++ if (p->timeouts.normal) ++ call->next_rx_timo = min(msecs_to_jiffies(p->timeouts.normal), 1UL); ++ if (p->timeouts.idle) ++ call->next_req_timo = min(msecs_to_jiffies(p->timeouts.idle), 1UL); ++ if (p->timeouts.hard) ++ call->hard_timo = p->timeouts.hard * HZ; ++ + ret = rxrpc_init_client_call_security(call); + if (ret < 0) { + rxrpc_prefail_call(call, RXRPC_CALL_LOCAL_ERROR, ret); +@@ -256,7 +263,7 @@ void rxrpc_start_call_timer(struct rxrpc_call *call) + call->keepalive_at = j; + call->expect_rx_by = j; + call->expect_req_by = j; +- call->expect_term_by = j; ++ call->expect_term_by = j + call->hard_timo; + call->timer.expires = now; + } + +diff --git a/net/rxrpc/sendmsg.c b/net/rxrpc/sendmsg.c +index c1b074c17b33e..8e0b94714e849 100644 +--- a/net/rxrpc/sendmsg.c ++++ b/net/rxrpc/sendmsg.c +@@ -651,6 +651,7 @@ int rxrpc_do_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg, size_t len) + if (IS_ERR(call)) + return PTR_ERR(call); + /* ... and we have the call lock. */ ++ p.call.nr_timeouts = 0; + ret = 0; + if (rxrpc_call_is_complete(call)) + goto out_put_unlock; +-- +2.39.2 + diff --git a/queue-6.2/rxrpc-make-it-so-that-a-waiting-process-can-be-abort.patch b/queue-6.2/rxrpc-make-it-so-that-a-waiting-process-can-be-abort.patch new file mode 100644 index 00000000000..c5e7e944ec5 --- /dev/null +++ b/queue-6.2/rxrpc-make-it-so-that-a-waiting-process-can-be-abort.patch @@ -0,0 +1,62 @@ +From ef12ce381714f9476d3b2b2e4594ffbc110d64e5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 28 Apr 2023 21:27:55 +0100 +Subject: rxrpc: Make it so that a waiting process can be aborted + +From: David Howells + +[ Upstream commit 0eb362d254814ce04848730bf32e75b8ee1a4d6c ] + +When sendmsg() creates an rxrpc call, it queues it to wait for a connection +and channel to be assigned and then waits before it can start shovelling +data as the encrypted DATA packet content includes a summary of the +connection parameters. + +However, sendmsg() may get interrupted before a connection gets assigned +and further sendmsg() calls will fail with EBUSY until an assignment is +made. + +Fix this so that the call can at least be aborted without failing on +EBUSY. We have to be careful here as sendmsg() mustn't be allowed to start +the call timer if the call doesn't yet have a connection assigned as an +oops may follow shortly thereafter. + +Fixes: 540b1c48c37a ("rxrpc: Fix deadlock between call creation and sendmsg/recvmsg") +Reported-by: Marc Dionne +Signed-off-by: David Howells +cc: "David S. Miller" +cc: Eric Dumazet +cc: Jakub Kicinski +cc: Paolo Abeni +cc: linux-afs@lists.infradead.org +cc: netdev@vger.kernel.org +cc: linux-kernel@vger.kernel.org +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/rxrpc/sendmsg.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/net/rxrpc/sendmsg.c b/net/rxrpc/sendmsg.c +index 7498a77b5d397..c1b074c17b33e 100644 +--- a/net/rxrpc/sendmsg.c ++++ b/net/rxrpc/sendmsg.c +@@ -656,10 +656,13 @@ int rxrpc_do_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg, size_t len) + goto out_put_unlock; + } else { + switch (rxrpc_call_state(call)) { +- case RXRPC_CALL_UNINITIALISED: + case RXRPC_CALL_CLIENT_AWAIT_CONN: +- case RXRPC_CALL_SERVER_PREALLOC: + case RXRPC_CALL_SERVER_SECURING: ++ if (p.command == RXRPC_CMD_SEND_ABORT) ++ break; ++ fallthrough; ++ case RXRPC_CALL_UNINITIALISED: ++ case RXRPC_CALL_SERVER_PREALLOC: + rxrpc_put_call(call, rxrpc_call_put_sendmsg); + ret = -EBUSY; + goto error_release_sock; +-- +2.39.2 + diff --git a/queue-6.2/scsi-qedi-fix-use-after-free-bug-in-qedi_remove.patch b/queue-6.2/scsi-qedi-fix-use-after-free-bug-in-qedi_remove.patch new file mode 100644 index 00000000000..5afcc61f069 --- /dev/null +++ b/queue-6.2/scsi-qedi-fix-use-after-free-bug-in-qedi_remove.patch @@ -0,0 +1,62 @@ +From 59d568cc52fb434321764578c51aa4ce27f05cab Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 13 Apr 2023 11:34:22 +0800 +Subject: scsi: qedi: Fix use after free bug in qedi_remove() + +From: Zheng Wang + +[ Upstream commit c5749639f2d0a1f6cbe187d05f70c2e7c544d748 ] + +In qedi_probe() we call __qedi_probe() which initializes +&qedi->recovery_work with qedi_recovery_handler() and +&qedi->board_disable_work with qedi_board_disable_work(). + +When qedi_schedule_recovery_handler() is called, schedule_delayed_work() +will finally start the work. + +In qedi_remove(), which is called to remove the driver, the following +sequence may be observed: + +Fix this by finishing the work before cleanup in qedi_remove(). + +CPU0 CPU1 + + |qedi_recovery_handler +qedi_remove | + __qedi_remove | +iscsi_host_free | +scsi_host_put | +//free shost | + |iscsi_host_for_each_session + |//use qedi->shost + +Cancel recovery_work and board_disable_work in __qedi_remove(). + +Fixes: 4b1068f5d74b ("scsi: qedi: Add MFW error recovery process") +Signed-off-by: Zheng Wang +Link: https://lore.kernel.org/r/20230413033422.28003-1-zyytlz.wz@163.com +Acked-by: Manish Rangankar +Reviewed-by: Mike Christie +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/qedi/qedi_main.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c +index f2ee49756df8d..45d3595541820 100644 +--- a/drivers/scsi/qedi/qedi_main.c ++++ b/drivers/scsi/qedi/qedi_main.c +@@ -2450,6 +2450,9 @@ static void __qedi_remove(struct pci_dev *pdev, int mode) + qedi_ops->ll2->stop(qedi->cdev); + } + ++ cancel_delayed_work_sync(&qedi->recovery_work); ++ cancel_delayed_work_sync(&qedi->board_disable_work); ++ + qedi_free_iscsi_pf_param(qedi); + + rval = qedi_ops->common->update_drv_state(qedi->cdev, false); +-- +2.39.2 + diff --git a/queue-6.2/selftests-netfilter-fix-libmnl-pkg-config-usage.patch b/queue-6.2/selftests-netfilter-fix-libmnl-pkg-config-usage.patch new file mode 100644 index 00000000000..4c9de9d75e1 --- /dev/null +++ b/queue-6.2/selftests-netfilter-fix-libmnl-pkg-config-usage.patch @@ -0,0 +1,43 @@ +From bc7dd67e4d7d9a54e78ac2aa6504e656e09b6421 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 25 Apr 2023 22:11:39 +0100 +Subject: selftests: netfilter: fix libmnl pkg-config usage + +From: Jeremy Sowden + +[ Upstream commit de4773f0235acf74554f6a64ea60adc0d7b01895 ] + +1. Don't hard-code pkg-config +2. Remove distro-specific default for CFLAGS +3. Use pkg-config for LDLIBS + +Fixes: a50a88f026fb ("selftests: netfilter: fix a build error on openSUSE") +Suggested-by: Jan Engelhardt +Signed-off-by: Jeremy Sowden +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/netfilter/Makefile | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/tools/testing/selftests/netfilter/Makefile b/tools/testing/selftests/netfilter/Makefile +index 4504ee07be08d..3686bfa6c58d7 100644 +--- a/tools/testing/selftests/netfilter/Makefile ++++ b/tools/testing/selftests/netfilter/Makefile +@@ -8,8 +8,11 @@ TEST_PROGS := nft_trans_stress.sh nft_fib.sh nft_nat.sh bridge_brouter.sh \ + ipip-conntrack-mtu.sh conntrack_tcp_unreplied.sh \ + conntrack_vrf.sh nft_synproxy.sh rpath.sh + +-CFLAGS += $(shell pkg-config --cflags libmnl 2>/dev/null || echo "-I/usr/include/libmnl") +-LDLIBS = -lmnl ++HOSTPKG_CONFIG := pkg-config ++ ++CFLAGS += $(shell $(HOSTPKG_CONFIG) --cflags libmnl 2>/dev/null) ++LDLIBS += $(shell $(HOSTPKG_CONFIG) --libs libmnl 2>/dev/null || echo -lmnl) ++ + TEST_GEN_FILES = nf-queue connect_close + + include ../lib.mk +-- +2.39.2 + diff --git a/queue-6.2/selftests-srv6-make-srv6_end_dt46_l3vpn_test-more-ro.patch b/queue-6.2/selftests-srv6-make-srv6_end_dt46_l3vpn_test-more-ro.patch new file mode 100644 index 00000000000..6e96bd21953 --- /dev/null +++ b/queue-6.2/selftests-srv6-make-srv6_end_dt46_l3vpn_test-more-ro.patch @@ -0,0 +1,61 @@ +From 2db83a5bdd656c56b2388e920b359cfbeadbc41b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 Apr 2023 11:49:23 +0200 +Subject: selftests: srv6: make srv6_end_dt46_l3vpn_test more robust + +From: Andrea Mayer + +[ Upstream commit 46ef24c60f8ee70662968ac55325297ed4624d61 ] + +On some distributions, the rp_filter is automatically set (=1) by +default on a netdev basis (also on VRFs). +In an SRv6 End.DT46 behavior, decapsulated IPv4 packets are routed using +the table associated with the VRF bound to that tunnel. During lookup +operations, the rp_filter can lead to packet loss when activated on the +VRF. +Therefore, we chose to make this selftest more robust by explicitly +disabling the rp_filter during tests (as it is automatically set by some +Linux distributions). + +Fixes: 03a0b567a03d ("selftests: seg6: add selftest for SRv6 End.DT46 Behavior") +Reported-by: Hangbin Liu +Signed-off-by: Andrea Mayer +Tested-by: Hangbin Liu +Reviewed-by: David Ahern +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + .../testing/selftests/net/srv6_end_dt46_l3vpn_test.sh | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/tools/testing/selftests/net/srv6_end_dt46_l3vpn_test.sh b/tools/testing/selftests/net/srv6_end_dt46_l3vpn_test.sh +index aebaab8ce44cb..441eededa0312 100755 +--- a/tools/testing/selftests/net/srv6_end_dt46_l3vpn_test.sh ++++ b/tools/testing/selftests/net/srv6_end_dt46_l3vpn_test.sh +@@ -292,6 +292,11 @@ setup_hs() + ip netns exec ${hsname} sysctl -wq net.ipv6.conf.all.accept_dad=0 + ip netns exec ${hsname} sysctl -wq net.ipv6.conf.default.accept_dad=0 + ++ # disable the rp_filter otherwise the kernel gets confused about how ++ # to route decap ipv4 packets. ++ ip netns exec ${rtname} sysctl -wq net.ipv4.conf.all.rp_filter=0 ++ ip netns exec ${rtname} sysctl -wq net.ipv4.conf.default.rp_filter=0 ++ + ip -netns ${hsname} link add veth0 type veth peer name ${rtveth} + ip -netns ${hsname} link set ${rtveth} netns ${rtname} + ip -netns ${hsname} addr add ${IPv6_HS_NETWORK}::${hs}/64 dev veth0 nodad +@@ -316,11 +321,6 @@ setup_hs() + ip netns exec ${rtname} sysctl -wq net.ipv6.conf.${rtveth}.proxy_ndp=1 + ip netns exec ${rtname} sysctl -wq net.ipv4.conf.${rtveth}.proxy_arp=1 + +- # disable the rp_filter otherwise the kernel gets confused about how +- # to route decap ipv4 packets. +- ip netns exec ${rtname} sysctl -wq net.ipv4.conf.all.rp_filter=0 +- ip netns exec ${rtname} sysctl -wq net.ipv4.conf.${rtveth}.rp_filter=0 +- + ip netns exec ${rtname} sh -c "echo 1 > /proc/sys/net/vrf/strict_mode" + } + +-- +2.39.2 + diff --git a/queue-6.2/series b/queue-6.2/series index c24912326a6..5aa1ecf584b 100644 --- a/queue-6.2/series +++ b/queue-6.2/series @@ -17,3 +17,95 @@ kvm-x86-do-not-unload-mmu-roots-when-only-toggling-c.patch kvm-x86-make-use-of-kvm_read_cr-_bits-when-testing-b.patch kvm-vmx-make-cr0.wp-a-guest-owned-bit.patch kvm-x86-mmu-refresh-cr0.wp-prior-to-checking-for-emu.patch +rdma-rxe-remove-rxe_alloc.patch +rdma-rxe-change-rxe_dbg-to-rxe_dbg_dev.patch +rdma-rxe-extend-dbg-log-messages-to-err-and-info.patch +asoc-intel-soc-acpi-byt-fix-wm510205-match-no-longer.patch +scsi-qedi-fix-use-after-free-bug-in-qedi_remove.patch +drm-amd-display-add-missing-wa-and-mclk-validation.patch +drm-amd-display-return-error-code-on-dsc-atomic-chec.patch +drm-amd-display-fixes-for-dcn32_clk_mgr-implementati.patch +drm-amd-display-reset-outbox0-r-w-pointer-on-dmub-re.patch +drm-amd-display-do-not-clear-gpint-register-when-rel.patch +drm-amd-display-update-bounding-box-values-for-dcn32.patch +rxrpc-fix-potential-data-race-in-rxrpc_wait_to_be_co.patch +ixgbe-fix-panic-during-xdp_tx-with-64-cpus.patch +octeonxt2-af-mcs-fix-per-port-bypass-config.patch +octeontx2-af-mcs-write-tcam_data-and-tcam_mask-regis.patch +octeontx2-af-mcs-config-parser-to-skip-8b-header.patch +octeontx2-af-mcs-fix-mcs-block-interrupt.patch +octeontx2-pf-mcs-fix-null-pointer-dereferences.patch +octeontx2-pf-mcs-match-macsec-ethertype-along-with-d.patch +octeontx2-pf-mcs-clear-stats-before-freeing-resource.patch +octeontx2-pf-mcs-fix-shared-counters-logic.patch +octeontx2-pf-mcs-do-not-reset-pn-while-updating-secy.patch +net-ncsi-clear-tx-enable-mode-when-handling-a-config.patch +tcp-fix-skb_copy_ubufs-vs-big-tcp.patch +net-sched-cls_api-remove-block_cb-from-driver_list-b.patch +sit-update-dev-needed_headroom-in-ipip6_tunnel_bind_.patch +selftests-srv6-make-srv6_end_dt46_l3vpn_test-more-ro.patch +net-ipv6-fix-skb-hash-for-some-rst-packets.patch +net-dsa-mv88e6xxx-add-mv88e6321-rsvd2cpu.patch +writeback-fix-call-of-incorrect-macro.patch +block-skip-destroyed-blkg-when-restart-in-blkg_destr.patch +watchdog-dw_wdt-fix-the-error-handling-path-of-dw_wd.patch +risc-v-mm-enable-huge-page-support-to-kernel_page_pr.patch +i2c-tegra-fix-pec-support-for-smbus-block-read.patch +net-sched-act_mirred-add-carrier-check.patch +r8152-fix-flow-control-issue-of-rtl8156a.patch +r8152-fix-the-poor-throughput-for-2.5g-devices.patch +r8152-move-setting-r8153b_rx_agg_chg_indicate.patch +sfc-fix-module-eeprom-reporting-for-qsfp-modules.patch +rxrpc-fix-hard-call-timeout-units.patch +rxrpc-make-it-so-that-a-waiting-process-can-be-abort.patch +rxrpc-fix-timeout-of-a-call-that-hasn-t-yet-been-gra.patch +riscv-compat_syscall_table-fixup-compile-warning.patch +net-ethernet-mtk_eth_soc-drop-generic-vlan-rx-offloa.patch +drm-i915-mtl-add-the-missing-cpu-transcoder-mask-in-.patch +selftests-netfilter-fix-libmnl-pkg-config-usage.patch +octeontx2-af-secure-apr-table-update-with-the-lock.patch +octeontx2-af-fix-start-and-end-bit-for-scan-config.patch +octeontx2-af-fix-depth-of-cam-and-mem-table.patch +octeontx2-pf-increase-the-size-of-dmac-filter-flows.patch +octeontx2-af-add-validation-for-lmac-type.patch +octeontx2-af-update-correct-mask-to-filter-ipv4-frag.patch +octeontx2-af-update-fix-npc-field-hash-extract-featu.patch +octeontx2-af-fix-issues-with-npc-field-hash-extract.patch +octeontx2-af-skip-pfs-if-not-enabled.patch +octeontx2-pf-disable-packet-i-o-for-graceful-exit.patch +octeontx2-vf-detach-lf-resources-on-probe-cleanup.patch +ionic-remove-noise-from-ethtool-rxnfc-error-msg.patch +ethtool-fix-uninitialized-number-of-lanes.patch +ionic-catch-failure-from-devlink_alloc.patch +af_packet-don-t-send-zero-byte-data-in-packet_sendms.patch +drm-amdgpu-add-a-missing-lock-for-amdgpu_sched.patch +alsa-caiaq-input-add-error-handling-for-unsupported-.patch +kvm-s390-pv-fix-asynchronous-teardown-for-small-vms.patch +kvm-s390-fix-race-in-gmap_make_secure.patch +net-dsa-mt7530-fix-corrupt-frames-using-trgmii-on-40.patch +net-dsa-mt7530-split-off-common-parts-from-mt7531_se.patch +net-dsa-mt7530-fix-network-connectivity-with-multipl.patch +ice-block-lan-in-case-of-vf-to-vf-offload.patch +virtio_net-suppress-cpu-stall-when-free_unused_bufs.patch +net-enetc-check-the-index-of-the-sfi-rather-than-the.patch +net-fec-correct-the-counting-of-xdp-sent-frames.patch +net-bcmgenet-remove-phy_stop-from-bcmgenet_netif_sto.patch +perf-record-fix-read-lost-count-failed-msg-with-samp.patch +perf-build-support-python-perf.so-testing.patch +perf-scripts-intel-pt-events.py-fix-ipc-output-for-p.patch +perf-script-fix-python-support-when-no-libtraceevent.patch +perf-hist-improve-srcfile-sort-key-performance-reall.patch +perf-vendor-events-s390-remove-utf-8-characters-from.patch +perf-tests-record_offcpu.sh-fix-redirection-of-stder.patch +perf-ftrace-make-system-wide-the-default-target-for-.patch +perf-vendor-events-power9-remove-utf-8-characters-fr.patch +perf-pmu-zfree-expects-a-pointer-to-a-pointer-to-zer.patch +perf-map-delete-two-variable-initialisations-before-.patch +perf-cs-etm-fix-timeless-decode-mode-detection.patch +crypto-sun8i-ss-fix-a-test-in-sun8i_ss_setup_ivs.patch +crypto-api-add-scaffolding-to-change-completion-func.patch +crypto-engine-use-crypto_request_complete.patch +crypto-engine-fix-crypto_queue-backlog-handling.patch +perf-symbols-fix-return-incorrect-build_id-size-in-e.patch +perf-tracepoint-fix-memory-leak-in-is_valid_tracepoi.patch +perf-stat-separate-bperf-from-bpf_profiler.patch diff --git a/queue-6.2/sfc-fix-module-eeprom-reporting-for-qsfp-modules.patch b/queue-6.2/sfc-fix-module-eeprom-reporting-for-qsfp-modules.patch new file mode 100644 index 00000000000..d48a89cee12 --- /dev/null +++ b/queue-6.2/sfc-fix-module-eeprom-reporting-for-qsfp-modules.patch @@ -0,0 +1,59 @@ +From 4fb5055759c7c31b7927bb22762ede2eff6ac049 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 28 Apr 2023 12:33:33 +0100 +Subject: sfc: Fix module EEPROM reporting for QSFP modules + +From: Andy Moreton + +[ Upstream commit 281900a923d4c50df109b52a22ae3cdac150159b ] + +The sfc driver does not report QSFP module EEPROM contents correctly +as only the first page is fetched from hardware. + +Commit 0e1a2a3e6e7d ("ethtool: Add SFF-8436 and SFF-8636 max EEPROM +length definitions") added ETH_MODULE_SFF_8436_MAX_LEN for the overall +size of the EEPROM info, so use that to report the full EEPROM contents. + +Fixes: 9b17010da57a ("sfc: Add ethtool -m support for QSFP modules") +Signed-off-by: Andy Moreton +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/sfc/mcdi_port_common.c | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/ethernet/sfc/mcdi_port_common.c b/drivers/net/ethernet/sfc/mcdi_port_common.c +index 899cc16710048..0ab14f3d01d4d 100644 +--- a/drivers/net/ethernet/sfc/mcdi_port_common.c ++++ b/drivers/net/ethernet/sfc/mcdi_port_common.c +@@ -972,12 +972,15 @@ static u32 efx_mcdi_phy_module_type(struct efx_nic *efx) + + /* A QSFP+ NIC may actually have an SFP+ module attached. + * The ID is page 0, byte 0. ++ * QSFP28 is of type SFF_8636, however, this is treated ++ * the same by ethtool, so we can also treat them the same. + */ + switch (efx_mcdi_phy_get_module_eeprom_byte(efx, 0, 0)) { +- case 0x3: ++ case 0x3: /* SFP */ + return MC_CMD_MEDIA_SFP_PLUS; +- case 0xc: +- case 0xd: ++ case 0xc: /* QSFP */ ++ case 0xd: /* QSFP+ */ ++ case 0x11: /* QSFP28 */ + return MC_CMD_MEDIA_QSFP_PLUS; + default: + return 0; +@@ -1075,7 +1078,7 @@ int efx_mcdi_phy_get_module_info(struct efx_nic *efx, struct ethtool_modinfo *mo + + case MC_CMD_MEDIA_QSFP_PLUS: + modinfo->type = ETH_MODULE_SFF_8436; +- modinfo->eeprom_len = ETH_MODULE_SFF_8436_LEN; ++ modinfo->eeprom_len = ETH_MODULE_SFF_8436_MAX_LEN; + break; + + default: +-- +2.39.2 + diff --git a/queue-6.2/sit-update-dev-needed_headroom-in-ipip6_tunnel_bind_.patch b/queue-6.2/sit-update-dev-needed_headroom-in-ipip6_tunnel_bind_.patch new file mode 100644 index 00000000000..9267203af93 --- /dev/null +++ b/queue-6.2/sit-update-dev-needed_headroom-in-ipip6_tunnel_bind_.patch @@ -0,0 +1,69 @@ +From 52c14e273836579f8ce5310dd43dbd1d5f44aa36 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Apr 2023 23:00:06 -0700 +Subject: sit: update dev->needed_headroom in ipip6_tunnel_bind_dev() + +From: Cong Wang + +[ Upstream commit c88f8d5cd95fd039cff95d682b8e71100c001df0 ] + +When a tunnel device is bound with the underlying device, its +dev->needed_headroom needs to be updated properly. IPv4 tunnels +already do the same in ip_tunnel_bind_dev(). Otherwise we may +not have enough header room for skb, especially after commit +b17f709a2401 ("gue: TX support for using remote checksum offload option"). + +Fixes: 32b8a8e59c9c ("sit: add IPv4 over IPv4 support") +Reported-by: Palash Oswal +Link: https://lore.kernel.org/netdev/CAGyP=7fDcSPKu6nttbGwt7RXzE3uyYxLjCSE97J64pRxJP8jPA@mail.gmail.com/ +Cc: Kuniyuki Iwashima +Cc: Eric Dumazet +Signed-off-by: Cong Wang +Reviewed-by: Eric Dumazet +Reviewed-by: Kuniyuki Iwashima +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/ipv6/sit.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c +index 70d81bba50939..3ffb6a5b1f82a 100644 +--- a/net/ipv6/sit.c ++++ b/net/ipv6/sit.c +@@ -1095,12 +1095,13 @@ static netdev_tx_t sit_tunnel_xmit(struct sk_buff *skb, + + static void ipip6_tunnel_bind_dev(struct net_device *dev) + { ++ struct ip_tunnel *tunnel = netdev_priv(dev); ++ int t_hlen = tunnel->hlen + sizeof(struct iphdr); + struct net_device *tdev = NULL; +- struct ip_tunnel *tunnel; ++ int hlen = LL_MAX_HEADER; + const struct iphdr *iph; + struct flowi4 fl4; + +- tunnel = netdev_priv(dev); + iph = &tunnel->parms.iph; + + if (iph->daddr) { +@@ -1123,14 +1124,15 @@ static void ipip6_tunnel_bind_dev(struct net_device *dev) + tdev = __dev_get_by_index(tunnel->net, tunnel->parms.link); + + if (tdev && !netif_is_l3_master(tdev)) { +- int t_hlen = tunnel->hlen + sizeof(struct iphdr); + int mtu; + + mtu = tdev->mtu - t_hlen; + if (mtu < IPV6_MIN_MTU) + mtu = IPV6_MIN_MTU; + WRITE_ONCE(dev->mtu, mtu); ++ hlen = tdev->hard_header_len + tdev->needed_headroom; + } ++ dev->needed_headroom = t_hlen + hlen; + } + + static void ipip6_tunnel_update(struct ip_tunnel *t, struct ip_tunnel_parm *p, +-- +2.39.2 + diff --git a/queue-6.2/tcp-fix-skb_copy_ubufs-vs-big-tcp.patch b/queue-6.2/tcp-fix-skb_copy_ubufs-vs-big-tcp.patch new file mode 100644 index 00000000000..def2f70ff66 --- /dev/null +++ b/queue-6.2/tcp-fix-skb_copy_ubufs-vs-big-tcp.patch @@ -0,0 +1,96 @@ +From 0b476b991aa36feee8df47435754f38490081bcf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 28 Apr 2023 04:32:31 +0000 +Subject: tcp: fix skb_copy_ubufs() vs BIG TCP + +From: Eric Dumazet + +[ Upstream commit 7e692df3933628d974acb9f5b334d2b3e885e2a6 ] + +David Ahern reported crashes in skb_copy_ubufs() caused by TCP tx zerocopy +using hugepages, and skb length bigger than ~68 KB. + +skb_copy_ubufs() assumed it could copy all payload using up to +MAX_SKB_FRAGS order-0 pages. + +This assumption broke when BIG TCP was able to put up to 512 KB per skb. + +We did not hit this bug at Google because we use CONFIG_MAX_SKB_FRAGS=45 +and limit gso_max_size to 180000. + +A solution is to use higher order pages if needed. + +v2: add missing __GFP_COMP, or we leak memory. + +Fixes: 7c4e983c4f3c ("net: allow gso_max_size to exceed 65536") +Reported-by: David Ahern +Link: https://lore.kernel.org/netdev/c70000f6-baa4-4a05-46d0-4b3e0dc1ccc8@gmail.com/T/ +Signed-off-by: Eric Dumazet +Cc: Xin Long +Cc: Willem de Bruijn +Cc: Coco Li +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/core/skbuff.c | 20 ++++++++++++++------ + 1 file changed, 14 insertions(+), 6 deletions(-) + +diff --git a/net/core/skbuff.c b/net/core/skbuff.c +index 6f5ef18a8b772..ef3dd8f120e02 100644 +--- a/net/core/skbuff.c ++++ b/net/core/skbuff.c +@@ -1608,7 +1608,7 @@ int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask) + { + int num_frags = skb_shinfo(skb)->nr_frags; + struct page *page, *head = NULL; +- int i, new_frags; ++ int i, order, psize, new_frags; + u32 d_off; + + if (skb_shared(skb) || skb_unclone(skb, gfp_mask)) +@@ -1617,9 +1617,17 @@ int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask) + if (!num_frags) + goto release; + +- new_frags = (__skb_pagelen(skb) + PAGE_SIZE - 1) >> PAGE_SHIFT; ++ /* We might have to allocate high order pages, so compute what minimum ++ * page order is needed. ++ */ ++ order = 0; ++ while ((PAGE_SIZE << order) * MAX_SKB_FRAGS < __skb_pagelen(skb)) ++ order++; ++ psize = (PAGE_SIZE << order); ++ ++ new_frags = (__skb_pagelen(skb) + psize - 1) >> (PAGE_SHIFT + order); + for (i = 0; i < new_frags; i++) { +- page = alloc_page(gfp_mask); ++ page = alloc_pages(gfp_mask | __GFP_COMP, order); + if (!page) { + while (head) { + struct page *next = (struct page *)page_private(head); +@@ -1646,11 +1654,11 @@ int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask) + vaddr = kmap_atomic(p); + + while (done < p_len) { +- if (d_off == PAGE_SIZE) { ++ if (d_off == psize) { + d_off = 0; + page = (struct page *)page_private(page); + } +- copy = min_t(u32, PAGE_SIZE - d_off, p_len - done); ++ copy = min_t(u32, psize - d_off, p_len - done); + memcpy(page_address(page) + d_off, + vaddr + p_off + done, copy); + done += copy; +@@ -1666,7 +1674,7 @@ int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask) + + /* skb frags point to kernel buffers */ + for (i = 0; i < new_frags - 1; i++) { +- __skb_fill_page_desc(skb, i, head, 0, PAGE_SIZE); ++ __skb_fill_page_desc(skb, i, head, 0, psize); + head = (struct page *)page_private(head); + } + __skb_fill_page_desc(skb, new_frags - 1, head, 0, d_off); +-- +2.39.2 + diff --git a/queue-6.2/virtio_net-suppress-cpu-stall-when-free_unused_bufs.patch b/queue-6.2/virtio_net-suppress-cpu-stall-when-free_unused_bufs.patch new file mode 100644 index 00000000000..fd621f4f762 --- /dev/null +++ b/queue-6.2/virtio_net-suppress-cpu-stall-when-free_unused_bufs.patch @@ -0,0 +1,44 @@ +From e637e59bead4390d2923eb3f0a6570388728443c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 4 May 2023 10:27:06 +0800 +Subject: virtio_net: suppress cpu stall when free_unused_bufs + +From: Wenliang Wang + +[ Upstream commit f8bb5104394560e29017c25bcade4c6b7aabd108 ] + +For multi-queue and large ring-size use case, the following error +occurred when free_unused_bufs: +rcu: INFO: rcu_sched self-detected stall on CPU. + +Fixes: 986a4f4d452d ("virtio_net: multiqueue support") +Signed-off-by: Wenliang Wang +Acked-by: Michael S. Tsirkin +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/virtio_net.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c +index 0644069592211..259d54b229bf1 100644 +--- a/drivers/net/virtio_net.c ++++ b/drivers/net/virtio_net.c +@@ -3411,12 +3411,14 @@ static void free_unused_bufs(struct virtnet_info *vi) + struct virtqueue *vq = vi->sq[i].vq; + while ((buf = virtqueue_detach_unused_buf(vq)) != NULL) + virtnet_sq_free_unused_buf(vq, buf); ++ cond_resched(); + } + + for (i = 0; i < vi->max_queue_pairs; i++) { + struct virtqueue *vq = vi->rq[i].vq; + while ((buf = virtqueue_detach_unused_buf(vq)) != NULL) + virtnet_rq_free_unused_buf(vq, buf); ++ cond_resched(); + } + } + +-- +2.39.2 + diff --git a/queue-6.2/watchdog-dw_wdt-fix-the-error-handling-path-of-dw_wd.patch b/queue-6.2/watchdog-dw_wdt-fix-the-error-handling-path-of-dw_wd.patch new file mode 100644 index 00000000000..3a4db8a05ab --- /dev/null +++ b/queue-6.2/watchdog-dw_wdt-fix-the-error-handling-path-of-dw_wd.patch @@ -0,0 +1,59 @@ +From dfb4f4917a44739f31861da35f9635649896c2bc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 26 Apr 2023 08:52:48 +0200 +Subject: watchdog: dw_wdt: Fix the error handling path of dw_wdt_drv_probe() + +From: Christophe JAILLET + +[ Upstream commit 7f5390750645756bd5da2b24fac285f2654dd922 ] + +The commit in Fixes has only updated the remove function and missed the +error handling path of the probe. + +Add the missing reset_control_assert() call. + +Fixes: 65a3b6935d92 ("watchdog: dw_wdt: get reset lines from dt") +Signed-off-by: Christophe JAILLET +Reviewed-by: Philipp Zabel +Reviewed-by: Guenter Roeck +Link: https://lore.kernel.org/r/fbb650650bbb33a8fa2fd028c23157bedeed50e1.1682491863.git.christophe.jaillet@wanadoo.fr +Signed-off-by: Guenter Roeck +Signed-off-by: Wim Van Sebroeck +Signed-off-by: Sasha Levin +--- + drivers/watchdog/dw_wdt.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/watchdog/dw_wdt.c b/drivers/watchdog/dw_wdt.c +index 52962e8d11a6f..61af5d1332ac6 100644 +--- a/drivers/watchdog/dw_wdt.c ++++ b/drivers/watchdog/dw_wdt.c +@@ -635,7 +635,7 @@ static int dw_wdt_drv_probe(struct platform_device *pdev) + + ret = dw_wdt_init_timeouts(dw_wdt, dev); + if (ret) +- goto out_disable_clk; ++ goto out_assert_rst; + + wdd = &dw_wdt->wdd; + wdd->ops = &dw_wdt_ops; +@@ -666,12 +666,15 @@ static int dw_wdt_drv_probe(struct platform_device *pdev) + + ret = watchdog_register_device(wdd); + if (ret) +- goto out_disable_pclk; ++ goto out_assert_rst; + + dw_wdt_dbgfs_init(dw_wdt); + + return 0; + ++out_assert_rst: ++ reset_control_assert(dw_wdt->rst); ++ + out_disable_pclk: + clk_disable_unprepare(dw_wdt->pclk); + +-- +2.39.2 + diff --git a/queue-6.2/writeback-fix-call-of-incorrect-macro.patch b/queue-6.2/writeback-fix-call-of-incorrect-macro.patch new file mode 100644 index 00000000000..39f87c56357 --- /dev/null +++ b/queue-6.2/writeback-fix-call-of-incorrect-macro.patch @@ -0,0 +1,41 @@ +From fe783a182cd048e23d30553849cf95aa882d861d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 19 Jan 2023 13:44:43 +0300 +Subject: writeback: fix call of incorrect macro + +From: Maxim Korotkov + +[ Upstream commit 3e46c89c74f2c38e5337d2cf44b0b551adff1cb4 ] + + the variable 'history' is of type u16, it may be an error + that the hweight32 macro was used for it + I guess macro hweight16 should be used + +Found by Linux Verification Center (linuxtesting.org) with SVACE. + +Fixes: 2a81490811d0 ("writeback: implement foreign cgroup inode detection") +Signed-off-by: Maxim Korotkov +Reviewed-by: Jan Kara +Link: https://lore.kernel.org/r/20230119104443.3002-1-korotkov.maxim.s@gmail.com +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + fs/fs-writeback.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c +index 713e2d97935ff..909150a57aebb 100644 +--- a/fs/fs-writeback.c ++++ b/fs/fs-writeback.c +@@ -829,7 +829,7 @@ void wbc_detach_inode(struct writeback_control *wbc) + * is okay. The main goal is avoiding keeping an inode on + * the wrong wb for an extended period of time. + */ +- if (hweight32(history) > WB_FRN_HIST_THR_SLOTS) ++ if (hweight16(history) > WB_FRN_HIST_THR_SLOTS) + inode_switch_wbs(inode, max_id); + } + +-- +2.39.2 +