+++ /dev/null
-From 15fe393f9b9d38e2cd69c2e1a206a7ddbe6907de Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 23 May 2024 00:40:02 +0900
-Subject: af_unix: Annotate data-race around unix_sk(sk)->addr.
-
-From: Kuniyuki Iwashima <kuniyu@amazon.com>
-
-[ Upstream commit 97e1db06c7bb948da10ba85acad8030b56886593 ]
-
-Once unix_sk(sk)->addr is assigned under net->unx.table.locks and
-unix_sk(sk)->bindlock, *(unix_sk(sk)->addr) and unix_sk(sk)->path are
-fully set up, and unix_sk(sk)->addr is never changed.
-
-unix_getname() and unix_copy_addr() access the two fields locklessly,
-and commit ae3b564179bf ("missing barriers in some of unix_sock ->addr
-and ->path accesses") added smp_store_release() and smp_load_acquire()
-pairs.
-
-In other functions, we still read unix_sk(sk)->addr locklessly to check
-if the socket is bound, and KCSAN complains about it. [0]
-
-Given these functions have no dependency for *(unix_sk(sk)->addr) and
-unix_sk(sk)->path, READ_ONCE() is enough to annotate the data-race.
-
-Note that it is safe to access unix_sk(sk)->addr locklessly if the socket
-is found in the hash table. For example, the lockless read of otheru->addr
-in unix_stream_connect() is safe.
-
-Note also that newu->addr there is of the child socket that is still not
-accessible from userspace, and smp_store_release() publishes the address
-in case the socket is accept()ed and unix_getname() / unix_copy_addr()
-is called.
-
-[0]:
-BUG: KCSAN: data-race in unix_bind / unix_listen
-
-write (marked) to 0xffff88805f8d1840 of 8 bytes by task 13723 on cpu 0:
- __unix_set_addr_hash net/unix/af_unix.c:329 [inline]
- unix_bind_bsd net/unix/af_unix.c:1241 [inline]
- unix_bind+0x881/0x1000 net/unix/af_unix.c:1319
- __sys_bind+0x194/0x1e0 net/socket.c:1847
- __do_sys_bind net/socket.c:1858 [inline]
- __se_sys_bind net/socket.c:1856 [inline]
- __x64_sys_bind+0x40/0x50 net/socket.c:1856
- do_syscall_x64 arch/x86/entry/common.c:52 [inline]
- do_syscall_64+0x4f/0x110 arch/x86/entry/common.c:83
- entry_SYSCALL_64_after_hwframe+0x46/0x4e
-
-read to 0xffff88805f8d1840 of 8 bytes by task 13724 on cpu 1:
- unix_listen+0x72/0x180 net/unix/af_unix.c:734
- __sys_listen+0xdc/0x160 net/socket.c:1881
- __do_sys_listen net/socket.c:1890 [inline]
- __se_sys_listen net/socket.c:1888 [inline]
- __x64_sys_listen+0x2e/0x40 net/socket.c:1888
- do_syscall_x64 arch/x86/entry/common.c:52 [inline]
- do_syscall_64+0x4f/0x110 arch/x86/entry/common.c:83
- entry_SYSCALL_64_after_hwframe+0x46/0x4e
-
-value changed: 0x0000000000000000 -> 0xffff88807b5b1b40
-
-Reported by Kernel Concurrency Sanitizer on:
-CPU: 1 PID: 13724 Comm: syz-executor.4 Not tainted 6.8.0-12822-gcd51db110a7e #12
-Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
-
-Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
-Reported-by: syzkaller <syzkaller@googlegroups.com>
-Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
-Link: https://lore.kernel.org/r/20240522154002.77857-1-kuniyu@amazon.com
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- net/unix/af_unix.c | 10 ++++++----
- 1 file changed, 6 insertions(+), 4 deletions(-)
-
-diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
-index 6afa6d24818fb..085a1fc4934e4 100644
---- a/net/unix/af_unix.c
-+++ b/net/unix/af_unix.c
-@@ -733,7 +733,7 @@ static int unix_listen(struct socket *sock, int backlog)
- if (sock->type != SOCK_STREAM && sock->type != SOCK_SEQPACKET)
- goto out; /* Only stream/seqpacket sockets accept */
- err = -EINVAL;
-- if (!u->addr)
-+ if (!READ_ONCE(u->addr))
- goto out; /* No listens on an unbound socket */
- unix_state_lock(sk);
- if (sk->sk_state != TCP_CLOSE && sk->sk_state != TCP_LISTEN)
-@@ -1371,7 +1371,7 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr,
-
- if ((test_bit(SOCK_PASSCRED, &sock->flags) ||
- test_bit(SOCK_PASSPIDFD, &sock->flags)) &&
-- !unix_sk(sk)->addr) {
-+ !READ_ONCE(unix_sk(sk)->addr)) {
- err = unix_autobind(sk);
- if (err)
- goto out;
-@@ -1483,7 +1483,8 @@ static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr,
- goto out;
-
- if ((test_bit(SOCK_PASSCRED, &sock->flags) ||
-- test_bit(SOCK_PASSPIDFD, &sock->flags)) && !u->addr) {
-+ test_bit(SOCK_PASSPIDFD, &sock->flags)) &&
-+ !READ_ONCE(u->addr)) {
- err = unix_autobind(sk);
- if (err)
- goto out;
-@@ -1937,7 +1938,8 @@ static int unix_dgram_sendmsg(struct socket *sock, struct msghdr *msg,
- }
-
- if ((test_bit(SOCK_PASSCRED, &sock->flags) ||
-- test_bit(SOCK_PASSPIDFD, &sock->flags)) && !u->addr) {
-+ test_bit(SOCK_PASSPIDFD, &sock->flags)) &&
-+ !READ_ONCE(u->addr)) {
- err = unix_autobind(sk);
- if (err)
- goto out;
---
-2.43.0
-
+++ /dev/null
-From 240b3f424e06927aab75ce8ac20939a6f660c755 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 23 May 2024 00:42:18 +0900
-Subject: af_unix: Read sk->sk_hash under bindlock during bind().
-
-From: Kuniyuki Iwashima <kuniyu@amazon.com>
-
-[ Upstream commit 51d1b25a720982324871338b1a36b197ec9bd6f0 ]
-
-syzkaller reported data-race of sk->sk_hash in unix_autobind() [0],
-and the same ones exist in unix_bind_bsd() and unix_bind_abstract().
-
-The three bind() functions prefetch sk->sk_hash locklessly and
-use it later after validating that unix_sk(sk)->addr is NULL under
-unix_sk(sk)->bindlock.
-
-The prefetched sk->sk_hash is the hash value of unbound socket set
-in unix_create1() and does not change until bind() completes.
-
-There could be a chance that sk->sk_hash changes after the lockless
-read. However, in such a case, non-NULL unix_sk(sk)->addr is visible
-under unix_sk(sk)->bindlock, and bind() returns -EINVAL without using
-the prefetched value.
-
-The KCSAN splat is false-positive, but let's silence it by reading
-sk->sk_hash under unix_sk(sk)->bindlock.
-
-[0]:
-BUG: KCSAN: data-race in unix_autobind / unix_autobind
-
-write to 0xffff888034a9fb88 of 4 bytes by task 4468 on cpu 0:
- __unix_set_addr_hash net/unix/af_unix.c:331 [inline]
- unix_autobind+0x47a/0x7d0 net/unix/af_unix.c:1185
- unix_dgram_connect+0x7e3/0x890 net/unix/af_unix.c:1373
- __sys_connect_file+0xd7/0xe0 net/socket.c:2048
- __sys_connect+0x114/0x140 net/socket.c:2065
- __do_sys_connect net/socket.c:2075 [inline]
- __se_sys_connect net/socket.c:2072 [inline]
- __x64_sys_connect+0x40/0x50 net/socket.c:2072
- do_syscall_x64 arch/x86/entry/common.c:52 [inline]
- do_syscall_64+0x4f/0x110 arch/x86/entry/common.c:83
- entry_SYSCALL_64_after_hwframe+0x46/0x4e
-
-read to 0xffff888034a9fb88 of 4 bytes by task 4465 on cpu 1:
- unix_autobind+0x28/0x7d0 net/unix/af_unix.c:1134
- unix_dgram_connect+0x7e3/0x890 net/unix/af_unix.c:1373
- __sys_connect_file+0xd7/0xe0 net/socket.c:2048
- __sys_connect+0x114/0x140 net/socket.c:2065
- __do_sys_connect net/socket.c:2075 [inline]
- __se_sys_connect net/socket.c:2072 [inline]
- __x64_sys_connect+0x40/0x50 net/socket.c:2072
- do_syscall_x64 arch/x86/entry/common.c:52 [inline]
- do_syscall_64+0x4f/0x110 arch/x86/entry/common.c:83
- entry_SYSCALL_64_after_hwframe+0x46/0x4e
-
-value changed: 0x000000e4 -> 0x000001e3
-
-Reported by Kernel Concurrency Sanitizer on:
-CPU: 1 PID: 4465 Comm: syz-executor.0 Not tainted 6.8.0-12822-gcd51db110a7e #12
-Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
-
-Fixes: afd20b9290e1 ("af_unix: Replace the big lock with small locks.")
-Reported-by: syzkaller <syzkaller@googlegroups.com>
-Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
-Link: https://lore.kernel.org/r/20240522154218.78088-1-kuniyu@amazon.com
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- net/unix/af_unix.c | 9 ++++++---
- 1 file changed, 6 insertions(+), 3 deletions(-)
-
-diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
-index 085a1fc4934e4..51891b3db560d 100644
---- a/net/unix/af_unix.c
-+++ b/net/unix/af_unix.c
-@@ -1133,8 +1133,8 @@ static struct sock *unix_find_other(struct net *net,
-
- static int unix_autobind(struct sock *sk)
- {
-- unsigned int new_hash, old_hash = sk->sk_hash;
- struct unix_sock *u = unix_sk(sk);
-+ unsigned int new_hash, old_hash;
- struct net *net = sock_net(sk);
- struct unix_address *addr;
- u32 lastnum, ordernum;
-@@ -1157,6 +1157,7 @@ static int unix_autobind(struct sock *sk)
- addr->name->sun_family = AF_UNIX;
- refcount_set(&addr->refcnt, 1);
-
-+ old_hash = sk->sk_hash;
- ordernum = get_random_u32();
- lastnum = ordernum & 0xFFFFF;
- retry:
-@@ -1197,8 +1198,8 @@ static int unix_bind_bsd(struct sock *sk, struct sockaddr_un *sunaddr,
- {
- umode_t mode = S_IFSOCK |
- (SOCK_INODE(sk->sk_socket)->i_mode & ~current_umask());
-- unsigned int new_hash, old_hash = sk->sk_hash;
- struct unix_sock *u = unix_sk(sk);
-+ unsigned int new_hash, old_hash;
- struct net *net = sock_net(sk);
- struct mnt_idmap *idmap;
- struct unix_address *addr;
-@@ -1236,6 +1237,7 @@ static int unix_bind_bsd(struct sock *sk, struct sockaddr_un *sunaddr,
- if (u->addr)
- goto out_unlock;
-
-+ old_hash = sk->sk_hash;
- new_hash = unix_bsd_hash(d_backing_inode(dentry));
- unix_table_double_lock(net, old_hash, new_hash);
- u->path.mnt = mntget(parent.mnt);
-@@ -1263,8 +1265,8 @@ static int unix_bind_bsd(struct sock *sk, struct sockaddr_un *sunaddr,
- static int unix_bind_abstract(struct sock *sk, struct sockaddr_un *sunaddr,
- int addr_len)
- {
-- unsigned int new_hash, old_hash = sk->sk_hash;
- struct unix_sock *u = unix_sk(sk);
-+ unsigned int new_hash, old_hash;
- struct net *net = sock_net(sk);
- struct unix_address *addr;
- int err;
-@@ -1282,6 +1284,7 @@ static int unix_bind_abstract(struct sock *sk, struct sockaddr_un *sunaddr,
- goto out_mutex;
- }
-
-+ old_hash = sk->sk_hash;
- new_hash = unix_abstract_hash(addr->name, addr->len, sk->sk_type);
- unix_table_double_lock(net, old_hash, new_hash);
-
---
-2.43.0
-
+++ /dev/null
-From db864b207bedc53319561f570a11ffe206ccdb36 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 16 May 2024 22:48:35 +0900
-Subject: af_unix: Update unix_sk(sk)->oob_skb under sk_receive_queue lock.
-
-From: Kuniyuki Iwashima <kuniyu@amazon.com>
-
-[ Upstream commit 9841991a446c87f90f66f4b9fee6fe934c1336a2 ]
-
-Billy Jheng Bing-Jhong reported a race between __unix_gc() and
-queue_oob().
-
-__unix_gc() tries to garbage-collect close()d inflight sockets,
-and then if the socket has MSG_OOB in unix_sk(sk)->oob_skb, GC
-will drop the reference and set NULL to it locklessly.
-
-However, the peer socket still can send MSG_OOB message and
-queue_oob() can update unix_sk(sk)->oob_skb concurrently, leading
-NULL pointer dereference. [0]
-
-To fix the issue, let's update unix_sk(sk)->oob_skb under the
-sk_receive_queue's lock and take it everywhere we touch oob_skb.
-
-Note that we defer kfree_skb() in manage_oob() to silence lockdep
-false-positive (See [1]).
-
-[0]:
-BUG: kernel NULL pointer dereference, address: 0000000000000008
- PF: supervisor write access in kernel mode
- PF: error_code(0x0002) - not-present page
-PGD 8000000009f5e067 P4D 8000000009f5e067 PUD 9f5d067 PMD 0
-Oops: 0002 [#1] PREEMPT SMP PTI
-CPU: 3 PID: 50 Comm: kworker/3:1 Not tainted 6.9.0-rc5-00191-gd091e579b864 #110
-Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
-Workqueue: events delayed_fput
-RIP: 0010:skb_dequeue (./include/linux/skbuff.h:2386 ./include/linux/skbuff.h:2402 net/core/skbuff.c:3847)
-Code: 39 e3 74 3e 8b 43 10 48 89 ef 83 e8 01 89 43 10 49 8b 44 24 08 49 c7 44 24 08 00 00 00 00 49 8b 14 24 49 c7 04 24 00 00 00 00 <48> 89 42 08 48 89 10 e8 e7 c5 42 00 4c 89 e0 5b 5d 41 5c c3 cc cc
-RSP: 0018:ffffc900001bfd48 EFLAGS: 00000002
-RAX: 0000000000000000 RBX: ffff8880088f5ae8 RCX: 00000000361289f9
-RDX: 0000000000000000 RSI: 0000000000000206 RDI: ffff8880088f5b00
-RBP: ffff8880088f5b00 R08: 0000000000080000 R09: 0000000000000001
-R10: 0000000000000003 R11: 0000000000000001 R12: ffff8880056b6a00
-R13: ffff8880088f5280 R14: 0000000000000001 R15: ffff8880088f5a80
-FS: 0000000000000000(0000) GS:ffff88807dd80000(0000) knlGS:0000000000000000
-CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
-CR2: 0000000000000008 CR3: 0000000006314000 CR4: 00000000007506f0
-PKRU: 55555554
-Call Trace:
- <TASK>
- unix_release_sock (net/unix/af_unix.c:654)
- unix_release (net/unix/af_unix.c:1050)
- __sock_release (net/socket.c:660)
- sock_close (net/socket.c:1423)
- __fput (fs/file_table.c:423)
- delayed_fput (fs/file_table.c:444 (discriminator 3))
- process_one_work (kernel/workqueue.c:3259)
- worker_thread (kernel/workqueue.c:3329 kernel/workqueue.c:3416)
- kthread (kernel/kthread.c:388)
- ret_from_fork (arch/x86/kernel/process.c:153)
- ret_from_fork_asm (arch/x86/entry/entry_64.S:257)
- </TASK>
-Modules linked in:
-CR2: 0000000000000008
-
-Link: https://lore.kernel.org/netdev/a00d3993-c461-43f2-be6d-07259c98509a@rbox.co/ [1]
-Fixes: 1279f9d9dec2 ("af_unix: Call kfree_skb() for dead unix_(sk)->oob_skb in GC.")
-Reported-by: Billy Jheng Bing-Jhong <billy@starlabs.sg>
-Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
-Link: https://lore.kernel.org/r/20240516134835.8332-1-kuniyu@amazon.com
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- net/unix/af_unix.c | 28 ++++++++++++++++++++++------
- 1 file changed, 22 insertions(+), 6 deletions(-)
-
-diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
-index eb90a255507ef..6afa6d24818fb 100644
---- a/net/unix/af_unix.c
-+++ b/net/unix/af_unix.c
-@@ -2157,13 +2157,15 @@ static int queue_oob(struct socket *sock, struct msghdr *msg, struct sock *other
- maybe_add_creds(skb, sock, other);
- skb_get(skb);
-
-+ scm_stat_add(other, skb);
-+
-+ spin_lock(&other->sk_receive_queue.lock);
- if (ousk->oob_skb)
- consume_skb(ousk->oob_skb);
--
- WRITE_ONCE(ousk->oob_skb, skb);
-+ __skb_queue_tail(&other->sk_receive_queue, skb);
-+ spin_unlock(&other->sk_receive_queue.lock);
-
-- scm_stat_add(other, skb);
-- skb_queue_tail(&other->sk_receive_queue, skb);
- sk_send_sigurg(other);
- unix_state_unlock(other);
- other->sk_data_ready(other);
-@@ -2553,8 +2555,10 @@ static int unix_stream_recv_urg(struct unix_stream_read_state *state)
-
- mutex_lock(&u->iolock);
- unix_state_lock(sk);
-+ spin_lock(&sk->sk_receive_queue.lock);
-
- if (sock_flag(sk, SOCK_URGINLINE) || !u->oob_skb) {
-+ spin_unlock(&sk->sk_receive_queue.lock);
- unix_state_unlock(sk);
- mutex_unlock(&u->iolock);
- return -EINVAL;
-@@ -2566,6 +2570,8 @@ static int unix_stream_recv_urg(struct unix_stream_read_state *state)
- WRITE_ONCE(u->oob_skb, NULL);
- else
- skb_get(oob_skb);
-+
-+ spin_unlock(&sk->sk_receive_queue.lock);
- unix_state_unlock(sk);
-
- chunk = state->recv_actor(oob_skb, 0, chunk, state);
-@@ -2594,6 +2600,10 @@ static struct sk_buff *manage_oob(struct sk_buff *skb, struct sock *sk,
- consume_skb(skb);
- skb = NULL;
- } else {
-+ struct sk_buff *unlinked_skb = NULL;
-+
-+ spin_lock(&sk->sk_receive_queue.lock);
-+
- if (skb == u->oob_skb) {
- if (copied) {
- skb = NULL;
-@@ -2605,13 +2615,19 @@ static struct sk_buff *manage_oob(struct sk_buff *skb, struct sock *sk,
- } else if (flags & MSG_PEEK) {
- skb = NULL;
- } else {
-- skb_unlink(skb, &sk->sk_receive_queue);
-+ __skb_unlink(skb, &sk->sk_receive_queue);
- WRITE_ONCE(u->oob_skb, NULL);
-- if (!WARN_ON_ONCE(skb_unref(skb)))
-- kfree_skb(skb);
-+ unlinked_skb = skb;
- skb = skb_peek(&sk->sk_receive_queue);
- }
- }
-+
-+ spin_unlock(&sk->sk_receive_queue.lock);
-+
-+ if (unlinked_skb) {
-+ WARN_ON_ONCE(skb_unref(unlinked_skb));
-+ kfree_skb(unlinked_skb);
-+ }
- }
- return skb;
- }
---
-2.43.0
-
+++ /dev/null
-From 9cc8fd8135fb684480c7b0bb723401f1e693922c Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 24 May 2024 17:11:46 +0200
-Subject: ALSA: core: Remove debugfs at disconnection
-
-From: Takashi Iwai <tiwai@suse.de>
-
-[ Upstream commit 495000a38634e640e2fd02f7e4f1512ccc92d770 ]
-
-The card-specific debugfs entries are removed at the last stage of
-card free phase, and it's performed after synchronization of the
-closes of all opened fds. This works fine for most cases, but it can
-be potentially problematic for a hotplug device like USB-audio. Due
-to the nature of snd_card_free_when_closed(), the card free isn't
-called immediately after the driver removal for a hotplug device, but
-it's left until the last fd is closed. It implies that the card
-debugfs entries also remain. Meanwhile, when a new device is inserted
-before the last close and the very same card slot is assigned, the
-driver tries to create the card debugfs root again on the very same
-path. This conflicts with the remaining entry, and results in the
-kernel warning such as:
- debugfs: Directory 'card0' with parent 'sound' already present!
-with the missing debugfs entry afterwards.
-
-For avoiding such conflicts, remove debugfs entries at the device
-disconnection phase instead. The jack kctl debugfs entries get
-removed in snd_jack_dev_disconnect() instead of each kctl
-private_free.
-
-Fixes: 2d670ea2bd53 ("ALSA: jack: implement software jack injection via debugfs")
-Link: https://lore.kernel.org/r/20240524151256.32521-1-tiwai@suse.de
-Signed-off-by: Takashi Iwai <tiwai@suse.de>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- sound/core/init.c | 9 +++++----
- sound/core/jack.c | 21 ++++++++++++++-------
- 2 files changed, 19 insertions(+), 11 deletions(-)
-
-diff --git a/sound/core/init.c b/sound/core/init.c
-index d97b8af897ee4..b2b7e50ff4cc3 100644
---- a/sound/core/init.c
-+++ b/sound/core/init.c
-@@ -546,6 +546,11 @@ void snd_card_disconnect(struct snd_card *card)
- synchronize_irq(card->sync_irq);
-
- snd_info_card_disconnect(card);
-+#ifdef CONFIG_SND_DEBUG
-+ debugfs_remove(card->debugfs_root);
-+ card->debugfs_root = NULL;
-+#endif
-+
- if (card->registered) {
- device_del(&card->card_dev);
- card->registered = false;
-@@ -598,10 +603,6 @@ static int snd_card_do_free(struct snd_card *card)
- dev_warn(card->dev, "unable to free card info\n");
- /* Not fatal error */
- }
--#ifdef CONFIG_SND_DEBUG
-- debugfs_remove(card->debugfs_root);
-- card->debugfs_root = NULL;
--#endif
- if (card->release_completion)
- complete(card->release_completion);
- if (!card->managed)
-diff --git a/sound/core/jack.c b/sound/core/jack.c
-index e08b2c4fbd1a5..e4bcecdf89b7e 100644
---- a/sound/core/jack.c
-+++ b/sound/core/jack.c
-@@ -37,11 +37,15 @@ static const int jack_switch_types[SND_JACK_SWITCH_TYPES] = {
- };
- #endif /* CONFIG_SND_JACK_INPUT_DEV */
-
-+static void snd_jack_remove_debugfs(struct snd_jack *jack);
-+
- static int snd_jack_dev_disconnect(struct snd_device *device)
- {
--#ifdef CONFIG_SND_JACK_INPUT_DEV
- struct snd_jack *jack = device->device_data;
-
-+ snd_jack_remove_debugfs(jack);
-+
-+#ifdef CONFIG_SND_JACK_INPUT_DEV
- guard(mutex)(&jack->input_dev_lock);
- if (!jack->input_dev)
- return 0;
-@@ -381,10 +385,14 @@ static int snd_jack_debugfs_add_inject_node(struct snd_jack *jack,
- return 0;
- }
-
--static void snd_jack_debugfs_clear_inject_node(struct snd_jack_kctl *jack_kctl)
-+static void snd_jack_remove_debugfs(struct snd_jack *jack)
- {
-- debugfs_remove(jack_kctl->jack_debugfs_root);
-- jack_kctl->jack_debugfs_root = NULL;
-+ struct snd_jack_kctl *jack_kctl;
-+
-+ list_for_each_entry(jack_kctl, &jack->kctl_list, list) {
-+ debugfs_remove(jack_kctl->jack_debugfs_root);
-+ jack_kctl->jack_debugfs_root = NULL;
-+ }
- }
- #else /* CONFIG_SND_JACK_INJECTION_DEBUG */
- static int snd_jack_debugfs_add_inject_node(struct snd_jack *jack,
-@@ -393,7 +401,7 @@ static int snd_jack_debugfs_add_inject_node(struct snd_jack *jack,
- return 0;
- }
-
--static void snd_jack_debugfs_clear_inject_node(struct snd_jack_kctl *jack_kctl)
-+static void snd_jack_remove_debugfs(struct snd_jack *jack)
- {
- }
- #endif /* CONFIG_SND_JACK_INJECTION_DEBUG */
-@@ -404,7 +412,6 @@ static void snd_jack_kctl_private_free(struct snd_kcontrol *kctl)
-
- jack_kctl = kctl->private_data;
- if (jack_kctl) {
-- snd_jack_debugfs_clear_inject_node(jack_kctl);
- list_del(&jack_kctl->list);
- kfree(jack_kctl);
- }
-@@ -497,8 +504,8 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
- .dev_free = snd_jack_dev_free,
- #ifdef CONFIG_SND_JACK_INPUT_DEV
- .dev_register = snd_jack_dev_register,
-- .dev_disconnect = snd_jack_dev_disconnect,
- #endif /* CONFIG_SND_JACK_INPUT_DEV */
-+ .dev_disconnect = snd_jack_dev_disconnect,
- };
-
- if (initial_kctl) {
---
-2.43.0
-
+++ /dev/null
-From d91144d10d38b1d9bf532a5094b6b7e0cbe3d2f8 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 8 May 2024 11:08:11 +0100
-Subject: ALSA: hda: cs35l56: Fix lifetime of cs_dsp instance
-
-From: Richard Fitzgerald <rf@opensource.cirrus.com>
-
-[ Upstream commit d344873c4cbde249b7152d36a273bcc45864001e ]
-
-The cs_dsp instance is initialized in the driver probe() so it
-should be freed in the driver remove(). Also fix a missing call
-to cs_dsp_remove() in the error path of cs35l56_hda_common_probe().
-
-The call to cs_dsp_remove() was being done in the component unbind
-callback cs35l56_hda_unbind(). This meant that if the driver was
-unbound and then re-bound it would be using an uninitialized cs_dsp
-instance.
-
-It is best to initialize the cs_dsp instance in probe() so that it
-can return an error if it fails. The component binding API doesn't
-have any error handling so there's no way to handle a failure if
-cs_dsp was initialized in the bind.
-
-Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
-Fixes: 73cfbfa9caea ("ALSA: hda/cs35l56: Add driver for Cirrus Logic CS35L56 amplifier")
-Link: https://lore.kernel.org/r/20240508100811.49514-1-rf@opensource.cirrus.com
-Signed-off-by: Takashi Iwai <tiwai@suse.de>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- sound/pci/hda/cs35l56_hda.c | 8 +++++---
- 1 file changed, 5 insertions(+), 3 deletions(-)
-
-diff --git a/sound/pci/hda/cs35l56_hda.c b/sound/pci/hda/cs35l56_hda.c
-index de58a953b48d2..55f217874da67 100644
---- a/sound/pci/hda/cs35l56_hda.c
-+++ b/sound/pci/hda/cs35l56_hda.c
-@@ -712,8 +712,6 @@ static void cs35l56_hda_unbind(struct device *dev, struct device *master, void *
- if (cs35l56->base.fw_patched)
- cs_dsp_power_down(&cs35l56->cs_dsp);
-
-- cs_dsp_remove(&cs35l56->cs_dsp);
--
- if (comps[cs35l56->index].dev == dev)
- memset(&comps[cs35l56->index], 0, sizeof(*comps));
-
-@@ -1007,7 +1005,7 @@ int cs35l56_hda_common_probe(struct cs35l56_hda *cs35l56, int id)
- ARRAY_SIZE(cs35l56_hda_dai_config));
- ret = cs35l56_force_sync_asp1_registers_from_cache(&cs35l56->base);
- if (ret)
-- goto err;
-+ goto dsp_err;
-
- /*
- * By default only enable one ASP1TXn, where n=amplifier index,
-@@ -1033,6 +1031,8 @@ int cs35l56_hda_common_probe(struct cs35l56_hda *cs35l56, int id)
-
- pm_err:
- pm_runtime_disable(cs35l56->base.dev);
-+dsp_err:
-+ cs_dsp_remove(&cs35l56->cs_dsp);
- err:
- gpiod_set_value_cansleep(cs35l56->base.reset_gpio, 0);
-
-@@ -1050,6 +1050,8 @@ void cs35l56_hda_remove(struct device *dev)
-
- component_del(cs35l56->base.dev, &cs35l56_hda_comp_ops);
-
-+ cs_dsp_remove(&cs35l56->cs_dsp);
-+
- kfree(cs35l56->system_name);
- pm_runtime_put_noidle(cs35l56->base.dev);
-
---
-2.43.0
-
+++ /dev/null
-From 69092832b1048e3a13bc6b9388fae7632790c9e1 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 8 May 2024 10:56:27 +0100
-Subject: ALSA: hda/cs_dsp_ctl: Use private_free for control cleanup
-
-From: Richard Fitzgerald <rf@opensource.cirrus.com>
-
-[ Upstream commit 172811e3a557d8681a5e2d0f871dc04a2d17eb13 ]
-
-Use the control private_free callback to free the associated data
-block. This ensures that the memory won't leak, whatever way the
-control gets destroyed.
-
-The original implementation didn't actually remove the ALSA
-controls in hda_cs_dsp_control_remove(). It only freed the internal
-tracking structure. This meant it was possible to remove/unload the
-amp driver while leaving its ALSA controls still present in the
-soundcard. Obviously attempting to access them could cause segfaults
-or at least dereferencing stale pointers.
-
-Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
-Fixes: 3233b978af23 ("ALSA: hda: hda_cs_dsp_ctl: Add Library to support CS_DSP ALSA controls")
-Link: https://lore.kernel.org/r/20240508095627.44476-1-rf@opensource.cirrus.com
-Signed-off-by: Takashi Iwai <tiwai@suse.de>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- sound/pci/hda/hda_cs_dsp_ctl.c | 47 ++++++++++++++++++++++------------
- 1 file changed, 31 insertions(+), 16 deletions(-)
-
-diff --git a/sound/pci/hda/hda_cs_dsp_ctl.c b/sound/pci/hda/hda_cs_dsp_ctl.c
-index 463ca06036bfe..9db45d7c17e5f 100644
---- a/sound/pci/hda/hda_cs_dsp_ctl.c
-+++ b/sound/pci/hda/hda_cs_dsp_ctl.c
-@@ -8,6 +8,7 @@
-
- #include <linux/module.h>
- #include <sound/soc.h>
-+#include <linux/cleanup.h>
- #include <linux/firmware/cirrus/cs_dsp.h>
- #include <linux/firmware/cirrus/wmfw.h>
- #include "hda_cs_dsp_ctl.h"
-@@ -97,11 +98,23 @@ static unsigned int wmfw_convert_flags(unsigned int in)
- return out;
- }
-
--static void hda_cs_dsp_add_kcontrol(struct hda_cs_dsp_coeff_ctl *ctl, const char *name)
-+static void hda_cs_dsp_free_kcontrol(struct snd_kcontrol *kctl)
- {
-+ struct hda_cs_dsp_coeff_ctl *ctl = (struct hda_cs_dsp_coeff_ctl *)snd_kcontrol_chip(kctl);
- struct cs_dsp_coeff_ctl *cs_ctl = ctl->cs_ctl;
-+
-+ /* NULL priv to prevent a double-free in hda_cs_dsp_control_remove() */
-+ cs_ctl->priv = NULL;
-+ kfree(ctl);
-+}
-+
-+static void hda_cs_dsp_add_kcontrol(struct cs_dsp_coeff_ctl *cs_ctl,
-+ const struct hda_cs_dsp_ctl_info *info,
-+ const char *name)
-+{
- struct snd_kcontrol_new kcontrol = {0};
- struct snd_kcontrol *kctl;
-+ struct hda_cs_dsp_coeff_ctl *ctl __free(kfree) = NULL;
- int ret = 0;
-
- if (cs_ctl->len > ADSP_MAX_STD_CTRL_SIZE) {
-@@ -110,6 +123,13 @@ static void hda_cs_dsp_add_kcontrol(struct hda_cs_dsp_coeff_ctl *ctl, const char
- return;
- }
-
-+ ctl = kzalloc(sizeof(*ctl), GFP_KERNEL);
-+ if (!ctl)
-+ return;
-+
-+ ctl->cs_ctl = cs_ctl;
-+ ctl->card = info->card;
-+
- kcontrol.name = name;
- kcontrol.info = hda_cs_dsp_coeff_info;
- kcontrol.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
-@@ -117,20 +137,22 @@ static void hda_cs_dsp_add_kcontrol(struct hda_cs_dsp_coeff_ctl *ctl, const char
- kcontrol.get = hda_cs_dsp_coeff_get;
- kcontrol.put = hda_cs_dsp_coeff_put;
-
-- /* Save ctl inside private_data, ctl is owned by cs_dsp,
-- * and will be freed when cs_dsp removes the control */
- kctl = snd_ctl_new1(&kcontrol, (void *)ctl);
- if (!kctl)
- return;
-
-- ret = snd_ctl_add(ctl->card, kctl);
-+ kctl->private_free = hda_cs_dsp_free_kcontrol;
-+ ctl->kctl = kctl;
-+
-+ /* snd_ctl_add() calls our private_free on error, which will kfree(ctl) */
-+ cs_ctl->priv = no_free_ptr(ctl);
-+ ret = snd_ctl_add(info->card, kctl);
- if (ret) {
- dev_err(cs_ctl->dsp->dev, "Failed to add KControl %s = %d\n", kcontrol.name, ret);
- return;
- }
-
- dev_dbg(cs_ctl->dsp->dev, "Added KControl: %s\n", kcontrol.name);
-- ctl->kctl = kctl;
- }
-
- static void hda_cs_dsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl,
-@@ -138,7 +160,6 @@ static void hda_cs_dsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl,
- {
- struct cs_dsp *cs_dsp = cs_ctl->dsp;
- char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
-- struct hda_cs_dsp_coeff_ctl *ctl;
- const char *region_name;
- int ret;
-
-@@ -163,15 +184,7 @@ static void hda_cs_dsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl,
- " %.*s", cs_ctl->subname_len - skip, cs_ctl->subname + skip);
- }
-
-- ctl = kzalloc(sizeof(*ctl), GFP_KERNEL);
-- if (!ctl)
-- return;
--
-- ctl->cs_ctl = cs_ctl;
-- ctl->card = info->card;
-- cs_ctl->priv = ctl;
--
-- hda_cs_dsp_add_kcontrol(ctl, name);
-+ hda_cs_dsp_add_kcontrol(cs_ctl, info, name);
- }
-
- void hda_cs_dsp_add_controls(struct cs_dsp *dsp, const struct hda_cs_dsp_ctl_info *info)
-@@ -203,7 +216,9 @@ void hda_cs_dsp_control_remove(struct cs_dsp_coeff_ctl *cs_ctl)
- {
- struct hda_cs_dsp_coeff_ctl *ctl = cs_ctl->priv;
-
-- kfree(ctl);
-+ /* ctl and kctl may already have been removed by ALSA private_free */
-+ if (ctl && ctl->kctl)
-+ snd_ctl_remove(ctl->card, ctl->kctl);
- }
- EXPORT_SYMBOL_NS_GPL(hda_cs_dsp_control_remove, SND_HDA_CS_DSP_CONTROLS);
-
---
-2.43.0
-
+++ /dev/null
-From c669b215ac50b3e67e6631bd5f22b5455f5d2b8e Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sun, 26 May 2024 21:10:32 +1200
-Subject: ALSA: hda/realtek: Adjust G814JZR to use SPI init for amp
-
-From: Luke D. Jones <luke@ljones.dev>
-
-[ Upstream commit 2be46155d792d629e8fe3188c2cde176833afe36 ]
-
-The 2024 ASUS ROG G814J model is much the same as the 2023 model
-and the 2023 16" version. We can use the same Cirrus Amp quirk.
-
-Fixes: 811dd426a9b1 ("ALSA: hda/realtek: Add quirks for Asus ROG 2024 laptops using CS35L41")
-Signed-off-by: Luke D. Jones <luke@ljones.dev>
-Link: https://lore.kernel.org/r/20240526091032.114545-1-luke@ljones.dev
-Signed-off-by: Takashi Iwai <tiwai@suse.de>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- sound/pci/hda/patch_realtek.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
-index c0e12e6746922..9a2cc048668ca 100644
---- a/sound/pci/hda/patch_realtek.c
-+++ b/sound/pci/hda/patch_realtek.c
-@@ -10196,7 +10196,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
- SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
- SND_PCI_QUIRK(0x1043, 0x3a20, "ASUS G614JZR", ALC245_FIXUP_CS35L41_SPI_2),
- SND_PCI_QUIRK(0x1043, 0x3a30, "ASUS G814JVR/JIR", ALC245_FIXUP_CS35L41_SPI_2),
-- SND_PCI_QUIRK(0x1043, 0x3a40, "ASUS G814JZR", ALC245_FIXUP_CS35L41_SPI_2),
-+ SND_PCI_QUIRK(0x1043, 0x3a40, "ASUS G814JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
- SND_PCI_QUIRK(0x1043, 0x3a50, "ASUS G834JYR/JZR", ALC245_FIXUP_CS35L41_SPI_2),
- SND_PCI_QUIRK(0x1043, 0x3a60, "ASUS G634JYR/JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),
- SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
---
-2.43.0
-
+++ /dev/null
-From 3bc83b4c289f55adc4baea93404971ca99b7dbd6 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 27 Feb 2024 09:52:52 +0100
-Subject: ALSA: jack: Use guard() for locking
-
-From: Takashi Iwai <tiwai@suse.de>
-
-[ Upstream commit 7234795b59f7b0b14569ec46dce56300a4988067 ]
-
-We can simplify the code gracefully with new guard() macro and co for
-automatic cleanup of locks.
-
-Only the code refactoring, and no functional changes.
-
-Signed-off-by: Takashi Iwai <tiwai@suse.de>
-Link: https://lore.kernel.org/r/20240227085306.9764-11-tiwai@suse.de
-Stable-dep-of: 495000a38634 ("ALSA: core: Remove debugfs at disconnection")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- sound/core/jack.c | 25 +++++++------------------
- 1 file changed, 7 insertions(+), 18 deletions(-)
-
-diff --git a/sound/core/jack.c b/sound/core/jack.c
-index e0f034e7275cd..e08b2c4fbd1a5 100644
---- a/sound/core/jack.c
-+++ b/sound/core/jack.c
-@@ -42,11 +42,9 @@ static int snd_jack_dev_disconnect(struct snd_device *device)
- #ifdef CONFIG_SND_JACK_INPUT_DEV
- struct snd_jack *jack = device->device_data;
-
-- mutex_lock(&jack->input_dev_lock);
-- if (!jack->input_dev) {
-- mutex_unlock(&jack->input_dev_lock);
-+ guard(mutex)(&jack->input_dev_lock);
-+ if (!jack->input_dev)
- return 0;
-- }
-
- /* If the input device is registered with the input subsystem
- * then we need to use a different deallocator. */
-@@ -55,7 +53,6 @@ static int snd_jack_dev_disconnect(struct snd_device *device)
- else
- input_free_device(jack->input_dev);
- jack->input_dev = NULL;
-- mutex_unlock(&jack->input_dev_lock);
- #endif /* CONFIG_SND_JACK_INPUT_DEV */
- return 0;
- }
-@@ -92,11 +89,9 @@ static int snd_jack_dev_register(struct snd_device *device)
- snprintf(jack->name, sizeof(jack->name), "%s %s",
- card->shortname, jack->id);
-
-- mutex_lock(&jack->input_dev_lock);
-- if (!jack->input_dev) {
-- mutex_unlock(&jack->input_dev_lock);
-+ guard(mutex)(&jack->input_dev_lock);
-+ if (!jack->input_dev)
- return 0;
-- }
-
- jack->input_dev->name = jack->name;
-
-@@ -121,7 +116,6 @@ static int snd_jack_dev_register(struct snd_device *device)
- if (err == 0)
- jack->registered = 1;
-
-- mutex_unlock(&jack->input_dev_lock);
- return err;
- }
- #endif /* CONFIG_SND_JACK_INPUT_DEV */
-@@ -586,14 +580,9 @@ EXPORT_SYMBOL(snd_jack_new);
- void snd_jack_set_parent(struct snd_jack *jack, struct device *parent)
- {
- WARN_ON(jack->registered);
-- mutex_lock(&jack->input_dev_lock);
-- if (!jack->input_dev) {
-- mutex_unlock(&jack->input_dev_lock);
-- return;
-- }
--
-- jack->input_dev->dev.parent = parent;
-- mutex_unlock(&jack->input_dev_lock);
-+ guard(mutex)(&jack->input_dev_lock);
-+ if (jack->input_dev)
-+ jack->input_dev->dev.parent = parent;
- }
- EXPORT_SYMBOL(snd_jack_set_parent);
-
---
-2.43.0
-
+++ /dev/null
-From 350881d0dd7c9cd258a4d04bd863d1d89478d1c0 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 27 May 2024 17:18:50 +0200
-Subject: ALSA: seq: Don't clear bank selection at event -> UMP MIDI2
- conversion
-
-From: Takashi Iwai <tiwai@suse.de>
-
-[ Upstream commit a200df7deb3186cd7b55abb77ab96dfefb8a4f09 ]
-
-The current code to convert from a legacy sequencer event to UMP MIDI2
-clears the bank selection at each time the program change is
-submitted. This is confusing and may lead to incorrect bank values
-tranmitted to the destination in the end.
-
-Drop the line to clear the bank info and keep the provided values.
-
-Fixes: e9e02819a98a ("ALSA: seq: Automatic conversion of UMP events")
-Link: https://lore.kernel.org/r/20240527151852.29036-2-tiwai@suse.de
-Signed-off-by: Takashi Iwai <tiwai@suse.de>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- sound/core/seq/seq_ump_convert.c | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/sound/core/seq/seq_ump_convert.c b/sound/core/seq/seq_ump_convert.c
-index c21be87f5da9e..f5d22dd008426 100644
---- a/sound/core/seq/seq_ump_convert.c
-+++ b/sound/core/seq/seq_ump_convert.c
-@@ -892,7 +892,6 @@ static int pgm_ev_to_ump_midi2(const struct snd_seq_event *event,
- data->pg.bank_msb = cc->cc_bank_msb;
- data->pg.bank_lsb = cc->cc_bank_lsb;
- cc->bank_set = 0;
-- cc->cc_bank_msb = cc->cc_bank_lsb = 0;
- }
- return 1;
- }
---
-2.43.0
-
+++ /dev/null
-From 16765adcdc88f2e63273e1419f45e801971c5a07 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 27 May 2024 17:18:49 +0200
-Subject: ALSA: seq: Fix missing bank setup between MIDI1/MIDI2 UMP conversion
-
-From: Takashi Iwai <tiwai@suse.de>
-
-[ Upstream commit 8a42886cae307663f3f999846926bd6e64392000 ]
-
-When a UMP packet is converted between MIDI1 and MIDI2 protocols, the
-bank selection may be lost. The conversion from MIDI1 to MIDI2 needs
-the encoding of the bank into UMP_MSG_STATUS_PROGRAM bits, while the
-conversion from MIDI2 to MIDI1 needs the extraction from that
-instead.
-
-This patch implements the missing bank selection mechanism in those
-conversions.
-
-Fixes: e9e02819a98a ("ALSA: seq: Automatic conversion of UMP events")
-Link: https://lore.kernel.org/r/20240527151852.29036-1-tiwai@suse.de
-Signed-off-by: Takashi Iwai <tiwai@suse.de>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- sound/core/seq/seq_ump_convert.c | 38 ++++++++++++++++++++++++++++++++
- 1 file changed, 38 insertions(+)
-
-diff --git a/sound/core/seq/seq_ump_convert.c b/sound/core/seq/seq_ump_convert.c
-index ee6ac649df836..c21be87f5da9e 100644
---- a/sound/core/seq/seq_ump_convert.c
-+++ b/sound/core/seq/seq_ump_convert.c
-@@ -368,6 +368,7 @@ static int cvt_ump_midi1_to_midi2(struct snd_seq_client *dest,
- struct snd_seq_ump_event ev_cvt;
- const union snd_ump_midi1_msg *midi1 = (const union snd_ump_midi1_msg *)event->ump;
- union snd_ump_midi2_msg *midi2 = (union snd_ump_midi2_msg *)ev_cvt.ump;
-+ struct snd_seq_ump_midi2_bank *cc;
-
- ev_cvt = *event;
- memset(&ev_cvt.ump, 0, sizeof(ev_cvt.ump));
-@@ -387,11 +388,29 @@ static int cvt_ump_midi1_to_midi2(struct snd_seq_client *dest,
- midi2->paf.data = upscale_7_to_32bit(midi1->paf.data);
- break;
- case UMP_MSG_STATUS_CC:
-+ cc = &dest_port->midi2_bank[midi1->note.channel];
-+ switch (midi1->cc.index) {
-+ case UMP_CC_BANK_SELECT:
-+ cc->bank_set = 1;
-+ cc->cc_bank_msb = midi1->cc.data;
-+ return 0; // skip
-+ case UMP_CC_BANK_SELECT_LSB:
-+ cc->bank_set = 1;
-+ cc->cc_bank_lsb = midi1->cc.data;
-+ return 0; // skip
-+ }
- midi2->cc.index = midi1->cc.index;
- midi2->cc.data = upscale_7_to_32bit(midi1->cc.data);
- break;
- case UMP_MSG_STATUS_PROGRAM:
- midi2->pg.program = midi1->pg.program;
-+ cc = &dest_port->midi2_bank[midi1->note.channel];
-+ if (cc->bank_set) {
-+ midi2->pg.bank_valid = 1;
-+ midi2->pg.bank_msb = cc->cc_bank_msb;
-+ midi2->pg.bank_lsb = cc->cc_bank_lsb;
-+ cc->bank_set = 0;
-+ }
- break;
- case UMP_MSG_STATUS_CHANNEL_PRESSURE:
- midi2->caf.data = upscale_7_to_32bit(midi1->caf.data);
-@@ -419,6 +438,7 @@ static int cvt_ump_midi2_to_midi1(struct snd_seq_client *dest,
- struct snd_seq_ump_event ev_cvt;
- union snd_ump_midi1_msg *midi1 = (union snd_ump_midi1_msg *)ev_cvt.ump;
- const union snd_ump_midi2_msg *midi2 = (const union snd_ump_midi2_msg *)event->ump;
-+ int err;
- u16 v;
-
- ev_cvt = *event;
-@@ -443,6 +463,24 @@ static int cvt_ump_midi2_to_midi1(struct snd_seq_client *dest,
- midi1->cc.data = downscale_32_to_7bit(midi2->cc.data);
- break;
- case UMP_MSG_STATUS_PROGRAM:
-+ if (midi2->pg.bank_valid) {
-+ midi1->cc.status = UMP_MSG_STATUS_CC;
-+ midi1->cc.index = UMP_CC_BANK_SELECT;
-+ midi1->cc.data = midi2->pg.bank_msb;
-+ err = __snd_seq_deliver_single_event(dest, dest_port,
-+ (struct snd_seq_event *)&ev_cvt,
-+ atomic, hop);
-+ if (err < 0)
-+ return err;
-+ midi1->cc.index = UMP_CC_BANK_SELECT_LSB;
-+ midi1->cc.data = midi2->pg.bank_lsb;
-+ err = __snd_seq_deliver_single_event(dest, dest_port,
-+ (struct snd_seq_event *)&ev_cvt,
-+ atomic, hop);
-+ if (err < 0)
-+ return err;
-+ midi1->note.status = midi2->note.status;
-+ }
- midi1->pg.program = midi2->pg.program;
- break;
- case UMP_MSG_STATUS_CHANNEL_PRESSURE:
---
-2.43.0
-
+++ /dev/null
-From 4f5b91e48a720e347339b98e2e1b98ab49b81e34 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 30 May 2024 12:10:43 +0200
-Subject: ALSA: seq: Fix yet another spot for system message conversion
-
-From: Takashi Iwai <tiwai@suse.de>
-
-[ Upstream commit 700fe6fd093d08c6da2bda8efe00479b0e617327 ]
-
-We fixed the incorrect UMP type for system messages in the recent
-commit, but it missed one place in system_ev_to_ump_midi1().
-Fix it now.
-
-Fixes: e9e02819a98a ("ALSA: seq: Automatic conversion of UMP events")
-Fixes: c2bb79613fed ("ALSA: seq: Fix incorrect UMP type for system messages")
-Link: https://lore.kernel.org/r/20240530101044.17524-1-tiwai@suse.de
-Signed-off-by: Takashi Iwai <tiwai@suse.de>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- sound/core/seq/seq_ump_convert.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/sound/core/seq/seq_ump_convert.c b/sound/core/seq/seq_ump_convert.c
-index f5d22dd008426..903a644b80e25 100644
---- a/sound/core/seq/seq_ump_convert.c
-+++ b/sound/core/seq/seq_ump_convert.c
-@@ -729,6 +729,7 @@ static int system_ev_to_ump_midi1(const struct snd_seq_event *event,
- union snd_ump_midi1_msg *data,
- unsigned char status)
- {
-+ data->system.type = UMP_MSG_TYPE_SYSTEM; // override
- data->system.status = status;
- return 1;
- }
---
-2.43.0
-
+++ /dev/null
-From 26726de0a606dad99e9e07b172b491b924b3d9f0 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 31 May 2024 09:51:07 +0200
-Subject: ALSA: seq: ump: Fix swapped song position pointer data
-
-From: Takashi Iwai <tiwai@suse.de>
-
-[ Upstream commit 310fa3ec2859f1c094e6e9b5d2e1ca51738c409a ]
-
-At converting between the legacy event and UMP, the parameters for
-MIDI Song Position Pointer are incorrectly stored. It should have
-been LSB -> MSB order while it stored in MSB -> LSB order.
-This patch corrects the ordering.
-
-Fixes: e9e02819a98a ("ALSA: seq: Automatic conversion of UMP events")
-Link: https://lore.kernel.org/r/20240531075110.3250-1-tiwai@suse.de
-Signed-off-by: Takashi Iwai <tiwai@suse.de>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- sound/core/seq/seq_ump_convert.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/sound/core/seq/seq_ump_convert.c b/sound/core/seq/seq_ump_convert.c
-index 903a644b80e25..9bfba69b2a709 100644
---- a/sound/core/seq/seq_ump_convert.c
-+++ b/sound/core/seq/seq_ump_convert.c
-@@ -157,7 +157,7 @@ static void ump_system_to_one_param_ev(const union snd_ump_midi1_msg *val,
- static void ump_system_to_songpos_ev(const union snd_ump_midi1_msg *val,
- struct snd_seq_event *ev)
- {
-- ev->data.control.value = (val->system.parm1 << 7) | val->system.parm2;
-+ ev->data.control.value = (val->system.parm2 << 7) | val->system.parm1;
- }
-
- /* Encoders for 0xf0 - 0xff */
-@@ -752,8 +752,8 @@ static int system_2p_ev_to_ump_midi1(const struct snd_seq_event *event,
- unsigned char status)
- {
- data->system.status = status;
-- data->system.parm1 = (event->data.control.value >> 7) & 0x7f;
-- data->system.parm2 = event->data.control.value & 0x7f;
-+ data->system.parm1 = event->data.control.value & 0x7f;
-+ data->system.parm2 = (event->data.control.value >> 7) & 0x7f;
- return 1;
- }
-
---
-2.43.0
-
+++ /dev/null
-From d717dbdb94145bee1e9cf9eca387d973564203c4 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 14 May 2024 20:27:36 +0200
-Subject: ALSA: timer: Set lower bound of start tick time
-
-From: Takashi Iwai <tiwai@suse.de>
-
-[ Upstream commit 4a63bd179fa8d3fcc44a0d9d71d941ddd62f0c4e ]
-
-Currently ALSA timer doesn't have the lower limit of the start tick
-time, and it allows a very small size, e.g. 1 tick with 1ns resolution
-for hrtimer. Such a situation may lead to an unexpected RCU stall,
-where the callback repeatedly queuing the expire update, as reported
-by fuzzer.
-
-This patch introduces a sanity check of the timer start tick time, so
-that the system returns an error when a too small start size is set.
-As of this patch, the lower limit is hard-coded to 100us, which is
-small enough but can still work somehow.
-
-Reported-by: syzbot+43120c2af6ca2938cc38@syzkaller.appspotmail.com
-Closes: https://lore.kernel.org/r/000000000000fa00a1061740ab6d@google.com
-Cc: <stable@vger.kernel.org>
-Link: https://lore.kernel.org/r/20240514182745.4015-1-tiwai@suse.de
-Signed-off-by: Takashi Iwai <tiwai@suse.de>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- sound/core/timer.c | 8 ++++++++
- 1 file changed, 8 insertions(+)
-
-diff --git a/sound/core/timer.c b/sound/core/timer.c
-index e6e551d4a29e0..42c4c2b029526 100644
---- a/sound/core/timer.c
-+++ b/sound/core/timer.c
-@@ -553,6 +553,14 @@ static int snd_timer_start1(struct snd_timer_instance *timeri,
- goto unlock;
- }
-
-+ /* check the actual time for the start tick;
-+ * bail out as error if it's way too low (< 100us)
-+ */
-+ if (start) {
-+ if ((u64)snd_timer_hw_resolution(timer) * ticks < 100000)
-+ return -EINVAL;
-+ }
-+
- if (start)
- timeri->ticks = timeri->cticks = ticks;
- else if (!timeri->cticks)
---
-2.43.0
-
+++ /dev/null
-From a6e08454ce9a1f00afb84d6765e055764c2c7ccf Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 20 May 2024 21:34:37 +0800
-Subject: arm64: asm-bug: Add .align 2 to the end of __BUG_ENTRY
-
-From: Jiangfeng Xiao <xiaojiangfeng@huawei.com>
-
-[ Upstream commit ffbf4fb9b5c12ff878a10ea17997147ea4ebea6f ]
-
-When CONFIG_DEBUG_BUGVERBOSE=n, we fail to add necessary padding bytes
-to bug_table entries, and as a result the last entry in a bug table will
-be ignored, potentially leading to an unexpected panic(). All prior
-entries in the table will be handled correctly.
-
-The arm64 ABI requires that struct fields of up to 8 bytes are
-naturally-aligned, with padding added within a struct such that struct
-are suitably aligned within arrays.
-
-When CONFIG_DEBUG_BUGVERPOSE=y, the layout of a bug_entry is:
-
- struct bug_entry {
- signed int bug_addr_disp; // 4 bytes
- signed int file_disp; // 4 bytes
- unsigned short line; // 2 bytes
- unsigned short flags; // 2 bytes
- }
-
-... with 12 bytes total, requiring 4-byte alignment.
-
-When CONFIG_DEBUG_BUGVERBOSE=n, the layout of a bug_entry is:
-
- struct bug_entry {
- signed int bug_addr_disp; // 4 bytes
- unsigned short flags; // 2 bytes
- < implicit padding > // 2 bytes
- }
-
-... with 8 bytes total, with 6 bytes of data and 2 bytes of trailing
-padding, requiring 4-byte alginment.
-
-When we create a bug_entry in assembly, we align the start of the entry
-to 4 bytes, which implicitly handles padding for any prior entries.
-However, we do not align the end of the entry, and so when
-CONFIG_DEBUG_BUGVERBOSE=n, the final entry lacks the trailing padding
-bytes.
-
-For the main kernel image this is not a problem as find_bug() doesn't
-depend on the trailing padding bytes when searching for entries:
-
- for (bug = __start___bug_table; bug < __stop___bug_table; ++bug)
- if (bugaddr == bug_addr(bug))
- return bug;
-
-However for modules, module_bug_finalize() depends on the trailing
-bytes when calculating the number of entries:
-
- mod->num_bugs = sechdrs[i].sh_size / sizeof(struct bug_entry);
-
-... and as the last bug_entry lacks the necessary padding bytes, this entry
-will not be counted, e.g. in the case of a single entry:
-
- sechdrs[i].sh_size == 6
- sizeof(struct bug_entry) == 8;
-
- sechdrs[i].sh_size / sizeof(struct bug_entry) == 0;
-
-Consequently module_find_bug() will miss the last bug_entry when it does:
-
- for (i = 0; i < mod->num_bugs; ++i, ++bug)
- if (bugaddr == bug_addr(bug))
- goto out;
-
-... which can lead to a kenrel panic due to an unhandled bug.
-
-This can be demonstrated with the following module:
-
- static int __init buginit(void)
- {
- WARN(1, "hello\n");
- return 0;
- }
-
- static void __exit bugexit(void)
- {
- }
-
- module_init(buginit);
- module_exit(bugexit);
- MODULE_LICENSE("GPL");
-
-... which will trigger a kernel panic when loaded:
-
- ------------[ cut here ]------------
- hello
- Unexpected kernel BRK exception at EL1
- Internal error: BRK handler: 00000000f2000800 [#1] PREEMPT SMP
- Modules linked in: hello(O+)
- CPU: 0 PID: 50 Comm: insmod Tainted: G O 6.9.1 #8
- Hardware name: linux,dummy-virt (DT)
- pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
- pc : buginit+0x18/0x1000 [hello]
- lr : buginit+0x18/0x1000 [hello]
- sp : ffff800080533ae0
- x29: ffff800080533ae0 x28: 0000000000000000 x27: 0000000000000000
- x26: ffffaba8c4e70510 x25: ffff800080533c30 x24: ffffaba8c4a28a58
- x23: 0000000000000000 x22: 0000000000000000 x21: ffff3947c0eab3c0
- x20: ffffaba8c4e3f000 x19: ffffaba846464000 x18: 0000000000000006
- x17: 0000000000000000 x16: ffffaba8c2492834 x15: 0720072007200720
- x14: 0720072007200720 x13: ffffaba8c49b27c8 x12: 0000000000000312
- x11: 0000000000000106 x10: ffffaba8c4a0a7c8 x9 : ffffaba8c49b27c8
- x8 : 00000000ffffefff x7 : ffffaba8c4a0a7c8 x6 : 80000000fffff000
- x5 : 0000000000000107 x4 : 0000000000000000 x3 : 0000000000000000
- x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff3947c0eab3c0
- Call trace:
- buginit+0x18/0x1000 [hello]
- do_one_initcall+0x80/0x1c8
- do_init_module+0x60/0x218
- load_module+0x1ba4/0x1d70
- __do_sys_init_module+0x198/0x1d0
- __arm64_sys_init_module+0x1c/0x28
- invoke_syscall+0x48/0x114
- el0_svc_common.constprop.0+0x40/0xe0
- do_el0_svc+0x1c/0x28
- el0_svc+0x34/0xd8
- el0t_64_sync_handler+0x120/0x12c
- el0t_64_sync+0x190/0x194
- Code: d0ffffe0 910003fd 91000000 9400000b (d4210000)
- ---[ end trace 0000000000000000 ]---
- Kernel panic - not syncing: BRK handler: Fatal exception
-
-Fix this by always aligning the end of a bug_entry to 4 bytes, which is
-correct regardless of CONFIG_DEBUG_BUGVERBOSE.
-
-Fixes: 9fb7410f955f ("arm64/BUG: Use BRK instruction for generic BUG traps")
-
-Signed-off-by: Yuanbin Xie <xieyuanbin1@huawei.com>
-Signed-off-by: Jiangfeng Xiao <xiaojiangfeng@huawei.com>
-Reviewed-by: Mark Rutland <mark.rutland@arm.com>
-Link: https://lore.kernel.org/r/1716212077-43826-1-git-send-email-xiaojiangfeng@huawei.com
-Signed-off-by: Will Deacon <will@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/arm64/include/asm/asm-bug.h | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/arch/arm64/include/asm/asm-bug.h b/arch/arm64/include/asm/asm-bug.h
-index c762038ba4009..6e73809f6492a 100644
---- a/arch/arm64/include/asm/asm-bug.h
-+++ b/arch/arm64/include/asm/asm-bug.h
-@@ -28,6 +28,7 @@
- 14470: .long 14471f - .; \
- _BUGVERBOSE_LOCATION(__FILE__, __LINE__) \
- .short flags; \
-+ .align 2; \
- .popsection; \
- 14471:
- #else
---
-2.43.0
-
+++ /dev/null
-From 4ac7dd4e3627a77735efbbf5f69b16637d644ed5 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 12 Apr 2024 16:42:30 +0800
-Subject: arm64: dts: meson: fix S4 power-controller node
-
-From: Xianwei Zhao <xianwei.zhao@amlogic.com>
-
-[ Upstream commit 72907de9051dc2aa7b55c2a020e2872184ac17cd ]
-
-The power-controller module works well by adding its parent
-node secure-monitor.
-
-Fixes: 085f7a298a14 ("arm64: dts: add support for S4 power domain controller")
-Signed-off-by: Xianwei Zhao <xianwei.zhao@amlogic.com>
-Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
-Link: https://lore.kernel.org/r/20240412-fix-secpwr-s4-v2-1-3802fd936d77@amlogic.com
-Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/arm64/boot/dts/amlogic/meson-s4.dtsi | 13 +++++++++----
- 1 file changed, 9 insertions(+), 4 deletions(-)
-
-diff --git a/arch/arm64/boot/dts/amlogic/meson-s4.dtsi b/arch/arm64/boot/dts/amlogic/meson-s4.dtsi
-index ce90b35686a21..10896f9df682d 100644
---- a/arch/arm64/boot/dts/amlogic/meson-s4.dtsi
-+++ b/arch/arm64/boot/dts/amlogic/meson-s4.dtsi
-@@ -65,10 +65,15 @@ xtal: xtal-clk {
- #clock-cells = <0>;
- };
-
-- pwrc: power-controller {
-- compatible = "amlogic,meson-s4-pwrc";
-- #power-domain-cells = <1>;
-- status = "okay";
-+ firmware {
-+ sm: secure-monitor {
-+ compatible = "amlogic,meson-gxbb-sm";
-+
-+ pwrc: power-controller {
-+ compatible = "amlogic,meson-s4-pwrc";
-+ #power-domain-cells = <1>;
-+ };
-+ };
- };
-
- soc {
---
-2.43.0
-
+++ /dev/null
-From e78372c4c82d20c17f0864d4fdb0237c999d5cfe Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 2 May 2024 19:33:25 +0530
-Subject: ASoC: amd: acp: fix for acp platform device creation failure
-
-From: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
-
-[ Upstream commit 09068d624c490c0e89f33f963c402f1859964467 ]
-
-ACP pin configuration varies based on acp version.
-ACP PCI driver should read the ACP PIN config value and based on config
-value, it has to create a platform device in below two conditions.
-1) If ACP PDM configuration is selected from BIOS and ACP PDM controller
-exists.
-2) If ACP I2S configuration is selected from BIOS.
-
-Other than above scenarios, ACP PCI driver should skip the platform
-device creation logic, i.e. ACP PCI driver probe sequence should never
-fail if other acp pin configuration is selected. It should skip platform
-device creation logic.
-
-check_acp_pdm() function was implemented for ACP6.x platforms to check
-ACP PDM configuration. Previously, this code was safe guarded by
-FLAG_AMD_LEGACY_ONLY_DMIC flag check.
-
-This implementation breaks audio use cases for Huawei Matebooks which are
-based on ACP3.x varaint uses I2S configuration.
-In current scenario, check_acp_pdm() function returns -ENODEV value
-which results in ACP PCI driver probe failure without creating a platform
-device even in case of valid ACP pin configuration.
-
-Implement check_acp_config() as a common function which invokes platform
-specific acp pin configuration check functions for ACP3.x, ACP6.0 & ACP6.3
-& ACP7.0 variants and checks for ACP PDM controller.
-
-Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218780
-Fixes: 4af565de9f8c ("ASoC: amd: acp: fix for acp pdm configuration check")
-Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
-Link: https://lore.kernel.org/r/20240502140340.4049021-1-Vijendar.Mukunda@amd.com
-Signed-off-by: Mark Brown <broonie@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- sound/soc/amd/acp/acp-legacy-common.c | 96 ++++++++++++++++++++++-----
- sound/soc/amd/acp/acp-pci.c | 9 ++-
- sound/soc/amd/acp/amd.h | 10 ++-
- sound/soc/amd/acp/chip_offset_byte.h | 1 +
- 4 files changed, 95 insertions(+), 21 deletions(-)
-
-diff --git a/sound/soc/amd/acp/acp-legacy-common.c b/sound/soc/amd/acp/acp-legacy-common.c
-index b5aff3f230be5..3be7c6d55a6f8 100644
---- a/sound/soc/amd/acp/acp-legacy-common.c
-+++ b/sound/soc/amd/acp/acp-legacy-common.c
-@@ -358,11 +358,25 @@ int smn_read(struct pci_dev *dev, u32 smn_addr)
- }
- EXPORT_SYMBOL_NS_GPL(smn_read, SND_SOC_ACP_COMMON);
-
--int check_acp_pdm(struct pci_dev *pci, struct acp_chip_info *chip)
-+static void check_acp3x_config(struct acp_chip_info *chip)
- {
-- struct acpi_device *pdm_dev;
-- const union acpi_object *obj;
-- u32 pdm_addr, val;
-+ u32 val;
-+
-+ val = readl(chip->base + ACP3X_PIN_CONFIG);
-+ switch (val) {
-+ case ACP_CONFIG_4:
-+ chip->is_i2s_config = true;
-+ chip->is_pdm_config = true;
-+ break;
-+ default:
-+ chip->is_pdm_config = true;
-+ break;
-+ }
-+}
-+
-+static void check_acp6x_config(struct acp_chip_info *chip)
-+{
-+ u32 val;
-
- val = readl(chip->base + ACP_PIN_CONFIG);
- switch (val) {
-@@ -371,42 +385,94 @@ int check_acp_pdm(struct pci_dev *pci, struct acp_chip_info *chip)
- case ACP_CONFIG_6:
- case ACP_CONFIG_7:
- case ACP_CONFIG_8:
-- case ACP_CONFIG_10:
- case ACP_CONFIG_11:
-+ case ACP_CONFIG_14:
-+ chip->is_pdm_config = true;
-+ break;
-+ case ACP_CONFIG_9:
-+ chip->is_i2s_config = true;
-+ break;
-+ case ACP_CONFIG_10:
- case ACP_CONFIG_12:
- case ACP_CONFIG_13:
-+ chip->is_i2s_config = true;
-+ chip->is_pdm_config = true;
-+ break;
-+ default:
-+ break;
-+ }
-+}
-+
-+static void check_acp70_config(struct acp_chip_info *chip)
-+{
-+ u32 val;
-+
-+ val = readl(chip->base + ACP_PIN_CONFIG);
-+ switch (val) {
-+ case ACP_CONFIG_4:
-+ case ACP_CONFIG_5:
-+ case ACP_CONFIG_6:
-+ case ACP_CONFIG_7:
-+ case ACP_CONFIG_8:
-+ case ACP_CONFIG_11:
- case ACP_CONFIG_14:
-+ case ACP_CONFIG_17:
-+ case ACP_CONFIG_18:
-+ chip->is_pdm_config = true;
-+ break;
-+ case ACP_CONFIG_9:
-+ chip->is_i2s_config = true;
-+ break;
-+ case ACP_CONFIG_10:
-+ case ACP_CONFIG_12:
-+ case ACP_CONFIG_13:
-+ case ACP_CONFIG_19:
-+ case ACP_CONFIG_20:
-+ chip->is_i2s_config = true;
-+ chip->is_pdm_config = true;
- break;
- default:
-- return -EINVAL;
-+ break;
- }
-+}
-+
-+void check_acp_config(struct pci_dev *pci, struct acp_chip_info *chip)
-+{
-+ struct acpi_device *pdm_dev;
-+ const union acpi_object *obj;
-+ u32 pdm_addr;
-
- switch (chip->acp_rev) {
- case ACP3X_DEV:
- pdm_addr = ACP_RENOIR_PDM_ADDR;
-+ check_acp3x_config(chip);
- break;
- case ACP6X_DEV:
- pdm_addr = ACP_REMBRANDT_PDM_ADDR;
-+ check_acp6x_config(chip);
- break;
- case ACP63_DEV:
- pdm_addr = ACP63_PDM_ADDR;
-+ check_acp6x_config(chip);
- break;
- case ACP70_DEV:
- pdm_addr = ACP70_PDM_ADDR;
-+ check_acp70_config(chip);
- break;
- default:
-- return -EINVAL;
-+ break;
- }
-
-- pdm_dev = acpi_find_child_device(ACPI_COMPANION(&pci->dev), pdm_addr, 0);
-- if (pdm_dev) {
-- if (!acpi_dev_get_property(pdm_dev, "acp-audio-device-type",
-- ACPI_TYPE_INTEGER, &obj) &&
-- obj->integer.value == pdm_addr)
-- return 0;
-+ if (chip->is_pdm_config) {
-+ pdm_dev = acpi_find_child_device(ACPI_COMPANION(&pci->dev), pdm_addr, 0);
-+ if (pdm_dev) {
-+ if (!acpi_dev_get_property(pdm_dev, "acp-audio-device-type",
-+ ACPI_TYPE_INTEGER, &obj) &&
-+ obj->integer.value == pdm_addr)
-+ chip->is_pdm_dev = true;
-+ }
- }
-- return -ENODEV;
- }
--EXPORT_SYMBOL_NS_GPL(check_acp_pdm, SND_SOC_ACP_COMMON);
-+EXPORT_SYMBOL_NS_GPL(check_acp_config, SND_SOC_ACP_COMMON);
-
- MODULE_LICENSE("Dual BSD/GPL");
-diff --git a/sound/soc/amd/acp/acp-pci.c b/sound/soc/amd/acp/acp-pci.c
-index 5f35b90eab8d3..ad320b29e87dc 100644
---- a/sound/soc/amd/acp/acp-pci.c
-+++ b/sound/soc/amd/acp/acp-pci.c
-@@ -100,7 +100,6 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id
- ret = -EINVAL;
- goto release_regions;
- }
--
- dmic_dev = platform_device_register_data(dev, "dmic-codec", PLATFORM_DEVID_NONE, NULL, 0);
- if (IS_ERR(dmic_dev)) {
- dev_err(dev, "failed to create DMIC device\n");
-@@ -119,6 +118,10 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id
- if (ret)
- goto unregister_dmic_dev;
-
-+ check_acp_config(pci, chip);
-+ if (!chip->is_pdm_dev && !chip->is_i2s_config)
-+ goto skip_pdev_creation;
-+
- res = devm_kcalloc(&pci->dev, num_res, sizeof(struct resource), GFP_KERNEL);
- if (!res) {
- ret = -ENOMEM;
-@@ -136,10 +139,6 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id
- }
- }
-
-- ret = check_acp_pdm(pci, chip);
-- if (ret < 0)
-- goto skip_pdev_creation;
--
- chip->flag = flag;
- memset(&pdevinfo, 0, sizeof(pdevinfo));
-
-diff --git a/sound/soc/amd/acp/amd.h b/sound/soc/amd/acp/amd.h
-index 5017e868f39b9..d75b4eb34de8d 100644
---- a/sound/soc/amd/acp/amd.h
-+++ b/sound/soc/amd/acp/amd.h
-@@ -138,6 +138,9 @@ struct acp_chip_info {
- void __iomem *base; /* ACP memory PCI base */
- struct platform_device *chip_pdev;
- unsigned int flag; /* Distinguish b/w Legacy or Only PDM */
-+ bool is_pdm_dev; /* flag set to true when ACP PDM controller exists */
-+ bool is_pdm_config; /* flag set to true when PDM configuration is selected from BIOS */
-+ bool is_i2s_config; /* flag set to true when I2S configuration is selected from BIOS */
- };
-
- struct acp_stream {
-@@ -212,6 +215,11 @@ enum acp_config {
- ACP_CONFIG_13,
- ACP_CONFIG_14,
- ACP_CONFIG_15,
-+ ACP_CONFIG_16,
-+ ACP_CONFIG_17,
-+ ACP_CONFIG_18,
-+ ACP_CONFIG_19,
-+ ACP_CONFIG_20,
- };
-
- extern const struct snd_soc_dai_ops asoc_acp_cpu_dai_ops;
-@@ -240,7 +248,7 @@ void restore_acp_pdm_params(struct snd_pcm_substream *substream,
- int restore_acp_i2s_params(struct snd_pcm_substream *substream,
- struct acp_dev_data *adata, struct acp_stream *stream);
-
--int check_acp_pdm(struct pci_dev *pci, struct acp_chip_info *chip);
-+void check_acp_config(struct pci_dev *pci, struct acp_chip_info *chip);
-
- static inline u64 acp_get_byte_count(struct acp_dev_data *adata, int dai_id, int direction)
- {
-diff --git a/sound/soc/amd/acp/chip_offset_byte.h b/sound/soc/amd/acp/chip_offset_byte.h
-index cfd6c4d075944..18da734c0e9e7 100644
---- a/sound/soc/amd/acp/chip_offset_byte.h
-+++ b/sound/soc/amd/acp/chip_offset_byte.h
-@@ -20,6 +20,7 @@
- #define ACP_SOFT_RESET 0x1000
- #define ACP_CONTROL 0x1004
- #define ACP_PIN_CONFIG 0x1440
-+#define ACP3X_PIN_CONFIG 0x1400
-
- #define ACP_EXTERNAL_INTR_REG_ADDR(adata, offset, ctrl) \
- (adata->acp_base + adata->rsrc->irq_reg_offset + offset + (ctrl * 0x04))
---
-2.43.0
-
+++ /dev/null
-From ff837e9a4db95c85ba7601bd82d54182084beded Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 27 May 2024 11:08:40 +0100
-Subject: ASoC: cs42l43: Only restrict 44.1kHz for the ASP
-
-From: Charles Keepax <ckeepax@opensource.cirrus.com>
-
-[ Upstream commit 797c525e85d1e44cf0e6f338890e8e0c661f524a ]
-
-The SoundWire interface can always support 44.1kHz using flow controlled
-mode, and whether the ASP is in master mode should obviously only affect
-the ASP. Update cs42l43_startup() to only restrict the rates for the ASP
-DAI.
-
-Fixes: fc918cbe874e ("ASoC: cs42l43: Add support for the cs42l43")
-Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
-Link: https://msgid.link/r/20240527100840.439832-1-ckeepax@opensource.cirrus.com
-Signed-off-by: Mark Brown <broonie@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- sound/soc/codecs/cs42l43.c | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/sound/soc/codecs/cs42l43.c b/sound/soc/codecs/cs42l43.c
-index a24b52c9dda6b..193ef7543930a 100644
---- a/sound/soc/codecs/cs42l43.c
-+++ b/sound/soc/codecs/cs42l43.c
-@@ -300,8 +300,9 @@ static int cs42l43_startup(struct snd_pcm_substream *substream, struct snd_soc_d
- struct snd_soc_component *component = dai->component;
- struct cs42l43_codec *priv = snd_soc_component_get_drvdata(component);
- struct cs42l43 *cs42l43 = priv->core;
-- int provider = !!regmap_test_bits(cs42l43->regmap, CS42L43_ASP_CLK_CONFIG2,
-- CS42L43_ASP_MASTER_MODE_MASK);
-+ int provider = !dai->id || !!regmap_test_bits(cs42l43->regmap,
-+ CS42L43_ASP_CLK_CONFIG2,
-+ CS42L43_ASP_MASTER_MODE_MASK);
-
- if (provider)
- priv->constraint.mask = CS42L43_PROVIDER_RATE_MASK;
---
-2.43.0
-
+++ /dev/null
-From 4dfdb1a1cd8a9522c130636ecb264e5c29fc4bd9 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 9 May 2024 07:31:29 +0000
-Subject: ASoC: mediatek: mt8192: fix register configuration for tdm
-
-From: Hsin-Te Yuan <yuanhsinte@chromium.org>
-
-[ Upstream commit a85ed162f0efcfdd664954414a05d1d560cc95dc ]
-
-For DSP_A, data is a BCK cycle behind LRCK trigger edge. For DSP_B, this
-delay doesn't exist. Fix the delay configuration to match the standard.
-
-Fixes: 52fcd65414abfc ("ASoC: mediatek: mt8192: support tdm in platform driver")
-Signed-off-by: Hsin-Te Yuan <yuanhsinte@chromium.org>
-Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
-Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
-Link: https://lore.kernel.org/r/20240509-8192-tdm-v1-1-530b54645763@chromium.org
-Signed-off-by: Mark Brown <broonie@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- sound/soc/mediatek/mt8192/mt8192-dai-tdm.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/sound/soc/mediatek/mt8192/mt8192-dai-tdm.c b/sound/soc/mediatek/mt8192/mt8192-dai-tdm.c
-index 9ce06821c7d0f..49440db370af0 100644
---- a/sound/soc/mediatek/mt8192/mt8192-dai-tdm.c
-+++ b/sound/soc/mediatek/mt8192/mt8192-dai-tdm.c
-@@ -566,10 +566,10 @@ static int mtk_dai_tdm_hw_params(struct snd_pcm_substream *substream,
- tdm_con |= 1 << DELAY_DATA_SFT;
- tdm_con |= get_tdm_lrck_width(format) << LRCK_TDM_WIDTH_SFT;
- } else if (tdm_priv->tdm_out_mode == TDM_OUT_DSP_A) {
-- tdm_con |= 0 << DELAY_DATA_SFT;
-+ tdm_con |= 1 << DELAY_DATA_SFT;
- tdm_con |= 0 << LRCK_TDM_WIDTH_SFT;
- } else if (tdm_priv->tdm_out_mode == TDM_OUT_DSP_B) {
-- tdm_con |= 1 << DELAY_DATA_SFT;
-+ tdm_con |= 0 << DELAY_DATA_SFT;
- tdm_con |= 0 << LRCK_TDM_WIDTH_SFT;
- }
-
---
-2.43.0
-
+++ /dev/null
-From b0ee5740ace43c82c36f349de45a591c0a67cda5 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 18 May 2024 11:35:15 +0800
-Subject: ASoC: tas2552: Add TX path for capturing AUDIO-OUT data
-
-From: Shenghao Ding <shenghao-ding@ti.com>
-
-[ Upstream commit 7078ac4fd179a68d0bab448004fcd357e7a45f8d ]
-
-TAS2552 is a Smartamp with I/V sense data, add TX path
-to support capturing I/V data.
-
-Fixes: 38803ce7b53b ("ASoC: codecs: tas*: merge .digital_mute() into .mute_stream()")
-Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
-Link: https://msgid.link/r/20240518033515.866-1-shenghao-ding@ti.com
-Signed-off-by: Mark Brown <broonie@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- sound/soc/codecs/tas2552.c | 15 +++++++++++++--
- 1 file changed, 13 insertions(+), 2 deletions(-)
-
-diff --git a/sound/soc/codecs/tas2552.c b/sound/soc/codecs/tas2552.c
-index 8c9dc318b0e82..c65a4219ecd6c 100644
---- a/sound/soc/codecs/tas2552.c
-+++ b/sound/soc/codecs/tas2552.c
-@@ -2,7 +2,8 @@
- /*
- * tas2552.c - ALSA SoC Texas Instruments TAS2552 Mono Audio Amplifier
- *
-- * Copyright (C) 2014 Texas Instruments Incorporated - https://www.ti.com
-+ * Copyright (C) 2014 - 2024 Texas Instruments Incorporated -
-+ * https://www.ti.com
- *
- * Author: Dan Murphy <dmurphy@ti.com>
- */
-@@ -119,12 +120,14 @@ static const struct snd_soc_dapm_widget tas2552_dapm_widgets[] =
- &tas2552_input_mux_control),
-
- SND_SOC_DAPM_AIF_IN("DAC IN", "DAC Playback", 0, SND_SOC_NOPM, 0, 0),
-+ SND_SOC_DAPM_AIF_OUT("ASI OUT", "DAC Capture", 0, SND_SOC_NOPM, 0, 0),
- SND_SOC_DAPM_DAC("DAC", NULL, SND_SOC_NOPM, 0, 0),
- SND_SOC_DAPM_OUT_DRV("ClassD", TAS2552_CFG_2, 7, 0, NULL, 0),
- SND_SOC_DAPM_SUPPLY("PLL", TAS2552_CFG_2, 3, 0, NULL, 0),
- SND_SOC_DAPM_POST("Post Event", tas2552_post_event),
-
-- SND_SOC_DAPM_OUTPUT("OUT")
-+ SND_SOC_DAPM_OUTPUT("OUT"),
-+ SND_SOC_DAPM_INPUT("DMIC")
- };
-
- static const struct snd_soc_dapm_route tas2552_audio_map[] = {
-@@ -134,6 +137,7 @@ static const struct snd_soc_dapm_route tas2552_audio_map[] = {
- {"ClassD", NULL, "Input selection"},
- {"OUT", NULL, "ClassD"},
- {"ClassD", NULL, "PLL"},
-+ {"ASI OUT", NULL, "DMIC"}
- };
-
- #ifdef CONFIG_PM
-@@ -538,6 +542,13 @@ static struct snd_soc_dai_driver tas2552_dai[] = {
- .rates = SNDRV_PCM_RATE_8000_192000,
- .formats = TAS2552_FORMATS,
- },
-+ .capture = {
-+ .stream_name = "Capture",
-+ .channels_min = 2,
-+ .channels_max = 2,
-+ .rates = SNDRV_PCM_RATE_8000_192000,
-+ .formats = TAS2552_FORMATS,
-+ },
- .ops = &tas2552_speaker_dai_ops,
- },
- };
---
-2.43.0
-
+++ /dev/null
-From 62137d50860212e1a3b8c04e72f239529d0994a2 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sun, 5 May 2024 20:23:45 +0800
-Subject: ASoC: tas2781: Fix a warning reported by robot kernel test
-
-From: Shenghao Ding <shenghao-ding@ti.com>
-
-[ Upstream commit 1ae14f3520b1a0ad144610a3f592c81a3e81cd1b ]
-
-Fix a warning reported by robot kernel test that 'fw_entry' in function
-'tas2781_load_calibration' is used uninitialized with compiler
-sh4-linux-gcc (GCC) 13.2.0, an update of copyright and a correction of the
-comments.
-
-Fixes: ef3bcde75d06 ("ASoc: tas2781: Add tas2781 driver")
-Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
-Link: https://lore.kernel.org/r/20240505122346.1326-1-shenghao-ding@ti.com
-Signed-off-by: Mark Brown <broonie@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- sound/soc/codecs/tas2781-fmwlib.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/sound/soc/codecs/tas2781-fmwlib.c b/sound/soc/codecs/tas2781-fmwlib.c
-index 85e14ff61769a..a182ae7d44a37 100644
---- a/sound/soc/codecs/tas2781-fmwlib.c
-+++ b/sound/soc/codecs/tas2781-fmwlib.c
-@@ -1,8 +1,8 @@
- // SPDX-License-Identifier: GPL-2.0
- //
--// tasdevice-fmw.c -- TASDEVICE firmware support
-+// tas2781-fmwlib.c -- TASDEVICE firmware support
- //
--// Copyright 2023 Texas Instruments, Inc.
-+// Copyright 2023 - 2024 Texas Instruments, Inc.
- //
- // Author: Shenghao Ding <shenghao-ding@ti.com>
-
-@@ -1878,7 +1878,7 @@ int tas2781_load_calibration(void *context, char *file_name,
- {
- struct tasdevice_priv *tas_priv = (struct tasdevice_priv *)context;
- struct tasdevice *tasdev = &(tas_priv->tasdevice[i]);
-- const struct firmware *fw_entry;
-+ const struct firmware *fw_entry = NULL;
- struct tasdevice_fw *tas_fmw;
- struct firmware fmw;
- int offset = 0;
---
-2.43.0
-
+++ /dev/null
-From b78ed275ab46c3855d15f5f46c7deea63a405bd4 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 18 May 2024 22:15:46 +0800
-Subject: ASoC: tas2781: Fix wrong loading calibrated data sequence
-
-From: Shenghao Ding <shenghao-ding@ti.com>
-
-[ Upstream commit b195acf5266d2dee4067f89345c3e6b88d925311 ]
-
-Calibrated data will be set to default after loading DSP config params,
-which will cause speaker protection work abnormally. Reload calibrated
-data after loading DSP config params. Remove declaration of unused API
-which load calibrated data in wrong sequence, changed the copyright year
-and correct file name in license
-header.
-
-Fixes: ef3bcde75d06 ("ASoC: tas2781: Add tas2781 driver")
-Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
-Link: https://msgid.link/r/20240518141546.1742-1-shenghao-ding@ti.com
-Signed-off-by: Mark Brown <broonie@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- include/sound/tas2781-dsp.h | 7 +-
- sound/soc/codecs/tas2781-fmwlib.c | 103 ++++++++----------------------
- sound/soc/codecs/tas2781-i2c.c | 4 +-
- 3 files changed, 32 insertions(+), 82 deletions(-)
-
-diff --git a/include/sound/tas2781-dsp.h b/include/sound/tas2781-dsp.h
-index ea9af2726a53f..7fba7ea26a4b0 100644
---- a/include/sound/tas2781-dsp.h
-+++ b/include/sound/tas2781-dsp.h
-@@ -2,7 +2,7 @@
- //
- // ALSA SoC Texas Instruments TAS2781 Audio Smart Amplifier
- //
--// Copyright (C) 2022 - 2023 Texas Instruments Incorporated
-+// Copyright (C) 2022 - 2024 Texas Instruments Incorporated
- // https://www.ti.com
- //
- // The TAS2781 driver implements a flexible and configurable
-@@ -13,8 +13,8 @@
- // Author: Kevin Lu <kevin-lu@ti.com>
- //
-
--#ifndef __TASDEVICE_DSP_H__
--#define __TASDEVICE_DSP_H__
-+#ifndef __TAS2781_DSP_H__
-+#define __TAS2781_DSP_H__
-
- #define MAIN_ALL_DEVICES 0x0d
- #define MAIN_DEVICE_A 0x01
-@@ -180,7 +180,6 @@ void tasdevice_calbin_remove(void *context);
- int tasdevice_select_tuningprm_cfg(void *context, int prm,
- int cfg_no, int rca_conf_no);
- int tasdevice_prmg_load(void *context, int prm_no);
--int tasdevice_prmg_calibdata_load(void *context, int prm_no);
- void tasdevice_tuning_switch(void *context, int state);
- int tas2781_load_calibration(void *context, char *file_name,
- unsigned short i);
-diff --git a/sound/soc/codecs/tas2781-fmwlib.c b/sound/soc/codecs/tas2781-fmwlib.c
-index a182ae7d44a37..43a3cc5eeb974 100644
---- a/sound/soc/codecs/tas2781-fmwlib.c
-+++ b/sound/soc/codecs/tas2781-fmwlib.c
-@@ -2151,6 +2151,24 @@ static int tasdevice_load_data(struct tasdevice_priv *tas_priv,
- return ret;
- }
-
-+static void tasdev_load_calibrated_data(struct tasdevice_priv *priv, int i)
-+{
-+ struct tasdevice_calibration *cal;
-+ struct tasdevice_fw *cal_fmw;
-+
-+ cal_fmw = priv->tasdevice[i].cali_data_fmw;
-+
-+ /* No calibrated data for current devices, playback will go ahead. */
-+ if (!cal_fmw)
-+ return;
-+
-+ cal = cal_fmw->calibrations;
-+ if (cal)
-+ return;
-+
-+ load_calib_data(priv, &cal->dev_data);
-+}
-+
- int tasdevice_select_tuningprm_cfg(void *context, int prm_no,
- int cfg_no, int rca_conf_no)
- {
-@@ -2210,21 +2228,9 @@ int tasdevice_select_tuningprm_cfg(void *context, int prm_no,
- for (i = 0; i < tas_priv->ndev; i++) {
- if (tas_priv->tasdevice[i].is_loaderr == true)
- continue;
-- else if (tas_priv->tasdevice[i].is_loaderr == false
-- && tas_priv->tasdevice[i].is_loading == true) {
-- struct tasdevice_fw *cal_fmw =
-- tas_priv->tasdevice[i].cali_data_fmw;
--
-- if (cal_fmw) {
-- struct tasdevice_calibration
-- *cal = cal_fmw->calibrations;
--
-- if (cal)
-- load_calib_data(tas_priv,
-- &(cal->dev_data));
-- }
-+ if (tas_priv->tasdevice[i].is_loaderr == false &&
-+ tas_priv->tasdevice[i].is_loading == true)
- tas_priv->tasdevice[i].cur_prog = prm_no;
-- }
- }
- }
-
-@@ -2245,11 +2251,15 @@ int tasdevice_select_tuningprm_cfg(void *context, int prm_no,
- tasdevice_load_data(tas_priv, &(conf->dev_data));
- for (i = 0; i < tas_priv->ndev; i++) {
- if (tas_priv->tasdevice[i].is_loaderr == true) {
-- status |= 1 << (i + 4);
-+ status |= BIT(i + 4);
- continue;
-- } else if (tas_priv->tasdevice[i].is_loaderr == false
-- && tas_priv->tasdevice[i].is_loading == true)
-+ }
-+
-+ if (tas_priv->tasdevice[i].is_loaderr == false &&
-+ tas_priv->tasdevice[i].is_loading == true) {
-+ tasdev_load_calibrated_data(tas_priv, i);
- tas_priv->tasdevice[i].cur_conf = cfg_no;
-+ }
- }
- } else
- dev_dbg(tas_priv->dev, "%s: Unneeded loading dsp conf %d\n",
-@@ -2308,65 +2318,6 @@ int tasdevice_prmg_load(void *context, int prm_no)
- }
- EXPORT_SYMBOL_NS_GPL(tasdevice_prmg_load, SND_SOC_TAS2781_FMWLIB);
-
--int tasdevice_prmg_calibdata_load(void *context, int prm_no)
--{
-- struct tasdevice_priv *tas_priv = (struct tasdevice_priv *) context;
-- struct tasdevice_fw *tas_fmw = tas_priv->fmw;
-- struct tasdevice_prog *program;
-- int prog_status = 0;
-- int i;
--
-- if (!tas_fmw) {
-- dev_err(tas_priv->dev, "%s: Firmware is NULL\n", __func__);
-- goto out;
-- }
--
-- if (prm_no >= tas_fmw->nr_programs) {
-- dev_err(tas_priv->dev,
-- "%s: prm(%d) is not in range of Programs %u\n",
-- __func__, prm_no, tas_fmw->nr_programs);
-- goto out;
-- }
--
-- for (i = 0, prog_status = 0; i < tas_priv->ndev; i++) {
-- if (prm_no >= 0 && tas_priv->tasdevice[i].cur_prog != prm_no) {
-- tas_priv->tasdevice[i].cur_conf = -1;
-- tas_priv->tasdevice[i].is_loading = true;
-- prog_status++;
-- }
-- tas_priv->tasdevice[i].is_loaderr = false;
-- }
--
-- if (prog_status) {
-- program = &(tas_fmw->programs[prm_no]);
-- tasdevice_load_data(tas_priv, &(program->dev_data));
-- for (i = 0; i < tas_priv->ndev; i++) {
-- if (tas_priv->tasdevice[i].is_loaderr == true)
-- continue;
-- else if (tas_priv->tasdevice[i].is_loaderr == false
-- && tas_priv->tasdevice[i].is_loading == true) {
-- struct tasdevice_fw *cal_fmw =
-- tas_priv->tasdevice[i].cali_data_fmw;
--
-- if (cal_fmw) {
-- struct tasdevice_calibration *cal =
-- cal_fmw->calibrations;
--
-- if (cal)
-- load_calib_data(tas_priv,
-- &(cal->dev_data));
-- }
-- tas_priv->tasdevice[i].cur_prog = prm_no;
-- }
-- }
-- }
--
--out:
-- return prog_status;
--}
--EXPORT_SYMBOL_NS_GPL(tasdevice_prmg_calibdata_load,
-- SND_SOC_TAS2781_FMWLIB);
--
- void tasdevice_tuning_switch(void *context, int state)
- {
- struct tasdevice_priv *tas_priv = (struct tasdevice_priv *) context;
-diff --git a/sound/soc/codecs/tas2781-i2c.c b/sound/soc/codecs/tas2781-i2c.c
-index b5abff230e437..9350972dfefe7 100644
---- a/sound/soc/codecs/tas2781-i2c.c
-+++ b/sound/soc/codecs/tas2781-i2c.c
-@@ -2,7 +2,7 @@
- //
- // ALSA SoC Texas Instruments TAS2563/TAS2781 Audio Smart Amplifier
- //
--// Copyright (C) 2022 - 2023 Texas Instruments Incorporated
-+// Copyright (C) 2022 - 2024 Texas Instruments Incorporated
- // https://www.ti.com
- //
- // The TAS2563/TAS2781 driver implements a flexible and configurable
-@@ -414,7 +414,7 @@ static void tasdevice_fw_ready(const struct firmware *fmw,
- __func__, tas_priv->cal_binaryname[i]);
- }
-
-- tasdevice_prmg_calibdata_load(tas_priv, 0);
-+ tasdevice_prmg_load(tas_priv, 0);
- tas_priv->cur_prog = 0;
- out:
- if (tas_priv->fw_state == TASDEVICE_DSP_FW_FAIL) {
---
-2.43.0
-
+++ /dev/null
-From fe469ced5f7e909c11f9bbe8bad8f04970be7a04 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 15 May 2024 09:31:57 +0800
-Subject: blk-cgroup: fix list corruption from reorder of WRITE ->lqueued
-
-From: Ming Lei <ming.lei@redhat.com>
-
-[ Upstream commit d0aac2363549e12cc79b8e285f13d5a9f42fd08e ]
-
-__blkcg_rstat_flush() can be run anytime, especially when blk_cgroup_bio_start
-is being executed.
-
-If WRITE of `->lqueued` is re-ordered with READ of 'bisc->lnode.next' in
-the loop of __blkcg_rstat_flush(), `next_bisc` can be assigned with one
-stat instance being added in blk_cgroup_bio_start(), then the local
-list in __blkcg_rstat_flush() could be corrupted.
-
-Fix the issue by adding one barrier.
-
-Cc: Tejun Heo <tj@kernel.org>
-Cc: Waiman Long <longman@redhat.com>
-Fixes: 3b8cc6298724 ("blk-cgroup: Optimize blkcg_rstat_flush()")
-Signed-off-by: Ming Lei <ming.lei@redhat.com>
-Link: https://lore.kernel.org/r/20240515013157.443672-3-ming.lei@redhat.com
-Signed-off-by: Jens Axboe <axboe@kernel.dk>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- block/blk-cgroup.c | 10 ++++++++++
- 1 file changed, 10 insertions(+)
-
-diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
-index 98bd30114043e..249fc915b551d 100644
---- a/block/blk-cgroup.c
-+++ b/block/blk-cgroup.c
-@@ -1036,6 +1036,16 @@ static void __blkcg_rstat_flush(struct blkcg *blkcg, int cpu)
- struct blkg_iostat cur;
- unsigned int seq;
-
-+ /*
-+ * Order assignment of `next_bisc` from `bisc->lnode.next` in
-+ * llist_for_each_entry_safe and clearing `bisc->lqueued` for
-+ * avoiding to assign `next_bisc` with new next pointer added
-+ * in blk_cgroup_bio_start() in case of re-ordering.
-+ *
-+ * The pair barrier is implied in llist_add() in blk_cgroup_bio_start().
-+ */
-+ smp_mb();
-+
- WRITE_ONCE(bisc->lqueued, false);
-
- /* fetch the current per-cpu values */
---
-2.43.0
-
+++ /dev/null
-From c5fc1ef40c90e825b12dea6928f83c5ef180ed12 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 15 May 2024 09:31:56 +0800
-Subject: blk-cgroup: fix list corruption from resetting io stat
-
-From: Ming Lei <ming.lei@redhat.com>
-
-[ Upstream commit 6da6680632792709cecf2b006f2fe3ca7857e791 ]
-
-Since commit 3b8cc6298724 ("blk-cgroup: Optimize blkcg_rstat_flush()"),
-each iostat instance is added to blkcg percpu list, so blkcg_reset_stats()
-can't reset the stat instance by memset(), otherwise the llist may be
-corrupted.
-
-Fix the issue by only resetting the counter part.
-
-Cc: Tejun Heo <tj@kernel.org>
-Cc: Waiman Long <longman@redhat.com>
-Cc: Jay Shin <jaeshin@redhat.com>
-Fixes: 3b8cc6298724 ("blk-cgroup: Optimize blkcg_rstat_flush()")
-Signed-off-by: Ming Lei <ming.lei@redhat.com>
-Acked-by: Tejun Heo <tj@kernel.org>
-Reviewed-by: Waiman Long <longman@redhat.com>
-Link: https://lore.kernel.org/r/20240515013157.443672-2-ming.lei@redhat.com
-Signed-off-by: Jens Axboe <axboe@kernel.dk>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- block/blk-cgroup.c | 58 ++++++++++++++++++++++++++++------------------
- 1 file changed, 35 insertions(+), 23 deletions(-)
-
-diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
-index 4529122e0cbdb..98bd30114043e 100644
---- a/block/blk-cgroup.c
-+++ b/block/blk-cgroup.c
-@@ -619,12 +619,45 @@ static void blkg_destroy_all(struct gendisk *disk)
- spin_unlock_irq(&q->queue_lock);
- }
-
-+static void blkg_iostat_set(struct blkg_iostat *dst, struct blkg_iostat *src)
-+{
-+ int i;
-+
-+ for (i = 0; i < BLKG_IOSTAT_NR; i++) {
-+ dst->bytes[i] = src->bytes[i];
-+ dst->ios[i] = src->ios[i];
-+ }
-+}
-+
-+static void __blkg_clear_stat(struct blkg_iostat_set *bis)
-+{
-+ struct blkg_iostat cur = {0};
-+ unsigned long flags;
-+
-+ flags = u64_stats_update_begin_irqsave(&bis->sync);
-+ blkg_iostat_set(&bis->cur, &cur);
-+ blkg_iostat_set(&bis->last, &cur);
-+ u64_stats_update_end_irqrestore(&bis->sync, flags);
-+}
-+
-+static void blkg_clear_stat(struct blkcg_gq *blkg)
-+{
-+ int cpu;
-+
-+ for_each_possible_cpu(cpu) {
-+ struct blkg_iostat_set *s = per_cpu_ptr(blkg->iostat_cpu, cpu);
-+
-+ __blkg_clear_stat(s);
-+ }
-+ __blkg_clear_stat(&blkg->iostat);
-+}
-+
- static int blkcg_reset_stats(struct cgroup_subsys_state *css,
- struct cftype *cftype, u64 val)
- {
- struct blkcg *blkcg = css_to_blkcg(css);
- struct blkcg_gq *blkg;
-- int i, cpu;
-+ int i;
-
- mutex_lock(&blkcg_pol_mutex);
- spin_lock_irq(&blkcg->lock);
-@@ -635,18 +668,7 @@ static int blkcg_reset_stats(struct cgroup_subsys_state *css,
- * anyway. If you get hit by a race, retry.
- */
- hlist_for_each_entry(blkg, &blkcg->blkg_list, blkcg_node) {
-- for_each_possible_cpu(cpu) {
-- struct blkg_iostat_set *bis =
-- per_cpu_ptr(blkg->iostat_cpu, cpu);
-- memset(bis, 0, sizeof(*bis));
--
-- /* Re-initialize the cleared blkg_iostat_set */
-- u64_stats_init(&bis->sync);
-- bis->blkg = blkg;
-- }
-- memset(&blkg->iostat, 0, sizeof(blkg->iostat));
-- u64_stats_init(&blkg->iostat.sync);
--
-+ blkg_clear_stat(blkg);
- for (i = 0; i < BLKCG_MAX_POLS; i++) {
- struct blkcg_policy *pol = blkcg_policy[i];
-
-@@ -949,16 +971,6 @@ void blkg_conf_exit(struct blkg_conf_ctx *ctx)
- }
- EXPORT_SYMBOL_GPL(blkg_conf_exit);
-
--static void blkg_iostat_set(struct blkg_iostat *dst, struct blkg_iostat *src)
--{
-- int i;
--
-- for (i = 0; i < BLKG_IOSTAT_NR; i++) {
-- dst->bytes[i] = src->bytes[i];
-- dst->ios[i] = src->ios[i];
-- }
--}
--
- static void blkg_iostat_add(struct blkg_iostat *dst, struct blkg_iostat *src)
- {
- int i;
---
-2.43.0
-
+++ /dev/null
-From 4725944ae14b1d74b45b6c587f6ab96cccc2890e Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 15 May 2024 10:30:59 -0400
-Subject: blk-cgroup: Properly propagate the iostat update up the hierarchy
-
-From: Waiman Long <longman@redhat.com>
-
-[ Upstream commit 9d230c09964e6e18c8f6e4f0d41ee90eef45ec1c ]
-
-During a cgroup_rstat_flush() call, the lowest level of nodes are flushed
-first before their parents. Since commit 3b8cc6298724 ("blk-cgroup:
-Optimize blkcg_rstat_flush()"), iostat propagation was still done to
-the parent. Grandparent, however, may not get the iostat update if the
-parent has no blkg_iostat_set queued in its lhead lockless list.
-
-Fix this iostat propagation problem by queuing the parent's global
-blkg->iostat into one of its percpu lockless lists to make sure that
-the delta will always be propagated up to the grandparent and so on
-toward the root blkcg.
-
-Note that successive calls to __blkcg_rstat_flush() are serialized by
-the cgroup_rstat_lock. So no special barrier is used in the reading
-and writing of blkg->iostat.lqueued.
-
-Fixes: 3b8cc6298724 ("blk-cgroup: Optimize blkcg_rstat_flush()")
-Reported-by: Dan Schatzberg <schatzberg.dan@gmail.com>
-Closes: https://lore.kernel.org/lkml/ZkO6l%2FODzadSgdhC@dschatzberg-fedora-PF3DHTBV/
-Signed-off-by: Waiman Long <longman@redhat.com>
-Reviewed-by: Ming Lei <ming.lei@redhat.com>
-Acked-by: Tejun Heo <tj@kernel.org>
-Link: https://lore.kernel.org/r/20240515143059.276677-1-longman@redhat.com
-Signed-off-by: Jens Axboe <axboe@kernel.dk>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- block/blk-cgroup.c | 19 ++++++++++++++++++-
- 1 file changed, 18 insertions(+), 1 deletion(-)
-
-diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
-index 249fc915b551d..caab7b679bf04 100644
---- a/block/blk-cgroup.c
-+++ b/block/blk-cgroup.c
-@@ -323,6 +323,7 @@ static struct blkcg_gq *blkg_alloc(struct blkcg *blkcg, struct gendisk *disk,
- blkg->q = disk->queue;
- INIT_LIST_HEAD(&blkg->q_node);
- blkg->blkcg = blkcg;
-+ blkg->iostat.blkg = blkg;
- #ifdef CONFIG_BLK_CGROUP_PUNT_BIO
- spin_lock_init(&blkg->async_bio_lock);
- bio_list_init(&blkg->async_bios);
-@@ -1047,6 +1048,8 @@ static void __blkcg_rstat_flush(struct blkcg *blkcg, int cpu)
- smp_mb();
-
- WRITE_ONCE(bisc->lqueued, false);
-+ if (bisc == &blkg->iostat)
-+ goto propagate_up; /* propagate up to parent only */
-
- /* fetch the current per-cpu values */
- do {
-@@ -1056,10 +1059,24 @@ static void __blkcg_rstat_flush(struct blkcg *blkcg, int cpu)
-
- blkcg_iostat_update(blkg, &cur, &bisc->last);
-
-+propagate_up:
- /* propagate global delta to parent (unless that's root) */
-- if (parent && parent->parent)
-+ if (parent && parent->parent) {
- blkcg_iostat_update(parent, &blkg->iostat.cur,
- &blkg->iostat.last);
-+ /*
-+ * Queue parent->iostat to its blkcg's lockless
-+ * list to propagate up to the grandparent if the
-+ * iostat hasn't been queued yet.
-+ */
-+ if (!parent->iostat.lqueued) {
-+ struct llist_head *plhead;
-+
-+ plhead = per_cpu_ptr(parent->blkcg->lhead, cpu);
-+ llist_add(&parent->iostat.lnode, plhead);
-+ parent->iostat.lqueued = true;
-+ }
-+ }
- }
- raw_spin_unlock_irqrestore(&blkg_stat_lock, flags);
- out:
---
-2.43.0
-
+++ /dev/null
-From 38afc7dbb3d6607c93930624defd68c0e3907989 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 27 May 2024 13:20:07 +0200
-Subject: bpf: Allow delete from sockmap/sockhash only if update is allowed
-
-From: Jakub Sitnicki <jakub@cloudflare.com>
-
-[ Upstream commit 98e948fb60d41447fd8d2d0c3b8637fc6b6dc26d ]
-
-We have seen an influx of syzkaller reports where a BPF program attached to
-a tracepoint triggers a locking rule violation by performing a map_delete
-on a sockmap/sockhash.
-
-We don't intend to support this artificial use scenario. Extend the
-existing verifier allowed-program-type check for updating sockmap/sockhash
-to also cover deleting from a map.
-
-From now on only BPF programs which were previously allowed to update
-sockmap/sockhash can delete from these map types.
-
-Fixes: ff9105993240 ("bpf, sockmap: Prevent lock inversion deadlock in map delete elem")
-Reported-by: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
-Reported-by: syzbot+ec941d6e24f633a59172@syzkaller.appspotmail.com
-Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>
-Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
-Tested-by: syzbot+ec941d6e24f633a59172@syzkaller.appspotmail.com
-Acked-by: John Fastabend <john.fastabend@gmail.com>
-Closes: https://syzkaller.appspot.com/bug?extid=ec941d6e24f633a59172
-Link: https://lore.kernel.org/bpf/20240527-sockmap-verify-deletes-v1-1-944b372f2101@cloudflare.com
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- kernel/bpf/verifier.c | 10 +++++++---
- 1 file changed, 7 insertions(+), 3 deletions(-)
-
-diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
-index 6edfcc3375082..f3b36f500a693 100644
---- a/kernel/bpf/verifier.c
-+++ b/kernel/bpf/verifier.c
-@@ -8756,7 +8756,8 @@ static bool may_update_sockmap(struct bpf_verifier_env *env, int func_id)
- enum bpf_attach_type eatype = env->prog->expected_attach_type;
- enum bpf_prog_type type = resolve_prog_type(env->prog);
-
-- if (func_id != BPF_FUNC_map_update_elem)
-+ if (func_id != BPF_FUNC_map_update_elem &&
-+ func_id != BPF_FUNC_map_delete_elem)
- return false;
-
- /* It's not possible to get access to a locked struct sock in these
-@@ -8767,6 +8768,11 @@ static bool may_update_sockmap(struct bpf_verifier_env *env, int func_id)
- if (eatype == BPF_TRACE_ITER)
- return true;
- break;
-+ case BPF_PROG_TYPE_SOCK_OPS:
-+ /* map_update allowed only via dedicated helpers with event type checks */
-+ if (func_id == BPF_FUNC_map_delete_elem)
-+ return true;
-+ break;
- case BPF_PROG_TYPE_SOCKET_FILTER:
- case BPF_PROG_TYPE_SCHED_CLS:
- case BPF_PROG_TYPE_SCHED_ACT:
-@@ -8862,7 +8868,6 @@ static int check_map_func_compatibility(struct bpf_verifier_env *env,
- case BPF_MAP_TYPE_SOCKMAP:
- if (func_id != BPF_FUNC_sk_redirect_map &&
- func_id != BPF_FUNC_sock_map_update &&
-- func_id != BPF_FUNC_map_delete_elem &&
- func_id != BPF_FUNC_msg_redirect_map &&
- func_id != BPF_FUNC_sk_select_reuseport &&
- func_id != BPF_FUNC_map_lookup_elem &&
-@@ -8872,7 +8877,6 @@ static int check_map_func_compatibility(struct bpf_verifier_env *env,
- case BPF_MAP_TYPE_SOCKHASH:
- if (func_id != BPF_FUNC_sk_redirect_hash &&
- func_id != BPF_FUNC_sock_hash_update &&
-- func_id != BPF_FUNC_map_delete_elem &&
- func_id != BPF_FUNC_msg_redirect_hash &&
- func_id != BPF_FUNC_sk_select_reuseport &&
- func_id != BPF_FUNC_map_lookup_elem &&
---
-2.43.0
-
+++ /dev/null
-From d3faaae38c2a16246344d8376a96ae251659ecf6 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 14 May 2024 09:09:31 +0200
-Subject: bpf: Fix potential integer overflow in resolve_btfids
-
-From: Friedrich Vock <friedrich.vock@gmx.de>
-
-[ Upstream commit 44382b3ed6b2787710c8ade06c0e97f5970a47c8 ]
-
-err is a 32-bit integer, but elf_update returns an off_t, which is 64-bit
-at least on 64-bit platforms. If symbols_patch is called on a binary between
-2-4GB in size, the result will be negative when cast to a 32-bit integer,
-which the code assumes means an error occurred. This can wrongly trigger
-build failures when building very large kernel images.
-
-Fixes: fbbb68de80a4 ("bpf: Add resolve_btfids tool to resolve BTF IDs in ELF object")
-Signed-off-by: Friedrich Vock <friedrich.vock@gmx.de>
-Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
-Acked-by: Daniel Borkmann <daniel@iogearbox.net>
-Link: https://lore.kernel.org/bpf/20240514070931.199694-1-friedrich.vock@gmx.de
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/bpf/resolve_btfids/main.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tools/bpf/resolve_btfids/main.c b/tools/bpf/resolve_btfids/main.c
-index d9520cb826b31..af393c7dee1f1 100644
---- a/tools/bpf/resolve_btfids/main.c
-+++ b/tools/bpf/resolve_btfids/main.c
-@@ -728,7 +728,7 @@ static int sets_patch(struct object *obj)
-
- static int symbols_patch(struct object *obj)
- {
-- int err;
-+ off_t err;
-
- if (__symbols_patch(obj, &obj->structs) ||
- __symbols_patch(obj, &obj->unions) ||
---
-2.43.0
-
+++ /dev/null
-From 4c726eb3d5bf59b75eb9249b6ff5c4fd8be397ce Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 24 May 2024 15:23:36 +0100
-Subject: cifs: Fix missing set of remote_i_size
-
-From: David Howells <dhowells@redhat.com>
-
-[ Upstream commit 93a43155127fec0f8cc942d63b76668c2f8f69fa ]
-
-Occasionally, the generic/001 xfstest will fail indicating corruption in
-one of the copy chains when run on cifs against a server that supports
-FSCTL_DUPLICATE_EXTENTS_TO_FILE (eg. Samba with a share on btrfs). The
-problem is that the remote_i_size value isn't updated by cifs_setsize()
-when called by smb2_duplicate_extents(), but i_size *is*.
-
-This may cause cifs_remap_file_range() to then skip the bit after calling
-->duplicate_extents() that sets sizes.
-
-Fix this by calling netfs_resize_file() in smb2_duplicate_extents() before
-calling cifs_setsize() to set i_size.
-
-This means we don't then need to call netfs_resize_file() upon return from
-->duplicate_extents(), but we also fix the test to compare against the pre-dup
-inode size.
-
-[Note that this goes back before the addition of remote_i_size with the
-netfs_inode struct. It should probably have been setting cifsi->server_eof
-previously.]
-
-Fixes: cfc63fc8126a ("smb3: fix cached file size problems in duplicate extents (reflink)")
-Signed-off-by: David Howells <dhowells@redhat.com>
-cc: Steve French <sfrench@samba.org>
-cc: Paulo Alcantara <pc@manguebit.com>
-cc: Shyam Prasad N <nspmangalore@gmail.com>
-cc: Rohith Surabattula <rohiths.msft@gmail.com>
-cc: Jeff Layton <jlayton@kernel.org>
-cc: linux-cifs@vger.kernel.org
-cc: netfs@lists.linux.dev
-Signed-off-by: Steve French <stfrench@microsoft.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/smb/client/cifsfs.c | 6 +++---
- fs/smb/client/smb2ops.c | 1 +
- 2 files changed, 4 insertions(+), 3 deletions(-)
-
-diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c
-index a5fe291fcc2ff..f04785c84f1e4 100644
---- a/fs/smb/client/cifsfs.c
-+++ b/fs/smb/client/cifsfs.c
-@@ -1280,7 +1280,7 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off,
- struct cifsFileInfo *smb_file_src = src_file->private_data;
- struct cifsFileInfo *smb_file_target = dst_file->private_data;
- struct cifs_tcon *target_tcon, *src_tcon;
-- unsigned long long destend, fstart, fend, new_size;
-+ unsigned long long destend, fstart, fend, old_size, new_size;
- unsigned int xid;
- int rc;
-
-@@ -1347,6 +1347,7 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off,
- goto unlock;
- if (fend > target_cifsi->netfs.zero_point)
- target_cifsi->netfs.zero_point = fend + 1;
-+ old_size = target_cifsi->netfs.remote_i_size;
-
- /* Discard all the folios that overlap the destination region. */
- cifs_dbg(FYI, "about to discard pages %llx-%llx\n", fstart, fend);
-@@ -1359,9 +1360,8 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off,
- if (target_tcon->ses->server->ops->duplicate_extents) {
- rc = target_tcon->ses->server->ops->duplicate_extents(xid,
- smb_file_src, smb_file_target, off, len, destoff);
-- if (rc == 0 && new_size > i_size_read(target_inode)) {
-+ if (rc == 0 && new_size > old_size) {
- truncate_setsize(target_inode, new_size);
-- netfs_resize_file(&target_cifsi->netfs, new_size, true);
- fscache_resize_cookie(cifs_inode_cookie(target_inode),
- new_size);
- }
-diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c
-index ab77ecb2d4f02..0875b1a582896 100644
---- a/fs/smb/client/smb2ops.c
-+++ b/fs/smb/client/smb2ops.c
-@@ -2027,6 +2027,7 @@ smb2_duplicate_extents(const unsigned int xid,
- * size will be queried on next revalidate, but it is important
- * to make sure that file's cached size is updated immediately
- */
-+ netfs_resize_file(netfs_inode(inode), dest_off + len, true);
- cifs_setsize(inode, dest_off + len);
- }
- rc = SMB2_ioctl(xid, tcon, trgtfile->fid.persistent_fid,
---
-2.43.0
-
+++ /dev/null
-From ce242ee33629fb3b49048cfe43436cbc1acc2b12 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 28 Nov 2023 16:26:44 +0000
-Subject: cifs: Set zero_point in the copy_file_range() and remap_file_range()
-
-From: David Howells <dhowells@redhat.com>
-
-[ Upstream commit 3758c485f6c9124d8ad76b88382004cbc28a0892 ]
-
-Set zero_point in the copy_file_range() and remap_file_range()
-implementations so that we don't skip reading data modified on a
-server-side copy.
-
-Signed-off-by: David Howells <dhowells@redhat.com>
-cc: Steve French <sfrench@samba.org>
-cc: Shyam Prasad N <nspmangalore@gmail.com>
-cc: Rohith Surabattula <rohiths.msft@gmail.com>
-cc: Jeff Layton <jlayton@kernel.org>
-cc: linux-cifs@vger.kernel.org
-cc: netfs@lists.linux.dev
-cc: linux-fsdevel@vger.kernel.org
-cc: linux-mm@kvack.org
-Stable-dep-of: 93a43155127f ("cifs: Fix missing set of remote_i_size")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/smb/client/cifsfs.c | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c
-index 81fe60815885c..a5fe291fcc2ff 100644
---- a/fs/smb/client/cifsfs.c
-+++ b/fs/smb/client/cifsfs.c
-@@ -1345,6 +1345,8 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off,
- rc = cifs_flush_folio(target_inode, destend, &fstart, &fend, false);
- if (rc)
- goto unlock;
-+ if (fend > target_cifsi->netfs.zero_point)
-+ target_cifsi->netfs.zero_point = fend + 1;
-
- /* Discard all the folios that overlap the destination region. */
- cifs_dbg(FYI, "about to discard pages %llx-%llx\n", fstart, fend);
-@@ -1363,6 +1365,8 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off,
- fscache_resize_cookie(cifs_inode_cookie(target_inode),
- new_size);
- }
-+ if (rc == 0 && new_size > target_cifsi->netfs.zero_point)
-+ target_cifsi->netfs.zero_point = new_size;
- }
-
- /* force revalidate of size and timestamps of target file now
-@@ -1454,6 +1458,8 @@ ssize_t cifs_file_copychunk_range(unsigned int xid,
- rc = cifs_flush_folio(target_inode, destend, &fstart, &fend, false);
- if (rc)
- goto unlock;
-+ if (fend > target_cifsi->netfs.zero_point)
-+ target_cifsi->netfs.zero_point = fend + 1;
-
- /* Discard all the folios that overlap the destination region. */
- truncate_inode_pages_range(&target_inode->i_data, fstart, fend);
---
-2.43.0
-
+++ /dev/null
-From 66fb0db9908262a116d13cc7e54457b5bf979d76 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 15 Feb 2024 09:58:10 -0800
-Subject: coccinelle: Add rules to find str_plural() replacements
-
-From: Kees Cook <keescook@chromium.org>
-
-[ Upstream commit 1d02f252339e2eaf3ba35b9dc77e7a1a9aa7414c ]
-
-Add rules for finding places where str_plural() can be used. This
-currently finds:
- 54 files changed, 62 insertions(+), 61 deletions(-)
-
-Co-developed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
-Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
-Link: https://lore.kernel.org/all/fc1b25a8-6381-47c2-831c-ab6b8201a82b@intel.com/
-Signed-off-by: Kees Cook <keescook@chromium.org>
-Stable-dep-of: 5bb288c4abc2 ("scsi: mptfusion: Avoid possible run-time warning with long manufacturer strings")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- MAINTAINERS | 1 +
- scripts/coccinelle/api/string_choices.cocci | 41 +++++++++++++++++++++
- 2 files changed, 42 insertions(+)
- create mode 100644 scripts/coccinelle/api/string_choices.cocci
-
-diff --git a/MAINTAINERS b/MAINTAINERS
-index 1aabf1c15bb30..f269d603851c6 100644
---- a/MAINTAINERS
-+++ b/MAINTAINERS
-@@ -8985,6 +8985,7 @@ F: lib/string.c
- F: lib/string_helpers.c
- F: lib/test-string_helpers.c
- F: lib/test_string.c
-+F: scripts/coccinelle/api/string_choices.cocci
-
- GENERIC UIO DRIVER FOR PCI DEVICES
- M: "Michael S. Tsirkin" <mst@redhat.com>
-diff --git a/scripts/coccinelle/api/string_choices.cocci b/scripts/coccinelle/api/string_choices.cocci
-new file mode 100644
-index 0000000000000..a71966c0494ef
---- /dev/null
-+++ b/scripts/coccinelle/api/string_choices.cocci
-@@ -0,0 +1,41 @@
-+// SPDX-License-Identifier: GPL-2.0-only
-+/// Find places to use string_choices.h's various helpers.
-+//
-+// Confidence: Medium
-+// Options: --no-includes --include-headers
-+virtual patch
-+virtual context
-+virtual report
-+
-+@str_plural depends on patch@
-+expression E;
-+@@
-+(
-+- ((E == 1) ? "" : "s")
-++ str_plural(E)
-+|
-+- ((E != 1) ? "s" : "")
-++ str_plural(E)
-+|
-+- ((E > 1) ? "s" : "")
-++ str_plural(E)
-+)
-+
-+@str_plural_r depends on !patch exists@
-+expression E;
-+position P;
-+@@
-+(
-+* ((E@P == 1) ? "" : "s")
-+|
-+* ((E@P != 1) ? "s" : "")
-+|
-+* ((E@P > 1) ? "s" : "")
-+)
-+
-+@script:python depends on report@
-+p << str_plural_r.P;
-+e << str_plural_r.E;
-+@@
-+
-+coccilib.report.print_report(p[0], "opportunity for str_plural(%s)" % e)
---
-2.43.0
-
+++ /dev/null
-From 5062e16102214201d2d3c497889bccda82481fe0 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 12 Apr 2024 15:26:59 +0100
-Subject: coresight: etm4x: Do not hardcode IOMEM access for register restore
-
-From: Suzuki K Poulose <suzuki.poulose@arm.com>
-
-[ Upstream commit 1e7ba33fa591de1cf60afffcabb45600b3607025 ]
-
-When we restore the register state for ETM4x, while coming back
-from CPU idle, we hardcode IOMEM access. This is wrong and could
-blow up for an ETM with system instructions access (and for ETE).
-
-Fixes: f5bd523690d2 ("coresight: etm4x: Convert all register accesses")
-Reported-by: Yabin Cui <yabinc@google.com>
-Reviewed-by: Mike Leach <mike.leach@linaro.org>
-Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
-Tested-by: Yabin Cui <yabinc@google.com>
-Link: https://lore.kernel.org/r/20240412142702.2882478-2-suzuki.poulose@arm.com
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/hwtracing/coresight/coresight-etm4x-core.c | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
-index f37f792d352eb..e267113698616 100644
---- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
-+++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
-@@ -1847,8 +1847,10 @@ static void __etm4_cpu_restore(struct etmv4_drvdata *drvdata)
- {
- int i;
- struct etmv4_save_state *state = drvdata->save_state;
-- struct csdev_access tmp_csa = CSDEV_ACCESS_IOMEM(drvdata->base);
-- struct csdev_access *csa = &tmp_csa;
-+ struct csdev_access *csa = &drvdata->csdev->access;
-+
-+ if (WARN_ON(!drvdata->csdev))
-+ return;
-
- etm4_cs_unlock(drvdata, csa);
- etm4x_relaxed_write32(csa, state->trcclaimset, TRCCLAIMSET);
---
-2.43.0
-
+++ /dev/null
-From 3685aa7f962c0a4deb9db14f64053a8dc8992575 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 12 Apr 2024 15:27:00 +0100
-Subject: coresight: etm4x: Do not save/restore Data trace control registers
-
-From: Suzuki K Poulose <suzuki.poulose@arm.com>
-
-[ Upstream commit 5eb3a0c2c52368cb9902e9a6ea04888e093c487d ]
-
-ETM4x doesn't support Data trace on A class CPUs. As such do not access the
-Data trace control registers during CPU idle. This could cause problems for
-ETE. While at it, remove all references to the Data trace control registers.
-
-Fixes: f188b5e76aae ("coresight: etm4x: Save/restore state across CPU low power states")
-Reported-by: Yabin Cui <yabinc@google.com>
-Reviewed-by: Mike Leach <mike.leach@linaro.org>
-Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
-Tested-by: Yabin Cui <yabinc@google.com>
-Link: https://lore.kernel.org/r/20240412142702.2882478-3-suzuki.poulose@arm.com
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- .../coresight/coresight-etm4x-core.c | 6 ----
- drivers/hwtracing/coresight/coresight-etm4x.h | 28 -------------------
- 2 files changed, 34 deletions(-)
-
-diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
-index e267113698616..85381f7831268 100644
---- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
-+++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
-@@ -1743,9 +1743,6 @@ static int __etm4_cpu_save(struct etmv4_drvdata *drvdata)
- state->trcvissctlr = etm4x_read32(csa, TRCVISSCTLR);
- if (drvdata->nr_pe_cmp)
- state->trcvipcssctlr = etm4x_read32(csa, TRCVIPCSSCTLR);
-- state->trcvdctlr = etm4x_read32(csa, TRCVDCTLR);
-- state->trcvdsacctlr = etm4x_read32(csa, TRCVDSACCTLR);
-- state->trcvdarcctlr = etm4x_read32(csa, TRCVDARCCTLR);
-
- for (i = 0; i < drvdata->nrseqstate - 1; i++)
- state->trcseqevr[i] = etm4x_read32(csa, TRCSEQEVRn(i));
-@@ -1876,9 +1873,6 @@ static void __etm4_cpu_restore(struct etmv4_drvdata *drvdata)
- etm4x_relaxed_write32(csa, state->trcvissctlr, TRCVISSCTLR);
- if (drvdata->nr_pe_cmp)
- etm4x_relaxed_write32(csa, state->trcvipcssctlr, TRCVIPCSSCTLR);
-- etm4x_relaxed_write32(csa, state->trcvdctlr, TRCVDCTLR);
-- etm4x_relaxed_write32(csa, state->trcvdsacctlr, TRCVDSACCTLR);
-- etm4x_relaxed_write32(csa, state->trcvdarcctlr, TRCVDARCCTLR);
-
- for (i = 0; i < drvdata->nrseqstate - 1; i++)
- etm4x_relaxed_write32(csa, state->trcseqevr[i], TRCSEQEVRn(i));
-diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h
-index da17b6c49b0f1..574dbaef50836 100644
---- a/drivers/hwtracing/coresight/coresight-etm4x.h
-+++ b/drivers/hwtracing/coresight/coresight-etm4x.h
-@@ -43,9 +43,6 @@
- #define TRCVIIECTLR 0x084
- #define TRCVISSCTLR 0x088
- #define TRCVIPCSSCTLR 0x08C
--#define TRCVDCTLR 0x0A0
--#define TRCVDSACCTLR 0x0A4
--#define TRCVDARCCTLR 0x0A8
- /* Derived resources registers */
- #define TRCSEQEVRn(n) (0x100 + (n * 4)) /* n = 0-2 */
- #define TRCSEQRSTEVR 0x118
-@@ -90,9 +87,6 @@
- /* Address Comparator registers n = 0-15 */
- #define TRCACVRn(n) (0x400 + (n * 8))
- #define TRCACATRn(n) (0x480 + (n * 8))
--/* Data Value Comparator Value registers, n = 0-7 */
--#define TRCDVCVRn(n) (0x500 + (n * 16))
--#define TRCDVCMRn(n) (0x580 + (n * 16))
- /* ContextID/Virtual ContextID comparators, n = 0-7 */
- #define TRCCIDCVRn(n) (0x600 + (n * 8))
- #define TRCVMIDCVRn(n) (0x640 + (n * 8))
-@@ -272,9 +266,6 @@
- /* List of registers accessible via System instructions */
- #define ETM4x_ONLY_SYSREG_LIST(op, val) \
- CASE_##op((val), TRCPROCSELR) \
-- CASE_##op((val), TRCVDCTLR) \
-- CASE_##op((val), TRCVDSACCTLR) \
-- CASE_##op((val), TRCVDARCCTLR) \
- CASE_##op((val), TRCOSLAR)
-
- #define ETM_COMMON_SYSREG_LIST(op, val) \
-@@ -422,22 +413,6 @@
- CASE_##op((val), TRCACATRn(13)) \
- CASE_##op((val), TRCACATRn(14)) \
- CASE_##op((val), TRCACATRn(15)) \
-- CASE_##op((val), TRCDVCVRn(0)) \
-- CASE_##op((val), TRCDVCVRn(1)) \
-- CASE_##op((val), TRCDVCVRn(2)) \
-- CASE_##op((val), TRCDVCVRn(3)) \
-- CASE_##op((val), TRCDVCVRn(4)) \
-- CASE_##op((val), TRCDVCVRn(5)) \
-- CASE_##op((val), TRCDVCVRn(6)) \
-- CASE_##op((val), TRCDVCVRn(7)) \
-- CASE_##op((val), TRCDVCMRn(0)) \
-- CASE_##op((val), TRCDVCMRn(1)) \
-- CASE_##op((val), TRCDVCMRn(2)) \
-- CASE_##op((val), TRCDVCMRn(3)) \
-- CASE_##op((val), TRCDVCMRn(4)) \
-- CASE_##op((val), TRCDVCMRn(5)) \
-- CASE_##op((val), TRCDVCMRn(6)) \
-- CASE_##op((val), TRCDVCMRn(7)) \
- CASE_##op((val), TRCCIDCVRn(0)) \
- CASE_##op((val), TRCCIDCVRn(1)) \
- CASE_##op((val), TRCCIDCVRn(2)) \
-@@ -907,9 +882,6 @@ struct etmv4_save_state {
- u32 trcviiectlr;
- u32 trcvissctlr;
- u32 trcvipcssctlr;
-- u32 trcvdctlr;
-- u32 trcvdsacctlr;
-- u32 trcvdarcctlr;
-
- u32 trcseqevr[ETM_MAX_SEQ_STATES];
- u32 trcseqrstevr;
---
-2.43.0
-
+++ /dev/null
-From c6f3bf16a68edfb7f77f3c98c20d39caa80fd5b6 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 12 Apr 2024 15:27:02 +0100
-Subject: coresight: etm4x: Fix access to resource selector registers
-
-From: Suzuki K Poulose <suzuki.poulose@arm.com>
-
-[ Upstream commit d6fc00d0f640d6010b51054aa8b0fd191177dbc9 ]
-
-Resource selector pair 0 is always implemented and reserved. We must not
-touch it, even during save/restore for CPU Idle. Rest of the driver is
-well behaved. Fix the offending ones.
-
-Reported-by: Yabin Cui <yabinc@google.com>
-Fixes: f188b5e76aae ("coresight: etm4x: Save/restore state across CPU low power states")
-Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
-Tested-by: Yabin Cui <yabinc@google.com>
-Reviewed-by: Mike Leach <mike.leach@linaro.org>
-Link: https://lore.kernel.org/r/20240412142702.2882478-5-suzuki.poulose@arm.com
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/hwtracing/coresight/coresight-etm4x-core.c | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
-index 4988503f68558..30e8a235242d5 100644
---- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
-+++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
-@@ -1762,7 +1762,8 @@ static int __etm4_cpu_save(struct etmv4_drvdata *drvdata)
- state->trccntvr[i] = etm4x_read32(csa, TRCCNTVRn(i));
- }
-
-- for (i = 0; i < drvdata->nr_resource * 2; i++)
-+ /* Resource selector pair 0 is reserved */
-+ for (i = 2; i < drvdata->nr_resource * 2; i++)
- state->trcrsctlr[i] = etm4x_read32(csa, TRCRSCTLRn(i));
-
- for (i = 0; i < drvdata->nr_ss_cmp; i++) {
-@@ -1893,7 +1894,8 @@ static void __etm4_cpu_restore(struct etmv4_drvdata *drvdata)
- etm4x_relaxed_write32(csa, state->trccntvr[i], TRCCNTVRn(i));
- }
-
-- for (i = 0; i < drvdata->nr_resource * 2; i++)
-+ /* Resource selector pair 0 is reserved */
-+ for (i = 2; i < drvdata->nr_resource * 2; i++)
- etm4x_relaxed_write32(csa, state->trcrsctlr[i], TRCRSCTLRn(i));
-
- for (i = 0; i < drvdata->nr_ss_cmp; i++) {
---
-2.43.0
-
+++ /dev/null
-From a82576951c5963eef8c37a2d4e804de44e323035 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 14 Mar 2024 11:28:33 +0530
-Subject: coresight: etm4x: Fix unbalanced pm_runtime_enable()
-
-From: Anshuman Khandual <anshuman.khandual@arm.com>
-
-[ Upstream commit caa41c47dab7e1054f587e592ab21296e3a6781c ]
-
-There is an unbalanced pm_runtime_enable() in etm4_probe_platform_dev()
-when etm4_probe() fails. This problem can be observed via the coresight
-etm4 module's (load -> unload -> load) sequence when etm4_probe() fails
-in etm4_probe_platform_dev().
-
-[ 63.379943] coresight-etm4x 7040000.etm: Unbalanced pm_runtime_enable!
-[ 63.393630] coresight-etm4x 7140000.etm: Unbalanced pm_runtime_enable!
-[ 63.407455] coresight-etm4x 7240000.etm: Unbalanced pm_runtime_enable!
-[ 63.420983] coresight-etm4x 7340000.etm: Unbalanced pm_runtime_enable!
-[ 63.420999] coresight-etm4x 7440000.etm: Unbalanced pm_runtime_enable!
-[ 63.441209] coresight-etm4x 7540000.etm: Unbalanced pm_runtime_enable!
-[ 63.454689] coresight-etm4x 7640000.etm: Unbalanced pm_runtime_enable!
-[ 63.474982] coresight-etm4x 7740000.etm: Unbalanced pm_runtime_enable!
-
-This fixes the above problem - with an explicit pm_runtime_disable() call
-when etm4_probe() fails during etm4_probe_platform_dev().
-
-Cc: Lorenzo Pieralisi <lpieralisi@kernel.org>
-Cc: Hanjun Guo <guohanjun@huawei.com>
-Cc: Sudeep Holla <sudeep.holla@arm.com>
-Cc: "Rafael J. Wysocki" <rafael@kernel.org>
-Cc: Len Brown <lenb@kernel.org>
-Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
-Cc: Mike Leach <mike.leach@linaro.org>
-Cc: James Clark <james.clark@arm.com>
-Cc: Leo Yan <leo.yan@linaro.org>
-Cc: linux-acpi@vger.kernel.org
-Cc: linux-arm-kernel@lists.infradead.org
-Cc: linux-kernel@vger.kernel.org
-Cc: coresight@lists.linaro.org
-Fixes: 5214b563588e ("coresight: etm4x: Add support for sysreg only devices")
-Reviewed-by: James Clark <james.clark@arm.com>
-Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
-Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
-Link: https://lore.kernel.org/r/20240314055843.2625883-2-anshuman.khandual@arm.com
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/hwtracing/coresight/coresight-etm4x-core.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
-index 2e2cabc5f50ab..f37f792d352eb 100644
---- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
-+++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
-@@ -2217,6 +2217,9 @@ static int etm4_probe_platform_dev(struct platform_device *pdev)
- ret = etm4_probe(&pdev->dev);
-
- pm_runtime_put(&pdev->dev);
-+ if (ret)
-+ pm_runtime_disable(&pdev->dev);
-+
- return ret;
- }
-
---
-2.43.0
-
+++ /dev/null
-From 4384f8a572258d3e79fea07cc51af1db69f78015 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 12 Apr 2024 15:27:01 +0100
-Subject: coresight: etm4x: Safe access for TRCQCLTR
-
-From: Suzuki K Poulose <suzuki.poulose@arm.com>
-
-[ Upstream commit 46bf8d7cd8530eca607379033b9bc4ac5590a0cd ]
-
-ETM4x implements TRCQCLTR only when the Q elements are supported
-and the Q element filtering is supported (TRCIDR0.QFILT). Access
-to the register otherwise could be fatal. Fix this by tracking the
-availability, like the others.
-
-Fixes: f188b5e76aae ("coresight: etm4x: Save/restore state across CPU low power states")
-Reported-by: Yabin Cui <yabinc@google.com>
-Reviewed-by: Mike Leach <mike.leach@linaro.org>
-Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
-Tested-by: Yabin Cui <yabinc@google.com>
-Link: https://lore.kernel.org/r/20240412142702.2882478-4-suzuki.poulose@arm.com
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/hwtracing/coresight/coresight-etm4x-core.c | 8 ++++++--
- drivers/hwtracing/coresight/coresight-etm4x.h | 3 +++
- 2 files changed, 9 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
-index 85381f7831268..4988503f68558 100644
---- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
-+++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
-@@ -1244,6 +1244,8 @@ static void etm4_init_arch_data(void *info)
- drvdata->nr_event = FIELD_GET(TRCIDR0_NUMEVENT_MASK, etmidr0);
- /* QSUPP, bits[16:15] Q element support field */
- drvdata->q_support = FIELD_GET(TRCIDR0_QSUPP_MASK, etmidr0);
-+ if (drvdata->q_support)
-+ drvdata->q_filt = !!(etmidr0 & TRCIDR0_QFILT);
- /* TSSIZE, bits[28:24] Global timestamp size field */
- drvdata->ts_size = FIELD_GET(TRCIDR0_TSSIZE_MASK, etmidr0);
-
-@@ -1736,7 +1738,8 @@ static int __etm4_cpu_save(struct etmv4_drvdata *drvdata)
- state->trcccctlr = etm4x_read32(csa, TRCCCCTLR);
- state->trcbbctlr = etm4x_read32(csa, TRCBBCTLR);
- state->trctraceidr = etm4x_read32(csa, TRCTRACEIDR);
-- state->trcqctlr = etm4x_read32(csa, TRCQCTLR);
-+ if (drvdata->q_filt)
-+ state->trcqctlr = etm4x_read32(csa, TRCQCTLR);
-
- state->trcvictlr = etm4x_read32(csa, TRCVICTLR);
- state->trcviiectlr = etm4x_read32(csa, TRCVIIECTLR);
-@@ -1866,7 +1869,8 @@ static void __etm4_cpu_restore(struct etmv4_drvdata *drvdata)
- etm4x_relaxed_write32(csa, state->trcccctlr, TRCCCCTLR);
- etm4x_relaxed_write32(csa, state->trcbbctlr, TRCBBCTLR);
- etm4x_relaxed_write32(csa, state->trctraceidr, TRCTRACEIDR);
-- etm4x_relaxed_write32(csa, state->trcqctlr, TRCQCTLR);
-+ if (drvdata->q_filt)
-+ etm4x_relaxed_write32(csa, state->trcqctlr, TRCQCTLR);
-
- etm4x_relaxed_write32(csa, state->trcvictlr, TRCVICTLR);
- etm4x_relaxed_write32(csa, state->trcviiectlr, TRCVIIECTLR);
-diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h
-index 574dbaef50836..6b6760e49ed35 100644
---- a/drivers/hwtracing/coresight/coresight-etm4x.h
-+++ b/drivers/hwtracing/coresight/coresight-etm4x.h
-@@ -135,6 +135,7 @@
- #define TRCIDR0_TRCCCI BIT(7)
- #define TRCIDR0_RETSTACK BIT(9)
- #define TRCIDR0_NUMEVENT_MASK GENMASK(11, 10)
-+#define TRCIDR0_QFILT BIT(14)
- #define TRCIDR0_QSUPP_MASK GENMASK(16, 15)
- #define TRCIDR0_TSSIZE_MASK GENMASK(28, 24)
-
-@@ -954,6 +955,7 @@ struct etmv4_save_state {
- * @os_unlock: True if access to management registers is allowed.
- * @instrp0: Tracing of load and store instructions
- * as P0 elements is supported.
-+ * @q_filt: Q element filtering support, if Q elements are supported.
- * @trcbb: Indicates if the trace unit supports branch broadcast tracing.
- * @trccond: If the trace unit supports conditional
- * instruction tracing.
-@@ -1017,6 +1019,7 @@ struct etmv4_drvdata {
- bool boot_enable;
- bool os_unlock;
- bool instrp0;
-+ bool q_filt;
- bool trcbb;
- bool trccond;
- bool retstack;
---
-2.43.0
-
+++ /dev/null
-From ffa3ac5c1d5caf5e3d9c3e2d2d612802a1fc1d4e Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 22 Dec 2023 21:05:11 -0800
-Subject: counter: linux/counter.h: fix Excess kernel-doc description warning
-
-From: Randy Dunlap <rdunlap@infradead.org>
-
-[ Upstream commit 416bdb89605d960405178b9bf04df512d1ace1a3 ]
-
-Remove the @priv: line to prevent the kernel-doc warning:
-
-include/linux/counter.h:400: warning: Excess struct member 'priv' description in 'counter_device'
-
-Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
-Fixes: f2ee4759fb70 ("counter: remove old and now unused registration API")
-Link: https://lore.kernel.org/r/20231223050511.13849-1-rdunlap@infradead.org
-Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- include/linux/counter.h | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/include/linux/counter.h b/include/linux/counter.h
-index 702e9108bbb44..b767b5c821f58 100644
---- a/include/linux/counter.h
-+++ b/include/linux/counter.h
-@@ -359,7 +359,6 @@ struct counter_ops {
- * @num_counts: number of Counts specified in @counts
- * @ext: optional array of Counter device extensions
- * @num_ext: number of Counter device extensions specified in @ext
-- * @priv: optional private data supplied by driver
- * @dev: internal device structure
- * @chrdev: internal character device structure
- * @events_list: list of current watching Counter events
---
-2.43.0
-
+++ /dev/null
-From 79be1ef9b03ea879d17e9503c5c9ca3a8768801d Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sun, 28 Apr 2024 11:07:48 +0800
-Subject: cxl/region: Fix cxlr_pmem leaks
-
-From: Li Zhijian <lizhijian@fujitsu.com>
-
-[ Upstream commit 1c987cf22d6b65ade46145c03eef13f0e3e81d83 ]
-
-Before this error path, cxlr_pmem pointed to a kzalloc() memory, free
-it to avoid this memory leaking.
-
-Fixes: f17b558d6663 ("cxl/pmem: Refactor nvdimm device registration, delete the workqueue")
-Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
-Reviewed-by: Dan Williams <dan.j.williams@intel.com>
-Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-Link: https://lore.kernel.org/r/20240428030748.318985-1-lizhijian@fujitsu.com
-Signed-off-by: Dave Jiang <dave.jiang@intel.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/cxl/core/region.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
-index 4c7fd2d5cccb2..2aaff86869b7e 100644
---- a/drivers/cxl/core/region.c
-+++ b/drivers/cxl/core/region.c
-@@ -2550,6 +2550,7 @@ static struct cxl_pmem_region *cxl_pmem_region_alloc(struct cxl_region *cxlr)
- if (i == 0) {
- cxl_nvb = cxl_find_nvdimm_bridge(cxlmd);
- if (!cxl_nvb) {
-+ kfree(cxlr_pmem);
- cxlr_pmem = ERR_PTR(-ENODEV);
- goto out;
- }
---
-2.43.0
-
+++ /dev/null
-From 1059ef95c75e915c16233e1af2028e38df735d43 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 30 Apr 2024 10:28:03 -0700
-Subject: cxl/trace: Correct DPA field masks for general_media & dram events
-
-From: Alison Schofield <alison.schofield@intel.com>
-
-[ Upstream commit 2042d11cb57b7e0cbda7910e5ff80e9e8bf0ae17 ]
-
-The length of Physical Address in General Media and DRAM event
-records is 64-bit, so the field mask for extracting the DPA should
-be 64-bit also, otherwise the trace event reports DPA's with the
-upper 32 bits of a DPA address masked off. If users do DPA-to-HPA
-translations this could lead to incorrect page retirement decisions.
-
-Use GENMASK_ULL() for CXL_DPA_MASK to get all the DPA address bits.
-
-Tidy up CXL_DPA_FLAGS_MASK by using GENMASK() to only mask the exact
-flag bits.
-
-These bits are defined as part of the event record physical address
-descriptions of General Media and DRAM events in CXL Spec 3.1
-Section 8.2.9.2 Events.
-
-Fixes: d54a531a430b ("cxl/mem: Trace General Media Event Record")
-Co-developed-by: Shiyang Ruan <ruansy.fnst@fujitsu.com>
-Signed-off-by: Shiyang Ruan <ruansy.fnst@fujitsu.com>
-Signed-off-by: Alison Schofield <alison.schofield@intel.com>
-Reviewed-by: Ira Weiny <ira.weiny@intel.com>
-Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-Link: https://lore.kernel.org/r/2867fc43c57720a4a15a3179431829b8dbd2dc16.1714496730.git.alison.schofield@intel.com
-Signed-off-by: Dave Jiang <dave.jiang@intel.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/cxl/core/trace.h | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/cxl/core/trace.h b/drivers/cxl/core/trace.h
-index e5f13260fc524..7c5cd069f10cc 100644
---- a/drivers/cxl/core/trace.h
-+++ b/drivers/cxl/core/trace.h
-@@ -253,8 +253,8 @@ TRACE_EVENT(cxl_generic_event,
- * DRAM Event Record
- * CXL rev 3.0 section 8.2.9.2.1.2; Table 8-44
- */
--#define CXL_DPA_FLAGS_MASK 0x3F
--#define CXL_DPA_MASK (~CXL_DPA_FLAGS_MASK)
-+#define CXL_DPA_FLAGS_MASK GENMASK(1, 0)
-+#define CXL_DPA_MASK GENMASK_ULL(63, 6)
-
- #define CXL_DPA_VOLATILE BIT(0)
- #define CXL_DPA_NOT_REPAIRABLE BIT(1)
---
-2.43.0
-
+++ /dev/null
-From 1a75fd61311d3573d3556c1ae10e0afc4b034403 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sun, 5 May 2024 23:08:31 +0900
-Subject: dma-buf/sw-sync: don't enable IRQ from sync_print_obj()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
-
-[ Upstream commit b794918961516f667b0c745aebdfebbb8a98df39 ]
-
-Since commit a6aa8fca4d79 ("dma-buf/sw-sync: Reduce irqsave/irqrestore from
-known context") by error replaced spin_unlock_irqrestore() with
-spin_unlock_irq() for both sync_debugfs_show() and sync_print_obj() despite
-sync_print_obj() is called from sync_debugfs_show(), lockdep complains
-inconsistent lock state warning.
-
-Use plain spin_{lock,unlock}() for sync_print_obj(), for
-sync_debugfs_show() is already using spin_{lock,unlock}_irq().
-
-Reported-by: syzbot <syzbot+a225ee3df7e7f9372dbe@syzkaller.appspotmail.com>
-Closes: https://syzkaller.appspot.com/bug?extid=a225ee3df7e7f9372dbe
-Fixes: a6aa8fca4d79 ("dma-buf/sw-sync: Reduce irqsave/irqrestore from known context")
-Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
-Reviewed-by: Christian König <christian.koenig@amd.com>
-Link: https://patchwork.freedesktop.org/patch/msgid/c2e46020-aaa6-4e06-bf73-f05823f913f0@I-love.SAKURA.ne.jp
-Signed-off-by: Christian König <christian.koenig@amd.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/dma-buf/sync_debug.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/dma-buf/sync_debug.c b/drivers/dma-buf/sync_debug.c
-index 101394f16930f..237bce21d1e72 100644
---- a/drivers/dma-buf/sync_debug.c
-+++ b/drivers/dma-buf/sync_debug.c
-@@ -110,12 +110,12 @@ static void sync_print_obj(struct seq_file *s, struct sync_timeline *obj)
-
- seq_printf(s, "%s: %d\n", obj->name, obj->value);
-
-- spin_lock_irq(&obj->lock);
-+ spin_lock(&obj->lock); /* Caller already disabled IRQ. */
- list_for_each(pos, &obj->pt_list) {
- struct sync_pt *pt = container_of(pos, struct sync_pt, link);
- sync_print_fence(s, &pt->base, false);
- }
-- spin_unlock_irq(&obj->lock);
-+ spin_unlock(&obj->lock);
- }
-
- static void sync_print_sync_file(struct seq_file *s,
---
-2.43.0
-
+++ /dev/null
-From 751a523adf2e95ff053229e62f5890fb7edb4bf0 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 4 May 2024 14:47:03 +0300
-Subject: dma-mapping: benchmark: fix node id validation
-
-From: Fedor Pchelkin <pchelkin@ispras.ru>
-
-[ Upstream commit 1ff05e723f7ca30644b8ec3fb093f16312e408ad ]
-
-While validating node ids in map_benchmark_ioctl(), node_possible() may
-be provided with invalid argument outside of [0,MAX_NUMNODES-1] range
-leading to:
-
-BUG: KASAN: wild-memory-access in map_benchmark_ioctl (kernel/dma/map_benchmark.c:214)
-Read of size 8 at addr 1fffffff8ccb6398 by task dma_map_benchma/971
-CPU: 7 PID: 971 Comm: dma_map_benchma Not tainted 6.9.0-rc6 #37
-Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)
-Call Trace:
- <TASK>
-dump_stack_lvl (lib/dump_stack.c:117)
-kasan_report (mm/kasan/report.c:603)
-kasan_check_range (mm/kasan/generic.c:189)
-variable_test_bit (arch/x86/include/asm/bitops.h:227) [inline]
-arch_test_bit (arch/x86/include/asm/bitops.h:239) [inline]
-_test_bit at (include/asm-generic/bitops/instrumented-non-atomic.h:142) [inline]
-node_state (include/linux/nodemask.h:423) [inline]
-map_benchmark_ioctl (kernel/dma/map_benchmark.c:214)
-full_proxy_unlocked_ioctl (fs/debugfs/file.c:333)
-__x64_sys_ioctl (fs/ioctl.c:890)
-do_syscall_64 (arch/x86/entry/common.c:83)
-entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)
-
-Compare node ids with sane bounds first. NUMA_NO_NODE is considered a
-special valid case meaning that benchmarking kthreads won't be bound to a
-cpuset of a given node.
-
-Found by Linux Verification Center (linuxtesting.org).
-
-Fixes: 65789daa8087 ("dma-mapping: add benchmark support for streaming DMA APIs")
-Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
-Reviewed-by: Robin Murphy <robin.murphy@arm.com>
-Signed-off-by: Christoph Hellwig <hch@lst.de>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- kernel/dma/map_benchmark.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/kernel/dma/map_benchmark.c b/kernel/dma/map_benchmark.c
-index 2478957cf9f83..59fb3f849b351 100644
---- a/kernel/dma/map_benchmark.c
-+++ b/kernel/dma/map_benchmark.c
-@@ -212,7 +212,8 @@ static long map_benchmark_ioctl(struct file *file, unsigned int cmd,
- }
-
- if (map->bparam.node != NUMA_NO_NODE &&
-- !node_possible(map->bparam.node)) {
-+ (map->bparam.node < 0 || map->bparam.node >= MAX_NUMNODES ||
-+ !node_possible(map->bparam.node))) {
- pr_err("invalid numa node\n");
- return -EINVAL;
- }
---
-2.43.0
-
+++ /dev/null
-From 43254f21bc6b9616746e41b9460cdc9707d80867 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 4 May 2024 14:47:01 +0300
-Subject: dma-mapping: benchmark: fix up kthread-related error handling
-
-From: Fedor Pchelkin <pchelkin@ispras.ru>
-
-[ Upstream commit bb9025f4432f8c158322cf2c04c2b492f23eb511 ]
-
-kthread creation failure is invalidly handled inside do_map_benchmark().
-The put_task_struct() calls on the error path are supposed to balance the
-get_task_struct() calls which only happen after all the kthreads are
-successfully created. Rollback using kthread_stop() for already created
-kthreads in case of such failure.
-
-In normal situation call kthread_stop_put() to gracefully stop kthreads
-and put their task refcounts. This should be done for all started
-kthreads.
-
-Found by Linux Verification Center (linuxtesting.org).
-
-Fixes: 65789daa8087 ("dma-mapping: add benchmark support for streaming DMA APIs")
-Suggested-by: Robin Murphy <robin.murphy@arm.com>
-Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
-Reviewed-by: Robin Murphy <robin.murphy@arm.com>
-Signed-off-by: Christoph Hellwig <hch@lst.de>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- kernel/dma/map_benchmark.c | 16 ++++++++++------
- 1 file changed, 10 insertions(+), 6 deletions(-)
-
-diff --git a/kernel/dma/map_benchmark.c b/kernel/dma/map_benchmark.c
-index 02205ab53b7e9..2478957cf9f83 100644
---- a/kernel/dma/map_benchmark.c
-+++ b/kernel/dma/map_benchmark.c
-@@ -118,6 +118,8 @@ static int do_map_benchmark(struct map_benchmark_data *map)
- if (IS_ERR(tsk[i])) {
- pr_err("create dma_map thread failed\n");
- ret = PTR_ERR(tsk[i]);
-+ while (--i >= 0)
-+ kthread_stop(tsk[i]);
- goto out;
- }
-
-@@ -139,13 +141,17 @@ static int do_map_benchmark(struct map_benchmark_data *map)
-
- msleep_interruptible(map->bparam.seconds * 1000);
-
-- /* wait for the completion of benchmark threads */
-+ /* wait for the completion of all started benchmark threads */
- for (i = 0; i < threads; i++) {
-- ret = kthread_stop(tsk[i]);
-- if (ret)
-- goto out;
-+ int kthread_ret = kthread_stop_put(tsk[i]);
-+
-+ if (kthread_ret)
-+ ret = kthread_ret;
- }
-
-+ if (ret)
-+ goto out;
-+
- loops = atomic64_read(&map->loops);
- if (likely(loops > 0)) {
- u64 map_variance, unmap_variance;
-@@ -170,8 +176,6 @@ static int do_map_benchmark(struct map_benchmark_data *map)
- }
-
- out:
-- for (i = 0; i < threads; i++)
-- put_task_struct(tsk[i]);
- put_device(map->dev);
- kfree(tsk);
- return ret;
---
-2.43.0
-
+++ /dev/null
-From 57d7b930ea1d8e75a696370504d439715014d0b9 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 4 May 2024 14:47:04 +0300
-Subject: dma-mapping: benchmark: handle NUMA_NO_NODE correctly
-
-From: Fedor Pchelkin <pchelkin@ispras.ru>
-
-[ Upstream commit e64746e74f717961250a155e14c156616fcd981f ]
-
-cpumask_of_node() can be called for NUMA_NO_NODE inside do_map_benchmark()
-resulting in the following sanitizer report:
-
-UBSAN: array-index-out-of-bounds in ./arch/x86/include/asm/topology.h:72:28
-index -1 is out of range for type 'cpumask [64][1]'
-CPU: 1 PID: 990 Comm: dma_map_benchma Not tainted 6.9.0-rc6 #29
-Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)
-Call Trace:
- <TASK>
-dump_stack_lvl (lib/dump_stack.c:117)
-ubsan_epilogue (lib/ubsan.c:232)
-__ubsan_handle_out_of_bounds (lib/ubsan.c:429)
-cpumask_of_node (arch/x86/include/asm/topology.h:72) [inline]
-do_map_benchmark (kernel/dma/map_benchmark.c:104)
-map_benchmark_ioctl (kernel/dma/map_benchmark.c:246)
-full_proxy_unlocked_ioctl (fs/debugfs/file.c:333)
-__x64_sys_ioctl (fs/ioctl.c:890)
-do_syscall_64 (arch/x86/entry/common.c:83)
-entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)
-
-Use cpumask_of_node() in place when binding a kernel thread to a cpuset
-of a particular node.
-
-Note that the provided node id is checked inside map_benchmark_ioctl().
-It's just a NUMA_NO_NODE case which is not handled properly later.
-
-Found by Linux Verification Center (linuxtesting.org).
-
-Fixes: 65789daa8087 ("dma-mapping: add benchmark support for streaming DMA APIs")
-Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
-Acked-by: Barry Song <baohua@kernel.org>
-Signed-off-by: Christoph Hellwig <hch@lst.de>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- kernel/dma/map_benchmark.c | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/kernel/dma/map_benchmark.c b/kernel/dma/map_benchmark.c
-index 59fb3f849b351..f7f3d14fa69a7 100644
---- a/kernel/dma/map_benchmark.c
-+++ b/kernel/dma/map_benchmark.c
-@@ -101,7 +101,6 @@ static int do_map_benchmark(struct map_benchmark_data *map)
- struct task_struct **tsk;
- int threads = map->bparam.threads;
- int node = map->bparam.node;
-- const cpumask_t *cpu_mask = cpumask_of_node(node);
- u64 loops;
- int ret = 0;
- int i;
-@@ -124,7 +123,7 @@ static int do_map_benchmark(struct map_benchmark_data *map)
- }
-
- if (node != NUMA_NO_NODE)
-- kthread_bind_mask(tsk[i], cpu_mask);
-+ kthread_bind_mask(tsk[i], cpumask_of_node(node));
- }
-
- /* clear the old value in the previous benchmark */
---
-2.43.0
-
+++ /dev/null
-From b3445b27a10096082ebc0755616a11169aed5c90 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 3 Apr 2024 02:49:32 +0000
-Subject: dmaengine: idma64: Add check for dma_set_max_seg_size
-
-From: Chen Ni <nichen@iscas.ac.cn>
-
-[ Upstream commit 2b1c1cf08a0addb6df42f16b37133dc7a351de29 ]
-
-As the possible failure of the dma_set_max_seg_size(), it should be
-better to check the return value of the dma_set_max_seg_size().
-
-Fixes: e3fdb1894cfa ("dmaengine: idma64: set maximum allowed segment size for DMA")
-Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
-Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Link: https://lore.kernel.org/r/20240403024932.3342606-1-nichen@iscas.ac.cn
-Signed-off-by: Vinod Koul <vkoul@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/dma/idma64.c | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/dma/idma64.c b/drivers/dma/idma64.c
-index 1398814d8fbb6..e3505e56784b1 100644
---- a/drivers/dma/idma64.c
-+++ b/drivers/dma/idma64.c
-@@ -598,7 +598,9 @@ static int idma64_probe(struct idma64_chip *chip)
-
- idma64->dma.dev = chip->sysdev;
-
-- dma_set_max_seg_size(idma64->dma.dev, IDMA64C_CTLH_BLOCK_TS_MASK);
-+ ret = dma_set_max_seg_size(idma64->dma.dev, IDMA64C_CTLH_BLOCK_TS_MASK);
-+ if (ret)
-+ return ret;
-
- ret = dma_async_device_register(&idma64->dma);
- if (ret)
---
-2.43.0
-
+++ /dev/null
-From 5acfd95f07a2dbe501f05a87e92853865d2f4366 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 29 Jan 2024 17:39:54 -0800
-Subject: dmaengine: idxd: Avoid unnecessary destruction of file_ida
-
-From: Fenghua Yu <fenghua.yu@intel.com>
-
-[ Upstream commit 76e43fa6a456787bad31b8d0daeabda27351a480 ]
-
-file_ida is allocated during cdev open and is freed accordingly
-during cdev release. This sequence is guaranteed by driver file
-operations. Therefore, there is no need to destroy an already empty
-file_ida when the WQ cdev is removed.
-
-Worse, ida_free() in cdev release may happen after destruction of
-file_ida per WQ cdev. This can lead to accessing an id in file_ida
-after it has been destroyed, resulting in a kernel panic.
-
-Remove ida_destroy(&file_ida) to address these issues.
-
-Fixes: e6fd6d7e5f0f ("dmaengine: idxd: add a device to represent the file opened")
-Signed-off-by: Lijun Pan <lijun.pan@intel.com>
-Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
-Reviewed-by: Dave Jiang <dave.jiang@intel.com>
-Link: https://lore.kernel.org/r/20240130013954.2024231-1-fenghua.yu@intel.com
-Signed-off-by: Vinod Koul <vkoul@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/dma/idxd/cdev.c | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/drivers/dma/idxd/cdev.c b/drivers/dma/idxd/cdev.c
-index dcefb838b8c0f..73407e5775276 100644
---- a/drivers/dma/idxd/cdev.c
-+++ b/drivers/dma/idxd/cdev.c
-@@ -577,7 +577,6 @@ void idxd_wq_del_cdev(struct idxd_wq *wq)
- struct idxd_cdev *idxd_cdev;
-
- idxd_cdev = wq->idxd_cdev;
-- ida_destroy(&file_ida);
- wq->idxd_cdev = NULL;
- cdev_device_del(&idxd_cdev->cdev, cdev_dev(idxd_cdev));
- put_device(cdev_dev(idxd_cdev));
---
-2.43.0
-
+++ /dev/null
-From a74ccdd8d682922454c4963ddb56bfe8f6071059 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 17 May 2024 09:15:16 +0800
-Subject: drivers/xen: Improve the late XenStore init protocol
-
-From: Henry Wang <xin.wang2@amd.com>
-
-[ Upstream commit a3607581cd49c17128a486a526a36a97bafcb2bb ]
-
-Currently, the late XenStore init protocol is only triggered properly
-for the case that HVM_PARAM_STORE_PFN is ~0ULL (invalid). For the
-case that XenStore interface is allocated but not ready (the connection
-status is not XENSTORE_CONNECTED), Linux should also wait until the
-XenStore is set up properly.
-
-Introduce a macro to describe the XenStore interface is ready, use
-it in xenbus_probe_initcall() to select the code path of doing the
-late XenStore init protocol or not. Since now we have more than one
-condition for XenStore late init, rework the check in xenbus_probe()
-for the free_irq().
-
-Take the opportunity to enhance the check of the allocated XenStore
-interface can be properly mapped, and return error early if the
-memremap() fails.
-
-Fixes: 5b3353949e89 ("xen: add support for initializing xenstore later as HVM domain")
-Signed-off-by: Henry Wang <xin.wang2@amd.com>
-Signed-off-by: Michal Orzel <michal.orzel@amd.com>
-Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
-Link: https://lore.kernel.org/r/20240517011516.1451087-1-xin.wang2@amd.com
-Signed-off-by: Juergen Gross <jgross@suse.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/xen/xenbus/xenbus_probe.c | 36 ++++++++++++++++++++-----------
- 1 file changed, 23 insertions(+), 13 deletions(-)
-
-diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
-index 3205e5d724c8c..1a9ded0cddcb0 100644
---- a/drivers/xen/xenbus/xenbus_probe.c
-+++ b/drivers/xen/xenbus/xenbus_probe.c
-@@ -65,13 +65,17 @@
- #include "xenbus.h"
-
-
--static int xs_init_irq;
-+static int xs_init_irq = -1;
- int xen_store_evtchn;
- EXPORT_SYMBOL_GPL(xen_store_evtchn);
-
- struct xenstore_domain_interface *xen_store_interface;
- EXPORT_SYMBOL_GPL(xen_store_interface);
-
-+#define XS_INTERFACE_READY \
-+ ((xen_store_interface != NULL) && \
-+ (xen_store_interface->connection == XENSTORE_CONNECTED))
-+
- enum xenstore_init xen_store_domain_type;
- EXPORT_SYMBOL_GPL(xen_store_domain_type);
-
-@@ -751,19 +755,19 @@ static void xenbus_probe(void)
- {
- xenstored_ready = 1;
-
-- if (!xen_store_interface) {
-+ if (!xen_store_interface)
- xen_store_interface = memremap(xen_store_gfn << XEN_PAGE_SHIFT,
- XEN_PAGE_SIZE, MEMREMAP_WB);
-- /*
-- * Now it is safe to free the IRQ used for xenstore late
-- * initialization. No need to unbind: it is about to be
-- * bound again from xb_init_comms. Note that calling
-- * unbind_from_irqhandler now would result in xen_evtchn_close()
-- * being called and the event channel not being enabled again
-- * afterwards, resulting in missed event notifications.
-- */
-+ /*
-+ * Now it is safe to free the IRQ used for xenstore late
-+ * initialization. No need to unbind: it is about to be
-+ * bound again from xb_init_comms. Note that calling
-+ * unbind_from_irqhandler now would result in xen_evtchn_close()
-+ * being called and the event channel not being enabled again
-+ * afterwards, resulting in missed event notifications.
-+ */
-+ if (xs_init_irq >= 0)
- free_irq(xs_init_irq, &xb_waitq);
-- }
-
- /*
- * In the HVM case, xenbus_init() deferred its call to
-@@ -822,7 +826,7 @@ static int __init xenbus_probe_initcall(void)
- if (xen_store_domain_type == XS_PV ||
- (xen_store_domain_type == XS_HVM &&
- !xs_hvm_defer_init_for_callback() &&
-- xen_store_interface != NULL))
-+ XS_INTERFACE_READY))
- xenbus_probe();
-
- /*
-@@ -831,7 +835,7 @@ static int __init xenbus_probe_initcall(void)
- * started, then probe. It will be triggered when communication
- * starts happening, by waiting on xb_waitq.
- */
-- if (xen_store_domain_type == XS_LOCAL || xen_store_interface == NULL) {
-+ if (xen_store_domain_type == XS_LOCAL || !XS_INTERFACE_READY) {
- struct task_struct *probe_task;
-
- probe_task = kthread_run(xenbus_probe_thread, NULL,
-@@ -1014,6 +1018,12 @@ static int __init xenbus_init(void)
- xen_store_interface =
- memremap(xen_store_gfn << XEN_PAGE_SHIFT,
- XEN_PAGE_SIZE, MEMREMAP_WB);
-+ if (!xen_store_interface) {
-+ pr_err("%s: cannot map HVM_PARAM_STORE_PFN=%llx\n",
-+ __func__, v);
-+ err = -EINVAL;
-+ goto out_error;
-+ }
- if (xen_store_interface->connection != XENSTORE_CONNECTED)
- wait = true;
- }
---
-2.43.0
-
+++ /dev/null
-From 08299aae3ab9b587d8a4db8cc95f2550e96fc305 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 8 May 2024 16:45:35 -0500
-Subject: drm/amd/display: Enable colorspace property for MST connectors
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Mario Limonciello <mario.limonciello@amd.com>
-
-[ Upstream commit 8195979d2dd995d60c2663adf54c69c1bf4eadd1 ]
-
-MST colorspace property support was disabled due to a series of warnings
-that came up when the device was plugged in since the properties weren't
-made at device creation. Create the properties in advance instead.
-
-Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
-Fixes: 69a959610229 ("drm/amd/display: Temporary Disable MST DP Colorspace Property").
-Reported-and-tested-by: Tyler Schneider <tyler.schneider@amd.com>
-Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3353
-Reviewed-by: Harry Wentland <harry.wentland@amd.com>
-Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
-Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-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 941e96f100f4e..12b036d511d0c 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
-@@ -613,6 +613,9 @@ dm_dp_add_mst_connector(struct drm_dp_mst_topology_mgr *mgr,
- &connector->base,
- dev->mode_config.tile_property,
- 0);
-+ connector->colorspace_property = master->base.colorspace_property;
-+ if (connector->colorspace_property)
-+ drm_connector_attach_colorspace_property(connector);
-
- drm_connector_set_path_property(connector, pathprop);
-
---
-2.43.0
-
+++ /dev/null
-From cf90abab51068037e57770b9c7dce1ee462cdbe1 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 15 May 2024 11:25:49 -0400
-Subject: drm/amdgpu: Adjust logic in amdgpu_device_partner_bandwidth()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Alex Deucher <alexander.deucher@amd.com>
-
-[ Upstream commit ba46b3bda296c4f82b061ac40b90f49d2a00a380 ]
-
-Use current speed/width on devices which don't support
-dynamic PCIe switching.
-
-Fixes: 466a7d115326 ("drm/amd: Use the first non-dGPU PCI device for BW limits")
-Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3289
-Acked-by: Christian König <christian.koenig@amd.com>
-Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 19 ++++++++++++-------
- 1 file changed, 12 insertions(+), 7 deletions(-)
-
-diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
-index 14d878675586a..33f07e6cbc1d0 100644
---- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
-+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
-@@ -5792,13 +5792,18 @@ static void amdgpu_device_partner_bandwidth(struct amdgpu_device *adev,
- *speed = PCI_SPEED_UNKNOWN;
- *width = PCIE_LNK_WIDTH_UNKNOWN;
-
-- while ((parent = pci_upstream_bridge(parent))) {
-- /* skip upstream/downstream switches internal to dGPU*/
-- if (parent->vendor == PCI_VENDOR_ID_ATI)
-- continue;
-- *speed = pcie_get_speed_cap(parent);
-- *width = pcie_get_width_cap(parent);
-- break;
-+ if (amdgpu_device_pcie_dynamic_switching_supported(adev)) {
-+ while ((parent = pci_upstream_bridge(parent))) {
-+ /* skip upstream/downstream switches internal to dGPU*/
-+ if (parent->vendor == PCI_VENDOR_ID_ATI)
-+ continue;
-+ *speed = pcie_get_speed_cap(parent);
-+ *width = pcie_get_width_cap(parent);
-+ break;
-+ }
-+ } else {
-+ /* use the current speeds rather than max if switching is not supported */
-+ pcie_bandwidth_available(adev->pdev, NULL, speed, width);
- }
- }
-
---
-2.43.0
-
+++ /dev/null
-From 4e6ac3240bf8b542a82ee43e4116b074d0d97979 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 25 Apr 2024 11:22:32 +0530
-Subject: drm/amdgpu: Fix buffer size in gfx_v9_4_3_init_
- cp_compute_microcode() and rlc_microcode()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
-
-[ Upstream commit acce6479e30f73ab0872e93a75aed1fb791d04ec ]
-
-The function gfx_v9_4_3_init_microcode in gfx_v9_4_3.c was generating
-about potential truncation of output when using the snprintf function.
-The issue was due to the size of the buffer 'ucode_prefix' being too
-small to accommodate the maximum possible length of the string being
-written into it.
-
-The string being written is "amdgpu/%s_mec.bin" or "amdgpu/%s_rlc.bin",
-where %s is replaced by the value of 'chip_name'. The length of this
-string without the %s is 16 characters. The warning message indicated
-that 'chip_name' could be up to 29 characters long, resulting in a total
-of 45 characters, which exceeds the buffer size of 30 characters.
-
-To resolve this issue, the size of the 'ucode_prefix' buffer has been
-reduced from 30 to 15. This ensures that the maximum possible length of
-the string being written into the buffer will not exceed its size, thus
-preventing potential buffer overflow and truncation issues.
-
-Fixes the below with gcc W=1:
-drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c: In function ‘gfx_v9_4_3_early_init’:
-drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:379:52: warning: ‘%s’ directive output may be truncated writing up to 29 bytes into a region of size 23 [-Wformat-truncation=]
- 379 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
- | ^~
-......
- 439 | r = gfx_v9_4_3_init_rlc_microcode(adev, ucode_prefix);
- | ~~~~~~~~~~~~
-drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:379:9: note: ‘snprintf’ output between 16 and 45 bytes into a destination of size 30
- 379 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
- | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:413:52: warning: ‘%s’ directive output may be truncated writing up to 29 bytes into a region of size 23 [-Wformat-truncation=]
- 413 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name);
- | ^~
-......
- 443 | r = gfx_v9_4_3_init_cp_compute_microcode(adev, ucode_prefix);
- | ~~~~~~~~~~~~
-drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:413:9: note: ‘snprintf’ output between 16 and 45 bytes into a destination of size 30
- 413 | snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name);
- | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-Fixes: 86301129698b ("drm/amdgpu: split gc v9_4_3 functionality from gc v9_0")
-Cc: Hawking Zhang <Hawking.Zhang@amd.com>
-Cc: Christian König <christian.koenig@amd.com>
-Cc: Alex Deucher <alexander.deucher@amd.com>
-Cc: Lijo Lazar <lijo.lazar@amd.com>
-Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
-Suggested-by: Lijo Lazar <lijo.lazar@amd.com>
-Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
-Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
-index 82b6e28b61937..5a346607ed3ee 100644
---- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
-+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
-@@ -426,7 +426,7 @@ static int gfx_v9_4_3_init_cp_compute_microcode(struct amdgpu_device *adev,
-
- static int gfx_v9_4_3_init_microcode(struct amdgpu_device *adev)
- {
-- char ucode_prefix[30];
-+ char ucode_prefix[15];
- int r;
-
- amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
---
-2.43.0
-
+++ /dev/null
-From 0f435c7bf9e056cbad59d411392bfef63a0b80cb Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 17 Apr 2024 17:57:52 +0800
-Subject: drm/amdgpu: init microcode chip name from ip versions
-
-From: Le Ma <le.ma@amd.com>
-
-[ Upstream commit 92ed1e9cd5f6cc4f8c9a9ba6c4d2d2bbc6221296 ]
-
-To adapt to different gc versions in gfx_v9_4_3.c file.
-
-Signed-off-by: Le Ma <le.ma@amd.com>
-Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
-Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
-Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-Stable-dep-of: acce6479e30f ("drm/amdgpu: Fix buffer size in gfx_v9_4_3_init_ cp_compute_microcode() and rlc_microcode()")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
-index 131cddbdda0dc..82b6e28b61937 100644
---- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
-+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
-@@ -426,16 +426,16 @@ static int gfx_v9_4_3_init_cp_compute_microcode(struct amdgpu_device *adev,
-
- static int gfx_v9_4_3_init_microcode(struct amdgpu_device *adev)
- {
-- const char *chip_name;
-+ char ucode_prefix[30];
- int r;
-
-- chip_name = "gc_9_4_3";
-+ amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
-
-- r = gfx_v9_4_3_init_rlc_microcode(adev, chip_name);
-+ r = gfx_v9_4_3_init_rlc_microcode(adev, ucode_prefix);
- if (r)
- return r;
-
-- r = gfx_v9_4_3_init_cp_compute_microcode(adev, chip_name);
-+ r = gfx_v9_4_3_init_cp_compute_microcode(adev, ucode_prefix);
- if (r)
- return r;
-
---
-2.43.0
-
+++ /dev/null
-From ec22b5c7b3fa3c32f5b0c9ea0b9089f285b149ae Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sun, 25 Feb 2024 08:19:33 +0200
-Subject: drm/bridge: tc358775: fix support for jeida-18 and jeida-24
-
-From: Michael Walle <mwalle@kernel.org>
-
-[ Upstream commit 30ea09a182cb37c4921b9d477ed18107befe6d78 ]
-
-The bridge always uses 24bpp internally. Therefore, for jeida-18
-mapping we need to discard the lowest two bits for each channel and thus
-starting with LV_[RGB]2. jeida-24 has the same mapping but uses four
-lanes instead of three, with the forth pair transmitting the lowest two
-bits of each channel. Thus, the mapping between jeida-18 and jeida-24
-is actually the same, except that one channel is turned off (by
-selecting the RGB666 format in VPCTRL).
-
-While at it, remove the bogus comment about the hardware default because
-the default is overwritten in any case.
-
-Tested with a jeida-18 display (Evervision VGG644804).
-
-Fixes: b26975593b17 ("display/drm/bridge: TC358775 DSI/LVDS driver")
-Signed-off-by: Michael Walle <mwalle@kernel.org>
-Signed-off-by: Tony Lindgren <tony@atomide.com>
-Reviewed-by: Robert Foss <rfoss@kernel.org>
-Signed-off-by: Robert Foss <rfoss@kernel.org>
-Link: https://patchwork.freedesktop.org/patch/msgid/20240225062008.33191-5-tony@atomide.com
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/bridge/tc358775.c | 21 +++++++++------------
- 1 file changed, 9 insertions(+), 12 deletions(-)
-
-diff --git a/drivers/gpu/drm/bridge/tc358775.c b/drivers/gpu/drm/bridge/tc358775.c
-index fea4f00a20f83..c737670631929 100644
---- a/drivers/gpu/drm/bridge/tc358775.c
-+++ b/drivers/gpu/drm/bridge/tc358775.c
-@@ -454,10 +454,6 @@ static void tc_bridge_enable(struct drm_bridge *bridge)
- dev_dbg(tc->dev, "bus_formats %04x bpc %d\n",
- connector->display_info.bus_formats[0],
- tc->bpc);
-- /*
-- * Default hardware register settings of tc358775 configured
-- * with MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA jeida-24 format
-- */
- if (connector->display_info.bus_formats[0] ==
- MEDIA_BUS_FMT_RGB888_1X7X4_SPWG) {
- /* VESA-24 */
-@@ -468,14 +464,15 @@ static void tc_bridge_enable(struct drm_bridge *bridge)
- d2l_write(tc->i2c, LV_MX1619, LV_MX(LVI_B6, LVI_B7, LVI_B1, LVI_B2));
- d2l_write(tc->i2c, LV_MX2023, LV_MX(LVI_B3, LVI_B4, LVI_B5, LVI_L0));
- d2l_write(tc->i2c, LV_MX2427, LV_MX(LVI_HS, LVI_VS, LVI_DE, LVI_R6));
-- } else { /* MEDIA_BUS_FMT_RGB666_1X7X3_SPWG - JEIDA-18 */
-- d2l_write(tc->i2c, LV_MX0003, LV_MX(LVI_R0, LVI_R1, LVI_R2, LVI_R3));
-- d2l_write(tc->i2c, LV_MX0407, LV_MX(LVI_R4, LVI_L0, LVI_R5, LVI_G0));
-- d2l_write(tc->i2c, LV_MX0811, LV_MX(LVI_G1, LVI_G2, LVI_L0, LVI_L0));
-- d2l_write(tc->i2c, LV_MX1215, LV_MX(LVI_G3, LVI_G4, LVI_G5, LVI_B0));
-- d2l_write(tc->i2c, LV_MX1619, LV_MX(LVI_L0, LVI_L0, LVI_B1, LVI_B2));
-- d2l_write(tc->i2c, LV_MX2023, LV_MX(LVI_B3, LVI_B4, LVI_B5, LVI_L0));
-- d2l_write(tc->i2c, LV_MX2427, LV_MX(LVI_HS, LVI_VS, LVI_DE, LVI_L0));
-+ } else {
-+ /* JEIDA-18 and JEIDA-24 */
-+ d2l_write(tc->i2c, LV_MX0003, LV_MX(LVI_R2, LVI_R3, LVI_R4, LVI_R5));
-+ d2l_write(tc->i2c, LV_MX0407, LV_MX(LVI_R6, LVI_R1, LVI_R7, LVI_G2));
-+ d2l_write(tc->i2c, LV_MX0811, LV_MX(LVI_G3, LVI_G4, LVI_G0, LVI_G1));
-+ d2l_write(tc->i2c, LV_MX1215, LV_MX(LVI_G5, LVI_G6, LVI_G7, LVI_B2));
-+ d2l_write(tc->i2c, LV_MX1619, LV_MX(LVI_B0, LVI_B1, LVI_B3, LVI_B4));
-+ d2l_write(tc->i2c, LV_MX2023, LV_MX(LVI_B5, LVI_B6, LVI_B7, LVI_L0));
-+ d2l_write(tc->i2c, LV_MX2427, LV_MX(LVI_HS, LVI_VS, LVI_DE, LVI_R0));
- }
-
- d2l_write(tc->i2c, VFUEN, VFUEN_EN);
---
-2.43.0
-
+++ /dev/null
-From 6c8edde802f7e98521f153e27a1448e67a98b8b0 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 17 May 2024 11:06:16 +0200
-Subject: drm/i915/gt: Fix CCS id's calculation for CCS mode setting
-
-From: Andi Shyti <andi.shyti@linux.intel.com>
-
-[ Upstream commit ee01b6a386eaf9984b58a2476e8f531149679da9 ]
-
-The whole point of the previous fixes has been to change the CCS
-hardware configuration to generate only one stream available to
-the compute users. We did this by changing the info.engine_mask
-that is set during device probe, reset during the detection of
-the fused engines, and finally reset again when choosing the CCS
-mode.
-
-We can't use the engine_mask variable anymore, as with the
-current configuration, it imposes only one CCS no matter what the
-hardware configuration is.
-
-Before changing the engine_mask for the third time, save it and
-use it for calculating the CCS mode.
-
-After the previous changes, the user reported a performance drop
-to around 1/4. We have tested that the compute operations, with
-the current patch, have improved by the same factor.
-
-Fixes: 6db31251bb26 ("drm/i915/gt: Enable only one CCS for compute workload")
-Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
-Cc: Chris Wilson <chris.p.wilson@linux.intel.com>
-Cc: Gnattu OC <gnattuoc@me.com>
-Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
-Cc: Matt Roper <matthew.d.roper@intel.com>
-Tested-by: Jian Ye <jian.ye@intel.com>
-Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
-Tested-by: Gnattu OC <gnattuoc@me.com>
-Link: https://patchwork.freedesktop.org/patch/msgid/20240517090616.242529-1-andi.shyti@linux.intel.com
-(cherry picked from commit a09d2327a9ba8e3f5be238bc1b7ca2809255b464)
-Signed-off-by: Jani Nikula <jani.nikula@intel.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/i915/gt/intel_engine_cs.c | 6 ++++++
- drivers/gpu/drm/i915/gt/intel_gt_ccs_mode.c | 2 +-
- drivers/gpu/drm/i915/gt/intel_gt_types.h | 8 ++++++++
- 3 files changed, 15 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/gpu/drm/i915/gt/intel_engine_cs.c b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
-index 84be97f959faa..e379eabeaa662 100644
---- a/drivers/gpu/drm/i915/gt/intel_engine_cs.c
-+++ b/drivers/gpu/drm/i915/gt/intel_engine_cs.c
-@@ -919,6 +919,12 @@ static intel_engine_mask_t init_engine_mask(struct intel_gt *gt)
- if (IS_DG2(gt->i915)) {
- u8 first_ccs = __ffs(CCS_MASK(gt));
-
-+ /*
-+ * Store the number of active cslices before
-+ * changing the CCS engine configuration
-+ */
-+ gt->ccs.cslices = CCS_MASK(gt);
-+
- /* Mask off all the CCS engine */
- info->engine_mask &= ~GENMASK(CCS3, CCS0);
- /* Put back in the first CCS engine */
-diff --git a/drivers/gpu/drm/i915/gt/intel_gt_ccs_mode.c b/drivers/gpu/drm/i915/gt/intel_gt_ccs_mode.c
-index 99b71bb7da0a6..3c62a44e9106c 100644
---- a/drivers/gpu/drm/i915/gt/intel_gt_ccs_mode.c
-+++ b/drivers/gpu/drm/i915/gt/intel_gt_ccs_mode.c
-@@ -19,7 +19,7 @@ unsigned int intel_gt_apply_ccs_mode(struct intel_gt *gt)
-
- /* Build the value for the fixed CCS load balancing */
- for (cslice = 0; cslice < I915_MAX_CCS; cslice++) {
-- if (CCS_MASK(gt) & BIT(cslice))
-+ if (gt->ccs.cslices & BIT(cslice))
- /*
- * If available, assign the cslice
- * to the first available engine...
-diff --git a/drivers/gpu/drm/i915/gt/intel_gt_types.h b/drivers/gpu/drm/i915/gt/intel_gt_types.h
-index def7dd0eb6f19..cfdd2ad5e9549 100644
---- a/drivers/gpu/drm/i915/gt/intel_gt_types.h
-+++ b/drivers/gpu/drm/i915/gt/intel_gt_types.h
-@@ -207,6 +207,14 @@ struct intel_gt {
- [MAX_ENGINE_INSTANCE + 1];
- enum intel_submission_method submission_method;
-
-+ struct {
-+ /*
-+ * Mask of the non fused CCS slices
-+ * to be used for the load balancing
-+ */
-+ intel_engine_mask_t cslices;
-+ } ccs;
-+
- /*
- * Default address space (either GGTT or ppGTT depending on arch).
- *
---
-2.43.0
-
+++ /dev/null
-From 8a573027f373c2cbb70a647287e935c3feba7b73 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 30 Apr 2024 09:48:09 -0700
-Subject: drm/i915/guc: avoid FIELD_PREP warning
-
-From: Arnd Bergmann <arnd@arndb.de>
-
-[ Upstream commit d4f36db62396b73bed383c0b6e48d36278cafa78 ]
-
-With gcc-7 and earlier, there are lots of warnings like
-
-In file included from <command-line>:0:0:
-In function '__guc_context_policy_add_priority.isra.66',
- inlined from '__guc_context_set_prio.isra.67' at drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:3292:3,
- inlined from 'guc_context_set_prio' at drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:3320:2:
-include/linux/compiler_types.h:399:38: error: call to '__compiletime_assert_631' declared with attribute error: FIELD_PREP: mask is not constant
- _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
- ^
-...
-drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:2422:3: note: in expansion of macro 'FIELD_PREP'
- FIELD_PREP(GUC_KLV_0_KEY, GUC_CONTEXT_POLICIES_KLV_ID_##id) | \
- ^~~~~~~~~~
-
-Make sure that GUC_KLV_0_KEY is an unsigned value to avoid the warning.
-
-Fixes: 77b6f79df66e ("drm/i915/guc: Update to GuC version 69.0.3")
-Signed-off-by: Arnd Bergmann <arnd@arndb.de>
-Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
-Signed-off-by: Julia Filipchuk <julia.filipchuk@intel.com>
-Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
-Link: https://patchwork.freedesktop.org/patch/msgid/20240430164809.482131-1-julia.filipchuk@intel.com
-(cherry picked from commit 364e039827ef628c650c21c1afe1c54d9c3296d9)
-Signed-off-by: Jani Nikula <jani.nikula@intel.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h b/drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h
-index 58012edd4eb0e..4f4f53c42a9c5 100644
---- a/drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h
-+++ b/drivers/gpu/drm/i915/gt/uc/abi/guc_klvs_abi.h
-@@ -29,9 +29,9 @@
- */
-
- #define GUC_KLV_LEN_MIN 1u
--#define GUC_KLV_0_KEY (0xffff << 16)
--#define GUC_KLV_0_LEN (0xffff << 0)
--#define GUC_KLV_n_VALUE (0xffffffff << 0)
-+#define GUC_KLV_0_KEY (0xffffu << 16)
-+#define GUC_KLV_0_LEN (0xffffu << 0)
-+#define GUC_KLV_n_VALUE (0xffffffffu << 0)
-
- /**
- * DOC: GuC Self Config KLVs
---
-2.43.0
-
+++ /dev/null
-From 68f8e5e1d67157578d81728cd1225c580771d4a0 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 17 Apr 2024 10:38:19 +0000
-Subject: drm/mediatek: dp: Fix mtk_dp_aux_transfer return value
-
-From: Wojciech Macek <wmacek@chromium.org>
-
-[ Upstream commit 8431fff9e0f3fc1c5844cf99a73b49b63ceed481 ]
-
-In case there is no DP device attached to the port the
-transfer function should return IO error, similar to what
-other drivers do.
-In case EAGAIN is returned then any read from /dev/drm_dp_aux
-device ends up in an infinite loop as the upper layers
-constantly repeats the transfer request.
-
-Fixes: f70ac097a2cf ("drm/mediatek: Add MT8195 Embedded DisplayPort driver")
-Signed-off-by: Wojciech Macek <wmacek@chromium.org>
-Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
-Reviewed-by: CK Hu <ck.hu@mediatek.com>
-Link: https://patchwork.kernel.org/project/dri-devel/patch/20240417103819.990512-1-wmacek@chromium.org/
-Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/mediatek/mtk_dp.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c
-index 2136a596efa18..afc8905df828e 100644
---- a/drivers/gpu/drm/mediatek/mtk_dp.c
-+++ b/drivers/gpu/drm/mediatek/mtk_dp.c
-@@ -2095,7 +2095,7 @@ static ssize_t mtk_dp_aux_transfer(struct drm_dp_aux *mtk_aux,
-
- if (mtk_dp->bridge.type != DRM_MODE_CONNECTOR_eDP &&
- !mtk_dp->train_info.cable_plugged_in) {
-- ret = -EAGAIN;
-+ ret = -EIO;
- goto err;
- }
-
---
-2.43.0
-
+++ /dev/null
-From 19ee88f2404dd40b7ea7d324f830c83d31e7a22d Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 3 Apr 2024 09:46:35 +0200
-Subject: drm/meson: gate px_clk when setting rate
-
-From: Neil Armstrong <neil.armstrong@linaro.org>
-
-[ Upstream commit 5c9837374ecf55a1fa3b7622d365a0456960270f ]
-
-Disable the px_clk when setting the rate to recover a fully
-configured and correctly reset VCLK clock tree after the rate
-is set.
-
-Fixes: 77d9e1e6b846 ("drm/meson: add support for MIPI-DSI transceiver")
-Reviewed-by: Nicolas Belin <nbelin@baylibre.com>
-Link: https://lore.kernel.org/r/20240403-amlogic-v6-4-upstream-dsi-ccf-vim3-v12-4-99ecdfdc87fc@linaro.org
-Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
-Link: https://patchwork.freedesktop.org/patch/msgid/20240403-amlogic-v6-4-upstream-dsi-ccf-vim3-v12-4-99ecdfdc87fc@linaro.org
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/meson/meson_dw_mipi_dsi.c | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c b/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c
-index a6bc1bdb3d0d8..a10cff3ca1fef 100644
---- a/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c
-+++ b/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c
-@@ -95,6 +95,7 @@ static int dw_mipi_dsi_phy_init(void *priv_data)
- return ret;
- }
-
-+ clk_disable_unprepare(mipi_dsi->px_clk);
- ret = clk_set_rate(mipi_dsi->px_clk, mipi_dsi->mode->clock * 1000);
-
- if (ret) {
-@@ -103,6 +104,12 @@ static int dw_mipi_dsi_phy_init(void *priv_data)
- return ret;
- }
-
-+ ret = clk_prepare_enable(mipi_dsi->px_clk);
-+ if (ret) {
-+ dev_err(mipi_dsi->dev, "Failed to enable DSI Pixel clock (ret %d)\n", ret);
-+ return ret;
-+ }
-+
- switch (mipi_dsi->dsi_device->format) {
- case MIPI_DSI_FMT_RGB888:
- dpi_data_format = DPI_COLOR_24BIT;
---
-2.43.0
-
+++ /dev/null
-From 3206321e62d76cdd7d125115e8036211501f06b0 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 12 Apr 2024 10:53:25 +0200
-Subject: drm/msm/a6xx: Avoid a nullptr dereference when speedbin setting fails
-
-From: Konrad Dybcio <konrad.dybcio@linaro.org>
-
-[ Upstream commit 46d4efcccc688cbacdd70a238bedca510acaa8e4 ]
-
-Calling a6xx_destroy() before adreno_gpu_init() leads to a null pointer
-dereference on:
-
-msm_gpu_cleanup() : platform_set_drvdata(gpu->pdev, NULL);
-
-as gpu->pdev is only assigned in:
-
-a6xx_gpu_init()
-|_ adreno_gpu_init
- |_ msm_gpu_init()
-
-Instead of relying on handwavy null checks down the cleanup chain,
-explicitly de-allocate the LLC data and free a6xx_gpu instead.
-
-Fixes: 76efc2453d0e ("drm/msm/gpu: Fix crash during system suspend after unbind")
-Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
-Patchwork: https://patchwork.freedesktop.org/patch/588919/
-Signed-off-by: Rob Clark <robdclark@chromium.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
-index 6b646698a887f..74de2d50eead8 100644
---- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
-+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
-@@ -2889,7 +2889,8 @@ struct msm_gpu *a6xx_gpu_init(struct drm_device *dev)
-
- ret = a6xx_set_supported_hw(&pdev->dev, config->info);
- if (ret) {
-- a6xx_destroy(&(a6xx_gpu->base.base));
-+ a6xx_llc_slices_destroy(a6xx_gpu);
-+ kfree(a6xx_gpu);
- return ERR_PTR(ret);
- }
-
---
-2.43.0
-
+++ /dev/null
-From 42ec6e8372eba4468dd7892c905dacf5ec3f9b00 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 9 Apr 2024 14:57:00 +0200
-Subject: drm/msm/adreno: fix CP cycles stat retrieval on a7xx
-
-From: Zan Dobersek <zdobersek@igalia.com>
-
-[ Upstream commit 328660262df89ab64031059909d763f7a8af9570 ]
-
-a7xx_submit() should use the a7xx variant of the RBBM_PERFCTR_CP register
-for retrieving the CP cycles value before and after the submitted command
-stream execution.
-
-Signed-off-by: Zan Dobersek <zdobersek@igalia.com>
-Fixes: af66706accdf ("drm/msm/a6xx: Add skeleton A7xx support")
-Patchwork: https://patchwork.freedesktop.org/patch/588445/
-Signed-off-by: Rob Clark <robdclark@chromium.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
-index 792a4c60a20c2..6b646698a887f 100644
---- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
-+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
-@@ -284,7 +284,7 @@ static void a7xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit)
-
- a6xx_set_pagetable(a6xx_gpu, ring, submit->queue->ctx);
-
-- get_stats_counter(ring, REG_A6XX_RBBM_PERFCTR_CP(0),
-+ get_stats_counter(ring, REG_A7XX_RBBM_PERFCTR_CP(0),
- rbmemptr_stats(ring, index, cpcycles_start));
- get_stats_counter(ring, REG_A6XX_CP_ALWAYS_ON_COUNTER,
- rbmemptr_stats(ring, index, alwayson_start));
-@@ -330,7 +330,7 @@ static void a7xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit)
- OUT_PKT7(ring, CP_SET_MARKER, 1);
- OUT_RING(ring, 0x00e); /* IB1LIST end */
-
-- get_stats_counter(ring, REG_A6XX_RBBM_PERFCTR_CP(0),
-+ get_stats_counter(ring, REG_A7XX_RBBM_PERFCTR_CP(0),
- rbmemptr_stats(ring, index, cpcycles_end));
- get_stats_counter(ring, REG_A6XX_CP_ALWAYS_ON_COUNTER,
- rbmemptr_stats(ring, index, alwayson_end));
---
-2.43.0
-
+++ /dev/null
-From b4b444bf02e3633786c17cc48627e92254e75b68 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 8 Apr 2024 11:55:23 +0300
-Subject: drm/msm/dpu: Add callback function pointer check before its call
-
-From: Aleksandr Mishin <amishin@t-argos.ru>
-
-[ Upstream commit 530f272053a5e72243a9cb07bb1296af6c346002 ]
-
-In dpu_core_irq_callback_handler() callback function pointer is compared to NULL,
-but then callback function is unconditionally called by this pointer.
-Fix this bug by adding conditional return.
-
-Found by Linux Verification Center (linuxtesting.org) with SVACE.
-
-Fixes: c929ac60b3ed ("drm/msm/dpu: allow just single IRQ callback")
-Signed-off-by: Aleksandr Mishin <amishin@t-argos.ru>
-Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-Patchwork: https://patchwork.freedesktop.org/patch/588237/
-Link: https://lore.kernel.org/r/20240408085523.12231-1-amishin@t-argos.ru
-Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c
-index 6a0a74832fb64..b85881aab0478 100644
---- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c
-+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c
-@@ -223,9 +223,11 @@ static void dpu_core_irq_callback_handler(struct dpu_kms *dpu_kms, unsigned int
-
- VERB("IRQ=[%d, %d]\n", DPU_IRQ_REG(irq_idx), DPU_IRQ_BIT(irq_idx));
-
-- if (!irq_entry->cb)
-+ if (!irq_entry->cb) {
- DRM_ERROR("no registered cb, IRQ=[%d, %d]\n",
- DPU_IRQ_REG(irq_idx), DPU_IRQ_BIT(irq_idx));
-+ return;
-+ }
-
- atomic_inc(&irq_entry->count);
-
---
-2.43.0
-
+++ /dev/null
-From bce6a996c77af2a75181c21df7b622cb7e30cbb0 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 17 Apr 2024 01:57:44 +0200
-Subject: drm/msm/dpu: Allow configuring multiple active DSC blocks
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Marijn Suijten <marijn.suijten@somainline.org>
-
-[ Upstream commit ca97fa419dfe62a384fdea8b33553c4d6afe034e ]
-
-Just like the active interface and writeback block in ctl_intf_cfg_v1(),
-and later the rest of the blocks in followup active-CTL fixes or
-reworks, multiple calls to this function should enable additional DSC
-blocks instead of overwriting the blocks that are enabled.
-
-This pattern is observed in an active-CTL scenario since DPU 5.0.0 where
-for example bonded-DSI uses a single CTL to drive multiple INTFs, and
-each encoder calls this function individually with the INTF (hence the
-pre-existing update instead of overwrite of this bitmask) and DSC blocks
-it wishes to be enabled, and expects them to be OR'd into the bitmask.
-
-The reverse already exists in reset_intf_cfg_v1() where only specified
-DSC blocks are removed out of the CTL_DSC_ACTIVE bitmask (same for all
-other blocks and ACTIVE bitmasks), leaving the rest enabled.
-
-Fixes: 77f6da90487c ("drm/msm/disp/dpu1: Add DSC support in hw_ctl")
-Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
-Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-Patchwork: https://patchwork.freedesktop.org/patch/589902/
-Link: https://lore.kernel.org/r/20240417-drm-msm-initial-dualpipe-dsc-fixes-v1-4-78ae3ee9a697@somainline.org
-Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c | 9 ++++++---
- 1 file changed, 6 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c
-index e76565c3e6a43..e8a0b731d89e2 100644
---- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c
-+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c
-@@ -532,6 +532,7 @@ static void dpu_hw_ctl_intf_cfg_v1(struct dpu_hw_ctl *ctx,
- {
- struct dpu_hw_blk_reg_map *c = &ctx->hw;
- u32 intf_active = 0;
-+ u32 dsc_active = 0;
- u32 wb_active = 0;
- u32 mode_sel = 0;
-
-@@ -547,6 +548,7 @@ static void dpu_hw_ctl_intf_cfg_v1(struct dpu_hw_ctl *ctx,
-
- intf_active = DPU_REG_READ(c, CTL_INTF_ACTIVE);
- wb_active = DPU_REG_READ(c, CTL_WB_ACTIVE);
-+ dsc_active = DPU_REG_READ(c, CTL_DSC_ACTIVE);
-
- if (cfg->intf)
- intf_active |= BIT(cfg->intf - INTF_0);
-@@ -554,17 +556,18 @@ static void dpu_hw_ctl_intf_cfg_v1(struct dpu_hw_ctl *ctx,
- if (cfg->wb)
- wb_active |= BIT(cfg->wb - WB_0);
-
-+ if (cfg->dsc)
-+ dsc_active |= cfg->dsc;
-+
- DPU_REG_WRITE(c, CTL_TOP, mode_sel);
- DPU_REG_WRITE(c, CTL_INTF_ACTIVE, intf_active);
- DPU_REG_WRITE(c, CTL_WB_ACTIVE, wb_active);
-+ DPU_REG_WRITE(c, CTL_DSC_ACTIVE, dsc_active);
-
- if (cfg->merge_3d)
- DPU_REG_WRITE(c, CTL_MERGE_3D_ACTIVE,
- BIT(cfg->merge_3d - MERGE_3D_0));
-
-- if (cfg->dsc)
-- DPU_REG_WRITE(c, CTL_DSC_ACTIVE, cfg->dsc);
--
- if (cfg->cdm)
- DPU_REG_WRITE(c, CTL_CDM_ACTIVE, cfg->cdm);
- }
---
-2.43.0
-
+++ /dev/null
-From 416a213f8a4b042bc87e9cc1aac7b25a0a1fe46a Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 17 Apr 2024 01:57:43 +0200
-Subject: drm/msm/dpu: Always flush the slave INTF on the CTL
-
-From: Marijn Suijten <marijn.suijten@somainline.org>
-
-[ Upstream commit 2b938c3ab0a69ec6ea587bbf6fc2aec3db4a8736 ]
-
-As we can clearly see in a downstream kernel [1], flushing the slave INTF
-is skipped /only if/ the PPSPLIT topology is active.
-
-However, when DPU was originally submitted to mainline PPSPLIT was no
-longer part of it (seems to have been ripped out before submission), but
-this clause was incorrectly ported from the original SDE driver. Given
-that there is no support for PPSPLIT (currently), flushing the slave
-INTF should /never/ be skipped (as the `if (ppsplit && !master) goto
-skip;` clause downstream never becomes true).
-
-[1]: https://git.codelinaro.org/clo/la/platform/vendor/opensource/display-drivers/-/blob/display-kernel.lnx.5.4.r1-rel/msm/sde/sde_encoder_phys_cmd.c?ref_type=heads#L1131-1139
-
-Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support")
-Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
-Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-Patchwork: https://patchwork.freedesktop.org/patch/589901/
-Link: https://lore.kernel.org/r/20240417-drm-msm-initial-dualpipe-dsc-fixes-v1-3-78ae3ee9a697@somainline.org
-Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 3 ---
- 1 file changed, 3 deletions(-)
-
-diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c
-index a301e2833177a..44fb5083c1473 100644
---- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c
-+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c
-@@ -451,9 +451,6 @@ static void dpu_encoder_phys_cmd_enable_helper(
-
- _dpu_encoder_phys_cmd_pingpong_config(phys_enc);
-
-- if (!dpu_encoder_phys_cmd_is_master(phys_enc))
-- return;
--
- ctl = phys_enc->hw_ctl;
- ctl->ops.update_pending_flush_intf(ctl, phys_enc->hw_intf->idx);
- }
---
-2.43.0
-
+++ /dev/null
-From fa55504744980e1434fbcdbb626b85fc13d0b038 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 17 Apr 2024 01:57:41 +0200
-Subject: drm/msm/dsi: Print dual-DSI-adjusted pclk instead of original mode
- pclk
-
-From: Marijn Suijten <marijn.suijten@somainline.org>
-
-[ Upstream commit f12e0e12524a34bf145f7b80122e653ffe3d130a ]
-
-When dual-DSI (bonded DSI) was added in commit ed9976a09b48
-("drm/msm/dsi: adjust dsi timing for dual dsi mode") some DBG() prints
-were not updated, leading to print the original mode->clock rather
-than the adjusted (typically the mode clock divided by two, though more
-recently also adjusted for DSC compression) msm_host->pixel_clk_rate
-which is passed to clk_set_rate() just below. Fix that by printing the
-actual pixel_clk_rate that is being set.
-
-Fixes: ed9976a09b48 ("drm/msm/dsi: adjust dsi timing for dual dsi mode")
-Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
-Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-Patchwork: https://patchwork.freedesktop.org/patch/589896/
-Link: https://lore.kernel.org/r/20240417-drm-msm-initial-dualpipe-dsc-fixes-v1-1-78ae3ee9a697@somainline.org
-Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/msm/dsi/dsi_host.c | 10 +++++-----
- 1 file changed, 5 insertions(+), 5 deletions(-)
-
-diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
-index deeecdfd6c4e4..758a071150ecd 100644
---- a/drivers/gpu/drm/msm/dsi/dsi_host.c
-+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
-@@ -366,8 +366,8 @@ int dsi_link_clk_set_rate_6g(struct msm_dsi_host *msm_host)
- {
- int ret;
-
-- DBG("Set clk rates: pclk=%d, byteclk=%lu",
-- msm_host->mode->clock, msm_host->byte_clk_rate);
-+ DBG("Set clk rates: pclk=%lu, byteclk=%lu",
-+ msm_host->pixel_clk_rate, msm_host->byte_clk_rate);
-
- ret = dev_pm_opp_set_rate(&msm_host->pdev->dev,
- msm_host->byte_clk_rate);
-@@ -440,9 +440,9 @@ int dsi_link_clk_set_rate_v2(struct msm_dsi_host *msm_host)
- {
- int ret;
-
-- DBG("Set clk rates: pclk=%d, byteclk=%lu, esc_clk=%lu, dsi_src_clk=%lu",
-- msm_host->mode->clock, msm_host->byte_clk_rate,
-- msm_host->esc_clk_rate, msm_host->src_clk_rate);
-+ DBG("Set clk rates: pclk=%lu, byteclk=%lu, esc_clk=%lu, dsi_src_clk=%lu",
-+ msm_host->pixel_clk_rate, msm_host->byte_clk_rate,
-+ msm_host->esc_clk_rate, msm_host->src_clk_rate);
-
- ret = clk_set_rate(msm_host->byte_clk, msm_host->byte_clk_rate);
- if (ret) {
---
-2.43.0
-
+++ /dev/null
-From d14f4d18c487bdd782adabdee25f1461de4d03c4 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 9 May 2024 23:43:52 +0300
-Subject: drm/nouveau: use tile_mode and pte_kind for VM_BIND bo allocations
-
-From: Mohamed Ahmed <mohamedahmedegypt2001@gmail.com>
-
-[ Upstream commit aed9a1a4f7106ff99a882ad06318cebfa71016a2 ]
-
-Allow PTE kind and tile mode on BO create with VM_BIND, and add a
-GETPARAM to indicate this change. This is needed to support modifiers in
-NVK and ensure correctness when dealing with the nouveau GL driver.
-
-The userspace modifiers implementation this is for can be found here:
-https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24795
-
-Fixes: b88baab82871 ("drm/nouveau: implement new VM_BIND uAPI")
-Signed-off-by: Mohamed Ahmed <mohamedahmedegypt2001@gmail.com>
-Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
-Signed-off-by: Danilo Krummrich <dakr@redhat.com>
-Link: https://patchwork.freedesktop.org/patch/msgid/20240509204352.7597-1-mohamedahmedegypt2001@gmail.com
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/nouveau/nouveau_abi16.c | 3 ++
- drivers/gpu/drm/nouveau/nouveau_bo.c | 44 +++++++++++--------------
- include/uapi/drm/nouveau_drm.h | 7 ++++
- 3 files changed, 29 insertions(+), 25 deletions(-)
-
-diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c
-index 80f74ee0fc786..47e53e17b4e58 100644
---- a/drivers/gpu/drm/nouveau/nouveau_abi16.c
-+++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c
-@@ -272,6 +272,9 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS)
- getparam->value = (u64)ttm_resource_manager_usage(vram_mgr);
- break;
- }
-+ case NOUVEAU_GETPARAM_HAS_VMA_TILEMODE:
-+ getparam->value = 1;
-+ break;
- default:
- NV_PRINTK(dbg, cli, "unknown parameter %lld\n", getparam->param);
- return -EINVAL;
-diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
-index 5d8ee17295424..eaa087a2ca63b 100644
---- a/drivers/gpu/drm/nouveau/nouveau_bo.c
-+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
-@@ -241,28 +241,28 @@ nouveau_bo_alloc(struct nouveau_cli *cli, u64 *size, int *align, u32 domain,
- }
-
- nvbo->contig = !(tile_flags & NOUVEAU_GEM_TILE_NONCONTIG);
-- if (!nouveau_cli_uvmm(cli) || internal) {
-- /* for BO noVM allocs, don't assign kinds */
-- if (cli->device.info.family >= NV_DEVICE_INFO_V0_FERMI) {
-- nvbo->kind = (tile_flags & 0x0000ff00) >> 8;
-- if (!nvif_mmu_kind_valid(mmu, nvbo->kind)) {
-- kfree(nvbo);
-- return ERR_PTR(-EINVAL);
-- }
-
-- nvbo->comp = mmu->kind[nvbo->kind] != nvbo->kind;
-- } else if (cli->device.info.family >= NV_DEVICE_INFO_V0_TESLA) {
-- nvbo->kind = (tile_flags & 0x00007f00) >> 8;
-- nvbo->comp = (tile_flags & 0x00030000) >> 16;
-- if (!nvif_mmu_kind_valid(mmu, nvbo->kind)) {
-- kfree(nvbo);
-- return ERR_PTR(-EINVAL);
-- }
-- } else {
-- nvbo->zeta = (tile_flags & 0x00000007);
-+ if (cli->device.info.family >= NV_DEVICE_INFO_V0_FERMI) {
-+ nvbo->kind = (tile_flags & 0x0000ff00) >> 8;
-+ if (!nvif_mmu_kind_valid(mmu, nvbo->kind)) {
-+ kfree(nvbo);
-+ return ERR_PTR(-EINVAL);
-+ }
-+
-+ nvbo->comp = mmu->kind[nvbo->kind] != nvbo->kind;
-+ } else if (cli->device.info.family >= NV_DEVICE_INFO_V0_TESLA) {
-+ nvbo->kind = (tile_flags & 0x00007f00) >> 8;
-+ nvbo->comp = (tile_flags & 0x00030000) >> 16;
-+ if (!nvif_mmu_kind_valid(mmu, nvbo->kind)) {
-+ kfree(nvbo);
-+ return ERR_PTR(-EINVAL);
- }
-- nvbo->mode = tile_mode;
-+ } else {
-+ nvbo->zeta = (tile_flags & 0x00000007);
-+ }
-+ nvbo->mode = tile_mode;
-
-+ if (!nouveau_cli_uvmm(cli) || internal) {
- /* Determine the desirable target GPU page size for the buffer. */
- for (i = 0; i < vmm->page_nr; i++) {
- /* Because we cannot currently allow VMM maps to fail
-@@ -304,12 +304,6 @@ nouveau_bo_alloc(struct nouveau_cli *cli, u64 *size, int *align, u32 domain,
- }
- nvbo->page = vmm->page[pi].shift;
- } else {
-- /* reject other tile flags when in VM mode. */
-- if (tile_mode)
-- return ERR_PTR(-EINVAL);
-- if (tile_flags & ~NOUVEAU_GEM_TILE_NONCONTIG)
-- return ERR_PTR(-EINVAL);
--
- /* Determine the desirable target GPU page size for the buffer. */
- for (i = 0; i < vmm->page_nr; i++) {
- /* Because we cannot currently allow VMM maps to fail
-diff --git a/include/uapi/drm/nouveau_drm.h b/include/uapi/drm/nouveau_drm.h
-index 77d7ff0d5b110..c3d8dc7512971 100644
---- a/include/uapi/drm/nouveau_drm.h
-+++ b/include/uapi/drm/nouveau_drm.h
-@@ -68,6 +68,13 @@ extern "C" {
- */
- #define NOUVEAU_GETPARAM_VRAM_USED 19
-
-+/*
-+ * NOUVEAU_GETPARAM_HAS_VMA_TILEMODE
-+ *
-+ * Query whether tile mode and PTE kind are accepted with VM allocs or not.
-+ */
-+#define NOUVEAU_GETPARAM_HAS_VMA_TILEMODE 20
-+
- struct drm_nouveau_getparam {
- __u64 param;
- __u64 value;
---
-2.43.0
-
+++ /dev/null
-From 1a11817ac504ef732a7e85f2119241a2a18f6a3d Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 29 May 2024 16:42:47 +0200
-Subject: drm/panel: sitronix-st7789v: fix display size for jt240mhqs_hwt_ek_e3
- panel
-
-From: Gerald Loacker <gerald.loacker@wolfvision.net>
-
-[ Upstream commit b62c150c3bae72ac1910dcc588f360159eb0744a ]
-
-This is a portrait mode display. Change the dimensions accordingly.
-
-Fixes: 0fbbe96bfa08 ("drm/panel: sitronix-st7789v: add jasonic jt240mhqs-hwt-ek-e3 support")
-Signed-off-by: Gerald Loacker <gerald.loacker@wolfvision.net>
-Acked-by: Jessica Zhang <quic_jesszhan@quicinc.com>
-Link: https://lore.kernel.org/r/20240409-bugfix-jt240mhqs_hwt_ek_e3-timing-v2-3-e4821802443d@wolfvision.net
-Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
-Link: https://patchwork.freedesktop.org/patch/msgid/20240409-bugfix-jt240mhqs_hwt_ek_e3-timing-v2-3-e4821802443d@wolfvision.net
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/panel/panel-sitronix-st7789v.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
-index c7e3f1280404d..e8f385b9c6182 100644
---- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
-+++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
-@@ -289,8 +289,8 @@ static const struct drm_display_mode jt240mhqs_hwt_ek_e3_mode = {
- .vsync_start = 280 + 48,
- .vsync_end = 280 + 48 + 4,
- .vtotal = 280 + 48 + 4 + 4,
-- .width_mm = 43,
-- .height_mm = 37,
-+ .width_mm = 37,
-+ .height_mm = 43,
- .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,
- };
-
---
-2.43.0
-
+++ /dev/null
-From da12ce0ec6616d4f40130fe83eb2978c793ac054 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 29 May 2024 16:42:45 +0200
-Subject: drm/panel: sitronix-st7789v: fix timing for jt240mhqs_hwt_ek_e3 panel
-
-From: Gerald Loacker <gerald.loacker@wolfvision.net>
-
-[ Upstream commit 0e5895ff7fab0fc05ec17daf9a568368828fa6ea ]
-
-Flickering was observed when using partial mode. Moving the vsync to the
-same position as used by the default sitronix-st7789v timing resolves this
-issue.
-
-Fixes: 0fbbe96bfa08 ("drm/panel: sitronix-st7789v: add jasonic jt240mhqs-hwt-ek-e3 support")
-Acked-by: Jessica Zhang <quic_jesszhan@quicinc.com>
-Signed-off-by: Gerald Loacker <gerald.loacker@wolfvision.net>
-Link: https://lore.kernel.org/r/20240409-bugfix-jt240mhqs_hwt_ek_e3-timing-v2-1-e4821802443d@wolfvision.net
-Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
-Link: https://patchwork.freedesktop.org/patch/msgid/20240409-bugfix-jt240mhqs_hwt_ek_e3-timing-v2-1-e4821802443d@wolfvision.net
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/panel/panel-sitronix-st7789v.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
-index 88e80fe98112d..32e5c03480381 100644
---- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
-+++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
-@@ -286,9 +286,9 @@ static const struct drm_display_mode jt240mhqs_hwt_ek_e3_mode = {
- .hsync_end = 240 + 28 + 10,
- .htotal = 240 + 28 + 10 + 10,
- .vdisplay = 280,
-- .vsync_start = 280 + 8,
-- .vsync_end = 280 + 8 + 4,
-- .vtotal = 280 + 8 + 4 + 4,
-+ .vsync_start = 280 + 48,
-+ .vsync_end = 280 + 48 + 4,
-+ .vtotal = 280 + 48 + 4 + 4,
- .width_mm = 43,
- .height_mm = 37,
- .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,
---
-2.43.0
-
+++ /dev/null
-From 2d1dad3e69369ea5e4ce985fa1a60f1c374a2959 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 29 May 2024 16:42:46 +0200
-Subject: drm/panel: sitronix-st7789v: tweak timing for jt240mhqs_hwt_ek_e3
- panel
-
-From: Gerald Loacker <gerald.loacker@wolfvision.net>
-
-[ Upstream commit 2ba50582634d0bfe3a333ab7575a7f0122a7cde8 ]
-
-Use the default timing parameters to get a refresh rate of about 60 Hz for
-a clock of 6 MHz.
-
-Fixes: 0fbbe96bfa08 ("drm/panel: sitronix-st7789v: add jasonic jt240mhqs-hwt-ek-e3 support")
-Signed-off-by: Gerald Loacker <gerald.loacker@wolfvision.net>
-Acked-by: Jessica Zhang <quic_jesszhan@quicinc.com>
-Link: https://lore.kernel.org/r/20240409-bugfix-jt240mhqs_hwt_ek_e3-timing-v2-2-e4821802443d@wolfvision.net
-Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
-Link: https://patchwork.freedesktop.org/patch/msgid/20240409-bugfix-jt240mhqs_hwt_ek_e3-timing-v2-2-e4821802443d@wolfvision.net
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/panel/panel-sitronix-st7789v.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
-index 32e5c03480381..c7e3f1280404d 100644
---- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
-+++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
-@@ -282,9 +282,9 @@ static const struct drm_display_mode et028013dma_mode = {
- static const struct drm_display_mode jt240mhqs_hwt_ek_e3_mode = {
- .clock = 6000,
- .hdisplay = 240,
-- .hsync_start = 240 + 28,
-- .hsync_end = 240 + 28 + 10,
-- .htotal = 240 + 28 + 10 + 10,
-+ .hsync_start = 240 + 38,
-+ .hsync_end = 240 + 38 + 10,
-+ .htotal = 240 + 38 + 10 + 10,
- .vdisplay = 280,
- .vsync_start = 280 + 48,
- .vsync_end = 280 + 48 + 4,
---
-2.43.0
-
+++ /dev/null
-From f024e7f975f54b5ea7fb420c73bdb2b431d1baa8 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 18 Mar 2024 14:01:41 -0400
-Subject: drm/xe: Add dbg messages on the suspend resume functions.
-
-From: Rodrigo Vivi <rodrigo.vivi@intel.com>
-
-[ Upstream commit f7f24b7950af4b1548ad5075ddb13eeb333bb782 ]
-
-In case of the suspend/resume flow getting locked up we
-can get reports with some useful hints on where it might
-get locked and if that has failed.
-
-Reviewed-by: Matthew Auld <matthew.auld@intel.com>
-Link: https://patchwork.freedesktop.org/patch/msgid/20240318180141.267458-2-rodrigo.vivi@intel.com
-Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
-Stable-dep-of: 77b79df0268b ("drm/xe: Change pcode timeout to 50msec while polling again")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/xe/xe_pm.c | 22 +++++++++++++++++-----
- 1 file changed, 17 insertions(+), 5 deletions(-)
-
-diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c
-index b429c2876a764..bcf748036dce9 100644
---- a/drivers/gpu/drm/xe/xe_pm.c
-+++ b/drivers/gpu/drm/xe/xe_pm.c
-@@ -54,13 +54,15 @@ int xe_pm_suspend(struct xe_device *xe)
- u8 id;
- int err;
-
-+ drm_dbg(&xe->drm, "Suspending device\n");
-+
- for_each_gt(gt, xe, id)
- xe_gt_suspend_prepare(gt);
-
- /* FIXME: Super racey... */
- err = xe_bo_evict_all(xe);
- if (err)
-- return err;
-+ goto err;
-
- xe_display_pm_suspend(xe);
-
-@@ -68,7 +70,7 @@ int xe_pm_suspend(struct xe_device *xe)
- err = xe_gt_suspend(gt);
- if (err) {
- xe_display_pm_resume(xe);
-- return err;
-+ goto err;
- }
- }
-
-@@ -76,7 +78,11 @@ int xe_pm_suspend(struct xe_device *xe)
-
- xe_display_pm_suspend_late(xe);
-
-+ drm_dbg(&xe->drm, "Device suspended\n");
- return 0;
-+err:
-+ drm_dbg(&xe->drm, "Device suspend failed %d\n", err);
-+ return err;
- }
-
- /**
-@@ -92,13 +98,15 @@ int xe_pm_resume(struct xe_device *xe)
- u8 id;
- int err;
-
-+ drm_dbg(&xe->drm, "Resuming device\n");
-+
- for_each_tile(tile, xe, id)
- xe_wa_apply_tile_workarounds(tile);
-
- for_each_gt(gt, xe, id) {
- err = xe_pcode_init(gt);
- if (err)
-- return err;
-+ goto err;
- }
-
- xe_display_pm_resume_early(xe);
-@@ -109,7 +117,7 @@ int xe_pm_resume(struct xe_device *xe)
- */
- err = xe_bo_restore_kernel(xe);
- if (err)
-- return err;
-+ goto err;
-
- xe_irq_resume(xe);
-
-@@ -120,9 +128,13 @@ int xe_pm_resume(struct xe_device *xe)
-
- err = xe_bo_restore_user(xe);
- if (err)
-- return err;
-+ goto err;
-
-+ drm_dbg(&xe->drm, "Device resumed\n");
- return 0;
-+err:
-+ drm_dbg(&xe->drm, "Device resume failed %d\n", err);
-+ return err;
- }
-
- static bool xe_pm_pci_d3cold_capable(struct pci_dev *pdev)
---
-2.43.0
-
+++ /dev/null
-From a25768366eb6765373fa51c8b785efd98777b5d3 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 8 May 2024 20:52:15 +0530
-Subject: drm/xe: Change pcode timeout to 50msec while polling again
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
-
-[ Upstream commit 77b79df0268bee3ef38fd5e76e86a076ce02995d ]
-
-Polling is initially attempted with timeout_base_ms enabled for
-preemption, and if it exceeds this timeframe, another attempt is made
-without preemption, allowing an additional 50 ms before timing out.
-
-v2
-- Rebase
-
-v3
-- Move warnings to separate patch (Lucas)
-
-Cc: Lucas De Marchi <lucas.demarchi@intel.com>
-Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
-Signed-off-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
-Fixes: 7dc9b92dcfef ("drm/xe: Remove i915_utils dependency from xe_pcode.")
-Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
-Link: https://patchwork.freedesktop.org/patch/msgid/20240508152216.3263109-2-himal.prasad.ghimiray@intel.com
-Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
-(cherry picked from commit c81858eb52266b3d6ba28ca4f62a198231a10cdc)
-Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/xe/xe_pcode.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/gpu/drm/xe/xe_pcode.c b/drivers/gpu/drm/xe/xe_pcode.c
-index c674c87c7f40b..81f4ae2ea08f3 100644
---- a/drivers/gpu/drm/xe/xe_pcode.c
-+++ b/drivers/gpu/drm/xe/xe_pcode.c
-@@ -191,7 +191,7 @@ int xe_pcode_request(struct xe_gt *gt, u32 mbox, u32 request,
- drm_WARN_ON_ONCE(>_to_xe(gt)->drm, timeout_base_ms > 1);
- preempt_disable();
- ret = pcode_try_request(gt, mbox, request, reply_mask, reply, &status,
-- true, timeout_base_ms * 1000, true);
-+ true, 50 * 1000, true);
- preempt_enable();
-
- out:
---
-2.43.0
-
+++ /dev/null
-From 53f036fe10e0b9c5948145284a8db62522f8259d Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 10 Apr 2024 14:20:04 +0530
-Subject: drm/xe: check pcode init status only on root gt of root tile
-
-From: Riana Tauro <riana.tauro@intel.com>
-
-[ Upstream commit 933fd5ffaf87a60a019992d48e3a96b5c3403d9f ]
-
-The root tile indicates the pcode initialization is complete
-when all tiles have completed their initialization.
-So the mailbox can be polled only on the root tile.
-Check pcode init status only on root tile and move it to
-device probe early as root tile is initialized there.
-Also make similar changes in resume paths.
-
-v2: add lock/unlocked version of pcode_mailbox_rw
- to allow pcode init to be called in device
- early probe (Rodrigo)
-
-v3: add code description about using root tile
- change function names to xe_pcode_probe_early
- and xe_pcode_init (Rodrigo)
-
-Signed-off-by: Riana Tauro <riana.tauro@intel.com>
-Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
-Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
-Link: https://patchwork.freedesktop.org/patch/msgid/20240410085005.1126343-2-riana.tauro@intel.com
-Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
-Stable-dep-of: 77b79df0268b ("drm/xe: Change pcode timeout to 50msec while polling again")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/xe/xe_device.c | 21 ++++--
- drivers/gpu/drm/xe/xe_pcode.c | 115 ++++++++++++++++++++-------------
- drivers/gpu/drm/xe/xe_pcode.h | 6 +-
- drivers/gpu/drm/xe/xe_pm.c | 16 ++---
- 4 files changed, 94 insertions(+), 64 deletions(-)
-
-diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
-index 5176c27e4b6a4..1554ba3cf3ce2 100644
---- a/drivers/gpu/drm/xe/xe_device.c
-+++ b/drivers/gpu/drm/xe/xe_device.c
-@@ -377,8 +377,14 @@ static int xe_set_dma_info(struct xe_device *xe)
- return err;
- }
-
--/*
-- * Initialize MMIO resources that don't require any knowledge about tile count.
-+/**
-+ * xe_device_probe_early: Device early probe
-+ * @xe: xe device instance
-+ *
-+ * Initialize MMIO resources that don't require any
-+ * knowledge about tile count. Also initialize pcode
-+ *
-+ * Return: 0 on success, error code on failure
- */
- int xe_device_probe_early(struct xe_device *xe)
- {
-@@ -392,6 +398,10 @@ int xe_device_probe_early(struct xe_device *xe)
- if (err)
- return err;
-
-+ err = xe_pcode_probe_early(xe);
-+ if (err)
-+ return err;
-+
- return 0;
- }
-
-@@ -454,11 +464,8 @@ int xe_device_probe(struct xe_device *xe)
- if (err)
- return err;
-
-- for_each_gt(gt, xe, id) {
-- err = xe_pcode_probe(gt);
-- if (err)
-- return err;
-- }
-+ for_each_gt(gt, xe, id)
-+ xe_pcode_init(gt);
-
- err = xe_display_init_noirq(xe);
- if (err)
-diff --git a/drivers/gpu/drm/xe/xe_pcode.c b/drivers/gpu/drm/xe/xe_pcode.c
-index b324dc2a5debe..c674c87c7f40b 100644
---- a/drivers/gpu/drm/xe/xe_pcode.c
-+++ b/drivers/gpu/drm/xe/xe_pcode.c
-@@ -10,6 +10,7 @@
-
- #include <drm/drm_managed.h>
-
-+#include "xe_device.h"
- #include "xe_gt.h"
- #include "xe_mmio.h"
- #include "xe_pcode_api.h"
-@@ -43,8 +44,6 @@ static int pcode_mailbox_status(struct xe_gt *gt)
- [PCODE_ERROR_MASK] = {-EPROTO, "Unknown"},
- };
-
-- lockdep_assert_held(>->pcode.lock);
--
- err = xe_mmio_read32(gt, PCODE_MAILBOX) & PCODE_ERROR_MASK;
- if (err) {
- drm_err(>_to_xe(gt)->drm, "PCODE Mailbox failed: %d %s", err,
-@@ -55,17 +54,15 @@ static int pcode_mailbox_status(struct xe_gt *gt)
- return 0;
- }
-
--static int pcode_mailbox_rw(struct xe_gt *gt, u32 mbox, u32 *data0, u32 *data1,
-- unsigned int timeout_ms, bool return_data,
-- bool atomic)
-+static int __pcode_mailbox_rw(struct xe_gt *gt, u32 mbox, u32 *data0, u32 *data1,
-+ unsigned int timeout_ms, bool return_data,
-+ bool atomic)
- {
- int err;
-
- if (gt_to_xe(gt)->info.skip_pcode)
- return 0;
-
-- lockdep_assert_held(>->pcode.lock);
--
- if ((xe_mmio_read32(gt, PCODE_MAILBOX) & PCODE_READY) != 0)
- return -EAGAIN;
-
-@@ -87,6 +84,18 @@ static int pcode_mailbox_rw(struct xe_gt *gt, u32 mbox, u32 *data0, u32 *data1,
- return pcode_mailbox_status(gt);
- }
-
-+static int pcode_mailbox_rw(struct xe_gt *gt, u32 mbox, u32 *data0, u32 *data1,
-+ unsigned int timeout_ms, bool return_data,
-+ bool atomic)
-+{
-+ if (gt_to_xe(gt)->info.skip_pcode)
-+ return 0;
-+
-+ lockdep_assert_held(>->pcode.lock);
-+
-+ return __pcode_mailbox_rw(gt, mbox, data0, data1, timeout_ms, return_data, atomic);
-+}
-+
- int xe_pcode_write_timeout(struct xe_gt *gt, u32 mbox, u32 data, int timeout)
- {
- int err;
-@@ -109,15 +118,19 @@ int xe_pcode_read(struct xe_gt *gt, u32 mbox, u32 *val, u32 *val1)
- return err;
- }
-
--static int xe_pcode_try_request(struct xe_gt *gt, u32 mbox,
-- u32 request, u32 reply_mask, u32 reply,
-- u32 *status, bool atomic, int timeout_us)
-+static int pcode_try_request(struct xe_gt *gt, u32 mbox,
-+ u32 request, u32 reply_mask, u32 reply,
-+ u32 *status, bool atomic, int timeout_us, bool locked)
- {
- int slept, wait = 10;
-
- for (slept = 0; slept < timeout_us; slept += wait) {
-- *status = pcode_mailbox_rw(gt, mbox, &request, NULL, 1, true,
-- atomic);
-+ if (locked)
-+ *status = pcode_mailbox_rw(gt, mbox, &request, NULL, 1, true,
-+ atomic);
-+ else
-+ *status = __pcode_mailbox_rw(gt, mbox, &request, NULL, 1, true,
-+ atomic);
- if ((*status == 0) && ((request & reply_mask) == reply))
- return 0;
-
-@@ -158,8 +171,8 @@ int xe_pcode_request(struct xe_gt *gt, u32 mbox, u32 request,
-
- mutex_lock(>->pcode.lock);
-
-- ret = xe_pcode_try_request(gt, mbox, request, reply_mask, reply, &status,
-- false, timeout_base_ms * 1000);
-+ ret = pcode_try_request(gt, mbox, request, reply_mask, reply, &status,
-+ false, timeout_base_ms * 1000, true);
- if (!ret)
- goto out;
-
-@@ -177,8 +190,8 @@ int xe_pcode_request(struct xe_gt *gt, u32 mbox, u32 request,
- "PCODE timeout, retrying with preemption disabled\n");
- drm_WARN_ON_ONCE(>_to_xe(gt)->drm, timeout_base_ms > 1);
- preempt_disable();
-- ret = xe_pcode_try_request(gt, mbox, request, reply_mask, reply, &status,
-- true, timeout_base_ms * 1000);
-+ ret = pcode_try_request(gt, mbox, request, reply_mask, reply, &status,
-+ true, timeout_base_ms * 1000, true);
- preempt_enable();
-
- out:
-@@ -238,59 +251,71 @@ int xe_pcode_init_min_freq_table(struct xe_gt *gt, u32 min_gt_freq,
- }
-
- /**
-- * xe_pcode_init - Ensure PCODE is initialized
-- * @gt: gt instance
-+ * xe_pcode_ready - Ensure PCODE is initialized
-+ * @xe: xe instance
-+ * @locked: true if lock held, false otherwise
- *
-- * This function ensures that PCODE is properly initialized. To be called during
-- * probe and resume paths.
-+ * PCODE init mailbox is polled only on root gt of root tile
-+ * as the root tile provides the initialization is complete only
-+ * after all the tiles have completed the initialization.
-+ * Called only on early probe without locks and with locks in
-+ * resume path.
- *
-- * It returns 0 on success, and -error number on failure.
-+ * Returns 0 on success, and -error number on failure.
- */
--int xe_pcode_init(struct xe_gt *gt)
-+int xe_pcode_ready(struct xe_device *xe, bool locked)
- {
- u32 status, request = DGFX_GET_INIT_STATUS;
-+ struct xe_gt *gt = xe_root_mmio_gt(xe);
- int timeout_us = 180000000; /* 3 min */
- int ret;
-
-- if (gt_to_xe(gt)->info.skip_pcode)
-+ if (xe->info.skip_pcode)
- return 0;
-
-- if (!IS_DGFX(gt_to_xe(gt)))
-+ if (!IS_DGFX(xe))
- return 0;
-
-- mutex_lock(>->pcode.lock);
-- ret = xe_pcode_try_request(gt, DGFX_PCODE_STATUS, request,
-- DGFX_INIT_STATUS_COMPLETE,
-- DGFX_INIT_STATUS_COMPLETE,
-- &status, false, timeout_us);
-- mutex_unlock(>->pcode.lock);
-+ if (locked)
-+ mutex_lock(>->pcode.lock);
-+
-+ ret = pcode_try_request(gt, DGFX_PCODE_STATUS, request,
-+ DGFX_INIT_STATUS_COMPLETE,
-+ DGFX_INIT_STATUS_COMPLETE,
-+ &status, false, timeout_us, locked);
-+
-+ if (locked)
-+ mutex_unlock(>->pcode.lock);
-
- if (ret)
-- drm_err(>_to_xe(gt)->drm,
-+ drm_err(&xe->drm,
- "PCODE initialization timedout after: 3 min\n");
-
- return ret;
- }
-
- /**
-- * xe_pcode_probe - Prepare xe_pcode and also ensure PCODE is initialized.
-+ * xe_pcode_init: initialize components of PCODE
- * @gt: gt instance
- *
-- * This function initializes the xe_pcode component, and when needed, it ensures
-- * that PCODE has properly performed its initialization and it is really ready
-- * to go. To be called once only during probe.
-- *
-- * It returns 0 on success, and -error number on failure.
-+ * This function initializes the xe_pcode component.
-+ * To be called once only during probe.
- */
--int xe_pcode_probe(struct xe_gt *gt)
-+void xe_pcode_init(struct xe_gt *gt)
- {
- drmm_mutex_init(>_to_xe(gt)->drm, >->pcode.lock);
-+}
-
-- if (gt_to_xe(gt)->info.skip_pcode)
-- return 0;
--
-- if (!IS_DGFX(gt_to_xe(gt)))
-- return 0;
--
-- return xe_pcode_init(gt);
-+/**
-+ * xe_pcode_probe_early: initializes PCODE
-+ * @xe: xe instance
-+ *
-+ * This function checks the initialization status of PCODE
-+ * To be called once only during early probe without locks.
-+ *
-+ * Returns 0 on success, error code otherwise
-+ */
-+int xe_pcode_probe_early(struct xe_device *xe)
-+{
-+ return xe_pcode_ready(xe, false);
- }
-diff --git a/drivers/gpu/drm/xe/xe_pcode.h b/drivers/gpu/drm/xe/xe_pcode.h
-index 08cb1d047cba2..3f54c6d2a57d2 100644
---- a/drivers/gpu/drm/xe/xe_pcode.h
-+++ b/drivers/gpu/drm/xe/xe_pcode.h
-@@ -8,9 +8,11 @@
-
- #include <linux/types.h>
- struct xe_gt;
-+struct xe_device;
-
--int xe_pcode_probe(struct xe_gt *gt);
--int xe_pcode_init(struct xe_gt *gt);
-+void xe_pcode_init(struct xe_gt *gt);
-+int xe_pcode_probe_early(struct xe_device *xe);
-+int xe_pcode_ready(struct xe_device *xe, bool locked);
- int xe_pcode_init_min_freq_table(struct xe_gt *gt, u32 min_gt_freq,
- u32 max_gt_freq);
- int xe_pcode_read(struct xe_gt *gt, u32 mbox, u32 *val, u32 *val1);
-diff --git a/drivers/gpu/drm/xe/xe_pm.c b/drivers/gpu/drm/xe/xe_pm.c
-index bcf748036dce9..343b71216b797 100644
---- a/drivers/gpu/drm/xe/xe_pm.c
-+++ b/drivers/gpu/drm/xe/xe_pm.c
-@@ -103,11 +103,9 @@ int xe_pm_resume(struct xe_device *xe)
- for_each_tile(tile, xe, id)
- xe_wa_apply_tile_workarounds(tile);
-
-- for_each_gt(gt, xe, id) {
-- err = xe_pcode_init(gt);
-- if (err)
-- goto err;
-- }
-+ err = xe_pcode_ready(xe, true);
-+ if (err)
-+ return err;
-
- xe_display_pm_resume_early(xe);
-
-@@ -298,11 +296,9 @@ int xe_pm_runtime_resume(struct xe_device *xe)
- xe->d3cold.power_lost = xe_guc_in_reset(>->uc.guc);
-
- if (xe->d3cold.allowed && xe->d3cold.power_lost) {
-- for_each_gt(gt, xe, id) {
-- err = xe_pcode_init(gt);
-- if (err)
-- goto out;
-- }
-+ err = xe_pcode_ready(xe, true);
-+ if (err)
-+ goto out;
-
- /*
- * This only restores pinned memory which is the memory
---
-2.43.0
-
+++ /dev/null
-From e0b87046f752f632ec5d632be53fc87d4d7fb038 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 21 Mar 2024 12:55:12 -0700
-Subject: drm/xe/guc: Check error code when initializing the CT mutex
-
-From: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
-
-[ Upstream commit b4abeb5545bb3ddcdda3c19067680ad0b2259be4 ]
-
-The initialization via drmm_mutex_init can fail, so we need to check the
-return code and escalate the failure.
-
-The mutex initialization has been moved after all the other init steps
-that can't fail, so we're always guaranteed to have those done and don't
-have to check in the cleanup code.
-
-Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
-Reviewed-by: Vinay Belgaumkar <vinay.belgaumkar@intel.com>
-Link: https://patchwork.freedesktop.org/patch/msgid/20240321195512.274210-1-daniele.ceraolospurio@intel.com
-Stable-dep-of: c002bfe644a2 ("drm/xe: Use ordered WQ for G2H handler")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/xe/xe_guc_ct.c | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/gpu/drm/xe/xe_guc_ct.c b/drivers/gpu/drm/xe/xe_guc_ct.c
-index 24a33fa36496a..006c6830b55a7 100644
---- a/drivers/gpu/drm/xe/xe_guc_ct.c
-+++ b/drivers/gpu/drm/xe/xe_guc_ct.c
-@@ -138,13 +138,16 @@ int xe_guc_ct_init(struct xe_guc_ct *ct)
-
- xe_assert(xe, !(guc_ct_size() % PAGE_SIZE));
-
-- drmm_mutex_init(&xe->drm, &ct->lock);
- spin_lock_init(&ct->fast_lock);
- xa_init(&ct->fence_lookup);
- INIT_WORK(&ct->g2h_worker, g2h_worker_func);
- init_waitqueue_head(&ct->wq);
- init_waitqueue_head(&ct->g2h_fence_wq);
-
-+ err = drmm_mutex_init(&xe->drm, &ct->lock);
-+ if (err)
-+ return err;
-+
- primelockdep(ct);
-
- bo = xe_managed_bo_create_pin_map(xe, tile, guc_ct_size(),
---
-2.43.0
-
+++ /dev/null
-From d430e04a614582ebc96d24ddbb01f0624b3fbb30 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 2 Jan 2024 12:35:38 -0800
-Subject: drm/xe/guc: Only take actions in CT irq handler if CTs are enabled
-
-From: Matthew Brost <matthew.brost@intel.com>
-
-[ Upstream commit 5030e16140b655ba00217d47680e697480ac3587 ]
-
-Protect entire IRQ handler by CT being enabled rather than just G2H
-handler.
-
-v2: Return on not enabled in CT irq handler (Michal)
-
-Suggested-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
-Signed-off-by: Matthew Brost <matthew.brost@intel.com>
-Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
-Stable-dep-of: c002bfe644a2 ("drm/xe: Use ordered WQ for G2H handler")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/xe/xe_guc_ct.h | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/gpu/drm/xe/xe_guc_ct.h b/drivers/gpu/drm/xe/xe_guc_ct.h
-index f15f8a4857e07..9ecb67db8ec40 100644
---- a/drivers/gpu/drm/xe/xe_guc_ct.h
-+++ b/drivers/gpu/drm/xe/xe_guc_ct.h
-@@ -24,9 +24,11 @@ void xe_guc_ct_print(struct xe_guc_ct *ct, struct drm_printer *p, bool atomic);
-
- static inline void xe_guc_ct_irq_handler(struct xe_guc_ct *ct)
- {
-+ if (!ct->enabled)
-+ return;
-+
- wake_up_all(&ct->wq);
-- if (ct->enabled)
-- queue_work(system_unbound_wq, &ct->g2h_worker);
-+ queue_work(system_unbound_wq, &ct->g2h_worker);
- xe_guc_ct_fast_path(ct);
- }
-
---
-2.43.0
-
+++ /dev/null
-From 2da6594eb5a33a254705a6c17ffcb6665e2e268c Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 15 Apr 2024 12:04:53 -0700
-Subject: drm/xe: Only use reserved BCS instances for usm migrate exec queue
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Matthew Brost <matthew.brost@intel.com>
-
-[ Upstream commit c8ea2c31f5ea437199b239d76ad5db27343edb0c ]
-
-The GuC context scheduling queue is 2 entires deep, thus it is possible
-for a migration job to be stuck behind a fault if migration exec queue
-shares engines with user jobs. This can deadlock as the migrate exec
-queue is required to service page faults. Avoid deadlock by only using
-reserved BCS instances for usm migrate exec queue.
-
-Fixes: a043fbab7af5 ("drm/xe/pvc: Use fast copy engines as migrate engine on PVC")
-Cc: Matt Roper <matthew.d.roper@intel.com>
-Cc: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
-Signed-off-by: Matthew Brost <matthew.brost@intel.com>
-Link: https://patchwork.freedesktop.org/patch/msgid/20240415190453.696553-2-matthew.brost@intel.com
-Reviewed-by: Brian Welty <brian.welty@intel.com>
-(cherry picked from commit 04f4a70a183a688a60fe3882d6e4236ea02cfc67)
-Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/xe/xe_migrate.c | 12 +++++-------
- 1 file changed, 5 insertions(+), 7 deletions(-)
-
-diff --git a/drivers/gpu/drm/xe/xe_migrate.c b/drivers/gpu/drm/xe/xe_migrate.c
-index 7a6ad3469d748..0f77305c47c88 100644
---- a/drivers/gpu/drm/xe/xe_migrate.c
-+++ b/drivers/gpu/drm/xe/xe_migrate.c
-@@ -32,7 +32,6 @@
- #include "xe_sync.h"
- #include "xe_trace.h"
- #include "xe_vm.h"
--#include "xe_wa.h"
-
- /**
- * struct xe_migrate - migrate context.
-@@ -288,10 +287,6 @@ static int xe_migrate_prepare_vm(struct xe_tile *tile, struct xe_migrate *m,
- }
-
- /*
-- * Due to workaround 16017236439, odd instance hardware copy engines are
-- * faster than even instance ones.
-- * This function returns the mask involving all fast copy engines and the
-- * reserved copy engine to be used as logical mask for migrate engine.
- * Including the reserved copy engine is required to avoid deadlocks due to
- * migrate jobs servicing the faults gets stuck behind the job that faulted.
- */
-@@ -305,8 +300,7 @@ static u32 xe_migrate_usm_logical_mask(struct xe_gt *gt)
- if (hwe->class != XE_ENGINE_CLASS_COPY)
- continue;
-
-- if (!XE_WA(gt, 16017236439) ||
-- xe_gt_is_usm_hwe(gt, hwe) || hwe->instance & 1)
-+ if (xe_gt_is_usm_hwe(gt, hwe))
- logical_mask |= BIT(hwe->logical_instance);
- }
-
-@@ -357,6 +351,10 @@ struct xe_migrate *xe_migrate_init(struct xe_tile *tile)
- if (!hwe || !logical_mask)
- return ERR_PTR(-EINVAL);
-
-+ /*
-+ * XXX: Currently only reserving 1 (likely slow) BCS instance on
-+ * PVC, may want to revisit if performance is needed.
-+ */
- m->q = xe_exec_queue_create(xe, vm, logical_mask, 1, hwe,
- EXEC_QUEUE_FLAG_KERNEL |
- EXEC_QUEUE_FLAG_PERMANENT |
---
-2.43.0
-
+++ /dev/null
-From 95ad221bf81e254480d050b9df5fda71170189cc Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sun, 5 May 2024 20:47:58 -0700
-Subject: drm/xe: Use ordered WQ for G2H handler
-
-From: Matthew Brost <matthew.brost@intel.com>
-
-[ Upstream commit c002bfe644a29ba600c571f2abba13a155a12dcd ]
-
-System work queues are shared, use a dedicated work queue for G2H
-processing to avoid G2H processing getting block behind system tasks.
-
-Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
-Cc: <stable@vger.kernel.org>
-Signed-off-by: Matthew Brost <matthew.brost@intel.com>
-Reviewed-by: Francois Dugast <francois.dugast@intel.com>
-Link: https://patchwork.freedesktop.org/patch/msgid/20240506034758.3697397-1-matthew.brost@intel.com
-(cherry picked from commit 50aec9665e0babd62b9eee4e613d9a1ef8d2b7de)
-Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/xe/xe_guc_ct.c | 5 +++++
- drivers/gpu/drm/xe/xe_guc_ct.h | 2 +-
- drivers/gpu/drm/xe/xe_guc_ct_types.h | 2 ++
- 3 files changed, 8 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/gpu/drm/xe/xe_guc_ct.c b/drivers/gpu/drm/xe/xe_guc_ct.c
-index 006c6830b55a7..917082af197cd 100644
---- a/drivers/gpu/drm/xe/xe_guc_ct.c
-+++ b/drivers/gpu/drm/xe/xe_guc_ct.c
-@@ -113,6 +113,7 @@ static void guc_ct_fini(struct drm_device *drm, void *arg)
- {
- struct xe_guc_ct *ct = arg;
-
-+ destroy_workqueue(ct->g2h_wq);
- xa_destroy(&ct->fence_lookup);
- }
-
-@@ -138,6 +139,10 @@ int xe_guc_ct_init(struct xe_guc_ct *ct)
-
- xe_assert(xe, !(guc_ct_size() % PAGE_SIZE));
-
-+ ct->g2h_wq = alloc_ordered_workqueue("xe-g2h-wq", 0);
-+ if (!ct->g2h_wq)
-+ return -ENOMEM;
-+
- spin_lock_init(&ct->fast_lock);
- xa_init(&ct->fence_lookup);
- INIT_WORK(&ct->g2h_worker, g2h_worker_func);
-diff --git a/drivers/gpu/drm/xe/xe_guc_ct.h b/drivers/gpu/drm/xe/xe_guc_ct.h
-index 9ecb67db8ec40..86b67b775eaba 100644
---- a/drivers/gpu/drm/xe/xe_guc_ct.h
-+++ b/drivers/gpu/drm/xe/xe_guc_ct.h
-@@ -28,7 +28,7 @@ static inline void xe_guc_ct_irq_handler(struct xe_guc_ct *ct)
- return;
-
- wake_up_all(&ct->wq);
-- queue_work(system_unbound_wq, &ct->g2h_worker);
-+ queue_work(ct->g2h_wq, &ct->g2h_worker);
- xe_guc_ct_fast_path(ct);
- }
-
-diff --git a/drivers/gpu/drm/xe/xe_guc_ct_types.h b/drivers/gpu/drm/xe/xe_guc_ct_types.h
-index d814d4ee3fc65..bd945ed3ee41e 100644
---- a/drivers/gpu/drm/xe/xe_guc_ct_types.h
-+++ b/drivers/gpu/drm/xe/xe_guc_ct_types.h
-@@ -106,6 +106,8 @@ struct xe_guc_ct {
- wait_queue_head_t wq;
- /** @g2h_fence_wq: wait queue used for G2H fencing */
- wait_queue_head_t g2h_fence_wq;
-+ /** @g2h_wq: used to process G2H */
-+ struct workqueue_struct *g2h_wq;
- /** @msg: Message buffer */
- u32 msg[GUC_CTB_MSG_MAX_LEN];
- /** @fast_msg: Message buffer */
---
-2.43.0
-
+++ /dev/null
-From 1bbb60e569cbd469bb6b3aaba1f9a58e660aca2b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 8 Mar 2024 15:47:41 -0500
-Subject: drm: zynqmp_dpsub: Always register bridge
-
-From: Sean Anderson <sean.anderson@linux.dev>
-
-[ Upstream commit be3f3042391d061cfca2bd22630e0d101acea5fc ]
-
-We must always register the DRM bridge, since zynqmp_dp_hpd_work_func
-calls drm_bridge_hpd_notify, which in turn expects hpd_mutex to be
-initialized. We do this before zynqmp_dpsub_drm_init since that calls
-drm_bridge_attach. This fixes the following lockdep warning:
-
-[ 19.217084] ------------[ cut here ]------------
-[ 19.227530] DEBUG_LOCKS_WARN_ON(lock->magic != lock)
-[ 19.227768] WARNING: CPU: 0 PID: 140 at kernel/locking/mutex.c:582 __mutex_lock+0x4bc/0x550
-[ 19.241696] Modules linked in:
-[ 19.244937] CPU: 0 PID: 140 Comm: kworker/0:4 Not tainted 6.6.20+ #96
-[ 19.252046] Hardware name: xlnx,zynqmp (DT)
-[ 19.256421] Workqueue: events zynqmp_dp_hpd_work_func
-[ 19.261795] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
-[ 19.269104] pc : __mutex_lock+0x4bc/0x550
-[ 19.273364] lr : __mutex_lock+0x4bc/0x550
-[ 19.277592] sp : ffffffc085c5bbe0
-[ 19.281066] x29: ffffffc085c5bbe0 x28: 0000000000000000 x27: ffffff88009417f8
-[ 19.288624] x26: ffffff8800941788 x25: ffffff8800020008 x24: ffffffc082aa3000
-[ 19.296227] x23: ffffffc080d90e3c x22: 0000000000000002 x21: 0000000000000000
-[ 19.303744] x20: 0000000000000000 x19: ffffff88002f5210 x18: 0000000000000000
-[ 19.311295] x17: 6c707369642e3030 x16: 3030613464662072 x15: 0720072007200720
-[ 19.318922] x14: 0000000000000000 x13: 284e4f5f4e524157 x12: 0000000000000001
-[ 19.326442] x11: 0001ffc085c5b940 x10: 0001ff88003f388b x9 : 0001ff88003f3888
-[ 19.334003] x8 : 0001ff88003f3888 x7 : 0000000000000000 x6 : 0000000000000000
-[ 19.341537] x5 : 0000000000000000 x4 : 0000000000001668 x3 : 0000000000000000
-[ 19.349054] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffffff88003f3880
-[ 19.356581] Call trace:
-[ 19.359160] __mutex_lock+0x4bc/0x550
-[ 19.363032] mutex_lock_nested+0x24/0x30
-[ 19.367187] drm_bridge_hpd_notify+0x2c/0x6c
-[ 19.371698] zynqmp_dp_hpd_work_func+0x44/0x54
-[ 19.376364] process_one_work+0x3ac/0x988
-[ 19.380660] worker_thread+0x398/0x694
-[ 19.384736] kthread+0x1bc/0x1c0
-[ 19.388241] ret_from_fork+0x10/0x20
-[ 19.392031] irq event stamp: 183
-[ 19.395450] hardirqs last enabled at (183): [<ffffffc0800b9278>] finish_task_switch.isra.0+0xa8/0x2d4
-[ 19.405140] hardirqs last disabled at (182): [<ffffffc081ad3754>] __schedule+0x714/0xd04
-[ 19.413612] softirqs last enabled at (114): [<ffffffc080133de8>] srcu_invoke_callbacks+0x158/0x23c
-[ 19.423128] softirqs last disabled at (110): [<ffffffc080133de8>] srcu_invoke_callbacks+0x158/0x23c
-[ 19.432614] ---[ end trace 0000000000000000 ]---
-
-Fixes: eb2d64bfcc17 ("drm: xlnx: zynqmp_dpsub: Report HPD through the bridge")
-Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
-Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
-Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
-Link: https://patchwork.freedesktop.org/patch/msgid/20240308204741.3631919-1-sean.anderson@linux.dev
-(cherry picked from commit 61ba791c4a7a09a370c45b70a81b8c7d4cf6b2ae)
-Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/xlnx/zynqmp_dpsub.c | 7 +++----
- 1 file changed, 3 insertions(+), 4 deletions(-)
-
-diff --git a/drivers/gpu/drm/xlnx/zynqmp_dpsub.c b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
-index 88eb33acd5f0d..face8d6b2a6fb 100644
---- a/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
-+++ b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
-@@ -256,12 +256,12 @@ static int zynqmp_dpsub_probe(struct platform_device *pdev)
- if (ret)
- goto err_dp;
-
-+ drm_bridge_add(dpsub->bridge);
-+
- if (dpsub->dma_enabled) {
- ret = zynqmp_dpsub_drm_init(dpsub);
- if (ret)
- goto err_disp;
-- } else {
-- drm_bridge_add(dpsub->bridge);
- }
-
- dev_info(&pdev->dev, "ZynqMP DisplayPort Subsystem driver probed");
-@@ -288,9 +288,8 @@ static void zynqmp_dpsub_remove(struct platform_device *pdev)
-
- if (dpsub->drm)
- zynqmp_dpsub_drm_cleanup(dpsub);
-- else
-- drm_bridge_remove(dpsub->bridge);
-
-+ drm_bridge_remove(dpsub->bridge);
- zynqmp_disp_remove(dpsub);
- zynqmp_dp_remove(dpsub);
-
---
-2.43.0
-
+++ /dev/null
-From a1aa10c97eb060fbfd714305d16216dfeb29244f Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 26 Apr 2024 17:42:12 +0200
-Subject: dt-bindings: adc: axi-adc: add clocks property
-
-From: Nuno Sa <nuno.sa@analog.com>
-
-[ Upstream commit 19fb11d7220b8abc016aa254dc7e6d9f2d49b178 ]
-
-Add a required clock property as we can't access the device registers if
-the AXI bus clock is not properly enabled.
-
-Note this clock is a very fundamental one that is typically enabled
-pretty early during boot. Independently of that, we should really rely on
-it to be enabled.
-
-Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
-Fixes: 96553a44e96d ("dt-bindings: iio: adc: add bindings doc for AXI ADC driver")
-Signed-off-by: Nuno Sa <nuno.sa@analog.com>
-Link: https://lore.kernel.org/r/20240426-ad9467-new-features-v2-3-6361fc3ba1cc@analog.com
-Cc: <Stable@ver.kernel.org>
-Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- Documentation/devicetree/bindings/iio/adc/adi,axi-adc.yaml | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/Documentation/devicetree/bindings/iio/adc/adi,axi-adc.yaml b/Documentation/devicetree/bindings/iio/adc/adi,axi-adc.yaml
-index 3d49d21ad33df..e1f450b80db27 100644
---- a/Documentation/devicetree/bindings/iio/adc/adi,axi-adc.yaml
-+++ b/Documentation/devicetree/bindings/iio/adc/adi,axi-adc.yaml
-@@ -28,6 +28,9 @@ properties:
- reg:
- maxItems: 1
-
-+ clocks:
-+ maxItems: 1
-+
- dmas:
- maxItems: 1
-
-@@ -48,6 +51,7 @@ required:
- - compatible
- - dmas
- - reg
-+ - clocks
-
- additionalProperties: false
-
-@@ -58,6 +62,7 @@ examples:
- reg = <0x44a00000 0x10000>;
- dmas = <&rx_dma 0>;
- dma-names = "rx";
-+ clocks = <&axi_clk>;
- #io-backend-cells = <0>;
- };
- ...
---
-2.43.0
-
+++ /dev/null
-From ecc0c506e87fbaccf3796fd478246a5476173beb Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 10 Feb 2024 21:57:14 +0100
-Subject: dt-bindings: adc: axi-adc: update bindings for backend framework
-
-From: Nuno Sa <nuno.sa@analog.com>
-
-[ Upstream commit a032b921bdeba2274866daafc8e791edd609eb13 ]
-
-'adi,adc-dev' is now deprecated and must not be used anymore. Hence,
-also remove it from being required.
-
-The reason why it's being deprecated is because the axi-adc CORE is now
-an IIO service provider hardware (IIO backends) for consumers to make use
-of. Before, the logic with 'adi,adc-dev' was the opposite (it was kind
-of consumer referencing other nodes/devices) and that proved to be wrong
-and to not scale.
-
-Now, IIO consumers of this hardware are expected to reference it using the
-io-backends property. Hence, the new '#io-backend-cells' is being added
-so the device is easily identified as a provider.
-
-Reviewed-by: Rob Herring <robh@kernel.org>
-Signed-off-by: Nuno Sa <nuno.sa@analog.com>
-Link: https://lore.kernel.org/r/20240210-iio-backend-v11-2-f5242a5fb42a@analog.com
-Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-Stable-dep-of: 19fb11d7220b ("dt-bindings: adc: axi-adc: add clocks property")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- .../devicetree/bindings/iio/adc/adi,axi-adc.yaml | 8 +++++---
- 1 file changed, 5 insertions(+), 3 deletions(-)
-
-diff --git a/Documentation/devicetree/bindings/iio/adc/adi,axi-adc.yaml b/Documentation/devicetree/bindings/iio/adc/adi,axi-adc.yaml
-index 9996dd93f84b2..3d49d21ad33df 100644
---- a/Documentation/devicetree/bindings/iio/adc/adi,axi-adc.yaml
-+++ b/Documentation/devicetree/bindings/iio/adc/adi,axi-adc.yaml
-@@ -39,12 +39,15 @@ properties:
- $ref: /schemas/types.yaml#/definitions/phandle
- description:
- A reference to a the actual ADC to which this FPGA ADC interfaces to.
-+ deprecated: true
-+
-+ '#io-backend-cells':
-+ const: 0
-
- required:
- - compatible
- - dmas
- - reg
-- - adi,adc-dev
-
- additionalProperties: false
-
-@@ -55,7 +58,6 @@ examples:
- reg = <0x44a00000 0x10000>;
- dmas = <&rx_dma 0>;
- dma-names = "rx";
--
-- adi,adc-dev = <&spi_adc>;
-+ #io-backend-cells = <0>;
- };
- ...
---
-2.43.0
-
+++ /dev/null
-From 55e686e04cc48a334b94d6e63de47f46eb5e7b28 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 1 Feb 2024 16:52:01 +0100
-Subject: dt-bindings: PCI: rcar-pci-host: Add missing IOMMU properties
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Geert Uytterhoeven <geert+renesas@glider.be>
-
-[ Upstream commit 78d212851f0e56b7d7083c4d5014aa7fa8b77e20 ]
-
-make dtbs_check:
-
- arch/arm64/boot/dts/renesas/r8a77951-salvator-xs.dtb: pcie@fe000000: Unevaluated properties are not allowed ('iommu-map', 'iommu-map-mask' were unexpected)
- from schema $id: http://devicetree.org/schemas/pci/rcar-pci-host.yaml#
-
-Fix this by adding the missing IOMMU-related properties.
-
-[kwilczynski: added missing Fixes: tag]
-Fixes: 0d69ce3c2c63 ("dt-bindings: PCI: rcar-pci-host: Convert bindings to json-schema")
-Link: https://lore.kernel.org/linux-pci/babc878a93cb6461a5d39331f8ecfa654dfda921.1706802597.git.geert+renesas@glider.be
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
-Acked-by: Conor Dooley <conor.dooley@microchip.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- Documentation/devicetree/bindings/pci/rcar-pci-host.yaml | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/Documentation/devicetree/bindings/pci/rcar-pci-host.yaml b/Documentation/devicetree/bindings/pci/rcar-pci-host.yaml
-index b6a7cb32f61e5..835b6db00c279 100644
---- a/Documentation/devicetree/bindings/pci/rcar-pci-host.yaml
-+++ b/Documentation/devicetree/bindings/pci/rcar-pci-host.yaml
-@@ -77,6 +77,9 @@ properties:
- vpcie12v-supply:
- description: The 12v regulator to use for PCIe.
-
-+ iommu-map: true
-+ iommu-map-mask: true
-+
- required:
- - compatible
- - reg
---
-2.43.0
-
+++ /dev/null
-From 6754a4579d3af6993353daeb4f9bb9e12d6e9bb0 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 1 Apr 2024 12:00:58 +0200
-Subject: dt-bindings: PCI: rockchip,rk3399-pcie: Add missing maxItems to
- ep-gpios
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
-
-[ Upstream commit 52d06636a4ae4db24ebfe23fae7a525f7e983604 ]
-
-Properties with GPIOs should define number of actual GPIOs, so add
-missing maxItems to ep-gpios. Otherwise multiple GPIOs could be
-provided which is not a true hardware description.
-
-Fixes: aa222f9311e1 ("dt-bindings: PCI: Convert Rockchip RK3399 PCIe to DT schema")
-Link: https://lore.kernel.org/linux-pci/20240401100058.15749-1-krzysztof.kozlowski@linaro.org
-Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
-Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
-Acked-by: Conor Dooley <conor.dooley@microchip.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- Documentation/devicetree/bindings/pci/rockchip,rk3399-pcie.yaml | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/Documentation/devicetree/bindings/pci/rockchip,rk3399-pcie.yaml b/Documentation/devicetree/bindings/pci/rockchip,rk3399-pcie.yaml
-index 531008f0b6ac3..002b728cbc718 100644
---- a/Documentation/devicetree/bindings/pci/rockchip,rk3399-pcie.yaml
-+++ b/Documentation/devicetree/bindings/pci/rockchip,rk3399-pcie.yaml
-@@ -37,6 +37,7 @@ properties:
- description: This property is needed if using 24MHz OSC for RC's PHY.
-
- ep-gpios:
-+ maxItems: 1
- description: pre-reset GPIO
-
- vpcie12v-supply:
---
-2.43.0
-
+++ /dev/null
-From 1603af7b588df0be2edd0285d3e14065bea35921 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 1 May 2024 19:19:28 +0300
-Subject: dt-bindings: phy: qcom,sc8280xp-qmp-ufs-phy: fix msm899[68]
- power-domains
-
-From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-
-[ Upstream commit 59e377a124dc9039d9554d823b1cb4942bcee9a0 ]
-
-The Qualcomm MSM8996 and MSM8998 platforms don't have separate power
-domain for the UFS PHY. Replace required:power-domains with the
-conditional schema.
-
-Fixes: dc5cb63592bd ("dt-bindings: phy: migrate QMP UFS PHY bindings to qcom,sc8280xp-qmp-ufs-phy.yaml")
-Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
-Link: https://lore.kernel.org/r/20240501-qcom-phy-fixes-v1-2-f1fd15c33fb3@linaro.org
-Signed-off-by: Vinod Koul <vkoul@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- .../bindings/phy/qcom,sc8280xp-qmp-ufs-phy.yaml | 16 +++++++++++++++-
- 1 file changed, 15 insertions(+), 1 deletion(-)
-
-diff --git a/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-ufs-phy.yaml b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-ufs-phy.yaml
-index 8474eef8d0ff5..b2bae42134a29 100644
---- a/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-ufs-phy.yaml
-+++ b/Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-ufs-phy.yaml
-@@ -73,7 +73,6 @@ required:
- - reg
- - clocks
- - clock-names
-- - power-domains
- - resets
- - reset-names
- - vdda-phy-supply
-@@ -134,6 +133,21 @@ allOf:
- clock-names:
- maxItems: 1
-
-+ - if:
-+ properties:
-+ compatible:
-+ contains:
-+ enum:
-+ - qcom,msm8996-qmp-ufs-phy
-+ - qcom,msm8998-qmp-ufs-phy
-+ then:
-+ properties:
-+ power-domains:
-+ false
-+ else:
-+ required:
-+ - power-domains
-+
- additionalProperties: false
-
- examples:
---
-2.43.0
-
+++ /dev/null
-From 14f10f92a7924eac85292a42ac82e8d7e9c1e7f7 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 1 May 2024 19:19:29 +0300
-Subject: dt-bindings: phy: qcom,usb-snps-femto-v2: use correct fallback for
- sc8180x
-
-From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-
-[ Upstream commit 960b3f023d3bda0efd6e573a0647227d1115d266 ]
-
-The qcom,sc8180x-usb-hs-phy device uses qcom,usb-snps-hs-7nm-phy
-fallback. Correct the schema for this platform.
-
-Fixes: 9160fb7c39a1 ("dt-bindings: phy: qcom,usb-snps-femto-v2: use fallback compatibles")
-Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
-Link: https://lore.kernel.org/r/20240501-qcom-phy-fixes-v1-3-f1fd15c33fb3@linaro.org
-Signed-off-by: Vinod Koul <vkoul@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- .../devicetree/bindings/phy/qcom,usb-snps-femto-v2.yaml | 4 +---
- 1 file changed, 1 insertion(+), 3 deletions(-)
-
-diff --git a/Documentation/devicetree/bindings/phy/qcom,usb-snps-femto-v2.yaml b/Documentation/devicetree/bindings/phy/qcom,usb-snps-femto-v2.yaml
-index 0f200e3f97a9a..fce7f8a19e9c0 100644
---- a/Documentation/devicetree/bindings/phy/qcom,usb-snps-femto-v2.yaml
-+++ b/Documentation/devicetree/bindings/phy/qcom,usb-snps-femto-v2.yaml
-@@ -15,9 +15,6 @@ description: |
- properties:
- compatible:
- oneOf:
-- - enum:
-- - qcom,sc8180x-usb-hs-phy
-- - qcom,usb-snps-femto-v2-phy
- - items:
- - enum:
- - qcom,sa8775p-usb-hs-phy
-@@ -26,6 +23,7 @@ properties:
- - items:
- - enum:
- - qcom,sc7280-usb-hs-phy
-+ - qcom,sc8180x-usb-hs-phy
- - qcom,sdx55-usb-hs-phy
- - qcom,sdx65-usb-hs-phy
- - qcom,sm6375-usb-hs-phy
---
-2.43.0
-
+++ /dev/null
-From a1f0655ae2fcc7b3fe89260aaf7c1afc9211951a Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 23 Apr 2024 06:55:01 +0200
-Subject: dt-bindings: pinctrl: mediatek: mt7622: fix array properties
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Rafał Miłecki <rafal@milecki.pl>
-
-[ Upstream commit 61fcbbf3ca038c048c942ce31bb3d3c846c87581 ]
-
-Some properties (function groups & pins) are meant to be arrays and
-should allow multiple entries out of enum sets. Use "items" for those.
-
-Mistake was noticed during validation of in-kernel DTS files.
-
-Fixes: b9ffc18c6388 ("dt-bindings: mediatek: convert pinctrl to yaml")
-Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
-Acked-by: Rob Herring <robh@kernel.org>
-Message-ID: <20240423045502.7778-1-zajec5@gmail.com>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- .../pinctrl/mediatek,mt7622-pinctrl.yaml | 92 ++++++++++---------
- 1 file changed, 49 insertions(+), 43 deletions(-)
-
-diff --git a/Documentation/devicetree/bindings/pinctrl/mediatek,mt7622-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/mediatek,mt7622-pinctrl.yaml
-index bd72a326e6e06..60f30a59f3853 100644
---- a/Documentation/devicetree/bindings/pinctrl/mediatek,mt7622-pinctrl.yaml
-+++ b/Documentation/devicetree/bindings/pinctrl/mediatek,mt7622-pinctrl.yaml
-@@ -97,7 +97,8 @@ patternProperties:
- then:
- properties:
- groups:
-- enum: [emmc, emmc_rst]
-+ items:
-+ enum: [emmc, emmc_rst]
- - if:
- properties:
- function:
-@@ -105,8 +106,9 @@ patternProperties:
- then:
- properties:
- groups:
-- enum: [esw, esw_p0_p1, esw_p2_p3_p4, rgmii_via_esw,
-- rgmii_via_gmac1, rgmii_via_gmac2, mdc_mdio]
-+ items:
-+ enum: [esw, esw_p0_p1, esw_p2_p3_p4, rgmii_via_esw,
-+ rgmii_via_gmac1, rgmii_via_gmac2, mdc_mdio]
- - if:
- properties:
- function:
-@@ -123,10 +125,11 @@ patternProperties:
- then:
- properties:
- groups:
-- enum: [i2s_in_mclk_bclk_ws, i2s1_in_data, i2s2_in_data,
-- i2s3_in_data, i2s4_in_data, i2s_out_mclk_bclk_ws,
-- i2s1_out_data, i2s2_out_data, i2s3_out_data,
-- i2s4_out_data]
-+ items:
-+ enum: [i2s_in_mclk_bclk_ws, i2s1_in_data, i2s2_in_data,
-+ i2s3_in_data, i2s4_in_data, i2s_out_mclk_bclk_ws,
-+ i2s1_out_data, i2s2_out_data, i2s3_out_data,
-+ i2s4_out_data]
- - if:
- properties:
- function:
-@@ -159,10 +162,11 @@ patternProperties:
- then:
- properties:
- groups:
-- enum: [pcie0_0_waken, pcie0_1_waken, pcie1_0_waken,
-- pcie0_0_clkreq, pcie0_1_clkreq, pcie1_0_clkreq,
-- pcie0_pad_perst, pcie1_pad_perst, pcie_pereset,
-- pcie_wake, pcie_clkreq]
-+ items:
-+ enum: [pcie0_0_waken, pcie0_1_waken, pcie1_0_waken,
-+ pcie0_0_clkreq, pcie0_1_clkreq, pcie1_0_clkreq,
-+ pcie0_pad_perst, pcie1_pad_perst, pcie_pereset,
-+ pcie_wake, pcie_clkreq]
- - if:
- properties:
- function:
-@@ -178,11 +182,12 @@ patternProperties:
- then:
- properties:
- groups:
-- enum: [pwm_ch1_0, pwm_ch1_1, pwm_ch1_2, pwm_ch2_0, pwm_ch2_1,
-- pwm_ch2_2, pwm_ch3_0, pwm_ch3_1, pwm_ch3_2, pwm_ch4_0,
-- pwm_ch4_1, pwm_ch4_2, pwm_ch4_3, pwm_ch5_0, pwm_ch5_1,
-- pwm_ch5_2, pwm_ch6_0, pwm_ch6_1, pwm_ch6_2, pwm_ch6_3,
-- pwm_ch7_0, pwm_0, pwm_1]
-+ items:
-+ enum: [pwm_ch1_0, pwm_ch1_1, pwm_ch1_2, pwm_ch2_0, pwm_ch2_1,
-+ pwm_ch2_2, pwm_ch3_0, pwm_ch3_1, pwm_ch3_2, pwm_ch4_0,
-+ pwm_ch4_1, pwm_ch4_2, pwm_ch4_3, pwm_ch5_0, pwm_ch5_1,
-+ pwm_ch5_2, pwm_ch6_0, pwm_ch6_1, pwm_ch6_2, pwm_ch6_3,
-+ pwm_ch7_0, pwm_0, pwm_1]
- - if:
- properties:
- function:
-@@ -260,33 +265,34 @@ patternProperties:
- pins:
- description:
- An array of strings. Each string contains the name of a pin.
-- enum: [GPIO_A, I2S1_IN, I2S1_OUT, I2S_BCLK, I2S_WS, I2S_MCLK, TXD0,
-- RXD0, SPI_WP, SPI_HOLD, SPI_CLK, SPI_MOSI, SPI_MISO, SPI_CS,
-- I2C_SDA, I2C_SCL, I2S2_IN, I2S3_IN, I2S4_IN, I2S2_OUT,
-- I2S3_OUT, I2S4_OUT, GPIO_B, MDC, MDIO, G2_TXD0, G2_TXD1,
-- G2_TXD2, G2_TXD3, G2_TXEN, G2_TXC, G2_RXD0, G2_RXD1, G2_RXD2,
-- G2_RXD3, G2_RXDV, G2_RXC, NCEB, NWEB, NREB, NDL4, NDL5, NDL6,
-- NDL7, NRB, NCLE, NALE, NDL0, NDL1, NDL2, NDL3, MDI_TP_P0,
-- MDI_TN_P0, MDI_RP_P0, MDI_RN_P0, MDI_TP_P1, MDI_TN_P1,
-- MDI_RP_P1, MDI_RN_P1, MDI_RP_P2, MDI_RN_P2, MDI_TP_P2,
-- MDI_TN_P2, MDI_TP_P3, MDI_TN_P3, MDI_RP_P3, MDI_RN_P3,
-- MDI_RP_P4, MDI_RN_P4, MDI_TP_P4, MDI_TN_P4, PMIC_SCL,
-- PMIC_SDA, SPIC1_CLK, SPIC1_MOSI, SPIC1_MISO, SPIC1_CS,
-- GPIO_D, WATCHDOG, RTS3_N, CTS3_N, TXD3, RXD3, PERST0_N,
-- PERST1_N, WLED_N, EPHY_LED0_N, AUXIN0, AUXIN1, AUXIN2,
-- AUXIN3, TXD4, RXD4, RTS4_N, CST4_N, PWM1, PWM2, PWM3, PWM4,
-- PWM5, PWM6, PWM7, GPIO_E, TOP_5G_CLK, TOP_5G_DATA,
-- WF0_5G_HB0, WF0_5G_HB1, WF0_5G_HB2, WF0_5G_HB3, WF0_5G_HB4,
-- WF0_5G_HB5, WF0_5G_HB6, XO_REQ, TOP_RST_N, SYS_WATCHDOG,
-- EPHY_LED0_N_JTDO, EPHY_LED1_N_JTDI, EPHY_LED2_N_JTMS,
-- EPHY_LED3_N_JTCLK, EPHY_LED4_N_JTRST_N, WF2G_LED_N,
-- WF5G_LED_N, GPIO_9, GPIO_10, GPIO_11, GPIO_12, UART1_TXD,
-- UART1_RXD, UART1_CTS, UART1_RTS, UART2_TXD, UART2_RXD,
-- UART2_CTS, UART2_RTS, SMI_MDC, SMI_MDIO, PCIE_PERESET_N,
-- PWM_0, GPIO_0, GPIO_1, GPIO_2, GPIO_3, GPIO_4, GPIO_5,
-- GPIO_6, GPIO_7, GPIO_8, UART0_TXD, UART0_RXD, TOP_2G_CLK,
-- TOP_2G_DATA, WF0_2G_HB0, WF0_2G_HB1, WF0_2G_HB2, WF0_2G_HB3,
-- WF0_2G_HB4, WF0_2G_HB5, WF0_2G_HB6]
-+ items:
-+ enum: [GPIO_A, I2S1_IN, I2S1_OUT, I2S_BCLK, I2S_WS, I2S_MCLK, TXD0,
-+ RXD0, SPI_WP, SPI_HOLD, SPI_CLK, SPI_MOSI, SPI_MISO, SPI_CS,
-+ I2C_SDA, I2C_SCL, I2S2_IN, I2S3_IN, I2S4_IN, I2S2_OUT,
-+ I2S3_OUT, I2S4_OUT, GPIO_B, MDC, MDIO, G2_TXD0, G2_TXD1,
-+ G2_TXD2, G2_TXD3, G2_TXEN, G2_TXC, G2_RXD0, G2_RXD1, G2_RXD2,
-+ G2_RXD3, G2_RXDV, G2_RXC, NCEB, NWEB, NREB, NDL4, NDL5, NDL6,
-+ NDL7, NRB, NCLE, NALE, NDL0, NDL1, NDL2, NDL3, MDI_TP_P0,
-+ MDI_TN_P0, MDI_RP_P0, MDI_RN_P0, MDI_TP_P1, MDI_TN_P1,
-+ MDI_RP_P1, MDI_RN_P1, MDI_RP_P2, MDI_RN_P2, MDI_TP_P2,
-+ MDI_TN_P2, MDI_TP_P3, MDI_TN_P3, MDI_RP_P3, MDI_RN_P3,
-+ MDI_RP_P4, MDI_RN_P4, MDI_TP_P4, MDI_TN_P4, PMIC_SCL,
-+ PMIC_SDA, SPIC1_CLK, SPIC1_MOSI, SPIC1_MISO, SPIC1_CS,
-+ GPIO_D, WATCHDOG, RTS3_N, CTS3_N, TXD3, RXD3, PERST0_N,
-+ PERST1_N, WLED_N, EPHY_LED0_N, AUXIN0, AUXIN1, AUXIN2,
-+ AUXIN3, TXD4, RXD4, RTS4_N, CST4_N, PWM1, PWM2, PWM3, PWM4,
-+ PWM5, PWM6, PWM7, GPIO_E, TOP_5G_CLK, TOP_5G_DATA,
-+ WF0_5G_HB0, WF0_5G_HB1, WF0_5G_HB2, WF0_5G_HB3, WF0_5G_HB4,
-+ WF0_5G_HB5, WF0_5G_HB6, XO_REQ, TOP_RST_N, SYS_WATCHDOG,
-+ EPHY_LED0_N_JTDO, EPHY_LED1_N_JTDI, EPHY_LED2_N_JTMS,
-+ EPHY_LED3_N_JTCLK, EPHY_LED4_N_JTRST_N, WF2G_LED_N,
-+ WF5G_LED_N, GPIO_9, GPIO_10, GPIO_11, GPIO_12, UART1_TXD,
-+ UART1_RXD, UART1_CTS, UART1_RTS, UART2_TXD, UART2_RXD,
-+ UART2_CTS, UART2_RTS, SMI_MDC, SMI_MDIO, PCIE_PERESET_N,
-+ PWM_0, GPIO_0, GPIO_1, GPIO_2, GPIO_3, GPIO_4, GPIO_5,
-+ GPIO_6, GPIO_7, GPIO_8, UART0_TXD, UART0_RXD, TOP_2G_CLK,
-+ TOP_2G_DATA, WF0_2G_HB0, WF0_2G_HB1, WF0_2G_HB2, WF0_2G_HB3,
-+ WF0_2G_HB4, WF0_2G_HB5, WF0_2G_HB6]
-
- bias-disable: true
-
---
-2.43.0
-
+++ /dev/null
-From 8d9ca9ac62b93af0a43e15fd70041ed3cad8d45e Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 12 Mar 2024 10:58:07 +0800
-Subject: dt-bindings: pinctrl: qcom: update functions to match with driver
-
-From: Tengfei Fan <quic_tengfan@quicinc.com>
-
-[ Upstream commit 842ecb5fcf8de17dfde11d4ec5f41930f0076887 ]
-
-Some functions were consolidated in the SM4450 pinctrl driver, but they
-had not been updated in the binding file before the previous SM4450
-pinctrl patch series was merged.
-Update functions in this binding file to match with SM4450 pinctrl
-driver. Some functions need to be consolidated and some functions need
-to be removed.
-The following functions are removed:
- - atest_char0, atest_char1, atest_char2, atest_char3
- - atest_usb00, atest_usb01, atest_usb02, atest_usb03
- - audio_ref
- - cci_async
- - cci_timer0, cci_timer1, cci_timer2, cci_timer3, cci_timer4
- - cmu_rng0, cmu_rng1, cmu_rng2, cmu_rng3
- - coex_uart1
- - cri_trng0, cri_trng1
- - dbg_out
- - ddr_pxi0, ddr_pxi1
- - dp0_hot
- - gcc_gp1, gcc_gp2, gcc_gp3
- - ibi_i3c
- - jitter_bist
- - mdp_vsync0, mdp_vsync1, mdp_vsync2, mdp_vsync3
- - mi2s0_data0, mi2s0_data1, mi2s0_sck, mi2s0_ws, mi2s2_data0,
- mi2s2_data1, mi2s2_sck, mi2s2_ws, mi2s_mclk0, mi2s_mclk1
- - nav_gpio0, nav_gpio1, nav_gpio2
- - phase_flag0, phase_flag1, phase_flag10, phase_flag11, phase_flag12,
- phase_flag13, phase_flag14, phase_flag15, phase_flag16,
- phase_flag17, phase_flag18, phase_flag19, phase_flag2, phase_flag20,
- phase_flag21, phase_flag22, phase_flag23, phase_flag24,
- phase_flag25, phase_flag26, phase_flag27, phase_flag28,
- phase_flag29, phase_flag3, phase_flag30, phase_flag31, phase_flag4,
- phase_flag5, phase_flag6, phase_flag7, phase_flag8, phase_flag9
- - pll_bist, pll_clk
- - prng_rosc0, prng_rosc1, prng_rosc2, prng_rosc3
- - qdss_gpio0, qdss_gpio1, qdss_gpio10, qdss_gpio11, qdss_gpio12,
- qdss_gpio13, qdss_gpio14, qdss_gpio15, qdss_gpio2, qdss_gpio3,
- qdss_gpio4, qdss_gpio5, qdss_gpio6, qdss_gpio7, qdss_gpio8,
- qdss_gpio9
- - qlink0_wmss
- - qup0_se5, qup0_se6, qup0_se7, qup1_se5, qup1_se6
- - sd_write
- - tb_trig
- - tgu_ch0, tgu_ch1, tgu_ch2, tgu_ch3
- - tmess_prng0, tmess_prng1, tmess_prng2, tmess_prng3
- - tsense_pwm1, tsense_pwm2
- - uim0_clk, uim0_data, uim0_present, uim0_reset, uim1_clk, uim1_data,
- uim1_present, uim1_reset
- - usb0_hs, usb0_phy
- - vsense_trigger
-
-The following functions are added:
- - atest_char
- - atest_usb0
- - audio_ref_clk
- - cci
- - cci_async_in0
- - cmu_rng
- - coex_uart1_rx, coex_uart1_tx
- - dbg_out_clk
- - ddr_pxi0_test, ddr_pxi1_test
- - gcc_gp1_clk, gcc_gp2_clk, gcc_gp3_clk
- - ibi_i3c_qup0, ibi_i3c_qup1
- - jitter_bist_ref
- - mdp_vsync
- - nav
- - phase_flag
- - pll_bist_sync, pll_clk_aux
- - prng_rosc
- - qlink0_wmss_reset
- - sd_write_protect
- - tb_trig_sdc1, tb_trig_sdc2
- - tgu_ch0_trigout, tgu_ch1_trigout, tgu_ch2_trigout, tgu_ch3_trigout
- - tmess_prng
- - tsense_pwm1_out, tsense_pwm2_out
- - uim0, uim1
- - usb0_hs_ac, usb0_phy_ps
- - vsense_trigger_mirnat
- - wlan1_adc_dtest0, wlan1_adc_dtest1
-
-Fixes: 7bf8b78f86db ("dt-bindings: pinctrl: qcom: Add SM4450 pinctrl")
-Signed-off-by: Tengfei Fan <quic_tengfan@quicinc.com>
-Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
-Message-ID: <20240312025807.26075-3-quic_tengfan@quicinc.com>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- .../bindings/pinctrl/qcom,sm4450-tlmm.yaml | 52 +++++++------------
- 1 file changed, 18 insertions(+), 34 deletions(-)
-
-diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,sm4450-tlmm.yaml b/Documentation/devicetree/bindings/pinctrl/qcom,sm4450-tlmm.yaml
-index bb08ca5a1509e..53d59b641bf78 100644
---- a/Documentation/devicetree/bindings/pinctrl/qcom,sm4450-tlmm.yaml
-+++ b/Documentation/devicetree/bindings/pinctrl/qcom,sm4450-tlmm.yaml
-@@ -72,40 +72,24 @@ $defs:
- description:
- Specify the alternative function to be configured for the specified
- pins.
-- enum: [ gpio, atest_char, atest_char0, atest_char1, atest_char2,
-- atest_char3, atest_usb0, atest_usb00, atest_usb01, atest_usb02,
-- atest_usb03, audio_ref, cam_mclk, cci_async, cci_i2c,
-- cci_timer0, cci_timer1, cci_timer2, cci_timer3, cci_timer4,
-- cmu_rng0, cmu_rng1, cmu_rng2, cmu_rng3, coex_uart1, cri_trng,
-- cri_trng0, cri_trng1, dbg_out, ddr_bist, ddr_pxi0, ddr_pxi1,
-- dp0_hot, gcc_gp1, gcc_gp2, gcc_gp3, host2wlan_sol, ibi_i3c,
-- jitter_bist, mdp_vsync, mdp_vsync0, mdp_vsync1, mdp_vsync2,
-- mdp_vsync3, mi2s0_data0, mi2s0_data1, mi2s0_sck, mi2s0_ws,
-- mi2s2_data0, mi2s2_data1, mi2s2_sck, mi2s2_ws, mi2s_mclk0,
-- mi2s_mclk1, nav_gpio0, nav_gpio1, nav_gpio2, pcie0_clk,
-- phase_flag0, phase_flag1, phase_flag10, phase_flag11,
-- phase_flag12, phase_flag13, phase_flag14, phase_flag15,
-- phase_flag16, phase_flag17, phase_flag18, phase_flag19,
-- phase_flag2, phase_flag20, phase_flag21, phase_flag22,
-- phase_flag23, phase_flag24, phase_flag25, phase_flag26,
-- phase_flag27, phase_flag28, phase_flag29, phase_flag3,
-- phase_flag30, phase_flag31, phase_flag4, phase_flag5,
-- phase_flag6, phase_flag7, phase_flag8, phase_flag9,
-- pll_bist, pll_clk, prng_rosc0, prng_rosc1, prng_rosc2,
-- prng_rosc3, qdss_cti, qdss_gpio, qdss_gpio0, qdss_gpio1,
-- qdss_gpio10, qdss_gpio11, qdss_gpio12, qdss_gpio13, qdss_gpio14,
-- qdss_gpio15, qdss_gpio2, qdss_gpio3, qdss_gpio4, qdss_gpio5,
-- qdss_gpio6, qdss_gpio7, qdss_gpio8, qdss_gpio9, qlink0_enable,
-- qlink0_request, qlink0_wmss, qlink1_enable, qlink1_request,
-- qlink1_wmss, qlink2_enable, qlink2_request, qlink2_wmss,
-- qup0_se0, qup0_se1, qup0_se2, qup0_se3, qup0_se4, qup0_se5,
-- qup0_se6, qup0_se7, qup1_se0, qup1_se1, qup1_se2, qup1_se3,
-- qup1_se4, qup1_se5, qup1_se6, sd_write, tb_trig, tgu_ch0,
-- tgu_ch1, tgu_ch2, tgu_ch3, tmess_prng0, tmess_prng1,
-- tmess_prng2, tmess_prng3, tsense_pwm1, tsense_pwm2, uim0_clk,
-- uim0_data, uim0_present, uim0_reset, uim1_clk, uim1_data,
-- uim1_present, uim1_reset, usb0_hs, usb0_phy, vfr_0, vfr_1,
-- vsense_trigger ]
-+ enum: [ gpio, atest_char, atest_usb0, audio_ref_clk, cam_mclk,
-+ cci_async_in0, cci_i2c, cci, cmu_rng, coex_uart1_rx,
-+ coex_uart1_tx, cri_trng, dbg_out_clk, ddr_bist,
-+ ddr_pxi0_test, ddr_pxi1_test, gcc_gp1_clk, gcc_gp2_clk,
-+ gcc_gp3_clk, host2wlan_sol, ibi_i3c_qup0, ibi_i3c_qup1,
-+ jitter_bist_ref, mdp_vsync0_out, mdp_vsync1_out,
-+ mdp_vsync2_out, mdp_vsync3_out, mdp_vsync, nav,
-+ pcie0_clk_req, phase_flag, pll_bist_sync, pll_clk_aux,
-+ prng_rosc, qdss_cti_trig0, qdss_cti_trig1, qdss_gpio,
-+ qlink0_enable, qlink0_request, qlink0_wmss_reset,
-+ qup0_se0, qup0_se1, qup0_se2, qup0_se3, qup0_se4,
-+ qup1_se0, qup1_se1, qup1_se2, qup1_se2_l2, qup1_se3,
-+ qup1_se4, sd_write_protect, tb_trig_sdc1, tb_trig_sdc2,
-+ tgu_ch0_trigout, tgu_ch1_trigout, tgu_ch2_trigout,
-+ tgu_ch3_trigout, tmess_prng, tsense_pwm1_out,
-+ tsense_pwm2_out, uim0, uim1, usb0_hs_ac, usb0_phy_ps,
-+ vfr_0_mira, vfr_0_mirb, vfr_1, vsense_trigger_mirnat,
-+ wlan1_adc_dtest0, wlan1_adc_dtest1 ]
-
- required:
- - pins
---
-2.43.0
-
+++ /dev/null
-From 6a330dc17966a9bdd1199ef8175a606f1354c9f5 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 28 May 2024 15:06:04 -0700
-Subject: e1000e: move force SMBUS near the end of enable_ulp function
-
-From: Hui Wang <hui.wang@canonical.com>
-
-[ Upstream commit bfd546a552e140b0a4c8a21527c39d6d21addb28 ]
-
-The commit 861e8086029e ("e1000e: move force SMBUS from enable ulp
-function to avoid PHY loss issue") introduces a regression on
-PCH_MTP_I219_LM18 (PCIID: 0x8086550A). Without the referred commit, the
-ethernet works well after suspend and resume, but after applying the
-commit, the ethernet couldn't work anymore after the resume and the
-dmesg shows that the NIC link changes to 10Mbps (1000Mbps originally):
-
- [ 43.305084] e1000e 0000:00:1f.6 enp0s31f6: NIC Link is Up 10 Mbps Full Duplex, Flow Control: Rx/Tx
-
-Without the commit, the force SMBUS code will not be executed if
-"return 0" or "goto out" is executed in the enable_ulp(), and in my
-case, the "goto out" is executed since FWSM_FW_VALID is set. But after
-applying the commit, the force SMBUS code will be ran unconditionally.
-
-Here move the force SMBUS code back to enable_ulp() and put it
-immediately ahead of hw->phy.ops.release(hw), this could allow the
-longest settling time as possible for interface in this function and
-doesn't change the original code logic.
-
-The issue was found on a Lenovo laptop with the ethernet hw as below:
-00:1f.6 Ethernet controller [0200]: Intel Corporation Device [8086:550a]
-(rev 20).
-
-And this patch is verified (cable plug and unplug, system suspend
-and resume) on Lenovo laptops with ethernet hw: [8086:550a],
-[8086:550b], [8086:15bb], [8086:15be], [8086:1a1f], [8086:1a1c] and
-[8086:0dc7].
-
-Fixes: 861e8086029e ("e1000e: move force SMBUS from enable ulp function to avoid PHY loss issue")
-Signed-off-by: Hui Wang <hui.wang@canonical.com>
-Acked-by: Vitaly Lifshits <vitaly.lifshits@intel.com>
-Tested-by: Naama Meir <naamax.meir@linux.intel.com>
-Reviewed-by: Simon Horman <horms@kernel.org>
-Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
-Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
-Tested-by: Zhang Rui <rui.zhang@intel.com>
-Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
-Link: https://lore.kernel.org/r/20240528-net-2024-05-28-intel-net-fixes-v1-1-dc8593d2bbc6@intel.com
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/ethernet/intel/e1000e/ich8lan.c | 22 +++++++++++++++++++++
- drivers/net/ethernet/intel/e1000e/netdev.c | 18 -----------------
- 2 files changed, 22 insertions(+), 18 deletions(-)
-
-diff --git a/drivers/net/ethernet/intel/e1000e/ich8lan.c b/drivers/net/ethernet/intel/e1000e/ich8lan.c
-index f9e94be36e97f..2e98a2a0bead9 100644
---- a/drivers/net/ethernet/intel/e1000e/ich8lan.c
-+++ b/drivers/net/ethernet/intel/e1000e/ich8lan.c
-@@ -1225,6 +1225,28 @@ s32 e1000_enable_ulp_lpt_lp(struct e1000_hw *hw, bool to_sx)
- }
-
- release:
-+ /* Switching PHY interface always returns MDI error
-+ * so disable retry mechanism to avoid wasting time
-+ */
-+ e1000e_disable_phy_retry(hw);
-+
-+ /* Force SMBus mode in PHY */
-+ ret_val = e1000_read_phy_reg_hv_locked(hw, CV_SMB_CTRL, &phy_reg);
-+ if (ret_val) {
-+ e1000e_enable_phy_retry(hw);
-+ hw->phy.ops.release(hw);
-+ goto out;
-+ }
-+ phy_reg |= CV_SMB_CTRL_FORCE_SMBUS;
-+ e1000_write_phy_reg_hv_locked(hw, CV_SMB_CTRL, phy_reg);
-+
-+ e1000e_enable_phy_retry(hw);
-+
-+ /* Force SMBus mode in MAC */
-+ mac_reg = er32(CTRL_EXT);
-+ mac_reg |= E1000_CTRL_EXT_FORCE_SMBUS;
-+ ew32(CTRL_EXT, mac_reg);
-+
- hw->phy.ops.release(hw);
- out:
- if (ret_val)
-diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
-index 3692fce201959..cc8c531ec3dff 100644
---- a/drivers/net/ethernet/intel/e1000e/netdev.c
-+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
-@@ -6623,7 +6623,6 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime)
- struct e1000_hw *hw = &adapter->hw;
- u32 ctrl, ctrl_ext, rctl, status, wufc;
- int retval = 0;
-- u16 smb_ctrl;
-
- /* Runtime suspend should only enable wakeup for link changes */
- if (runtime)
-@@ -6697,23 +6696,6 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime)
- if (retval)
- return retval;
- }
--
-- /* Force SMBUS to allow WOL */
-- /* Switching PHY interface always returns MDI error
-- * so disable retry mechanism to avoid wasting time
-- */
-- e1000e_disable_phy_retry(hw);
--
-- e1e_rphy(hw, CV_SMB_CTRL, &smb_ctrl);
-- smb_ctrl |= CV_SMB_CTRL_FORCE_SMBUS;
-- e1e_wphy(hw, CV_SMB_CTRL, smb_ctrl);
--
-- e1000e_enable_phy_retry(hw);
--
-- /* Force SMBus mode in MAC */
-- ctrl_ext = er32(CTRL_EXT);
-- ctrl_ext |= E1000_CTRL_EXT_FORCE_SMBUS;
-- ew32(CTRL_EXT, ctrl_ext);
- }
-
- /* Ensure that the appropriate bits are set in LPI_CTRL
---
-2.43.0
-
+++ /dev/null
-From 5e93316f3b6564d6b4a1bc3b45cce5255bb1b2ea Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 22 May 2024 10:30:44 +0300
-Subject: enic: Validate length of nl attributes in enic_set_vf_port
-
-From: Roded Zats <rzats@paloaltonetworks.com>
-
-[ Upstream commit e8021b94b0412c37bcc79027c2e382086b6ce449 ]
-
-enic_set_vf_port assumes that the nl attribute IFLA_PORT_PROFILE
-is of length PORT_PROFILE_MAX and that the nl attributes
-IFLA_PORT_INSTANCE_UUID, IFLA_PORT_HOST_UUID are of length PORT_UUID_MAX.
-These attributes are validated (in the function do_setlink in rtnetlink.c)
-using the nla_policy ifla_port_policy. The policy defines IFLA_PORT_PROFILE
-as NLA_STRING, IFLA_PORT_INSTANCE_UUID as NLA_BINARY and
-IFLA_PORT_HOST_UUID as NLA_STRING. That means that the length validation
-using the policy is for the max size of the attributes and not on exact
-size so the length of these attributes might be less than the sizes that
-enic_set_vf_port expects. This might cause an out of bands
-read access in the memcpys of the data of these
-attributes in enic_set_vf_port.
-
-Fixes: f8bd909183ac ("net: Add ndo_{set|get}_vf_port support for enic dynamic vnics")
-Signed-off-by: Roded Zats <rzats@paloaltonetworks.com>
-Link: https://lore.kernel.org/r/20240522073044.33519-1-rzats@paloaltonetworks.com
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/ethernet/cisco/enic/enic_main.c | 12 ++++++++++++
- 1 file changed, 12 insertions(+)
-
-diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
-index 37bd38d772e80..cccf0db2fb4e5 100644
---- a/drivers/net/ethernet/cisco/enic/enic_main.c
-+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
-@@ -1117,18 +1117,30 @@ static int enic_set_vf_port(struct net_device *netdev, int vf,
- pp->request = nla_get_u8(port[IFLA_PORT_REQUEST]);
-
- if (port[IFLA_PORT_PROFILE]) {
-+ if (nla_len(port[IFLA_PORT_PROFILE]) != PORT_PROFILE_MAX) {
-+ memcpy(pp, &prev_pp, sizeof(*pp));
-+ return -EINVAL;
-+ }
- pp->set |= ENIC_SET_NAME;
- memcpy(pp->name, nla_data(port[IFLA_PORT_PROFILE]),
- PORT_PROFILE_MAX);
- }
-
- if (port[IFLA_PORT_INSTANCE_UUID]) {
-+ if (nla_len(port[IFLA_PORT_INSTANCE_UUID]) != PORT_UUID_MAX) {
-+ memcpy(pp, &prev_pp, sizeof(*pp));
-+ return -EINVAL;
-+ }
- pp->set |= ENIC_SET_INSTANCE;
- memcpy(pp->instance_uuid,
- nla_data(port[IFLA_PORT_INSTANCE_UUID]), PORT_UUID_MAX);
- }
-
- if (port[IFLA_PORT_HOST_UUID]) {
-+ if (nla_len(port[IFLA_PORT_HOST_UUID]) != PORT_UUID_MAX) {
-+ memcpy(pp, &prev_pp, sizeof(*pp));
-+ return -EINVAL;
-+ }
- pp->set |= ENIC_SET_HOST;
- memcpy(pp->host_uuid,
- nla_data(port[IFLA_PORT_HOST_UUID]), PORT_UUID_MAX);
---
-2.43.0
-
+++ /dev/null
-From 3377da3377094a688bd40389a8cdb0432eb8ee5f Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 1 Feb 2024 10:34:52 -0500
-Subject: eventfs: Create eventfs_root_inode to store dentry
-
-From: Steven Rostedt (Google) <rostedt@goodmis.org>
-
-[ Upstream commit c3137ab6318d56370dd5541ebf027ddfc0c8557c ]
-
-Only the root "events" directory stores a dentry. There's no reason to
-hold a dentry pointer for every eventfs_inode as it is never set except
-for the root "events" eventfs_inode.
-
-Create a eventfs_root_inode structure that holds the events_dir dentry.
-The "events" eventfs_inode *is* special, let it have its own descriptor.
-
-Link: https://lore.kernel.org/linux-trace-kernel/20240201161617.658992558@goodmis.org
-
-Cc: Linus Torvalds <torvalds@linux-foundation.org>
-Cc: Masami Hiramatsu <mhiramat@kernel.org>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-Cc: Christian Brauner <brauner@kernel.org>
-Cc: Al Viro <viro@ZenIV.linux.org.uk>
-Cc: Ajay Kaher <ajay.kaher@broadcom.com>
-Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-Stable-dep-of: b63db58e2fa5 ("eventfs/tracing: Add callback for release of an eventfs_inode")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/tracefs/event_inode.c | 65 +++++++++++++++++++++++++++++++++-------
- fs/tracefs/internal.h | 2 --
- 2 files changed, 55 insertions(+), 12 deletions(-)
-
-diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c
-index 56d1741fe0413..59099b36e9a91 100644
---- a/fs/tracefs/event_inode.c
-+++ b/fs/tracefs/event_inode.c
-@@ -35,6 +35,17 @@ static DEFINE_MUTEX(eventfs_mutex);
- /* Choose something "unique" ;-) */
- #define EVENTFS_FILE_INODE_INO 0x12c4e37
-
-+struct eventfs_root_inode {
-+ struct eventfs_inode ei;
-+ struct dentry *events_dir;
-+};
-+
-+static struct eventfs_root_inode *get_root_inode(struct eventfs_inode *ei)
-+{
-+ WARN_ON_ONCE(!ei->is_events);
-+ return container_of(ei, struct eventfs_root_inode, ei);
-+}
-+
- /* Just try to make something consistent and unique */
- static int eventfs_dir_ino(struct eventfs_inode *ei)
- {
-@@ -73,12 +84,18 @@ enum {
- static void release_ei(struct kref *ref)
- {
- struct eventfs_inode *ei = container_of(ref, struct eventfs_inode, kref);
-+ struct eventfs_root_inode *rei;
-
- WARN_ON_ONCE(!ei->is_freed);
-
- kfree(ei->entry_attrs);
- kfree_const(ei->name);
-- kfree_rcu(ei, rcu);
-+ if (ei->is_events) {
-+ rei = get_root_inode(ei);
-+ kfree_rcu(rei, ei.rcu);
-+ } else {
-+ kfree_rcu(ei, rcu);
-+ }
- }
-
- static inline void put_ei(struct eventfs_inode *ei)
-@@ -423,19 +440,43 @@ static struct dentry *lookup_dir_entry(struct dentry *dentry,
- return NULL;
- }
-
-+static inline struct eventfs_inode *init_ei(struct eventfs_inode *ei, const char *name)
-+{
-+ ei->name = kstrdup_const(name, GFP_KERNEL);
-+ if (!ei->name)
-+ return NULL;
-+ kref_init(&ei->kref);
-+ return ei;
-+}
-+
- static inline struct eventfs_inode *alloc_ei(const char *name)
- {
- struct eventfs_inode *ei = kzalloc(sizeof(*ei), GFP_KERNEL);
-+ struct eventfs_inode *result;
-
- if (!ei)
- return NULL;
-
-- ei->name = kstrdup_const(name, GFP_KERNEL);
-- if (!ei->name) {
-+ result = init_ei(ei, name);
-+ if (!result)
- kfree(ei);
-+
-+ return result;
-+}
-+
-+static inline struct eventfs_inode *alloc_root_ei(const char *name)
-+{
-+ struct eventfs_root_inode *rei = kzalloc(sizeof(*rei), GFP_KERNEL);
-+ struct eventfs_inode *ei;
-+
-+ if (!rei)
- return NULL;
-- }
-- kref_init(&ei->kref);
-+
-+ rei->ei.is_events = 1;
-+ ei = init_ei(&rei->ei, name);
-+ if (!ei)
-+ kfree(rei);
-+
- return ei;
- }
-
-@@ -724,6 +765,7 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry
- int size, void *data)
- {
- struct dentry *dentry = tracefs_start_creating(name, parent);
-+ struct eventfs_root_inode *rei;
- struct eventfs_inode *ei;
- struct tracefs_inode *ti;
- struct inode *inode;
-@@ -736,7 +778,7 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry
- if (IS_ERR(dentry))
- return ERR_CAST(dentry);
-
-- ei = alloc_ei(name);
-+ ei = alloc_root_ei(name);
- if (!ei)
- goto fail;
-
-@@ -745,10 +787,11 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry
- goto fail;
-
- // Note: we have a ref to the dentry from tracefs_start_creating()
-- ei->events_dir = dentry;
-+ rei = get_root_inode(ei);
-+ rei->events_dir = dentry;
-+
- ei->entries = entries;
- ei->nr_entries = size;
-- ei->is_events = 1;
- ei->data = data;
-
- /* Save the ownership of this directory */
-@@ -859,13 +902,15 @@ void eventfs_remove_dir(struct eventfs_inode *ei)
- */
- void eventfs_remove_events_dir(struct eventfs_inode *ei)
- {
-+ struct eventfs_root_inode *rei;
- struct dentry *dentry;
-
-- dentry = ei->events_dir;
-+ rei = get_root_inode(ei);
-+ dentry = rei->events_dir;
- if (!dentry)
- return;
-
-- ei->events_dir = NULL;
-+ rei->events_dir = NULL;
- eventfs_remove_dir(ei);
-
- /*
-diff --git a/fs/tracefs/internal.h b/fs/tracefs/internal.h
-index 824cbe83679cc..29f0c999975b6 100644
---- a/fs/tracefs/internal.h
-+++ b/fs/tracefs/internal.h
-@@ -40,7 +40,6 @@ struct eventfs_attr {
- * @children: link list into the child eventfs_inode
- * @entries: the array of entries representing the files in the directory
- * @name: the name of the directory to create
-- * @events_dir: the dentry of the events directory
- * @entry_attrs: Saved mode and ownership of the @d_children
- * @data: The private data to pass to the callbacks
- * @attr: Saved mode and ownership of eventfs_inode itself
-@@ -58,7 +57,6 @@ struct eventfs_inode {
- struct list_head children;
- const struct eventfs_entry *entries;
- const char *name;
-- struct dentry *events_dir;
- struct eventfs_attr *entry_attrs;
- void *data;
- struct eventfs_attr attr;
---
-2.43.0
-
+++ /dev/null
-From eb94f917ba14165b86b4e3dc7ad94cbf0867ec17 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 2 May 2024 16:08:25 -0400
-Subject: eventfs: Do not differentiate the toplevel events directory
-
-From: Steven Rostedt (Google) <rostedt@goodmis.org>
-
-[ Upstream commit d53891d348ac3eceaf48f4732a1f4f5c0e0a55ce ]
-
-The toplevel events directory is really no different than the events
-directory of instances. Having the two be different caused
-inconsistencies and made it harder to fix the permissions bugs.
-
-Make all events directories act the same.
-
-Link: https://lore.kernel.org/linux-trace-kernel/20240502200905.846448710@goodmis.org
-
-Cc: stable@vger.kernel.org
-Cc: Masami Hiramatsu <mhiramat@kernel.org>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-Cc: Andrew Morton <akpm@linux-foundation.org>
-Fixes: 8186fff7ab649 ("tracefs/eventfs: Use root and instance inodes as default ownership")
-Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/tracefs/event_inode.c | 29 ++++++++---------------------
- fs/tracefs/internal.h | 7 +++----
- 2 files changed, 11 insertions(+), 25 deletions(-)
-
-diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c
-index db869e52aa5cc..fd111e10f04e4 100644
---- a/fs/tracefs/event_inode.c
-+++ b/fs/tracefs/event_inode.c
-@@ -68,7 +68,6 @@ enum {
- EVENTFS_SAVE_MODE = BIT(16),
- EVENTFS_SAVE_UID = BIT(17),
- EVENTFS_SAVE_GID = BIT(18),
-- EVENTFS_TOPLEVEL = BIT(19),
- };
-
- #define EVENTFS_MODE_MASK (EVENTFS_SAVE_MODE - 1)
-@@ -225,14 +224,10 @@ static int eventfs_set_attr(struct mnt_idmap *idmap, struct dentry *dentry,
- return ret;
- }
-
--static void update_top_events_attr(struct eventfs_inode *ei, struct super_block *sb)
-+static void update_events_attr(struct eventfs_inode *ei, struct super_block *sb)
- {
- struct inode *root;
-
-- /* Only update if the "events" was on the top level */
-- if (!ei || !(ei->attr.mode & EVENTFS_TOPLEVEL))
-- return;
--
- /* Get the tracefs root inode. */
- root = d_inode(sb->s_root);
- ei->attr.uid = root->i_uid;
-@@ -245,10 +240,10 @@ static void set_top_events_ownership(struct inode *inode)
- struct eventfs_inode *ei = ti->private;
-
- /* The top events directory doesn't get automatically updated */
-- if (!ei || !ei->is_events || !(ei->attr.mode & EVENTFS_TOPLEVEL))
-+ if (!ei || !ei->is_events)
- return;
-
-- update_top_events_attr(ei, inode->i_sb);
-+ update_events_attr(ei, inode->i_sb);
-
- if (!(ei->attr.mode & EVENTFS_SAVE_UID))
- inode->i_uid = ei->attr.uid;
-@@ -277,7 +272,7 @@ static int eventfs_permission(struct mnt_idmap *idmap,
- return generic_permission(idmap, inode, mask);
- }
-
--static const struct inode_operations eventfs_root_dir_inode_operations = {
-+static const struct inode_operations eventfs_dir_inode_operations = {
- .lookup = eventfs_root_lookup,
- .setattr = eventfs_set_attr,
- .getattr = eventfs_get_attr,
-@@ -345,7 +340,7 @@ static struct eventfs_inode *eventfs_find_events(struct dentry *dentry)
- // Walk upwards until you find the events inode
- } while (!ei->is_events);
-
-- update_top_events_attr(ei, dentry->d_sb);
-+ update_events_attr(ei, dentry->d_sb);
-
- return ei;
- }
-@@ -449,7 +444,7 @@ static struct dentry *lookup_dir_entry(struct dentry *dentry,
- update_inode_attr(dentry, inode, &ei->attr,
- S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO);
-
-- inode->i_op = &eventfs_root_dir_inode_operations;
-+ inode->i_op = &eventfs_dir_inode_operations;
- inode->i_fop = &eventfs_file_operations;
-
- /* All directories will have the same inode number */
-@@ -824,14 +819,6 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry
- uid = d_inode(dentry->d_parent)->i_uid;
- gid = d_inode(dentry->d_parent)->i_gid;
-
-- /*
-- * If the events directory is of the top instance, then parent
-- * is NULL. Set the attr.mode to reflect this and its permissions will
-- * default to the tracefs root dentry.
-- */
-- if (!parent)
-- ei->attr.mode = EVENTFS_TOPLEVEL;
--
- /* This is used as the default ownership of the files and directories */
- ei->attr.uid = uid;
- ei->attr.gid = gid;
-@@ -840,13 +827,13 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry
- INIT_LIST_HEAD(&ei->list);
-
- ti = get_tracefs(inode);
-- ti->flags |= TRACEFS_EVENT_INODE | TRACEFS_EVENT_TOP_INODE;
-+ ti->flags |= TRACEFS_EVENT_INODE;
- ti->private = ei;
-
- inode->i_mode = S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO;
- inode->i_uid = uid;
- inode->i_gid = gid;
-- inode->i_op = &eventfs_root_dir_inode_operations;
-+ inode->i_op = &eventfs_dir_inode_operations;
- inode->i_fop = &eventfs_file_operations;
-
- dentry->d_fsdata = get_ei(ei);
-diff --git a/fs/tracefs/internal.h b/fs/tracefs/internal.h
-index 29f0c999975b6..f704d8348357e 100644
---- a/fs/tracefs/internal.h
-+++ b/fs/tracefs/internal.h
-@@ -4,10 +4,9 @@
-
- enum {
- TRACEFS_EVENT_INODE = BIT(1),
-- TRACEFS_EVENT_TOP_INODE = BIT(2),
-- TRACEFS_GID_PERM_SET = BIT(3),
-- TRACEFS_UID_PERM_SET = BIT(4),
-- TRACEFS_INSTANCE_INODE = BIT(5),
-+ TRACEFS_GID_PERM_SET = BIT(2),
-+ TRACEFS_UID_PERM_SET = BIT(3),
-+ TRACEFS_INSTANCE_INODE = BIT(4),
- };
-
- struct tracefs_inode {
---
-2.43.0
-
+++ /dev/null
-From 02d6f1e22584272a0a121587a1ad7caae347b786 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 2 May 2024 16:08:22 -0400
-Subject: eventfs: Free all of the eventfs_inode after RCU
-
-From: Steven Rostedt (Google) <rostedt@goodmis.org>
-
-[ Upstream commit ee4e0379475e4fe723986ae96293e465014fa8d9 ]
-
-The freeing of eventfs_inode via a kfree_rcu() callback. But the content
-of the eventfs_inode was being freed after the last kref. This is
-dangerous, as changes are being made that can access the content of an
-eventfs_inode from an RCU loop.
-
-Instead of using kfree_rcu() use call_rcu() that calls a function to do
-all the freeing of the eventfs_inode after a RCU grace period has expired.
-
-Link: https://lore.kernel.org/linux-trace-kernel/20240502200905.370261163@goodmis.org
-
-Cc: stable@vger.kernel.org
-Cc: Masami Hiramatsu <mhiramat@kernel.org>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-Cc: Andrew Morton <akpm@linux-foundation.org>
-Fixes: 43aa6f97c2d03 ("eventfs: Get rid of dentry pointers without refcounts")
-Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/tracefs/event_inode.c | 25 ++++++++++++++++---------
- 1 file changed, 16 insertions(+), 9 deletions(-)
-
-diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c
-index 57830b2bedb6d..db869e52aa5cc 100644
---- a/fs/tracefs/event_inode.c
-+++ b/fs/tracefs/event_inode.c
-@@ -73,6 +73,21 @@ enum {
-
- #define EVENTFS_MODE_MASK (EVENTFS_SAVE_MODE - 1)
-
-+static void free_ei_rcu(struct rcu_head *rcu)
-+{
-+ struct eventfs_inode *ei = container_of(rcu, struct eventfs_inode, rcu);
-+ struct eventfs_root_inode *rei;
-+
-+ kfree(ei->entry_attrs);
-+ kfree_const(ei->name);
-+ if (ei->is_events) {
-+ rei = get_root_inode(ei);
-+ kfree(rei);
-+ } else {
-+ kfree(ei);
-+ }
-+}
-+
- /*
- * eventfs_inode reference count management.
- *
-@@ -85,7 +100,6 @@ static void release_ei(struct kref *ref)
- {
- struct eventfs_inode *ei = container_of(ref, struct eventfs_inode, kref);
- const struct eventfs_entry *entry;
-- struct eventfs_root_inode *rei;
-
- WARN_ON_ONCE(!ei->is_freed);
-
-@@ -95,14 +109,7 @@ static void release_ei(struct kref *ref)
- entry->release(entry->name, ei->data);
- }
-
-- kfree(ei->entry_attrs);
-- kfree_const(ei->name);
-- if (ei->is_events) {
-- rei = get_root_inode(ei);
-- kfree_rcu(rei, ei.rcu);
-- } else {
-- kfree_rcu(ei, rcu);
-- }
-+ call_rcu(&ei->rcu, free_ei_rcu);
- }
-
- static inline void put_ei(struct eventfs_inode *ei)
---
-2.43.0
-
+++ /dev/null
-From 2918c1b1bee28ae2c0c10cc10b47b5046aeba2be Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 2 May 2024 16:08:27 -0400
-Subject: eventfs: Have "events" directory get permissions from its parent
-
-From: Steven Rostedt (Google) <rostedt@goodmis.org>
-
-[ Upstream commit d57cf30c4c07837799edec949102b0adf58bae79 ]
-
-The events directory gets its permissions from the root inode. But this
-can cause an inconsistency if the instances directory changes its
-permissions, as the permissions of the created directories under it should
-inherit the permissions of the instances directory when directories under
-it are created.
-
-Currently the behavior is:
-
- # cd /sys/kernel/tracing
- # chgrp 1002 instances
- # mkdir instances/foo
- # ls -l instances/foo
-[..]
- -r--r----- 1 root lkp 0 May 1 18:55 buffer_total_size_kb
- -rw-r----- 1 root lkp 0 May 1 18:55 current_tracer
- -rw-r----- 1 root lkp 0 May 1 18:55 error_log
- drwxr-xr-x 1 root root 0 May 1 18:55 events
- --w------- 1 root lkp 0 May 1 18:55 free_buffer
- drwxr-x--- 2 root lkp 0 May 1 18:55 options
- drwxr-x--- 10 root lkp 0 May 1 18:55 per_cpu
- -rw-r----- 1 root lkp 0 May 1 18:55 set_event
-
-All the files and directories under "foo" has the "lkp" group except the
-"events" directory. That's because its getting its default value from the
-mount point instead of its parent.
-
-Have the "events" directory make its default value based on its parent's
-permissions. That now gives:
-
- # ls -l instances/foo
-[..]
- -rw-r----- 1 root lkp 0 May 1 21:16 buffer_subbuf_size_kb
- -r--r----- 1 root lkp 0 May 1 21:16 buffer_total_size_kb
- -rw-r----- 1 root lkp 0 May 1 21:16 current_tracer
- -rw-r----- 1 root lkp 0 May 1 21:16 error_log
- drwxr-xr-x 1 root lkp 0 May 1 21:16 events
- --w------- 1 root lkp 0 May 1 21:16 free_buffer
- drwxr-x--- 2 root lkp 0 May 1 21:16 options
- drwxr-x--- 10 root lkp 0 May 1 21:16 per_cpu
- -rw-r----- 1 root lkp 0 May 1 21:16 set_event
-
-Link: https://lore.kernel.org/linux-trace-kernel/20240502200906.161887248@goodmis.org
-
-Cc: stable@vger.kernel.org
-Cc: Masami Hiramatsu <mhiramat@kernel.org>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-Cc: Andrew Morton <akpm@linux-foundation.org>
-Fixes: 8186fff7ab649 ("tracefs/eventfs: Use root and instance inodes as default ownership")
-Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/tracefs/event_inode.c | 30 ++++++++++++++++++++++++------
- 1 file changed, 24 insertions(+), 6 deletions(-)
-
-diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c
-index fd111e10f04e4..3b785f4ca95e4 100644
---- a/fs/tracefs/event_inode.c
-+++ b/fs/tracefs/event_inode.c
-@@ -37,6 +37,7 @@ static DEFINE_MUTEX(eventfs_mutex);
-
- struct eventfs_root_inode {
- struct eventfs_inode ei;
-+ struct inode *parent_inode;
- struct dentry *events_dir;
- };
-
-@@ -226,12 +227,23 @@ static int eventfs_set_attr(struct mnt_idmap *idmap, struct dentry *dentry,
-
- static void update_events_attr(struct eventfs_inode *ei, struct super_block *sb)
- {
-- struct inode *root;
-+ struct eventfs_root_inode *rei;
-+ struct inode *parent;
-+
-+ rei = get_root_inode(ei);
-+
-+ /* Use the parent inode permissions unless root set its permissions */
-+ parent = rei->parent_inode;
-
-- /* Get the tracefs root inode. */
-- root = d_inode(sb->s_root);
-- ei->attr.uid = root->i_uid;
-- ei->attr.gid = root->i_gid;
-+ if (rei->ei.attr.mode & EVENTFS_SAVE_UID)
-+ ei->attr.uid = rei->ei.attr.uid;
-+ else
-+ ei->attr.uid = parent->i_uid;
-+
-+ if (rei->ei.attr.mode & EVENTFS_SAVE_GID)
-+ ei->attr.gid = rei->ei.attr.gid;
-+ else
-+ ei->attr.gid = parent->i_gid;
- }
-
- static void set_top_events_ownership(struct inode *inode)
-@@ -810,6 +822,7 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry
- // Note: we have a ref to the dentry from tracefs_start_creating()
- rei = get_root_inode(ei);
- rei->events_dir = dentry;
-+ rei->parent_inode = d_inode(dentry->d_sb->s_root);
-
- ei->entries = entries;
- ei->nr_entries = size;
-@@ -819,10 +832,15 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry
- uid = d_inode(dentry->d_parent)->i_uid;
- gid = d_inode(dentry->d_parent)->i_gid;
-
-- /* This is used as the default ownership of the files and directories */
- ei->attr.uid = uid;
- ei->attr.gid = gid;
-
-+ /*
-+ * When the "events" directory is created, it takes on the
-+ * permissions of its parent. But can be reset on remount.
-+ */
-+ ei->attr.mode |= EVENTFS_SAVE_UID | EVENTFS_SAVE_GID;
-+
- INIT_LIST_HEAD(&ei->children);
- INIT_LIST_HEAD(&ei->list);
-
---
-2.43.0
-
+++ /dev/null
-From 7972838b569eb8074ec84a90edd2d48a884072e0 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 2 May 2024 09:03:15 -0400
-Subject: eventfs/tracing: Add callback for release of an eventfs_inode
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Steven Rostedt (Google) <rostedt@goodmis.org>
-
-[ Upstream commit b63db58e2fa5d6963db9c45df88e60060f0ff35f ]
-
-Synthetic events create and destroy tracefs files when they are created
-and removed. The tracing subsystem has its own file descriptor
-representing the state of the events attached to the tracefs files.
-There's a race between the eventfs files and this file descriptor of the
-tracing system where the following can cause an issue:
-
-With two scripts 'A' and 'B' doing:
-
- Script 'A':
- echo "hello int aaa" > /sys/kernel/tracing/synthetic_events
- while :
- do
- echo 0 > /sys/kernel/tracing/events/synthetic/hello/enable
- done
-
- Script 'B':
- echo > /sys/kernel/tracing/synthetic_events
-
-Script 'A' creates a synthetic event "hello" and then just writes zero
-into its enable file.
-
-Script 'B' removes all synthetic events (including the newly created
-"hello" event).
-
-What happens is that the opening of the "enable" file has:
-
- {
- struct trace_event_file *file = inode->i_private;
- int ret;
-
- ret = tracing_check_open_get_tr(file->tr);
- [..]
-
-But deleting the events frees the "file" descriptor, and a "use after
-free" happens with the dereference at "file->tr".
-
-The file descriptor does have a reference counter, but there needs to be a
-way to decrement it from the eventfs when the eventfs_inode is removed
-that represents this file descriptor.
-
-Add an optional "release" callback to the eventfs_entry array structure,
-that gets called when the eventfs file is about to be removed. This allows
-for the creating on the eventfs file to increment the tracing file
-descriptor ref counter. When the eventfs file is deleted, it can call the
-release function that will call the put function for the tracing file
-descriptor.
-
-This will protect the tracing file from being freed while a eventfs file
-that references it is being opened.
-
-Link: https://lore.kernel.org/linux-trace-kernel/20240426073410.17154-1-Tze-nan.Wu@mediatek.com/
-Link: https://lore.kernel.org/linux-trace-kernel/20240502090315.448cba46@gandalf.local.home
-
-Cc: stable@vger.kernel.org
-Cc: Masami Hiramatsu <mhiramat@kernel.org>
-Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
-Fixes: 5790b1fb3d672 ("eventfs: Remove eventfs_file and just use eventfs_inode")
-Reported-by: Tze-nan wu <Tze-nan.Wu@mediatek.com>
-Tested-by: Tze-nan Wu (吳澤南) <Tze-nan.Wu@mediatek.com>
-Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/tracefs/event_inode.c | 23 +++++++++++++++++++++--
- include/linux/tracefs.h | 3 +++
- kernel/trace/trace_events.c | 12 ++++++++++++
- 3 files changed, 36 insertions(+), 2 deletions(-)
-
-diff --git a/fs/tracefs/event_inode.c b/fs/tracefs/event_inode.c
-index 59099b36e9a91..57830b2bedb6d 100644
---- a/fs/tracefs/event_inode.c
-+++ b/fs/tracefs/event_inode.c
-@@ -84,10 +84,17 @@ enum {
- static void release_ei(struct kref *ref)
- {
- struct eventfs_inode *ei = container_of(ref, struct eventfs_inode, kref);
-+ const struct eventfs_entry *entry;
- struct eventfs_root_inode *rei;
-
- WARN_ON_ONCE(!ei->is_freed);
-
-+ for (int i = 0; i < ei->nr_entries; i++) {
-+ entry = &ei->entries[i];
-+ if (entry->release)
-+ entry->release(entry->name, ei->data);
-+ }
-+
- kfree(ei->entry_attrs);
- kfree_const(ei->name);
- if (ei->is_events) {
-@@ -112,6 +119,18 @@ static inline void free_ei(struct eventfs_inode *ei)
- }
- }
-
-+/*
-+ * Called when creation of an ei fails, do not call release() functions.
-+ */
-+static inline void cleanup_ei(struct eventfs_inode *ei)
-+{
-+ if (ei) {
-+ /* Set nr_entries to 0 to prevent release() function being called */
-+ ei->nr_entries = 0;
-+ free_ei(ei);
-+ }
-+}
-+
- static inline struct eventfs_inode *get_ei(struct eventfs_inode *ei)
- {
- if (ei)
-@@ -742,7 +761,7 @@ struct eventfs_inode *eventfs_create_dir(const char *name, struct eventfs_inode
-
- /* Was the parent freed? */
- if (list_empty(&ei->list)) {
-- free_ei(ei);
-+ cleanup_ei(ei);
- ei = NULL;
- }
- return ei;
-@@ -843,7 +862,7 @@ struct eventfs_inode *eventfs_create_events_dir(const char *name, struct dentry
- return ei;
-
- fail:
-- free_ei(ei);
-+ cleanup_ei(ei);
- tracefs_failed_creating(dentry);
- return ERR_PTR(-ENOMEM);
- }
-diff --git a/include/linux/tracefs.h b/include/linux/tracefs.h
-index 7a5fe17b6bf9c..d03f746587167 100644
---- a/include/linux/tracefs.h
-+++ b/include/linux/tracefs.h
-@@ -62,6 +62,8 @@ struct eventfs_file;
- typedef int (*eventfs_callback)(const char *name, umode_t *mode, void **data,
- const struct file_operations **fops);
-
-+typedef void (*eventfs_release)(const char *name, void *data);
-+
- /**
- * struct eventfs_entry - dynamically created eventfs file call back handler
- * @name: Then name of the dynamic file in an eventfs directory
-@@ -72,6 +74,7 @@ typedef int (*eventfs_callback)(const char *name, umode_t *mode, void **data,
- struct eventfs_entry {
- const char *name;
- eventfs_callback callback;
-+ eventfs_release release;
- };
-
- struct eventfs_inode;
-diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
-index 52f75c36bbca4..6ef29eba90ceb 100644
---- a/kernel/trace/trace_events.c
-+++ b/kernel/trace/trace_events.c
-@@ -2552,6 +2552,14 @@ static int event_callback(const char *name, umode_t *mode, void **data,
- return 0;
- }
-
-+/* The file is incremented on creation and freeing the enable file decrements it */
-+static void event_release(const char *name, void *data)
-+{
-+ struct trace_event_file *file = data;
-+
-+ event_file_put(file);
-+}
-+
- static int
- event_create_dir(struct eventfs_inode *parent, struct trace_event_file *file)
- {
-@@ -2566,6 +2574,7 @@ event_create_dir(struct eventfs_inode *parent, struct trace_event_file *file)
- {
- .name = "enable",
- .callback = event_callback,
-+ .release = event_release,
- },
- {
- .name = "filter",
-@@ -2634,6 +2643,9 @@ event_create_dir(struct eventfs_inode *parent, struct trace_event_file *file)
- return ret;
- }
-
-+ /* Gets decremented on freeing of the "enable" file */
-+ event_file_get(file);
-+
- return 0;
- }
-
---
-2.43.0
-
+++ /dev/null
-From 7d2ddaeb1fb8647b006bba509213d42b45b811d6 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 12 Feb 2024 22:00:28 -0800
-Subject: extcon: max8997: select IRQ_DOMAIN instead of depending on it
-
-From: Randy Dunlap <rdunlap@infradead.org>
-
-[ Upstream commit b1781d0a1458070d40134e4f3412ec9d70099bec ]
-
-IRQ_DOMAIN is a hidden (not user visible) symbol. Users cannot set
-it directly thru "make *config", so drivers should select it instead
-of depending on it if they need it.
-Relying on it being set for a dependency is risky.
-
-Consistently using "select" or "depends on" can also help reduce
-Kconfig circular dependency issues.
-
-Therefore, change EXTCON_MAX8997's use of "depends on" for
-IRQ_DOMAIN to "select".
-
-Link: https://lore.kernel.org/lkml/20240213060028.9744-1-rdunlap@infradead.org/
-Fixes: dca1a71e4108 ("extcon: Add support irq domain for MAX8997 muic")
-Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
-Acked-by: Arnd Bergmann <arnd@arndb.de>
-Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/extcon/Kconfig | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig
-index 5f869eacd19ab..3da94b3822923 100644
---- a/drivers/extcon/Kconfig
-+++ b/drivers/extcon/Kconfig
-@@ -116,7 +116,8 @@ config EXTCON_MAX77843
-
- config EXTCON_MAX8997
- tristate "Maxim MAX8997 EXTCON Support"
-- depends on MFD_MAX8997 && IRQ_DOMAIN
-+ depends on MFD_MAX8997
-+ select IRQ_DOMAIN
- help
- If you say yes here you get support for the MUIC device of
- Maxim MAX8997 PMIC. The MAX8997 MUIC is a USB port accessory
---
-2.43.0
-
+++ /dev/null
-From 0b1ca78528f08924120089818ea783e7abbd0fc6 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 10 May 2024 11:33:39 +0800
-Subject: f2fs: compress: don't allow unaligned truncation on released compress
- inode
-
-From: Chao Yu <chao@kernel.org>
-
-[ Upstream commit 29ed2b5dd521ce7c5d8466cd70bf0cc9d07afeee ]
-
-f2fs image may be corrupted after below testcase:
-- mkfs.f2fs -O extra_attr,compression -f /dev/vdb
-- mount /dev/vdb /mnt/f2fs
-- touch /mnt/f2fs/file
-- f2fs_io setflags compression /mnt/f2fs/file
-- dd if=/dev/zero of=/mnt/f2fs/file bs=4k count=4
-- f2fs_io release_cblocks /mnt/f2fs/file
-- truncate -s 8192 /mnt/f2fs/file
-- umount /mnt/f2fs
-- fsck.f2fs /dev/vdb
-
-[ASSERT] (fsck_chk_inode_blk:1256) --> ino: 0x5 has i_blocks: 0x00000002, but has 0x3 blocks
-[FSCK] valid_block_count matching with CP [Fail] [0x4, 0x5]
-[FSCK] other corrupted bugs [Fail]
-
-The reason is: partial truncation assume compressed inode has reserved
-blocks, after partial truncation, valid block count may change w/o
-.i_blocks and .total_valid_block_count update, result in corruption.
-
-This patch only allow cluster size aligned truncation on released
-compress inode for fixing.
-
-Fixes: c61404153eb6 ("f2fs: introduce FI_COMPRESS_RELEASED instead of using IMMUTABLE bit")
-Signed-off-by: Chao Yu <chao@kernel.org>
-Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/f2fs/file.c | 11 ++++++++---
- 1 file changed, 8 insertions(+), 3 deletions(-)
-
-diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
-index 0971dc22810f7..8d3a854f8b0e7 100644
---- a/fs/f2fs/file.c
-+++ b/fs/f2fs/file.c
-@@ -935,9 +935,14 @@ int f2fs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
- ATTR_GID | ATTR_TIMES_SET))))
- return -EPERM;
-
-- if ((attr->ia_valid & ATTR_SIZE) &&
-- !f2fs_is_compress_backend_ready(inode))
-- return -EOPNOTSUPP;
-+ if ((attr->ia_valid & ATTR_SIZE)) {
-+ if (!f2fs_is_compress_backend_ready(inode))
-+ return -EOPNOTSUPP;
-+ if (is_inode_flag_set(inode, FI_COMPRESS_RELEASED) &&
-+ !IS_ALIGNED(attr->ia_size,
-+ F2FS_BLK_TO_BYTES(F2FS_I(inode)->i_cluster_size)))
-+ return -EINVAL;
-+ }
-
- err = setattr_prepare(idmap, dentry, attr);
- if (err)
---
-2.43.0
-
+++ /dev/null
-From 0b21bc65262d353ae4ba5d10c8b77c364bd0332c Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 6 May 2024 18:41:37 +0800
-Subject: f2fs: compress: fix error path of inc_valid_block_count()
-
-From: Chao Yu <chao@kernel.org>
-
-[ Upstream commit 043c832371cd9023fbd725138ddc6c7f288dc469 ]
-
-If inc_valid_block_count() can not allocate all requested blocks,
-it needs to release block count in .total_valid_block_count and
-resevation blocks in inode.
-
-Fixes: 54607494875e ("f2fs: compress: fix to avoid inconsistence bewteen i_blocks and dnode")
-Signed-off-by: Chao Yu <chao@kernel.org>
-Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/f2fs/f2fs.h | 15 ++++++++-------
- 1 file changed, 8 insertions(+), 7 deletions(-)
-
-diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
-index f561f75ef98e9..252e373c1938f 100644
---- a/fs/f2fs/f2fs.h
-+++ b/fs/f2fs/f2fs.h
-@@ -2276,7 +2276,7 @@ static inline void f2fs_i_blocks_write(struct inode *, block_t, bool, bool);
- static inline int inc_valid_block_count(struct f2fs_sb_info *sbi,
- struct inode *inode, blkcnt_t *count, bool partial)
- {
-- blkcnt_t diff = 0, release = 0;
-+ long long diff = 0, release = 0;
- block_t avail_user_block_count;
- int ret;
-
-@@ -2296,26 +2296,27 @@ static inline int inc_valid_block_count(struct f2fs_sb_info *sbi,
- percpu_counter_add(&sbi->alloc_valid_block_count, (*count));
-
- spin_lock(&sbi->stat_lock);
-- sbi->total_valid_block_count += (block_t)(*count);
-- avail_user_block_count = get_available_block_count(sbi, inode, true);
-
-- if (unlikely(sbi->total_valid_block_count > avail_user_block_count)) {
-+ avail_user_block_count = get_available_block_count(sbi, inode, true);
-+ diff = (long long)sbi->total_valid_block_count + *count -
-+ avail_user_block_count;
-+ if (unlikely(diff > 0)) {
- if (!partial) {
- spin_unlock(&sbi->stat_lock);
-+ release = *count;
- goto enospc;
- }
--
-- diff = sbi->total_valid_block_count - avail_user_block_count;
- if (diff > *count)
- diff = *count;
- *count -= diff;
- release = diff;
-- sbi->total_valid_block_count -= diff;
- if (!*count) {
- spin_unlock(&sbi->stat_lock);
- goto enospc;
- }
- }
-+ sbi->total_valid_block_count += (block_t)(*count);
-+
- spin_unlock(&sbi->stat_lock);
-
- if (unlikely(release)) {
---
-2.43.0
-
+++ /dev/null
-From 7a840a550df639790829529e8aa389b72bced122 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 6 May 2024 18:41:39 +0800
-Subject: f2fs: compress: fix to cover {reserve,release}_compress_blocks() w/
- cp_rwsem lock
-
-From: Chao Yu <chao@kernel.org>
-
-[ Upstream commit 0a4ed2d97cb6d044196cc3e726b6699222b41019 ]
-
-It needs to cover {reserve,release}_compress_blocks() w/ cp_rwsem lock
-to avoid racing with checkpoint, otherwise, filesystem metadata including
-blkaddr in dnode, inode fields and .total_valid_block_count may be
-corrupted after SPO case.
-
-Fixes: ef8d563f184e ("f2fs: introduce F2FS_IOC_RELEASE_COMPRESS_BLOCKS")
-Fixes: c75488fb4d82 ("f2fs: introduce F2FS_IOC_RESERVE_COMPRESS_BLOCKS")
-Signed-off-by: Chao Yu <chao@kernel.org>
-Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/f2fs/file.c | 10 ++++++++++
- 1 file changed, 10 insertions(+)
-
-diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
-index 91a5f1a41f26e..0971dc22810f7 100644
---- a/fs/f2fs/file.c
-+++ b/fs/f2fs/file.c
-@@ -3541,9 +3541,12 @@ static int f2fs_release_compress_blocks(struct file *filp, unsigned long arg)
- struct dnode_of_data dn;
- pgoff_t end_offset, count;
-
-+ f2fs_lock_op(sbi);
-+
- set_new_dnode(&dn, inode, NULL, NULL, 0);
- ret = f2fs_get_dnode_of_data(&dn, page_idx, LOOKUP_NODE);
- if (ret) {
-+ f2fs_unlock_op(sbi);
- if (ret == -ENOENT) {
- page_idx = f2fs_get_next_page_offset(&dn,
- page_idx);
-@@ -3561,6 +3564,8 @@ static int f2fs_release_compress_blocks(struct file *filp, unsigned long arg)
-
- f2fs_put_dnode(&dn);
-
-+ f2fs_unlock_op(sbi);
-+
- if (ret < 0)
- break;
-
-@@ -3713,9 +3718,12 @@ static int f2fs_reserve_compress_blocks(struct file *filp, unsigned long arg)
- struct dnode_of_data dn;
- pgoff_t end_offset, count;
-
-+ f2fs_lock_op(sbi);
-+
- set_new_dnode(&dn, inode, NULL, NULL, 0);
- ret = f2fs_get_dnode_of_data(&dn, page_idx, LOOKUP_NODE);
- if (ret) {
-+ f2fs_unlock_op(sbi);
- if (ret == -ENOENT) {
- page_idx = f2fs_get_next_page_offset(&dn,
- page_idx);
-@@ -3733,6 +3741,8 @@ static int f2fs_reserve_compress_blocks(struct file *filp, unsigned long arg)
-
- f2fs_put_dnode(&dn);
-
-+ f2fs_unlock_op(sbi);
-+
- if (ret < 0)
- break;
-
---
-2.43.0
-
+++ /dev/null
-From 15d067ff5030afa9a449b6a18cee0ec43a50b161 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sun, 7 Apr 2024 15:26:03 +0800
-Subject: f2fs: compress: fix to relocate check condition in
- f2fs_{release,reserve}_compress_blocks()
-
-From: Chao Yu <chao@kernel.org>
-
-[ Upstream commit 7c5dffb3d90c5921b91981cc663e02757d90526e ]
-
-Compress flag should be checked after inode lock held to avoid
-racing w/ f2fs_setflags_common(), fix it.
-
-Fixes: 4c8ff7095bef ("f2fs: support data compression")
-Reported-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
-Closes: https://lore.kernel.org/linux-f2fs-devel/CAHJ8P3LdZXLc2rqeYjvymgYHr2+YLuJ0sLG9DdsJZmwO7deuhw@mail.gmail.com
-Signed-off-by: Chao Yu <chao@kernel.org>
-Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/f2fs/file.c | 12 ++++--------
- 1 file changed, 4 insertions(+), 8 deletions(-)
-
-diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
-index 66bd3559d86ee..246ae3639bc0a 100644
---- a/fs/f2fs/file.c
-+++ b/fs/f2fs/file.c
-@@ -3494,9 +3494,6 @@ static int f2fs_release_compress_blocks(struct file *filp, unsigned long arg)
- if (!f2fs_sb_has_compression(sbi))
- return -EOPNOTSUPP;
-
-- if (!f2fs_compressed_file(inode))
-- return -EINVAL;
--
- if (f2fs_readonly(sbi->sb))
- return -EROFS;
-
-@@ -3515,7 +3512,8 @@ static int f2fs_release_compress_blocks(struct file *filp, unsigned long arg)
- goto out;
- }
-
-- if (is_inode_flag_set(inode, FI_COMPRESS_RELEASED)) {
-+ if (!f2fs_compressed_file(inode) ||
-+ is_inode_flag_set(inode, FI_COMPRESS_RELEASED)) {
- ret = -EINVAL;
- goto out;
- }
-@@ -3678,9 +3676,6 @@ static int f2fs_reserve_compress_blocks(struct file *filp, unsigned long arg)
- if (!f2fs_sb_has_compression(sbi))
- return -EOPNOTSUPP;
-
-- if (!f2fs_compressed_file(inode))
-- return -EINVAL;
--
- if (f2fs_readonly(sbi->sb))
- return -EROFS;
-
-@@ -3692,7 +3687,8 @@ static int f2fs_reserve_compress_blocks(struct file *filp, unsigned long arg)
-
- inode_lock(inode);
-
-- if (!is_inode_flag_set(inode, FI_COMPRESS_RELEASED)) {
-+ if (!f2fs_compressed_file(inode) ||
-+ !is_inode_flag_set(inode, FI_COMPRESS_RELEASED)) {
- ret = -EINVAL;
- goto unlock_inode;
- }
---
-2.43.0
-
+++ /dev/null
-From ce5584447b17f2ff4ee4cceb37f84403f715b867 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sun, 7 Apr 2024 15:26:04 +0800
-Subject: f2fs: compress: fix to relocate check condition in
- f2fs_ioc_{,de}compress_file()
-
-From: Chao Yu <chao@kernel.org>
-
-[ Upstream commit bd9ae4ae9e585061acfd4a169f2321706f900246 ]
-
-Compress flag should be checked after inode lock held to avoid
-racing w/ f2fs_setflags_common() , fix it.
-
-Fixes: 5fdb322ff2c2 ("f2fs: add F2FS_IOC_DECOMPRESS_FILE and F2FS_IOC_COMPRESS_FILE")
-Reported-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
-Closes: https://lore.kernel.org/linux-f2fs-devel/CAHJ8P3LdZXLc2rqeYjvymgYHr2+YLuJ0sLG9DdsJZmwO7deuhw@mail.gmail.com
-Signed-off-by: Chao Yu <chao@kernel.org>
-Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/f2fs/file.c | 12 ++++--------
- 1 file changed, 4 insertions(+), 8 deletions(-)
-
-diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
-index 246ae3639bc0a..4f223395c9a90 100644
---- a/fs/f2fs/file.c
-+++ b/fs/f2fs/file.c
-@@ -4092,9 +4092,6 @@ static int f2fs_ioc_decompress_file(struct file *filp)
- if (!(filp->f_mode & FMODE_WRITE))
- return -EBADF;
-
-- if (!f2fs_compressed_file(inode))
-- return -EINVAL;
--
- f2fs_balance_fs(sbi, true);
-
- file_start_write(filp);
-@@ -4105,7 +4102,8 @@ static int f2fs_ioc_decompress_file(struct file *filp)
- goto out;
- }
-
-- if (is_inode_flag_set(inode, FI_COMPRESS_RELEASED)) {
-+ if (!f2fs_compressed_file(inode) ||
-+ is_inode_flag_set(inode, FI_COMPRESS_RELEASED)) {
- ret = -EINVAL;
- goto out;
- }
-@@ -4171,9 +4169,6 @@ static int f2fs_ioc_compress_file(struct file *filp)
- if (!(filp->f_mode & FMODE_WRITE))
- return -EBADF;
-
-- if (!f2fs_compressed_file(inode))
-- return -EINVAL;
--
- f2fs_balance_fs(sbi, true);
-
- file_start_write(filp);
-@@ -4184,7 +4179,8 @@ static int f2fs_ioc_compress_file(struct file *filp)
- goto out;
- }
-
-- if (is_inode_flag_set(inode, FI_COMPRESS_RELEASED)) {
-+ if (!f2fs_compressed_file(inode) ||
-+ is_inode_flag_set(inode, FI_COMPRESS_RELEASED)) {
- ret = -EINVAL;
- goto out;
- }
---
-2.43.0
-
+++ /dev/null
-From c6c883d48c7e9a2990ef67edf30fa1cc41643c1f Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 6 May 2024 18:41:36 +0800
-Subject: f2fs: compress: fix to update i_compr_blocks correctly
-
-From: Chao Yu <chao@kernel.org>
-
-[ Upstream commit 186e7d71534df4589405925caca5597af7626c12 ]
-
-Previously, we account reserved blocks and compressed blocks into
-@compr_blocks, then, f2fs_i_compr_blocks_update(,compr_blocks) will
-update i_compr_blocks incorrectly, fix it.
-
-Meanwhile, for the case all blocks in cluster were reserved, fix to
-update dn->ofs_in_node correctly.
-
-Fixes: eb8fbaa53374 ("f2fs: compress: fix to check unreleased compressed cluster")
-Signed-off-by: Chao Yu <chao@kernel.org>
-Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/f2fs/file.c | 21 ++++++++++++++-------
- 1 file changed, 14 insertions(+), 7 deletions(-)
-
-diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
-index 449e6f1625033..124fd8f2fd1ac 100644
---- a/fs/f2fs/file.c
-+++ b/fs/f2fs/file.c
-@@ -3616,7 +3616,8 @@ static int reserve_compress_blocks(struct dnode_of_data *dn, pgoff_t count,
-
- while (count) {
- int compr_blocks = 0;
-- blkcnt_t reserved;
-+ blkcnt_t reserved = 0;
-+ blkcnt_t to_reserved;
- int ret;
-
- for (i = 0; i < cluster_size; i++) {
-@@ -3636,20 +3637,26 @@ static int reserve_compress_blocks(struct dnode_of_data *dn, pgoff_t count,
- * fails in release_compress_blocks(), so NEW_ADDR
- * is a possible case.
- */
-- if (blkaddr == NEW_ADDR ||
-- __is_valid_data_blkaddr(blkaddr)) {
-+ if (blkaddr == NEW_ADDR) {
-+ reserved++;
-+ continue;
-+ }
-+ if (__is_valid_data_blkaddr(blkaddr)) {
- compr_blocks++;
- continue;
- }
- }
-
-- reserved = cluster_size - compr_blocks;
-+ to_reserved = cluster_size - compr_blocks - reserved;
-
- /* for the case all blocks in cluster were reserved */
-- if (reserved == 1)
-+ if (to_reserved == 1) {
-+ dn->ofs_in_node += cluster_size;
- goto next;
-+ }
-
-- ret = inc_valid_block_count(sbi, dn->inode, &reserved, false);
-+ ret = inc_valid_block_count(sbi, dn->inode,
-+ &to_reserved, false);
- if (unlikely(ret))
- return ret;
-
-@@ -3660,7 +3667,7 @@ static int reserve_compress_blocks(struct dnode_of_data *dn, pgoff_t count,
-
- f2fs_i_compr_blocks_update(dn->inode, compr_blocks, true);
-
-- *reserved_blocks += reserved;
-+ *reserved_blocks += to_reserved;
- next:
- count -= cluster_size;
- }
---
-2.43.0
-
+++ /dev/null
-From dbcd721e8c3ab1225124ee06365dc19024e54772 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 6 Feb 2024 11:21:00 -0800
-Subject: f2fs: deprecate io_bits
-
-From: Jaegeuk Kim <jaegeuk@kernel.org>
-
-[ Upstream commit 87161a2b0aed9e9b614bbf6fe8697ad560ceb0cb ]
-
-Let's deprecate an unused io_bits feature to save CPU cycles and memory.
-
-Reviewed-by: Daeho Jeong <daehojeong@google.com>
-Reviewed-by: Chao Yu <chao@kernel.org>
-Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-Stable-dep-of: 043c832371cd ("f2fs: compress: fix error path of inc_valid_block_count()")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- Documentation/filesystems/f2fs.rst | 2 -
- fs/f2fs/data.c | 73 +------------------------
- fs/f2fs/f2fs.h | 25 ++-------
- fs/f2fs/file.c | 2 -
- fs/f2fs/gc.c | 10 +---
- fs/f2fs/segment.c | 9 +--
- fs/f2fs/super.c | 88 +-----------------------------
- include/linux/f2fs_fs.h | 6 --
- 8 files changed, 10 insertions(+), 205 deletions(-)
-
-diff --git a/Documentation/filesystems/f2fs.rst b/Documentation/filesystems/f2fs.rst
-index d32c6209685d6..f66bf6bea02be 100644
---- a/Documentation/filesystems/f2fs.rst
-+++ b/Documentation/filesystems/f2fs.rst
-@@ -228,8 +228,6 @@ mode=%s Control block allocation mode which supports "adaptive"
- option for more randomness.
- Please, use these options for your experiments and we strongly
- recommend to re-format the filesystem after using these options.
--io_bits=%u Set the bit size of write IO requests. It should be set
-- with "mode=lfs".
- usrquota Enable plain user disk quota accounting.
- grpquota Enable plain group disk quota accounting.
- prjquota Enable plain project quota accounting.
-diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
-index a871ba9fa3aab..a585a8d5eab0c 100644
---- a/fs/f2fs/data.c
-+++ b/fs/f2fs/data.c
-@@ -338,17 +338,6 @@ static void f2fs_write_end_io(struct bio *bio)
- struct page *page = bvec->bv_page;
- enum count_type type = WB_DATA_TYPE(page, false);
-
-- if (page_private_dummy(page)) {
-- clear_page_private_dummy(page);
-- unlock_page(page);
-- mempool_free(page, sbi->write_io_dummy);
--
-- if (unlikely(bio->bi_status))
-- f2fs_stop_checkpoint(sbi, true,
-- STOP_CP_REASON_WRITE_FAIL);
-- continue;
-- }
--
- fscrypt_finalize_bounce_page(&page);
-
- #ifdef CONFIG_F2FS_FS_COMPRESSION
-@@ -522,50 +511,13 @@ void f2fs_submit_read_bio(struct f2fs_sb_info *sbi, struct bio *bio,
- submit_bio(bio);
- }
-
--static void f2fs_align_write_bio(struct f2fs_sb_info *sbi, struct bio *bio)
--{
-- unsigned int start =
-- (bio->bi_iter.bi_size >> F2FS_BLKSIZE_BITS) % F2FS_IO_SIZE(sbi);
--
-- if (start == 0)
-- return;
--
-- /* fill dummy pages */
-- for (; start < F2FS_IO_SIZE(sbi); start++) {
-- struct page *page =
-- mempool_alloc(sbi->write_io_dummy,
-- GFP_NOIO | __GFP_NOFAIL);
-- f2fs_bug_on(sbi, !page);
--
-- lock_page(page);
--
-- zero_user_segment(page, 0, PAGE_SIZE);
-- set_page_private_dummy(page);
--
-- if (bio_add_page(bio, page, PAGE_SIZE, 0) < PAGE_SIZE)
-- f2fs_bug_on(sbi, 1);
-- }
--}
--
- static void f2fs_submit_write_bio(struct f2fs_sb_info *sbi, struct bio *bio,
- enum page_type type)
- {
- WARN_ON_ONCE(is_read_io(bio_op(bio)));
-
-- if (type == DATA || type == NODE) {
-- if (f2fs_lfs_mode(sbi) && current->plug)
-- blk_finish_plug(current->plug);
--
-- if (F2FS_IO_ALIGNED(sbi)) {
-- f2fs_align_write_bio(sbi, bio);
-- /*
-- * In the NODE case, we lose next block address chain.
-- * So, we need to do checkpoint in f2fs_sync_file.
-- */
-- if (type == NODE)
-- set_sbi_flag(sbi, SBI_NEED_CP);
-- }
-- }
-+ if (f2fs_lfs_mode(sbi) && current->plug && PAGE_TYPE_ON_MAIN(type))
-+ blk_finish_plug(current->plug);
-
- trace_f2fs_submit_write_bio(sbi->sb, type, bio);
- iostat_update_submit_ctx(bio, type);
-@@ -794,16 +746,6 @@ static bool io_is_mergeable(struct f2fs_sb_info *sbi, struct bio *bio,
- block_t last_blkaddr,
- block_t cur_blkaddr)
- {
-- if (F2FS_IO_ALIGNED(sbi) && (fio->type == DATA || fio->type == NODE)) {
-- unsigned int filled_blocks =
-- F2FS_BYTES_TO_BLK(bio->bi_iter.bi_size);
-- unsigned int io_size = F2FS_IO_SIZE(sbi);
-- unsigned int left_vecs = bio->bi_max_vecs - bio->bi_vcnt;
--
-- /* IOs in bio is aligned and left space of vectors is not enough */
-- if (!(filled_blocks % io_size) && left_vecs < io_size)
-- return false;
-- }
- if (!page_is_mergeable(sbi, bio, last_blkaddr, cur_blkaddr))
- return false;
- return io_type_is_mergeable(io, fio);
-@@ -1055,14 +997,6 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio)
- __submit_merged_bio(io);
- alloc_new:
- if (io->bio == NULL) {
-- if (F2FS_IO_ALIGNED(sbi) &&
-- (fio->type == DATA || fio->type == NODE) &&
-- fio->new_blkaddr & F2FS_IO_SIZE_MASK(sbi)) {
-- dec_page_count(sbi, WB_DATA_TYPE(bio_page,
-- fio->compressed_page));
-- fio->retry = 1;
-- goto skip;
-- }
- io->bio = __bio_alloc(fio, BIO_MAX_VECS);
- f2fs_set_bio_crypt_ctx(io->bio, fio->page->mapping->host,
- bio_page->index, fio, GFP_NOIO);
-@@ -1092,7 +1026,6 @@ void f2fs_submit_page_write(struct f2fs_io_info *fio)
- __submit_merged_bio(io);
- }
- #endif
--skip:
- if (fio->in_list)
- goto next;
- out:
-@@ -2669,8 +2602,6 @@ bool f2fs_should_update_outplace(struct inode *inode, struct f2fs_io_info *fio)
- if (fio) {
- if (page_private_gcing(fio->page))
- return true;
-- if (page_private_dummy(fio->page))
-- return true;
- if (unlikely(is_sbi_flag_set(sbi, SBI_CP_DISABLED) &&
- f2fs_is_checkpointed_data(sbi, fio->old_blkaddr)))
- return true;
-diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
-index 6610ff6d7e6cc..e3c231352f6db 100644
---- a/fs/f2fs/f2fs.h
-+++ b/fs/f2fs/f2fs.h
-@@ -147,7 +147,6 @@ struct f2fs_rwsem {
-
- struct f2fs_mount_info {
- unsigned int opt;
-- int write_io_size_bits; /* Write IO size bits */
- block_t root_reserved_blocks; /* root reserved blocks */
- kuid_t s_resuid; /* reserved blocks for uid */
- kgid_t s_resgid; /* reserved blocks for gid */
-@@ -1116,6 +1115,7 @@ enum count_type {
- * ... Only can be used with META.
- */
- #define PAGE_TYPE_OF_BIO(type) ((type) > META ? META : (type))
-+#define PAGE_TYPE_ON_MAIN(type) ((type) == DATA || (type) == NODE)
- enum page_type {
- DATA = 0,
- NODE = 1, /* should not change this */
-@@ -1210,7 +1210,6 @@ struct f2fs_io_info {
- unsigned int submitted:1; /* indicate IO submission */
- unsigned int in_list:1; /* indicate fio is in io_list */
- unsigned int is_por:1; /* indicate IO is from recovery or not */
-- unsigned int retry:1; /* need to reallocate block address */
- unsigned int encrypted:1; /* indicate file is encrypted */
- unsigned int post_read:1; /* require post read */
- enum iostat_type io_type; /* io type */
-@@ -1412,18 +1411,16 @@ static inline void f2fs_clear_bit(unsigned int nr, char *addr);
- * Layout A: lowest bit should be 1
- * | bit0 = 1 | bit1 | bit2 | ... | bit MAX | private data .... |
- * bit 0 PAGE_PRIVATE_NOT_POINTER
-- * bit 1 PAGE_PRIVATE_DUMMY_WRITE
-- * bit 2 PAGE_PRIVATE_ONGOING_MIGRATION
-- * bit 3 PAGE_PRIVATE_INLINE_INODE
-- * bit 4 PAGE_PRIVATE_REF_RESOURCE
-- * bit 5- f2fs private data
-+ * bit 1 PAGE_PRIVATE_ONGOING_MIGRATION
-+ * bit 2 PAGE_PRIVATE_INLINE_INODE
-+ * bit 3 PAGE_PRIVATE_REF_RESOURCE
-+ * bit 4- f2fs private data
- *
- * Layout B: lowest bit should be 0
- * page.private is a wrapped pointer.
- */
- enum {
- PAGE_PRIVATE_NOT_POINTER, /* private contains non-pointer data */
-- PAGE_PRIVATE_DUMMY_WRITE, /* data page for padding aligned IO */
- PAGE_PRIVATE_ONGOING_MIGRATION, /* data page which is on-going migrating */
- PAGE_PRIVATE_INLINE_INODE, /* inode page contains inline data */
- PAGE_PRIVATE_REF_RESOURCE, /* dirty page has referenced resources */
-@@ -1570,7 +1567,6 @@ struct f2fs_sb_info {
- struct f2fs_bio_info *write_io[NR_PAGE_TYPE]; /* for write bios */
- /* keep migration IO order for LFS mode */
- struct f2fs_rwsem io_order_lock;
-- mempool_t *write_io_dummy; /* Dummy pages */
- pgoff_t page_eio_ofs[NR_PAGE_TYPE]; /* EIO page offset */
- int page_eio_cnt[NR_PAGE_TYPE]; /* EIO count */
-
-@@ -2286,10 +2282,6 @@ static inline int inc_valid_block_count(struct f2fs_sb_info *sbi,
- if (!__allow_reserved_blocks(sbi, inode, true))
- avail_user_block_count -= F2FS_OPTION(sbi).root_reserved_blocks;
-
-- if (F2FS_IO_ALIGNED(sbi))
-- avail_user_block_count -= sbi->blocks_per_seg *
-- SM_I(sbi)->additional_reserved_segments;
--
- if (unlikely(is_sbi_flag_set(sbi, SBI_CP_DISABLED))) {
- if (avail_user_block_count > sbi->unusable_block_count)
- avail_user_block_count -= sbi->unusable_block_count;
-@@ -2371,17 +2363,14 @@ static inline void clear_page_private_##name(struct page *page) \
- PAGE_PRIVATE_GET_FUNC(nonpointer, NOT_POINTER);
- PAGE_PRIVATE_GET_FUNC(inline, INLINE_INODE);
- PAGE_PRIVATE_GET_FUNC(gcing, ONGOING_MIGRATION);
--PAGE_PRIVATE_GET_FUNC(dummy, DUMMY_WRITE);
-
- PAGE_PRIVATE_SET_FUNC(reference, REF_RESOURCE);
- PAGE_PRIVATE_SET_FUNC(inline, INLINE_INODE);
- PAGE_PRIVATE_SET_FUNC(gcing, ONGOING_MIGRATION);
--PAGE_PRIVATE_SET_FUNC(dummy, DUMMY_WRITE);
-
- PAGE_PRIVATE_CLEAR_FUNC(reference, REF_RESOURCE);
- PAGE_PRIVATE_CLEAR_FUNC(inline, INLINE_INODE);
- PAGE_PRIVATE_CLEAR_FUNC(gcing, ONGOING_MIGRATION);
--PAGE_PRIVATE_CLEAR_FUNC(dummy, DUMMY_WRITE);
-
- static inline unsigned long get_page_private_data(struct page *page)
- {
-@@ -2637,10 +2626,6 @@ static inline int inc_valid_node_count(struct f2fs_sb_info *sbi,
- if (!__allow_reserved_blocks(sbi, inode, false))
- valid_block_count += F2FS_OPTION(sbi).root_reserved_blocks;
-
-- if (F2FS_IO_ALIGNED(sbi))
-- valid_block_count += sbi->blocks_per_seg *
-- SM_I(sbi)->additional_reserved_segments;
--
- user_block_count = sbi->user_block_count;
- if (unlikely(is_sbi_flag_set(sbi, SBI_CP_DISABLED)))
- user_block_count -= sbi->unusable_block_count;
-diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
-index 124fd8f2fd1ac..91a5f1a41f26e 100644
---- a/fs/f2fs/file.c
-+++ b/fs/f2fs/file.c
-@@ -819,8 +819,6 @@ static bool f2fs_force_buffered_io(struct inode *inode, int rw)
- */
- if (f2fs_sb_has_blkzoned(sbi) && (rw == WRITE))
- return true;
-- if (f2fs_lfs_mode(sbi) && rw == WRITE && F2FS_IO_ALIGNED(sbi))
-- return true;
- if (is_sbi_flag_set(sbi, SBI_CP_DISABLED))
- return true;
-
-diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
-index a079eebfb080b..6899f434ad688 100644
---- a/fs/f2fs/gc.c
-+++ b/fs/f2fs/gc.c
-@@ -1184,7 +1184,6 @@ static int ra_data_block(struct inode *inode, pgoff_t index)
- .op_flags = 0,
- .encrypted_page = NULL,
- .in_list = 0,
-- .retry = 0,
- };
- int err;
-
-@@ -1273,7 +1272,6 @@ static int move_data_block(struct inode *inode, block_t bidx,
- .op_flags = 0,
- .encrypted_page = NULL,
- .in_list = 0,
-- .retry = 0,
- };
- struct dnode_of_data dn;
- struct f2fs_summary sum;
-@@ -1393,18 +1391,12 @@ static int move_data_block(struct inode *inode, block_t bidx,
- fio.op_flags = REQ_SYNC;
- fio.new_blkaddr = newaddr;
- f2fs_submit_page_write(&fio);
-- if (fio.retry) {
-- err = -EAGAIN;
-- if (PageWriteback(fio.encrypted_page))
-- end_page_writeback(fio.encrypted_page);
-- goto put_page_out;
-- }
-
- f2fs_update_iostat(fio.sbi, NULL, FS_GC_DATA_IO, F2FS_BLKSIZE);
-
- f2fs_update_data_blkaddr(&dn, newaddr);
- set_inode_flag(inode, FI_APPEND_WRITE);
--put_page_out:
-+
- f2fs_put_page(fio.encrypted_page, 1);
- recover_block:
- if (err)
-diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
-index 6d5774093452f..dbe3ff73bce72 100644
---- a/fs/f2fs/segment.c
-+++ b/fs/f2fs/segment.c
-@@ -3507,9 +3507,6 @@ void f2fs_allocate_data_block(struct f2fs_sb_info *sbi, struct page *page,
- if (fio) {
- struct f2fs_bio_info *io;
-
-- if (F2FS_IO_ALIGNED(sbi))
-- fio->retry = 0;
--
- INIT_LIST_HEAD(&fio->list);
- fio->in_list = 1;
- io = sbi->write_io[fio->type] + fio->temp;
-@@ -3557,7 +3554,7 @@ static void do_write_page(struct f2fs_summary *sum, struct f2fs_io_info *fio)
-
- if (keep_order)
- f2fs_down_read(&fio->sbi->io_order_lock);
--reallocate:
-+
- f2fs_allocate_data_block(fio->sbi, fio->page, fio->old_blkaddr,
- &fio->new_blkaddr, sum, type, fio);
- if (GET_SEGNO(fio->sbi, fio->old_blkaddr) != NULL_SEGNO)
-@@ -3565,10 +3562,6 @@ static void do_write_page(struct f2fs_summary *sum, struct f2fs_io_info *fio)
-
- /* writeout dirty page into bdev */
- f2fs_submit_page_write(fio);
-- if (fio->retry) {
-- fio->old_blkaddr = fio->new_blkaddr;
-- goto reallocate;
-- }
-
- f2fs_update_device_state(fio->sbi, fio->ino, fio->new_blkaddr, 1);
-
-diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
-index 4ba613ed3a179..96e0ff4edf024 100644
---- a/fs/f2fs/super.c
-+++ b/fs/f2fs/super.c
-@@ -137,7 +137,6 @@ enum {
- Opt_resgid,
- Opt_resuid,
- Opt_mode,
-- Opt_io_size_bits,
- Opt_fault_injection,
- Opt_fault_type,
- Opt_lazytime,
-@@ -216,7 +215,6 @@ static match_table_t f2fs_tokens = {
- {Opt_resgid, "resgid=%u"},
- {Opt_resuid, "resuid=%u"},
- {Opt_mode, "mode=%s"},
-- {Opt_io_size_bits, "io_bits=%u"},
- {Opt_fault_injection, "fault_injection=%u"},
- {Opt_fault_type, "fault_type=%u"},
- {Opt_lazytime, "lazytime"},
-@@ -343,46 +341,6 @@ static inline void limit_reserve_root(struct f2fs_sb_info *sbi)
- F2FS_OPTION(sbi).s_resgid));
- }
-
--static inline int adjust_reserved_segment(struct f2fs_sb_info *sbi)
--{
-- unsigned int sec_blks = sbi->blocks_per_seg * sbi->segs_per_sec;
-- unsigned int avg_vblocks;
-- unsigned int wanted_reserved_segments;
-- block_t avail_user_block_count;
--
-- if (!F2FS_IO_ALIGNED(sbi))
-- return 0;
--
-- /* average valid block count in section in worst case */
-- avg_vblocks = sec_blks / F2FS_IO_SIZE(sbi);
--
-- /*
-- * we need enough free space when migrating one section in worst case
-- */
-- wanted_reserved_segments = (F2FS_IO_SIZE(sbi) / avg_vblocks) *
-- reserved_segments(sbi);
-- wanted_reserved_segments -= reserved_segments(sbi);
--
-- avail_user_block_count = sbi->user_block_count -
-- sbi->current_reserved_blocks -
-- F2FS_OPTION(sbi).root_reserved_blocks;
--
-- if (wanted_reserved_segments * sbi->blocks_per_seg >
-- avail_user_block_count) {
-- f2fs_err(sbi, "IO align feature can't grab additional reserved segment: %u, available segments: %u",
-- wanted_reserved_segments,
-- avail_user_block_count >> sbi->log_blocks_per_seg);
-- return -ENOSPC;
-- }
--
-- SM_I(sbi)->additional_reserved_segments = wanted_reserved_segments;
--
-- f2fs_info(sbi, "IO align feature needs additional reserved segment: %u",
-- wanted_reserved_segments);
--
-- return 0;
--}
--
- static inline void adjust_unusable_cap_perc(struct f2fs_sb_info *sbi)
- {
- if (!F2FS_OPTION(sbi).unusable_cap_perc)
-@@ -919,16 +877,6 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
- }
- kfree(name);
- break;
-- case Opt_io_size_bits:
-- if (args->from && match_int(args, &arg))
-- return -EINVAL;
-- if (arg <= 0 || arg > __ilog2_u32(BIO_MAX_VECS)) {
-- f2fs_warn(sbi, "Not support %ld, larger than %d",
-- BIT(arg), BIO_MAX_VECS);
-- return -EINVAL;
-- }
-- F2FS_OPTION(sbi).write_io_size_bits = arg;
-- break;
- #ifdef CONFIG_F2FS_FAULT_INJECTION
- case Opt_fault_injection:
- if (args->from && match_int(args, &arg))
-@@ -1398,12 +1346,6 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
- }
- #endif
-
-- if (F2FS_IO_SIZE_BITS(sbi) && !f2fs_lfs_mode(sbi)) {
-- f2fs_err(sbi, "Should set mode=lfs with %luKB-sized IO",
-- F2FS_IO_SIZE_KB(sbi));
-- return -EINVAL;
-- }
--
- if (test_opt(sbi, INLINE_XATTR_SIZE)) {
- int min_size, max_size;
-
-@@ -1724,7 +1666,6 @@ static void f2fs_put_super(struct super_block *sb)
-
- f2fs_destroy_page_array_cache(sbi);
- f2fs_destroy_xattr_caches(sbi);
-- mempool_destroy(sbi->write_io_dummy);
- #ifdef CONFIG_QUOTA
- for (i = 0; i < MAXQUOTAS; i++)
- kfree(F2FS_OPTION(sbi).s_qf_names[i]);
-@@ -2084,9 +2025,6 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root)
- F2FS_OPTION(sbi).s_resuid),
- from_kgid_munged(&init_user_ns,
- F2FS_OPTION(sbi).s_resgid));
-- if (F2FS_IO_SIZE_BITS(sbi))
-- seq_printf(seq, ",io_bits=%u",
-- F2FS_OPTION(sbi).write_io_size_bits);
- #ifdef CONFIG_F2FS_FAULT_INJECTION
- if (test_opt(sbi, FAULT_INJECTION)) {
- seq_printf(seq, ",fault_injection=%u",
-@@ -2338,7 +2276,6 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data)
- bool no_read_extent_cache = !test_opt(sbi, READ_EXTENT_CACHE);
- bool no_age_extent_cache = !test_opt(sbi, AGE_EXTENT_CACHE);
- bool enable_checkpoint = !test_opt(sbi, DISABLE_CHECKPOINT);
-- bool no_io_align = !F2FS_IO_ALIGNED(sbi);
- bool no_atgc = !test_opt(sbi, ATGC);
- bool no_discard = !test_opt(sbi, DISCARD);
- bool no_compress_cache = !test_opt(sbi, COMPRESS_CACHE);
-@@ -2446,12 +2383,6 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data)
- goto restore_opts;
- }
-
-- if (no_io_align == !!F2FS_IO_ALIGNED(sbi)) {
-- err = -EINVAL;
-- f2fs_warn(sbi, "switch io_bits option is not allowed");
-- goto restore_opts;
-- }
--
- if (no_compress_cache == !!test_opt(sbi, COMPRESS_CACHE)) {
- err = -EINVAL;
- f2fs_warn(sbi, "switch compress_cache option is not allowed");
-@@ -4306,8 +4237,6 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi)
- FDEV(i).total_segments,
- FDEV(i).start_blk, FDEV(i).end_blk);
- }
-- f2fs_info(sbi,
-- "IO Block Size: %8ld KB", F2FS_IO_SIZE_KB(sbi));
- return 0;
- }
-
-@@ -4520,19 +4449,10 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
- if (err)
- goto free_iostat;
-
-- if (F2FS_IO_ALIGNED(sbi)) {
-- sbi->write_io_dummy =
-- mempool_create_page_pool(2 * (F2FS_IO_SIZE(sbi) - 1), 0);
-- if (!sbi->write_io_dummy) {
-- err = -ENOMEM;
-- goto free_percpu;
-- }
-- }
--
- /* init per sbi slab cache */
- err = f2fs_init_xattr_caches(sbi);
- if (err)
-- goto free_io_dummy;
-+ goto free_percpu;
- err = f2fs_init_page_array_cache(sbi);
- if (err)
- goto free_xattr_cache;
-@@ -4620,10 +4540,6 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
- goto free_nm;
- }
-
-- err = adjust_reserved_segment(sbi);
-- if (err)
-- goto free_nm;
--
- /* For write statistics */
- sbi->sectors_written_start = f2fs_get_sectors_written(sbi);
-
-@@ -4854,8 +4770,6 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
- f2fs_destroy_page_array_cache(sbi);
- free_xattr_cache:
- f2fs_destroy_xattr_caches(sbi);
--free_io_dummy:
-- mempool_destroy(sbi->write_io_dummy);
- free_percpu:
- destroy_percpu_info(sbi);
- free_iostat:
-diff --git a/include/linux/f2fs_fs.h b/include/linux/f2fs_fs.h
-index 3f016d3c1ec4f..a8c0c081ec4df 100644
---- a/include/linux/f2fs_fs.h
-+++ b/include/linux/f2fs_fs.h
-@@ -41,12 +41,6 @@
-
- #define F2FS_ENC_UTF8_12_1 1
-
--#define F2FS_IO_SIZE(sbi) BIT(F2FS_OPTION(sbi).write_io_size_bits) /* Blocks */
--#define F2FS_IO_SIZE_KB(sbi) BIT(F2FS_OPTION(sbi).write_io_size_bits + 2) /* KB */
--#define F2FS_IO_SIZE_BITS(sbi) (F2FS_OPTION(sbi).write_io_size_bits) /* power of 2 */
--#define F2FS_IO_SIZE_MASK(sbi) (F2FS_IO_SIZE(sbi) - 1)
--#define F2FS_IO_ALIGNED(sbi) (F2FS_IO_SIZE(sbi) > 1)
--
- /* This flag is used by node and meta inodes, and by recovery */
- #define GFP_F2FS_ZERO (GFP_NOFS | __GFP_ZERO)
-
---
-2.43.0
-
+++ /dev/null
-From 94f68f54f6b71883c517a01a4ee449c15a933e3c Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sun, 28 Apr 2024 21:51:42 -0600
-Subject: f2fs: fix block migration when section is not aligned to pow2
-
-From: Wu Bo <bo.wu@vivo.com>
-
-[ Upstream commit aa4074e8fec4d2e686daee627fcafb3503efe365 ]
-
-As for zoned-UFS, f2fs section size is forced to zone size. And zone
-size may not aligned to pow2.
-
-Fixes: 859fca6b706e ("f2fs: swap: support migrating swapfile in aligned write mode")
-Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
-Signed-off-by: Wu Bo <bo.wu@vivo.com>
-Reviewed-by: Chao Yu <chao@kernel.org>
-Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/f2fs/data.c | 17 ++++++++---------
- 1 file changed, 8 insertions(+), 9 deletions(-)
-
-diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
-index 8e9aaa9e41cce..a871ba9fa3aab 100644
---- a/fs/f2fs/data.c
-+++ b/fs/f2fs/data.c
-@@ -3968,15 +3968,14 @@ static int check_swap_activate(struct swap_info_struct *sis,
- struct address_space *mapping = swap_file->f_mapping;
- struct inode *inode = mapping->host;
- struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
-- sector_t cur_lblock;
-- sector_t last_lblock;
-- sector_t pblock;
-- sector_t lowest_pblock = -1;
-- sector_t highest_pblock = 0;
-+ block_t cur_lblock;
-+ block_t last_lblock;
-+ block_t pblock;
-+ block_t lowest_pblock = -1;
-+ block_t highest_pblock = 0;
- int nr_extents = 0;
-- unsigned long nr_pblocks;
-+ unsigned int nr_pblocks;
- unsigned int blks_per_sec = BLKS_PER_SEC(sbi);
-- unsigned int sec_blks_mask = BLKS_PER_SEC(sbi) - 1;
- unsigned int not_aligned = 0;
- int ret = 0;
-
-@@ -4014,8 +4013,8 @@ static int check_swap_activate(struct swap_info_struct *sis,
- pblock = map.m_pblk;
- nr_pblocks = map.m_len;
-
-- if ((pblock - SM_I(sbi)->main_blkaddr) & sec_blks_mask ||
-- nr_pblocks & sec_blks_mask) {
-+ if ((pblock - SM_I(sbi)->main_blkaddr) % blks_per_sec ||
-+ nr_pblocks % blks_per_sec) {
- not_aligned++;
-
- nr_pblocks = roundup(nr_pblocks, blks_per_sec);
---
-2.43.0
-
+++ /dev/null
-From 1134aa47c0d9ebf3e89da3d242b38ede8c9d962c Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 10 May 2024 11:43:33 +0800
-Subject: f2fs: fix to add missing iput() in gc_data_segment()
-
-From: Chao Yu <chao@kernel.org>
-
-[ Upstream commit a798ff17cd2dabe47d5d4ed3d509631793c36e19 ]
-
-During gc_data_segment(), if inode state is abnormal, it missed to call
-iput(), fix it.
-
-Fixes: b73e52824c89 ("f2fs: reposition unlock_new_inode to prevent accessing invalid inode")
-Fixes: 9056d6489f5a ("f2fs: fix to do sanity check on inode type during garbage collection")
-Signed-off-by: Chao Yu <chao@kernel.org>
-Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/f2fs/gc.c | 9 +++++++--
- 1 file changed, 7 insertions(+), 2 deletions(-)
-
-diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
-index 6899f434ad688..61f142f2cce23 100644
---- a/fs/f2fs/gc.c
-+++ b/fs/f2fs/gc.c
-@@ -1552,10 +1552,15 @@ static int gc_data_segment(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
- int err;
-
- inode = f2fs_iget(sb, dni.ino);
-- if (IS_ERR(inode) || is_bad_inode(inode) ||
-- special_file(inode->i_mode))
-+ if (IS_ERR(inode))
- continue;
-
-+ if (is_bad_inode(inode) ||
-+ special_file(inode->i_mode)) {
-+ iput(inode);
-+ continue;
-+ }
-+
- err = f2fs_gc_pinned_control(inode, gc_type, segno);
- if (err == -EAGAIN) {
- iput(inode);
---
-2.43.0
-
+++ /dev/null
-From 911dc36a67123e9996fc7391a424177e697b1f5d Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 3 Apr 2024 22:24:20 +0800
-Subject: f2fs: fix to check pinfile flag in f2fs_move_file_range()
-
-From: Chao Yu <chao@kernel.org>
-
-[ Upstream commit e07230da0500e0919a765037c5e81583b519be2c ]
-
-ioctl(F2FS_IOC_MOVE_RANGE) can truncate or punch hole on pinned file,
-fix to disallow it.
-
-Fixes: 5fed0be8583f ("f2fs: do not allow partial truncation on pinned file")
-Signed-off-by: Chao Yu <chao@kernel.org>
-Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/f2fs/file.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
-index fb6c3777ef1a8..449e6f1625033 100644
---- a/fs/f2fs/file.c
-+++ b/fs/f2fs/file.c
-@@ -2819,7 +2819,8 @@ static int f2fs_move_file_range(struct file *file_in, loff_t pos_in,
- goto out;
- }
-
-- if (f2fs_compressed_file(src) || f2fs_compressed_file(dst)) {
-+ if (f2fs_compressed_file(src) || f2fs_compressed_file(dst) ||
-+ f2fs_is_pinned_file(src) || f2fs_is_pinned_file(dst)) {
- ret = -EOPNOTSUPP;
- goto out_unlock;
- }
---
-2.43.0
-
+++ /dev/null
-From 124f352837899e408b0b193efb7c803cfda70789 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 7 May 2024 11:31:00 +0800
-Subject: f2fs: fix to release node block count in error path of
- f2fs_new_node_page()
-
-From: Chao Yu <chao@kernel.org>
-
-[ Upstream commit 0fa4e57c1db263effd72d2149d4e21da0055c316 ]
-
-It missed to call dec_valid_node_count() to release node block count
-in error path, fix it.
-
-Fixes: 141170b759e0 ("f2fs: fix to avoid use f2fs_bug_on() in f2fs_new_node_page()")
-Signed-off-by: Chao Yu <chao@kernel.org>
-Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/f2fs/node.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
-index 2ea9c99e7dcb7..ad3ebe489f66a 100644
---- a/fs/f2fs/node.c
-+++ b/fs/f2fs/node.c
-@@ -1319,6 +1319,7 @@ struct page *f2fs_new_node_page(struct dnode_of_data *dn, unsigned int ofs)
- }
- if (unlikely(new_ni.blk_addr != NULL_ADDR)) {
- err = -EFSCORRUPTED;
-+ dec_valid_node_count(sbi, dn->inode, !ofs);
- set_sbi_flag(sbi, SBI_NEED_FSCK);
- f2fs_handle_error(sbi, ERROR_INVALID_BLKADDR);
- goto fail;
-@@ -1345,7 +1346,6 @@ struct page *f2fs_new_node_page(struct dnode_of_data *dn, unsigned int ofs)
- if (ofs == 0)
- inc_valid_inode_count(sbi);
- return page;
--
- fail:
- clear_node_page_dirty(page);
- f2fs_put_page(page, 1);
---
-2.43.0
-
+++ /dev/null
-From 36ea46dc70f0a5f63343c6b68628c9b216bd865a Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 3 Apr 2024 22:24:19 +0800
-Subject: f2fs: fix to relocate check condition in f2fs_fallocate()
-
-From: Chao Yu <chao@kernel.org>
-
-[ Upstream commit 278a6253a673611dbc8ab72a3b34b151a8e75822 ]
-
-compress and pinfile flag should be checked after inode lock held to
-avoid race condition, fix it.
-
-Fixes: 4c8ff7095bef ("f2fs: support data compression")
-Fixes: 5fed0be8583f ("f2fs: do not allow partial truncation on pinned file")
-Signed-off-by: Chao Yu <chao@kernel.org>
-Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/f2fs/file.c | 20 +++++++++++---------
- 1 file changed, 11 insertions(+), 9 deletions(-)
-
-diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
-index 4f223395c9a90..fb6c3777ef1a8 100644
---- a/fs/f2fs/file.c
-+++ b/fs/f2fs/file.c
-@@ -1803,15 +1803,6 @@ static long f2fs_fallocate(struct file *file, int mode,
- (mode & (FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_INSERT_RANGE)))
- return -EOPNOTSUPP;
-
-- /*
-- * Pinned file should not support partial truncation since the block
-- * can be used by applications.
-- */
-- if ((f2fs_compressed_file(inode) || f2fs_is_pinned_file(inode)) &&
-- (mode & (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_COLLAPSE_RANGE |
-- FALLOC_FL_ZERO_RANGE | FALLOC_FL_INSERT_RANGE)))
-- return -EOPNOTSUPP;
--
- if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE |
- FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_ZERO_RANGE |
- FALLOC_FL_INSERT_RANGE))
-@@ -1819,6 +1810,17 @@ static long f2fs_fallocate(struct file *file, int mode,
-
- inode_lock(inode);
-
-+ /*
-+ * Pinned file should not support partial truncation since the block
-+ * can be used by applications.
-+ */
-+ if ((f2fs_compressed_file(inode) || f2fs_is_pinned_file(inode)) &&
-+ (mode & (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_COLLAPSE_RANGE |
-+ FALLOC_FL_ZERO_RANGE | FALLOC_FL_INSERT_RANGE))) {
-+ ret = -EOPNOTSUPP;
-+ goto out;
-+ }
-+
- ret = file_modified(file);
- if (ret)
- goto out;
---
-2.43.0
-
+++ /dev/null
-From 97f29b28d9698e81292bd37e5b11038fc0c9a6d5 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 26 Mar 2024 19:28:45 +0800
-Subject: f2fs: fix to wait on page writeback in __clone_blkaddrs()
-
-From: Chao Yu <chao@kernel.org>
-
-[ Upstream commit d3876e34e7e789e2cbdd782360fef2a777391082 ]
-
-In below race condition, dst page may become writeback status
-in __clone_blkaddrs(), it needs to wait writeback before update,
-fix it.
-
-Thread A GC Thread
-- f2fs_move_file_range
- - filemap_write_and_wait_range(dst)
- - gc_data_segment
- - f2fs_down_write(dst)
- - move_data_page
- - set_page_writeback(dst_page)
- - f2fs_submit_page_write
- - f2fs_up_write(dst)
- - f2fs_down_write(dst)
- - __exchange_data_block
- - __clone_blkaddrs
- - f2fs_get_new_data_page
- - memcpy_page
-
-Fixes: 0a2aa8fbb969 ("f2fs: refactor __exchange_data_block for speed up")
-Signed-off-by: Chao Yu <chao@kernel.org>
-Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/f2fs/file.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
-index 51970b345eeee..66bd3559d86ee 100644
---- a/fs/f2fs/file.c
-+++ b/fs/f2fs/file.c
-@@ -1311,6 +1311,9 @@ static int __clone_blkaddrs(struct inode *src_inode, struct inode *dst_inode,
- f2fs_put_page(psrc, 1);
- return PTR_ERR(pdst);
- }
-+
-+ f2fs_wait_on_page_writeback(pdst, DATA, true, true);
-+
- memcpy_page(pdst, 0, psrc, 0, PAGE_SIZE);
- set_page_dirty(pdst);
- set_page_private_gcing(pdst);
---
-2.43.0
-
+++ /dev/null
-From f1f1d7449113b65219164357826b422363fbb1a8 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 20 Feb 2024 11:15:15 +0800
-Subject: f2fs: introduce get_available_block_count() for cleanup
-
-From: Chao Yu <chao@kernel.org>
-
-[ Upstream commit 0f1c6ede6da9f7c5dd7380b74a64850298279168 ]
-
-There are very similar codes in inc_valid_block_count() and
-inc_valid_node_count() which is used for available user block
-count calculation.
-
-This patch introduces a new helper get_available_block_count()
-to include those common codes, and used it to clean up codes.
-
-Signed-off-by: Chao Yu <chao@kernel.org>
-Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-Stable-dep-of: 043c832371cd ("f2fs: compress: fix error path of inc_valid_block_count()")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/f2fs/f2fs.h | 49 +++++++++++++++++++++++++++----------------------
- 1 file changed, 27 insertions(+), 22 deletions(-)
-
-diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
-index e3c231352f6db..f561f75ef98e9 100644
---- a/fs/f2fs/f2fs.h
-+++ b/fs/f2fs/f2fs.h
-@@ -2251,6 +2251,27 @@ static inline bool __allow_reserved_blocks(struct f2fs_sb_info *sbi,
- return false;
- }
-
-+static inline unsigned int get_available_block_count(struct f2fs_sb_info *sbi,
-+ struct inode *inode, bool cap)
-+{
-+ block_t avail_user_block_count;
-+
-+ avail_user_block_count = sbi->user_block_count -
-+ sbi->current_reserved_blocks;
-+
-+ if (!__allow_reserved_blocks(sbi, inode, cap))
-+ avail_user_block_count -= F2FS_OPTION(sbi).root_reserved_blocks;
-+
-+ if (unlikely(is_sbi_flag_set(sbi, SBI_CP_DISABLED))) {
-+ if (avail_user_block_count > sbi->unusable_block_count)
-+ avail_user_block_count -= sbi->unusable_block_count;
-+ else
-+ avail_user_block_count = 0;
-+ }
-+
-+ return avail_user_block_count;
-+}
-+
- static inline void f2fs_i_blocks_write(struct inode *, block_t, bool, bool);
- static inline int inc_valid_block_count(struct f2fs_sb_info *sbi,
- struct inode *inode, blkcnt_t *count, bool partial)
-@@ -2276,18 +2297,8 @@ static inline int inc_valid_block_count(struct f2fs_sb_info *sbi,
-
- spin_lock(&sbi->stat_lock);
- sbi->total_valid_block_count += (block_t)(*count);
-- avail_user_block_count = sbi->user_block_count -
-- sbi->current_reserved_blocks;
-+ avail_user_block_count = get_available_block_count(sbi, inode, true);
-
-- if (!__allow_reserved_blocks(sbi, inode, true))
-- avail_user_block_count -= F2FS_OPTION(sbi).root_reserved_blocks;
--
-- if (unlikely(is_sbi_flag_set(sbi, SBI_CP_DISABLED))) {
-- if (avail_user_block_count > sbi->unusable_block_count)
-- avail_user_block_count -= sbi->unusable_block_count;
-- else
-- avail_user_block_count = 0;
-- }
- if (unlikely(sbi->total_valid_block_count > avail_user_block_count)) {
- if (!partial) {
- spin_unlock(&sbi->stat_lock);
-@@ -2600,7 +2611,8 @@ static inline int inc_valid_node_count(struct f2fs_sb_info *sbi,
- struct inode *inode, bool is_inode)
- {
- block_t valid_block_count;
-- unsigned int valid_node_count, user_block_count;
-+ unsigned int valid_node_count;
-+ unsigned int avail_user_block_count;
- int err;
-
- if (is_inode) {
-@@ -2620,17 +2632,10 @@ static inline int inc_valid_node_count(struct f2fs_sb_info *sbi,
-
- spin_lock(&sbi->stat_lock);
-
-- valid_block_count = sbi->total_valid_block_count +
-- sbi->current_reserved_blocks + 1;
--
-- if (!__allow_reserved_blocks(sbi, inode, false))
-- valid_block_count += F2FS_OPTION(sbi).root_reserved_blocks;
--
-- user_block_count = sbi->user_block_count;
-- if (unlikely(is_sbi_flag_set(sbi, SBI_CP_DISABLED)))
-- user_block_count -= sbi->unusable_block_count;
-+ valid_block_count = sbi->total_valid_block_count + 1;
-+ avail_user_block_count = get_available_block_count(sbi, inode, false);
-
-- if (unlikely(valid_block_count > user_block_count)) {
-+ if (unlikely(valid_block_count > avail_user_block_count)) {
- spin_unlock(&sbi->stat_lock);
- goto enospc;
- }
---
-2.43.0
-
+++ /dev/null
-From 1e3ca2e2c01eb83b2a1e48a0e92a589e18b35e0a Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 27 Mar 2024 15:42:23 +0800
-Subject: f2fs: multidev: fix to recognize valid zero block address
-
-From: Chao Yu <chao@kernel.org>
-
-[ Upstream commit 33e62cd7b4c281cd737c62e5d8c4f0e602a8c5c5 ]
-
-As reported by Yi Zhang in mailing list [1], kernel warning was catched
-during zbd/010 test as below:
-
-./check zbd/010
-zbd/010 (test gap zone support with F2FS) [failed]
- runtime ... 3.752s
- something found in dmesg:
- [ 4378.146781] run blktests zbd/010 at 2024-02-18 11:31:13
- [ 4378.192349] null_blk: module loaded
- [ 4378.209860] null_blk: disk nullb0 created
- [ 4378.413285] scsi_debug:sdebug_driver_probe: scsi_debug: trim
-poll_queues to 0. poll_q/nr_hw = (0/1)
- [ 4378.422334] scsi host15: scsi_debug: version 0191 [20210520]
- dev_size_mb=1024, opts=0x0, submit_queues=1, statistics=0
- [ 4378.434922] scsi 15:0:0:0: Direct-Access-ZBC Linux
-scsi_debug 0191 PQ: 0 ANSI: 7
- [ 4378.443343] scsi 15:0:0:0: Power-on or device reset occurred
- [ 4378.449371] sd 15:0:0:0: Attached scsi generic sg5 type 20
- [ 4378.449418] sd 15:0:0:0: [sdf] Host-managed zoned block device
- ...
- (See '/mnt/tests/gitlab.com/api/v4/projects/19168116/repository/archive.zip/storage/blktests/blk/blktests/results/nodev/zbd/010.dmesg'
-
-WARNING: CPU: 22 PID: 44011 at fs/iomap/iter.c:51
-CPU: 22 PID: 44011 Comm: fio Not tainted 6.8.0-rc3+ #1
-RIP: 0010:iomap_iter+0x32b/0x350
-Call Trace:
- <TASK>
- __iomap_dio_rw+0x1df/0x830
- f2fs_file_read_iter+0x156/0x3d0 [f2fs]
- aio_read+0x138/0x210
- io_submit_one+0x188/0x8c0
- __x64_sys_io_submit+0x8c/0x1a0
- do_syscall_64+0x86/0x170
- entry_SYSCALL_64_after_hwframe+0x6e/0x76
-
-Shinichiro Kawasaki helps to analyse this issue and proposes a potential
-fixing patch in [2].
-
-Quoted from reply of Shinichiro Kawasaki:
-
-"I confirmed that the trigger commit is dbf8e63f48af as Yi reported. I took a
-look in the commit, but it looks fine to me. So I thought the cause is not
-in the commit diff.
-
-I found the WARN is printed when the f2fs is set up with multiple devices,
-and read requests are mapped to the very first block of the second device in the
-direct read path. In this case, f2fs_map_blocks() and f2fs_map_blocks_cached()
-modify map->m_pblk as the physical block address from each block device. It
-becomes zero when it is mapped to the first block of the device. However,
-f2fs_iomap_begin() assumes that map->m_pblk is the physical block address of the
-whole f2fs, across the all block devices. It compares map->m_pblk against
-NULL_ADDR == 0, then go into the unexpected branch and sets the invalid
-iomap->length. The WARN catches the invalid iomap->length.
-
-This WARN is printed even for non-zoned block devices, by following steps.
-
- - Create two (non-zoned) null_blk devices memory backed with 128MB size each:
- nullb0 and nullb1.
- # mkfs.f2fs /dev/nullb0 -c /dev/nullb1
- # mount -t f2fs /dev/nullb0 "${mount_dir}"
- # dd if=/dev/zero of="${mount_dir}/test.dat" bs=1M count=192
- # dd if="${mount_dir}/test.dat" of=/dev/null bs=1M count=192 iflag=direct
-
-..."
-
-So, the root cause of this issue is: when multi-devices feature is on,
-f2fs_map_blocks() may return zero blkaddr in non-primary device, which is
-a verified valid block address, however, f2fs_iomap_begin() treats it as
-an invalid block address, and then it triggers the warning in iomap
-framework code.
-
-Finally, as discussed, we decide to use a more simple and direct way that
-checking (map.m_flags & F2FS_MAP_MAPPED) condition instead of
-(map.m_pblk != NULL_ADDR) to fix this issue.
-
-Thanks a lot for the effort of Yi Zhang and Shinichiro Kawasaki on this
-issue.
-
-[1] https://lore.kernel.org/linux-f2fs-devel/CAHj4cs-kfojYC9i0G73PRkYzcxCTex=-vugRFeP40g_URGvnfQ@mail.gmail.com/
-[2] https://lore.kernel.org/linux-f2fs-devel/gngdj77k4picagsfdtiaa7gpgnup6fsgwzsltx6milmhegmjff@iax2n4wvrqye/
-
-Reported-by: Yi Zhang <yi.zhang@redhat.com>
-Closes: https://lore.kernel.org/linux-f2fs-devel/CAHj4cs-kfojYC9i0G73PRkYzcxCTex=-vugRFeP40g_URGvnfQ@mail.gmail.com/
-Tested-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
-Tested-by: Yi Zhang <yi.zhang@redhat.com>
-Fixes: 1517c1a7a445 ("f2fs: implement iomap operations")
-Fixes: 8d3c1fa3fa5e ("f2fs: don't rely on F2FS_MAP_* in f2fs_iomap_begin")
-Signed-off-by: Chao Yu <chao@kernel.org>
-Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/f2fs/data.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
-index 05158f89ef32d..8e9aaa9e41cce 100644
---- a/fs/f2fs/data.c
-+++ b/fs/f2fs/data.c
-@@ -4246,7 +4246,7 @@ static int f2fs_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
- if (WARN_ON_ONCE(map.m_pblk == COMPRESS_ADDR))
- return -EINVAL;
-
-- if (map.m_pblk != NULL_ADDR) {
-+ if (map.m_flags & F2FS_MAP_MAPPED) {
- iomap->length = blks_to_bytes(inode, map.m_len);
- iomap->type = IOMAP_MAPPED;
- iomap->flags |= IOMAP_F_MERGED;
---
-2.43.0
-
+++ /dev/null
-From 4a497caca7acd5bec2c230383b788f06860069af Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 8 Apr 2024 09:34:24 +0200
-Subject: firmware: dmi-id: add a release callback function
-
-From: Arnd Bergmann <arnd@arndb.de>
-
-[ Upstream commit cf770af5645a41a753c55a053fa1237105b0964a ]
-
-dmi_class uses kfree() as the .release function, but that now causes
-a warning with clang-16 as it violates control flow integrity (KCFI)
-rules:
-
-drivers/firmware/dmi-id.c:174:17: error: cast from 'void (*)(const void *)' to 'void (*)(struct device *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
- 174 | .dev_release = (void(*)(struct device *)) kfree,
-
-Add an explicit function to call kfree() instead.
-
-Fixes: 4f5c791a850e ("DMI-based module autoloading")
-Link: https://lore.kernel.org/lkml/20240213100238.456912-1-arnd@kernel.org/
-Signed-off-by: Arnd Bergmann <arnd@arndb.de>
-Signed-off-by: Jean Delvare <jdelvare@suse.de>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/firmware/dmi-id.c | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/firmware/dmi-id.c b/drivers/firmware/dmi-id.c
-index 5f3a3e913d28f..d19c78a78ae3a 100644
---- a/drivers/firmware/dmi-id.c
-+++ b/drivers/firmware/dmi-id.c
-@@ -169,9 +169,14 @@ static int dmi_dev_uevent(const struct device *dev, struct kobj_uevent_env *env)
- return 0;
- }
-
-+static void dmi_dev_release(struct device *dev)
-+{
-+ kfree(dev);
-+}
-+
- static struct class dmi_class = {
- .name = "dmi",
-- .dev_release = (void(*)(struct device *)) kfree,
-+ .dev_release = dmi_dev_release,
- .dev_uevent = dmi_dev_uevent,
- };
-
---
-2.43.0
-
+++ /dev/null
-From 4848bfd76aa2adc3776e49c561586553736260b7 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 22 Mar 2024 18:18:37 +0100
-Subject: fpga: bridge: add owner module and take its refcount
-
-From: Marco Pagani <marpagan@redhat.com>
-
-[ Upstream commit 1da11f822042eb6ef4b6064dc048f157a7852529 ]
-
-The current implementation of the fpga bridge assumes that the low-level
-module registers a driver for the parent device and uses its owner pointer
-to take the module's refcount. This approach is problematic since it can
-lead to a null pointer dereference while attempting to get the bridge if
-the parent device does not have a driver.
-
-To address this problem, add a module owner pointer to the fpga_bridge
-struct and use it to take the module's refcount. Modify the function for
-registering a bridge to take an additional owner module parameter and
-rename it to avoid conflicts. Use the old function name for a helper macro
-that automatically sets the module that registers the bridge as the owner.
-This ensures compatibility with existing low-level control modules and
-reduces the chances of registering a bridge without setting the owner.
-
-Also, update the documentation to keep it consistent with the new interface
-for registering an fpga bridge.
-
-Other changes: opportunistically move put_device() from __fpga_bridge_get()
-to fpga_bridge_get() and of_fpga_bridge_get() to improve code clarity since
-the bridge device is taken in these functions.
-
-Fixes: 21aeda950c5f ("fpga: add fpga bridge framework")
-Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Suggested-by: Xu Yilun <yilun.xu@intel.com>
-Reviewed-by: Russ Weight <russ.weight@linux.dev>
-Signed-off-by: Marco Pagani <marpagan@redhat.com>
-Acked-by: Xu Yilun <yilun.xu@intel.com>
-Link: https://lore.kernel.org/r/20240322171839.233864-1-marpagan@redhat.com
-Signed-off-by: Xu Yilun <yilun.xu@linux.intel.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- Documentation/driver-api/fpga/fpga-bridge.rst | 7 ++-
- drivers/fpga/fpga-bridge.c | 57 ++++++++++---------
- include/linux/fpga/fpga-bridge.h | 10 +++-
- 3 files changed, 43 insertions(+), 31 deletions(-)
-
-diff --git a/Documentation/driver-api/fpga/fpga-bridge.rst b/Documentation/driver-api/fpga/fpga-bridge.rst
-index 6042085340953..833f68fb07008 100644
---- a/Documentation/driver-api/fpga/fpga-bridge.rst
-+++ b/Documentation/driver-api/fpga/fpga-bridge.rst
-@@ -6,9 +6,12 @@ API to implement a new FPGA bridge
-
- * struct fpga_bridge - The FPGA Bridge structure
- * struct fpga_bridge_ops - Low level Bridge driver ops
--* fpga_bridge_register() - Create and register a bridge
-+* __fpga_bridge_register() - Create and register a bridge
- * fpga_bridge_unregister() - Unregister a bridge
-
-+The helper macro ``fpga_bridge_register()`` automatically sets
-+the module that registers the FPGA bridge as the owner.
-+
- .. kernel-doc:: include/linux/fpga/fpga-bridge.h
- :functions: fpga_bridge
-
-@@ -16,7 +19,7 @@ API to implement a new FPGA bridge
- :functions: fpga_bridge_ops
-
- .. kernel-doc:: drivers/fpga/fpga-bridge.c
-- :functions: fpga_bridge_register
-+ :functions: __fpga_bridge_register
-
- .. kernel-doc:: drivers/fpga/fpga-bridge.c
- :functions: fpga_bridge_unregister
-diff --git a/drivers/fpga/fpga-bridge.c b/drivers/fpga/fpga-bridge.c
-index a024be2b84e29..83d35fbb82450 100644
---- a/drivers/fpga/fpga-bridge.c
-+++ b/drivers/fpga/fpga-bridge.c
-@@ -55,33 +55,26 @@ int fpga_bridge_disable(struct fpga_bridge *bridge)
- }
- EXPORT_SYMBOL_GPL(fpga_bridge_disable);
-
--static struct fpga_bridge *__fpga_bridge_get(struct device *dev,
-+static struct fpga_bridge *__fpga_bridge_get(struct device *bridge_dev,
- struct fpga_image_info *info)
- {
- struct fpga_bridge *bridge;
-- int ret = -ENODEV;
-
-- bridge = to_fpga_bridge(dev);
-+ bridge = to_fpga_bridge(bridge_dev);
-
- bridge->info = info;
-
-- if (!mutex_trylock(&bridge->mutex)) {
-- ret = -EBUSY;
-- goto err_dev;
-- }
-+ if (!mutex_trylock(&bridge->mutex))
-+ return ERR_PTR(-EBUSY);
-
-- if (!try_module_get(dev->parent->driver->owner))
-- goto err_ll_mod;
-+ if (!try_module_get(bridge->br_ops_owner)) {
-+ mutex_unlock(&bridge->mutex);
-+ return ERR_PTR(-ENODEV);
-+ }
-
- dev_dbg(&bridge->dev, "get\n");
-
- return bridge;
--
--err_ll_mod:
-- mutex_unlock(&bridge->mutex);
--err_dev:
-- put_device(dev);
-- return ERR_PTR(ret);
- }
-
- /**
-@@ -98,13 +91,18 @@ static struct fpga_bridge *__fpga_bridge_get(struct device *dev,
- struct fpga_bridge *of_fpga_bridge_get(struct device_node *np,
- struct fpga_image_info *info)
- {
-- struct device *dev;
-+ struct fpga_bridge *bridge;
-+ struct device *bridge_dev;
-
-- dev = class_find_device_by_of_node(&fpga_bridge_class, np);
-- if (!dev)
-+ bridge_dev = class_find_device_by_of_node(&fpga_bridge_class, np);
-+ if (!bridge_dev)
- return ERR_PTR(-ENODEV);
-
-- return __fpga_bridge_get(dev, info);
-+ bridge = __fpga_bridge_get(bridge_dev, info);
-+ if (IS_ERR(bridge))
-+ put_device(bridge_dev);
-+
-+ return bridge;
- }
- EXPORT_SYMBOL_GPL(of_fpga_bridge_get);
-
-@@ -125,6 +123,7 @@ static int fpga_bridge_dev_match(struct device *dev, const void *data)
- struct fpga_bridge *fpga_bridge_get(struct device *dev,
- struct fpga_image_info *info)
- {
-+ struct fpga_bridge *bridge;
- struct device *bridge_dev;
-
- bridge_dev = class_find_device(&fpga_bridge_class, NULL, dev,
-@@ -132,7 +131,11 @@ struct fpga_bridge *fpga_bridge_get(struct device *dev,
- if (!bridge_dev)
- return ERR_PTR(-ENODEV);
-
-- return __fpga_bridge_get(bridge_dev, info);
-+ bridge = __fpga_bridge_get(bridge_dev, info);
-+ if (IS_ERR(bridge))
-+ put_device(bridge_dev);
-+
-+ return bridge;
- }
- EXPORT_SYMBOL_GPL(fpga_bridge_get);
-
-@@ -146,7 +149,7 @@ void fpga_bridge_put(struct fpga_bridge *bridge)
- dev_dbg(&bridge->dev, "put\n");
-
- bridge->info = NULL;
-- module_put(bridge->dev.parent->driver->owner);
-+ module_put(bridge->br_ops_owner);
- mutex_unlock(&bridge->mutex);
- put_device(&bridge->dev);
- }
-@@ -316,18 +319,19 @@ static struct attribute *fpga_bridge_attrs[] = {
- ATTRIBUTE_GROUPS(fpga_bridge);
-
- /**
-- * fpga_bridge_register - create and register an FPGA Bridge device
-+ * __fpga_bridge_register - create and register an FPGA Bridge device
- * @parent: FPGA bridge device from pdev
- * @name: FPGA bridge name
- * @br_ops: pointer to structure of fpga bridge ops
- * @priv: FPGA bridge private data
-+ * @owner: owner module containing the br_ops
- *
- * Return: struct fpga_bridge pointer or ERR_PTR()
- */
- struct fpga_bridge *
--fpga_bridge_register(struct device *parent, const char *name,
-- const struct fpga_bridge_ops *br_ops,
-- void *priv)
-+__fpga_bridge_register(struct device *parent, const char *name,
-+ const struct fpga_bridge_ops *br_ops,
-+ void *priv, struct module *owner)
- {
- struct fpga_bridge *bridge;
- int id, ret;
-@@ -357,6 +361,7 @@ fpga_bridge_register(struct device *parent, const char *name,
-
- bridge->name = name;
- bridge->br_ops = br_ops;
-+ bridge->br_ops_owner = owner;
- bridge->priv = priv;
-
- bridge->dev.groups = br_ops->groups;
-@@ -386,7 +391,7 @@ fpga_bridge_register(struct device *parent, const char *name,
-
- return ERR_PTR(ret);
- }
--EXPORT_SYMBOL_GPL(fpga_bridge_register);
-+EXPORT_SYMBOL_GPL(__fpga_bridge_register);
-
- /**
- * fpga_bridge_unregister - unregister an FPGA bridge
-diff --git a/include/linux/fpga/fpga-bridge.h b/include/linux/fpga/fpga-bridge.h
-index 223da48a6d18b..94c4edd047e54 100644
---- a/include/linux/fpga/fpga-bridge.h
-+++ b/include/linux/fpga/fpga-bridge.h
-@@ -45,6 +45,7 @@ struct fpga_bridge_info {
- * @dev: FPGA bridge device
- * @mutex: enforces exclusive reference to bridge
- * @br_ops: pointer to struct of FPGA bridge ops
-+ * @br_ops_owner: module containing the br_ops
- * @info: fpga image specific information
- * @node: FPGA bridge list node
- * @priv: low level driver private date
-@@ -54,6 +55,7 @@ struct fpga_bridge {
- struct device dev;
- struct mutex mutex; /* for exclusive reference to bridge */
- const struct fpga_bridge_ops *br_ops;
-+ struct module *br_ops_owner;
- struct fpga_image_info *info;
- struct list_head node;
- void *priv;
-@@ -79,10 +81,12 @@ int of_fpga_bridge_get_to_list(struct device_node *np,
- struct fpga_image_info *info,
- struct list_head *bridge_list);
-
-+#define fpga_bridge_register(parent, name, br_ops, priv) \
-+ __fpga_bridge_register(parent, name, br_ops, priv, THIS_MODULE)
- struct fpga_bridge *
--fpga_bridge_register(struct device *parent, const char *name,
-- const struct fpga_bridge_ops *br_ops,
-- void *priv);
-+__fpga_bridge_register(struct device *parent, const char *name,
-+ const struct fpga_bridge_ops *br_ops, void *priv,
-+ struct module *owner);
- void fpga_bridge_unregister(struct fpga_bridge *br);
-
- #endif /* _LINUX_FPGA_BRIDGE_H */
---
-2.43.0
-
+++ /dev/null
-From b31579350087e10b608e88b1935ba25e3fc450a8 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 5 Mar 2024 20:29:26 +0100
-Subject: fpga: manager: add owner module and take its refcount
-
-From: Marco Pagani <marpagan@redhat.com>
-
-[ Upstream commit 4d4d2d4346857bf778fafaa97d6f76bb1663e3c9 ]
-
-The current implementation of the fpga manager assumes that the low-level
-module registers a driver for the parent device and uses its owner pointer
-to take the module's refcount. This approach is problematic since it can
-lead to a null pointer dereference while attempting to get the manager if
-the parent device does not have a driver.
-
-To address this problem, add a module owner pointer to the fpga_manager
-struct and use it to take the module's refcount. Modify the functions for
-registering the manager to take an additional owner module parameter and
-rename them to avoid conflicts. Use the old function names for helper
-macros that automatically set the module that registers the manager as the
-owner. This ensures compatibility with existing low-level control modules
-and reduces the chances of registering a manager without setting the owner.
-
-Also, update the documentation to keep it consistent with the new interface
-for registering an fpga manager.
-
-Other changes: opportunistically move put_device() from __fpga_mgr_get() to
-fpga_mgr_get() and of_fpga_mgr_get() to improve code clarity since the
-manager device is taken in these functions.
-
-Fixes: 654ba4cc0f3e ("fpga manager: ensure lifetime with of_fpga_mgr_get")
-Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Suggested-by: Xu Yilun <yilun.xu@intel.com>
-Signed-off-by: Marco Pagani <marpagan@redhat.com>
-Acked-by: Xu Yilun <yilun.xu@intel.com>
-Link: https://lore.kernel.org/r/20240305192926.84886-1-marpagan@redhat.com
-Signed-off-by: Xu Yilun <yilun.xu@linux.intel.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- Documentation/driver-api/fpga/fpga-mgr.rst | 34 +++++----
- drivers/fpga/fpga-mgr.c | 82 +++++++++++++---------
- include/linux/fpga/fpga-mgr.h | 26 +++++--
- 3 files changed, 89 insertions(+), 53 deletions(-)
-
-diff --git a/Documentation/driver-api/fpga/fpga-mgr.rst b/Documentation/driver-api/fpga/fpga-mgr.rst
-index 49c0a95126532..8d2b79f696c1f 100644
---- a/Documentation/driver-api/fpga/fpga-mgr.rst
-+++ b/Documentation/driver-api/fpga/fpga-mgr.rst
-@@ -24,7 +24,8 @@ How to support a new FPGA device
- --------------------------------
-
- To add another FPGA manager, write a driver that implements a set of ops. The
--probe function calls fpga_mgr_register() or fpga_mgr_register_full(), such as::
-+probe function calls ``fpga_mgr_register()`` or ``fpga_mgr_register_full()``,
-+such as::
-
- static const struct fpga_manager_ops socfpga_fpga_ops = {
- .write_init = socfpga_fpga_ops_configure_init,
-@@ -69,10 +70,11 @@ probe function calls fpga_mgr_register() or fpga_mgr_register_full(), such as::
- }
-
- Alternatively, the probe function could call one of the resource managed
--register functions, devm_fpga_mgr_register() or devm_fpga_mgr_register_full().
--When these functions are used, the parameter syntax is the same, but the call
--to fpga_mgr_unregister() should be removed. In the above example, the
--socfpga_fpga_remove() function would not be required.
-+register functions, ``devm_fpga_mgr_register()`` or
-+``devm_fpga_mgr_register_full()``. When these functions are used, the
-+parameter syntax is the same, but the call to ``fpga_mgr_unregister()`` should be
-+removed. In the above example, the ``socfpga_fpga_remove()`` function would not be
-+required.
-
- The ops will implement whatever device specific register writes are needed to
- do the programming sequence for this particular FPGA. These ops return 0 for
-@@ -125,15 +127,19 @@ API for implementing a new FPGA Manager driver
- * struct fpga_manager - the FPGA manager struct
- * struct fpga_manager_ops - Low level FPGA manager driver ops
- * struct fpga_manager_info - Parameter structure for fpga_mgr_register_full()
--* fpga_mgr_register_full() - Create and register an FPGA manager using the
-+* __fpga_mgr_register_full() - Create and register an FPGA manager using the
- fpga_mgr_info structure to provide the full flexibility of options
--* fpga_mgr_register() - Create and register an FPGA manager using standard
-+* __fpga_mgr_register() - Create and register an FPGA manager using standard
- arguments
--* devm_fpga_mgr_register_full() - Resource managed version of
-- fpga_mgr_register_full()
--* devm_fpga_mgr_register() - Resource managed version of fpga_mgr_register()
-+* __devm_fpga_mgr_register_full() - Resource managed version of
-+ __fpga_mgr_register_full()
-+* __devm_fpga_mgr_register() - Resource managed version of __fpga_mgr_register()
- * fpga_mgr_unregister() - Unregister an FPGA manager
-
-+Helper macros ``fpga_mgr_register_full()``, ``fpga_mgr_register()``,
-+``devm_fpga_mgr_register_full()``, and ``devm_fpga_mgr_register()`` are available
-+to ease the registration.
-+
- .. kernel-doc:: include/linux/fpga/fpga-mgr.h
- :functions: fpga_mgr_states
-
-@@ -147,16 +153,16 @@ API for implementing a new FPGA Manager driver
- :functions: fpga_manager_info
-
- .. kernel-doc:: drivers/fpga/fpga-mgr.c
-- :functions: fpga_mgr_register_full
-+ :functions: __fpga_mgr_register_full
-
- .. kernel-doc:: drivers/fpga/fpga-mgr.c
-- :functions: fpga_mgr_register
-+ :functions: __fpga_mgr_register
-
- .. kernel-doc:: drivers/fpga/fpga-mgr.c
-- :functions: devm_fpga_mgr_register_full
-+ :functions: __devm_fpga_mgr_register_full
-
- .. kernel-doc:: drivers/fpga/fpga-mgr.c
-- :functions: devm_fpga_mgr_register
-+ :functions: __devm_fpga_mgr_register
-
- .. kernel-doc:: drivers/fpga/fpga-mgr.c
- :functions: fpga_mgr_unregister
-diff --git a/drivers/fpga/fpga-mgr.c b/drivers/fpga/fpga-mgr.c
-index 06651389c5926..0f4035b089a2e 100644
---- a/drivers/fpga/fpga-mgr.c
-+++ b/drivers/fpga/fpga-mgr.c
-@@ -664,20 +664,16 @@ static struct attribute *fpga_mgr_attrs[] = {
- };
- ATTRIBUTE_GROUPS(fpga_mgr);
-
--static struct fpga_manager *__fpga_mgr_get(struct device *dev)
-+static struct fpga_manager *__fpga_mgr_get(struct device *mgr_dev)
- {
- struct fpga_manager *mgr;
-
-- mgr = to_fpga_manager(dev);
-+ mgr = to_fpga_manager(mgr_dev);
-
-- if (!try_module_get(dev->parent->driver->owner))
-- goto err_dev;
-+ if (!try_module_get(mgr->mops_owner))
-+ mgr = ERR_PTR(-ENODEV);
-
- return mgr;
--
--err_dev:
-- put_device(dev);
-- return ERR_PTR(-ENODEV);
- }
-
- static int fpga_mgr_dev_match(struct device *dev, const void *data)
-@@ -693,12 +689,18 @@ static int fpga_mgr_dev_match(struct device *dev, const void *data)
- */
- struct fpga_manager *fpga_mgr_get(struct device *dev)
- {
-- struct device *mgr_dev = class_find_device(&fpga_mgr_class, NULL, dev,
-- fpga_mgr_dev_match);
-+ struct fpga_manager *mgr;
-+ struct device *mgr_dev;
-+
-+ mgr_dev = class_find_device(&fpga_mgr_class, NULL, dev, fpga_mgr_dev_match);
- if (!mgr_dev)
- return ERR_PTR(-ENODEV);
-
-- return __fpga_mgr_get(mgr_dev);
-+ mgr = __fpga_mgr_get(mgr_dev);
-+ if (IS_ERR(mgr))
-+ put_device(mgr_dev);
-+
-+ return mgr;
- }
- EXPORT_SYMBOL_GPL(fpga_mgr_get);
-
-@@ -711,13 +713,18 @@ EXPORT_SYMBOL_GPL(fpga_mgr_get);
- */
- struct fpga_manager *of_fpga_mgr_get(struct device_node *node)
- {
-- struct device *dev;
-+ struct fpga_manager *mgr;
-+ struct device *mgr_dev;
-
-- dev = class_find_device_by_of_node(&fpga_mgr_class, node);
-- if (!dev)
-+ mgr_dev = class_find_device_by_of_node(&fpga_mgr_class, node);
-+ if (!mgr_dev)
- return ERR_PTR(-ENODEV);
-
-- return __fpga_mgr_get(dev);
-+ mgr = __fpga_mgr_get(mgr_dev);
-+ if (IS_ERR(mgr))
-+ put_device(mgr_dev);
-+
-+ return mgr;
- }
- EXPORT_SYMBOL_GPL(of_fpga_mgr_get);
-
-@@ -727,7 +734,7 @@ EXPORT_SYMBOL_GPL(of_fpga_mgr_get);
- */
- void fpga_mgr_put(struct fpga_manager *mgr)
- {
-- module_put(mgr->dev.parent->driver->owner);
-+ module_put(mgr->mops_owner);
- put_device(&mgr->dev);
- }
- EXPORT_SYMBOL_GPL(fpga_mgr_put);
-@@ -766,9 +773,10 @@ void fpga_mgr_unlock(struct fpga_manager *mgr)
- EXPORT_SYMBOL_GPL(fpga_mgr_unlock);
-
- /**
-- * fpga_mgr_register_full - create and register an FPGA Manager device
-+ * __fpga_mgr_register_full - create and register an FPGA Manager device
- * @parent: fpga manager device from pdev
- * @info: parameters for fpga manager
-+ * @owner: owner module containing the ops
- *
- * The caller of this function is responsible for calling fpga_mgr_unregister().
- * Using devm_fpga_mgr_register_full() instead is recommended.
-@@ -776,7 +784,8 @@ EXPORT_SYMBOL_GPL(fpga_mgr_unlock);
- * Return: pointer to struct fpga_manager pointer or ERR_PTR()
- */
- struct fpga_manager *
--fpga_mgr_register_full(struct device *parent, const struct fpga_manager_info *info)
-+__fpga_mgr_register_full(struct device *parent, const struct fpga_manager_info *info,
-+ struct module *owner)
- {
- const struct fpga_manager_ops *mops = info->mops;
- struct fpga_manager *mgr;
-@@ -804,6 +813,8 @@ fpga_mgr_register_full(struct device *parent, const struct fpga_manager_info *in
-
- mutex_init(&mgr->ref_mutex);
-
-+ mgr->mops_owner = owner;
-+
- mgr->name = info->name;
- mgr->mops = info->mops;
- mgr->priv = info->priv;
-@@ -841,14 +852,15 @@ fpga_mgr_register_full(struct device *parent, const struct fpga_manager_info *in
-
- return ERR_PTR(ret);
- }
--EXPORT_SYMBOL_GPL(fpga_mgr_register_full);
-+EXPORT_SYMBOL_GPL(__fpga_mgr_register_full);
-
- /**
-- * fpga_mgr_register - create and register an FPGA Manager device
-+ * __fpga_mgr_register - create and register an FPGA Manager device
- * @parent: fpga manager device from pdev
- * @name: fpga manager name
- * @mops: pointer to structure of fpga manager ops
- * @priv: fpga manager private data
-+ * @owner: owner module containing the ops
- *
- * The caller of this function is responsible for calling fpga_mgr_unregister().
- * Using devm_fpga_mgr_register() instead is recommended. This simple
-@@ -859,8 +871,8 @@ EXPORT_SYMBOL_GPL(fpga_mgr_register_full);
- * Return: pointer to struct fpga_manager pointer or ERR_PTR()
- */
- struct fpga_manager *
--fpga_mgr_register(struct device *parent, const char *name,
-- const struct fpga_manager_ops *mops, void *priv)
-+__fpga_mgr_register(struct device *parent, const char *name,
-+ const struct fpga_manager_ops *mops, void *priv, struct module *owner)
- {
- struct fpga_manager_info info = { 0 };
-
-@@ -868,9 +880,9 @@ fpga_mgr_register(struct device *parent, const char *name,
- info.mops = mops;
- info.priv = priv;
-
-- return fpga_mgr_register_full(parent, &info);
-+ return __fpga_mgr_register_full(parent, &info, owner);
- }
--EXPORT_SYMBOL_GPL(fpga_mgr_register);
-+EXPORT_SYMBOL_GPL(__fpga_mgr_register);
-
- /**
- * fpga_mgr_unregister - unregister an FPGA manager
-@@ -900,9 +912,10 @@ static void devm_fpga_mgr_unregister(struct device *dev, void *res)
- }
-
- /**
-- * devm_fpga_mgr_register_full - resource managed variant of fpga_mgr_register()
-+ * __devm_fpga_mgr_register_full - resource managed variant of fpga_mgr_register()
- * @parent: fpga manager device from pdev
- * @info: parameters for fpga manager
-+ * @owner: owner module containing the ops
- *
- * Return: fpga manager pointer on success, negative error code otherwise.
- *
-@@ -910,7 +923,8 @@ static void devm_fpga_mgr_unregister(struct device *dev, void *res)
- * function will be called automatically when the managing device is detached.
- */
- struct fpga_manager *
--devm_fpga_mgr_register_full(struct device *parent, const struct fpga_manager_info *info)
-+__devm_fpga_mgr_register_full(struct device *parent, const struct fpga_manager_info *info,
-+ struct module *owner)
- {
- struct fpga_mgr_devres *dr;
- struct fpga_manager *mgr;
-@@ -919,7 +933,7 @@ devm_fpga_mgr_register_full(struct device *parent, const struct fpga_manager_inf
- if (!dr)
- return ERR_PTR(-ENOMEM);
-
-- mgr = fpga_mgr_register_full(parent, info);
-+ mgr = __fpga_mgr_register_full(parent, info, owner);
- if (IS_ERR(mgr)) {
- devres_free(dr);
- return mgr;
-@@ -930,14 +944,15 @@ devm_fpga_mgr_register_full(struct device *parent, const struct fpga_manager_inf
-
- return mgr;
- }
--EXPORT_SYMBOL_GPL(devm_fpga_mgr_register_full);
-+EXPORT_SYMBOL_GPL(__devm_fpga_mgr_register_full);
-
- /**
-- * devm_fpga_mgr_register - resource managed variant of fpga_mgr_register()
-+ * __devm_fpga_mgr_register - resource managed variant of fpga_mgr_register()
- * @parent: fpga manager device from pdev
- * @name: fpga manager name
- * @mops: pointer to structure of fpga manager ops
- * @priv: fpga manager private data
-+ * @owner: owner module containing the ops
- *
- * Return: fpga manager pointer on success, negative error code otherwise.
- *
-@@ -946,8 +961,9 @@ EXPORT_SYMBOL_GPL(devm_fpga_mgr_register_full);
- * device is detached.
- */
- struct fpga_manager *
--devm_fpga_mgr_register(struct device *parent, const char *name,
-- const struct fpga_manager_ops *mops, void *priv)
-+__devm_fpga_mgr_register(struct device *parent, const char *name,
-+ const struct fpga_manager_ops *mops, void *priv,
-+ struct module *owner)
- {
- struct fpga_manager_info info = { 0 };
-
-@@ -955,9 +971,9 @@ devm_fpga_mgr_register(struct device *parent, const char *name,
- info.mops = mops;
- info.priv = priv;
-
-- return devm_fpga_mgr_register_full(parent, &info);
-+ return __devm_fpga_mgr_register_full(parent, &info, owner);
- }
--EXPORT_SYMBOL_GPL(devm_fpga_mgr_register);
-+EXPORT_SYMBOL_GPL(__devm_fpga_mgr_register);
-
- static void fpga_mgr_dev_release(struct device *dev)
- {
-diff --git a/include/linux/fpga/fpga-mgr.h b/include/linux/fpga/fpga-mgr.h
-index 54f63459efd6e..0d4fe068f3d8a 100644
---- a/include/linux/fpga/fpga-mgr.h
-+++ b/include/linux/fpga/fpga-mgr.h
-@@ -201,6 +201,7 @@ struct fpga_manager_ops {
- * @state: state of fpga manager
- * @compat_id: FPGA manager id for compatibility check.
- * @mops: pointer to struct of fpga manager ops
-+ * @mops_owner: module containing the mops
- * @priv: low level driver private date
- */
- struct fpga_manager {
-@@ -210,6 +211,7 @@ struct fpga_manager {
- enum fpga_mgr_states state;
- struct fpga_compat_id *compat_id;
- const struct fpga_manager_ops *mops;
-+ struct module *mops_owner;
- void *priv;
- };
-
-@@ -230,18 +232,30 @@ struct fpga_manager *fpga_mgr_get(struct device *dev);
-
- void fpga_mgr_put(struct fpga_manager *mgr);
-
-+#define fpga_mgr_register_full(parent, info) \
-+ __fpga_mgr_register_full(parent, info, THIS_MODULE)
- struct fpga_manager *
--fpga_mgr_register_full(struct device *parent, const struct fpga_manager_info *info);
-+__fpga_mgr_register_full(struct device *parent, const struct fpga_manager_info *info,
-+ struct module *owner);
-
-+#define fpga_mgr_register(parent, name, mops, priv) \
-+ __fpga_mgr_register(parent, name, mops, priv, THIS_MODULE)
- struct fpga_manager *
--fpga_mgr_register(struct device *parent, const char *name,
-- const struct fpga_manager_ops *mops, void *priv);
-+__fpga_mgr_register(struct device *parent, const char *name,
-+ const struct fpga_manager_ops *mops, void *priv, struct module *owner);
-+
- void fpga_mgr_unregister(struct fpga_manager *mgr);
-
-+#define devm_fpga_mgr_register_full(parent, info) \
-+ __devm_fpga_mgr_register_full(parent, info, THIS_MODULE)
- struct fpga_manager *
--devm_fpga_mgr_register_full(struct device *parent, const struct fpga_manager_info *info);
-+__devm_fpga_mgr_register_full(struct device *parent, const struct fpga_manager_info *info,
-+ struct module *owner);
-+#define devm_fpga_mgr_register(parent, name, mops, priv) \
-+ __devm_fpga_mgr_register(parent, name, mops, priv, THIS_MODULE)
- struct fpga_manager *
--devm_fpga_mgr_register(struct device *parent, const char *name,
-- const struct fpga_manager_ops *mops, void *priv);
-+__devm_fpga_mgr_register(struct device *parent, const char *name,
-+ const struct fpga_manager_ops *mops, void *priv,
-+ struct module *owner);
-
- #endif /*_LINUX_FPGA_MGR_H */
---
-2.43.0
-
+++ /dev/null
-From fea28798459b011fd39139f7e040ea12832632d1 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 19 Apr 2024 10:35:59 +0200
-Subject: fpga: region: add owner module and take its refcount
-
-From: Marco Pagani <marpagan@redhat.com>
-
-[ Upstream commit b7c0e1ecee403a43abc89eb3e75672b01ff2ece9 ]
-
-The current implementation of the fpga region assumes that the low-level
-module registers a driver for the parent device and uses its owner pointer
-to take the module's refcount. This approach is problematic since it can
-lead to a null pointer dereference while attempting to get the region
-during programming if the parent device does not have a driver.
-
-To address this problem, add a module owner pointer to the fpga_region
-struct and use it to take the module's refcount. Modify the functions for
-registering a region to take an additional owner module parameter and
-rename them to avoid conflicts. Use the old function names for helper
-macros that automatically set the module that registers the region as the
-owner. This ensures compatibility with existing low-level control modules
-and reduces the chances of registering a region without setting the owner.
-
-Also, update the documentation to keep it consistent with the new interface
-for registering an fpga region.
-
-Fixes: 0fa20cdfcc1f ("fpga: fpga-region: device tree control for FPGA")
-Suggested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Suggested-by: Xu Yilun <yilun.xu@intel.com>
-Reviewed-by: Russ Weight <russ.weight@linux.dev>
-Signed-off-by: Marco Pagani <marpagan@redhat.com>
-Acked-by: Xu Yilun <yilun.xu@intel.com>
-Link: https://lore.kernel.org/r/20240419083601.77403-1-marpagan@redhat.com
-Signed-off-by: Xu Yilun <yilun.xu@linux.intel.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- Documentation/driver-api/fpga/fpga-region.rst | 13 ++++++----
- drivers/fpga/fpga-region.c | 24 +++++++++++--------
- include/linux/fpga/fpga-region.h | 13 +++++++---
- 3 files changed, 32 insertions(+), 18 deletions(-)
-
-diff --git a/Documentation/driver-api/fpga/fpga-region.rst b/Documentation/driver-api/fpga/fpga-region.rst
-index dc55d60a0b4a5..2d03b5fb76575 100644
---- a/Documentation/driver-api/fpga/fpga-region.rst
-+++ b/Documentation/driver-api/fpga/fpga-region.rst
-@@ -46,13 +46,16 @@ API to add a new FPGA region
- ----------------------------
-
- * struct fpga_region - The FPGA region struct
--* struct fpga_region_info - Parameter structure for fpga_region_register_full()
--* fpga_region_register_full() - Create and register an FPGA region using the
-+* struct fpga_region_info - Parameter structure for __fpga_region_register_full()
-+* __fpga_region_register_full() - Create and register an FPGA region using the
- fpga_region_info structure to provide the full flexibility of options
--* fpga_region_register() - Create and register an FPGA region using standard
-+* __fpga_region_register() - Create and register an FPGA region using standard
- arguments
- * fpga_region_unregister() - Unregister an FPGA region
-
-+Helper macros ``fpga_region_register()`` and ``fpga_region_register_full()``
-+automatically set the module that registers the FPGA region as the owner.
-+
- The FPGA region's probe function will need to get a reference to the FPGA
- Manager it will be using to do the programming. This usually would happen
- during the region's probe function.
-@@ -82,10 +85,10 @@ following APIs to handle building or tearing down that list.
- :functions: fpga_region_info
-
- .. kernel-doc:: drivers/fpga/fpga-region.c
-- :functions: fpga_region_register_full
-+ :functions: __fpga_region_register_full
-
- .. kernel-doc:: drivers/fpga/fpga-region.c
-- :functions: fpga_region_register
-+ :functions: __fpga_region_register
-
- .. kernel-doc:: drivers/fpga/fpga-region.c
- :functions: fpga_region_unregister
-diff --git a/drivers/fpga/fpga-region.c b/drivers/fpga/fpga-region.c
-index b364a929425ce..753cd142503e0 100644
---- a/drivers/fpga/fpga-region.c
-+++ b/drivers/fpga/fpga-region.c
-@@ -53,7 +53,7 @@ static struct fpga_region *fpga_region_get(struct fpga_region *region)
- }
-
- get_device(dev);
-- if (!try_module_get(dev->parent->driver->owner)) {
-+ if (!try_module_get(region->ops_owner)) {
- put_device(dev);
- mutex_unlock(®ion->mutex);
- return ERR_PTR(-ENODEV);
-@@ -75,7 +75,7 @@ static void fpga_region_put(struct fpga_region *region)
-
- dev_dbg(dev, "put\n");
-
-- module_put(dev->parent->driver->owner);
-+ module_put(region->ops_owner);
- put_device(dev);
- mutex_unlock(®ion->mutex);
- }
-@@ -181,14 +181,16 @@ static struct attribute *fpga_region_attrs[] = {
- ATTRIBUTE_GROUPS(fpga_region);
-
- /**
-- * fpga_region_register_full - create and register an FPGA Region device
-+ * __fpga_region_register_full - create and register an FPGA Region device
- * @parent: device parent
- * @info: parameters for FPGA Region
-+ * @owner: module containing the get_bridges function
- *
- * Return: struct fpga_region or ERR_PTR()
- */
- struct fpga_region *
--fpga_region_register_full(struct device *parent, const struct fpga_region_info *info)
-+__fpga_region_register_full(struct device *parent, const struct fpga_region_info *info,
-+ struct module *owner)
- {
- struct fpga_region *region;
- int id, ret = 0;
-@@ -213,6 +215,7 @@ fpga_region_register_full(struct device *parent, const struct fpga_region_info *
- region->compat_id = info->compat_id;
- region->priv = info->priv;
- region->get_bridges = info->get_bridges;
-+ region->ops_owner = owner;
-
- mutex_init(®ion->mutex);
- INIT_LIST_HEAD(®ion->bridge_list);
-@@ -241,13 +244,14 @@ fpga_region_register_full(struct device *parent, const struct fpga_region_info *
-
- return ERR_PTR(ret);
- }
--EXPORT_SYMBOL_GPL(fpga_region_register_full);
-+EXPORT_SYMBOL_GPL(__fpga_region_register_full);
-
- /**
-- * fpga_region_register - create and register an FPGA Region device
-+ * __fpga_region_register - create and register an FPGA Region device
- * @parent: device parent
- * @mgr: manager that programs this region
- * @get_bridges: optional function to get bridges to a list
-+ * @owner: module containing the get_bridges function
- *
- * This simple version of the register function should be sufficient for most users.
- * The fpga_region_register_full() function is available for users that need to
-@@ -256,17 +260,17 @@ EXPORT_SYMBOL_GPL(fpga_region_register_full);
- * Return: struct fpga_region or ERR_PTR()
- */
- struct fpga_region *
--fpga_region_register(struct device *parent, struct fpga_manager *mgr,
-- int (*get_bridges)(struct fpga_region *))
-+__fpga_region_register(struct device *parent, struct fpga_manager *mgr,
-+ int (*get_bridges)(struct fpga_region *), struct module *owner)
- {
- struct fpga_region_info info = { 0 };
-
- info.mgr = mgr;
- info.get_bridges = get_bridges;
-
-- return fpga_region_register_full(parent, &info);
-+ return __fpga_region_register_full(parent, &info, owner);
- }
--EXPORT_SYMBOL_GPL(fpga_region_register);
-+EXPORT_SYMBOL_GPL(__fpga_region_register);
-
- /**
- * fpga_region_unregister - unregister an FPGA region
-diff --git a/include/linux/fpga/fpga-region.h b/include/linux/fpga/fpga-region.h
-index 9d4d32909340a..5fbc05fe70a6b 100644
---- a/include/linux/fpga/fpga-region.h
-+++ b/include/linux/fpga/fpga-region.h
-@@ -36,6 +36,7 @@ struct fpga_region_info {
- * @mgr: FPGA manager
- * @info: FPGA image info
- * @compat_id: FPGA region id for compatibility check.
-+ * @ops_owner: module containing the get_bridges function
- * @priv: private data
- * @get_bridges: optional function to get bridges to a list
- */
-@@ -46,6 +47,7 @@ struct fpga_region {
- struct fpga_manager *mgr;
- struct fpga_image_info *info;
- struct fpga_compat_id *compat_id;
-+ struct module *ops_owner;
- void *priv;
- int (*get_bridges)(struct fpga_region *region);
- };
-@@ -58,12 +60,17 @@ fpga_region_class_find(struct device *start, const void *data,
-
- int fpga_region_program_fpga(struct fpga_region *region);
-
-+#define fpga_region_register_full(parent, info) \
-+ __fpga_region_register_full(parent, info, THIS_MODULE)
- struct fpga_region *
--fpga_region_register_full(struct device *parent, const struct fpga_region_info *info);
-+__fpga_region_register_full(struct device *parent, const struct fpga_region_info *info,
-+ struct module *owner);
-
-+#define fpga_region_register(parent, mgr, get_bridges) \
-+ __fpga_region_register(parent, mgr, get_bridges, THIS_MODULE)
- struct fpga_region *
--fpga_region_register(struct device *parent, struct fpga_manager *mgr,
-- int (*get_bridges)(struct fpga_region *));
-+__fpga_region_register(struct device *parent, struct fpga_manager *mgr,
-+ int (*get_bridges)(struct fpga_region *), struct module *owner);
- void fpga_region_unregister(struct fpga_region *region);
-
- #endif /* _FPGA_REGION_H */
---
-2.43.0
-
+++ /dev/null
-From 1d95b511678b4a776b7367ea23f6d99ae0c4da75 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 16 Apr 2024 09:54:34 +0300
-Subject: fs/ntfs3: Check 'folio' pointer for NULL
-
-From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
-
-[ Upstream commit 1cd6c96219c429ebcfa8e79a865277376c563803 ]
-
-It can be NULL if bmap is called.
-
-Fixes: 82cae269cfa95 ("fs/ntfs3: Add initialization of super block")
-Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/ntfs3/inode.c | 17 +++++++++++------
- 1 file changed, 11 insertions(+), 6 deletions(-)
-
-diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
-index 05f169018c4e9..502a527e51cd1 100644
---- a/fs/ntfs3/inode.c
-+++ b/fs/ntfs3/inode.c
-@@ -571,13 +571,18 @@ static noinline int ntfs_get_block_vbo(struct inode *inode, u64 vbo,
- clear_buffer_uptodate(bh);
-
- if (is_resident(ni)) {
-- ni_lock(ni);
-- err = attr_data_read_resident(ni, &folio->page);
-- ni_unlock(ni);
--
-- if (!err)
-- set_buffer_uptodate(bh);
-+ bh->b_blocknr = RESIDENT_LCN;
- bh->b_size = block_size;
-+ if (!folio) {
-+ err = 0;
-+ } else {
-+ ni_lock(ni);
-+ err = attr_data_read_resident(ni, &folio->page);
-+ ni_unlock(ni);
-+
-+ if (!err)
-+ set_buffer_uptodate(bh);
-+ }
- return err;
- }
-
---
-2.43.0
-
+++ /dev/null
-From 3a876e309278fe506ed878c3784858be1db9183a Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 16 Apr 2024 09:45:09 +0300
-Subject: fs/ntfs3: Use 64 bit variable to avoid 32 bit overflow
-
-From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
-
-[ Upstream commit e931f6b630ffb22d66caab202a52aa8cbb10c649 ]
-
-For example, in the expression:
- vbo = 2 * vbo + skip
-
-Fixes: b46acd6a6a627 ("fs/ntfs3: Add NTFS journal")
-Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/ntfs3/fslog.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c
-index 855519713bf79..4085fe30bf481 100644
---- a/fs/ntfs3/fslog.c
-+++ b/fs/ntfs3/fslog.c
-@@ -1184,7 +1184,8 @@ static int read_log_page(struct ntfs_log *log, u32 vbo,
- static int log_read_rst(struct ntfs_log *log, bool first,
- struct restart_info *info)
- {
-- u32 skip, vbo;
-+ u32 skip;
-+ u64 vbo;
- struct RESTART_HDR *r_page = NULL;
-
- /* Determine which restart area we are looking for. */
---
-2.43.0
-
+++ /dev/null
-From c3ed4026c7d1a0a40fde1e955633efaf772731a3 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 16 Apr 2024 09:43:58 +0300
-Subject: fs/ntfs3: Use variable length array instead of fixed size
-
-From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
-
-[ Upstream commit 1997cdc3e727526aa5d84b32f7cbb3f56459b7ef ]
-
-Should fix smatch warning:
- ntfs_set_label() error: __builtin_memcpy() 'uni->name' too small (20 vs 256)
-
-Fixes: 4534a70b7056f ("fs/ntfs3: Add headers and misc files")
-Reported-by: kernel test robot <lkp@intel.com>
-Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
-Closes: https://lore.kernel.org/r/202401091421.3RJ24Mn3-lkp@intel.com/
-Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/ntfs3/ntfs.h | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/fs/ntfs3/ntfs.h b/fs/ntfs3/ntfs.h
-index 9c7478150a035..3d6143c7abc03 100644
---- a/fs/ntfs3/ntfs.h
-+++ b/fs/ntfs3/ntfs.h
-@@ -59,7 +59,7 @@ struct GUID {
- struct cpu_str {
- u8 len;
- u8 unused;
-- u16 name[10];
-+ u16 name[];
- };
-
- struct le_str {
---
-2.43.0
-
+++ /dev/null
-From 201d6e16ca1902df45f21bb3669ec40dcbd5aa39 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 13 May 2024 15:59:01 +0800
-Subject: gpiolib: acpi: Fix failed in acpi_gpiochip_find() by adding parent
- node match
-
-From: Devyn Liu <liudingyuan@huawei.com>
-
-[ Upstream commit adbc49a5a8c6fcf7be154c2e30213bbf472940da ]
-
-Previous patch modified the standard used by acpi_gpiochip_find()
-to match device nodes. Using the device node set in gc->gpiodev->d-
-ev instead of gc->parent.
-
-However, there is a situation in gpio-dwapb where the GPIO device
-driver will set gc->fwnode for each port corresponding to a child
-node under a GPIO device, so gc->gpiodev->dev will be assigned the
-value of each child node in gpiochip_add_data().
-
-gpio-dwapb.c:
-128,31 static int dwapb_gpio_add_port(struct dwapb_gpio *gpio,
- struct dwapb_port_property *pp,
- unsigned int offs);
-port->gc.fwnode = pp->fwnode;
-
-693,39 static int dwapb_gpio_probe;
-err = dwapb_gpio_add_port(gpio, &pdata->properties[i], i);
-
-When other drivers request GPIO pin resources through the GPIO device
-node provided by ACPI (corresponding to the parent node), the change
-of the matching object to gc->gpiodev->dev in acpi_gpiochip_find()
-only allows finding the value of each port (child node), resulting
-in a failed request.
-
-Reapply the condition of using gc->parent for match in acpi_gpio-
-chip_find() in the code can compatible with the problem of gpio-dwapb,
-and will not affect the two cases mentioned in the patch:
-1. There is no setting for gc->fwnode.
-2. The case that depends on using gc->fwnode for match.
-
-Fixes: 5062e4c14b75 ("gpiolib: acpi: use the fwnode in acpi_gpiochip_find()")
-Fixes: 067dbc1ea5ce ("gpiolib: acpi: Don't use GPIO chip fwnode in acpi_gpiochip_find()")
-Signed-off-by: Devyn Liu <liudingyuan@huawei.com>
-Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
-Tested-by: Benjamin Tissoires <bentiss@kernel.org>
-Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpio/gpiolib-acpi.c | 19 ++++++++++++++++++-
- 1 file changed, 18 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
-index cd3e9657cc36d..551b604903e14 100644
---- a/drivers/gpio/gpiolib-acpi.c
-+++ b/drivers/gpio/gpiolib-acpi.c
-@@ -128,7 +128,24 @@ static bool acpi_gpio_deferred_req_irqs_done;
-
- static int acpi_gpiochip_find(struct gpio_chip *gc, void *data)
- {
-- return device_match_acpi_handle(&gc->gpiodev->dev, data);
-+ /* First check the actual GPIO device */
-+ if (device_match_acpi_handle(&gc->gpiodev->dev, data))
-+ return true;
-+
-+ /*
-+ * When the ACPI device is artificially split to the banks of GPIOs,
-+ * where each of them is represented by a separate GPIO device,
-+ * the firmware node of the physical device may not be shared among
-+ * the banks as they may require different values for the same property,
-+ * e.g., number of GPIOs in a certain bank. In such case the ACPI handle
-+ * of a GPIO device is NULL and can not be used. Hence we have to check
-+ * the parent device to be sure that there is no match before bailing
-+ * out.
-+ */
-+ if (gc->parent)
-+ return device_match_acpi_handle(gc->parent, data);
-+
-+ return false;
- }
-
- /**
---
-2.43.0
-
+++ /dev/null
-From 842e5c47e09a65f3044958a75d9ce9c0bc79274a Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 3 Apr 2024 10:06:35 +0200
-Subject: greybus: arche-ctrl: move device table to its right location
-
-From: Arnd Bergmann <arnd@arndb.de>
-
-[ Upstream commit 6a0b8c0da8d8d418cde6894a104cf74e6098ddfa ]
-
-The arche-ctrl has two platform drivers and three of_device_id tables,
-but one table is only used for the the module loader, while the other
-two seem to be associated with their drivers.
-
-This leads to a W=1 warning when the driver is built-in:
-
-drivers/staging/greybus/arche-platform.c:623:34: error: 'arche_combined_id' defined but not used [-Werror=unused-const-variable=]
- 623 | static const struct of_device_id arche_combined_id[] = {
-
-Drop the extra table and register both tables that are actually
-used as the ones for the module loader instead.
-
-Fixes: 7b62b61c752a ("greybus: arche-ctrl: Don't expose driver internals to arche-platform driver")
-Signed-off-by: Arnd Bergmann <arnd@arndb.de>
-Link: https://lore.kernel.org/r/20240403080702.3509288-18-arnd@kernel.org
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/staging/greybus/arche-apb-ctrl.c | 1 +
- drivers/staging/greybus/arche-platform.c | 9 +--------
- 2 files changed, 2 insertions(+), 8 deletions(-)
-
-diff --git a/drivers/staging/greybus/arche-apb-ctrl.c b/drivers/staging/greybus/arche-apb-ctrl.c
-index 8541995008da8..aa6f266b62a14 100644
---- a/drivers/staging/greybus/arche-apb-ctrl.c
-+++ b/drivers/staging/greybus/arche-apb-ctrl.c
-@@ -466,6 +466,7 @@ static const struct of_device_id arche_apb_ctrl_of_match[] = {
- { .compatible = "usbffff,2", },
- { },
- };
-+MODULE_DEVICE_TABLE(of, arche_apb_ctrl_of_match);
-
- static struct platform_driver arche_apb_ctrl_device_driver = {
- .probe = arche_apb_ctrl_probe,
-diff --git a/drivers/staging/greybus/arche-platform.c b/drivers/staging/greybus/arche-platform.c
-index 891b75327d7f7..b33977ccd5271 100644
---- a/drivers/staging/greybus/arche-platform.c
-+++ b/drivers/staging/greybus/arche-platform.c
-@@ -619,14 +619,7 @@ static const struct of_device_id arche_platform_of_match[] = {
- { .compatible = "google,arche-platform", },
- { },
- };
--
--static const struct of_device_id arche_combined_id[] = {
-- /* Use PID/VID of SVC device */
-- { .compatible = "google,arche-platform", },
-- { .compatible = "usbffff,2", },
-- { },
--};
--MODULE_DEVICE_TABLE(of, arche_combined_id);
-+MODULE_DEVICE_TABLE(of, arche_platform_of_match);
-
- static struct platform_driver arche_platform_device_driver = {
- .probe = arche_platform_probe,
---
-2.43.0
-
+++ /dev/null
-From 27cde0cdadc5b0cb91660fb5b2506bd4c539aaab Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 25 Mar 2024 22:09:55 +0000
-Subject: greybus: lights: check return of get_channel_from_mode
-
-From: Rui Miguel Silva <rmfrfs@gmail.com>
-
-[ Upstream commit a1ba19a1ae7cd1e324685ded4ab563e78fe68648 ]
-
-If channel for the given node is not found we return null from
-get_channel_from_mode. Make sure we validate the return pointer
-before using it in two of the missing places.
-
-This was originally reported in [0]:
-Found by Linux Verification Center (linuxtesting.org) with SVACE.
-
-[0] https://lore.kernel.org/all/20240301190425.120605-1-m.lobanov@rosalinux.ru
-
-Fixes: 2870b52bae4c ("greybus: lights: add lights implementation")
-Reported-by: Mikhail Lobanov <m.lobanov@rosalinux.ru>
-Suggested-by: Mikhail Lobanov <m.lobanov@rosalinux.ru>
-Suggested-by: Alex Elder <elder@ieee.org>
-Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
-Link: https://lore.kernel.org/r/20240325221549.2185265-1-rmfrfs@gmail.com
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/staging/greybus/light.c | 8 +++++++-
- 1 file changed, 7 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c
-index c6bd86a5335ab..9999f84016992 100644
---- a/drivers/staging/greybus/light.c
-+++ b/drivers/staging/greybus/light.c
-@@ -147,6 +147,9 @@ static int __gb_lights_flash_brightness_set(struct gb_channel *channel)
- channel = get_channel_from_mode(channel->light,
- GB_CHANNEL_MODE_TORCH);
-
-+ if (!channel)
-+ return -EINVAL;
-+
- /* For not flash we need to convert brightness to intensity */
- intensity = channel->intensity_uA.min +
- (channel->intensity_uA.step * channel->led->brightness);
-@@ -549,7 +552,10 @@ static int gb_lights_light_v4l2_register(struct gb_light *light)
- }
-
- channel_flash = get_channel_from_mode(light, GB_CHANNEL_MODE_FLASH);
-- WARN_ON(!channel_flash);
-+ if (!channel_flash) {
-+ dev_err(dev, "failed to get flash channel from mode\n");
-+ return -EINVAL;
-+ }
-
- fled = &channel_flash->fled;
-
---
-2.43.0
-
+++ /dev/null
-From a80a1bd8f5d0be32b830902f159caf45f057ed91 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 21 May 2024 14:12:46 -0400
-Subject: hwmon: (intel-m10-bmc-hwmon) Fix multiplier for N6000 board power
- sensor
-
-From: Peter Colberg <peter.colberg@intel.com>
-
-[ Upstream commit 027a44fedd55fbdf1d45603894634acd960ad04b ]
-
-The Intel N6000 BMC outputs the board power value in milliwatt, whereas
-the hwmon sysfs interface must provide power values in microwatt.
-
-Fixes: e1983220ae14 ("hwmon: intel-m10-bmc-hwmon: Add N6000 sensors")
-Signed-off-by: Peter Colberg <peter.colberg@intel.com>
-Reviewed-by: Matthew Gerlach <matthew.gerlach@linux.intel.com>
-Link: https://lore.kernel.org/r/20240521181246.683833-1-peter.colberg@intel.com
-Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/hwmon/intel-m10-bmc-hwmon.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/hwmon/intel-m10-bmc-hwmon.c b/drivers/hwmon/intel-m10-bmc-hwmon.c
-index 6500ca548f9c7..ca2dff1589251 100644
---- a/drivers/hwmon/intel-m10-bmc-hwmon.c
-+++ b/drivers/hwmon/intel-m10-bmc-hwmon.c
-@@ -429,7 +429,7 @@ static const struct m10bmc_sdata n6000bmc_curr_tbl[] = {
- };
-
- static const struct m10bmc_sdata n6000bmc_power_tbl[] = {
-- { 0x724, 0x0, 0x0, 0x0, 0x0, 1, "Board Power" },
-+ { 0x724, 0x0, 0x0, 0x0, 0x0, 1000, "Board Power" },
- };
-
- static const struct hwmon_channel_info * const n6000bmc_hinfo[] = {
---
-2.43.0
-
+++ /dev/null
-From 59641bdcbc62dc0916f431477e10a0ae38289199 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 30 May 2024 08:20:14 -0700
-Subject: hwmon: (shtc1) Fix property misspelling
-
-From: Guenter Roeck <linux@roeck-us.net>
-
-[ Upstream commit 52a2c70c3ec555e670a34dd1ab958986451d2dd2 ]
-
-The property name is "sensirion,low-precision", not
-"sensicon,low-precision".
-
-Cc: Chris Ruehl <chris.ruehl@gtsys.com.hk>
-Fixes: be7373b60df5 ("hwmon: shtc1: add support for device tree bindings")
-Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/hwmon/shtc1.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/hwmon/shtc1.c b/drivers/hwmon/shtc1.c
-index 1f96e94967ee8..439dd3dba5fc8 100644
---- a/drivers/hwmon/shtc1.c
-+++ b/drivers/hwmon/shtc1.c
-@@ -238,7 +238,7 @@ static int shtc1_probe(struct i2c_client *client)
-
- if (np) {
- data->setup.blocking_io = of_property_read_bool(np, "sensirion,blocking-io");
-- data->setup.high_precision = !of_property_read_bool(np, "sensicon,low-precision");
-+ data->setup.high_precision = !of_property_read_bool(np, "sensirion,low-precision");
- } else {
- if (client->dev.platform_data)
- data->setup = *(struct shtc1_platform_data *)dev->platform_data;
---
-2.43.0
-
+++ /dev/null
-From abbfa6ff114dcafc4f73e3c4872b3761080e6496 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 3 May 2024 15:12:08 +0530
-Subject: i2c: cadence: Avoid fifo clear after start
-
-From: Sai Pavan Boddu <sai.pavan.boddu@amd.com>
-
-[ Upstream commit c2e55b449de7298a751ed0256251019d302af453 ]
-
-The Driver unintentionally programs ctrl reg to clear the fifo, which
-happens after the start of transaction. Previously, this was not an issue
-as it involved read-modified-write. However, this issue breaks i2c reads
-on QEMU, as i2c-read is executed before guest starts programming control
-register.
-
-Fixes: ff0cf7bca630 ("i2c: cadence: Remove unnecessary register reads")
-Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@amd.com>
-Acked-by: Michal Simek <michal.simek@amd.com>
-Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/i2c/busses/i2c-cadence.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c
-index de3f58b60dce5..6f7d753a8197c 100644
---- a/drivers/i2c/busses/i2c-cadence.c
-+++ b/drivers/i2c/busses/i2c-cadence.c
-@@ -633,6 +633,7 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id)
-
- if (hold_clear) {
- ctrl_reg &= ~CDNS_I2C_CR_HOLD;
-+ ctrl_reg &= ~CDNS_I2C_CR_CLR_FIFO;
- /*
- * In case of Xilinx Zynq SOC, clear the HOLD bit before transfer size
- * register reaches '0'. This is an IP bug which causes transfer size
---
-2.43.0
-
+++ /dev/null
-From 0cc02bc8e603bfd57c1d9fd2074e3f66a7c8e4ea Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 6 Jan 2024 13:48:24 +0100
-Subject: i2c: synquacer: Fix an error handling path in synquacer_i2c_probe()
-
-From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
-
-[ Upstream commit 55750148e5595bb85605e8fbb40b2759c2c4c2d7 ]
-
-If an error occurs after the clk_prepare_enable() call, it should be undone
-by a corresponding clk_disable_unprepare() call, as already done in the
-remove() function.
-
-As devm_clk_get() is used, we can switch to devm_clk_get_enabled() to
-handle it automatically and fix the probe.
-
-Update the remove() function accordingly and remove the now useless
-clk_disable_unprepare() call.
-
-Fixes: 0d676a6c4390 ("i2c: add support for Socionext SynQuacer I2C controller")
-Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
-Acked-by: Ard Biesheuvel <ardb@kernel.org>
-Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/i2c/busses/i2c-synquacer.c | 20 +++++++-------------
- 1 file changed, 7 insertions(+), 13 deletions(-)
-
-diff --git a/drivers/i2c/busses/i2c-synquacer.c b/drivers/i2c/busses/i2c-synquacer.c
-index bbea521b05dda..a73f5bb9a1645 100644
---- a/drivers/i2c/busses/i2c-synquacer.c
-+++ b/drivers/i2c/busses/i2c-synquacer.c
-@@ -550,17 +550,13 @@ static int synquacer_i2c_probe(struct platform_device *pdev)
- device_property_read_u32(&pdev->dev, "socionext,pclk-rate",
- &i2c->pclkrate);
-
-- i2c->pclk = devm_clk_get(&pdev->dev, "pclk");
-- if (PTR_ERR(i2c->pclk) == -EPROBE_DEFER)
-- return -EPROBE_DEFER;
-- if (!IS_ERR_OR_NULL(i2c->pclk)) {
-- dev_dbg(&pdev->dev, "clock source %p\n", i2c->pclk);
--
-- ret = clk_prepare_enable(i2c->pclk);
-- if (ret)
-- return dev_err_probe(&pdev->dev, ret, "failed to enable clock\n");
-- i2c->pclkrate = clk_get_rate(i2c->pclk);
-- }
-+ i2c->pclk = devm_clk_get_enabled(&pdev->dev, "pclk");
-+ if (IS_ERR(i2c->pclk))
-+ return dev_err_probe(&pdev->dev, PTR_ERR(i2c->pclk),
-+ "failed to get and enable clock\n");
-+
-+ dev_dbg(&pdev->dev, "clock source %p\n", i2c->pclk);
-+ i2c->pclkrate = clk_get_rate(i2c->pclk);
-
- if (i2c->pclkrate < SYNQUACER_I2C_MIN_CLK_RATE ||
- i2c->pclkrate > SYNQUACER_I2C_MAX_CLK_RATE)
-@@ -615,8 +611,6 @@ static void synquacer_i2c_remove(struct platform_device *pdev)
- struct synquacer_i2c *i2c = platform_get_drvdata(pdev);
-
- i2c_del_adapter(&i2c->adapter);
-- if (!IS_ERR(i2c->pclk))
-- clk_disable_unprepare(i2c->pclk);
- };
-
- static const struct of_device_id synquacer_i2c_dt_ids[] __maybe_unused = {
---
-2.43.0
-
+++ /dev/null
-From 88d14e55e30b02a8f08b6bf87a0c5557aa66a994 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 6 May 2024 12:40:08 -0400
-Subject: i3c: master: svc: change ENXIO to EAGAIN when IBI occurs during start
- frame
-
-From: Frank Li <Frank.Li@nxp.com>
-
-[ Upstream commit 7f3d633b460be5553a65a247def5426d16805e72 ]
-
-svc_i3c_master_xfer() returns error ENXIO if an In-Band Interrupt (IBI)
-occurs when the host starts the frame.
-
-Change error code to EAGAIN to inform the client driver that this
-situation has occurred and to try again sometime later.
-
-Fixes: 5e5e3c92e748 ("i3c: master: svc: fix wrong data return when IBI happen during start frame")
-Signed-off-by: Frank Li <Frank.Li@nxp.com>
-Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
-Link: https://lore.kernel.org/r/20240506164009.21375-2-Frank.Li@nxp.com
-Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/i3c/master/svc-i3c-master.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
-index 5ee4db68988e2..a2298ab460a37 100644
---- a/drivers/i3c/master/svc-i3c-master.c
-+++ b/drivers/i3c/master/svc-i3c-master.c
-@@ -1080,7 +1080,7 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master,
- * and yield the above events handler.
- */
- if (SVC_I3C_MSTATUS_IBIWON(reg)) {
-- ret = -ENXIO;
-+ ret = -EAGAIN;
- *actual_len = 0;
- goto emit_stop;
- }
---
-2.43.0
-
+++ /dev/null
-From 5f9f3dac875f2cae8ad5a08d5f5ac1dbdf9b5f29 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 28 May 2024 15:06:08 -0700
-Subject: ice: fix 200G PHY types to link speed mapping
-
-From: Paul Greenwalt <paul.greenwalt@intel.com>
-
-[ Upstream commit 2a6d8f2de2224ac46df94dc40f43f8b9701f6703 ]
-
-Commit 24407a01e57c ("ice: Add 200G speed/phy type use") added support
-for 200G PHY speeds, but did not include the mapping of 200G PHY types
-to link speed. As a result the driver is returning UNKNOWN link speed
-when setting 200G ethtool advertised link modes.
-
-To fix this add 200G PHY types to link speed mapping to
-ice_get_link_speed_based_on_phy_type().
-
-Fixes: 24407a01e57c ("ice: Add 200G speed/phy type use")
-Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
-Signed-off-by: Paul Greenwalt <paul.greenwalt@intel.com>
-Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com>
-Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
-Link: https://lore.kernel.org/r/20240528-net-2024-05-28-intel-net-fixes-v1-5-dc8593d2bbc6@intel.com
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/ethernet/intel/ice/ice_common.c | 10 ++++++++++
- 1 file changed, 10 insertions(+)
-
-diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c
-index ce50a322daa91..3017e7c4423b9 100644
---- a/drivers/net/ethernet/intel/ice/ice_common.c
-+++ b/drivers/net/ethernet/intel/ice/ice_common.c
-@@ -3103,6 +3103,16 @@ ice_get_link_speed_based_on_phy_type(u64 phy_type_low, u64 phy_type_high)
- case ICE_PHY_TYPE_HIGH_100G_AUI2:
- speed_phy_type_high = ICE_AQ_LINK_SPEED_100GB;
- break;
-+ case ICE_PHY_TYPE_HIGH_200G_CR4_PAM4:
-+ case ICE_PHY_TYPE_HIGH_200G_SR4:
-+ case ICE_PHY_TYPE_HIGH_200G_FR4:
-+ case ICE_PHY_TYPE_HIGH_200G_LR4:
-+ case ICE_PHY_TYPE_HIGH_200G_DR4:
-+ case ICE_PHY_TYPE_HIGH_200G_KR4_PAM4:
-+ case ICE_PHY_TYPE_HIGH_200G_AUI4_AOC_ACC:
-+ case ICE_PHY_TYPE_HIGH_200G_AUI4:
-+ speed_phy_type_high = ICE_AQ_LINK_SPEED_200GB;
-+ break;
- default:
- speed_phy_type_high = ICE_AQ_LINK_SPEED_UNKNOWN;
- break;
---
-2.43.0
-
+++ /dev/null
-From 623a231f07ce8203ca96aff87b0ba5c0436f2fe3 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 23 May 2024 10:45:30 -0700
-Subject: ice: fix accounting if a VLAN already exists
-
-From: Jacob Keller <jacob.e.keller@intel.com>
-
-[ Upstream commit 82617b9a04649e83ee8731918aeadbb6e6d7cbc7 ]
-
-The ice_vsi_add_vlan() function is used to add a VLAN filter for the target
-VSI. This function prepares a filter in the switch table for the given VSI.
-If it succeeds, the vsi->num_vlan counter is incremented.
-
-It is not considered an error to add a VLAN which already exists in the
-switch table, so the function explicitly checks and ignores -EEXIST. The
-vsi->num_vlan counter is still incremented.
-
-This seems incorrect, as it means we can double-count in the case where the
-same VLAN is added twice by the caller. The actual table will have one less
-filter than the count.
-
-The ice_vsi_del_vlan() function similarly checks and handles the -ENOENT
-condition for when deleting a filter that doesn't exist. This flow only
-decrements the vsi->num_vlan if it actually deleted a filter.
-
-The vsi->num_vlan counter is used only in a few places, primarily related
-to tracking the number of non-zero VLANs. If the vsi->num_vlans gets out of
-sync, then ice_vsi_num_non_zero_vlans() will incorrectly report more VLANs
-than are present, and ice_vsi_has_non_zero_vlans() could return true
-potentially in cases where there are only VLAN 0 filters left.
-
-Fix this by only incrementing the vsi->num_vlan in the case where we
-actually added an entry, and not in the case where the entry already
-existed.
-
-Fixes: a1ffafb0b4a4 ("ice: Support configuring the device to Double VLAN Mode")
-Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
-Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com>
-Reviewed-by: Simon Horman <horms@kernel.org>
-Link: https://lore.kernel.org/r/20240523-net-2024-05-23-intel-net-fixes-v1-2-17a923e0bb5f@intel.com
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c | 11 ++++++-----
- 1 file changed, 6 insertions(+), 5 deletions(-)
-
-diff --git a/drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c b/drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c
-index 2e9ad27cb9d13..6e8f2aab60801 100644
---- a/drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c
-+++ b/drivers/net/ethernet/intel/ice/ice_vsi_vlan_lib.c
-@@ -45,14 +45,15 @@ int ice_vsi_add_vlan(struct ice_vsi *vsi, struct ice_vlan *vlan)
- return -EINVAL;
-
- err = ice_fltr_add_vlan(vsi, vlan);
-- if (err && err != -EEXIST) {
-+ if (!err)
-+ vsi->num_vlan++;
-+ else if (err == -EEXIST)
-+ err = 0;
-+ else
- dev_err(ice_pf_to_dev(vsi->back), "Failure Adding VLAN %d on VSI %i, status %d\n",
- vlan->vid, vsi->vsi_num, err);
-- return err;
-- }
-
-- vsi->num_vlan++;
-- return 0;
-+ return err;
- }
-
- /**
---
-2.43.0
-
+++ /dev/null
-From 17408d721faa72c3efef5cfef53dc002c72c6703 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 21 May 2024 12:39:53 -0700
-Subject: ice: Interpret .set_channels() input differently
-
-From: Larysa Zaremba <larysa.zaremba@intel.com>
-
-[ Upstream commit 05d6f442f31f901d27dbc64fd504a8ec7d5013de ]
-
-A bug occurs because a safety check guarding AF_XDP-related queues in
-ethnl_set_channels(), does not trigger. This happens, because kernel and
-ice driver interpret the ethtool command differently.
-
-How the bug occurs:
-1. ethtool -l <IFNAME> -> combined: 40
-2. Attach AF_XDP to queue 30
-3. ethtool -L <IFNAME> rx 15 tx 15
- combined number is not specified, so command becomes {rx_count = 15,
- tx_count = 15, combined_count = 40}.
-4. ethnl_set_channels checks, if there are any AF_XDP of queues from the
- new (combined_count + rx_count) to the old one, so from 55 to 40, check
- does not trigger.
-5. ice interprets `rx 15 tx 15` as 15 combined channels and deletes the
- queue that AF_XDP is attached to.
-
-Interpret the command in a way that is more consistent with ethtool
-manual [0] (--show-channels and --set-channels).
-
-Considering that in the ice driver only the difference between RX and TX
-queues forms dedicated channels, change the correct way to set number of
-channels to:
-
-ethtool -L <IFNAME> combined 10 /* For symmetric queues */
-ethtool -L <IFNAME> combined 8 tx 2 rx 0 /* For asymmetric queues */
-
-[0] https://man7.org/linux/man-pages/man8/ethtool.8.html
-
-Fixes: 87324e747fde ("ice: Implement ethtool ops for channels")
-Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
-Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
-Tested-by: Chandan Kumar Rout <chandanx.rout@intel.com>
-Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com>
-Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
-Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/ethernet/intel/ice/ice_ethtool.c | 19 ++-----------------
- 1 file changed, 2 insertions(+), 17 deletions(-)
-
-diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
-index a19b06f18e400..eb604ed3b6cbb 100644
---- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
-+++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
-@@ -3514,7 +3514,6 @@ static int ice_set_channels(struct net_device *dev, struct ethtool_channels *ch)
- struct ice_pf *pf = vsi->back;
- int new_rx = 0, new_tx = 0;
- bool locked = false;
-- u32 curr_combined;
- int ret = 0;
-
- /* do not support changing channels in Safe Mode */
-@@ -3536,22 +3535,8 @@ static int ice_set_channels(struct net_device *dev, struct ethtool_channels *ch)
- return -EOPNOTSUPP;
- }
-
-- curr_combined = ice_get_combined_cnt(vsi);
--
-- /* these checks are for cases where user didn't specify a particular
-- * value on cmd line but we get non-zero value anyway via
-- * get_channels(); look at ethtool.c in ethtool repository (the user
-- * space part), particularly, do_schannels() routine
-- */
-- if (ch->rx_count == vsi->num_rxq - curr_combined)
-- ch->rx_count = 0;
-- if (ch->tx_count == vsi->num_txq - curr_combined)
-- ch->tx_count = 0;
-- if (ch->combined_count == curr_combined)
-- ch->combined_count = 0;
--
-- if (!(ch->combined_count || (ch->rx_count && ch->tx_count))) {
-- netdev_err(dev, "Please specify at least 1 Rx and 1 Tx channel\n");
-+ if (ch->rx_count && ch->tx_count) {
-+ netdev_err(dev, "Dedicated RX or TX channels cannot be used simultaneously\n");
- return -EINVAL;
- }
-
---
-2.43.0
-
+++ /dev/null
-From 55daf032467f31eddec14aab29fa133851438be7 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 23 May 2024 10:45:29 -0700
-Subject: idpf: don't enable NAPI and interrupts prior to allocating Rx buffers
-
-From: Alexander Lobakin <aleksander.lobakin@intel.com>
-
-[ Upstream commit d514c8b54209de7a95ab37259fe32c7406976bd9 ]
-
-Currently, idpf enables NAPI and interrupts prior to allocating Rx
-buffers.
-This may lead to frame loss (there are no buffers to place incoming
-frames) and even crashes on quick ifup-ifdown. Interrupts must be
-enabled only after all the resources are here and available.
-Split interrupt init into two phases: initialization and enabling,
-and perform the second only after the queues are fully initialized.
-Note that we can't just move interrupt initialization down the init
-process, as the queues must have correct a ::q_vector pointer set
-and NAPI already added in order to allocate buffers correctly.
-Also, during the deinit process, disable HW interrupts first and
-only then disable NAPI. Otherwise, there can be a HW event leading
-to napi_schedule(), but the NAPI will already be unavailable.
-
-Fixes: d4d558718266 ("idpf: initialize interrupts and enable vport")
-Reported-by: Michal Kubiak <michal.kubiak@intel.com>
-Reviewed-by: Wojciech Drewek <wojciech.drewek@intel.com>
-Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
-Reviewed-by: Simon Horman <horms@kernel.org>
-Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
-Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
-Link: https://lore.kernel.org/r/20240523-net-2024-05-23-intel-net-fixes-v1-1-17a923e0bb5f@intel.com
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/ethernet/intel/idpf/idpf_lib.c | 1 +
- drivers/net/ethernet/intel/idpf/idpf_txrx.c | 12 +++++++-----
- drivers/net/ethernet/intel/idpf/idpf_txrx.h | 1 +
- 3 files changed, 9 insertions(+), 5 deletions(-)
-
-diff --git a/drivers/net/ethernet/intel/idpf/idpf_lib.c b/drivers/net/ethernet/intel/idpf/idpf_lib.c
-index 58179bd733ff0..f769a9fc1084c 100644
---- a/drivers/net/ethernet/intel/idpf/idpf_lib.c
-+++ b/drivers/net/ethernet/intel/idpf/idpf_lib.c
-@@ -1419,6 +1419,7 @@ static int idpf_vport_open(struct idpf_vport *vport, bool alloc_res)
- }
-
- idpf_rx_init_buf_tail(vport);
-+ idpf_vport_intr_ena(vport);
-
- err = idpf_send_config_queues_msg(vport);
- if (err) {
-diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
-index 017a081d85802..b16fa9d8a8c58 100644
---- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c
-+++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
-@@ -3746,9 +3746,9 @@ static void idpf_vport_intr_ena_irq_all(struct idpf_vport *vport)
- */
- void idpf_vport_intr_deinit(struct idpf_vport *vport)
- {
-+ idpf_vport_intr_dis_irq_all(vport);
- idpf_vport_intr_napi_dis_all(vport);
- idpf_vport_intr_napi_del_all(vport);
-- idpf_vport_intr_dis_irq_all(vport);
- idpf_vport_intr_rel_irq(vport);
- }
-
-@@ -4179,7 +4179,6 @@ int idpf_vport_intr_init(struct idpf_vport *vport)
-
- idpf_vport_intr_map_vector_to_qs(vport);
- idpf_vport_intr_napi_add_all(vport);
-- idpf_vport_intr_napi_ena_all(vport);
-
- err = vport->adapter->dev_ops.reg_ops.intr_reg_init(vport);
- if (err)
-@@ -4193,17 +4192,20 @@ int idpf_vport_intr_init(struct idpf_vport *vport)
- if (err)
- goto unroll_vectors_alloc;
-
-- idpf_vport_intr_ena_irq_all(vport);
--
- return 0;
-
- unroll_vectors_alloc:
-- idpf_vport_intr_napi_dis_all(vport);
- idpf_vport_intr_napi_del_all(vport);
-
- return err;
- }
-
-+void idpf_vport_intr_ena(struct idpf_vport *vport)
-+{
-+ idpf_vport_intr_napi_ena_all(vport);
-+ idpf_vport_intr_ena_irq_all(vport);
-+}
-+
- /**
- * idpf_config_rss - Send virtchnl messages to configure RSS
- * @vport: virtual port
-diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.h b/drivers/net/ethernet/intel/idpf/idpf_txrx.h
-index df76493faa756..85a1466890d43 100644
---- a/drivers/net/ethernet/intel/idpf/idpf_txrx.h
-+++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.h
-@@ -988,6 +988,7 @@ int idpf_vport_intr_alloc(struct idpf_vport *vport);
- void idpf_vport_intr_update_itr_ena_irq(struct idpf_q_vector *q_vector);
- void idpf_vport_intr_deinit(struct idpf_vport *vport);
- int idpf_vport_intr_init(struct idpf_vport *vport);
-+void idpf_vport_intr_ena(struct idpf_vport *vport);
- enum pkt_hash_types idpf_ptype_to_htype(const struct idpf_rx_ptype_decoded *decoded);
- int idpf_config_rss(struct idpf_vport *vport);
- int idpf_init_rss(struct idpf_vport *vport);
---
-2.43.0
-
+++ /dev/null
-From dfc78cf08988658dfa0c132617fa9a2736cf3157 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 21 May 2024 12:39:54 -0700
-Subject: idpf: Interpret .set_channels() input differently
-
-From: Larysa Zaremba <larysa.zaremba@intel.com>
-
-[ Upstream commit 5e7695e0219bf6acb96081af3ba0ca08b1829656 ]
-
-Unlike ice, idpf does not check, if user has requested at least 1 combined
-channel. Instead, it relies on a check in the core code. Unfortunately, the
-check does not trigger for us because of the hacky .set_channels()
-interpretation logic that is not consistent with the core code.
-
-This naturally leads to user being able to trigger a crash with an invalid
-input. This is how:
-
-1. ethtool -l <IFNAME> -> combined: 40
-2. ethtool -L <IFNAME> rx 0 tx 0
- combined number is not specified, so command becomes {rx_count = 0,
- tx_count = 0, combined_count = 40}.
-3. ethnl_set_channels checks, if there is at least 1 RX and 1 TX channel,
- comparing (combined_count + rx_count) and (combined_count + tx_count)
- to zero. Obviously, (40 + 0) is greater than zero, so the core code
- deems the input OK.
-4. idpf interprets `rx 0 tx 0` as 0 channels and tries to proceed with such
- configuration.
-
-The issue has to be solved fundamentally, as current logic is also known to
-cause AF_XDP problems in ice [0].
-
-Interpret the command in a way that is more consistent with ethtool
-manual [1] (--show-channels and --set-channels) and new ice logic.
-
-Considering that in the idpf driver only the difference between RX and TX
-queues forms dedicated channels, change the correct way to set number of
-channels to:
-
-ethtool -L <IFNAME> combined 10 /* For symmetric queues */
-ethtool -L <IFNAME> combined 8 tx 2 rx 0 /* For asymmetric queues */
-
-[0] https://lore.kernel.org/netdev/20240418095857.2827-1-larysa.zaremba@intel.com/
-[1] https://man7.org/linux/man-pages/man8/ethtool.8.html
-
-Fixes: 02cbfba1add5 ("idpf: add ethtool callbacks")
-Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
-Reviewed-by: Igor Bagnucki <igor.bagnucki@intel.com>
-Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
-Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
-Reviewed-by: Simon Horman <horms@kernel.org>
-Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- .../net/ethernet/intel/idpf/idpf_ethtool.c | 21 ++++++-------------
- 1 file changed, 6 insertions(+), 15 deletions(-)
-
-diff --git a/drivers/net/ethernet/intel/idpf/idpf_ethtool.c b/drivers/net/ethernet/intel/idpf/idpf_ethtool.c
-index 6972d728431cb..1885ba618981d 100644
---- a/drivers/net/ethernet/intel/idpf/idpf_ethtool.c
-+++ b/drivers/net/ethernet/intel/idpf/idpf_ethtool.c
-@@ -222,14 +222,19 @@ static int idpf_set_channels(struct net_device *netdev,
- struct ethtool_channels *ch)
- {
- struct idpf_vport_config *vport_config;
-- u16 combined, num_txq, num_rxq;
- unsigned int num_req_tx_q;
- unsigned int num_req_rx_q;
- struct idpf_vport *vport;
-+ u16 num_txq, num_rxq;
- struct device *dev;
- int err = 0;
- u16 idx;
-
-+ if (ch->rx_count && ch->tx_count) {
-+ netdev_err(netdev, "Dedicated RX or TX channels cannot be used simultaneously\n");
-+ return -EINVAL;
-+ }
-+
- idpf_vport_ctrl_lock(netdev);
- vport = idpf_netdev_to_vport(netdev);
-
-@@ -239,20 +244,6 @@ static int idpf_set_channels(struct net_device *netdev,
- num_txq = vport_config->user_config.num_req_tx_qs;
- num_rxq = vport_config->user_config.num_req_rx_qs;
-
-- combined = min(num_txq, num_rxq);
--
-- /* these checks are for cases where user didn't specify a particular
-- * value on cmd line but we get non-zero value anyway via
-- * get_channels(); look at ethtool.c in ethtool repository (the user
-- * space part), particularly, do_schannels() routine
-- */
-- if (ch->combined_count == combined)
-- ch->combined_count = 0;
-- if (ch->combined_count && ch->rx_count == num_rxq - combined)
-- ch->rx_count = 0;
-- if (ch->combined_count && ch->tx_count == num_txq - combined)
-- ch->tx_count = 0;
--
- num_req_tx_q = ch->combined_count + ch->tx_count;
- num_req_rx_q = ch->combined_count + ch->rx_count;
-
---
-2.43.0
-
+++ /dev/null
-From ceaee2be56b77c3c2515cf26bff6ceaa10c09a85 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 30 Mar 2024 18:53:00 +0000
-Subject: iio: adc: stm32: Fixing err code to not indicate success
-
-From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-
-[ Upstream commit 3735ca0b072656c3aa2cedc617a5e639b583a472 ]
-
-This path would result in returning 0 / success on an error path.
-
-Cc: Olivier Moysan <olivier.moysan@foss.st.com>
-Fixes: 95bc818404b2 ("iio: adc: stm32-adc: add support of generic channels binding")
-Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com>
-Link: https://lore.kernel.org/r/20240330185305.1319844-4-jic23@kernel.org
-Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/iio/adc/stm32-adc.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
-index b5d3c9cea5c4e..283c207571064 100644
---- a/drivers/iio/adc/stm32-adc.c
-+++ b/drivers/iio/adc/stm32-adc.c
-@@ -2234,6 +2234,7 @@ static int stm32_adc_generic_chan_init(struct iio_dev *indio_dev,
- if (vin[0] != val || vin[1] >= adc_info->max_channels) {
- dev_err(&indio_dev->dev, "Invalid channel in%d-in%d\n",
- vin[0], vin[1]);
-+ ret = -EINVAL;
- goto err;
- }
- } else if (ret != -EINVAL) {
---
-2.43.0
-
+++ /dev/null
-From 53d08e24206248c2744b3bffb4a359ce95ed3169 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 4 Mar 2024 16:04:32 +0200
-Subject: iio: core: Leave private pointer NULL when no private data supplied
-
-From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-
-[ Upstream commit f0245ab389330cbc1d187e358a5b890d9f5383db ]
-
-In iio_device_alloc() when size of the private data is 0,
-the private pointer is calculated to point behind the valid data.
-Leave it NULL when no private data supplied.
-
-Fixes: 6d4ebd565d15 ("iio: core: wrap IIO device into an iio_dev_opaque object")
-Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Reviewed-by: David Lechner <dlechner@baylibre.com>
-Link: https://lore.kernel.org/r/20240304140650.977784-2-andriy.shevchenko@linux.intel.com
-Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/iio/industrialio-core.c | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
-index 173dc00762a15..cc9f0d41f59b2 100644
---- a/drivers/iio/industrialio-core.c
-+++ b/drivers/iio/industrialio-core.c
-@@ -1656,8 +1656,10 @@ struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv)
- return NULL;
-
- indio_dev = &iio_dev_opaque->indio_dev;
-- indio_dev->priv = (char *)iio_dev_opaque +
-- ALIGN(sizeof(struct iio_dev_opaque), IIO_DMA_MINALIGN);
-+
-+ if (sizeof_priv)
-+ indio_dev->priv = (char *)iio_dev_opaque +
-+ ALIGN(sizeof(*iio_dev_opaque), IIO_DMA_MINALIGN);
-
- indio_dev->dev.parent = parent;
- indio_dev->dev.type = &iio_device_type;
---
-2.43.0
-
+++ /dev/null
-From 7611299115f7300404c947b5559578749703fed6 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 15 Apr 2024 12:50:27 +0200
-Subject: iio: pressure: dps310: support negative temperature values
-
-From: Thomas Haemmerle <thomas.haemmerle@leica-geosystems.com>
-
-[ Upstream commit 9dd6b32e76ff714308964cd9ec91466a343dcb8b ]
-
-The current implementation interprets negative values returned from
-`dps310_calculate_temp` as error codes.
-This has a side effect that when negative temperature values are
-calculated, they are interpreted as error.
-
-Fix this by using the return value only for error handling and passing a
-pointer for the value.
-
-Fixes: ba6ec48e76bc ("iio: Add driver for Infineon DPS310")
-Signed-off-by: Thomas Haemmerle <thomas.haemmerle@leica-geosystems.com>
-Link: https://lore.kernel.org/r/20240415105030.1161770-2-thomas.haemmerle@leica-geosystems.com
-Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/iio/pressure/dps310.c | 11 ++++++-----
- 1 file changed, 6 insertions(+), 5 deletions(-)
-
-diff --git a/drivers/iio/pressure/dps310.c b/drivers/iio/pressure/dps310.c
-index 1ff091b2f764d..d0a516d56da47 100644
---- a/drivers/iio/pressure/dps310.c
-+++ b/drivers/iio/pressure/dps310.c
-@@ -730,7 +730,7 @@ static int dps310_read_pressure(struct dps310_data *data, int *val, int *val2,
- }
- }
-
--static int dps310_calculate_temp(struct dps310_data *data)
-+static int dps310_calculate_temp(struct dps310_data *data, int *val)
- {
- s64 c0;
- s64 t;
-@@ -746,7 +746,9 @@ static int dps310_calculate_temp(struct dps310_data *data)
- t = c0 + ((s64)data->temp_raw * (s64)data->c1);
-
- /* Convert to milliCelsius and scale the temperature */
-- return (int)div_s64(t * 1000LL, kt);
-+ *val = (int)div_s64(t * 1000LL, kt);
-+
-+ return 0;
- }
-
- static int dps310_read_temp(struct dps310_data *data, int *val, int *val2,
-@@ -768,11 +770,10 @@ static int dps310_read_temp(struct dps310_data *data, int *val, int *val2,
- if (rc)
- return rc;
-
-- rc = dps310_calculate_temp(data);
-- if (rc < 0)
-+ rc = dps310_calculate_temp(data, val);
-+ if (rc)
- return rc;
-
-- *val = rc;
- return IIO_VAL_INT;
-
- case IIO_CHAN_INFO_OVERSAMPLING_RATIO:
---
-2.43.0
-
+++ /dev/null
-From 600692a5e88746cb0478d7f65514cb799941a1d2 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 29 Apr 2024 13:30:09 +0000
-Subject: inet: introduce dst_rtable() helper
-
-From: Eric Dumazet <edumazet@google.com>
-
-[ Upstream commit 05d6d492097c55f2d153fc3fd33cbe78e1e28e0a ]
-
-I added dst_rt6_info() in commit
-e8dfd42c17fa ("ipv6: introduce dst_rt6_info() helper")
-
-This patch does a similar change for IPv4.
-
-Instead of (struct rtable *)dst casts, we can use :
-
- #define dst_rtable(_ptr) \
- container_of_const(_ptr, struct rtable, dst)
-
-Patch is smaller than IPv6 one, because IPv4 has skb_rtable() helper.
-
-Signed-off-by: Eric Dumazet <edumazet@google.com>
-Reviewed-by: David Ahern <dsahern@kernel.org>
-Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
-Link: https://lore.kernel.org/r/20240429133009.1227754-1-edumazet@google.com
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Stable-dep-of: 92f1655aa2b2 ("net: fix __dst_negative_advice() race")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/infiniband/core/addr.c | 12 +++---------
- drivers/net/vrf.c | 2 +-
- drivers/s390/net/qeth_core.h | 5 ++---
- include/linux/skbuff.h | 9 ---------
- include/net/ip.h | 4 ++--
- include/net/route.h | 11 +++++++++++
- net/atm/clip.c | 2 +-
- net/core/dst_cache.c | 2 +-
- net/core/filter.c | 3 +--
- net/ipv4/af_inet.c | 2 +-
- net/ipv4/icmp.c | 26 ++++++++++++++------------
- net/ipv4/ip_input.c | 2 +-
- net/ipv4/ip_output.c | 8 ++++----
- net/ipv4/route.c | 24 +++++++++++-------------
- net/ipv4/udp.c | 2 +-
- net/ipv4/xfrm4_policy.c | 2 +-
- net/l2tp/l2tp_ip.c | 2 +-
- net/mpls/mpls_iptunnel.c | 2 +-
- net/netfilter/ipvs/ip_vs_xmit.c | 2 +-
- net/netfilter/nf_flow_table_ip.c | 4 ++--
- net/netfilter/nft_rt.c | 2 +-
- net/sctp/protocol.c | 4 ++--
- net/tipc/udp_media.c | 2 +-
- 23 files changed, 64 insertions(+), 70 deletions(-)
-
-diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
-index f20dfe70fa0e4..be0743dac3fff 100644
---- a/drivers/infiniband/core/addr.c
-+++ b/drivers/infiniband/core/addr.c
-@@ -348,16 +348,10 @@ static int dst_fetch_ha(const struct dst_entry *dst,
-
- static bool has_gateway(const struct dst_entry *dst, sa_family_t family)
- {
-- const struct rtable *rt;
-- const struct rt6_info *rt6;
-+ if (family == AF_INET)
-+ return dst_rtable(dst)->rt_uses_gateway;
-
-- if (family == AF_INET) {
-- rt = container_of(dst, struct rtable, dst);
-- return rt->rt_uses_gateway;
-- }
--
-- rt6 = dst_rt6_info(dst);
-- return rt6->rt6i_flags & RTF_GATEWAY;
-+ return dst_rt6_info(dst)->rt6i_flags & RTF_GATEWAY;
- }
-
- static int fetch_ha(const struct dst_entry *dst, struct rdma_dev_addr *dev_addr,
-diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
-index 71cfa03a77449..c3af9ad5e1547 100644
---- a/drivers/net/vrf.c
-+++ b/drivers/net/vrf.c
-@@ -860,7 +860,7 @@ static int vrf_rt6_create(struct net_device *dev)
- static int vrf_finish_output(struct net *net, struct sock *sk, struct sk_buff *skb)
- {
- struct dst_entry *dst = skb_dst(skb);
-- struct rtable *rt = (struct rtable *)dst;
-+ struct rtable *rt = dst_rtable(dst);
- struct net_device *dev = dst->dev;
- unsigned int hh_len = LL_RESERVED_SPACE(dev);
- struct neighbour *neigh;
-diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h
-index 5f17a2a5d0e33..41fe8a043d61f 100644
---- a/drivers/s390/net/qeth_core.h
-+++ b/drivers/s390/net/qeth_core.h
-@@ -970,9 +970,8 @@ static inline struct dst_entry *qeth_dst_check_rcu(struct sk_buff *skb,
- static inline __be32 qeth_next_hop_v4_rcu(struct sk_buff *skb,
- struct dst_entry *dst)
- {
-- struct rtable *rt = (struct rtable *) dst;
--
-- return (rt) ? rt_nexthop(rt, ip_hdr(skb)->daddr) : ip_hdr(skb)->daddr;
-+ return (dst) ? rt_nexthop(dst_rtable(dst), ip_hdr(skb)->daddr) :
-+ ip_hdr(skb)->daddr;
- }
-
- static inline struct in6_addr *qeth_next_hop_v6_rcu(struct sk_buff *skb,
-diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
-index f86f9396f727b..d4e53a5a262c7 100644
---- a/include/linux/skbuff.h
-+++ b/include/linux/skbuff.h
-@@ -1169,15 +1169,6 @@ static inline bool skb_dst_is_noref(const struct sk_buff *skb)
- return (skb->_skb_refdst & SKB_DST_NOREF) && skb_dst(skb);
- }
-
--/**
-- * skb_rtable - Returns the skb &rtable
-- * @skb: buffer
-- */
--static inline struct rtable *skb_rtable(const struct sk_buff *skb)
--{
-- return (struct rtable *)skb_dst(skb);
--}
--
- /* For mangling skb->pkt_type from user space side from applications
- * such as nft, tc, etc, we only allow a conservative subset of
- * possible pkt_types to be set.
-diff --git a/include/net/ip.h b/include/net/ip.h
-index 25cb688bdc623..6d735e00d3f3e 100644
---- a/include/net/ip.h
-+++ b/include/net/ip.h
-@@ -423,7 +423,7 @@ int ip_decrease_ttl(struct iphdr *iph)
-
- static inline int ip_mtu_locked(const struct dst_entry *dst)
- {
-- const struct rtable *rt = (const struct rtable *)dst;
-+ const struct rtable *rt = dst_rtable(dst);
-
- return rt->rt_mtu_locked || dst_metric_locked(dst, RTAX_MTU);
- }
-@@ -461,7 +461,7 @@ static inline bool ip_sk_ignore_df(const struct sock *sk)
- static inline unsigned int ip_dst_mtu_maybe_forward(const struct dst_entry *dst,
- bool forwarding)
- {
-- const struct rtable *rt = container_of(dst, struct rtable, dst);
-+ const struct rtable *rt = dst_rtable(dst);
- struct net *net = dev_net(dst->dev);
- unsigned int mtu;
-
-diff --git a/include/net/route.h b/include/net/route.h
-index 980ab474eabdc..9cc68c2d23271 100644
---- a/include/net/route.h
-+++ b/include/net/route.h
-@@ -80,6 +80,17 @@ struct rtable {
- rt_pmtu:31;
- };
-
-+#define dst_rtable(_ptr) container_of_const(_ptr, struct rtable, dst)
-+
-+/**
-+ * skb_rtable - Returns the skb &rtable
-+ * @skb: buffer
-+ */
-+static inline struct rtable *skb_rtable(const struct sk_buff *skb)
-+{
-+ return dst_rtable(skb_dst(skb));
-+}
-+
- static inline bool rt_is_input_route(const struct rtable *rt)
- {
- return rt->rt_is_input != 0;
-diff --git a/net/atm/clip.c b/net/atm/clip.c
-index 294cb9efe3d38..015fb679be425 100644
---- a/net/atm/clip.c
-+++ b/net/atm/clip.c
-@@ -345,7 +345,7 @@ static netdev_tx_t clip_start_xmit(struct sk_buff *skb,
- dev->stats.tx_dropped++;
- return NETDEV_TX_OK;
- }
-- rt = (struct rtable *) dst;
-+ rt = dst_rtable(dst);
- if (rt->rt_gw_family == AF_INET)
- daddr = &rt->rt_gw4;
- else
-diff --git a/net/core/dst_cache.c b/net/core/dst_cache.c
-index b17171345d649..0c0bdb058c5b1 100644
---- a/net/core/dst_cache.c
-+++ b/net/core/dst_cache.c
-@@ -83,7 +83,7 @@ struct rtable *dst_cache_get_ip4(struct dst_cache *dst_cache, __be32 *saddr)
- return NULL;
-
- *saddr = idst->in_saddr.s_addr;
-- return container_of(dst, struct rtable, dst);
-+ return dst_rtable(dst);
- }
- EXPORT_SYMBOL_GPL(dst_cache_get_ip4);
-
-diff --git a/net/core/filter.c b/net/core/filter.c
-index 9c9300664320b..4aa556ecefe2e 100644
---- a/net/core/filter.c
-+++ b/net/core/filter.c
-@@ -2314,8 +2314,7 @@ static int bpf_out_neigh_v4(struct net *net, struct sk_buff *skb,
-
- rcu_read_lock();
- if (!nh) {
-- struct dst_entry *dst = skb_dst(skb);
-- struct rtable *rt = container_of(dst, struct rtable, dst);
-+ struct rtable *rt = skb_rtable(skb);
-
- neigh = ip_neigh_for_gw(rt, skb, &is_v6gw);
- } else if (nh->nh_family == AF_INET6) {
-diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
-index 1e373e7477efa..88966ae7f9c4c 100644
---- a/net/ipv4/af_inet.c
-+++ b/net/ipv4/af_inet.c
-@@ -1307,8 +1307,8 @@ static int inet_sk_reselect_saddr(struct sock *sk)
-
- int inet_sk_rebuild_header(struct sock *sk)
- {
-+ struct rtable *rt = dst_rtable(__sk_dst_check(sk, 0));
- struct inet_sock *inet = inet_sk(sk);
-- struct rtable *rt = (struct rtable *)__sk_dst_check(sk, 0);
- __be32 daddr;
- struct ip_options_rcu *inet_opt;
- struct flowi4 *fl4;
-diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
-index 437e782b9663b..207482d30dc7e 100644
---- a/net/ipv4/icmp.c
-+++ b/net/ipv4/icmp.c
-@@ -483,6 +483,7 @@ static struct rtable *icmp_route_lookup(struct net *net,
- struct icmp_bxm *param)
- {
- struct net_device *route_lookup_dev;
-+ struct dst_entry *dst, *dst2;
- struct rtable *rt, *rt2;
- struct flowi4 fl4_dec;
- int err;
-@@ -508,16 +509,17 @@ static struct rtable *icmp_route_lookup(struct net *net,
- /* No need to clone since we're just using its address. */
- rt2 = rt;
-
-- rt = (struct rtable *) xfrm_lookup(net, &rt->dst,
-- flowi4_to_flowi(fl4), NULL, 0);
-- if (!IS_ERR(rt)) {
-+ dst = xfrm_lookup(net, &rt->dst,
-+ flowi4_to_flowi(fl4), NULL, 0);
-+ rt = dst_rtable(dst);
-+ if (!IS_ERR(dst)) {
- if (rt != rt2)
- return rt;
-- } else if (PTR_ERR(rt) == -EPERM) {
-+ } else if (PTR_ERR(dst) == -EPERM) {
- rt = NULL;
-- } else
-+ } else {
- return rt;
--
-+ }
- err = xfrm_decode_session_reverse(net, skb_in, flowi4_to_flowi(&fl4_dec), AF_INET);
- if (err)
- goto relookup_failed;
-@@ -551,19 +553,19 @@ static struct rtable *icmp_route_lookup(struct net *net,
- if (err)
- goto relookup_failed;
-
-- rt2 = (struct rtable *) xfrm_lookup(net, &rt2->dst,
-- flowi4_to_flowi(&fl4_dec), NULL,
-- XFRM_LOOKUP_ICMP);
-- if (!IS_ERR(rt2)) {
-+ dst2 = xfrm_lookup(net, &rt2->dst, flowi4_to_flowi(&fl4_dec), NULL,
-+ XFRM_LOOKUP_ICMP);
-+ rt2 = dst_rtable(dst2);
-+ if (!IS_ERR(dst2)) {
- dst_release(&rt->dst);
- memcpy(fl4, &fl4_dec, sizeof(*fl4));
- rt = rt2;
-- } else if (PTR_ERR(rt2) == -EPERM) {
-+ } else if (PTR_ERR(dst2) == -EPERM) {
- if (rt)
- dst_release(&rt->dst);
- return rt2;
- } else {
-- err = PTR_ERR(rt2);
-+ err = PTR_ERR(dst2);
- goto relookup_failed;
- }
- return rt;
-diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
-index 5e9c8156656a7..d6fbcbd2358a5 100644
---- a/net/ipv4/ip_input.c
-+++ b/net/ipv4/ip_input.c
-@@ -616,7 +616,7 @@ static void ip_list_rcv_finish(struct net *net, struct sock *sk,
- dst = skb_dst(skb);
- if (curr_dst != dst) {
- hint = ip_extract_route_hint(net, skb,
-- ((struct rtable *)dst)->rt_type);
-+ dst_rtable(dst)->rt_type);
-
- /* dispatch old sublist */
- if (!list_empty(&sublist))
-diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
-index a38e63669c54a..3e6ea4318d1e3 100644
---- a/net/ipv4/ip_output.c
-+++ b/net/ipv4/ip_output.c
-@@ -198,7 +198,7 @@ EXPORT_SYMBOL_GPL(ip_build_and_send_pkt);
- static int ip_finish_output2(struct net *net, struct sock *sk, struct sk_buff *skb)
- {
- struct dst_entry *dst = skb_dst(skb);
-- struct rtable *rt = (struct rtable *)dst;
-+ struct rtable *rt = dst_rtable(dst);
- struct net_device *dev = dst->dev;
- unsigned int hh_len = LL_RESERVED_SPACE(dev);
- struct neighbour *neigh;
-@@ -475,7 +475,7 @@ int __ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl,
- goto packet_routed;
-
- /* Make sure we can route this packet. */
-- rt = (struct rtable *)__sk_dst_check(sk, 0);
-+ rt = dst_rtable(__sk_dst_check(sk, 0));
- if (!rt) {
- __be32 daddr;
-
-@@ -971,7 +971,7 @@ static int __ip_append_data(struct sock *sk,
- bool zc = false;
- unsigned int maxfraglen, fragheaderlen, maxnonfragsize;
- int csummode = CHECKSUM_NONE;
-- struct rtable *rt = (struct rtable *)cork->dst;
-+ struct rtable *rt = dst_rtable(cork->dst);
- bool paged, hold_tskey, extra_uref = false;
- unsigned int wmem_alloc_delta = 0;
- u32 tskey = 0;
-@@ -1390,7 +1390,7 @@ struct sk_buff *__ip_make_skb(struct sock *sk,
- struct inet_sock *inet = inet_sk(sk);
- struct net *net = sock_net(sk);
- struct ip_options *opt = NULL;
-- struct rtable *rt = (struct rtable *)cork->dst;
-+ struct rtable *rt = dst_rtable(cork->dst);
- struct iphdr *iph;
- u8 pmtudisc, ttl;
- __be16 df = 0;
-diff --git a/net/ipv4/route.c b/net/ipv4/route.c
-index f67d3d6fe9345..6d6e1c3e67d8f 100644
---- a/net/ipv4/route.c
-+++ b/net/ipv4/route.c
-@@ -831,7 +831,7 @@ static void ip_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_buf
- u32 mark = skb->mark;
- __u8 tos = iph->tos;
-
-- rt = (struct rtable *) dst;
-+ rt = dst_rtable(dst);
-
- __build_flow_key(net, &fl4, sk, iph, oif, tos, prot, mark, 0);
- __ip_do_redirect(rt, skb, &fl4, true);
-@@ -839,7 +839,7 @@ static void ip_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_buf
-
- static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst)
- {
-- struct rtable *rt = (struct rtable *)dst;
-+ struct rtable *rt = dst_rtable(dst);
- struct dst_entry *ret = dst;
-
- if (rt) {
-@@ -1056,7 +1056,7 @@ static void ip_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,
- struct sk_buff *skb, u32 mtu,
- bool confirm_neigh)
- {
-- struct rtable *rt = (struct rtable *) dst;
-+ struct rtable *rt = dst_rtable(dst);
- struct flowi4 fl4;
-
- ip_rt_build_flow_key(&fl4, sk, skb);
-@@ -1127,7 +1127,7 @@ void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu)
-
- __build_flow_key(net, &fl4, sk, iph, 0, 0, 0, 0, 0);
-
-- rt = (struct rtable *)odst;
-+ rt = dst_rtable(odst);
- if (odst->obsolete && !odst->ops->check(odst, 0)) {
- rt = ip_route_output_flow(sock_net(sk), &fl4, sk);
- if (IS_ERR(rt))
-@@ -1136,7 +1136,7 @@ void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu)
- new = true;
- }
-
-- __ip_rt_update_pmtu((struct rtable *)xfrm_dst_path(&rt->dst), &fl4, mtu);
-+ __ip_rt_update_pmtu(dst_rtable(xfrm_dst_path(&rt->dst)), &fl4, mtu);
-
- if (!dst_check(&rt->dst, 0)) {
- if (new)
-@@ -1193,7 +1193,7 @@ EXPORT_SYMBOL_GPL(ipv4_sk_redirect);
- INDIRECT_CALLABLE_SCOPE struct dst_entry *ipv4_dst_check(struct dst_entry *dst,
- u32 cookie)
- {
-- struct rtable *rt = (struct rtable *) dst;
-+ struct rtable *rt = dst_rtable(dst);
-
- /* All IPV4 dsts are created with ->obsolete set to the value
- * DST_OBSOLETE_FORCE_CHK which forces validation calls down
-@@ -1528,10 +1528,8 @@ void rt_del_uncached_list(struct rtable *rt)
-
- static void ipv4_dst_destroy(struct dst_entry *dst)
- {
-- struct rtable *rt = (struct rtable *)dst;
--
- ip_dst_metrics_put(dst);
-- rt_del_uncached_list(rt);
-+ rt_del_uncached_list(dst_rtable(dst));
- }
-
- void rt_flush_dev(struct net_device *dev)
-@@ -2832,7 +2830,7 @@ static struct dst_ops ipv4_dst_blackhole_ops = {
-
- struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_orig)
- {
-- struct rtable *ort = (struct rtable *) dst_orig;
-+ struct rtable *ort = dst_rtable(dst_orig);
- struct rtable *rt;
-
- rt = dst_alloc(&ipv4_dst_blackhole_ops, NULL, DST_OBSOLETE_DEAD, 0);
-@@ -2877,9 +2875,9 @@ struct rtable *ip_route_output_flow(struct net *net, struct flowi4 *flp4,
-
- if (flp4->flowi4_proto) {
- flp4->flowi4_oif = rt->dst.dev->ifindex;
-- rt = (struct rtable *)xfrm_lookup_route(net, &rt->dst,
-- flowi4_to_flowi(flp4),
-- sk, 0);
-+ rt = dst_rtable(xfrm_lookup_route(net, &rt->dst,
-+ flowi4_to_flowi(flp4),
-+ sk, 0));
- }
-
- return rt;
-diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
-index e980869f18176..b2e1bfa0f625a 100644
---- a/net/ipv4/udp.c
-+++ b/net/ipv4/udp.c
-@@ -1220,7 +1220,7 @@ int udp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
- }
-
- if (connected)
-- rt = (struct rtable *)sk_dst_check(sk, 0);
-+ rt = dst_rtable(sk_dst_check(sk, 0));
-
- if (!rt) {
- struct net *net = sock_net(sk);
-diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
-index c33bca2c38415..1853a8415d9f1 100644
---- a/net/ipv4/xfrm4_policy.c
-+++ b/net/ipv4/xfrm4_policy.c
-@@ -69,7 +69,7 @@ static int xfrm4_get_saddr(struct net *net, int oif,
- static int xfrm4_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
- const struct flowi *fl)
- {
-- struct rtable *rt = (struct rtable *)xdst->route;
-+ struct rtable *rt = dst_rtable(xdst->route);
- const struct flowi4 *fl4 = &fl->u.ip4;
-
- xdst->u.rt.rt_iif = fl4->flowi4_iif;
-diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c
-index 9a2a9ed3ba478..4b4bd83353d5d 100644
---- a/net/l2tp/l2tp_ip.c
-+++ b/net/l2tp/l2tp_ip.c
-@@ -459,7 +459,7 @@ static int l2tp_ip_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
-
- fl4 = &inet->cork.fl.u.ip4;
- if (connected)
-- rt = (struct rtable *)__sk_dst_check(sk, 0);
-+ rt = dst_rtable(__sk_dst_check(sk, 0));
-
- rcu_read_lock();
- if (!rt) {
-diff --git a/net/mpls/mpls_iptunnel.c b/net/mpls/mpls_iptunnel.c
-index 8985abcb7a058..89d0fa560d8fc 100644
---- a/net/mpls/mpls_iptunnel.c
-+++ b/net/mpls/mpls_iptunnel.c
-@@ -83,7 +83,7 @@ static int mpls_xmit(struct sk_buff *skb)
- ttl = net->mpls.default_ttl;
- else
- ttl = ip_hdr(skb)->ttl;
-- rt = (struct rtable *)dst;
-+ rt = dst_rtable(dst);
- } else if (dst->ops->family == AF_INET6) {
- if (tun_encap_info->ttl_propagate == MPLS_TTL_PROP_DISABLED)
- ttl = tun_encap_info->default_ttl;
-diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c
-index 5cd511162bc03..e1f17392f58c1 100644
---- a/net/netfilter/ipvs/ip_vs_xmit.c
-+++ b/net/netfilter/ipvs/ip_vs_xmit.c
-@@ -318,7 +318,7 @@ __ip_vs_get_out_rt(struct netns_ipvs *ipvs, int skb_af, struct sk_buff *skb,
- if (dest) {
- dest_dst = __ip_vs_dst_check(dest);
- if (likely(dest_dst))
-- rt = (struct rtable *) dest_dst->dst_cache;
-+ rt = dst_rtable(dest_dst->dst_cache);
- else {
- dest_dst = ip_vs_dest_dst_alloc();
- spin_lock_bh(&dest->dst_lock);
-diff --git a/net/netfilter/nf_flow_table_ip.c b/net/netfilter/nf_flow_table_ip.c
-index 100887beed314..c2c005234dcd3 100644
---- a/net/netfilter/nf_flow_table_ip.c
-+++ b/net/netfilter/nf_flow_table_ip.c
-@@ -434,7 +434,7 @@ nf_flow_offload_ip_hook(void *priv, struct sk_buff *skb,
- return NF_ACCEPT;
-
- if (unlikely(tuplehash->tuple.xmit_type == FLOW_OFFLOAD_XMIT_XFRM)) {
-- rt = (struct rtable *)tuplehash->tuple.dst_cache;
-+ rt = dst_rtable(tuplehash->tuple.dst_cache);
- memset(skb->cb, 0, sizeof(struct inet_skb_parm));
- IPCB(skb)->iif = skb->dev->ifindex;
- IPCB(skb)->flags = IPSKB_FORWARDED;
-@@ -446,7 +446,7 @@ nf_flow_offload_ip_hook(void *priv, struct sk_buff *skb,
-
- switch (tuplehash->tuple.xmit_type) {
- case FLOW_OFFLOAD_XMIT_NEIGH:
-- rt = (struct rtable *)tuplehash->tuple.dst_cache;
-+ rt = dst_rtable(tuplehash->tuple.dst_cache);
- outdev = rt->dst.dev;
- skb->dev = outdev;
- nexthop = rt_nexthop(rt, flow->tuplehash[!dir].tuple.src_v4.s_addr);
-diff --git a/net/netfilter/nft_rt.c b/net/netfilter/nft_rt.c
-index 2434c624aafde..14d88394bcb7f 100644
---- a/net/netfilter/nft_rt.c
-+++ b/net/netfilter/nft_rt.c
-@@ -73,7 +73,7 @@ void nft_rt_get_eval(const struct nft_expr *expr,
- if (nft_pf(pkt) != NFPROTO_IPV4)
- goto err;
-
-- *dest = (__force u32)rt_nexthop((const struct rtable *)dst,
-+ *dest = (__force u32)rt_nexthop(dst_rtable(dst),
- ip_hdr(skb)->daddr);
- break;
- case NFT_RT_NEXTHOP6:
-diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
-index 94c6dd53cd62d..ae68b48cebbe5 100644
---- a/net/sctp/protocol.c
-+++ b/net/sctp/protocol.c
-@@ -552,7 +552,7 @@ static void sctp_v4_get_saddr(struct sctp_sock *sk,
- struct flowi *fl)
- {
- union sctp_addr *saddr = &t->saddr;
-- struct rtable *rt = (struct rtable *)t->dst;
-+ struct rtable *rt = dst_rtable(t->dst);
-
- if (rt) {
- saddr->v4.sin_family = AF_INET;
-@@ -1085,7 +1085,7 @@ static inline int sctp_v4_xmit(struct sk_buff *skb, struct sctp_transport *t)
- skb_reset_inner_mac_header(skb);
- skb_reset_inner_transport_header(skb);
- skb_set_inner_ipproto(skb, IPPROTO_SCTP);
-- udp_tunnel_xmit_skb((struct rtable *)dst, sk, skb, fl4->saddr,
-+ udp_tunnel_xmit_skb(dst_rtable(dst), sk, skb, fl4->saddr,
- fl4->daddr, dscp, ip4_dst_hoplimit(dst), df,
- sctp_sk(sk)->udp_port, t->encap_port, false, false);
- return 0;
-diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c
-index f892b0903dbaf..b849a3d133a01 100644
---- a/net/tipc/udp_media.c
-+++ b/net/tipc/udp_media.c
-@@ -174,7 +174,7 @@ static int tipc_udp_xmit(struct net *net, struct sk_buff *skb,
- local_bh_disable();
- ndst = dst_cache_get(cache);
- if (dst->proto == htons(ETH_P_IP)) {
-- struct rtable *rt = (struct rtable *)ndst;
-+ struct rtable *rt = dst_rtable(ndst);
-
- if (!rt) {
- struct flowi4 fl = {
---
-2.43.0
-
+++ /dev/null
-From 683540b511a572837f2bcdf262967101e786f574 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 9 Oct 2023 14:10:18 +0200
-Subject: Input: cyapa - add missing input core locking to suspend/resume
- functions
-
-From: Marek Szyprowski <m.szyprowski@samsung.com>
-
-[ Upstream commit 7b4e0b39182cf5e677c1fc092a3ec40e621c25b6 ]
-
-Grab input->mutex during suspend/resume functions like it is done in
-other input drivers. This fixes the following warning during system
-suspend/resume cycle on Samsung Exynos5250-based Snow Chromebook:
-
-------------[ cut here ]------------
-WARNING: CPU: 1 PID: 1680 at drivers/input/input.c:2291 input_device_enabled+0x68/0x6c
-Modules linked in: ...
-CPU: 1 PID: 1680 Comm: kworker/u4:12 Tainted: G W 6.6.0-rc5-next-20231009 #14109
-Hardware name: Samsung Exynos (Flattened Device Tree)
-Workqueue: events_unbound async_run_entry_fn
- unwind_backtrace from show_stack+0x10/0x14
- show_stack from dump_stack_lvl+0x58/0x70
- dump_stack_lvl from __warn+0x1a8/0x1cc
- __warn from warn_slowpath_fmt+0x18c/0x1b4
- warn_slowpath_fmt from input_device_enabled+0x68/0x6c
- input_device_enabled from cyapa_gen3_set_power_mode+0x13c/0x1dc
- cyapa_gen3_set_power_mode from cyapa_reinitialize+0x10c/0x15c
- cyapa_reinitialize from cyapa_resume+0x48/0x98
- cyapa_resume from dpm_run_callback+0x90/0x298
- dpm_run_callback from device_resume+0xb4/0x258
- device_resume from async_resume+0x20/0x64
- async_resume from async_run_entry_fn+0x40/0x15c
- async_run_entry_fn from process_scheduled_works+0xbc/0x6a8
- process_scheduled_works from worker_thread+0x188/0x454
- worker_thread from kthread+0x108/0x140
- kthread from ret_from_fork+0x14/0x28
-Exception stack(0xf1625fb0 to 0xf1625ff8)
-...
----[ end trace 0000000000000000 ]---
-...
-------------[ cut here ]------------
-WARNING: CPU: 1 PID: 1680 at drivers/input/input.c:2291 input_device_enabled+0x68/0x6c
-Modules linked in: ...
-CPU: 1 PID: 1680 Comm: kworker/u4:12 Tainted: G W 6.6.0-rc5-next-20231009 #14109
-Hardware name: Samsung Exynos (Flattened Device Tree)
-Workqueue: events_unbound async_run_entry_fn
- unwind_backtrace from show_stack+0x10/0x14
- show_stack from dump_stack_lvl+0x58/0x70
- dump_stack_lvl from __warn+0x1a8/0x1cc
- __warn from warn_slowpath_fmt+0x18c/0x1b4
- warn_slowpath_fmt from input_device_enabled+0x68/0x6c
- input_device_enabled from cyapa_gen3_set_power_mode+0x13c/0x1dc
- cyapa_gen3_set_power_mode from cyapa_reinitialize+0x10c/0x15c
- cyapa_reinitialize from cyapa_resume+0x48/0x98
- cyapa_resume from dpm_run_callback+0x90/0x298
- dpm_run_callback from device_resume+0xb4/0x258
- device_resume from async_resume+0x20/0x64
- async_resume from async_run_entry_fn+0x40/0x15c
- async_run_entry_fn from process_scheduled_works+0xbc/0x6a8
- process_scheduled_works from worker_thread+0x188/0x454
- worker_thread from kthread+0x108/0x140
- kthread from ret_from_fork+0x14/0x28
-Exception stack(0xf1625fb0 to 0xf1625ff8)
-...
----[ end trace 0000000000000000 ]---
-
-Fixes: d69f0a43c677 ("Input: use input_device_enabled()")
-Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
-Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
-Link: https://lore.kernel.org/r/20231009121018.1075318-1-m.szyprowski@samsung.com
-Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/input/mouse/cyapa.c | 12 +++++++++++-
- 1 file changed, 11 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c
-index 5979deabe23d1..256f757a13267 100644
---- a/drivers/input/mouse/cyapa.c
-+++ b/drivers/input/mouse/cyapa.c
-@@ -1347,10 +1347,16 @@ static int cyapa_suspend(struct device *dev)
- u8 power_mode;
- int error;
-
-- error = mutex_lock_interruptible(&cyapa->state_sync_lock);
-+ error = mutex_lock_interruptible(&cyapa->input->mutex);
- if (error)
- return error;
-
-+ error = mutex_lock_interruptible(&cyapa->state_sync_lock);
-+ if (error) {
-+ mutex_unlock(&cyapa->input->mutex);
-+ return error;
-+ }
-+
- /*
- * Runtime PM is enable only when device is in operational mode and
- * users in use, so need check it before disable it to
-@@ -1385,6 +1391,8 @@ static int cyapa_suspend(struct device *dev)
- cyapa->irq_wake = (enable_irq_wake(client->irq) == 0);
-
- mutex_unlock(&cyapa->state_sync_lock);
-+ mutex_unlock(&cyapa->input->mutex);
-+
- return 0;
- }
-
-@@ -1394,6 +1402,7 @@ static int cyapa_resume(struct device *dev)
- struct cyapa *cyapa = i2c_get_clientdata(client);
- int error;
-
-+ mutex_lock(&cyapa->input->mutex);
- mutex_lock(&cyapa->state_sync_lock);
-
- if (device_may_wakeup(dev) && cyapa->irq_wake) {
-@@ -1412,6 +1421,7 @@ static int cyapa_resume(struct device *dev)
- enable_irq(client->irq);
-
- mutex_unlock(&cyapa->state_sync_lock);
-+ mutex_unlock(&cyapa->input->mutex);
- return 0;
- }
-
---
-2.43.0
-
+++ /dev/null
-From 9172690a818c1452fa5f01405a3bf268f1dc6a9a Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 28 Mar 2024 13:28:56 -0700
-Subject: Input: ims-pcu - fix printf string overflow
-
-From: Arnd Bergmann <arnd@arndb.de>
-
-[ Upstream commit bf32bceedd0453c70d9d022e2e29f98e446d7161 ]
-
-clang warns about a string overflow in this driver
-
-drivers/input/misc/ims-pcu.c:1802:2: error: 'snprintf' will always be truncated; specified size is 10, but format string expands to at least 12 [-Werror,-Wformat-truncation]
-drivers/input/misc/ims-pcu.c:1814:2: error: 'snprintf' will always be truncated; specified size is 10, but format string expands to at least 12 [-Werror,-Wformat-truncation]
-
-Make the buffer a little longer to ensure it always fits.
-
-Fixes: 628329d52474 ("Input: add IMS Passenger Control Unit driver")
-Signed-off-by: Arnd Bergmann <arnd@arndb.de>
-Link: https://lore.kernel.org/r/20240326223825.4084412-7-arnd@kernel.org
-Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/input/misc/ims-pcu.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c
-index 6e8cc28debd97..80d16c92a08b3 100644
---- a/drivers/input/misc/ims-pcu.c
-+++ b/drivers/input/misc/ims-pcu.c
-@@ -42,8 +42,8 @@ struct ims_pcu_backlight {
- #define IMS_PCU_PART_NUMBER_LEN 15
- #define IMS_PCU_SERIAL_NUMBER_LEN 8
- #define IMS_PCU_DOM_LEN 8
--#define IMS_PCU_FW_VERSION_LEN (9 + 1)
--#define IMS_PCU_BL_VERSION_LEN (9 + 1)
-+#define IMS_PCU_FW_VERSION_LEN 16
-+#define IMS_PCU_BL_VERSION_LEN 16
- #define IMS_PCU_BL_RESET_REASON_LEN (2 + 1)
-
- #define IMS_PCU_PCU_B_DEVICE_ID 5
---
-2.43.0
-
+++ /dev/null
-From edb1ea5ceba8108852bc46b4ca73926321c49b95 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 15 Mar 2024 12:46:14 -0700
-Subject: Input: ioc3kbd - add device table
-
-From: Karel Balej <balejk@matfyz.cz>
-
-[ Upstream commit d40e9edcf3eb925c259df9f9dd7319a4fcbc675b ]
-
-Without the device table the driver will not auto-load when compiled as
-a module.
-
-Fixes: 273db8f03509 ("Input: add IOC3 serio driver")
-Signed-off-by: Karel Balej <balejk@matfyz.cz>
-Link: https://lore.kernel.org/r/20240313115832.8052-1-balejk@matfyz.cz
-Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/input/serio/ioc3kbd.c | 7 +++++++
- 1 file changed, 7 insertions(+)
-
-diff --git a/drivers/input/serio/ioc3kbd.c b/drivers/input/serio/ioc3kbd.c
-index 50552dc7b4f5e..676b0bda3d720 100644
---- a/drivers/input/serio/ioc3kbd.c
-+++ b/drivers/input/serio/ioc3kbd.c
-@@ -200,9 +200,16 @@ static void ioc3kbd_remove(struct platform_device *pdev)
- serio_unregister_port(d->aux);
- }
-
-+static const struct platform_device_id ioc3kbd_id_table[] = {
-+ { "ioc3-kbd", },
-+ { }
-+};
-+MODULE_DEVICE_TABLE(platform, ioc3kbd_id_table);
-+
- static struct platform_driver ioc3kbd_driver = {
- .probe = ioc3kbd_probe,
- .remove_new = ioc3kbd_remove,
-+ .id_table = ioc3kbd_id_table,
- .driver = {
- .name = "ioc3-kbd",
- },
---
-2.43.0
-
+++ /dev/null
-From 4861f981df98f466697e01ed0c7a4dee9655cefb Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 15 Apr 2024 16:03:40 -0700
-Subject: Input: pm8xxx-vibrator - correct VIB_MAX_LEVELS calculation
-
-From: Fenglin Wu <quic_fenglinw@quicinc.com>
-
-[ Upstream commit 48c0687a322d54ac7e7a685c0b6db78d78f593af ]
-
-The output voltage is inclusive hence the max level calculation is
-off-by-one-step. Correct it.
-
-iWhile we are at it also add a define for the step size instead of
-using the magic value.
-
-Fixes: 11205bb63e5c ("Input: add support for pm8xxx based vibrator driver")
-Signed-off-by: Fenglin Wu <quic_fenglinw@quicinc.com>
-Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-Link: https://lore.kernel.org/r/20240412-pm8xxx-vibrator-new-design-v10-1-0ec0ad133866@quicinc.com
-Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/input/misc/pm8xxx-vibrator.c | 7 ++++---
- 1 file changed, 4 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/input/misc/pm8xxx-vibrator.c b/drivers/input/misc/pm8xxx-vibrator.c
-index 5c288fe7accf1..79f478d3a9b37 100644
---- a/drivers/input/misc/pm8xxx-vibrator.c
-+++ b/drivers/input/misc/pm8xxx-vibrator.c
-@@ -13,7 +13,8 @@
-
- #define VIB_MAX_LEVEL_mV (3100)
- #define VIB_MIN_LEVEL_mV (1200)
--#define VIB_MAX_LEVELS (VIB_MAX_LEVEL_mV - VIB_MIN_LEVEL_mV)
-+#define VIB_PER_STEP_mV (100)
-+#define VIB_MAX_LEVELS (VIB_MAX_LEVEL_mV - VIB_MIN_LEVEL_mV + VIB_PER_STEP_mV)
-
- #define MAX_FF_SPEED 0xff
-
-@@ -117,10 +118,10 @@ static void pm8xxx_work_handler(struct work_struct *work)
- vib->active = true;
- vib->level = ((VIB_MAX_LEVELS * vib->speed) / MAX_FF_SPEED) +
- VIB_MIN_LEVEL_mV;
-- vib->level /= 100;
-+ vib->level /= VIB_PER_STEP_mV;
- } else {
- vib->active = false;
-- vib->level = VIB_MIN_LEVEL_mV / 100;
-+ vib->level = VIB_MIN_LEVEL_mV / VIB_PER_STEP_mV;
- }
-
- pm8xxx_vib_set(vib, vib->active);
---
-2.43.0
-
+++ /dev/null
-From 595e3741a1867e1affe6172a9bbfe271843a6240 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 26 Mar 2024 20:42:33 +0100
-Subject: interconnect: qcom: qcm2290: Fix mas_snoc_bimc QoS port assignment
-
-From: Konrad Dybcio <konrad.dybcio@linaro.org>
-
-[ Upstream commit 230d05b1179f6ce6f8dc8a2b99eba92799ac22d7 ]
-
-The value was wrong, resulting in misprogramming of the hardware.
-Fix it.
-
-Fixes: 1a14b1ac3935 ("interconnect: qcom: Add QCM2290 driver support")
-Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
-Link: https://lore.kernel.org/r/20240326-topic-rpm_icc_qos_cleanup-v1-2-357e736792be@linaro.org
-Signed-off-by: Georgi Djakov <djakov@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/interconnect/qcom/qcm2290.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/interconnect/qcom/qcm2290.c b/drivers/interconnect/qcom/qcm2290.c
-index 96735800b13c0..ba4cc08684d63 100644
---- a/drivers/interconnect/qcom/qcm2290.c
-+++ b/drivers/interconnect/qcom/qcm2290.c
-@@ -164,7 +164,7 @@ static struct qcom_icc_node mas_snoc_bimc = {
- .name = "mas_snoc_bimc",
- .buswidth = 16,
- .qos.ap_owned = true,
-- .qos.qos_port = 2,
-+ .qos.qos_port = 6,
- .qos.qos_mode = NOC_QOS_MODE_BYPASS,
- .mas_rpm_id = 164,
- .slv_rpm_id = -1,
---
-2.43.0
-
+++ /dev/null
-From 1b5451a77ccb865ecdde404c01bb23dae86edd48 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 26 Apr 2024 15:19:52 +0000
-Subject: ipv6: introduce dst_rt6_info() helper
-
-From: Eric Dumazet <edumazet@google.com>
-
-[ Upstream commit e8dfd42c17faf183415323db1ef0c977be0d6489 ]
-
-Instead of (struct rt6_info *)dst casts, we can use :
-
- #define dst_rt6_info(_ptr) \
- container_of_const(_ptr, struct rt6_info, dst)
-
-Some places needed missing const qualifiers :
-
-ip6_confirm_neigh(), ipv6_anycast_destination(),
-ipv6_unicast_destination(), has_gateway()
-
-v2: added missing parts (David Ahern)
-
-Signed-off-by: Eric Dumazet <edumazet@google.com>
-Reviewed-by: David Ahern <dsahern@kernel.org>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-Stable-dep-of: 92f1655aa2b2 ("net: fix __dst_negative_advice() race")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/infiniband/core/addr.c | 6 ++--
- .../ethernet/mellanox/mlxsw/spectrum_span.c | 2 +-
- drivers/net/vrf.c | 2 +-
- drivers/net/vxlan/vxlan_core.c | 2 +-
- drivers/s390/net/qeth_core.h | 4 +--
- include/net/ip6_fib.h | 6 ++--
- include/net/ip6_route.h | 11 ++++----
- net/bluetooth/6lowpan.c | 2 +-
- net/core/dst_cache.c | 2 +-
- net/core/filter.c | 2 +-
- net/ipv4/ip_tunnel.c | 2 +-
- net/ipv6/icmp.c | 8 +++---
- net/ipv6/ila/ila_lwt.c | 4 +--
- net/ipv6/ip6_output.c | 18 ++++++------
- net/ipv6/ip6mr.c | 2 +-
- net/ipv6/ndisc.c | 2 +-
- net/ipv6/ping.c | 2 +-
- net/ipv6/raw.c | 4 +--
- net/ipv6/route.c | 28 +++++++++----------
- net/ipv6/tcp_ipv6.c | 4 +--
- net/ipv6/udp.c | 11 +++-----
- net/ipv6/xfrm6_policy.c | 2 +-
- net/l2tp/l2tp_ip6.c | 2 +-
- net/mpls/mpls_iptunnel.c | 2 +-
- net/netfilter/ipvs/ip_vs_xmit.c | 14 +++++-----
- net/netfilter/nf_flow_table_core.c | 8 ++----
- net/netfilter/nf_flow_table_ip.c | 4 +--
- net/netfilter/nft_rt.c | 2 +-
- net/sctp/ipv6.c | 2 +-
- net/xfrm/xfrm_policy.c | 3 +-
- 30 files changed, 77 insertions(+), 86 deletions(-)
-
-diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c
-index f253295795f0a..f20dfe70fa0e4 100644
---- a/drivers/infiniband/core/addr.c
-+++ b/drivers/infiniband/core/addr.c
-@@ -348,15 +348,15 @@ static int dst_fetch_ha(const struct dst_entry *dst,
-
- static bool has_gateway(const struct dst_entry *dst, sa_family_t family)
- {
-- struct rtable *rt;
-- struct rt6_info *rt6;
-+ const struct rtable *rt;
-+ const struct rt6_info *rt6;
-
- if (family == AF_INET) {
- rt = container_of(dst, struct rtable, dst);
- return rt->rt_uses_gateway;
- }
-
-- rt6 = container_of(dst, struct rt6_info, dst);
-+ rt6 = dst_rt6_info(dst);
- return rt6->rt6i_flags & RTF_GATEWAY;
- }
-
-diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c
-index af50ff9e5f267..ce49c9514f911 100644
---- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c
-+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c
-@@ -539,7 +539,7 @@ mlxsw_sp_span_gretap6_route(const struct net_device *to_dev,
- if (!dst || dst->error)
- goto out;
-
-- rt6 = container_of(dst, struct rt6_info, dst);
-+ rt6 = dst_rt6_info(dst);
-
- dev = dst->dev;
- *saddrp = fl6.saddr;
-diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
-index bb95ce43cd97d..71cfa03a77449 100644
---- a/drivers/net/vrf.c
-+++ b/drivers/net/vrf.c
-@@ -653,7 +653,7 @@ static int vrf_finish_output6(struct net *net, struct sock *sk,
- skb->dev = dev;
-
- rcu_read_lock();
-- nexthop = rt6_nexthop((struct rt6_info *)dst, &ipv6_hdr(skb)->daddr);
-+ nexthop = rt6_nexthop(dst_rt6_info(dst), &ipv6_hdr(skb)->daddr);
- neigh = __ipv6_neigh_lookup_noref(dst->dev, nexthop);
- if (unlikely(!neigh))
- neigh = __neigh_create(&nd_tbl, nexthop, dst->dev, false);
-diff --git a/drivers/net/vxlan/vxlan_core.c b/drivers/net/vxlan/vxlan_core.c
-index 0a0b4a9717cec..9ae844d3b969c 100644
---- a/drivers/net/vxlan/vxlan_core.c
-+++ b/drivers/net/vxlan/vxlan_core.c
-@@ -2528,7 +2528,7 @@ void vxlan_xmit_one(struct sk_buff *skb, struct net_device *dev,
- }
-
- if (!info) {
-- u32 rt6i_flags = ((struct rt6_info *)ndst)->rt6i_flags;
-+ u32 rt6i_flags = dst_rt6_info(ndst)->rt6i_flags;
-
- err = encap_bypass_if_local(skb, dev, vxlan, AF_INET6,
- dst_port, ifindex, vni,
-diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h
-index 613eab7297046..5f17a2a5d0e33 100644
---- a/drivers/s390/net/qeth_core.h
-+++ b/drivers/s390/net/qeth_core.h
-@@ -956,7 +956,7 @@ static inline struct dst_entry *qeth_dst_check_rcu(struct sk_buff *skb,
- struct dst_entry *dst = skb_dst(skb);
- struct rt6_info *rt;
-
-- rt = (struct rt6_info *) dst;
-+ rt = dst_rt6_info(dst);
- if (dst) {
- if (proto == htons(ETH_P_IPV6))
- dst = dst_check(dst, rt6_get_cookie(rt));
-@@ -978,7 +978,7 @@ static inline __be32 qeth_next_hop_v4_rcu(struct sk_buff *skb,
- static inline struct in6_addr *qeth_next_hop_v6_rcu(struct sk_buff *skb,
- struct dst_entry *dst)
- {
-- struct rt6_info *rt = (struct rt6_info *) dst;
-+ struct rt6_info *rt = dst_rt6_info(dst);
-
- if (rt && !ipv6_addr_any(&rt->rt6i_gateway))
- return &rt->rt6i_gateway;
-diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
-index 9ba6413fd2e3e..1121d614942c8 100644
---- a/include/net/ip6_fib.h
-+++ b/include/net/ip6_fib.h
-@@ -237,9 +237,11 @@ struct fib6_result {
- for (rt = (w)->leaf; rt; \
- rt = rcu_dereference_protected(rt->fib6_next, 1))
-
--static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst)
-+#define dst_rt6_info(_ptr) container_of_const(_ptr, struct rt6_info, dst)
-+
-+static inline struct inet6_dev *ip6_dst_idev(const struct dst_entry *dst)
- {
-- return ((struct rt6_info *)dst)->rt6i_idev;
-+ return dst_rt6_info(dst)->rt6i_idev;
- }
-
- static inline bool fib6_requires_src(const struct fib6_info *rt)
-diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
-index 28b0657902615..e94d2867770c5 100644
---- a/include/net/ip6_route.h
-+++ b/include/net/ip6_route.h
-@@ -209,12 +209,11 @@ void rt6_uncached_list_del(struct rt6_info *rt);
- static inline const struct rt6_info *skb_rt6_info(const struct sk_buff *skb)
- {
- const struct dst_entry *dst = skb_dst(skb);
-- const struct rt6_info *rt6 = NULL;
-
- if (dst)
-- rt6 = container_of(dst, struct rt6_info, dst);
-+ return dst_rt6_info(dst);
-
-- return rt6;
-+ return NULL;
- }
-
- /*
-@@ -226,7 +225,7 @@ static inline void ip6_dst_store(struct sock *sk, struct dst_entry *dst,
- {
- struct ipv6_pinfo *np = inet6_sk(sk);
-
-- np->dst_cookie = rt6_get_cookie((struct rt6_info *)dst);
-+ np->dst_cookie = rt6_get_cookie(dst_rt6_info(dst));
- sk_setup_caps(sk, dst);
- np->daddr_cache = daddr;
- #ifdef CONFIG_IPV6_SUBTREES
-@@ -239,7 +238,7 @@ void ip6_sk_dst_store_flow(struct sock *sk, struct dst_entry *dst,
-
- static inline bool ipv6_unicast_destination(const struct sk_buff *skb)
- {
-- struct rt6_info *rt = (struct rt6_info *) skb_dst(skb);
-+ const struct rt6_info *rt = dst_rt6_info(skb_dst(skb));
-
- return rt->rt6i_flags & RTF_LOCAL;
- }
-@@ -247,7 +246,7 @@ static inline bool ipv6_unicast_destination(const struct sk_buff *skb)
- static inline bool ipv6_anycast_destination(const struct dst_entry *dst,
- const struct in6_addr *daddr)
- {
-- struct rt6_info *rt = (struct rt6_info *)dst;
-+ const struct rt6_info *rt = dst_rt6_info(dst);
-
- return rt->rt6i_flags & RTF_ANYCAST ||
- (rt->rt6i_dst.plen < 127 &&
-diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
-index 715cbafbf6631..0fcaa4d832c98 100644
---- a/net/bluetooth/6lowpan.c
-+++ b/net/bluetooth/6lowpan.c
-@@ -133,7 +133,7 @@ static inline struct lowpan_peer *peer_lookup_dst(struct lowpan_btle_dev *dev,
- struct in6_addr *daddr,
- struct sk_buff *skb)
- {
-- struct rt6_info *rt = (struct rt6_info *)skb_dst(skb);
-+ struct rt6_info *rt = dst_rt6_info(skb_dst(skb));
- int count = atomic_read(&dev->peer_count);
- const struct in6_addr *nexthop;
- struct lowpan_peer *peer;
-diff --git a/net/core/dst_cache.c b/net/core/dst_cache.c
-index 0ccfd5fa5cb9b..b17171345d649 100644
---- a/net/core/dst_cache.c
-+++ b/net/core/dst_cache.c
-@@ -112,7 +112,7 @@ void dst_cache_set_ip6(struct dst_cache *dst_cache, struct dst_entry *dst,
-
- idst = this_cpu_ptr(dst_cache->cache);
- dst_cache_per_cpu_dst_set(this_cpu_ptr(dst_cache->cache), dst,
-- rt6_get_cookie((struct rt6_info *)dst));
-+ rt6_get_cookie(dst_rt6_info(dst)));
- idst->in6_saddr = *saddr;
- }
- EXPORT_SYMBOL_GPL(dst_cache_set_ip6);
-diff --git a/net/core/filter.c b/net/core/filter.c
-index 75cdaa16046bb..9c9300664320b 100644
---- a/net/core/filter.c
-+++ b/net/core/filter.c
-@@ -2215,7 +2215,7 @@ static int bpf_out_neigh_v6(struct net *net, struct sk_buff *skb,
- rcu_read_lock();
- if (!nh) {
- dst = skb_dst(skb);
-- nexthop = rt6_nexthop(container_of(dst, struct rt6_info, dst),
-+ nexthop = rt6_nexthop(dst_rt6_info(dst),
- &ipv6_hdr(skb)->daddr);
- } else {
- nexthop = &nh->ipv6_nh;
-diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
-index 55039191b8d2b..236448e57e550 100644
---- a/net/ipv4/ip_tunnel.c
-+++ b/net/ipv4/ip_tunnel.c
-@@ -544,7 +544,7 @@ static int tnl_update_pmtu(struct net_device *dev, struct sk_buff *skb,
- struct rt6_info *rt6;
- __be32 daddr;
-
-- rt6 = skb_valid_dst(skb) ? (struct rt6_info *)skb_dst(skb) :
-+ rt6 = skb_valid_dst(skb) ? dst_rt6_info(skb_dst(skb)) :
- NULL;
- daddr = md ? dst : tunnel->parms.iph.daddr;
-
-diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
-index 1635da07285f2..d285c1f6f1a61 100644
---- a/net/ipv6/icmp.c
-+++ b/net/ipv6/icmp.c
-@@ -212,7 +212,7 @@ static bool icmpv6_xrlim_allow(struct sock *sk, u8 type,
- } else if (dst->dev && (dst->dev->flags&IFF_LOOPBACK)) {
- res = true;
- } else {
-- struct rt6_info *rt = (struct rt6_info *)dst;
-+ struct rt6_info *rt = dst_rt6_info(dst);
- int tmo = net->ipv6.sysctl.icmpv6_time;
- struct inet_peer *peer;
-
-@@ -241,7 +241,7 @@ static bool icmpv6_rt_has_prefsrc(struct sock *sk, u8 type,
-
- dst = ip6_route_output(net, sk, fl6);
- if (!dst->error) {
-- struct rt6_info *rt = (struct rt6_info *)dst;
-+ struct rt6_info *rt = dst_rt6_info(dst);
- struct in6_addr prefsrc;
-
- rt6_get_prefsrc(rt, &prefsrc);
-@@ -616,7 +616,7 @@ void icmp6_send(struct sk_buff *skb, u8 type, u8 code, __u32 info,
- if (ip6_append_data(sk, icmpv6_getfrag, &msg,
- len + sizeof(struct icmp6hdr),
- sizeof(struct icmp6hdr),
-- &ipc6, &fl6, (struct rt6_info *)dst,
-+ &ipc6, &fl6, dst_rt6_info(dst),
- MSG_DONTWAIT)) {
- ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTERRORS);
- ip6_flush_pending_frames(sk);
-@@ -803,7 +803,7 @@ static enum skb_drop_reason icmpv6_echo_reply(struct sk_buff *skb)
- if (ip6_append_data(sk, icmpv6_getfrag, &msg,
- skb->len + sizeof(struct icmp6hdr),
- sizeof(struct icmp6hdr), &ipc6, &fl6,
-- (struct rt6_info *)dst, MSG_DONTWAIT)) {
-+ dst_rt6_info(dst), MSG_DONTWAIT)) {
- __ICMP6_INC_STATS(net, idev, ICMP6_MIB_OUTERRORS);
- ip6_flush_pending_frames(sk);
- } else {
-diff --git a/net/ipv6/ila/ila_lwt.c b/net/ipv6/ila/ila_lwt.c
-index 8c1ce78956bae..0601bad798221 100644
---- a/net/ipv6/ila/ila_lwt.c
-+++ b/net/ipv6/ila/ila_lwt.c
-@@ -38,7 +38,7 @@ static inline struct ila_params *ila_params_lwtunnel(
- static int ila_output(struct net *net, struct sock *sk, struct sk_buff *skb)
- {
- struct dst_entry *orig_dst = skb_dst(skb);
-- struct rt6_info *rt = (struct rt6_info *)orig_dst;
-+ struct rt6_info *rt = dst_rt6_info(orig_dst);
- struct ila_lwt *ilwt = ila_lwt_lwtunnel(orig_dst->lwtstate);
- struct dst_entry *dst;
- int err = -EINVAL;
-@@ -70,7 +70,7 @@ static int ila_output(struct net *net, struct sock *sk, struct sk_buff *skb)
- memset(&fl6, 0, sizeof(fl6));
- fl6.flowi6_oif = orig_dst->dev->ifindex;
- fl6.flowi6_iif = LOOPBACK_IFINDEX;
-- fl6.daddr = *rt6_nexthop((struct rt6_info *)orig_dst,
-+ fl6.daddr = *rt6_nexthop(dst_rt6_info(orig_dst),
- &ip6h->daddr);
-
- dst = ip6_route_output(net, NULL, &fl6);
-diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
-index 51b358f6c3918..995e560098d1c 100644
---- a/net/ipv6/ip6_output.c
-+++ b/net/ipv6/ip6_output.c
-@@ -120,7 +120,7 @@ static int ip6_finish_output2(struct net *net, struct sock *sk, struct sk_buff *
- IP6_UPD_PO_STATS(net, idev, IPSTATS_MIB_OUT, skb->len);
-
- rcu_read_lock();
-- nexthop = rt6_nexthop((struct rt6_info *)dst, daddr);
-+ nexthop = rt6_nexthop(dst_rt6_info(dst), daddr);
- neigh = __ipv6_neigh_lookup_noref(dev, nexthop);
-
- if (unlikely(IS_ERR_OR_NULL(neigh))) {
-@@ -599,7 +599,7 @@ int ip6_forward(struct sk_buff *skb)
- * send a redirect.
- */
-
-- rt = (struct rt6_info *) dst;
-+ rt = dst_rt6_info(dst);
- if (rt->rt6i_flags & RTF_GATEWAY)
- target = &rt->rt6i_gateway;
- else
-@@ -856,7 +856,7 @@ int ip6_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
- int (*output)(struct net *, struct sock *, struct sk_buff *))
- {
- struct sk_buff *frag;
-- struct rt6_info *rt = (struct rt6_info *)skb_dst(skb);
-+ struct rt6_info *rt = dst_rt6_info(skb_dst(skb));
- struct ipv6_pinfo *np = skb->sk && !dev_recursion_level() ?
- inet6_sk(skb->sk) : NULL;
- bool mono_delivery_time = skb->mono_delivery_time;
-@@ -1063,7 +1063,7 @@ static struct dst_entry *ip6_sk_dst_check(struct sock *sk,
- return NULL;
- }
-
-- rt = (struct rt6_info *)dst;
-+ rt = dst_rt6_info(dst);
- /* Yes, checking route validity in not connected
- * case is not very simple. Take into account,
- * that we do not support routing by source, TOS,
-@@ -1118,7 +1118,7 @@ static int ip6_dst_lookup_tail(struct net *net, const struct sock *sk,
- struct rt6_info *rt;
-
- *dst = ip6_route_output(net, sk, fl6);
-- rt = (*dst)->error ? NULL : (struct rt6_info *)*dst;
-+ rt = (*dst)->error ? NULL : dst_rt6_info(*dst);
-
- rcu_read_lock();
- from = rt ? rcu_dereference(rt->from) : NULL;
-@@ -1159,7 +1159,7 @@ static int ip6_dst_lookup_tail(struct net *net, const struct sock *sk,
- * dst entry and replace it instead with the
- * dst entry of the nexthop router
- */
-- rt = (struct rt6_info *) *dst;
-+ rt = dst_rt6_info(*dst);
- rcu_read_lock();
- n = __ipv6_neigh_lookup_noref(rt->dst.dev,
- rt6_nexthop(rt, &fl6->daddr));
-@@ -1423,7 +1423,7 @@ static int __ip6_append_data(struct sock *sk,
- int offset = 0;
- bool zc = false;
- u32 tskey = 0;
-- struct rt6_info *rt = (struct rt6_info *)cork->dst;
-+ struct rt6_info *rt = dst_rt6_info(cork->dst);
- bool paged, hold_tskey, extra_uref = false;
- struct ipv6_txoptions *opt = v6_cork->opt;
- int csummode = CHECKSUM_NONE;
-@@ -1877,7 +1877,7 @@ struct sk_buff *__ip6_make_skb(struct sock *sk,
- struct net *net = sock_net(sk);
- struct ipv6hdr *hdr;
- struct ipv6_txoptions *opt = v6_cork->opt;
-- struct rt6_info *rt = (struct rt6_info *)cork->base.dst;
-+ struct rt6_info *rt = dst_rt6_info(cork->base.dst);
- struct flowi6 *fl6 = &cork->fl.u.ip6;
- unsigned char proto = fl6->flowi6_proto;
-
-@@ -1949,7 +1949,7 @@ struct sk_buff *__ip6_make_skb(struct sock *sk,
- int ip6_send_skb(struct sk_buff *skb)
- {
- struct net *net = sock_net(skb->sk);
-- struct rt6_info *rt = (struct rt6_info *)skb_dst(skb);
-+ struct rt6_info *rt = dst_rt6_info(skb_dst(skb));
- int err;
-
- err = ip6_local_out(net, skb->sk, skb);
-diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
-index 9782c180fee64..5f841b5c1c59e 100644
---- a/net/ipv6/ip6mr.c
-+++ b/net/ipv6/ip6mr.c
-@@ -2276,7 +2276,7 @@ int ip6mr_get_route(struct net *net, struct sk_buff *skb, struct rtmsg *rtm,
- int err;
- struct mr_table *mrt;
- struct mfc6_cache *cache;
-- struct rt6_info *rt = (struct rt6_info *)skb_dst(skb);
-+ struct rt6_info *rt = dst_rt6_info(skb_dst(skb));
-
- mrt = ip6mr_get_table(net, RT6_TABLE_DFLT);
- if (!mrt)
-diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
-index a19999b30bc07..acf33fb83942a 100644
---- a/net/ipv6/ndisc.c
-+++ b/net/ipv6/ndisc.c
-@@ -1708,7 +1708,7 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target)
- if (IS_ERR(dst))
- return;
-
-- rt = (struct rt6_info *) dst;
-+ rt = dst_rt6_info(dst);
-
- if (rt->rt6i_flags & RTF_GATEWAY) {
- ND_PRINTK(2, warn,
-diff --git a/net/ipv6/ping.c b/net/ipv6/ping.c
-index ef2059c889554..88b3fcacd4f94 100644
---- a/net/ipv6/ping.c
-+++ b/net/ipv6/ping.c
-@@ -154,7 +154,7 @@ static int ping_v6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
- dst = ip6_sk_dst_lookup_flow(sk, &fl6, daddr, false);
- if (IS_ERR(dst))
- return PTR_ERR(dst);
-- rt = (struct rt6_info *) dst;
-+ rt = dst_rt6_info(dst);
-
- if (!fl6.flowi6_oif && ipv6_addr_is_multicast(&fl6.daddr))
- fl6.flowi6_oif = READ_ONCE(np->mcast_oif);
-diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
-index 03dbb874c363b..b97a5eb0b0bc8 100644
---- a/net/ipv6/raw.c
-+++ b/net/ipv6/raw.c
-@@ -592,7 +592,7 @@ static int rawv6_send_hdrinc(struct sock *sk, struct msghdr *msg, int length,
- struct ipv6hdr *iph;
- struct sk_buff *skb;
- int err;
-- struct rt6_info *rt = (struct rt6_info *)*dstp;
-+ struct rt6_info *rt = dst_rt6_info(*dstp);
- int hlen = LL_RESERVED_SPACE(rt->dst.dev);
- int tlen = rt->dst.dev->needed_tailroom;
-
-@@ -911,7 +911,7 @@ static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
- ipc6.opt = opt;
- lock_sock(sk);
- err = ip6_append_data(sk, raw6_getfrag, &rfv,
-- len, 0, &ipc6, &fl6, (struct rt6_info *)dst,
-+ len, 0, &ipc6, &fl6, dst_rt6_info(dst),
- msg->msg_flags);
-
- if (err)
-diff --git a/net/ipv6/route.c b/net/ipv6/route.c
-index ef815ba583a8f..0d6dd1f0c51eb 100644
---- a/net/ipv6/route.c
-+++ b/net/ipv6/route.c
-@@ -226,7 +226,7 @@ static struct neighbour *ip6_dst_neigh_lookup(const struct dst_entry *dst,
- struct sk_buff *skb,
- const void *daddr)
- {
-- const struct rt6_info *rt = container_of(dst, struct rt6_info, dst);
-+ const struct rt6_info *rt = dst_rt6_info(dst);
-
- return ip6_neigh_lookup(rt6_nexthop(rt, &in6addr_any),
- dst->dev, skb, daddr);
-@@ -234,8 +234,8 @@ static struct neighbour *ip6_dst_neigh_lookup(const struct dst_entry *dst,
-
- static void ip6_confirm_neigh(const struct dst_entry *dst, const void *daddr)
- {
-+ const struct rt6_info *rt = dst_rt6_info(dst);
- struct net_device *dev = dst->dev;
-- struct rt6_info *rt = (struct rt6_info *)dst;
-
- daddr = choose_neigh_daddr(rt6_nexthop(rt, &in6addr_any), NULL, daddr);
- if (!daddr)
-@@ -354,7 +354,7 @@ EXPORT_SYMBOL(ip6_dst_alloc);
-
- static void ip6_dst_destroy(struct dst_entry *dst)
- {
-- struct rt6_info *rt = (struct rt6_info *)dst;
-+ struct rt6_info *rt = dst_rt6_info(dst);
- struct fib6_info *from;
- struct inet6_dev *idev;
-
-@@ -373,7 +373,7 @@ static void ip6_dst_destroy(struct dst_entry *dst)
-
- static void ip6_dst_ifdown(struct dst_entry *dst, struct net_device *dev)
- {
-- struct rt6_info *rt = (struct rt6_info *)dst;
-+ struct rt6_info *rt = dst_rt6_info(dst);
- struct inet6_dev *idev = rt->rt6i_idev;
-
- if (idev && idev->dev != blackhole_netdev) {
-@@ -1278,7 +1278,7 @@ struct rt6_info *rt6_lookup(struct net *net, const struct in6_addr *daddr,
-
- dst = fib6_rule_lookup(net, &fl6, skb, flags, ip6_pol_route_lookup);
- if (dst->error == 0)
-- return (struct rt6_info *) dst;
-+ return dst_rt6_info(dst);
-
- dst_release(dst);
-
-@@ -2637,7 +2637,7 @@ struct dst_entry *ip6_route_output_flags(struct net *net,
-
- rcu_read_lock();
- dst = ip6_route_output_flags_noref(net, sk, fl6, flags);
-- rt6 = (struct rt6_info *)dst;
-+ rt6 = dst_rt6_info(dst);
- /* For dst cached in uncached_list, refcnt is already taken. */
- if (list_empty(&rt6->dst.rt_uncached) && !dst_hold_safe(dst)) {
- dst = &net->ipv6.ip6_null_entry->dst;
-@@ -2651,7 +2651,7 @@ EXPORT_SYMBOL_GPL(ip6_route_output_flags);
-
- struct dst_entry *ip6_blackhole_route(struct net *net, struct dst_entry *dst_orig)
- {
-- struct rt6_info *rt, *ort = (struct rt6_info *) dst_orig;
-+ struct rt6_info *rt, *ort = dst_rt6_info(dst_orig);
- struct net_device *loopback_dev = net->loopback_dev;
- struct dst_entry *new = NULL;
-
-@@ -2734,7 +2734,7 @@ INDIRECT_CALLABLE_SCOPE struct dst_entry *ip6_dst_check(struct dst_entry *dst,
- struct fib6_info *from;
- struct rt6_info *rt;
-
-- rt = container_of(dst, struct rt6_info, dst);
-+ rt = dst_rt6_info(dst);
-
- if (rt->sernum)
- return rt6_is_valid(rt) ? dst : NULL;
-@@ -2762,7 +2762,7 @@ EXPORT_INDIRECT_CALLABLE(ip6_dst_check);
-
- static struct dst_entry *ip6_negative_advice(struct dst_entry *dst)
- {
-- struct rt6_info *rt = (struct rt6_info *) dst;
-+ struct rt6_info *rt = dst_rt6_info(dst);
-
- if (rt) {
- if (rt->rt6i_flags & RTF_CACHE) {
-@@ -2786,7 +2786,7 @@ static void ip6_link_failure(struct sk_buff *skb)
-
- icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_ADDR_UNREACH, 0);
-
-- rt = (struct rt6_info *) skb_dst(skb);
-+ rt = dst_rt6_info(skb_dst(skb));
- if (rt) {
- rcu_read_lock();
- if (rt->rt6i_flags & RTF_CACHE) {
-@@ -2842,7 +2842,7 @@ static void __ip6_rt_update_pmtu(struct dst_entry *dst, const struct sock *sk,
- bool confirm_neigh)
- {
- const struct in6_addr *daddr, *saddr;
-- struct rt6_info *rt6 = (struct rt6_info *)dst;
-+ struct rt6_info *rt6 = dst_rt6_info(dst);
-
- /* Note: do *NOT* check dst_metric_locked(dst, RTAX_MTU)
- * IPv6 pmtu discovery isn't optional, so 'mtu lock' cannot disable it.
-@@ -4165,7 +4165,7 @@ static void rt6_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_bu
- }
- }
-
-- rt = (struct rt6_info *) dst;
-+ rt = dst_rt6_info(dst);
- if (rt->rt6i_flags & RTF_REJECT) {
- net_dbg_ratelimited("rt6_redirect: source isn't a valid nexthop for redirect target\n");
- return;
-@@ -5597,7 +5597,7 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb,
- int iif, int type, u32 portid, u32 seq,
- unsigned int flags)
- {
-- struct rt6_info *rt6 = (struct rt6_info *)dst;
-+ struct rt6_info *rt6 = dst_rt6_info(dst);
- struct rt6key *rt6_dst, *rt6_src;
- u32 *pmetrics, table, rt6_flags;
- unsigned char nh_flags = 0;
-@@ -6100,7 +6100,7 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh,
- }
-
-
-- rt = container_of(dst, struct rt6_info, dst);
-+ rt = dst_rt6_info(dst);
- if (rt->dst.error) {
- err = rt->dst.error;
- ip6_rt_put(rt);
-diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
-index 012adcfcabeb5..b23e4b2873138 100644
---- a/net/ipv6/tcp_ipv6.c
-+++ b/net/ipv6/tcp_ipv6.c
-@@ -94,11 +94,9 @@ static void inet6_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb)
- struct dst_entry *dst = skb_dst(skb);
-
- if (dst && dst_hold_safe(dst)) {
-- const struct rt6_info *rt = (const struct rt6_info *)dst;
--
- rcu_assign_pointer(sk->sk_rx_dst, dst);
- sk->sk_rx_dst_ifindex = skb->skb_iif;
-- sk->sk_rx_dst_cookie = rt6_get_cookie(rt);
-+ sk->sk_rx_dst_cookie = rt6_get_cookie(dst_rt6_info(dst));
- }
- }
-
-diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
-index 936b51f358a9a..9a9434c4cc893 100644
---- a/net/ipv6/udp.c
-+++ b/net/ipv6/udp.c
-@@ -913,11 +913,8 @@ static int __udp6_lib_mcast_deliver(struct net *net, struct sk_buff *skb,
-
- static void udp6_sk_rx_dst_set(struct sock *sk, struct dst_entry *dst)
- {
-- if (udp_sk_rx_dst_set(sk, dst)) {
-- const struct rt6_info *rt = (const struct rt6_info *)dst;
--
-- sk->sk_rx_dst_cookie = rt6_get_cookie(rt);
-- }
-+ if (udp_sk_rx_dst_set(sk, dst))
-+ sk->sk_rx_dst_cookie = rt6_get_cookie(dst_rt6_info(dst));
- }
-
- /* wrapper for udp_queue_rcv_skb tacking care of csum conversion and
-@@ -1587,7 +1584,7 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
-
- skb = ip6_make_skb(sk, getfrag, msg, ulen,
- sizeof(struct udphdr), &ipc6,
-- (struct rt6_info *)dst,
-+ dst_rt6_info(dst),
- msg->msg_flags, &cork);
- err = PTR_ERR(skb);
- if (!IS_ERR_OR_NULL(skb))
-@@ -1614,7 +1611,7 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
- ipc6.dontfrag = inet6_test_bit(DONTFRAG, sk);
- up->len += ulen;
- err = ip6_append_data(sk, getfrag, msg, ulen, sizeof(struct udphdr),
-- &ipc6, fl6, (struct rt6_info *)dst,
-+ &ipc6, fl6, dst_rt6_info(dst),
- corkreq ? msg->msg_flags|MSG_MORE : msg->msg_flags);
- if (err)
- udp_v6_flush_pending_frames(sk);
-diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
-index 42fb6996b0777..ce48173c60e56 100644
---- a/net/ipv6/xfrm6_policy.c
-+++ b/net/ipv6/xfrm6_policy.c
-@@ -70,7 +70,7 @@ static int xfrm6_get_saddr(struct net *net, int oif,
- static int xfrm6_fill_dst(struct xfrm_dst *xdst, struct net_device *dev,
- const struct flowi *fl)
- {
-- struct rt6_info *rt = (struct rt6_info *)xdst->route;
-+ struct rt6_info *rt = dst_rt6_info(xdst->route);
-
- xdst->u.dst.dev = dev;
- netdev_hold(dev, &xdst->u.dst.dev_tracker, GFP_ATOMIC);
-diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c
-index 7bf14cf9ffaa9..8780ec64f3769 100644
---- a/net/l2tp/l2tp_ip6.c
-+++ b/net/l2tp/l2tp_ip6.c
-@@ -630,7 +630,7 @@ static int l2tp_ip6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
- ulen = len + (skb_queue_empty(&sk->sk_write_queue) ? transhdrlen : 0);
- err = ip6_append_data(sk, ip_generic_getfrag, msg,
- ulen, transhdrlen, &ipc6,
-- &fl6, (struct rt6_info *)dst,
-+ &fl6, dst_rt6_info(dst),
- msg->msg_flags);
- if (err)
- ip6_flush_pending_frames(sk);
-diff --git a/net/mpls/mpls_iptunnel.c b/net/mpls/mpls_iptunnel.c
-index ef59e25dc4827..8985abcb7a058 100644
---- a/net/mpls/mpls_iptunnel.c
-+++ b/net/mpls/mpls_iptunnel.c
-@@ -92,7 +92,7 @@ static int mpls_xmit(struct sk_buff *skb)
- ttl = net->mpls.default_ttl;
- else
- ttl = ipv6_hdr(skb)->hop_limit;
-- rt6 = (struct rt6_info *)dst;
-+ rt6 = dst_rt6_info(dst);
- } else {
- goto drop;
- }
-diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c
-index 65e0259178da4..5cd511162bc03 100644
---- a/net/netfilter/ipvs/ip_vs_xmit.c
-+++ b/net/netfilter/ipvs/ip_vs_xmit.c
-@@ -180,7 +180,7 @@ static inline bool crosses_local_route_boundary(int skb_af, struct sk_buff *skb,
- (!skb->dev || skb->dev->flags & IFF_LOOPBACK) &&
- (addr_type & IPV6_ADDR_LOOPBACK);
- old_rt_is_local = __ip_vs_is_local_route6(
-- (struct rt6_info *)skb_dst(skb));
-+ dst_rt6_info(skb_dst(skb)));
- } else
- #endif
- {
-@@ -481,7 +481,7 @@ __ip_vs_get_out_rt_v6(struct netns_ipvs *ipvs, int skb_af, struct sk_buff *skb,
- if (dest) {
- dest_dst = __ip_vs_dst_check(dest);
- if (likely(dest_dst))
-- rt = (struct rt6_info *) dest_dst->dst_cache;
-+ rt = dst_rt6_info(dest_dst->dst_cache);
- else {
- u32 cookie;
-
-@@ -501,7 +501,7 @@ __ip_vs_get_out_rt_v6(struct netns_ipvs *ipvs, int skb_af, struct sk_buff *skb,
- ip_vs_dest_dst_free(dest_dst);
- goto err_unreach;
- }
-- rt = (struct rt6_info *) dst;
-+ rt = dst_rt6_info(dst);
- cookie = rt6_get_cookie(rt);
- __ip_vs_dst_set(dest, dest_dst, &rt->dst, cookie);
- spin_unlock_bh(&dest->dst_lock);
-@@ -517,7 +517,7 @@ __ip_vs_get_out_rt_v6(struct netns_ipvs *ipvs, int skb_af, struct sk_buff *skb,
- rt_mode);
- if (!dst)
- goto err_unreach;
-- rt = (struct rt6_info *) dst;
-+ rt = dst_rt6_info(dst);
- }
-
- local = __ip_vs_is_local_route6(rt);
-@@ -862,7 +862,7 @@ ip_vs_nat_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
- IP_VS_RT_MODE_RDR);
- if (local < 0)
- goto tx_error;
-- rt = (struct rt6_info *) skb_dst(skb);
-+ rt = dst_rt6_info(skb_dst(skb));
- /*
- * Avoid duplicate tuple in reply direction for NAT traffic
- * to local address when connection is sync-ed
-@@ -1288,7 +1288,7 @@ ip_vs_tunnel_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
- if (local)
- return ip_vs_send_or_cont(NFPROTO_IPV6, skb, cp, 1);
-
-- rt = (struct rt6_info *) skb_dst(skb);
-+ rt = dst_rt6_info(skb_dst(skb));
- tdev = rt->dst.dev;
-
- /*
-@@ -1590,7 +1590,7 @@ ip_vs_icmp_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
- &cp->daddr.in6, NULL, ipvsh, 0, rt_mode);
- if (local < 0)
- goto tx_error;
-- rt = (struct rt6_info *) skb_dst(skb);
-+ rt = dst_rt6_info(skb_dst(skb));
- /*
- * Avoid duplicate tuple in reply direction for NAT traffic
- * to local address when connection is sync-ed
-diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c
-index a0571339239c4..5c1ff07eaee0b 100644
---- a/net/netfilter/nf_flow_table_core.c
-+++ b/net/netfilter/nf_flow_table_core.c
-@@ -77,12 +77,8 @@ EXPORT_SYMBOL_GPL(flow_offload_alloc);
-
- static u32 flow_offload_dst_cookie(struct flow_offload_tuple *flow_tuple)
- {
-- const struct rt6_info *rt;
--
-- if (flow_tuple->l3proto == NFPROTO_IPV6) {
-- rt = (const struct rt6_info *)flow_tuple->dst_cache;
-- return rt6_get_cookie(rt);
-- }
-+ if (flow_tuple->l3proto == NFPROTO_IPV6)
-+ return rt6_get_cookie(dst_rt6_info(flow_tuple->dst_cache));
-
- return 0;
- }
-diff --git a/net/netfilter/nf_flow_table_ip.c b/net/netfilter/nf_flow_table_ip.c
-index 5383bed3d3e00..100887beed314 100644
---- a/net/netfilter/nf_flow_table_ip.c
-+++ b/net/netfilter/nf_flow_table_ip.c
-@@ -729,7 +729,7 @@ nf_flow_offload_ipv6_hook(void *priv, struct sk_buff *skb,
- return NF_ACCEPT;
-
- if (unlikely(tuplehash->tuple.xmit_type == FLOW_OFFLOAD_XMIT_XFRM)) {
-- rt = (struct rt6_info *)tuplehash->tuple.dst_cache;
-+ rt = dst_rt6_info(tuplehash->tuple.dst_cache);
- memset(skb->cb, 0, sizeof(struct inet6_skb_parm));
- IP6CB(skb)->iif = skb->dev->ifindex;
- IP6CB(skb)->flags = IP6SKB_FORWARDED;
-@@ -741,7 +741,7 @@ nf_flow_offload_ipv6_hook(void *priv, struct sk_buff *skb,
-
- switch (tuplehash->tuple.xmit_type) {
- case FLOW_OFFLOAD_XMIT_NEIGH:
-- rt = (struct rt6_info *)tuplehash->tuple.dst_cache;
-+ rt = dst_rt6_info(tuplehash->tuple.dst_cache);
- outdev = rt->dst.dev;
- skb->dev = outdev;
- nexthop = rt6_nexthop(rt, &flow->tuplehash[!dir].tuple.src_v6);
-diff --git a/net/netfilter/nft_rt.c b/net/netfilter/nft_rt.c
-index 24d9771385729..2434c624aafde 100644
---- a/net/netfilter/nft_rt.c
-+++ b/net/netfilter/nft_rt.c
-@@ -80,7 +80,7 @@ void nft_rt_get_eval(const struct nft_expr *expr,
- if (nft_pf(pkt) != NFPROTO_IPV6)
- goto err;
-
-- memcpy(dest, rt6_nexthop((struct rt6_info *)dst,
-+ memcpy(dest, rt6_nexthop(dst_rt6_info(dst),
- &ipv6_hdr(skb)->daddr),
- sizeof(struct in6_addr));
- break;
-diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c
-index 24368f755ab19..f7b809c0d142c 100644
---- a/net/sctp/ipv6.c
-+++ b/net/sctp/ipv6.c
-@@ -415,7 +415,7 @@ static void sctp_v6_get_dst(struct sctp_transport *t, union sctp_addr *saddr,
- if (!IS_ERR_OR_NULL(dst)) {
- struct rt6_info *rt;
-
-- rt = (struct rt6_info *)dst;
-+ rt = dst_rt6_info(dst);
- t->dst_cookie = rt6_get_cookie(rt);
- pr_debug("rt6_dst:%pI6/%d rt6_src:%pI6\n",
- &rt->rt6i_dst.addr, rt->rt6i_dst.plen,
-diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
-index da6ecc6b3e153..55db22473e3eb 100644
---- a/net/xfrm/xfrm_policy.c
-+++ b/net/xfrm/xfrm_policy.c
-@@ -2597,8 +2597,7 @@ static void xfrm_init_path(struct xfrm_dst *path, struct dst_entry *dst,
- int nfheader_len)
- {
- if (dst->ops->family == AF_INET6) {
-- struct rt6_info *rt = (struct rt6_info *)dst;
-- path->path_cookie = rt6_get_cookie(rt);
-+ path->path_cookie = rt6_get_cookie(dst_rt6_info(dst));
- path->u.rt6.rt6i_nfheader_len = nfheader_len;
- }
- }
---
-2.43.0
-
+++ /dev/null
-From 4412572816477c1eba7da5994d2f98b5889ec30b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 17 May 2024 08:54:35 +0800
-Subject: ipv6: sr: fix memleak in seg6_hmac_init_algo
-
-From: Hangbin Liu <liuhangbin@gmail.com>
-
-[ Upstream commit efb9f4f19f8e37fde43dfecebc80292d179f56c6 ]
-
-seg6_hmac_init_algo returns without cleaning up the previous allocations
-if one fails, so it's going to leak all that memory and the crypto tfms.
-
-Update seg6_hmac_exit to only free the memory when allocated, so we can
-reuse the code directly.
-
-Fixes: bf355b8d2c30 ("ipv6: sr: add core files for SR HMAC support")
-Reported-by: Sabrina Dubroca <sd@queasysnail.net>
-Closes: https://lore.kernel.org/netdev/Zj3bh-gE7eT6V6aH@hog/
-Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
-Reviewed-by: Simon Horman <horms@kernel.org>
-Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
-Link: https://lore.kernel.org/r/20240517005435.2600277-1-liuhangbin@gmail.com
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- net/ipv6/seg6_hmac.c | 42 ++++++++++++++++++++++++++++--------------
- 1 file changed, 28 insertions(+), 14 deletions(-)
-
-diff --git a/net/ipv6/seg6_hmac.c b/net/ipv6/seg6_hmac.c
-index d43c50a7310d6..3c3800223e0e0 100644
---- a/net/ipv6/seg6_hmac.c
-+++ b/net/ipv6/seg6_hmac.c
-@@ -354,6 +354,7 @@ static int seg6_hmac_init_algo(void)
- struct crypto_shash *tfm;
- struct shash_desc *shash;
- int i, alg_count, cpu;
-+ int ret = -ENOMEM;
-
- alg_count = ARRAY_SIZE(hmac_algos);
-
-@@ -364,12 +365,14 @@ static int seg6_hmac_init_algo(void)
- algo = &hmac_algos[i];
- algo->tfms = alloc_percpu(struct crypto_shash *);
- if (!algo->tfms)
-- return -ENOMEM;
-+ goto error_out;
-
- for_each_possible_cpu(cpu) {
- tfm = crypto_alloc_shash(algo->name, 0, 0);
-- if (IS_ERR(tfm))
-- return PTR_ERR(tfm);
-+ if (IS_ERR(tfm)) {
-+ ret = PTR_ERR(tfm);
-+ goto error_out;
-+ }
- p_tfm = per_cpu_ptr(algo->tfms, cpu);
- *p_tfm = tfm;
- }
-@@ -381,18 +384,22 @@ static int seg6_hmac_init_algo(void)
-
- algo->shashs = alloc_percpu(struct shash_desc *);
- if (!algo->shashs)
-- return -ENOMEM;
-+ goto error_out;
-
- for_each_possible_cpu(cpu) {
- shash = kzalloc_node(shsize, GFP_KERNEL,
- cpu_to_node(cpu));
- if (!shash)
-- return -ENOMEM;
-+ goto error_out;
- *per_cpu_ptr(algo->shashs, cpu) = shash;
- }
- }
-
- return 0;
-+
-+error_out:
-+ seg6_hmac_exit();
-+ return ret;
- }
-
- int __init seg6_hmac_init(void)
-@@ -410,22 +417,29 @@ int __net_init seg6_hmac_net_init(struct net *net)
- void seg6_hmac_exit(void)
- {
- struct seg6_hmac_algo *algo = NULL;
-+ struct crypto_shash *tfm;
-+ struct shash_desc *shash;
- int i, alg_count, cpu;
-
- alg_count = ARRAY_SIZE(hmac_algos);
- for (i = 0; i < alg_count; i++) {
- algo = &hmac_algos[i];
-- for_each_possible_cpu(cpu) {
-- struct crypto_shash *tfm;
-- struct shash_desc *shash;
-
-- shash = *per_cpu_ptr(algo->shashs, cpu);
-- kfree(shash);
-- tfm = *per_cpu_ptr(algo->tfms, cpu);
-- crypto_free_shash(tfm);
-+ if (algo->shashs) {
-+ for_each_possible_cpu(cpu) {
-+ shash = *per_cpu_ptr(algo->shashs, cpu);
-+ kfree(shash);
-+ }
-+ free_percpu(algo->shashs);
-+ }
-+
-+ if (algo->tfms) {
-+ for_each_possible_cpu(cpu) {
-+ tfm = *per_cpu_ptr(algo->tfms, cpu);
-+ crypto_free_shash(tfm);
-+ }
-+ free_percpu(algo->tfms);
- }
-- free_percpu(algo->tfms);
-- free_percpu(algo->shashs);
- }
- }
- EXPORT_SYMBOL(seg6_hmac_exit);
---
-2.43.0
-
+++ /dev/null
-From 711acd4e99f5d6b4ef700a604006b2b63b48dddc Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 17 May 2024 18:45:41 +0200
-Subject: ipv6: sr: fix missing sk_buff release in seg6_input_core
-
-From: Andrea Mayer <andrea.mayer@uniroma2.it>
-
-[ Upstream commit 5447f9708d9e4c17a647b16a9cb29e9e02820bd9 ]
-
-The seg6_input() function is responsible for adding the SRH into a
-packet, delegating the operation to the seg6_input_core(). This function
-uses the skb_cow_head() to ensure that there is sufficient headroom in
-the sk_buff for accommodating the link-layer header.
-In the event that the skb_cow_header() function fails, the
-seg6_input_core() catches the error but it does not release the sk_buff,
-which will result in a memory leak.
-
-This issue was introduced in commit af3b5158b89d ("ipv6: sr: fix BUG due
-to headroom too small after SRH push") and persists even after commit
-7a3f5b0de364 ("netfilter: add netfilter hooks to SRv6 data plane"),
-where the entire seg6_input() code was refactored to deal with netfilter
-hooks.
-
-The proposed patch addresses the identified memory leak by requiring the
-seg6_input_core() function to release the sk_buff in the event that
-skb_cow_head() fails.
-
-Fixes: af3b5158b89d ("ipv6: sr: fix BUG due to headroom too small after SRH push")
-Signed-off-by: Andrea Mayer <andrea.mayer@uniroma2.it>
-Reviewed-by: Simon Horman <horms@kernel.org>
-Reviewed-by: David Ahern <dsahern@kernel.org>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- net/ipv6/seg6_iptunnel.c | 11 ++++++-----
- 1 file changed, 6 insertions(+), 5 deletions(-)
-
-diff --git a/net/ipv6/seg6_iptunnel.c b/net/ipv6/seg6_iptunnel.c
-index 03b877ff45588..a75df2ec8db0d 100644
---- a/net/ipv6/seg6_iptunnel.c
-+++ b/net/ipv6/seg6_iptunnel.c
-@@ -459,10 +459,8 @@ static int seg6_input_core(struct net *net, struct sock *sk,
- int err;
-
- err = seg6_do_srh(skb);
-- if (unlikely(err)) {
-- kfree_skb(skb);
-- return err;
-- }
-+ if (unlikely(err))
-+ goto drop;
-
- slwt = seg6_lwt_lwtunnel(orig_dst->lwtstate);
-
-@@ -486,7 +484,7 @@ static int seg6_input_core(struct net *net, struct sock *sk,
-
- err = skb_cow_head(skb, LL_RESERVED_SPACE(dst->dev));
- if (unlikely(err))
-- return err;
-+ goto drop;
-
- if (static_branch_unlikely(&nf_hooks_lwtunnel_enabled))
- return NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT,
-@@ -494,6 +492,9 @@ static int seg6_input_core(struct net *net, struct sock *sk,
- skb_dst(skb)->dev, seg6_input_finish);
-
- return seg6_input_finish(dev_net(skb->dev), NULL, skb);
-+drop:
-+ kfree_skb(skb);
-+ return err;
- }
-
- static int seg6_input_nf(struct sk_buff *skb)
---
-2.43.0
-
+++ /dev/null
-From 016063ac631d44411fe694e3d912cd005ca48dab Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 29 May 2024 17:56:33 +0800
-Subject: ipvlan: Dont Use skb->sk in ipvlan_process_v{4,6}_outbound
-
-From: Yue Haibing <yuehaibing@huawei.com>
-
-[ Upstream commit b3dc6e8003b500861fa307e9a3400c52e78e4d3a ]
-
-Raw packet from PF_PACKET socket ontop of an IPv6-backed ipvlan device will
-hit WARN_ON_ONCE() in sk_mc_loop() through sch_direct_xmit() path.
-
-WARNING: CPU: 2 PID: 0 at net/core/sock.c:775 sk_mc_loop+0x2d/0x70
-Modules linked in: sch_netem ipvlan rfkill cirrus drm_shmem_helper sg drm_kms_helper
-CPU: 2 PID: 0 Comm: swapper/2 Kdump: loaded Not tainted 6.9.0+ #279
-Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
-RIP: 0010:sk_mc_loop+0x2d/0x70
-Code: fa 0f 1f 44 00 00 65 0f b7 15 f7 96 a3 4f 31 c0 66 85 d2 75 26 48 85 ff 74 1c
-RSP: 0018:ffffa9584015cd78 EFLAGS: 00010212
-RAX: 0000000000000011 RBX: ffff91e585793e00 RCX: 0000000002c6a001
-RDX: 0000000000000000 RSI: 0000000000000040 RDI: ffff91e589c0f000
-RBP: ffff91e5855bd100 R08: 0000000000000000 R09: 3d00545216f43d00
-R10: ffff91e584fdcc50 R11: 00000060dd8616f4 R12: ffff91e58132d000
-R13: ffff91e584fdcc68 R14: ffff91e5869ce800 R15: ffff91e589c0f000
-FS: 0000000000000000(0000) GS:ffff91e898100000(0000) knlGS:0000000000000000
-CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
-CR2: 00007f788f7c44c0 CR3: 0000000008e1a000 CR4: 00000000000006f0
-DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
-DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
-Call Trace:
-<IRQ>
- ? __warn (kernel/panic.c:693)
- ? sk_mc_loop (net/core/sock.c:760)
- ? report_bug (lib/bug.c:201 lib/bug.c:219)
- ? handle_bug (arch/x86/kernel/traps.c:239)
- ? exc_invalid_op (arch/x86/kernel/traps.c:260 (discriminator 1))
- ? asm_exc_invalid_op (./arch/x86/include/asm/idtentry.h:621)
- ? sk_mc_loop (net/core/sock.c:760)
- ip6_finish_output2 (net/ipv6/ip6_output.c:83 (discriminator 1))
- ? nf_hook_slow (net/netfilter/core.c:626)
- ip6_finish_output (net/ipv6/ip6_output.c:222)
- ? __pfx_ip6_finish_output (net/ipv6/ip6_output.c:215)
- ipvlan_xmit_mode_l3 (drivers/net/ipvlan/ipvlan_core.c:602) ipvlan
- ipvlan_start_xmit (drivers/net/ipvlan/ipvlan_main.c:226) ipvlan
- dev_hard_start_xmit (net/core/dev.c:3594)
- sch_direct_xmit (net/sched/sch_generic.c:343)
- __qdisc_run (net/sched/sch_generic.c:416)
- net_tx_action (net/core/dev.c:5286)
- handle_softirqs (kernel/softirq.c:555)
- __irq_exit_rcu (kernel/softirq.c:589)
- sysvec_apic_timer_interrupt (arch/x86/kernel/apic/apic.c:1043)
-
-The warning triggers as this:
-packet_sendmsg
- packet_snd //skb->sk is packet sk
- __dev_queue_xmit
- __dev_xmit_skb //q->enqueue is not NULL
- __qdisc_run
- sch_direct_xmit
- dev_hard_start_xmit
- ipvlan_start_xmit
- ipvlan_xmit_mode_l3 //l3 mode
- ipvlan_process_outbound //vepa flag
- ipvlan_process_v6_outbound
- ip6_local_out
- __ip6_finish_output
- ip6_finish_output2 //multicast packet
- sk_mc_loop //sk->sk_family is AF_PACKET
-
-Call ip{6}_local_out() with NULL sk in ipvlan as other tunnels to fix this.
-
-Fixes: 2ad7bf363841 ("ipvlan: Initial check-in of the IPVLAN driver.")
-Suggested-by: Eric Dumazet <edumazet@google.com>
-Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
-Reviewed-by: Eric Dumazet <edumazet@google.com>
-Link: https://lore.kernel.org/r/20240529095633.613103-1-yuehaibing@huawei.com
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/ipvlan/ipvlan_core.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/net/ipvlan/ipvlan_core.c b/drivers/net/ipvlan/ipvlan_core.c
-index 2d5b021b4ea60..fef4eff7753a7 100644
---- a/drivers/net/ipvlan/ipvlan_core.c
-+++ b/drivers/net/ipvlan/ipvlan_core.c
-@@ -439,7 +439,7 @@ static noinline_for_stack int ipvlan_process_v4_outbound(struct sk_buff *skb)
-
- memset(IPCB(skb), 0, sizeof(*IPCB(skb)));
-
-- err = ip_local_out(net, skb->sk, skb);
-+ err = ip_local_out(net, NULL, skb);
- if (unlikely(net_xmit_eval(err)))
- DEV_STATS_INC(dev, tx_errors);
- else
-@@ -494,7 +494,7 @@ static int ipvlan_process_v6_outbound(struct sk_buff *skb)
-
- memset(IP6CB(skb), 0, sizeof(*IP6CB(skb)));
-
-- err = ip6_local_out(dev_net(dev), skb->sk, skb);
-+ err = ip6_local_out(dev_net(dev), NULL, skb);
- if (unlikely(net_xmit_eval(err)))
- DEV_STATS_INC(dev, tx_errors);
- else
---
-2.43.0
-
+++ /dev/null
-From 1501d1295308b987149d0983507eaf484b68b0db Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 17 May 2024 15:01:18 +0200
-Subject: kasan, fortify: properly rename memintrinsics
-
-From: Andrey Konovalov <andreyknvl@gmail.com>
-
-[ Upstream commit 2e577732e8d28b9183df701fb90cb7943aa4ed16 ]
-
-After commit 69d4c0d32186 ("entry, kasan, x86: Disallow overriding mem*()
-functions") and the follow-up fixes, with CONFIG_FORTIFY_SOURCE enabled,
-even though the compiler instruments meminstrinsics by generating calls to
-__asan/__hwasan_ prefixed functions, FORTIFY_SOURCE still uses
-uninstrumented memset/memmove/memcpy as the underlying functions.
-
-As a result, KASAN cannot detect bad accesses in memset/memmove/memcpy.
-This also makes KASAN tests corrupt kernel memory and cause crashes.
-
-To fix this, use __asan_/__hwasan_memset/memmove/memcpy as the underlying
-functions whenever appropriate. Do this only for the instrumented code
-(as indicated by __SANITIZE_ADDRESS__).
-
-Link: https://lkml.kernel.org/r/20240517130118.759301-1-andrey.konovalov@linux.dev
-Fixes: 69d4c0d32186 ("entry, kasan, x86: Disallow overriding mem*() functions")
-Fixes: 51287dcb00cc ("kasan: emit different calls for instrumentable memintrinsics")
-Fixes: 36be5cba99f6 ("kasan: treat meminstrinsic as builtins in uninstrumented files")
-Signed-off-by: Andrey Konovalov <andreyknvl@gmail.com>
-Reported-by: Erhard Furtner <erhard_f@mailbox.org>
-Reported-by: Nico Pache <npache@redhat.com>
-Closes: https://lore.kernel.org/all/20240501144156.17e65021@outsider.home/
-Reviewed-by: Marco Elver <elver@google.com>
-Tested-by: Nico Pache <npache@redhat.com>
-Acked-by: Nico Pache <npache@redhat.com>
-Cc: Alexander Potapenko <glider@google.com>
-Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
-Cc: Daniel Axtens <dja@axtens.net>
-Cc: Dmitry Vyukov <dvyukov@google.com>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- include/linux/fortify-string.h | 22 ++++++++++++++++++----
- 1 file changed, 18 insertions(+), 4 deletions(-)
-
-diff --git a/include/linux/fortify-string.h b/include/linux/fortify-string.h
-index 89a6888f2f9e5..e99dbc0525751 100644
---- a/include/linux/fortify-string.h
-+++ b/include/linux/fortify-string.h
-@@ -31,17 +31,30 @@ void __write_overflow_field(size_t avail, size_t wanted) __compiletime_warning("
- __ret; \
- })
-
--#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)
-+#if defined(__SANITIZE_ADDRESS__)
-+
-+#if !defined(CONFIG_CC_HAS_KASAN_MEMINTRINSIC_PREFIX) && !defined(CONFIG_GENERIC_ENTRY)
-+extern void *__underlying_memset(void *p, int c, __kernel_size_t size) __RENAME(memset);
-+extern void *__underlying_memmove(void *p, const void *q, __kernel_size_t size) __RENAME(memmove);
-+extern void *__underlying_memcpy(void *p, const void *q, __kernel_size_t size) __RENAME(memcpy);
-+#elif defined(CONFIG_KASAN_GENERIC)
-+extern void *__underlying_memset(void *p, int c, __kernel_size_t size) __RENAME(__asan_memset);
-+extern void *__underlying_memmove(void *p, const void *q, __kernel_size_t size) __RENAME(__asan_memmove);
-+extern void *__underlying_memcpy(void *p, const void *q, __kernel_size_t size) __RENAME(__asan_memcpy);
-+#else /* CONFIG_KASAN_SW_TAGS */
-+extern void *__underlying_memset(void *p, int c, __kernel_size_t size) __RENAME(__hwasan_memset);
-+extern void *__underlying_memmove(void *p, const void *q, __kernel_size_t size) __RENAME(__hwasan_memmove);
-+extern void *__underlying_memcpy(void *p, const void *q, __kernel_size_t size) __RENAME(__hwasan_memcpy);
-+#endif
-+
- extern void *__underlying_memchr(const void *p, int c, __kernel_size_t size) __RENAME(memchr);
- extern int __underlying_memcmp(const void *p, const void *q, __kernel_size_t size) __RENAME(memcmp);
--extern void *__underlying_memcpy(void *p, const void *q, __kernel_size_t size) __RENAME(memcpy);
--extern void *__underlying_memmove(void *p, const void *q, __kernel_size_t size) __RENAME(memmove);
--extern void *__underlying_memset(void *p, int c, __kernel_size_t size) __RENAME(memset);
- extern char *__underlying_strcat(char *p, const char *q) __RENAME(strcat);
- extern char *__underlying_strcpy(char *p, const char *q) __RENAME(strcpy);
- extern __kernel_size_t __underlying_strlen(const char *p) __RENAME(strlen);
- extern char *__underlying_strncat(char *p, const char *q, __kernel_size_t count) __RENAME(strncat);
- extern char *__underlying_strncpy(char *p, const char *q, __kernel_size_t size) __RENAME(strncpy);
-+
- #else
-
- #if defined(__SANITIZE_MEMORY__)
-@@ -66,6 +79,7 @@ extern char *__underlying_strncpy(char *p, const char *q, __kernel_size_t size)
- #define __underlying_strlen __builtin_strlen
- #define __underlying_strncat __builtin_strncat
- #define __underlying_strncpy __builtin_strncpy
-+
- #endif
-
- /**
---
-2.43.0
-
+++ /dev/null
-From a117acade7508d3a8a832d2bc98926d6886aa590 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sun, 19 May 2024 18:22:27 +0900
-Subject: kconfig: fix comparison to constant symbols, 'm', 'n'
-
-From: Masahiro Yamada <masahiroy@kernel.org>
-
-[ Upstream commit aabdc960a283ba78086b0bf66ee74326f49e218e ]
-
-Currently, comparisons to 'm' or 'n' result in incorrect output.
-
-[Test Code]
-
- config MODULES
- def_bool y
- modules
-
- config A
- def_tristate m
-
- config B
- def_bool A > n
-
-CONFIG_B is unset, while CONFIG_B=y is expected.
-
-The reason for the issue is because Kconfig compares the tristate values
-as strings.
-
-Currently, the .type fields in the constant symbol definitions,
-symbol_{yes,mod,no} are unspecified, i.e., S_UNKNOWN.
-
-When expr_calc_value() evaluates 'A > n', it checks the types of 'A' and
-'n' to determine how to compare them.
-
-The left-hand side, 'A', is a tristate symbol with a value of 'm', which
-corresponds to a numeric value of 1. (Internally, 'y', 'm', and 'n' are
-represented as 2, 1, and 0, respectively.)
-
-The right-hand side, 'n', has an unknown type, so it is treated as the
-string "n" during the comparison.
-
-expr_calc_value() compares two values numerically only when both can
-have numeric values. Otherwise, they are compared as strings.
-
- symbol numeric value ASCII code
- -------------------------------------
- y 2 0x79
- m 1 0x6d
- n 0 0x6e
-
-'m' is greater than 'n' if compared numerically (since 1 is greater
-than 0), but smaller than 'n' if compared as strings (since the ASCII
-code 0x6d is smaller than 0x6e).
-
-Specifying .type=S_TRISTATE for symbol_{yes,mod,no} fixes the above
-test code.
-
-Doing so, however, would cause a regression to the following test code.
-
-[Test Code 2]
-
- config MODULES
- def_bool n
- modules
-
- config A
- def_tristate n
-
- config B
- def_bool A = m
-
-You would get CONFIG_B=y, while CONFIG_B should not be set.
-
-The reason is because sym_get_string_value() turns 'm' into 'n' when the
-module feature is disabled. Consequently, expr_calc_value() evaluates
-'A = n' instead of 'A = m'. This oddity has been hidden because the type
-of 'm' was previously S_UNKNOWN instead of S_TRISTATE.
-
-sym_get_string_value() should not tweak the string because the tristate
-value has already been correctly calculated. There is no reason to
-return the string "n" where its tristate value is mod.
-
-Fixes: 31847b67bec0 ("kconfig: allow use of relations other than (in)equality")
-Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- scripts/kconfig/symbol.c | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
-index e9e9fb8d86746..0d419b2c4ac58 100644
---- a/scripts/kconfig/symbol.c
-+++ b/scripts/kconfig/symbol.c
-@@ -13,18 +13,21 @@
-
- struct symbol symbol_yes = {
- .name = "y",
-+ .type = S_TRISTATE,
- .curr = { "y", yes },
- .flags = SYMBOL_CONST|SYMBOL_VALID,
- };
-
- struct symbol symbol_mod = {
- .name = "m",
-+ .type = S_TRISTATE,
- .curr = { "m", mod },
- .flags = SYMBOL_CONST|SYMBOL_VALID,
- };
-
- struct symbol symbol_no = {
- .name = "n",
-+ .type = S_TRISTATE,
- .curr = { "n", no },
- .flags = SYMBOL_CONST|SYMBOL_VALID,
- };
-@@ -786,8 +789,7 @@ const char *sym_get_string_value(struct symbol *sym)
- case no:
- return "n";
- case mod:
-- sym_calc_value(modules_sym);
-- return (modules_sym->curr.tri == no) ? "n" : "m";
-+ return "m";
- case yes:
- return "y";
- }
---
-2.43.0
-
+++ /dev/null
-From 6b722a9cb743458ab1ad73116b6520becad775a8 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 28 May 2024 18:31:50 +0200
-Subject: kheaders: use `command -v` to test for existence of `cpio`
-
-From: Miguel Ojeda <ojeda@kernel.org>
-
-[ Upstream commit 6e58e0173507e506a5627741358bc770f220e356 ]
-
-Commit 13e1df09284d ("kheaders: explicitly validate existence of cpio
-command") added an explicit check for `cpio` using `type`.
-
-However, `type` in `dash` (which is used in some popular distributions
-and base images as the shell script runner) prints the missing message
-to standard output, and thus no error is printed:
-
- $ bash -c 'type missing >/dev/null'
- bash: line 1: type: missing: not found
- $ dash -c 'type missing >/dev/null'
- $
-
-For instance, this issue may be seen by loongarch builders, given its
-defconfig enables CONFIG_IKHEADERS since commit 9cc1df421f00 ("LoongArch:
-Update Loongson-3 default config file").
-
-Therefore, use `command -v` instead to have consistent behavior, and
-take the chance to provide a more explicit error.
-
-Fixes: 13e1df09284d ("kheaders: explicitly validate existence of cpio command")
-Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
-Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- kernel/gen_kheaders.sh | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
-
-diff --git a/kernel/gen_kheaders.sh b/kernel/gen_kheaders.sh
-index 6d443ea22bb73..4ba5fd3d73ae2 100755
---- a/kernel/gen_kheaders.sh
-+++ b/kernel/gen_kheaders.sh
-@@ -14,7 +14,12 @@ include/
- arch/$SRCARCH/include/
- "
-
--type cpio > /dev/null
-+if ! command -v cpio >/dev/null; then
-+ echo >&2 "***"
-+ echo >&2 "*** 'cpio' could not be found."
-+ echo >&2 "***"
-+ exit 1
-+fi
-
- # Support incremental builds by skipping archive generation
- # if timestamps of files being archived are not changed.
---
-2.43.0
-
+++ /dev/null
-From 13cc0cfe260d689a6b0e3e74b8bc2fffabbc9f79 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 2 May 2024 10:07:50 +0900
-Subject: ksmbd: use rwsem instead of rwlock for lease break
-
-From: Namjae Jeon <linkinjeon@kernel.org>
-
-[ Upstream commit d1c189c6cb8b0fb7b5ee549237d27889c40c2f8b ]
-
-lease break wait for lease break acknowledgment.
-rwsem is more suitable than unlock while traversing the list for parent
-lease break in ->m_op_list.
-
-Cc: stable@vger.kernel.org
-Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
-Signed-off-by: Steve French <stfrench@microsoft.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/smb/server/oplock.c | 30 +++++++++++-------------------
- fs/smb/server/smb2pdu.c | 4 ++--
- fs/smb/server/smb_common.c | 4 ++--
- fs/smb/server/vfs_cache.c | 20 ++++++++++----------
- fs/smb/server/vfs_cache.h | 2 +-
- 5 files changed, 26 insertions(+), 34 deletions(-)
-
-diff --git a/fs/smb/server/oplock.c b/fs/smb/server/oplock.c
-index 2292ca6ff00b6..3b8f80639ae84 100644
---- a/fs/smb/server/oplock.c
-+++ b/fs/smb/server/oplock.c
-@@ -206,9 +206,9 @@ static void opinfo_add(struct oplock_info *opinfo)
- {
- struct ksmbd_inode *ci = opinfo->o_fp->f_ci;
-
-- write_lock(&ci->m_lock);
-+ down_write(&ci->m_lock);
- list_add_rcu(&opinfo->op_entry, &ci->m_op_list);
-- write_unlock(&ci->m_lock);
-+ up_write(&ci->m_lock);
- }
-
- static void opinfo_del(struct oplock_info *opinfo)
-@@ -220,9 +220,9 @@ static void opinfo_del(struct oplock_info *opinfo)
- lease_del_list(opinfo);
- write_unlock(&lease_list_lock);
- }
-- write_lock(&ci->m_lock);
-+ down_write(&ci->m_lock);
- list_del_rcu(&opinfo->op_entry);
-- write_unlock(&ci->m_lock);
-+ up_write(&ci->m_lock);
- }
-
- static unsigned long opinfo_count(struct ksmbd_file *fp)
-@@ -525,21 +525,18 @@ static struct oplock_info *same_client_has_lease(struct ksmbd_inode *ci,
- * Compare lease key and client_guid to know request from same owner
- * of same client
- */
-- read_lock(&ci->m_lock);
-+ down_read(&ci->m_lock);
- list_for_each_entry(opinfo, &ci->m_op_list, op_entry) {
- if (!opinfo->is_lease)
- continue;
-- read_unlock(&ci->m_lock);
- lease = opinfo->o_lease;
-
- ret = compare_guid_key(opinfo, client_guid, lctx->lease_key);
- if (ret) {
- m_opinfo = opinfo;
- /* skip upgrading lease about breaking lease */
-- if (atomic_read(&opinfo->breaking_cnt)) {
-- read_lock(&ci->m_lock);
-+ if (atomic_read(&opinfo->breaking_cnt))
- continue;
-- }
-
- /* upgrading lease */
- if ((atomic_read(&ci->op_count) +
-@@ -569,9 +566,8 @@ static struct oplock_info *same_client_has_lease(struct ksmbd_inode *ci,
- lease_none_upgrade(opinfo, lctx->req_state);
- }
- }
-- read_lock(&ci->m_lock);
- }
-- read_unlock(&ci->m_lock);
-+ up_read(&ci->m_lock);
-
- return m_opinfo;
- }
-@@ -1118,7 +1114,7 @@ void smb_send_parent_lease_break_noti(struct ksmbd_file *fp,
- if (!p_ci)
- return;
-
-- read_lock(&p_ci->m_lock);
-+ down_read(&p_ci->m_lock);
- list_for_each_entry(opinfo, &p_ci->m_op_list, op_entry) {
- if (!opinfo->is_lease)
- continue;
-@@ -1136,13 +1132,11 @@ void smb_send_parent_lease_break_noti(struct ksmbd_file *fp,
- continue;
- }
-
-- read_unlock(&p_ci->m_lock);
- oplock_break(opinfo, SMB2_OPLOCK_LEVEL_NONE);
- opinfo_conn_put(opinfo);
-- read_lock(&p_ci->m_lock);
- }
- }
-- read_unlock(&p_ci->m_lock);
-+ up_read(&p_ci->m_lock);
-
- ksmbd_inode_put(p_ci);
- }
-@@ -1163,7 +1157,7 @@ void smb_lazy_parent_lease_break_close(struct ksmbd_file *fp)
- if (!p_ci)
- return;
-
-- read_lock(&p_ci->m_lock);
-+ down_read(&p_ci->m_lock);
- list_for_each_entry(opinfo, &p_ci->m_op_list, op_entry) {
- if (!opinfo->is_lease)
- continue;
-@@ -1177,13 +1171,11 @@ void smb_lazy_parent_lease_break_close(struct ksmbd_file *fp)
- atomic_dec(&opinfo->conn->r_count);
- continue;
- }
-- read_unlock(&p_ci->m_lock);
- oplock_break(opinfo, SMB2_OPLOCK_LEVEL_NONE);
- opinfo_conn_put(opinfo);
-- read_lock(&p_ci->m_lock);
- }
- }
-- read_unlock(&p_ci->m_lock);
-+ up_read(&p_ci->m_lock);
-
- ksmbd_inode_put(p_ci);
- }
-diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
-index 8ae0c4d5ab96c..82ed14ce1a656 100644
---- a/fs/smb/server/smb2pdu.c
-+++ b/fs/smb/server/smb2pdu.c
-@@ -3192,9 +3192,9 @@ int smb2_open(struct ksmbd_work *work)
- * after daccess, saccess, attrib_only, and stream are
- * initialized.
- */
-- write_lock(&fp->f_ci->m_lock);
-+ down_write(&fp->f_ci->m_lock);
- list_add(&fp->node, &fp->f_ci->m_fp_list);
-- write_unlock(&fp->f_ci->m_lock);
-+ up_write(&fp->f_ci->m_lock);
-
- /* Check delete pending among previous fp before oplock break */
- if (ksmbd_inode_pending_delete(fp)) {
-diff --git a/fs/smb/server/smb_common.c b/fs/smb/server/smb_common.c
-index fcaf373cc0080..474dadf6b7b8b 100644
---- a/fs/smb/server/smb_common.c
-+++ b/fs/smb/server/smb_common.c
-@@ -646,7 +646,7 @@ int ksmbd_smb_check_shared_mode(struct file *filp, struct ksmbd_file *curr_fp)
- * Lookup fp in master fp list, and check desired access and
- * shared mode between previous open and current open.
- */
-- read_lock(&curr_fp->f_ci->m_lock);
-+ down_read(&curr_fp->f_ci->m_lock);
- list_for_each_entry(prev_fp, &curr_fp->f_ci->m_fp_list, node) {
- if (file_inode(filp) != file_inode(prev_fp->filp))
- continue;
-@@ -722,7 +722,7 @@ int ksmbd_smb_check_shared_mode(struct file *filp, struct ksmbd_file *curr_fp)
- break;
- }
- }
-- read_unlock(&curr_fp->f_ci->m_lock);
-+ up_read(&curr_fp->f_ci->m_lock);
-
- return rc;
- }
-diff --git a/fs/smb/server/vfs_cache.c b/fs/smb/server/vfs_cache.c
-index 4e82ff627d122..1abd9b85302e8 100644
---- a/fs/smb/server/vfs_cache.c
-+++ b/fs/smb/server/vfs_cache.c
-@@ -165,7 +165,7 @@ static int ksmbd_inode_init(struct ksmbd_inode *ci, struct ksmbd_file *fp)
- ci->m_fattr = 0;
- INIT_LIST_HEAD(&ci->m_fp_list);
- INIT_LIST_HEAD(&ci->m_op_list);
-- rwlock_init(&ci->m_lock);
-+ init_rwsem(&ci->m_lock);
- ci->m_de = fp->filp->f_path.dentry;
- return 0;
- }
-@@ -261,14 +261,14 @@ static void __ksmbd_inode_close(struct ksmbd_file *fp)
- }
-
- if (atomic_dec_and_test(&ci->m_count)) {
-- write_lock(&ci->m_lock);
-+ down_write(&ci->m_lock);
- if (ci->m_flags & (S_DEL_ON_CLS | S_DEL_PENDING)) {
- ci->m_flags &= ~(S_DEL_ON_CLS | S_DEL_PENDING);
-- write_unlock(&ci->m_lock);
-+ up_write(&ci->m_lock);
- ksmbd_vfs_unlink(filp);
-- write_lock(&ci->m_lock);
-+ down_write(&ci->m_lock);
- }
-- write_unlock(&ci->m_lock);
-+ up_write(&ci->m_lock);
-
- ksmbd_inode_free(ci);
- }
-@@ -289,9 +289,9 @@ static void __ksmbd_remove_fd(struct ksmbd_file_table *ft, struct ksmbd_file *fp
- if (!has_file_id(fp->volatile_id))
- return;
-
-- write_lock(&fp->f_ci->m_lock);
-+ down_write(&fp->f_ci->m_lock);
- list_del_init(&fp->node);
-- write_unlock(&fp->f_ci->m_lock);
-+ up_write(&fp->f_ci->m_lock);
-
- write_lock(&ft->lock);
- idr_remove(ft->idr, fp->volatile_id);
-@@ -501,17 +501,17 @@ struct ksmbd_file *ksmbd_lookup_fd_inode(struct dentry *dentry)
- if (!ci)
- return NULL;
-
-- read_lock(&ci->m_lock);
-+ down_read(&ci->m_lock);
- list_for_each_entry(lfp, &ci->m_fp_list, node) {
- if (inode == file_inode(lfp->filp)) {
- atomic_dec(&ci->m_count);
- lfp = ksmbd_fp_get(lfp);
-- read_unlock(&ci->m_lock);
-+ up_read(&ci->m_lock);
- return lfp;
- }
- }
- atomic_dec(&ci->m_count);
-- read_unlock(&ci->m_lock);
-+ up_read(&ci->m_lock);
- return NULL;
- }
-
-diff --git a/fs/smb/server/vfs_cache.h b/fs/smb/server/vfs_cache.h
-index a528f0cc775ae..b8a623932f568 100644
---- a/fs/smb/server/vfs_cache.h
-+++ b/fs/smb/server/vfs_cache.h
-@@ -46,7 +46,7 @@ struct stream {
- };
-
- struct ksmbd_inode {
-- rwlock_t m_lock;
-+ struct rw_semaphore m_lock;
- atomic_t m_count;
- atomic_t op_count;
- /* opinfo count for streams */
---
-2.43.0
-
+++ /dev/null
-From 7b0f4f9b38735149a0c7ce134fbcc073f73962c1 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 8 May 2024 07:19:52 +0000
-Subject: KVM: arm64: Destroy mpidr_data for 'late' vCPU creation
-
-From: Oliver Upton <oliver.upton@linux.dev>
-
-[ Upstream commit ce5d2448eb8fe83aed331db53a08612286a137dd ]
-
-A particularly annoying userspace could create a vCPU after KVM has
-computed mpidr_data for the VM, either by racing against VGIC
-initialization or having a userspace irqchip.
-
-In any case, this means mpidr_data no longer fully describes the VM, and
-attempts to find the new vCPU with kvm_mpidr_to_vcpu() will fail. The
-fix is to discard mpidr_data altogether, as it is only a performance
-optimization and not required for correctness. In all likelihood KVM
-will recompute the mappings when KVM_RUN is called on the new vCPU.
-
-Note that reads of mpidr_data are not guarded by a lock; promote to RCU
-to cope with the possibility of mpidr_data being invalidated at runtime.
-
-Fixes: 54a8006d0b49 ("KVM: arm64: Fast-track kvm_mpidr_to_vcpu() when mpidr_data is available")
-Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
-Link: https://lore.kernel.org/r/20240508071952.2035422-1-oliver.upton@linux.dev
-Signed-off-by: Marc Zyngier <maz@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/arm64/kvm/arm.c | 50 ++++++++++++++++++++++++++++++++++++--------
- 1 file changed, 41 insertions(+), 9 deletions(-)
-
-diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
-index c063e84fc72c7..0f340143a1e74 100644
---- a/arch/arm64/kvm/arm.c
-+++ b/arch/arm64/kvm/arm.c
-@@ -191,6 +191,23 @@ vm_fault_t kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf)
- }
-
-
-+static void kvm_destroy_mpidr_data(struct kvm *kvm)
-+{
-+ struct kvm_mpidr_data *data;
-+
-+ mutex_lock(&kvm->arch.config_lock);
-+
-+ data = rcu_dereference_protected(kvm->arch.mpidr_data,
-+ lockdep_is_held(&kvm->arch.config_lock));
-+ if (data) {
-+ rcu_assign_pointer(kvm->arch.mpidr_data, NULL);
-+ synchronize_rcu();
-+ kfree(data);
-+ }
-+
-+ mutex_unlock(&kvm->arch.config_lock);
-+}
-+
- /**
- * kvm_arch_destroy_vm - destroy the VM data structure
- * @kvm: pointer to the KVM struct
-@@ -205,7 +222,8 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
- if (is_protected_kvm_enabled())
- pkvm_destroy_hyp_vm(kvm);
-
-- kfree(kvm->arch.mpidr_data);
-+ kvm_destroy_mpidr_data(kvm);
-+
- kfree(kvm->arch.sysreg_masks);
- kvm_destroy_vcpus(kvm);
-
-@@ -391,6 +409,13 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu)
-
- vcpu->arch.hw_mmu = &vcpu->kvm->arch.mmu;
-
-+ /*
-+ * This vCPU may have been created after mpidr_data was initialized.
-+ * Throw out the pre-computed mappings if that is the case which forces
-+ * KVM to fall back to iteratively searching the vCPUs.
-+ */
-+ kvm_destroy_mpidr_data(vcpu->kvm);
-+
- err = kvm_vgic_vcpu_init(vcpu);
- if (err)
- return err;
-@@ -590,7 +615,8 @@ static void kvm_init_mpidr_data(struct kvm *kvm)
-
- mutex_lock(&kvm->arch.config_lock);
-
-- if (kvm->arch.mpidr_data || atomic_read(&kvm->online_vcpus) == 1)
-+ if (rcu_access_pointer(kvm->arch.mpidr_data) ||
-+ atomic_read(&kvm->online_vcpus) == 1)
- goto out;
-
- kvm_for_each_vcpu(c, vcpu, kvm) {
-@@ -627,7 +653,7 @@ static void kvm_init_mpidr_data(struct kvm *kvm)
- data->cmpidr_to_idx[index] = c;
- }
-
-- kvm->arch.mpidr_data = data;
-+ rcu_assign_pointer(kvm->arch.mpidr_data, data);
- out:
- mutex_unlock(&kvm->arch.config_lock);
- }
-@@ -2460,21 +2486,27 @@ static int __init init_hyp_mode(void)
-
- struct kvm_vcpu *kvm_mpidr_to_vcpu(struct kvm *kvm, unsigned long mpidr)
- {
-- struct kvm_vcpu *vcpu;
-+ struct kvm_vcpu *vcpu = NULL;
-+ struct kvm_mpidr_data *data;
- unsigned long i;
-
- mpidr &= MPIDR_HWID_BITMASK;
-
-- if (kvm->arch.mpidr_data) {
-- u16 idx = kvm_mpidr_index(kvm->arch.mpidr_data, mpidr);
-+ rcu_read_lock();
-+ data = rcu_dereference(kvm->arch.mpidr_data);
-
-- vcpu = kvm_get_vcpu(kvm,
-- kvm->arch.mpidr_data->cmpidr_to_idx[idx]);
-+ if (data) {
-+ u16 idx = kvm_mpidr_index(data, mpidr);
-+
-+ vcpu = kvm_get_vcpu(kvm, data->cmpidr_to_idx[idx]);
- if (mpidr != kvm_vcpu_get_mpidr_aff(vcpu))
- vcpu = NULL;
-+ }
-
-+ rcu_read_unlock();
-+
-+ if (vcpu)
- return vcpu;
-- }
-
- kvm_for_each_vcpu(i, vcpu, kvm) {
- if (mpidr == kvm_vcpu_get_mpidr_aff(vcpu))
---
-2.43.0
-
+++ /dev/null
-From fbb2bcdc458dd7db3860f85a06e98cc25904d20d Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 14 Feb 2024 13:18:04 +0000
-Subject: KVM: arm64: nv: Add sanitising to VNCR-backed sysregs
-
-From: Marc Zyngier <maz@kernel.org>
-
-[ Upstream commit 888f0880702293096619b300150cd7e59fcd9743 ]
-
-VNCR-backed "registers" are actually only memory. Which means that
-there is zero control over what the guest can write, and that it
-is the hypervisor's job to actually sanitise the content of the
-backing store. Yeah, this is fun.
-
-In order to preserve some form of sanity, add a repainting mechanism
-that makes use of a per-VM set of RES0/RES1 masks, one pair per VNCR
-register. These masks get applied on access to the backing store via
-__vcpu_sys_reg(), ensuring that the state that is consumed by KVM is
-correct.
-
-So far, nothing populates these masks, but stay tuned.
-
-Signed-off-by: Marc Zyngier <maz@kernel.org>
-Reviewed-by: Joey Gouly <joey.gouly@arm.com>
-Link: https://lore.kernel.org/r/20240214131827.2856277-4-maz@kernel.org
-Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
-Stable-dep-of: ce5d2448eb8f ("KVM: arm64: Destroy mpidr_data for 'late' vCPU creation")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/arm64/include/asm/kvm_host.h | 22 ++++++++++++++++-
- arch/arm64/kvm/arm.c | 1 +
- arch/arm64/kvm/nested.c | 41 ++++++++++++++++++++++++++++++-
- 3 files changed, 62 insertions(+), 2 deletions(-)
-
-diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h
-index 21c57b812569f..dbb25285227d7 100644
---- a/arch/arm64/include/asm/kvm_host.h
-+++ b/arch/arm64/include/asm/kvm_host.h
-@@ -238,6 +238,8 @@ static inline u16 kvm_mpidr_index(struct kvm_mpidr_data *data, u64 mpidr)
- return index;
- }
-
-+struct kvm_sysreg_masks;
-+
- struct kvm_arch {
- struct kvm_s2_mmu mmu;
-
-@@ -312,6 +314,9 @@ struct kvm_arch {
- #define KVM_ARM_ID_REG_NUM (IDREG_IDX(sys_reg(3, 0, 0, 7, 7)) + 1)
- u64 id_regs[KVM_ARM_ID_REG_NUM];
-
-+ /* Masks for VNCR-baked sysregs */
-+ struct kvm_sysreg_masks *sysreg_masks;
-+
- /*
- * For an untrusted host VM, 'pkvm.handle' is used to lookup
- * the associated pKVM instance in the hypervisor.
-@@ -474,6 +479,13 @@ enum vcpu_sysreg {
- NR_SYS_REGS /* Nothing after this line! */
- };
-
-+struct kvm_sysreg_masks {
-+ struct {
-+ u64 res0;
-+ u64 res1;
-+ } mask[NR_SYS_REGS - __VNCR_START__];
-+};
-+
- struct kvm_cpu_context {
- struct user_pt_regs regs; /* sp = sp_el0 */
-
-@@ -868,7 +880,15 @@ static inline u64 *__ctxt_sys_reg(const struct kvm_cpu_context *ctxt, int r)
-
- #define ctxt_sys_reg(c,r) (*__ctxt_sys_reg(c,r))
-
--#define __vcpu_sys_reg(v,r) (ctxt_sys_reg(&(v)->arch.ctxt, (r)))
-+u64 kvm_vcpu_sanitise_vncr_reg(const struct kvm_vcpu *, enum vcpu_sysreg);
-+#define __vcpu_sys_reg(v,r) \
-+ (*({ \
-+ const struct kvm_cpu_context *ctxt = &(v)->arch.ctxt; \
-+ u64 *__r = __ctxt_sys_reg(ctxt, (r)); \
-+ if (vcpu_has_nv((v)) && (r) >= __VNCR_START__) \
-+ *__r = kvm_vcpu_sanitise_vncr_reg((v), (r)); \
-+ __r; \
-+ }))
-
- u64 vcpu_read_sys_reg(const struct kvm_vcpu *vcpu, int reg);
- void vcpu_write_sys_reg(struct kvm_vcpu *vcpu, u64 val, int reg);
-diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
-index a25265aca4324..c063e84fc72c7 100644
---- a/arch/arm64/kvm/arm.c
-+++ b/arch/arm64/kvm/arm.c
-@@ -206,6 +206,7 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
- pkvm_destroy_hyp_vm(kvm);
-
- kfree(kvm->arch.mpidr_data);
-+ kfree(kvm->arch.sysreg_masks);
- kvm_destroy_vcpus(kvm);
-
- kvm_unshare_hyp(kvm, kvm + 1);
-diff --git a/arch/arm64/kvm/nested.c b/arch/arm64/kvm/nested.c
-index ba95d044bc98f..6cb6db4cfd8f5 100644
---- a/arch/arm64/kvm/nested.c
-+++ b/arch/arm64/kvm/nested.c
-@@ -156,15 +156,54 @@ static u64 limit_nv_id_reg(u32 id, u64 val)
-
- return val;
- }
-+
-+u64 kvm_vcpu_sanitise_vncr_reg(const struct kvm_vcpu *vcpu, enum vcpu_sysreg sr)
-+{
-+ u64 v = ctxt_sys_reg(&vcpu->arch.ctxt, sr);
-+ struct kvm_sysreg_masks *masks;
-+
-+ masks = vcpu->kvm->arch.sysreg_masks;
-+
-+ if (masks) {
-+ sr -= __VNCR_START__;
-+
-+ v &= ~masks->mask[sr].res0;
-+ v |= masks->mask[sr].res1;
-+ }
-+
-+ return v;
-+}
-+
-+static void __maybe_unused set_sysreg_masks(struct kvm *kvm, int sr, u64 res0, u64 res1)
-+{
-+ int i = sr - __VNCR_START__;
-+
-+ kvm->arch.sysreg_masks->mask[i].res0 = res0;
-+ kvm->arch.sysreg_masks->mask[i].res1 = res1;
-+}
-+
- int kvm_init_nv_sysregs(struct kvm *kvm)
- {
-+ int ret = 0;
-+
- mutex_lock(&kvm->arch.config_lock);
-
-+ if (kvm->arch.sysreg_masks)
-+ goto out;
-+
-+ kvm->arch.sysreg_masks = kzalloc(sizeof(*(kvm->arch.sysreg_masks)),
-+ GFP_KERNEL);
-+ if (!kvm->arch.sysreg_masks) {
-+ ret = -ENOMEM;
-+ goto out;
-+ }
-+
- for (int i = 0; i < KVM_ARM_ID_REG_NUM; i++)
- kvm->arch.id_regs[i] = limit_nv_id_reg(IDX_IDREG(i),
- kvm->arch.id_regs[i]);
-
-+out:
- mutex_unlock(&kvm->arch.config_lock);
-
-- return 0;
-+ return ret;
- }
---
-2.43.0
-
+++ /dev/null
-From 86478d7c742ea5850e362896e4b76e525ca18df3 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 15 Apr 2024 09:27:29 +0530
-Subject: KVM: PPC: Book3S HV nestedv2: Cancel pending DEC exception
-
-From: Vaibhav Jain <vaibhav@linux.ibm.com>
-
-[ Upstream commit 7be6ce7043b4cf293c8826a48fd9f56931cef2cf ]
-
-This reverts commit 180c6b072bf3 ("KVM: PPC: Book3S HV nestedv2: Do not
-cancel pending decrementer exception") [1] which prevented canceling a
-pending HDEC exception for nestedv2 KVM guests. It was done to avoid
-overhead of a H_GUEST_GET_STATE hcall to read the 'DEC expiry TB' register
-which was higher compared to handling extra decrementer exceptions.
-
-However recent benchmarks indicate that overhead of not handling 'DECR'
-expiry for Nested KVM Guest(L2) is higher and results in much larger exits
-to Pseries Host(L1) as indicated by the Unixbench-arithoh bench[2]
-
-Metric | Current upstream | Revert [1] | Difference %
-========================================================================
-arithoh-count (10) | 3244831634 | 3403089673 | +04.88%
-kvm_hv:kvm_guest_exit | 513558 | 152441 | -70.32%
-probe:kvmppc_gsb_recv | 28060 | 28110 | +00.18%
-
-N=1
-
-As indicated by the data above that reverting [1] results in substantial
-reduction in number of L2->L1 exits with only slight increase in number of
-H_GUEST_GET_STATE hcalls to read the value of 'DEC expiry TB'. This results
-in an overall ~4% improvement of arithoh[2] throughput.
-
-[1] commit 180c6b072bf3 ("KVM: PPC: Book3S HV nestedv2: Do not cancel pending decrementer exception")
-[2] https://github.com/kdlucas/byte-unixbench/
-
-Fixes: 180c6b072bf3 ("KVM: PPC: Book3S HV nestedv2: Do not cancel pending decrementer exception")
-Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
-Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-Link: https://msgid.link/20240415035731.103097-1-vaibhav@linux.ibm.com
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/powerpc/kvm/book3s_hv.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
-index 0b921704da45e..e47b954ce2669 100644
---- a/arch/powerpc/kvm/book3s_hv.c
-+++ b/arch/powerpc/kvm/book3s_hv.c
-@@ -4856,7 +4856,7 @@ int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 time_limit,
- * entering a nested guest in which case the decrementer is now owned
- * by L2 and the L1 decrementer is provided in hdec_expires
- */
-- if (!kvmhv_is_nestedv2() && kvmppc_core_pending_dec(vcpu) &&
-+ if (kvmppc_core_pending_dec(vcpu) &&
- ((tb < kvmppc_dec_expires_host_tb(vcpu)) ||
- (trap == BOOK3S_INTERRUPT_SYSCALL &&
- kvmppc_get_gpr(vcpu, 3) == H_ENTER_NESTED)))
---
-2.43.0
-
+++ /dev/null
-From d80884ac684aa69626fdee01f45ec8fc8b1076f8 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sun, 28 Jan 2024 12:34:25 +0100
-Subject: KVM: PPC: Book3S HV nestedv2: Fix an error handling path in
- gs_msg_ops_kvmhv_nestedv2_config_fill_info()
-
-From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
-
-[ Upstream commit b52e8cd3f835869370f8540f1bc804a47a47f02b ]
-
-The return value of kvmppc_gse_put_buff_info() is not assigned to 'rc' and
-'rc' is uninitialized at this point.
-So the error handling can not work.
-
-Assign the expected value to 'rc' to fix the issue.
-
-Fixes: 19d31c5f1157 ("KVM: PPC: Add support for nestedv2 guests")
-Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
-Reviewed-by: Vaibhav Jain <vaibhav@linux.ibm.com>
-Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-Link: https://msgid.link/a7ed4cc12e0a0bbd97fac44fe6c222d1c393ec95.1706441651.git.christophe.jaillet@wanadoo.fr
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/powerpc/kvm/book3s_hv_nestedv2.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/arch/powerpc/kvm/book3s_hv_nestedv2.c b/arch/powerpc/kvm/book3s_hv_nestedv2.c
-index 8e6f5355f08b5..1091f7a83b255 100644
---- a/arch/powerpc/kvm/book3s_hv_nestedv2.c
-+++ b/arch/powerpc/kvm/book3s_hv_nestedv2.c
-@@ -71,8 +71,8 @@ gs_msg_ops_kvmhv_nestedv2_config_fill_info(struct kvmppc_gs_buff *gsb,
- }
-
- if (kvmppc_gsm_includes(gsm, KVMPPC_GSID_RUN_OUTPUT)) {
-- kvmppc_gse_put_buff_info(gsb, KVMPPC_GSID_RUN_OUTPUT,
-- cfg->vcpu_run_output_cfg);
-+ rc = kvmppc_gse_put_buff_info(gsb, KVMPPC_GSID_RUN_OUTPUT,
-+ cfg->vcpu_run_output_cfg);
- if (rc < 0)
- return rc;
- }
---
-2.43.0
-
+++ /dev/null
-From f2919b75e5e8f13aa0d80e8dcd33dc45111bf069 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 17 Apr 2024 17:38:47 +0200
-Subject: leds: pwm: Disable PWM when going to suspend
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-
-[ Upstream commit 974afccd37947a6951a052ef8118c961e57eaf7b ]
-
-On stm32mp1xx based machines (and others) a PWM consumer has to disable
-the PWM because an enabled PWM refuses to suspend. So check the
-LED_SUSPENDED flag and depending on that set the .enabled property.
-
-Link: https://bugzilla.kernel.org/show_bug.cgi?id=218559
-Fixes: 76fe464c8e64 ("leds: pwm: Don't disable the PWM when the LED should be off")
-Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-Link: https://lore.kernel.org/r/20240417153846.271751-2-u.kleine-koenig@pengutronix.de
-Signed-off-by: Lee Jones <lee@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/leds/leds-pwm.c | 8 +++++++-
- 1 file changed, 7 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/leds/leds-pwm.c b/drivers/leds/leds-pwm.c
-index 4e3936a39d0ed..e1b414b403534 100644
---- a/drivers/leds/leds-pwm.c
-+++ b/drivers/leds/leds-pwm.c
-@@ -53,7 +53,13 @@ static int led_pwm_set(struct led_classdev *led_cdev,
- duty = led_dat->pwmstate.period - duty;
-
- led_dat->pwmstate.duty_cycle = duty;
-- led_dat->pwmstate.enabled = true;
-+ /*
-+ * Disabling a PWM doesn't guarantee that it emits the inactive level.
-+ * So keep it on. Only for suspending the PWM should be disabled because
-+ * otherwise it refuses to suspend. The possible downside is that the
-+ * LED might stay (or even go) on.
-+ */
-+ led_dat->pwmstate.enabled = !(led_cdev->flags & LED_SUSPENDED);
- return pwm_apply_might_sleep(led_dat->pwm, &led_dat->pwmstate);
- }
-
---
-2.43.0
-
+++ /dev/null
-From ebe360a276f5cdd2c9bbfb0a4cc37a70111a7afa Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 8 May 2024 22:20:15 -0700
-Subject: libsubcmd: Fix parse-options memory leak
-
-From: Ian Rogers <irogers@google.com>
-
-[ Upstream commit 230a7a71f92212e723fa435d4ca5922de33ec88a ]
-
-If a usage string is built in parse_options_subcommand, also free it.
-
-Fixes: 901421a5bdf605d2 ("perf tools: Remove subcmd dependencies on strbuf")
-Signed-off-by: Ian Rogers <irogers@google.com>
-Cc: Adrian Hunter <adrian.hunter@intel.com>
-Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
-Cc: Ingo Molnar <mingo@redhat.com>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Josh Poimboeuf <jpoimboe@kernel.org>
-Cc: Kan Liang <kan.liang@linux.intel.com>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Link: https://lore.kernel.org/r/20240509052015.1914670-1-irogers@google.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/lib/subcmd/parse-options.c | 8 +++++---
- 1 file changed, 5 insertions(+), 3 deletions(-)
-
-diff --git a/tools/lib/subcmd/parse-options.c b/tools/lib/subcmd/parse-options.c
-index 9fa75943f2ed1..d943d78b787ed 100644
---- a/tools/lib/subcmd/parse-options.c
-+++ b/tools/lib/subcmd/parse-options.c
-@@ -633,11 +633,10 @@ int parse_options_subcommand(int argc, const char **argv, const struct option *o
- const char *const subcommands[], const char *usagestr[], int flags)
- {
- struct parse_opt_ctx_t ctx;
-+ char *buf = NULL;
-
- /* build usage string if it's not provided */
- if (subcommands && !usagestr[0]) {
-- char *buf = NULL;
--
- astrcatf(&buf, "%s %s [<options>] {", subcmd_config.exec_name, argv[0]);
-
- for (int i = 0; subcommands[i]; i++) {
-@@ -679,7 +678,10 @@ int parse_options_subcommand(int argc, const char **argv, const struct option *o
- astrcatf(&error_buf, "unknown switch `%c'", *ctx.opt);
- usage_with_options(usagestr, options);
- }
--
-+ if (buf) {
-+ usagestr[0] = NULL;
-+ free(buf);
-+ }
- return parse_options_end(&ctx);
- }
-
---
-2.43.0
-
+++ /dev/null
-From d3652d4d32b62bf2121a1341fa78c47fd444e81e Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 14 May 2024 12:24:18 +0800
-Subject: LoongArch: Fix callchain parse error with kernel tracepoint events
- again
-
-From: Huacai Chen <chenhuacai@loongson.cn>
-
-[ Upstream commit d6af2c76399f98444a5b4de96baf4b362d9f102b ]
-
-With commit d3119bc985fb645 ("LoongArch: Fix callchain parse error with
-kernel tracepoint events"), perf can parse kernel callchain, but not
-complete and sometimes maybe error. The reason is LoongArch's unwinders
-(guess, prologue and orc) don't really need fp (i.e., regs[22]), and
-they use sp (i.e., regs[3]) as the frame address rather than the current
-stack pointer.
-
-Fix that by removing the assignment of regs[22], and instead assign the
-__builtin_frame_address(0) to regs[3].
-
-Without fix:
-
- Children Self Command Shared Object Symbol
- ........ ........ ............. ................. ................
- 33.91% 33.91% swapper [kernel.vmlinux] [k] __schedule
- |
- |--33.04%--__schedule
- |
- --0.87%--__arch_cpu_idle
- __schedule
-
-With this fix:
-
- Children Self Command Shared Object Symbol
- ........ ........ ............. ................. ................
- 31.16% 31.16% swapper [kernel.vmlinux] [k] __schedule
- |
- |--20.63%--smpboot_entry
- | cpu_startup_entry
- | schedule_idle
- | __schedule
- |
- --10.53%--start_kernel
- cpu_startup_entry
- schedule_idle
- __schedule
-
-Fixes: d3119bc985fb645 ("LoongArch: Fix callchain parse error with kernel tracepoint events")
-Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/loongarch/include/asm/perf_event.h | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/arch/loongarch/include/asm/perf_event.h b/arch/loongarch/include/asm/perf_event.h
-index 52b638059e40b..f948a0676daf8 100644
---- a/arch/loongarch/include/asm/perf_event.h
-+++ b/arch/loongarch/include/asm/perf_event.h
-@@ -13,8 +13,7 @@
-
- #define perf_arch_fetch_caller_regs(regs, __ip) { \
- (regs)->csr_era = (__ip); \
-- (regs)->regs[3] = current_stack_pointer; \
-- (regs)->regs[22] = (unsigned long) __builtin_frame_address(0); \
-+ (regs)->regs[3] = (unsigned long) __builtin_frame_address(0); \
- }
-
- #endif /* __LOONGARCH_PERF_EVENT_H__ */
---
-2.43.0
-
+++ /dev/null
-From 6dd31c0015c838f1eb5385854b18161490565b3b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 26 Apr 2024 10:01:21 +0800
-Subject: mailbox: mtk-cmdq: Fix pm_runtime_get_sync() warning in mbox shutdown
-
-From: Jason-JH.Lin <jason-jh.lin@mediatek.com>
-
-[ Upstream commit 747a69a119c469121385543f21c2d08562968ccc ]
-
-The return value of pm_runtime_get_sync() in cmdq_mbox_shutdown()
-will return 1 when pm runtime state is active, and we don't want to
-get the warning message in this case.
-
-So we change the return value < 0 for WARN_ON().
-
-Fixes: 8afe816b0c99 ("mailbox: mtk-cmdq-mailbox: Implement Runtime PM with autosuspend")
-Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
-Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
-Signed-off-by: Jassi Brar <jassisinghbrar@gmail.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/mailbox/mtk-cmdq-mailbox.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/mailbox/mtk-cmdq-mailbox.c b/drivers/mailbox/mtk-cmdq-mailbox.c
-index ead2200f39ba0..033aff11f87cf 100644
---- a/drivers/mailbox/mtk-cmdq-mailbox.c
-+++ b/drivers/mailbox/mtk-cmdq-mailbox.c
-@@ -465,7 +465,7 @@ static void cmdq_mbox_shutdown(struct mbox_chan *chan)
- struct cmdq_task *task, *tmp;
- unsigned long flags;
-
-- WARN_ON(pm_runtime_get_sync(cmdq->mbox.dev));
-+ WARN_ON(pm_runtime_get_sync(cmdq->mbox.dev) < 0);
-
- spin_lock_irqsave(&thread->chan->lock, flags);
- if (list_empty(&thread->task_busy_list))
---
-2.43.0
-
+++ /dev/null
-From 50c4e2dcc4a88c8e54e77edf80b917e02008ad38 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 23 Feb 2024 12:24:38 +0000
-Subject: media: cec: cec-adap: always cancel work in cec_transmit_msg_fh
-
-From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-
-[ Upstream commit 9fe2816816a3c765dff3b88af5b5c3d9bbb911ce ]
-
-Do not check for !data->completed, just always call
-cancel_delayed_work_sync(). This fixes a small race condition.
-
-Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-Reported-by: Yang, Chenyuan <cy54@illinois.edu>
-Closes: https://lore.kernel.org/linux-media/PH7PR11MB57688E64ADE4FE82E658D86DA09EA@PH7PR11MB5768.namprd11.prod.outlook.com/
-Fixes: 490d84f6d73c ("media: cec: forgot to cancel delayed work")
-Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/media/cec/core/cec-adap.c | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/drivers/media/cec/core/cec-adap.c b/drivers/media/cec/core/cec-adap.c
-index 559a172ebc6cb..6fc7de744ee9a 100644
---- a/drivers/media/cec/core/cec-adap.c
-+++ b/drivers/media/cec/core/cec-adap.c
-@@ -936,8 +936,7 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg,
- */
- mutex_unlock(&adap->lock);
- wait_for_completion_killable(&data->c);
-- if (!data->completed)
-- cancel_delayed_work_sync(&data->work);
-+ cancel_delayed_work_sync(&data->work);
- mutex_lock(&adap->lock);
-
- /* Cancel the transmit if it was interrupted */
---
-2.43.0
-
+++ /dev/null
-From 0bdf5633afbf82b2e8d45797107e463a6cf15360 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 23 Feb 2024 12:25:55 +0000
-Subject: media: cec: cec-api: add locking in cec_release()
-
-From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-
-[ Upstream commit 42bcaacae924bf18ae387c3f78c202df0b739292 ]
-
-When cec_release() uses fh->msgs it has to take fh->lock,
-otherwise the list can get corrupted.
-
-Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-Reported-by: Yang, Chenyuan <cy54@illinois.edu>
-Closes: https://lore.kernel.org/linux-media/PH7PR11MB57688E64ADE4FE82E658D86DA09EA@PH7PR11MB5768.namprd11.prod.outlook.com/
-Fixes: ca684386e6e2 ("[media] cec: add HDMI CEC framework (api)")
-Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/media/cec/core/cec-api.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/drivers/media/cec/core/cec-api.c b/drivers/media/cec/core/cec-api.c
-index 67dc79ef17050..d64bb716f9c68 100644
---- a/drivers/media/cec/core/cec-api.c
-+++ b/drivers/media/cec/core/cec-api.c
-@@ -664,6 +664,8 @@ static int cec_release(struct inode *inode, struct file *filp)
- list_del_init(&data->xfer_list);
- }
- mutex_unlock(&adap->lock);
-+
-+ mutex_lock(&fh->lock);
- while (!list_empty(&fh->msgs)) {
- struct cec_msg_entry *entry =
- list_first_entry(&fh->msgs, struct cec_msg_entry, list);
-@@ -681,6 +683,7 @@ static int cec_release(struct inode *inode, struct file *filp)
- kfree(entry);
- }
- }
-+ mutex_unlock(&fh->lock);
- kfree(fh);
-
- cec_put_device(devnode);
---
-2.43.0
-
+++ /dev/null
-From c1a0deb5fa6cdd36af3a53affe8973379e13de80 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 30 Apr 2024 11:13:47 +0100
-Subject: media: cec: core: avoid confusing "transmit timed out" message
-
-From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-
-[ Upstream commit cbe499977bc36fedae89f0a0d7deb4ccde9798fe ]
-
-If, when waiting for a transmit to finish, the wait is interrupted,
-then you might get a "transmit timed out" message, even though the
-transmit was interrupted and did not actually time out.
-
-Set transmit_in_progress_aborted to true if the
-wait_for_completion_killable() call was interrupted and ensure
-that the transmit is properly marked as ABORTED.
-
-Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-Reported-by: Yang, Chenyuan <cy54@illinois.edu>
-Closes: https://lore.kernel.org/linux-media/PH7PR11MB57688E64ADE4FE82E658D86DA09EA@PH7PR11MB5768.namprd11.prod.outlook.com/
-Fixes: 590a8e564c6e ("media: cec: abort if the current transmit was canceled")
-Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/media/cec/core/cec-adap.c | 15 ++++++++++++++-
- 1 file changed, 14 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/media/cec/core/cec-adap.c b/drivers/media/cec/core/cec-adap.c
-index a493cbce24567..da09834990b87 100644
---- a/drivers/media/cec/core/cec-adap.c
-+++ b/drivers/media/cec/core/cec-adap.c
-@@ -490,6 +490,15 @@ int cec_thread_func(void *_adap)
- goto unlock;
- }
-
-+ if (adap->transmit_in_progress &&
-+ adap->transmit_in_progress_aborted) {
-+ if (adap->transmitting)
-+ cec_data_cancel(adap->transmitting,
-+ CEC_TX_STATUS_ABORTED, 0);
-+ adap->transmit_in_progress = false;
-+ adap->transmit_in_progress_aborted = false;
-+ goto unlock;
-+ }
- if (adap->transmit_in_progress && timeout) {
- /*
- * If we timeout, then log that. Normally this does
-@@ -771,6 +780,7 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg,
- {
- struct cec_data *data;
- bool is_raw = msg_is_raw(msg);
-+ int err;
-
- if (adap->devnode.unregistered)
- return -ENODEV;
-@@ -935,10 +945,13 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg,
- * Release the lock and wait, retake the lock afterwards.
- */
- mutex_unlock(&adap->lock);
-- wait_for_completion_killable(&data->c);
-+ err = wait_for_completion_killable(&data->c);
- cancel_delayed_work_sync(&data->work);
- mutex_lock(&adap->lock);
-
-+ if (err)
-+ adap->transmit_in_progress_aborted = true;
-+
- /* Cancel the transmit if it was interrupted */
- if (!data->completed) {
- if (data->msg.tx_status & CEC_TX_STATUS_OK)
---
-2.43.0
-
+++ /dev/null
-From 16978d51254a2f1b968481f3d06463513bcb746c Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 22 Feb 2024 16:17:33 +0000
-Subject: media: cec: core: avoid recursive cec_claim_log_addrs
-
-From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-
-[ Upstream commit 47c82aac10a6954d68f29f10d9758d016e8e5af1 ]
-
-Keep track if cec_claim_log_addrs() is running, and return -EBUSY
-if it is when calling CEC_ADAP_S_LOG_ADDRS.
-
-This prevents a case where cec_claim_log_addrs() could be called
-while it was still in progress.
-
-Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-Reported-by: Yang, Chenyuan <cy54@illinois.edu>
-Closes: https://lore.kernel.org/linux-media/PH7PR11MB57688E64ADE4FE82E658D86DA09EA@PH7PR11MB5768.namprd11.prod.outlook.com/
-Fixes: ca684386e6e2 ("[media] cec: add HDMI CEC framework (api)")
-Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/media/cec/core/cec-adap.c | 6 +++++-
- drivers/media/cec/core/cec-api.c | 2 +-
- include/media/cec.h | 1 +
- 3 files changed, 7 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/media/cec/core/cec-adap.c b/drivers/media/cec/core/cec-adap.c
-index 6fc7de744ee9a..a493cbce24567 100644
---- a/drivers/media/cec/core/cec-adap.c
-+++ b/drivers/media/cec/core/cec-adap.c
-@@ -1574,9 +1574,12 @@ static int cec_config_thread_func(void *arg)
- */
- static void cec_claim_log_addrs(struct cec_adapter *adap, bool block)
- {
-- if (WARN_ON(adap->is_configuring || adap->is_configured))
-+ if (WARN_ON(adap->is_claiming_log_addrs ||
-+ adap->is_configuring || adap->is_configured))
- return;
-
-+ adap->is_claiming_log_addrs = true;
-+
- init_completion(&adap->config_completion);
-
- /* Ready to kick off the thread */
-@@ -1591,6 +1594,7 @@ static void cec_claim_log_addrs(struct cec_adapter *adap, bool block)
- wait_for_completion(&adap->config_completion);
- mutex_lock(&adap->lock);
- }
-+ adap->is_claiming_log_addrs = false;
- }
-
- /*
-diff --git a/drivers/media/cec/core/cec-api.c b/drivers/media/cec/core/cec-api.c
-index d64bb716f9c68..3ef9153443044 100644
---- a/drivers/media/cec/core/cec-api.c
-+++ b/drivers/media/cec/core/cec-api.c
-@@ -178,7 +178,7 @@ static long cec_adap_s_log_addrs(struct cec_adapter *adap, struct cec_fh *fh,
- CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU |
- CEC_LOG_ADDRS_FL_CDC_ONLY;
- mutex_lock(&adap->lock);
-- if (!adap->is_configuring &&
-+ if (!adap->is_claiming_log_addrs && !adap->is_configuring &&
- (!log_addrs.num_log_addrs || !adap->is_configured) &&
- !cec_is_busy(adap, fh)) {
- err = __cec_s_log_addrs(adap, &log_addrs, block);
-diff --git a/include/media/cec.h b/include/media/cec.h
-index d77982685116e..dc425cdc3da9e 100644
---- a/include/media/cec.h
-+++ b/include/media/cec.h
-@@ -260,6 +260,7 @@ struct cec_adapter {
- u16 phys_addr;
- bool needs_hpd;
- bool is_enabled;
-+ bool is_claiming_log_addrs;
- bool is_configuring;
- bool must_reconfigure;
- bool is_configured;
---
-2.43.0
-
+++ /dev/null
-From d6290263cd28136674308fbadcbc5b500487d94e Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 2 Jun 2022 06:50:24 +0100
-Subject: media: flexcop-usb: fix sanity check of bNumEndpoints
-
-From: Dongliang Mu <mudongliangabcd@gmail.com>
-
-[ Upstream commit f62dc8f6bf82d1b307fc37d8d22cc79f67856c2f ]
-
-Commit d725d20e81c2 ("media: flexcop-usb: sanity checking of endpoint type
-") adds a sanity check for endpoint[1], but fails to modify the sanity
-check of bNumEndpoints.
-
-Fix this by modifying the sanity check of bNumEndpoints to 2.
-
-Link: https://lore.kernel.org/linux-media/20220602055027.849014-1-dzm91@hust.edu.cn
-Fixes: d725d20e81c2 ("media: flexcop-usb: sanity checking of endpoint type")
-Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
-Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/media/usb/b2c2/flexcop-usb.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/media/usb/b2c2/flexcop-usb.c b/drivers/media/usb/b2c2/flexcop-usb.c
-index 790787f0eba84..bcb24d8964981 100644
---- a/drivers/media/usb/b2c2/flexcop-usb.c
-+++ b/drivers/media/usb/b2c2/flexcop-usb.c
-@@ -515,7 +515,7 @@ static int flexcop_usb_init(struct flexcop_usb *fc_usb)
-
- alt = fc_usb->uintf->cur_altsetting;
-
-- if (alt->desc.bNumEndpoints < 1)
-+ if (alt->desc.bNumEndpoints < 2)
- return -ENODEV;
- if (!usb_endpoint_is_isoc_in(&alt->endpoint[0].desc))
- return -ENODEV;
---
-2.43.0
-
+++ /dev/null
-From 155b651d718f13d9492bf1ad98339a05a09cbdbc Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 28 Dec 2023 13:32:40 +0200
-Subject: media: mediatek: vcodec: fix possible unbalanced PM counter
-
-From: Eugen Hristev <eugen.hristev@collabora.com>
-
-[ Upstream commit c28d4921a1e3ce0a0374b7e9d68593be8802c42a ]
-
-It is possible that mtk_vcodec_enc_pw_on fails, and in that scenario
-the PM counter is not incremented, and subsequent call to
-mtk_vcodec_enc_pw_off decrements the counter, leading to a PM imbalance.
-Fix by bailing out of venc_if_encode in the case when mtk_vcodec_enc_pw_on
-fails.
-
-Fixes: 4e855a6efa54 ("[media] vcodec: mediatek: Add Mediatek V4L2 Video Encoder Driver")
-Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com>
-Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
-Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
-Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
-Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- .../platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.c | 4 +++-
- .../platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.h | 2 +-
- drivers/media/platform/mediatek/vcodec/encoder/venc_drv_if.c | 5 ++++-
- 3 files changed, 8 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.c b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.c
-index a22b7dfc656e1..1a2b14a3e219c 100644
---- a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.c
-+++ b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.c
-@@ -58,13 +58,15 @@ int mtk_vcodec_init_enc_clk(struct mtk_vcodec_enc_dev *mtkdev)
- return 0;
- }
-
--void mtk_vcodec_enc_pw_on(struct mtk_vcodec_pm *pm)
-+int mtk_vcodec_enc_pw_on(struct mtk_vcodec_pm *pm)
- {
- int ret;
-
- ret = pm_runtime_resume_and_get(pm->dev);
- if (ret)
- dev_err(pm->dev, "pm_runtime_resume_and_get fail: %d", ret);
-+
-+ return ret;
- }
-
- void mtk_vcodec_enc_pw_off(struct mtk_vcodec_pm *pm)
-diff --git a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.h b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.h
-index 157ea08ba9e36..2e28f25e36cc4 100644
---- a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.h
-+++ b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.h
-@@ -10,7 +10,7 @@
- #include "mtk_vcodec_enc_drv.h"
-
- int mtk_vcodec_init_enc_clk(struct mtk_vcodec_enc_dev *dev);
--void mtk_vcodec_enc_pw_on(struct mtk_vcodec_pm *pm);
-+int mtk_vcodec_enc_pw_on(struct mtk_vcodec_pm *pm);
- void mtk_vcodec_enc_pw_off(struct mtk_vcodec_pm *pm);
- void mtk_vcodec_enc_clock_on(struct mtk_vcodec_pm *pm);
- void mtk_vcodec_enc_clock_off(struct mtk_vcodec_pm *pm);
-diff --git a/drivers/media/platform/mediatek/vcodec/encoder/venc_drv_if.c b/drivers/media/platform/mediatek/vcodec/encoder/venc_drv_if.c
-index c402a686f3cb2..e83747b8d69ab 100644
---- a/drivers/media/platform/mediatek/vcodec/encoder/venc_drv_if.c
-+++ b/drivers/media/platform/mediatek/vcodec/encoder/venc_drv_if.c
-@@ -64,7 +64,9 @@ int venc_if_encode(struct mtk_vcodec_enc_ctx *ctx,
- ctx->dev->curr_ctx = ctx;
- spin_unlock_irqrestore(&ctx->dev->irqlock, flags);
-
-- mtk_vcodec_enc_pw_on(&ctx->dev->pm);
-+ ret = mtk_vcodec_enc_pw_on(&ctx->dev->pm);
-+ if (ret)
-+ goto venc_if_encode_pw_on_err;
- mtk_vcodec_enc_clock_on(&ctx->dev->pm);
- ret = ctx->enc_if->encode(ctx->drv_handle, opt, frm_buf,
- bs_buf, result);
-@@ -75,6 +77,7 @@ int venc_if_encode(struct mtk_vcodec_enc_ctx *ctx,
- ctx->dev->curr_ctx = NULL;
- spin_unlock_irqrestore(&ctx->dev->irqlock, flags);
-
-+venc_if_encode_pw_on_err:
- mtk_venc_unlock(ctx);
- return ret;
- }
---
-2.43.0
-
+++ /dev/null
-From ab558a205a4ca4c18acb9f5d2139ca1f70b014ec Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 28 Mar 2024 19:44:13 -0300
-Subject: media: ov2680: Allow probing if link-frequencies is absent
-
-From: Fabio Estevam <festevam@denx.de>
-
-[ Upstream commit fd2e66abd729dae5809dbb41c6c52a6931cfa6bb ]
-
-Since commit 63b0cd30b78e ("media: ov2680: Add bus-cfg / endpoint
-property verification") the ov2680 no longer probes on a imx7s-warp7:
-
-ov2680 1-0036: error -EINVAL: supported link freq 330000000 not found
-ov2680 1-0036: probe with driver ov2680 failed with error -22
-
-As the 'link-frequencies' property is not mandatory, allow the probe
-to succeed by skipping the link-frequency verification when the
-property is absent.
-
-Cc: stable@vger.kernel.org
-Fixes: 63b0cd30b78e ("media: ov2680: Add bus-cfg / endpoint property verification")
-Signed-off-by: Fabio Estevam <festevam@denx.de>
-Reviewed-by: Hans de Goede <hdegoede@redhat.com>
-Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
-Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-Stable-dep-of: 24034af644fc ("media: ov2680: Do not fail if data-lanes property is absent")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/media/i2c/ov2680.c | 9 +++++++--
- 1 file changed, 7 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c
-index 3e3b7c2b492cf..a857763c7984c 100644
---- a/drivers/media/i2c/ov2680.c
-+++ b/drivers/media/i2c/ov2680.c
-@@ -1123,18 +1123,23 @@ static int ov2680_parse_dt(struct ov2680_dev *sensor)
- goto out_free_bus_cfg;
- }
-
-+ if (!bus_cfg.nr_of_link_frequencies) {
-+ dev_warn(dev, "Consider passing 'link-frequencies' in DT\n");
-+ goto skip_link_freq_validation;
-+ }
-+
- for (i = 0; i < bus_cfg.nr_of_link_frequencies; i++)
- if (bus_cfg.link_frequencies[i] == sensor->link_freq[0])
- break;
-
-- if (bus_cfg.nr_of_link_frequencies == 0 ||
-- bus_cfg.nr_of_link_frequencies == i) {
-+ if (bus_cfg.nr_of_link_frequencies == i) {
- ret = dev_err_probe(dev, -EINVAL,
- "supported link freq %lld not found\n",
- sensor->link_freq[0]);
- goto out_free_bus_cfg;
- }
-
-+skip_link_freq_validation:
- ret = 0;
- out_free_bus_cfg:
- v4l2_fwnode_endpoint_free(&bus_cfg);
---
-2.43.0
-
+++ /dev/null
-From 7b536350335682d8b03f504f98549b12337700fb Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 28 Mar 2024 19:44:12 -0300
-Subject: media: ov2680: Clear the 'ret' variable on success
-
-From: Fabio Estevam <festevam@denx.de>
-
-[ Upstream commit 49a9bad83b4ab5dac1d7aba2615c77978bcf3984 ]
-
-Since commit 63b0cd30b78e ("media: ov2680: Add bus-cfg / endpoint
-property verification") even when the correct 'link-frequencies'
-property is passed in the devicetree, the driver fails to probe:
-
-ov2680 1-0036: probe with driver ov2680 failed with error -22
-
-The reason is that the variable 'ret' may contain the -EINVAL value
-from a previous assignment:
-
-ret = fwnode_property_read_u32(dev_fwnode(dev), "clock-frequency",
- &rate);
-
-Fix the problem by clearing 'ret' on the successful path.
-
-Tested on imx7s-warp board with the following devicetree:
-
-port {
- ov2680_to_mipi: endpoint {
- remote-endpoint = <&mipi_from_sensor>;
- clock-lanes = <0>;
- data-lanes = <1>;
- link-frequencies = /bits/ 64 <330000000>;
- };
-};
-
-Cc: stable@vger.kernel.org
-Fixes: 63b0cd30b78e ("media: ov2680: Add bus-cfg / endpoint property verification")
-Suggested-by: Hans de Goede <hdegoede@redhat.com>
-Signed-off-by: Fabio Estevam <festevam@denx.de>
-Reviewed-by: Hans de Goede <hdegoede@redhat.com>
-Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
-Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-Stable-dep-of: 24034af644fc ("media: ov2680: Do not fail if data-lanes property is absent")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/media/i2c/ov2680.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c
-index 39d321e2b7f98..3e3b7c2b492cf 100644
---- a/drivers/media/i2c/ov2680.c
-+++ b/drivers/media/i2c/ov2680.c
-@@ -1135,6 +1135,7 @@ static int ov2680_parse_dt(struct ov2680_dev *sensor)
- goto out_free_bus_cfg;
- }
-
-+ ret = 0;
- out_free_bus_cfg:
- v4l2_fwnode_endpoint_free(&bus_cfg);
- return ret;
---
-2.43.0
-
+++ /dev/null
-From 367ce147abd1df830c8107511b897032c3b287d1 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sun, 14 Apr 2024 18:09:06 -0300
-Subject: media: ov2680: Do not fail if data-lanes property is absent
-
-From: Fabio Estevam <festevam@denx.de>
-
-[ Upstream commit 24034af644fc01126bec9850346a06ef1450181f ]
-
-Since commit 63b0cd30b78e ("media: ov2680: Add bus-cfg / endpoint
-property verification") the ov2680 driver no longer probes when the
-'data-lanes' property is absent.
-
-The OV2680 sensor has only one data lane, so there is no need for
-describing it the devicetree.
-
-Remove the unnecessary data-lanes property check.
-
-Suggested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
-Fixes: 63b0cd30b78e ("media: ov2680: Add bus-cfg / endpoint property verification")
-Signed-off-by: Fabio Estevam <festevam@denx.de>
-Reviewed-by: Hans de Goede <hdegoede@redhat.com>
-Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
-Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/media/i2c/ov2680.c | 7 -------
- 1 file changed, 7 deletions(-)
-
-diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c
-index a857763c7984c..4577a8977c85a 100644
---- a/drivers/media/i2c/ov2680.c
-+++ b/drivers/media/i2c/ov2680.c
-@@ -1116,13 +1116,6 @@ static int ov2680_parse_dt(struct ov2680_dev *sensor)
- sensor->pixel_rate = sensor->link_freq[0] * 2;
- do_div(sensor->pixel_rate, 10);
-
-- /* Verify bus cfg */
-- if (bus_cfg.bus.mipi_csi2.num_data_lanes != 1) {
-- ret = dev_err_probe(dev, -EINVAL,
-- "only a 1-lane CSI2 config is supported");
-- goto out_free_bus_cfg;
-- }
--
- if (!bus_cfg.nr_of_link_frequencies) {
- dev_warn(dev, "Consider passing 'link-frequencies' in DT\n");
- goto skip_link_freq_validation;
---
-2.43.0
-
+++ /dev/null
-From 55c5bb40c789d80d80d35a12f0630b531268fd07 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 22 Apr 2024 12:32:44 +0300
-Subject: media: stk1160: fix bounds checking in stk1160_copy_video()
-
-From: Dan Carpenter <dan.carpenter@linaro.org>
-
-[ Upstream commit faa4364bef2ec0060de381ff028d1d836600a381 ]
-
-The subtract in this condition is reversed. The ->length is the length
-of the buffer. The ->bytesused is how many bytes we have copied thus
-far. When the condition is reversed that means the result of the
-subtraction is always negative but since it's unsigned then the result
-is a very high positive value. That means the overflow check is never
-true.
-
-Additionally, the ->bytesused doesn't actually work for this purpose
-because we're not writing to "buf->mem + buf->bytesused". Instead, the
-math to calculate the destination where we are writing is a bit
-involved. You calculate the number of full lines already written,
-multiply by two, skip a line if necessary so that we start on an odd
-numbered line, and add the offset into the line.
-
-To fix this buffer overflow, just take the actual destination where we
-are writing, if the offset is already out of bounds print an error and
-return. Otherwise, write up to buf->length bytes.
-
-Fixes: 9cb2173e6ea8 ("[media] media: Add stk1160 new driver (easycap replacement)")
-Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
-Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
-Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/media/usb/stk1160/stk1160-video.c | 20 +++++++++++++++-----
- 1 file changed, 15 insertions(+), 5 deletions(-)
-
-diff --git a/drivers/media/usb/stk1160/stk1160-video.c b/drivers/media/usb/stk1160/stk1160-video.c
-index 366f0e4a5dc0d..e79c45db60ab5 100644
---- a/drivers/media/usb/stk1160/stk1160-video.c
-+++ b/drivers/media/usb/stk1160/stk1160-video.c
-@@ -99,7 +99,7 @@ void stk1160_buffer_done(struct stk1160 *dev)
- static inline
- void stk1160_copy_video(struct stk1160 *dev, u8 *src, int len)
- {
-- int linesdone, lineoff, lencopy;
-+ int linesdone, lineoff, lencopy, offset;
- int bytesperline = dev->width * 2;
- struct stk1160_buffer *buf = dev->isoc_ctl.buf;
- u8 *dst = buf->mem;
-@@ -139,8 +139,13 @@ void stk1160_copy_video(struct stk1160 *dev, u8 *src, int len)
- * Check if we have enough space left in the buffer.
- * In that case, we force loop exit after copy.
- */
-- if (lencopy > buf->bytesused - buf->length) {
-- lencopy = buf->bytesused - buf->length;
-+ offset = dst - (u8 *)buf->mem;
-+ if (offset > buf->length) {
-+ dev_warn_ratelimited(dev->dev, "out of bounds offset\n");
-+ return;
-+ }
-+ if (lencopy > buf->length - offset) {
-+ lencopy = buf->length - offset;
- remain = lencopy;
- }
-
-@@ -182,8 +187,13 @@ void stk1160_copy_video(struct stk1160 *dev, u8 *src, int len)
- * Check if we have enough space left in the buffer.
- * In that case, we force loop exit after copy.
- */
-- if (lencopy > buf->bytesused - buf->length) {
-- lencopy = buf->bytesused - buf->length;
-+ offset = dst - (u8 *)buf->mem;
-+ if (offset > buf->length) {
-+ dev_warn_ratelimited(dev->dev, "offset out of bounds\n");
-+ return;
-+ }
-+ if (lencopy > buf->length - offset) {
-+ lencopy = buf->length - offset;
- remain = lencopy;
- }
-
---
-2.43.0
-
+++ /dev/null
-From 85adea81d07d34dfdb85689c12780f7185c92cd7 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 27 Sep 2023 05:04:38 +0100
-Subject: media: sunxi: a83-mips-csi2: also select GENERIC_PHY
-
-From: Randy Dunlap <rdunlap@infradead.org>
-
-[ Upstream commit 8237026159cb6760ad22e28d57b9a1c53b612d3a ]
-
-When selecting GENERIC_PHY_MIPI_DPHY, also select GENERIC_PHY to
-prevent kconfig warnings:
-
-WARNING: unmet direct dependencies detected for GENERIC_PHY_MIPI_DPHY
- Depends on [n]: GENERIC_PHY [=n]
- Selected by [y]:
- - VIDEO_SUN8I_A83T_MIPI_CSI2 [=y] && MEDIA_SUPPORT [=y] && MEDIA_PLATFORM_SUPPORT [=y] && MEDIA_PLATFORM_DRIVERS [=y] && V4L_PLATFORM_DRIVERS [=y] && VIDEO_DEV [=y] && (ARCH_SUNXI || COMPILE_TEST [=y]) && PM [=y] && COMMON_CLK [=y] && RESET_CONTROLLER [=y]
-
-Fixes: 94d7fd9692b5 ("media: sunxi: Depend on GENERIC_PHY_MIPI_DPHY")
-Reported-by: kernel test robot <lkp@intel.com>
-Closes: https://lore.kernel.org/r/ZQ/WS8HC1A3F0Qn8@rli9-mobl
-Link: https://lore.kernel.org/linux-media/20230927040438.5589-1-rdunlap@infradead.org
-
-Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
-Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/Kconfig | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/Kconfig b/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/Kconfig
-index 47a8c0fb7eb9f..99c401e653bc4 100644
---- a/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/Kconfig
-+++ b/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/Kconfig
-@@ -8,6 +8,7 @@ config VIDEO_SUN8I_A83T_MIPI_CSI2
- select VIDEO_V4L2_SUBDEV_API
- select V4L2_FWNODE
- select REGMAP_MMIO
-+ select GENERIC_PHY
- select GENERIC_PHY_MIPI_DPHY
- help
- Support for the Allwinner A83T MIPI CSI-2 controller and D-PHY.
---
-2.43.0
-
+++ /dev/null
-From 310d7ea439d5dde8455ce858be7e8f1cfb6833a7 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 23 Feb 2024 13:53:02 +0530
-Subject: media: ti: j721e-csi2rx: Fix races while restarting DMA
-
-From: Jai Luthra <j-luthra@ti.com>
-
-[ Upstream commit ad79c9ecea5baa7b4f19677e4b1c881ed89b0c3b ]
-
-After the frame is submitted to DMA, it may happen that the submitted
-list is not updated soon enough, and the DMA callback is triggered
-before that.
-
-This can lead to kernel crashes, so move everything in a single
-lock/unlock section to prevent such races.
-
-Fixes: b4a3d877dc92 ("media: ti: Add CSI2RX support for J721E")
-Signed-off-by: Jai Luthra <j-luthra@ti.com>
-Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
-Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c | 5 ++---
- 1 file changed, 2 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c b/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c
-index 59b30fc431440..c8c1fda73e530 100644
---- a/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c
-+++ b/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c
-@@ -762,15 +762,14 @@ static void ti_csi2rx_buffer_queue(struct vb2_buffer *vb)
- dev_warn(csi->dev,
- "Failed to drain DMA. Next frame might be bogus\n");
-
-+ spin_lock_irqsave(&dma->lock, flags);
- ret = ti_csi2rx_start_dma(csi, buf);
- if (ret) {
-- dev_err(csi->dev, "Failed to start DMA: %d\n", ret);
-- spin_lock_irqsave(&dma->lock, flags);
- vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
- dma->state = TI_CSI2RX_DMA_IDLE;
- spin_unlock_irqrestore(&dma->lock, flags);
-+ dev_err(csi->dev, "Failed to start DMA: %d\n", ret);
- } else {
-- spin_lock_irqsave(&dma->lock, flags);
- list_add_tail(&buf->list, &dma->submitted);
- spin_unlock_irqrestore(&dma->lock, flags);
- }
---
-2.43.0
-
+++ /dev/null
-From a9ab085934c7c009b662d1afbc1f672143d5b275 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 10 Apr 2024 12:58:44 +0300
-Subject: media: v4l: Don't turn on privacy LED if streamon fails
-
-From: Sakari Ailus <sakari.ailus@linux.intel.com>
-
-[ Upstream commit f2bf6cd8f44781349620e30a0af8987fe9af008f ]
-
-Turn on the privacy LED only if streamon succeeds. This can be done after
-enabling streaming on the sensor.
-
-Fixes: b6e10ff6c23d ("media: v4l2-core: Make the v4l2-core code enable/disable the privacy LED if present")
-Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
-Reviewed-by: Hans de Goede <hdegoede@redhat.com>
-Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
-Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
-Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/media/v4l2-core/v4l2-subdev.c | 22 ++++++++++++----------
- 1 file changed, 12 insertions(+), 10 deletions(-)
-
-diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
-index 45836f0a2b0a7..19d20871afefa 100644
---- a/drivers/media/v4l2-core/v4l2-subdev.c
-+++ b/drivers/media/v4l2-core/v4l2-subdev.c
-@@ -412,15 +412,6 @@ static int call_s_stream(struct v4l2_subdev *sd, int enable)
- if (WARN_ON(!!sd->enabled_streams == !!enable))
- return 0;
-
--#if IS_REACHABLE(CONFIG_LEDS_CLASS)
-- if (!IS_ERR_OR_NULL(sd->privacy_led)) {
-- if (enable)
-- led_set_brightness(sd->privacy_led,
-- sd->privacy_led->max_brightness);
-- else
-- led_set_brightness(sd->privacy_led, 0);
-- }
--#endif
- ret = sd->ops->video->s_stream(sd, enable);
-
- if (!enable && ret < 0) {
-@@ -428,9 +419,20 @@ static int call_s_stream(struct v4l2_subdev *sd, int enable)
- ret = 0;
- }
-
-- if (!ret)
-+ if (!ret) {
- sd->enabled_streams = enable ? BIT(0) : 0;
-
-+#if IS_REACHABLE(CONFIG_LEDS_CLASS)
-+ if (!IS_ERR_OR_NULL(sd->privacy_led)) {
-+ if (enable)
-+ led_set_brightness(sd->privacy_led,
-+ sd->privacy_led->max_brightness);
-+ else
-+ led_set_brightness(sd->privacy_led, 0);
-+ }
-+#endif
-+ }
-+
- return ret;
- }
-
---
-2.43.0
-
+++ /dev/null
-From 566c71884d8ec02e5e6f1f24702d26a9b56418b6 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 11 Apr 2024 10:27:21 +0200
-Subject: microblaze: Remove early printk call from cpuinfo-static.c
-
-From: Michal Simek <michal.simek@amd.com>
-
-[ Upstream commit 58d647506c92ccd3cfa0c453c68ddd14f40bf06f ]
-
-Early printk has been removed already that's why also remove calling it.
-Similar change has been done in cpuinfo-pvr-full.c by commit cfbd8d1979af
-("microblaze: Remove early printk setup").
-
-Fixes: 96f0e6fcc9ad ("microblaze: remove redundant early_printk support")
-Signed-off-by: Michal Simek <michal.simek@amd.com>
-Link: https://lore.kernel.org/r/2f10db506be8188fa07b6ec331caca01af1b10f8.1712824039.git.michal.simek@amd.com
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/microblaze/kernel/cpu/cpuinfo-static.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/microblaze/kernel/cpu/cpuinfo-static.c b/arch/microblaze/kernel/cpu/cpuinfo-static.c
-index 85dbda4a08a81..03da36dc6d9c9 100644
---- a/arch/microblaze/kernel/cpu/cpuinfo-static.c
-+++ b/arch/microblaze/kernel/cpu/cpuinfo-static.c
-@@ -18,7 +18,7 @@ static const char family_string[] = CONFIG_XILINX_MICROBLAZE0_FAMILY;
- static const char cpu_ver_string[] = CONFIG_XILINX_MICROBLAZE0_HW_VER;
-
- #define err_printk(x) \
-- early_printk("ERROR: Microblaze " x "-different for kernel and DTS\n");
-+ pr_err("ERROR: Microblaze " x "-different for kernel and DTS\n");
-
- void __init set_cpuinfo_static(struct cpuinfo *ci, struct device_node *cpu)
- {
---
-2.43.0
-
+++ /dev/null
-From 589d2ed19b113a999afcf701253472bce9cc0707 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 11 Apr 2024 10:21:44 +0200
-Subject: microblaze: Remove gcc flag for non existing early_printk.c file
-
-From: Michal Simek <michal.simek@amd.com>
-
-[ Upstream commit edc66cf0c4164aa3daf6cc55e970bb94383a6a57 ]
-
-early_printk support for removed long time ago but compilation flag for
-ftrace still points to already removed file that's why remove that line
-too.
-
-Fixes: 96f0e6fcc9ad ("microblaze: remove redundant early_printk support")
-Signed-off-by: Michal Simek <michal.simek@amd.com>
-Link: https://lore.kernel.org/r/5493467419cd2510a32854e2807bcd263de981a0.1712823702.git.michal.simek@amd.com
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/microblaze/kernel/Makefile | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/arch/microblaze/kernel/Makefile b/arch/microblaze/kernel/Makefile
-index 4393bee64eaf8..85c4d29ef43e9 100644
---- a/arch/microblaze/kernel/Makefile
-+++ b/arch/microblaze/kernel/Makefile
-@@ -7,7 +7,6 @@ ifdef CONFIG_FUNCTION_TRACER
- # Do not trace early boot code and low level code
- CFLAGS_REMOVE_timer.o = -pg
- CFLAGS_REMOVE_intc.o = -pg
--CFLAGS_REMOVE_early_printk.o = -pg
- CFLAGS_REMOVE_ftrace.o = -pg
- CFLAGS_REMOVE_process.o = -pg
- endif
---
-2.43.0
-
+++ /dev/null
-From 31ad1958cbadaa0ee9c506709f98f573a6c60b79 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 20 Mar 2024 17:38:36 -0500
-Subject: mmc: sdhci_am654: Add ITAPDLYSEL in sdhci_j721e_4bit_set_clock
-
-From: Judith Mendez <jm@ti.com>
-
-[ Upstream commit 9dff65bb5e09903c27d9cff947dff4d22b6ea6a1 ]
-
-Add ITAPDLYSEL to sdhci_j721e_4bit_set_clock function.
-This allows to set the correct ITAPDLY for timings that
-do not carry out tuning.
-
-Fixes: 1accbced1c32 ("mmc: sdhci_am654: Add Support for 4 bit IP on J721E")
-Signed-off-by: Judith Mendez <jm@ti.com>
-Acked-by: Adrian Hunter <adrian.hunter@intel.com>
-Link: https://lore.kernel.org/r/20240320223837.959900-7-jm@ti.com
-Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/mmc/host/sdhci_am654.c | 12 +++++++++---
- 1 file changed, 9 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c
-index 888bfda0ebc0e..884d1b53180d7 100644
---- a/drivers/mmc/host/sdhci_am654.c
-+++ b/drivers/mmc/host/sdhci_am654.c
-@@ -320,6 +320,7 @@ static void sdhci_j721e_4bit_set_clock(struct sdhci_host *host,
- unsigned char timing = host->mmc->ios.timing;
- u32 otap_del_sel;
- u32 itap_del_ena;
-+ u32 itap_del_sel;
- u32 mask, val;
-
- /* Setup DLL Output TAP delay */
-@@ -329,13 +330,18 @@ static void sdhci_j721e_4bit_set_clock(struct sdhci_host *host,
- val = (0x1 << OTAPDLYENA_SHIFT) |
- (otap_del_sel << OTAPDLYSEL_SHIFT);
-
-+ /* Setup Input TAP delay */
- itap_del_ena = sdhci_am654->itap_del_ena[timing];
-+ itap_del_sel = sdhci_am654->itap_del_sel[timing];
-
-- mask |= ITAPDLYENA_MASK;
-- val |= (itap_del_ena << ITAPDLYENA_SHIFT);
-+ mask |= ITAPDLYENA_MASK | ITAPDLYSEL_MASK;
-+ val |= (itap_del_ena << ITAPDLYENA_SHIFT) |
-+ (itap_del_sel << ITAPDLYSEL_SHIFT);
-
-+ regmap_update_bits(sdhci_am654->base, PHY_CTRL4, ITAPCHGWIN_MASK,
-+ 1 << ITAPCHGWIN_SHIFT);
- regmap_update_bits(sdhci_am654->base, PHY_CTRL4, mask, val);
--
-+ regmap_update_bits(sdhci_am654->base, PHY_CTRL4, ITAPCHGWIN_MASK, 0);
- regmap_update_bits(sdhci_am654->base, PHY_CTRL5, CLKBUFSEL_MASK,
- sdhci_am654->clkbuf_sel);
-
---
-2.43.0
-
+++ /dev/null
-From dcebc60b7fb78715ab3aba6f19d07c1d9105d093 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 20 Mar 2024 17:38:33 -0500
-Subject: mmc: sdhci_am654: Add OTAP/ITAP delay enable
-
-From: Judith Mendez <jm@ti.com>
-
-[ Upstream commit 387c1bf7dce0dfea02080c8bdb066b5209e92155 ]
-
-Currently the OTAP/ITAP delay enable functionality is incorrect in
-the am654_set_clock function. The OTAP delay is not enabled when
-timing < SDR25 bus speed mode. The ITAP delay is not enabled for
-timings that do not carry out tuning.
-
-Add this OTAP/ITAP delay functionality according to the datasheet
-[1] OTAPDLYENA and ITAPDLYENA for MMC0.
-
-[1] https://www.ti.com/lit/ds/symlink/am62p.pdf
-
-Fixes: 8ee5fc0e0b3b ("mmc: sdhci_am654: Update OTAPDLY writes")
-Signed-off-by: Judith Mendez <jm@ti.com>
-Acked-by: Adrian Hunter <adrian.hunter@intel.com>
-Link: https://lore.kernel.org/r/20240320223837.959900-4-jm@ti.com
-Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/mmc/host/sdhci_am654.c | 40 ++++++++++++++++++++++------------
- 1 file changed, 26 insertions(+), 14 deletions(-)
-
-diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c
-index cfb614d0b42b4..888bfda0ebc0e 100644
---- a/drivers/mmc/host/sdhci_am654.c
-+++ b/drivers/mmc/host/sdhci_am654.c
-@@ -143,6 +143,7 @@ struct sdhci_am654_data {
- struct regmap *base;
- int otap_del_sel[ARRAY_SIZE(td)];
- int itap_del_sel[ARRAY_SIZE(td)];
-+ u32 itap_del_ena[ARRAY_SIZE(td)];
- int clkbuf_sel;
- int trm_icp;
- int drv_strength;
-@@ -239,11 +240,13 @@ static void sdhci_am654_setup_dll(struct sdhci_host *host, unsigned int clock)
- }
-
- static void sdhci_am654_write_itapdly(struct sdhci_am654_data *sdhci_am654,
-- u32 itapdly)
-+ u32 itapdly, u32 enable)
- {
- /* Set ITAPCHGWIN before writing to ITAPDLY */
- regmap_update_bits(sdhci_am654->base, PHY_CTRL4, ITAPCHGWIN_MASK,
- 1 << ITAPCHGWIN_SHIFT);
-+ regmap_update_bits(sdhci_am654->base, PHY_CTRL4, ITAPDLYENA_MASK,
-+ enable << ITAPDLYENA_SHIFT);
- regmap_update_bits(sdhci_am654->base, PHY_CTRL4, ITAPDLYSEL_MASK,
- itapdly << ITAPDLYSEL_SHIFT);
- regmap_update_bits(sdhci_am654->base, PHY_CTRL4, ITAPCHGWIN_MASK, 0);
-@@ -260,8 +263,8 @@ static void sdhci_am654_setup_delay_chain(struct sdhci_am654_data *sdhci_am654,
- mask = SELDLYTXCLK_MASK | SELDLYRXCLK_MASK;
- regmap_update_bits(sdhci_am654->base, PHY_CTRL5, mask, val);
-
-- sdhci_am654_write_itapdly(sdhci_am654,
-- sdhci_am654->itap_del_sel[timing]);
-+ sdhci_am654_write_itapdly(sdhci_am654, sdhci_am654->itap_del_sel[timing],
-+ sdhci_am654->itap_del_ena[timing]);
- }
-
- static void sdhci_am654_set_clock(struct sdhci_host *host, unsigned int clock)
-@@ -270,7 +273,6 @@ static void sdhci_am654_set_clock(struct sdhci_host *host, unsigned int clock)
- struct sdhci_am654_data *sdhci_am654 = sdhci_pltfm_priv(pltfm_host);
- unsigned char timing = host->mmc->ios.timing;
- u32 otap_del_sel;
-- u32 otap_del_ena;
- u32 mask, val;
-
- regmap_update_bits(sdhci_am654->base, PHY_CTRL1, ENDLL_MASK, 0);
-@@ -279,10 +281,9 @@ static void sdhci_am654_set_clock(struct sdhci_host *host, unsigned int clock)
-
- /* Setup DLL Output TAP delay */
- otap_del_sel = sdhci_am654->otap_del_sel[timing];
-- otap_del_ena = (timing > MMC_TIMING_UHS_SDR25) ? 1 : 0;
-
- mask = OTAPDLYENA_MASK | OTAPDLYSEL_MASK;
-- val = (otap_del_ena << OTAPDLYENA_SHIFT) |
-+ val = (0x1 << OTAPDLYENA_SHIFT) |
- (otap_del_sel << OTAPDLYSEL_SHIFT);
-
- /* Write to STRBSEL for HS400 speed mode */
-@@ -300,7 +301,8 @@ static void sdhci_am654_set_clock(struct sdhci_host *host, unsigned int clock)
- if (timing > MMC_TIMING_UHS_SDR25 && clock >= CLOCK_TOO_SLOW_HZ) {
- sdhci_am654_setup_dll(host, clock);
- sdhci_am654->dll_enable = true;
-- sdhci_am654_write_itapdly(sdhci_am654, sdhci_am654->itap_del_sel[timing]);
-+ sdhci_am654_write_itapdly(sdhci_am654, sdhci_am654->itap_del_sel[timing],
-+ sdhci_am654->itap_del_ena[timing]);
- } else {
- sdhci_am654_setup_delay_chain(sdhci_am654, timing);
- sdhci_am654->dll_enable = false;
-@@ -317,6 +319,7 @@ static void sdhci_j721e_4bit_set_clock(struct sdhci_host *host,
- struct sdhci_am654_data *sdhci_am654 = sdhci_pltfm_priv(pltfm_host);
- unsigned char timing = host->mmc->ios.timing;
- u32 otap_del_sel;
-+ u32 itap_del_ena;
- u32 mask, val;
-
- /* Setup DLL Output TAP delay */
-@@ -325,6 +328,12 @@ static void sdhci_j721e_4bit_set_clock(struct sdhci_host *host,
- mask = OTAPDLYENA_MASK | OTAPDLYSEL_MASK;
- val = (0x1 << OTAPDLYENA_SHIFT) |
- (otap_del_sel << OTAPDLYSEL_SHIFT);
-+
-+ itap_del_ena = sdhci_am654->itap_del_ena[timing];
-+
-+ mask |= ITAPDLYENA_MASK;
-+ val |= (itap_del_ena << ITAPDLYENA_SHIFT);
-+
- regmap_update_bits(sdhci_am654->base, PHY_CTRL4, mask, val);
-
- regmap_update_bits(sdhci_am654->base, PHY_CTRL5, CLKBUFSEL_MASK,
-@@ -478,6 +487,7 @@ static int sdhci_am654_platform_execute_tuning(struct sdhci_host *host,
- {
- struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
- struct sdhci_am654_data *sdhci_am654 = sdhci_pltfm_priv(pltfm_host);
-+ unsigned char timing = host->mmc->ios.timing;
- struct window fail_window[ITAPDLY_LENGTH];
- u8 curr_pass, itap;
- u8 fail_index = 0;
-@@ -486,11 +496,10 @@ static int sdhci_am654_platform_execute_tuning(struct sdhci_host *host,
- memset(fail_window, 0, sizeof(fail_window));
-
- /* Enable ITAPDLY */
-- regmap_update_bits(sdhci_am654->base, PHY_CTRL4, ITAPDLYENA_MASK,
-- 1 << ITAPDLYENA_SHIFT);
-+ sdhci_am654->itap_del_ena[timing] = 0x1;
-
- for (itap = 0; itap < ITAPDLY_LENGTH; itap++) {
-- sdhci_am654_write_itapdly(sdhci_am654, itap);
-+ sdhci_am654_write_itapdly(sdhci_am654, itap, sdhci_am654->itap_del_ena[timing]);
-
- curr_pass = !mmc_send_tuning(host->mmc, opcode, NULL);
-
-@@ -514,7 +523,7 @@ static int sdhci_am654_platform_execute_tuning(struct sdhci_host *host,
- itap = sdhci_am654_calculate_itap(host, fail_window, fail_index,
- sdhci_am654->dll_enable);
-
-- sdhci_am654_write_itapdly(sdhci_am654, itap);
-+ sdhci_am654_write_itapdly(sdhci_am654, itap, sdhci_am654->itap_del_ena[timing]);
-
- return 0;
- }
-@@ -663,9 +672,12 @@ static int sdhci_am654_get_otap_delay(struct sdhci_host *host,
- host->mmc->caps2 &= ~td[i].capability;
- }
-
-- if (td[i].itap_binding)
-- device_property_read_u32(dev, td[i].itap_binding,
-- &sdhci_am654->itap_del_sel[i]);
-+ if (td[i].itap_binding) {
-+ ret = device_property_read_u32(dev, td[i].itap_binding,
-+ &sdhci_am654->itap_del_sel[i]);
-+ if (!ret)
-+ sdhci_am654->itap_del_ena[i] = 0x1;
-+ }
- }
-
- return 0;
---
-2.43.0
-
+++ /dev/null
-From 2a3ee13133aebbbb6573a42df7c7a11d7e574e76 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 20 Mar 2024 17:38:31 -0500
-Subject: mmc: sdhci_am654: Add tuning algorithm for delay chain
-
-From: Judith Mendez <jm@ti.com>
-
-[ Upstream commit 6231d99dd4119312ad41abf9383e18fec66cbe4b ]
-
-Currently the sdhci_am654 driver only supports one tuning
-algorithm which should be used only when DLL is enabled. The
-ITAPDLY is selected from the largest passing window and the
-buffer is viewed as a circular buffer.
-
-The new algorithm should be used when the delay chain
-is enabled. The ITAPDLY is selected from the largest passing
-window and the buffer is not viewed as a circular buffer.
-
-This implementation is based off of the following paper: [1].
-
-Also add support for multiple failing windows.
-
-[1] https://www.ti.com/lit/an/spract9/spract9.pdf
-
-Fixes: 13ebeae68ac9 ("mmc: sdhci_am654: Add support for software tuning")
-Signed-off-by: Judith Mendez <jm@ti.com>
-Acked-by: Adrian Hunter <adrian.hunter@intel.com>
-Link: https://lore.kernel.org/r/20240320223837.959900-2-jm@ti.com
-Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/mmc/host/sdhci_am654.c | 112 +++++++++++++++++++++++++++------
- 1 file changed, 92 insertions(+), 20 deletions(-)
-
-diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c
-index d659c59422e1e..d8c9821b0b663 100644
---- a/drivers/mmc/host/sdhci_am654.c
-+++ b/drivers/mmc/host/sdhci_am654.c
-@@ -149,10 +149,17 @@ struct sdhci_am654_data {
- int strb_sel;
- u32 flags;
- u32 quirks;
-+ bool dll_enable;
-
- #define SDHCI_AM654_QUIRK_FORCE_CDTEST BIT(0)
- };
-
-+struct window {
-+ u8 start;
-+ u8 end;
-+ u8 length;
-+};
-+
- struct sdhci_am654_driver_data {
- const struct sdhci_pltfm_data *pdata;
- u32 flags;
-@@ -290,10 +297,13 @@ static void sdhci_am654_set_clock(struct sdhci_host *host, unsigned int clock)
-
- regmap_update_bits(sdhci_am654->base, PHY_CTRL4, mask, val);
-
-- if (timing > MMC_TIMING_UHS_SDR25 && clock >= CLOCK_TOO_SLOW_HZ)
-+ if (timing > MMC_TIMING_UHS_SDR25 && clock >= CLOCK_TOO_SLOW_HZ) {
- sdhci_am654_setup_dll(host, clock);
-- else
-+ sdhci_am654->dll_enable = true;
-+ } else {
- sdhci_am654_setup_delay_chain(sdhci_am654, timing);
-+ sdhci_am654->dll_enable = false;
-+ }
-
- regmap_update_bits(sdhci_am654->base, PHY_CTRL5, CLKBUFSEL_MASK,
- sdhci_am654->clkbuf_sel);
-@@ -408,39 +418,101 @@ static u32 sdhci_am654_cqhci_irq(struct sdhci_host *host, u32 intmask)
- return 0;
- }
-
--#define ITAP_MAX 32
-+#define ITAPDLY_LENGTH 32
-+#define ITAPDLY_LAST_INDEX (ITAPDLY_LENGTH - 1)
-+
-+static u32 sdhci_am654_calculate_itap(struct sdhci_host *host, struct window
-+ *fail_window, u8 num_fails, bool circular_buffer)
-+{
-+ u8 itap = 0, start_fail = 0, end_fail = 0, pass_length = 0;
-+ u8 first_fail_start = 0, last_fail_end = 0;
-+ struct device *dev = mmc_dev(host->mmc);
-+ struct window pass_window = {0, 0, 0};
-+ int prev_fail_end = -1;
-+ u8 i;
-+
-+ if (!num_fails)
-+ return ITAPDLY_LAST_INDEX >> 1;
-+
-+ if (fail_window->length == ITAPDLY_LENGTH) {
-+ dev_err(dev, "No passing ITAPDLY, return 0\n");
-+ return 0;
-+ }
-+
-+ first_fail_start = fail_window->start;
-+ last_fail_end = fail_window[num_fails - 1].end;
-+
-+ for (i = 0; i < num_fails; i++) {
-+ start_fail = fail_window[i].start;
-+ end_fail = fail_window[i].end;
-+ pass_length = start_fail - (prev_fail_end + 1);
-+
-+ if (pass_length > pass_window.length) {
-+ pass_window.start = prev_fail_end + 1;
-+ pass_window.length = pass_length;
-+ }
-+ prev_fail_end = end_fail;
-+ }
-+
-+ if (!circular_buffer)
-+ pass_length = ITAPDLY_LAST_INDEX - last_fail_end;
-+ else
-+ pass_length = ITAPDLY_LAST_INDEX - last_fail_end + first_fail_start;
-+
-+ if (pass_length > pass_window.length) {
-+ pass_window.start = last_fail_end + 1;
-+ pass_window.length = pass_length;
-+ }
-+
-+ if (!circular_buffer)
-+ itap = pass_window.start + (pass_window.length >> 1);
-+ else
-+ itap = (pass_window.start + (pass_window.length >> 1)) % ITAPDLY_LENGTH;
-+
-+ return (itap > ITAPDLY_LAST_INDEX) ? ITAPDLY_LAST_INDEX >> 1 : itap;
-+}
-+
- static int sdhci_am654_platform_execute_tuning(struct sdhci_host *host,
- u32 opcode)
- {
- struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
- struct sdhci_am654_data *sdhci_am654 = sdhci_pltfm_priv(pltfm_host);
-- int cur_val, prev_val = 1, fail_len = 0, pass_window = 0, pass_len;
-- u32 itap;
-+ struct window fail_window[ITAPDLY_LENGTH];
-+ u8 curr_pass, itap;
-+ u8 fail_index = 0;
-+ u8 prev_pass = 1;
-+
-+ memset(fail_window, 0, sizeof(fail_window));
-
- /* Enable ITAPDLY */
- regmap_update_bits(sdhci_am654->base, PHY_CTRL4, ITAPDLYENA_MASK,
- 1 << ITAPDLYENA_SHIFT);
-
-- for (itap = 0; itap < ITAP_MAX; itap++) {
-+ for (itap = 0; itap < ITAPDLY_LENGTH; itap++) {
- sdhci_am654_write_itapdly(sdhci_am654, itap);
-
-- cur_val = !mmc_send_tuning(host->mmc, opcode, NULL);
-- if (cur_val && !prev_val)
-- pass_window = itap;
-+ curr_pass = !mmc_send_tuning(host->mmc, opcode, NULL);
-
-- if (!cur_val)
-- fail_len++;
-+ if (!curr_pass && prev_pass)
-+ fail_window[fail_index].start = itap;
-
-- prev_val = cur_val;
-+ if (!curr_pass) {
-+ fail_window[fail_index].end = itap;
-+ fail_window[fail_index].length++;
-+ }
-+
-+ if (curr_pass && !prev_pass)
-+ fail_index++;
-+
-+ prev_pass = curr_pass;
- }
-- /*
-- * Having determined the length of the failing window and start of
-- * the passing window calculate the length of the passing window and
-- * set the final value halfway through it considering the range as a
-- * circular buffer
-- */
-- pass_len = ITAP_MAX - fail_len;
-- itap = (pass_window + (pass_len >> 1)) % ITAP_MAX;
-+
-+ if (fail_window[fail_index].length != 0)
-+ fail_index++;
-+
-+ itap = sdhci_am654_calculate_itap(host, fail_window, fail_index,
-+ sdhci_am654->dll_enable);
-+
- sdhci_am654_write_itapdly(sdhci_am654, itap);
-
- return 0;
---
-2.43.0
-
+++ /dev/null
-From 925b0b0094b894e9600f32dfda2e1eaa09b1fad5 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 20 Mar 2024 17:38:37 -0500
-Subject: mmc: sdhci_am654: Fix ITAPDLY for HS400 timing
-
-From: Judith Mendez <jm@ti.com>
-
-[ Upstream commit d3182932bb070e7518411fd165e023f82afd7d25 ]
-
-While STRB is currently used for DATA and CRC responses, the CMD
-responses from the device to the host still require ITAPDLY for
-HS400 timing.
-
-Currently what is stored for HS400 is the ITAPDLY from High Speed
-mode which is incorrect. The ITAPDLY for HS400 speed mode should
-be the same as ITAPDLY as HS200 timing after tuning is executed.
-Add the functionality to save ITAPDLY from HS200 tuning and save
-as HS400 ITAPDLY.
-
-Fixes: a161c45f2979 ("mmc: sdhci_am654: Enable DLL only for some speed modes")
-Signed-off-by: Judith Mendez <jm@ti.com>
-Acked-by: Adrian Hunter <adrian.hunter@intel.com>
-Link: https://lore.kernel.org/r/20240320223837.959900-8-jm@ti.com
-Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/mmc/host/sdhci_am654.c | 9 +++++++++
- 1 file changed, 9 insertions(+)
-
-diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c
-index 884d1b53180d7..562034af653eb 100644
---- a/drivers/mmc/host/sdhci_am654.c
-+++ b/drivers/mmc/host/sdhci_am654.c
-@@ -301,6 +301,12 @@ static void sdhci_am654_set_clock(struct sdhci_host *host, unsigned int clock)
- if (timing > MMC_TIMING_UHS_SDR25 && clock >= CLOCK_TOO_SLOW_HZ) {
- sdhci_am654_setup_dll(host, clock);
- sdhci_am654->dll_enable = true;
-+
-+ if (timing == MMC_TIMING_MMC_HS400) {
-+ sdhci_am654->itap_del_ena[timing] = 0x1;
-+ sdhci_am654->itap_del_sel[timing] = sdhci_am654->itap_del_sel[timing - 1];
-+ }
-+
- sdhci_am654_write_itapdly(sdhci_am654, sdhci_am654->itap_del_sel[timing],
- sdhci_am654->itap_del_ena[timing]);
- } else {
-@@ -531,6 +537,9 @@ static int sdhci_am654_platform_execute_tuning(struct sdhci_host *host,
-
- sdhci_am654_write_itapdly(sdhci_am654, itap, sdhci_am654->itap_del_ena[timing]);
-
-+ /* Save ITAPDLY */
-+ sdhci_am654->itap_del_sel[timing] = itap;
-+
- return 0;
- }
-
---
-2.43.0
-
+++ /dev/null
-From 52b26dd8611c4f30f8ac16d9d34e640af0021e72 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 20 Mar 2024 17:38:32 -0500
-Subject: mmc: sdhci_am654: Write ITAPDLY for DDR52 timing
-
-From: Judith Mendez <jm@ti.com>
-
-[ Upstream commit d465234493bb6ad1b9c10a0c9ef9881b8d85081a ]
-
-For DDR52 timing, DLL is enabled but tuning is not carried
-out, therefore the ITAPDLY value in PHY CTRL 4 register is
-not correct. Fix this by writing ITAPDLY after enabling DLL.
-
-Fixes: a161c45f2979 ("mmc: sdhci_am654: Enable DLL only for some speed modes")
-Signed-off-by: Judith Mendez <jm@ti.com>
-Reviewed-by: Andrew Davis <afd@ti.com>
-Acked-by: Adrian Hunter <adrian.hunter@intel.com>
-Link: https://lore.kernel.org/r/20240320223837.959900-3-jm@ti.com
-Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/mmc/host/sdhci_am654.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c
-index d8c9821b0b663..cfb614d0b42b4 100644
---- a/drivers/mmc/host/sdhci_am654.c
-+++ b/drivers/mmc/host/sdhci_am654.c
-@@ -300,6 +300,7 @@ static void sdhci_am654_set_clock(struct sdhci_host *host, unsigned int clock)
- if (timing > MMC_TIMING_UHS_SDR25 && clock >= CLOCK_TOO_SLOW_HZ) {
- sdhci_am654_setup_dll(host, clock);
- sdhci_am654->dll_enable = true;
-+ sdhci_am654_write_itapdly(sdhci_am654, sdhci_am654->itap_del_sel[timing]);
- } else {
- sdhci_am654_setup_delay_chain(sdhci_am654, timing);
- sdhci_am654->dll_enable = false;
---
-2.43.0
-
+++ /dev/null
-From bdcb25947abaaa28095a1b1b4b540d4e7a301ee8 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 8 Apr 2024 10:05:58 +0200
-Subject: module: don't ignore sysfs_create_link() failures
-
-From: Arnd Bergmann <arnd@arndb.de>
-
-[ Upstream commit 85d2b0aa170351380be39fe4ff7973df1427fe76 ]
-
-The sysfs_create_link() return code is marked as __must_check, but the
-module_add_driver() function tries hard to not care, by assigning the
-return code to a variable. When building with 'make W=1', gcc still
-warns because this variable is only assigned but not used:
-
-drivers/base/module.c: In function 'module_add_driver':
-drivers/base/module.c:36:6: warning: variable 'no_warn' set but not used [-Wunused-but-set-variable]
-
-Rework the code to properly unwind and return the error code to the
-caller. My reading of the original code was that it tries to
-not fail when the links already exist, so keep ignoring -EEXIST
-errors.
-
-Fixes: e17e0f51aeea ("Driver core: show drivers in /sys/module/")
-See-also: 4a7fb6363f2d ("add __must_check to device management code")
-Signed-off-by: Arnd Bergmann <arnd@arndb.de>
-Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
-Link: https://lore.kernel.org/r/20240408080616.3911573-1-arnd@kernel.org
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/base/base.h | 9 ++++++---
- drivers/base/bus.c | 9 ++++++++-
- drivers/base/module.c | 42 +++++++++++++++++++++++++++++++-----------
- 3 files changed, 45 insertions(+), 15 deletions(-)
-
-diff --git a/drivers/base/base.h b/drivers/base/base.h
-index eb4c0ace92420..a8e3d8165232f 100644
---- a/drivers/base/base.h
-+++ b/drivers/base/base.h
-@@ -192,11 +192,14 @@ extern struct kset *devices_kset;
- void devices_kset_move_last(struct device *dev);
-
- #if defined(CONFIG_MODULES) && defined(CONFIG_SYSFS)
--void module_add_driver(struct module *mod, struct device_driver *drv);
-+int module_add_driver(struct module *mod, struct device_driver *drv);
- void module_remove_driver(struct device_driver *drv);
- #else
--static inline void module_add_driver(struct module *mod,
-- struct device_driver *drv) { }
-+static inline int module_add_driver(struct module *mod,
-+ struct device_driver *drv)
-+{
-+ return 0;
-+}
- static inline void module_remove_driver(struct device_driver *drv) { }
- #endif
-
-diff --git a/drivers/base/bus.c b/drivers/base/bus.c
-index daee55c9b2d9e..ffea0728b8b2f 100644
---- a/drivers/base/bus.c
-+++ b/drivers/base/bus.c
-@@ -674,7 +674,12 @@ int bus_add_driver(struct device_driver *drv)
- if (error)
- goto out_del_list;
- }
-- module_add_driver(drv->owner, drv);
-+ error = module_add_driver(drv->owner, drv);
-+ if (error) {
-+ printk(KERN_ERR "%s: failed to create module links for %s\n",
-+ __func__, drv->name);
-+ goto out_detach;
-+ }
-
- error = driver_create_file(drv, &driver_attr_uevent);
- if (error) {
-@@ -699,6 +704,8 @@ int bus_add_driver(struct device_driver *drv)
-
- return 0;
-
-+out_detach:
-+ driver_detach(drv);
- out_del_list:
- klist_del(&priv->knode_bus);
- out_unregister:
-diff --git a/drivers/base/module.c b/drivers/base/module.c
-index 46ad4d636731d..a1b55da07127d 100644
---- a/drivers/base/module.c
-+++ b/drivers/base/module.c
-@@ -30,14 +30,14 @@ static void module_create_drivers_dir(struct module_kobject *mk)
- mutex_unlock(&drivers_dir_mutex);
- }
-
--void module_add_driver(struct module *mod, struct device_driver *drv)
-+int module_add_driver(struct module *mod, struct device_driver *drv)
- {
- char *driver_name;
-- int no_warn;
- struct module_kobject *mk = NULL;
-+ int ret;
-
- if (!drv)
-- return;
-+ return 0;
-
- if (mod)
- mk = &mod->mkobj;
-@@ -56,17 +56,37 @@ void module_add_driver(struct module *mod, struct device_driver *drv)
- }
-
- if (!mk)
-- return;
-+ return 0;
-+
-+ ret = sysfs_create_link(&drv->p->kobj, &mk->kobj, "module");
-+ if (ret)
-+ return ret;
-
-- /* Don't check return codes; these calls are idempotent */
-- no_warn = sysfs_create_link(&drv->p->kobj, &mk->kobj, "module");
- driver_name = make_driver_name(drv);
-- if (driver_name) {
-- module_create_drivers_dir(mk);
-- no_warn = sysfs_create_link(mk->drivers_dir, &drv->p->kobj,
-- driver_name);
-- kfree(driver_name);
-+ if (!driver_name) {
-+ ret = -ENOMEM;
-+ goto out;
-+ }
-+
-+ module_create_drivers_dir(mk);
-+ if (!mk->drivers_dir) {
-+ ret = -EINVAL;
-+ goto out;
- }
-+
-+ ret = sysfs_create_link(mk->drivers_dir, &drv->p->kobj, driver_name);
-+ if (ret)
-+ goto out;
-+
-+ kfree(driver_name);
-+
-+ return 0;
-+out:
-+ sysfs_remove_link(&drv->p->kobj, "module");
-+ sysfs_remove_link(mk->drivers_dir, driver_name);
-+ kfree(driver_name);
-+
-+ return ret;
- }
-
- void module_remove_driver(struct device_driver *drv)
---
-2.43.0
-
+++ /dev/null
-From 478181e7116b8e74255d65cfc9c1f4580922e495 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 16 May 2024 09:56:30 -0700
-Subject: net: Always descend into dsa/ folder with CONFIG_NET_DSA enabled
-
-From: Florian Fainelli <florian.fainelli@broadcom.com>
-
-[ Upstream commit b1fa60ec252fba39130107074becd12d0b3f83ec ]
-
-Stephen reported that he was unable to get the dsa_loop driver to get
-probed, and the reason ended up being because he had CONFIG_FIXED_PHY=y
-in his kernel configuration. As Masahiro explained it:
-
- "obj-m += dsa/" means everything under dsa/ must be modular.
-
- If there is a built-in object under dsa/ with CONFIG_NET_DSA=m,
- you cannot do "obj-$(CONFIG_NET_DSA) += dsa/".
-
- You need to change it back to "obj-y += dsa/".
-
-This was the case here whereby CONFIG_NET_DSA=m, and so the
-obj-$(CONFIG_FIXED_PHY) += dsa_loop_bdinfo.o rule is not executed and
-the DSA loop mdio_board info structure is not registered with the
-kernel, and eventually the device is simply not found.
-
-To preserve the intention of the original commit of limiting the amount
-of folder descending, conditionally descend into drivers/net/dsa when
-CONFIG_NET_DSA is enabled.
-
-Fixes: 227d72063fcc ("dsa: simplify Kconfig symbols and dependencies")
-Reported-by: Stephen Langstaff <stephenlangstaff1@gmail.com>
-Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
-Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
-Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/Makefile | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/net/Makefile b/drivers/net/Makefile
-index 7cab36f94782e..db55ffdb5792d 100644
---- a/drivers/net/Makefile
-+++ b/drivers/net/Makefile
-@@ -48,7 +48,9 @@ obj-$(CONFIG_MHI_NET) += mhi_net.o
- obj-$(CONFIG_ARCNET) += arcnet/
- obj-$(CONFIG_CAIF) += caif/
- obj-$(CONFIG_CAN) += can/
--obj-$(CONFIG_NET_DSA) += dsa/
-+ifdef CONFIG_NET_DSA
-+obj-y += dsa/
-+endif
- obj-$(CONFIG_ETHERNET) += ethernet/
- obj-$(CONFIG_FDDI) += fddi/
- obj-$(CONFIG_HIPPI) += hippi/
---
-2.43.0
-
+++ /dev/null
-From 0ed4d34e95c00f6b8ca21aacedd720b2b4c93875 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 28 May 2024 14:34:26 -0700
-Subject: net: dsa: microchip: fix RGMII error in KSZ DSA driver
-
-From: Tristram Ha <tristram.ha@microchip.com>
-
-[ Upstream commit 278d65ccdadb5f0fa0ceaf7b9cc97b305cd72822 ]
-
-The driver should return RMII interface when XMII is running in RMII mode.
-
-Fixes: 0ab7f6bf1675 ("net: dsa: microchip: ksz9477: use common xmii function")
-Signed-off-by: Tristram Ha <tristram.ha@microchip.com>
-Acked-by: Arun Ramadoss <arun.ramadoss@microchip.com>
-Acked-by: Jerry Ray <jerry.ray@microchip.com>
-Reviewed-by: Andrew Lunn <andrew@lunn.ch>
-Link: https://lore.kernel.org/r/1716932066-3342-1-git-send-email-Tristram.Ha@microchip.com
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/dsa/microchip/ksz_common.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
-index 25a49708f4842..47b4e137c1a4f 100644
---- a/drivers/net/dsa/microchip/ksz_common.c
-+++ b/drivers/net/dsa/microchip/ksz_common.c
-@@ -2968,7 +2968,7 @@ phy_interface_t ksz_get_xmii(struct ksz_device *dev, int port, bool gbit)
- else
- interface = PHY_INTERFACE_MODE_MII;
- } else if (val == bitval[P_RMII_SEL]) {
-- interface = PHY_INTERFACE_MODE_RGMII;
-+ interface = PHY_INTERFACE_MODE_RMII;
- } else {
- interface = PHY_INTERFACE_MODE_RGMII;
- if (data8 & P_RGMII_ID_EG_ENABLE)
---
-2.43.0
-
+++ /dev/null
-From 256dbb5a2dc8640a4318107ced73f46a72677fb5 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 28 May 2024 20:09:12 +0300
-Subject: net: ena: Fix redundant device NUMA node override
-
-From: Shay Agroskin <shayagr@amazon.com>
-
-[ Upstream commit 2dc8b1e7177d4f49f492ce648440caf2de0c3616 ]
-
-The driver overrides the NUMA node id of the device regardless of
-whether it knows its correct value (often setting it to -1 even though
-the node id is advertised in 'struct device'). This can lead to
-suboptimal configurations.
-
-This patch fixes this behavior and makes the shared memory allocation
-functions use the NUMA node id advertised by the underlying device.
-
-Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)")
-Signed-off-by: Shay Agroskin <shayagr@amazon.com>
-Link: https://lore.kernel.org/r/20240528170912.1204417-1-shayagr@amazon.com
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/ethernet/amazon/ena/ena_com.c | 11 -----------
- 1 file changed, 11 deletions(-)
-
-diff --git a/drivers/net/ethernet/amazon/ena/ena_com.c b/drivers/net/ethernet/amazon/ena/ena_com.c
-index e733419dd3f49..276f6a8631fb1 100644
---- a/drivers/net/ethernet/amazon/ena/ena_com.c
-+++ b/drivers/net/ethernet/amazon/ena/ena_com.c
-@@ -312,7 +312,6 @@ static int ena_com_init_io_sq(struct ena_com_dev *ena_dev,
- struct ena_com_io_sq *io_sq)
- {
- size_t size;
-- int dev_node = 0;
-
- memset(&io_sq->desc_addr, 0x0, sizeof(io_sq->desc_addr));
-
-@@ -325,12 +324,9 @@ static int ena_com_init_io_sq(struct ena_com_dev *ena_dev,
- size = io_sq->desc_entry_size * io_sq->q_depth;
-
- if (io_sq->mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_HOST) {
-- dev_node = dev_to_node(ena_dev->dmadev);
-- set_dev_node(ena_dev->dmadev, ctx->numa_node);
- io_sq->desc_addr.virt_addr =
- dma_alloc_coherent(ena_dev->dmadev, size, &io_sq->desc_addr.phys_addr,
- GFP_KERNEL);
-- set_dev_node(ena_dev->dmadev, dev_node);
- if (!io_sq->desc_addr.virt_addr) {
- io_sq->desc_addr.virt_addr =
- dma_alloc_coherent(ena_dev->dmadev, size,
-@@ -354,10 +350,7 @@ static int ena_com_init_io_sq(struct ena_com_dev *ena_dev,
- size = (size_t)io_sq->bounce_buf_ctrl.buffer_size *
- io_sq->bounce_buf_ctrl.buffers_num;
-
-- dev_node = dev_to_node(ena_dev->dmadev);
-- set_dev_node(ena_dev->dmadev, ctx->numa_node);
- io_sq->bounce_buf_ctrl.base_buffer = devm_kzalloc(ena_dev->dmadev, size, GFP_KERNEL);
-- set_dev_node(ena_dev->dmadev, dev_node);
- if (!io_sq->bounce_buf_ctrl.base_buffer)
- io_sq->bounce_buf_ctrl.base_buffer =
- devm_kzalloc(ena_dev->dmadev, size, GFP_KERNEL);
-@@ -397,7 +390,6 @@ static int ena_com_init_io_cq(struct ena_com_dev *ena_dev,
- struct ena_com_io_cq *io_cq)
- {
- size_t size;
-- int prev_node = 0;
-
- memset(&io_cq->cdesc_addr, 0x0, sizeof(io_cq->cdesc_addr));
-
-@@ -409,11 +401,8 @@ static int ena_com_init_io_cq(struct ena_com_dev *ena_dev,
-
- size = io_cq->cdesc_entry_size_in_bytes * io_cq->q_depth;
-
-- prev_node = dev_to_node(ena_dev->dmadev);
-- set_dev_node(ena_dev->dmadev, ctx->numa_node);
- io_cq->cdesc_addr.virt_addr =
- dma_alloc_coherent(ena_dev->dmadev, size, &io_cq->cdesc_addr.phys_addr, GFP_KERNEL);
-- set_dev_node(ena_dev->dmadev, prev_node);
- if (!io_cq->cdesc_addr.virt_addr) {
- io_cq->cdesc_addr.virt_addr =
- dma_alloc_coherent(ena_dev->dmadev, size, &io_cq->cdesc_addr.phys_addr,
---
-2.43.0
-
+++ /dev/null
-From e20280464cebe38538cde1f77020811fde1d0a61 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 30 Jan 2024 09:53:53 +0000
-Subject: net: ena: Reduce lines with longer column width boundary
-
-From: David Arinzon <darinzon@amazon.com>
-
-[ Upstream commit 50613650c3d6255cef13a129ccaa919ca73a6743 ]
-
-This patch reduces some of the lines by removing newlines
-where more variables or print strings can be pushed back
-to the previous line while still adhering to the styling
-guidelines.
-
-Signed-off-by: David Arinzon <darinzon@amazon.com>
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Stable-dep-of: 2dc8b1e7177d ("net: ena: Fix redundant device NUMA node override")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/ethernet/amazon/ena/ena_com.c | 315 +++++++-----------
- drivers/net/ethernet/amazon/ena/ena_eth_com.c | 49 ++-
- drivers/net/ethernet/amazon/ena/ena_eth_com.h | 15 +-
- drivers/net/ethernet/amazon/ena/ena_netdev.c | 32 +-
- 4 files changed, 151 insertions(+), 260 deletions(-)
-
-diff --git a/drivers/net/ethernet/amazon/ena/ena_com.c b/drivers/net/ethernet/amazon/ena/ena_com.c
-index 4db689372980e..e733419dd3f49 100644
---- a/drivers/net/ethernet/amazon/ena/ena_com.c
-+++ b/drivers/net/ethernet/amazon/ena/ena_com.c
-@@ -90,8 +90,7 @@ static int ena_com_admin_init_sq(struct ena_com_admin_queue *admin_queue)
- struct ena_com_admin_sq *sq = &admin_queue->sq;
- u16 size = ADMIN_SQ_SIZE(admin_queue->q_depth);
-
-- sq->entries = dma_alloc_coherent(admin_queue->q_dmadev, size,
-- &sq->dma_addr, GFP_KERNEL);
-+ sq->entries = dma_alloc_coherent(admin_queue->q_dmadev, size, &sq->dma_addr, GFP_KERNEL);
-
- if (!sq->entries) {
- netdev_err(ena_dev->net_device, "Memory allocation failed\n");
-@@ -113,8 +112,7 @@ static int ena_com_admin_init_cq(struct ena_com_admin_queue *admin_queue)
- struct ena_com_admin_cq *cq = &admin_queue->cq;
- u16 size = ADMIN_CQ_SIZE(admin_queue->q_depth);
-
-- cq->entries = dma_alloc_coherent(admin_queue->q_dmadev, size,
-- &cq->dma_addr, GFP_KERNEL);
-+ cq->entries = dma_alloc_coherent(admin_queue->q_dmadev, size, &cq->dma_addr, GFP_KERNEL);
-
- if (!cq->entries) {
- netdev_err(ena_dev->net_device, "Memory allocation failed\n");
-@@ -136,8 +134,7 @@ static int ena_com_admin_init_aenq(struct ena_com_dev *ena_dev,
-
- ena_dev->aenq.q_depth = ENA_ASYNC_QUEUE_DEPTH;
- size = ADMIN_AENQ_SIZE(ENA_ASYNC_QUEUE_DEPTH);
-- aenq->entries = dma_alloc_coherent(ena_dev->dmadev, size,
-- &aenq->dma_addr, GFP_KERNEL);
-+ aenq->entries = dma_alloc_coherent(ena_dev->dmadev, size, &aenq->dma_addr, GFP_KERNEL);
-
- if (!aenq->entries) {
- netdev_err(ena_dev->net_device, "Memory allocation failed\n");
-@@ -155,14 +152,13 @@ static int ena_com_admin_init_aenq(struct ena_com_dev *ena_dev,
-
- aenq_caps = 0;
- aenq_caps |= ena_dev->aenq.q_depth & ENA_REGS_AENQ_CAPS_AENQ_DEPTH_MASK;
-- aenq_caps |= (sizeof(struct ena_admin_aenq_entry)
-- << ENA_REGS_AENQ_CAPS_AENQ_ENTRY_SIZE_SHIFT) &
-- ENA_REGS_AENQ_CAPS_AENQ_ENTRY_SIZE_MASK;
-+ aenq_caps |=
-+ (sizeof(struct ena_admin_aenq_entry) << ENA_REGS_AENQ_CAPS_AENQ_ENTRY_SIZE_SHIFT) &
-+ ENA_REGS_AENQ_CAPS_AENQ_ENTRY_SIZE_MASK;
- writel(aenq_caps, ena_dev->reg_bar + ENA_REGS_AENQ_CAPS_OFF);
-
- if (unlikely(!aenq_handlers)) {
-- netdev_err(ena_dev->net_device,
-- "AENQ handlers pointer is NULL\n");
-+ netdev_err(ena_dev->net_device, "AENQ handlers pointer is NULL\n");
- return -EINVAL;
- }
-
-@@ -189,14 +185,12 @@ static struct ena_comp_ctx *get_comp_ctxt(struct ena_com_admin_queue *admin_queu
- }
-
- if (unlikely(!admin_queue->comp_ctx)) {
-- netdev_err(admin_queue->ena_dev->net_device,
-- "Completion context is NULL\n");
-+ netdev_err(admin_queue->ena_dev->net_device, "Completion context is NULL\n");
- return NULL;
- }
-
- if (unlikely(admin_queue->comp_ctx[command_id].occupied && capture)) {
-- netdev_err(admin_queue->ena_dev->net_device,
-- "Completion context is occupied\n");
-+ netdev_err(admin_queue->ena_dev->net_device, "Completion context is occupied\n");
- return NULL;
- }
-
-@@ -226,8 +220,7 @@ static struct ena_comp_ctx *__ena_com_submit_admin_cmd(struct ena_com_admin_queu
- /* In case of queue FULL */
- cnt = (u16)atomic_read(&admin_queue->outstanding_cmds);
- if (cnt >= admin_queue->q_depth) {
-- netdev_dbg(admin_queue->ena_dev->net_device,
-- "Admin queue is full.\n");
-+ netdev_dbg(admin_queue->ena_dev->net_device, "Admin queue is full.\n");
- admin_queue->stats.out_of_space++;
- return ERR_PTR(-ENOSPC);
- }
-@@ -274,8 +267,7 @@ static int ena_com_init_comp_ctxt(struct ena_com_admin_queue *admin_queue)
- struct ena_comp_ctx *comp_ctx;
- u16 i;
-
-- admin_queue->comp_ctx =
-- devm_kzalloc(admin_queue->q_dmadev, size, GFP_KERNEL);
-+ admin_queue->comp_ctx = devm_kzalloc(admin_queue->q_dmadev, size, GFP_KERNEL);
- if (unlikely(!admin_queue->comp_ctx)) {
- netdev_err(ena_dev->net_device, "Memory allocation failed\n");
- return -ENOMEM;
-@@ -336,20 +328,17 @@ static int ena_com_init_io_sq(struct ena_com_dev *ena_dev,
- dev_node = dev_to_node(ena_dev->dmadev);
- set_dev_node(ena_dev->dmadev, ctx->numa_node);
- io_sq->desc_addr.virt_addr =
-- dma_alloc_coherent(ena_dev->dmadev, size,
-- &io_sq->desc_addr.phys_addr,
-+ dma_alloc_coherent(ena_dev->dmadev, size, &io_sq->desc_addr.phys_addr,
- GFP_KERNEL);
- set_dev_node(ena_dev->dmadev, dev_node);
- if (!io_sq->desc_addr.virt_addr) {
- io_sq->desc_addr.virt_addr =
- dma_alloc_coherent(ena_dev->dmadev, size,
-- &io_sq->desc_addr.phys_addr,
-- GFP_KERNEL);
-+ &io_sq->desc_addr.phys_addr, GFP_KERNEL);
- }
-
- if (!io_sq->desc_addr.virt_addr) {
-- netdev_err(ena_dev->net_device,
-- "Memory allocation failed\n");
-+ netdev_err(ena_dev->net_device, "Memory allocation failed\n");
- return -ENOMEM;
- }
- }
-@@ -367,16 +356,14 @@ static int ena_com_init_io_sq(struct ena_com_dev *ena_dev,
-
- dev_node = dev_to_node(ena_dev->dmadev);
- set_dev_node(ena_dev->dmadev, ctx->numa_node);
-- io_sq->bounce_buf_ctrl.base_buffer =
-- devm_kzalloc(ena_dev->dmadev, size, GFP_KERNEL);
-+ io_sq->bounce_buf_ctrl.base_buffer = devm_kzalloc(ena_dev->dmadev, size, GFP_KERNEL);
- set_dev_node(ena_dev->dmadev, dev_node);
- if (!io_sq->bounce_buf_ctrl.base_buffer)
- io_sq->bounce_buf_ctrl.base_buffer =
- devm_kzalloc(ena_dev->dmadev, size, GFP_KERNEL);
-
- if (!io_sq->bounce_buf_ctrl.base_buffer) {
-- netdev_err(ena_dev->net_device,
-- "Bounce buffer memory allocation failed\n");
-+ netdev_err(ena_dev->net_device, "Bounce buffer memory allocation failed\n");
- return -ENOMEM;
- }
-
-@@ -425,13 +412,11 @@ static int ena_com_init_io_cq(struct ena_com_dev *ena_dev,
- prev_node = dev_to_node(ena_dev->dmadev);
- set_dev_node(ena_dev->dmadev, ctx->numa_node);
- io_cq->cdesc_addr.virt_addr =
-- dma_alloc_coherent(ena_dev->dmadev, size,
-- &io_cq->cdesc_addr.phys_addr, GFP_KERNEL);
-+ dma_alloc_coherent(ena_dev->dmadev, size, &io_cq->cdesc_addr.phys_addr, GFP_KERNEL);
- set_dev_node(ena_dev->dmadev, prev_node);
- if (!io_cq->cdesc_addr.virt_addr) {
- io_cq->cdesc_addr.virt_addr =
-- dma_alloc_coherent(ena_dev->dmadev, size,
-- &io_cq->cdesc_addr.phys_addr,
-+ dma_alloc_coherent(ena_dev->dmadev, size, &io_cq->cdesc_addr.phys_addr,
- GFP_KERNEL);
- }
-
-@@ -514,8 +499,8 @@ static int ena_com_comp_status_to_errno(struct ena_com_admin_queue *admin_queue,
- u8 comp_status)
- {
- if (unlikely(comp_status != 0))
-- netdev_err(admin_queue->ena_dev->net_device,
-- "Admin command failed[%u]\n", comp_status);
-+ netdev_err(admin_queue->ena_dev->net_device, "Admin command failed[%u]\n",
-+ comp_status);
-
- switch (comp_status) {
- case ENA_ADMIN_SUCCESS:
-@@ -580,8 +565,7 @@ static int ena_com_wait_and_process_admin_cq_polling(struct ena_comp_ctx *comp_c
- }
-
- if (unlikely(comp_ctx->status == ENA_CMD_ABORTED)) {
-- netdev_err(admin_queue->ena_dev->net_device,
-- "Command was aborted\n");
-+ netdev_err(admin_queue->ena_dev->net_device, "Command was aborted\n");
- spin_lock_irqsave(&admin_queue->q_lock, flags);
- admin_queue->stats.aborted_cmd++;
- spin_unlock_irqrestore(&admin_queue->q_lock, flags);
-@@ -589,8 +573,7 @@ static int ena_com_wait_and_process_admin_cq_polling(struct ena_comp_ctx *comp_c
- goto err;
- }
-
-- WARN(comp_ctx->status != ENA_CMD_COMPLETED, "Invalid comp status %d\n",
-- comp_ctx->status);
-+ WARN(comp_ctx->status != ENA_CMD_COMPLETED, "Invalid comp status %d\n", comp_ctx->status);
-
- ret = ena_com_comp_status_to_errno(admin_queue, comp_ctx->comp_status);
- err:
-@@ -634,8 +617,7 @@ static int ena_com_set_llq(struct ena_com_dev *ena_dev)
- sizeof(resp));
-
- if (unlikely(ret))
-- netdev_err(ena_dev->net_device,
-- "Failed to set LLQ configurations: %d\n", ret);
-+ netdev_err(ena_dev->net_device, "Failed to set LLQ configurations: %d\n", ret);
-
- return ret;
- }
-@@ -658,8 +640,7 @@ static int ena_com_config_llq_info(struct ena_com_dev *ena_dev,
- llq_default_cfg->llq_header_location;
- } else {
- netdev_err(ena_dev->net_device,
-- "Invalid header location control, supported: 0x%x\n",
-- supported_feat);
-+ "Invalid header location control, supported: 0x%x\n", supported_feat);
- return -EINVAL;
- }
-
-@@ -681,8 +662,8 @@ static int ena_com_config_llq_info(struct ena_com_dev *ena_dev,
-
- netdev_err(ena_dev->net_device,
- "Default llq stride ctrl is not supported, performing fallback, default: 0x%x, supported: 0x%x, used: 0x%x\n",
-- llq_default_cfg->llq_stride_ctrl,
-- supported_feat, llq_info->desc_stride_ctrl);
-+ llq_default_cfg->llq_stride_ctrl, supported_feat,
-+ llq_info->desc_stride_ctrl);
- }
- } else {
- llq_info->desc_stride_ctrl = 0;
-@@ -704,8 +685,7 @@ static int ena_com_config_llq_info(struct ena_com_dev *ena_dev,
- llq_info->desc_list_entry_size = 256;
- } else {
- netdev_err(ena_dev->net_device,
-- "Invalid entry_size_ctrl, supported: 0x%x\n",
-- supported_feat);
-+ "Invalid entry_size_ctrl, supported: 0x%x\n", supported_feat);
- return -EINVAL;
- }
-
-@@ -750,8 +730,8 @@ static int ena_com_config_llq_info(struct ena_com_dev *ena_dev,
-
- netdev_err(ena_dev->net_device,
- "Default llq num descs before header is not supported, performing fallback, default: 0x%x, supported: 0x%x, used: 0x%x\n",
-- llq_default_cfg->llq_num_decs_before_header,
-- supported_feat, llq_info->descs_num_before_header);
-+ llq_default_cfg->llq_num_decs_before_header, supported_feat,
-+ llq_info->descs_num_before_header);
- }
- /* Check for accelerated queue supported */
- llq_accel_mode_get = llq_features->accel_mode.u.get;
-@@ -767,8 +747,7 @@ static int ena_com_config_llq_info(struct ena_com_dev *ena_dev,
-
- rc = ena_com_set_llq(ena_dev);
- if (rc)
-- netdev_err(ena_dev->net_device,
-- "Cannot set LLQ configuration: %d\n", rc);
-+ netdev_err(ena_dev->net_device, "Cannot set LLQ configuration: %d\n", rc);
-
- return rc;
- }
-@@ -780,8 +759,7 @@ static int ena_com_wait_and_process_admin_cq_interrupts(struct ena_comp_ctx *com
- int ret;
-
- wait_for_completion_timeout(&comp_ctx->wait_event,
-- usecs_to_jiffies(
-- admin_queue->completion_timeout));
-+ usecs_to_jiffies(admin_queue->completion_timeout));
-
- /* In case the command wasn't completed find out the root cause.
- * There might be 2 kinds of errors
-@@ -797,8 +775,7 @@ static int ena_com_wait_and_process_admin_cq_interrupts(struct ena_comp_ctx *com
- if (comp_ctx->status == ENA_CMD_COMPLETED) {
- netdev_err(admin_queue->ena_dev->net_device,
- "The ena device sent a completion but the driver didn't receive a MSI-X interrupt (cmd %d), autopolling mode is %s\n",
-- comp_ctx->cmd_opcode,
-- admin_queue->auto_polling ? "ON" : "OFF");
-+ comp_ctx->cmd_opcode, admin_queue->auto_polling ? "ON" : "OFF");
- /* Check if fallback to polling is enabled */
- if (admin_queue->auto_polling)
- admin_queue->polling = true;
-@@ -867,15 +844,13 @@ static u32 ena_com_reg_bar_read32(struct ena_com_dev *ena_dev, u16 offset)
- if (unlikely(i == timeout)) {
- netdev_err(ena_dev->net_device,
- "Reading reg failed for timeout. expected: req id[%u] offset[%u] actual: req id[%u] offset[%u]\n",
-- mmio_read->seq_num, offset, read_resp->req_id,
-- read_resp->reg_off);
-+ mmio_read->seq_num, offset, read_resp->req_id, read_resp->reg_off);
- ret = ENA_MMIO_READ_TIMEOUT;
- goto err;
- }
-
- if (read_resp->reg_off != offset) {
-- netdev_err(ena_dev->net_device,
-- "Read failure: wrong offset provided\n");
-+ netdev_err(ena_dev->net_device, "Read failure: wrong offset provided\n");
- ret = ENA_MMIO_READ_TIMEOUT;
- } else {
- ret = read_resp->reg_val;
-@@ -934,8 +909,7 @@ static int ena_com_destroy_io_sq(struct ena_com_dev *ena_dev,
- sizeof(destroy_resp));
-
- if (unlikely(ret && (ret != -ENODEV)))
-- netdev_err(ena_dev->net_device,
-- "Failed to destroy io sq error: %d\n", ret);
-+ netdev_err(ena_dev->net_device, "Failed to destroy io sq error: %d\n", ret);
-
- return ret;
- }
-@@ -949,8 +923,7 @@ static void ena_com_io_queue_free(struct ena_com_dev *ena_dev,
- if (io_cq->cdesc_addr.virt_addr) {
- size = io_cq->cdesc_entry_size_in_bytes * io_cq->q_depth;
-
-- dma_free_coherent(ena_dev->dmadev, size,
-- io_cq->cdesc_addr.virt_addr,
-+ dma_free_coherent(ena_dev->dmadev, size, io_cq->cdesc_addr.virt_addr,
- io_cq->cdesc_addr.phys_addr);
-
- io_cq->cdesc_addr.virt_addr = NULL;
-@@ -959,8 +932,7 @@ static void ena_com_io_queue_free(struct ena_com_dev *ena_dev,
- if (io_sq->desc_addr.virt_addr) {
- size = io_sq->desc_entry_size * io_sq->q_depth;
-
-- dma_free_coherent(ena_dev->dmadev, size,
-- io_sq->desc_addr.virt_addr,
-+ dma_free_coherent(ena_dev->dmadev, size, io_sq->desc_addr.virt_addr,
- io_sq->desc_addr.phys_addr);
-
- io_sq->desc_addr.virt_addr = NULL;
-@@ -985,8 +957,7 @@ static int wait_for_reset_state(struct ena_com_dev *ena_dev, u32 timeout,
- val = ena_com_reg_bar_read32(ena_dev, ENA_REGS_DEV_STS_OFF);
-
- if (unlikely(val == ENA_MMIO_READ_TIMEOUT)) {
-- netdev_err(ena_dev->net_device,
-- "Reg read timeout occurred\n");
-+ netdev_err(ena_dev->net_device, "Reg read timeout occurred\n");
- return -ETIME;
- }
-
-@@ -1026,8 +997,7 @@ static int ena_com_get_feature_ex(struct ena_com_dev *ena_dev,
- int ret;
-
- if (!ena_com_check_supported_feature_id(ena_dev, feature_id)) {
-- netdev_dbg(ena_dev->net_device, "Feature %d isn't supported\n",
-- feature_id);
-+ netdev_dbg(ena_dev->net_device, "Feature %d isn't supported\n", feature_id);
- return -EOPNOTSUPP;
- }
-
-@@ -1064,8 +1034,7 @@ static int ena_com_get_feature_ex(struct ena_com_dev *ena_dev,
-
- if (unlikely(ret))
- netdev_err(ena_dev->net_device,
-- "Failed to submit get_feature command %d error: %d\n",
-- feature_id, ret);
-+ "Failed to submit get_feature command %d error: %d\n", feature_id, ret);
-
- return ret;
- }
-@@ -1104,13 +1073,11 @@ static int ena_com_hash_key_allocate(struct ena_com_dev *ena_dev)
- {
- struct ena_rss *rss = &ena_dev->rss;
-
-- if (!ena_com_check_supported_feature_id(ena_dev,
-- ENA_ADMIN_RSS_HASH_FUNCTION))
-+ if (!ena_com_check_supported_feature_id(ena_dev, ENA_ADMIN_RSS_HASH_FUNCTION))
- return -EOPNOTSUPP;
-
-- rss->hash_key =
-- dma_alloc_coherent(ena_dev->dmadev, sizeof(*rss->hash_key),
-- &rss->hash_key_dma_addr, GFP_KERNEL);
-+ rss->hash_key = dma_alloc_coherent(ena_dev->dmadev, sizeof(*rss->hash_key),
-+ &rss->hash_key_dma_addr, GFP_KERNEL);
-
- if (unlikely(!rss->hash_key))
- return -ENOMEM;
-@@ -1123,8 +1090,8 @@ static void ena_com_hash_key_destroy(struct ena_com_dev *ena_dev)
- struct ena_rss *rss = &ena_dev->rss;
-
- if (rss->hash_key)
-- dma_free_coherent(ena_dev->dmadev, sizeof(*rss->hash_key),
-- rss->hash_key, rss->hash_key_dma_addr);
-+ dma_free_coherent(ena_dev->dmadev, sizeof(*rss->hash_key), rss->hash_key,
-+ rss->hash_key_dma_addr);
- rss->hash_key = NULL;
- }
-
-@@ -1132,9 +1099,8 @@ static int ena_com_hash_ctrl_init(struct ena_com_dev *ena_dev)
- {
- struct ena_rss *rss = &ena_dev->rss;
-
-- rss->hash_ctrl =
-- dma_alloc_coherent(ena_dev->dmadev, sizeof(*rss->hash_ctrl),
-- &rss->hash_ctrl_dma_addr, GFP_KERNEL);
-+ rss->hash_ctrl = dma_alloc_coherent(ena_dev->dmadev, sizeof(*rss->hash_ctrl),
-+ &rss->hash_ctrl_dma_addr, GFP_KERNEL);
-
- if (unlikely(!rss->hash_ctrl))
- return -ENOMEM;
-@@ -1147,8 +1113,8 @@ static void ena_com_hash_ctrl_destroy(struct ena_com_dev *ena_dev)
- struct ena_rss *rss = &ena_dev->rss;
-
- if (rss->hash_ctrl)
-- dma_free_coherent(ena_dev->dmadev, sizeof(*rss->hash_ctrl),
-- rss->hash_ctrl, rss->hash_ctrl_dma_addr);
-+ dma_free_coherent(ena_dev->dmadev, sizeof(*rss->hash_ctrl), rss->hash_ctrl,
-+ rss->hash_ctrl_dma_addr);
- rss->hash_ctrl = NULL;
- }
-
-@@ -1177,15 +1143,13 @@ static int ena_com_indirect_table_allocate(struct ena_com_dev *ena_dev,
- tbl_size = (1ULL << log_size) *
- sizeof(struct ena_admin_rss_ind_table_entry);
-
-- rss->rss_ind_tbl =
-- dma_alloc_coherent(ena_dev->dmadev, tbl_size,
-- &rss->rss_ind_tbl_dma_addr, GFP_KERNEL);
-+ rss->rss_ind_tbl = dma_alloc_coherent(ena_dev->dmadev, tbl_size, &rss->rss_ind_tbl_dma_addr,
-+ GFP_KERNEL);
- if (unlikely(!rss->rss_ind_tbl))
- goto mem_err1;
-
- tbl_size = (1ULL << log_size) * sizeof(u16);
-- rss->host_rss_ind_tbl =
-- devm_kzalloc(ena_dev->dmadev, tbl_size, GFP_KERNEL);
-+ rss->host_rss_ind_tbl = devm_kzalloc(ena_dev->dmadev, tbl_size, GFP_KERNEL);
- if (unlikely(!rss->host_rss_ind_tbl))
- goto mem_err2;
-
-@@ -1197,8 +1161,7 @@ static int ena_com_indirect_table_allocate(struct ena_com_dev *ena_dev,
- tbl_size = (1ULL << log_size) *
- sizeof(struct ena_admin_rss_ind_table_entry);
-
-- dma_free_coherent(ena_dev->dmadev, tbl_size, rss->rss_ind_tbl,
-- rss->rss_ind_tbl_dma_addr);
-+ dma_free_coherent(ena_dev->dmadev, tbl_size, rss->rss_ind_tbl, rss->rss_ind_tbl_dma_addr);
- rss->rss_ind_tbl = NULL;
- mem_err1:
- rss->tbl_log_size = 0;
-@@ -1261,8 +1224,7 @@ static int ena_com_create_io_sq(struct ena_com_dev *ena_dev,
- &create_cmd.sq_ba,
- io_sq->desc_addr.phys_addr);
- if (unlikely(ret)) {
-- netdev_err(ena_dev->net_device,
-- "Memory address set failed\n");
-+ netdev_err(ena_dev->net_device, "Memory address set failed\n");
- return ret;
- }
- }
-@@ -1273,8 +1235,7 @@ static int ena_com_create_io_sq(struct ena_com_dev *ena_dev,
- (struct ena_admin_acq_entry *)&cmd_completion,
- sizeof(cmd_completion));
- if (unlikely(ret)) {
-- netdev_err(ena_dev->net_device,
-- "Failed to create IO SQ. error: %d\n", ret);
-+ netdev_err(ena_dev->net_device, "Failed to create IO SQ. error: %d\n", ret);
- return ret;
- }
-
-@@ -1292,8 +1253,7 @@ static int ena_com_create_io_sq(struct ena_com_dev *ena_dev,
- cmd_completion.llq_descriptors_offset);
- }
-
-- netdev_dbg(ena_dev->net_device, "Created sq[%u], depth[%u]\n",
-- io_sq->idx, io_sq->q_depth);
-+ netdev_dbg(ena_dev->net_device, "Created sq[%u], depth[%u]\n", io_sq->idx, io_sq->q_depth);
-
- return ret;
- }
-@@ -1420,8 +1380,7 @@ int ena_com_create_io_cq(struct ena_com_dev *ena_dev,
- (struct ena_admin_acq_entry *)&cmd_completion,
- sizeof(cmd_completion));
- if (unlikely(ret)) {
-- netdev_err(ena_dev->net_device,
-- "Failed to create IO CQ. error: %d\n", ret);
-+ netdev_err(ena_dev->net_device, "Failed to create IO CQ. error: %d\n", ret);
- return ret;
- }
-
-@@ -1440,8 +1399,7 @@ int ena_com_create_io_cq(struct ena_com_dev *ena_dev,
- (u32 __iomem *)((uintptr_t)ena_dev->reg_bar +
- cmd_completion.numa_node_register_offset);
-
-- netdev_dbg(ena_dev->net_device, "Created cq[%u], depth[%u]\n",
-- io_cq->idx, io_cq->q_depth);
-+ netdev_dbg(ena_dev->net_device, "Created cq[%u], depth[%u]\n", io_cq->idx, io_cq->q_depth);
-
- return ret;
- }
-@@ -1451,8 +1409,7 @@ int ena_com_get_io_handlers(struct ena_com_dev *ena_dev, u16 qid,
- struct ena_com_io_cq **io_cq)
- {
- if (qid >= ENA_TOTAL_NUM_QUEUES) {
-- netdev_err(ena_dev->net_device,
-- "Invalid queue number %d but the max is %d\n", qid,
-+ netdev_err(ena_dev->net_device, "Invalid queue number %d but the max is %d\n", qid,
- ENA_TOTAL_NUM_QUEUES);
- return -EINVAL;
- }
-@@ -1492,8 +1449,7 @@ void ena_com_wait_for_abort_completion(struct ena_com_dev *ena_dev)
- spin_lock_irqsave(&admin_queue->q_lock, flags);
- while (atomic_read(&admin_queue->outstanding_cmds) != 0) {
- spin_unlock_irqrestore(&admin_queue->q_lock, flags);
-- ena_delay_exponential_backoff_us(exp++,
-- ena_dev->ena_min_poll_delay_us);
-+ ena_delay_exponential_backoff_us(exp++, ena_dev->ena_min_poll_delay_us);
- spin_lock_irqsave(&admin_queue->q_lock, flags);
- }
- spin_unlock_irqrestore(&admin_queue->q_lock, flags);
-@@ -1519,8 +1475,7 @@ int ena_com_destroy_io_cq(struct ena_com_dev *ena_dev,
- sizeof(destroy_resp));
-
- if (unlikely(ret && (ret != -ENODEV)))
-- netdev_err(ena_dev->net_device,
-- "Failed to destroy IO CQ. error: %d\n", ret);
-+ netdev_err(ena_dev->net_device, "Failed to destroy IO CQ. error: %d\n", ret);
-
- return ret;
- }
-@@ -1588,8 +1543,7 @@ int ena_com_set_aenq_config(struct ena_com_dev *ena_dev, u32 groups_flag)
- sizeof(resp));
-
- if (unlikely(ret))
-- netdev_err(ena_dev->net_device,
-- "Failed to config AENQ ret: %d\n", ret);
-+ netdev_err(ena_dev->net_device, "Failed to config AENQ ret: %d\n", ret);
-
- return ret;
- }
-@@ -1610,8 +1564,7 @@ int ena_com_get_dma_width(struct ena_com_dev *ena_dev)
- netdev_dbg(ena_dev->net_device, "ENA dma width: %d\n", width);
-
- if ((width < 32) || width > ENA_MAX_PHYS_ADDR_SIZE_BITS) {
-- netdev_err(ena_dev->net_device, "DMA width illegal value: %d\n",
-- width);
-+ netdev_err(ena_dev->net_device, "DMA width illegal value: %d\n", width);
- return -EINVAL;
- }
-
-@@ -1633,19 +1586,16 @@ int ena_com_validate_version(struct ena_com_dev *ena_dev)
- ctrl_ver = ena_com_reg_bar_read32(ena_dev,
- ENA_REGS_CONTROLLER_VERSION_OFF);
-
-- if (unlikely((ver == ENA_MMIO_READ_TIMEOUT) ||
-- (ctrl_ver == ENA_MMIO_READ_TIMEOUT))) {
-+ if (unlikely((ver == ENA_MMIO_READ_TIMEOUT) || (ctrl_ver == ENA_MMIO_READ_TIMEOUT))) {
- netdev_err(ena_dev->net_device, "Reg read timeout occurred\n");
- return -ETIME;
- }
-
- dev_info(ena_dev->dmadev, "ENA device version: %d.%d\n",
-- (ver & ENA_REGS_VERSION_MAJOR_VERSION_MASK) >>
-- ENA_REGS_VERSION_MAJOR_VERSION_SHIFT,
-+ (ver & ENA_REGS_VERSION_MAJOR_VERSION_MASK) >> ENA_REGS_VERSION_MAJOR_VERSION_SHIFT,
- ver & ENA_REGS_VERSION_MINOR_VERSION_MASK);
-
-- dev_info(ena_dev->dmadev,
-- "ENA controller version: %d.%d.%d implementation version %d\n",
-+ dev_info(ena_dev->dmadev, "ENA controller version: %d.%d.%d implementation version %d\n",
- (ctrl_ver & ENA_REGS_CONTROLLER_VERSION_MAJOR_VERSION_MASK) >>
- ENA_REGS_CONTROLLER_VERSION_MAJOR_VERSION_SHIFT,
- (ctrl_ver & ENA_REGS_CONTROLLER_VERSION_MINOR_VERSION_MASK) >>
-@@ -1694,20 +1644,17 @@ void ena_com_admin_destroy(struct ena_com_dev *ena_dev)
-
- size = ADMIN_SQ_SIZE(admin_queue->q_depth);
- if (sq->entries)
-- dma_free_coherent(ena_dev->dmadev, size, sq->entries,
-- sq->dma_addr);
-+ dma_free_coherent(ena_dev->dmadev, size, sq->entries, sq->dma_addr);
- sq->entries = NULL;
-
- size = ADMIN_CQ_SIZE(admin_queue->q_depth);
- if (cq->entries)
-- dma_free_coherent(ena_dev->dmadev, size, cq->entries,
-- cq->dma_addr);
-+ dma_free_coherent(ena_dev->dmadev, size, cq->entries, cq->dma_addr);
- cq->entries = NULL;
-
- size = ADMIN_AENQ_SIZE(aenq->q_depth);
- if (ena_dev->aenq.entries)
-- dma_free_coherent(ena_dev->dmadev, size, aenq->entries,
-- aenq->dma_addr);
-+ dma_free_coherent(ena_dev->dmadev, size, aenq->entries, aenq->dma_addr);
- aenq->entries = NULL;
- }
-
-@@ -1733,10 +1680,8 @@ int ena_com_mmio_reg_read_request_init(struct ena_com_dev *ena_dev)
- struct ena_com_mmio_read *mmio_read = &ena_dev->mmio_read;
-
- spin_lock_init(&mmio_read->lock);
-- mmio_read->read_resp =
-- dma_alloc_coherent(ena_dev->dmadev,
-- sizeof(*mmio_read->read_resp),
-- &mmio_read->read_resp_dma_addr, GFP_KERNEL);
-+ mmio_read->read_resp = dma_alloc_coherent(ena_dev->dmadev, sizeof(*mmio_read->read_resp),
-+ &mmio_read->read_resp_dma_addr, GFP_KERNEL);
- if (unlikely(!mmio_read->read_resp))
- goto err;
-
-@@ -1767,8 +1712,8 @@ void ena_com_mmio_reg_read_request_destroy(struct ena_com_dev *ena_dev)
- writel(0x0, ena_dev->reg_bar + ENA_REGS_MMIO_RESP_LO_OFF);
- writel(0x0, ena_dev->reg_bar + ENA_REGS_MMIO_RESP_HI_OFF);
-
-- dma_free_coherent(ena_dev->dmadev, sizeof(*mmio_read->read_resp),
-- mmio_read->read_resp, mmio_read->read_resp_dma_addr);
-+ dma_free_coherent(ena_dev->dmadev, sizeof(*mmio_read->read_resp), mmio_read->read_resp,
-+ mmio_read->read_resp_dma_addr);
-
- mmio_read->read_resp = NULL;
- }
-@@ -1800,8 +1745,7 @@ int ena_com_admin_init(struct ena_com_dev *ena_dev,
- }
-
- if (!(dev_sts & ENA_REGS_DEV_STS_READY_MASK)) {
-- netdev_err(ena_dev->net_device,
-- "Device isn't ready, abort com init\n");
-+ netdev_err(ena_dev->net_device, "Device isn't ready, abort com init\n");
- return -ENODEV;
- }
-
-@@ -1878,8 +1822,7 @@ int ena_com_create_io_queue(struct ena_com_dev *ena_dev,
- int ret;
-
- if (ctx->qid >= ENA_TOTAL_NUM_QUEUES) {
-- netdev_err(ena_dev->net_device,
-- "Qid (%d) is bigger than max num of queues (%d)\n",
-+ netdev_err(ena_dev->net_device, "Qid (%d) is bigger than max num of queues (%d)\n",
- ctx->qid, ENA_TOTAL_NUM_QUEUES);
- return -EINVAL;
- }
-@@ -1905,8 +1848,7 @@ int ena_com_create_io_queue(struct ena_com_dev *ena_dev,
-
- if (ctx->direction == ENA_COM_IO_QUEUE_DIRECTION_TX)
- /* header length is limited to 8 bits */
-- io_sq->tx_max_header_size =
-- min_t(u32, ena_dev->tx_max_header_size, SZ_256);
-+ io_sq->tx_max_header_size = min_t(u32, ena_dev->tx_max_header_size, SZ_256);
-
- ret = ena_com_init_io_sq(ena_dev, ctx, io_sq);
- if (ret)
-@@ -1938,8 +1880,7 @@ void ena_com_destroy_io_queue(struct ena_com_dev *ena_dev, u16 qid)
- struct ena_com_io_cq *io_cq;
-
- if (qid >= ENA_TOTAL_NUM_QUEUES) {
-- netdev_err(ena_dev->net_device,
-- "Qid (%d) is bigger than max num of queues (%d)\n",
-+ netdev_err(ena_dev->net_device, "Qid (%d) is bigger than max num of queues (%d)\n",
- qid, ENA_TOTAL_NUM_QUEUES);
- return;
- }
-@@ -1983,8 +1924,7 @@ int ena_com_get_dev_attr_feat(struct ena_com_dev *ena_dev,
- if (rc)
- return rc;
-
-- if (get_resp.u.max_queue_ext.version !=
-- ENA_FEATURE_MAX_QUEUE_EXT_VER)
-+ if (get_resp.u.max_queue_ext.version != ENA_FEATURE_MAX_QUEUE_EXT_VER)
- return -EINVAL;
-
- memcpy(&get_feat_ctx->max_queue_ext, &get_resp.u.max_queue_ext,
-@@ -2025,18 +1965,15 @@ int ena_com_get_dev_attr_feat(struct ena_com_dev *ena_dev,
- rc = ena_com_get_feature(ena_dev, &get_resp, ENA_ADMIN_HW_HINTS, 0);
-
- if (!rc)
-- memcpy(&get_feat_ctx->hw_hints, &get_resp.u.hw_hints,
-- sizeof(get_resp.u.hw_hints));
-+ memcpy(&get_feat_ctx->hw_hints, &get_resp.u.hw_hints, sizeof(get_resp.u.hw_hints));
- else if (rc == -EOPNOTSUPP)
-- memset(&get_feat_ctx->hw_hints, 0x0,
-- sizeof(get_feat_ctx->hw_hints));
-+ memset(&get_feat_ctx->hw_hints, 0x0, sizeof(get_feat_ctx->hw_hints));
- else
- return rc;
-
- rc = ena_com_get_feature(ena_dev, &get_resp, ENA_ADMIN_LLQ, 0);
- if (!rc)
-- memcpy(&get_feat_ctx->llq, &get_resp.u.llq,
-- sizeof(get_resp.u.llq));
-+ memcpy(&get_feat_ctx->llq, &get_resp.u.llq, sizeof(get_resp.u.llq));
- else if (rc == -EOPNOTSUPP)
- memset(&get_feat_ctx->llq, 0x0, sizeof(get_feat_ctx->llq));
- else
-@@ -2084,8 +2021,7 @@ void ena_com_aenq_intr_handler(struct ena_com_dev *ena_dev, void *data)
- aenq_common = &aenq_e->aenq_common_desc;
-
- /* Go over all the events */
-- while ((READ_ONCE(aenq_common->flags) &
-- ENA_ADMIN_AENQ_COMMON_DESC_PHASE_MASK) == phase) {
-+ while ((READ_ONCE(aenq_common->flags) & ENA_ADMIN_AENQ_COMMON_DESC_PHASE_MASK) == phase) {
- /* Make sure the phase bit (ownership) is as expected before
- * reading the rest of the descriptor.
- */
-@@ -2094,8 +2030,7 @@ void ena_com_aenq_intr_handler(struct ena_com_dev *ena_dev, void *data)
- timestamp = (u64)aenq_common->timestamp_low |
- ((u64)aenq_common->timestamp_high << 32);
-
-- netdev_dbg(ena_dev->net_device,
-- "AENQ! Group[%x] Syndrome[%x] timestamp: [%llus]\n",
-+ netdev_dbg(ena_dev->net_device, "AENQ! Group[%x] Syndrome[%x] timestamp: [%llus]\n",
- aenq_common->group, aenq_common->syndrome, timestamp);
-
- /* Handle specific event*/
-@@ -2124,8 +2059,7 @@ void ena_com_aenq_intr_handler(struct ena_com_dev *ena_dev, void *data)
-
- /* write the aenq doorbell after all AENQ descriptors were read */
- mb();
-- writel_relaxed((u32)aenq->head,
-- ena_dev->reg_bar + ENA_REGS_AENQ_HEAD_DB_OFF);
-+ writel_relaxed((u32)aenq->head, ena_dev->reg_bar + ENA_REGS_AENQ_HEAD_DB_OFF);
- }
-
- int ena_com_dev_reset(struct ena_com_dev *ena_dev,
-@@ -2137,15 +2071,13 @@ int ena_com_dev_reset(struct ena_com_dev *ena_dev,
- stat = ena_com_reg_bar_read32(ena_dev, ENA_REGS_DEV_STS_OFF);
- cap = ena_com_reg_bar_read32(ena_dev, ENA_REGS_CAPS_OFF);
-
-- if (unlikely((stat == ENA_MMIO_READ_TIMEOUT) ||
-- (cap == ENA_MMIO_READ_TIMEOUT))) {
-+ if (unlikely((stat == ENA_MMIO_READ_TIMEOUT) || (cap == ENA_MMIO_READ_TIMEOUT))) {
- netdev_err(ena_dev->net_device, "Reg read32 timeout occurred\n");
- return -ETIME;
- }
-
- if ((stat & ENA_REGS_DEV_STS_READY_MASK) == 0) {
-- netdev_err(ena_dev->net_device,
-- "Device isn't ready, can't reset device\n");
-+ netdev_err(ena_dev->net_device, "Device isn't ready, can't reset device\n");
- return -EINVAL;
- }
-
-@@ -2168,8 +2100,7 @@ int ena_com_dev_reset(struct ena_com_dev *ena_dev,
- rc = wait_for_reset_state(ena_dev, timeout,
- ENA_REGS_DEV_STS_RESET_IN_PROGRESS_MASK);
- if (rc != 0) {
-- netdev_err(ena_dev->net_device,
-- "Reset indication didn't turn on\n");
-+ netdev_err(ena_dev->net_device, "Reset indication didn't turn on\n");
- return rc;
- }
-
-@@ -2177,8 +2108,7 @@ int ena_com_dev_reset(struct ena_com_dev *ena_dev,
- writel(0, ena_dev->reg_bar + ENA_REGS_DEV_CTL_OFF);
- rc = wait_for_reset_state(ena_dev, timeout, 0);
- if (rc != 0) {
-- netdev_err(ena_dev->net_device,
-- "Reset indication didn't turn off\n");
-+ netdev_err(ena_dev->net_device, "Reset indication didn't turn off\n");
- return rc;
- }
-
-@@ -2215,8 +2145,7 @@ static int ena_get_dev_stats(struct ena_com_dev *ena_dev,
- sizeof(*get_resp));
-
- if (unlikely(ret))
-- netdev_err(ena_dev->net_device,
-- "Failed to get stats. error: %d\n", ret);
-+ netdev_err(ena_dev->net_device, "Failed to get stats. error: %d\n", ret);
-
- return ret;
- }
-@@ -2228,8 +2157,7 @@ int ena_com_get_eni_stats(struct ena_com_dev *ena_dev,
- int ret;
-
- if (!ena_com_get_cap(ena_dev, ENA_ADMIN_ENI_STATS)) {
-- netdev_err(ena_dev->net_device,
-- "Capability %d isn't supported\n",
-+ netdev_err(ena_dev->net_device, "Capability %d isn't supported\n",
- ENA_ADMIN_ENI_STATS);
- return -EOPNOTSUPP;
- }
-@@ -2266,8 +2194,7 @@ int ena_com_set_dev_mtu(struct ena_com_dev *ena_dev, u32 mtu)
- int ret;
-
- if (!ena_com_check_supported_feature_id(ena_dev, ENA_ADMIN_MTU)) {
-- netdev_dbg(ena_dev->net_device, "Feature %d isn't supported\n",
-- ENA_ADMIN_MTU);
-+ netdev_dbg(ena_dev->net_device, "Feature %d isn't supported\n", ENA_ADMIN_MTU);
- return -EOPNOTSUPP;
- }
-
-@@ -2286,8 +2213,7 @@ int ena_com_set_dev_mtu(struct ena_com_dev *ena_dev, u32 mtu)
- sizeof(resp));
-
- if (unlikely(ret))
-- netdev_err(ena_dev->net_device,
-- "Failed to set mtu %d. error: %d\n", mtu, ret);
-+ netdev_err(ena_dev->net_device, "Failed to set mtu %d. error: %d\n", mtu, ret);
-
- return ret;
- }
-@@ -2301,8 +2227,7 @@ int ena_com_get_offload_settings(struct ena_com_dev *ena_dev,
- ret = ena_com_get_feature(ena_dev, &resp,
- ENA_ADMIN_STATELESS_OFFLOAD_CONFIG, 0);
- if (unlikely(ret)) {
-- netdev_err(ena_dev->net_device,
-- "Failed to get offload capabilities %d\n", ret);
-+ netdev_err(ena_dev->net_device, "Failed to get offload capabilities %d\n", ret);
- return ret;
- }
-
-@@ -2320,8 +2245,7 @@ int ena_com_set_hash_function(struct ena_com_dev *ena_dev)
- struct ena_admin_get_feat_resp get_resp;
- int ret;
-
-- if (!ena_com_check_supported_feature_id(ena_dev,
-- ENA_ADMIN_RSS_HASH_FUNCTION)) {
-+ if (!ena_com_check_supported_feature_id(ena_dev, ENA_ADMIN_RSS_HASH_FUNCTION)) {
- netdev_dbg(ena_dev->net_device, "Feature %d isn't supported\n",
- ENA_ADMIN_RSS_HASH_FUNCTION);
- return -EOPNOTSUPP;
-@@ -2334,8 +2258,7 @@ int ena_com_set_hash_function(struct ena_com_dev *ena_dev)
- return ret;
-
- if (!(get_resp.u.flow_hash_func.supported_func & BIT(rss->hash_func))) {
-- netdev_err(ena_dev->net_device,
-- "Func hash %d isn't supported by device, abort\n",
-+ netdev_err(ena_dev->net_device, "Func hash %d isn't supported by device, abort\n",
- rss->hash_func);
- return -EOPNOTSUPP;
- }
-@@ -2365,8 +2288,7 @@ int ena_com_set_hash_function(struct ena_com_dev *ena_dev)
- (struct ena_admin_acq_entry *)&resp,
- sizeof(resp));
- if (unlikely(ret)) {
-- netdev_err(ena_dev->net_device,
-- "Failed to set hash function %d. error: %d\n",
-+ netdev_err(ena_dev->net_device, "Failed to set hash function %d. error: %d\n",
- rss->hash_func, ret);
- return -EINVAL;
- }
-@@ -2398,16 +2320,15 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev,
- return rc;
-
- if (!(BIT(func) & get_resp.u.flow_hash_func.supported_func)) {
-- netdev_err(ena_dev->net_device,
-- "Flow hash function %d isn't supported\n", func);
-+ netdev_err(ena_dev->net_device, "Flow hash function %d isn't supported\n", func);
- return -EOPNOTSUPP;
- }
-
- if ((func == ENA_ADMIN_TOEPLITZ) && key) {
- if (key_len != sizeof(hash_key->key)) {
- netdev_err(ena_dev->net_device,
-- "key len (%u) doesn't equal the supported size (%zu)\n",
-- key_len, sizeof(hash_key->key));
-+ "key len (%u) doesn't equal the supported size (%zu)\n", key_len,
-+ sizeof(hash_key->key));
- return -EINVAL;
- }
- memcpy(hash_key->key, key, key_len);
-@@ -2495,8 +2416,7 @@ int ena_com_set_hash_ctrl(struct ena_com_dev *ena_dev)
- struct ena_admin_set_feat_resp resp;
- int ret;
-
-- if (!ena_com_check_supported_feature_id(ena_dev,
-- ENA_ADMIN_RSS_HASH_INPUT)) {
-+ if (!ena_com_check_supported_feature_id(ena_dev, ENA_ADMIN_RSS_HASH_INPUT)) {
- netdev_dbg(ena_dev->net_device, "Feature %d isn't supported\n",
- ENA_ADMIN_RSS_HASH_INPUT);
- return -EOPNOTSUPP;
-@@ -2527,8 +2447,7 @@ int ena_com_set_hash_ctrl(struct ena_com_dev *ena_dev)
- (struct ena_admin_acq_entry *)&resp,
- sizeof(resp));
- if (unlikely(ret))
-- netdev_err(ena_dev->net_device,
-- "Failed to set hash input. error: %d\n", ret);
-+ netdev_err(ena_dev->net_device, "Failed to set hash input. error: %d\n", ret);
-
- return ret;
- }
-@@ -2605,8 +2524,7 @@ int ena_com_fill_hash_ctrl(struct ena_com_dev *ena_dev,
- int rc;
-
- if (proto >= ENA_ADMIN_RSS_PROTO_NUM) {
-- netdev_err(ena_dev->net_device, "Invalid proto num (%u)\n",
-- proto);
-+ netdev_err(ena_dev->net_device, "Invalid proto num (%u)\n", proto);
- return -EINVAL;
- }
-
-@@ -2658,8 +2576,7 @@ int ena_com_indirect_table_set(struct ena_com_dev *ena_dev)
- struct ena_admin_set_feat_resp resp;
- int ret;
-
-- if (!ena_com_check_supported_feature_id(
-- ena_dev, ENA_ADMIN_RSS_INDIRECTION_TABLE_CONFIG)) {
-+ if (!ena_com_check_supported_feature_id(ena_dev, ENA_ADMIN_RSS_INDIRECTION_TABLE_CONFIG)) {
- netdev_dbg(ena_dev->net_device, "Feature %d isn't supported\n",
- ENA_ADMIN_RSS_INDIRECTION_TABLE_CONFIG);
- return -EOPNOTSUPP;
-@@ -2699,8 +2616,7 @@ int ena_com_indirect_table_set(struct ena_com_dev *ena_dev)
- sizeof(resp));
-
- if (unlikely(ret))
-- netdev_err(ena_dev->net_device,
-- "Failed to set indirect table. error: %d\n", ret);
-+ netdev_err(ena_dev->net_device, "Failed to set indirect table. error: %d\n", ret);
-
- return ret;
- }
-@@ -2779,9 +2695,8 @@ int ena_com_allocate_host_info(struct ena_com_dev *ena_dev)
- {
- struct ena_host_attribute *host_attr = &ena_dev->host_attr;
-
-- host_attr->host_info =
-- dma_alloc_coherent(ena_dev->dmadev, SZ_4K,
-- &host_attr->host_info_dma_addr, GFP_KERNEL);
-+ host_attr->host_info = dma_alloc_coherent(ena_dev->dmadev, SZ_4K,
-+ &host_attr->host_info_dma_addr, GFP_KERNEL);
- if (unlikely(!host_attr->host_info))
- return -ENOMEM;
-
-@@ -2827,8 +2742,7 @@ void ena_com_delete_debug_area(struct ena_com_dev *ena_dev)
-
- if (host_attr->debug_area_virt_addr) {
- dma_free_coherent(ena_dev->dmadev, host_attr->debug_area_size,
-- host_attr->debug_area_virt_addr,
-- host_attr->debug_area_dma_addr);
-+ host_attr->debug_area_virt_addr, host_attr->debug_area_dma_addr);
- host_attr->debug_area_virt_addr = NULL;
- }
- }
-@@ -2877,8 +2791,7 @@ int ena_com_set_host_attributes(struct ena_com_dev *ena_dev)
- sizeof(resp));
-
- if (unlikely(ret))
-- netdev_err(ena_dev->net_device,
-- "Failed to set host attributes: %d\n", ret);
-+ netdev_err(ena_dev->net_device, "Failed to set host attributes: %d\n", ret);
-
- return ret;
- }
-@@ -2896,8 +2809,7 @@ static int ena_com_update_nonadaptive_moderation_interval(struct ena_com_dev *en
- u32 *intr_moder_interval)
- {
- if (!intr_delay_resolution) {
-- netdev_err(ena_dev->net_device,
-- "Illegal interrupt delay granularity value\n");
-+ netdev_err(ena_dev->net_device, "Illegal interrupt delay granularity value\n");
- return -EFAULT;
- }
-
-@@ -2935,14 +2847,12 @@ int ena_com_init_interrupt_moderation(struct ena_com_dev *ena_dev)
-
- if (rc) {
- if (rc == -EOPNOTSUPP) {
-- netdev_dbg(ena_dev->net_device,
-- "Feature %d isn't supported\n",
-+ netdev_dbg(ena_dev->net_device, "Feature %d isn't supported\n",
- ENA_ADMIN_INTERRUPT_MODERATION);
- rc = 0;
- } else {
- netdev_err(ena_dev->net_device,
-- "Failed to get interrupt moderation admin cmd. rc: %d\n",
-- rc);
-+ "Failed to get interrupt moderation admin cmd. rc: %d\n", rc);
- }
-
- /* no moderation supported, disable adaptive support */
-@@ -2990,8 +2900,7 @@ int ena_com_config_dev_mode(struct ena_com_dev *ena_dev,
- (llq_info->descs_num_before_header * sizeof(struct ena_eth_io_tx_desc));
-
- if (unlikely(ena_dev->tx_max_header_size == 0)) {
-- netdev_err(ena_dev->net_device,
-- "The size of the LLQ entry is smaller than needed\n");
-+ netdev_err(ena_dev->net_device, "The size of the LLQ entry is smaller than needed\n");
- return -EINVAL;
- }
-
-diff --git a/drivers/net/ethernet/amazon/ena/ena_eth_com.c b/drivers/net/ethernet/amazon/ena/ena_eth_com.c
-index f9f886289b970..933e619b3a313 100644
---- a/drivers/net/ethernet/amazon/ena/ena_eth_com.c
-+++ b/drivers/net/ethernet/amazon/ena/ena_eth_com.c
-@@ -18,8 +18,7 @@ static struct ena_eth_io_rx_cdesc_base *ena_com_get_next_rx_cdesc(
- cdesc = (struct ena_eth_io_rx_cdesc_base *)(io_cq->cdesc_addr.virt_addr
- + (head_masked * io_cq->cdesc_entry_size_in_bytes));
-
-- desc_phase = (READ_ONCE(cdesc->status) &
-- ENA_ETH_IO_RX_CDESC_BASE_PHASE_MASK) >>
-+ desc_phase = (READ_ONCE(cdesc->status) & ENA_ETH_IO_RX_CDESC_BASE_PHASE_MASK) >>
- ENA_ETH_IO_RX_CDESC_BASE_PHASE_SHIFT;
-
- if (desc_phase != expected_phase)
-@@ -65,8 +64,8 @@ static int ena_com_write_bounce_buffer_to_dev(struct ena_com_io_sq *io_sq,
-
- io_sq->entries_in_tx_burst_left--;
- netdev_dbg(ena_com_io_sq_to_ena_dev(io_sq)->net_device,
-- "Decreasing entries_in_tx_burst_left of queue %d to %d\n",
-- io_sq->qid, io_sq->entries_in_tx_burst_left);
-+ "Decreasing entries_in_tx_burst_left of queue %d to %d\n", io_sq->qid,
-+ io_sq->entries_in_tx_burst_left);
- }
-
- /* Make sure everything was written into the bounce buffer before
-@@ -75,8 +74,8 @@ static int ena_com_write_bounce_buffer_to_dev(struct ena_com_io_sq *io_sq,
- wmb();
-
- /* The line is completed. Copy it to dev */
-- __iowrite64_copy(io_sq->desc_addr.pbuf_dev_addr + dst_offset,
-- bounce_buffer, (llq_info->desc_list_entry_size) / 8);
-+ __iowrite64_copy(io_sq->desc_addr.pbuf_dev_addr + dst_offset, bounce_buffer,
-+ (llq_info->desc_list_entry_size) / 8);
-
- io_sq->tail++;
-
-@@ -102,16 +101,14 @@ static int ena_com_write_header_to_bounce(struct ena_com_io_sq *io_sq,
- header_offset =
- llq_info->descs_num_before_header * io_sq->desc_entry_size;
-
-- if (unlikely((header_offset + header_len) >
-- llq_info->desc_list_entry_size)) {
-+ if (unlikely((header_offset + header_len) > llq_info->desc_list_entry_size)) {
- netdev_err(ena_com_io_sq_to_ena_dev(io_sq)->net_device,
- "Trying to write header larger than llq entry can accommodate\n");
- return -EFAULT;
- }
-
- if (unlikely(!bounce_buffer)) {
-- netdev_err(ena_com_io_sq_to_ena_dev(io_sq)->net_device,
-- "Bounce buffer is NULL\n");
-+ netdev_err(ena_com_io_sq_to_ena_dev(io_sq)->net_device, "Bounce buffer is NULL\n");
- return -EFAULT;
- }
-
-@@ -129,8 +126,7 @@ static void *get_sq_desc_llq(struct ena_com_io_sq *io_sq)
- bounce_buffer = pkt_ctrl->curr_bounce_buf;
-
- if (unlikely(!bounce_buffer)) {
-- netdev_err(ena_com_io_sq_to_ena_dev(io_sq)->net_device,
-- "Bounce buffer is NULL\n");
-+ netdev_err(ena_com_io_sq_to_ena_dev(io_sq)->net_device, "Bounce buffer is NULL\n");
- return NULL;
- }
-
-@@ -247,8 +243,7 @@ static u16 ena_com_cdesc_rx_pkt_get(struct ena_com_io_cq *io_cq,
-
- ena_com_cq_inc_head(io_cq);
- count++;
-- last = (READ_ONCE(cdesc->status) &
-- ENA_ETH_IO_RX_CDESC_BASE_LAST_MASK) >>
-+ last = (READ_ONCE(cdesc->status) & ENA_ETH_IO_RX_CDESC_BASE_LAST_MASK) >>
- ENA_ETH_IO_RX_CDESC_BASE_LAST_SHIFT;
- } while (!last);
-
-@@ -369,9 +364,8 @@ static void ena_com_rx_set_flags(struct ena_com_io_cq *io_cq,
-
- netdev_dbg(ena_com_io_cq_to_ena_dev(io_cq)->net_device,
- "l3_proto %d l4_proto %d l3_csum_err %d l4_csum_err %d hash %d frag %d cdesc_status %x\n",
-- ena_rx_ctx->l3_proto, ena_rx_ctx->l4_proto,
-- ena_rx_ctx->l3_csum_err, ena_rx_ctx->l4_csum_err,
-- ena_rx_ctx->hash, ena_rx_ctx->frag, cdesc->status);
-+ ena_rx_ctx->l3_proto, ena_rx_ctx->l4_proto, ena_rx_ctx->l3_csum_err,
-+ ena_rx_ctx->l4_csum_err, ena_rx_ctx->hash, ena_rx_ctx->frag, cdesc->status);
- }
-
- /*****************************************************************************/
-@@ -403,13 +397,12 @@ int ena_com_prepare_tx(struct ena_com_io_sq *io_sq,
-
- if (unlikely(header_len > io_sq->tx_max_header_size)) {
- netdev_err(ena_com_io_sq_to_ena_dev(io_sq)->net_device,
-- "Header size is too large %d max header: %d\n",
-- header_len, io_sq->tx_max_header_size);
-+ "Header size is too large %d max header: %d\n", header_len,
-+ io_sq->tx_max_header_size);
- return -EINVAL;
- }
-
-- if (unlikely(io_sq->mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV &&
-- !buffer_to_push)) {
-+ if (unlikely(io_sq->mem_queue_type == ENA_ADMIN_PLACEMENT_POLICY_DEV && !buffer_to_push)) {
- netdev_err(ena_com_io_sq_to_ena_dev(io_sq)->net_device,
- "Push header wasn't provided in LLQ mode\n");
- return -EINVAL;
-@@ -556,13 +549,11 @@ int ena_com_rx_pkt(struct ena_com_io_cq *io_cq,
- }
-
- netdev_dbg(ena_com_io_cq_to_ena_dev(io_cq)->net_device,
-- "Fetch rx packet: queue %d completed desc: %d\n", io_cq->qid,
-- nb_hw_desc);
-+ "Fetch rx packet: queue %d completed desc: %d\n", io_cq->qid, nb_hw_desc);
-
- if (unlikely(nb_hw_desc > ena_rx_ctx->max_bufs)) {
- netdev_err(ena_com_io_cq_to_ena_dev(io_cq)->net_device,
-- "Too many RX cdescs (%d) > MAX(%d)\n", nb_hw_desc,
-- ena_rx_ctx->max_bufs);
-+ "Too many RX cdescs (%d) > MAX(%d)\n", nb_hw_desc, ena_rx_ctx->max_bufs);
- return -ENOSPC;
- }
-
-@@ -586,8 +577,8 @@ int ena_com_rx_pkt(struct ena_com_io_cq *io_cq,
- io_sq->next_to_comp += nb_hw_desc;
-
- netdev_dbg(ena_com_io_cq_to_ena_dev(io_cq)->net_device,
-- "[%s][QID#%d] Updating SQ head to: %d\n", __func__,
-- io_sq->qid, io_sq->next_to_comp);
-+ "[%s][QID#%d] Updating SQ head to: %d\n", __func__, io_sq->qid,
-+ io_sq->next_to_comp);
-
- /* Get rx flags from the last pkt */
- ena_com_rx_set_flags(io_cq, ena_rx_ctx, cdesc);
-@@ -624,8 +615,8 @@ int ena_com_add_single_rx_desc(struct ena_com_io_sq *io_sq,
- desc->req_id = req_id;
-
- netdev_dbg(ena_com_io_sq_to_ena_dev(io_sq)->net_device,
-- "[%s] Adding single RX desc, Queue: %u, req_id: %u\n",
-- __func__, io_sq->qid, req_id);
-+ "[%s] Adding single RX desc, Queue: %u, req_id: %u\n", __func__, io_sq->qid,
-+ req_id);
-
- desc->buff_addr_lo = (u32)ena_buf->paddr;
- desc->buff_addr_hi =
-diff --git a/drivers/net/ethernet/amazon/ena/ena_eth_com.h b/drivers/net/ethernet/amazon/ena/ena_eth_com.h
-index 372b259279eca..6eba034646525 100644
---- a/drivers/net/ethernet/amazon/ena/ena_eth_com.h
-+++ b/drivers/net/ethernet/amazon/ena/ena_eth_com.h
-@@ -145,8 +145,8 @@ static inline bool ena_com_is_doorbell_needed(struct ena_com_io_sq *io_sq,
- }
-
- netdev_dbg(ena_com_io_sq_to_ena_dev(io_sq)->net_device,
-- "Queue: %d num_descs: %d num_entries_needed: %d\n",
-- io_sq->qid, num_descs, num_entries_needed);
-+ "Queue: %d num_descs: %d num_entries_needed: %d\n", io_sq->qid, num_descs,
-+ num_entries_needed);
-
- return num_entries_needed > io_sq->entries_in_tx_burst_left;
- }
-@@ -157,15 +157,14 @@ static inline int ena_com_write_sq_doorbell(struct ena_com_io_sq *io_sq)
- u16 tail = io_sq->tail;
-
- netdev_dbg(ena_com_io_sq_to_ena_dev(io_sq)->net_device,
-- "Write submission queue doorbell for queue: %d tail: %d\n",
-- io_sq->qid, tail);
-+ "Write submission queue doorbell for queue: %d tail: %d\n", io_sq->qid, tail);
-
- writel(tail, io_sq->db_addr);
-
- if (is_llq_max_tx_burst_exists(io_sq)) {
- netdev_dbg(ena_com_io_sq_to_ena_dev(io_sq)->net_device,
-- "Reset available entries in tx burst for queue %d to %d\n",
-- io_sq->qid, max_entries_in_tx_burst);
-+ "Reset available entries in tx burst for queue %d to %d\n", io_sq->qid,
-+ max_entries_in_tx_burst);
- io_sq->entries_in_tx_burst_left = max_entries_in_tx_burst;
- }
-
-@@ -248,8 +247,8 @@ static inline int ena_com_tx_comp_req_id_get(struct ena_com_io_cq *io_cq,
-
- *req_id = READ_ONCE(cdesc->req_id);
- if (unlikely(*req_id >= io_cq->q_depth)) {
-- netdev_err(ena_com_io_cq_to_ena_dev(io_cq)->net_device,
-- "Invalid req id %d\n", cdesc->req_id);
-+ netdev_err(ena_com_io_cq_to_ena_dev(io_cq)->net_device, "Invalid req id %d\n",
-+ cdesc->req_id);
- return -EINVAL;
- }
-
-diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.c b/drivers/net/ethernet/amazon/ena/ena_netdev.c
-index 95ed32542edfe..e343e0ae8ffda 100644
---- a/drivers/net/ethernet/amazon/ena/ena_netdev.c
-+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.c
-@@ -116,11 +116,9 @@ int ena_xmit_common(struct ena_adapter *adapter,
- if (unlikely(rc)) {
- netif_err(adapter, tx_queued, adapter->netdev,
- "Failed to prepare tx bufs\n");
-- ena_increase_stat(&ring->tx_stats.prepare_ctx_err, 1,
-- &ring->syncp);
-+ ena_increase_stat(&ring->tx_stats.prepare_ctx_err, 1, &ring->syncp);
- if (rc != -ENOMEM)
-- ena_reset_device(adapter,
-- ENA_REGS_RESET_DRIVER_INVALID_STATE);
-+ ena_reset_device(adapter, ENA_REGS_RESET_DRIVER_INVALID_STATE);
- return rc;
- }
-
-@@ -485,8 +483,7 @@ static struct page *ena_alloc_map_page(struct ena_ring *rx_ring,
- */
- page = dev_alloc_page();
- if (!page) {
-- ena_increase_stat(&rx_ring->rx_stats.page_alloc_fail, 1,
-- &rx_ring->syncp);
-+ ena_increase_stat(&rx_ring->rx_stats.page_alloc_fail, 1, &rx_ring->syncp);
- return ERR_PTR(-ENOSPC);
- }
-
-@@ -545,8 +542,8 @@ static void ena_unmap_rx_buff_attrs(struct ena_ring *rx_ring,
- struct ena_rx_buffer *rx_info,
- unsigned long attrs)
- {
-- dma_unmap_page_attrs(rx_ring->dev, rx_info->dma_addr, ENA_PAGE_SIZE,
-- DMA_BIDIRECTIONAL, attrs);
-+ dma_unmap_page_attrs(rx_ring->dev, rx_info->dma_addr, ENA_PAGE_SIZE, DMA_BIDIRECTIONAL,
-+ attrs);
- }
-
- static void ena_free_rx_page(struct ena_ring *rx_ring,
-@@ -827,8 +824,7 @@ static int ena_clean_tx_irq(struct ena_ring *tx_ring, u32 budget)
- &req_id);
- if (rc) {
- if (unlikely(rc == -EINVAL))
-- handle_invalid_req_id(tx_ring, req_id, NULL,
-- false);
-+ handle_invalid_req_id(tx_ring, req_id, NULL, false);
- break;
- }
-
-@@ -1054,8 +1050,7 @@ static struct sk_buff *ena_rx_skb(struct ena_ring *rx_ring,
- DMA_FROM_DEVICE);
-
- if (!reuse_rx_buf_page)
-- ena_unmap_rx_buff_attrs(rx_ring, rx_info,
-- DMA_ATTR_SKIP_CPU_SYNC);
-+ ena_unmap_rx_buff_attrs(rx_ring, rx_info, DMA_ATTR_SKIP_CPU_SYNC);
-
- skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags, rx_info->page,
- page_offset + buf_offset, len, buf_len);
-@@ -1328,8 +1323,7 @@ static int ena_clean_rx_irq(struct ena_ring *rx_ring, struct napi_struct *napi,
- adapter = netdev_priv(rx_ring->netdev);
-
- if (rc == -ENOSPC) {
-- ena_increase_stat(&rx_ring->rx_stats.bad_desc_num, 1,
-- &rx_ring->syncp);
-+ ena_increase_stat(&rx_ring->rx_stats.bad_desc_num, 1, &rx_ring->syncp);
- ena_reset_device(adapter, ENA_REGS_RESET_TOO_MANY_RX_DESCS);
- } else {
- ena_increase_stat(&rx_ring->rx_stats.bad_req_id, 1,
-@@ -1819,8 +1813,7 @@ static int ena_rss_configure(struct ena_adapter *adapter)
- if (!ena_dev->rss.tbl_log_size) {
- rc = ena_rss_init_default(adapter);
- if (rc && (rc != -EOPNOTSUPP)) {
-- netif_err(adapter, ifup, adapter->netdev,
-- "Failed to init RSS rc: %d\n", rc);
-+ netif_err(adapter, ifup, adapter->netdev, "Failed to init RSS rc: %d\n", rc);
- return rc;
- }
- }
-@@ -2756,8 +2749,7 @@ static void ena_config_debug_area(struct ena_adapter *adapter)
- rc = ena_com_set_host_attributes(adapter->ena_dev);
- if (rc) {
- if (rc == -EOPNOTSUPP)
-- netif_warn(adapter, drv, adapter->netdev,
-- "Cannot set host attributes\n");
-+ netif_warn(adapter, drv, adapter->netdev, "Cannot set host attributes\n");
- else
- netif_err(adapter, drv, adapter->netdev,
- "Cannot set host attributes\n");
-@@ -3756,8 +3748,8 @@ static int ena_rss_init_default(struct ena_adapter *adapter)
- }
- }
-
-- rc = ena_com_fill_hash_function(ena_dev, ENA_ADMIN_TOEPLITZ, NULL,
-- ENA_HASH_KEY_SIZE, 0xFFFFFFFF);
-+ rc = ena_com_fill_hash_function(ena_dev, ENA_ADMIN_TOEPLITZ, NULL, ENA_HASH_KEY_SIZE,
-+ 0xFFFFFFFF);
- if (unlikely(rc && (rc != -EOPNOTSUPP))) {
- dev_err(dev, "Cannot fill hash function\n");
- goto err_fill_indir;
---
-2.43.0
-
+++ /dev/null
-From bab53ba1c6481c1a020f17cb482aef8a884f83a4 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 24 May 2024 13:05:28 +0800
-Subject: net:fec: Add fec_enet_deinit()
-
-From: Xiaolei Wang <xiaolei.wang@windriver.com>
-
-[ Upstream commit bf0497f53c8535f99b72041529d3f7708a6e2c0d ]
-
-When fec_probe() fails or fec_drv_remove() needs to release the
-fec queue and remove a NAPI context, therefore add a function
-corresponding to fec_enet_init() and call fec_enet_deinit() which
-does the opposite to release memory and remove a NAPI context.
-
-Fixes: 59d0f7465644 ("net: fec: init multi queue date structure")
-Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com>
-Reviewed-by: Wei Fang <wei.fang@nxp.com>
-Reviewed-by: Andrew Lunn <andrew@lunn.ch>
-Link: https://lore.kernel.org/r/20240524050528.4115581-1-xiaolei.wang@windriver.com
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/ethernet/freescale/fec_main.c | 10 ++++++++++
- 1 file changed, 10 insertions(+)
-
-diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
-index e92a830330590..eec38f1e17360 100644
---- a/drivers/net/ethernet/freescale/fec_main.c
-+++ b/drivers/net/ethernet/freescale/fec_main.c
-@@ -4134,6 +4134,14 @@ static int fec_enet_init(struct net_device *ndev)
- return ret;
- }
-
-+static void fec_enet_deinit(struct net_device *ndev)
-+{
-+ struct fec_enet_private *fep = netdev_priv(ndev);
-+
-+ netif_napi_del(&fep->napi);
-+ fec_enet_free_queue(ndev);
-+}
-+
- #ifdef CONFIG_OF
- static int fec_reset_phy(struct platform_device *pdev)
- {
-@@ -4528,6 +4536,7 @@ fec_probe(struct platform_device *pdev)
- fec_enet_mii_remove(fep);
- failed_mii_init:
- failed_irq:
-+ fec_enet_deinit(ndev);
- failed_init:
- fec_ptp_stop(pdev);
- failed_reset:
-@@ -4591,6 +4600,7 @@ fec_drv_remove(struct platform_device *pdev)
- pm_runtime_put_noidle(&pdev->dev);
- pm_runtime_disable(&pdev->dev);
-
-+ fec_enet_deinit(ndev);
- free_netdev(ndev);
- }
-
---
-2.43.0
-
+++ /dev/null
-From 9f6ae4731df6681e04bc780ef03f14b99736a212 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 21 May 2024 10:38:00 +0800
-Subject: net: fec: avoid lock evasion when reading pps_enable
-
-From: Wei Fang <wei.fang@nxp.com>
-
-[ Upstream commit 3b1c92f8e5371700fada307cc8fd2c51fa7bc8c1 ]
-
-The assignment of pps_enable is protected by tmreg_lock, but the read
-operation of pps_enable is not. So the Coverity tool reports a lock
-evasion warning which may cause data race to occur when running in a
-multithread environment. Although this issue is almost impossible to
-occur, we'd better fix it, at least it seems more logically reasonable,
-and it also prevents Coverity from continuing to issue warnings.
-
-Fixes: 278d24047891 ("net: fec: ptp: Enable PPS output based on ptp clock")
-Signed-off-by: Wei Fang <wei.fang@nxp.com>
-Link: https://lore.kernel.org/r/20240521023800.17102-1-wei.fang@nxp.com
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/ethernet/freescale/fec_ptp.c | 14 ++++++++------
- 1 file changed, 8 insertions(+), 6 deletions(-)
-
-diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c
-index 181d9bfbee220..e32f6724f5681 100644
---- a/drivers/net/ethernet/freescale/fec_ptp.c
-+++ b/drivers/net/ethernet/freescale/fec_ptp.c
-@@ -104,14 +104,13 @@ static int fec_ptp_enable_pps(struct fec_enet_private *fep, uint enable)
- struct timespec64 ts;
- u64 ns;
-
-- if (fep->pps_enable == enable)
-- return 0;
--
-- fep->pps_channel = DEFAULT_PPS_CHANNEL;
-- fep->reload_period = PPS_OUPUT_RELOAD_PERIOD;
--
- spin_lock_irqsave(&fep->tmreg_lock, flags);
-
-+ if (fep->pps_enable == enable) {
-+ spin_unlock_irqrestore(&fep->tmreg_lock, flags);
-+ return 0;
-+ }
-+
- if (enable) {
- /* clear capture or output compare interrupt status if have.
- */
-@@ -532,6 +531,9 @@ static int fec_ptp_enable(struct ptp_clock_info *ptp,
- int ret = 0;
-
- if (rq->type == PTP_CLK_REQ_PPS) {
-+ fep->pps_channel = DEFAULT_PPS_CHANNEL;
-+ fep->reload_period = PPS_OUPUT_RELOAD_PERIOD;
-+
- ret = fec_ptp_enable_pps(fep, on);
-
- return ret;
---
-2.43.0
-
+++ /dev/null
-From 3404ff41b808130d00a6b5ff72d5fc1b9cc6f29b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 28 May 2024 11:43:53 +0000
-Subject: net: fix __dst_negative_advice() race
-
-From: Eric Dumazet <edumazet@google.com>
-
-[ Upstream commit 92f1655aa2b2294d0b49925f3b875a634bd3b59e ]
-
-__dst_negative_advice() does not enforce proper RCU rules when
-sk->dst_cache must be cleared, leading to possible UAF.
-
-RCU rules are that we must first clear sk->sk_dst_cache,
-then call dst_release(old_dst).
-
-Note that sk_dst_reset(sk) is implementing this protocol correctly,
-while __dst_negative_advice() uses the wrong order.
-
-Given that ip6_negative_advice() has special logic
-against RTF_CACHE, this means each of the three ->negative_advice()
-existing methods must perform the sk_dst_reset() themselves.
-
-Note the check against NULL dst is centralized in
-__dst_negative_advice(), there is no need to duplicate
-it in various callbacks.
-
-Many thanks to Clement Lecigne for tracking this issue.
-
-This old bug became visible after the blamed commit, using UDP sockets.
-
-Fixes: a87cb3e48ee8 ("net: Facility to report route quality of connected sockets")
-Reported-by: Clement Lecigne <clecigne@google.com>
-Diagnosed-by: Clement Lecigne <clecigne@google.com>
-Signed-off-by: Eric Dumazet <edumazet@google.com>
-Cc: Tom Herbert <tom@herbertland.com>
-Reviewed-by: David Ahern <dsahern@kernel.org>
-Link: https://lore.kernel.org/r/20240528114353.1794151-1-edumazet@google.com
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- include/net/dst_ops.h | 2 +-
- include/net/sock.h | 13 +++----------
- net/ipv4/route.c | 22 ++++++++--------------
- net/ipv6/route.c | 29 +++++++++++++++--------------
- net/xfrm/xfrm_policy.c | 11 +++--------
- 5 files changed, 30 insertions(+), 47 deletions(-)
-
-diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h
-index 6d1c8541183db..3a9001a042a5c 100644
---- a/include/net/dst_ops.h
-+++ b/include/net/dst_ops.h
-@@ -24,7 +24,7 @@ struct dst_ops {
- void (*destroy)(struct dst_entry *);
- void (*ifdown)(struct dst_entry *,
- struct net_device *dev);
-- struct dst_entry * (*negative_advice)(struct dst_entry *);
-+ void (*negative_advice)(struct sock *sk, struct dst_entry *);
- void (*link_failure)(struct sk_buff *);
- void (*update_pmtu)(struct dst_entry *dst, struct sock *sk,
- struct sk_buff *skb, u32 mtu,
-diff --git a/include/net/sock.h b/include/net/sock.h
-index 54a7967613348..afb5bcf217ab8 100644
---- a/include/net/sock.h
-+++ b/include/net/sock.h
-@@ -2155,17 +2155,10 @@ sk_dst_get(const struct sock *sk)
-
- static inline void __dst_negative_advice(struct sock *sk)
- {
-- struct dst_entry *ndst, *dst = __sk_dst_get(sk);
-+ struct dst_entry *dst = __sk_dst_get(sk);
-
-- if (dst && dst->ops->negative_advice) {
-- ndst = dst->ops->negative_advice(dst);
--
-- if (ndst != dst) {
-- rcu_assign_pointer(sk->sk_dst_cache, ndst);
-- sk_tx_queue_clear(sk);
-- WRITE_ONCE(sk->sk_dst_pending_confirm, 0);
-- }
-- }
-+ if (dst && dst->ops->negative_advice)
-+ dst->ops->negative_advice(sk, dst);
- }
-
- static inline void dst_negative_advice(struct sock *sk)
-diff --git a/net/ipv4/route.c b/net/ipv4/route.c
-index 6d6e1c3e67d8f..cab30af5be348 100644
---- a/net/ipv4/route.c
-+++ b/net/ipv4/route.c
-@@ -132,7 +132,8 @@ struct dst_entry *ipv4_dst_check(struct dst_entry *dst, u32 cookie);
- static unsigned int ipv4_default_advmss(const struct dst_entry *dst);
- INDIRECT_CALLABLE_SCOPE
- unsigned int ipv4_mtu(const struct dst_entry *dst);
--static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst);
-+static void ipv4_negative_advice(struct sock *sk,
-+ struct dst_entry *dst);
- static void ipv4_link_failure(struct sk_buff *skb);
- static void ip_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,
- struct sk_buff *skb, u32 mtu,
-@@ -837,22 +838,15 @@ static void ip_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_buf
- __ip_do_redirect(rt, skb, &fl4, true);
- }
-
--static struct dst_entry *ipv4_negative_advice(struct dst_entry *dst)
-+static void ipv4_negative_advice(struct sock *sk,
-+ struct dst_entry *dst)
- {
- struct rtable *rt = dst_rtable(dst);
-- struct dst_entry *ret = dst;
-
-- if (rt) {
-- if (dst->obsolete > 0) {
-- ip_rt_put(rt);
-- ret = NULL;
-- } else if ((rt->rt_flags & RTCF_REDIRECTED) ||
-- rt->dst.expires) {
-- ip_rt_put(rt);
-- ret = NULL;
-- }
-- }
-- return ret;
-+ if ((dst->obsolete > 0) ||
-+ (rt->rt_flags & RTCF_REDIRECTED) ||
-+ rt->dst.expires)
-+ sk_dst_reset(sk);
- }
-
- /*
-diff --git a/net/ipv6/route.c b/net/ipv6/route.c
-index 0d6dd1f0c51eb..a28246192aeea 100644
---- a/net/ipv6/route.c
-+++ b/net/ipv6/route.c
-@@ -87,7 +87,8 @@ struct dst_entry *ip6_dst_check(struct dst_entry *dst, u32 cookie);
- static unsigned int ip6_default_advmss(const struct dst_entry *dst);
- INDIRECT_CALLABLE_SCOPE
- unsigned int ip6_mtu(const struct dst_entry *dst);
--static struct dst_entry *ip6_negative_advice(struct dst_entry *);
-+static void ip6_negative_advice(struct sock *sk,
-+ struct dst_entry *dst);
- static void ip6_dst_destroy(struct dst_entry *);
- static void ip6_dst_ifdown(struct dst_entry *,
- struct net_device *dev);
-@@ -2760,24 +2761,24 @@ INDIRECT_CALLABLE_SCOPE struct dst_entry *ip6_dst_check(struct dst_entry *dst,
- }
- EXPORT_INDIRECT_CALLABLE(ip6_dst_check);
-
--static struct dst_entry *ip6_negative_advice(struct dst_entry *dst)
-+static void ip6_negative_advice(struct sock *sk,
-+ struct dst_entry *dst)
- {
- struct rt6_info *rt = dst_rt6_info(dst);
-
-- if (rt) {
-- if (rt->rt6i_flags & RTF_CACHE) {
-- rcu_read_lock();
-- if (rt6_check_expired(rt)) {
-- rt6_remove_exception_rt(rt);
-- dst = NULL;
-- }
-- rcu_read_unlock();
-- } else {
-- dst_release(dst);
-- dst = NULL;
-+ if (rt->rt6i_flags & RTF_CACHE) {
-+ rcu_read_lock();
-+ if (rt6_check_expired(rt)) {
-+ /* counteract the dst_release() in sk_dst_reset() */
-+ dst_hold(dst);
-+ sk_dst_reset(sk);
-+
-+ rt6_remove_exception_rt(rt);
- }
-+ rcu_read_unlock();
-+ return;
- }
-- return dst;
-+ sk_dst_reset(sk);
- }
-
- static void ip6_link_failure(struct sk_buff *skb)
-diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
-index 55db22473e3eb..947a6e695b296 100644
---- a/net/xfrm/xfrm_policy.c
-+++ b/net/xfrm/xfrm_policy.c
-@@ -3764,15 +3764,10 @@ static void xfrm_link_failure(struct sk_buff *skb)
- /* Impossible. Such dst must be popped before reaches point of failure. */
- }
-
--static struct dst_entry *xfrm_negative_advice(struct dst_entry *dst)
-+static void xfrm_negative_advice(struct sock *sk, struct dst_entry *dst)
- {
-- if (dst) {
-- if (dst->obsolete) {
-- dst_release(dst);
-- dst = NULL;
-- }
-- }
-- return dst;
-+ if (dst->obsolete)
-+ sk_dst_reset(sk);
- }
-
- static void xfrm_init_pmtu(struct xfrm_dst **bundle, int nr)
---
-2.43.0
-
+++ /dev/null
-From 028c3134fbba72c65e8267bb08715c422ca565cc Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 17 May 2024 15:58:08 +0200
-Subject: net: lan966x: Remove ptp traps in case the ptp is not enabled.
-
-From: Horatiu Vultur <horatiu.vultur@microchip.com>
-
-[ Upstream commit eda40be3a5ff3fdce513d2bcfeaca8cc16cf962a ]
-
-Lan966x is adding ptp traps to redirect the ptp frames to the CPU such
-that the HW will not forward these frames anywhere. The issue is that in
-case ptp is not enabled and the timestamping source is et to
-HWTSTAMP_SOURCE_NETDEV then these traps would not be removed on the
-error path.
-Fix this by removing the traps in this case as they are not needed.
-
-Fixes: 54e1ed69c40a ("net: lan966x: convert to ndo_hwtstamp_get() and ndo_hwtstamp_set()")
-Suggested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
-Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
-Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
-Link: https://lore.kernel.org/r/20240517135808.3025435-1-horatiu.vultur@microchip.com
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/ethernet/microchip/lan966x/lan966x_main.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
-index 61d88207eed42..6695ed661ef83 100644
---- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
-+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
-@@ -474,14 +474,14 @@ static int lan966x_port_hwtstamp_set(struct net_device *dev,
- cfg->source != HWTSTAMP_SOURCE_PHYLIB)
- return -EOPNOTSUPP;
-
-+ if (cfg->source == HWTSTAMP_SOURCE_NETDEV && !port->lan966x->ptp)
-+ return -EOPNOTSUPP;
-+
- err = lan966x_ptp_setup_traps(port, cfg);
- if (err)
- return err;
-
- if (cfg->source == HWTSTAMP_SOURCE_NETDEV) {
-- if (!port->lan966x->ptp)
-- return -EOPNOTSUPP;
--
- err = lan966x_ptp_hwtstamp_set(port, cfg, extack);
- if (err) {
- lan966x_ptp_del_traps(port);
---
-2.43.0
-
+++ /dev/null
-From 4c543ad8fd3c0857794afe5289566186802710a5 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 24 May 2024 10:53:50 +0200
-Subject: net: micrel: Fix lan8841_config_intr after getting out of sleep mode
-
-From: Horatiu Vultur <horatiu.vultur@microchip.com>
-
-[ Upstream commit 4fb679040d9f758eeb3b4d01bbde6405bf20e64e ]
-
-When the interrupt is enabled, the function lan8841_config_intr tries to
-clear any pending interrupts by reading the interrupt status, then
-checks the return value for errors and then continue to enable the
-interrupt. It has been seen that once the system gets out of sleep mode,
-the interrupt status has the value 0x400 meaning that the PHY detected
-that the link was in low power. That is correct value but the problem is
-that the check is wrong. We try to check for errors but we return an
-error also in this case which is not an error. Therefore fix this by
-returning only when there is an error.
-
-Fixes: a8f1a19d27ef ("net: micrel: Add support for lan8841 PHY")
-Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
-Reviewed-by: Suman Ghosh <sumang@marvell.com>
-Reviewed-by: Andrew Lunn <andrew@lunn.ch>
-Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
-Link: https://lore.kernel.org/r/20240524085350.359812-1-horatiu.vultur@microchip.com
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/phy/micrel.c | 10 +++++++++-
- 1 file changed, 9 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
-index 25041b3465734..37bf61eeafffe 100644
---- a/drivers/net/phy/micrel.c
-+++ b/drivers/net/phy/micrel.c
-@@ -3475,7 +3475,7 @@ static int lan8841_config_intr(struct phy_device *phydev)
-
- if (phydev->interrupts == PHY_INTERRUPT_ENABLED) {
- err = phy_read(phydev, LAN8814_INTS);
-- if (err)
-+ if (err < 0)
- return err;
-
- /* Enable / disable interrupts. It is OK to enable PTP interrupt
-@@ -3491,6 +3491,14 @@ static int lan8841_config_intr(struct phy_device *phydev)
- return err;
-
- err = phy_read(phydev, LAN8814_INTS);
-+ if (err < 0)
-+ return err;
-+
-+ /* Getting a positive value doesn't mean that is an error, it
-+ * just indicates what was the status. Therefore make sure to
-+ * clear the value and say that there is no error.
-+ */
-+ err = 0;
- }
-
- return err;
---
-2.43.0
-
+++ /dev/null
-From 4a90585d81729743dd56e2ff1b9931e07b5ec415 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 22 May 2024 22:26:54 +0300
-Subject: net/mlx5: Fix MTMP register capability offset in MCAM register
-
-From: Gal Pressman <gal@nvidia.com>
-
-[ Upstream commit 1b9f86c6d53245dab087f1b2c05727b5982142ff ]
-
-The MTMP register (0x900a) capability offset is off-by-one, move it to
-the right place.
-
-Fixes: 1f507e80c700 ("net/mlx5: Expose NIC temperature via hardware monitoring kernel API")
-Signed-off-by: Gal Pressman <gal@nvidia.com>
-Reviewed-by: Cosmin Ratiu <cratiu@nvidia.com>
-Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
-Reviewed-by: Simon Horman <horms@kernel.org>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- include/linux/mlx5/mlx5_ifc.h | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/include/linux/mlx5/mlx5_ifc.h b/include/linux/mlx5/mlx5_ifc.h
-index 486b7492050c3..d2c27a7227bb4 100644
---- a/include/linux/mlx5/mlx5_ifc.h
-+++ b/include/linux/mlx5/mlx5_ifc.h
-@@ -10265,9 +10265,9 @@ struct mlx5_ifc_mcam_access_reg_bits {
- u8 mfrl[0x1];
- u8 regs_39_to_32[0x8];
-
-- u8 regs_31_to_10[0x16];
-+ u8 regs_31_to_11[0x15];
- u8 mtmp[0x1];
-- u8 regs_8_to_0[0x9];
-+ u8 regs_9_to_0[0xa];
- };
-
- struct mlx5_ifc_mcam_access_reg_bits1 {
---
-2.43.0
-
+++ /dev/null
-From bcf2fcaf60a5ed88fab38bf81c3e414c40a35c97 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 22 May 2024 22:26:52 +0300
-Subject: net/mlx5: Lag, do bond only if slaves agree on roce state
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Maher Sanalla <msanalla@nvidia.com>
-
-[ Upstream commit 51ef9305b8f40946d65c40368ffb4c14636d369a ]
-
-Currently, the driver does not enforce that lag bond slaves must have
-matching roce capabilities. Yet, in mlx5_do_bond(), the driver attempts
-to enable roce on all vports of the bond slaves, causing the following
-syndrome when one slave has no roce fw support:
-
-mlx5_cmd_out_err:809:(pid 25427): MODIFY_NIC_VPORT_CONTEXT(0×755) op_mod(0×0)
-failed, status bad parameter(0×3), syndrome (0xc1f678), err(-22)
-
-Thus, create HW lag only if bond's slaves agree on roce state,
-either all slaves have roce support resulting in a roce lag bond,
-or none do, resulting in a raw eth bond.
-
-Fixes: 7907f23adc18 ("net/mlx5: Implement RoCE LAG feature")
-Signed-off-by: Maher Sanalla <msanalla@nvidia.com>
-Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
-Reviewed-by: Simon Horman <horms@kernel.org>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 12 ++++++++++--
- 1 file changed, 10 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
-index 37598d116f3b8..58a452d20daf7 100644
---- a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
-+++ b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
-@@ -720,6 +720,7 @@ bool mlx5_lag_check_prereq(struct mlx5_lag *ldev)
- struct mlx5_core_dev *dev;
- u8 mode;
- #endif
-+ bool roce_support;
- int i;
-
- for (i = 0; i < ldev->ports; i++)
-@@ -746,6 +747,11 @@ bool mlx5_lag_check_prereq(struct mlx5_lag *ldev)
- if (mlx5_sriov_is_enabled(ldev->pf[i].dev))
- return false;
- #endif
-+ roce_support = mlx5_get_roce_state(ldev->pf[MLX5_LAG_P1].dev);
-+ for (i = 1; i < ldev->ports; i++)
-+ if (mlx5_get_roce_state(ldev->pf[i].dev) != roce_support)
-+ return false;
-+
- return true;
- }
-
-@@ -913,8 +919,10 @@ static void mlx5_do_bond(struct mlx5_lag *ldev)
- } else if (roce_lag) {
- dev0->priv.flags &= ~MLX5_PRIV_FLAGS_DISABLE_IB_ADEV;
- mlx5_rescan_drivers_locked(dev0);
-- for (i = 1; i < ldev->ports; i++)
-- mlx5_nic_vport_enable_roce(ldev->pf[i].dev);
-+ for (i = 1; i < ldev->ports; i++) {
-+ if (mlx5_get_roce_state(ldev->pf[i].dev))
-+ mlx5_nic_vport_enable_roce(ldev->pf[i].dev);
-+ }
- } else if (shared_fdb) {
- int i;
-
---
-2.43.0
-
+++ /dev/null
-From 9f48e8ff1b14b307bb6f3c38c402d81e0cebd4fe Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 22 May 2024 22:26:55 +0300
-Subject: net/mlx5: Use mlx5_ipsec_rx_status_destroy to correctly delete status
- rules
-
-From: Rahul Rameshbabu <rrameshbabu@nvidia.com>
-
-[ Upstream commit 16d66a4fa81da07bc4ed19f4e53b87263c2f8d38 ]
-
-rx_create no longer allocates a modify_hdr instance that needs to be
-cleaned up. The mlx5_modify_header_dealloc call will lead to a NULL pointer
-dereference. A leak in the rules also previously occurred since there are
-now two rules populated related to status.
-
- BUG: kernel NULL pointer dereference, address: 0000000000000000
- #PF: supervisor read access in kernel mode
- #PF: error_code(0x0000) - not-present page
- PGD 109907067 P4D 109907067 PUD 116890067 PMD 0
- Oops: 0000 [#1] SMP
- CPU: 1 PID: 484 Comm: ip Not tainted 6.9.0-rc2-rrameshbabu+ #254
- Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS Arch Linux 1.16.3-1-1 04/01/2014
- RIP: 0010:mlx5_modify_header_dealloc+0xd/0x70
- <snip>
- Call Trace:
- <TASK>
- ? show_regs+0x60/0x70
- ? __die+0x24/0x70
- ? page_fault_oops+0x15f/0x430
- ? free_to_partial_list.constprop.0+0x79/0x150
- ? do_user_addr_fault+0x2c9/0x5c0
- ? exc_page_fault+0x63/0x110
- ? asm_exc_page_fault+0x27/0x30
- ? mlx5_modify_header_dealloc+0xd/0x70
- rx_create+0x374/0x590
- rx_add_rule+0x3ad/0x500
- ? rx_add_rule+0x3ad/0x500
- ? mlx5_cmd_exec+0x2c/0x40
- ? mlx5_create_ipsec_obj+0xd6/0x200
- mlx5e_accel_ipsec_fs_add_rule+0x31/0xf0
- mlx5e_xfrm_add_state+0x426/0xc00
- <snip>
-
-Fixes: 94af50c0a9bb ("net/mlx5e: Unify esw and normal IPsec status table creation/destruction")
-Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
-Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
-Reviewed-by: Simon Horman <horms@kernel.org>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
-index 41a2543a52cda..e51b03d4c717f 100644
---- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
-+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
-@@ -750,8 +750,7 @@ static int rx_create(struct mlx5_core_dev *mdev, struct mlx5e_ipsec *ipsec,
- err_fs_ft:
- if (rx->allow_tunnel_mode)
- mlx5_eswitch_unblock_encap(mdev);
-- mlx5_del_flow_rules(rx->status.rule);
-- mlx5_modify_header_dealloc(mdev, rx->status.modify_hdr);
-+ mlx5_ipsec_rx_status_destroy(ipsec, rx);
- err_add:
- mlx5_destroy_flow_table(rx->ft.status);
- err_fs_ft_status:
---
-2.43.0
-
+++ /dev/null
-From d9ced53464fd9e533587039a43fe4f6243948c4e Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 22 May 2024 22:26:56 +0300
-Subject: net/mlx5e: Fix IPsec tunnel mode offload feature check
-
-From: Rahul Rameshbabu <rrameshbabu@nvidia.com>
-
-[ Upstream commit 9a52f6d44f4521773b4699b4ed34b8e21d5a175c ]
-
-Remove faulty check disabling checksum offload and GSO for offload of
-simple IPsec tunnel L4 traffic. Comment previously describing the deleted
-code incorrectly claimed the check prevented double tunnel (or three layers
-of ip headers).
-
-Fixes: f1267798c980 ("net/mlx5: Fix checksum issue of VXLAN and IPsec crypto offload")
-Signed-off-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>
-Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
-Reviewed-by: Simon Horman <horms@kernel.org>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- .../mellanox/mlx5/core/en_accel/ipsec_rxtx.h | 17 +++++------------
- 1 file changed, 5 insertions(+), 12 deletions(-)
-
-diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h
-index 2ed99772f168a..e1a241d3b418c 100644
---- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h
-+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.h
-@@ -98,18 +98,11 @@ mlx5e_ipsec_feature_check(struct sk_buff *skb, netdev_features_t features)
- if (!x || !x->xso.offload_handle)
- goto out_disable;
-
-- if (xo->inner_ipproto) {
-- /* Cannot support tunnel packet over IPsec tunnel mode
-- * because we cannot offload three IP header csum
-- */
-- if (x->props.mode == XFRM_MODE_TUNNEL)
-- goto out_disable;
--
-- /* Only support UDP or TCP L4 checksum */
-- if (xo->inner_ipproto != IPPROTO_UDP &&
-- xo->inner_ipproto != IPPROTO_TCP)
-- goto out_disable;
-- }
-+ /* Only support UDP or TCP L4 checksum */
-+ if (xo->inner_ipproto &&
-+ xo->inner_ipproto != IPPROTO_UDP &&
-+ xo->inner_ipproto != IPPROTO_TCP)
-+ goto out_disable;
-
- return features;
-
---
-2.43.0
-
+++ /dev/null
-From e0763d08d62c49e9df8ba7db0e7c0976f9026e53 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 22 May 2024 22:26:59 +0300
-Subject: net/mlx5e: Fix UDP GSO for encapsulated packets
-
-From: Gal Pressman <gal@nvidia.com>
-
-[ Upstream commit 83fea49f2711fc90c0d115b0ed04046b45155b65 ]
-
-When the skb is encapsulated, adjust the inner UDP header instead of the
-outer one, and account for UDP header (instead of TCP) in the inline
-header size calculation.
-
-Fixes: 689adf0d4892 ("net/mlx5e: Add UDP GSO support")
-Reported-by: Jason Baron <jbaron@akamai.com>
-Closes: https://lore.kernel.org/netdev/c42961cb-50b9-4a9a-bd43-87fe48d88d29@akamai.com/
-Signed-off-by: Gal Pressman <gal@nvidia.com>
-Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
-Reviewed-by: Boris Pismenny <borisp@nvidia.com>
-Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
-Reviewed-by: Simon Horman <horms@kernel.org>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- .../net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h | 8 +++++++-
- drivers/net/ethernet/mellanox/mlx5/core/en_tx.c | 6 +++++-
- 2 files changed, 12 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h
-index caa34b9c161e5..33e32584b07f5 100644
---- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h
-+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/en_accel.h
-@@ -102,8 +102,14 @@ static inline void
- mlx5e_udp_gso_handle_tx_skb(struct sk_buff *skb)
- {
- int payload_len = skb_shinfo(skb)->gso_size + sizeof(struct udphdr);
-+ struct udphdr *udphdr;
-
-- udp_hdr(skb)->len = htons(payload_len);
-+ if (skb->encapsulation)
-+ udphdr = (struct udphdr *)skb_inner_transport_header(skb);
-+ else
-+ udphdr = udp_hdr(skb);
-+
-+ udphdr->len = htons(payload_len);
- }
-
- struct mlx5e_accel_tx_state {
-diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
-index e21a3b4128ce8..0964b16ca5619 100644
---- a/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
-+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tx.c
-@@ -153,7 +153,11 @@ mlx5e_tx_get_gso_ihs(struct mlx5e_txqsq *sq, struct sk_buff *skb, int *hopbyhop)
-
- *hopbyhop = 0;
- if (skb->encapsulation) {
-- ihs = skb_inner_tcp_all_headers(skb);
-+ if (skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4)
-+ ihs = skb_inner_transport_offset(skb) +
-+ sizeof(struct udphdr);
-+ else
-+ ihs = skb_inner_tcp_all_headers(skb);
- stats->tso_inner_packets++;
- stats->tso_inner_bytes += skb->len - ihs;
- } else {
---
-2.43.0
-
+++ /dev/null
-From baeb28aea7e825b3eaf7cfba0fdc19e5010016d3 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 22 May 2024 22:26:58 +0300
-Subject: net/mlx5e: Use rx_missed_errors instead of rx_dropped for reporting
- buffer exhaustion
-
-From: Carolina Jubran <cjubran@nvidia.com>
-
-[ Upstream commit 5c74195d5dd977e97556e6fa76909b831c241230 ]
-
-Previously, the driver incorrectly used rx_dropped to report device
-buffer exhaustion.
-
-According to the documentation, rx_dropped should not be used to count
-packets dropped due to buffer exhaustion, which is the purpose of
-rx_missed_errors.
-
-Use rx_missed_errors as intended for counting packets dropped due to
-buffer exhaustion.
-
-Fixes: 269e6b3af3bf ("net/mlx5e: Report additional error statistics in get stats ndo")
-Signed-off-by: Carolina Jubran <cjubran@nvidia.com>
-Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
-Reviewed-by: Simon Horman <horms@kernel.org>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
-index 952f1f98138cc..d410625461550 100644
---- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
-+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
-@@ -3769,7 +3769,7 @@ mlx5e_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
- mlx5e_fold_sw_stats64(priv, stats);
- }
-
-- stats->rx_dropped = priv->stats.qcnt.rx_out_of_buffer;
-+ stats->rx_missed_errors = priv->stats.qcnt.rx_out_of_buffer;
-
- stats->rx_length_errors =
- PPORT_802_3_GET(pstats, a_in_range_length_errors) +
---
-2.43.0
-
+++ /dev/null
-From 666d573baa8b4ead9813561cbda9e4249da54daf Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 21 May 2024 08:54:06 +0200
-Subject: net: phy: micrel: set soft_reset callback to genphy_soft_reset for
- KSZ8061
-
-From: Mathieu Othacehe <othacehe@gnu.org>
-
-[ Upstream commit 128d54fbcb14b8717ecf596d3dbded327b9980b3 ]
-
-Following a similar reinstate for the KSZ8081 and KSZ9031.
-
-Older kernels would use the genphy_soft_reset if the PHY did not implement
-a .soft_reset.
-
-The KSZ8061 errata described here:
-https://ww1.microchip.com/downloads/en/DeviceDoc/KSZ8061-Errata-DS80000688B.pdf
-and worked around with 232ba3a51c ("net: phy: Micrel KSZ8061: link failure after cable connect")
-is back again without this soft reset.
-
-Fixes: 6e2d85ec0559 ("net: phy: Stop with excessive soft reset")
-Tested-by: Karim Ben Houcine <karim.benhoucine@landisgyr.com>
-Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
-Reviewed-by: Andrew Lunn <andrew@lunn.ch>
-Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/phy/micrel.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
-index 827db6a6ff397..25041b3465734 100644
---- a/drivers/net/phy/micrel.c
-+++ b/drivers/net/phy/micrel.c
-@@ -4773,6 +4773,7 @@ static struct phy_driver ksphy_driver[] = {
- /* PHY_BASIC_FEATURES */
- .probe = kszphy_probe,
- .config_init = ksz8061_config_init,
-+ .soft_reset = genphy_soft_reset,
- .config_intr = kszphy_config_intr,
- .handle_interrupt = kszphy_handle_interrupt,
- .suspend = kszphy_suspend,
---
-2.43.0
-
+++ /dev/null
-From a30b596a6436a777c4b1e2d9ca71f8ce89a2e118 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 21 May 2024 16:01:00 +0200
-Subject: net: relax socket state check at accept time.
-
-From: Paolo Abeni <pabeni@redhat.com>
-
-[ Upstream commit 26afda78cda3da974fd4c287962c169e9462c495 ]
-
-Christoph reported the following splat:
-
-WARNING: CPU: 1 PID: 772 at net/ipv4/af_inet.c:761 __inet_accept+0x1f4/0x4a0
-Modules linked in:
-CPU: 1 PID: 772 Comm: syz-executor510 Not tainted 6.9.0-rc7-g7da7119fe22b #56
-Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-2.el7 04/01/2014
-RIP: 0010:__inet_accept+0x1f4/0x4a0 net/ipv4/af_inet.c:759
-Code: 04 38 84 c0 0f 85 87 00 00 00 41 c7 04 24 03 00 00 00 48 83 c4 10 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc e8 ec b7 da fd <0f> 0b e9 7f fe ff ff e8 e0 b7 da fd 0f 0b e9 fe fe ff ff 89 d9 80
-RSP: 0018:ffffc90000c2fc58 EFLAGS: 00010293
-RAX: ffffffff836bdd14 RBX: 0000000000000000 RCX: ffff888104668000
-RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
-RBP: dffffc0000000000 R08: ffffffff836bdb89 R09: fffff52000185f64
-R10: dffffc0000000000 R11: fffff52000185f64 R12: dffffc0000000000
-R13: 1ffff92000185f98 R14: ffff88810754d880 R15: ffff8881007b7800
-FS: 000000001c772880(0000) GS:ffff88811b280000(0000) knlGS:0000000000000000
-CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
-CR2: 00007fb9fcf2e178 CR3: 00000001045d2002 CR4: 0000000000770ef0
-DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
-DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
-PKRU: 55555554
-Call Trace:
- <TASK>
- inet_accept+0x138/0x1d0 net/ipv4/af_inet.c:786
- do_accept+0x435/0x620 net/socket.c:1929
- __sys_accept4_file net/socket.c:1969 [inline]
- __sys_accept4+0x9b/0x110 net/socket.c:1999
- __do_sys_accept net/socket.c:2016 [inline]
- __se_sys_accept net/socket.c:2013 [inline]
- __x64_sys_accept+0x7d/0x90 net/socket.c:2013
- do_syscall_x64 arch/x86/entry/common.c:52 [inline]
- do_syscall_64+0x58/0x100 arch/x86/entry/common.c:83
- entry_SYSCALL_64_after_hwframe+0x76/0x7e
-RIP: 0033:0x4315f9
-Code: fd ff 48 81 c4 80 00 00 00 e9 f1 fe ff ff 0f 1f 00 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 0f 83 ab b4 fd ff c3 66 2e 0f 1f 84 00 00 00 00
-RSP: 002b:00007ffdb26d9c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002b
-RAX: ffffffffffffffda RBX: 0000000000400300 RCX: 00000000004315f9
-RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000004
-RBP: 00000000006e1018 R08: 0000000000400300 R09: 0000000000400300
-R10: 0000000000400300 R11: 0000000000000246 R12: 0000000000000000
-R13: 000000000040cdf0 R14: 000000000040ce80 R15: 0000000000000055
- </TASK>
-
-The reproducer invokes shutdown() before entering the listener status.
-After commit 94062790aedb ("tcp: defer shutdown(SEND_SHUTDOWN) for
-TCP_SYN_RECV sockets"), the above causes the child to reach the accept
-syscall in FIN_WAIT1 status.
-
-Eric noted we can relax the existing assertion in __inet_accept()
-
-Reported-by: Christoph Paasch <cpaasch@apple.com>
-Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/490
-Suggested-by: Eric Dumazet <edumazet@google.com>
-Fixes: 94062790aedb ("tcp: defer shutdown(SEND_SHUTDOWN) for TCP_SYN_RECV sockets")
-Reviewed-by: Eric Dumazet <edumazet@google.com>
-Link: https://lore.kernel.org/r/23ab880a44d8cfd967e84de8b93dbf48848e3d8c.1716299669.git.pabeni@redhat.com
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- net/ipv4/af_inet.c | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
-index ce5c26cf1e2e8..1e373e7477efa 100644
---- a/net/ipv4/af_inet.c
-+++ b/net/ipv4/af_inet.c
-@@ -757,7 +757,9 @@ void __inet_accept(struct socket *sock, struct socket *newsock, struct sock *new
- sock_rps_record_flow(newsk);
- WARN_ON(!((1 << newsk->sk_state) &
- (TCPF_ESTABLISHED | TCPF_SYN_RECV |
-- TCPF_CLOSE_WAIT | TCPF_CLOSE)));
-+ TCPF_FIN_WAIT1 | TCPF_FIN_WAIT2 |
-+ TCPF_CLOSING | TCPF_CLOSE_WAIT |
-+ TCPF_CLOSE)));
-
- if (test_bit(SOCK_SUPPORT_ZC, &sock->flags))
- set_bit(SOCK_SUPPORT_ZC, &newsock->flags);
---
-2.43.0
-
+++ /dev/null
-From 15dd8079f29f8966fdb63127f802873fedef4b00 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 27 May 2024 18:39:55 +0300
-Subject: net/sched: taprio: extend minimum interval restriction to entire
- cycle too
-
-From: Vladimir Oltean <vladimir.oltean@nxp.com>
-
-[ Upstream commit fb66df20a7201e60f2b13d7f95d031b31a8831d3 ]
-
-It is possible for syzbot to side-step the restriction imposed by the
-blamed commit in the Fixes: tag, because the taprio UAPI permits a
-cycle-time different from (and potentially shorter than) the sum of
-entry intervals.
-
-We need one more restriction, which is that the cycle time itself must
-be larger than N * ETH_ZLEN bit times, where N is the number of schedule
-entries. This restriction needs to apply regardless of whether the cycle
-time came from the user or was the implicit, auto-calculated value, so
-we move the existing "cycle == 0" check outside the "if "(!new->cycle_time)"
-branch. This way covers both conditions and scenarios.
-
-Add a selftest which illustrates the issue triggered by syzbot.
-
-Fixes: b5b73b26b3ca ("taprio: Fix allowing too small intervals")
-Reported-by: syzbot+a7d2b1d5d1af83035567@syzkaller.appspotmail.com
-Closes: https://lore.kernel.org/netdev/0000000000007d66bc06196e7c66@google.com/
-Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
-Link: https://lore.kernel.org/r/20240527153955.553333-2-vladimir.oltean@nxp.com
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- net/sched/sch_taprio.c | 10 ++++-----
- .../tc-testing/tc-tests/qdiscs/taprio.json | 22 +++++++++++++++++++
- 2 files changed, 27 insertions(+), 5 deletions(-)
-
-diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
-index 501ce71500658..2db5db5afaa72 100644
---- a/net/sched/sch_taprio.c
-+++ b/net/sched/sch_taprio.c
-@@ -1161,11 +1161,6 @@ static int parse_taprio_schedule(struct taprio_sched *q, struct nlattr **tb,
- list_for_each_entry(entry, &new->entries, list)
- cycle = ktime_add_ns(cycle, entry->interval);
-
-- if (!cycle) {
-- NL_SET_ERR_MSG(extack, "'cycle_time' can never be 0");
-- return -EINVAL;
-- }
--
- if (cycle < 0 || cycle > INT_MAX) {
- NL_SET_ERR_MSG(extack, "'cycle_time' is too big");
- return -EINVAL;
-@@ -1174,6 +1169,11 @@ static int parse_taprio_schedule(struct taprio_sched *q, struct nlattr **tb,
- new->cycle_time = cycle;
- }
-
-+ if (new->cycle_time < new->num_entries * length_to_duration(q, ETH_ZLEN)) {
-+ NL_SET_ERR_MSG(extack, "'cycle_time' is too small");
-+ return -EINVAL;
-+ }
-+
- taprio_calculate_gate_durations(q, new);
-
- return 0;
-diff --git a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/taprio.json b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/taprio.json
-index 387db0d9bfd15..74dba8c671889 100644
---- a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/taprio.json
-+++ b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/taprio.json
-@@ -154,6 +154,28 @@
- "echo \"1\" > /sys/bus/netdevsim/del_device"
- ]
- },
-+ {
-+ "id": "831f",
-+ "name": "Add taprio Qdisc with too short cycle-time",
-+ "category": [
-+ "qdisc",
-+ "taprio"
-+ ],
-+ "plugins": {
-+ "requires": "nsPlugin"
-+ },
-+ "setup": [
-+ "echo \"1 1 8\" > /sys/bus/netdevsim/new_device"
-+ ],
-+ "cmdUnderTest": "$TC qdisc add dev $ETH root handle 1: taprio num_tc 2 queues 1@0 1@1 sched-entry S 01 200000 sched-entry S 02 200000 cycle-time 100 clockid CLOCK_TAI",
-+ "expExitCode": "2",
-+ "verifyCmd": "$TC qdisc show dev $ETH",
-+ "matchPattern": "qdisc taprio 1: root refcnt",
-+ "matchCount": "0",
-+ "teardown": [
-+ "echo \"1\" > /sys/bus/netdevsim/del_device"
-+ ]
-+ },
- {
- "id": "3e1e",
- "name": "Add taprio Qdisc with an invalid cycle-time",
---
-2.43.0
-
+++ /dev/null
-From 01a00193d4698c1eacccea8ba4fa2987e0a4141a Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 27 May 2024 18:39:54 +0300
-Subject: net/sched: taprio: make q->picos_per_byte available to
- fill_sched_entry()
-
-From: Vladimir Oltean <vladimir.oltean@nxp.com>
-
-[ Upstream commit e634134180885574d1fe7aa162777ba41e7fcd5b ]
-
-In commit b5b73b26b3ca ("taprio: Fix allowing too small intervals"), a
-comparison of user input against length_to_duration(q, ETH_ZLEN) was
-introduced, to avoid RCU stalls due to frequent hrtimers.
-
-The implementation of length_to_duration() depends on q->picos_per_byte
-being set for the link speed. The blamed commit in the Fixes: tag has
-moved this too late, so the checks introduced above are ineffective.
-The q->picos_per_byte is zero at parse_taprio_schedule() ->
-parse_sched_list() -> parse_sched_entry() -> fill_sched_entry() time.
-
-Move the taprio_set_picos_per_byte() call as one of the first things in
-taprio_change(), before the bulk of the netlink attribute parsing is
-done. That's because it is needed there.
-
-Add a selftest to make sure the issue doesn't get reintroduced.
-
-Fixes: 09dbdf28f9f9 ("net/sched: taprio: fix calculation of maximum gate durations")
-Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
-Reviewed-by: Eric Dumazet <edumazet@google.com>
-Link: https://lore.kernel.org/r/20240527153955.553333-1-vladimir.oltean@nxp.com
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- net/sched/sch_taprio.c | 4 +++-
- .../tc-testing/tc-tests/qdiscs/taprio.json | 22 +++++++++++++++++++
- 2 files changed, 25 insertions(+), 1 deletion(-)
-
-diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
-index ad99409c6325e..501ce71500658 100644
---- a/net/sched/sch_taprio.c
-+++ b/net/sched/sch_taprio.c
-@@ -1871,6 +1871,9 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
-
- q->flags = err;
-
-+ /* Needed for length_to_duration() during netlink attribute parsing */
-+ taprio_set_picos_per_byte(dev, q);
-+
- err = taprio_parse_mqprio_opt(dev, mqprio, extack, q->flags);
- if (err < 0)
- return err;
-@@ -1930,7 +1933,6 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
- if (err < 0)
- goto free_sched;
-
-- taprio_set_picos_per_byte(dev, q);
- taprio_update_queue_max_sdu(q, new_admin, stab);
-
- if (FULL_OFFLOAD_IS_ENABLED(q->flags))
-diff --git a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/taprio.json b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/taprio.json
-index 2d603ef2e375c..387db0d9bfd15 100644
---- a/tools/testing/selftests/tc-testing/tc-tests/qdiscs/taprio.json
-+++ b/tools/testing/selftests/tc-testing/tc-tests/qdiscs/taprio.json
-@@ -132,6 +132,28 @@
- "echo \"1\" > /sys/bus/netdevsim/del_device"
- ]
- },
-+ {
-+ "id": "6f62",
-+ "name": "Add taprio Qdisc with too short interval",
-+ "category": [
-+ "qdisc",
-+ "taprio"
-+ ],
-+ "plugins": {
-+ "requires": "nsPlugin"
-+ },
-+ "setup": [
-+ "echo \"1 1 8\" > /sys/bus/netdevsim/new_device"
-+ ],
-+ "cmdUnderTest": "$TC qdisc add dev $ETH root handle 1: taprio num_tc 2 queues 1@0 1@1 sched-entry S 01 300 sched-entry S 02 1700 clockid CLOCK_TAI",
-+ "expExitCode": "2",
-+ "verifyCmd": "$TC qdisc show dev $ETH",
-+ "matchPattern": "qdisc taprio 1: root refcnt",
-+ "matchCount": "0",
-+ "teardown": [
-+ "echo \"1\" > /sys/bus/netdevsim/del_device"
-+ ]
-+ },
- {
- "id": "3e1e",
- "name": "Add taprio Qdisc with an invalid cycle-time",
---
-2.43.0
-
+++ /dev/null
-From a6c6dfa2905e2fb0da9717ecc7ec4d2dd2d4cf6f Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 27 May 2024 12:00:15 +0530
-Subject: net: ti: icssg-prueth: Fix start counter for ft1 filter
-
-From: MD Danish Anwar <danishanwar@ti.com>
-
-[ Upstream commit 56a5cf538c3f2d935b0d81040a8303b6e7fc5fd8 ]
-
-The start counter for FT1 filter is wrongly set to 0 in the driver.
-FT1 is used for source address violation (SAV) check and source address
-starts at Byte 6 not Byte 0. Fix this by changing start counter to
-ETH_ALEN in icssg_ft1_set_mac_addr().
-
-Fixes: e9b4ece7d74b ("net: ti: icssg-prueth: Add Firmware config and classification APIs.")
-Signed-off-by: MD Danish Anwar <danishanwar@ti.com>
-Link: https://lore.kernel.org/r/20240527063015.263748-1-danishanwar@ti.com
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/ethernet/ti/icssg/icssg_classifier.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/net/ethernet/ti/icssg/icssg_classifier.c b/drivers/net/ethernet/ti/icssg/icssg_classifier.c
-index 6df53ab17fbc5..902a2717785cb 100644
---- a/drivers/net/ethernet/ti/icssg/icssg_classifier.c
-+++ b/drivers/net/ethernet/ti/icssg/icssg_classifier.c
-@@ -360,7 +360,7 @@ void icssg_ft1_set_mac_addr(struct regmap *miig_rt, int slice, u8 *mac_addr)
- {
- const u8 mask_addr[] = { 0, 0, 0, 0, 0, 0, };
-
-- rx_class_ft1_set_start_len(miig_rt, slice, 0, 6);
-+ rx_class_ft1_set_start_len(miig_rt, slice, ETH_ALEN, ETH_ALEN);
- rx_class_ft1_set_da(miig_rt, slice, 0, mac_addr);
- rx_class_ft1_set_da_mask(miig_rt, slice, 0, mask_addr);
- rx_class_ft1_cfg_set_type(miig_rt, slice, 0, FT1_CFG_TYPE_EQ);
---
-2.43.0
-
+++ /dev/null
-From f5c188f6e58d5e9d7d0fb2c2ba1520ac4f8972d9 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 23 May 2024 14:23:14 +0530
-Subject: net: usb: smsc95xx: fix changing LED_SEL bit value updated from
- EEPROM
-
-From: Parthiban Veerasooran <Parthiban.Veerasooran@microchip.com>
-
-[ Upstream commit 52a2f0608366a629d43dacd3191039c95fef74ba ]
-
-LED Select (LED_SEL) bit in the LED General Purpose IO Configuration
-register is used to determine the functionality of external LED pins
-(Speed Indicator, Link and Activity Indicator, Full Duplex Link
-Indicator). The default value for this bit is 0 when no EEPROM is
-present. If a EEPROM is present, the default value is the value of the
-LED Select bit in the Configuration Flags of the EEPROM. A USB Reset or
-Lite Reset (LRST) will cause this bit to be restored to the image value
-last loaded from EEPROM, or to be set to 0 if no EEPROM is present.
-
-While configuring the dual purpose GPIO/LED pins to LED outputs in the
-LED General Purpose IO Configuration register, the LED_SEL bit is changed
-as 0 and resulting the configured value from the EEPROM is cleared. The
-issue is fixed by using read-modify-write approach.
-
-Fixes: f293501c61c5 ("smsc95xx: configure LED outputs")
-Signed-off-by: Parthiban Veerasooran <Parthiban.Veerasooran@microchip.com>
-Reviewed-by: Simon Horman <horms@kernel.org>
-Reviewed-by: Woojung Huh <woojung.huh@microchip.com>
-Link: https://lore.kernel.org/r/20240523085314.167650-1-Parthiban.Veerasooran@microchip.com
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/usb/smsc95xx.c | 11 +++++++----
- 1 file changed, 7 insertions(+), 4 deletions(-)
-
-diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
-index cbea246664795..8e82184be5e7d 100644
---- a/drivers/net/usb/smsc95xx.c
-+++ b/drivers/net/usb/smsc95xx.c
-@@ -879,7 +879,7 @@ static int smsc95xx_start_rx_path(struct usbnet *dev)
- static int smsc95xx_reset(struct usbnet *dev)
- {
- struct smsc95xx_priv *pdata = dev->driver_priv;
-- u32 read_buf, write_buf, burst_cap;
-+ u32 read_buf, burst_cap;
- int ret = 0, timeout;
-
- netif_dbg(dev, ifup, dev->net, "entering smsc95xx_reset\n");
-@@ -1003,10 +1003,13 @@ static int smsc95xx_reset(struct usbnet *dev)
- return ret;
- netif_dbg(dev, ifup, dev->net, "ID_REV = 0x%08x\n", read_buf);
-
-+ ret = smsc95xx_read_reg(dev, LED_GPIO_CFG, &read_buf);
-+ if (ret < 0)
-+ return ret;
- /* Configure GPIO pins as LED outputs */
-- write_buf = LED_GPIO_CFG_SPD_LED | LED_GPIO_CFG_LNK_LED |
-- LED_GPIO_CFG_FDX_LED;
-- ret = smsc95xx_write_reg(dev, LED_GPIO_CFG, write_buf);
-+ read_buf |= LED_GPIO_CFG_SPD_LED | LED_GPIO_CFG_LNK_LED |
-+ LED_GPIO_CFG_FDX_LED;
-+ ret = smsc95xx_write_reg(dev, LED_GPIO_CFG, read_buf);
- if (ret < 0)
- return ret;
-
---
-2.43.0
-
+++ /dev/null
-From 4095b6d6cb29f5eacec1b81abe9a1f8b9eccd902 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 17 Apr 2024 18:51:41 +0500
-Subject: netfilter: ipset: Add list flush to cancel_gc
-
-From: Alexander Maltsev <keltar.gw@gmail.com>
-
-[ Upstream commit c1193d9bbbd379defe9be3c6de566de684de8a6f ]
-
-Flushing list in cancel_gc drops references to other lists right away,
-without waiting for RCU to destroy list. Fixes race when referenced
-ipsets can't be destroyed while referring list is scheduled for destroy.
-
-Fixes: 97f7cf1cd80e ("netfilter: ipset: fix performance regression in swap operation")
-Signed-off-by: Alexander Maltsev <keltar.gw@gmail.com>
-Acked-by: Jozsef Kadlecsik <kadlec@netfilter.org>
-Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- net/netfilter/ipset/ip_set_list_set.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/net/netfilter/ipset/ip_set_list_set.c b/net/netfilter/ipset/ip_set_list_set.c
-index 6c3f28bc59b32..54e2a1dd7f5f5 100644
---- a/net/netfilter/ipset/ip_set_list_set.c
-+++ b/net/netfilter/ipset/ip_set_list_set.c
-@@ -549,6 +549,9 @@ list_set_cancel_gc(struct ip_set *set)
-
- if (SET_WITH_TIMEOUT(set))
- timer_shutdown_sync(&map->gc);
-+
-+ /* Flush list to drop references to other ipsets */
-+ list_set_flush(set);
- }
-
- static const struct ip_set_type_variant set_variant = {
---
-2.43.0
-
+++ /dev/null
-From 706a77d15b5ddc1f8d41972cdf60f7bc413a337b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 15 May 2024 13:23:39 +0000
-Subject: netfilter: nfnetlink_queue: acquire rcu_read_lock() in
- instance_destroy_rcu()
-
-From: Eric Dumazet <edumazet@google.com>
-
-[ Upstream commit dc21c6cc3d6986d938efbf95de62473982c98dec ]
-
-syzbot reported that nf_reinject() could be called without rcu_read_lock() :
-
-WARNING: suspicious RCU usage
-6.9.0-rc7-syzkaller-02060-g5c1672705a1a #0 Not tainted
-
-net/netfilter/nfnetlink_queue.c:263 suspicious rcu_dereference_check() usage!
-
-other info that might help us debug this:
-
-rcu_scheduler_active = 2, debug_locks = 1
-2 locks held by syz-executor.4/13427:
- #0: ffffffff8e334f60 (rcu_callback){....}-{0:0}, at: rcu_lock_acquire include/linux/rcupdate.h:329 [inline]
- #0: ffffffff8e334f60 (rcu_callback){....}-{0:0}, at: rcu_do_batch kernel/rcu/tree.c:2190 [inline]
- #0: ffffffff8e334f60 (rcu_callback){....}-{0:0}, at: rcu_core+0xa86/0x1830 kernel/rcu/tree.c:2471
- #1: ffff88801ca92958 (&inst->lock){+.-.}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:356 [inline]
- #1: ffff88801ca92958 (&inst->lock){+.-.}-{2:2}, at: nfqnl_flush net/netfilter/nfnetlink_queue.c:405 [inline]
- #1: ffff88801ca92958 (&inst->lock){+.-.}-{2:2}, at: instance_destroy_rcu+0x30/0x220 net/netfilter/nfnetlink_queue.c:172
-
-stack backtrace:
-CPU: 0 PID: 13427 Comm: syz-executor.4 Not tainted 6.9.0-rc7-syzkaller-02060-g5c1672705a1a #0
-Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
-Call Trace:
- <IRQ>
- __dump_stack lib/dump_stack.c:88 [inline]
- dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114
- lockdep_rcu_suspicious+0x221/0x340 kernel/locking/lockdep.c:6712
- nf_reinject net/netfilter/nfnetlink_queue.c:323 [inline]
- nfqnl_reinject+0x6ec/0x1120 net/netfilter/nfnetlink_queue.c:397
- nfqnl_flush net/netfilter/nfnetlink_queue.c:410 [inline]
- instance_destroy_rcu+0x1ae/0x220 net/netfilter/nfnetlink_queue.c:172
- rcu_do_batch kernel/rcu/tree.c:2196 [inline]
- rcu_core+0xafd/0x1830 kernel/rcu/tree.c:2471
- handle_softirqs+0x2d6/0x990 kernel/softirq.c:554
- __do_softirq kernel/softirq.c:588 [inline]
- invoke_softirq kernel/softirq.c:428 [inline]
- __irq_exit_rcu+0xf4/0x1c0 kernel/softirq.c:637
- irq_exit_rcu+0x9/0x30 kernel/softirq.c:649
- instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1043 [inline]
- sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1043
- </IRQ>
- <TASK>
-
-Fixes: 9872bec773c2 ("[NETFILTER]: nfnetlink: use RCU for queue instances hash")
-Reported-by: syzbot <syzkaller@googlegroups.com>
-Signed-off-by: Eric Dumazet <edumazet@google.com>
-Acked-by: Florian Westphal <fw@strlen.de>
-Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- net/netfilter/nfnetlink_queue.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
-index 5cf38fc0a366a..29bfd996e4fc3 100644
---- a/net/netfilter/nfnetlink_queue.c
-+++ b/net/netfilter/nfnetlink_queue.c
-@@ -169,7 +169,9 @@ instance_destroy_rcu(struct rcu_head *head)
- struct nfqnl_instance *inst = container_of(head, struct nfqnl_instance,
- rcu);
-
-+ rcu_read_lock();
- nfqnl_flush(inst, NULL, 0);
-+ rcu_read_unlock();
- kfree(inst);
- module_put(THIS_MODULE);
- }
---
-2.43.0
-
+++ /dev/null
-From c713e81885ee9e0884c075b74516cd2902950dd4 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 21 May 2024 10:25:05 -0400
-Subject: netfilter: nft_fib: allow from forward/input without iif selector
-
-From: Eric Garver <eric@garver.life>
-
-[ Upstream commit e8ded22ef0f4831279c363c264cd41cd9d59ca9e ]
-
-This removes the restriction of needing iif selector in the
-forward/input hooks for fib lookups when requested result is
-oif/oifname.
-
-Removing this restriction allows "loose" lookups from the forward hooks.
-
-Fixes: be8be04e5ddb ("netfilter: nft_fib: reverse path filter for policy-based routing on iif")
-Signed-off-by: Eric Garver <eric@garver.life>
-Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- net/netfilter/nft_fib.c | 8 +++-----
- 1 file changed, 3 insertions(+), 5 deletions(-)
-
-diff --git a/net/netfilter/nft_fib.c b/net/netfilter/nft_fib.c
-index 37cfe6dd712d8..b58f62195ff3e 100644
---- a/net/netfilter/nft_fib.c
-+++ b/net/netfilter/nft_fib.c
-@@ -35,11 +35,9 @@ int nft_fib_validate(const struct nft_ctx *ctx, const struct nft_expr *expr,
- switch (priv->result) {
- case NFT_FIB_RESULT_OIF:
- case NFT_FIB_RESULT_OIFNAME:
-- hooks = (1 << NF_INET_PRE_ROUTING);
-- if (priv->flags & NFTA_FIB_F_IIF) {
-- hooks |= (1 << NF_INET_LOCAL_IN) |
-- (1 << NF_INET_FORWARD);
-- }
-+ hooks = (1 << NF_INET_PRE_ROUTING) |
-+ (1 << NF_INET_LOCAL_IN) |
-+ (1 << NF_INET_FORWARD);
- break;
- case NFT_FIB_RESULT_ADDRTYPE:
- if (priv->flags & NFTA_FIB_F_IIF)
---
-2.43.0
-
+++ /dev/null
-From af1b9360f8746d8e5322eaf09d6a3a8f10988703 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 9 May 2024 23:02:24 +0200
-Subject: netfilter: nft_payload: restore vlan q-in-q match support
-
-From: Pablo Neira Ayuso <pablo@netfilter.org>
-
-[ Upstream commit aff5c01fa1284d606f8e7cbdaafeef2511bb46c1 ]
-
-Revert f6ae9f120dad ("netfilter: nft_payload: add C-VLAN support").
-
-f41f72d09ee1 ("netfilter: nft_payload: simplify vlan header handling")
-already allows to match on inner vlan tags by subtract the vlan header
-size to the payload offset which has been popped and stored in skbuff
-metadata fields.
-
-Fixes: f6ae9f120dad ("netfilter: nft_payload: add C-VLAN support")
-Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- net/netfilter/nft_payload.c | 23 +++++++----------------
- 1 file changed, 7 insertions(+), 16 deletions(-)
-
-diff --git a/net/netfilter/nft_payload.c b/net/netfilter/nft_payload.c
-index 0a689c8e0295d..a3cb5dbcb362c 100644
---- a/net/netfilter/nft_payload.c
-+++ b/net/netfilter/nft_payload.c
-@@ -45,36 +45,27 @@ nft_payload_copy_vlan(u32 *d, const struct sk_buff *skb, u8 offset, u8 len)
- int mac_off = skb_mac_header(skb) - skb->data;
- u8 *vlanh, *dst_u8 = (u8 *) d;
- struct vlan_ethhdr veth;
-- u8 vlan_hlen = 0;
--
-- if ((skb->protocol == htons(ETH_P_8021AD) ||
-- skb->protocol == htons(ETH_P_8021Q)) &&
-- offset >= VLAN_ETH_HLEN && offset < VLAN_ETH_HLEN + VLAN_HLEN)
-- vlan_hlen += VLAN_HLEN;
-
- vlanh = (u8 *) &veth;
-- if (offset < VLAN_ETH_HLEN + vlan_hlen) {
-+ if (offset < VLAN_ETH_HLEN) {
- u8 ethlen = len;
-
-- if (vlan_hlen &&
-- skb_copy_bits(skb, mac_off, &veth, VLAN_ETH_HLEN) < 0)
-- return false;
-- else if (!nft_payload_rebuild_vlan_hdr(skb, mac_off, &veth))
-+ if (!nft_payload_rebuild_vlan_hdr(skb, mac_off, &veth))
- return false;
-
-- if (offset + len > VLAN_ETH_HLEN + vlan_hlen)
-- ethlen -= offset + len - VLAN_ETH_HLEN - vlan_hlen;
-+ if (offset + len > VLAN_ETH_HLEN)
-+ ethlen -= offset + len - VLAN_ETH_HLEN;
-
-- memcpy(dst_u8, vlanh + offset - vlan_hlen, ethlen);
-+ memcpy(dst_u8, vlanh + offset, ethlen);
-
- len -= ethlen;
- if (len == 0)
- return true;
-
- dst_u8 += ethlen;
-- offset = ETH_HLEN + vlan_hlen;
-+ offset = ETH_HLEN;
- } else {
-- offset -= VLAN_HLEN + vlan_hlen;
-+ offset -= VLAN_HLEN;
- }
-
- return skb_copy_bits(skb, offset + mac_off, dst_u8, len) == 0;
---
-2.43.0
-
+++ /dev/null
-From 6d37f6b957bce5f41681f60d0d6a510870d6fc31 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 8 May 2024 22:50:34 +0200
-Subject: netfilter: nft_payload: skbuff vlan metadata mangle support
-
-From: Pablo Neira Ayuso <pablo@netfilter.org>
-
-[ Upstream commit 33c563ebf8d3deed7d8addd20d77398ac737ef9a ]
-
-Userspace assumes vlan header is present at a given offset, but vlan
-offload allows to store this in metadata fields of the skbuff. Hence
-mangling vlan results in a garbled packet. Handle this transparently by
-adding a parser to the kernel.
-
-If vlan metadata is present and payload offset is over 12 bytes (source
-and destination mac address fields), then subtract vlan header present
-in vlan metadata, otherwise mangle vlan metadata based on offset and
-length, extracting data from the source register.
-
-This is similar to:
-
- 8cfd23e67401 ("netfilter: nft_payload: work around vlan header stripping")
-
-to deal with vlan payload mangling.
-
-Fixes: 7ec3f7b47b8d ("netfilter: nft_payload: add packet mangling support")
-Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- net/netfilter/nft_payload.c | 72 +++++++++++++++++++++++++++++++++----
- 1 file changed, 65 insertions(+), 7 deletions(-)
-
-diff --git a/net/netfilter/nft_payload.c b/net/netfilter/nft_payload.c
-index a3cb5dbcb362c..0c43d748e23ae 100644
---- a/net/netfilter/nft_payload.c
-+++ b/net/netfilter/nft_payload.c
-@@ -145,12 +145,12 @@ int nft_payload_inner_offset(const struct nft_pktinfo *pkt)
- return pkt->inneroff;
- }
-
--static bool nft_payload_need_vlan_copy(const struct nft_payload *priv)
-+static bool nft_payload_need_vlan_adjust(u32 offset, u32 len)
- {
-- unsigned int len = priv->offset + priv->len;
-+ unsigned int boundary = offset + len;
-
- /* data past ether src/dst requested, copy needed */
-- if (len > offsetof(struct ethhdr, h_proto))
-+ if (boundary > offsetof(struct ethhdr, h_proto))
- return true;
-
- return false;
-@@ -174,7 +174,7 @@ void nft_payload_eval(const struct nft_expr *expr,
- goto err;
-
- if (skb_vlan_tag_present(skb) &&
-- nft_payload_need_vlan_copy(priv)) {
-+ nft_payload_need_vlan_adjust(priv->offset, priv->len)) {
- if (!nft_payload_copy_vlan(dest, skb,
- priv->offset, priv->len))
- goto err;
-@@ -801,21 +801,79 @@ struct nft_payload_set {
- u8 csum_flags;
- };
-
-+/* This is not struct vlan_hdr. */
-+struct nft_payload_vlan_hdr {
-+ __be16 h_vlan_proto;
-+ __be16 h_vlan_TCI;
-+};
-+
-+static bool
-+nft_payload_set_vlan(const u32 *src, struct sk_buff *skb, u8 offset, u8 len,
-+ int *vlan_hlen)
-+{
-+ struct nft_payload_vlan_hdr *vlanh;
-+ __be16 vlan_proto;
-+ u16 vlan_tci;
-+
-+ if (offset >= offsetof(struct vlan_ethhdr, h_vlan_encapsulated_proto)) {
-+ *vlan_hlen = VLAN_HLEN;
-+ return true;
-+ }
-+
-+ switch (offset) {
-+ case offsetof(struct vlan_ethhdr, h_vlan_proto):
-+ if (len == 2) {
-+ vlan_proto = nft_reg_load_be16(src);
-+ skb->vlan_proto = vlan_proto;
-+ } else if (len == 4) {
-+ vlanh = (struct nft_payload_vlan_hdr *)src;
-+ __vlan_hwaccel_put_tag(skb, vlanh->h_vlan_proto,
-+ ntohs(vlanh->h_vlan_TCI));
-+ } else {
-+ return false;
-+ }
-+ break;
-+ case offsetof(struct vlan_ethhdr, h_vlan_TCI):
-+ if (len != 2)
-+ return false;
-+
-+ vlan_tci = ntohs(nft_reg_load_be16(src));
-+ skb->vlan_tci = vlan_tci;
-+ break;
-+ default:
-+ return false;
-+ }
-+
-+ return true;
-+}
-+
- static void nft_payload_set_eval(const struct nft_expr *expr,
- struct nft_regs *regs,
- const struct nft_pktinfo *pkt)
- {
- const struct nft_payload_set *priv = nft_expr_priv(expr);
-- struct sk_buff *skb = pkt->skb;
- const u32 *src = ®s->data[priv->sreg];
-- int offset, csum_offset;
-+ int offset, csum_offset, vlan_hlen = 0;
-+ struct sk_buff *skb = pkt->skb;
- __wsum fsum, tsum;
-
- switch (priv->base) {
- case NFT_PAYLOAD_LL_HEADER:
- if (!skb_mac_header_was_set(skb))
- goto err;
-- offset = skb_mac_header(skb) - skb->data;
-+
-+ if (skb_vlan_tag_present(skb) &&
-+ nft_payload_need_vlan_adjust(priv->offset, priv->len)) {
-+ if (!nft_payload_set_vlan(src, skb,
-+ priv->offset, priv->len,
-+ &vlan_hlen))
-+ goto err;
-+
-+ if (!vlan_hlen)
-+ return;
-+ }
-+
-+ offset = skb_mac_header(skb) - skb->data - vlan_hlen;
- break;
- case NFT_PAYLOAD_NETWORK_HEADER:
- offset = skb_network_offset(skb);
---
-2.43.0
-
+++ /dev/null
-From 2ff89b874f5f4a71197f3effa21f306407fe7b80 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 13 May 2024 12:27:15 +0200
-Subject: netfilter: tproxy: bail out if IP has been disabled on the device
-
-From: Florian Westphal <fw@strlen.de>
-
-[ Upstream commit 21a673bddc8fd4873c370caf9ae70ffc6d47e8d3 ]
-
-syzbot reports:
-general protection fault, probably for non-canonical address 0xdffffc0000000003: 0000 [#1] PREEMPT SMP KASAN PTI
-KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f]
-[..]
-RIP: 0010:nf_tproxy_laddr4+0xb7/0x340 net/ipv4/netfilter/nf_tproxy_ipv4.c:62
-Call Trace:
- nft_tproxy_eval_v4 net/netfilter/nft_tproxy.c:56 [inline]
- nft_tproxy_eval+0xa9a/0x1a00 net/netfilter/nft_tproxy.c:168
-
-__in_dev_get_rcu() can return NULL, so check for this.
-
-Reported-and-tested-by: syzbot+b94a6818504ea90d7661@syzkaller.appspotmail.com
-Fixes: cc6eb4338569 ("tproxy: use the interface primary IP address as a default value for --on-ip")
-Signed-off-by: Florian Westphal <fw@strlen.de>
-Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- net/ipv4/netfilter/nf_tproxy_ipv4.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/net/ipv4/netfilter/nf_tproxy_ipv4.c b/net/ipv4/netfilter/nf_tproxy_ipv4.c
-index 69e3317996043..73e66a088e25e 100644
---- a/net/ipv4/netfilter/nf_tproxy_ipv4.c
-+++ b/net/ipv4/netfilter/nf_tproxy_ipv4.c
-@@ -58,6 +58,8 @@ __be32 nf_tproxy_laddr4(struct sk_buff *skb, __be32 user_laddr, __be32 daddr)
-
- laddr = 0;
- indev = __in_dev_get_rcu(skb->dev);
-+ if (!indev)
-+ return daddr;
-
- in_dev_for_each_ifa_rcu(ifa, indev) {
- if (ifa->ifa_flags & IFA_F_SECONDARY)
---
-2.43.0
-
+++ /dev/null
-From 316923e2a9fd0224f920b3b5b2fc1f7540a39ee1 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 21 May 2024 16:49:46 +0100
-Subject: netfs: Fix setting of BDP_ASYNC from iocb flags
-
-From: David Howells <dhowells@redhat.com>
-
-[ Upstream commit c596bea1452ddf172ec9b588e4597228e9a1f4d5 ]
-
-Fix netfs_perform_write() to set BDP_ASYNC if IOCB_NOWAIT is set rather
-than if IOCB_SYNC is not set. It reflects asynchronicity in the sense of
-not waiting rather than synchronicity in the sense of not returning until
-the op is complete.
-
-Without this, generic/590 fails on cifs in strict caching mode with a
-complaint that one of the writes fails with EAGAIN. The test can be
-distilled down to:
-
- mount -t cifs /my/share /mnt -ostuff
- xfs_io -i -c 'falloc 0 8191M -c fsync -f /mnt/file
- xfs_io -i -c 'pwrite -b 1M -W 0 8191M' /mnt/file
-
-Fixes: c38f4e96e605 ("netfs: Provide func to copy data to pagecache for buffered write")
-Signed-off-by: David Howells <dhowells@redhat.com>
-Link: https://lore.kernel.org/r/316306.1716306586@warthog.procyon.org.uk
-Reviewed-by: Jens Axboe <axboe@kernel.dk>
-cc: Jeff Layton <jlayton@kernel.org>
-cc: Enzo Matsumiya <ematsumiya@suse.de>
-cc: Jens Axboe <axboe@kernel.dk>
-cc: Matthew Wilcox <willy@infradead.org>
-cc: netfs@lists.linux.dev
-cc: v9fs@lists.linux.dev
-cc: linux-afs@lists.infradead.org
-cc: linux-cifs@vger.kernel.org
-cc: linux-fsdevel@vger.kernel.org
-Signed-off-by: Christian Brauner <brauner@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/netfs/buffered_write.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/fs/netfs/buffered_write.c b/fs/netfs/buffered_write.c
-index 267b622d923b1..912ad0a1df021 100644
---- a/fs/netfs/buffered_write.c
-+++ b/fs/netfs/buffered_write.c
-@@ -163,7 +163,7 @@ ssize_t netfs_perform_write(struct kiocb *iocb, struct iov_iter *iter,
- struct folio *folio;
- enum netfs_how_to_modify howto;
- enum netfs_folio_trace trace;
-- unsigned int bdp_flags = (iocb->ki_flags & IOCB_SYNC) ? 0: BDP_ASYNC;
-+ unsigned int bdp_flags = (iocb->ki_flags & IOCB_NOWAIT) ? BDP_ASYNC : 0;
- ssize_t written = 0, ret, ret2;
- loff_t i_size, pos = iocb->ki_pos, from, to;
- size_t max_chunk = PAGE_SIZE << MAX_PAGECACHE_ORDER;
---
-2.43.0
-
+++ /dev/null
-From 8b4ba7e81807092d25ce35abbe0d4a8f75c3896a Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 24 May 2024 18:36:17 +0200
-Subject: netkit: Fix pkt_type override upon netkit pass verdict
-
-From: Daniel Borkmann <daniel@iogearbox.net>
-
-[ Upstream commit 3998d184267dfcff858aaa84d3de17429253629d ]
-
-When running Cilium connectivity test suite with netkit in L2 mode, we
-found that compared to tcx a few tests were failing which pushed traffic
-into an L7 proxy sitting in host namespace. The problem in particular is
-around the invocation of eth_type_trans() in netkit.
-
-In case of tcx, this is run before the tcx ingress is triggered inside
-host namespace and thus if the BPF program uses the bpf_skb_change_type()
-helper the newly set type is retained. However, in case of netkit, the
-late eth_type_trans() invocation overrides the earlier decision from the
-BPF program which eventually leads to the test failure.
-
-Instead of eth_type_trans(), split out the relevant parts, meaning, reset
-of mac header and call to eth_skb_pkt_type() before the BPF program is run
-in order to have the same behavior as with tcx, and refactor a small helper
-called eth_skb_pull_mac() which is run in case it's passed up the stack
-where the mac header must be pulled. With this all connectivity tests pass.
-
-Fixes: 35dfaad7188c ("netkit, bpf: Add bpf programmable net device")
-Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
-Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
-Link: https://lore.kernel.org/r/20240524163619.26001-2-daniel@iogearbox.net
-Signed-off-by: Alexei Starovoitov <ast@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/netkit.c | 4 +++-
- include/linux/etherdevice.h | 8 ++++++++
- net/ethernet/eth.c | 4 +---
- 3 files changed, 12 insertions(+), 4 deletions(-)
-
-diff --git a/drivers/net/netkit.c b/drivers/net/netkit.c
-index c24aa9d93f9f6..5cc794a2a789d 100644
---- a/drivers/net/netkit.c
-+++ b/drivers/net/netkit.c
-@@ -55,6 +55,7 @@ static void netkit_prep_forward(struct sk_buff *skb, bool xnet)
- skb_scrub_packet(skb, xnet);
- skb->priority = 0;
- nf_skip_egress(skb, true);
-+ skb_reset_mac_header(skb);
- }
-
- static struct netkit *netkit_priv(const struct net_device *dev)
-@@ -78,6 +79,7 @@ static netdev_tx_t netkit_xmit(struct sk_buff *skb, struct net_device *dev)
- skb_orphan_frags(skb, GFP_ATOMIC)))
- goto drop;
- netkit_prep_forward(skb, !net_eq(dev_net(dev), dev_net(peer)));
-+ eth_skb_pkt_type(skb, peer);
- skb->dev = peer;
- entry = rcu_dereference(nk->active);
- if (entry)
-@@ -85,7 +87,7 @@ static netdev_tx_t netkit_xmit(struct sk_buff *skb, struct net_device *dev)
- switch (ret) {
- case NETKIT_NEXT:
- case NETKIT_PASS:
-- skb->protocol = eth_type_trans(skb, skb->dev);
-+ eth_skb_pull_mac(skb);
- skb_postpull_rcsum(skb, eth_hdr(skb), ETH_HLEN);
- if (likely(__netif_rx(skb) == NET_RX_SUCCESS)) {
- dev_sw_netstats_tx_add(dev, 1, len);
-diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
-index 297231854ada5..e44913a8200fd 100644
---- a/include/linux/etherdevice.h
-+++ b/include/linux/etherdevice.h
-@@ -632,6 +632,14 @@ static inline void eth_skb_pkt_type(struct sk_buff *skb,
- }
- }
-
-+static inline struct ethhdr *eth_skb_pull_mac(struct sk_buff *skb)
-+{
-+ struct ethhdr *eth = (struct ethhdr *)skb->data;
-+
-+ skb_pull_inline(skb, ETH_HLEN);
-+ return eth;
-+}
-+
- /**
- * eth_skb_pad - Pad buffer to mininum number of octets for Ethernet frame
- * @skb: Buffer to pad
-diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
-index 049c3adeb8504..4e3651101b866 100644
---- a/net/ethernet/eth.c
-+++ b/net/ethernet/eth.c
-@@ -161,9 +161,7 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)
- skb->dev = dev;
- skb_reset_mac_header(skb);
-
-- eth = (struct ethhdr *)skb->data;
-- skb_pull_inline(skb, ETH_HLEN);
--
-+ eth = eth_skb_pull_mac(skb);
- eth_skb_pkt_type(skb, dev);
-
- /*
---
-2.43.0
-
+++ /dev/null
-From 20ff0db450100a4ea2e177eeae631f5595587a15 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 24 May 2024 18:36:16 +0200
-Subject: netkit: Fix setting mac address in l2 mode
-
-From: Daniel Borkmann <daniel@iogearbox.net>
-
-[ Upstream commit d6fe532b7499e4575f9647879b7a34625817fe7f ]
-
-When running Cilium connectivity test suite with netkit in L2 mode, we
-found that it is expected to be able to specify a custom MAC address for
-the devices, in particular, cilium-cni obtains the specified MAC address
-by querying the endpoint and sets the MAC address of the interface inside
-the Pod. Thus, fix the missing support in netkit for L2 mode.
-
-Fixes: 35dfaad7188c ("netkit, bpf: Add bpf programmable net device")
-Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
-Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
-Acked-by: Stanislav Fomichev <sdf@google.com>
-Link: https://lore.kernel.org/r/20240524163619.26001-1-daniel@iogearbox.net
-Signed-off-by: Alexei Starovoitov <ast@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/netkit.c | 26 +++++++++++++++++++++-----
- 1 file changed, 21 insertions(+), 5 deletions(-)
-
-diff --git a/drivers/net/netkit.c b/drivers/net/netkit.c
-index 39171380ccf29..c24aa9d93f9f6 100644
---- a/drivers/net/netkit.c
-+++ b/drivers/net/netkit.c
-@@ -155,6 +155,16 @@ static void netkit_set_multicast(struct net_device *dev)
- /* Nothing to do, we receive whatever gets pushed to us! */
- }
-
-+static int netkit_set_macaddr(struct net_device *dev, void *sa)
-+{
-+ struct netkit *nk = netkit_priv(dev);
-+
-+ if (nk->mode != NETKIT_L2)
-+ return -EOPNOTSUPP;
-+
-+ return eth_mac_addr(dev, sa);
-+}
-+
- static void netkit_set_headroom(struct net_device *dev, int headroom)
- {
- struct netkit *nk = netkit_priv(dev), *nk2;
-@@ -198,6 +208,7 @@ static const struct net_device_ops netkit_netdev_ops = {
- .ndo_start_xmit = netkit_xmit,
- .ndo_set_rx_mode = netkit_set_multicast,
- .ndo_set_rx_headroom = netkit_set_headroom,
-+ .ndo_set_mac_address = netkit_set_macaddr,
- .ndo_get_iflink = netkit_get_iflink,
- .ndo_get_peer_dev = netkit_peer_dev,
- .ndo_get_stats64 = netkit_get_stats,
-@@ -300,9 +311,11 @@ static int netkit_validate(struct nlattr *tb[], struct nlattr *data[],
-
- if (!attr)
- return 0;
-- NL_SET_ERR_MSG_ATTR(extack, attr,
-- "Setting Ethernet address is not supported");
-- return -EOPNOTSUPP;
-+ if (nla_len(attr) != ETH_ALEN)
-+ return -EINVAL;
-+ if (!is_valid_ether_addr(nla_data(attr)))
-+ return -EADDRNOTAVAIL;
-+ return 0;
- }
-
- static struct rtnl_link_ops netkit_link_ops;
-@@ -365,6 +378,9 @@ static int netkit_new_link(struct net *src_net, struct net_device *dev,
- strscpy(ifname, "nk%d", IFNAMSIZ);
- ifname_assign_type = NET_NAME_ENUM;
- }
-+ if (mode != NETKIT_L2 &&
-+ (tb[IFLA_ADDRESS] || tbp[IFLA_ADDRESS]))
-+ return -EOPNOTSUPP;
-
- net = rtnl_link_get_net(src_net, tbp);
- if (IS_ERR(net))
-@@ -379,7 +395,7 @@ static int netkit_new_link(struct net *src_net, struct net_device *dev,
-
- netif_inherit_tso_max(peer, dev);
-
-- if (mode == NETKIT_L2)
-+ if (mode == NETKIT_L2 && !(ifmp && tbp[IFLA_ADDRESS]))
- eth_hw_addr_random(peer);
- if (ifmp && dev->ifindex)
- peer->ifindex = ifmp->ifi_index;
-@@ -402,7 +418,7 @@ static int netkit_new_link(struct net *src_net, struct net_device *dev,
- if (err < 0)
- goto err_configure_peer;
-
-- if (mode == NETKIT_L2)
-+ if (mode == NETKIT_L2 && !tb[IFLA_ADDRESS])
- eth_hw_addr_random(dev);
- if (tb[IFLA_IFNAME])
- nla_strscpy(dev->name, tb[IFLA_IFNAME], IFNAMSIZ);
---
-2.43.0
-
+++ /dev/null
-From 2215752ca705a106b2a2654c6f8769920c95bff4 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 22 May 2024 00:34:42 +0900
-Subject: nfc: nci: Fix handling of zero-length payload packets in
- nci_rx_work()
-
-From: Ryosuke Yasuoka <ryasuoka@redhat.com>
-
-[ Upstream commit 6671e352497ca4bb07a96c48e03907065ff77d8a ]
-
-When nci_rx_work() receives a zero-length payload packet, it should not
-discard the packet and exit the loop. Instead, it should continue
-processing subsequent packets.
-
-Fixes: d24b03535e5e ("nfc: nci: Fix uninit-value in nci_dev_up and nci_ntf_packet")
-Signed-off-by: Ryosuke Yasuoka <ryasuoka@redhat.com>
-Reviewed-by: Simon Horman <horms@kernel.org>
-Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
-Link: https://lore.kernel.org/r/20240521153444.535399-1-ryasuoka@redhat.com
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- net/nfc/nci/core.c | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
-index 7a9897fbf4f41..f456a5911e7d1 100644
---- a/net/nfc/nci/core.c
-+++ b/net/nfc/nci/core.c
-@@ -1531,8 +1531,7 @@ static void nci_rx_work(struct work_struct *work)
-
- if (!nci_valid_size(skb)) {
- kfree_skb(skb);
-- kcov_remote_stop();
-- break;
-+ continue;
- }
-
- /* Process frame */
---
-2.43.0
-
+++ /dev/null
-From 89d64c667c594583d05337403cc0eb6f88716c0e Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sun, 19 May 2024 18:43:03 +0900
-Subject: nfc: nci: Fix uninit-value in nci_rx_work
-
-From: Ryosuke Yasuoka <ryasuoka@redhat.com>
-
-[ Upstream commit e4a87abf588536d1cdfb128595e6e680af5cf3ed ]
-
-syzbot reported the following uninit-value access issue [1]
-
-nci_rx_work() parses received packet from ndev->rx_q. It should be
-validated header size, payload size and total packet size before
-processing the packet. If an invalid packet is detected, it should be
-silently discarded.
-
-Fixes: d24b03535e5e ("nfc: nci: Fix uninit-value in nci_dev_up and nci_ntf_packet")
-Reported-and-tested-by: syzbot+d7b4dc6cd50410152534@syzkaller.appspotmail.com
-Closes: https://syzkaller.appspot.com/bug?extid=d7b4dc6cd50410152534 [1]
-Signed-off-by: Ryosuke Yasuoka <ryasuoka@redhat.com>
-Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- net/nfc/nci/core.c | 15 ++++++++++++++-
- 1 file changed, 14 insertions(+), 1 deletion(-)
-
-diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
-index b133dc55304ce..7a9897fbf4f41 100644
---- a/net/nfc/nci/core.c
-+++ b/net/nfc/nci/core.c
-@@ -1463,6 +1463,19 @@ int nci_core_ntf_packet(struct nci_dev *ndev, __u16 opcode,
- ndev->ops->n_core_ops);
- }
-
-+static bool nci_valid_size(struct sk_buff *skb)
-+{
-+ BUILD_BUG_ON(NCI_CTRL_HDR_SIZE != NCI_DATA_HDR_SIZE);
-+ unsigned int hdr_size = NCI_CTRL_HDR_SIZE;
-+
-+ if (skb->len < hdr_size ||
-+ !nci_plen(skb->data) ||
-+ skb->len < hdr_size + nci_plen(skb->data)) {
-+ return false;
-+ }
-+ return true;
-+}
-+
- /* ---- NCI TX Data worker thread ---- */
-
- static void nci_tx_work(struct work_struct *work)
-@@ -1516,7 +1529,7 @@ static void nci_rx_work(struct work_struct *work)
- nfc_send_to_raw_sock(ndev->nfc_dev, skb,
- RAW_PAYLOAD_NCI, NFC_DIRECTION_RX);
-
-- if (!nci_plen(skb->data)) {
-+ if (!nci_valid_size(skb)) {
- kfree_skb(skb);
- kcov_remote_stop();
- break;
---
-2.43.0
-
+++ /dev/null
-From 9e23bdfd981c4b0f9ee6dd3ad095c740e7de785b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sun, 14 Apr 2024 19:01:09 +0200
-Subject: nfs: keep server info for remounts
-
-From: Martin Kaiser <martin@kaiser.cx>
-
-[ Upstream commit b322bf9e983addedff0894c55e92d58f4d16d92a ]
-
-With newer kernels that use fs_context for nfs mounts, remounts fail with
--EINVAL.
-
-$ mount -t nfs -o nolock 10.0.0.1:/tmp/test /mnt/test/
-$ mount -t nfs -o remount /mnt/test/
-mount: mounting 10.0.0.1:/tmp/test on /mnt/test failed: Invalid argument
-
-For remounts, the nfs server address and port are populated by
-nfs_init_fs_context and later overwritten with 0x00 bytes by
-nfs23_parse_monolithic. The remount then fails as the server address is
-invalid.
-
-Fix this by not overwriting nfs server info in nfs23_parse_monolithic if
-we're doing a remount.
-
-Fixes: f2aedb713c28 ("NFS: Add fs_context support.")
-Signed-off-by: Martin Kaiser <martin@kaiser.cx>
-Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/nfs/fs_context.c | 9 ++++++---
- 1 file changed, 6 insertions(+), 3 deletions(-)
-
-diff --git a/fs/nfs/fs_context.c b/fs/nfs/fs_context.c
-index 853e8d609bb3b..41126d6dcd760 100644
---- a/fs/nfs/fs_context.c
-+++ b/fs/nfs/fs_context.c
-@@ -1111,9 +1111,12 @@ static int nfs23_parse_monolithic(struct fs_context *fc,
- ctx->acdirmax = data->acdirmax;
- ctx->need_mount = false;
-
-- memcpy(sap, &data->addr, sizeof(data->addr));
-- ctx->nfs_server.addrlen = sizeof(data->addr);
-- ctx->nfs_server.port = ntohs(data->addr.sin_port);
-+ if (!is_remount_fc(fc)) {
-+ memcpy(sap, &data->addr, sizeof(data->addr));
-+ ctx->nfs_server.addrlen = sizeof(data->addr);
-+ ctx->nfs_server.port = ntohs(data->addr.sin_port);
-+ }
-+
- if (sap->ss_family != AF_INET ||
- !nfs_verify_server_address(sap))
- goto out_no_address;
---
-2.43.0
-
+++ /dev/null
-From 83027d9215c4bc73f9ea3d0697cf755dc53a01fd Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 17 Apr 2024 14:49:29 -0400
-Subject: NFSv4: Fixup smatch warning for ambiguous return
-
-From: Benjamin Coddington <bcodding@redhat.com>
-
-[ Upstream commit 37ffe06537af3e3ec212e7cbe941046fce0a822f ]
-
-Dan Carpenter reports smatch warning for nfs4_try_migration() when a memory
-allocation failure results in a zero return value. In this case, a
-transient allocation failure error will likely be retried the next time the
-server responds with NFS4ERR_MOVED.
-
-We can fixup the smatch warning with a small refactor: attempt all three
-allocations before testing and returning on a failure.
-
-Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
-Fixes: c3ed222745d9 ("NFSv4: Fix free of uninitialized nfs4_label on referral lookup.")
-Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
-Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
-Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
-Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/nfs/nfs4state.c | 12 +++++-------
- 1 file changed, 5 insertions(+), 7 deletions(-)
-
-diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
-index 9a5d911a7edc7..c95c50328ced8 100644
---- a/fs/nfs/nfs4state.c
-+++ b/fs/nfs/nfs4state.c
-@@ -2117,6 +2117,7 @@ static int nfs4_try_migration(struct nfs_server *server, const struct cred *cred
- {
- struct nfs_client *clp = server->nfs_client;
- struct nfs4_fs_locations *locations = NULL;
-+ struct nfs_fattr *fattr;
- struct inode *inode;
- struct page *page;
- int status, result;
-@@ -2126,19 +2127,16 @@ static int nfs4_try_migration(struct nfs_server *server, const struct cred *cred
- (unsigned long long)server->fsid.minor,
- clp->cl_hostname);
-
-- result = 0;
- page = alloc_page(GFP_KERNEL);
- locations = kmalloc(sizeof(struct nfs4_fs_locations), GFP_KERNEL);
-- if (page == NULL || locations == NULL) {
-- dprintk("<-- %s: no memory\n", __func__);
-- goto out;
-- }
-- locations->fattr = nfs_alloc_fattr();
-- if (locations->fattr == NULL) {
-+ fattr = nfs_alloc_fattr();
-+ if (page == NULL || locations == NULL || fattr == NULL) {
- dprintk("<-- %s: no memory\n", __func__);
-+ result = 0;
- goto out;
- }
-
-+ locations->fattr = fattr;
- inode = d_inode(server->super->s_root);
- result = nfs4_proc_get_locations(server, NFS_FH(inode), locations,
- page, cred);
---
-2.43.0
-
+++ /dev/null
-From 121e12b326da13b8334c2d724c7c6a72a0dc20c5 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 30 Apr 2024 17:00:19 +0900
-Subject: nilfs2: make superblock data array index computation sparse friendly
-
-From: Ryusuke Konishi <konishi.ryusuke@gmail.com>
-
-[ Upstream commit 91d743a9c8299de1fc1b47428d8bb4c85face00f ]
-
-Upon running sparse, "warning: dubious: x & !y" is output at an array
-index calculation within nilfs_load_super_block().
-
-The calculation is not wrong, but to eliminate the sparse warning, replace
-it with an equivalent calculation.
-
-Also, add a comment to make it easier to understand what the unintuitive
-array index calculation is doing and whether it's correct.
-
-Link: https://lkml.kernel.org/r/20240430080019.4242-3-konishi.ryusuke@gmail.com
-Fixes: e339ad31f599 ("nilfs2: introduce secondary super block")
-Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
-Cc: Bart Van Assche <bvanassche@acm.org>
-Cc: Jens Axboe <axboe@kernel.dk>
-Cc: kernel test robot <lkp@intel.com>
-Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/nilfs2/the_nilfs.c | 20 ++++++++++++++++++--
- 1 file changed, 18 insertions(+), 2 deletions(-)
-
-diff --git a/fs/nilfs2/the_nilfs.c b/fs/nilfs2/the_nilfs.c
-index 71400496ed365..3e3c1d32da180 100644
---- a/fs/nilfs2/the_nilfs.c
-+++ b/fs/nilfs2/the_nilfs.c
-@@ -592,7 +592,7 @@ static int nilfs_load_super_block(struct the_nilfs *nilfs,
- struct nilfs_super_block **sbp = nilfs->ns_sbp;
- struct buffer_head **sbh = nilfs->ns_sbh;
- u64 sb2off, devsize = bdev_nr_bytes(nilfs->ns_bdev);
-- int valid[2], swp = 0;
-+ int valid[2], swp = 0, older;
-
- if (devsize < NILFS_SEG_MIN_BLOCKS * NILFS_MIN_BLOCK_SIZE + 4096) {
- nilfs_err(sb, "device size too small");
-@@ -648,9 +648,25 @@ static int nilfs_load_super_block(struct the_nilfs *nilfs,
- if (swp)
- nilfs_swap_super_block(nilfs);
-
-+ /*
-+ * Calculate the array index of the older superblock data.
-+ * If one has been dropped, set index 0 pointing to the remaining one,
-+ * otherwise set index 1 pointing to the old one (including if both
-+ * are the same).
-+ *
-+ * Divided case valid[0] valid[1] swp -> older
-+ * -------------------------------------------------------------
-+ * Both SBs are invalid 0 0 N/A (Error)
-+ * SB1 is invalid 0 1 1 0
-+ * SB2 is invalid 1 0 0 0
-+ * SB2 is newer 1 1 1 0
-+ * SB2 is older or the same 1 1 0 1
-+ */
-+ older = valid[1] ^ swp;
-+
- nilfs->ns_sbwcount = 0;
- nilfs->ns_sbwtime = le64_to_cpu(sbp[0]->s_wtime);
-- nilfs->ns_prot_seq = le64_to_cpu(sbp[valid[1] & !swp]->s_last_seq);
-+ nilfs->ns_prot_seq = le64_to_cpu(sbp[older]->s_last_seq);
- *sbpp = sbp[0];
- return 0;
- }
---
-2.43.0
-
+++ /dev/null
-From 250ed9b22073f96a51f442e705a7babde3997622 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 6 May 2024 09:55:38 +0200
-Subject: null_blk: Fix the WARNING: modpost: missing MODULE_DESCRIPTION()
-
-From: Zhu Yanjun <yanjun.zhu@linux.dev>
-
-[ Upstream commit 9e6727f824edcdb8fdd3e6e8a0862eb49546e1cd ]
-
-No functional changes intended.
-
-Fixes: f2298c0403b0 ("null_blk: multi queue aware block test driver")
-Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
-Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-Link: https://lore.kernel.org/r/20240506075538.6064-1-yanjun.zhu@linux.dev
-Signed-off-by: Jens Axboe <axboe@kernel.dk>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/block/null_blk/main.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
-index 3584f389b92ce..a8abca1b353c5 100644
---- a/drivers/block/null_blk/main.c
-+++ b/drivers/block/null_blk/main.c
-@@ -2380,4 +2380,5 @@ module_init(null_init);
- module_exit(null_exit);
-
- MODULE_AUTHOR("Jens Axboe <axboe@kernel.dk>");
-+MODULE_DESCRIPTION("multi queue aware block test driver");
- MODULE_LICENSE("GPL");
---
-2.43.0
-
+++ /dev/null
-From 0e289ded592da7a9cb906e578793fa7f1d9e2759 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 21 May 2024 09:50:47 -0700
-Subject: nvme: fix multipath batched completion accounting
-
-From: Keith Busch <kbusch@kernel.org>
-
-[ Upstream commit 2fe7b422460d14b33027d8770f7be8d26bcb2639 ]
-
-Batched completions were missing the io stats accounting and bio trace
-events. Move the common code to a helper and call it from the batched
-and non-batched functions.
-
-Fixes: d4d957b53d91ee ("nvme-multipath: support io stats on the mpath device")
-Reviewed-by: Christoph Hellwig <hch@lst.de>
-Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
-Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-Reviewed-by: Hannes Reinecke <hare@suse.de>
-Signed-off-by: Keith Busch <kbusch@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/nvme/host/core.c | 15 ++++++++++-----
- 1 file changed, 10 insertions(+), 5 deletions(-)
-
-diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
-index 3cc79817e4d75..fcf7ce19caea4 100644
---- a/drivers/nvme/host/core.c
-+++ b/drivers/nvme/host/core.c
-@@ -405,6 +405,14 @@ static inline void nvme_end_req_zoned(struct request *req)
- }
- }
-
-+static inline void __nvme_end_req(struct request *req)
-+{
-+ nvme_end_req_zoned(req);
-+ nvme_trace_bio_complete(req);
-+ if (req->cmd_flags & REQ_NVME_MPATH)
-+ nvme_mpath_end_request(req);
-+}
-+
- static inline void nvme_end_req(struct request *req)
- {
- blk_status_t status = nvme_error_status(nvme_req(req)->status);
-@@ -415,10 +423,7 @@ static inline void nvme_end_req(struct request *req)
- else
- nvme_log_error(req);
- }
-- nvme_end_req_zoned(req);
-- nvme_trace_bio_complete(req);
-- if (req->cmd_flags & REQ_NVME_MPATH)
-- nvme_mpath_end_request(req);
-+ __nvme_end_req(req);
- blk_mq_end_request(req, status);
- }
-
-@@ -467,7 +472,7 @@ void nvme_complete_batch_req(struct request *req)
- {
- trace_nvme_complete_rq(req);
- nvme_cleanup_cmd(req);
-- nvme_end_req_zoned(req);
-+ __nvme_end_req(req);
- }
- EXPORT_SYMBOL_GPL(nvme_complete_batch_req);
-
---
-2.43.0
-
+++ /dev/null
-From 619788938c94a974f09e449de3c639469d28a4a5 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 21 May 2024 11:02:28 -0700
-Subject: nvme-multipath: fix io accounting on failover
-
-From: Keith Busch <kbusch@kernel.org>
-
-[ Upstream commit a2e4c5f5f68dbd206f132bc709b98dea64afc3b8 ]
-
-There are io stats accounting that needs to be handled, so don't call
-blk_mq_end_request() directly. Use the existing nvme_end_req() helper
-that already handles everything.
-
-Fixes: d4d957b53d91ee ("nvme-multipath: support io stats on the mpath device")
-Reviewed-by: Christoph Hellwig <hch@lst.de>
-Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
-Signed-off-by: Keith Busch <kbusch@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/nvme/host/core.c | 2 +-
- drivers/nvme/host/multipath.c | 3 ++-
- drivers/nvme/host/nvme.h | 1 +
- 3 files changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
-index fcf7ce19caea4..2f51c4a978589 100644
---- a/drivers/nvme/host/core.c
-+++ b/drivers/nvme/host/core.c
-@@ -413,7 +413,7 @@ static inline void __nvme_end_req(struct request *req)
- nvme_mpath_end_request(req);
- }
-
--static inline void nvme_end_req(struct request *req)
-+void nvme_end_req(struct request *req)
- {
- blk_status_t status = nvme_error_status(nvme_req(req)->status);
-
-diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c
-index 75386d3e0f981..e157c7983d466 100644
---- a/drivers/nvme/host/multipath.c
-+++ b/drivers/nvme/host/multipath.c
-@@ -118,7 +118,8 @@ void nvme_failover_req(struct request *req)
- blk_steal_bios(&ns->head->requeue_list, req);
- spin_unlock_irqrestore(&ns->head->requeue_lock, flags);
-
-- blk_mq_end_request(req, 0);
-+ nvme_req(req)->status = 0;
-+ nvme_end_req(req);
- kblockd_schedule_work(&ns->head->requeue_work);
- }
-
-diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
-index 2a7bf574284f6..05d807fa0d3da 100644
---- a/drivers/nvme/host/nvme.h
-+++ b/drivers/nvme/host/nvme.h
-@@ -766,6 +766,7 @@ static inline bool nvme_state_terminal(struct nvme_ctrl *ctrl)
- }
- }
-
-+void nvme_end_req(struct request *req);
- void nvme_complete_rq(struct request *req);
- void nvme_complete_batch_req(struct request *req);
-
---
-2.43.0
-
+++ /dev/null
-From 6e2dbfc93c551596374d4a9b5b70493e11ee2f28 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 21 May 2024 23:20:28 +0300
-Subject: nvmet: fix ns enable/disable possible hang
-
-From: Sagi Grimberg <sagi@grimberg.me>
-
-[ Upstream commit f97914e35fd98b2b18fb8a092e0a0799f73afdfe ]
-
-When disabling an nvmet namespace, there is a period where the
-subsys->lock is released, as the ns disable waits for backend IO to
-complete, and the ns percpu ref to be properly killed. The original
-intent was to avoid taking the subsystem lock for a prolong period as
-other processes may need to acquire it (for example new incoming
-connections).
-
-However, it opens up a window where another process may come in and
-enable the ns, (re)intiailizing the ns percpu_ref, causing the disable
-sequence to hang.
-
-Solve this by taking the global nvmet_config_sem over the entire configfs
-enable/disable sequence.
-
-Fixes: a07b4970f464 ("nvmet: add a generic NVMe target")
-Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
-Reviewed-by: Christoph Hellwig <hch@lst.de>
-Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-Signed-off-by: Keith Busch <kbusch@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/nvme/target/configfs.c | 8 ++++++++
- 1 file changed, 8 insertions(+)
-
-diff --git a/drivers/nvme/target/configfs.c b/drivers/nvme/target/configfs.c
-index 3ef6bc655661d..303b49c604bd7 100644
---- a/drivers/nvme/target/configfs.c
-+++ b/drivers/nvme/target/configfs.c
-@@ -650,10 +650,18 @@ static ssize_t nvmet_ns_enable_store(struct config_item *item,
- if (kstrtobool(page, &enable))
- return -EINVAL;
-
-+ /*
-+ * take a global nvmet_config_sem because the disable routine has a
-+ * window where it releases the subsys-lock, giving a chance to
-+ * a parallel enable to concurrently execute causing the disable to
-+ * have a misaccounting of the ns percpu_ref.
-+ */
-+ down_write(&nvmet_config_sem);
- if (enable)
- ret = nvmet_ns_enable(ns);
- else
- nvmet_ns_disable(ns);
-+ up_write(&nvmet_config_sem);
-
- return ret ? ret : count;
- }
---
-2.43.0
-
+++ /dev/null
-From dad40c052583e2678e701a557d0983541efeb7b8 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 23 May 2024 13:06:26 +0530
-Subject: Octeontx2-pf: Free send queue buffers incase of leaf to inner
-
-From: Hariprasad Kelam <hkelam@marvell.com>
-
-[ Upstream commit 1684842147677a1279bcff95f8adb6de9a656e30 ]
-
-There are two type of classes. "Leaf classes" that are the
-bottom of the class hierarchy. "Inner classes" that are neither
-the root class nor leaf classes. QoS rules can only specify leaf
-classes as targets for traffic.
-
- Root
- / \
- / \
- 1 2
- /\
- / \
- 4 5
- classes 1,4 and 5 are leaf classes.
- class 2 is a inner class.
-
-When a leaf class made as inner, or vice versa, resources associated
-with send queue (send queue buffers and transmit schedulers) are not
-getting freed.
-
-Fixes: 5e6808b4c68d ("octeontx2-pf: Add support for HTB offload")
-Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
-Link: https://lore.kernel.org/r/20240523073626.4114-1-hkelam@marvell.com
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/ethernet/marvell/octeontx2/nic/qos.c | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/qos.c b/drivers/net/ethernet/marvell/octeontx2/nic/qos.c
-index 1723e9912ae07..6cddb4da85b71 100644
---- a/drivers/net/ethernet/marvell/octeontx2/nic/qos.c
-+++ b/drivers/net/ethernet/marvell/octeontx2/nic/qos.c
-@@ -1407,7 +1407,10 @@ static int otx2_qos_leaf_to_inner(struct otx2_nic *pfvf, u16 classid,
- otx2_qos_read_txschq_cfg(pfvf, node, old_cfg);
-
- /* delete the txschq nodes allocated for this node */
-+ otx2_qos_disable_sq(pfvf, qid);
-+ otx2_qos_free_hw_node_schq(pfvf, node);
- otx2_qos_free_sw_node_schq(pfvf, node);
-+ pfvf->qos.qid_to_sqmap[qid] = OTX2_QOS_INVALID_SQ;
-
- /* mark this node as htb inner node */
- WRITE_ONCE(node->qid, OTX2_QOS_QID_INNER);
-@@ -1554,6 +1557,7 @@ static int otx2_qos_leaf_del_last(struct otx2_nic *pfvf, u16 classid, bool force
- dwrr_del_node = true;
-
- /* destroy the leaf node */
-+ otx2_qos_disable_sq(pfvf, qid);
- otx2_qos_destroy_node(pfvf, node);
- pfvf->qos.qid_to_sqmap[qid] = OTX2_QOS_INVALID_SQ;
-
---
-2.43.0
-
+++ /dev/null
-From aa458d3813d440345a68a324aef3fe09906378ea Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 16 May 2024 16:09:41 -0400
-Subject: openvswitch: Set the skbuff pkt_type for proper pmtud support.
-
-From: Aaron Conole <aconole@redhat.com>
-
-[ Upstream commit 30a92c9e3d6b073932762bef2ac66f4ee784c657 ]
-
-Open vSwitch is originally intended to switch at layer 2, only dealing with
-Ethernet frames. With the introduction of l3 tunnels support, it crossed
-into the realm of needing to care a bit about some routing details when
-making forwarding decisions. If an oversized packet would need to be
-fragmented during this forwarding decision, there is a chance for pmtu
-to get involved and generate a routing exception. This is gated by the
-skbuff->pkt_type field.
-
-When a flow is already loaded into the openvswitch module this field is
-set up and transitioned properly as a packet moves from one port to
-another. In the case that a packet execute is invoked after a flow is
-newly installed this field is not properly initialized. This causes the
-pmtud mechanism to omit sending the required exception messages across
-the tunnel boundary and a second attempt needs to be made to make sure
-that the routing exception is properly setup. To fix this, we set the
-outgoing packet's pkt_type to PACKET_OUTGOING, since it can only get
-to the openvswitch module via a port device or packet command.
-
-Even for bridge ports as users, the pkt_type needs to be reset when
-doing the transmit as the packet is truly outgoing and routing needs
-to get involved post packet transformations, in the case of
-VXLAN/GENEVE/udp-tunnel packets. In general, the pkt_type on output
-gets ignored, since we go straight to the driver, but in the case of
-tunnel ports they go through IP routing layer.
-
-This issue is periodically encountered in complex setups, such as large
-openshift deployments, where multiple sets of tunnel traversal occurs.
-A way to recreate this is with the ovn-heater project that can setup
-a networking environment which mimics such large deployments. We need
-larger environments for this because we need to ensure that flow
-misses occur. In these environment, without this patch, we can see:
-
- ./ovn_cluster.sh start
- podman exec ovn-chassis-1 ip r a 170.168.0.5/32 dev eth1 mtu 1200
- podman exec ovn-chassis-1 ip netns exec sw01p1 ip r flush cache
- podman exec ovn-chassis-1 ip netns exec sw01p1 \
- ping 21.0.0.3 -M do -s 1300 -c2
- PING 21.0.0.3 (21.0.0.3) 1300(1328) bytes of data.
- From 21.0.0.3 icmp_seq=2 Frag needed and DF set (mtu = 1142)
-
- --- 21.0.0.3 ping statistics ---
- ...
-
-Using tcpdump, we can also see the expected ICMP FRAG_NEEDED message is not
-sent into the server.
-
-With this patch, setting the pkt_type, we see the following:
-
- podman exec ovn-chassis-1 ip netns exec sw01p1 \
- ping 21.0.0.3 -M do -s 1300 -c2
- PING 21.0.0.3 (21.0.0.3) 1300(1328) bytes of data.
- From 21.0.0.3 icmp_seq=1 Frag needed and DF set (mtu = 1222)
- ping: local error: message too long, mtu=1222
-
- --- 21.0.0.3 ping statistics ---
- ...
-
-In this case, the first ping request receives the FRAG_NEEDED message and
-a local routing exception is created.
-
-Tested-by: Jaime Caamano <jcaamano@redhat.com>
-Reported-at: https://issues.redhat.com/browse/FDP-164
-Fixes: 58264848a5a7 ("openvswitch: Add vxlan tunneling support.")
-Signed-off-by: Aaron Conole <aconole@redhat.com>
-Acked-by: Eelco Chaudron <echaudro@redhat.com>
-Link: https://lore.kernel.org/r/20240516200941.16152-1-aconole@redhat.com
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- net/openvswitch/actions.c | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
-index 6fcd7e2ca81fe..9642255808247 100644
---- a/net/openvswitch/actions.c
-+++ b/net/openvswitch/actions.c
-@@ -936,6 +936,12 @@ static void do_output(struct datapath *dp, struct sk_buff *skb, int out_port,
- pskb_trim(skb, ovs_mac_header_len(key));
- }
-
-+ /* Need to set the pkt_type to involve the routing layer. The
-+ * packet movement through the OVS datapath doesn't generally
-+ * use routing, but this is needed for tunnel cases.
-+ */
-+ skb->pkt_type = PACKET_OUTGOING;
-+
- if (likely(!mru ||
- (skb->len <= mru + vport->dev->hard_header_len))) {
- ovs_vport_send(vport, skb, ovs_key_mac_proto(key));
---
-2.43.0
-
+++ /dev/null
-From f2c45ef6fc02ff1a29e22e9b516429f42b6d912d Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 2 May 2024 20:35:57 +0200
-Subject: ovl: remove upper umask handling from ovl_create_upper()
-
-From: Miklos Szeredi <mszeredi@redhat.com>
-
-[ Upstream commit 096802748ea1dea8b476938e0a8dc16f4bd2f1ad ]
-
-This is already done by vfs_prepare_mode() when creating the upper object
-by vfs_create(), vfs_mkdir() and vfs_mknod().
-
-No regressions have been observed in xfstests run with posix acls turned
-off for the upper filesystem.
-
-Fixes: 1639a49ccdce ("fs: move S_ISGID stripping into the vfs_*() helpers")
-Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/overlayfs/dir.c | 3 ---
- 1 file changed, 3 deletions(-)
-
-diff --git a/fs/overlayfs/dir.c b/fs/overlayfs/dir.c
-index 0f8b4a719237c..02d89a285d0dc 100644
---- a/fs/overlayfs/dir.c
-+++ b/fs/overlayfs/dir.c
-@@ -327,9 +327,6 @@ static int ovl_create_upper(struct dentry *dentry, struct inode *inode,
- struct dentry *newdentry;
- int err;
-
-- if (!attr->hardlink && !IS_POSIXACL(udir))
-- attr->mode &= ~current_umask();
--
- inode_lock_nested(udir, I_MUTEX_PARENT);
- newdentry = ovl_create_real(ofs, udir,
- ovl_lookup_upper(ofs, dentry->d_name.name,
---
-2.43.0
-
+++ /dev/null
-From 44a4af5695db7fba68f7abae5696b40633831a69 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 27 Mar 2024 14:43:30 +0530
-Subject: PCI: dwc: ep: Fix DBI access failure for drivers requiring refclk
- from host
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-
-[ Upstream commit 869bc52534065990cb57013b2bb354c0c1e66c5c ]
-
-The DWC glue drivers requiring an active reference clock from the PCIe host
-for initializing their PCIe EP core, set a flag called 'core_init_notifier'
-to let DWC driver know that these drivers need a special attention during
-initialization. In these drivers, access to the hw registers (like DBI)
-before receiving the active refclk from host will result in access failure
-and also could cause a whole system hang.
-
-But the current DWC EP driver doesn't honor the requirements of the drivers
-setting 'core_init_notifier' flag and tries to access the DBI registers
-during dw_pcie_ep_init(). This causes the system hang for glue drivers such
-as Tegra194 and Qcom EP as they depend on refclk from host and have set the
-above mentioned flag.
-
-To workaround this issue, users of the affected platforms have to maintain
-the dependency with the PCIe host by booting the PCIe EP after host boot.
-But this won't provide a good user experience, since PCIe EP is _one_ of
-the features of those platforms and it doesn't make sense to delay the
-whole platform booting due to PCIe requiring active refclk.
-
-So to fix this issue, let's move all the DBI access from
-dw_pcie_ep_init() in the DWC EP driver to the dw_pcie_ep_init_complete()
-API. This API will only be called by the drivers setting
-'core_init_notifier' flag once refclk is received from host. For the rest
-of the drivers that gets the refclk locally, this API will be called
-within dw_pcie_ep_init().
-
-Link: https://lore.kernel.org/linux-pci/20240327-pci-dbi-rework-v12-1-082625472414@linaro.org
-Fixes: e966f7390da9 ("PCI: dwc: Refactor core initialization code for EP mode")
-Co-developed-by: Vidya Sagar <vidyas@nvidia.com>
-Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
-Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
-Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
-Reviewed-by: Frank Li <Frank.Li@nxp.com>
-Reviewed-by: Niklas Cassel <cassel@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- .../pci/controller/dwc/pcie-designware-ep.c | 120 +++++++++++-------
- 1 file changed, 71 insertions(+), 49 deletions(-)
-
-diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c
-index 746a11dcb67f1..c43a1479de2ce 100644
---- a/drivers/pci/controller/dwc/pcie-designware-ep.c
-+++ b/drivers/pci/controller/dwc/pcie-designware-ep.c
-@@ -604,11 +604,16 @@ static unsigned int dw_pcie_ep_find_ext_capability(struct dw_pcie *pci, int cap)
- int dw_pcie_ep_init_complete(struct dw_pcie_ep *ep)
- {
- struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
-+ struct dw_pcie_ep_func *ep_func;
-+ struct device *dev = pci->dev;
-+ struct pci_epc *epc = ep->epc;
- unsigned int offset, ptm_cap_base;
- unsigned int nbars;
- u8 hdr_type;
-+ u8 func_no;
-+ int i, ret;
-+ void *addr;
- u32 reg;
-- int i;
-
- hdr_type = dw_pcie_readb_dbi(pci, PCI_HEADER_TYPE) &
- PCI_HEADER_TYPE_MASK;
-@@ -619,6 +624,58 @@ int dw_pcie_ep_init_complete(struct dw_pcie_ep *ep)
- return -EIO;
- }
-
-+ dw_pcie_version_detect(pci);
-+
-+ dw_pcie_iatu_detect(pci);
-+
-+ ret = dw_pcie_edma_detect(pci);
-+ if (ret)
-+ return ret;
-+
-+ if (!ep->ib_window_map) {
-+ ep->ib_window_map = devm_bitmap_zalloc(dev, pci->num_ib_windows,
-+ GFP_KERNEL);
-+ if (!ep->ib_window_map)
-+ goto err_remove_edma;
-+ }
-+
-+ if (!ep->ob_window_map) {
-+ ep->ob_window_map = devm_bitmap_zalloc(dev, pci->num_ob_windows,
-+ GFP_KERNEL);
-+ if (!ep->ob_window_map)
-+ goto err_remove_edma;
-+ }
-+
-+ if (!ep->outbound_addr) {
-+ addr = devm_kcalloc(dev, pci->num_ob_windows, sizeof(phys_addr_t),
-+ GFP_KERNEL);
-+ if (!addr)
-+ goto err_remove_edma;
-+ ep->outbound_addr = addr;
-+ }
-+
-+ for (func_no = 0; func_no < epc->max_functions; func_no++) {
-+
-+ ep_func = dw_pcie_ep_get_func_from_ep(ep, func_no);
-+ if (ep_func)
-+ continue;
-+
-+ ep_func = devm_kzalloc(dev, sizeof(*ep_func), GFP_KERNEL);
-+ if (!ep_func)
-+ goto err_remove_edma;
-+
-+ ep_func->func_no = func_no;
-+ ep_func->msi_cap = dw_pcie_ep_find_capability(ep, func_no,
-+ PCI_CAP_ID_MSI);
-+ ep_func->msix_cap = dw_pcie_ep_find_capability(ep, func_no,
-+ PCI_CAP_ID_MSIX);
-+
-+ list_add_tail(&ep_func->list, &ep->func_list);
-+ }
-+
-+ if (ep->ops->init)
-+ ep->ops->init(ep);
-+
- offset = dw_pcie_ep_find_ext_capability(pci, PCI_EXT_CAP_ID_REBAR);
- ptm_cap_base = dw_pcie_ep_find_ext_capability(pci, PCI_EXT_CAP_ID_PTM);
-
-@@ -658,14 +715,17 @@ int dw_pcie_ep_init_complete(struct dw_pcie_ep *ep)
- dw_pcie_dbi_ro_wr_dis(pci);
-
- return 0;
-+
-+err_remove_edma:
-+ dw_pcie_edma_remove(pci);
-+
-+ return ret;
- }
- EXPORT_SYMBOL_GPL(dw_pcie_ep_init_complete);
-
- int dw_pcie_ep_init(struct dw_pcie_ep *ep)
- {
- int ret;
-- void *addr;
-- u8 func_no;
- struct resource *res;
- struct pci_epc *epc;
- struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
-@@ -673,7 +733,6 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep)
- struct platform_device *pdev = to_platform_device(dev);
- struct device_node *np = dev->of_node;
- const struct pci_epc_features *epc_features;
-- struct dw_pcie_ep_func *ep_func;
-
- INIT_LIST_HEAD(&ep->func_list);
-
-@@ -691,26 +750,6 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep)
- if (ep->ops->pre_init)
- ep->ops->pre_init(ep);
-
-- dw_pcie_version_detect(pci);
--
-- dw_pcie_iatu_detect(pci);
--
-- ep->ib_window_map = devm_bitmap_zalloc(dev, pci->num_ib_windows,
-- GFP_KERNEL);
-- if (!ep->ib_window_map)
-- return -ENOMEM;
--
-- ep->ob_window_map = devm_bitmap_zalloc(dev, pci->num_ob_windows,
-- GFP_KERNEL);
-- if (!ep->ob_window_map)
-- return -ENOMEM;
--
-- addr = devm_kcalloc(dev, pci->num_ob_windows, sizeof(phys_addr_t),
-- GFP_KERNEL);
-- if (!addr)
-- return -ENOMEM;
-- ep->outbound_addr = addr;
--
- epc = devm_pci_epc_create(dev, &epc_ops);
- if (IS_ERR(epc)) {
- dev_err(dev, "Failed to create epc device\n");
-@@ -724,23 +763,6 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep)
- if (ret < 0)
- epc->max_functions = 1;
-
-- for (func_no = 0; func_no < epc->max_functions; func_no++) {
-- ep_func = devm_kzalloc(dev, sizeof(*ep_func), GFP_KERNEL);
-- if (!ep_func)
-- return -ENOMEM;
--
-- ep_func->func_no = func_no;
-- ep_func->msi_cap = dw_pcie_ep_find_capability(ep, func_no,
-- PCI_CAP_ID_MSI);
-- ep_func->msix_cap = dw_pcie_ep_find_capability(ep, func_no,
-- PCI_CAP_ID_MSIX);
--
-- list_add_tail(&ep_func->list, &ep->func_list);
-- }
--
-- if (ep->ops->init)
-- ep->ops->init(ep);
--
- ret = pci_epc_mem_init(epc, ep->phys_base, ep->addr_size,
- ep->page_size);
- if (ret < 0) {
-@@ -756,25 +778,25 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep)
- goto err_exit_epc_mem;
- }
-
-- ret = dw_pcie_edma_detect(pci);
-- if (ret)
-- goto err_free_epc_mem;
--
- if (ep->ops->get_features) {
- epc_features = ep->ops->get_features(ep);
- if (epc_features->core_init_notifier)
- return 0;
- }
-
-+ /*
-+ * NOTE:- Avoid accessing the hardware (Ex:- DBI space) before this
-+ * step as platforms that implement 'core_init_notifier' feature may
-+ * not have the hardware ready (i.e. core initialized) for access
-+ * (Ex: tegra194). Any hardware access on such platforms result
-+ * in system hang.
-+ */
- ret = dw_pcie_ep_init_complete(ep);
- if (ret)
-- goto err_remove_edma;
-+ goto err_free_epc_mem;
-
- return 0;
-
--err_remove_edma:
-- dw_pcie_edma_remove(pci);
--
- err_free_epc_mem:
- pci_epc_mem_free_addr(epc, ep->msi_mem_phys, ep->msi_mem,
- epc->mem->window.page_size);
---
-2.43.0
-
+++ /dev/null
-From 3bc5142d992b95d86a9a42bfdea0b52f3ca7a873 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 1 May 2024 02:25:43 +0000
-Subject: PCI/EDR: Align EDR_PORT_DPC_ENABLE_DSM with PCI Firmware r3.3
-
-From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
-
-[ Upstream commit f24ba846133d0edec785ac6430d4daf6e9c93a09 ]
-
-The "Downstream Port Containment related Enhancements" ECN of Jan 28, 2019
-(document 12888 below), defined the EDR_PORT_DPC_ENABLE_DSM function with
-Revision ID 5 with Arg3 being an integer. But when the ECN was integrated
-into PCI Firmware r3.3, sec 4.6.12, it was defined as Revision ID 6 with
-Arg3 being a package containing an integer.
-
-The implementation in acpi_enable_dpc() supplies a package as Arg3 (arg4 in
-the code), but it previously specified Revision ID 5. Align this with PCI
-Firmware r3.3 by using Revision ID 6.
-
-If firmware implemented per the ECN, its Revision 5 function would receive
-a package as Arg3 when it expects an integer, so acpi_enable_dpc() would
-likely fail. If such firmware exists and lacks a Revision 6 function that
-expects a package, we may have to add support for Revision 5.
-
-Link: https://lore.kernel.org/r/20240501022543.1626025-1-sathyanarayanan.kuppuswamy@linux.intel.com
-Link: https://members.pcisig.com/wg/PCI-SIG/document/12888
-Fixes: ac1c8e35a326 ("PCI/DPC: Add Error Disconnect Recover (EDR) support")
-Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
-[bhelgaas: split into two patches, update commit log]
-Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-Tested-by: Satish Thatchanamurthy <Satish.Thatchanamurt@Dell.com> # one platform
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/pci/pcie/edr.c | 13 ++++---------
- 1 file changed, 4 insertions(+), 9 deletions(-)
-
-diff --git a/drivers/pci/pcie/edr.c b/drivers/pci/pcie/edr.c
-index 5f4914d313a17..fa085677c91de 100644
---- a/drivers/pci/pcie/edr.c
-+++ b/drivers/pci/pcie/edr.c
-@@ -32,10 +32,10 @@ static int acpi_enable_dpc(struct pci_dev *pdev)
- int status = 0;
-
- /*
-- * Behavior when calling unsupported _DSM functions is undefined,
-- * so check whether EDR_PORT_DPC_ENABLE_DSM is supported.
-+ * Per PCI Firmware r3.3, sec 4.6.12, EDR_PORT_DPC_ENABLE_DSM is
-+ * optional. Return success if it's not implemented.
- */
-- if (!acpi_check_dsm(adev->handle, &pci_acpi_dsm_guid, 5,
-+ if (!acpi_check_dsm(adev->handle, &pci_acpi_dsm_guid, 6,
- 1ULL << EDR_PORT_DPC_ENABLE_DSM))
- return 0;
-
-@@ -46,12 +46,7 @@ static int acpi_enable_dpc(struct pci_dev *pdev)
- argv4.package.count = 1;
- argv4.package.elements = &req;
-
-- /*
-- * Per Downstream Port Containment Related Enhancements ECN to PCI
-- * Firmware Specification r3.2, sec 4.6.12, EDR_PORT_DPC_ENABLE_DSM is
-- * optional. Return success if it's not implemented.
-- */
-- obj = acpi_evaluate_dsm(adev->handle, &pci_acpi_dsm_guid, 5,
-+ obj = acpi_evaluate_dsm(adev->handle, &pci_acpi_dsm_guid, 6,
- EDR_PORT_DPC_ENABLE_DSM, &argv4);
- if (!obj)
- return 0;
---
-2.43.0
-
+++ /dev/null
-From 083fa6ca6946f107b0f13ba3a5ac2a3833249e11 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 8 May 2024 14:31:38 -0500
-Subject: PCI/EDR: Align EDR_PORT_LOCATE_DSM with PCI Firmware r3.3
-
-From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
-
-[ Upstream commit e2e78a294a8a863898b781dbcf90e087eda3155d ]
-
-The "Downstream Port Containment related Enhancements" ECN of Jan 28, 2019
-(document 12888 below), defined the EDR_PORT_LOCATE_DSM function with
-Revision ID 5 with a return value encoding (Bits 2:0 = Function, Bits 7:3 =
-Device, Bits 15:8 = Bus). When the ECN was integrated into PCI Firmware
-r3.3, sec 4.6.13, Bit 31 was added to indicate success or failure.
-
-Check Bit 31 for failure in acpi_dpc_port_get().
-
-Link: https://lore.kernel.org/r/20240501022543.1626025-1-sathyanarayanan.kuppuswamy@linux.intel.com
-Link: https://members.pcisig.com/wg/PCI-SIG/document/12888
-Fixes: ac1c8e35a326 ("PCI/DPC: Add Error Disconnect Recover (EDR) support")
-Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
-[bhelgaas: split into two patches, update commit log]
-Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-Tested-by: Satish Thatchanamurthy <Satish.Thatchanamurt@Dell.com> # one platform
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/pci/pcie/edr.c | 15 +++++++++++++--
- 1 file changed, 13 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/pci/pcie/edr.c b/drivers/pci/pcie/edr.c
-index fa085677c91de..e86298dbbcff6 100644
---- a/drivers/pci/pcie/edr.c
-+++ b/drivers/pci/pcie/edr.c
-@@ -80,8 +80,9 @@ static struct pci_dev *acpi_dpc_port_get(struct pci_dev *pdev)
- u16 port;
-
- /*
-- * Behavior when calling unsupported _DSM functions is undefined,
-- * so check whether EDR_PORT_DPC_ENABLE_DSM is supported.
-+ * If EDR_PORT_LOCATE_DSM is not implemented under the target of
-+ * EDR, the target is the port that experienced the containment
-+ * event (PCI Firmware r3.3, sec 4.6.13).
- */
- if (!acpi_check_dsm(adev->handle, &pci_acpi_dsm_guid, 5,
- 1ULL << EDR_PORT_LOCATE_DSM))
-@@ -98,6 +99,16 @@ static struct pci_dev *acpi_dpc_port_get(struct pci_dev *pdev)
- return NULL;
- }
-
-+ /*
-+ * Bit 31 represents the success/failure of the operation. If bit
-+ * 31 is set, the operation failed.
-+ */
-+ if (obj->integer.value & BIT(31)) {
-+ ACPI_FREE(obj);
-+ pci_err(pdev, "Locate Port _DSM failed\n");
-+ return NULL;
-+ }
-+
- /*
- * Firmware returns DPC port BDF details in following format:
- * 15:8 = bus
---
-2.43.0
-
+++ /dev/null
-From 6143810f5df627b5ca920daa6fbb8ec16f313da0 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sun, 3 Mar 2024 18:57:29 +0800
-Subject: PCI: of_property: Return error for int_map allocation failure
-
-From: Duoming Zhou <duoming@zju.edu.cn>
-
-[ Upstream commit e6f7d27df5d208b50cae817a91d128fb434bb12c ]
-
-Return -ENOMEM from of_pci_prop_intr_map() if kcalloc() fails to prevent a
-NULL pointer dereference in this case.
-
-Fixes: 407d1a51921e ("PCI: Create device tree node for bridge")
-Link: https://lore.kernel.org/r/20240303105729.78624-1-duoming@zju.edu.cn
-Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
-[bhelgaas: commit log]
-Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/pci/of_property.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/drivers/pci/of_property.c b/drivers/pci/of_property.c
-index c2c7334152bc0..03539e5053720 100644
---- a/drivers/pci/of_property.c
-+++ b/drivers/pci/of_property.c
-@@ -238,6 +238,8 @@ static int of_pci_prop_intr_map(struct pci_dev *pdev, struct of_changeset *ocs,
- return 0;
-
- int_map = kcalloc(map_sz, sizeof(u32), GFP_KERNEL);
-+ if (!int_map)
-+ return -ENOMEM;
- mapp = int_map;
-
- list_for_each_entry(child, &pdev->subordinate->devices, bus_list) {
---
-2.43.0
-
+++ /dev/null
-From 46d7b00e302489f8c7369ad768e81b709db14e27 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 8 Apr 2024 15:00:53 +0530
-Subject: PCI: tegra194: Fix probe path for Endpoint mode
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Vidya Sagar <vidyas@nvidia.com>
-
-[ Upstream commit 19326006a21da26532d982254677c892dae8f29b ]
-
-Tegra194 PCIe probe path is taking failure path in success case for
-Endpoint mode. Return success from the switch case instead of going
-into the failure path.
-
-Fixes: c57247f940e8 ("PCI: tegra: Add support for PCIe endpoint mode in Tegra194")
-Link: https://lore.kernel.org/linux-pci/20240408093053.3948634-1-vidyas@nvidia.com
-Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
-Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
-Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/pci/controller/dwc/pcie-tegra194.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c
-index 7afa9e9aabe21..2349e284f6e8f 100644
---- a/drivers/pci/controller/dwc/pcie-tegra194.c
-+++ b/drivers/pci/controller/dwc/pcie-tegra194.c
-@@ -2269,11 +2269,14 @@ static int tegra_pcie_dw_probe(struct platform_device *pdev)
- ret = tegra_pcie_config_ep(pcie, pdev);
- if (ret < 0)
- goto fail;
-+ else
-+ return 0;
- break;
-
- default:
- dev_err(dev, "Invalid PCIe device type %d\n",
- pcie->of_data->mode);
-+ ret = -EINVAL;
- }
-
- fail:
---
-2.43.0
-
+++ /dev/null
-From 5ac606f92c1a62ae506cf075f8799712bc46cc19 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 23 Apr 2024 16:08:19 +0300
-Subject: PCI: Wait for Link Training==0 before starting Link retrain
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
-
-[ Upstream commit 73cb3a35f94db723c0211ad099bce55b2155e3f0 ]
-
-Two changes were made in link retraining logic independent of each other.
-
-The commit e7e39756363a ("PCI/ASPM: Avoid link retraining race") added a
-check to pcie_retrain_link() to ensure no Link Training is currently active
-to address the Implementation Note in PCIe r6.1 sec 7.5.3.7. At that time
-pcie_wait_for_retrain() only checked for the Link Training (LT) bit being
-cleared.
-
-The commit 680e9c47a229 ("PCI: Add support for polling DLLLA to
-pcie_retrain_link()") generalized pcie_wait_for_retrain() into
-pcie_wait_for_link_status() which can wait either for LT or the Data Link
-Layer Link Active (DLLLA) bit with 'use_lt' argument and supporting waiting
-for either cleared or set using 'active' argument.
-
-In the merge commit 1abb47390350 ("Merge branch 'pci/enumeration'"), those
-two divergent branches converged. The merge changed LT bit checking added
-in the commit e7e39756363a ("PCI/ASPM: Avoid link retraining race") to now
-wait for completion of any ongoing Link Training using DLLLA bit being set
-if 'use_lt' is false.
-
-When 'use_lt' is false, the pseudo-code steps of what occurs in
-pcie_retrain_link():
-
- 1. Wait for DLLLA==1
- 2. Trigger link to retrain
- 3. Wait for DLLLA==1
-
-Step 3 waits for the link to come up from the retraining triggered by Step
-2. As Step 1 is supposed to wait for any ongoing retraining to end, using
-DLLLA also for it does not make sense because link training being active is
-still indicated using LT bit, not with DLLLA.
-
-Correct the pcie_wait_for_link_status() parameters in Step 1 to only wait
-for LT==0 to ensure there is no ongoing Link Training.
-
-This only impacts the Target Speed quirk, which is the only case where
-waiting for DLLLA bit is used. It currently works in the problematic case
-by means of link training getting initiated by hardware repeatedly and
-respecting the new link parameters set by the caller, which then make
-training succeed and bring the link up, setting DLLLA and causing
-pcie_wait_for_link_status() to return success. We are not supposed to rely
-on luck and need to make sure that LT transitioned through the inactive
-state though before we initiate link training by hand via RL (Retrain Link)
-bit.
-
-Fixes: 1abb47390350 ("Merge branch 'pci/enumeration'")
-Link: https://lore.kernel.org/r/20240423130820.43824-1-ilpo.jarvinen@linux.intel.com
-Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
-Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/pci/pci.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
-index c3585229c12a2..12dc5bfb87088 100644
---- a/drivers/pci/pci.c
-+++ b/drivers/pci/pci.c
-@@ -5049,7 +5049,7 @@ int pcie_retrain_link(struct pci_dev *pdev, bool use_lt)
- * avoid LTSSM race as recommended in Implementation Note at the
- * end of PCIe r6.0.1 sec 7.5.3.7.
- */
-- rc = pcie_wait_for_link_status(pdev, use_lt, !use_lt);
-+ rc = pcie_wait_for_link_status(pdev, true, false);
- if (rc)
- return rc;
-
---
-2.43.0
-
+++ /dev/null
-From 4507259ef27dbfe058f6f82e8ded9b119fb5f127 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 4 Apr 2024 10:57:08 -0700
-Subject: perf annotate: Fix annotation_calc_lines() to pass correct address to
- get_srcline()
-
-From: Namhyung Kim <namhyung@kernel.org>
-
-[ Upstream commit aaf494cf483a1a835c44e942861429b30a00cab0 ]
-
-It should pass a proper address (i.e. suitable for objdump or addr2line)
-to get_srcline() in order to work correctly. It used to pass an address
-with map__rip_2objdump() as the second argument but later it's changed
-to use notes->start. It's ok in normal cases but it can be changed when
-annotate_opts.full_addr is set. So let's convert the address directly
-instead of using the notes->start.
-
-Also the last argument is an IP to print symbol offset if requested. So
-it should pass symbol-relative address.
-
-Fixes: 7d18a824b5e57ddd ("perf annotate: Toggle full address <-> offset display")
-Signed-off-by: Namhyung Kim <namhyung@kernel.org>
-Cc: Adrian Hunter <adrian.hunter@intel.com>
-Cc: Ian Rogers <irogers@google.com>
-Cc: Ingo Molnar <mingo@kernel.org>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Kan Liang <kan.liang@linux.intel.com>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Link: https://lore.kernel.org/r/20240404175716.1225482-2-namhyung@kernel.org
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/util/annotate.c | 10 ++++++----
- 1 file changed, 6 insertions(+), 4 deletions(-)
-
-diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
-index 86a996290e9ab..78088dd73248b 100644
---- a/tools/perf/util/annotate.c
-+++ b/tools/perf/util/annotate.c
-@@ -2988,7 +2988,7 @@ void annotation__toggle_full_addr(struct annotation *notes, struct map_symbol *m
- annotation__update_column_widths(notes);
- }
-
--static void annotation__calc_lines(struct annotation *notes, struct map *map,
-+static void annotation__calc_lines(struct annotation *notes, struct map_symbol *ms,
- struct rb_root *root)
- {
- struct annotation_line *al;
-@@ -2996,6 +2996,7 @@ static void annotation__calc_lines(struct annotation *notes, struct map *map,
-
- list_for_each_entry(al, ¬es->src->source, node) {
- double percent_max = 0.0;
-+ u64 addr;
- int i;
-
- for (i = 0; i < al->data_nr; i++) {
-@@ -3011,8 +3012,9 @@ static void annotation__calc_lines(struct annotation *notes, struct map *map,
- if (percent_max <= 0.5)
- continue;
-
-- al->path = get_srcline(map__dso(map), notes->start + al->offset, NULL,
-- false, true, notes->start + al->offset);
-+ addr = map__rip_2objdump(ms->map, ms->sym->start);
-+ al->path = get_srcline(map__dso(ms->map), addr + al->offset, NULL,
-+ false, true, ms->sym->start + al->offset);
- insert_source_line(&tmp_root, al);
- }
-
-@@ -3023,7 +3025,7 @@ static void symbol__calc_lines(struct map_symbol *ms, struct rb_root *root)
- {
- struct annotation *notes = symbol__annotation(ms->sym);
-
-- annotation__calc_lines(notes, ms->map, root);
-+ annotation__calc_lines(notes, ms, root);
- }
-
- int symbol__tty_annotate2(struct map_symbol *ms, struct evsel *evsel)
---
-2.43.0
-
+++ /dev/null
-From c9fbf1c682c98ac4c863a951f2a5d962b004e9bc Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 22 Mar 2024 15:43:12 -0700
-Subject: perf annotate: Get rid of duplicate --group option item
-
-From: Namhyung Kim <namhyung@kernel.org>
-
-[ Upstream commit 374af9f1f06b5e991c810d2e4983d6f58df32136 ]
-
-The options array in cmd_annotate() has duplicate --group options. It
-only needs one and let's get rid of the other.
-
- $ perf annotate -h 2>&1 | grep group
- --group Show event group information together
- --group Show event group information together
-
-Fixes: 7ebaf4890f63eb90 ("perf annotate: Support '--group' option")
-Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
-Signed-off-by: Namhyung Kim <namhyung@kernel.org>
-Cc: Adrian Hunter <adrian.hunter@intel.com>
-Cc: Ian Rogers <irogers@google.com>
-Cc: Ingo Molnar <mingo@kernel.org>
-Cc: Jin Yao <yao.jin@linux.intel.com>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Link: https://lore.kernel.org/r/20240322224313.423181-1-namhyung@kernel.org
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/builtin-annotate.c | 2 --
- 1 file changed, 2 deletions(-)
-
-diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
-index 6c1cc797692d9..9cd97fd76bb5e 100644
---- a/tools/perf/builtin-annotate.c
-+++ b/tools/perf/builtin-annotate.c
-@@ -809,8 +809,6 @@ int cmd_annotate(int argc, const char **argv)
- "Enable symbol demangling"),
- OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel,
- "Enable kernel symbol demangling"),
-- OPT_BOOLEAN(0, "group", &symbol_conf.event_group,
-- "Show event group information together"),
- OPT_BOOLEAN(0, "show-total-period", &symbol_conf.show_total_period,
- "Show a column with the sum of periods"),
- OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples,
---
-2.43.0
-
+++ /dev/null
-From 2edf7c86559acf0dcdeb474206ee7d105d77e486 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 14 May 2024 11:00:50 -0700
-Subject: perf/arm-dmc620: Fix lockdep assert in ->event_init()
-
-From: Namhyung Kim <namhyung@kernel.org>
-
-[ Upstream commit a4c5a457c6107dfe9dc65a104af1634811396bac ]
-
-for_each_sibling_event() checks leader's ctx but it doesn't have the ctx
-yet if it's the leader. Like in perf_event_validate_size(), we should
-skip checking siblings in that case.
-
-Acked-by: Mark Rutland <mark.rutland@arm.com>
-Fixes: f3c0eba28704 ("perf: Add a few assertions")
-Reported-by: Greg Thelen <gthelen@google.com>
-Cc: Robin Murphy <robin.murphy@arm.com>
-Cc: Tuan Phan <tuanphan@os.amperecomputing.com>
-Signed-off-by: Namhyung Kim <namhyung@kernel.org>
-Reviewed-by: Robin Murphy <robin.murphy@arm.com>
-Link: https://lore.kernel.org/r/20240514180050.182454-1-namhyung@kernel.org
-Signed-off-by: Will Deacon <will@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/perf/arm_dmc620_pmu.c | 9 ++++++---
- 1 file changed, 6 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/perf/arm_dmc620_pmu.c b/drivers/perf/arm_dmc620_pmu.c
-index 30cea68595747..b6a677224d682 100644
---- a/drivers/perf/arm_dmc620_pmu.c
-+++ b/drivers/perf/arm_dmc620_pmu.c
-@@ -542,12 +542,16 @@ static int dmc620_pmu_event_init(struct perf_event *event)
- if (event->cpu < 0)
- return -EINVAL;
-
-+ hwc->idx = -1;
-+
-+ if (event->group_leader == event)
-+ return 0;
-+
- /*
- * We can't atomically disable all HW counters so only one event allowed,
- * although software events are acceptable.
- */
-- if (event->group_leader != event &&
-- !is_software_event(event->group_leader))
-+ if (!is_software_event(event->group_leader))
- return -EINVAL;
-
- for_each_sibling_event(sibling, event->group_leader) {
-@@ -556,7 +560,6 @@ static int dmc620_pmu_event_init(struct perf_event *event)
- return -EINVAL;
- }
-
-- hwc->idx = -1;
- return 0;
- }
-
---
-2.43.0
-
+++ /dev/null
-From 46d015dc8f60e7570e7b1cb7cdce886a562d486a Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 7 May 2024 14:50:26 +0800
-Subject: perf bench internals inject-build-id: Fix trap divide when collecting
- just one DSO
-
-From: He Zhe <zhe.he@windriver.com>
-
-[ Upstream commit d9180e23fbfa3875424d3a6b28b71b072862a52a ]
-
-'perf bench internals inject-build-id' suffers from the following error when
-only one DSO is collected.
-
- # perf bench internals inject-build-id -v
- Collected 1 DSOs
- traps: internals-injec[2305] trap divide error
- ip:557566ba6394 sp:7ffd4de97fe0 error:0 in perf[557566b2a000+23d000]
- Build-id injection benchmark
- Iteration #1
- Floating point exception
-
-This patch removes the unnecessary minus one from the divisor which also
-corrects the randomization range.
-
-Signed-off-by: He Zhe <zhe.he@windriver.com>
-Fixes: 0bf02a0d80427f26 ("perf bench: Add build-id injection benchmark")
-Cc: Adrian Hunter <adrian.hunter@intel.com>
-Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
-Cc: Ian Rogers <irogers@google.com>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Link: https://lore.kernel.org/r/20240507065026.2652929-1-zhe.he@windriver.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/bench/inject-buildid.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tools/perf/bench/inject-buildid.c b/tools/perf/bench/inject-buildid.c
-index 49331743c7439..a759eb2328bea 100644
---- a/tools/perf/bench/inject-buildid.c
-+++ b/tools/perf/bench/inject-buildid.c
-@@ -362,7 +362,7 @@ static int inject_build_id(struct bench_data *data, u64 *max_rss)
- return -1;
-
- for (i = 0; i < nr_mmaps; i++) {
-- int idx = rand() % (nr_dsos - 1);
-+ int idx = rand() % nr_dsos;
- struct bench_dso *dso = &dsos[idx];
- u64 timestamp = rand() % 1000000;
-
---
-2.43.0
-
+++ /dev/null
-From 7e08e660b27de4525bdf4c532932a85050f1090a Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 5 Apr 2024 21:09:10 -0700
-Subject: perf bench uprobe: Remove lib64 from libc.so.6 binary path
-
-From: Ian Rogers <irogers@google.com>
-
-[ Upstream commit 459fee7b508231cd4622b3bd94aaa85e8e16b888 ]
-
-bpf_program__attach_uprobe_opts will search LD_LIBRARY_PATH and so
-specifying `/lib64` is unnecessary and causes failures for libc.so.6
-paths like `/lib/x86_64-linux-gnu/libc.so.6`.
-
-Fixes: 7b47623b8cae8149 ("perf bench uprobe trace_printk: Add entry attaching an BPF program that does a trace_printk")
-Signed-off-by: Ian Rogers <irogers@google.com>
-Acked-by: Jiri Olsa <jolsa@kernel.org>
-Cc: Adrian Hunter <adrian.hunter@intel.com>
-Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
-Cc: Andrei Vagin <avagin@google.com>
-Cc: Ingo Molnar <mingo@redhat.com>
-Cc: Kan Liang <kan.liang@linux.intel.com>
-Cc: Kees Kook <keescook@chromium.org>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Link: https://lore.kernel.org/r/20240406040911.1603801-1-irogers@google.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/bench/uprobe.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tools/perf/bench/uprobe.c b/tools/perf/bench/uprobe.c
-index 5c71fdc419dd7..b722ff88fe7de 100644
---- a/tools/perf/bench/uprobe.c
-+++ b/tools/perf/bench/uprobe.c
-@@ -47,7 +47,7 @@ static const char * const bench_uprobe_usage[] = {
- #define bench_uprobe__attach_uprobe(prog) \
- skel->links.prog = bpf_program__attach_uprobe_opts(/*prog=*/skel->progs.prog, \
- /*pid=*/-1, \
-- /*binary_path=*/"/lib64/libc.so.6", \
-+ /*binary_path=*/"libc.so.6", \
- /*func_offset=*/0, \
- /*opts=*/&uprobe_opts); \
- if (!skel->links.prog) { \
---
-2.43.0
-
+++ /dev/null
-From 34bac9df074bc994b0a890e228bb1586390e90b4 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 14 Mar 2024 15:20:12 -0700
-Subject: perf build: Fix out of tree build related to installation of
- sysreg-defs
-
-From: Ethan Adams <j.ethan.adams@gmail.com>
-
-[ Upstream commit efae55bb78cf8722c7df01cd974197dfd13ece39 ]
-
-It seems that a previous modification to sysreg-defs, which corrected
-emitting the header to the specified output directory, exposed missing
-subdir, prefix variables.
-
-This breaks out of tree builds of perf as the file is now built into the
-output directory, but still tries to descend into output directory as a
-subdir.
-
-Fixes: a29ee6aea7030786 ("perf build: Ensure sysreg-defs Makefile respects output dir")
-Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
-Reviewed-by: Tycho Andersen <tycho@tycho.pizza>
-Signed-off-by: Ethan Adams <j.ethan.adams@gmail.com>
-Tested-by: Tycho Andersen <tycho@tycho.pizza>
-Cc: Adrian Hunter <adrian.hunter@intel.com>
-Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
-Cc: Ian Rogers <irogers@google.com>
-Cc: Ingo Molnar <mingo@redhat.com>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Link: https://lore.kernel.org/r/20240314222012.47193-1-j.ethan.adams@gmail.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/Makefile.perf | 7 ++++---
- 1 file changed, 4 insertions(+), 3 deletions(-)
-
-diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
-index 116db7874412d..27705df2e2ba8 100644
---- a/tools/perf/Makefile.perf
-+++ b/tools/perf/Makefile.perf
-@@ -455,18 +455,19 @@ SHELL = $(SHELL_PATH)
-
- arm64_gen_sysreg_dir := $(srctree)/tools/arch/arm64/tools
- ifneq ($(OUTPUT),)
-- arm64_gen_sysreg_outdir := $(OUTPUT)
-+ arm64_gen_sysreg_outdir := $(abspath $(OUTPUT))
- else
- arm64_gen_sysreg_outdir := $(CURDIR)
- endif
-
- arm64-sysreg-defs: FORCE
-- $(Q)$(MAKE) -C $(arm64_gen_sysreg_dir) O=$(arm64_gen_sysreg_outdir)
-+ $(Q)$(MAKE) -C $(arm64_gen_sysreg_dir) O=$(arm64_gen_sysreg_outdir) \
-+ prefix= subdir=
-
- arm64-sysreg-defs-clean:
- $(call QUIET_CLEAN,arm64-sysreg-defs)
- $(Q)$(MAKE) -C $(arm64_gen_sysreg_dir) O=$(arm64_gen_sysreg_outdir) \
-- clean > /dev/null
-+ prefix= subdir= clean > /dev/null
-
- beauty_linux_dir := $(srctree)/tools/perf/trace/beauty/include/linux/
- linux_uapi_dir := $(srctree)/tools/include/uapi/linux
---
-2.43.0
-
+++ /dev/null
-From e0db6a482dc458229402c5190bd308bbde25f794 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 9 May 2024 17:34:24 -0700
-Subject: perf daemon: Fix file leak in daemon_session__control
-
-From: Samasth Norway Ananda <samasth.norway.ananda@oracle.com>
-
-[ Upstream commit 09541603462c399c7408d50295db99b4b8042eaa ]
-
-The open() function returns -1 on error.
-
-The 'control' and 'ack' file descriptors are both initialized with
-open() and further validated with 'if' statement.
-
-'if (!control)' would evaluate to 'true' if returned value on error were
-'0' but it is actually '-1'.
-
-Fixes: edcaa47958c7438b ("perf daemon: Add 'ping' command")
-Signed-off-by: Samasth Norway Ananda <samasth.norway.ananda@oracle.com>
-Cc: Adrian Hunter <adrian.hunter@intel.com>
-Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
-Cc: Ian Rogers <irogers@google.com>
-Cc: Ingo Molnar <mingo@redhat.com>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Link: https://lore.kernel.org/r/20240510003424.2016914-1-samasth.norway.ananda@oracle.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/builtin-daemon.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/tools/perf/builtin-daemon.c b/tools/perf/builtin-daemon.c
-index 83954af36753a..de76bbc50bfbc 100644
---- a/tools/perf/builtin-daemon.c
-+++ b/tools/perf/builtin-daemon.c
-@@ -523,7 +523,7 @@ static int daemon_session__control(struct daemon_session *session,
- session->base, SESSION_CONTROL);
-
- control = open(control_path, O_WRONLY|O_NONBLOCK);
-- if (!control)
-+ if (control < 0)
- return -1;
-
- if (do_ack) {
-@@ -532,7 +532,7 @@ static int daemon_session__control(struct daemon_session *session,
- session->base, SESSION_ACK);
-
- ack = open(ack_path, O_RDONLY, O_NONBLOCK);
-- if (!ack) {
-+ if (ack < 0) {
- close(control);
- return -1;
- }
---
-2.43.0
-
+++ /dev/null
-From 11ed4a56e59d70a1b6de2664a3198343db15d0aa Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 16 Apr 2024 10:00:13 -0700
-Subject: perf docs: Document bpf event modifier
-
-From: Ian Rogers <irogers@google.com>
-
-[ Upstream commit eb4d27cf9aef3e6c9bcaf8fa1a1cadc2433d847b ]
-
-Document that 'b' is used as a modifier to make an event use a BPF
-counter.
-
-Fixes: 01bd8efcec444468 ("perf stat: Introduce ':b' modifier")
-Signed-off-by: Ian Rogers <irogers@google.com>
-Cc: Adrian Hunter <adrian.hunter@intel.com>
-Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
-Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
-Cc: Ingo Molnar <mingo@redhat.com>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Kan Liang <kan.liang@linux.intel.com>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Cc: Ravi Bangoria <ravi.bangoria@amd.com>
-Cc: Song Liu <song@kernel.org>
-Cc: Thomas Richter <tmricht@linux.ibm.com>
-Link: https://lore.kernel.org/r/20240416170014.985191-1-irogers@google.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/Documentation/perf-list.txt | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/tools/perf/Documentation/perf-list.txt b/tools/perf/Documentation/perf-list.txt
-index 3b12595193c9f..6bf2468f59d31 100644
---- a/tools/perf/Documentation/perf-list.txt
-+++ b/tools/perf/Documentation/perf-list.txt
-@@ -71,6 +71,7 @@ counted. The following modifiers exist:
- D - pin the event to the PMU
- W - group is weak and will fallback to non-group if not schedulable,
- e - group or event are exclusive and do not share the PMU
-+ b - use BPF aggregration (see perf stat --bpf-counters)
-
- The 'p' modifier can be used for specifying how precise the instruction
- address should be. The 'p' modifier can be specified multiple times:
---
-2.43.0
-
+++ /dev/null
-From f8bfcbfd9cf07f35dca7016c5256d17913d06dc8 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 26 Mar 2024 10:32:23 +0200
-Subject: perf intel-pt: Fix unassigned instruction op (discovered by
- MemorySanitizer)
-
-From: Adrian Hunter <adrian.hunter@intel.com>
-
-[ Upstream commit e101a05f79fd4ee3e89d2f3fb716493c33a33708 ]
-
-MemorySanitizer discovered instances where the instruction op value was
-not assigned.:
-
- WARNING: MemorySanitizer: use-of-uninitialized-value
- #0 0x5581c00a76b3 in intel_pt_sample_flags tools/perf/util/intel-pt.c:1527:17
- Uninitialized value was stored to memory at
- #0 0x5581c005ddf8 in intel_pt_walk_insn tools/perf/util/intel-pt-decoder/intel-pt-decoder.c:1256:25
-
-The op value is used to set branch flags for branch instructions
-encountered when walking the code, so fix by setting op to
-INTEL_PT_OP_OTHER in other cases.
-
-Fixes: 4c761d805bb2d2ea ("perf intel-pt: Fix intel_pt_fup_event() assumptions about setting state type")
-Reported-by: Ian Rogers <irogers@google.com>
-Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
-Tested-by: Ian Rogers <irogers@google.com>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Closes: https://lore.kernel.org/linux-perf-users/20240320162619.1272015-1-irogers@google.com/
-Link: https://lore.kernel.org/r/20240326083223.10883-1-adrian.hunter@intel.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/util/intel-pt-decoder/intel-pt-decoder.c | 2 ++
- tools/perf/util/intel-pt.c | 2 ++
- 2 files changed, 4 insertions(+)
-
-diff --git a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
-index b450178e3420b..e733f6b1f7ac5 100644
---- a/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
-+++ b/tools/perf/util/intel-pt-decoder/intel-pt-decoder.c
-@@ -1319,6 +1319,8 @@ static bool intel_pt_fup_event(struct intel_pt_decoder *decoder, bool no_tip)
- bool ret = false;
-
- decoder->state.type &= ~INTEL_PT_BRANCH;
-+ decoder->state.insn_op = INTEL_PT_OP_OTHER;
-+ decoder->state.insn_len = 0;
-
- if (decoder->set_fup_cfe_ip || decoder->set_fup_cfe) {
- bool ip = decoder->set_fup_cfe_ip;
-diff --git a/tools/perf/util/intel-pt.c b/tools/perf/util/intel-pt.c
-index f38893e0b0369..4db9a098f5926 100644
---- a/tools/perf/util/intel-pt.c
-+++ b/tools/perf/util/intel-pt.c
-@@ -764,6 +764,7 @@ static int intel_pt_walk_next_insn(struct intel_pt_insn *intel_pt_insn,
-
- addr_location__init(&al);
- intel_pt_insn->length = 0;
-+ intel_pt_insn->op = INTEL_PT_OP_OTHER;
-
- if (to_ip && *ip == to_ip)
- goto out_no_cache;
-@@ -898,6 +899,7 @@ static int intel_pt_walk_next_insn(struct intel_pt_insn *intel_pt_insn,
-
- if (to_ip && *ip == to_ip) {
- intel_pt_insn->length = 0;
-+ intel_pt_insn->op = INTEL_PT_OP_OTHER;
- goto out_no_cache;
- }
-
---
-2.43.0
-
+++ /dev/null
-From 010c28150994d8bf1c8409f0f11d1b5457cbf99c Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 2 May 2024 14:35:07 -0700
-Subject: perf pmu: Assume sysfs events are always the same case
-
-From: Ian Rogers <irogers@google.com>
-
-[ Upstream commit 7b6dd7a923281a7ccb980a0f768d6926721eb3cc ]
-
-Perf event names aren't case sensitive. For sysfs events the entire
-directory of events is read then iterated comparing names in a case
-insensitive way, most often to see if an event is present.
-
-Consider:
-
- $ perf stat -e inst_retired.any true
-
-The event inst_retired.any may be present in any PMU, so every PMU's
-sysfs events are loaded and then searched with strcasecmp to see if
-any match. This event is only present on the cpu PMU as a JSON event
-so a lot of events were loaded from sysfs unnecessarily just to prove
-an event didn't exist there.
-
-This change avoids loading all the events by assuming sysfs event
-names are always either lower or uppercase. It uses file exists and
-only loads the events when the desired event is present.
-
-For the example above, the number of openat calls measured by 'perf
-trace' on a tigerlake laptop goes from 325 down to 255. The reduction
-will be larger for machines with many PMUs, particularly replicated
-uncore PMUs.
-
-Ensure pmu_aliases_parse() is called before all uses of the aliases
-list, but remove some "pmu->sysfs_aliases_loaded" tests as they are now
-part of the function.
-
-Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
-Signed-off-by: Ian Rogers <irogers@google.com>
-Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
-Cc: Bjorn Helgaas <bhelgaas@google.com>
-Cc: Ingo Molnar <mingo@redhat.com>
-Cc: James Clark <james.clark@arm.com>
-Cc: Jing Zhang <renyu.zj@linux.alibaba.com>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Jonathan Corbet <corbet@lwn.net>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Cc: Randy Dunlap <rdunlap@infradead.org>
-Cc: Ravi Bangoria <ravi.bangoria@amd.com>
-Cc: Thomas Richter <tmricht@linux.ibm.com>
-Link: https://lore.kernel.org/r/20240502213507.2339733-7-irogers@google.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Stable-dep-of: d9c5f5f94c2d ("perf pmu: Count sys and cpuid JSON events separately")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/util/pmu.c | 31 ++++++++++++++++++++++++++-----
- 1 file changed, 26 insertions(+), 5 deletions(-)
-
-diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
-index a0ec0103e0a62..bd4270c3beb54 100644
---- a/tools/perf/util/pmu.c
-+++ b/tools/perf/util/pmu.c
-@@ -425,9 +425,30 @@ static struct perf_pmu_alias *perf_pmu__find_alias(struct perf_pmu *pmu,
- {
- struct perf_pmu_alias *alias;
-
-- if (load && !pmu->sysfs_aliases_loaded)
-- pmu_aliases_parse(pmu);
-+ if (load && !pmu->sysfs_aliases_loaded) {
-+ bool has_sysfs_event;
-+ char event_file_name[FILENAME_MAX + 8];
-
-+ /*
-+ * Test if alias/event 'name' exists in the PMU's sysfs/events
-+ * directory. If not skip parsing the sysfs aliases. Sysfs event
-+ * name must be all lower or all upper case.
-+ */
-+ scnprintf(event_file_name, sizeof(event_file_name), "events/%s", name);
-+ for (size_t i = 7, n = 7 + strlen(name); i < n; i++)
-+ event_file_name[i] = tolower(event_file_name[i]);
-+
-+ has_sysfs_event = perf_pmu__file_exists(pmu, event_file_name);
-+ if (!has_sysfs_event) {
-+ for (size_t i = 7, n = 7 + strlen(name); i < n; i++)
-+ event_file_name[i] = toupper(event_file_name[i]);
-+
-+ has_sysfs_event = perf_pmu__file_exists(pmu, event_file_name);
-+ }
-+ if (has_sysfs_event)
-+ pmu_aliases_parse(pmu);
-+
-+ }
- list_for_each_entry(alias, &pmu->aliases, list) {
- if (!strcasecmp(alias->name, name))
- return alias;
-@@ -1629,9 +1650,7 @@ size_t perf_pmu__num_events(struct perf_pmu *pmu)
- {
- size_t nr;
-
-- if (!pmu->sysfs_aliases_loaded)
-- pmu_aliases_parse(pmu);
--
-+ pmu_aliases_parse(pmu);
- nr = pmu->sysfs_aliases;
-
- if (pmu->cpu_aliases_added)
-@@ -1690,6 +1709,7 @@ int perf_pmu__for_each_event(struct perf_pmu *pmu, bool skip_duplicate_pmus,
- struct strbuf sb;
-
- strbuf_init(&sb, /*hint=*/ 0);
-+ pmu_aliases_parse(pmu);
- pmu_add_cpu_aliases(pmu);
- list_for_each_entry(event, &pmu->aliases, list) {
- size_t buf_used;
-@@ -2090,6 +2110,7 @@ const char *perf_pmu__name_from_config(struct perf_pmu *pmu, u64 config)
- if (!pmu)
- return NULL;
-
-+ pmu_aliases_parse(pmu);
- pmu_add_cpu_aliases(pmu);
- list_for_each_entry(event, &pmu->aliases, list) {
- struct perf_event_attr attr = {.config = 0,};
---
-2.43.0
-
+++ /dev/null
-From 367b5eddccf58f10c598ebc249d549d174d00609 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 10 May 2024 17:36:01 -0700
-Subject: perf pmu: Count sys and cpuid JSON events separately
-
-From: Ian Rogers <irogers@google.com>
-
-[ Upstream commit d9c5f5f94c2d356fdf3503f7fcaf254512bc032d ]
-
-Sys events are eagerly loaded as each event has a compat option that may
-mean the event is or isn't associated with the PMU.
-
-These shouldn't be counted as loaded_json_events as that is used for
-JSON events matching the CPUID that may or may not have been loaded. The
-mismatch causes issues on ARM64 that uses sys events.
-
-Fixes: e6ff1eed3584362d ("perf pmu: Lazily add JSON events")
-Closes: https://lore.kernel.org/lkml/20240510024729.1075732-1-justin.he@arm.com/
-Reported-by: Jia He <justin.he@arm.com>
-Signed-off-by: Ian Rogers <irogers@google.com>
-Cc: Adrian Hunter <adrian.hunter@intel.com>
-Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
-Cc: Ingo Molnar <mingo@redhat.com>
-Cc: James Clark <james.clark@arm.com>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: John Garry <john.g.garry@oracle.com>
-Cc: Kan Liang <kan.liang@linux.intel.com>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Link: https://lore.kernel.org/r/20240511003601.2666907-1-irogers@google.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/util/pmu.c | 70 ++++++++++++++++++++++++++++++-------------
- tools/perf/util/pmu.h | 6 ++--
- 2 files changed, 53 insertions(+), 23 deletions(-)
-
-diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
-index bd4270c3beb54..f1b58784bdffe 100644
---- a/tools/perf/util/pmu.c
-+++ b/tools/perf/util/pmu.c
-@@ -36,6 +36,18 @@ struct perf_pmu perf_pmu__fake = {
-
- #define UNIT_MAX_LEN 31 /* max length for event unit name */
-
-+enum event_source {
-+ /* An event loaded from /sys/devices/<pmu>/events. */
-+ EVENT_SRC_SYSFS,
-+ /* An event loaded from a CPUID matched json file. */
-+ EVENT_SRC_CPU_JSON,
-+ /*
-+ * An event loaded from a /sys/devices/<pmu>/identifier matched json
-+ * file.
-+ */
-+ EVENT_SRC_SYS_JSON,
-+};
-+
- /**
- * struct perf_pmu_alias - An event either read from sysfs or builtin in
- * pmu-events.c, created by parsing the pmu-events json files.
-@@ -521,7 +533,7 @@ static int update_alias(const struct pmu_event *pe,
-
- static int perf_pmu__new_alias(struct perf_pmu *pmu, const char *name,
- const char *desc, const char *val, FILE *val_fd,
-- const struct pmu_event *pe)
-+ const struct pmu_event *pe, enum event_source src)
- {
- struct perf_pmu_alias *alias;
- int ret;
-@@ -573,25 +585,30 @@ static int perf_pmu__new_alias(struct perf_pmu *pmu, const char *name,
- }
- snprintf(alias->unit, sizeof(alias->unit), "%s", unit);
- }
-- if (!pe) {
-- /* Update an event from sysfs with json data. */
-- struct update_alias_data data = {
-- .pmu = pmu,
-- .alias = alias,
-- };
--
-+ switch (src) {
-+ default:
-+ case EVENT_SRC_SYSFS:
- alias->from_sysfs = true;
- if (pmu->events_table) {
-+ /* Update an event from sysfs with json data. */
-+ struct update_alias_data data = {
-+ .pmu = pmu,
-+ .alias = alias,
-+ };
- if (pmu_events_table__find_event(pmu->events_table, pmu, name,
- update_alias, &data) == 0)
-- pmu->loaded_json_aliases++;
-+ pmu->cpu_json_aliases++;
- }
-- }
--
-- if (!pe)
- pmu->sysfs_aliases++;
-- else
-- pmu->loaded_json_aliases++;
-+ break;
-+ case EVENT_SRC_CPU_JSON:
-+ pmu->cpu_json_aliases++;
-+ break;
-+ case EVENT_SRC_SYS_JSON:
-+ pmu->sys_json_aliases++;
-+ break;
-+
-+ }
- list_add_tail(&alias->list, &pmu->aliases);
- return 0;
- }
-@@ -667,7 +684,8 @@ static int pmu_aliases_parse(struct perf_pmu *pmu)
- }
-
- if (perf_pmu__new_alias(pmu, name, /*desc=*/ NULL,
-- /*val=*/ NULL, file, /*pe=*/ NULL) < 0)
-+ /*val=*/ NULL, file, /*pe=*/ NULL,
-+ EVENT_SRC_SYSFS) < 0)
- pr_debug("Cannot set up %s\n", name);
- fclose(file);
- }
-@@ -920,7 +938,8 @@ static int pmu_add_cpu_aliases_map_callback(const struct pmu_event *pe,
- {
- struct perf_pmu *pmu = vdata;
-
-- perf_pmu__new_alias(pmu, pe->name, pe->desc, pe->event, /*val_fd=*/ NULL, pe);
-+ perf_pmu__new_alias(pmu, pe->name, pe->desc, pe->event, /*val_fd=*/ NULL,
-+ pe, EVENT_SRC_CPU_JSON);
- return 0;
- }
-
-@@ -955,13 +974,14 @@ static int pmu_add_sys_aliases_iter_fn(const struct pmu_event *pe,
- return 0;
-
- if (pmu_uncore_alias_match(pe->pmu, pmu->name) &&
-- pmu_uncore_identifier_match(pe->compat, pmu->id)) {
-+ pmu_uncore_identifier_match(pe->compat, pmu->id)) {
- perf_pmu__new_alias(pmu,
- pe->name,
- pe->desc,
- pe->event,
- /*val_fd=*/ NULL,
-- pe);
-+ pe,
-+ EVENT_SRC_SYS_JSON);
- }
-
- return 0;
-@@ -1053,6 +1073,12 @@ struct perf_pmu *perf_pmu__lookup(struct list_head *pmus, int dirfd, const char
- pmu->max_precise = pmu_max_precise(dirfd, pmu);
- pmu->alias_name = pmu_find_alias_name(pmu, dirfd);
- pmu->events_table = perf_pmu__find_events_table(pmu);
-+ /*
-+ * Load the sys json events/aliases when loading the PMU as each event
-+ * may have a different compat regular expression. We therefore can't
-+ * know the number of sys json events/aliases without computing the
-+ * regular expressions for them all.
-+ */
- pmu_add_sys_aliases(pmu);
- list_add_tail(&pmu->list, pmus);
-
-@@ -1651,12 +1677,14 @@ size_t perf_pmu__num_events(struct perf_pmu *pmu)
- size_t nr;
-
- pmu_aliases_parse(pmu);
-- nr = pmu->sysfs_aliases;
-+ nr = pmu->sysfs_aliases + pmu->sys_json_aliases;;
-
- if (pmu->cpu_aliases_added)
-- nr += pmu->loaded_json_aliases;
-+ nr += pmu->cpu_json_aliases;
- else if (pmu->events_table)
-- nr += pmu_events_table__num_events(pmu->events_table, pmu) - pmu->loaded_json_aliases;
-+ nr += pmu_events_table__num_events(pmu->events_table, pmu) - pmu->cpu_json_aliases;
-+ else
-+ assert(pmu->cpu_json_aliases == 0);
-
- return pmu->selectable ? nr + 1 : nr;
- }
-diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
-index 109f3704a6461..25803ea92ed34 100644
---- a/tools/perf/util/pmu.h
-+++ b/tools/perf/util/pmu.h
-@@ -121,8 +121,10 @@ struct perf_pmu {
- const struct pmu_events_table *events_table;
- /** @sysfs_aliases: Number of sysfs aliases loaded. */
- uint32_t sysfs_aliases;
-- /** @sysfs_aliases: Number of json event aliases loaded. */
-- uint32_t loaded_json_aliases;
-+ /** @cpu_json_aliases: Number of json event aliases loaded specific to the CPUID. */
-+ uint32_t cpu_json_aliases;
-+ /** @sys_json_aliases: Number of json event aliases loaded matching the PMU's identifier. */
-+ uint32_t sys_json_aliases;
- /** @sysfs_aliases_loaded: Are sysfs aliases loaded from disk? */
- bool sysfs_aliases_loaded;
- /**
---
-2.43.0
-
+++ /dev/null
-From 4e8241d81864768f7c3b73970233cd5baa602f4a Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 21 Mar 2024 11:13:30 -0300
-Subject: perf probe: Add missing libgen.h header needed for using basename()
-
-From: Arnaldo Carvalho de Melo <acme@redhat.com>
-
-[ Upstream commit 581037151910126a7934e369e4b6ac70eda9a703 ]
-
-This prototype is obtained indirectly, by luck, from some other header
-in probe-event.c in most systems, but recently exploded on alpine:edge:
-
- 8 13.39 alpine:edge : FAIL gcc version 13.2.1 20240309 (Alpine 13.2.1_git20240309)
- util/probe-event.c: In function 'convert_exec_to_group':
- util/probe-event.c:225:16: error: implicit declaration of function 'basename' [-Werror=implicit-function-declaration]
- 225 | ptr1 = basename(exec_copy);
- | ^~~~~~~~
- util/probe-event.c:225:14: error: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Werror=int-conversion]
- 225 | ptr1 = basename(exec_copy);
- | ^
- cc1: all warnings being treated as errors
- make[3]: *** [/git/perf-6.8.0/tools/build/Makefile.build:158: util] Error 2
-
-Fix it by adding the libgen.h header where basename() is prototyped.
-
-Fixes: fb7345bbf7fad9bf ("perf probe: Support basic dwarf-based operations on uprobe events")
-Cc: Masami Hiramatsu <mhiramat@kernel.org>
-Cc: Adrian Hunter <adrian.hunter@intel.com>
-Cc: Ian Rogers <irogers@google.com>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Link: https://lore.kernel.org/lkml/
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/util/probe-event.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
-index a1a796043691f..d8e70a54d9e5e 100644
---- a/tools/perf/util/probe-event.c
-+++ b/tools/perf/util/probe-event.c
-@@ -11,6 +11,7 @@
- #include <sys/stat.h>
- #include <fcntl.h>
- #include <errno.h>
-+#include <libgen.h>
- #include <stdio.h>
- #include <unistd.h>
- #include <stdlib.h>
---
-2.43.0
-
+++ /dev/null
-From 8ad568ae4c051214bc96879bfd22afefbccb501e Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 29 Feb 2024 23:46:36 -0800
-Subject: perf record: Delete session after stopping sideband thread
-
-From: Ian Rogers <irogers@google.com>
-
-[ Upstream commit 88ce0106a1f603bf360cb397e8fe293f8298fabb ]
-
-The session has a header in it which contains a perf env with
-bpf_progs. The bpf_progs are accessed by the sideband thread and so
-the sideband thread must be stopped before the session is deleted, to
-avoid a use after free. This error was detected by AddressSanitizer
-in the following:
-
- ==2054673==ERROR: AddressSanitizer: heap-use-after-free on address 0x61d000161e00 at pc 0x55769289de54 bp 0x7f9df36d4ab0 sp 0x7f9df36d4aa8
- READ of size 8 at 0x61d000161e00 thread T1
- #0 0x55769289de53 in __perf_env__insert_bpf_prog_info util/env.c:42
- #1 0x55769289dbb1 in perf_env__insert_bpf_prog_info util/env.c:29
- #2 0x557692bbae29 in perf_env__add_bpf_info util/bpf-event.c:483
- #3 0x557692bbb01a in bpf_event__sb_cb util/bpf-event.c:512
- #4 0x5576928b75f4 in perf_evlist__poll_thread util/sideband_evlist.c:68
- #5 0x7f9df96a63eb in start_thread nptl/pthread_create.c:444
- #6 0x7f9df9726a4b in clone3 ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
-
- 0x61d000161e00 is located 384 bytes inside of 2136-byte region [0x61d000161c80,0x61d0001624d8)
- freed by thread T0 here:
- #0 0x7f9dfa6d7288 in __interceptor_free libsanitizer/asan/asan_malloc_linux.cpp:52
- #1 0x557692978d50 in perf_session__delete util/session.c:319
- #2 0x557692673959 in __cmd_record tools/perf/builtin-record.c:2884
- #3 0x55769267a9f0 in cmd_record tools/perf/builtin-record.c:4259
- #4 0x55769286710c in run_builtin tools/perf/perf.c:349
- #5 0x557692867678 in handle_internal_command tools/perf/perf.c:402
- #6 0x557692867a40 in run_argv tools/perf/perf.c:446
- #7 0x557692867fae in main tools/perf/perf.c:562
- #8 0x7f9df96456c9 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
-
-Fixes: 657ee5531903339b ("perf evlist: Introduce side band thread")
-Signed-off-by: Ian Rogers <irogers@google.com>
-Cc: Adrian Hunter <adrian.hunter@intel.com>
-Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
-Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
-Cc: Christian Brauner <brauner@kernel.org>
-Cc: Disha Goel <disgoel@linux.ibm.com>
-Cc: Ingo Molnar <mingo@redhat.com>
-Cc: James Clark <james.clark@arm.com>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Kajol Jain <kjain@linux.ibm.com>
-Cc: Kan Liang <kan.liang@linux.intel.com>
-Cc: K Prateek Nayak <kprateek.nayak@amd.com>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Cc: Song Liu <songliubraving@fb.com>
-Cc: Tim Chen <tim.c.chen@linux.intel.com>
-Cc: Yicong Yang <yangyicong@hisilicon.com>
-Link: https://lore.kernel.org/r/20240301074639.2260708-1-irogers@google.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/builtin-record.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
-index 3ddd4381aebd2..7f583fd0750cb 100644
---- a/tools/perf/builtin-record.c
-+++ b/tools/perf/builtin-record.c
-@@ -2877,10 +2877,10 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
- }
- #endif
- zstd_fini(&session->zstd_data);
-- perf_session__delete(session);
--
- if (!opts->no_bpf_event)
- evlist__stop_sb_thread(rec->sb_evlist);
-+
-+ perf_session__delete(session);
- return status;
- }
-
---
-2.43.0
-
+++ /dev/null
-From 0e65278b1218bb063cc2dbefe084623376788d92 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 11 Apr 2024 10:54:47 +0300
-Subject: perf record: Fix debug message placement for test consumption
-
-From: Adrian Hunter <adrian.hunter@intel.com>
-
-[ Upstream commit 792bc998baf9ae17297b1f93b1edc3ca34a0b7e2 ]
-
-evlist__config() might mess up the debug output consumed by test
-"Test per-thread recording" in "Miscellaneous Intel PT testing".
-
-Move it out from between the debug prints:
-
- "perf record opening and mmapping events" and
- "perf record done opening and mmapping events"
-
-Fixes: da4062021e0e6da5 ("perf tools: Add debug messages and comments for testing")
-Closes: https://lore.kernel.org/linux-perf-users/ZhVfc5jYLarnGzKa@x1/
-Reported-by: Arnaldo Carvalho de Melo <acme@kernel.org>
-Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
-Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Cc: Ian Rogers <irogers@google.com>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Link: https://lore.kernel.org/r/20240411075447.17306-1-adrian.hunter@intel.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/builtin-record.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
-index 7f583fd0750cb..a5051a571d5af 100644
---- a/tools/perf/builtin-record.c
-+++ b/tools/perf/builtin-record.c
-@@ -1355,8 +1355,6 @@ static int record__open(struct record *rec)
- struct record_opts *opts = &rec->opts;
- int rc = 0;
-
-- evlist__config(evlist, opts, &callchain_param);
--
- evlist__for_each_entry(evlist, pos) {
- try_again:
- if (evsel__open(pos, pos->core.cpus, pos->core.threads) < 0) {
-@@ -2479,6 +2477,8 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
-
- evlist__uniquify_name(rec->evlist);
-
-+ evlist__config(rec->evlist, opts, &callchain_param);
-+
- /* Debug message used by test scripts */
- pr_debug3("perf record opening and mmapping events\n");
- if (record__open(rec) != 0) {
---
-2.43.0
-
+++ /dev/null
-From d0e68bb3e0a86cb980e726c0f82e8730a32c71e3 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 7 May 2024 20:53:00 -0700
-Subject: perf report: Avoid SEGV in report__setup_sample_type()
-
-From: Ian Rogers <irogers@google.com>
-
-[ Upstream commit 45b4f402a6b782352c4bafcff682bfb01da9ca05 ]
-
-In some cases evsel->name is lazily initialized in evsel__name(). If not
-initialized passing NULL to strstr() leads to a SEGV.
-
-Fixes: ccb17caecfbd542f ("perf report: Set PERF_SAMPLE_DATA_SRC bit for Arm SPE event")
-Signed-off-by: Ian Rogers <irogers@google.com>
-Cc: Adrian Hunter <adrian.hunter@intel.com>
-Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
-Cc: Ingo Molnar <mingo@redhat.com>
-Cc: James Clark <james.clark@arm.com>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Kan Liang <kan.liang@linux.intel.com>
-Cc: Leo Yan <leo.yan@linux.dev>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Link: https://lore.kernel.org/r/20240508035301.1554434-4-irogers@google.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/builtin-report.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
-index f2ed2b7e80a32..ea8636abbb8db 100644
---- a/tools/perf/builtin-report.c
-+++ b/tools/perf/builtin-report.c
-@@ -427,7 +427,7 @@ static int report__setup_sample_type(struct report *rep)
- * compatibility, set the bit if it's an old perf data file.
- */
- evlist__for_each_entry(session->evlist, evsel) {
-- if (strstr(evsel->name, "arm_spe") &&
-+ if (strstr(evsel__name(evsel), "arm_spe") &&
- !(sample_type & PERF_SAMPLE_DATA_SRC)) {
- evsel->core.attr.sample_type |= PERF_SAMPLE_DATA_SRC;
- sample_type |= PERF_SAMPLE_DATA_SRC;
---
-2.43.0
-
+++ /dev/null
-From fc451fe67f1201f7d7661c7cc2233ddcc8bb4e34 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 4 Apr 2024 08:48:05 +0200
-Subject: perf report: Fix PAI counter names for s390 virtual machines
-
-From: Thomas Richter <tmricht@linux.ibm.com>
-
-[ Upstream commit b74bc5a633a7d72f89141d481d835e73bda3c3ae ]
-
-s390 introduced the Processor Activity Instrumentation (PAI) counter
-facility on LPAR and virtual machines z/VM for models 3931 and 3932.
-
-These counters are stored as raw data in the perf.data file and are
-displayed with:
-
- # perf report -i /tmp//perfout-635468 -D | grep Counter
- Counter:007 <unknown> Value:0x00000000000186a0
- Counter:032 <unknown> Value:0x0000000000000001
- Counter:032 <unknown> Value:0x0000000000000001
- Counter:032 <unknown> Value:0x0000000000000001
- #
-
-However on z/VM virtual machines, the counter names are not retrieved
-from the PMU and are shown as '<unknown>'. This is caused by the CPU
-string saved in the mapfile.csv for this machine:
-
- ^IBM.393[12].*3\.7.[[:xdigit:]]+$,3,cf_z16,core
-
-This string contains the CPU Measurement facility first and second
-version number and authorization level (3\.7.[[:xdigit:]]+). These
-numbers do not apply to the PAI counter facility. In fact they can be
-omitted.
-
-Shorten the CPU identification string for this machine to manufacturer
-and model. This is sufficient for all PMU devices.
-
-Output after:
-
- # perf report -i /tmp//perfout-635468 -D | grep Counter
- Counter:007 km_aes_128 Value:0x00000000000186a0
- Counter:032 kma_gcm_aes_256 Value:0x0000000000000001
- Counter:032 kma_gcm_aes_256 Value:0x0000000000000001
- Counter:032 kma_gcm_aes_256 Value:0x0000000000000001
- #
-
-Fixes: b539deafbadb2fc6 ("perf report: Add s390 raw data interpretation for PAI counters")
-Reviewed-by: Ian Rogers <irogers@google.com>
-Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
-Acked-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
-Cc: Heiko Carstens <hca@linux.ibm.com>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Cc: Sven Schnelle <svens@linux.ibm.com>
-Cc: Thomas Richter <tmricht@linux.ibm.com>
-Cc: Vasily Gorbik <gor@linux.ibm.com>
-Link: https://lore.kernel.org/r/20240404064806.1362876-1-tmricht@linux.ibm.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/pmu-events/arch/s390/mapfile.csv | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tools/perf/pmu-events/arch/s390/mapfile.csv b/tools/perf/pmu-events/arch/s390/mapfile.csv
-index a918e1af77a57..b22648d127517 100644
---- a/tools/perf/pmu-events/arch/s390/mapfile.csv
-+++ b/tools/perf/pmu-events/arch/s390/mapfile.csv
-@@ -5,4 +5,4 @@ Family-model,Version,Filename,EventType
- ^IBM.296[45].*[13]\.[1-5].[[:xdigit:]]+$,1,cf_z13,core
- ^IBM.390[67].*[13]\.[1-5].[[:xdigit:]]+$,3,cf_z14,core
- ^IBM.856[12].*3\.6.[[:xdigit:]]+$,3,cf_z15,core
--^IBM.393[12].*3\.7.[[:xdigit:]]+$,3,cf_z16,core
-+^IBM.393[12].*$,3,cf_z16,core
---
-2.43.0
-
+++ /dev/null
-From bb6421731c41d7dac2b45ed03d4d7c041c0b5556 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 1 Apr 2024 14:27:23 +0800
-Subject: perf sched timehist: Fix -g/--call-graph option failure
-
-From: Yang Jihong <yangjihong@bytedance.com>
-
-[ Upstream commit 6e4b398770d5023eb6383da9360a23bd537c155b ]
-
-When 'perf sched' enables the call-graph recording, sample_type of dummy
-event does not have PERF_SAMPLE_CALLCHAIN, timehist_check_attr() checks
-that the evsel does not have a callchain, and set show_callchain to 0.
-
-Currently 'perf sched timehist' only saves callchain when processing the
-'sched:sched_switch event', timehist_check_attr() only needs to determine
-whether the event has PERF_SAMPLE_CALLCHAIN.
-
-Before:
-
- # perf sched record -g true
- [ perf record: Woken up 0 times to write data ]
- [ perf record: Captured and wrote 4.153 MB perf.data (7536 samples) ]
- # perf sched timehist
- Samples do not have callchains.
- time cpu task name wait time sch delay run time
- [tid/pid] (msec) (msec) (msec)
- --------------- ------ ------------------------------ --------- --------- ---------
- 147851.826019 [0000] perf[285035] 0.000 0.000 0.000
- 147851.826029 [0000] migration/0[15] 0.000 0.003 0.009
- 147851.826063 [0001] perf[285035] 0.000 0.000 0.000
- 147851.826069 [0001] migration/1[21] 0.000 0.003 0.006
- <SNIP>
-
-After:
-
- # perf sched record -g true
- [ perf record: Woken up 1 times to write data ]
- [ perf record: Captured and wrote 2.572 MB perf.data (822 samples) ]
- # perf sched timehist
- time cpu task name waittime sch delay runtime
- [tid/pid] (msec) (msec) (msec)
- ----------- --- --------------- -------- -------- -----
- 4193.035164 [0] perf[277062] 0.000 0.000 0.000 __traceiter_sched_switch <- __traceiter_sched_switch <- __sched_text_start <- preempt_schedule_common <- __cond_resched <- __wait_for_common <- wait_for_completion
- 4193.035174 [0] migration/0[15] 0.000 0.003 0.009 __traceiter_sched_switch <- __traceiter_sched_switch <- __sched_text_start <- smpboot_thread_fn <- kthread <- ret_from_fork
- 4193.035207 [1] perf[277062] 0.000 0.000 0.000 __traceiter_sched_switch <- __traceiter_sched_switch <- __sched_text_start <- preempt_schedule_common <- __cond_resched <- __wait_for_common <- wait_for_completion
- 4193.035214 [1] migration/1[21] 0.000 0.003 0.007 __traceiter_sched_switch <- __traceiter_sched_switch <- __sched_text_start <- smpboot_thread_fn <- kthread <- ret_from_fork
- <SNIP>
-
-Fixes: 9c95e4ef06572349 ("perf evlist: Add evlist__findnew_tracking_event() helper")
-Reviewed-by: Ian Rogers <irogers@google.com>
-Signed-off-by: Yang Jihong <yangjihong@bytedance.com>
-Cc: Adrian Hunter <adrian.hunter@intel.com>
-Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
-Cc: Ingo Molnar <mingo@redhat.com>
-Cc: James Clark <james.clark@arm.com>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Kan Liang <kan.liang@linux.intel.com>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Cc: Yang Jihong <yangjihong1@huawei.com>
-Link: https://lore.kernel.org/r/20240401062724.1006010-2-yangjihong@bytedance.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/builtin-sched.c | 7 +++++--
- 1 file changed, 5 insertions(+), 2 deletions(-)
-
-diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
-index dd6065afbbaf6..5c1badc4d8f2c 100644
---- a/tools/perf/builtin-sched.c
-+++ b/tools/perf/builtin-sched.c
-@@ -3000,8 +3000,11 @@ static int timehist_check_attr(struct perf_sched *sched,
- return -1;
- }
-
-- if (sched->show_callchain && !evsel__has_callchain(evsel)) {
-- pr_info("Samples do not have callchains.\n");
-+ /* only need to save callchain related to sched_switch event */
-+ if (sched->show_callchain &&
-+ evsel__name_is(evsel, "sched:sched_switch") &&
-+ !evsel__has_callchain(evsel)) {
-+ pr_info("Samples of sched_switch event do not have callchains.\n");
- sched->show_callchain = 0;
- symbol_conf.use_callchain = 0;
- }
---
-2.43.0
-
+++ /dev/null
-From b2f6dcd3d4e2ec49e26a558ec4496e849be4c95a Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 4 Apr 2024 08:48:06 +0200
-Subject: perf stat: Do not fail on metrics on s390 z/VM systems
-
-From: Thomas Richter <tmricht@linux.ibm.com>
-
-[ Upstream commit c2f3d7dfc7373d53286f2a5c882d3397a5070adc ]
-
-On s390 z/VM virtual machines command 'perf list' also displays metrics:
-
- # perf list | grep -A 20 'Metric Groups:'
- Metric Groups:
-
- No_group:
- cpi
- [Cycles per Instruction]
- est_cpi
- [Estimated Instruction Complexity CPI infinite Level 1]
- finite_cpi
- [Cycles per Instructions from Finite cache/memory]
- l1mp
- [Level One Miss per 100 Instructions]
- l2p
- [Percentage sourced from Level 2 cache]
- l3p
- [Percentage sourced from Level 3 on same chip cache]
- l4lp
- [Percentage sourced from Level 4 Local cache on same book]
- l4rp
- [Percentage sourced from Level 4 Remote cache on different book]
- memp
- [Percentage sourced from memory]
- ....
- #
-
-The command
-
- # perf stat -M cpi -- true
- event syntax error: '{CPU_CYCLES/metric-id=CPU_CYCLES/.....'
- \___ Bad event or PMU
-
- Unable to find PMU or event on a PMU of 'CPU_CYCLES'
-
- event syntax error: '{CPU_CYCLES/metric-id=CPU_CYCLES/...'
- \___ Cannot find PMU `CPU_CYCLES'.
- Missing kernel support?
- #
-
-fails. 'perf stat' should not fail on metrics when the referenced CPU
-Counter Measurement PMU is not available.
-
-Output after:
-
- # perf stat -M est_cpi -- sleep 1
-
- Performance counter stats for 'sleep 1':
-
- 1,000,887,494 ns duration_time # 0.00 est_cpi
-
- 1.000887494 seconds time elapsed
-
- 0.000143000 seconds user
- 0.000662000 seconds sys
-
- #
-
-Fixes: 7f76b31130680fb3 ("perf list: Add IBM z16 event description for s390")
-Suggested-by: Ian Rogers <irogers@google.com>
-Reviewed-by: Ian Rogers <irogers@google.com>
-Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
-Cc: Heiko Carstens <hca@linux.ibm.com>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Cc: Sumanth Korikkar <sumanthk@linux.ibm.com>
-Cc: Sven Schnelle <svens@linux.ibm.com>
-Cc: Vasily Gorbik <gor@linux.ibm.com>
-Link: https://lore.kernel.org/r/20240404064806.1362876-2-tmricht@linux.ibm.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- .../arch/s390/cf_z16/transaction.json | 28 +++++++++----------
- 1 file changed, 14 insertions(+), 14 deletions(-)
-
-diff --git a/tools/perf/pmu-events/arch/s390/cf_z16/transaction.json b/tools/perf/pmu-events/arch/s390/cf_z16/transaction.json
-index ec2ff78e2b5f2..3ab1d3a6638c4 100644
---- a/tools/perf/pmu-events/arch/s390/cf_z16/transaction.json
-+++ b/tools/perf/pmu-events/arch/s390/cf_z16/transaction.json
-@@ -2,71 +2,71 @@
- {
- "BriefDescription": "Transaction count",
- "MetricName": "transaction",
-- "MetricExpr": "TX_C_TEND + TX_NC_TEND + TX_NC_TABORT + TX_C_TABORT_SPECIAL + TX_C_TABORT_NO_SPECIAL"
-+ "MetricExpr": "TX_C_TEND + TX_NC_TEND + TX_NC_TABORT + TX_C_TABORT_SPECIAL + TX_C_TABORT_NO_SPECIAL if has_event(TX_C_TEND) else 0"
- },
- {
- "BriefDescription": "Cycles per Instruction",
- "MetricName": "cpi",
-- "MetricExpr": "CPU_CYCLES / INSTRUCTIONS"
-+ "MetricExpr": "CPU_CYCLES / INSTRUCTIONS if has_event(INSTRUCTIONS) else 0"
- },
- {
- "BriefDescription": "Problem State Instruction Ratio",
- "MetricName": "prbstate",
-- "MetricExpr": "(PROBLEM_STATE_INSTRUCTIONS / INSTRUCTIONS) * 100"
-+ "MetricExpr": "(PROBLEM_STATE_INSTRUCTIONS / INSTRUCTIONS) * 100 if has_event(INSTRUCTIONS) else 0"
- },
- {
- "BriefDescription": "Level One Miss per 100 Instructions",
- "MetricName": "l1mp",
-- "MetricExpr": "((L1I_DIR_WRITES + L1D_DIR_WRITES) / INSTRUCTIONS) * 100"
-+ "MetricExpr": "((L1I_DIR_WRITES + L1D_DIR_WRITES) / INSTRUCTIONS) * 100 if has_event(INSTRUCTIONS) else 0"
- },
- {
- "BriefDescription": "Percentage sourced from Level 2 cache",
- "MetricName": "l2p",
-- "MetricExpr": "((DCW_REQ + DCW_REQ_IV + ICW_REQ + ICW_REQ_IV) / (L1I_DIR_WRITES + L1D_DIR_WRITES)) * 100"
-+ "MetricExpr": "((DCW_REQ + DCW_REQ_IV + ICW_REQ + ICW_REQ_IV) / (L1I_DIR_WRITES + L1D_DIR_WRITES)) * 100 if has_event(DCW_REQ) else 0"
- },
- {
- "BriefDescription": "Percentage sourced from Level 3 on same chip cache",
- "MetricName": "l3p",
-- "MetricExpr": "((DCW_REQ_CHIP_HIT + DCW_ON_CHIP + DCW_ON_CHIP_IV + DCW_ON_CHIP_CHIP_HIT + ICW_REQ_CHIP_HIT + ICW_ON_CHIP + ICW_ON_CHIP_IV + ICW_ON_CHIP_CHIP_HIT) / (L1I_DIR_WRITES + L1D_DIR_WRITES)) * 100"
-+ "MetricExpr": "((DCW_REQ_CHIP_HIT + DCW_ON_CHIP + DCW_ON_CHIP_IV + DCW_ON_CHIP_CHIP_HIT + ICW_REQ_CHIP_HIT + ICW_ON_CHIP + ICW_ON_CHIP_IV + ICW_ON_CHIP_CHIP_HIT) / (L1I_DIR_WRITES + L1D_DIR_WRITES)) * 100 if has_event(DCW_REQ_CHIP_HIT) else 0"
- },
- {
- "BriefDescription": "Percentage sourced from Level 4 Local cache on same book",
- "MetricName": "l4lp",
-- "MetricExpr": "((DCW_REQ_DRAWER_HIT + DCW_ON_CHIP_DRAWER_HIT + DCW_ON_MODULE + DCW_ON_DRAWER + IDCW_ON_MODULE_IV + IDCW_ON_MODULE_CHIP_HIT + IDCW_ON_MODULE_DRAWER_HIT + IDCW_ON_DRAWER_IV + IDCW_ON_DRAWER_CHIP_HIT + IDCW_ON_DRAWER_DRAWER_HIT + ICW_REQ_DRAWER_HIT + ICW_ON_CHIP_DRAWER_HIT + ICW_ON_MODULE + ICW_ON_DRAWER) / (L1I_DIR_WRITES + L1D_DIR_WRITES)) * 100"
-+ "MetricExpr": "((DCW_REQ_DRAWER_HIT + DCW_ON_CHIP_DRAWER_HIT + DCW_ON_MODULE + DCW_ON_DRAWER + IDCW_ON_MODULE_IV + IDCW_ON_MODULE_CHIP_HIT + IDCW_ON_MODULE_DRAWER_HIT + IDCW_ON_DRAWER_IV + IDCW_ON_DRAWER_CHIP_HIT + IDCW_ON_DRAWER_DRAWER_HIT + ICW_REQ_DRAWER_HIT + ICW_ON_CHIP_DRAWER_HIT + ICW_ON_MODULE + ICW_ON_DRAWER) / (L1I_DIR_WRITES + L1D_DIR_WRITES)) * 100 if has_event(DCW_REQ_DRAWER_HIT) else 0"
- },
- {
- "BriefDescription": "Percentage sourced from Level 4 Remote cache on different book",
- "MetricName": "l4rp",
-- "MetricExpr": "((DCW_OFF_DRAWER + IDCW_OFF_DRAWER_IV + IDCW_OFF_DRAWER_CHIP_HIT + IDCW_OFF_DRAWER_DRAWER_HIT + ICW_OFF_DRAWER) / (L1I_DIR_WRITES + L1D_DIR_WRITES)) * 100"
-+ "MetricExpr": "((DCW_OFF_DRAWER + IDCW_OFF_DRAWER_IV + IDCW_OFF_DRAWER_CHIP_HIT + IDCW_OFF_DRAWER_DRAWER_HIT + ICW_OFF_DRAWER) / (L1I_DIR_WRITES + L1D_DIR_WRITES)) * 100 if has_event(DCW_OFF_DRAWER) else 0"
- },
- {
- "BriefDescription": "Percentage sourced from memory",
- "MetricName": "memp",
-- "MetricExpr": "((DCW_ON_CHIP_MEMORY + DCW_ON_MODULE_MEMORY + DCW_ON_DRAWER_MEMORY + DCW_OFF_DRAWER_MEMORY + ICW_ON_CHIP_MEMORY + ICW_ON_MODULE_MEMORY + ICW_ON_DRAWER_MEMORY + ICW_OFF_DRAWER_MEMORY) / (L1I_DIR_WRITES + L1D_DIR_WRITES)) * 100"
-+ "MetricExpr": "((DCW_ON_CHIP_MEMORY + DCW_ON_MODULE_MEMORY + DCW_ON_DRAWER_MEMORY + DCW_OFF_DRAWER_MEMORY + ICW_ON_CHIP_MEMORY + ICW_ON_MODULE_MEMORY + ICW_ON_DRAWER_MEMORY + ICW_OFF_DRAWER_MEMORY) / (L1I_DIR_WRITES + L1D_DIR_WRITES)) * 100 if has_event(DCW_ON_CHIP_MEMORY) else 0"
- },
- {
- "BriefDescription": "Cycles per Instructions from Finite cache/memory",
- "MetricName": "finite_cpi",
-- "MetricExpr": "L1C_TLB2_MISSES / INSTRUCTIONS"
-+ "MetricExpr": "L1C_TLB2_MISSES / INSTRUCTIONS if has_event(L1C_TLB2_MISSES) else 0"
- },
- {
- "BriefDescription": "Estimated Instruction Complexity CPI infinite Level 1",
- "MetricName": "est_cpi",
-- "MetricExpr": "(CPU_CYCLES / INSTRUCTIONS) - (L1C_TLB2_MISSES / INSTRUCTIONS)"
-+ "MetricExpr": "(CPU_CYCLES / INSTRUCTIONS) - (L1C_TLB2_MISSES / INSTRUCTIONS) if has_event(INSTRUCTIONS) else 0"
- },
- {
- "BriefDescription": "Estimated Sourcing Cycles per Level 1 Miss",
- "MetricName": "scpl1m",
-- "MetricExpr": "L1C_TLB2_MISSES / (L1I_DIR_WRITES + L1D_DIR_WRITES)"
-+ "MetricExpr": "L1C_TLB2_MISSES / (L1I_DIR_WRITES + L1D_DIR_WRITES) if has_event(L1C_TLB2_MISSES) else 0"
- },
- {
- "BriefDescription": "Estimated TLB CPU percentage of Total CPU",
- "MetricName": "tlb_percent",
-- "MetricExpr": "((DTLB2_MISSES + ITLB2_MISSES) / CPU_CYCLES) * (L1C_TLB2_MISSES / (L1I_PENALTY_CYCLES + L1D_PENALTY_CYCLES)) * 100"
-+ "MetricExpr": "((DTLB2_MISSES + ITLB2_MISSES) / CPU_CYCLES) * (L1C_TLB2_MISSES / (L1I_PENALTY_CYCLES + L1D_PENALTY_CYCLES)) * 100 if has_event(CPU_CYCLES) else 0"
- },
- {
- "BriefDescription": "Estimated Cycles per TLB Miss",
- "MetricName": "tlb_miss",
-- "MetricExpr": "((DTLB2_MISSES + ITLB2_MISSES) / (DTLB2_WRITES + ITLB2_WRITES)) * (L1C_TLB2_MISSES / (L1I_PENALTY_CYCLES + L1D_PENALTY_CYCLES))"
-+ "MetricExpr": "((DTLB2_MISSES + ITLB2_MISSES) / (DTLB2_WRITES + ITLB2_WRITES)) * (L1C_TLB2_MISSES / (L1I_PENALTY_CYCLES + L1D_PENALTY_CYCLES)) if has_event(DTLB2_MISSES) else 0"
- }
- ]
---
-2.43.0
-
+++ /dev/null
-From 0b77e9713f858dea849450535152e2d10a0e94da Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 9 May 2024 22:13:09 -0700
-Subject: perf stat: Don't display metric header for non-leader uncore events
-
-From: Ian Rogers <irogers@google.com>
-
-[ Upstream commit 193a9e30207f54777ff42d0d8be8389edc522277 ]
-
-On an Intel tigerlake laptop a metric like:
-
- {
- "BriefDescription": "Test",
- "MetricExpr": "imc_free_running@data_read@ + imc_free_running@data_write@",
- "MetricGroup": "Test",
- "MetricName": "Test",
- "ScaleUnit": "6.103515625e-5MiB"
- },
-
-Will have 4 events:
-
- uncore_imc_free_running_0/data_read/
- uncore_imc_free_running_0/data_write/
- uncore_imc_free_running_1/data_read/
- uncore_imc_free_running_1/data_write/
-
-If aggregration is disabled with metric-only 2 column headers are
-needed:
-
- $ perf stat -M test --metric-only -A -a sleep 1
-
- Performance counter stats for 'system wide':
-
- MiB Test MiB Test
- CPU0 1821.0 1820.5
-
-But when not, the counts aggregated in the metric leader and only 1
-column should be shown:
-
- $ perf stat -M test --metric-only -a sleep 1
- Performance counter stats for 'system wide':
-
- MiB Test
- 5909.4
-
- 1.001258915 seconds time elapsed
-
-Achieve this by skipping events that aren't metric leaders when
-printing column headers and aggregation isn't disabled.
-
-The bug is long standing, the fixes tag is set to a refactor as that
-is as far back as is reasonable to backport.
-
-Fixes: 088519f318be3a41 ("perf stat: Move the display functions to stat-display.c")
-Signed-off-by: Ian Rogers <irogers@google.com>
-Cc: Adrian Hunter <adrian.hunter@intel.com>
-Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
-Cc: Ingo Molnar <mingo@redhat.com>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Kaige Ye <ye@kaige.org>
-Cc: Kan Liang <kan.liang@linux.intel.com>
-Cc: K Prateek Nayak <kprateek.nayak@amd.com>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Cc: Yicong Yang <yangyicong@hisilicon.com>
-Link: https://lore.kernel.org/r/20240510051309.2452468-1-irogers@google.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/util/stat-display.c | 3 +++
- 1 file changed, 3 insertions(+)
-
-diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
-index b7d00a538d703..5f2e20448a074 100644
---- a/tools/perf/util/stat-display.c
-+++ b/tools/perf/util/stat-display.c
-@@ -1207,6 +1207,9 @@ static void print_metric_headers(struct perf_stat_config *config,
-
- /* Print metrics headers only */
- evlist__for_each_entry(evlist, counter) {
-+ if (config->aggr_mode != AGGR_NONE && counter->metric_leader != counter)
-+ continue;
-+
- os.evsel = counter;
-
- perf_stat__print_shadow_stats(config, counter, 0,
---
-2.43.0
-
+++ /dev/null
-From 338e6891c7bf6133941d9d8703521b4b5764da2d Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 7 May 2024 15:12:08 +0100
-Subject: perf symbols: Fix ownership of string in dso__load_vmlinux()
-
-From: James Clark <james.clark@arm.com>
-
-[ Upstream commit 25626e19ae6df34f336f235b6b3dbd1b566d2738 ]
-
-The linked commit updated dso__load_vmlinux() to call
-dso__set_long_name() before loading the symbols. Loading the symbols may
-not succeed but dso__set_long_name() takes ownership of the string. The
-two callers of this function free the string themselves on failure
-cases, resulting in the following error:
-
- $ perf record -- ls
- $ perf report
-
- free(): double free detected in tcache 2
-
-Fix it by always taking ownership of the string, even on failure. This
-means the string is either freed at the very first early exit condition,
-or later when the dso is deleted or the long name is replaced. Now no
-special return value is needed to signify that the caller needs to
-free the string.
-
-Fixes: e59fea47f83e8a9a ("perf symbols: Fix DSO kernel load and symbol process to correctly map DSO to its long_name, type and adjust_symbols")
-Reviewed-by: Ian Rogers <irogers@google.com>
-Signed-off-by: James Clark <james.clark@arm.com>
-Cc: Adrian Hunter <adrian.hunter@intel.com>
-Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
-Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
-Cc: Ingo Molnar <mingo@redhat.com>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Link: https://lore.kernel.org/r/20240507141210.195939-5-james.clark@arm.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/util/symbol.c | 11 ++++++++---
- 1 file changed, 8 insertions(+), 3 deletions(-)
-
-diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
-index be212ba157dc3..a5a56ed45ebc3 100644
---- a/tools/perf/util/symbol.c
-+++ b/tools/perf/util/symbol.c
-@@ -1937,6 +1937,10 @@ int dso__load(struct dso *dso, struct map *map)
- return ret;
- }
-
-+/*
-+ * Always takes ownership of vmlinux when vmlinux_allocated == true, even if
-+ * it returns an error.
-+ */
- int dso__load_vmlinux(struct dso *dso, struct map *map,
- const char *vmlinux, bool vmlinux_allocated)
- {
-@@ -1955,8 +1959,11 @@ int dso__load_vmlinux(struct dso *dso, struct map *map,
- else
- symtab_type = DSO_BINARY_TYPE__VMLINUX;
-
-- if (symsrc__init(&ss, dso, symfs_vmlinux, symtab_type))
-+ if (symsrc__init(&ss, dso, symfs_vmlinux, symtab_type)) {
-+ if (vmlinux_allocated)
-+ free((char *) vmlinux);
- return -1;
-+ }
-
- /*
- * dso__load_sym() may copy 'dso' which will result in the copies having
-@@ -1999,7 +2006,6 @@ int dso__load_vmlinux_path(struct dso *dso, struct map *map)
- err = dso__load_vmlinux(dso, map, filename, true);
- if (err > 0)
- goto out;
-- free(filename);
- }
- out:
- return err;
-@@ -2151,7 +2157,6 @@ static int dso__load_kernel_sym(struct dso *dso, struct map *map)
- err = dso__load_vmlinux(dso, map, filename, true);
- if (err > 0)
- return err;
-- free(filename);
- }
-
- if (!symbol_conf.ignore_vmlinux && vmlinux_path != NULL) {
---
-2.43.0
-
+++ /dev/null
-From 00135977a7c68175b21b25385a08daca7987474b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 26 Mar 2024 11:37:49 +0000
-Subject: perf test shell arm_coresight: Increase buffer size for Coresight
- basic tests
-
-From: James Clark <james.clark@arm.com>
-
-[ Upstream commit 10b6ee3b597b1b1b4dc390aaf9d589664af31df9 ]
-
-These tests record in a mode that includes kernel trace but look for
-samples of a userspace process. This makes them sensitive to any kernel
-compilation options that increase the amount of time spent in the
-kernel. If the trace buffer is completely filled before userspace is
-reached then the test will fail. Double the buffer size to fix this.
-
-The other tests in the same file aren't sensitive to this for various
-reasons, for example the iterate devices test filters by userspace trace
-only. But in order to keep coverage of all the modes, increase the
-buffer size rather than filtering by userspace for the basic tests.
-
-Fixes: d1efa4a0a696e487 ("perf cs-etm: Add separate decode paths for timeless and per-thread modes")
-Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
-Signed-off-by: James Clark <james.clark@arm.com>
-Cc: Adrian Hunter <adrian.hunter@intel.com>
-Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
-Cc: Ian Rogers <irogers@google.com>
-Cc: Ingo Molnar <mingo@redhat.com>
-Cc: James Clark <james.clark@arm.com>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Mike Leach <mike.leach@linaro.org>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
-Link: https://lore.kernel.org/r/20240326113749.257250-1-james.clark@arm.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/tests/shell/test_arm_coresight.sh | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tools/perf/tests/shell/test_arm_coresight.sh b/tools/perf/tests/shell/test_arm_coresight.sh
-index 65dd852071250..3302ea0b96723 100755
---- a/tools/perf/tests/shell/test_arm_coresight.sh
-+++ b/tools/perf/tests/shell/test_arm_coresight.sh
-@@ -188,7 +188,7 @@ arm_cs_etm_snapshot_test() {
-
- arm_cs_etm_basic_test() {
- echo "Recording trace with '$*'"
-- perf record -o ${perfdata} "$@" -- ls > /dev/null 2>&1
-+ perf record -o ${perfdata} "$@" -m,8M -- ls > /dev/null 2>&1
-
- perf_script_branch_samples ls &&
- perf_report_branch_samples ls &&
---
-2.43.0
-
+++ /dev/null
-From 23b3648c2aa2c1084242ce36ed91eb828a4f5155 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 10 Apr 2024 11:34:53 +0100
-Subject: perf tests: Apply attributes to all events in object code reading
- test
-
-From: James Clark <james.clark@arm.com>
-
-[ Upstream commit 2dade41a533f337447b945239b87ff31a8857890 ]
-
-PERF_PMU_CAP_EXTENDED_HW_TYPE results in multiple events being opened on
-heterogeneous systems. Currently this test only sets its required
-attributes on the first event. Not disabling enable_on_exec on the other
-events causes the test to fail because the forked objdump processes are
-sampled. No tracking event is opened so Perf only knows about its own
-mappings causing the objdump samples to give the following error:
-
- $ perf test -vvv "object code reading"
-
- Reading object code for memory address: 0xffff9aaa55ec
- thread__find_map failed
- ---- end(-1) ----
- 24: Object code reading : FAILED!
-
-Fixes: 251aa040244a3b17 ("perf parse-events: Wildcard most "numeric" events")
-Reviewed-by: Ian Rogers <irogers@google.com>
-Signed-off-by: James Clark <james.clark@arm.com>
-Acked-by: Namhyung Kim <namhyung@kernel.org>
-Cc: Adrian Hunter <adrian.hunter@intel.com>
-Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
-Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
-Cc: Ian Rogers <irogers@google.com>
-Cc: Ingo Molnar <mingo@redhat.com>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Kan Liang <kan.liang@linux.intel.com>
-Cc: Leo Yan <leo.yan@linux.dev>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Cc: Spoorthy S <spoorts2@in.ibm.com>
-Link: https://lore.kernel.org/r/20240410103458.813656-3-james.clark@arm.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/tests/code-reading.c | 10 +++++-----
- 1 file changed, 5 insertions(+), 5 deletions(-)
-
-diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
-index 7a3a7bbbec714..29d2f3ee4e10f 100644
---- a/tools/perf/tests/code-reading.c
-+++ b/tools/perf/tests/code-reading.c
-@@ -637,11 +637,11 @@ static int do_test_code_reading(bool try_kcore)
-
- evlist__config(evlist, &opts, NULL);
-
-- evsel = evlist__first(evlist);
--
-- evsel->core.attr.comm = 1;
-- evsel->core.attr.disabled = 1;
-- evsel->core.attr.enable_on_exec = 0;
-+ evlist__for_each_entry(evlist, evsel) {
-+ evsel->core.attr.comm = 1;
-+ evsel->core.attr.disabled = 1;
-+ evsel->core.attr.enable_on_exec = 0;
-+ }
-
- ret = evlist__open(evlist);
- if (ret < 0) {
---
-2.43.0
-
+++ /dev/null
-From 5b222890b3ad9500f5ab5ea3e4148513862b8368 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 10 Apr 2024 11:34:52 +0100
-Subject: perf tests: Make "test data symbol" more robust on Neoverse N1
-
-From: James Clark <james.clark@arm.com>
-
-[ Upstream commit 256ef072b3842273ce703db18b603b051aca95fe ]
-
-To prevent anyone from seeing a test failure appear as a regression and
-thinking that it was caused by their code change, insert some noise into
-the loop which makes it immune to sampling bias issues (errata 1694299).
-
-The "test data symbol" test can fail with any unrelated change that
-shifts the loop into an unfortunate position in the Perf binary which is
-almost impossible to debug as the root cause of the test failure.
-Ultimately it's caused by the referenced errata.
-
-Fixes: 60abedb8aa902b06 ("perf test: Introduce script for data symbol testing")
-Reviewed-by: Ian Rogers <irogers@google.com>
-Signed-off-by: James Clark <james.clark@arm.com>
-Acked-by: Namhyung Kim <namhyung@kernel.org>
-Cc: Adrian Hunter <adrian.hunter@intel.com>
-Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
-Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
-Cc: Ingo Molnar <mingo@redhat.com>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Kan Liang <kan.liang@linux.intel.com>
-Cc: Leo Yan <leo.yan@linux.dev>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Cc: Spoorthy S <spoorts2@in.ibm.com>
-Link: https://lore.kernel.org/r/20240410103458.813656-2-james.clark@arm.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/tests/workloads/datasym.c | 16 ++++++++++++++++
- 1 file changed, 16 insertions(+)
-
-diff --git a/tools/perf/tests/workloads/datasym.c b/tools/perf/tests/workloads/datasym.c
-index ddd40bc63448a..8e08fc75a973e 100644
---- a/tools/perf/tests/workloads/datasym.c
-+++ b/tools/perf/tests/workloads/datasym.c
-@@ -16,6 +16,22 @@ static int datasym(int argc __maybe_unused, const char **argv __maybe_unused)
- {
- for (;;) {
- buf1.data1++;
-+ if (buf1.data1 == 123) {
-+ /*
-+ * Add some 'noise' in the loop to work around errata
-+ * 1694299 on Arm N1.
-+ *
-+ * Bias exists in SPE sampling which can cause the load
-+ * and store instructions to be skipped entirely. This
-+ * comes and goes randomly depending on the offset the
-+ * linker places the datasym loop at in the Perf binary.
-+ * With an extra branch in the middle of the loop that
-+ * isn't always taken, the instruction stream is no
-+ * longer a continuous repeating pattern that interacts
-+ * badly with the bias.
-+ */
-+ buf1.data1++;
-+ }
- buf1.data2 += buf1.data1;
- }
- return 0;
---
-2.43.0
-
+++ /dev/null
-From 0c9a66599e32b406406de069928a17c5b9a80f5f Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 7 May 2024 20:53:01 -0700
-Subject: perf thread: Fixes to thread__new() related to initializing comm
-
-From: Ian Rogers <irogers@google.com>
-
-[ Upstream commit 3536c2575e88a890cf696b4ccd3da36bc937853b ]
-
-Freeing the thread on failure won't work with reference count checking,
-use thread__delete().
-
-Don't allocate the comm_str, use a stack allocation instead.
-
-Fixes: f6005cafebab72f8 ("perf thread: Add reference count checking")
-Signed-off-by: Ian Rogers <irogers@google.com>
-Cc: Adrian Hunter <adrian.hunter@intel.com>
-Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
-Cc: Ingo Molnar <mingo@redhat.com>
-Cc: James Clark <james.clark@arm.com>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Kan Liang <kan.liang@linux.intel.com>
-Cc: Leo Yan <leo.yan@linux.dev>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Link: https://lore.kernel.org/r/20240508035301.1554434-5-irogers@google.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/util/thread.c | 14 +++++---------
- 1 file changed, 5 insertions(+), 9 deletions(-)
-
-diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
-index 89c47a5098e28..0170e4b5340df 100644
---- a/tools/perf/util/thread.c
-+++ b/tools/perf/util/thread.c
-@@ -39,12 +39,13 @@ int thread__init_maps(struct thread *thread, struct machine *machine)
-
- struct thread *thread__new(pid_t pid, pid_t tid)
- {
-- char *comm_str;
-- struct comm *comm;
- RC_STRUCT(thread) *_thread = zalloc(sizeof(*_thread));
- struct thread *thread;
-
- if (ADD_RC_CHK(thread, _thread) != NULL) {
-+ struct comm *comm;
-+ char comm_str[32];
-+
- thread__set_pid(thread, pid);
- thread__set_tid(thread, tid);
- thread__set_ppid(thread, -1);
-@@ -56,13 +57,8 @@ struct thread *thread__new(pid_t pid, pid_t tid)
- init_rwsem(thread__namespaces_lock(thread));
- init_rwsem(thread__comm_lock(thread));
-
-- comm_str = malloc(32);
-- if (!comm_str)
-- goto err_thread;
--
-- snprintf(comm_str, 32, ":%d", tid);
-+ snprintf(comm_str, sizeof(comm_str), ":%d", tid);
- comm = comm__new(comm_str, 0, false);
-- free(comm_str);
- if (!comm)
- goto err_thread;
-
-@@ -76,7 +72,7 @@ struct thread *thread__new(pid_t pid, pid_t tid)
- return thread;
-
- err_thread:
-- free(thread);
-+ thread__delete(thread);
- return NULL;
- }
-
---
-2.43.0
-
+++ /dev/null
-From 887012f45b49171169c2d96a0757a43d5d3d9274 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 7 Mar 2024 16:19:15 -0800
-Subject: perf tools: Add/use PMU reverse lookup from config to name
-
-From: Ian Rogers <irogers@google.com>
-
-[ Upstream commit 67ee8e71daabb8632931b7559e5c8a4b69a427f8 ]
-
-Add perf_pmu__name_from_config that does a reverse lookup from a
-config number to an alias name. The lookup is expensive as the config
-is computed for every alias by filling in a perf_event_attr, but this
-is only done when verbose output is enabled. The lookup also only
-considers config, and not config1, config2 or config3.
-
-An example of the output:
-
- $ perf stat -vv -e data_read true
- ...
- perf_event_attr:
- type 24 (uncore_imc_free_running_0)
- size 136
- config 0x20ff (data_read)
- sample_type IDENTIFIER
- read_format TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
- disabled 1
- inherit 1
- exclude_guest 1
- ...
-
-Committer notes:
-
-Fix the python binding build by adding dummies for not strictly
-needed perf_pmu__name_from_config() and perf_pmus__find_by_type().
-
-Signed-off-by: Ian Rogers <irogers@google.com>
-Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Tested-by: Kan Liang <kan.liang@linux.intel.com>
-Cc: Adrian Hunter <adrian.hunter@intel.com>
-Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
-Cc: Ingo Molnar <mingo@redhat.com>
-Cc: James Clark <james.clark@arm.com>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Cc: Ravi Bangoria <ravi.bangoria@amd.com>
-Cc: Yang Jihong <yangjihong1@huawei.com>
-Link: https://lore.kernel.org/r/20240308001915.4060155-7-irogers@google.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Stable-dep-of: d9c5f5f94c2d ("perf pmu: Count sys and cpuid JSON events separately")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/util/perf_event_attr_fprintf.c | 10 ++++++++--
- tools/perf/util/pmu.c | 18 ++++++++++++++++++
- tools/perf/util/pmu.h | 1 +
- tools/perf/util/python.c | 10 ++++++++++
- 4 files changed, 37 insertions(+), 2 deletions(-)
-
-diff --git a/tools/perf/util/perf_event_attr_fprintf.c b/tools/perf/util/perf_event_attr_fprintf.c
-index 29e66835da3a7..59fbbba796974 100644
---- a/tools/perf/util/perf_event_attr_fprintf.c
-+++ b/tools/perf/util/perf_event_attr_fprintf.c
-@@ -222,8 +222,14 @@ static void __p_config_tracepoint_id(char *buf, size_t size, u64 value)
- }
- #endif
-
--static void __p_config_id(char *buf, size_t size, u32 type, u64 value)
-+static void __p_config_id(struct perf_pmu *pmu, char *buf, size_t size, u32 type, u64 value)
- {
-+ const char *name = perf_pmu__name_from_config(pmu, value);
-+
-+ if (name) {
-+ print_id_hex(name);
-+ return;
-+ }
- switch (type) {
- case PERF_TYPE_HARDWARE:
- return __p_config_hw_id(buf, size, value);
-@@ -252,7 +258,7 @@ static void __p_config_id(char *buf, size_t size, u32 type, u64 value)
- #define p_branch_sample_type(val) __p_branch_sample_type(buf, BUF_SIZE, val)
- #define p_read_format(val) __p_read_format(buf, BUF_SIZE, val)
- #define p_type_id(val) __p_type_id(pmu, buf, BUF_SIZE, val)
--#define p_config_id(val) __p_config_id(buf, BUF_SIZE, attr->type, val)
-+#define p_config_id(val) __p_config_id(pmu, buf, BUF_SIZE, attr->type, val)
-
- #define PRINT_ATTRn(_n, _f, _p, _a) \
- do { \
-diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
-index 6b82f4759ce69..a0ec0103e0a62 100644
---- a/tools/perf/util/pmu.c
-+++ b/tools/perf/util/pmu.c
-@@ -2082,3 +2082,21 @@ void perf_pmu__delete(struct perf_pmu *pmu)
- zfree(&pmu->id);
- free(pmu);
- }
-+
-+const char *perf_pmu__name_from_config(struct perf_pmu *pmu, u64 config)
-+{
-+ struct perf_pmu_alias *event;
-+
-+ if (!pmu)
-+ return NULL;
-+
-+ pmu_add_cpu_aliases(pmu);
-+ list_for_each_entry(event, &pmu->aliases, list) {
-+ struct perf_event_attr attr = {.config = 0,};
-+ int ret = perf_pmu__config(pmu, &attr, &event->terms, NULL);
-+
-+ if (ret == 0 && config == attr.config)
-+ return event->name;
-+ }
-+ return NULL;
-+}
-diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
-index 424c3fee09496..109f3704a6461 100644
---- a/tools/perf/util/pmu.h
-+++ b/tools/perf/util/pmu.h
-@@ -266,5 +266,6 @@ struct perf_pmu *perf_pmu__lookup(struct list_head *pmus, int dirfd, const char
- struct perf_pmu *perf_pmu__create_placeholder_core_pmu(struct list_head *core_pmus);
- void perf_pmu__delete(struct perf_pmu *pmu);
- struct perf_pmu *perf_pmus__find_core_pmu(void);
-+const char *perf_pmu__name_from_config(struct perf_pmu *pmu, u64 config);
-
- #endif /* __PMU_H */
-diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
-index 8761f51b5c7c8..ae4b2cd2e1e95 100644
---- a/tools/perf/util/python.c
-+++ b/tools/perf/util/python.c
-@@ -103,6 +103,16 @@ int perf_pmu__scan_file(const struct perf_pmu *pmu, const char *name, const char
- return EOF;
- }
-
-+const char *perf_pmu__name_from_config(struct perf_pmu *pmu __maybe_unused, u64 config __maybe_unused)
-+{
-+ return NULL;
-+}
-+
-+struct perf_pmu *perf_pmus__find_by_type(unsigned int type __maybe_unused)
-+{
-+ return NULL;
-+}
-+
- int perf_pmus__num_core_pmus(void)
- {
- return 1;
---
-2.43.0
-
+++ /dev/null
-From 985e9f404a44637d63d1aede899d5fea45dc1efe Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 7 Mar 2024 16:19:14 -0800
-Subject: perf tools: Use pmus to describe type from attribute
-
-From: Ian Rogers <irogers@google.com>
-
-[ Upstream commit 7093882067e2e2f88d3449c35c5f0f3f566c8a26 ]
-
-When dumping a perf_event_attr, use pmus to find the PMU and its name
-by the type number. This allows dynamically added PMUs to be described.
-
-Before:
-
- $ perf stat -vv -e data_read true
- ...
- perf_event_attr:
- type 24
- size 136
- config 0x20ff
- sample_type IDENTIFIER
- read_format TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
- disabled 1
- inherit 1
- exclude_guest 1
- ...
-
-After:
-
- $ perf stat -vv -e data_read true
- ...
- perf_event_attr:
- type 24 (uncore_imc_free_running_0)
- size 136
- config 0x20ff
- sample_type IDENTIFIER
- read_format TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
- disabled 1
- inherit 1
- exclude_guest 1
- ...
-
-However, it also means that when we have a PMU name we prefer it to a
-hard coded name:
-
-Before:
-
- $ perf stat -vv -e faults true
- ...
- perf_event_attr:
- type 1 (PERF_TYPE_SOFTWARE)
- size 136
- config 0x2 (PERF_COUNT_SW_PAGE_FAULTS)
- sample_type IDENTIFIER
- read_format TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
- disabled 1
- inherit 1
- enable_on_exec 1
- exclude_guest 1
- ...
-
-After:
-
- $ perf stat -vv -e faults true
- ...
- perf_event_attr:
- type 1 (software)
- size 136
- config 0x2 (PERF_COUNT_SW_PAGE_FAULTS)
- sample_type IDENTIFIER
- read_format TOTAL_TIME_ENABLED|TOTAL_TIME_RUNNING
- disabled 1
- inherit 1
- enable_on_exec 1
- exclude_guest 1
- ...
-
-It feels more consistent to do this, rather than only prefer a PMU
-name when a hard coded name isn't available.
-
-Signed-off-by: Ian Rogers <irogers@google.com>
-Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Tested-by: Kan Liang <kan.liang@linux.intel.com>
-Cc: Adrian Hunter <adrian.hunter@intel.com>
-Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
-Cc: Ingo Molnar <mingo@redhat.com>
-Cc: James Clark <james.clark@arm.com>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Cc: Ravi Bangoria <ravi.bangoria@amd.com>
-Cc: Yang Jihong <yangjihong1@huawei.com>
-Link: https://lore.kernel.org/r/20240308001915.4060155-6-irogers@google.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Stable-dep-of: d9c5f5f94c2d ("perf pmu: Count sys and cpuid JSON events separately")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/util/perf_event_attr_fprintf.c | 16 +++++++++++-----
- 1 file changed, 11 insertions(+), 5 deletions(-)
-
-diff --git a/tools/perf/util/perf_event_attr_fprintf.c b/tools/perf/util/perf_event_attr_fprintf.c
-index 8f04d3b7f3ec7..29e66835da3a7 100644
---- a/tools/perf/util/perf_event_attr_fprintf.c
-+++ b/tools/perf/util/perf_event_attr_fprintf.c
-@@ -7,6 +7,8 @@
- #include <linux/types.h>
- #include <linux/perf_event.h>
- #include "util/evsel_fprintf.h"
-+#include "util/pmu.h"
-+#include "util/pmus.h"
- #include "trace-event.h"
-
- struct bit_names {
-@@ -75,9 +77,12 @@ static void __p_read_format(char *buf, size_t size, u64 value)
- }
-
- #define ENUM_ID_TO_STR_CASE(x) case x: return (#x);
--static const char *stringify_perf_type_id(u64 value)
-+static const char *stringify_perf_type_id(struct perf_pmu *pmu, u32 type)
- {
-- switch (value) {
-+ if (pmu)
-+ return pmu->name;
-+
-+ switch (type) {
- ENUM_ID_TO_STR_CASE(PERF_TYPE_HARDWARE)
- ENUM_ID_TO_STR_CASE(PERF_TYPE_SOFTWARE)
- ENUM_ID_TO_STR_CASE(PERF_TYPE_TRACEPOINT)
-@@ -175,9 +180,9 @@ do { \
- #define print_id_unsigned(_s) PRINT_ID(_s, "%"PRIu64)
- #define print_id_hex(_s) PRINT_ID(_s, "%#"PRIx64)
-
--static void __p_type_id(char *buf, size_t size, u64 value)
-+static void __p_type_id(struct perf_pmu *pmu, char *buf, size_t size, u64 value)
- {
-- print_id_unsigned(stringify_perf_type_id(value));
-+ print_id_unsigned(stringify_perf_type_id(pmu, value));
- }
-
- static void __p_config_hw_id(char *buf, size_t size, u64 value)
-@@ -246,7 +251,7 @@ static void __p_config_id(char *buf, size_t size, u32 type, u64 value)
- #define p_sample_type(val) __p_sample_type(buf, BUF_SIZE, val)
- #define p_branch_sample_type(val) __p_branch_sample_type(buf, BUF_SIZE, val)
- #define p_read_format(val) __p_read_format(buf, BUF_SIZE, val)
--#define p_type_id(val) __p_type_id(buf, BUF_SIZE, val)
-+#define p_type_id(val) __p_type_id(pmu, buf, BUF_SIZE, val)
- #define p_config_id(val) __p_config_id(buf, BUF_SIZE, attr->type, val)
-
- #define PRINT_ATTRn(_n, _f, _p, _a) \
-@@ -262,6 +267,7 @@ do { \
- int perf_event_attr__fprintf(FILE *fp, struct perf_event_attr *attr,
- attr__fprintf_f attr__fprintf, void *priv)
- {
-+ struct perf_pmu *pmu = perf_pmus__find_by_type(attr->type);
- char buf[BUF_SIZE];
- int ret = 0;
-
---
-2.43.0
-
+++ /dev/null
-From 685434350fb95dd1b2614f65fabfab4d10a64c80 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 7 May 2024 20:52:58 -0700
-Subject: perf ui browser: Avoid SEGV on title
-
-From: Ian Rogers <irogers@google.com>
-
-[ Upstream commit 90f01afb0dfafbc9b094bb61e61a4ac297d9d0d2 ]
-
-If the title is NULL then it can lead to a SEGV.
-
-Fixes: 769e6a1e15bdbbaf ("perf ui browser: Don't save pointer to stack memory")
-Signed-off-by: Ian Rogers <irogers@google.com>
-Cc: Adrian Hunter <adrian.hunter@intel.com>
-Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
-Cc: Ingo Molnar <mingo@redhat.com>
-Cc: James Clark <james.clark@arm.com>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Kan Liang <kan.liang@linux.intel.com>
-Cc: Leo Yan <leo.yan@linux.dev>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Link: https://lore.kernel.org/r/20240508035301.1554434-2-irogers@google.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/ui/browser.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tools/perf/ui/browser.c b/tools/perf/ui/browser.c
-index c4cdf2ea69b72..19503e8387385 100644
---- a/tools/perf/ui/browser.c
-+++ b/tools/perf/ui/browser.c
-@@ -203,7 +203,7 @@ void ui_browser__refresh_dimensions(struct ui_browser *browser)
- void ui_browser__handle_resize(struct ui_browser *browser)
- {
- ui__refresh_dimensions(false);
-- ui_browser__show(browser, browser->title, ui_helpline__current);
-+ ui_browser__show(browser, browser->title ?: "", ui_helpline__current);
- ui_browser__refresh(browser);
- }
-
---
-2.43.0
-
+++ /dev/null
-From 471eb64019f6d54783e338891d028c6f98ff0e5b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 7 May 2024 11:35:38 -0700
-Subject: perf ui browser: Don't save pointer to stack memory
-
-From: Ian Rogers <irogers@google.com>
-
-[ Upstream commit 769e6a1e15bdbbaf2b0d2f37c24f2c53268bd21f ]
-
-ui_browser__show() is capturing the input title that is stack allocated
-memory in hist_browser__run().
-
-Avoid a use after return by strdup-ing the string.
-
-Committer notes:
-
-Further explanation from Ian Rogers:
-
-My command line using tui is:
-$ sudo bash -c 'rm /tmp/asan.log*; export
-ASAN_OPTIONS="log_path=/tmp/asan.log"; /tmp/perf/perf mem record -a
-sleep 1; /tmp/perf/perf mem report'
-I then go to the perf annotate view and quit. This triggers the asan
-error (from the log file):
-```
-==1254591==ERROR: AddressSanitizer: stack-use-after-return on address
-0x7f2813331920 at pc 0x7f28180
-65991 bp 0x7fff0a21c750 sp 0x7fff0a21bf10
-READ of size 80 at 0x7f2813331920 thread T0
- #0 0x7f2818065990 in __interceptor_strlen
-../../../../src/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:461
- #1 0x7f2817698251 in SLsmg_write_wrapped_string
-(/lib/x86_64-linux-gnu/libslang.so.2+0x98251)
- #2 0x7f28176984b9 in SLsmg_write_nstring
-(/lib/x86_64-linux-gnu/libslang.so.2+0x984b9)
- #3 0x55c94045b365 in ui_browser__write_nstring ui/browser.c:60
- #4 0x55c94045c558 in __ui_browser__show_title ui/browser.c:266
- #5 0x55c94045c776 in ui_browser__show ui/browser.c:288
- #6 0x55c94045c06d in ui_browser__handle_resize ui/browser.c:206
- #7 0x55c94047979b in do_annotate ui/browsers/hists.c:2458
- #8 0x55c94047fb17 in evsel__hists_browse ui/browsers/hists.c:3412
- #9 0x55c940480a0c in perf_evsel_menu__run ui/browsers/hists.c:3527
- #10 0x55c940481108 in __evlist__tui_browse_hists ui/browsers/hists.c:3613
- #11 0x55c9404813f7 in evlist__tui_browse_hists ui/browsers/hists.c:3661
- #12 0x55c93ffa253f in report__browse_hists tools/perf/builtin-report.c:671
- #13 0x55c93ffa58ca in __cmd_report tools/perf/builtin-report.c:1141
- #14 0x55c93ffaf159 in cmd_report tools/perf/builtin-report.c:1805
- #15 0x55c94000c05c in report_events tools/perf/builtin-mem.c:374
- #16 0x55c94000d96d in cmd_mem tools/perf/builtin-mem.c:516
- #17 0x55c9400e44ee in run_builtin tools/perf/perf.c:350
- #18 0x55c9400e4a5a in handle_internal_command tools/perf/perf.c:403
- #19 0x55c9400e4e22 in run_argv tools/perf/perf.c:447
- #20 0x55c9400e53ad in main tools/perf/perf.c:561
- #21 0x7f28170456c9 in __libc_start_call_main
-../sysdeps/nptl/libc_start_call_main.h:58
- #22 0x7f2817045784 in __libc_start_main_impl ../csu/libc-start.c:360
- #23 0x55c93ff544c0 in _start (/tmp/perf/perf+0x19a4c0) (BuildId:
-84899b0e8c7d3a3eaa67b2eb35e3d8b2f8cd4c93)
-
-Address 0x7f2813331920 is located in stack of thread T0 at offset 32 in frame
- #0 0x55c94046e85e in hist_browser__run ui/browsers/hists.c:746
-
- This frame has 1 object(s):
- [32, 192) 'title' (line 747) <== Memory access at offset 32 is
-inside this variable
-HINT: this may be a false positive if your program uses some custom
-stack unwind mechanism, swapcontext or vfork
-```
-hist_browser__run isn't on the stack so the asan error looks legit.
-There's no clean init/exit on struct ui_browser so I may be trading a
-use-after-return for a memory leak, but that seems look a good trade
-anyway.
-
-Fixes: 05e8b0804ec4 ("perf ui browser: Stop using 'self'")
-Signed-off-by: Ian Rogers <irogers@google.com>
-Cc: Adrian Hunter <adrian.hunter@intel.com>
-Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
-Cc: Andi Kleen <ak@linux.intel.com>
-Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
-Cc: Ben Gainey <ben.gainey@arm.com>
-Cc: Ingo Molnar <mingo@redhat.com>
-Cc: James Clark <james.clark@arm.com>
-Cc: Jiri Olsa <jolsa@kernel.org>
-Cc: Kajol Jain <kjain@linux.ibm.com>
-Cc: Kan Liang <kan.liang@linux.intel.com>
-Cc: K Prateek Nayak <kprateek.nayak@amd.com>
-Cc: Li Dong <lidong@vivo.com>
-Cc: Mark Rutland <mark.rutland@arm.com>
-Cc: Namhyung Kim <namhyung@kernel.org>
-Cc: Oliver Upton <oliver.upton@linux.dev>
-Cc: Paran Lee <p4ranlee@gmail.com>
-Cc: Peter Zijlstra <peterz@infradead.org>
-Cc: Ravi Bangoria <ravi.bangoria@amd.com>
-Cc: Sun Haiyong <sunhaiyong@loongson.cn>
-Cc: Tim Chen <tim.c.chen@linux.intel.com>
-Cc: Yanteng Si <siyanteng@loongson.cn>
-Cc: Yicong Yang <yangyicong@hisilicon.com>
-Link: https://lore.kernel.org/r/20240507183545.1236093-2-irogers@google.com
-Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/perf/ui/browser.c | 4 +++-
- tools/perf/ui/browser.h | 2 +-
- 2 files changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/tools/perf/ui/browser.c b/tools/perf/ui/browser.c
-index 603d11283cbdc..c4cdf2ea69b72 100644
---- a/tools/perf/ui/browser.c
-+++ b/tools/perf/ui/browser.c
-@@ -287,7 +287,8 @@ int ui_browser__show(struct ui_browser *browser, const char *title,
- mutex_lock(&ui__lock);
- __ui_browser__show_title(browser, title);
-
-- browser->title = title;
-+ free(browser->title);
-+ browser->title = strdup(title);
- zfree(&browser->helpline);
-
- va_start(ap, helpline);
-@@ -304,6 +305,7 @@ void ui_browser__hide(struct ui_browser *browser)
- mutex_lock(&ui__lock);
- ui_helpline__pop();
- zfree(&browser->helpline);
-+ zfree(&browser->title);
- mutex_unlock(&ui__lock);
- }
-
-diff --git a/tools/perf/ui/browser.h b/tools/perf/ui/browser.h
-index 510ce45540501..6e98d5f8f71cc 100644
---- a/tools/perf/ui/browser.h
-+++ b/tools/perf/ui/browser.h
-@@ -21,7 +21,7 @@ struct ui_browser {
- u8 extra_title_lines;
- int current_color;
- void *priv;
-- const char *title;
-+ char *title;
- char *helpline;
- const char *no_samples_msg;
- void (*refresh_dimensions)(struct ui_browser *browser);
---
-2.43.0
-
+++ /dev/null
-From c0734231ffeb16556f8470ccb8b359658598221b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 23 Apr 2024 23:32:45 +0300
-Subject: pinctrl: qcom: pinctrl-sm7150: Fix sdc1 and ufs special pins regs
-
-From: Danila Tikhonov <danila@jiaxyga.com>
-
-[ Upstream commit 5ed79863fae5c06eb33f5cd6b6bdf22dd7089392 ]
-
-SDC1 and UFS_RESET special pins are located in the west memory bank.
-
-SDC1 have address 0x359a000:
-0x3500000 (TLMM BASE) + 0x0 (WEST) + 0x9a000 (SDC1_OFFSET) = 0x359a000
-
-UFS_RESET have address 0x359f000:
-0x3500000 (TLMM BASE) + 0x0 (WEST) + 0x9f000 (UFS_OFFSET) = 0x359a000
-
-Fixes: b915395c9e04 ("pinctrl: qcom: Add SM7150 pinctrl driver")
-Signed-off-by: Danila Tikhonov <danila@jiaxyga.com>
-Message-ID: <20240423203245.188480-1-danila@jiaxyga.com>
-Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/pinctrl/qcom/pinctrl-sm7150.c | 20 ++++++++++----------
- 1 file changed, 10 insertions(+), 10 deletions(-)
-
-diff --git a/drivers/pinctrl/qcom/pinctrl-sm7150.c b/drivers/pinctrl/qcom/pinctrl-sm7150.c
-index c25357ca1963e..b9f067de8ef0e 100644
---- a/drivers/pinctrl/qcom/pinctrl-sm7150.c
-+++ b/drivers/pinctrl/qcom/pinctrl-sm7150.c
-@@ -65,7 +65,7 @@ enum {
- .intr_detection_width = 2, \
- }
-
--#define SDC_QDSD_PINGROUP(pg_name, ctl, pull, drv) \
-+#define SDC_QDSD_PINGROUP(pg_name, _tile, ctl, pull, drv) \
- { \
- .grp = PINCTRL_PINGROUP(#pg_name, \
- pg_name##_pins, \
-@@ -75,7 +75,7 @@ enum {
- .intr_cfg_reg = 0, \
- .intr_status_reg = 0, \
- .intr_target_reg = 0, \
-- .tile = SOUTH, \
-+ .tile = _tile, \
- .mux_bit = -1, \
- .pull_bit = pull, \
- .drv_bit = drv, \
-@@ -101,7 +101,7 @@ enum {
- .intr_cfg_reg = 0, \
- .intr_status_reg = 0, \
- .intr_target_reg = 0, \
-- .tile = SOUTH, \
-+ .tile = WEST, \
- .mux_bit = -1, \
- .pull_bit = 3, \
- .drv_bit = 0, \
-@@ -1199,13 +1199,13 @@ static const struct msm_pingroup sm7150_groups[] = {
- [117] = PINGROUP(117, NORTH, _, _, _, _, _, _, _, _, _),
- [118] = PINGROUP(118, NORTH, _, _, _, _, _, _, _, _, _),
- [119] = UFS_RESET(ufs_reset, 0x9f000),
-- [120] = SDC_QDSD_PINGROUP(sdc1_rclk, 0x9a000, 15, 0),
-- [121] = SDC_QDSD_PINGROUP(sdc1_clk, 0x9a000, 13, 6),
-- [122] = SDC_QDSD_PINGROUP(sdc1_cmd, 0x9a000, 11, 3),
-- [123] = SDC_QDSD_PINGROUP(sdc1_data, 0x9a000, 9, 0),
-- [124] = SDC_QDSD_PINGROUP(sdc2_clk, 0x98000, 14, 6),
-- [125] = SDC_QDSD_PINGROUP(sdc2_cmd, 0x98000, 11, 3),
-- [126] = SDC_QDSD_PINGROUP(sdc2_data, 0x98000, 9, 0),
-+ [120] = SDC_QDSD_PINGROUP(sdc1_rclk, WEST, 0x9a000, 15, 0),
-+ [121] = SDC_QDSD_PINGROUP(sdc1_clk, WEST, 0x9a000, 13, 6),
-+ [122] = SDC_QDSD_PINGROUP(sdc1_cmd, WEST, 0x9a000, 11, 3),
-+ [123] = SDC_QDSD_PINGROUP(sdc1_data, WEST, 0x9a000, 9, 0),
-+ [124] = SDC_QDSD_PINGROUP(sdc2_clk, SOUTH, 0x98000, 14, 6),
-+ [125] = SDC_QDSD_PINGROUP(sdc2_cmd, SOUTH, 0x98000, 11, 3),
-+ [126] = SDC_QDSD_PINGROUP(sdc2_data, SOUTH, 0x98000, 9, 0),
- };
-
- static const struct msm_gpio_wakeirq_map sm7150_pdc_map[] = {
---
-2.43.0
-
+++ /dev/null
-From 0979a34517ffa129690ab9800374bed40cba2e26 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 17 Apr 2024 12:41:31 +0100
-Subject: pinctrl: renesas: rzg2l: Limit 2.5V power supply to Ethernet
- interfaces
-
-From: Paul Barker <paul.barker.ct@bp.renesas.com>
-
-[ Upstream commit cd27553b0dee6fdc4a2535ab9fc3c8fbdd811d13 ]
-
-The RZ/G3S SoC supports configurable supply voltages for several of its
-I/O interfaces. All of these interfaces support both 1.8V and 3.3V
-supplies, but only the Ethernet and XSPI interfaces support a 2.5V
-supply.
-
-Voltage selection for the XSPI interface is not yet supported, so this
-leaves only the Ethernet interfaces currently supporting selection of a
-2.5V supply. So we need to return an error if there is an attempt to
-select a 2.5V supply for any non-Ethernet interface.
-
-Fixes: 51996952b8b5 ("pinctrl: renesas: rzg2l: Add support to select power source for Ethernet pins")
-Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
-Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Link: https://lore.kernel.org/r/20240417114132.6605-1-paul.barker.ct@bp.renesas.com
-Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/pinctrl/renesas/pinctrl-rzg2l.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
-index 01ef6921cb35c..5bbcb38f843a0 100644
---- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c
-+++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c
-@@ -668,6 +668,8 @@ static int rzg2l_set_power_source(struct rzg2l_pinctrl *pctrl, u32 pin, u32 caps
- val = PVDD_1800;
- break;
- case 2500:
-+ if (!(caps & (PIN_CFG_IO_VMC_ETH0 | PIN_CFG_IO_VMC_ETH1)))
-+ return -EINVAL;
- val = PVDD_2500;
- break;
- case 3300:
---
-2.43.0
-
+++ /dev/null
-From 1592ee457332a459ea41a13df6ad3c047135f542 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 24 Apr 2024 14:28:11 +0200
-Subject: platform/x86: thinkpad_acpi: Take hotkey_mutex during hotkey_exit()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Hans de Goede <hdegoede@redhat.com>
-
-[ Upstream commit e397c564298c2e91aea3887990da8e8eddb65277 ]
-
-hotkey_exit() already takes the mutex around the hotkey_poll_stop_sync()
-call, but not around the other calls.
-
-commit 38831eaf7d4c ("platform/x86: thinkpad_acpi: use lockdep
-annotations") has added lockdep_assert_held() checks to various hotkey
-functions.
-
-These lockdep_assert_held() checks fail causing WARN() backtraces in
-dmesg due to missing locking in hotkey_exit(), fix this.
-
-Fixes: 38831eaf7d4c ("platform/x86: thinkpad_acpi: use lockdep annotations")
-Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca>
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
-Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
-Link: https://lore.kernel.org/r/20240424122834.19801-2-hdegoede@redhat.com
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/platform/x86/thinkpad_acpi.c | 5 +++--
- 1 file changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
-index 5ecd9d33250d7..3dd49dd772662 100644
---- a/drivers/platform/x86/thinkpad_acpi.c
-+++ b/drivers/platform/x86/thinkpad_acpi.c
-@@ -3042,10 +3042,9 @@ static void tpacpi_send_radiosw_update(void)
-
- static void hotkey_exit(void)
- {
--#ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL
- mutex_lock(&hotkey_mutex);
-+#ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL
- hotkey_poll_stop_sync();
-- mutex_unlock(&hotkey_mutex);
- #endif
- dbg_printk(TPACPI_DBG_EXIT | TPACPI_DBG_HKEY,
- "restoring original HKEY status and mask\n");
-@@ -3055,6 +3054,8 @@ static void hotkey_exit(void)
- hotkey_mask_set(hotkey_orig_mask)) |
- hotkey_status_set(false)) != 0)
- pr_err("failed to restore hot key mask to BIOS defaults\n");
-+
-+ mutex_unlock(&hotkey_mutex);
- }
-
- static void __init hotkey_unmap(const unsigned int scancode)
---
-2.43.0
-
+++ /dev/null
-From 2666e4cfa7e9838d0ec596c5b111a534ecf20429 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 7 May 2024 11:15:45 -0400
-Subject: pNFS/filelayout: fixup pNfs allocation modes
-
-From: Olga Kornievskaia <kolga@netapp.com>
-
-[ Upstream commit 3ebcb24646f8c5bfad2866892d3f3cff05514452 ]
-
-Change left over allocation flags.
-
-Fixes: a245832aaa99 ("pNFS/files: Ensure pNFS allocation modes are consistent with nfsiod")
-Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
-Reviewed-by: Benjamin Coddington <bcodding@redhat.com>
-Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/nfs/filelayout/filelayout.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/fs/nfs/filelayout/filelayout.c b/fs/nfs/filelayout/filelayout.c
-index ce8f8934bca51..569ae4ec60845 100644
---- a/fs/nfs/filelayout/filelayout.c
-+++ b/fs/nfs/filelayout/filelayout.c
-@@ -883,7 +883,7 @@ filelayout_pg_init_read(struct nfs_pageio_descriptor *pgio,
- NFS4_MAX_UINT64,
- IOMODE_READ,
- false,
-- GFP_KERNEL);
-+ nfs_io_gfp_mask());
- if (IS_ERR(pgio->pg_lseg)) {
- pgio->pg_error = PTR_ERR(pgio->pg_lseg);
- pgio->pg_lseg = NULL;
-@@ -907,7 +907,7 @@ filelayout_pg_init_write(struct nfs_pageio_descriptor *pgio,
- NFS4_MAX_UINT64,
- IOMODE_RW,
- false,
-- GFP_NOFS);
-+ nfs_io_gfp_mask());
- if (IS_ERR(pgio->pg_lseg)) {
- pgio->pg_error = PTR_ERR(pgio->pg_lseg);
- pgio->pg_lseg = NULL;
---
-2.43.0
-
+++ /dev/null
-From 2ea165417a5527d9d6908f393b36399ab138c435 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 5 Mar 2024 16:36:23 +0100
-Subject: powerpc/bpf/32: Fix failing test_bpf tests
-
-From: Christophe Leroy <christophe.leroy@csgroup.eu>
-
-[ Upstream commit 8ecf3c1dab1c675721d3d0255556abe2306fa340 ]
-
-Recent additions in BPF like cpu v4 instructions, test_bpf module
-exhibits the following failures:
-
- test_bpf: #82 ALU_MOVSX | BPF_B jited:1 ret 2 != 1 (0x2 != 0x1)FAIL (1 times)
- test_bpf: #83 ALU_MOVSX | BPF_H jited:1 ret 2 != 1 (0x2 != 0x1)FAIL (1 times)
- test_bpf: #84 ALU64_MOVSX | BPF_B jited:1 ret 2 != 1 (0x2 != 0x1)FAIL (1 times)
- test_bpf: #85 ALU64_MOVSX | BPF_H jited:1 ret 2 != 1 (0x2 != 0x1)FAIL (1 times)
- test_bpf: #86 ALU64_MOVSX | BPF_W jited:1 ret 2 != 1 (0x2 != 0x1)FAIL (1 times)
-
- test_bpf: #165 ALU_SDIV_X: -6 / 2 = -3 jited:1 ret 2147483645 != -3 (0x7ffffffd != 0xfffffffd)FAIL (1 times)
- test_bpf: #166 ALU_SDIV_K: -6 / 2 = -3 jited:1 ret 2147483645 != -3 (0x7ffffffd != 0xfffffffd)FAIL (1 times)
-
- test_bpf: #169 ALU_SMOD_X: -7 % 2 = -1 jited:1 ret 1 != -1 (0x1 != 0xffffffff)FAIL (1 times)
- test_bpf: #170 ALU_SMOD_K: -7 % 2 = -1 jited:1 ret 1 != -1 (0x1 != 0xffffffff)FAIL (1 times)
-
- test_bpf: #172 ALU64_SMOD_K: -7 % 2 = -1 jited:1 ret 1 != -1 (0x1 != 0xffffffff)FAIL (1 times)
-
- test_bpf: #313 BSWAP 16: 0x0123456789abcdef -> 0xefcd
- eBPF filter opcode 00d7 (@2) unsupported
- jited:0 301 PASS
- test_bpf: #314 BSWAP 32: 0x0123456789abcdef -> 0xefcdab89
- eBPF filter opcode 00d7 (@2) unsupported
- jited:0 555 PASS
- test_bpf: #315 BSWAP 64: 0x0123456789abcdef -> 0x67452301
- eBPF filter opcode 00d7 (@2) unsupported
- jited:0 268 PASS
- test_bpf: #316 BSWAP 64: 0x0123456789abcdef >> 32 -> 0xefcdab89
- eBPF filter opcode 00d7 (@2) unsupported
- jited:0 269 PASS
- test_bpf: #317 BSWAP 16: 0xfedcba9876543210 -> 0x1032
- eBPF filter opcode 00d7 (@2) unsupported
- jited:0 460 PASS
- test_bpf: #318 BSWAP 32: 0xfedcba9876543210 -> 0x10325476
- eBPF filter opcode 00d7 (@2) unsupported
- jited:0 320 PASS
- test_bpf: #319 BSWAP 64: 0xfedcba9876543210 -> 0x98badcfe
- eBPF filter opcode 00d7 (@2) unsupported
- jited:0 222 PASS
- test_bpf: #320 BSWAP 64: 0xfedcba9876543210 >> 32 -> 0x10325476
- eBPF filter opcode 00d7 (@2) unsupported
- jited:0 273 PASS
-
- test_bpf: #344 BPF_LDX_MEMSX | BPF_B
- eBPF filter opcode 0091 (@5) unsupported
- jited:0 432 PASS
- test_bpf: #345 BPF_LDX_MEMSX | BPF_H
- eBPF filter opcode 0089 (@5) unsupported
- jited:0 381 PASS
- test_bpf: #346 BPF_LDX_MEMSX | BPF_W
- eBPF filter opcode 0081 (@5) unsupported
- jited:0 505 PASS
-
- test_bpf: #490 JMP32_JA: Unconditional jump: if (true) return 1
- eBPF filter opcode 0006 (@1) unsupported
- jited:0 261 PASS
-
- test_bpf: Summary: 1040 PASSED, 10 FAILED, [924/1038 JIT'ed]
-
-Fix them by adding missing processing.
-
-Fixes: daabb2b098e0 ("bpf/tests: add tests for cpuv4 instructions")
-Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
-Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-Link: https://msgid.link/91de862dda99d170697eb79ffb478678af7e0b27.1709652689.git.christophe.leroy@csgroup.eu
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/powerpc/include/asm/ppc-opcode.h | 4 +
- arch/powerpc/net/bpf_jit_comp32.c | 137 ++++++++++++++++++++------
- 2 files changed, 110 insertions(+), 31 deletions(-)
-
-diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
-index 005601243dda4..076ae60b4a55d 100644
---- a/arch/powerpc/include/asm/ppc-opcode.h
-+++ b/arch/powerpc/include/asm/ppc-opcode.h
-@@ -510,6 +510,7 @@
- #define PPC_RAW_STB(r, base, i) (0x98000000 | ___PPC_RS(r) | ___PPC_RA(base) | IMM_L(i))
- #define PPC_RAW_LBZ(r, base, i) (0x88000000 | ___PPC_RT(r) | ___PPC_RA(base) | IMM_L(i))
- #define PPC_RAW_LDX(r, base, b) (0x7c00002a | ___PPC_RT(r) | ___PPC_RA(base) | ___PPC_RB(b))
-+#define PPC_RAW_LHA(r, base, i) (0xa8000000 | ___PPC_RT(r) | ___PPC_RA(base) | IMM_L(i))
- #define PPC_RAW_LHZ(r, base, i) (0xa0000000 | ___PPC_RT(r) | ___PPC_RA(base) | IMM_L(i))
- #define PPC_RAW_LHBRX(r, base, b) (0x7c00062c | ___PPC_RT(r) | ___PPC_RA(base) | ___PPC_RB(b))
- #define PPC_RAW_LWBRX(r, base, b) (0x7c00042c | ___PPC_RT(r) | ___PPC_RA(base) | ___PPC_RB(b))
-@@ -532,6 +533,7 @@
- #define PPC_RAW_MULW(d, a, b) (0x7c0001d6 | ___PPC_RT(d) | ___PPC_RA(a) | ___PPC_RB(b))
- #define PPC_RAW_MULHWU(d, a, b) (0x7c000016 | ___PPC_RT(d) | ___PPC_RA(a) | ___PPC_RB(b))
- #define PPC_RAW_MULI(d, a, i) (0x1c000000 | ___PPC_RT(d) | ___PPC_RA(a) | IMM_L(i))
-+#define PPC_RAW_DIVW(d, a, b) (0x7c0003d6 | ___PPC_RT(d) | ___PPC_RA(a) | ___PPC_RB(b))
- #define PPC_RAW_DIVWU(d, a, b) (0x7c000396 | ___PPC_RT(d) | ___PPC_RA(a) | ___PPC_RB(b))
- #define PPC_RAW_DIVDU(d, a, b) (0x7c000392 | ___PPC_RT(d) | ___PPC_RA(a) | ___PPC_RB(b))
- #define PPC_RAW_DIVDE(t, a, b) (0x7c000352 | ___PPC_RT(t) | ___PPC_RA(a) | ___PPC_RB(b))
-@@ -550,6 +552,8 @@
- #define PPC_RAW_XOR(d, a, b) (0x7c000278 | ___PPC_RA(d) | ___PPC_RS(a) | ___PPC_RB(b))
- #define PPC_RAW_XORI(d, a, i) (0x68000000 | ___PPC_RA(d) | ___PPC_RS(a) | IMM_L(i))
- #define PPC_RAW_XORIS(d, a, i) (0x6c000000 | ___PPC_RA(d) | ___PPC_RS(a) | IMM_L(i))
-+#define PPC_RAW_EXTSB(d, a) (0x7c000774 | ___PPC_RA(d) | ___PPC_RS(a))
-+#define PPC_RAW_EXTSH(d, a) (0x7c000734 | ___PPC_RA(d) | ___PPC_RS(a))
- #define PPC_RAW_EXTSW(d, a) (0x7c0007b4 | ___PPC_RA(d) | ___PPC_RS(a))
- #define PPC_RAW_SLW(d, a, s) (0x7c000030 | ___PPC_RA(d) | ___PPC_RS(a) | ___PPC_RB(s))
- #define PPC_RAW_SLD(d, a, s) (0x7c000036 | ___PPC_RA(d) | ___PPC_RS(a) | ___PPC_RB(s))
-diff --git a/arch/powerpc/net/bpf_jit_comp32.c b/arch/powerpc/net/bpf_jit_comp32.c
-index 2f39c50ca729e..43b97032a91c0 100644
---- a/arch/powerpc/net/bpf_jit_comp32.c
-+++ b/arch/powerpc/net/bpf_jit_comp32.c
-@@ -450,10 +450,16 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
- }
- break;
- case BPF_ALU | BPF_DIV | BPF_X: /* (u32) dst /= (u32) src */
-- EMIT(PPC_RAW_DIVWU(dst_reg, src2_reg, src_reg));
-+ if (off)
-+ EMIT(PPC_RAW_DIVW(dst_reg, src2_reg, src_reg));
-+ else
-+ EMIT(PPC_RAW_DIVWU(dst_reg, src2_reg, src_reg));
- break;
- case BPF_ALU | BPF_MOD | BPF_X: /* (u32) dst %= (u32) src */
-- EMIT(PPC_RAW_DIVWU(_R0, src2_reg, src_reg));
-+ if (off)
-+ EMIT(PPC_RAW_DIVW(_R0, src2_reg, src_reg));
-+ else
-+ EMIT(PPC_RAW_DIVWU(_R0, src2_reg, src_reg));
- EMIT(PPC_RAW_MULW(_R0, src_reg, _R0));
- EMIT(PPC_RAW_SUB(dst_reg, src2_reg, _R0));
- break;
-@@ -467,10 +473,16 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
- if (imm == 1) {
- EMIT(PPC_RAW_MR(dst_reg, src2_reg));
- } else if (is_power_of_2((u32)imm)) {
-- EMIT(PPC_RAW_SRWI(dst_reg, src2_reg, ilog2(imm)));
-+ if (off)
-+ EMIT(PPC_RAW_SRAWI(dst_reg, src2_reg, ilog2(imm)));
-+ else
-+ EMIT(PPC_RAW_SRWI(dst_reg, src2_reg, ilog2(imm)));
- } else {
- PPC_LI32(_R0, imm);
-- EMIT(PPC_RAW_DIVWU(dst_reg, src2_reg, _R0));
-+ if (off)
-+ EMIT(PPC_RAW_DIVW(dst_reg, src2_reg, _R0));
-+ else
-+ EMIT(PPC_RAW_DIVWU(dst_reg, src2_reg, _R0));
- }
- break;
- case BPF_ALU | BPF_MOD | BPF_K: /* (u32) dst %= (u32) imm */
-@@ -480,11 +492,19 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
- if (!is_power_of_2((u32)imm)) {
- bpf_set_seen_register(ctx, tmp_reg);
- PPC_LI32(tmp_reg, imm);
-- EMIT(PPC_RAW_DIVWU(_R0, src2_reg, tmp_reg));
-+ if (off)
-+ EMIT(PPC_RAW_DIVW(_R0, src2_reg, tmp_reg));
-+ else
-+ EMIT(PPC_RAW_DIVWU(_R0, src2_reg, tmp_reg));
- EMIT(PPC_RAW_MULW(_R0, tmp_reg, _R0));
- EMIT(PPC_RAW_SUB(dst_reg, src2_reg, _R0));
- } else if (imm == 1) {
- EMIT(PPC_RAW_LI(dst_reg, 0));
-+ } else if (off) {
-+ EMIT(PPC_RAW_SRAWI(_R0, src2_reg, ilog2(imm)));
-+ EMIT(PPC_RAW_ADDZE(_R0, _R0));
-+ EMIT(PPC_RAW_SLWI(_R0, _R0, ilog2(imm)));
-+ EMIT(PPC_RAW_SUB(dst_reg, src2_reg, _R0));
- } else {
- imm = ilog2((u32)imm);
- EMIT(PPC_RAW_RLWINM(dst_reg, src2_reg, 0, 32 - imm, 31));
-@@ -497,11 +517,21 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
- imm = -imm;
- if (!is_power_of_2(imm))
- return -EOPNOTSUPP;
-- if (imm == 1)
-+ if (imm == 1) {
- EMIT(PPC_RAW_LI(dst_reg, 0));
-- else
-+ EMIT(PPC_RAW_LI(dst_reg_h, 0));
-+ } else if (off) {
-+ EMIT(PPC_RAW_SRAWI(dst_reg_h, src2_reg_h, 31));
-+ EMIT(PPC_RAW_XOR(dst_reg, src2_reg, dst_reg_h));
-+ EMIT(PPC_RAW_SUBFC(dst_reg, dst_reg_h, dst_reg));
-+ EMIT(PPC_RAW_RLWINM(dst_reg, dst_reg, 0, 32 - ilog2(imm), 31));
-+ EMIT(PPC_RAW_XOR(dst_reg, dst_reg, dst_reg_h));
-+ EMIT(PPC_RAW_SUBFC(dst_reg, dst_reg_h, dst_reg));
-+ EMIT(PPC_RAW_SUBFE(dst_reg_h, dst_reg_h, dst_reg_h));
-+ } else {
- EMIT(PPC_RAW_RLWINM(dst_reg, src2_reg, 0, 32 - ilog2(imm), 31));
-- EMIT(PPC_RAW_LI(dst_reg_h, 0));
-+ EMIT(PPC_RAW_LI(dst_reg_h, 0));
-+ }
- break;
- case BPF_ALU64 | BPF_DIV | BPF_K: /* dst /= imm */
- if (!imm)
-@@ -727,15 +757,30 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
- * MOV
- */
- case BPF_ALU64 | BPF_MOV | BPF_X: /* dst = src */
-- if (dst_reg == src_reg)
-- break;
-- EMIT(PPC_RAW_MR(dst_reg, src_reg));
-- EMIT(PPC_RAW_MR(dst_reg_h, src_reg_h));
-+ if (off == 8) {
-+ EMIT(PPC_RAW_EXTSB(dst_reg, src_reg));
-+ EMIT(PPC_RAW_SRAWI(dst_reg_h, dst_reg, 31));
-+ } else if (off == 16) {
-+ EMIT(PPC_RAW_EXTSH(dst_reg, src_reg));
-+ EMIT(PPC_RAW_SRAWI(dst_reg_h, dst_reg, 31));
-+ } else if (off == 32 && dst_reg == src_reg) {
-+ EMIT(PPC_RAW_SRAWI(dst_reg_h, src_reg, 31));
-+ } else if (off == 32) {
-+ EMIT(PPC_RAW_MR(dst_reg, src_reg));
-+ EMIT(PPC_RAW_SRAWI(dst_reg_h, src_reg, 31));
-+ } else if (dst_reg != src_reg) {
-+ EMIT(PPC_RAW_MR(dst_reg, src_reg));
-+ EMIT(PPC_RAW_MR(dst_reg_h, src_reg_h));
-+ }
- break;
- case BPF_ALU | BPF_MOV | BPF_X: /* (u32) dst = src */
- /* special mov32 for zext */
- if (imm == 1)
- EMIT(PPC_RAW_LI(dst_reg_h, 0));
-+ else if (off == 8)
-+ EMIT(PPC_RAW_EXTSB(dst_reg, src_reg));
-+ else if (off == 16)
-+ EMIT(PPC_RAW_EXTSH(dst_reg, src_reg));
- else if (dst_reg != src_reg)
- EMIT(PPC_RAW_MR(dst_reg, src_reg));
- break;
-@@ -751,6 +796,7 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
- * BPF_FROM_BE/LE
- */
- case BPF_ALU | BPF_END | BPF_FROM_LE:
-+ case BPF_ALU64 | BPF_END | BPF_FROM_LE:
- switch (imm) {
- case 16:
- /* Copy 16 bits to upper part */
-@@ -785,6 +831,8 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
- EMIT(PPC_RAW_MR(dst_reg_h, tmp_reg));
- break;
- }
-+ if (BPF_CLASS(code) == BPF_ALU64 && imm != 64)
-+ EMIT(PPC_RAW_LI(dst_reg_h, 0));
- break;
- case BPF_ALU | BPF_END | BPF_FROM_BE:
- switch (imm) {
-@@ -918,11 +966,17 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
- * BPF_LDX
- */
- case BPF_LDX | BPF_MEM | BPF_B: /* dst = *(u8 *)(ul) (src + off) */
-+ case BPF_LDX | BPF_MEMSX | BPF_B:
- case BPF_LDX | BPF_PROBE_MEM | BPF_B:
-+ case BPF_LDX | BPF_PROBE_MEMSX | BPF_B:
- case BPF_LDX | BPF_MEM | BPF_H: /* dst = *(u16 *)(ul) (src + off) */
-+ case BPF_LDX | BPF_MEMSX | BPF_H:
- case BPF_LDX | BPF_PROBE_MEM | BPF_H:
-+ case BPF_LDX | BPF_PROBE_MEMSX | BPF_H:
- case BPF_LDX | BPF_MEM | BPF_W: /* dst = *(u32 *)(ul) (src + off) */
-+ case BPF_LDX | BPF_MEMSX | BPF_W:
- case BPF_LDX | BPF_PROBE_MEM | BPF_W:
-+ case BPF_LDX | BPF_PROBE_MEMSX | BPF_W:
- case BPF_LDX | BPF_MEM | BPF_DW: /* dst = *(u64 *)(ul) (src + off) */
- case BPF_LDX | BPF_PROBE_MEM | BPF_DW:
- /*
-@@ -931,7 +985,7 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
- * load only if addr is kernel address (see is_kernel_addr()), otherwise
- * set dst_reg=0 and move on.
- */
-- if (BPF_MODE(code) == BPF_PROBE_MEM) {
-+ if (BPF_MODE(code) == BPF_PROBE_MEM || BPF_MODE(code) == BPF_PROBE_MEMSX) {
- PPC_LI32(_R0, TASK_SIZE - off);
- EMIT(PPC_RAW_CMPLW(src_reg, _R0));
- PPC_BCC_SHORT(COND_GT, (ctx->idx + 4) * 4);
-@@ -953,30 +1007,48 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
- * as there are two load instructions for dst_reg_h & dst_reg
- * respectively.
- */
-- if (size == BPF_DW)
-+ if (size == BPF_DW ||
-+ (size == BPF_B && BPF_MODE(code) == BPF_PROBE_MEMSX))
- PPC_JMP((ctx->idx + 3) * 4);
- else
- PPC_JMP((ctx->idx + 2) * 4);
- }
-
-- switch (size) {
-- case BPF_B:
-- EMIT(PPC_RAW_LBZ(dst_reg, src_reg, off));
-- break;
-- case BPF_H:
-- EMIT(PPC_RAW_LHZ(dst_reg, src_reg, off));
-- break;
-- case BPF_W:
-- EMIT(PPC_RAW_LWZ(dst_reg, src_reg, off));
-- break;
-- case BPF_DW:
-- EMIT(PPC_RAW_LWZ(dst_reg_h, src_reg, off));
-- EMIT(PPC_RAW_LWZ(dst_reg, src_reg, off + 4));
-- break;
-- }
-+ if (BPF_MODE(code) == BPF_MEMSX || BPF_MODE(code) == BPF_PROBE_MEMSX) {
-+ switch (size) {
-+ case BPF_B:
-+ EMIT(PPC_RAW_LBZ(dst_reg, src_reg, off));
-+ EMIT(PPC_RAW_EXTSB(dst_reg, dst_reg));
-+ break;
-+ case BPF_H:
-+ EMIT(PPC_RAW_LHA(dst_reg, src_reg, off));
-+ break;
-+ case BPF_W:
-+ EMIT(PPC_RAW_LWZ(dst_reg, src_reg, off));
-+ break;
-+ }
-+ if (!fp->aux->verifier_zext)
-+ EMIT(PPC_RAW_SRAWI(dst_reg_h, dst_reg, 31));
-
-- if (size != BPF_DW && !fp->aux->verifier_zext)
-- EMIT(PPC_RAW_LI(dst_reg_h, 0));
-+ } else {
-+ switch (size) {
-+ case BPF_B:
-+ EMIT(PPC_RAW_LBZ(dst_reg, src_reg, off));
-+ break;
-+ case BPF_H:
-+ EMIT(PPC_RAW_LHZ(dst_reg, src_reg, off));
-+ break;
-+ case BPF_W:
-+ EMIT(PPC_RAW_LWZ(dst_reg, src_reg, off));
-+ break;
-+ case BPF_DW:
-+ EMIT(PPC_RAW_LWZ(dst_reg_h, src_reg, off));
-+ EMIT(PPC_RAW_LWZ(dst_reg, src_reg, off + 4));
-+ break;
-+ }
-+ if (size != BPF_DW && !fp->aux->verifier_zext)
-+ EMIT(PPC_RAW_LI(dst_reg_h, 0));
-+ }
-
- if (BPF_MODE(code) == BPF_PROBE_MEM) {
- int insn_idx = ctx->idx - 1;
-@@ -1068,6 +1140,9 @@ int bpf_jit_build_body(struct bpf_prog *fp, u32 *image, u32 *fimage, struct code
- case BPF_JMP | BPF_JA:
- PPC_JMP(addrs[i + 1 + off]);
- break;
-+ case BPF_JMP32 | BPF_JA:
-+ PPC_JMP(addrs[i + 1 + imm]);
-+ break;
-
- case BPF_JMP | BPF_JGT | BPF_K:
- case BPF_JMP | BPF_JGT | BPF_X:
---
-2.43.0
-
+++ /dev/null
-From 61d4ff5ba85699f11db0954f0cdb95770363a116 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 12 Apr 2024 14:50:47 +0530
-Subject: powerpc/pseries: Add failure related checks for h_get_mpp and
- h_get_ppp
-
-From: Shrikanth Hegde <sshegde@linux.ibm.com>
-
-[ Upstream commit 6d4341638516bf97b9a34947e0bd95035a8230a5 ]
-
-Couple of Minor fixes:
-
-- hcall return values are long. Fix that for h_get_mpp, h_get_ppp and
-parse_ppp_data
-
-- If hcall fails, values set should be at-least zero. It shouldn't be
-uninitialized values. Fix that for h_get_mpp and h_get_ppp
-
-Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>
-Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-Link: https://msgid.link/20240412092047.455483-3-sshegde@linux.ibm.com
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/powerpc/include/asm/hvcall.h | 2 +-
- arch/powerpc/platforms/pseries/lpar.c | 6 +++---
- arch/powerpc/platforms/pseries/lparcfg.c | 6 +++---
- 3 files changed, 7 insertions(+), 7 deletions(-)
-
-diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h
-index a41e542ba94dd..51172625fa3a5 100644
---- a/arch/powerpc/include/asm/hvcall.h
-+++ b/arch/powerpc/include/asm/hvcall.h
-@@ -570,7 +570,7 @@ struct hvcall_mpp_data {
- unsigned long backing_mem;
- };
-
--int h_get_mpp(struct hvcall_mpp_data *);
-+long h_get_mpp(struct hvcall_mpp_data *mpp_data);
-
- struct hvcall_mpp_x_data {
- unsigned long coalesced_bytes;
-diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
-index 4e9916bb03d71..c1d8bee8f7018 100644
---- a/arch/powerpc/platforms/pseries/lpar.c
-+++ b/arch/powerpc/platforms/pseries/lpar.c
-@@ -1886,10 +1886,10 @@ notrace void __trace_hcall_exit(long opcode, long retval, unsigned long *retbuf)
- * h_get_mpp
- * H_GET_MPP hcall returns info in 7 parms
- */
--int h_get_mpp(struct hvcall_mpp_data *mpp_data)
-+long h_get_mpp(struct hvcall_mpp_data *mpp_data)
- {
-- int rc;
-- unsigned long retbuf[PLPAR_HCALL9_BUFSIZE];
-+ unsigned long retbuf[PLPAR_HCALL9_BUFSIZE] = {0};
-+ long rc;
-
- rc = plpar_hcall9(H_GET_MPP, retbuf);
-
-diff --git a/arch/powerpc/platforms/pseries/lparcfg.c b/arch/powerpc/platforms/pseries/lparcfg.c
-index 1c151d77e74b3..f04bfea1a97bd 100644
---- a/arch/powerpc/platforms/pseries/lparcfg.c
-+++ b/arch/powerpc/platforms/pseries/lparcfg.c
-@@ -113,8 +113,8 @@ struct hvcall_ppp_data {
- */
- static unsigned int h_get_ppp(struct hvcall_ppp_data *ppp_data)
- {
-- unsigned long rc;
-- unsigned long retbuf[PLPAR_HCALL9_BUFSIZE];
-+ unsigned long retbuf[PLPAR_HCALL9_BUFSIZE] = {0};
-+ long rc;
-
- rc = plpar_hcall9(H_GET_PPP, retbuf);
-
-@@ -193,7 +193,7 @@ static void parse_ppp_data(struct seq_file *m)
- struct hvcall_ppp_data ppp_data;
- struct device_node *root;
- const __be32 *perf_level;
-- int rc;
-+ long rc;
-
- rc = h_get_ppp(&ppp_data);
- if (rc)
---
-2.43.0
-
+++ /dev/null
-From 78b4194d20b8eece3bcdbb05e6f09933ccd568c1 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 24 May 2024 14:29:54 -0500
-Subject: powerpc/pseries/lparcfg: drop error message from guest name lookup
-
-From: Nathan Lynch <nathanl@linux.ibm.com>
-
-[ Upstream commit 12870ae3818e39ea65bf710f645972277b634f72 ]
-
-It's not an error or exceptional situation when the hosting
-environment does not expose a name for the LP/guest via RTAS or the
-device tree. This happens with qemu when run without the '-name'
-option. The message also lacks a newline. Remove it.
-
-Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
-Fixes: eddaa9a40275 ("powerpc/pseries: read the lpar name from the firmware")
-Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-Link: https://msgid.link/20240524-lparcfg-updates-v2-1-62e2e9d28724@linux.ibm.com
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/powerpc/platforms/pseries/lparcfg.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/arch/powerpc/platforms/pseries/lparcfg.c b/arch/powerpc/platforms/pseries/lparcfg.c
-index f04bfea1a97bd..11d5208817b9d 100644
---- a/arch/powerpc/platforms/pseries/lparcfg.c
-+++ b/arch/powerpc/platforms/pseries/lparcfg.c
-@@ -357,8 +357,8 @@ static int read_dt_lpar_name(struct seq_file *m)
-
- static void read_lpar_name(struct seq_file *m)
- {
-- if (read_rtas_lpar_name(m) && read_dt_lpar_name(m))
-- pr_err_once("Error can't get the LPAR name");
-+ if (read_rtas_lpar_name(m))
-+ read_dt_lpar_name(m);
- }
-
- #define SPLPAR_MAXLENGTH 1026*(sizeof(char))
---
-2.43.0
-
+++ /dev/null
-From afd9d483281107afc704e7da3df914f1d8662a56 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 29 May 2024 22:30:29 +1000
-Subject: powerpc/uaccess: Use YZ asm constraint for ld
-
-From: Michael Ellerman <mpe@ellerman.id.au>
-
-[ Upstream commit 50934945d54238d2d6d8db4b7c1d4c90d2696c57 ]
-
-The 'ld' instruction requires a 4-byte aligned displacement because it
-is a DS-form instruction. But the "m" asm constraint doesn't enforce
-that.
-
-Add a special case of __get_user_asm2_goto() so that the "YZ" constraint
-can be used for "ld".
-
-The "Z" constraint is documented in the GCC manual PowerPC machine
-constraints, and specifies a "memory operand accessed with indexed or
-indirect addressing". "Y" is not documented in the manual but specifies
-a "memory operand for a DS-form instruction". Using both allows the
-compiler to generate a DS-form "ld" or X-form "ldx" as appropriate.
-
-The change has to be conditional on CONFIG_PPC_KERNEL_PREFIXED because
-the "Y" constraint does not guarantee 4-byte alignment when prefixed
-instructions are enabled.
-
-No build errors have been reported due to this, but the possibility is
-there depending on compiler code generation decisions.
-
-Fixes: c20beffeec3c ("powerpc/uaccess: Use flexible addressing with __put_user()/__get_user()")
-Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-Link: https://msgid.link/20240529123029.146953-2-mpe@ellerman.id.au
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/powerpc/include/asm/uaccess.h | 11 +++++++++++
- 1 file changed, 11 insertions(+)
-
-diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h
-index de10437fd2065..ac4f6e4ae5810 100644
---- a/arch/powerpc/include/asm/uaccess.h
-+++ b/arch/powerpc/include/asm/uaccess.h
-@@ -165,8 +165,19 @@ do { \
- #endif
-
- #ifdef __powerpc64__
-+#ifdef CONFIG_PPC_KERNEL_PREFIXED
- #define __get_user_asm2_goto(x, addr, label) \
- __get_user_asm_goto(x, addr, label, "ld")
-+#else
-+#define __get_user_asm2_goto(x, addr, label) \
-+ asm_goto_output( \
-+ "1: ld%U1%X1 %0, %1 # get_user\n" \
-+ EX_TABLE(1b, %l2) \
-+ : "=r" (x) \
-+ : DS_FORM_CONSTRAINT (*addr) \
-+ : \
-+ : label)
-+#endif // CONFIG_PPC_KERNEL_PREFIXED
- #else /* __powerpc64__ */
- #define __get_user_asm2_goto(x, addr, label) \
- asm_goto_output( \
---
-2.43.0
-
+++ /dev/null
-From decad3a5c17171049ab7843c54f492e06c28346f Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 12 Apr 2024 16:38:40 +0800
-Subject: ppdev: Add an error check in register_device
-
-From: Huai-Yuan Liu <qq810974084@gmail.com>
-
-[ Upstream commit fbf740aeb86a4fe82ad158d26d711f2f3be79b3e ]
-
-In register_device, the return value of ida_simple_get is unchecked,
-in witch ida_simple_get will use an invalid index value.
-
-To address this issue, index should be checked after ida_simple_get. When
-the index value is abnormal, a warning message should be printed, the port
-should be dropped, and the value should be recorded.
-
-Fixes: 9a69645dde11 ("ppdev: fix registering same device name")
-Signed-off-by: Huai-Yuan Liu <qq810974084@gmail.com>
-Link: https://lore.kernel.org/r/20240412083840.234085-1-qq810974084@gmail.com
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/char/ppdev.c | 15 +++++++++++----
- 1 file changed, 11 insertions(+), 4 deletions(-)
-
-diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c
-index ee951b265213f..58e9dcc2a3087 100644
---- a/drivers/char/ppdev.c
-+++ b/drivers/char/ppdev.c
-@@ -296,28 +296,35 @@ static int register_device(int minor, struct pp_struct *pp)
- if (!port) {
- pr_warn("%s: no associated port!\n", name);
- rc = -ENXIO;
-- goto err;
-+ goto err_free_name;
- }
-
- index = ida_alloc(&ida_index, GFP_KERNEL);
-+ if (index < 0) {
-+ pr_warn("%s: failed to get index!\n", name);
-+ rc = index;
-+ goto err_put_port;
-+ }
-+
- memset(&ppdev_cb, 0, sizeof(ppdev_cb));
- ppdev_cb.irq_func = pp_irq;
- ppdev_cb.flags = (pp->flags & PP_EXCL) ? PARPORT_FLAG_EXCL : 0;
- ppdev_cb.private = pp;
- pdev = parport_register_dev_model(port, name, &ppdev_cb, index);
-- parport_put_port(port);
-
- if (!pdev) {
- pr_warn("%s: failed to register device!\n", name);
- rc = -ENXIO;
- ida_free(&ida_index, index);
-- goto err;
-+ goto err_put_port;
- }
-
- pp->pdev = pdev;
- pp->index = index;
- dev_dbg(&pdev->dev, "registered pardevice\n");
--err:
-+err_put_port:
-+ parport_put_port(port);
-+err_free_name:
- kfree(name);
- return rc;
- }
---
-2.43.0
-
+++ /dev/null
-From 1399e4f32162ad84b49ada8672520cc1dbe85ccd Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sun, 5 May 2024 10:03:41 +0200
-Subject: printk: Fix LOG_CPU_MAX_BUF_SHIFT when BASE_SMALL is enabled
-
-From: Yoann Congal <yoann.congal@smile.fr>
-
-[ Upstream commit 320bf43190514be5c00e11f47ec2160dd3993844 ]
-
-LOG_CPU_MAX_BUF_SHIFT default value depends on BASE_SMALL:
- config LOG_CPU_MAX_BUF_SHIFT
- default 12 if !BASE_SMALL
- default 0 if BASE_SMALL
-But, BASE_SMALL is a config of type int and "!BASE_SMALL" is always
-evaluated to true whatever is the value of BASE_SMALL.
-
-This patch fixes this by using the correct conditional operator for int
-type : BASE_SMALL != 0.
-
-Note: This changes CONFIG_LOG_CPU_MAX_BUF_SHIFT=12 to
-CONFIG_LOG_CPU_MAX_BUF_SHIFT=0 for BASE_SMALL defconfigs, but that will
-not be a big impact due to this code in kernel/printk/printk.c:
- /* by default this will only continue through for large > 64 CPUs */
- if (cpu_extra <= __LOG_BUF_LEN / 2)
- return;
-Systems using CONFIG_BASE_SMALL and having 64+ CPUs should be quite
-rare.
-
-John Ogness <john.ogness@linutronix.de> (printk reviewer) wrote:
-> For printk this will mean that BASE_SMALL systems were probably
-> previously allocating/using the dynamic ringbuffer and now they will
-> just continue to use the static ringbuffer. Which is fine and saves
-> memory (as it should).
-
-Petr Mladek <pmladek@suse.com> (printk maintainer) wrote:
-> More precisely, it allocated the buffer dynamically when the sum
-> of per-CPU-extra space exceeded half of the default static ring
-> buffer. This happened for systems with more than 64 CPUs with
-> the default config values.
-
-Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
-Closes: https://lore.kernel.org/all/CAMuHMdWm6u1wX7efZQf=2XUAHascps76YQac6rdnQGhc8nop_Q@mail.gmail.com/
-Reported-by: Vegard Nossum <vegard.nossum@oracle.com>
-Closes: https://lore.kernel.org/all/f6856be8-54b7-0fa0-1d17-39632bf29ada@oracle.com/
-Fixes: 4e244c10eab3 ("kconfig: remove unneeded symbol_empty variable")
-Reviewed-by: Petr Mladek <pmladek@suse.com>
-Reviewed-by: Masahiro Yamada <masahiroy@kernel.org>
-Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
-Link: https://lore.kernel.org/r/20240505080343.1471198-2-yoann.congal@smile.fr
-Signed-off-by: Petr Mladek <pmladek@suse.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- init/Kconfig | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/init/Kconfig b/init/Kconfig
-index c8a155cf7209b..1cb19bec01355 100644
---- a/init/Kconfig
-+++ b/init/Kconfig
-@@ -743,8 +743,8 @@ config LOG_CPU_MAX_BUF_SHIFT
- int "CPU kernel log buffer size contribution (13 => 8 KB, 17 => 128KB)"
- depends on SMP
- range 0 21
-- default 12 if !BASE_SMALL
-- default 0 if BASE_SMALL
-+ default 0 if BASE_SMALL != 0
-+ default 12
- depends on PRINTK
- help
- This option allows to increase the default ring buffer size
---
-2.43.0
-
+++ /dev/null
-From a5dc2009583b2b232bfc4a34d3e0939a18e7edf4 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 16 May 2024 11:54:41 +0300
-Subject: regulator: bd71828: Don't overwrite runtime voltages
-
-From: Matti Vaittinen <mazziesaccount@gmail.com>
-
-[ Upstream commit 0f9f7c63c415e287cd57b5c98be61eb320dedcfc ]
-
-Some of the regulators on the BD71828 have common voltage setting for
-RUN/SUSPEND/IDLE/LPSR states. The enable control can be set for each
-state though.
-
-The driver allows setting the voltage values for these states via
-device-tree. As a side effect, setting the voltages for
-SUSPEND/IDLE/LPSR will also change the RUN level voltage which is not
-desired and can break the system.
-
-The comment in code reflects this behaviour, but it is likely to not
-make people any happier. The right thing to do is to allow setting the
-enable/disable state at SUSPEND/IDLE/LPSR via device-tree, but to
-disallow setting state specific voltages for those regulators.
-
-BUCK1 is a bit different. It only shares the SUSPEND and LPSR state
-voltages. The former behaviour of allowing to silently overwrite the
-SUSPEND state voltage by LPSR state voltage is also changed here so that
-the SUSPEND voltage is prioritized over LPSR voltage.
-
-Prevent setting PMIC state specific voltages for regulators which do not
-support it.
-
-Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
-Fixes: 522498f8cb8c ("regulator: bd71828: Basic support for ROHM bd71828 PMIC regulators")
-Link: https://msgid.link/r/e1883ae1e3ae5668f1030455d4750923561f3d68.1715848512.git.mazziesaccount@gmail.com
-Signed-off-by: Mark Brown <broonie@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/regulator/bd71828-regulator.c | 58 +--------------------------
- 1 file changed, 2 insertions(+), 56 deletions(-)
-
-diff --git a/drivers/regulator/bd71828-regulator.c b/drivers/regulator/bd71828-regulator.c
-index 08d4ee369287e..dd871ffe979c3 100644
---- a/drivers/regulator/bd71828-regulator.c
-+++ b/drivers/regulator/bd71828-regulator.c
-@@ -206,14 +206,11 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {
- .suspend_reg = BD71828_REG_BUCK1_SUSP_VOLT,
- .suspend_mask = BD71828_MASK_BUCK1267_VOLT,
- .suspend_on_mask = BD71828_MASK_SUSP_EN,
-- .lpsr_on_mask = BD71828_MASK_LPSR_EN,
- /*
- * LPSR voltage is same as SUSPEND voltage. Allow
-- * setting it so that regulator can be set enabled at
-- * LPSR state
-+ * only enabling/disabling regulator for LPSR state
- */
-- .lpsr_reg = BD71828_REG_BUCK1_SUSP_VOLT,
-- .lpsr_mask = BD71828_MASK_BUCK1267_VOLT,
-+ .lpsr_on_mask = BD71828_MASK_LPSR_EN,
- },
- .reg_inits = buck1_inits,
- .reg_init_amnt = ARRAY_SIZE(buck1_inits),
-@@ -288,13 +285,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {
- ROHM_DVS_LEVEL_SUSPEND |
- ROHM_DVS_LEVEL_LPSR,
- .run_reg = BD71828_REG_BUCK3_VOLT,
-- .idle_reg = BD71828_REG_BUCK3_VOLT,
-- .suspend_reg = BD71828_REG_BUCK3_VOLT,
-- .lpsr_reg = BD71828_REG_BUCK3_VOLT,
- .run_mask = BD71828_MASK_BUCK3_VOLT,
-- .idle_mask = BD71828_MASK_BUCK3_VOLT,
-- .suspend_mask = BD71828_MASK_BUCK3_VOLT,
-- .lpsr_mask = BD71828_MASK_BUCK3_VOLT,
- .idle_on_mask = BD71828_MASK_IDLE_EN,
- .suspend_on_mask = BD71828_MASK_SUSP_EN,
- .lpsr_on_mask = BD71828_MASK_LPSR_EN,
-@@ -329,13 +320,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {
- ROHM_DVS_LEVEL_SUSPEND |
- ROHM_DVS_LEVEL_LPSR,
- .run_reg = BD71828_REG_BUCK4_VOLT,
-- .idle_reg = BD71828_REG_BUCK4_VOLT,
-- .suspend_reg = BD71828_REG_BUCK4_VOLT,
-- .lpsr_reg = BD71828_REG_BUCK4_VOLT,
- .run_mask = BD71828_MASK_BUCK4_VOLT,
-- .idle_mask = BD71828_MASK_BUCK4_VOLT,
-- .suspend_mask = BD71828_MASK_BUCK4_VOLT,
-- .lpsr_mask = BD71828_MASK_BUCK4_VOLT,
- .idle_on_mask = BD71828_MASK_IDLE_EN,
- .suspend_on_mask = BD71828_MASK_SUSP_EN,
- .lpsr_on_mask = BD71828_MASK_LPSR_EN,
-@@ -370,13 +355,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {
- ROHM_DVS_LEVEL_SUSPEND |
- ROHM_DVS_LEVEL_LPSR,
- .run_reg = BD71828_REG_BUCK5_VOLT,
-- .idle_reg = BD71828_REG_BUCK5_VOLT,
-- .suspend_reg = BD71828_REG_BUCK5_VOLT,
-- .lpsr_reg = BD71828_REG_BUCK5_VOLT,
- .run_mask = BD71828_MASK_BUCK5_VOLT,
-- .idle_mask = BD71828_MASK_BUCK5_VOLT,
-- .suspend_mask = BD71828_MASK_BUCK5_VOLT,
-- .lpsr_mask = BD71828_MASK_BUCK5_VOLT,
- .idle_on_mask = BD71828_MASK_IDLE_EN,
- .suspend_on_mask = BD71828_MASK_SUSP_EN,
- .lpsr_on_mask = BD71828_MASK_LPSR_EN,
-@@ -493,13 +472,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {
- ROHM_DVS_LEVEL_SUSPEND |
- ROHM_DVS_LEVEL_LPSR,
- .run_reg = BD71828_REG_LDO1_VOLT,
-- .idle_reg = BD71828_REG_LDO1_VOLT,
-- .suspend_reg = BD71828_REG_LDO1_VOLT,
-- .lpsr_reg = BD71828_REG_LDO1_VOLT,
- .run_mask = BD71828_MASK_LDO_VOLT,
-- .idle_mask = BD71828_MASK_LDO_VOLT,
-- .suspend_mask = BD71828_MASK_LDO_VOLT,
-- .lpsr_mask = BD71828_MASK_LDO_VOLT,
- .idle_on_mask = BD71828_MASK_IDLE_EN,
- .suspend_on_mask = BD71828_MASK_SUSP_EN,
- .lpsr_on_mask = BD71828_MASK_LPSR_EN,
-@@ -533,13 +506,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {
- ROHM_DVS_LEVEL_SUSPEND |
- ROHM_DVS_LEVEL_LPSR,
- .run_reg = BD71828_REG_LDO2_VOLT,
-- .idle_reg = BD71828_REG_LDO2_VOLT,
-- .suspend_reg = BD71828_REG_LDO2_VOLT,
-- .lpsr_reg = BD71828_REG_LDO2_VOLT,
- .run_mask = BD71828_MASK_LDO_VOLT,
-- .idle_mask = BD71828_MASK_LDO_VOLT,
-- .suspend_mask = BD71828_MASK_LDO_VOLT,
-- .lpsr_mask = BD71828_MASK_LDO_VOLT,
- .idle_on_mask = BD71828_MASK_IDLE_EN,
- .suspend_on_mask = BD71828_MASK_SUSP_EN,
- .lpsr_on_mask = BD71828_MASK_LPSR_EN,
-@@ -573,13 +540,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {
- ROHM_DVS_LEVEL_SUSPEND |
- ROHM_DVS_LEVEL_LPSR,
- .run_reg = BD71828_REG_LDO3_VOLT,
-- .idle_reg = BD71828_REG_LDO3_VOLT,
-- .suspend_reg = BD71828_REG_LDO3_VOLT,
-- .lpsr_reg = BD71828_REG_LDO3_VOLT,
- .run_mask = BD71828_MASK_LDO_VOLT,
-- .idle_mask = BD71828_MASK_LDO_VOLT,
-- .suspend_mask = BD71828_MASK_LDO_VOLT,
-- .lpsr_mask = BD71828_MASK_LDO_VOLT,
- .idle_on_mask = BD71828_MASK_IDLE_EN,
- .suspend_on_mask = BD71828_MASK_SUSP_EN,
- .lpsr_on_mask = BD71828_MASK_LPSR_EN,
-@@ -614,13 +575,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {
- ROHM_DVS_LEVEL_SUSPEND |
- ROHM_DVS_LEVEL_LPSR,
- .run_reg = BD71828_REG_LDO4_VOLT,
-- .idle_reg = BD71828_REG_LDO4_VOLT,
-- .suspend_reg = BD71828_REG_LDO4_VOLT,
-- .lpsr_reg = BD71828_REG_LDO4_VOLT,
- .run_mask = BD71828_MASK_LDO_VOLT,
-- .idle_mask = BD71828_MASK_LDO_VOLT,
-- .suspend_mask = BD71828_MASK_LDO_VOLT,
-- .lpsr_mask = BD71828_MASK_LDO_VOLT,
- .idle_on_mask = BD71828_MASK_IDLE_EN,
- .suspend_on_mask = BD71828_MASK_SUSP_EN,
- .lpsr_on_mask = BD71828_MASK_LPSR_EN,
-@@ -655,13 +610,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {
- ROHM_DVS_LEVEL_SUSPEND |
- ROHM_DVS_LEVEL_LPSR,
- .run_reg = BD71828_REG_LDO5_VOLT,
-- .idle_reg = BD71828_REG_LDO5_VOLT,
-- .suspend_reg = BD71828_REG_LDO5_VOLT,
-- .lpsr_reg = BD71828_REG_LDO5_VOLT,
- .run_mask = BD71828_MASK_LDO_VOLT,
-- .idle_mask = BD71828_MASK_LDO_VOLT,
-- .suspend_mask = BD71828_MASK_LDO_VOLT,
-- .lpsr_mask = BD71828_MASK_LDO_VOLT,
- .idle_on_mask = BD71828_MASK_IDLE_EN,
- .suspend_on_mask = BD71828_MASK_SUSP_EN,
- .lpsr_on_mask = BD71828_MASK_LPSR_EN,
-@@ -720,9 +669,6 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {
- .suspend_reg = BD71828_REG_LDO7_VOLT,
- .lpsr_reg = BD71828_REG_LDO7_VOLT,
- .run_mask = BD71828_MASK_LDO_VOLT,
-- .idle_mask = BD71828_MASK_LDO_VOLT,
-- .suspend_mask = BD71828_MASK_LDO_VOLT,
-- .lpsr_mask = BD71828_MASK_LDO_VOLT,
- .idle_on_mask = BD71828_MASK_IDLE_EN,
- .suspend_on_mask = BD71828_MASK_SUSP_EN,
- .lpsr_on_mask = BD71828_MASK_LPSR_EN,
---
-2.43.0
-
+++ /dev/null
-From 222d4a37a9314419806a1703bd16bf0e39e1f5b7 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 20 May 2024 15:31:33 +0300
-Subject: regulator: pickable ranges: don't always cache vsel
-
-From: Matti Vaittinen <mazziesaccount@gmail.com>
-
-[ Upstream commit f4f4276f985a5aac7b310a4ed040b47e275e7591 ]
-
-Some PMICs treat the vsel_reg same as apply-bit. Eg, when voltage range
-is changed, the new voltage setting is not taking effect until the vsel
-register is written.
-
-Add a flag 'range_applied_by_vsel' to the regulator desc to indicate this
-behaviour and to force the vsel value to be written to hardware if range
-was changed, even if the old selector was same as the new one.
-
-Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
-Link: https://msgid.link/r/ZktCpcGZdgHWuN_L@fedora
-Signed-off-by: Mark Brown <broonie@kernel.org>
-Stable-dep-of: 1ace99d7c7c4 ("regulator: tps6287x: Force writing VSEL bit")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/regulator/helpers.c | 43 ++++++++++++++++++++++----------
- include/linux/regulator/driver.h | 3 +++
- 2 files changed, 33 insertions(+), 13 deletions(-)
-
-diff --git a/drivers/regulator/helpers.c b/drivers/regulator/helpers.c
-index d492683365532..6e1ace660b8cf 100644
---- a/drivers/regulator/helpers.c
-+++ b/drivers/regulator/helpers.c
-@@ -161,6 +161,32 @@ int regulator_get_voltage_sel_pickable_regmap(struct regulator_dev *rdev)
- }
- EXPORT_SYMBOL_GPL(regulator_get_voltage_sel_pickable_regmap);
-
-+static int write_separate_vsel_and_range(struct regulator_dev *rdev,
-+ unsigned int sel, unsigned int range)
-+{
-+ bool range_updated;
-+ int ret;
-+
-+ ret = regmap_update_bits_base(rdev->regmap, rdev->desc->vsel_range_reg,
-+ rdev->desc->vsel_range_mask,
-+ range, &range_updated, false, false);
-+ if (ret)
-+ return ret;
-+
-+ /*
-+ * Some PMICs treat the vsel_reg same as apply-bit. Force it to be
-+ * written if the range changed, even if the old selector was same as
-+ * the new one
-+ */
-+ if (rdev->desc->range_applied_by_vsel && range_updated)
-+ return regmap_write_bits(rdev->regmap,
-+ rdev->desc->vsel_reg,
-+ rdev->desc->vsel_mask, sel);
-+
-+ return regmap_update_bits(rdev->regmap, rdev->desc->vsel_reg,
-+ rdev->desc->vsel_mask, sel);
-+}
-+
- /**
- * regulator_set_voltage_sel_pickable_regmap - pickable range set_voltage_sel
- *
-@@ -199,21 +225,12 @@ int regulator_set_voltage_sel_pickable_regmap(struct regulator_dev *rdev,
- range = rdev->desc->linear_range_selectors_bitfield[i];
- range <<= ffs(rdev->desc->vsel_range_mask) - 1;
-
-- if (rdev->desc->vsel_reg == rdev->desc->vsel_range_reg) {
-- ret = regmap_update_bits(rdev->regmap,
-- rdev->desc->vsel_reg,
-+ if (rdev->desc->vsel_reg == rdev->desc->vsel_range_reg)
-+ ret = regmap_update_bits(rdev->regmap, rdev->desc->vsel_reg,
- rdev->desc->vsel_range_mask |
- rdev->desc->vsel_mask, sel | range);
-- } else {
-- ret = regmap_update_bits(rdev->regmap,
-- rdev->desc->vsel_range_reg,
-- rdev->desc->vsel_range_mask, range);
-- if (ret)
-- return ret;
--
-- ret = regmap_update_bits(rdev->regmap, rdev->desc->vsel_reg,
-- rdev->desc->vsel_mask, sel);
-- }
-+ else
-+ ret = write_separate_vsel_and_range(rdev, sel, range);
-
- if (ret)
- return ret;
-diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
-index 22a07c0900a41..f230a472ccd35 100644
---- a/include/linux/regulator/driver.h
-+++ b/include/linux/regulator/driver.h
-@@ -299,6 +299,8 @@ enum regulator_type {
- * @vsel_range_reg: Register for range selector when using pickable ranges
- * and ``regulator_map_*_voltage_*_pickable`` functions.
- * @vsel_range_mask: Mask for register bitfield used for range selector
-+ * @range_applied_by_vsel: A flag to indicate that changes to vsel_range_reg
-+ * are only effective after vsel_reg is written
- * @vsel_reg: Register for selector when using ``regulator_map_*_voltage_*``
- * @vsel_mask: Mask for register bitfield used for selector
- * @vsel_step: Specify the resolution of selector stepping when setting
-@@ -389,6 +391,7 @@ struct regulator_desc {
-
- unsigned int vsel_range_reg;
- unsigned int vsel_range_mask;
-+ bool range_applied_by_vsel;
- unsigned int vsel_reg;
- unsigned int vsel_mask;
- unsigned int vsel_step;
---
-2.43.0
-
+++ /dev/null
-From b36a1fd62d3d65e57e4122eadf09baf131277bf4 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 20 May 2024 15:36:55 +0300
-Subject: regulator: tps6287x: Force writing VSEL bit
-
-From: Matti Vaittinen <mazziesaccount@gmail.com>
-
-[ Upstream commit 1ace99d7c7c4c801c0660246f741ff846a9b8e3c ]
-
-The data-sheet for TPS6287x-Q1
-https://www.ti.com/lit/ds/symlink/tps62873-q1.pdf
-states at chapter 9.3.6.1 Output Voltage Range:
-
-"Note that every change to the VRANGE[1:0] bits must be followed by a
-write to the VSET register, even if the value of the VSET[7:0] bits does
-not change."
-
-The current implementation of the driver uses the
-regulator_set_voltage_sel_pickable_regmap() helper which further uses
-regmap_update_bits() to write the VSET-register. The
-regmap_update_bits() will not access the hardware if the new register
-value is same as old. It is worth noting that this is true also when the
-register is marked volatile, which I can't say is wrong because
-'read-mnodify-write'-cycle with a volatile register is in any case
-something user should carefully consider.
-
-The 'range_applied_by_vsel'-flag in regulator desc was added to force
-the vsel register upodates by using regmap_write_bits(). This variant
-will always unconditionally write the bits to the hardware.
-
-It is worth noting that the vsel is now forced to be written to the
-hardware, whether the range was changed or not. This may cause a
-performance drop if users are wrtiting same voltage value repeteadly.
-
-It would be possible to read the range register to determine if it was
-changed, but this would be a performance issue for users who don't use
-reg cache for vsel.
-
-Always write the VSET register to the hardware regardless the cache.
-
-Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
-Fixes: 7b0518fbf2be ("regulator: Add support for TI TPS6287x regulators")
-Link: https://msgid.link/r/ZktD50C5twF1EuKu@fedora
-Signed-off-by: Mark Brown <broonie@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/regulator/tps6287x-regulator.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/drivers/regulator/tps6287x-regulator.c b/drivers/regulator/tps6287x-regulator.c
-index 9b7c3d77789e3..3c9d79e003e4b 100644
---- a/drivers/regulator/tps6287x-regulator.c
-+++ b/drivers/regulator/tps6287x-regulator.c
-@@ -115,6 +115,7 @@ static struct regulator_desc tps6287x_reg = {
- .vsel_mask = 0xFF,
- .vsel_range_reg = TPS6287X_CTRL2,
- .vsel_range_mask = TPS6287X_CTRL2_VRANGE,
-+ .range_applied_by_vsel = true,
- .ramp_reg = TPS6287X_CTRL1,
- .ramp_mask = TPS6287X_CTRL1_VRAMP,
- .ramp_delay_table = tps6287x_ramp_table,
---
-2.43.0
-
+++ /dev/null
-From 3aa031cb104dc617af01f47d30488a5731cf7159 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 21 May 2024 15:17:58 +0530
-Subject: regulator: tps6594-regulator: Correct multi-phase configuration
-
-From: Neha Malcom Francis <n-francis@ti.com>
-
-[ Upstream commit 74b38cd77d3eb63c6d0ad9cf2ae59812ae54d3ee ]
-
-According to the TPS6594 PMIC Manual (linked) 8.3.2.1.4 Multi-Phase BUCK
-Regulator Configurations section, the PMIC ignores all the other bucks'
-except the primary buck's regulator registers. This is BUCK1 for
-configurations BUCK12, BUCK123 and BUCK1234 while it is BUCK3 for
-BUCK34. Correct the registers mapped for these configurations
-accordingly.
-
-Fixes: f17ccc5deb4d ("regulator: tps6594-regulator: Add driver for TI TPS6594 regulators")
-Link: https://www.ti.com/lit/gpn/tps6594-q1
-Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
-Link: https://msgid.link/r/20240521094758.2190331-1-n-francis@ti.com
-Signed-off-by: Mark Brown <broonie@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/regulator/tps6594-regulator.c | 16 ++++++++--------
- 1 file changed, 8 insertions(+), 8 deletions(-)
-
-diff --git a/drivers/regulator/tps6594-regulator.c b/drivers/regulator/tps6594-regulator.c
-index b7f0c87797577..5fad61785e72f 100644
---- a/drivers/regulator/tps6594-regulator.c
-+++ b/drivers/regulator/tps6594-regulator.c
-@@ -287,30 +287,30 @@ static struct tps6594_regulator_irq_type *tps6594_ldos_irq_types[] = {
- static const struct regulator_desc multi_regs[] = {
- TPS6594_REGULATOR("BUCK12", "buck12", TPS6594_BUCK_1,
- REGULATOR_VOLTAGE, tps6594_bucks_ops, TPS6594_MASK_BUCKS_VSET,
-- TPS6594_REG_BUCKX_VOUT_1(1),
-+ TPS6594_REG_BUCKX_VOUT_1(0),
- TPS6594_MASK_BUCKS_VSET,
-- TPS6594_REG_BUCKX_CTRL(1),
-+ TPS6594_REG_BUCKX_CTRL(0),
- TPS6594_BIT_BUCK_EN, 0, 0, bucks_ranges,
- 4, 4000, 0, NULL, 0, 0),
- TPS6594_REGULATOR("BUCK34", "buck34", TPS6594_BUCK_3,
- REGULATOR_VOLTAGE, tps6594_bucks_ops, TPS6594_MASK_BUCKS_VSET,
-- TPS6594_REG_BUCKX_VOUT_1(3),
-+ TPS6594_REG_BUCKX_VOUT_1(2),
- TPS6594_MASK_BUCKS_VSET,
-- TPS6594_REG_BUCKX_CTRL(3),
-+ TPS6594_REG_BUCKX_CTRL(2),
- TPS6594_BIT_BUCK_EN, 0, 0, bucks_ranges,
- 4, 0, 0, NULL, 0, 0),
- TPS6594_REGULATOR("BUCK123", "buck123", TPS6594_BUCK_1,
- REGULATOR_VOLTAGE, tps6594_bucks_ops, TPS6594_MASK_BUCKS_VSET,
-- TPS6594_REG_BUCKX_VOUT_1(1),
-+ TPS6594_REG_BUCKX_VOUT_1(0),
- TPS6594_MASK_BUCKS_VSET,
-- TPS6594_REG_BUCKX_CTRL(1),
-+ TPS6594_REG_BUCKX_CTRL(0),
- TPS6594_BIT_BUCK_EN, 0, 0, bucks_ranges,
- 4, 4000, 0, NULL, 0, 0),
- TPS6594_REGULATOR("BUCK1234", "buck1234", TPS6594_BUCK_1,
- REGULATOR_VOLTAGE, tps6594_bucks_ops, TPS6594_MASK_BUCKS_VSET,
-- TPS6594_REG_BUCKX_VOUT_1(1),
-+ TPS6594_REG_BUCKX_VOUT_1(0),
- TPS6594_MASK_BUCKS_VSET,
-- TPS6594_REG_BUCKX_CTRL(1),
-+ TPS6594_REG_BUCKX_CTRL(0),
- TPS6594_BIT_BUCK_EN, 0, 0, bucks_ranges,
- 4, 4000, 0, NULL, 0, 0),
- };
---
-2.43.0
-
+++ /dev/null
-From f791208e7a1360127af4c578bc8b57acb9ae3244 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 28 Aug 2023 17:13:18 +0200
-Subject: remove call_{read,write}_iter() functions
-
-From: Miklos Szeredi <mszeredi@redhat.com>
-
-[ Upstream commit 7c98f7cb8fda964fbc60b9307ad35e94735fa35f ]
-
-These have no clear purpose. This is effectively a revert of commit
-bb7462b6fd64 ("vfs: use helpers for calling f_op->{read,write}_iter()").
-
-The patch was created with the help of a coccinelle script.
-
-Fixes: bb7462b6fd64 ("vfs: use helpers for calling f_op->{read,write}_iter()")
-Reviewed-by: Christian Brauner <brauner@kernel.org>
-Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
-Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/block/loop.c | 4 ++--
- drivers/target/target_core_file.c | 4 ++--
- fs/aio.c | 4 ++--
- fs/read_write.c | 12 ++++++------
- fs/splice.c | 4 ++--
- include/linux/fs.h | 12 ------------
- io_uring/rw.c | 4 ++--
- 7 files changed, 16 insertions(+), 28 deletions(-)
-
-diff --git a/drivers/block/loop.c b/drivers/block/loop.c
-index f8145499da38c..379bc9b9e8f61 100644
---- a/drivers/block/loop.c
-+++ b/drivers/block/loop.c
-@@ -445,9 +445,9 @@ static int lo_rw_aio(struct loop_device *lo, struct loop_cmd *cmd,
- cmd->iocb.ki_ioprio = IOPRIO_PRIO_VALUE(IOPRIO_CLASS_NONE, 0);
-
- if (rw == ITER_SOURCE)
-- ret = call_write_iter(file, &cmd->iocb, &iter);
-+ ret = file->f_op->write_iter(&cmd->iocb, &iter);
- else
-- ret = call_read_iter(file, &cmd->iocb, &iter);
-+ ret = file->f_op->read_iter(&cmd->iocb, &iter);
-
- lo_rw_aio_do_completion(cmd);
-
-diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c
-index 4d447520bab87..94e6cd4e7e43d 100644
---- a/drivers/target/target_core_file.c
-+++ b/drivers/target/target_core_file.c
-@@ -299,9 +299,9 @@ fd_execute_rw_aio(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
- aio_cmd->iocb.ki_flags |= IOCB_DSYNC;
-
- if (is_write)
-- ret = call_write_iter(file, &aio_cmd->iocb, &iter);
-+ ret = file->f_op->write_iter(&aio_cmd->iocb, &iter);
- else
-- ret = call_read_iter(file, &aio_cmd->iocb, &iter);
-+ ret = file->f_op->read_iter(&aio_cmd->iocb, &iter);
-
- if (ret != -EIOCBQUEUED)
- cmd_rw_aio_complete(&aio_cmd->iocb, ret);
-diff --git a/fs/aio.c b/fs/aio.c
-index 0f4f531c97800..744c7d1562dce 100644
---- a/fs/aio.c
-+++ b/fs/aio.c
-@@ -1605,7 +1605,7 @@ static int aio_read(struct kiocb *req, const struct iocb *iocb,
- return ret;
- ret = rw_verify_area(READ, file, &req->ki_pos, iov_iter_count(&iter));
- if (!ret)
-- aio_rw_done(req, call_read_iter(file, req, &iter));
-+ aio_rw_done(req, file->f_op->read_iter(req, &iter));
- kfree(iovec);
- return ret;
- }
-@@ -1636,7 +1636,7 @@ static int aio_write(struct kiocb *req, const struct iocb *iocb,
- if (S_ISREG(file_inode(file)->i_mode))
- kiocb_start_write(req);
- req->ki_flags |= IOCB_WRITE;
-- aio_rw_done(req, call_write_iter(file, req, &iter));
-+ aio_rw_done(req, file->f_op->write_iter(req, &iter));
- }
- kfree(iovec);
- return ret;
-diff --git a/fs/read_write.c b/fs/read_write.c
-index d4c036e82b6c3..2de7f6adb33d3 100644
---- a/fs/read_write.c
-+++ b/fs/read_write.c
-@@ -392,7 +392,7 @@ static ssize_t new_sync_read(struct file *filp, char __user *buf, size_t len, lo
- kiocb.ki_pos = (ppos ? *ppos : 0);
- iov_iter_ubuf(&iter, ITER_DEST, buf, len);
-
-- ret = call_read_iter(filp, &kiocb, &iter);
-+ ret = filp->f_op->read_iter(&kiocb, &iter);
- BUG_ON(ret == -EIOCBQUEUED);
- if (ppos)
- *ppos = kiocb.ki_pos;
-@@ -494,7 +494,7 @@ static ssize_t new_sync_write(struct file *filp, const char __user *buf, size_t
- kiocb.ki_pos = (ppos ? *ppos : 0);
- iov_iter_ubuf(&iter, ITER_SOURCE, (void __user *)buf, len);
-
-- ret = call_write_iter(filp, &kiocb, &iter);
-+ ret = filp->f_op->write_iter(&kiocb, &iter);
- BUG_ON(ret == -EIOCBQUEUED);
- if (ret > 0 && ppos)
- *ppos = kiocb.ki_pos;
-@@ -736,9 +736,9 @@ static ssize_t do_iter_readv_writev(struct file *filp, struct iov_iter *iter,
- kiocb.ki_pos = (ppos ? *ppos : 0);
-
- if (type == READ)
-- ret = call_read_iter(filp, &kiocb, iter);
-+ ret = filp->f_op->read_iter(&kiocb, iter);
- else
-- ret = call_write_iter(filp, &kiocb, iter);
-+ ret = filp->f_op->write_iter(&kiocb, iter);
- BUG_ON(ret == -EIOCBQUEUED);
- if (ppos)
- *ppos = kiocb.ki_pos;
-@@ -799,7 +799,7 @@ ssize_t vfs_iocb_iter_read(struct file *file, struct kiocb *iocb,
- if (ret < 0)
- return ret;
-
-- ret = call_read_iter(file, iocb, iter);
-+ ret = file->f_op->read_iter(iocb, iter);
- out:
- if (ret >= 0)
- fsnotify_access(file);
-@@ -860,7 +860,7 @@ ssize_t vfs_iocb_iter_write(struct file *file, struct kiocb *iocb,
- return ret;
-
- kiocb_start_write(iocb);
-- ret = call_write_iter(file, iocb, iter);
-+ ret = file->f_op->write_iter(iocb, iter);
- if (ret != -EIOCBQUEUED)
- kiocb_end_write(iocb);
- if (ret > 0)
-diff --git a/fs/splice.c b/fs/splice.c
-index 218e24b1ac401..60aed8de21f85 100644
---- a/fs/splice.c
-+++ b/fs/splice.c
-@@ -362,7 +362,7 @@ ssize_t copy_splice_read(struct file *in, loff_t *ppos,
- iov_iter_bvec(&to, ITER_DEST, bv, npages, len);
- init_sync_kiocb(&kiocb, in);
- kiocb.ki_pos = *ppos;
-- ret = call_read_iter(in, &kiocb, &to);
-+ ret = in->f_op->read_iter(&kiocb, &to);
-
- if (ret > 0) {
- keep = DIV_ROUND_UP(ret, PAGE_SIZE);
-@@ -740,7 +740,7 @@ iter_file_splice_write(struct pipe_inode_info *pipe, struct file *out,
- iov_iter_bvec(&from, ITER_SOURCE, array, n, sd.total_len - left);
- init_sync_kiocb(&kiocb, out);
- kiocb.ki_pos = sd.pos;
-- ret = call_write_iter(out, &kiocb, &from);
-+ ret = out->f_op->write_iter(&kiocb, &from);
- sd.pos = kiocb.ki_pos;
- if (ret <= 0)
- break;
-diff --git a/include/linux/fs.h b/include/linux/fs.h
-index 10e32c8ef1e9c..6a305a357199b 100644
---- a/include/linux/fs.h
-+++ b/include/linux/fs.h
-@@ -2076,18 +2076,6 @@ struct inode_operations {
- struct offset_ctx *(*get_offset_ctx)(struct inode *inode);
- } ____cacheline_aligned;
-
--static inline ssize_t call_read_iter(struct file *file, struct kiocb *kio,
-- struct iov_iter *iter)
--{
-- return file->f_op->read_iter(kio, iter);
--}
--
--static inline ssize_t call_write_iter(struct file *file, struct kiocb *kio,
-- struct iov_iter *iter)
--{
-- return file->f_op->write_iter(kio, iter);
--}
--
- static inline int call_mmap(struct file *file, struct vm_area_struct *vma)
- {
- return file->f_op->mmap(file, vma);
-diff --git a/io_uring/rw.c b/io_uring/rw.c
-index c3c154790e452..3181a4086bc5b 100644
---- a/io_uring/rw.c
-+++ b/io_uring/rw.c
-@@ -700,7 +700,7 @@ static inline int io_iter_do_read(struct io_rw *rw, struct iov_iter *iter)
- struct file *file = rw->kiocb.ki_filp;
-
- if (likely(file->f_op->read_iter))
-- return call_read_iter(file, &rw->kiocb, iter);
-+ return file->f_op->read_iter(&rw->kiocb, iter);
- else if (file->f_op->read)
- return loop_rw_iter(READ, rw, iter);
- else
-@@ -1053,7 +1053,7 @@ int io_write(struct io_kiocb *req, unsigned int issue_flags)
- kiocb->ki_flags |= IOCB_WRITE;
-
- if (likely(req->file->f_op->write_iter))
-- ret2 = call_write_iter(req->file, kiocb, &s->iter);
-+ ret2 = req->file->f_op->write_iter(kiocb, &s->iter);
- else if (req->file->f_op->write)
- ret2 = loop_rw_iter(WRITE, rw, &s->iter);
- else
---
-2.43.0
-
+++ /dev/null
-From 0f29fef658e7bbd913ebb7db7c107209cf411301 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 26 Apr 2024 14:22:59 +0200
-Subject: Revert "drm/bridge: ti-sn65dsi83: Fix enable error path"
-
-From: Luca Ceresoli <luca.ceresoli@bootlin.com>
-
-[ Upstream commit ad81feb5b6f1f5461641706376dcf7a9914ed2e7 ]
-
-This reverts commit 8a91b29f1f50ce7742cdbe5cf11d17f128511f3f.
-
-The regulator_disable() added by the original commit solves one kind of
-regulator imbalance but adds another one as it allows the regulator to be
-disabled one more time than it is enabled in the following scenario:
-
- 1. Start video pipeline -> sn65dsi83_atomic_pre_enable -> regulator_enable
- 2. PLL lock fails -> regulator_disable
- 3. Stop video pipeline -> sn65dsi83_atomic_disable -> regulator_disable
-
-The reason is clear from the code flow, which looks like this (after
-removing unrelated code):
-
- static void sn65dsi83_atomic_pre_enable()
- {
- regulator_enable(ctx->vcc);
-
- if (PLL failed locking) {
- regulator_disable(ctx->vcc); <---- added by patch being reverted
- return;
- }
- }
-
- static void sn65dsi83_atomic_disable()
- {
- regulator_disable(ctx->vcc);
- }
-
-The use case for introducing the additional regulator_disable() was
-removing the module for debugging (see link below for the discussion). If
-the module is removed after a .atomic_pre_enable, i.e. with an active
-pipeline from the DRM point of view, .atomic_disable is not called and thus
-the regulator would not be disabled.
-
-According to the discussion however there is no actual use case for
-removing the module with an active pipeline, except for
-debugging/development.
-
-On the other hand, the occurrence of a PLL lock failure is possible due to
-any physical reason (e.g. a temporary hardware failure for electrical
-reasons) so handling it gracefully should be supported. As there is no way
-for .atomic[_pre]_enable to report an error to the core, the only clean way
-to support it is calling regulator_disabled() only in .atomic_disable,
-unconditionally, as it was before.
-
-Link: https://lore.kernel.org/all/15244220.uLZWGnKmhe@steina-w/
-Fixes: 8a91b29f1f50 ("drm/bridge: ti-sn65dsi83: Fix enable error path")
-Reviewed-by: Alexander Stein <alexander.stein@ew.tq-group.com>
-Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
-Signed-off-by: Robert Foss <rfoss@kernel.org>
-Link: https://patchwork.freedesktop.org/patch/msgid/20240426122259.46808-1-luca.ceresoli@bootlin.com
-(cherry picked from commit 2940ee03b23281071620dda1d790cd644dabd394)
-Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/bridge/ti-sn65dsi83.c | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
-index 4814b7b6d1fd1..57a7ed13f9965 100644
---- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c
-+++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
-@@ -478,7 +478,6 @@ static void sn65dsi83_atomic_pre_enable(struct drm_bridge *bridge,
- dev_err(ctx->dev, "failed to lock PLL, ret=%i\n", ret);
- /* On failure, disable PLL again and exit. */
- regmap_write(ctx->regmap, REG_RC_PLL_EN, 0x00);
-- regulator_disable(ctx->vcc);
- return;
- }
-
---
-2.43.0
-
+++ /dev/null
-From d6574d38452bb6ac9f693b7144b35efe3cc19f63 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 20 May 2024 17:21:27 -0700
-Subject: Revert "ixgbe: Manual AN-37 for troublesome link partners for X550
- SFI"
-
-From: Jacob Keller <jacob.e.keller@intel.com>
-
-[ Upstream commit b35b1c0b4e166a427395deaf61e3140495dfcb89 ]
-
-This reverts commit 565736048bd5f9888990569993c6b6bfdf6dcb6d.
-
-According to the commit, it implements a manual AN-37 for some
-"troublesome" Juniper MX5 switches. This appears to be a workaround for a
-particular switch.
-
-It has been reported that this causes a severe breakage for other switches,
-including a Cisco 3560CX-12PD-S.
-
-The code appears to be a workaround for a specific switch which fails to
-link in SFI mode. It expects to see AN-37 auto negotiation in order to
-link. The Cisco switch is not expecting AN-37 auto negotiation. When the
-device starts the manual AN-37, the Cisco switch decides that the port is
-confused and stops attempting to link with it. This persists until a power
-cycle. A simple driver unload and reload does not resolve the issue, even
-if loading with a version of the driver which lacks this workaround.
-
-The authors of the workaround commit have not responded with
-clarifications, and the result of the workaround is complete failure to
-connect with other switches.
-
-This appears to be a case where the driver can either "correctly" link with
-the Juniper MX5 switch, at the cost of bricking the link with the Cisco
-switch, or it can behave properly for the Cisco switch, but fail to link
-with the Junipir MX5 switch. I do not know enough about the standards
-involved to clearly determine whether either switch is at fault or behaving
-incorrectly. Nor do I know whether there exists some alternative fix which
-corrects behavior with both switches.
-
-Revert the workaround for the Juniper switch.
-
-Fixes: 565736048bd5 ("ixgbe: Manual AN-37 for troublesome link partners for X550 SFI")
-Link: https://lore.kernel.org/netdev/cbe874db-9ac9-42b8-afa0-88ea910e1e99@intel.com/T/
-Link: https://forum.proxmox.com/threads/intel-x553-sfp-ixgbe-no-go-on-pve8.135129/#post-612291
-Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
-Cc: Jeff Daly <jeffd@silicom-usa.com>
-Cc: kernel.org-fo5k2w@ycharbi.fr
-Reviewed-by: Simon Horman <horms@kernel.org>
-Link: https://lore.kernel.org/r/20240520-net-2024-05-20-revert-silicom-switch-workaround-v1-1-50f80f261c94@intel.com
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 3 -
- drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 56 +------------------
- 2 files changed, 3 insertions(+), 56 deletions(-)
-
-diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
-index 61b9774b3d31e..c24a72d1e2737 100644
---- a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
-+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
-@@ -3673,9 +3673,7 @@ struct ixgbe_info {
- #define IXGBE_KRM_LINK_S1(P) ((P) ? 0x8200 : 0x4200)
- #define IXGBE_KRM_LINK_CTRL_1(P) ((P) ? 0x820C : 0x420C)
- #define IXGBE_KRM_AN_CNTL_1(P) ((P) ? 0x822C : 0x422C)
--#define IXGBE_KRM_AN_CNTL_4(P) ((P) ? 0x8238 : 0x4238)
- #define IXGBE_KRM_AN_CNTL_8(P) ((P) ? 0x8248 : 0x4248)
--#define IXGBE_KRM_PCS_KX_AN(P) ((P) ? 0x9918 : 0x5918)
- #define IXGBE_KRM_SGMII_CTRL(P) ((P) ? 0x82A0 : 0x42A0)
- #define IXGBE_KRM_LP_BASE_PAGE_HIGH(P) ((P) ? 0x836C : 0x436C)
- #define IXGBE_KRM_DSP_TXFFE_STATE_4(P) ((P) ? 0x8634 : 0x4634)
-@@ -3685,7 +3683,6 @@ struct ixgbe_info {
- #define IXGBE_KRM_PMD_FLX_MASK_ST20(P) ((P) ? 0x9054 : 0x5054)
- #define IXGBE_KRM_TX_COEFF_CTRL_1(P) ((P) ? 0x9520 : 0x5520)
- #define IXGBE_KRM_RX_ANA_CTL(P) ((P) ? 0x9A00 : 0x5A00)
--#define IXGBE_KRM_FLX_TMRS_CTRL_ST31(P) ((P) ? 0x9180 : 0x5180)
-
- #define IXGBE_KRM_PMD_FLX_MASK_ST20_SFI_10G_DA ~(0x3 << 20)
- #define IXGBE_KRM_PMD_FLX_MASK_ST20_SFI_10G_SR BIT(20)
-diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
-index c1adc94a5a657..f806fbf25ec7c 100644
---- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
-+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
-@@ -1722,59 +1722,9 @@ static s32 ixgbe_setup_sfi_x550a(struct ixgbe_hw *hw, ixgbe_link_speed *speed)
- return -EINVAL;
- }
-
-- (void)mac->ops.write_iosf_sb_reg(hw,
-- IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id),
-- IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
--
-- /* change mode enforcement rules to hybrid */
-- (void)mac->ops.read_iosf_sb_reg(hw,
-- IXGBE_KRM_FLX_TMRS_CTRL_ST31(hw->bus.lan_id),
-- IXGBE_SB_IOSF_TARGET_KR_PHY, ®_val);
-- reg_val |= 0x0400;
--
-- (void)mac->ops.write_iosf_sb_reg(hw,
-- IXGBE_KRM_FLX_TMRS_CTRL_ST31(hw->bus.lan_id),
-- IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
--
-- /* manually control the config */
-- (void)mac->ops.read_iosf_sb_reg(hw,
-- IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
-- IXGBE_SB_IOSF_TARGET_KR_PHY, ®_val);
-- reg_val |= 0x20002240;
--
-- (void)mac->ops.write_iosf_sb_reg(hw,
-- IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
-- IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
--
-- /* move the AN base page values */
-- (void)mac->ops.read_iosf_sb_reg(hw,
-- IXGBE_KRM_PCS_KX_AN(hw->bus.lan_id),
-- IXGBE_SB_IOSF_TARGET_KR_PHY, ®_val);
-- reg_val |= 0x1;
--
-- (void)mac->ops.write_iosf_sb_reg(hw,
-- IXGBE_KRM_PCS_KX_AN(hw->bus.lan_id),
-- IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
--
-- /* set the AN37 over CB mode */
-- (void)mac->ops.read_iosf_sb_reg(hw,
-- IXGBE_KRM_AN_CNTL_4(hw->bus.lan_id),
-- IXGBE_SB_IOSF_TARGET_KR_PHY, ®_val);
-- reg_val |= 0x20000000;
--
-- (void)mac->ops.write_iosf_sb_reg(hw,
-- IXGBE_KRM_AN_CNTL_4(hw->bus.lan_id),
-- IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
--
-- /* restart AN manually */
-- (void)mac->ops.read_iosf_sb_reg(hw,
-- IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
-- IXGBE_SB_IOSF_TARGET_KR_PHY, ®_val);
-- reg_val |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART;
--
-- (void)mac->ops.write_iosf_sb_reg(hw,
-- IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
-- IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
-+ status = mac->ops.write_iosf_sb_reg(hw,
-+ IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id),
-+ IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
-
- /* Toggle port SW reset by AN reset. */
- status = ixgbe_restart_an_internal_phy_x550em(hw);
---
-2.43.0
-
+++ /dev/null
-From 345858fa9d5f3e493b45671e27b1a5af0336c42a Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 2 May 2024 21:50:51 -0700
-Subject: riscv: cpufeature: Fix extension subset checking
-
-From: Charlie Jenkins <charlie@rivosinc.com>
-
-[ Upstream commit e67e98ee8952c7d5ce986d1dc6f8221ab8674afa ]
-
-This loop is supposed to check if ext->subset_ext_ids[j] is valid, rather
-than if ext->subset_ext_ids[i] is valid, before setting the extension
-id ext->subset_ext_ids[j] in isainfo->isa.
-
-Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
-Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
-Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
-Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
-Fixes: 0d8295ed975b ("riscv: add ISA extension parsing for scalar crypto")
-Link: https://lore.kernel.org/r/20240502-cpufeature_fixes-v4-2-b3d1a088722d@rivosinc.com
-Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/riscv/kernel/cpufeature.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c
-index 3242193541471..ec1852f47b280 100644
---- a/arch/riscv/kernel/cpufeature.c
-+++ b/arch/riscv/kernel/cpufeature.c
-@@ -616,7 +616,7 @@ static int __init riscv_fill_hwcap_from_ext_list(unsigned long *isa2hwcap)
-
- if (ext->subset_ext_size) {
- for (int j = 0; j < ext->subset_ext_size; j++) {
-- if (riscv_isa_extension_check(ext->subset_ext_ids[i]))
-+ if (riscv_isa_extension_check(ext->subset_ext_ids[j]))
- set_bit(ext->subset_ext_ids[j], isainfo->isa);
- }
- }
---
-2.43.0
-
+++ /dev/null
-From b13b6e67ca37d39640182e0da0fc00d6f7bcddc6 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 2 May 2024 21:50:50 -0700
-Subject: riscv: cpufeature: Fix thead vector hwcap removal
-
-From: Charlie Jenkins <charlie@rivosinc.com>
-
-[ Upstream commit e482eab4d1eb31031eff2b6afb71776483101979 ]
-
-The riscv_cpuinfo struct that contains mvendorid and marchid is not
-populated until all harts are booted which happens after the DT parsing.
-Use the mvendorid/marchid from the boot hart to determine if the DT
-contains an invalid V.
-
-Fixes: d82f32202e0d ("RISC-V: Ignore V from the riscv,isa DT property on older T-Head CPUs")
-Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
-Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
-Reviewed-by: Guo Ren <guoren@kernel.org>
-Link: https://lore.kernel.org/r/20240502-cpufeature_fixes-v4-1-b3d1a088722d@rivosinc.com
-Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/riscv/include/asm/sbi.h | 2 ++
- arch/riscv/kernel/cpu.c | 40 ++++++++++++++++++++++++++++++----
- arch/riscv/kernel/cpufeature.c | 8 +++++--
- 3 files changed, 44 insertions(+), 6 deletions(-)
-
-diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h
-index 6e68f8dff76bc..0fab508a65b3c 100644
---- a/arch/riscv/include/asm/sbi.h
-+++ b/arch/riscv/include/asm/sbi.h
-@@ -370,6 +370,8 @@ static inline int sbi_remote_fence_i(const struct cpumask *cpu_mask) { return -1
- static inline void sbi_init(void) {}
- #endif /* CONFIG_RISCV_SBI */
-
-+unsigned long riscv_get_mvendorid(void);
-+unsigned long riscv_get_marchid(void);
- unsigned long riscv_cached_mvendorid(unsigned int cpu_id);
- unsigned long riscv_cached_marchid(unsigned int cpu_id);
- unsigned long riscv_cached_mimpid(unsigned int cpu_id);
-diff --git a/arch/riscv/kernel/cpu.c b/arch/riscv/kernel/cpu.c
-index d11d6320fb0d2..c1f3655238fd2 100644
---- a/arch/riscv/kernel/cpu.c
-+++ b/arch/riscv/kernel/cpu.c
-@@ -139,6 +139,34 @@ int riscv_of_parent_hartid(struct device_node *node, unsigned long *hartid)
- return -1;
- }
-
-+unsigned long __init riscv_get_marchid(void)
-+{
-+ struct riscv_cpuinfo *ci = this_cpu_ptr(&riscv_cpuinfo);
-+
-+#if IS_ENABLED(CONFIG_RISCV_SBI)
-+ ci->marchid = sbi_spec_is_0_1() ? 0 : sbi_get_marchid();
-+#elif IS_ENABLED(CONFIG_RISCV_M_MODE)
-+ ci->marchid = csr_read(CSR_MARCHID);
-+#else
-+ ci->marchid = 0;
-+#endif
-+ return ci->marchid;
-+}
-+
-+unsigned long __init riscv_get_mvendorid(void)
-+{
-+ struct riscv_cpuinfo *ci = this_cpu_ptr(&riscv_cpuinfo);
-+
-+#if IS_ENABLED(CONFIG_RISCV_SBI)
-+ ci->mvendorid = sbi_spec_is_0_1() ? 0 : sbi_get_mvendorid();
-+#elif IS_ENABLED(CONFIG_RISCV_M_MODE)
-+ ci->mvendorid = csr_read(CSR_MVENDORID);
-+#else
-+ ci->mvendorid = 0;
-+#endif
-+ return ci->mvendorid;
-+}
-+
- DEFINE_PER_CPU(struct riscv_cpuinfo, riscv_cpuinfo);
-
- unsigned long riscv_cached_mvendorid(unsigned int cpu_id)
-@@ -170,12 +198,16 @@ static int riscv_cpuinfo_starting(unsigned int cpu)
- struct riscv_cpuinfo *ci = this_cpu_ptr(&riscv_cpuinfo);
-
- #if IS_ENABLED(CONFIG_RISCV_SBI)
-- ci->mvendorid = sbi_spec_is_0_1() ? 0 : sbi_get_mvendorid();
-- ci->marchid = sbi_spec_is_0_1() ? 0 : sbi_get_marchid();
-+ if (!ci->mvendorid)
-+ ci->mvendorid = sbi_spec_is_0_1() ? 0 : sbi_get_mvendorid();
-+ if (!ci->marchid)
-+ ci->marchid = sbi_spec_is_0_1() ? 0 : sbi_get_marchid();
- ci->mimpid = sbi_spec_is_0_1() ? 0 : sbi_get_mimpid();
- #elif IS_ENABLED(CONFIG_RISCV_M_MODE)
-- ci->mvendorid = csr_read(CSR_MVENDORID);
-- ci->marchid = csr_read(CSR_MARCHID);
-+ if (!ci->mvendorid)
-+ ci->mvendorid = csr_read(CSR_MVENDORID);
-+ if (!ci->marchid)
-+ ci->marchid = csr_read(CSR_MARCHID);
- ci->mimpid = csr_read(CSR_MIMPID);
- #else
- ci->mvendorid = 0;
-diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c
-index 79a5a35fab964..3242193541471 100644
---- a/arch/riscv/kernel/cpufeature.c
-+++ b/arch/riscv/kernel/cpufeature.c
-@@ -503,6 +503,8 @@ static void __init riscv_fill_hwcap_from_isa_string(unsigned long *isa2hwcap)
- struct acpi_table_header *rhct;
- acpi_status status;
- unsigned int cpu;
-+ u64 boot_vendorid;
-+ u64 boot_archid;
-
- if (!acpi_disabled) {
- status = acpi_get_table(ACPI_SIG_RHCT, 0, &rhct);
-@@ -510,6 +512,9 @@ static void __init riscv_fill_hwcap_from_isa_string(unsigned long *isa2hwcap)
- return;
- }
-
-+ boot_vendorid = riscv_get_mvendorid();
-+ boot_archid = riscv_get_marchid();
-+
- for_each_possible_cpu(cpu) {
- struct riscv_isainfo *isainfo = &hart_isa[cpu];
- unsigned long this_hwcap = 0;
-@@ -557,8 +562,7 @@ static void __init riscv_fill_hwcap_from_isa_string(unsigned long *isa2hwcap)
- * CPU cores with the ratified spec will contain non-zero
- * marchid.
- */
-- if (acpi_disabled && riscv_cached_mvendorid(cpu) == THEAD_VENDOR_ID &&
-- riscv_cached_marchid(cpu) == 0x0) {
-+ if (acpi_disabled && boot_vendorid == THEAD_VENDOR_ID && boot_archid == 0x0) {
- this_hwcap &= ~isa2hwcap[RISCV_ISA_EXT_v];
- clear_bit(RISCV_ISA_EXT_v, isainfo->isa);
- }
---
-2.43.0
-
+++ /dev/null
-From 20460ecca97dac3dd1fa5ebc72df6c9aab7f017e Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 15 Apr 2024 14:50:32 +0200
-Subject: riscv: dts: starfive: visionfive 2: Remove non-existing TDM hardware
-
-From: Hannah Peuckmann <hannah.peuckmann@canonical.com>
-
-[ Upstream commit dcde4e97b122ac318aaa71e8bcd2857dc28a0d12 ]
-
-This partially reverts
-commit e7c304c0346d ("riscv: dts: starfive: jh7110: add the node and pins configuration for tdm")
-
-This added device tree nodes for TDM hardware that is not actually on the
-VisionFive 2 board, but connected on the 40pin header. Many different extension
-boards could be added on those pins, so this should be handled by overlays
-instead.
-This also conflicts with the I2S node which also attempts to grab GPIO 44:
-
- starfive-jh7110-sys-pinctrl 13040000.pinctrl: pin GPIO44 already requested by 10090000.tdm; cannot claim for 120c0000.i2s
-
-Fixes: e7c304c0346d ("riscv: dts: starfive: jh7110: add the node and pins configuration for tdm")
-Signed-off-by: Hannah Peuckmann <hannah.peuckmann@canonical.com>
-Reviewed-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
-Tested-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
-Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- .../jh7110-starfive-visionfive-2.dtsi | 40 -------------------
- 1 file changed, 40 deletions(-)
-
-diff --git a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi
-index b89e9791efa72..30aa170bb76c7 100644
---- a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi
-+++ b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi
-@@ -551,40 +551,6 @@ GPOEN_ENABLE,
- };
- };
-
-- tdm_pins: tdm-0 {
-- tx-pins {
-- pinmux = <GPIOMUX(44, GPOUT_SYS_TDM_TXD,
-- GPOEN_ENABLE,
-- GPI_NONE)>;
-- bias-pull-up;
-- drive-strength = <2>;
-- input-disable;
-- input-schmitt-disable;
-- slew-rate = <0>;
-- };
--
-- rx-pins {
-- pinmux = <GPIOMUX(61, GPOUT_HIGH,
-- GPOEN_DISABLE,
-- GPI_SYS_TDM_RXD)>;
-- input-enable;
-- };
--
-- sync-pins {
-- pinmux = <GPIOMUX(63, GPOUT_HIGH,
-- GPOEN_DISABLE,
-- GPI_SYS_TDM_SYNC)>;
-- input-enable;
-- };
--
-- pcmclk-pins {
-- pinmux = <GPIOMUX(38, GPOUT_HIGH,
-- GPOEN_DISABLE,
-- GPI_SYS_TDM_CLK)>;
-- input-enable;
-- };
-- };
--
- uart0_pins: uart0-0 {
- tx-pins {
- pinmux = <GPIOMUX(5, GPOUT_SYS_UART0_TX,
-@@ -610,12 +576,6 @@ GPOEN_DISABLE,
- };
- };
-
--&tdm {
-- pinctrl-names = "default";
-- pinctrl-0 = <&tdm_pins>;
-- status = "okay";
--};
--
- &uart0 {
- pinctrl-names = "default";
- pinctrl-0 = <&uart0_pins>;
---
-2.43.0
-
+++ /dev/null
-From 7baca6dac7245a689429455af2ac392e85f77e1a Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 15 Apr 2024 14:50:33 +0200
-Subject: riscv: dts: starfive: visionfive 2: Remove non-existing I2S hardware
-
-From: Hannah Peuckmann <hannah.peuckmann@canonical.com>
-
-[ Upstream commit e0503d47e93dead8c0475ea1eb624e03fada21d3 ]
-
-This partially reverts
-commit 92cfc35838b2 ("riscv: dts: starfive: Add the nodes and pins of I2Srx/I2Stx0/I2Stx1")
-
-This added device tree nodes for I2S hardware that is not actually on the
-VisionFive 2 board, but connected on the 40pin header. Many different extension
-boards could be added on those pins, so this should be handled by overlays
-instead.
-This also conflicts with the TDM node which also attempts to grab GPIO 44:
-
- starfive-jh7110-sys-pinctrl 13040000.pinctrl: pin GPIO44 already requested by 10090000.tdm; cannot claim for 120c0000.i2s
-
-Fixes: 92cfc35838b2 ("riscv: dts: starfive: Add the nodes and pins of I2Srx/I2Stx0/I2Stx1")
-Signed-off-by: Hannah Peuckmann <hannah.peuckmann@canonical.com>
-Reviewed-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
-Tested-by: Emil Renner Berthing <emil.renner.berthing@canonical.com>
-Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- .../jh7110-starfive-visionfive-2.dtsi | 58 -------------------
- 1 file changed, 58 deletions(-)
-
-diff --git a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi
-index 30aa170bb76c7..c779cc826e918 100644
---- a/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi
-+++ b/arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi
-@@ -230,24 +230,6 @@ &i2c6 {
- status = "okay";
- };
-
--&i2srx {
-- pinctrl-names = "default";
-- pinctrl-0 = <&i2srx_pins>;
-- status = "okay";
--};
--
--&i2stx0 {
-- pinctrl-names = "default";
-- pinctrl-0 = <&mclk_ext_pins>;
-- status = "okay";
--};
--
--&i2stx1 {
-- pinctrl-names = "default";
-- pinctrl-0 = <&i2stx1_pins>;
-- status = "okay";
--};
--
- &mmc0 {
- max-frequency = <100000000>;
- assigned-clocks = <&syscrg JH7110_SYSCLK_SDIO0_SDCARD>;
-@@ -392,46 +374,6 @@ GPOEN_SYS_I2C6_DATA,
- };
- };
-
-- i2srx_pins: i2srx-0 {
-- clk-sd-pins {
-- pinmux = <GPIOMUX(38, GPOUT_LOW,
-- GPOEN_DISABLE,
-- GPI_SYS_I2SRX_BCLK)>,
-- <GPIOMUX(63, GPOUT_LOW,
-- GPOEN_DISABLE,
-- GPI_SYS_I2SRX_LRCK)>,
-- <GPIOMUX(38, GPOUT_LOW,
-- GPOEN_DISABLE,
-- GPI_SYS_I2STX1_BCLK)>,
-- <GPIOMUX(63, GPOUT_LOW,
-- GPOEN_DISABLE,
-- GPI_SYS_I2STX1_LRCK)>,
-- <GPIOMUX(61, GPOUT_LOW,
-- GPOEN_DISABLE,
-- GPI_SYS_I2SRX_SDIN0)>;
-- input-enable;
-- };
-- };
--
-- i2stx1_pins: i2stx1-0 {
-- sd-pins {
-- pinmux = <GPIOMUX(44, GPOUT_SYS_I2STX1_SDO0,
-- GPOEN_ENABLE,
-- GPI_NONE)>;
-- bias-disable;
-- input-disable;
-- };
-- };
--
-- mclk_ext_pins: mclk-ext-0 {
-- mclk-ext-pins {
-- pinmux = <GPIOMUX(4, GPOUT_LOW,
-- GPOEN_DISABLE,
-- GPI_SYS_MCLK_EXT)>;
-- input-enable;
-- };
-- };
--
- mmc0_pins: mmc0-0 {
- rst-pins {
- pinmux = <GPIOMUX(62, GPOUT_SYS_SDIO0_RST,
---
-2.43.0
-
+++ /dev/null
-From a1973fa43d40e50fc0245a8ca7bcd30e7dfddb5c Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 26 Mar 2024 21:49:42 -0700
-Subject: riscv: Flush the instruction cache during SMP bringup
-
-From: Samuel Holland <samuel.holland@sifive.com>
-
-[ Upstream commit 58661a30f1bcc748475ffd9be6d2fc9e4e6be679 ]
-
-Instruction cache flush IPIs are sent only to CPUs in cpu_online_mask,
-so they will not target a CPU until it calls set_cpu_online() earlier in
-smp_callin(). As a result, if instruction memory is modified between the
-CPU coming out of reset and that point, then its instruction cache may
-contain stale data. Therefore, the instruction cache must be flushed
-after the set_cpu_online() synchronization point.
-
-Fixes: 08f051eda33b ("RISC-V: Flush I$ when making a dirty page executable")
-Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
-Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
-Link: https://lore.kernel.org/r/20240327045035.368512-2-samuel.holland@sifive.com
-Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/riscv/kernel/smpboot.c | 7 ++++---
- 1 file changed, 4 insertions(+), 3 deletions(-)
-
-diff --git a/arch/riscv/kernel/smpboot.c b/arch/riscv/kernel/smpboot.c
-index 519b6bd946e5d..bbdb9ec62df0a 100644
---- a/arch/riscv/kernel/smpboot.c
-+++ b/arch/riscv/kernel/smpboot.c
-@@ -26,7 +26,7 @@
- #include <linux/sched/task_stack.h>
- #include <linux/sched/mm.h>
-
--#include <asm/cpufeature.h>
-+#include <asm/cacheflush.h>
- #include <asm/cpu_ops.h>
- #include <asm/cpufeature.h>
- #include <asm/irq.h>
-@@ -239,9 +239,10 @@ asmlinkage __visible void smp_callin(void)
- riscv_user_isa_enable();
-
- /*
-- * Remote TLB flushes are ignored while the CPU is offline, so emit
-- * a local TLB flush right now just in case.
-+ * Remote cache and TLB flushes are ignored while the CPU is offline,
-+ * so flush them both right now just in case.
- */
-+ local_flush_icache_all();
- local_flush_tlb_all();
- complete(&cpu_running);
- /*
---
-2.43.0
-
+++ /dev/null
-From 08951e58f14bac2d5a1a31a8ed78a9f537343938 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 23 May 2024 11:43:23 +0300
-Subject: riscv: prevent pt_regs corruption for secondary idle threads
-
-From: Sergey Matyukevich <sergey.matyukevich@syntacore.com>
-
-[ Upstream commit a638b0461b58aa3205cd9d5f14d6f703d795b4af ]
-
-Top of the kernel thread stack should be reserved for pt_regs. However
-this is not the case for the idle threads of the secondary boot harts.
-Their stacks overlap with their pt_regs, so both may get corrupted.
-
-Similar issue has been fixed for the primary hart, see c7cdd96eca28
-("riscv: prevent stack corruption by reserving task_pt_regs(p) early").
-However that fix was not propagated to the secondary harts. The problem
-has been noticed in some CPU hotplug tests with V enabled. The function
-smp_callin stored several registers on stack, corrupting top of pt_regs
-structure including status field. As a result, kernel attempted to save
-or restore inexistent V context.
-
-Fixes: 9a2451f18663 ("RISC-V: Avoid using per cpu array for ordered booting")
-Fixes: 2875fe056156 ("RISC-V: Add cpu_ops and modify default booting method")
-Signed-off-by: Sergey Matyukevich <sergey.matyukevich@syntacore.com>
-Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
-Link: https://lore.kernel.org/r/20240523084327.2013211-1-geomatsi@gmail.com
-Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/riscv/kernel/cpu_ops_sbi.c | 2 +-
- arch/riscv/kernel/cpu_ops_spinwait.c | 3 +--
- 2 files changed, 2 insertions(+), 3 deletions(-)
-
-diff --git a/arch/riscv/kernel/cpu_ops_sbi.c b/arch/riscv/kernel/cpu_ops_sbi.c
-index 1cc7df740eddc..e6fbaaf549562 100644
---- a/arch/riscv/kernel/cpu_ops_sbi.c
-+++ b/arch/riscv/kernel/cpu_ops_sbi.c
-@@ -72,7 +72,7 @@ static int sbi_cpu_start(unsigned int cpuid, struct task_struct *tidle)
- /* Make sure tidle is updated */
- smp_mb();
- bdata->task_ptr = tidle;
-- bdata->stack_ptr = task_stack_page(tidle) + THREAD_SIZE;
-+ bdata->stack_ptr = task_pt_regs(tidle);
- /* Make sure boot data is updated */
- smp_mb();
- hsm_data = __pa(bdata);
-diff --git a/arch/riscv/kernel/cpu_ops_spinwait.c b/arch/riscv/kernel/cpu_ops_spinwait.c
-index 613872b0a21ac..24869eb889085 100644
---- a/arch/riscv/kernel/cpu_ops_spinwait.c
-+++ b/arch/riscv/kernel/cpu_ops_spinwait.c
-@@ -34,8 +34,7 @@ static void cpu_update_secondary_bootdata(unsigned int cpuid,
-
- /* Make sure tidle is updated */
- smp_mb();
-- WRITE_ONCE(__cpu_spinwait_stack_pointer[hartid],
-- task_stack_page(tidle) + THREAD_SIZE);
-+ WRITE_ONCE(__cpu_spinwait_stack_pointer[hartid], task_pt_regs(tidle));
- WRITE_ONCE(__cpu_spinwait_task_pointer[hartid], tidle);
- }
-
---
-2.43.0
-
+++ /dev/null
-From fec3d4df09b3e33f32c9027e1cbe74e9e778900f Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 25 Apr 2024 12:58:03 -0700
-Subject: riscv: selftests: Add hwprobe binaries to .gitignore
-
-From: Charlie Jenkins <charlie@rivosinc.com>
-
-[ Upstream commit f8ea6ab92748e69216b44b07ea7213cb02070dba ]
-
-The cbo and which-cpu hwprobe selftests leave their artifacts in the
-kernel tree and end up being tracked by git. Add the binaries to the
-hwprobe selftest .gitignore so this no longer happens.
-
-Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
-Fixes: a29e2a48afe3 ("RISC-V: selftests: Add CBO tests")
-Fixes: ef7d6abb2cf5 ("RISC-V: selftests: Add which-cpus hwprobe test")
-Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
-Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
-Link: https://lore.kernel.org/r/20240425-gitignore_hwprobe_artifacts-v1-1-dfc5a20da469@rivosinc.com
-Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/testing/selftests/riscv/hwprobe/.gitignore | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/tools/testing/selftests/riscv/hwprobe/.gitignore b/tools/testing/selftests/riscv/hwprobe/.gitignore
-index 8113dc3bdd03a..6e384e80ea1a8 100644
---- a/tools/testing/selftests/riscv/hwprobe/.gitignore
-+++ b/tools/testing/selftests/riscv/hwprobe/.gitignore
-@@ -1 +1,3 @@
- hwprobe
-+cbo
-+which-cpus
---
-2.43.0
-
+++ /dev/null
-From 3447b69797c919e967d584c57bc79ae5dc2fb317 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 21 May 2024 22:13:13 +0300
-Subject: riscv: stacktrace: fixed walk_stackframe()
-
-From: Matthew Bystrin <dev.mbstr@gmail.com>
-
-[ Upstream commit a2a4d4a6a0bf5eba66f8b0b32502cc20d82715a0 ]
-
-If the load access fault occures in a leaf function (with
-CONFIG_FRAME_POINTER=y), when wrong stack trace will be displayed:
-
-[<ffffffff804853c2>] regmap_mmio_read32le+0xe/0x1c
----[ end trace 0000000000000000 ]---
-
-Registers dump:
- ra 0xffffffff80485758 <regmap_mmio_read+36>
- sp 0xffffffc80200b9a0
- fp 0xffffffc80200b9b0
- pc 0xffffffff804853ba <regmap_mmio_read32le+6>
-
-Stack dump:
- 0xffffffc80200b9a0: 0xffffffc80200b9e0 0xffffffc80200b9e0
- 0xffffffc80200b9b0: 0xffffffff8116d7e8 0x0000000000000100
- 0xffffffc80200b9c0: 0xffffffd8055b9400 0xffffffd8055b9400
- 0xffffffc80200b9d0: 0xffffffc80200b9f0 0xffffffff8047c526
- 0xffffffc80200b9e0: 0xffffffc80200ba30 0xffffffff8047fe9a
-
-The assembler dump of the function preambula:
- add sp,sp,-16
- sd s0,8(sp)
- add s0,sp,16
-
-In the fist stack frame, where ra is not stored on the stack we can
-observe:
-
- 0(sp) 8(sp)
- .---------------------------------------------.
- sp->| frame->fp | frame->ra (saved fp) |
- |---------------------------------------------|
- fp->| .... | .... |
- |---------------------------------------------|
- | | |
-
-and in the code check is performed:
- if (regs && (regs->epc == pc) && (frame->fp & 0x7))
-
-I see no reason to check frame->fp value at all, because it is can be
-uninitialized value on the stack. A better way is to check frame->ra to
-be an address on the stack. After the stacktrace shows as expect:
-
-[<ffffffff804853c2>] regmap_mmio_read32le+0xe/0x1c
-[<ffffffff80485758>] regmap_mmio_read+0x24/0x52
-[<ffffffff8047c526>] _regmap_bus_reg_read+0x1a/0x22
-[<ffffffff8047fe9a>] _regmap_read+0x5c/0xea
-[<ffffffff80480376>] _regmap_update_bits+0x76/0xc0
-...
----[ end trace 0000000000000000 ]---
-As pointed by Samuel Holland it is incorrect to remove check of the stackframe
-entirely.
-
-Changes since v2 [2]:
- - Add accidentally forgotten curly brace
-
-Changes since v1 [1]:
- - Instead of just dropping frame->fp check, replace it with validation of
- frame->ra, which should be a stack address.
- - Move frame pointer validation into the separate function.
-
-[1] https://lore.kernel.org/linux-riscv/20240426072701.6463-1-dev.mbstr@gmail.com/
-[2] https://lore.kernel.org/linux-riscv/20240521131314.48895-1-dev.mbstr@gmail.com/
-
-Fixes: f766f77a74f5 ("riscv/stacktrace: Fix stack output without ra on the stack top")
-Signed-off-by: Matthew Bystrin <dev.mbstr@gmail.com>
-Reviewed-by: Samuel Holland <samuel.holland@sifive.com>
-Link: https://lore.kernel.org/r/20240521191727.62012-1-dev.mbstr@gmail.com
-Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/riscv/kernel/stacktrace.c | 20 ++++++++++++++------
- 1 file changed, 14 insertions(+), 6 deletions(-)
-
-diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c
-index 64a9c093aef93..528ec7cc9a622 100644
---- a/arch/riscv/kernel/stacktrace.c
-+++ b/arch/riscv/kernel/stacktrace.c
-@@ -18,6 +18,16 @@
-
- extern asmlinkage void ret_from_exception(void);
-
-+static inline int fp_is_valid(unsigned long fp, unsigned long sp)
-+{
-+ unsigned long low, high;
-+
-+ low = sp + sizeof(struct stackframe);
-+ high = ALIGN(sp, THREAD_SIZE);
-+
-+ return !(fp < low || fp > high || fp & 0x07);
-+}
-+
- void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs,
- bool (*fn)(void *, unsigned long), void *arg)
- {
-@@ -41,21 +51,19 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs,
- }
-
- for (;;) {
-- unsigned long low, high;
- struct stackframe *frame;
-
- if (unlikely(!__kernel_text_address(pc) || (level++ >= 0 && !fn(arg, pc))))
- break;
-
-- /* Validate frame pointer */
-- low = sp + sizeof(struct stackframe);
-- high = ALIGN(sp, THREAD_SIZE);
-- if (unlikely(fp < low || fp > high || fp & 0x7))
-+ if (unlikely(!fp_is_valid(fp, sp)))
- break;
-+
- /* Unwind stack frame */
- frame = (struct stackframe *)fp - 1;
- sp = fp;
-- if (regs && (regs->epc == pc) && (frame->fp & 0x7)) {
-+ if (regs && (regs->epc == pc) && fp_is_valid(frame->ra, sp)) {
-+ /* We hit function where ra is not saved on the stack */
- fp = frame->ra;
- pc = regs->ra;
- } else {
---
-2.43.0
-
+++ /dev/null
-From c6e5b02cd329b9e230409f4935999e33746e0dbe Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 6 May 2024 12:37:59 +0300
-Subject: rpcrdma: fix handling for RDMA_CM_EVENT_DEVICE_REMOVAL
-
-From: Dan Aloni <dan.aloni@vastdata.com>
-
-[ Upstream commit 4836da219781ec510c4c0303df901aa643507a7a ]
-
-Under the scenario of IB device bonding, when bringing down one of the
-ports, or all ports, we saw xprtrdma entering a non-recoverable state
-where it is not even possible to complete the disconnect and shut it
-down the mount, requiring a reboot. Following debug, we saw that
-transport connect never ended after receiving the
-RDMA_CM_EVENT_DEVICE_REMOVAL callback.
-
-The DEVICE_REMOVAL callback is irrespective of whether the CM_ID is
-connected, and ESTABLISHED may not have happened. So need to work with
-each of these states accordingly.
-
-Fixes: 2acc5cae2923 ('xprtrdma: Prevent dereferencing r_xprt->rx_ep after it is freed')
-Cc: Sagi Grimberg <sagi.grimberg@vastdata.com>
-Signed-off-by: Dan Aloni <dan.aloni@vastdata.com>
-Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
-Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
-Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- net/sunrpc/xprtrdma/verbs.c | 6 +++++-
- 1 file changed, 5 insertions(+), 1 deletion(-)
-
-diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
-index 4f8d7efa469f0..432557a553e7e 100644
---- a/net/sunrpc/xprtrdma/verbs.c
-+++ b/net/sunrpc/xprtrdma/verbs.c
-@@ -244,7 +244,11 @@ rpcrdma_cm_event_handler(struct rdma_cm_id *id, struct rdma_cm_event *event)
- case RDMA_CM_EVENT_DEVICE_REMOVAL:
- pr_info("rpcrdma: removing device %s for %pISpc\n",
- ep->re_id->device->name, sap);
-- fallthrough;
-+ switch (xchg(&ep->re_connect_status, -ENODEV)) {
-+ case 0: goto wake_connect_worker;
-+ case 1: goto disconnected;
-+ }
-+ return 0;
- case RDMA_CM_EVENT_ADDR_CHANGE:
- ep->re_connect_status = -ENODEV;
- goto disconnected;
---
-2.43.0
-
+++ /dev/null
-From f1d2ee6647f098c62d802416ced2f825a7af0a09 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 20 May 2024 13:42:39 +0800
-Subject: rv: Update rv_en(dis)able_monitor doc to match kernel-doc
-
-From: Yang Li <yang.lee@linux.alibaba.com>
-
-[ Upstream commit 1e8b7b3dbb3103d577a586ca72bc329f7b67120b ]
-
-The patch updates the function documentation comment for
-rv_en(dis)able_monitor to adhere to the kernel-doc specification.
-
-Link: https://lore.kernel.org/linux-trace-kernel/20240520054239.61784-1-yang.lee@linux.alibaba.com
-
-Fixes: 102227b970a15 ("rv: Add Runtime Verification (RV) interface")
-Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
-Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- kernel/trace/rv/rv.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/kernel/trace/rv/rv.c b/kernel/trace/rv/rv.c
-index 2f68e93fff0bc..df0745a42a3f3 100644
---- a/kernel/trace/rv/rv.c
-+++ b/kernel/trace/rv/rv.c
-@@ -245,6 +245,7 @@ static int __rv_disable_monitor(struct rv_monitor_def *mdef, bool sync)
-
- /**
- * rv_disable_monitor - disable a given runtime monitor
-+ * @mdef: Pointer to the monitor definition structure.
- *
- * Returns 0 on success.
- */
-@@ -256,6 +257,7 @@ int rv_disable_monitor(struct rv_monitor_def *mdef)
-
- /**
- * rv_enable_monitor - enable a given runtime monitor
-+ * @mdef: Pointer to the monitor definition structure.
- *
- * Returns 0 on success, error otherwise.
- */
---
-2.43.0
-
+++ /dev/null
-From d747038899b39d0264e67dca47f25f0fceca944a Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 15 May 2024 09:20:27 +0200
-Subject: s390/boot: Remove alt_stfle_fac_list from decompressor
-
-From: Sven Schnelle <svens@linux.ibm.com>
-
-[ Upstream commit e7dec0b7926f3cd493c697c4c389df77e8e8a34c ]
-
-It is nowhere used in the decompressor, therefore remove it.
-
-Fixes: 17e89e1340a3 ("s390/facilities: move stfl information from lowcore to global data")
-Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
-Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
-Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/s390/boot/startup.c | 1 -
- arch/s390/kernel/setup.c | 2 +-
- 2 files changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/arch/s390/boot/startup.c b/arch/s390/boot/startup.c
-index 9cc76e631759b..3c2855c3d6df0 100644
---- a/arch/s390/boot/startup.c
-+++ b/arch/s390/boot/startup.c
-@@ -32,7 +32,6 @@ unsigned long __bootdata_preserved(max_mappable);
- unsigned long __bootdata(ident_map_size);
-
- u64 __bootdata_preserved(stfle_fac_list[16]);
--u64 __bootdata_preserved(alt_stfle_fac_list[16]);
- struct oldmem_data __bootdata_preserved(oldmem_data);
-
- struct machine_info machine;
-diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
-index d1f3b56e7afc2..9c43f45139fd4 100644
---- a/arch/s390/kernel/setup.c
-+++ b/arch/s390/kernel/setup.c
-@@ -155,7 +155,7 @@ unsigned int __bootdata_preserved(zlib_dfltcc_support);
- EXPORT_SYMBOL(zlib_dfltcc_support);
- u64 __bootdata_preserved(stfle_fac_list[16]);
- EXPORT_SYMBOL(stfle_fac_list);
--u64 __bootdata_preserved(alt_stfle_fac_list[16]);
-+u64 alt_stfle_fac_list[16];
- struct oldmem_data __bootdata_preserved(oldmem_data);
-
- unsigned long VMALLOC_START;
---
-2.43.0
-
+++ /dev/null
-From 67c408ec35321b2c4775bb29ea803eff694c5ba2 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 10 May 2024 12:41:25 +0200
-Subject: s390/ipl: Fix incorrect initialization of len fields in nvme reipl
- block
-
-From: Alexander Egorenkov <egorenar@linux.ibm.com>
-
-[ Upstream commit 9c922b73acaf39f867668d9cbe5dc69c23511f84 ]
-
-Use correct symbolic constants IPL_BP_NVME_LEN and IPL_BP0_NVME_LEN
-to initialize nvme reipl block when 'scp_data' sysfs attribute is
-being updated. This bug had not been detected before because
-the corresponding fcp and nvme symbolic constants are equal.
-
-Fixes: 23a457b8d57d ("s390: nvme reipl")
-Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
-Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com>
-Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/s390/kernel/ipl.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
-index ba75f6bee7742..47ab49ae542d3 100644
---- a/arch/s390/kernel/ipl.c
-+++ b/arch/s390/kernel/ipl.c
-@@ -962,8 +962,8 @@ static ssize_t reipl_nvme_scpdata_write(struct file *filp, struct kobject *kobj,
- scpdata_len += padding;
- }
-
-- reipl_block_nvme->hdr.len = IPL_BP_FCP_LEN + scpdata_len;
-- reipl_block_nvme->nvme.len = IPL_BP0_FCP_LEN + scpdata_len;
-+ reipl_block_nvme->hdr.len = IPL_BP_NVME_LEN + scpdata_len;
-+ reipl_block_nvme->nvme.len = IPL_BP0_NVME_LEN + scpdata_len;
- reipl_block_nvme->nvme.scp_data_len = scpdata_len;
-
- return count;
---
-2.43.0
-
+++ /dev/null
-From 768f8f7984eaaf3d74d1710fbd9c8e695ef5feee Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 10 May 2024 12:41:26 +0200
-Subject: s390/ipl: Fix incorrect initialization of nvme dump block
-
-From: Alexander Egorenkov <egorenar@linux.ibm.com>
-
-[ Upstream commit 7faacaeaf6ce12fae78751de5ad869d8f1e1cd7a ]
-
-Initialize the correct fields of the nvme dump block.
-This bug had not been detected before because first, the fcp and nvme fields
-of struct ipl_parameter_block are part of the same union and, therefore,
-overlap in memory and second, they are identical in structure and size.
-
-Fixes: d70e38cb1dee ("s390: nvme dump support")
-Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
-Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com>
-Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/s390/kernel/ipl.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
-index 47ab49ae542d3..8b95657db0a02 100644
---- a/arch/s390/kernel/ipl.c
-+++ b/arch/s390/kernel/ipl.c
-@@ -1858,9 +1858,9 @@ static int __init dump_nvme_init(void)
- }
- dump_block_nvme->hdr.len = IPL_BP_NVME_LEN;
- dump_block_nvme->hdr.version = IPL_PARM_BLOCK_VERSION;
-- dump_block_nvme->fcp.len = IPL_BP0_NVME_LEN;
-- dump_block_nvme->fcp.pbt = IPL_PBT_NVME;
-- dump_block_nvme->fcp.opt = IPL_PB0_NVME_OPT_DUMP;
-+ dump_block_nvme->nvme.len = IPL_BP0_NVME_LEN;
-+ dump_block_nvme->nvme.pbt = IPL_PBT_NVME;
-+ dump_block_nvme->nvme.opt = IPL_PB0_NVME_OPT_DUMP;
- dump_capabilities |= DUMP_TYPE_NVME;
- return 0;
- }
---
-2.43.0
-
+++ /dev/null
-From 03568e3b94f83e2cbaf5d9fa56d3d2fccd9136df Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 29 Apr 2024 17:02:53 +0200
-Subject: s390/vdso: Create .build-id links for unstripped vdso files
-
-From: Jens Remus <jremus@linux.ibm.com>
-
-[ Upstream commit fc2f5f10f9bc5e58d38e9fda7dae107ac04a799f ]
-
-Citing Andy Lutomirski from commit dda1e95cee38 ("x86/vdso: Create
-.build-id links for unstripped vdso files"):
-
-"With this change, doing 'make vdso_install' and telling gdb:
-
-set debug-file-directory /lib/modules/KVER/vdso
-
-will enable vdso debugging with symbols. This is useful for
-testing, but kernel RPM builds will probably want to manually delete
-these symlinks or otherwise do something sensible when they strip
-the vdso/*.so files."
-
-Fixes: 4bff8cb54502 ("s390: convert to GENERIC_VDSO")
-Signed-off-by: Jens Remus <jremus@linux.ibm.com>
-Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- scripts/Makefile.vdsoinst | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/scripts/Makefile.vdsoinst b/scripts/Makefile.vdsoinst
-index c477d17b0aa5b..a81ca735003e4 100644
---- a/scripts/Makefile.vdsoinst
-+++ b/scripts/Makefile.vdsoinst
-@@ -21,7 +21,7 @@ $$(dest): $$(src) FORCE
- $$(call cmd,install)
-
- # Some architectures create .build-id symlinks
--ifneq ($(filter arm sparc x86, $(SRCARCH)),)
-+ifneq ($(filter arm s390 sparc x86, $(SRCARCH)),)
- link := $(install-dir)/.build-id/$$(shell $(READELF) -n $$(src) | sed -n 's@^.*Build ID: \(..\)\(.*\)@\1/\2@p').debug
-
- __default: $$(link)
---
-2.43.0
-
+++ /dev/null
-From 4238c3738db50e6d33583a565b9d527b7137cc61 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 29 Apr 2024 17:02:52 +0200
-Subject: s390/vdso: Generate unwind information for C modules
-
-From: Jens Remus <jremus@linux.ibm.com>
-
-[ Upstream commit 10f70525365146046dddcc3d36bfaea2aee0376a ]
-
-GDB fails to unwind vDSO functions with error message "PC not saved",
-for instance when stepping through gettimeofday().
-
-Add -fasynchronous-unwind-tables to CFLAGS to generate .eh_frame
-DWARF unwind information for the vDSO C modules.
-
-Fixes: 4bff8cb54502 ("s390: convert to GENERIC_VDSO")
-Signed-off-by: Jens Remus <jremus@linux.ibm.com>
-Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/s390/kernel/vdso32/Makefile | 3 ++-
- arch/s390/kernel/vdso64/Makefile | 3 ++-
- 2 files changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/arch/s390/kernel/vdso32/Makefile b/arch/s390/kernel/vdso32/Makefile
-index b12a274cbb473..9090c0e5de254 100644
---- a/arch/s390/kernel/vdso32/Makefile
-+++ b/arch/s390/kernel/vdso32/Makefile
-@@ -20,7 +20,8 @@ KBUILD_AFLAGS_32 += -m31 -s
-
- KBUILD_CFLAGS_32 := $(filter-out -m64,$(KBUILD_CFLAGS))
- KBUILD_CFLAGS_32 := $(filter-out -mno-pic-data-is-text-relative,$(KBUILD_CFLAGS_32))
--KBUILD_CFLAGS_32 += -m31 -fPIC -shared -fno-common -fno-builtin
-+KBUILD_CFLAGS_32 := $(filter-out -fno-asynchronous-unwind-tables,$(KBUILD_CFLAGS_32))
-+KBUILD_CFLAGS_32 += -m31 -fPIC -shared -fno-common -fno-builtin -fasynchronous-unwind-tables
-
- LDFLAGS_vdso32.so.dbg += -shared -soname=linux-vdso32.so.1 \
- --hash-style=both --build-id=sha1 -melf_s390 -T
-diff --git a/arch/s390/kernel/vdso64/Makefile b/arch/s390/kernel/vdso64/Makefile
-index ef98327260972..a44f51de1f1ea 100644
---- a/arch/s390/kernel/vdso64/Makefile
-+++ b/arch/s390/kernel/vdso64/Makefile
-@@ -26,7 +26,8 @@ KBUILD_AFLAGS_64 += -m64
- KBUILD_CFLAGS_64 := $(filter-out -m64,$(KBUILD_CFLAGS))
- KBUILD_CFLAGS_64 := $(filter-out -mno-pic-data-is-text-relative,$(KBUILD_CFLAGS_64))
- KBUILD_CFLAGS_64 := $(filter-out -munaligned-symbols,$(KBUILD_CFLAGS_64))
--KBUILD_CFLAGS_64 += -m64 -fPIC -fno-common -fno-builtin
-+KBUILD_CFLAGS_64 := $(filter-out -fno-asynchronous-unwind-tables,$(KBUILD_CFLAGS_64))
-+KBUILD_CFLAGS_64 += -m64 -fPIC -fno-common -fno-builtin -fasynchronous-unwind-tables
- ldflags-y := -shared -soname=linux-vdso64.so.1 \
- --hash-style=both --build-id=sha1 -T
-
---
-2.43.0
-
+++ /dev/null
-From 9330e6a2ca8a1a0f527740c969cc3b536fb9958b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 29 Apr 2024 14:28:43 +0200
-Subject: s390/vdso: Use standard stack frame layout
-
-From: Heiko Carstens <hca@linux.ibm.com>
-
-[ Upstream commit 185445c7c137822ad856aae91a41e199370cb534 ]
-
-By default user space is compiled with standard stack frame layout and not
-with the packed stack layout. The vdso code however inherited the
--mpacked-stack compiler option from the kernel. Remove this option to make
-sure the vdso is compiled with standard stack frame layout.
-
-This makes sure that the stack frame backchain location for vdso generated
-stack frames is the same like for calling code (if compiled with default
-options). This allows to manually walk stack frames without DWARF
-information, like the kernel is doing it e.g. with arch_stack_walk_user().
-
-Fixes: 4bff8cb54502 ("s390: convert to GENERIC_VDSO")
-Reviewed-by: Jens Remus <jremus@linux.ibm.com>
-Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
-Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/s390/kernel/vdso32/Makefile | 1 +
- arch/s390/kernel/vdso64/Makefile | 1 +
- 2 files changed, 2 insertions(+)
-
-diff --git a/arch/s390/kernel/vdso32/Makefile b/arch/s390/kernel/vdso32/Makefile
-index 9090c0e5de254..4800d80decee6 100644
---- a/arch/s390/kernel/vdso32/Makefile
-+++ b/arch/s390/kernel/vdso32/Makefile
-@@ -19,6 +19,7 @@ KBUILD_AFLAGS_32 := $(filter-out -m64,$(KBUILD_AFLAGS))
- KBUILD_AFLAGS_32 += -m31 -s
-
- KBUILD_CFLAGS_32 := $(filter-out -m64,$(KBUILD_CFLAGS))
-+KBUILD_CFLAGS_32 := $(filter-out -mpacked-stack,$(KBUILD_CFLAGS))
- KBUILD_CFLAGS_32 := $(filter-out -mno-pic-data-is-text-relative,$(KBUILD_CFLAGS_32))
- KBUILD_CFLAGS_32 := $(filter-out -fno-asynchronous-unwind-tables,$(KBUILD_CFLAGS_32))
- KBUILD_CFLAGS_32 += -m31 -fPIC -shared -fno-common -fno-builtin -fasynchronous-unwind-tables
-diff --git a/arch/s390/kernel/vdso64/Makefile b/arch/s390/kernel/vdso64/Makefile
-index a44f51de1f1ea..2f2e4e997030c 100644
---- a/arch/s390/kernel/vdso64/Makefile
-+++ b/arch/s390/kernel/vdso64/Makefile
-@@ -24,6 +24,7 @@ KBUILD_AFLAGS_64 := $(filter-out -m64,$(KBUILD_AFLAGS))
- KBUILD_AFLAGS_64 += -m64
-
- KBUILD_CFLAGS_64 := $(filter-out -m64,$(KBUILD_CFLAGS))
-+KBUILD_CFLAGS_64 := $(filter-out -mpacked-stack,$(KBUILD_CFLAGS_64))
- KBUILD_CFLAGS_64 := $(filter-out -mno-pic-data-is-text-relative,$(KBUILD_CFLAGS_64))
- KBUILD_CFLAGS_64 := $(filter-out -munaligned-symbols,$(KBUILD_CFLAGS_64))
- KBUILD_CFLAGS_64 := $(filter-out -fno-asynchronous-unwind-tables,$(KBUILD_CFLAGS_64))
---
-2.43.0
-
+++ /dev/null
-From facdba5927609c954f569c27ace4e2681e25ba63 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 19 Feb 2024 14:27:31 +0100
-Subject: s390/vdso64: filter out munaligned-symbols flag for vdso
-
-From: Sumanth Korikkar <sumanthk@linux.ibm.com>
-
-[ Upstream commit 8192a1b3807510d0ed5be1f8988c08f8d41cced9 ]
-
-Gcc recently implemented an optimization [1] for loading symbols without
-explicit alignment, aligning with the IBM Z ELF ABI. This ABI mandates
-symbols to reside on a 2-byte boundary, enabling the use of the larl
-instruction. However, kernel linker scripts may still generate unaligned
-symbols. To address this, a new -munaligned-symbols option has been
-introduced [2] in recent gcc versions.
-
-[1] https://gcc.gnu.org/pipermail/gcc-patches/2023-June/622872.html
-[2] https://gcc.gnu.org/pipermail/gcc-patches/2023-August/625986.html
-
-However, when -munaligned-symbols is used in vdso code, it leads to the
-following compilation error:
-`.data.rel.ro.local' referenced in section `.text' of
-arch/s390/kernel/vdso64/vdso64_generic.o: defined in discarded section
-`.data.rel.ro.local' of arch/s390/kernel/vdso64/vdso64_generic.o
-
-vdso linker script discards .data section to make it lightweight.
-However, -munaligned-symbols in vdso object files references literal
-pool and accesses _vdso_data. Hence, compile vdso code without
--munaligned-symbols. This means in the future, vdso code should deal
-with alignment of newly introduced unaligned linker symbols.
-
-Acked-by: Vasily Gorbik <gor@linux.ibm.com>
-Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
-Link: https://lore.kernel.org/r/20240219132734.22881-2-sumanthk@linux.ibm.com
-Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
-Stable-dep-of: 10f705253651 ("s390/vdso: Generate unwind information for C modules")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/s390/kernel/vdso64/Makefile | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/arch/s390/kernel/vdso64/Makefile b/arch/s390/kernel/vdso64/Makefile
-index caa4ebff8a193..ef98327260972 100644
---- a/arch/s390/kernel/vdso64/Makefile
-+++ b/arch/s390/kernel/vdso64/Makefile
-@@ -25,6 +25,7 @@ KBUILD_AFLAGS_64 += -m64
-
- KBUILD_CFLAGS_64 := $(filter-out -m64,$(KBUILD_CFLAGS))
- KBUILD_CFLAGS_64 := $(filter-out -mno-pic-data-is-text-relative,$(KBUILD_CFLAGS_64))
-+KBUILD_CFLAGS_64 := $(filter-out -munaligned-symbols,$(KBUILD_CFLAGS_64))
- KBUILD_CFLAGS_64 += -m64 -fPIC -fno-common -fno-builtin
- ldflags-y := -shared -soname=linux-vdso64.so.1 \
- --hash-style=both --build-id=sha1 -T
---
-2.43.0
-
+++ /dev/null
-From febea7a20f6fe8fca25d5d0fe37b1b486509c0b8 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 9 Apr 2024 19:31:53 -0700
-Subject: scsi: mpi3mr: Avoid possible run-time warning with long manufacturer
- strings
-
-From: Kees Cook <keescook@chromium.org>
-
-[ Upstream commit d4309246cf6beb1c73b97b4d3bf976969793eb05 ]
-
-The prior use of strscpy() here expected the manufacture_reply strings to
-be NUL-terminated, but it is possible they are not, as the code pattern
-here shows, e.g., edev->vendor_id being exactly 1 character larger than
-manufacture_reply->vendor_id, and the strscpy() was copying only up to
-the size of the source character array. Replace this with memtostr(),
-which is the unambiguous way to convert a maybe not-NUL-terminated
-character array into a NUL-terminated string.
-
-Fixes: 2bd37e284914 ("scsi: mpi3mr: Add framework to issue MPT transport cmds")
-Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
-Link: https://lore.kernel.org/r/20240410023155.2100422-4-keescook@chromium.org
-Signed-off-by: Kees Cook <keescook@chromium.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/scsi/mpi3mr/mpi3mr_transport.c | 14 +++++---------
- 1 file changed, 5 insertions(+), 9 deletions(-)
-
-diff --git a/drivers/scsi/mpi3mr/mpi3mr_transport.c b/drivers/scsi/mpi3mr/mpi3mr_transport.c
-index d32ad46318cb0..231b4d0df85f3 100644
---- a/drivers/scsi/mpi3mr/mpi3mr_transport.c
-+++ b/drivers/scsi/mpi3mr/mpi3mr_transport.c
-@@ -209,17 +209,13 @@ static int mpi3mr_report_manufacture(struct mpi3mr_ioc *mrioc,
- goto out;
- }
-
-- strscpy(edev->vendor_id, manufacture_reply->vendor_id,
-- SAS_EXPANDER_VENDOR_ID_LEN);
-- strscpy(edev->product_id, manufacture_reply->product_id,
-- SAS_EXPANDER_PRODUCT_ID_LEN);
-- strscpy(edev->product_rev, manufacture_reply->product_rev,
-- SAS_EXPANDER_PRODUCT_REV_LEN);
-+ memtostr(edev->vendor_id, manufacture_reply->vendor_id);
-+ memtostr(edev->product_id, manufacture_reply->product_id);
-+ memtostr(edev->product_rev, manufacture_reply->product_rev);
- edev->level = manufacture_reply->sas_format & 1;
- if (edev->level) {
-- strscpy(edev->component_vendor_id,
-- manufacture_reply->component_vendor_id,
-- SAS_EXPANDER_COMPONENT_VENDOR_ID_LEN);
-+ memtostr(edev->component_vendor_id,
-+ manufacture_reply->component_vendor_id);
- tmp = (u8 *)&manufacture_reply->component_id;
- edev->component_id = tmp[0] << 8 | tmp[1];
- edev->component_revision_id =
---
-2.43.0
-
+++ /dev/null
-From 4eb3fe9f394758406659fbae37a3b01ef3340e1c Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 9 Apr 2024 19:31:51 -0700
-Subject: scsi: mptfusion: Avoid possible run-time warning with long
- manufacturer strings
-
-From: Kees Cook <keescook@chromium.org>
-
-[ Upstream commit 5bb288c4abc2e67d4ea94ba6bc80bb0ab18b123e ]
-
-The prior strscpy() replacement of strncpy() here expected the
-manufacture_reply strings to be NUL-terminated, but it is possible
-they are not, as the code pattern here shows, e.g., edev->vendor_id
-being exactly 1 character larger than manufacture_reply->vendor_id,
-and the replaced strncpy() was copying only up to the size of the
-source character array. Replace this with memtostr(), which is the
-unambiguous way to convert a maybe not-NUL-terminated character array
-into a NUL-terminated string.
-
-Reported-by: Charles Bertsch <cbertsch@cox.net>
-Closes: https://lore.kernel.org/all/5445ba0f-3e27-4d43-a9ba-0cc22ada2fce@cox.net/
-Fixes: 45e833f0e5bb ("scsi: message: fusion: Replace deprecated strncpy() with strscpy()")
-Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
-Link: https://lore.kernel.org/r/20240410023155.2100422-2-keescook@chromium.org
-Signed-off-by: Kees Cook <keescook@chromium.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/message/fusion/mptsas.c | 14 +++++---------
- 1 file changed, 5 insertions(+), 9 deletions(-)
-
-diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
-index 300f8e955a531..0f80c840afc3a 100644
---- a/drivers/message/fusion/mptsas.c
-+++ b/drivers/message/fusion/mptsas.c
-@@ -2964,17 +2964,13 @@ mptsas_exp_repmanufacture_info(MPT_ADAPTER *ioc,
- goto out_free;
-
- manufacture_reply = data_out + sizeof(struct rep_manu_request);
-- strscpy(edev->vendor_id, manufacture_reply->vendor_id,
-- sizeof(edev->vendor_id));
-- strscpy(edev->product_id, manufacture_reply->product_id,
-- sizeof(edev->product_id));
-- strscpy(edev->product_rev, manufacture_reply->product_rev,
-- sizeof(edev->product_rev));
-+ memtostr(edev->vendor_id, manufacture_reply->vendor_id);
-+ memtostr(edev->product_id, manufacture_reply->product_id);
-+ memtostr(edev->product_rev, manufacture_reply->product_rev);
- edev->level = manufacture_reply->sas_format;
- if (manufacture_reply->sas_format) {
-- strscpy(edev->component_vendor_id,
-- manufacture_reply->component_vendor_id,
-- sizeof(edev->component_vendor_id));
-+ memtostr(edev->component_vendor_id,
-+ manufacture_reply->component_vendor_id);
- tmp = (u8 *)&manufacture_reply->component_id;
- edev->component_id = tmp[0] << 8 | tmp[1];
- edev->component_revision_id =
---
-2.43.0
-
+++ /dev/null
-From 1957842812e97dbe643644c6fa211e06f4073176 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 9 Apr 2024 19:31:54 -0700
-Subject: scsi: qla2xxx: Avoid possible run-time warning with long model_num
-
-From: Kees Cook <keescook@chromium.org>
-
-[ Upstream commit c3408c4ae041dcc6a302397099fcad0dc307f6fd ]
-
-The prior strlcpy() replacement of strncpy() here (which was
-later replaced with strscpy()) expected pinfo->model_num (and
-pinfo->model_description) to be NUL-terminated, but it is possible
-it was not, as the code pattern here shows vha->hw->model_number (and
-vha->hw->model_desc) being exactly 1 character larger, and the replaced
-strncpy() was copying only up to the size of the source character
-array. Replace this with memtostr(), which is the unambiguous way to
-convert a maybe not-NUL-terminated character array into a NUL-terminated
-string.
-
-Fixes: 527e9b704c3d ("scsi: qla2xxx: Use memcpy() and strlcpy() instead of strcpy() and strncpy()")
-Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
-Link: https://lore.kernel.org/r/20240410023155.2100422-5-keescook@chromium.org
-Signed-off-by: Kees Cook <keescook@chromium.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/scsi/qla2xxx/qla_mr.c | 6 ++----
- 1 file changed, 2 insertions(+), 4 deletions(-)
-
-diff --git a/drivers/scsi/qla2xxx/qla_mr.c b/drivers/scsi/qla2xxx/qla_mr.c
-index 083f94e43fba0..82a7e21ddc838 100644
---- a/drivers/scsi/qla2xxx/qla_mr.c
-+++ b/drivers/scsi/qla2xxx/qla_mr.c
-@@ -1909,10 +1909,8 @@ qlafx00_fx_disc(scsi_qla_host_t *vha, fc_port_t *fcport, uint16_t fx_type)
- if (fx_type == FXDISC_GET_CONFIG_INFO) {
- struct config_info_data *pinfo =
- (struct config_info_data *) fdisc->u.fxiocb.rsp_addr;
-- strscpy(vha->hw->model_number, pinfo->model_num,
-- ARRAY_SIZE(vha->hw->model_number));
-- strscpy(vha->hw->model_desc, pinfo->model_description,
-- ARRAY_SIZE(vha->hw->model_desc));
-+ memtostr(vha->hw->model_number, pinfo->model_num);
-+ memtostr(vha->hw->model_desc, pinfo->model_description);
- memcpy(&vha->hw->mr.symbolic_name, pinfo->symbolic_name,
- sizeof(vha->hw->mr.symbolic_name));
- memcpy(&vha->hw->mr.serial_num, pinfo->serial_num,
---
-2.43.0
-
+++ /dev/null
-From 2055a7b6f7581e8e00fce65d61a052a1821f4027 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 5 Apr 2024 12:52:06 +0200
-Subject: selftests: mptcp: add ms units for tc-netem delay
-
-From: Geliang Tang <tanggeliang@kylinos.cn>
-
-[ Upstream commit 9109853a388b7b2b934f56f4ddb250d72e486555 ]
-
-'delay 1' in tc-netem is confusing, not sure if it's a delay of 1 second or
-1 millisecond. This patch explicitly adds millisecond units to make these
-commands clearer.
-
-Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
-Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
-Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-Stable-dep-of: 38af56e6668b ("selftests: mptcp: join: mark 'fail' tests as flaky")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/testing/selftests/net/mptcp/mptcp_join.sh | 6 +++---
- tools/testing/selftests/net/mptcp/simult_flows.sh | 4 ++--
- 2 files changed, 5 insertions(+), 5 deletions(-)
-
-diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
-index 24be952b4d4a1..a33e03da5070d 100755
---- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
-+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
-@@ -135,8 +135,8 @@ init_shapers()
- {
- local i
- for i in $(seq 1 4); do
-- tc -n $ns1 qdisc add dev ns1eth$i root netem rate 20mbit delay 1
-- tc -n $ns2 qdisc add dev ns2eth$i root netem rate 20mbit delay 1
-+ tc -n $ns1 qdisc add dev ns1eth$i root netem rate 20mbit delay 1ms
-+ tc -n $ns2 qdisc add dev ns2eth$i root netem rate 20mbit delay 1ms
- done
- }
-
-@@ -3279,7 +3279,7 @@ fail_tests()
-
- # multiple subflows
- if reset_with_fail "MP_FAIL MP_RST" 2; then
-- tc -n $ns2 qdisc add dev ns2eth1 root netem rate 1mbit delay 5
-+ tc -n $ns2 qdisc add dev ns2eth1 root netem rate 1mbit delay 5ms
- pm_nl_set_limits $ns1 0 1
- pm_nl_set_limits $ns2 0 1
- pm_nl_add_endpoint $ns2 10.0.2.2 dev ns2eth2 flags subflow
-diff --git a/tools/testing/selftests/net/mptcp/simult_flows.sh b/tools/testing/selftests/net/mptcp/simult_flows.sh
-index f5d094836067b..9831d7655b987 100755
---- a/tools/testing/selftests/net/mptcp/simult_flows.sh
-+++ b/tools/testing/selftests/net/mptcp/simult_flows.sh
-@@ -218,8 +218,8 @@ run_test()
- shift 4
- local msg=$*
-
-- [ $delay1 -gt 0 ] && delay1="delay $delay1" || delay1=""
-- [ $delay2 -gt 0 ] && delay2="delay $delay2" || delay2=""
-+ [ $delay1 -gt 0 ] && delay1="delay ${delay1}ms" || delay1=""
-+ [ $delay2 -gt 0 ] && delay2="delay ${delay2}ms" || delay2=""
-
- for dev in ns1eth1 ns1eth2; do
- tc -n $ns1 qdisc del dev $dev root >/dev/null 2>&1
---
-2.43.0
-
+++ /dev/null
-From 7aa071ef54821269ad76b47d4d257c8c9f9b9d24 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 24 May 2024 18:30:59 +0200
-Subject: selftests: mptcp: join: mark 'fail' tests as flaky
-
-From: Matthieu Baerts (NGI0) <matttbe@kernel.org>
-
-[ Upstream commit 38af56e6668b455f7dd0a8e2d9afe74100068e17 ]
-
-These tests are rarely unstable. It depends on the CI running the tests,
-especially if it is also busy doing other tasks in parallel, and if a
-debug kernel config is being used.
-
-It looks like this issue is sometimes present with the NetDev CI. While
-this is being investigated, the tests are marked as flaky not to create
-noises on such CIs.
-
-Fixes: b6e074e171bc ("selftests: mptcp: add infinite map testcase")
-Link: https://github.com/multipath-tcp/mptcp_net-next/issues/491
-Reviewed-by: Mat Martineau <martineau@kernel.org>
-Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
-Link: https://lore.kernel.org/r/20240524-upstream-net-20240524-selftests-mptcp-flaky-v1-4-a352362f3f8e@kernel.org
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/testing/selftests/net/mptcp/mptcp_join.sh | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
-index a33e03da5070d..1324ef532d99f 100755
---- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
-+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
-@@ -3271,6 +3271,7 @@ fail_tests()
- {
- # single subflow
- if reset_with_fail "Infinite map" 1; then
-+ MPTCP_LIB_SUBTEST_FLAKY=1
- test_linkfail=128 \
- run_tests $ns1 $ns2 10.0.1.1
- chk_join_nr 0 0 0 +1 +0 1 0 1 "$(pedit_action_pkts)"
-@@ -3279,6 +3280,7 @@ fail_tests()
-
- # multiple subflows
- if reset_with_fail "MP_FAIL MP_RST" 2; then
-+ MPTCP_LIB_SUBTEST_FLAKY=1
- tc -n $ns2 qdisc add dev ns2eth1 root netem rate 1mbit delay 5ms
- pm_nl_set_limits $ns1 0 1
- pm_nl_set_limits $ns2 0 1
---
-2.43.0
-
+++ /dev/null
-From 1283f5bcb5c29f47ea2cdf1db137e5fd8e266e28 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 24 May 2024 18:30:57 +0200
-Subject: selftests: mptcp: simult flows: mark 'unbalanced' tests as flaky
-
-From: Matthieu Baerts (NGI0) <matttbe@kernel.org>
-
-[ Upstream commit cc73a6577ae64247898269d138dee6b73ff710cc ]
-
-These tests are flaky since their introduction. This might be less or
-not visible depending on the CI running the tests, especially if it is
-also busy doing other tasks in parallel.
-
-A first analysis shown that the transfer can be slowed down when there
-are some re-injections at the MPTCP level. Such re-injections can of
-course happen, and disturb the transfer, but it looks strange to have
-them in this lab. That could be caused by the kernel having access to
-less CPU cycles -- e.g. when other activities are executed in parallel
--- or by a misinterpretation on the MPTCP packet scheduler side.
-
-While this is being investigated, the tests are marked as flaky not to
-create noises in other CIs.
-
-Fixes: 219d04992b68 ("mptcp: push pending frames when subflow has free space")
-Link: https://github.com/multipath-tcp/mptcp_net-next/issues/475
-Reviewed-by: Mat Martineau <martineau@kernel.org>
-Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
-Link: https://lore.kernel.org/r/20240524-upstream-net-20240524-selftests-mptcp-flaky-v1-2-a352362f3f8e@kernel.org
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/testing/selftests/net/mptcp/simult_flows.sh | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/tools/testing/selftests/net/mptcp/simult_flows.sh b/tools/testing/selftests/net/mptcp/simult_flows.sh
-index 8f9ddb3ad4fe8..f5d094836067b 100755
---- a/tools/testing/selftests/net/mptcp/simult_flows.sh
-+++ b/tools/testing/selftests/net/mptcp/simult_flows.sh
-@@ -245,7 +245,7 @@ run_test()
- do_transfer $small $large $time
- lret=$?
- mptcp_lib_result_code "${lret}" "${msg}"
-- if [ $lret -ne 0 ]; then
-+ if [ $lret -ne 0 ] && ! mptcp_lib_subtest_is_flaky; then
- ret=$lret
- [ $bail -eq 0 ] || exit $ret
- fi
-@@ -255,7 +255,7 @@ run_test()
- do_transfer $large $small $time
- lret=$?
- mptcp_lib_result_code "${lret}" "${msg}"
-- if [ $lret -ne 0 ]; then
-+ if [ $lret -ne 0 ] && ! mptcp_lib_subtest_is_flaky; then
- ret=$lret
- [ $bail -eq 0 ] || exit $ret
- fi
-@@ -288,7 +288,7 @@ run_test 10 10 0 0 "balanced bwidth"
- run_test 10 10 1 25 "balanced bwidth with unbalanced delay"
-
- # we still need some additional infrastructure to pass the following test-cases
--run_test 10 3 0 0 "unbalanced bwidth"
-+MPTCP_LIB_SUBTEST_FLAKY=1 run_test 10 3 0 0 "unbalanced bwidth"
- run_test 10 3 1 25 "unbalanced bwidth with unbalanced delay"
- run_test 10 3 25 1 "unbalanced bwidth with opposed, unbalanced delay"
-
---
-2.43.0
-
+++ /dev/null
-From da20ae987095f74ea9aeaf1bf619e2a9a062c414 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 18 May 2024 13:20:52 +0000
-Subject: selftests: net: kill smcrouted in the cleanup logic in amt.sh
-
-From: Taehee Yoo <ap420073@gmail.com>
-
-[ Upstream commit cc563e749810f5636451d4b833fbd689899ecdb9 ]
-
-The amt.sh requires smcrouted for multicasting routing.
-So, it starts smcrouted before forwarding tests.
-It must be stopped after all tests, but it isn't.
-
-To fix this issue, it kills smcrouted in the cleanup logic.
-
-Fixes: c08e8baea78e ("selftests: add amt interface selftest script")
-Signed-off-by: Taehee Yoo <ap420073@gmail.com>
-Reviewed-by: Simon Horman <horms@kernel.org>
-Signed-off-by: David S. Miller <davem@davemloft.net>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/testing/selftests/net/amt.sh | 8 +++++++-
- 1 file changed, 7 insertions(+), 1 deletion(-)
-
-diff --git a/tools/testing/selftests/net/amt.sh b/tools/testing/selftests/net/amt.sh
-index 5175a42cbe8a2..7e7ed6c558da9 100755
---- a/tools/testing/selftests/net/amt.sh
-+++ b/tools/testing/selftests/net/amt.sh
-@@ -77,6 +77,7 @@ readonly LISTENER=$(mktemp -u listener-XXXXXXXX)
- readonly GATEWAY=$(mktemp -u gateway-XXXXXXXX)
- readonly RELAY=$(mktemp -u relay-XXXXXXXX)
- readonly SOURCE=$(mktemp -u source-XXXXXXXX)
-+readonly SMCROUTEDIR="$(mktemp -d)"
- ERR=4
- err=0
-
-@@ -85,6 +86,11 @@ exit_cleanup()
- for ns in "$@"; do
- ip netns delete "${ns}" 2>/dev/null || true
- done
-+ if [ -f "$SMCROUTEDIR/amt.pid" ]; then
-+ smcpid=$(< $SMCROUTEDIR/amt.pid)
-+ kill $smcpid
-+ fi
-+ rm -rf $SMCROUTEDIR
-
- exit $ERR
- }
-@@ -167,7 +173,7 @@ setup_iptables()
-
- setup_mcast_routing()
- {
-- ip netns exec "${RELAY}" smcrouted
-+ ip netns exec "${RELAY}" smcrouted -P $SMCROUTEDIR/amt.pid
- ip netns exec "${RELAY}" smcroutectl a relay_src \
- 172.17.0.2 239.0.0.1 amtr
- ip netns exec "${RELAY}" smcroutectl a relay_src \
---
-2.43.0
-
+++ /dev/null
-From ba51341c99875871e9cfc4f217bd7c812b5e98bf Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 17 Apr 2024 21:23:17 +1000
-Subject: selftests/powerpc/dexcr: Add -no-pie to hashchk tests
-
-From: Benjamin Gray <bgray@linux.ibm.com>
-
-[ Upstream commit d7228a58d9438d6f219dc7f33eab0d1980b3bd2f ]
-
-The hashchk tests want to verify that the hash key is changed over exec.
-It does so by calculating hashes at the same address across an exec.
-This is made simpler by disabling PIE functionality, so we can
-re-execute ourselves and be using the same addresses in the child.
-
-While -fno-pie is already added, -no-pie is also required.
-
-Fixes: bdb07f35a52f ("selftests/powerpc/dexcr: Add hashst/hashchk test")
-Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
-Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-Link: https://msgid.link/20240417112325.728010-2-bgray@linux.ibm.com
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/testing/selftests/powerpc/dexcr/Makefile | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tools/testing/selftests/powerpc/dexcr/Makefile b/tools/testing/selftests/powerpc/dexcr/Makefile
-index 76210f2bcec3c..829ad075b4a44 100644
---- a/tools/testing/selftests/powerpc/dexcr/Makefile
-+++ b/tools/testing/selftests/powerpc/dexcr/Makefile
-@@ -3,7 +3,7 @@ TEST_GEN_FILES := lsdexcr
-
- include ../../lib.mk
-
--$(OUTPUT)/hashchk_test: CFLAGS += -fno-pie $(call cc-option,-mno-rop-protect)
-+$(OUTPUT)/hashchk_test: CFLAGS += -fno-pie -no-pie $(call cc-option,-mno-rop-protect)
-
- $(TEST_GEN_PROGS): ../harness.c ../utils.c ./dexcr.c
- $(TEST_GEN_FILES): ../utils.c ./dexcr.c
---
-2.43.0
-
+++ /dev/null
-From e116cef045f6e1e473982262ea6af6eb05bca315 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 2 Apr 2024 22:50:30 +0300
-Subject: serial: max3100: Fix bitwise types
-
-From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-
-[ Upstream commit e60955dbecb97f080848a57524827e2db29c70fd ]
-
-Sparse is not happy about misuse of bitwise types:
-
- .../max3100.c:194:13: warning: incorrect type in assignment (different base types)
- .../max3100.c:194:13: expected unsigned short [addressable] [usertype] etx
- .../max3100.c:194:13: got restricted __be16 [usertype]
- .../max3100.c:202:15: warning: cast to restricted __be16
-
-Fix this by choosing proper types for the respective variables.
-
-Fixes: 7831d56b0a35 ("tty: MAX3100")
-Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Link: https://lore.kernel.org/r/20240402195306.269276-4-andriy.shevchenko@linux.intel.com
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/tty/serial/max3100.c | 5 ++++-
- 1 file changed, 4 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/tty/serial/max3100.c b/drivers/tty/serial/max3100.c
-index b3e63b6a402e1..3d2b83d6ab51a 100644
---- a/drivers/tty/serial/max3100.c
-+++ b/drivers/tty/serial/max3100.c
-@@ -45,6 +45,9 @@
- #include <linux/freezer.h>
- #include <linux/tty.h>
- #include <linux/tty_flip.h>
-+#include <linux/types.h>
-+
-+#include <asm/unaligned.h>
-
- #include <linux/serial_max3100.h>
-
-@@ -191,7 +194,7 @@ static void max3100_timeout(struct timer_list *t)
- static int max3100_sr(struct max3100_port *s, u16 tx, u16 *rx)
- {
- struct spi_message message;
-- u16 etx, erx;
-+ __be16 etx, erx;
- int status;
- struct spi_transfer tran = {
- .tx_buf = &etx,
---
-2.43.0
-
+++ /dev/null
-From cf7dc87ef0593c0b4fc63036675516b1d97096fb Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 2 Apr 2024 22:50:28 +0300
-Subject: serial: max3100: Lock port->lock when calling
- uart_handle_cts_change()
-
-From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-
-[ Upstream commit 77ab53371a2066fdf9b895246505f5ef5a4b5d47 ]
-
-uart_handle_cts_change() has to be called with port lock taken,
-Since we run it in a separate work, the lock may not be taken at
-the time of running. Make sure that it's taken by explicitly doing
-that. Without it we got a splat:
-
- WARNING: CPU: 0 PID: 10 at drivers/tty/serial/serial_core.c:3491 uart_handle_cts_change+0xa6/0xb0
- ...
- Workqueue: max3100-0 max3100_work [max3100]
- RIP: 0010:uart_handle_cts_change+0xa6/0xb0
- ...
- max3100_handlerx+0xc5/0x110 [max3100]
- max3100_work+0x12a/0x340 [max3100]
-
-Fixes: 7831d56b0a35 ("tty: MAX3100")
-Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Link: https://lore.kernel.org/r/20240402195306.269276-2-andriy.shevchenko@linux.intel.com
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/tty/serial/max3100.c | 13 ++++++++++++-
- 1 file changed, 12 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/tty/serial/max3100.c b/drivers/tty/serial/max3100.c
-index 5efb2b593be33..45022f2909f0a 100644
---- a/drivers/tty/serial/max3100.c
-+++ b/drivers/tty/serial/max3100.c
-@@ -213,7 +213,7 @@ static int max3100_sr(struct max3100_port *s, u16 tx, u16 *rx)
- return 0;
- }
-
--static int max3100_handlerx(struct max3100_port *s, u16 rx)
-+static int max3100_handlerx_unlocked(struct max3100_port *s, u16 rx)
- {
- unsigned int status = 0;
- int ret = 0, cts;
-@@ -254,6 +254,17 @@ static int max3100_handlerx(struct max3100_port *s, u16 rx)
- return ret;
- }
-
-+static int max3100_handlerx(struct max3100_port *s, u16 rx)
-+{
-+ unsigned long flags;
-+ int ret;
-+
-+ uart_port_lock_irqsave(&s->port, &flags);
-+ ret = max3100_handlerx_unlocked(s, rx);
-+ uart_port_unlock_irqrestore(&s->port, flags);
-+ return ret;
-+}
-+
- static void max3100_work(struct work_struct *w)
- {
- struct max3100_port *s = container_of(w, struct max3100_port, work);
---
-2.43.0
-
+++ /dev/null
-From 04837655aa647f165370b768af8847af66035c9b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 2 Apr 2024 22:50:29 +0300
-Subject: serial: max3100: Update uart_driver_registered on driver removal
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-
-[ Upstream commit 712a1fcb38dc7cac6da63ee79a88708fbf9c45ec ]
-
-The removal of the last MAX3100 device triggers the removal of
-the driver. However, code doesn't update the respective global
-variable and after insmod — rmmod — insmod cycle the kernel
-oopses:
-
- max3100 spi-PRP0001:01: max3100_probe: adding port 0
- BUG: kernel NULL pointer dereference, address: 0000000000000408
- ...
- RIP: 0010:serial_core_register_port+0xa0/0x840
- ...
- max3100_probe+0x1b6/0x280 [max3100]
- spi_probe+0x8d/0xb0
-
-Update the actual state so next time UART driver will be registered
-again.
-
-Hugo also noticed, that the error path in the probe also affected
-by having the variable set, and not cleared. Instead of clearing it
-move the assignment after the successfull uart_register_driver() call.
-
-Fixes: 7831d56b0a35 ("tty: MAX3100")
-Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Reviewed-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
-Link: https://lore.kernel.org/r/20240402195306.269276-3-andriy.shevchenko@linux.intel.com
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/tty/serial/max3100.c | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/tty/serial/max3100.c b/drivers/tty/serial/max3100.c
-index 45022f2909f0a..b3e63b6a402e1 100644
---- a/drivers/tty/serial/max3100.c
-+++ b/drivers/tty/serial/max3100.c
-@@ -749,13 +749,14 @@ static int max3100_probe(struct spi_device *spi)
- mutex_lock(&max3100s_lock);
-
- if (!uart_driver_registered) {
-- uart_driver_registered = 1;
- retval = uart_register_driver(&max3100_uart_driver);
- if (retval) {
- printk(KERN_ERR "Couldn't register max3100 uart driver\n");
- mutex_unlock(&max3100s_lock);
- return retval;
- }
-+
-+ uart_driver_registered = 1;
- }
-
- for (i = 0; i < MAX_MAX3100; i++)
-@@ -841,6 +842,7 @@ static void max3100_remove(struct spi_device *spi)
- }
- pr_debug("removing max3100 driver\n");
- uart_unregister_driver(&max3100_uart_driver);
-+ uart_driver_registered = 0;
-
- mutex_unlock(&max3100s_lock);
- }
---
-2.43.0
-
+++ /dev/null
-From 4f9d9b0fc7902a4189b881107a0d6c814f3e7494 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 9 Apr 2024 11:42:49 -0400
-Subject: serial: sc16is7xx: add proper sched.h include for sched_set_fifo()
-
-From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
-
-[ Upstream commit 2a8e4ab0c93fad30769479f86849e22d63cd0e12 ]
-
-Replace incorrect include with the proper one for sched_set_fifo()
-declaration.
-
-Fixes: 28d2f209cd16 ("sched,serial: Convert to sched_set_fifo()")
-Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
-Link: https://lore.kernel.org/r/20240409154253.3043822-2-hugo@hugovil.com
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/tty/serial/sc16is7xx.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
-index 12915fffac279..ace2c4b333acc 100644
---- a/drivers/tty/serial/sc16is7xx.c
-+++ b/drivers/tty/serial/sc16is7xx.c
-@@ -18,6 +18,7 @@
- #include <linux/module.h>
- #include <linux/property.h>
- #include <linux/regmap.h>
-+#include <linux/sched.h>
- #include <linux/serial_core.h>
- #include <linux/serial.h>
- #include <linux/tty.h>
-@@ -25,7 +26,6 @@
- #include <linux/spi/spi.h>
- #include <linux/uaccess.h>
- #include <linux/units.h>
--#include <uapi/linux/sched/types.h>
-
- #define SC16IS7XX_NAME "sc16is7xx"
- #define SC16IS7XX_MAX_DEVS 8
---
-2.43.0
-
+++ /dev/null
-From dfcef6c66f51777c06cd53d6ce5742868c6776e7 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 6 May 2024 13:40:17 +0200
-Subject: serial: sh-sci: protect invalidating RXDMA on shutdown
-
-From: Wolfram Sang <wsa+renesas@sang-engineering.com>
-
-[ Upstream commit aae20f6e34cd0cbd67a1d0e5877561c40109a81b ]
-
-The to-be-fixed commit removed locking when invalidating the DMA RX
-descriptors on shutdown. It overlooked that there is still a rx_timer
-running which may still access the protected data. So, re-add the
-locking.
-
-Reported-by: Dirk Behme <dirk.behme@de.bosch.com>
-Closes: https://lore.kernel.org/r/ee6c9e16-9f29-450e-81da-4a8dceaa8fc7@de.bosch.com
-Fixes: 2c4ee23530ff ("serial: sh-sci: Postpone DMA release when falling back to PIO")
-Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
-Link: https://lore.kernel.org/r/20240506114016.30498-7-wsa+renesas@sang-engineering.com
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/tty/serial/sh-sci.c | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
-index a85e7b9a2e492..0d9eab56747cc 100644
---- a/drivers/tty/serial/sh-sci.c
-+++ b/drivers/tty/serial/sh-sci.c
-@@ -1272,9 +1272,14 @@ static void sci_dma_rx_chan_invalidate(struct sci_port *s)
- static void sci_dma_rx_release(struct sci_port *s)
- {
- struct dma_chan *chan = s->chan_rx_saved;
-+ struct uart_port *port = &s->port;
-+ unsigned long flags;
-
-+ uart_port_lock_irqsave(port, &flags);
- s->chan_rx_saved = NULL;
- sci_dma_rx_chan_invalidate(s);
-+ uart_port_unlock_irqrestore(port, flags);
-+
- dmaengine_terminate_sync(chan);
- dma_free_coherent(chan->device->dev, s->buf_len_rx * 2, s->rx_buf[0],
- sg_dma_address(&s->sg_rx[0]));
---
-2.43.0
-
+++ /dev/null
-perf-build-fix-out-of-tree-build-related-to-installa.patch
-perf-record-delete-session-after-stopping-sideband-t.patch
-perf-probe-add-missing-libgen.h-header-needed-for-us.patch
-iio-core-leave-private-pointer-null-when-no-private-.patch
-greybus-lights-check-return-of-get_channel_from_mode.patch
-dt-bindings-pinctrl-qcom-update-functions-to-match-w.patch
-f2fs-multidev-fix-to-recognize-valid-zero-block-addr.patch
-f2fs-fix-to-wait-on-page-writeback-in-__clone_blkadd.patch
-fpga-manager-add-owner-module-and-take-its-refcount.patch
-fpga-bridge-add-owner-module-and-take-its-refcount.patch
-counter-linux-counter.h-fix-excess-kernel-doc-descri.patch
-perf-annotate-get-rid-of-duplicate-group-option-item.patch
-perf-sched-timehist-fix-g-call-graph-option-failure.patch
-usb-typec-ucsi-allow-non-partner-get_pdos-for-qualco.patch
-usb-typec-ucsi-always-register-a-link-to-usb-pd-devi.patch
-usb-typec-ucsi-simplify-partner-s-pd-caps-registrati.patch
-perf-report-fix-pai-counter-names-for-s390-virtual-m.patch
-perf-stat-do-not-fail-on-metrics-on-s390-z-vm-system.patch
-soundwire-cadence-fix-invalid-pdi-offset.patch
-dmaengine-idma64-add-check-for-dma_set_max_seg_size.patch
-firmware-dmi-id-add-a-release-callback-function.patch
-perf-annotate-fix-annotation_calc_lines-to-pass-corr.patch
-serial-max3100-lock-port-lock-when-calling-uart_hand.patch
-serial-max3100-update-uart_driver_registered-on-driv.patch
-serial-max3100-fix-bitwise-types.patch
-greybus-arche-ctrl-move-device-table-to-its-right-lo.patch
-pci-dwc-ep-fix-dbi-access-failure-for-drivers-requir.patch
-pci-tegra194-fix-probe-path-for-endpoint-mode.patch
-serial-sc16is7xx-add-proper-sched.h-include-for-sche.patch
-module-don-t-ignore-sysfs_create_link-failures.patch
-interconnect-qcom-qcm2290-fix-mas_snoc_bimc-qos-port.patch
-arm64-dts-meson-fix-s4-power-controller-node.patch
-perf-tests-make-test-data-symbol-more-robust-on-neov.patch
-perf-tests-apply-attributes-to-all-events-in-object-.patch
-perf-record-fix-debug-message-placement-for-test-con.patch
-dt-bindings-pci-rcar-pci-host-add-missing-iommu-prop.patch
-perf-bench-uprobe-remove-lib64-from-libc.so.6-binary.patch
-f2fs-compress-fix-to-relocate-check-condition-in-f2f.patch
-f2fs-compress-fix-to-relocate-check-condition-in-f2f.patch-22547
-f2fs-fix-to-relocate-check-condition-in-f2fs_falloca.patch
-f2fs-fix-to-check-pinfile-flag-in-f2fs_move_file_ran.patch
-iio-adc-stm32-fixing-err-code-to-not-indicate-succes.patch
-riscv-dts-starfive-visionfive-2-remove-non-existing-.patch
-riscv-dts-starfive-visionfive-2-remove-non-existing-.patch-1325
-remove-call_-read-write-_iter-functions.patch
-coresight-etm4x-fix-unbalanced-pm_runtime_enable.patch
-perf-docs-document-bpf-event-modifier.patch
-perf-test-shell-arm_coresight-increase-buffer-size-f.patch
-iio-pressure-dps310-support-negative-temperature-val.patch
-coresight-etm4x-do-not-hardcode-iomem-access-for-reg.patch
-coresight-etm4x-do-not-save-restore-data-trace-contr.patch
-coresight-etm4x-safe-access-for-trcqcltr.patch
-coresight-etm4x-fix-access-to-resource-selector-regi.patch
-vfio-pci-fix-potential-memory-leak-in-vfio_intx_enab.patch
-fpga-region-add-owner-module-and-take-its-refcount.patch
-udf-remove-gfp_nofs-allocation-in-udf_expand_file_ad.patch
-udf-convert-udf_expand_file_adinicb-to-use-a-folio.patch
-microblaze-remove-gcc-flag-for-non-existing-early_pr.patch
-microblaze-remove-early-printk-call-from-cpuinfo-sta.patch
-pinctrl-renesas-rzg2l-limit-2.5v-power-supply-to-eth.patch
-pci-wait-for-link-training-0-before-starting-link-re.patch
-perf-intel-pt-fix-unassigned-instruction-op-discover.patch
-riscv-flush-the-instruction-cache-during-smp-bringup.patch
-usb-xhci-check-if-requested-segments-exceeds-erst-ca.patch
-leds-pwm-disable-pwm-when-going-to-suspend.patch
-ovl-remove-upper-umask-handling-from-ovl_create_uppe.patch
-pci-of_property-return-error-for-int_map-allocation-.patch
-vmci-fix-an-error-handling-path-in-vmci_guest_probe_.patch
-dt-bindings-pinctrl-mediatek-mt7622-fix-array-proper.patch
-pinctrl-qcom-pinctrl-sm7150-fix-sdc1-and-ufs-special.patch
-watchdog-cpu5wdt.c-fix-use-after-free-bug-caused-by-.patch
-watchdog-bd9576-drop-always-running-property.patch
-watchdog-sa1100-fix-ptr_err_or_zero-vs-null-check-in.patch
-dt-bindings-phy-qcom-sc8280xp-qmp-ufs-phy-fix-msm899.patch
-dt-bindings-phy-qcom-usb-snps-femto-v2-use-correct-f.patch
-dmaengine-idxd-avoid-unnecessary-destruction-of-file.patch
-usb-gadget-u_audio-fix-race-condition-use-of-control.patch
-usb-gadget-u_audio-clear-uac-pointer-when-freed.patch
-stm-class-fix-a-double-free-in-stm_register_device.patch
-ppdev-add-an-error-check-in-register_device.patch
-i2c-cadence-avoid-fifo-clear-after-start.patch
-i2c-synquacer-fix-an-error-handling-path-in-synquace.patch
-perf-bench-internals-inject-build-id-fix-trap-divide.patch
-perf-ui-browser-don-t-save-pointer-to-stack-memory.patch
-extcon-max8997-select-irq_domain-instead-of-dependin.patch
-spmi-pmic-arb-replace-three-is_err-calls-by-null-poi.patch
-pci-edr-align-edr_port_dpc_enable_dsm-with-pci-firmw.patch
-pci-edr-align-edr_port_locate_dsm-with-pci-firmware-.patch
-f2fs-fix-block-migration-when-section-is-not-aligned.patch
-perf-ui-browser-avoid-segv-on-title.patch
-perf-report-avoid-segv-in-report__setup_sample_type.patch
-perf-thread-fixes-to-thread__new-related-to-initiali.patch
-perf-symbols-fix-ownership-of-string-in-dso__load_vm.patch
-f2fs-compress-fix-to-update-i_compr_blocks-correctly.patch
-f2fs-deprecate-io_bits.patch
-f2fs-introduce-get_available_block_count-for-cleanup.patch
-f2fs-compress-fix-error-path-of-inc_valid_block_coun.patch
-f2fs-compress-fix-to-cover-reserve-release-_compress.patch
-f2fs-fix-to-release-node-block-count-in-error-path-o.patch
-f2fs-compress-don-t-allow-unaligned-truncation-on-re.patch
-serial-sh-sci-protect-invalidating-rxdma-on-shutdown.patch
-libsubcmd-fix-parse-options-memory-leak.patch
-perf-daemon-fix-file-leak-in-daemon_session__control.patch
-f2fs-fix-to-add-missing-iput-in-gc_data_segment.patch
-usb-fotg210-add-missing-kernel-doc-description.patch
-perf-stat-don-t-display-metric-header-for-non-leader.patch
-perf-tools-use-pmus-to-describe-type-from-attribute.patch
-perf-tools-add-use-pmu-reverse-lookup-from-config-to.patch
-perf-pmu-assume-sysfs-events-are-always-the-same-cas.patch
-perf-pmu-count-sys-and-cpuid-json-events-separately.patch
-loongarch-fix-callchain-parse-error-with-kernel-trac.patch
-s390-vdso64-filter-out-munaligned-symbols-flag-for-v.patch
-s390-vdso-generate-unwind-information-for-c-modules.patch
-s390-vdso-create-.build-id-links-for-unstripped-vdso.patch
-s390-vdso-use-standard-stack-frame-layout.patch
-s390-ipl-fix-incorrect-initialization-of-len-fields-.patch
-s390-ipl-fix-incorrect-initialization-of-nvme-dump-b.patch
-s390-boot-remove-alt_stfle_fac_list-from-decompresso.patch
-dt-bindings-pci-rockchip-rk3399-pcie-add-missing-max.patch
-mailbox-mtk-cmdq-fix-pm_runtime_get_sync-warning-in-.patch
-gpiolib-acpi-fix-failed-in-acpi_gpiochip_find-by-add.patch
-usb-typec-qcom-pmic-typec-fix-arguments-of-qcom_pmic.patch
-usb-typec-qcom-pmic-typec-allow-different-implementa.patch
-usb-typec-qcom-pmic-typec-allow-different-implementa.patch-30702
-usb-typec-qcom-pmic-fix-use-after-free-on-late-probe.patch
-eventfs-create-eventfs_root_inode-to-store-dentry.patch
-eventfs-tracing-add-callback-for-release-of-an-event.patch
-eventfs-free-all-of-the-eventfs_inode-after-rcu.patch
-eventfs-do-not-differentiate-the-toplevel-events-dir.patch
-eventfs-have-events-directory-get-permissions-from-i.patch
-ksmbd-use-rwsem-instead-of-rwlock-for-lease-break.patch
-drm-xe-guc-only-take-actions-in-ct-irq-handler-if-ct.patch
-drm-xe-guc-check-error-code-when-initializing-the-ct.patch
-drm-xe-use-ordered-wq-for-g2h-handler.patch
-dt-bindings-adc-axi-adc-update-bindings-for-backend-.patch
-dt-bindings-adc-axi-adc-add-clocks-property.patch
-alsa-timer-set-lower-bound-of-start-tick-time.patch
-input-ims-pcu-fix-printf-string-overflow.patch
-input-ioc3kbd-add-device-table.patch
-mmc-sdhci_am654-add-tuning-algorithm-for-delay-chain.patch
-mmc-sdhci_am654-write-itapdly-for-ddr52-timing.patch
-mmc-sdhci_am654-add-otap-itap-delay-enable.patch
-mmc-sdhci_am654-add-itapdlysel-in-sdhci_j721e_4bit_s.patch
-mmc-sdhci_am654-fix-itapdly-for-hs400-timing.patch
-input-pm8xxx-vibrator-correct-vib_max_levels-calcula.patch
-media-ti-j721e-csi2rx-fix-races-while-restarting-dma.patch
-media-v4l-don-t-turn-on-privacy-led-if-streamon-fail.patch
-media-ov2680-clear-the-ret-variable-on-success.patch
-media-ov2680-allow-probing-if-link-frequencies-is-ab.patch
-media-ov2680-do-not-fail-if-data-lanes-property-is-a.patch
-drm-msm-dsi-print-dual-dsi-adjusted-pclk-instead-of-.patch
-drm-msm-dpu-always-flush-the-slave-intf-on-the-ctl.patch
-drm-msm-dpu-allow-configuring-multiple-active-dsc-bl.patch
-drm-mediatek-dp-fix-mtk_dp_aux_transfer-return-value.patch
-drm-meson-gate-px_clk-when-setting-rate.patch
-um-fix-return-value-in-ubd_init.patch
-um-add-winch-to-winch_handlers-before-registering-wi.patch
-um-vector-fix-bpfflash-parameter-evaluation.patch
-fs-ntfs3-check-folio-pointer-for-null.patch
-fs-ntfs3-use-64-bit-variable-to-avoid-32-bit-overflo.patch
-fs-ntfs3-use-variable-length-array-instead-of-fixed-.patch
-drm-msm-dpu-add-callback-function-pointer-check-befo.patch
-drm-bridge-tc358775-fix-support-for-jeida-18-and-jei.patch
-media-stk1160-fix-bounds-checking-in-stk1160_copy_vi.patch
-coccinelle-add-rules-to-find-str_plural-replacements.patch
-string.h-introduce-memtostr-and-memtostr_pad.patch
-scsi-mptfusion-avoid-possible-run-time-warning-with-.patch
-scsi-mpi3mr-avoid-possible-run-time-warning-with-lon.patch
-scsi-qla2xxx-avoid-possible-run-time-warning-with-lo.patch
-input-cyapa-add-missing-input-core-locking-to-suspen.patch
-drm-amdgpu-init-microcode-chip-name-from-ip-versions.patch
-drm-amdgpu-fix-buffer-size-in-gfx_v9_4_3_init_-cp_co.patch
-media-mediatek-vcodec-fix-possible-unbalanced-pm-cou.patch
-tools-arch-x86-intel_sdsi-fix-maximum-meter-bundle-l.patch
-tools-arch-x86-intel_sdsi-fix-meter_show-display.patch
-tools-arch-x86-intel_sdsi-fix-meter_certificate-deco.patch
-platform-x86-thinkpad_acpi-take-hotkey_mutex-during-.patch
-media-flexcop-usb-fix-sanity-check-of-bnumendpoints.patch
-powerpc-pseries-add-failure-related-checks-for-h_get.patch
-um-fix-the-wmissing-prototypes-warning-for-__switch_.patch
-um-fix-the-wmissing-prototypes-warning-for-get_threa.patch
-um-fix-the-declaration-of-kasan_map_memory.patch
-cxl-trace-correct-dpa-field-masks-for-general_media-.patch
-cxl-region-fix-cxlr_pmem-leaks.patch
-media-sunxi-a83-mips-csi2-also-select-generic_phy.patch
-media-cec-cec-adap-always-cancel-work-in-cec_transmi.patch
-media-cec-cec-api-add-locking-in-cec_release.patch
-media-cec-core-avoid-recursive-cec_claim_log_addrs.patch
-media-cec-core-avoid-confusing-transmit-timed-out-me.patch
-revert-drm-bridge-ti-sn65dsi83-fix-enable-error-path.patch
-drm-zynqmp_dpsub-always-register-bridge.patch
-asoc-amd-acp-fix-for-acp-platform-device-creation-fa.patch
-selftests-powerpc-dexcr-add-no-pie-to-hashchk-tests.patch
-drm-msm-adreno-fix-cp-cycles-stat-retrieval-on-a7xx.patch
-drm-msm-a6xx-avoid-a-nullptr-dereference-when-speedb.patch
-asoc-tas2781-fix-a-warning-reported-by-robot-kernel-.patch
-null_blk-fix-the-warning-modpost-missing-module_desc.patch
-printk-fix-log_cpu_max_buf_shift-when-base_small-is-.patch
-powerpc-bpf-32-fix-failing-test_bpf-tests.patch
-kvm-ppc-book3s-hv-nestedv2-cancel-pending-dec-except.patch
-kvm-ppc-book3s-hv-nestedv2-fix-an-error-handling-pat.patch
-kvm-arm64-nv-add-sanitising-to-vncr-backed-sysregs.patch
-kvm-arm64-destroy-mpidr_data-for-late-vcpu-creation.patch
-nilfs2-make-superblock-data-array-index-computation-.patch
-alsa-hda-cs_dsp_ctl-use-private_free-for-control-cle.patch
-alsa-hda-cs35l56-fix-lifetime-of-cs_dsp-instance.patch
-asoc-mediatek-mt8192-fix-register-configuration-for-.patch
-drm-nouveau-use-tile_mode-and-pte_kind-for-vm_bind-b.patch
-blk-cgroup-fix-list-corruption-from-resetting-io-sta.patch
-blk-cgroup-fix-list-corruption-from-reorder-of-write.patch
-blk-cgroup-properly-propagate-the-iostat-update-up-t.patch
-regulator-bd71828-don-t-overwrite-runtime-voltages.patch
-xen-x86-add-extra-pages-to-unpopulated-alloc-if-avai.patch
-perf-arm-dmc620-fix-lockdep-assert-in-event_init.patch
-x86-kconfig-select-arch_want_frame_pointers-again-wh.patch
-net-always-descend-into-dsa-folder-with-config_net_d.patch
-ipv6-sr-fix-missing-sk_buff-release-in-seg6_input_co.patch
-selftests-net-kill-smcrouted-in-the-cleanup-logic-in.patch
-nfc-nci-fix-uninit-value-in-nci_rx_work.patch
-asoc-tas2552-add-tx-path-for-capturing-audio-out-dat.patch
-asoc-tas2781-fix-wrong-loading-calibrated-data-seque.patch
-nfsv4-fixup-smatch-warning-for-ambiguous-return.patch
-nfs-keep-server-info-for-remounts.patch
-sunrpc-fix-nfsacl-rpc-retry-on-soft-mount.patch
-rpcrdma-fix-handling-for-rdma_cm_event_device_remova.patch
-regulator-pickable-ranges-don-t-always-cache-vsel.patch
-regulator-tps6287x-force-writing-vsel-bit.patch
-af_unix-update-unix_sk-sk-oob_skb-under-sk_receive_q.patch
-ipv6-sr-fix-memleak-in-seg6_hmac_init_algo.patch
-regulator-tps6594-regulator-correct-multi-phase-conf.patch
-tcp-fix-shift-out-of-bounds-in-dctcp_update_alpha.patch
-pnfs-filelayout-fixup-pnfs-allocation-modes.patch
-openvswitch-set-the-skbuff-pkt_type-for-proper-pmtud.patch
-arm64-asm-bug-add-.align-2-to-the-end-of-__bug_entry.patch
-rv-update-rv_en-dis-able_monitor-doc-to-match-kernel.patch
-net-lan966x-remove-ptp-traps-in-case-the-ptp-is-not-.patch
-virtio_balloon-give-the-balloon-its-own-wakeup-sourc.patch
-virtio-delete-vq-in-vp_find_vqs_msix-when-request_ir.patch
-riscv-cpufeature-fix-thead-vector-hwcap-removal.patch
-riscv-cpufeature-fix-extension-subset-checking.patch
-i3c-master-svc-change-enxio-to-eagain-when-ibi-occur.patch
-riscv-stacktrace-fixed-walk_stackframe.patch
-riscv-selftests-add-hwprobe-binaries-to-.gitignore.patch
-revert-ixgbe-manual-an-37-for-troublesome-link-partn.patch
-net-fec-avoid-lock-evasion-when-reading-pps_enable.patch
-tls-fix-missing-memory-barrier-in-tls_init.patch
-tcp-remove-64-kbyte-limit-for-initial-tp-rcv_wnd-val.patch
-net-relax-socket-state-check-at-accept-time.patch
-nfc-nci-fix-handling-of-zero-length-payload-packets-.patch
-drivers-xen-improve-the-late-xenstore-init-protocol.patch
-ice-interpret-.set_channels-input-differently.patch
-idpf-interpret-.set_channels-input-differently.patch
-netfs-fix-setting-of-bdp_async-from-iocb-flags.patch
-kasan-fortify-properly-rename-memintrinsics.patch
-cifs-set-zero_point-in-the-copy_file_range-and-remap.patch
-cifs-fix-missing-set-of-remote_i_size.patch
-tracing-probes-fix-error-check-in-parse_btf_field.patch
-tpm_tis_spi-account-for-spi-header-when-allocating-t.patch
-netfilter-nfnetlink_queue-acquire-rcu_read_lock-in-i.patch
-netfilter-ipset-add-list-flush-to-cancel_gc.patch
-netfilter-nft_payload-restore-vlan-q-in-q-match-supp.patch
-spi-don-t-mark-message-dma-mapped-when-no-transfer-i.patch
-dma-mapping-benchmark-fix-up-kthread-related-error-h.patch
-dma-mapping-benchmark-fix-node-id-validation.patch
-dma-mapping-benchmark-handle-numa_no_node-correctly.patch
-nvme-fix-multipath-batched-completion-accounting.patch
-nvme-multipath-fix-io-accounting-on-failover.patch
-nvmet-fix-ns-enable-disable-possible-hang.patch
-drm-amd-display-enable-colorspace-property-for-mst-c.patch
-net-phy-micrel-set-soft_reset-callback-to-genphy_sof.patch
-net-mlx5-lag-do-bond-only-if-slaves-agree-on-roce-st.patch
-net-mlx5-fix-mtmp-register-capability-offset-in-mcam.patch
-net-mlx5-use-mlx5_ipsec_rx_status_destroy-to-correct.patch
-net-mlx5e-fix-ipsec-tunnel-mode-offload-feature-chec.patch
-net-mlx5e-use-rx_missed_errors-instead-of-rx_dropped.patch
-net-mlx5e-fix-udp-gso-for-encapsulated-packets.patch
-dma-buf-sw-sync-don-t-enable-irq-from-sync_print_obj.patch
-bpf-fix-potential-integer-overflow-in-resolve_btfids.patch
-netkit-fix-setting-mac-address-in-l2-mode.patch
-netkit-fix-pkt_type-override-upon-netkit-pass-verdic.patch
-alsa-jack-use-guard-for-locking.patch
-alsa-core-remove-debugfs-at-disconnection.patch
-alsa-hda-realtek-adjust-g814jzr-to-use-spi-init-for-.patch
-enic-validate-length-of-nl-attributes-in-enic_set_vf.patch
-af_unix-annotate-data-race-around-unix_sk-sk-addr.patch
-af_unix-read-sk-sk_hash-under-bindlock-during-bind.patch
-octeontx2-pf-free-send-queue-buffers-incase-of-leaf-.patch
-net-usb-smsc95xx-fix-changing-led_sel-bit-value-upda.patch
-asoc-cs42l43-only-restrict-44.1khz-for-the-asp.patch
-bpf-allow-delete-from-sockmap-sockhash-only-if-updat.patch
-tcp-reduce-accepted-window-in-new_syn_recv-state.patch
-net-fec-add-fec_enet_deinit.patch
-net-micrel-fix-lan8841_config_intr-after-getting-out.patch
-idpf-don-t-enable-napi-and-interrupts-prior-to-alloc.patch
-ice-fix-accounting-if-a-vlan-already-exists.patch
-selftests-mptcp-simult-flows-mark-unbalanced-tests-a.patch
-selftests-mptcp-add-ms-units-for-tc-netem-delay.patch
-selftests-mptcp-join-mark-fail-tests-as-flaky.patch
-drm-xe-add-dbg-messages-on-the-suspend-resume-functi.patch
-drm-xe-check-pcode-init-status-only-on-root-gt-of-ro.patch
-drm-xe-change-pcode-timeout-to-50msec-while-polling-.patch
-drm-xe-only-use-reserved-bcs-instances-for-usm-migra.patch
-alsa-seq-fix-missing-bank-setup-between-midi1-midi2-.patch
-alsa-seq-don-t-clear-bank-selection-at-event-ump-mid.patch
-net-ti-icssg-prueth-fix-start-counter-for-ft1-filter.patch
-netfilter-nft_payload-skbuff-vlan-metadata-mangle-su.patch
-netfilter-tproxy-bail-out-if-ip-has-been-disabled-on.patch
-netfilter-nft_fib-allow-from-forward-input-without-i.patch
-net-sched-taprio-make-q-picos_per_byte-available-to-.patch
-net-sched-taprio-extend-minimum-interval-restriction.patch
-kconfig-fix-comparison-to-constant-symbols-m-n.patch
-drm-i915-guc-avoid-field_prep-warning.patch
-drm-i915-gt-fix-ccs-id-s-calculation-for-ccs-mode-se.patch
-kheaders-use-command-v-to-test-for-existence-of-cpio.patch
-spi-stm32-don-t-warn-about-spurious-interrupts.patch
-drm-amdgpu-adjust-logic-in-amdgpu_device_partner_ban.patch
-ipv6-introduce-dst_rt6_info-helper.patch
-inet-introduce-dst_rtable-helper.patch
-net-fix-__dst_negative_advice-race.patch
-net-dsa-microchip-fix-rgmii-error-in-ksz-dsa-driver.patch
-e1000e-move-force-smbus-near-the-end-of-enable_ulp-f.patch
-ice-fix-200g-phy-types-to-link-speed-mapping.patch
-net-ena-reduce-lines-with-longer-column-width-bounda.patch
-net-ena-fix-redundant-device-numa-node-override.patch
-ipvlan-dont-use-skb-sk-in-ipvlan_process_v-4-6-_outb.patch
-alsa-seq-fix-yet-another-spot-for-system-message-con.patch
-powerpc-pseries-lparcfg-drop-error-message-from-gues.patch
-powerpc-uaccess-use-yz-asm-constraint-for-ld.patch
-drm-panel-sitronix-st7789v-fix-timing-for-jt240mhqs_.patch
-drm-panel-sitronix-st7789v-tweak-timing-for-jt240mhq.patch
-drm-panel-sitronix-st7789v-fix-display-size-for-jt24.patch
-hwmon-intel-m10-bmc-hwmon-fix-multiplier-for-n6000-b.patch
-hwmon-shtc1-fix-property-misspelling.patch
-riscv-prevent-pt_regs-corruption-for-secondary-idle-.patch
-alsa-seq-ump-fix-swapped-song-position-pointer-data.patch
+++ /dev/null
-From 10f0f17f8d3eefe8200ada9aa08bc033a393e0b6 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 26 Mar 2024 09:01:16 +0000
-Subject: soundwire: cadence: fix invalid PDI offset
-
-From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
-
-[ Upstream commit 8ee1b439b1540ae543149b15a2a61b9dff937d91 ]
-
-For some reason, we add an offset to the PDI, presumably to skip the
-PDI0 and PDI1 which are reserved for BPT.
-
-This code is however completely wrong and leads to an out-of-bounds
-access. We were just lucky so far since we used only a couple of PDIs
-and remained within the PDI array bounds.
-
-A Fixes: tag is not provided since there are no known platforms where
-the out-of-bounds would be accessed, and the initial code had problems
-as well.
-
-A follow-up patch completely removes this useless offset.
-
-Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
-Reviewed-by: Rander Wang <rander.wang@intel.com>
-Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
-Link: https://lore.kernel.org/r/20240326090122.1051806-2-yung-chuan.liao@linux.intel.com
-Signed-off-by: Vinod Koul <vkoul@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/soundwire/cadence_master.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/soundwire/cadence_master.c b/drivers/soundwire/cadence_master.c
-index 0efc1c3bee5f5..3e7cf04aaf2a6 100644
---- a/drivers/soundwire/cadence_master.c
-+++ b/drivers/soundwire/cadence_master.c
-@@ -1880,7 +1880,7 @@ struct sdw_cdns_pdi *sdw_cdns_alloc_pdi(struct sdw_cdns *cdns,
-
- /* check if we found a PDI, else find in bi-directional */
- if (!pdi)
-- pdi = cdns_find_pdi(cdns, 2, stream->num_bd, stream->bd,
-+ pdi = cdns_find_pdi(cdns, 0, stream->num_bd, stream->bd,
- dai_id);
-
- if (pdi) {
---
-2.43.0
-
+++ /dev/null
-From 5a023bf3dd5293b2ed8226db1f2dfa1389f60dd9 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 22 May 2024 20:09:49 +0300
-Subject: spi: Don't mark message DMA mapped when no transfer in it is
-
-From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-
-[ Upstream commit 9f788ba457b45b0ce422943fcec9fa35c4587764 ]
-
-There is no need to set the DMA mapped flag of the message if it has
-no mapped transfers. Moreover, it may give the code a chance to take
-the wrong paths, i.e. to exercise DMA related APIs on unmapped data.
-Make __spi_map_msg() to bail earlier on the above mentioned cases.
-
-Fixes: 99adef310f68 ("spi: Provide core support for DMA mapping transfers")
-Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Link: https://msgid.link/r/20240522171018.3362521-2-andriy.shevchenko@linux.intel.com
-Signed-off-by: Mark Brown <broonie@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/spi/spi.c | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
-index a7194f29c2007..8bb0e6cb5a7b3 100644
---- a/drivers/spi/spi.c
-+++ b/drivers/spi/spi.c
-@@ -1222,6 +1222,7 @@ static int __spi_map_msg(struct spi_controller *ctlr, struct spi_message *msg)
- else
- rx_dev = ctlr->dev.parent;
-
-+ ret = -ENOMSG;
- list_for_each_entry(xfer, &msg->transfers, transfer_list) {
- /* The sync is done before each transfer. */
- unsigned long attrs = DMA_ATTR_SKIP_CPU_SYNC;
-@@ -1251,6 +1252,9 @@ static int __spi_map_msg(struct spi_controller *ctlr, struct spi_message *msg)
- }
- }
- }
-+ /* No transfer has been mapped, bail out with success */
-+ if (ret)
-+ return 0;
-
- ctlr->cur_rx_dma_dev = rx_dev;
- ctlr->cur_tx_dma_dev = tx_dev;
---
-2.43.0
-
+++ /dev/null
-From 44730535ea991c2a581eedcda9d8a9b4e7bc4135 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 21 May 2024 12:52:42 +0200
-Subject: spi: stm32: Don't warn about spurious interrupts
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-
-[ Upstream commit 95d7c452a26564ef0c427f2806761b857106d8c4 ]
-
-The dev_warn to notify about a spurious interrupt was introduced with
-the reasoning that these are unexpected. However spurious interrupts
-tend to trigger continously and the error message on the serial console
-prevents that the core's detection of spurious interrupts kicks in
-(which disables the irq) and just floods the console.
-
-Fixes: c64e7efe46b7 ("spi: stm32: make spurious and overrun interrupts visible")
-Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-Link: https://msgid.link/r/20240521105241.62400-2-u.kleine-koenig@pengutronix.de
-Signed-off-by: Mark Brown <broonie@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/spi/spi-stm32.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/spi/spi-stm32.c b/drivers/spi/spi-stm32.c
-index e61302ef3c21a..43712f793ff0e 100644
---- a/drivers/spi/spi-stm32.c
-+++ b/drivers/spi/spi-stm32.c
-@@ -1057,7 +1057,7 @@ static irqreturn_t stm32h7_spi_irq_thread(int irq, void *dev_id)
- mask |= STM32H7_SPI_SR_TXP | STM32H7_SPI_SR_RXP;
-
- if (!(sr & mask)) {
-- dev_warn(spi->dev, "spurious IT (sr=0x%08x, ier=0x%08x)\n",
-+ dev_vdbg(spi->dev, "spurious IT (sr=0x%08x, ier=0x%08x)\n",
- sr, ier);
- spin_unlock_irqrestore(&spi->lock, flags);
- return IRQ_NONE;
---
-2.43.0
-
+++ /dev/null
-From f42bff5dbcf7acfecc20a567316aa745584b78c3 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 7 May 2024 14:07:42 -0700
-Subject: spmi: pmic-arb: Replace three IS_ERR() calls by null pointer checks
- in spmi_pmic_arb_probe()
-
-From: Markus Elfring <elfring@users.sourceforge.net>
-
-[ Upstream commit c86f90e30a347ef0a28d0df3975c46389d0cc7fc ]
-
-The devm_ioremap() function does not return error pointers.
-It returns NULL on error.
-This issue was detected once more also by using the Coccinelle software.
-
-Update three checks (and corresponding error codes) for failed
-function calls accordingly.
-
-Fixes: ffdfbafdc4f4 ("spmi: Use devm_spmi_controller_alloc()")
-Fixes: 231601cd22bd ("spmi: pmic-arb: Add support for PMIC v7")
-Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
-Link: https://lore.kernel.org/r/82a0768e-95b0-4091-bdd1-14c3e893726b@web.de
-Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-Reviewed-by: David Collins <quic_collinsd@quicinc.com>
-Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
-Signed-off-by: Stephen Boyd <sboyd@kernel.org>
-Link: https://lore.kernel.org/r/20240507210809.3479953-6-sboyd@kernel.org
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/spmi/spmi-pmic-arb.c | 12 ++++++------
- 1 file changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c
-index 9ed1180fe31f1..937c15324513f 100644
---- a/drivers/spmi/spmi-pmic-arb.c
-+++ b/drivers/spmi/spmi-pmic-arb.c
-@@ -1462,8 +1462,8 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)
- */
- res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "core");
- core = devm_ioremap(&ctrl->dev, res->start, resource_size(res));
-- if (IS_ERR(core))
-- return PTR_ERR(core);
-+ if (!core)
-+ return -ENOMEM;
-
- pmic_arb->core_size = resource_size(res);
-
-@@ -1495,15 +1495,15 @@ static int spmi_pmic_arb_probe(struct platform_device *pdev)
- "obsrvr");
- pmic_arb->rd_base = devm_ioremap(&ctrl->dev, res->start,
- resource_size(res));
-- if (IS_ERR(pmic_arb->rd_base))
-- return PTR_ERR(pmic_arb->rd_base);
-+ if (!pmic_arb->rd_base)
-+ return -ENOMEM;
-
- res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
- "chnls");
- pmic_arb->wr_base = devm_ioremap(&ctrl->dev, res->start,
- resource_size(res));
-- if (IS_ERR(pmic_arb->wr_base))
-- return PTR_ERR(pmic_arb->wr_base);
-+ if (!pmic_arb->wr_base)
-+ return -ENOMEM;
- }
-
- pmic_arb->max_periphs = PMIC_ARB_MAX_PERIPHS;
---
-2.43.0
-
+++ /dev/null
-From 607bd65d7fb1d25e1d59c4a9cfa088826b051923 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 29 Apr 2024 16:01:05 +0300
-Subject: stm class: Fix a double free in stm_register_device()
-
-From: Dan Carpenter <dan.carpenter@linaro.org>
-
-[ Upstream commit 3df463865ba42b8f88a590326f4c9ea17a1ce459 ]
-
-The put_device(&stm->dev) call will trigger stm_device_release() which
-frees "stm" so the vfree(stm) on the next line is a double free.
-
-Fixes: 389b6699a2aa ("stm class: Fix stm device initialization order")
-Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
-Reviewed-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
-Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
-Link: https://lore.kernel.org/r/20240429130119.1518073-2-alexander.shishkin@linux.intel.com
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/hwtracing/stm/core.c | 11 ++++++-----
- 1 file changed, 6 insertions(+), 5 deletions(-)
-
-diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c
-index 534fbefc7f6aa..20895d3915623 100644
---- a/drivers/hwtracing/stm/core.c
-+++ b/drivers/hwtracing/stm/core.c
-@@ -868,8 +868,11 @@ int stm_register_device(struct device *parent, struct stm_data *stm_data,
- return -ENOMEM;
-
- stm->major = register_chrdev(0, stm_data->name, &stm_fops);
-- if (stm->major < 0)
-- goto err_free;
-+ if (stm->major < 0) {
-+ err = stm->major;
-+ vfree(stm);
-+ return err;
-+ }
-
- device_initialize(&stm->dev);
- stm->dev.devt = MKDEV(stm->major, 0);
-@@ -913,10 +916,8 @@ int stm_register_device(struct device *parent, struct stm_data *stm_data,
- err_device:
- unregister_chrdev(stm->major, stm_data->name);
-
-- /* matches device_initialize() above */
-+ /* calls stm_device_release() */
- put_device(&stm->dev);
--err_free:
-- vfree(stm);
-
- return err;
- }
---
-2.43.0
-
+++ /dev/null
-From 24886cff3753f911e9ace4304613d5d72b3162d4 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 9 Apr 2024 19:31:50 -0700
-Subject: string.h: Introduce memtostr() and memtostr_pad()
-
-From: Kees Cook <keescook@chromium.org>
-
-[ Upstream commit 0efc5990bca540b8d438fda23db3a72efa733eb0 ]
-
-Another ambiguous use of strncpy() is to copy from strings that may not
-be NUL-terminated. These cases depend on having the destination buffer
-be explicitly larger than the source buffer's maximum size, having
-the size of the copy exactly match the source buffer's maximum size,
-and for the destination buffer to get explicitly NUL terminated.
-
-This usually happens when parsing protocols or hardware character arrays
-that are not guaranteed to be NUL-terminated. The code pattern is
-effectively this:
-
- char dest[sizeof(src) + 1];
-
- strncpy(dest, src, sizeof(src));
- dest[sizeof(dest) - 1] = '\0';
-
-In practice it usually looks like:
-
-struct from_hardware {
- ...
- char name[HW_NAME_SIZE] __nonstring;
- ...
-};
-
- struct from_hardware *p = ...;
- char name[HW_NAME_SIZE + 1];
-
- strncpy(name, p->name, HW_NAME_SIZE);
- name[NW_NAME_SIZE] = '\0';
-
-This cannot be replaced with:
-
- strscpy(name, p->name, sizeof(name));
-
-because p->name is smaller and not NUL-terminated, so FORTIFY will
-trigger when strnlen(p->name, sizeof(name)) is used. And it cannot be
-replaced with:
-
- strscpy(name, p->name, sizeof(p->name));
-
-because then "name" may contain a 1 character early truncation of
-p->name.
-
-Provide an unambiguous interface for converting a maybe not-NUL-terminated
-string to a NUL-terminated string, with compile-time buffer size checking
-so that it can never fail at runtime: memtostr() and memtostr_pad(). Also
-add KUnit tests for both.
-
-Link: https://lore.kernel.org/r/20240410023155.2100422-1-keescook@chromium.org
-Signed-off-by: Kees Cook <keescook@chromium.org>
-Stable-dep-of: 5bb288c4abc2 ("scsi: mptfusion: Avoid possible run-time warning with long manufacturer strings")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- include/linux/string.h | 49 ++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 49 insertions(+)
-
-diff --git a/include/linux/string.h b/include/linux/string.h
-index ab148d8dbfc14..a0e80e9e1ab5f 100644
---- a/include/linux/string.h
-+++ b/include/linux/string.h
-@@ -345,6 +345,55 @@ void memcpy_and_pad(void *dest, size_t dest_len, const void *src, size_t count,
- memcpy(dest, src, strnlen(src, min(_src_len, _dest_len))); \
- } while (0)
-
-+/**
-+ * memtostr - Copy a possibly non-NUL-term string to a NUL-term string
-+ * @dest: Pointer to destination NUL-terminates string
-+ * @src: Pointer to character array (likely marked as __nonstring)
-+ *
-+ * This is a replacement for strncpy() uses where the source is not
-+ * a NUL-terminated string.
-+ *
-+ * Note that sizes of @dest and @src must be known at compile-time.
-+ */
-+#define memtostr(dest, src) do { \
-+ const size_t _dest_len = __builtin_object_size(dest, 1); \
-+ const size_t _src_len = __builtin_object_size(src, 1); \
-+ const size_t _src_chars = strnlen(src, _src_len); \
-+ const size_t _copy_len = min(_dest_len - 1, _src_chars); \
-+ \
-+ BUILD_BUG_ON(!__builtin_constant_p(_dest_len) || \
-+ !__builtin_constant_p(_src_len) || \
-+ _dest_len == 0 || _dest_len == (size_t)-1 || \
-+ _src_len == 0 || _src_len == (size_t)-1); \
-+ memcpy(dest, src, _copy_len); \
-+ dest[_copy_len] = '\0'; \
-+} while (0)
-+
-+/**
-+ * memtostr_pad - Copy a possibly non-NUL-term string to a NUL-term string
-+ * with NUL padding in the destination
-+ * @dest: Pointer to destination NUL-terminates string
-+ * @src: Pointer to character array (likely marked as __nonstring)
-+ *
-+ * This is a replacement for strncpy() uses where the source is not
-+ * a NUL-terminated string.
-+ *
-+ * Note that sizes of @dest and @src must be known at compile-time.
-+ */
-+#define memtostr_pad(dest, src) do { \
-+ const size_t _dest_len = __builtin_object_size(dest, 1); \
-+ const size_t _src_len = __builtin_object_size(src, 1); \
-+ const size_t _src_chars = strnlen(src, _src_len); \
-+ const size_t _copy_len = min(_dest_len - 1, _src_chars); \
-+ \
-+ BUILD_BUG_ON(!__builtin_constant_p(_dest_len) || \
-+ !__builtin_constant_p(_src_len) || \
-+ _dest_len == 0 || _dest_len == (size_t)-1 || \
-+ _src_len == 0 || _src_len == (size_t)-1); \
-+ memcpy(dest, src, _copy_len); \
-+ memset(&dest[_copy_len], 0, _dest_len - _copy_len); \
-+} while (0)
-+
- /**
- * memset_after - Set a value after a struct member to the end of a struct
- *
---
-2.43.0
-
+++ /dev/null
-From 47cf19c0ad9fd0c7a01c4fd542f6d269297c4eb1 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 25 Apr 2024 13:49:38 +0300
-Subject: sunrpc: fix NFSACL RPC retry on soft mount
-
-From: Dan Aloni <dan.aloni@vastdata.com>
-
-[ Upstream commit 0dc9f430027b8bd9073fdafdfcdeb1a073ab5594 ]
-
-It used to be quite awhile ago since 1b63a75180c6 ('SUNRPC: Refactor
-rpc_clone_client()'), in 2012, that `cl_timeout` was copied in so that
-all mount parameters propagate to NFSACL clients. However since that
-change, if mount options as follows are given:
-
- soft,timeo=50,retrans=16,vers=3
-
-The resultant NFSACL client receives:
-
- cl_softrtry: 1
- cl_timeout: to_initval=60000, to_maxval=60000, to_increment=0, to_retries=2, to_exponential=0
-
-These values lead to NFSACL operations not being retried under the
-condition of transient network outages with soft mount. Instead, getacl
-call fails after 60 seconds with EIO.
-
-The simple fix is to pass the existing client's `cl_timeout` as the new
-client timeout.
-
-Cc: Chuck Lever <chuck.lever@oracle.com>
-Cc: Benjamin Coddington <bcodding@redhat.com>
-Link: https://lore.kernel.org/all/20231105154857.ryakhmgaptq3hb6b@gmail.com/T/
-Fixes: 1b63a75180c6 ('SUNRPC: Refactor rpc_clone_client()')
-Signed-off-by: Dan Aloni <dan.aloni@vastdata.com>
-Reviewed-by: Benjamin Coddington <bcodding@redhat.com>
-Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- net/sunrpc/clnt.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
-index 28f3749f6dc6c..59b2fbd88e5eb 100644
---- a/net/sunrpc/clnt.c
-+++ b/net/sunrpc/clnt.c
-@@ -1071,6 +1071,7 @@ struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *old,
- .authflavor = old->cl_auth->au_flavor,
- .cred = old->cl_cred,
- .stats = old->cl_stats,
-+ .timeout = old->cl_timeout,
- };
- struct rpc_clnt *clnt;
- int err;
---
-2.43.0
-
+++ /dev/null
-From 21c774bb492ca61ff16309fbb1588ef6f8ccfb1f Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 17 May 2024 18:16:26 +0900
-Subject: tcp: Fix shift-out-of-bounds in dctcp_update_alpha().
-
-From: Kuniyuki Iwashima <kuniyu@amazon.com>
-
-[ Upstream commit 3ebc46ca8675de6378e3f8f40768e180bb8afa66 ]
-
-In dctcp_update_alpha(), we use a module parameter dctcp_shift_g
-as follows:
-
- alpha -= min_not_zero(alpha, alpha >> dctcp_shift_g);
- ...
- delivered_ce <<= (10 - dctcp_shift_g);
-
-It seems syzkaller started fuzzing module parameters and triggered
-shift-out-of-bounds [0] by setting 100 to dctcp_shift_g:
-
- memcpy((void*)0x20000080,
- "/sys/module/tcp_dctcp/parameters/dctcp_shift_g\000", 47);
- res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x20000080ul,
- /*flags=*/2ul, /*mode=*/0ul);
- memcpy((void*)0x20000000, "100\000", 4);
- syscall(__NR_write, /*fd=*/r[0], /*val=*/0x20000000ul, /*len=*/4ul);
-
-Let's limit the max value of dctcp_shift_g by param_set_uint_minmax().
-
-With this patch:
-
- # echo 10 > /sys/module/tcp_dctcp/parameters/dctcp_shift_g
- # cat /sys/module/tcp_dctcp/parameters/dctcp_shift_g
- 10
- # echo 11 > /sys/module/tcp_dctcp/parameters/dctcp_shift_g
- -bash: echo: write error: Invalid argument
-
-[0]:
-UBSAN: shift-out-of-bounds in net/ipv4/tcp_dctcp.c:143:12
-shift exponent 100 is too large for 32-bit type 'u32' (aka 'unsigned int')
-CPU: 0 PID: 8083 Comm: syz-executor345 Not tainted 6.9.0-05151-g1b294a1f3561 #2
-Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
-1.13.0-1ubuntu1.1 04/01/2014
-Call Trace:
- <TASK>
- __dump_stack lib/dump_stack.c:88 [inline]
- dump_stack_lvl+0x201/0x300 lib/dump_stack.c:114
- ubsan_epilogue lib/ubsan.c:231 [inline]
- __ubsan_handle_shift_out_of_bounds+0x346/0x3a0 lib/ubsan.c:468
- dctcp_update_alpha+0x540/0x570 net/ipv4/tcp_dctcp.c:143
- tcp_in_ack_event net/ipv4/tcp_input.c:3802 [inline]
- tcp_ack+0x17b1/0x3bc0 net/ipv4/tcp_input.c:3948
- tcp_rcv_state_process+0x57a/0x2290 net/ipv4/tcp_input.c:6711
- tcp_v4_do_rcv+0x764/0xc40 net/ipv4/tcp_ipv4.c:1937
- sk_backlog_rcv include/net/sock.h:1106 [inline]
- __release_sock+0x20f/0x350 net/core/sock.c:2983
- release_sock+0x61/0x1f0 net/core/sock.c:3549
- mptcp_subflow_shutdown+0x3d0/0x620 net/mptcp/protocol.c:2907
- mptcp_check_send_data_fin+0x225/0x410 net/mptcp/protocol.c:2976
- __mptcp_close+0x238/0xad0 net/mptcp/protocol.c:3072
- mptcp_close+0x2a/0x1a0 net/mptcp/protocol.c:3127
- inet_release+0x190/0x1f0 net/ipv4/af_inet.c:437
- __sock_release net/socket.c:659 [inline]
- sock_close+0xc0/0x240 net/socket.c:1421
- __fput+0x41b/0x890 fs/file_table.c:422
- task_work_run+0x23b/0x300 kernel/task_work.c:180
- exit_task_work include/linux/task_work.h:38 [inline]
- do_exit+0x9c8/0x2540 kernel/exit.c:878
- do_group_exit+0x201/0x2b0 kernel/exit.c:1027
- __do_sys_exit_group kernel/exit.c:1038 [inline]
- __se_sys_exit_group kernel/exit.c:1036 [inline]
- __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1036
- do_syscall_x64 arch/x86/entry/common.c:52 [inline]
- do_syscall_64+0xe4/0x240 arch/x86/entry/common.c:83
- entry_SYSCALL_64_after_hwframe+0x67/0x6f
-RIP: 0033:0x7f6c2b5005b6
-Code: Unable to access opcode bytes at 0x7f6c2b50058c.
-RSP: 002b:00007ffe883eb948 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
-RAX: ffffffffffffffda RBX: 00007f6c2b5862f0 RCX: 00007f6c2b5005b6
-RDX: 0000000000000001 RSI: 000000000000003c RDI: 0000000000000001
-RBP: 0000000000000001 R08: 00000000000000e7 R09: ffffffffffffffc0
-R10: 0000000000000006 R11: 0000000000000246 R12: 00007f6c2b5862f0
-R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000001
- </TASK>
-
-Reported-by: syzkaller <syzkaller@googlegroups.com>
-Reported-by: Yue Sun <samsun1006219@gmail.com>
-Reported-by: xingwei lee <xrivendell7@gmail.com>
-Closes: https://lore.kernel.org/netdev/CAEkJfYNJM=cw-8x7_Vmj1J6uYVCWMbbvD=EFmDPVBGpTsqOxEA@mail.gmail.com/
-Fixes: e3118e8359bb ("net: tcp: add DCTCP congestion control algorithm")
-Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
-Reviewed-by: Simon Horman <horms@kernel.org>
-Link: https://lore.kernel.org/r/20240517091626.32772-1-kuniyu@amazon.com
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- net/ipv4/tcp_dctcp.c | 13 ++++++++++++-
- 1 file changed, 12 insertions(+), 1 deletion(-)
-
-diff --git a/net/ipv4/tcp_dctcp.c b/net/ipv4/tcp_dctcp.c
-index bb23bb5b387a0..8ad62713b0ba2 100644
---- a/net/ipv4/tcp_dctcp.c
-+++ b/net/ipv4/tcp_dctcp.c
-@@ -58,7 +58,18 @@ struct dctcp {
- };
-
- static unsigned int dctcp_shift_g __read_mostly = 4; /* g = 1/2^4 */
--module_param(dctcp_shift_g, uint, 0644);
-+
-+static int dctcp_shift_g_set(const char *val, const struct kernel_param *kp)
-+{
-+ return param_set_uint_minmax(val, kp, 0, 10);
-+}
-+
-+static const struct kernel_param_ops dctcp_shift_g_ops = {
-+ .set = dctcp_shift_g_set,
-+ .get = param_get_uint,
-+};
-+
-+module_param_cb(dctcp_shift_g, &dctcp_shift_g_ops, &dctcp_shift_g, 0644);
- MODULE_PARM_DESC(dctcp_shift_g, "parameter g for updating dctcp_alpha");
-
- static unsigned int dctcp_alpha_on_init __read_mostly = DCTCP_MAX_ALPHA;
---
-2.43.0
-
+++ /dev/null
-From 6f58554ba4277ffe93c17f9850b6a247a48244ac Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 23 May 2024 13:05:27 +0000
-Subject: tcp: reduce accepted window in NEW_SYN_RECV state
-
-From: Eric Dumazet <edumazet@google.com>
-
-[ Upstream commit f4dca95fc0f6350918f2e6727e35b41f7f86fcce ]
-
-Jason commit made checks against ACK sequence less strict
-and can be exploited by attackers to establish spoofed flows
-with less probes.
-
-Innocent users might use tcp_rmem[1] == 1,000,000,000,
-or something more reasonable.
-
-An attacker can use a regular TCP connection to learn the server
-initial tp->rcv_wnd, and use it to optimize the attack.
-
-If we make sure that only the announced window (smaller than 65535)
-is used for ACK validation, we force an attacker to use
-65537 packets to complete the 3WHS (assuming server ISN is unknown)
-
-Fixes: 378979e94e95 ("tcp: remove 64 KByte limit for initial tp->rcv_wnd value")
-Link: https://datatracker.ietf.org/meeting/119/materials/slides-119-tcpm-ghost-acks-00
-Signed-off-by: Eric Dumazet <edumazet@google.com>
-Acked-by: Neal Cardwell <ncardwell@google.com>
-Reviewed-by: Jason Xing <kerneljasonxing@gmail.com>
-Link: https://lore.kernel.org/r/20240523130528.60376-1-edumazet@google.com
-Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- include/net/request_sock.h | 12 ++++++++++++
- net/ipv4/tcp_ipv4.c | 7 +------
- net/ipv4/tcp_minisocks.c | 7 +++++--
- net/ipv6/tcp_ipv6.c | 7 +------
- 4 files changed, 19 insertions(+), 14 deletions(-)
-
-diff --git a/include/net/request_sock.h b/include/net/request_sock.h
-index 144c39db9898a..b79b7c9011ebc 100644
---- a/include/net/request_sock.h
-+++ b/include/net/request_sock.h
-@@ -238,4 +238,16 @@ static inline int reqsk_queue_len_young(const struct request_sock_queue *queue)
- return atomic_read(&queue->young);
- }
-
-+/* RFC 7323 2.3 Using the Window Scale Option
-+ * The window field (SEG.WND) of every outgoing segment, with the
-+ * exception of <SYN> segments, MUST be right-shifted by
-+ * Rcv.Wind.Shift bits.
-+ *
-+ * This means the SEG.WND carried in SYNACK can not exceed 65535.
-+ * We use this property to harden TCP stack while in NEW_SYN_RECV state.
-+ */
-+static inline u32 tcp_synack_window(const struct request_sock *req)
-+{
-+ return min(req->rsk_rcv_wnd, 65535U);
-+}
- #endif /* _REQUEST_SOCK_H */
-diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
-index abd47159d7e4d..0e4b5553ce927 100644
---- a/net/ipv4/tcp_ipv4.c
-+++ b/net/ipv4/tcp_ipv4.c
-@@ -1143,14 +1143,9 @@ static void tcp_v4_reqsk_send_ack(const struct sock *sk, struct sk_buff *skb,
- #endif
- }
-
-- /* RFC 7323 2.3
-- * The window field (SEG.WND) of every outgoing segment, with the
-- * exception of <SYN> segments, MUST be right-shifted by
-- * Rcv.Wind.Shift bits:
-- */
- tcp_v4_send_ack(sk, skb, seq,
- tcp_rsk(req)->rcv_nxt,
-- req->rsk_rcv_wnd >> inet_rsk(req)->rcv_wscale,
-+ tcp_synack_window(req) >> inet_rsk(req)->rcv_wscale,
- tcp_rsk_tsval(tcp_rsk(req)),
- READ_ONCE(req->ts_recent),
- 0, &key,
-diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
-index 0ecc7311dc6ce..cb4e253d511f8 100644
---- a/net/ipv4/tcp_minisocks.c
-+++ b/net/ipv4/tcp_minisocks.c
-@@ -783,8 +783,11 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
-
- /* RFC793: "first check sequence number". */
-
-- if (paws_reject || !tcp_in_window(TCP_SKB_CB(skb)->seq, TCP_SKB_CB(skb)->end_seq,
-- tcp_rsk(req)->rcv_nxt, tcp_rsk(req)->rcv_nxt + req->rsk_rcv_wnd)) {
-+ if (paws_reject || !tcp_in_window(TCP_SKB_CB(skb)->seq,
-+ TCP_SKB_CB(skb)->end_seq,
-+ tcp_rsk(req)->rcv_nxt,
-+ tcp_rsk(req)->rcv_nxt +
-+ tcp_synack_window(req))) {
- /* Out of window: send ACK and drop. */
- if (!(flg & TCP_FLAG_RST) &&
- !tcp_oow_rate_limited(sock_net(sk), skb,
-diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
-index 57b25b1fc9d9d..012adcfcabeb5 100644
---- a/net/ipv6/tcp_ipv6.c
-+++ b/net/ipv6/tcp_ipv6.c
-@@ -1267,15 +1267,10 @@ static void tcp_v6_reqsk_send_ack(const struct sock *sk, struct sk_buff *skb,
- /* sk->sk_state == TCP_LISTEN -> for regular TCP_SYN_RECV
- * sk->sk_state == TCP_SYN_RECV -> for Fast Open.
- */
-- /* RFC 7323 2.3
-- * The window field (SEG.WND) of every outgoing segment, with the
-- * exception of <SYN> segments, MUST be right-shifted by
-- * Rcv.Wind.Shift bits:
-- */
- tcp_v6_send_ack(sk, skb, (sk->sk_state == TCP_LISTEN) ?
- tcp_rsk(req)->snt_isn + 1 : tcp_sk(sk)->snd_nxt,
- tcp_rsk(req)->rcv_nxt,
-- req->rsk_rcv_wnd >> inet_rsk(req)->rcv_wscale,
-+ tcp_synack_window(req) >> inet_rsk(req)->rcv_wscale,
- tcp_rsk_tsval(tcp_rsk(req)),
- READ_ONCE(req->ts_recent), sk->sk_bound_dev_if,
- &key, ipv6_get_dsfield(ipv6_hdr(skb)), 0,
---
-2.43.0
-
+++ /dev/null
-From 89a9d4e84ff8f7e200a9f3b7438371a33519b725 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 21 May 2024 21:42:20 +0800
-Subject: tcp: remove 64 KByte limit for initial tp->rcv_wnd value
-
-From: Jason Xing <kernelxing@tencent.com>
-
-[ Upstream commit 378979e94e953c2070acb4f0e0c98d29260bd09d ]
-
-Recently, we had some servers upgraded to the latest kernel and noticed
-the indicator from the user side showed worse results than before. It is
-caused by the limitation of tp->rcv_wnd.
-
-In 2018 commit a337531b942b ("tcp: up initial rmem to 128KB and SYN rwin
-to around 64KB") limited the initial value of tp->rcv_wnd to 65535, most
-CDN teams would not benefit from this change because they cannot have a
-large window to receive a big packet, which will be slowed down especially
-in long RTT. Small rcv_wnd means slow transfer speed, to some extent. It's
-the side effect for the latency/time-sensitive users.
-
-To avoid future confusion, current change doesn't affect the initial
-receive window on the wire in a SYN or SYN+ACK packet which are set within
-65535 bytes according to RFC 7323 also due to the limit in
-__tcp_transmit_skb():
-
- th->window = htons(min(tp->rcv_wnd, 65535U));
-
-In one word, __tcp_transmit_skb() already ensures that constraint is
-respected, no matter how large tp->rcv_wnd is. The change doesn't violate
-RFC.
-
-Let me provide one example if with or without the patch:
-Before:
-client --- SYN: rwindow=65535 ---> server
-client <--- SYN+ACK: rwindow=65535 ---- server
-client --- ACK: rwindow=65536 ---> server
-Note: for the last ACK, the calculation is 512 << 7.
-
-After:
-client --- SYN: rwindow=65535 ---> server
-client <--- SYN+ACK: rwindow=65535 ---- server
-client --- ACK: rwindow=175232 ---> server
-Note: I use the following command to make it work:
-ip route change default via [ip] dev eth0 metric 100 initrwnd 120
-For the last ACK, the calculation is 1369 << 7.
-
-When we apply such a patch, having a large rcv_wnd if the user tweak this
-knob can help transfer data more rapidly and save some rtts.
-
-Fixes: a337531b942b ("tcp: up initial rmem to 128KB and SYN rwin to around 64KB")
-Signed-off-by: Jason Xing <kernelxing@tencent.com>
-Reviewed-by: Eric Dumazet <edumazet@google.com>
-Acked-by: Neal Cardwell <ncardwell@google.com>
-Link: https://lore.kernel.org/r/20240521134220.12510-1-kerneljasonxing@gmail.com
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- net/ipv4/tcp_output.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
-index 02caeb7bcf634..16ef24a37c498 100644
---- a/net/ipv4/tcp_output.c
-+++ b/net/ipv4/tcp_output.c
-@@ -229,7 +229,7 @@ void tcp_select_initial_window(const struct sock *sk, int __space, __u32 mss,
- if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_workaround_signed_windows))
- (*rcv_wnd) = min(space, MAX_TCP_WINDOW);
- else
-- (*rcv_wnd) = min_t(u32, space, U16_MAX);
-+ (*rcv_wnd) = space;
-
- if (init_rcv_wnd)
- *rcv_wnd = min(*rcv_wnd, init_rcv_wnd * mss);
---
-2.43.0
-
+++ /dev/null
-From e2a042fa9beb5cb6a720d850c5695b2e4bdcdaf3 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 21 May 2024 19:34:38 +0900
-Subject: tls: fix missing memory barrier in tls_init
-
-From: Dae R. Jeong <threeearcat@gmail.com>
-
-[ Upstream commit 91e61dd7a0af660408e87372d8330ceb218be302 ]
-
-In tls_init(), a write memory barrier is missing, and store-store
-reordering may cause NULL dereference in tls_{setsockopt,getsockopt}.
-
-CPU0 CPU1
------ -----
-// In tls_init()
-// In tls_ctx_create()
-ctx = kzalloc()
-ctx->sk_proto = READ_ONCE(sk->sk_prot) -(1)
-
-// In update_sk_prot()
-WRITE_ONCE(sk->sk_prot, tls_prots) -(2)
-
- // In sock_common_setsockopt()
- READ_ONCE(sk->sk_prot)->setsockopt()
-
- // In tls_{setsockopt,getsockopt}()
- ctx->sk_proto->setsockopt() -(3)
-
-In the above scenario, when (1) and (2) are reordered, (3) can observe
-the NULL value of ctx->sk_proto, causing NULL dereference.
-
-To fix it, we rely on rcu_assign_pointer() which implies the release
-barrier semantic. By moving rcu_assign_pointer() after ctx->sk_proto is
-initialized, we can ensure that ctx->sk_proto are visible when
-changing sk->sk_prot.
-
-Fixes: d5bee7374b68 ("net/tls: Annotate access to sk_prot with READ_ONCE/WRITE_ONCE")
-Signed-off-by: Yewon Choi <woni9911@gmail.com>
-Signed-off-by: Dae R. Jeong <threeearcat@gmail.com>
-Link: https://lore.kernel.org/netdev/ZU4OJG56g2V9z_H7@dragonet/T/
-Link: https://lore.kernel.org/r/Zkx4vjSFp0mfpjQ2@libra05
-Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- net/tls/tls_main.c | 10 +++++++++-
- 1 file changed, 9 insertions(+), 1 deletion(-)
-
-diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c
-index b4674f03d71a9..90b7f253d3632 100644
---- a/net/tls/tls_main.c
-+++ b/net/tls/tls_main.c
-@@ -816,9 +816,17 @@ struct tls_context *tls_ctx_create(struct sock *sk)
- return NULL;
-
- mutex_init(&ctx->tx_lock);
-- rcu_assign_pointer(icsk->icsk_ulp_data, ctx);
- ctx->sk_proto = READ_ONCE(sk->sk_prot);
- ctx->sk = sk;
-+ /* Release semantic of rcu_assign_pointer() ensures that
-+ * ctx->sk_proto is visible before changing sk->sk_prot in
-+ * update_sk_prot(), and prevents reading uninitialized value in
-+ * tls_{getsockopt, setsockopt}. Note that we do not need a
-+ * read barrier in tls_{getsockopt,setsockopt} as there is an
-+ * address dependency between sk->sk_proto->{getsockopt,setsockopt}
-+ * and ctx->sk_proto.
-+ */
-+ rcu_assign_pointer(icsk->icsk_ulp_data, ctx);
- return ctx;
- }
-
---
-2.43.0
-
+++ /dev/null
-From 0f7532f0146ba09d62df6200158e3df7b6b29474 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 10 Apr 2024 19:58:52 -0700
-Subject: tools/arch/x86/intel_sdsi: Fix maximum meter bundle length
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: David E. Box <david.e.box@linux.intel.com>
-
-[ Upstream commit a66f962f67ebbbdf7c82c6652180930c0169cf13 ]
-
-The maximum number of bundles in the meter certificate was set to 8 which
-is much less than the maximum. Instead, since the bundles appear at the end
-of the file, set it based on the remaining file size from the bundle start
-position.
-
-Fixes: 7fdc03a7370f ("tools/arch/x86: intel_sdsi: Add support for reading meter certificates")
-Signed-off-by: David E. Box <david.e.box@linux.intel.com>
-Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
-Link: https://lore.kernel.org/r/20240411025856.2782476-6-david.e.box@linux.intel.com
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/arch/x86/intel_sdsi/intel_sdsi.c | 12 ++++++++----
- 1 file changed, 8 insertions(+), 4 deletions(-)
-
-diff --git a/tools/arch/x86/intel_sdsi/intel_sdsi.c b/tools/arch/x86/intel_sdsi/intel_sdsi.c
-index 2cd92761f1714..7eaffcbff788c 100644
---- a/tools/arch/x86/intel_sdsi/intel_sdsi.c
-+++ b/tools/arch/x86/intel_sdsi/intel_sdsi.c
-@@ -43,7 +43,6 @@
- #define METER_CERT_MAX_SIZE 4096
- #define STATE_MAX_NUM_LICENSES 16
- #define STATE_MAX_NUM_IN_BUNDLE (uint32_t)8
--#define METER_MAX_NUM_BUNDLES 8
-
- #define __round_mask(x, y) ((__typeof__(x))((y) - 1))
- #define round_up(x, y) ((((x) - 1) | __round_mask(x, y)) + 1)
-@@ -167,6 +166,11 @@ struct bundle_encoding_counter {
- uint32_t encoding;
- uint32_t counter;
- };
-+#define METER_BUNDLE_SIZE sizeof(struct bundle_encoding_counter)
-+#define BUNDLE_COUNT(length) ((length) / METER_BUNDLE_SIZE)
-+#define METER_MAX_NUM_BUNDLES \
-+ ((METER_CERT_MAX_SIZE - sizeof(struct meter_certificate)) / \
-+ sizeof(struct bundle_encoding_counter))
-
- struct sdsi_dev {
- struct sdsi_regs regs;
-@@ -386,9 +390,9 @@ static int sdsi_meter_cert_show(struct sdsi_dev *s)
- return -1;
- }
-
-- if (mc->bundle_length > METER_MAX_NUM_BUNDLES * 8) {
-- fprintf(stderr, "More than %d bundles: %d\n",
-- METER_MAX_NUM_BUNDLES, mc->bundle_length / 8);
-+ if (mc->bundle_length > METER_MAX_NUM_BUNDLES * METER_BUNDLE_SIZE) {
-+ fprintf(stderr, "More than %ld bundles: actual %ld\n",
-+ METER_MAX_NUM_BUNDLES, BUNDLE_COUNT(mc->bundle_length));
- return -1;
- }
-
---
-2.43.0
-
+++ /dev/null
-From 4e8c1362bec29f0a5240db87e6c76b624ea4e60d Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 10 Apr 2024 19:58:54 -0700
-Subject: tools/arch/x86/intel_sdsi: Fix meter_certificate decoding
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: David E. Box <david.e.box@linux.intel.com>
-
-[ Upstream commit 09d70ded6c566fd00886be32c26d0b2004ef239c ]
-
-Fix errors in the calculation of the start position of the counters and in
-the display loop. While here, use a #define for the bundle count and size.
-
-Fixes: 7fdc03a7370f ("tools/arch/x86: intel_sdsi: Add support for reading meter certificates")
-Signed-off-by: David E. Box <david.e.box@linux.intel.com>
-Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
-Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
-Link: https://lore.kernel.org/r/20240411025856.2782476-8-david.e.box@linux.intel.com
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/arch/x86/intel_sdsi/intel_sdsi.c | 7 ++++---
- 1 file changed, 4 insertions(+), 3 deletions(-)
-
-diff --git a/tools/arch/x86/intel_sdsi/intel_sdsi.c b/tools/arch/x86/intel_sdsi/intel_sdsi.c
-index ae29214da1029..ba2a6b6645ae8 100644
---- a/tools/arch/x86/intel_sdsi/intel_sdsi.c
-+++ b/tools/arch/x86/intel_sdsi/intel_sdsi.c
-@@ -394,7 +394,7 @@ static int sdsi_meter_cert_show(struct sdsi_dev *s)
- printf("MMRC encoding: %.4s\n", name);
-
- printf("MMRC counter: %d\n", mc->mmrc_counter);
-- if (mc->bundle_length % 8) {
-+ if (mc->bundle_length % METER_BUNDLE_SIZE) {
- fprintf(stderr, "Invalid bundle length\n");
- return -1;
- }
-@@ -405,15 +405,16 @@ static int sdsi_meter_cert_show(struct sdsi_dev *s)
- return -1;
- }
-
-- bec = (void *)(mc) + sizeof(mc);
-+ bec = (struct bundle_encoding_counter *)(mc + 1);
-
- printf("Number of Feature Counters: %ld\n", BUNDLE_COUNT(mc->bundle_length));
-- while (count++ < mc->bundle_length / 8) {
-+ while (count < BUNDLE_COUNT(mc->bundle_length)) {
- char feature[5];
-
- feature[4] = '\0';
- get_feature(bec[count].encoding, feature);
- printf(" %s: %d\n", feature, bec[count].counter);
-+ ++count;
- }
-
- return 0;
---
-2.43.0
-
+++ /dev/null
-From 7f39fff0e823892268b180e4e4ec7b95be4a0274 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 10 Apr 2024 19:58:53 -0700
-Subject: tools/arch/x86/intel_sdsi: Fix meter_show display
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: David E. Box <david.e.box@linux.intel.com>
-
-[ Upstream commit 76f2bc17428c890754d11aa6aea14b332ba130c5 ]
-
-Fixes sdsi_meter_cert_show() to correctly decode and display the meter
-certificate output. Adds and displays a missing version field, displays the
-ASCII name of the signature, and fixes the print alignment.
-
-Fixes: 7fdc03a7370f ("tools/arch/x86: intel_sdsi: Add support for reading meter certificates")
-Signed-off-by: David E. Box <david.e.box@linux.intel.com>
-Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
-Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
-Link: https://lore.kernel.org/r/20240411025856.2782476-7-david.e.box@linux.intel.com
-Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- tools/arch/x86/intel_sdsi/intel_sdsi.c | 29 +++++++++++++++++---------
- 1 file changed, 19 insertions(+), 10 deletions(-)
-
-diff --git a/tools/arch/x86/intel_sdsi/intel_sdsi.c b/tools/arch/x86/intel_sdsi/intel_sdsi.c
-index 7eaffcbff788c..ae29214da1029 100644
---- a/tools/arch/x86/intel_sdsi/intel_sdsi.c
-+++ b/tools/arch/x86/intel_sdsi/intel_sdsi.c
-@@ -153,11 +153,12 @@ struct bundle_encoding {
- };
-
- struct meter_certificate {
-- uint32_t block_signature;
-- uint32_t counter_unit;
-+ uint32_t signature;
-+ uint32_t version;
- uint64_t ppin;
-+ uint32_t counter_unit;
- uint32_t bundle_length;
-- uint32_t reserved;
-+ uint64_t reserved;
- uint32_t mmrc_encoding;
- uint32_t mmrc_counter;
- };
-@@ -338,6 +339,7 @@ static int sdsi_meter_cert_show(struct sdsi_dev *s)
- uint32_t count = 0;
- FILE *cert_ptr;
- int ret, size;
-+ char name[4];
-
- ret = sdsi_update_registers(s);
- if (ret)
-@@ -379,12 +381,19 @@ static int sdsi_meter_cert_show(struct sdsi_dev *s)
- printf("\n");
- printf("Meter certificate for device %s\n", s->dev_name);
- printf("\n");
-- printf("Block Signature: 0x%x\n", mc->block_signature);
-- printf("Count Unit: %dms\n", mc->counter_unit);
-- printf("PPIN: 0x%lx\n", mc->ppin);
-- printf("Feature Bundle Length: %d\n", mc->bundle_length);
-- printf("MMRC encoding: %d\n", mc->mmrc_encoding);
-- printf("MMRC counter: %d\n", mc->mmrc_counter);
-+
-+ get_feature(mc->signature, name);
-+ printf("Signature: %.4s\n", name);
-+
-+ printf("Version: %d\n", mc->version);
-+ printf("Count Unit: %dms\n", mc->counter_unit);
-+ printf("PPIN: 0x%lx\n", mc->ppin);
-+ printf("Feature Bundle Length: %d\n", mc->bundle_length);
-+
-+ get_feature(mc->mmrc_encoding, name);
-+ printf("MMRC encoding: %.4s\n", name);
-+
-+ printf("MMRC counter: %d\n", mc->mmrc_counter);
- if (mc->bundle_length % 8) {
- fprintf(stderr, "Invalid bundle length\n");
- return -1;
-@@ -398,7 +407,7 @@ static int sdsi_meter_cert_show(struct sdsi_dev *s)
-
- bec = (void *)(mc) + sizeof(mc);
-
-- printf("Number of Feature Counters: %d\n", mc->bundle_length / 8);
-+ printf("Number of Feature Counters: %ld\n", BUNDLE_COUNT(mc->bundle_length));
- while (count++ < mc->bundle_length / 8) {
- char feature[5];
-
---
-2.43.0
-
+++ /dev/null
-From 09f4c79c048a967ae35e3bc787ca1dcbe4e15bf4 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 22 May 2024 15:06:40 +0300
-Subject: tpm_tis_spi: Account for SPI header when allocating TPM SPI xfer
- buffer
-
-From: Matthew R. Ochs <mochs@nvidia.com>
-
-[ Upstream commit 195aba96b854dd664768f382cd1db375d8181f88 ]
-
-The TPM SPI transfer mechanism uses MAX_SPI_FRAMESIZE for computing the
-maximum transfer length and the size of the transfer buffer. As such, it
-does not account for the 4 bytes of header that prepends the SPI data
-frame. This can result in out-of-bounds accesses and was confirmed with
-KASAN.
-
-Introduce SPI_HDRSIZE to account for the header and use to allocate the
-transfer buffer.
-
-Fixes: a86a42ac2bd6 ("tpm_tis_spi: Add hardware wait polling")
-Signed-off-by: Matthew R. Ochs <mochs@nvidia.com>
-Tested-by: Carol Soto <csoto@nvidia.com>
-Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
-Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/char/tpm/tpm_tis_spi_main.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/char/tpm/tpm_tis_spi_main.c b/drivers/char/tpm/tpm_tis_spi_main.c
-index c5c3197ee29f0..4bdad9e3667fa 100644
---- a/drivers/char/tpm/tpm_tis_spi_main.c
-+++ b/drivers/char/tpm/tpm_tis_spi_main.c
-@@ -37,6 +37,7 @@
- #include "tpm_tis_spi.h"
-
- #define MAX_SPI_FRAMESIZE 64
-+#define SPI_HDRSIZE 4
-
- /*
- * TCG SPI flow control is documented in section 6.4 of the spec[1]. In short,
-@@ -247,7 +248,7 @@ static int tpm_tis_spi_write_bytes(struct tpm_tis_data *data, u32 addr,
- int tpm_tis_spi_init(struct spi_device *spi, struct tpm_tis_spi_phy *phy,
- int irq, const struct tpm_tis_phy_ops *phy_ops)
- {
-- phy->iobuf = devm_kmalloc(&spi->dev, MAX_SPI_FRAMESIZE, GFP_KERNEL);
-+ phy->iobuf = devm_kmalloc(&spi->dev, SPI_HDRSIZE + MAX_SPI_FRAMESIZE, GFP_KERNEL);
- if (!phy->iobuf)
- return -ENOMEM;
-
---
-2.43.0
-
+++ /dev/null
-From 819f5b8d630b464f6c66244187bbe198ffb34951 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 27 May 2024 11:43:52 +0200
-Subject: tracing/probes: fix error check in parse_btf_field()
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Carlos López <clopez@suse.de>
-
-[ Upstream commit e569eb34970281438e2b48a3ef11c87459fcfbcb ]
-
-btf_find_struct_member() might return NULL or an error via the
-ERR_PTR() macro. However, its caller in parse_btf_field() only checks
-for the NULL condition. Fix this by using IS_ERR() and returning the
-error up the stack.
-
-Link: https://lore.kernel.org/all/20240527094351.15687-1-clopez@suse.de/
-
-Fixes: c440adfbe3025 ("tracing/probes: Support BTF based data structure field access")
-Signed-off-by: Carlos López <clopez@suse.de>
-Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- kernel/trace/trace_probe.c | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
-index 34289f9c67076..ae162ba36a480 100644
---- a/kernel/trace/trace_probe.c
-+++ b/kernel/trace/trace_probe.c
-@@ -553,6 +553,10 @@ static int parse_btf_field(char *fieldname, const struct btf_type *type,
- anon_offs = 0;
- field = btf_find_struct_member(ctx->btf, type, fieldname,
- &anon_offs);
-+ if (IS_ERR(field)) {
-+ trace_probe_log_err(ctx->offset, BAD_BTF_TID);
-+ return PTR_ERR(field);
-+ }
- if (!field) {
- trace_probe_log_err(ctx->offset, NO_BTF_FIELD);
- return -ENOENT;
---
-2.43.0
-
+++ /dev/null
-From c26e8590756a1b0ec1d9314d7bedccbcf8eb144b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 17 Apr 2024 16:04:09 +0100
-Subject: udf: Convert udf_expand_file_adinicb() to use a folio
-
-From: Matthew Wilcox (Oracle) <willy@infradead.org>
-
-[ Upstream commit db6754090a4f99c67e05ae6b87343ba6e013531f ]
-
-Use the folio APIs throughout this function.
-
-Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
-Fixes: 1eeceaec794e ("udf: Convert udf_expand_file_adinicb() to avoid kmap_atomic()")
-Signed-off-by: Jan Kara <jack@suse.cz>
-Message-Id: <20240417150416.752929-4-willy@infradead.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/udf/inode.c | 27 ++++++++++++++-------------
- 1 file changed, 14 insertions(+), 13 deletions(-)
-
-diff --git a/fs/udf/inode.c b/fs/udf/inode.c
-index 2f831a3a91afe..bbf8918417fd8 100644
---- a/fs/udf/inode.c
-+++ b/fs/udf/inode.c
-@@ -341,7 +341,7 @@ const struct address_space_operations udf_aops = {
- */
- int udf_expand_file_adinicb(struct inode *inode)
- {
-- struct page *page;
-+ struct folio *folio;
- struct udf_inode_info *iinfo = UDF_I(inode);
- int err;
-
-@@ -357,12 +357,13 @@ int udf_expand_file_adinicb(struct inode *inode)
- return 0;
- }
-
-- page = find_or_create_page(inode->i_mapping, 0, GFP_KERNEL);
-- if (!page)
-- return -ENOMEM;
-+ folio = __filemap_get_folio(inode->i_mapping, 0,
-+ FGP_LOCK | FGP_ACCESSED | FGP_CREAT, GFP_KERNEL);
-+ if (IS_ERR(folio))
-+ return PTR_ERR(folio);
-
-- if (!PageUptodate(page))
-- udf_adinicb_readpage(page);
-+ if (!folio_test_uptodate(folio))
-+ udf_adinicb_readpage(&folio->page);
- down_write(&iinfo->i_data_sem);
- memset(iinfo->i_data + iinfo->i_lenEAttr, 0x00,
- iinfo->i_lenAlloc);
-@@ -371,22 +372,22 @@ int udf_expand_file_adinicb(struct inode *inode)
- iinfo->i_alloc_type = ICBTAG_FLAG_AD_SHORT;
- else
- iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG;
-- set_page_dirty(page);
-- unlock_page(page);
-+ folio_mark_dirty(folio);
-+ folio_unlock(folio);
- up_write(&iinfo->i_data_sem);
- err = filemap_fdatawrite(inode->i_mapping);
- if (err) {
- /* Restore everything back so that we don't lose data... */
-- lock_page(page);
-+ folio_lock(folio);
- down_write(&iinfo->i_data_sem);
-- memcpy_to_page(page, 0, iinfo->i_data + iinfo->i_lenEAttr,
-- inode->i_size);
-- unlock_page(page);
-+ memcpy_from_folio(iinfo->i_data + iinfo->i_lenEAttr,
-+ folio, 0, inode->i_size);
-+ folio_unlock(folio);
- iinfo->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB;
- iinfo->i_lenAlloc = inode->i_size;
- up_write(&iinfo->i_data_sem);
- }
-- put_page(page);
-+ folio_put(folio);
- mark_inode_dirty(inode);
-
- return err;
---
-2.43.0
-
+++ /dev/null
-From 8a4132622255bd65cba0f6a87388d25c0bc97514 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 9 Jan 2024 11:15:43 +0100
-Subject: udf: Remove GFP_NOFS allocation in udf_expand_file_adinicb()
-
-From: Jan Kara <jack@suse.cz>
-
-[ Upstream commit 38f8af2a7191e5da21c557210d810c6d0d34f6c4 ]
-
-udf_expand_file_adinicb() is called under inode->i_rwsem and
-mapping->invalidate_lock. i_rwsem is safe wrt fs reclaim,
-invalidate_lock on this inode is safe as well (we hold inode reference
-so reclaim will not touch it, furthermore even lockdep should not
-complain as invalidate_lock is acquired from udf_evict_inode() only when
-truncating inode which should not happen from fs reclaim).
-
-Signed-off-by: Jan Kara <jack@suse.cz>
-Stable-dep-of: db6754090a4f ("udf: Convert udf_expand_file_adinicb() to use a folio")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- fs/udf/inode.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/fs/udf/inode.c b/fs/udf/inode.c
-index d8493449d4c57..2f831a3a91afe 100644
---- a/fs/udf/inode.c
-+++ b/fs/udf/inode.c
-@@ -357,7 +357,7 @@ int udf_expand_file_adinicb(struct inode *inode)
- return 0;
- }
-
-- page = find_or_create_page(inode->i_mapping, 0, GFP_NOFS);
-+ page = find_or_create_page(inode->i_mapping, 0, GFP_KERNEL);
- if (!page)
- return -ENOMEM;
-
---
-2.43.0
-
+++ /dev/null
-From 8298e3bf295fb9b1b4f0f305d7a678dd3ea54cf1 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 7 Mar 2024 11:49:26 +0100
-Subject: um: Add winch to winch_handlers before registering winch IRQ
-
-From: Roberto Sassu <roberto.sassu@huawei.com>
-
-[ Upstream commit a0fbbd36c156b9f7b2276871d499c9943dfe5101 ]
-
-Registering a winch IRQ is racy, an interrupt may occur before the winch is
-added to the winch_handlers list.
-
-If that happens, register_winch_irq() adds to that list a winch that is
-scheduled to be (or has already been) freed, causing a panic later in
-winch_cleanup().
-
-Avoid the race by adding the winch to the winch_handlers list before
-registering the IRQ, and rolling back if um_request_irq() fails.
-
-Fixes: 42a359e31a0e ("uml: SIGIO support cleanup")
-Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
-Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
-Signed-off-by: Richard Weinberger <richard@nod.at>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/um/drivers/line.c | 14 ++++++++------
- 1 file changed, 8 insertions(+), 6 deletions(-)
-
-diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
-index ffc5cb92fa367..d82bc3fdb86e7 100644
---- a/arch/um/drivers/line.c
-+++ b/arch/um/drivers/line.c
-@@ -676,24 +676,26 @@ void register_winch_irq(int fd, int tty_fd, int pid, struct tty_port *port,
- goto cleanup;
- }
-
-- *winch = ((struct winch) { .list = LIST_HEAD_INIT(winch->list),
-- .fd = fd,
-+ *winch = ((struct winch) { .fd = fd,
- .tty_fd = tty_fd,
- .pid = pid,
- .port = port,
- .stack = stack });
-
-+ spin_lock(&winch_handler_lock);
-+ list_add(&winch->list, &winch_handlers);
-+ spin_unlock(&winch_handler_lock);
-+
- if (um_request_irq(WINCH_IRQ, fd, IRQ_READ, winch_interrupt,
- IRQF_SHARED, "winch", winch) < 0) {
- printk(KERN_ERR "register_winch_irq - failed to register "
- "IRQ\n");
-+ spin_lock(&winch_handler_lock);
-+ list_del(&winch->list);
-+ spin_unlock(&winch_handler_lock);
- goto out_free;
- }
-
-- spin_lock(&winch_handler_lock);
-- list_add(&winch->list, &winch_handlers);
-- spin_unlock(&winch_handler_lock);
--
- return;
-
- out_free:
---
-2.43.0
-
+++ /dev/null
-From f346f26fce761d916504f145a3c9aa17b5cccbf6 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 6 Mar 2024 17:12:59 +0800
-Subject: um: Fix return value in ubd_init()
-
-From: Duoming Zhou <duoming@zju.edu.cn>
-
-[ Upstream commit 31a5990ed253a66712d7ddc29c92d297a991fdf2 ]
-
-When kmalloc_array() fails to allocate memory, the ubd_init()
-should return -ENOMEM instead of -1. So, fix it.
-
-Fixes: f88f0bdfc32f ("um: UBD Improvements")
-Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
-Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
-Signed-off-by: Richard Weinberger <richard@nod.at>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/um/drivers/ubd_kern.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
-index 92ee2697ff398..85e33caf62a0e 100644
---- a/arch/um/drivers/ubd_kern.c
-+++ b/arch/um/drivers/ubd_kern.c
-@@ -1098,7 +1098,7 @@ static int __init ubd_init(void)
-
- if (irq_req_buffer == NULL) {
- printk(KERN_ERR "Failed to initialize ubd buffering\n");
-- return -1;
-+ return -ENOMEM;
- }
- io_req_buffer = kmalloc_array(UBD_REQ_BUFFER_SIZE,
- sizeof(struct io_thread_req *),
-@@ -1109,7 +1109,7 @@ static int __init ubd_init(void)
-
- if (io_req_buffer == NULL) {
- printk(KERN_ERR "Failed to initialize ubd buffering\n");
-- return -1;
-+ return -ENOMEM;
- }
- platform_driver_register(&ubd_driver);
- mutex_lock(&ubd_lock);
---
-2.43.0
-
+++ /dev/null
-From 8b8b8e1de24cdc29673bf341cda4e9045e6dee3a Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 23 Apr 2024 20:58:55 +0800
-Subject: um: Fix the declaration of kasan_map_memory
-
-From: Tiwei Bie <tiwei.btw@antgroup.com>
-
-[ Upstream commit 6a85e34c4d07d2ec0c153067baff338ac0db55ca ]
-
-Make it match its definition (size_t vs unsigned long). And declare
-it in a shared header to fix the -Wmissing-prototypes warning, as it
-is defined in the user code and called in the kernel code.
-
-Fixes: 5b301409e8bc ("UML: add support for KASAN under x86_64")
-Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
-Signed-off-by: Richard Weinberger <richard@nod.at>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/um/include/asm/kasan.h | 1 -
- arch/um/include/shared/kern_util.h | 2 ++
- arch/um/os-Linux/mem.c | 1 +
- 3 files changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/arch/um/include/asm/kasan.h b/arch/um/include/asm/kasan.h
-index 0d6547f4ec85c..f97bb1f7b8514 100644
---- a/arch/um/include/asm/kasan.h
-+++ b/arch/um/include/asm/kasan.h
-@@ -24,7 +24,6 @@
-
- #ifdef CONFIG_KASAN
- void kasan_init(void);
--void kasan_map_memory(void *start, unsigned long len);
- extern int kasan_um_is_ready;
-
- #ifdef CONFIG_STATIC_LINK
-diff --git a/arch/um/include/shared/kern_util.h b/arch/um/include/shared/kern_util.h
-index 789b83013f355..af8cdfc75897e 100644
---- a/arch/um/include/shared/kern_util.h
-+++ b/arch/um/include/shared/kern_util.h
-@@ -66,4 +66,6 @@ extern void fatal_sigsegv(void) __attribute__ ((noreturn));
-
- void um_idle_sleep(void);
-
-+void kasan_map_memory(void *start, size_t len);
-+
- #endif
-diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c
-index 8530b2e086049..c6c9495b14321 100644
---- a/arch/um/os-Linux/mem.c
-+++ b/arch/um/os-Linux/mem.c
-@@ -15,6 +15,7 @@
- #include <sys/vfs.h>
- #include <linux/magic.h>
- #include <init.h>
-+#include <kern_util.h>
- #include <os.h>
-
- /*
---
-2.43.0
-
+++ /dev/null
-From 6c8175d2fac0e6e29c37a2b6cebf916d4e93c67b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 23 Apr 2024 20:58:53 +0800
-Subject: um: Fix the -Wmissing-prototypes warning for __switch_mm
-
-From: Tiwei Bie <tiwei.btw@antgroup.com>
-
-[ Upstream commit 2cbade17b18c0f0fd9963f26c9fc9b057eb1cb3a ]
-
-The __switch_mm function is defined in the user code, and is called
-by the kernel code. It should be declared in a shared header.
-
-Fixes: 4dc706c2f292 ("um: take um_mmu.h to asm/mmu.h, clean asm/mmu_context.h a bit")
-Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
-Signed-off-by: Richard Weinberger <richard@nod.at>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/um/include/asm/mmu.h | 2 --
- arch/um/include/shared/skas/mm_id.h | 2 ++
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/arch/um/include/asm/mmu.h b/arch/um/include/asm/mmu.h
-index a7555e43ed14a..f2923c767bb9a 100644
---- a/arch/um/include/asm/mmu.h
-+++ b/arch/um/include/asm/mmu.h
-@@ -14,8 +14,6 @@ typedef struct mm_context {
- struct uml_arch_mm_context arch;
- } mm_context_t;
-
--extern void __switch_mm(struct mm_id * mm_idp);
--
- /* Avoid tangled inclusion with asm/ldt.h */
- extern long init_new_ldt(struct mm_context *to_mm, struct mm_context *from_mm);
- extern void free_ldt(struct mm_context *mm);
-diff --git a/arch/um/include/shared/skas/mm_id.h b/arch/um/include/shared/skas/mm_id.h
-index e82e203f5f419..92dbf727e3842 100644
---- a/arch/um/include/shared/skas/mm_id.h
-+++ b/arch/um/include/shared/skas/mm_id.h
-@@ -15,4 +15,6 @@ struct mm_id {
- int kill;
- };
-
-+void __switch_mm(struct mm_id *mm_idp);
-+
- #endif
---
-2.43.0
-
+++ /dev/null
-From 8fbb3f5982fcc8cc5c7eed31812a2ba3e1640b71 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Tue, 23 Apr 2024 20:58:54 +0800
-Subject: um: Fix the -Wmissing-prototypes warning for get_thread_reg
-
-From: Tiwei Bie <tiwei.btw@antgroup.com>
-
-[ Upstream commit 3144013e48f4f6e5127223c4ebc488016815dedb ]
-
-The get_thread_reg function is defined in the user code, and is
-called by the kernel code. It should be declared in a shared header.
-
-Fixes: dbba7f704aa0 ("um: stop polluting the namespace with registers.h contents")
-Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
-Signed-off-by: Richard Weinberger <richard@nod.at>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/um/include/asm/processor-generic.h | 1 -
- arch/x86/um/shared/sysdep/archsetjmp.h | 7 +++++++
- 2 files changed, 7 insertions(+), 1 deletion(-)
-
-diff --git a/arch/um/include/asm/processor-generic.h b/arch/um/include/asm/processor-generic.h
-index 6c3779541845b..5a7c05275aa74 100644
---- a/arch/um/include/asm/processor-generic.h
-+++ b/arch/um/include/asm/processor-generic.h
-@@ -94,7 +94,6 @@ extern struct cpuinfo_um boot_cpu_data;
- #define current_cpu_data boot_cpu_data
- #define cache_line_size() (boot_cpu_data.cache_alignment)
-
--extern unsigned long get_thread_reg(int reg, jmp_buf *buf);
- #define KSTK_REG(tsk, reg) get_thread_reg(reg, &tsk->thread.switch_buf)
- extern unsigned long __get_wchan(struct task_struct *p);
-
-diff --git a/arch/x86/um/shared/sysdep/archsetjmp.h b/arch/x86/um/shared/sysdep/archsetjmp.h
-index 166cedbab9266..8c81d1a604a94 100644
---- a/arch/x86/um/shared/sysdep/archsetjmp.h
-+++ b/arch/x86/um/shared/sysdep/archsetjmp.h
-@@ -1,6 +1,13 @@
- /* SPDX-License-Identifier: GPL-2.0 */
-+#ifndef __X86_UM_SYSDEP_ARCHSETJMP_H
-+#define __X86_UM_SYSDEP_ARCHSETJMP_H
-+
- #ifdef __i386__
- #include "archsetjmp_32.h"
- #else
- #include "archsetjmp_64.h"
- #endif
-+
-+unsigned long get_thread_reg(int reg, jmp_buf *buf);
-+
-+#endif /* __X86_UM_SYSDEP_ARCHSETJMP_H */
---
-2.43.0
-
+++ /dev/null
-From 50400e68ecd926dc268e91bc48cc7d7c1a634029 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 28 Mar 2024 10:06:36 +0100
-Subject: um: vector: fix bpfflash parameter evaluation
-
-From: Johannes Berg <johannes.berg@intel.com>
-
-[ Upstream commit 584ed2f76ff5fe360d87a04d17b6520c7999e06b ]
-
-With W=1 the build complains about a pointer compared to
-zero, clearly the result should've been compared.
-
-Fixes: 9807019a62dc ("um: Loadable BPF "Firmware" for vector drivers")
-Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-Reviewed-by: Tiwei Bie <tiwei.btw@antgroup.com>
-Signed-off-by: Richard Weinberger <richard@nod.at>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/um/drivers/vector_kern.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c
-index 131b7cb295767..94a4dfac6c236 100644
---- a/arch/um/drivers/vector_kern.c
-+++ b/arch/um/drivers/vector_kern.c
-@@ -141,7 +141,7 @@ static bool get_bpf_flash(struct arglist *def)
-
- if (allow != NULL) {
- if (kstrtoul(allow, 10, &result) == 0)
-- return (allow > 0);
-+ return result > 0;
- }
- return false;
- }
---
-2.43.0
-
+++ /dev/null
-From ecaabf3a03e8a29f125b4fde050cbcceee4dc68b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 10 May 2024 18:26:22 +0300
-Subject: usb: fotg210: Add missing kernel doc description
-
-From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-
-[ Upstream commit 4b653e82ae18f2dc91c7132b54f5785c4d56bab4 ]
-
-kernel-doc validator is not happy:
-
- warning: Function parameter or struct member 'fotg' not described in 'fotg210_vbus'
-
-Add missing description.
-
-Fixes: 3e679bde529e ("usb: fotg210-udc: Implement VBUS session")
-Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
-Link: https://lore.kernel.org/r/20240510152641.2421298-1-andriy.shevchenko@linux.intel.com
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/usb/fotg210/fotg210-core.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/drivers/usb/fotg210/fotg210-core.c b/drivers/usb/fotg210/fotg210-core.c
-index 958fc40eae86b..0655afe7f9779 100644
---- a/drivers/usb/fotg210/fotg210-core.c
-+++ b/drivers/usb/fotg210/fotg210-core.c
-@@ -95,6 +95,7 @@ static int fotg210_gemini_init(struct fotg210 *fotg, struct resource *res,
-
- /**
- * fotg210_vbus() - Called by gadget driver to enable/disable VBUS
-+ * @fotg: pointer to a private fotg210 object
- * @enable: true to enable VBUS, false to disable VBUS
- */
- void fotg210_vbus(struct fotg210 *fotg, bool enable)
---
-2.43.0
-
+++ /dev/null
-From fb4ba5e5d042106cf127387a3613e41116103707 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 25 Apr 2024 15:20:20 +0000
-Subject: usb: gadget: u_audio: Clear uac pointer when freed.
-
-From: Chris Wulff <Chris.Wulff@biamp.com>
-
-[ Upstream commit a2cf936ebef291ef7395172b9e2f624779fb6dc0 ]
-
-This prevents use of a stale pointer if functions are called after
-g_cleanup that shouldn't be. This doesn't fix any races, but converts
-a possibly silent kernel memory corruption into an obvious NULL pointer
-dereference report.
-
-Fixes: eb9fecb9e69b ("usb: gadget: f_uac2: split out audio core")
-Signed-off-by: Chris Wulff <chris.wulff@biamp.com>
-Link: https://lore.kernel.org/stable/CO1PR17MB54194226DA08BFC9EBD8C163E1172%40CO1PR17MB5419.namprd17.prod.outlook.com
-Link: https://lore.kernel.org/r/CO1PR17MB54194226DA08BFC9EBD8C163E1172@CO1PR17MB5419.namprd17.prod.outlook.com
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/usb/gadget/function/u_audio.c | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/drivers/usb/gadget/function/u_audio.c b/drivers/usb/gadget/function/u_audio.c
-index c8e8154c59f50..ec1dceb087293 100644
---- a/drivers/usb/gadget/function/u_audio.c
-+++ b/drivers/usb/gadget/function/u_audio.c
-@@ -1419,6 +1419,8 @@ void g_audio_cleanup(struct g_audio *g_audio)
- return;
-
- uac = g_audio->uac;
-+ g_audio->uac = NULL;
-+
- card = uac->card;
- if (card)
- snd_card_free_when_closed(card);
---
-2.43.0
-
+++ /dev/null
-From 40a5caebd81e3db812303b4f298ab6bfd9965719 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 25 Apr 2024 15:18:01 +0000
-Subject: usb: gadget: u_audio: Fix race condition use of controls after free
- during gadget unbind.
-
-From: Chris Wulff <Chris.Wulff@biamp.com>
-
-[ Upstream commit 1b739388aa3f8dfb63a9fca777e6dfa6912d0464 ]
-
-Hang on to the control IDs instead of pointers since those are correctly
-handled with locks.
-
-Fixes: 8fe9a03f4331 ("usb: gadget: u_audio: Rate ctl notifies about current srate (0=stopped)")
-Fixes: c565ad07ef35 ("usb: gadget: u_audio: Support multiple sampling rates")
-Fixes: 02de698ca812 ("usb: gadget: u_audio: add bi-directional volume and mute support")
-Signed-off-by: Chris Wulff <chris.wulff@biamp.com>
-Link: https://lore.kernel.org/stable/CO1PR17MB5419C2BF44D400E4E620C1ADE1172%40CO1PR17MB5419.namprd17.prod.outlook.com
-Link: https://lore.kernel.org/r/CO1PR17MB5419C2BF44D400E4E620C1ADE1172@CO1PR17MB5419.namprd17.prod.outlook.com
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/usb/gadget/function/u_audio.c | 19 +++++++++----------
- 1 file changed, 9 insertions(+), 10 deletions(-)
-
-diff --git a/drivers/usb/gadget/function/u_audio.c b/drivers/usb/gadget/function/u_audio.c
-index 4a42574b4a7fe..c8e8154c59f50 100644
---- a/drivers/usb/gadget/function/u_audio.c
-+++ b/drivers/usb/gadget/function/u_audio.c
-@@ -57,13 +57,13 @@ struct uac_rtd_params {
-
- /* Volume/Mute controls and their state */
- int fu_id; /* Feature Unit ID */
-- struct snd_kcontrol *snd_kctl_volume;
-- struct snd_kcontrol *snd_kctl_mute;
-+ struct snd_ctl_elem_id snd_kctl_volume_id;
-+ struct snd_ctl_elem_id snd_kctl_mute_id;
- s16 volume_min, volume_max, volume_res;
- s16 volume;
- int mute;
-
-- struct snd_kcontrol *snd_kctl_rate; /* read-only current rate */
-+ struct snd_ctl_elem_id snd_kctl_rate_id; /* read-only current rate */
- int srate; /* selected samplerate */
- int active; /* playback/capture running */
-
-@@ -494,14 +494,13 @@ static inline void free_ep_fback(struct uac_rtd_params *prm, struct usb_ep *ep)
- static void set_active(struct uac_rtd_params *prm, bool active)
- {
- // notifying through the Rate ctrl
-- struct snd_kcontrol *kctl = prm->snd_kctl_rate;
- unsigned long flags;
-
- spin_lock_irqsave(&prm->lock, flags);
- if (prm->active != active) {
- prm->active = active;
- snd_ctl_notify(prm->uac->card, SNDRV_CTL_EVENT_MASK_VALUE,
-- &kctl->id);
-+ &prm->snd_kctl_rate_id);
- }
- spin_unlock_irqrestore(&prm->lock, flags);
- }
-@@ -807,7 +806,7 @@ int u_audio_set_volume(struct g_audio *audio_dev, int playback, s16 val)
-
- if (change)
- snd_ctl_notify(uac->card, SNDRV_CTL_EVENT_MASK_VALUE,
-- &prm->snd_kctl_volume->id);
-+ &prm->snd_kctl_volume_id);
-
- return 0;
- }
-@@ -856,7 +855,7 @@ int u_audio_set_mute(struct g_audio *audio_dev, int playback, int val)
-
- if (change)
- snd_ctl_notify(uac->card, SNDRV_CTL_EVENT_MASK_VALUE,
-- &prm->snd_kctl_mute->id);
-+ &prm->snd_kctl_mute_id);
-
- return 0;
- }
-@@ -1331,7 +1330,7 @@ int g_audio_setup(struct g_audio *g_audio, const char *pcm_name,
- err = snd_ctl_add(card, kctl);
- if (err < 0)
- goto snd_fail;
-- prm->snd_kctl_mute = kctl;
-+ prm->snd_kctl_mute_id = kctl->id;
- prm->mute = 0;
- }
-
-@@ -1359,7 +1358,7 @@ int g_audio_setup(struct g_audio *g_audio, const char *pcm_name,
- err = snd_ctl_add(card, kctl);
- if (err < 0)
- goto snd_fail;
-- prm->snd_kctl_volume = kctl;
-+ prm->snd_kctl_volume_id = kctl->id;
- prm->volume = fu->volume_max;
- prm->volume_max = fu->volume_max;
- prm->volume_min = fu->volume_min;
-@@ -1383,7 +1382,7 @@ int g_audio_setup(struct g_audio *g_audio, const char *pcm_name,
- err = snd_ctl_add(card, kctl);
- if (err < 0)
- goto snd_fail;
-- prm->snd_kctl_rate = kctl;
-+ prm->snd_kctl_rate_id = kctl->id;
- }
-
- strscpy(card->driver, card_name, sizeof(card->driver));
---
-2.43.0
-
+++ /dev/null
-From 9e23c733a7be02e7959b01bc4540baa3e7e340fa Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 18 Apr 2024 16:57:29 +0200
-Subject: usb: typec: qcom-pmic: fix use-after-free on late probe errors
-
-From: Johan Hovold <johan+linaro@kernel.org>
-
-[ Upstream commit d80eee97cb4e90768a81c856ac71d721996d86b7 ]
-
-Make sure to stop and deregister the port in case of late probe errors
-to avoid use-after-free issues when the underlying memory is released by
-devres.
-
-Fixes: a4422ff22142 ("usb: typec: qcom: Add Qualcomm PMIC Type-C driver")
-Cc: stable@vger.kernel.org # 6.5
-Cc: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
-Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
-Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
-Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
-Link: https://lore.kernel.org/r/20240418145730.4605-2-johan+linaro@kernel.org
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 8 ++++++--
- 1 file changed, 6 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
-index 82e3f59ea471b..ee3557e0becab 100644
---- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
-+++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
-@@ -94,14 +94,18 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev)
-
- ret = tcpm->port_start(tcpm, tcpm->tcpm_port);
- if (ret)
-- goto fwnode_remove;
-+ goto port_unregister;
-
- ret = tcpm->pdphy_start(tcpm, tcpm->tcpm_port);
- if (ret)
-- goto fwnode_remove;
-+ goto port_stop;
-
- return 0;
-
-+port_stop:
-+ tcpm->port_stop(tcpm);
-+port_unregister:
-+ tcpm_unregister_port(tcpm->tcpm_port);
- fwnode_remove:
- fwnode_remove_software_node(tcpm->tcpc.fwnode);
-
---
-2.43.0
-
+++ /dev/null
-From b4f110eeff8a779b915b28649796caafcdf67f6b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 13 Jan 2024 22:55:50 +0200
-Subject: usb: typec: qcom-pmic-typec: allow different implementations for the
- PD PHY
-
-From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-
-[ Upstream commit d2f9b93de0fe71b5040be391afd3d065ab113fb7 ]
-
-Rework Qualcomm PMIC TCPM driver to allow different platform-specific
-implementations of the PD PHY interface. While majority of platforms
-has the same of register for the PD PHY, some obscure ones (PMI632) do
-not have real PD PHY support. Add proper interface between the main
-module and the PD PHY backend to allow switching the PD PHY
-implementation.
-
-Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
-Acked-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
-Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-Link: https://lore.kernel.org/r/20240113-pmi632-typec-v2-7-182d9aa0a5b3@linaro.org
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Stable-dep-of: d80eee97cb4e ("usb: typec: qcom-pmic: fix use-after-free on late probe errors")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 91 +----------
- drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.h | 25 +++
- .../typec/tcpm/qcom/qcom_pmic_typec_pdphy.c | 153 +++++++++++++++---
- .../typec/tcpm/qcom/qcom_pmic_typec_pdphy.h | 93 +----------
- .../typec/tcpm/qcom/qcom_pmic_typec_port.h | 4 +-
- 5 files changed, 171 insertions(+), 195 deletions(-)
- create mode 100644 drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.h
-
-diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
-index a243648abb4a5..4c7c38c58a026 100644
---- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
-+++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
-@@ -20,26 +20,15 @@
-
- #include <drm/bridge/aux-bridge.h>
-
-+#include "qcom_pmic_typec.h"
- #include "qcom_pmic_typec_pdphy.h"
- #include "qcom_pmic_typec_port.h"
-
- struct pmic_typec_resources {
-- struct pmic_typec_pdphy_resources *pdphy_res;
-+ const struct pmic_typec_pdphy_resources *pdphy_res;
- struct pmic_typec_port_resources *port_res;
- };
-
--struct pmic_typec {
-- struct device *dev;
-- struct tcpm_port *tcpm_port;
-- struct tcpc_dev tcpc;
-- struct pmic_typec_pdphy *pmic_typec_pdphy;
-- struct pmic_typec_port *pmic_typec_port;
-- bool vbus_enabled;
-- struct mutex lock; /* VBUS state serialization */
--};
--
--#define tcpc_to_tcpm(_tcpc_) container_of(_tcpc_, struct pmic_typec, tcpc)
--
- static int qcom_pmic_typec_get_vbus(struct tcpc_dev *tcpc)
- {
- struct pmic_typec *tcpm = tcpc_to_tcpm(tcpc);
-@@ -116,34 +105,6 @@ static int qcom_pmic_typec_start_toggling(struct tcpc_dev *tcpc,
- port_type, cc);
- }
-
--static int qcom_pmic_typec_set_roles(struct tcpc_dev *tcpc, bool attached,
-- enum typec_role power_role,
-- enum typec_data_role data_role)
--{
-- struct pmic_typec *tcpm = tcpc_to_tcpm(tcpc);
--
-- return qcom_pmic_typec_pdphy_set_roles(tcpm->pmic_typec_pdphy,
-- power_role, data_role);
--}
--
--static int qcom_pmic_typec_set_pd_rx(struct tcpc_dev *tcpc, bool on)
--{
-- struct pmic_typec *tcpm = tcpc_to_tcpm(tcpc);
--
-- return qcom_pmic_typec_pdphy_set_pd_rx(tcpm->pmic_typec_pdphy, on);
--}
--
--static int qcom_pmic_typec_pd_transmit(struct tcpc_dev *tcpc,
-- enum tcpm_transmit_type type,
-- const struct pd_message *msg,
-- unsigned int negotiated_rev)
--{
-- struct pmic_typec *tcpm = tcpc_to_tcpm(tcpc);
--
-- return qcom_pmic_typec_pdphy_pd_transmit(tcpm->pmic_typec_pdphy, type,
-- msg, negotiated_rev);
--}
--
- static int qcom_pmic_typec_init(struct tcpc_dev *tcpc)
- {
- return 0;
-@@ -177,9 +138,6 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev)
- tcpm->tcpc.set_polarity = qcom_pmic_typec_set_polarity;
- tcpm->tcpc.set_vconn = qcom_pmic_typec_set_vconn;
- tcpm->tcpc.start_toggling = qcom_pmic_typec_start_toggling;
-- tcpm->tcpc.set_pd_rx = qcom_pmic_typec_set_pd_rx;
-- tcpm->tcpc.set_roles = qcom_pmic_typec_set_roles;
-- tcpm->tcpc.pd_transmit = qcom_pmic_typec_pd_transmit;
-
- regmap = dev_get_regmap(dev->parent, NULL);
- if (!regmap) {
-@@ -195,16 +153,12 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev)
- if (IS_ERR(tcpm->pmic_typec_port))
- return PTR_ERR(tcpm->pmic_typec_port);
-
-- tcpm->pmic_typec_pdphy = qcom_pmic_typec_pdphy_alloc(dev);
-- if (IS_ERR(tcpm->pmic_typec_pdphy))
-- return PTR_ERR(tcpm->pmic_typec_pdphy);
--
- ret = qcom_pmic_typec_port_probe(pdev, tcpm->pmic_typec_port,
- res->port_res, regmap, base[0]);
- if (ret)
- return ret;
-
-- ret = qcom_pmic_typec_pdphy_probe(pdev, tcpm->pmic_typec_pdphy,
-+ ret = qcom_pmic_typec_pdphy_probe(pdev, tcpm,
- res->pdphy_res, regmap, base[1]);
- if (ret)
- return ret;
-@@ -231,8 +185,7 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev)
- if (ret)
- goto fwnode_remove;
-
-- ret = qcom_pmic_typec_pdphy_start(tcpm->pmic_typec_pdphy,
-- tcpm->tcpm_port);
-+ ret = tcpm->pdphy_start(tcpm, tcpm->tcpm_port);
- if (ret)
- goto fwnode_remove;
-
-@@ -248,46 +201,12 @@ static void qcom_pmic_typec_remove(struct platform_device *pdev)
- {
- struct pmic_typec *tcpm = platform_get_drvdata(pdev);
-
-- qcom_pmic_typec_pdphy_stop(tcpm->pmic_typec_pdphy);
-+ tcpm->pdphy_stop(tcpm);
- qcom_pmic_typec_port_stop(tcpm->pmic_typec_port);
- tcpm_unregister_port(tcpm->tcpm_port);
- fwnode_remove_software_node(tcpm->tcpc.fwnode);
- }
-
--static struct pmic_typec_pdphy_resources pm8150b_pdphy_res = {
-- .irq_params = {
-- {
-- .virq = PMIC_PDPHY_SIG_TX_IRQ,
-- .irq_name = "sig-tx",
-- },
-- {
-- .virq = PMIC_PDPHY_SIG_RX_IRQ,
-- .irq_name = "sig-rx",
-- },
-- {
-- .virq = PMIC_PDPHY_MSG_TX_IRQ,
-- .irq_name = "msg-tx",
-- },
-- {
-- .virq = PMIC_PDPHY_MSG_RX_IRQ,
-- .irq_name = "msg-rx",
-- },
-- {
-- .virq = PMIC_PDPHY_MSG_TX_FAIL_IRQ,
-- .irq_name = "msg-tx-failed",
-- },
-- {
-- .virq = PMIC_PDPHY_MSG_TX_DISCARD_IRQ,
-- .irq_name = "msg-tx-discarded",
-- },
-- {
-- .virq = PMIC_PDPHY_MSG_RX_DISCARD_IRQ,
-- .irq_name = "msg-rx-discarded",
-- },
-- },
-- .nr_irqs = 7,
--};
--
- static struct pmic_typec_port_resources pm8150b_port_res = {
- .irq_params = {
- {
-diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.h b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.h
-new file mode 100644
-index 0000000000000..da035916c12a0
---- /dev/null
-+++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.h
-@@ -0,0 +1,25 @@
-+// SPDX-License-Identifier: GPL-2.0
-+/*
-+ * Copyright (c) 2023, Linaro Ltd. All rights reserved.
-+ */
-+
-+#ifndef __QCOM_PMIC_TYPEC_H__
-+#define __QCOM_PMIC_TYPEC_H__
-+
-+struct pmic_typec {
-+ struct device *dev;
-+ struct tcpm_port *tcpm_port;
-+ struct tcpc_dev tcpc;
-+ struct pmic_typec_pdphy *pmic_typec_pdphy;
-+ struct pmic_typec_port *pmic_typec_port;
-+ bool vbus_enabled;
-+ struct mutex lock; /* VBUS state serialization */
-+
-+ int (*pdphy_start)(struct pmic_typec *tcpm,
-+ struct tcpm_port *tcpm_port);
-+ void (*pdphy_stop)(struct pmic_typec *tcpm);
-+};
-+
-+#define tcpc_to_tcpm(_tcpc_) container_of(_tcpc_, struct pmic_typec, tcpc)
-+
-+#endif
-diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c
-index 44d8342ed0ad5..984d90b0d7636 100644
---- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c
-+++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c
-@@ -14,8 +14,74 @@
- #include <linux/slab.h>
- #include <linux/usb/pd.h>
- #include <linux/usb/tcpm.h>
-+#include "qcom_pmic_typec.h"
- #include "qcom_pmic_typec_pdphy.h"
-
-+/* PD PHY register offsets and bit fields */
-+#define USB_PDPHY_MSG_CONFIG_REG 0x40
-+#define MSG_CONFIG_PORT_DATA_ROLE BIT(3)
-+#define MSG_CONFIG_PORT_POWER_ROLE BIT(2)
-+#define MSG_CONFIG_SPEC_REV_MASK (BIT(1) | BIT(0))
-+
-+#define USB_PDPHY_EN_CONTROL_REG 0x46
-+#define CONTROL_ENABLE BIT(0)
-+
-+#define USB_PDPHY_RX_STATUS_REG 0x4A
-+#define RX_FRAME_TYPE (BIT(0) | BIT(1) | BIT(2))
-+
-+#define USB_PDPHY_FRAME_FILTER_REG 0x4C
-+#define FRAME_FILTER_EN_HARD_RESET BIT(5)
-+#define FRAME_FILTER_EN_SOP BIT(0)
-+
-+#define USB_PDPHY_TX_SIZE_REG 0x42
-+#define TX_SIZE_MASK 0xF
-+
-+#define USB_PDPHY_TX_CONTROL_REG 0x44
-+#define TX_CONTROL_RETRY_COUNT(n) (((n) & 0x3) << 5)
-+#define TX_CONTROL_FRAME_TYPE(n) (((n) & 0x7) << 2)
-+#define TX_CONTROL_FRAME_TYPE_CABLE_RESET (0x1 << 2)
-+#define TX_CONTROL_SEND_SIGNAL BIT(1)
-+#define TX_CONTROL_SEND_MSG BIT(0)
-+
-+#define USB_PDPHY_RX_SIZE_REG 0x48
-+
-+#define USB_PDPHY_RX_ACKNOWLEDGE_REG 0x4B
-+#define RX_BUFFER_TOKEN BIT(0)
-+
-+#define USB_PDPHY_BIST_MODE_REG 0x4E
-+#define BIST_MODE_MASK 0xF
-+#define BIST_ENABLE BIT(7)
-+#define PD_MSG_BIST 0x3
-+#define PD_BIST_TEST_DATA_MODE 0x8
-+
-+#define USB_PDPHY_TX_BUFFER_HDR_REG 0x60
-+#define USB_PDPHY_TX_BUFFER_DATA_REG 0x62
-+
-+#define USB_PDPHY_RX_BUFFER_REG 0x80
-+
-+/* VDD regulator */
-+#define VDD_PDPHY_VOL_MIN 2800000 /* uV */
-+#define VDD_PDPHY_VOL_MAX 3300000 /* uV */
-+#define VDD_PDPHY_HPM_LOAD 3000 /* uA */
-+
-+/* Message Spec Rev field */
-+#define PD_MSG_HDR_REV(hdr) (((hdr) >> 6) & 3)
-+
-+/* timers */
-+#define RECEIVER_RESPONSE_TIME 15 /* tReceiverResponse */
-+#define HARD_RESET_COMPLETE_TIME 5 /* tHardResetComplete */
-+
-+/* Interrupt numbers */
-+#define PMIC_PDPHY_SIG_TX_IRQ 0x0
-+#define PMIC_PDPHY_SIG_RX_IRQ 0x1
-+#define PMIC_PDPHY_MSG_TX_IRQ 0x2
-+#define PMIC_PDPHY_MSG_RX_IRQ 0x3
-+#define PMIC_PDPHY_MSG_TX_FAIL_IRQ 0x4
-+#define PMIC_PDPHY_MSG_TX_DISCARD_IRQ 0x5
-+#define PMIC_PDPHY_MSG_RX_DISCARD_IRQ 0x6
-+#define PMIC_PDPHY_FR_SWAP_IRQ 0x7
-+
-+
- struct pmic_typec_pdphy_irq_data {
- int virq;
- int irq;
-@@ -231,11 +297,13 @@ qcom_pmic_typec_pdphy_pd_transmit_payload(struct pmic_typec_pdphy *pmic_typec_pd
- return ret;
- }
-
--int qcom_pmic_typec_pdphy_pd_transmit(struct pmic_typec_pdphy *pmic_typec_pdphy,
-- enum tcpm_transmit_type type,
-- const struct pd_message *msg,
-- unsigned int negotiated_rev)
-+static int qcom_pmic_typec_pdphy_pd_transmit(struct tcpc_dev *tcpc,
-+ enum tcpm_transmit_type type,
-+ const struct pd_message *msg,
-+ unsigned int negotiated_rev)
- {
-+ struct pmic_typec *tcpm = tcpc_to_tcpm(tcpc);
-+ struct pmic_typec_pdphy *pmic_typec_pdphy = tcpm->pmic_typec_pdphy;
- struct device *dev = pmic_typec_pdphy->dev;
- int ret;
-
-@@ -336,8 +404,10 @@ static irqreturn_t qcom_pmic_typec_pdphy_isr(int irq, void *dev_id)
- return IRQ_HANDLED;
- }
-
--int qcom_pmic_typec_pdphy_set_pd_rx(struct pmic_typec_pdphy *pmic_typec_pdphy, bool on)
-+static int qcom_pmic_typec_pdphy_set_pd_rx(struct tcpc_dev *tcpc, bool on)
- {
-+ struct pmic_typec *tcpm = tcpc_to_tcpm(tcpc);
-+ struct pmic_typec_pdphy *pmic_typec_pdphy = tcpm->pmic_typec_pdphy;
- unsigned long flags;
- int ret;
-
-@@ -353,10 +423,12 @@ int qcom_pmic_typec_pdphy_set_pd_rx(struct pmic_typec_pdphy *pmic_typec_pdphy, b
- return ret;
- }
-
--int qcom_pmic_typec_pdphy_set_roles(struct pmic_typec_pdphy *pmic_typec_pdphy,
-- enum typec_role power_role,
-- enum typec_data_role data_role)
-+static int qcom_pmic_typec_pdphy_set_roles(struct tcpc_dev *tcpc, bool attached,
-+ enum typec_role power_role,
-+ enum typec_data_role data_role)
- {
-+ struct pmic_typec *tcpm = tcpc_to_tcpm(tcpc);
-+ struct pmic_typec_pdphy *pmic_typec_pdphy = tcpm->pmic_typec_pdphy;
- struct device *dev = pmic_typec_pdphy->dev;
- unsigned long flags;
- int ret;
-@@ -437,9 +509,10 @@ static int pmic_typec_pdphy_reset(struct pmic_typec_pdphy *pmic_typec_pdphy)
- return ret;
- }
-
--int qcom_pmic_typec_pdphy_start(struct pmic_typec_pdphy *pmic_typec_pdphy,
-- struct tcpm_port *tcpm_port)
-+static int qcom_pmic_typec_pdphy_start(struct pmic_typec *tcpm,
-+ struct tcpm_port *tcpm_port)
- {
-+ struct pmic_typec_pdphy *pmic_typec_pdphy = tcpm->pmic_typec_pdphy;
- int i;
- int ret;
-
-@@ -459,8 +532,9 @@ int qcom_pmic_typec_pdphy_start(struct pmic_typec_pdphy *pmic_typec_pdphy,
- return 0;
- }
-
--void qcom_pmic_typec_pdphy_stop(struct pmic_typec_pdphy *pmic_typec_pdphy)
-+static void qcom_pmic_typec_pdphy_stop(struct pmic_typec *tcpm)
- {
-+ struct pmic_typec_pdphy *pmic_typec_pdphy = tcpm->pmic_typec_pdphy;
- int i;
-
- for (i = 0; i < pmic_typec_pdphy->nr_irqs; i++)
-@@ -471,21 +545,21 @@ void qcom_pmic_typec_pdphy_stop(struct pmic_typec_pdphy *pmic_typec_pdphy)
- regulator_disable(pmic_typec_pdphy->vdd_pdphy);
- }
-
--struct pmic_typec_pdphy *qcom_pmic_typec_pdphy_alloc(struct device *dev)
--{
-- return devm_kzalloc(dev, sizeof(struct pmic_typec_pdphy), GFP_KERNEL);
--}
--
- int qcom_pmic_typec_pdphy_probe(struct platform_device *pdev,
-- struct pmic_typec_pdphy *pmic_typec_pdphy,
-- struct pmic_typec_pdphy_resources *res,
-+ struct pmic_typec *tcpm,
-+ const struct pmic_typec_pdphy_resources *res,
- struct regmap *regmap,
- u32 base)
- {
-+ struct pmic_typec_pdphy *pmic_typec_pdphy;
- struct device *dev = &pdev->dev;
- struct pmic_typec_pdphy_irq_data *irq_data;
- int i, ret, irq;
-
-+ pmic_typec_pdphy = devm_kzalloc(dev, sizeof(*pmic_typec_pdphy), GFP_KERNEL);
-+ if (!pmic_typec_pdphy)
-+ return -ENOMEM;
-+
- if (!res->nr_irqs || res->nr_irqs > PMIC_PDPHY_MAX_IRQS)
- return -EINVAL;
-
-@@ -524,5 +598,48 @@ int qcom_pmic_typec_pdphy_probe(struct platform_device *pdev,
- return ret;
- }
-
-+ tcpm->pmic_typec_pdphy = pmic_typec_pdphy;
-+
-+ tcpm->tcpc.set_pd_rx = qcom_pmic_typec_pdphy_set_pd_rx;
-+ tcpm->tcpc.set_roles = qcom_pmic_typec_pdphy_set_roles;
-+ tcpm->tcpc.pd_transmit = qcom_pmic_typec_pdphy_pd_transmit;
-+
-+ tcpm->pdphy_start = qcom_pmic_typec_pdphy_start;
-+ tcpm->pdphy_stop = qcom_pmic_typec_pdphy_stop;
-+
- return 0;
- }
-+
-+const struct pmic_typec_pdphy_resources pm8150b_pdphy_res = {
-+ .irq_params = {
-+ {
-+ .virq = PMIC_PDPHY_SIG_TX_IRQ,
-+ .irq_name = "sig-tx",
-+ },
-+ {
-+ .virq = PMIC_PDPHY_SIG_RX_IRQ,
-+ .irq_name = "sig-rx",
-+ },
-+ {
-+ .virq = PMIC_PDPHY_MSG_TX_IRQ,
-+ .irq_name = "msg-tx",
-+ },
-+ {
-+ .virq = PMIC_PDPHY_MSG_RX_IRQ,
-+ .irq_name = "msg-rx",
-+ },
-+ {
-+ .virq = PMIC_PDPHY_MSG_TX_FAIL_IRQ,
-+ .irq_name = "msg-tx-failed",
-+ },
-+ {
-+ .virq = PMIC_PDPHY_MSG_TX_DISCARD_IRQ,
-+ .irq_name = "msg-tx-discarded",
-+ },
-+ {
-+ .virq = PMIC_PDPHY_MSG_RX_DISCARD_IRQ,
-+ .irq_name = "msg-rx-discarded",
-+ },
-+ },
-+ .nr_irqs = 7,
-+};
-diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.h b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.h
-index 070822dc6f177..5f428e67ccfe2 100644
---- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.h
-+++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.h
-@@ -8,74 +8,6 @@
-
- #include <linux/platform_device.h>
- #include <linux/regmap.h>
--#include <linux/usb/tcpm.h>
--
--#define USB_PDPHY_MAX_DATA_OBJ_LEN 28
--#define USB_PDPHY_MSG_HDR_LEN 2
--
--/* PD PHY register offsets and bit fields */
--#define USB_PDPHY_MSG_CONFIG_REG 0x40
--#define MSG_CONFIG_PORT_DATA_ROLE BIT(3)
--#define MSG_CONFIG_PORT_POWER_ROLE BIT(2)
--#define MSG_CONFIG_SPEC_REV_MASK (BIT(1) | BIT(0))
--
--#define USB_PDPHY_EN_CONTROL_REG 0x46
--#define CONTROL_ENABLE BIT(0)
--
--#define USB_PDPHY_RX_STATUS_REG 0x4A
--#define RX_FRAME_TYPE (BIT(0) | BIT(1) | BIT(2))
--
--#define USB_PDPHY_FRAME_FILTER_REG 0x4C
--#define FRAME_FILTER_EN_HARD_RESET BIT(5)
--#define FRAME_FILTER_EN_SOP BIT(0)
--
--#define USB_PDPHY_TX_SIZE_REG 0x42
--#define TX_SIZE_MASK 0xF
--
--#define USB_PDPHY_TX_CONTROL_REG 0x44
--#define TX_CONTROL_RETRY_COUNT(n) (((n) & 0x3) << 5)
--#define TX_CONTROL_FRAME_TYPE(n) (((n) & 0x7) << 2)
--#define TX_CONTROL_FRAME_TYPE_CABLE_RESET (0x1 << 2)
--#define TX_CONTROL_SEND_SIGNAL BIT(1)
--#define TX_CONTROL_SEND_MSG BIT(0)
--
--#define USB_PDPHY_RX_SIZE_REG 0x48
--
--#define USB_PDPHY_RX_ACKNOWLEDGE_REG 0x4B
--#define RX_BUFFER_TOKEN BIT(0)
--
--#define USB_PDPHY_BIST_MODE_REG 0x4E
--#define BIST_MODE_MASK 0xF
--#define BIST_ENABLE BIT(7)
--#define PD_MSG_BIST 0x3
--#define PD_BIST_TEST_DATA_MODE 0x8
--
--#define USB_PDPHY_TX_BUFFER_HDR_REG 0x60
--#define USB_PDPHY_TX_BUFFER_DATA_REG 0x62
--
--#define USB_PDPHY_RX_BUFFER_REG 0x80
--
--/* VDD regulator */
--#define VDD_PDPHY_VOL_MIN 2800000 /* uV */
--#define VDD_PDPHY_VOL_MAX 3300000 /* uV */
--#define VDD_PDPHY_HPM_LOAD 3000 /* uA */
--
--/* Message Spec Rev field */
--#define PD_MSG_HDR_REV(hdr) (((hdr) >> 6) & 3)
--
--/* timers */
--#define RECEIVER_RESPONSE_TIME 15 /* tReceiverResponse */
--#define HARD_RESET_COMPLETE_TIME 5 /* tHardResetComplete */
--
--/* Interrupt numbers */
--#define PMIC_PDPHY_SIG_TX_IRQ 0x0
--#define PMIC_PDPHY_SIG_RX_IRQ 0x1
--#define PMIC_PDPHY_MSG_TX_IRQ 0x2
--#define PMIC_PDPHY_MSG_RX_IRQ 0x3
--#define PMIC_PDPHY_MSG_TX_FAIL_IRQ 0x4
--#define PMIC_PDPHY_MSG_TX_DISCARD_IRQ 0x5
--#define PMIC_PDPHY_MSG_RX_DISCARD_IRQ 0x6
--#define PMIC_PDPHY_FR_SWAP_IRQ 0x7
-
- /* Resources */
- #define PMIC_PDPHY_MAX_IRQS 0x08
-@@ -87,34 +19,17 @@ struct pmic_typec_pdphy_irq_params {
-
- struct pmic_typec_pdphy_resources {
- unsigned int nr_irqs;
-- struct pmic_typec_pdphy_irq_params irq_params[PMIC_PDPHY_MAX_IRQS];
-+ const struct pmic_typec_pdphy_irq_params irq_params[PMIC_PDPHY_MAX_IRQS];
- };
-
- /* API */
- struct pmic_typec_pdphy;
-
--struct pmic_typec_pdphy *qcom_pmic_typec_pdphy_alloc(struct device *dev);
--
-+extern const struct pmic_typec_pdphy_resources pm8150b_pdphy_res;
- int qcom_pmic_typec_pdphy_probe(struct platform_device *pdev,
-- struct pmic_typec_pdphy *pmic_typec_pdphy,
-- struct pmic_typec_pdphy_resources *res,
-+ struct pmic_typec *tcpm,
-+ const struct pmic_typec_pdphy_resources *res,
- struct regmap *regmap,
- u32 base);
-
--int qcom_pmic_typec_pdphy_start(struct pmic_typec_pdphy *pmic_typec_pdphy,
-- struct tcpm_port *tcpm_port);
--
--void qcom_pmic_typec_pdphy_stop(struct pmic_typec_pdphy *pmic_typec_pdphy);
--
--int qcom_pmic_typec_pdphy_set_roles(struct pmic_typec_pdphy *pmic_typec_pdphy,
-- enum typec_role power_role,
-- enum typec_data_role data_role);
--
--int qcom_pmic_typec_pdphy_set_pd_rx(struct pmic_typec_pdphy *pmic_typec_pdphy, bool on);
--
--int qcom_pmic_typec_pdphy_pd_transmit(struct pmic_typec_pdphy *pmic_typec_pdphy,
-- enum tcpm_transmit_type type,
-- const struct pd_message *msg,
-- unsigned int negotiated_rev);
--
- #endif /* __QCOM_PMIC_TYPEC_PDPHY_H__ */
-diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.h b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.h
-index d4d358c680b6b..4a892048908e7 100644
---- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.h
-+++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.h
-@@ -3,8 +3,8 @@
- * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
- * Copyright (c) 2023, Linaro Ltd. All rights reserved.
- */
--#ifndef __QCOM_PMIC_TYPEC_H__
--#define __QCOM_PMIC_TYPEC_H__
-+#ifndef __QCOM_PMIC_TYPEC_PORT_H__
-+#define __QCOM_PMIC_TYPEC_PORT_H__
-
- #include <linux/platform_device.h>
- #include <linux/usb/tcpm.h>
---
-2.43.0
-
+++ /dev/null
-From 368ddbdd39bfd1fbf4a8b5efddf355f99ab8939b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 13 Jan 2024 22:55:51 +0200
-Subject: usb: typec: qcom-pmic-typec: allow different implementations for the
- port backend
-
-From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-
-[ Upstream commit f1a27f081c1fa1eeebf38406e45f29636114470f ]
-
-Follow the PD PHY changes and rework Type-C port implementation to
-become an encapsulated backend. While this is not required for the
-PMI632, it will us later to enable Type-C handling on earlier platforms,
-including, but not limited to SDM845, SDM660 and MSM8998.
-
-Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
-Acked-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
-Link: https://lore.kernel.org/r/20240113-pmi632-typec-v2-8-182d9aa0a5b3@linaro.org
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Stable-dep-of: d80eee97cb4e ("usb: typec: qcom-pmic: fix use-after-free on late probe errors")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 137 +--------
- drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.h | 6 +-
- .../typec/tcpm/qcom/qcom_pmic_typec_port.c | 290 ++++++++++++++++--
- .../typec/tcpm/qcom/qcom_pmic_typec_port.h | 168 +---------
- 4 files changed, 282 insertions(+), 319 deletions(-)
-
-diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
-index 4c7c38c58a026..82e3f59ea471b 100644
---- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
-+++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
-@@ -26,85 +26,9 @@
-
- struct pmic_typec_resources {
- const struct pmic_typec_pdphy_resources *pdphy_res;
-- struct pmic_typec_port_resources *port_res;
-+ const struct pmic_typec_port_resources *port_res;
- };
-
--static int qcom_pmic_typec_get_vbus(struct tcpc_dev *tcpc)
--{
-- struct pmic_typec *tcpm = tcpc_to_tcpm(tcpc);
-- int ret;
--
-- mutex_lock(&tcpm->lock);
-- ret = tcpm->vbus_enabled || qcom_pmic_typec_port_get_vbus(tcpm->pmic_typec_port);
-- mutex_unlock(&tcpm->lock);
--
-- return ret;
--}
--
--static int qcom_pmic_typec_set_vbus(struct tcpc_dev *tcpc, bool on, bool sink)
--{
-- struct pmic_typec *tcpm = tcpc_to_tcpm(tcpc);
-- int ret = 0;
--
-- mutex_lock(&tcpm->lock);
-- if (tcpm->vbus_enabled == on)
-- goto done;
--
-- ret = qcom_pmic_typec_port_set_vbus(tcpm->pmic_typec_port, on);
-- if (ret)
-- goto done;
--
-- tcpm->vbus_enabled = on;
-- tcpm_vbus_change(tcpm->tcpm_port);
--
--done:
-- dev_dbg(tcpm->dev, "set_vbus set: %d result %d\n", on, ret);
-- mutex_unlock(&tcpm->lock);
--
-- return ret;
--}
--
--static int qcom_pmic_typec_set_vconn(struct tcpc_dev *tcpc, bool on)
--{
-- struct pmic_typec *tcpm = tcpc_to_tcpm(tcpc);
--
-- return qcom_pmic_typec_port_set_vconn(tcpm->pmic_typec_port, on);
--}
--
--static int qcom_pmic_typec_get_cc(struct tcpc_dev *tcpc,
-- enum typec_cc_status *cc1,
-- enum typec_cc_status *cc2)
--{
-- struct pmic_typec *tcpm = tcpc_to_tcpm(tcpc);
--
-- return qcom_pmic_typec_port_get_cc(tcpm->pmic_typec_port, cc1, cc2);
--}
--
--static int qcom_pmic_typec_set_cc(struct tcpc_dev *tcpc,
-- enum typec_cc_status cc)
--{
-- struct pmic_typec *tcpm = tcpc_to_tcpm(tcpc);
--
-- return qcom_pmic_typec_port_set_cc(tcpm->pmic_typec_port, cc);
--}
--
--static int qcom_pmic_typec_set_polarity(struct tcpc_dev *tcpc,
-- enum typec_cc_polarity pol)
--{
-- /* Polarity is set separately by phy-qcom-qmp.c */
-- return 0;
--}
--
--static int qcom_pmic_typec_start_toggling(struct tcpc_dev *tcpc,
-- enum typec_port_type port_type,
-- enum typec_cc_status cc)
--{
-- struct pmic_typec *tcpm = tcpc_to_tcpm(tcpc);
--
-- return qcom_pmic_typec_port_start_toggling(tcpm->pmic_typec_port,
-- port_type, cc);
--}
--
- static int qcom_pmic_typec_init(struct tcpc_dev *tcpc)
- {
- return 0;
-@@ -131,13 +55,6 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev)
-
- tcpm->dev = dev;
- tcpm->tcpc.init = qcom_pmic_typec_init;
-- tcpm->tcpc.get_vbus = qcom_pmic_typec_get_vbus;
-- tcpm->tcpc.set_vbus = qcom_pmic_typec_set_vbus;
-- tcpm->tcpc.set_cc = qcom_pmic_typec_set_cc;
-- tcpm->tcpc.get_cc = qcom_pmic_typec_get_cc;
-- tcpm->tcpc.set_polarity = qcom_pmic_typec_set_polarity;
-- tcpm->tcpc.set_vconn = qcom_pmic_typec_set_vconn;
-- tcpm->tcpc.start_toggling = qcom_pmic_typec_start_toggling;
-
- regmap = dev_get_regmap(dev->parent, NULL);
- if (!regmap) {
-@@ -149,11 +66,7 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev)
- if (ret)
- return ret;
-
-- tcpm->pmic_typec_port = qcom_pmic_typec_port_alloc(dev);
-- if (IS_ERR(tcpm->pmic_typec_port))
-- return PTR_ERR(tcpm->pmic_typec_port);
--
-- ret = qcom_pmic_typec_port_probe(pdev, tcpm->pmic_typec_port,
-+ ret = qcom_pmic_typec_port_probe(pdev, tcpm,
- res->port_res, regmap, base[0]);
- if (ret)
- return ret;
-@@ -163,7 +76,6 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev)
- if (ret)
- return ret;
-
-- mutex_init(&tcpm->lock);
- platform_set_drvdata(pdev, tcpm);
-
- tcpm->tcpc.fwnode = device_get_named_child_node(tcpm->dev, "connector");
-@@ -180,8 +92,7 @@ static int qcom_pmic_typec_probe(struct platform_device *pdev)
- goto fwnode_remove;
- }
-
-- ret = qcom_pmic_typec_port_start(tcpm->pmic_typec_port,
-- tcpm->tcpm_port);
-+ ret = tcpm->port_start(tcpm, tcpm->tcpm_port);
- if (ret)
- goto fwnode_remove;
-
-@@ -202,50 +113,12 @@ static void qcom_pmic_typec_remove(struct platform_device *pdev)
- struct pmic_typec *tcpm = platform_get_drvdata(pdev);
-
- tcpm->pdphy_stop(tcpm);
-- qcom_pmic_typec_port_stop(tcpm->pmic_typec_port);
-+ tcpm->port_stop(tcpm);
- tcpm_unregister_port(tcpm->tcpm_port);
- fwnode_remove_software_node(tcpm->tcpc.fwnode);
- }
-
--static struct pmic_typec_port_resources pm8150b_port_res = {
-- .irq_params = {
-- {
-- .irq_name = "vpd-detect",
-- .virq = PMIC_TYPEC_VPD_IRQ,
-- },
--
-- {
-- .irq_name = "cc-state-change",
-- .virq = PMIC_TYPEC_CC_STATE_IRQ,
-- },
-- {
-- .irq_name = "vconn-oc",
-- .virq = PMIC_TYPEC_VCONN_OC_IRQ,
-- },
--
-- {
-- .irq_name = "vbus-change",
-- .virq = PMIC_TYPEC_VBUS_IRQ,
-- },
--
-- {
-- .irq_name = "attach-detach",
-- .virq = PMIC_TYPEC_ATTACH_DETACH_IRQ,
-- },
-- {
-- .irq_name = "legacy-cable-detect",
-- .virq = PMIC_TYPEC_LEGACY_CABLE_IRQ,
-- },
--
-- {
-- .irq_name = "try-snk-src-detect",
-- .virq = PMIC_TYPEC_TRY_SNK_SRC_IRQ,
-- },
-- },
-- .nr_irqs = 7,
--};
--
--static struct pmic_typec_resources pm8150b_typec_res = {
-+static const struct pmic_typec_resources pm8150b_typec_res = {
- .pdphy_res = &pm8150b_pdphy_res,
- .port_res = &pm8150b_port_res,
- };
-diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.h b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.h
-index da035916c12a0..3c75820c91876 100644
---- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.h
-+++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.h
-@@ -12,12 +12,14 @@ struct pmic_typec {
- struct tcpc_dev tcpc;
- struct pmic_typec_pdphy *pmic_typec_pdphy;
- struct pmic_typec_port *pmic_typec_port;
-- bool vbus_enabled;
-- struct mutex lock; /* VBUS state serialization */
-
- int (*pdphy_start)(struct pmic_typec *tcpm,
- struct tcpm_port *tcpm_port);
- void (*pdphy_stop)(struct pmic_typec *tcpm);
-+
-+ int (*port_start)(struct pmic_typec *tcpm,
-+ struct tcpm_port *tcpm_port);
-+ void (*port_stop)(struct pmic_typec *tcpm);
- };
-
- #define tcpc_to_tcpm(_tcpc_) container_of(_tcpc_, struct pmic_typec, tcpc)
-diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c
-index a8f3f4d3a4509..a747baa297849 100644
---- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c
-+++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.c
-@@ -16,8 +16,147 @@
- #include <linux/usb/tcpm.h>
- #include <linux/usb/typec_mux.h>
- #include <linux/workqueue.h>
-+
-+#include "qcom_pmic_typec.h"
- #include "qcom_pmic_typec_port.h"
-
-+#define TYPEC_SNK_STATUS_REG 0x06
-+#define DETECTED_SNK_TYPE_MASK GENMASK(6, 0)
-+#define SNK_DAM_MASK GENMASK(6, 4)
-+#define SNK_DAM_500MA BIT(6)
-+#define SNK_DAM_1500MA BIT(5)
-+#define SNK_DAM_3000MA BIT(4)
-+#define SNK_RP_STD BIT(3)
-+#define SNK_RP_1P5 BIT(2)
-+#define SNK_RP_3P0 BIT(1)
-+#define SNK_RP_SHORT BIT(0)
-+
-+#define TYPEC_SRC_STATUS_REG 0x08
-+#define DETECTED_SRC_TYPE_MASK GENMASK(4, 0)
-+#define SRC_HIGH_BATT BIT(5)
-+#define SRC_DEBUG_ACCESS BIT(4)
-+#define SRC_RD_OPEN BIT(3)
-+#define SRC_RD_RA_VCONN BIT(2)
-+#define SRC_RA_OPEN BIT(1)
-+#define AUDIO_ACCESS_RA_RA BIT(0)
-+
-+#define TYPEC_STATE_MACHINE_STATUS_REG 0x09
-+#define TYPEC_ATTACH_DETACH_STATE BIT(5)
-+
-+#define TYPEC_SM_STATUS_REG 0x0A
-+#define TYPEC_SM_VBUS_VSAFE5V BIT(5)
-+#define TYPEC_SM_VBUS_VSAFE0V BIT(6)
-+#define TYPEC_SM_USBIN_LT_LV BIT(7)
-+
-+#define TYPEC_MISC_STATUS_REG 0x0B
-+#define TYPEC_WATER_DETECTION_STATUS BIT(7)
-+#define SNK_SRC_MODE BIT(6)
-+#define TYPEC_VBUS_DETECT BIT(5)
-+#define TYPEC_VBUS_ERROR_STATUS BIT(4)
-+#define TYPEC_DEBOUNCE_DONE BIT(3)
-+#define CC_ORIENTATION BIT(1)
-+#define CC_ATTACHED BIT(0)
-+
-+#define LEGACY_CABLE_STATUS_REG 0x0D
-+#define TYPEC_LEGACY_CABLE_STATUS BIT(1)
-+#define TYPEC_NONCOMP_LEGACY_CABLE_STATUS BIT(0)
-+
-+#define TYPEC_U_USB_STATUS_REG 0x0F
-+#define U_USB_GROUND_NOVBUS BIT(6)
-+#define U_USB_GROUND BIT(4)
-+#define U_USB_FMB1 BIT(3)
-+#define U_USB_FLOAT1 BIT(2)
-+#define U_USB_FMB2 BIT(1)
-+#define U_USB_FLOAT2 BIT(0)
-+
-+#define TYPEC_MODE_CFG_REG 0x44
-+#define TYPEC_TRY_MODE_MASK GENMASK(4, 3)
-+#define EN_TRY_SNK BIT(4)
-+#define EN_TRY_SRC BIT(3)
-+#define TYPEC_POWER_ROLE_CMD_MASK GENMASK(2, 0)
-+#define EN_SRC_ONLY BIT(2)
-+#define EN_SNK_ONLY BIT(1)
-+#define TYPEC_DISABLE_CMD BIT(0)
-+
-+#define TYPEC_VCONN_CONTROL_REG 0x46
-+#define VCONN_EN_ORIENTATION BIT(2)
-+#define VCONN_EN_VALUE BIT(1)
-+#define VCONN_EN_SRC BIT(0)
-+
-+#define TYPEC_CCOUT_CONTROL_REG 0x48
-+#define TYPEC_CCOUT_BUFFER_EN BIT(2)
-+#define TYPEC_CCOUT_VALUE BIT(1)
-+#define TYPEC_CCOUT_SRC BIT(0)
-+
-+#define DEBUG_ACCESS_SRC_CFG_REG 0x4C
-+#define EN_UNORIENTED_DEBUG_ACCESS_SRC BIT(0)
-+
-+#define TYPE_C_CRUDE_SENSOR_CFG_REG 0x4e
-+#define EN_SRC_CRUDE_SENSOR BIT(1)
-+#define EN_SNK_CRUDE_SENSOR BIT(0)
-+
-+#define TYPEC_EXIT_STATE_CFG_REG 0x50
-+#define BYPASS_VSAFE0V_DURING_ROLE_SWAP BIT(3)
-+#define SEL_SRC_UPPER_REF BIT(2)
-+#define USE_TPD_FOR_EXITING_ATTACHSRC BIT(1)
-+#define EXIT_SNK_BASED_ON_CC BIT(0)
-+
-+#define TYPEC_CURRSRC_CFG_REG 0x52
-+#define TYPEC_SRC_RP_SEL_330UA BIT(1)
-+#define TYPEC_SRC_RP_SEL_180UA BIT(0)
-+#define TYPEC_SRC_RP_SEL_80UA 0
-+#define TYPEC_SRC_RP_SEL_MASK GENMASK(1, 0)
-+
-+#define TYPEC_INTERRUPT_EN_CFG_1_REG 0x5E
-+#define TYPEC_LEGACY_CABLE_INT_EN BIT(7)
-+#define TYPEC_NONCOMPLIANT_LEGACY_CABLE_INT_EN BIT(6)
-+#define TYPEC_TRYSOURCE_DETECT_INT_EN BIT(5)
-+#define TYPEC_TRYSINK_DETECT_INT_EN BIT(4)
-+#define TYPEC_CCOUT_DETACH_INT_EN BIT(3)
-+#define TYPEC_CCOUT_ATTACH_INT_EN BIT(2)
-+#define TYPEC_VBUS_DEASSERT_INT_EN BIT(1)
-+#define TYPEC_VBUS_ASSERT_INT_EN BIT(0)
-+
-+#define TYPEC_INTERRUPT_EN_CFG_2_REG 0x60
-+#define TYPEC_SRC_BATT_HPWR_INT_EN BIT(6)
-+#define MICRO_USB_STATE_CHANGE_INT_EN BIT(5)
-+#define TYPEC_STATE_MACHINE_CHANGE_INT_EN BIT(4)
-+#define TYPEC_DEBUG_ACCESS_DETECT_INT_EN BIT(3)
-+#define TYPEC_WATER_DETECTION_INT_EN BIT(2)
-+#define TYPEC_VBUS_ERROR_INT_EN BIT(1)
-+#define TYPEC_DEBOUNCE_DONE_INT_EN BIT(0)
-+
-+#define TYPEC_DEBOUNCE_OPTION_REG 0x62
-+#define REDUCE_TCCDEBOUNCE_TO_2MS BIT(2)
-+
-+#define TYPE_C_SBU_CFG_REG 0x6A
-+#define SEL_SBU1_ISRC_VAL 0x04
-+#define SEL_SBU2_ISRC_VAL 0x01
-+
-+#define TYPEC_U_USB_CFG_REG 0x70
-+#define EN_MICRO_USB_FACTORY_MODE BIT(1)
-+#define EN_MICRO_USB_MODE BIT(0)
-+
-+#define TYPEC_PMI632_U_USB_WATER_PROTECTION_CFG_REG 0x72
-+
-+#define TYPEC_U_USB_WATER_PROTECTION_CFG_REG 0x73
-+#define EN_MICRO_USB_WATER_PROTECTION BIT(4)
-+#define MICRO_USB_DETECTION_ON_TIME_CFG_MASK GENMASK(3, 2)
-+#define MICRO_USB_DETECTION_PERIOD_CFG_MASK GENMASK(1, 0)
-+
-+#define TYPEC_PMI632_MICRO_USB_MODE_REG 0x73
-+#define MICRO_USB_MODE_ONLY BIT(0)
-+
-+/* Interrupt numbers */
-+#define PMIC_TYPEC_OR_RID_IRQ 0x0
-+#define PMIC_TYPEC_VPD_IRQ 0x1
-+#define PMIC_TYPEC_CC_STATE_IRQ 0x2
-+#define PMIC_TYPEC_VCONN_OC_IRQ 0x3
-+#define PMIC_TYPEC_VBUS_IRQ 0x4
-+#define PMIC_TYPEC_ATTACH_DETACH_IRQ 0x5
-+#define PMIC_TYPEC_LEGACY_CABLE_IRQ 0x6
-+#define PMIC_TYPEC_TRY_SNK_SRC_IRQ 0x7
-+
- struct pmic_typec_port_irq_data {
- int virq;
- int irq;
-@@ -33,6 +172,8 @@ struct pmic_typec_port {
- struct pmic_typec_port_irq_data *irq_data;
-
- struct regulator *vdd_vbus;
-+ bool vbus_enabled;
-+ struct mutex vbus_lock; /* VBUS state serialization */
-
- int cc;
- bool debouncing_cc;
-@@ -131,7 +272,7 @@ static irqreturn_t pmic_typec_port_isr(int irq, void *dev_id)
- return IRQ_HANDLED;
- }
-
--int qcom_pmic_typec_port_get_vbus(struct pmic_typec_port *pmic_typec_port)
-+static int qcom_pmic_typec_port_vbus_detect(struct pmic_typec_port *pmic_typec_port)
- {
- struct device *dev = pmic_typec_port->dev;
- unsigned int misc;
-@@ -148,7 +289,7 @@ int qcom_pmic_typec_port_get_vbus(struct pmic_typec_port *pmic_typec_port)
- return !!(misc & TYPEC_VBUS_DETECT);
- }
-
--int qcom_pmic_typec_port_set_vbus(struct pmic_typec_port *pmic_typec_port, bool on)
-+static int qcom_pmic_typec_port_vbus_toggle(struct pmic_typec_port *pmic_typec_port, bool on)
- {
- u32 sm_stat;
- u32 val;
-@@ -179,10 +320,49 @@ int qcom_pmic_typec_port_set_vbus(struct pmic_typec_port *pmic_typec_port, bool
- return 0;
- }
-
--int qcom_pmic_typec_port_get_cc(struct pmic_typec_port *pmic_typec_port,
-- enum typec_cc_status *cc1,
-- enum typec_cc_status *cc2)
-+static int qcom_pmic_typec_port_get_vbus(struct tcpc_dev *tcpc)
-+{
-+ struct pmic_typec *tcpm = tcpc_to_tcpm(tcpc);
-+ struct pmic_typec_port *pmic_typec_port = tcpm->pmic_typec_port;
-+ int ret;
-+
-+ mutex_lock(&pmic_typec_port->vbus_lock);
-+ ret = pmic_typec_port->vbus_enabled || qcom_pmic_typec_port_vbus_detect(pmic_typec_port);
-+ mutex_unlock(&pmic_typec_port->vbus_lock);
-+
-+ return ret;
-+}
-+
-+static int qcom_pmic_typec_port_set_vbus(struct tcpc_dev *tcpc, bool on, bool sink)
-+{
-+ struct pmic_typec *tcpm = tcpc_to_tcpm(tcpc);
-+ struct pmic_typec_port *pmic_typec_port = tcpm->pmic_typec_port;
-+ int ret = 0;
-+
-+ mutex_lock(&pmic_typec_port->vbus_lock);
-+ if (pmic_typec_port->vbus_enabled == on)
-+ goto done;
-+
-+ ret = qcom_pmic_typec_port_vbus_toggle(pmic_typec_port, on);
-+ if (ret)
-+ goto done;
-+
-+ pmic_typec_port->vbus_enabled = on;
-+ tcpm_vbus_change(tcpm->tcpm_port);
-+
-+done:
-+ dev_dbg(tcpm->dev, "set_vbus set: %d result %d\n", on, ret);
-+ mutex_unlock(&pmic_typec_port->vbus_lock);
-+
-+ return ret;
-+}
-+
-+static int qcom_pmic_typec_port_get_cc(struct tcpc_dev *tcpc,
-+ enum typec_cc_status *cc1,
-+ enum typec_cc_status *cc2)
- {
-+ struct pmic_typec *tcpm = tcpc_to_tcpm(tcpc);
-+ struct pmic_typec_port *pmic_typec_port = tcpm->pmic_typec_port;
- struct device *dev = pmic_typec_port->dev;
- unsigned int misc, val;
- bool attached;
-@@ -275,9 +455,11 @@ static void qcom_pmic_set_cc_debounce(struct pmic_typec_port *pmic_typec_port)
- msecs_to_jiffies(2));
- }
-
--int qcom_pmic_typec_port_set_cc(struct pmic_typec_port *pmic_typec_port,
-- enum typec_cc_status cc)
-+static int qcom_pmic_typec_port_set_cc(struct tcpc_dev *tcpc,
-+ enum typec_cc_status cc)
- {
-+ struct pmic_typec *tcpm = tcpc_to_tcpm(tcpc);
-+ struct pmic_typec_port *pmic_typec_port = tcpm->pmic_typec_port;
- struct device *dev = pmic_typec_port->dev;
- unsigned int mode, currsrc;
- unsigned int misc;
-@@ -341,8 +523,17 @@ int qcom_pmic_typec_port_set_cc(struct pmic_typec_port *pmic_typec_port,
- return ret;
- }
-
--int qcom_pmic_typec_port_set_vconn(struct pmic_typec_port *pmic_typec_port, bool on)
-+static int qcom_pmic_typec_port_set_polarity(struct tcpc_dev *tcpc,
-+ enum typec_cc_polarity pol)
-+{
-+ /* Polarity is set separately by phy-qcom-qmp.c */
-+ return 0;
-+}
-+
-+static int qcom_pmic_typec_port_set_vconn(struct tcpc_dev *tcpc, bool on)
- {
-+ struct pmic_typec *tcpm = tcpc_to_tcpm(tcpc);
-+ struct pmic_typec_port *pmic_typec_port = tcpm->pmic_typec_port;
- struct device *dev = pmic_typec_port->dev;
- unsigned int orientation, misc, mask, value;
- unsigned long flags;
-@@ -377,10 +568,12 @@ int qcom_pmic_typec_port_set_vconn(struct pmic_typec_port *pmic_typec_port, bool
- return ret;
- }
-
--int qcom_pmic_typec_port_start_toggling(struct pmic_typec_port *pmic_typec_port,
-- enum typec_port_type port_type,
-- enum typec_cc_status cc)
-+static int qcom_pmic_typec_port_start_toggling(struct tcpc_dev *tcpc,
-+ enum typec_port_type port_type,
-+ enum typec_cc_status cc)
- {
-+ struct pmic_typec *tcpm = tcpc_to_tcpm(tcpc);
-+ struct pmic_typec_port *pmic_typec_port = tcpm->pmic_typec_port;
- struct device *dev = pmic_typec_port->dev;
- unsigned int misc;
- u8 mode = 0;
-@@ -441,9 +634,10 @@ int qcom_pmic_typec_port_start_toggling(struct pmic_typec_port *pmic_typec_port,
- (TYPEC_STATE_MACHINE_CHANGE_INT_EN | TYPEC_VBUS_ERROR_INT_EN | \
- TYPEC_DEBOUNCE_DONE_INT_EN)
-
--int qcom_pmic_typec_port_start(struct pmic_typec_port *pmic_typec_port,
-- struct tcpm_port *tcpm_port)
-+static int qcom_pmic_typec_port_start(struct pmic_typec *tcpm,
-+ struct tcpm_port *tcpm_port)
- {
-+ struct pmic_typec_port *pmic_typec_port = tcpm->pmic_typec_port;
- int i;
- int mask;
- int ret;
-@@ -491,29 +685,30 @@ int qcom_pmic_typec_port_start(struct pmic_typec_port *pmic_typec_port,
- return ret;
- }
-
--void qcom_pmic_typec_port_stop(struct pmic_typec_port *pmic_typec_port)
-+static void qcom_pmic_typec_port_stop(struct pmic_typec *tcpm)
- {
-+ struct pmic_typec_port *pmic_typec_port = tcpm->pmic_typec_port;
- int i;
-
- for (i = 0; i < pmic_typec_port->nr_irqs; i++)
- disable_irq(pmic_typec_port->irq_data[i].irq);
- }
-
--struct pmic_typec_port *qcom_pmic_typec_port_alloc(struct device *dev)
--{
-- return devm_kzalloc(dev, sizeof(struct pmic_typec_port), GFP_KERNEL);
--}
--
- int qcom_pmic_typec_port_probe(struct platform_device *pdev,
-- struct pmic_typec_port *pmic_typec_port,
-- struct pmic_typec_port_resources *res,
-+ struct pmic_typec *tcpm,
-+ const struct pmic_typec_port_resources *res,
- struct regmap *regmap,
- u32 base)
- {
- struct device *dev = &pdev->dev;
- struct pmic_typec_port_irq_data *irq_data;
-+ struct pmic_typec_port *pmic_typec_port;
- int i, ret, irq;
-
-+ pmic_typec_port = devm_kzalloc(dev, sizeof(*pmic_typec_port), GFP_KERNEL);
-+ if (!pmic_typec_port)
-+ return -ENOMEM;
-+
- if (!res->nr_irqs || res->nr_irqs > PMIC_TYPEC_MAX_IRQS)
- return -EINVAL;
-
-@@ -522,6 +717,8 @@ int qcom_pmic_typec_port_probe(struct platform_device *pdev,
- if (!irq_data)
- return -ENOMEM;
-
-+ mutex_init(&pmic_typec_port->vbus_lock);
-+
- pmic_typec_port->vdd_vbus = devm_regulator_get(dev, "vdd-vbus");
- if (IS_ERR(pmic_typec_port->vdd_vbus))
- return PTR_ERR(pmic_typec_port->vdd_vbus);
-@@ -556,5 +753,56 @@ int qcom_pmic_typec_port_probe(struct platform_device *pdev,
- return ret;
- }
-
-+ tcpm->pmic_typec_port = pmic_typec_port;
-+
-+ tcpm->tcpc.get_vbus = qcom_pmic_typec_port_get_vbus;
-+ tcpm->tcpc.set_vbus = qcom_pmic_typec_port_set_vbus;
-+ tcpm->tcpc.set_cc = qcom_pmic_typec_port_set_cc;
-+ tcpm->tcpc.get_cc = qcom_pmic_typec_port_get_cc;
-+ tcpm->tcpc.set_polarity = qcom_pmic_typec_port_set_polarity;
-+ tcpm->tcpc.set_vconn = qcom_pmic_typec_port_set_vconn;
-+ tcpm->tcpc.start_toggling = qcom_pmic_typec_port_start_toggling;
-+
-+ tcpm->port_start = qcom_pmic_typec_port_start;
-+ tcpm->port_stop = qcom_pmic_typec_port_stop;
-+
- return 0;
- }
-+
-+const struct pmic_typec_port_resources pm8150b_port_res = {
-+ .irq_params = {
-+ {
-+ .irq_name = "vpd-detect",
-+ .virq = PMIC_TYPEC_VPD_IRQ,
-+ },
-+
-+ {
-+ .irq_name = "cc-state-change",
-+ .virq = PMIC_TYPEC_CC_STATE_IRQ,
-+ },
-+ {
-+ .irq_name = "vconn-oc",
-+ .virq = PMIC_TYPEC_VCONN_OC_IRQ,
-+ },
-+
-+ {
-+ .irq_name = "vbus-change",
-+ .virq = PMIC_TYPEC_VBUS_IRQ,
-+ },
-+
-+ {
-+ .irq_name = "attach-detach",
-+ .virq = PMIC_TYPEC_ATTACH_DETACH_IRQ,
-+ },
-+ {
-+ .irq_name = "legacy-cable-detect",
-+ .virq = PMIC_TYPEC_LEGACY_CABLE_IRQ,
-+ },
-+
-+ {
-+ .irq_name = "try-snk-src-detect",
-+ .virq = PMIC_TYPEC_TRY_SNK_SRC_IRQ,
-+ },
-+ },
-+ .nr_irqs = 7,
-+};
-diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.h b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.h
-index 4a892048908e7..2ca83a46cf3b5 100644
---- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.h
-+++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_port.h
-@@ -9,143 +9,6 @@
- #include <linux/platform_device.h>
- #include <linux/usb/tcpm.h>
-
--#define TYPEC_SNK_STATUS_REG 0x06
--#define DETECTED_SNK_TYPE_MASK GENMASK(6, 0)
--#define SNK_DAM_MASK GENMASK(6, 4)
--#define SNK_DAM_500MA BIT(6)
--#define SNK_DAM_1500MA BIT(5)
--#define SNK_DAM_3000MA BIT(4)
--#define SNK_RP_STD BIT(3)
--#define SNK_RP_1P5 BIT(2)
--#define SNK_RP_3P0 BIT(1)
--#define SNK_RP_SHORT BIT(0)
--
--#define TYPEC_SRC_STATUS_REG 0x08
--#define DETECTED_SRC_TYPE_MASK GENMASK(4, 0)
--#define SRC_HIGH_BATT BIT(5)
--#define SRC_DEBUG_ACCESS BIT(4)
--#define SRC_RD_OPEN BIT(3)
--#define SRC_RD_RA_VCONN BIT(2)
--#define SRC_RA_OPEN BIT(1)
--#define AUDIO_ACCESS_RA_RA BIT(0)
--
--#define TYPEC_STATE_MACHINE_STATUS_REG 0x09
--#define TYPEC_ATTACH_DETACH_STATE BIT(5)
--
--#define TYPEC_SM_STATUS_REG 0x0A
--#define TYPEC_SM_VBUS_VSAFE5V BIT(5)
--#define TYPEC_SM_VBUS_VSAFE0V BIT(6)
--#define TYPEC_SM_USBIN_LT_LV BIT(7)
--
--#define TYPEC_MISC_STATUS_REG 0x0B
--#define TYPEC_WATER_DETECTION_STATUS BIT(7)
--#define SNK_SRC_MODE BIT(6)
--#define TYPEC_VBUS_DETECT BIT(5)
--#define TYPEC_VBUS_ERROR_STATUS BIT(4)
--#define TYPEC_DEBOUNCE_DONE BIT(3)
--#define CC_ORIENTATION BIT(1)
--#define CC_ATTACHED BIT(0)
--
--#define LEGACY_CABLE_STATUS_REG 0x0D
--#define TYPEC_LEGACY_CABLE_STATUS BIT(1)
--#define TYPEC_NONCOMP_LEGACY_CABLE_STATUS BIT(0)
--
--#define TYPEC_U_USB_STATUS_REG 0x0F
--#define U_USB_GROUND_NOVBUS BIT(6)
--#define U_USB_GROUND BIT(4)
--#define U_USB_FMB1 BIT(3)
--#define U_USB_FLOAT1 BIT(2)
--#define U_USB_FMB2 BIT(1)
--#define U_USB_FLOAT2 BIT(0)
--
--#define TYPEC_MODE_CFG_REG 0x44
--#define TYPEC_TRY_MODE_MASK GENMASK(4, 3)
--#define EN_TRY_SNK BIT(4)
--#define EN_TRY_SRC BIT(3)
--#define TYPEC_POWER_ROLE_CMD_MASK GENMASK(2, 0)
--#define EN_SRC_ONLY BIT(2)
--#define EN_SNK_ONLY BIT(1)
--#define TYPEC_DISABLE_CMD BIT(0)
--
--#define TYPEC_VCONN_CONTROL_REG 0x46
--#define VCONN_EN_ORIENTATION BIT(2)
--#define VCONN_EN_VALUE BIT(1)
--#define VCONN_EN_SRC BIT(0)
--
--#define TYPEC_CCOUT_CONTROL_REG 0x48
--#define TYPEC_CCOUT_BUFFER_EN BIT(2)
--#define TYPEC_CCOUT_VALUE BIT(1)
--#define TYPEC_CCOUT_SRC BIT(0)
--
--#define DEBUG_ACCESS_SRC_CFG_REG 0x4C
--#define EN_UNORIENTED_DEBUG_ACCESS_SRC BIT(0)
--
--#define TYPE_C_CRUDE_SENSOR_CFG_REG 0x4e
--#define EN_SRC_CRUDE_SENSOR BIT(1)
--#define EN_SNK_CRUDE_SENSOR BIT(0)
--
--#define TYPEC_EXIT_STATE_CFG_REG 0x50
--#define BYPASS_VSAFE0V_DURING_ROLE_SWAP BIT(3)
--#define SEL_SRC_UPPER_REF BIT(2)
--#define USE_TPD_FOR_EXITING_ATTACHSRC BIT(1)
--#define EXIT_SNK_BASED_ON_CC BIT(0)
--
--#define TYPEC_CURRSRC_CFG_REG 0x52
--#define TYPEC_SRC_RP_SEL_330UA BIT(1)
--#define TYPEC_SRC_RP_SEL_180UA BIT(0)
--#define TYPEC_SRC_RP_SEL_80UA 0
--#define TYPEC_SRC_RP_SEL_MASK GENMASK(1, 0)
--
--#define TYPEC_INTERRUPT_EN_CFG_1_REG 0x5E
--#define TYPEC_LEGACY_CABLE_INT_EN BIT(7)
--#define TYPEC_NONCOMPLIANT_LEGACY_CABLE_INT_EN BIT(6)
--#define TYPEC_TRYSOURCE_DETECT_INT_EN BIT(5)
--#define TYPEC_TRYSINK_DETECT_INT_EN BIT(4)
--#define TYPEC_CCOUT_DETACH_INT_EN BIT(3)
--#define TYPEC_CCOUT_ATTACH_INT_EN BIT(2)
--#define TYPEC_VBUS_DEASSERT_INT_EN BIT(1)
--#define TYPEC_VBUS_ASSERT_INT_EN BIT(0)
--
--#define TYPEC_INTERRUPT_EN_CFG_2_REG 0x60
--#define TYPEC_SRC_BATT_HPWR_INT_EN BIT(6)
--#define MICRO_USB_STATE_CHANGE_INT_EN BIT(5)
--#define TYPEC_STATE_MACHINE_CHANGE_INT_EN BIT(4)
--#define TYPEC_DEBUG_ACCESS_DETECT_INT_EN BIT(3)
--#define TYPEC_WATER_DETECTION_INT_EN BIT(2)
--#define TYPEC_VBUS_ERROR_INT_EN BIT(1)
--#define TYPEC_DEBOUNCE_DONE_INT_EN BIT(0)
--
--#define TYPEC_DEBOUNCE_OPTION_REG 0x62
--#define REDUCE_TCCDEBOUNCE_TO_2MS BIT(2)
--
--#define TYPE_C_SBU_CFG_REG 0x6A
--#define SEL_SBU1_ISRC_VAL 0x04
--#define SEL_SBU2_ISRC_VAL 0x01
--
--#define TYPEC_U_USB_CFG_REG 0x70
--#define EN_MICRO_USB_FACTORY_MODE BIT(1)
--#define EN_MICRO_USB_MODE BIT(0)
--
--#define TYPEC_PMI632_U_USB_WATER_PROTECTION_CFG_REG 0x72
--
--#define TYPEC_U_USB_WATER_PROTECTION_CFG_REG 0x73
--#define EN_MICRO_USB_WATER_PROTECTION BIT(4)
--#define MICRO_USB_DETECTION_ON_TIME_CFG_MASK GENMASK(3, 2)
--#define MICRO_USB_DETECTION_PERIOD_CFG_MASK GENMASK(1, 0)
--
--#define TYPEC_PMI632_MICRO_USB_MODE_REG 0x73
--#define MICRO_USB_MODE_ONLY BIT(0)
--
--/* Interrupt numbers */
--#define PMIC_TYPEC_OR_RID_IRQ 0x0
--#define PMIC_TYPEC_VPD_IRQ 0x1
--#define PMIC_TYPEC_CC_STATE_IRQ 0x2
--#define PMIC_TYPEC_VCONN_OC_IRQ 0x3
--#define PMIC_TYPEC_VBUS_IRQ 0x4
--#define PMIC_TYPEC_ATTACH_DETACH_IRQ 0x5
--#define PMIC_TYPEC_LEGACY_CABLE_IRQ 0x6
--#define PMIC_TYPEC_TRY_SNK_SRC_IRQ 0x7
--
- /* Resources */
- #define PMIC_TYPEC_MAX_IRQS 0x08
-
-@@ -156,40 +19,17 @@ struct pmic_typec_port_irq_params {
-
- struct pmic_typec_port_resources {
- unsigned int nr_irqs;
-- struct pmic_typec_port_irq_params irq_params[PMIC_TYPEC_MAX_IRQS];
-+ const struct pmic_typec_port_irq_params irq_params[PMIC_TYPEC_MAX_IRQS];
- };
-
- /* API */
--struct pmic_typec;
-
--struct pmic_typec_port *qcom_pmic_typec_port_alloc(struct device *dev);
-+extern const struct pmic_typec_port_resources pm8150b_port_res;
-
- int qcom_pmic_typec_port_probe(struct platform_device *pdev,
-- struct pmic_typec_port *pmic_typec_port,
-- struct pmic_typec_port_resources *res,
-+ struct pmic_typec *tcpm,
-+ const struct pmic_typec_port_resources *res,
- struct regmap *regmap,
- u32 base);
-
--int qcom_pmic_typec_port_start(struct pmic_typec_port *pmic_typec_port,
-- struct tcpm_port *tcpm_port);
--
--void qcom_pmic_typec_port_stop(struct pmic_typec_port *pmic_typec_port);
--
--int qcom_pmic_typec_port_get_cc(struct pmic_typec_port *pmic_typec_port,
-- enum typec_cc_status *cc1,
-- enum typec_cc_status *cc2);
--
--int qcom_pmic_typec_port_set_cc(struct pmic_typec_port *pmic_typec_port,
-- enum typec_cc_status cc);
--
--int qcom_pmic_typec_port_get_vbus(struct pmic_typec_port *pmic_typec_port);
--
--int qcom_pmic_typec_port_set_vconn(struct pmic_typec_port *pmic_typec_port, bool on);
--
--int qcom_pmic_typec_port_start_toggling(struct pmic_typec_port *pmic_typec_port,
-- enum typec_port_type port_type,
-- enum typec_cc_status cc);
--
--int qcom_pmic_typec_port_set_vbus(struct pmic_typec_port *pmic_typec_port, bool on);
--
- #endif /* __QCOM_PMIC_TYPE_C_PORT_H__ */
---
-2.43.0
-
+++ /dev/null
-From 19d4a394b9a49304e355fccd74ee71317dae6eed Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 13 Jan 2024 22:55:49 +0200
-Subject: usb: typec: qcom-pmic-typec: fix arguments of
- qcom_pmic_typec_pdphy_set_roles
-
-From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-
-[ Upstream commit 65145a03d65be80d389bf24c1874c634527de849 ]
-
-The function qcom_pmic_typec_set_roles() passes enum values as boolean
-values to qcom_pmic_typec_pdphy_set_roles(), which then interprets them
-as bit values. Be more explicit about it, pass enum values directly and
-compute corresponding bit masks in qcom_pmic_typec_pdphy_set_roles().
-
-Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
-Link: https://lore.kernel.org/r/20240113-pmi632-typec-v2-6-182d9aa0a5b3@linaro.org
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Stable-dep-of: d80eee97cb4e ("usb: typec: qcom-pmic: fix use-after-free on late probe errors")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c | 2 +-
- drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c | 8 +++++---
- drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.h | 3 ++-
- 3 files changed, 8 insertions(+), 5 deletions(-)
-
-diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
-index 1a2b4bddaa97e..a243648abb4a5 100644
---- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
-+++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec.c
-@@ -123,7 +123,7 @@ static int qcom_pmic_typec_set_roles(struct tcpc_dev *tcpc, bool attached,
- struct pmic_typec *tcpm = tcpc_to_tcpm(tcpc);
-
- return qcom_pmic_typec_pdphy_set_roles(tcpm->pmic_typec_pdphy,
-- data_role, power_role);
-+ power_role, data_role);
- }
-
- static int qcom_pmic_typec_set_pd_rx(struct tcpc_dev *tcpc, bool on)
-diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c
-index 52c81378e36ef..44d8342ed0ad5 100644
---- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c
-+++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c
-@@ -354,7 +354,8 @@ int qcom_pmic_typec_pdphy_set_pd_rx(struct pmic_typec_pdphy *pmic_typec_pdphy, b
- }
-
- int qcom_pmic_typec_pdphy_set_roles(struct pmic_typec_pdphy *pmic_typec_pdphy,
-- bool data_role_host, bool power_role_src)
-+ enum typec_role power_role,
-+ enum typec_data_role data_role)
- {
- struct device *dev = pmic_typec_pdphy->dev;
- unsigned long flags;
-@@ -366,12 +367,13 @@ int qcom_pmic_typec_pdphy_set_roles(struct pmic_typec_pdphy *pmic_typec_pdphy,
- pmic_typec_pdphy->base + USB_PDPHY_MSG_CONFIG_REG,
- MSG_CONFIG_PORT_DATA_ROLE |
- MSG_CONFIG_PORT_POWER_ROLE,
-- data_role_host << 3 | power_role_src << 2);
-+ (data_role == TYPEC_HOST ? MSG_CONFIG_PORT_DATA_ROLE : 0) |
-+ (power_role == TYPEC_SOURCE ? MSG_CONFIG_PORT_POWER_ROLE : 0));
-
- spin_unlock_irqrestore(&pmic_typec_pdphy->lock, flags);
-
- dev_dbg(dev, "pdphy_set_roles: data_role_host=%d power_role_src=%d\n",
-- data_role_host, power_role_src);
-+ data_role, power_role);
-
- return ret;
- }
-diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.h b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.h
-index e67954e31b149..070822dc6f177 100644
---- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.h
-+++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.h
-@@ -107,7 +107,8 @@ int qcom_pmic_typec_pdphy_start(struct pmic_typec_pdphy *pmic_typec_pdphy,
- void qcom_pmic_typec_pdphy_stop(struct pmic_typec_pdphy *pmic_typec_pdphy);
-
- int qcom_pmic_typec_pdphy_set_roles(struct pmic_typec_pdphy *pmic_typec_pdphy,
-- bool power_role_src, bool data_role_host);
-+ enum typec_role power_role,
-+ enum typec_data_role data_role);
-
- int qcom_pmic_typec_pdphy_set_pd_rx(struct pmic_typec_pdphy *pmic_typec_pdphy, bool on);
-
---
-2.43.0
-
+++ /dev/null
-From 32338d65589b63f7f8fdcc4116f673ca5d029be3 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 29 Mar 2024 08:15:33 +0200
-Subject: usb: typec: ucsi: allow non-partner GET_PDOS for Qualcomm devices
-
-From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-
-[ Upstream commit 897d68d4ce7d50ca45a31e10c0e61597257b32d3 ]
-
-The name and description of the USB_NO_PARTNER_PDOS quirk specifies that
-only retrieving PDOS of the attached device is crashing. Retrieving PDOS
-of the UCSI device works. Fix the condition to limit the workaround only
-to is_partner cases.
-
-Fixes: 1d103d6af241 ("usb: typec: ucsi: fix UCSI on buggy Qualcomm devices")
-Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
-Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-Link: https://lore.kernel.org/r/20240329-qcom-ucsi-fixes-v2-1-0f5d37ed04db@linaro.org
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/usb/typec/ucsi/ucsi.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
-index b501760012c4f..147ce1a2a2885 100644
---- a/drivers/usb/typec/ucsi/ucsi.c
-+++ b/drivers/usb/typec/ucsi/ucsi.c
-@@ -595,7 +595,8 @@ static int ucsi_read_pdos(struct ucsi_connector *con,
- u64 command;
- int ret;
-
-- if (ucsi->quirks & UCSI_NO_PARTNER_PDOS)
-+ if (is_partner &&
-+ ucsi->quirks & UCSI_NO_PARTNER_PDOS)
- return 0;
-
- command = UCSI_COMMAND(UCSI_GET_PDOS) | UCSI_CONNECTOR_NUMBER(con->num);
---
-2.43.0
-
+++ /dev/null
-From 4c7d6521ab1cd0e480c4acf0b3a8c57569f0c8e9 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 29 Mar 2024 08:15:36 +0200
-Subject: usb: typec: ucsi: always register a link to USB PD device
-
-From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-
-[ Upstream commit c0f66d78f42353d38b9608c05f211cf0773d93ac ]
-
-UCSI driver will attempt to set a USB PD device only if it was able to
-read PDOs from the firmware. This results in suboptimal behaviour, since
-the PD device will be created anyway. Move calls to
-typec_port_set_usb_power_delivery() out of conditional code and call it
-after reading capabilities.
-
-Fixes: b04e1747fbcc ("usb: typec: ucsi: Register USB Power Delivery Capabilities")
-Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
-Link: https://lore.kernel.org/r/20240329-qcom-ucsi-fixes-v2-4-0f5d37ed04db@linaro.org
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/usb/typec/ucsi/ucsi.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
-index 147ce1a2a2885..ce2411c8daf37 100644
---- a/drivers/usb/typec/ucsi/ucsi.c
-+++ b/drivers/usb/typec/ucsi/ucsi.c
-@@ -1301,7 +1301,6 @@ static int ucsi_register_port(struct ucsi *ucsi, struct ucsi_connector *con)
- }
-
- con->port_source_caps = pd_cap;
-- typec_port_set_usb_power_delivery(con->port, con->pd);
- }
-
- memset(&pd_caps, 0, sizeof(pd_caps));
-@@ -1318,9 +1317,10 @@ static int ucsi_register_port(struct ucsi *ucsi, struct ucsi_connector *con)
- }
-
- con->port_sink_caps = pd_cap;
-- typec_port_set_usb_power_delivery(con->port, con->pd);
- }
-
-+ typec_port_set_usb_power_delivery(con->port, con->pd);
-+
- /* Alternate modes */
- ret = ucsi_register_altmodes(con, UCSI_RECIPIENT_CON);
- if (ret) {
---
-2.43.0
-
+++ /dev/null
-From 596e30945521037005e19c6a49e092b9336ad8b6 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 29 Mar 2024 08:15:37 +0200
-Subject: usb: typec: ucsi: simplify partner's PD caps registration
-
-From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-
-[ Upstream commit 41e1cd1401fcd1f1ae9e47574af2d9fc44a870b3 ]
-
-In a way similar to the previous commit, move
-typec_partner_set_usb_power_delivery() to be called after reading the PD
-caps. This also removes calls to
-usb_power_delivery_unregister_capabilities() from the error path. Keep
-all capabilities registered until they are cleared by
-ucsi_unregister_partner_pdos().
-
-Fixes: b04e1747fbcc ("usb: typec: ucsi: Register USB Power Delivery Capabilities")
-Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
-Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
-Link: https://lore.kernel.org/r/20240329-qcom-ucsi-fixes-v2-5-0f5d37ed04db@linaro.org
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/usb/typec/ucsi/ucsi.c | 14 +-------------
- 1 file changed, 1 insertion(+), 13 deletions(-)
-
-diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
-index ce2411c8daf37..b6a900cb657c6 100644
---- a/drivers/usb/typec/ucsi/ucsi.c
-+++ b/drivers/usb/typec/ucsi/ucsi.c
-@@ -698,12 +698,6 @@ static int ucsi_register_partner_pdos(struct ucsi_connector *con)
- return PTR_ERR(cap);
-
- con->partner_source_caps = cap;
--
-- ret = typec_partner_set_usb_power_delivery(con->partner, con->partner_pd);
-- if (ret) {
-- usb_power_delivery_unregister_capabilities(con->partner_source_caps);
-- return ret;
-- }
- }
-
- ret = ucsi_get_pdos(con, TYPEC_SINK, 1, caps.pdo);
-@@ -718,15 +712,9 @@ static int ucsi_register_partner_pdos(struct ucsi_connector *con)
- return PTR_ERR(cap);
-
- con->partner_sink_caps = cap;
--
-- ret = typec_partner_set_usb_power_delivery(con->partner, con->partner_pd);
-- if (ret) {
-- usb_power_delivery_unregister_capabilities(con->partner_sink_caps);
-- return ret;
-- }
- }
-
-- return 0;
-+ return typec_partner_set_usb_power_delivery(con->partner, con->partner_pd);
- }
-
- static void ucsi_unregister_partner_pdos(struct ucsi_connector *con)
---
-2.43.0
-
+++ /dev/null
-From d2b506d4c9b8db4e2bba4060da8f88fe28ed4cfc Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 29 Apr 2024 17:02:30 +0300
-Subject: usb: xhci: check if 'requested segments' exceeds ERST capacity
-
-From: Niklas Neronin <niklas.neronin@linux.intel.com>
-
-[ Upstream commit db4460b6ecf07574d580f01cd88054a62607068c ]
-
-Check if requested segments ('segs' or 'ERST_DEFAULT_SEGS') exceeds the
-maximum amount ERST supports.
-
-When 'segs' is '0', 'ERST_DEFAULT_SEGS' is used instead. But both values
-may not exceed ERST max.
-
-Macro 'ERST_MAX_SEGS' is renamed to 'ERST_DEFAULT_SEGS'. The new name
-better represents the macros, which is the number of Event Ring segments
-to allocate, when the amount is not specified.
-
-Additionally, rename and change xhci_create_secondary_interrupter()'s
-argument 'int num_segs' to 'unsigned int segs'. This makes it the same
-as its counter part in xhci_alloc_interrupter().
-
-Fixes: c99b38c41234 ("xhci: add support to allocate several interrupters")
-Signed-off-by: Niklas Neronin <niklas.neronin@linux.intel.com>
-Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
-Link: https://lore.kernel.org/r/20240429140245.3955523-4-mathias.nyman@linux.intel.com
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/usb/host/xhci-mem.c | 22 +++++++++++-----------
- drivers/usb/host/xhci.h | 6 +++---
- 2 files changed, 14 insertions(+), 14 deletions(-)
-
-diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
-index 450adaca68eeb..2246bb0dea191 100644
---- a/drivers/usb/host/xhci-mem.c
-+++ b/drivers/usb/host/xhci-mem.c
-@@ -2280,24 +2280,24 @@ static int xhci_setup_port_arrays(struct xhci_hcd *xhci, gfp_t flags)
- }
-
- static struct xhci_interrupter *
--xhci_alloc_interrupter(struct xhci_hcd *xhci, int segs, gfp_t flags)
-+xhci_alloc_interrupter(struct xhci_hcd *xhci, unsigned int segs, gfp_t flags)
- {
- struct device *dev = xhci_to_hcd(xhci)->self.sysdev;
- struct xhci_interrupter *ir;
-- unsigned int num_segs = segs;
-+ unsigned int max_segs;
- int ret;
-
-+ if (!segs)
-+ segs = ERST_DEFAULT_SEGS;
-+
-+ max_segs = BIT(HCS_ERST_MAX(xhci->hcs_params2));
-+ segs = min(segs, max_segs);
-+
- ir = kzalloc_node(sizeof(*ir), flags, dev_to_node(dev));
- if (!ir)
- return NULL;
-
-- /* number of ring segments should be greater than 0 */
-- if (segs <= 0)
-- num_segs = min_t(unsigned int, 1 << HCS_ERST_MAX(xhci->hcs_params2),
-- ERST_MAX_SEGS);
--
-- ir->event_ring = xhci_ring_alloc(xhci, num_segs, 1, TYPE_EVENT, 0,
-- flags);
-+ ir->event_ring = xhci_ring_alloc(xhci, segs, 1, TYPE_EVENT, 0, flags);
- if (!ir->event_ring) {
- xhci_warn(xhci, "Failed to allocate interrupter event ring\n");
- kfree(ir);
-@@ -2355,7 +2355,7 @@ xhci_add_interrupter(struct xhci_hcd *xhci, struct xhci_interrupter *ir,
- }
-
- struct xhci_interrupter *
--xhci_create_secondary_interrupter(struct usb_hcd *hcd, int num_seg)
-+xhci_create_secondary_interrupter(struct usb_hcd *hcd, unsigned int segs)
- {
- struct xhci_hcd *xhci = hcd_to_xhci(hcd);
- struct xhci_interrupter *ir;
-@@ -2365,7 +2365,7 @@ xhci_create_secondary_interrupter(struct usb_hcd *hcd, int num_seg)
- if (!xhci->interrupters || xhci->max_interrupters <= 1)
- return NULL;
-
-- ir = xhci_alloc_interrupter(xhci, num_seg, GFP_KERNEL);
-+ ir = xhci_alloc_interrupter(xhci, segs, GFP_KERNEL);
- if (!ir)
- return NULL;
-
-diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
-index bf05103aa68a0..a736b3cf366d3 100644
---- a/drivers/usb/host/xhci.h
-+++ b/drivers/usb/host/xhci.h
-@@ -1649,8 +1649,8 @@ struct urb_priv {
- struct xhci_td td[] __counted_by(num_tds);
- };
-
--/* Reasonable limit for number of Event Ring segments (spec allows 32k) */
--#define ERST_MAX_SEGS 2
-+/* Number of Event Ring segments to allocate, when amount is not specified. (spec allows 32k) */
-+#define ERST_DEFAULT_SEGS 2
- /* Poll every 60 seconds */
- #define POLL_TIMEOUT 60
- /* Stop endpoint command timeout (secs) for URB cancellation watchdog timer */
-@@ -2088,7 +2088,7 @@ struct xhci_container_ctx *xhci_alloc_container_ctx(struct xhci_hcd *xhci,
- void xhci_free_container_ctx(struct xhci_hcd *xhci,
- struct xhci_container_ctx *ctx);
- struct xhci_interrupter *
--xhci_create_secondary_interrupter(struct usb_hcd *hcd, int num_seg);
-+xhci_create_secondary_interrupter(struct usb_hcd *hcd, unsigned int segs);
- void xhci_remove_secondary_interrupter(struct usb_hcd
- *hcd, struct xhci_interrupter *ir);
-
---
-2.43.0
-
+++ /dev/null
-From d38a2d654b046eaf82ab1f630bddaac99708e81e Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 15 Apr 2024 09:50:29 +0800
-Subject: vfio/pci: fix potential memory leak in vfio_intx_enable()
-
-From: Ye Bin <yebin10@huawei.com>
-
-[ Upstream commit 82b951e6fbd31d85ae7f4feb5f00ddd4c5d256e2 ]
-
-If vfio_irq_ctx_alloc() failed will lead to 'name' memory leak.
-
-Fixes: 18c198c96a81 ("vfio/pci: Create persistent INTx handler")
-Signed-off-by: Ye Bin <yebin10@huawei.com>
-Reviewed-by: Kevin Tian <kevin.tian@intel.com>
-Acked-by: Reinette Chatre <reinette.chatre@intel.com>
-Link: https://lore.kernel.org/r/20240415015029.3699844-1-yebin10@huawei.com
-Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/vfio/pci/vfio_pci_intrs.c | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/vfio/pci/vfio_pci_intrs.c b/drivers/vfio/pci/vfio_pci_intrs.c
-index fb5392b749fff..e80c5d75b5419 100644
---- a/drivers/vfio/pci/vfio_pci_intrs.c
-+++ b/drivers/vfio/pci/vfio_pci_intrs.c
-@@ -277,8 +277,10 @@ static int vfio_intx_enable(struct vfio_pci_core_device *vdev,
- return -ENOMEM;
-
- ctx = vfio_irq_ctx_alloc(vdev, 0);
-- if (!ctx)
-+ if (!ctx) {
-+ kfree(name);
- return -ENOMEM;
-+ }
-
- ctx->name = name;
- ctx->trigger = trigger;
---
-2.43.0
-
+++ /dev/null
-From 40466f117aab43a579510208c6120f4b4e5188a2 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 26 Apr 2024 17:08:45 +0200
-Subject: virtio: delete vq in vp_find_vqs_msix() when request_irq() fails
-
-From: Jiri Pirko <jiri@nvidia.com>
-
-[ Upstream commit 89875151fccdd024d571aa884ea97a0128b968b6 ]
-
-When request_irq() fails, error path calls vp_del_vqs(). There, as vq is
-present in the list, free_irq() is called for the same vector. That
-causes following splat:
-
-[ 0.414355] Trying to free already-free IRQ 27
-[ 0.414403] WARNING: CPU: 1 PID: 1 at kernel/irq/manage.c:1899 free_irq+0x1a1/0x2d0
-[ 0.414510] Modules linked in:
-[ 0.414540] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 6.9.0-rc4+ #27
-[ 0.414540] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-1.fc39 04/01/2014
-[ 0.414540] RIP: 0010:free_irq+0x1a1/0x2d0
-[ 0.414540] Code: 1e 00 48 83 c4 08 48 89 e8 5b 5d 41 5c 41 5d 41 5e 41 5f c3 cc cc cc cc 90 8b 74 24 04 48 c7 c7 98 80 6c b1 e8 00 c9 f7 ff 90 <0f> 0b 90 90 48 89 ee 4c 89 ef e8 e0 20 b8 00 49 8b 47 40 48 8b 40
-[ 0.414540] RSP: 0000:ffffb71480013ae0 EFLAGS: 00010086
-[ 0.414540] RAX: 0000000000000000 RBX: ffffa099c2722000 RCX: 0000000000000000
-[ 0.414540] RDX: 0000000000000000 RSI: ffffb71480013998 RDI: 0000000000000001
-[ 0.414540] RBP: 0000000000000246 R08: 00000000ffffdfff R09: 0000000000000001
-[ 0.414540] R10: 00000000ffffdfff R11: ffffffffb18729c0 R12: ffffa099c1c91760
-[ 0.414540] R13: ffffa099c1c916a4 R14: ffffa099c1d2f200 R15: ffffa099c1c91600
-[ 0.414540] FS: 0000000000000000(0000) GS:ffffa099fec40000(0000) knlGS:0000000000000000
-[ 0.414540] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
-[ 0.414540] CR2: 0000000000000000 CR3: 0000000008e3e001 CR4: 0000000000370ef0
-[ 0.414540] Call Trace:
-[ 0.414540] <TASK>
-[ 0.414540] ? __warn+0x80/0x120
-[ 0.414540] ? free_irq+0x1a1/0x2d0
-[ 0.414540] ? report_bug+0x164/0x190
-[ 0.414540] ? handle_bug+0x3b/0x70
-[ 0.414540] ? exc_invalid_op+0x17/0x70
-[ 0.414540] ? asm_exc_invalid_op+0x1a/0x20
-[ 0.414540] ? free_irq+0x1a1/0x2d0
-[ 0.414540] vp_del_vqs+0xc1/0x220
-[ 0.414540] vp_find_vqs_msix+0x305/0x470
-[ 0.414540] vp_find_vqs+0x3e/0x1a0
-[ 0.414540] vp_modern_find_vqs+0x1b/0x70
-[ 0.414540] init_vqs+0x387/0x600
-[ 0.414540] virtnet_probe+0x50a/0xc80
-[ 0.414540] virtio_dev_probe+0x1e0/0x2b0
-[ 0.414540] really_probe+0xc0/0x2c0
-[ 0.414540] ? __pfx___driver_attach+0x10/0x10
-[ 0.414540] __driver_probe_device+0x73/0x120
-[ 0.414540] driver_probe_device+0x1f/0xe0
-[ 0.414540] __driver_attach+0x88/0x180
-[ 0.414540] bus_for_each_dev+0x85/0xd0
-[ 0.414540] bus_add_driver+0xec/0x1f0
-[ 0.414540] driver_register+0x59/0x100
-[ 0.414540] ? __pfx_virtio_net_driver_init+0x10/0x10
-[ 0.414540] virtio_net_driver_init+0x90/0xb0
-[ 0.414540] do_one_initcall+0x58/0x230
-[ 0.414540] kernel_init_freeable+0x1a3/0x2d0
-[ 0.414540] ? __pfx_kernel_init+0x10/0x10
-[ 0.414540] kernel_init+0x1a/0x1c0
-[ 0.414540] ret_from_fork+0x31/0x50
-[ 0.414540] ? __pfx_kernel_init+0x10/0x10
-[ 0.414540] ret_from_fork_asm+0x1a/0x30
-[ 0.414540] </TASK>
-
-Fix this by calling deleting the current vq when request_irq() fails.
-
-Fixes: 0b0f9dc52ed0 ("Revert "virtio_pci: use shared interrupts for virtqueues"")
-Signed-off-by: Jiri Pirko <jiri@nvidia.com>
-Message-Id: <20240426150845.3999481-1-jiri@resnulli.us>
-Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/virtio/virtio_pci_common.c | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
-
-diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c
-index b655fccaf7733..584af7816532b 100644
---- a/drivers/virtio/virtio_pci_common.c
-+++ b/drivers/virtio/virtio_pci_common.c
-@@ -348,8 +348,10 @@ static int vp_find_vqs_msix(struct virtio_device *vdev, unsigned int nvqs,
- vring_interrupt, 0,
- vp_dev->msix_names[msix_vec],
- vqs[i]);
-- if (err)
-+ if (err) {
-+ vp_del_vq(vqs[i]);
- goto error_find;
-+ }
- }
- return 0;
-
---
-2.43.0
-
+++ /dev/null
-From b97fc5a31dc8cd7b2ce52e42b027fa34a5f38c63 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 21 Mar 2024 10:24:44 +0900
-Subject: virtio_balloon: Give the balloon its own wakeup source
-
-From: David Stevens <stevensd@chromium.org>
-
-[ Upstream commit 810d831bbbf3cbd86e5aa91c8485b4d35186144d ]
-
-Wakeup sources don't support nesting multiple events, so sharing a
-single object between multiple drivers can result in one driver
-overriding the wakeup event processing period specified by another
-driver. Have the virtio balloon driver use the wakeup source of the
-device it is bound to rather than the wakeup source of the parent
-device, to avoid conflicts with the transport layer.
-
-Note that although the virtio balloon's virtio_device itself isn't what
-actually wakes up the device, it is responsible for processing wakeup
-events. In the same way that EPOLLWAKEUP uses a dedicated wakeup_source
-to prevent suspend when userspace is processing wakeup events, a
-dedicated wakeup_source is necessary when processing wakeup events in a
-higher layer in the kernel.
-
-Fixes: b12fbc3f787e ("virtio_balloon: stay awake while adjusting balloon")
-Signed-off-by: David Stevens <stevensd@chromium.org>
-Acked-by: David Hildenbrand <david@redhat.com>
-Message-Id: <20240321012445.1593685-2-stevensd@google.com>
-Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/virtio/virtio_balloon.c | 13 +++++++++++--
- 1 file changed, 11 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
-index 1f5b3dd31fcfc..89bc8da80519f 100644
---- a/drivers/virtio/virtio_balloon.c
-+++ b/drivers/virtio/virtio_balloon.c
-@@ -450,7 +450,7 @@ static void start_update_balloon_size(struct virtio_balloon *vb)
- vb->adjustment_signal_pending = true;
- if (!vb->adjustment_in_progress) {
- vb->adjustment_in_progress = true;
-- pm_stay_awake(vb->vdev->dev.parent);
-+ pm_stay_awake(&vb->vdev->dev);
- }
- spin_unlock_irqrestore(&vb->adjustment_lock, flags);
-
-@@ -462,7 +462,7 @@ static void end_update_balloon_size(struct virtio_balloon *vb)
- spin_lock_irq(&vb->adjustment_lock);
- if (!vb->adjustment_signal_pending && vb->adjustment_in_progress) {
- vb->adjustment_in_progress = false;
-- pm_relax(vb->vdev->dev.parent);
-+ pm_relax(&vb->vdev->dev);
- }
- spin_unlock_irq(&vb->adjustment_lock);
- }
-@@ -1029,6 +1029,15 @@ static int virtballoon_probe(struct virtio_device *vdev)
-
- spin_lock_init(&vb->adjustment_lock);
-
-+ /*
-+ * The virtio balloon itself can't wake up the device, but it is
-+ * responsible for processing wakeup events passed up from the transport
-+ * layer. Wakeup sources don't support nesting/chaining calls, so we use
-+ * our own wakeup source to ensure wakeup events are properly handled
-+ * without trampling on the transport layer's wakeup source.
-+ */
-+ device_set_wakeup_capable(&vb->vdev->dev, true);
-+
- virtio_device_ready(vdev);
-
- if (towards_target(vb))
---
-2.43.0
-
+++ /dev/null
-From 248cb4fab31926195f58433bfdb49df06e1d7c99 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 24 Apr 2024 14:27:23 +0200
-Subject: VMCI: Fix an error handling path in vmci_guest_probe_device()
-
-From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
-
-[ Upstream commit 73df3d6f2e9533e93a5039a33c40dd7216b81801 ]
-
-After a successful pci_iomap_range() call, pci_iounmap() should be called
-in the error handling path, as already done in the remove function.
-
-Add the missing call.
-
-The corresponding call was added in the remove function in commit
-5ee109828e73 ("VMCI: dma dg: allocate send and receive buffers for DMA
-datagrams")
-
-Fixes: e283a0e8b7ea ("VMCI: dma dg: add MMIO access to registers")
-Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
-Acked-by: Vishnu Dasa <vishnu.dasa@broadcom.com>
-Link: https://lore.kernel.org/r/a35bbc3876ae1da70e49dafde4435750e1477be3.1713961553.git.christophe.jaillet@wanadoo.fr
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/misc/vmw_vmci/vmci_guest.c | 10 ++++++++--
- 1 file changed, 8 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/misc/vmw_vmci/vmci_guest.c b/drivers/misc/vmw_vmci/vmci_guest.c
-index 4f8d962bb5b2a..1300ccab3d21b 100644
---- a/drivers/misc/vmw_vmci/vmci_guest.c
-+++ b/drivers/misc/vmw_vmci/vmci_guest.c
-@@ -625,7 +625,8 @@ static int vmci_guest_probe_device(struct pci_dev *pdev,
- if (!vmci_dev) {
- dev_err(&pdev->dev,
- "Can't allocate memory for VMCI device\n");
-- return -ENOMEM;
-+ error = -ENOMEM;
-+ goto err_unmap_mmio_base;
- }
-
- vmci_dev->dev = &pdev->dev;
-@@ -642,7 +643,8 @@ static int vmci_guest_probe_device(struct pci_dev *pdev,
- if (!vmci_dev->tx_buffer) {
- dev_err(&pdev->dev,
- "Can't allocate memory for datagram tx buffer\n");
-- return -ENOMEM;
-+ error = -ENOMEM;
-+ goto err_unmap_mmio_base;
- }
-
- vmci_dev->data_buffer = dma_alloc_coherent(&pdev->dev, VMCI_DMA_DG_BUFFER_SIZE,
-@@ -893,6 +895,10 @@ static int vmci_guest_probe_device(struct pci_dev *pdev,
- err_free_data_buffers:
- vmci_free_dg_buffers(vmci_dev);
-
-+err_unmap_mmio_base:
-+ if (mmio_base != NULL)
-+ pci_iounmap(pdev, mmio_base);
-+
- /* The rest are managed resources and will be freed by PCI core */
- return error;
- }
---
-2.43.0
-
+++ /dev/null
-From 3275ae81a8317fa8106b17ae8afa036c1819e4ef Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 8 Apr 2024 13:02:31 +0300
-Subject: watchdog: bd9576: Drop "always-running" property
-
-From: Matti Vaittinen <mazziesaccount@gmail.com>
-
-[ Upstream commit e3b3afd34d84efcbe4543deb966b1990f43584b8 ]
-
-The always-running (from linux,wdt-gpio.yaml) is abused by the BD9576
-watchdog driver. It's defined meaning is "the watchdog is always running
-and can not be stopped". The BD9576 watchdog driver has implemented it
-as "start watchdog when loading the module and prevent it from being
-stopped".
-
-Furthermore, the implementation does not set the WDOG_HW_RUNNING when
-enabling the watchdog due to the "always-running" at module loading.
-This will end up resulting a watchdog timeout if the device is not
-opened.
-
-The culprit was pointed out by Guenter, discussion can be found from
-https://lore.kernel.org/lkml/4fa3a64b-60fb-4e5e-8785-0f14da37eea2@roeck-us.net/
-
-Drop the invalid "always-running" handling.
-
-Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
-Reported-by: Guenter Roeck <linux@roeck-us.net>
-Fixes: b237bcac557a ("wdt: Support wdt on ROHM BD9576MUF and BD9573MUF")
-Reviewed-by: Guenter Roeck <linux@roeck-us.net>
-Link: https://lore.kernel.org/r/ZhPAt76yaJMersXf@fedora
-Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/watchdog/bd9576_wdt.c | 12 +-----------
- 1 file changed, 1 insertion(+), 11 deletions(-)
-
-diff --git a/drivers/watchdog/bd9576_wdt.c b/drivers/watchdog/bd9576_wdt.c
-index 4a20e07fbb699..f00ea1b4e40b6 100644
---- a/drivers/watchdog/bd9576_wdt.c
-+++ b/drivers/watchdog/bd9576_wdt.c
-@@ -29,7 +29,6 @@ struct bd9576_wdt_priv {
- struct gpio_desc *gpiod_en;
- struct device *dev;
- struct regmap *regmap;
-- bool always_running;
- struct watchdog_device wdd;
- };
-
-@@ -62,10 +61,7 @@ static int bd9576_wdt_stop(struct watchdog_device *wdd)
- {
- struct bd9576_wdt_priv *priv = watchdog_get_drvdata(wdd);
-
-- if (!priv->always_running)
-- bd9576_wdt_disable(priv);
-- else
-- set_bit(WDOG_HW_RUNNING, &wdd->status);
-+ bd9576_wdt_disable(priv);
-
- return 0;
- }
-@@ -264,9 +260,6 @@ static int bd9576_wdt_probe(struct platform_device *pdev)
- if (ret)
- return ret;
-
-- priv->always_running = device_property_read_bool(dev->parent,
-- "always-running");
--
- watchdog_set_drvdata(&priv->wdd, priv);
-
- priv->wdd.info = &bd957x_wdt_ident;
-@@ -281,9 +274,6 @@ static int bd9576_wdt_probe(struct platform_device *pdev)
-
- watchdog_stop_on_reboot(&priv->wdd);
-
-- if (priv->always_running)
-- bd9576_wdt_start(&priv->wdd);
--
- return devm_watchdog_register_device(dev, &priv->wdd);
- }
-
---
-2.43.0
-
+++ /dev/null
-From fe607c546ebfd6deae3815254cf61033f37ba6b5 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sun, 24 Mar 2024 22:04:44 +0800
-Subject: watchdog: cpu5wdt.c: Fix use-after-free bug caused by cpu5wdt_trigger
-
-From: Duoming Zhou <duoming@zju.edu.cn>
-
-[ Upstream commit 573601521277119f2e2ba5f28ae6e87fc594f4d4 ]
-
-When the cpu5wdt module is removing, the origin code uses del_timer() to
-de-activate the timer. If the timer handler is running, del_timer() could
-not stop it and will return directly. If the port region is released by
-release_region() and then the timer handler cpu5wdt_trigger() calls outb()
-to write into the region that is released, the use-after-free bug will
-happen.
-
-Change del_timer() to timer_shutdown_sync() in order that the timer handler
-could be finished before the port region is released.
-
-Fixes: e09d9c3e9f85 ("watchdog: cpu5wdt.c: add missing del_timer call")
-Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
-Reviewed-by: Guenter Roeck <linux@roeck-us.net>
-Link: https://lore.kernel.org/r/20240324140444.119584-1-duoming@zju.edu.cn
-Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/watchdog/cpu5wdt.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/drivers/watchdog/cpu5wdt.c b/drivers/watchdog/cpu5wdt.c
-index 688b112e712ba..9f279c0e13a66 100644
---- a/drivers/watchdog/cpu5wdt.c
-+++ b/drivers/watchdog/cpu5wdt.c
-@@ -252,7 +252,7 @@ static void cpu5wdt_exit(void)
- if (cpu5wdt_device.queue) {
- cpu5wdt_device.queue = 0;
- wait_for_completion(&cpu5wdt_device.stop);
-- del_timer(&cpu5wdt_device.timer);
-+ timer_shutdown_sync(&cpu5wdt_device.timer);
- }
-
- misc_deregister(&cpu5wdt_misc);
---
-2.43.0
-
+++ /dev/null
-From 1bcf6a59c37308e0abf96dfa0e08d7364325bed6 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 26 Apr 2024 15:58:08 +0800
-Subject: watchdog: sa1100: Fix PTR_ERR_OR_ZERO() vs NULL check in
- sa1100dog_probe()
-
-From: Chen Ni <nichen@iscas.ac.cn>
-
-[ Upstream commit 413bf4e857fd79617524d5dcd35f463e9aa2dd41 ]
-
-devm_ioremap() doesn't return error pointers, it returns NULL on error.
-Update the check accordingly.
-
-Fixes: e86bd43bcfc5 ("watchdog: sa1100: use platform device registration")
-Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
-Reviewed-by: Guenter Roeck <linux@roeck-us.net>
-Link: https://lore.kernel.org/r/20240426075808.1582678-1-nichen@iscas.ac.cn
-Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/watchdog/sa1100_wdt.c | 5 ++---
- 1 file changed, 2 insertions(+), 3 deletions(-)
-
-diff --git a/drivers/watchdog/sa1100_wdt.c b/drivers/watchdog/sa1100_wdt.c
-index 5d2df008b92a5..34a917221e316 100644
---- a/drivers/watchdog/sa1100_wdt.c
-+++ b/drivers/watchdog/sa1100_wdt.c
-@@ -191,9 +191,8 @@ static int sa1100dog_probe(struct platform_device *pdev)
- if (!res)
- return -ENXIO;
- reg_base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
-- ret = PTR_ERR_OR_ZERO(reg_base);
-- if (ret)
-- return ret;
-+ if (!reg_base)
-+ return -ENOMEM;
-
- clk = clk_get(NULL, "OSTIMER0");
- if (IS_ERR(clk)) {
---
-2.43.0
-
+++ /dev/null
-From 5c7bea51e60cca641c90834d5422214e4a147f2b Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sun, 4 Feb 2024 21:20:03 +0900
-Subject: x86/kconfig: Select ARCH_WANT_FRAME_POINTERS again when
- UNWINDER_FRAME_POINTER=y
-
-From: Masahiro Yamada <masahiroy@kernel.org>
-
-[ Upstream commit 66ee3636eddcc82ab82b539d08b85fb5ac1dff9b ]
-
-It took me some time to understand the purpose of the tricky code at
-the end of arch/x86/Kconfig.debug.
-
-Without it, the following would be shown:
-
- WARNING: unmet direct dependencies detected for FRAME_POINTER
-
-because
-
- 81d387190039 ("x86/kconfig: Consolidate unwinders into multiple choice selection")
-
-removed 'select ARCH_WANT_FRAME_POINTERS'.
-
-The correct and more straightforward approach should have been to move
-it where 'select FRAME_POINTER' is located.
-
-Several architectures properly handle the conditional selection of
-ARCH_WANT_FRAME_POINTERS. For example, 'config UNWINDER_FRAME_POINTER'
-in arch/arm/Kconfig.debug.
-
-Fixes: 81d387190039 ("x86/kconfig: Consolidate unwinders into multiple choice selection")
-Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
-Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
-Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
-Link: https://lore.kernel.org/r/20240204122003.53795-1-masahiroy@kernel.org
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/x86/Kconfig.debug | 5 +----
- 1 file changed, 1 insertion(+), 4 deletions(-)
-
-diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
-index c5d614d28a759..74777a97e394a 100644
---- a/arch/x86/Kconfig.debug
-+++ b/arch/x86/Kconfig.debug
-@@ -248,6 +248,7 @@ config UNWINDER_ORC
-
- config UNWINDER_FRAME_POINTER
- bool "Frame pointer unwinder"
-+ select ARCH_WANT_FRAME_POINTERS
- select FRAME_POINTER
- help
- This option enables the frame pointer unwinder for unwinding kernel
-@@ -271,7 +272,3 @@ config UNWINDER_GUESS
- overhead.
-
- endchoice
--
--config FRAME_POINTER
-- depends on !UNWINDER_ORC && !UNWINDER_GUESS
-- bool
---
-2.43.0
-
+++ /dev/null
-From 34184d6fb9fef1a7c9f444714e21c883eab338fd Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 29 Apr 2024 17:50:53 +0200
-Subject: xen/x86: add extra pages to unpopulated-alloc if available
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Roger Pau Monne <roger.pau@citrix.com>
-
-[ Upstream commit a6aa4eb994ee9ced905743817c5de8451d26b911 ]
-
-Commit 262fc47ac174 ('xen/balloon: don't use PV mode extra memory for zone
-device allocations') removed the addition of the extra memory ranges to the
-unpopulated range allocator, using those only for the balloon driver.
-
-This forces the unpopulated allocator to attach hotplug ranges even when spare
-memory (as part of the extra memory ranges) is available. Furthermore, on PVH
-domains it defeats the purpose of commit 38620fc4e893 ('x86/xen: attempt to
-inflate the memory balloon on PVH'), as extra memory ranges would only be
-used to map foreign memory if the kernel is built without XEN_UNPOPULATED_ALLOC
-support.
-
-Fix this by adding a helpers that adds the extra memory ranges to the list of
-unpopulated pages, and zeroes the ranges so they are not also consumed by the
-balloon driver.
-
-This should have been part of 38620fc4e893, hence the fixes tag.
-
-Note the current logic relies on unpopulated_init() (and hence
-arch_xen_unpopulated_init()) always being called ahead of balloon_init(), so
-that the extra memory regions are consumed by arch_xen_unpopulated_init().
-
-Fixes: 38620fc4e893 ('x86/xen: attempt to inflate the memory balloon on PVH')
-Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
-Reviewed-by: Juergen Gross <jgross@suse.com>
-Link: https://lore.kernel.org/r/20240429155053.72509-1-roger.pau@citrix.com
-Signed-off-by: Juergen Gross <jgross@suse.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/x86/xen/enlighten.c | 33 +++++++++++++++++++++++++++++++++
- 1 file changed, 33 insertions(+)
-
-diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
-index a01ca255b0c64..b88722dfc4f86 100644
---- a/arch/x86/xen/enlighten.c
-+++ b/arch/x86/xen/enlighten.c
-@@ -382,3 +382,36 @@ void __init xen_add_extra_mem(unsigned long start_pfn, unsigned long n_pfns)
-
- memblock_reserve(PFN_PHYS(start_pfn), PFN_PHYS(n_pfns));
- }
-+
-+#ifdef CONFIG_XEN_UNPOPULATED_ALLOC
-+int __init arch_xen_unpopulated_init(struct resource **res)
-+{
-+ unsigned int i;
-+
-+ if (!xen_domain())
-+ return -ENODEV;
-+
-+ /* Must be set strictly before calling xen_free_unpopulated_pages(). */
-+ *res = &iomem_resource;
-+
-+ /*
-+ * Initialize with pages from the extra memory regions (see
-+ * arch/x86/xen/setup.c).
-+ */
-+ for (i = 0; i < XEN_EXTRA_MEM_MAX_REGIONS; i++) {
-+ unsigned int j;
-+
-+ for (j = 0; j < xen_extra_mem[i].n_pfns; j++) {
-+ struct page *pg =
-+ pfn_to_page(xen_extra_mem[i].start_pfn + j);
-+
-+ xen_free_unpopulated_pages(1, &pg);
-+ }
-+
-+ /* Zero so region is not also added to the balloon driver. */
-+ xen_extra_mem[i].n_pfns = 0;
-+ }
-+
-+ return 0;
-+}
-+#endif
---
-2.43.0
-