kconfig: merge_config: use an empty file as initfile
Subsystems (79)
Sasha Levin
maintainerPATCH 1/486 kconfig: merge_config: use an empty file as initfile
From: Daniel Gomez <[email protected]>
[ Upstream commit a26fe287eed112b4e21e854f173c8918a6a8596d ]
The scripts/kconfig/merge_config.sh script requires an existing $INITFILE (or the $1 argument) as a base file for merging Kconfig fragments. However, an empty $INITFILE can serve as an initial starting point, later referenced by the KCONFIG_ALLCONFIG Makefile variable if -m is not used. This variable can point to any configuration file containing preset config symbols (the merged output) as stated in Documentation/kbuild/kconfig.rst. When -m is used $INITFILE will contain just the merge output requiring the user to run make (i.e. KCONFIG_ALLCONFIG=<$INITFILE> make <allnoconfig/alldefconfig> or make olddefconfig).
Instead of failing when $INITFILE is missing, create an empty file and use it as the starting point for merges.
--- scripts/kconfig/merge_config.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/kconfig/merge_config.sh +2 -2
@@ -112,8 +112,8 @@ INITFILE=$1 shift; if [ ! -r "$INITFILE" ]; then - echo "The base file '$INITFILE' does not exist. Exit." >&2 - exit 1 + echo "The base file '$INITFILE' does not exist. Creating one..." >&2 + touch "$INITFILE" fi MERGE_LIST=$*
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 2/486 x86/fred: Fix system hang during S4 resume with FRED enabled
From: "Xin Li (Intel)" <[email protected]>
[ Upstream commit e5f1e8af9c9e151ecd665f6d2e36fb25fec3b110 ]
Upon a wakeup from S4, the restore kernel starts and initializes the FRED MSRs as needed from its perspective. It then loads a hibernation image, including the image kernel, and attempts to load image pages directly into their original page frames used before hibernation unless those frames are currently in use. Once all pages are moved to their original locations, it jumps to a "trampoline" page in the image kernel.
At this point, the image kernel takes control, but the FRED MSRs still contain values set by the restore kernel, which may differ from those set by the image kernel before hibernation. Therefore, the image kernel must ensure the FRED MSRs have the same values as before hibernation. Since these values depend only on the location of the kernel text and data, they can be recomputed from scratch.
--- arch/x86/power/cpu.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
arch/x86/power/cpu.c +14 -0
@@ -27,6 +27,7 @@#include <asm/mmu_context.h> #include <asm/cpu_device_id.h> #include <asm/microcode.h> +#include <asm/fred.h> #ifdef CONFIG_X86_32 __visible unsigned long saved_context_ebx;
@@ -231,6 +232,19 @@ static void notrace __restore_processor_state(struct saved_context *ctxt)*/ #ifdef CONFIG_X86_64 wrmsrl (MSR_GS_BASE , ctxt->kernelmode_gs_base); + +/* +* Reinitialize FRED to ensure the FRED MSRs contain the same values +* as before hibernation. +* +* Note, the setup of FRED RSPs requires access to percpu data +* structures. Therefore, FRED reinitialization can only occur after +* the percpu access pointer (i.e., MSR_GS_BASE) is restored. +*/ +if (ctxt->cr4 &X86_CR4_FRED ) { +cpu_init_fred_exceptions (); +cpu_init_fred_rsps (); + }#else loadsegment (fs, __KERNEL_PERCPU);#endif
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 3/486 s390/vfio-ap: Fix no AP queue sharing allowed message written to kernel log
In reply to Sasha LevinFrom: Anthony Krowiak <[email protected]>
[ Upstream commit d33d729afcc8ad2148d99f9bc499b33fd0c0d73b ]
An erroneous message is written to the kernel log when either of the following actions are taken by a user:
1. Assign an adapter or domain to a vfio_ap mediated device via its sysfs assign_adapter or assign_domain attributes that would result in one or more AP queues being assigned that are already assigned to a different mediated device. Sharing of queues between mdevs is not allowed.
2. Reserve an adapter or domain for the host device driver via the AP bus driver's sysfs apmask or aqmask attribute that would result in providing host access to an AP queue that is in use by a vfio_ap mediated device. Reserving a queue for a host driver that is in use by an mdev is not allowed.
In both cases, the assignment will return an error; however, a message like the following is written to the kernel log:
vfio_ap_mdev e1839397-51a0-4e3c-91e0-c3b9c3d3047d: Userspace may not re-assign queue 00.0028 already assigned to \
e1839397-51a0-4e3c-91e0-c3b9c3d3047d
Notice the mdev reporting the error is the same as the mdev identified in the message as the one to which the queue is being assigned. It is perfectly okay to assign a queue to an mdev to which it is already assigned; the assignment is simply ignored by the vfio_ap device driver.
This patch logs more descriptive and accurate messages for both 1 and 2 above to the kernel log:
Example for 1:vfio_ap_mdev 0fe903a0-a323-44db-9daf-134c68627d61: Userspace may not assign queue 00.0033 to mdev: already assigned to \
62177883-f1bb-47f0-914d-32a22e3a8804
Example for 2:vfio_ap_mdev 62177883-f1bb-47f0-914d-32a22e3a8804: Can not reserve queue 00.0033 for host driver: in use by mdev
--- drivers/s390/crypto/vfio_ap_ops.c | 72 ++++++++++++++++++++----------- 1 file changed, 46 insertions(+), 26 deletions(-)
drivers/s390/crypto/vfio_ap_ops.c +46 -26
@@ -851,48 +851,66 @@ static void vfio_ap_mdev_remove(struct mdev_device *mdev)vfio_put_device (&matrix_mdev->vdev); } -#define MDEV_SHARING_ERR "Userspace may not re-assign queue %02lx.%04lx " \ - "already assigned to %s" +#define MDEV_SHARING_ERR "Userspace may not assign queue %02lx.%04lx to mdev: already assigned to %s" -static void vfio_ap_mdev_log_sharing_err (struct ap_matrix_mdev *matrix_mdev, -unsigned long *apm, -unsigned long *aqm) +#define MDEV_IN_USE_ERR "Can not reserve queue %02lx.%04lx for host driver: in use by mdev" + +static void vfio_ap_mdev_log_sharing_err (struct ap_matrix_mdev *assignee, +struct ap_matrix_mdev *assigned_to, +unsigned long *apm,unsigned long *aqm) {unsigned long apid, apqi; -const struct device *dev =mdev_dev (matrix_mdev->mdev); -const char *mdev_name =dev_name (dev); -for_each_set_bit_inv (apid, apm,AP_DEVICES ) +for_each_set_bit_inv (apid, apm,AP_DEVICES ) { +for_each_set_bit_inv (apqi, aqm,AP_DOMAINS ) { +dev_warn (mdev_dev (assignee->mdev),MDEV_SHARING_ERR , + apid, apqi,dev_name (mdev_dev (assigned_to->mdev))); + } + } +} + +static void vfio_ap_mdev_log_in_use_err (struct ap_matrix_mdev *assignee, +unsigned long *apm,unsigned long *aqm) +{ +unsigned long apid, apqi; + +for_each_set_bit_inv (apid, apm,AP_DEVICES ) {for_each_set_bit_inv (apqi, aqm,AP_DOMAINS ) -dev_warn (dev,MDEV_SHARING_ERR , apid, apqi, mdev_name); +dev_warn (mdev_dev (assignee->mdev),MDEV_IN_USE_ERR , apid, apqi); + } }/** * vfio_ap_mdev_verify_no_sharing - verify APQNs are not shared by matrix mdevs * +* @assignee: the matrix mdev to which @mdev_apm and @mdev_aqm are being +* assigned; or, NULL if this function was called by the AP bus +* driver in_use callback to verify none of the APQNs being reserved +* for the host device driver are in use by a vfio_ap mediated device * @mdev_apm: mask indicating the APIDs of the APQNs to be verified * @mdev_aqm: mask indicating the APQIs of the APQNs to be verified * -* Verifies that each APQN derived from the Cartesian product of a bitmap of -* AP adapter IDs and AP queue indexes is not configured for any matrix -* mediated device. AP queue sharing is not allowed. +* Verifies that each APQN derived from the Cartesian product of APIDs +* represented by the bits set in @mdev_apm and the APQIs of the bits set in +* @mdev_aqm is not assigned to a mediated device other than the mdev to which +* the APQN is being assigned (@assignee). AP queue sharing is not allowed. * * Return: 0 if the APQNs are not shared; otherwise return -EADDRINUSE. */ -static int vfio_ap_mdev_verify_no_sharing (unsigned long *mdev_apm, +static int vfio_ap_mdev_verify_no_sharing (struct ap_matrix_mdev *assignee, +unsigned long *mdev_apm,unsigned long *mdev_aqm) { -struct ap_matrix_mdev *matrix_mdev; +struct ap_matrix_mdev *assigned_to;DECLARE_BITMAP (apm,AP_DEVICES );DECLARE_BITMAP (aqm,AP_DOMAINS ); -list_for_each_entry (matrix_mdev, &matrix_dev->mdev_list, node) { +list_for_each_entry (assigned_to, &matrix_dev->mdev_list, node) {/* -* If the input apm and aqm are fields of the matrix_mdev -* object, then move on to the next matrix_mdev. +* If the mdev to which the mdev_apm and mdev_aqm is being +* assigned is the same as the mdev being verified */ -if (mdev_apm == matrix_mdev->matrix.apm && - mdev_aqm == matrix_mdev->matrix.aqm) +if (assignee == assigned_to)continue ;memset (apm,0 ,sizeof (apm));
@@ -902,15 +920,16 @@ static int vfio_ap_mdev_verify_no_sharing(unsigned long *mdev_apm,* We work on full longs, as we can only exclude the leftover * bits in non-inverse order. The leftover is all zeros. */ -if (!bitmap_and (apm, mdev_apm, matrix_mdev->matrix.apm, -AP_DEVICES )) +if (!bitmap_and (apm, mdev_apm, assigned_to->matrix.apm,AP_DEVICES ))continue ; -if (!bitmap_and (aqm, mdev_aqm, matrix_mdev->matrix.aqm, -AP_DOMAINS )) +if (!bitmap_and (aqm, mdev_aqm, assigned_to->matrix.aqm,AP_DOMAINS ))continue ; -vfio_ap_mdev_log_sharing_err (matrix_mdev, apm, aqm); +if (assignee) +vfio_ap_mdev_log_sharing_err (assignee, assigned_to, apm, aqm); +else +vfio_ap_mdev_log_in_use_err (assigned_to, apm, aqm);return -EADDRINUSE ; }
@@ -939,7 +958,8 @@ static int vfio_ap_mdev_validate_masks(struct ap_matrix_mdev *matrix_mdev) matrix_mdev->matrix.aqm))return -EADDRNOTAVAIL ; -return vfio_ap_mdev_verify_no_sharing (matrix_mdev->matrix.apm, +return vfio_ap_mdev_verify_no_sharing (matrix_mdev, + matrix_mdev->matrix.apm, matrix_mdev->matrix.aqm); }
@@ -2467,7 +2487,7 @@ int vfio_ap_mdev_resource_in_use(unsigned long *apm, unsigned long *aqm)mutex_lock (&matrix_dev->guests_lock);mutex_lock (&matrix_dev->mdevs_lock); - ret =vfio_ap_mdev_verify_no_sharing (apm, aqm); + ret =vfio_ap_mdev_verify_no_sharing (NULL , apm, aqm);mutex_unlock (&matrix_dev->mdevs_lock);mutex_unlock (&matrix_dev->guests_lock);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 4/486 cifs: Add fallback for SMB2 CREATE without FILE_READ_ATTRIBUTES
In reply to Sasha LevinFrom: Pali Rohár <[email protected]>
[ Upstream commit e255612b5ed9f179abe8196df7c2ba09dd227900 ]
Some operations, like WRITE, does not require FILE_READ_ATTRIBUTES access.
So when FILE_READ_ATTRIBUTES is not explicitly requested for smb2_open_file() then first try to do SMB2 CREATE with FILE_READ_ATTRIBUTES access (like it was before) and then fallback to SMB2 CREATE without FILE_READ_ATTRIBUTES access (less common case).
This change allows to complete WRITE operation to a file when it does not grant FILE_READ_ATTRIBUTES permission and its parent directory does not grant READ_DATA permission (parent directory READ_DATA is implicit grant of child FILE_READ_ATTRIBUTES permission).
--- fs/smb/client/smb2file.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
fs/smb/client/smb2file.c +10 -1
@@ -107,16 +107,25 @@ int smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms, __u32int err_buftype =CIFS_NO_BUFFER ;struct cifs_fid *fid = oparms->fid;struct network_resiliency_req nr_ioctl_req; +bool retry_without_read_attributes = false; smb2_path =cifs_convert_path_to_utf16 (oparms->path, oparms->cifs_sb);if (smb2_path ==NULL )return -ENOMEM ; - oparms->desired_access |=FILE_READ_ATTRIBUTES ; +if (!(oparms->desired_access &FILE_READ_ATTRIBUTES )) { + oparms->desired_access |=FILE_READ_ATTRIBUTES ; + retry_without_read_attributes = true; + } smb2_oplock =SMB2_OPLOCK_LEVEL_BATCH ; rc =SMB2_open (xid, oparms, smb2_path, &smb2_oplock, smb2_data,NULL , &err_iov, &err_buftype); +if (rc == -EACCES && retry_without_read_attributes) { + oparms->desired_access &= ~FILE_READ_ATTRIBUTES ; + rc =SMB2_open (xid, oparms, smb2_path, &smb2_oplock, smb2_data,NULL , &err_iov, + &err_buftype); + }if (rc && data) {struct smb2_hdr *hdr = err_iov.iov_base;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 5/486 cifs: Fix querying and creating MF symlinks over SMB1
In reply to Sasha LevinFrom: Pali Rohár <[email protected]>
[ Upstream commit 4236ac9fe5b8b42756070d4abfb76fed718e87c2 ]
Old SMB1 servers without CAP_NT_SMBS do not support CIFS_open() function and instead SMBLegacyOpen() needs to be used. This logic is already handled in cifs_open_file() function, which is server->ops->open callback function.
So for querying and creating MF symlinks use open callback function instead of CIFS_open() function directly.
This change fixes querying and creating new MF symlinks on Windows 98. Currently cifs_query_mf_symlink() is not able to detect MF symlink and cifs_create_mf_symlink() is failing with EIO error.
--- fs/smb/client/link.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/smb/client/link.c +4 -4
@@ -257,7 +257,7 @@ cifs_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,struct cifs_open_parms oparms;struct cifs_io_parms io_parms = {0 };int buf_type =CIFS_NO_BUFFER ; -FILE_ALL_INFO file_info; +struct cifs_open_info_data query_data; oparms = (struct cifs_open_parms ) { .tcon = tcon,
@@ -269,11 +269,11 @@ cifs_query_mf_symlink(unsigned int xid, struct cifs_tcon *tcon, .fid = &fid, }; - rc =CIFS_open (xid, &oparms, &oplock, &file_info); + rc = tcon->ses->server->ops->open (xid, &oparms, &oplock, &query_data);if (rc)return rc; -if (file_info.EndOfFile !=cpu_to_le64 (CIFS_MF_SYMLINK_FILE_SIZE )) { +if (query_data.fi.EndOfFile !=cpu_to_le64 (CIFS_MF_SYMLINK_FILE_SIZE )) { rc = -ENOENT ;/* it's not a symlink */ goto out;
@@ -312,7 +312,7 @@ cifs_create_mf_symlink(unsigned int xid, struct cifs_tcon *tcon, .fid = &fid, }; - rc =CIFS_open (xid, &oparms, &oplock,NULL ); + rc = tcon->ses->server->ops->open (xid, &oparms, &oplock,NULL );if (rc)return rc;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 6/486 cifs: Fix negotiate retry functionality
In reply to Sasha LevinFrom: Pali Rohár <[email protected]>
[ Upstream commit e94e882a6d69525c07589222cf3a6ff57ad12b5b ]
SMB negotiate retry functionality in cifs_negotiate() is currently broken and does not work when doing socket reconnect. Caller of this function, which is cifs_negotiate_protocol() requires that tcpStatus after successful execution of negotiate callback stay in CifsInNegotiate. But if the CIFSSMBNegotiate() called from cifs_negotiate() fails due to connection issues then tcpStatus is changed as so repeated CIFSSMBNegotiate() call does not help.
Fix this problem by moving retrying code from negotiate callback (which is either cifs_negotiate() or smb2_negotiate()) to cifs_negotiate_protocol() which is caller of those callbacks. This allows to properly handle and implement correct transistions between tcpStatus states as function cifs_negotiate_protocol() already handles it.
With this change, cifs_negotiate_protocol() now handles also -EAGAIN error set by the RFC1002_NEGATIVE_SESSION_RESPONSE processing after reconnecting with NetBIOS session.
--- fs/smb/client/connect.c | 10 ++++++++++ fs/smb/client/smb1ops.c | 7 ------- fs/smb/client/smb2ops.c | 3 --- 3 files changed, 10 insertions(+), 10 deletions(-)
fs/smb/client/connect.c +10 -0
@@ -3937,11 +3937,13 @@ int cifs_negotiate_protocol(const unsigned int xid, struct cifs_ses *ses, struct TCP_Server_Info *server) { + bool in_retry = false;int rc =0 ;if (!server->ops->need_neg || !server->ops->negotiate)return -ENOSYS ; +retry:/* only send once per connect */ spin_lock (&server->srv_lock); if (server->tcpStatus != CifsGood &&
@@ -3961,6 +3963,14 @@ cifs_negotiate_protocol(const unsigned int xid, struct cifs_ses *ses,spin_unlock (&server->srv_lock); rc = server->ops->negotiate (xid, ses, server); +if (rc == -EAGAIN ) { +/* Allow one retry attempt */ +if (!in_retry) { + in_retry = true; + goto retry; + } + rc = -EHOSTDOWN ; + }if (rc ==0 ) {spin_lock (&server->srv_lock);if (server->tcpStatus == CifsInNegotiate)
fs/smb/client/smb1ops.c +0 -7
@@ -426,13 +426,6 @@ cifs_negotiate(const unsigned int xid, {int rc; rc =CIFSSMBNegotiate (xid, ses, server); -if (rc == -EAGAIN ) { -/* retry only once on 1st time connection */ -set_credits (server,1 ); - rc =CIFSSMBNegotiate (xid, ses, server); -if (rc == -EAGAIN ) - rc = -EHOSTDOWN ; - }return rc; }
fs/smb/client/smb2ops.c +0 -3
@@ -464,9 +464,6 @@ smb2_negotiate(const unsigned int xid, server->CurrentMid =0 ;spin_unlock (&server->mid_lock); rc =SMB2_negotiate (xid, ses, server); -/* BB we probably don't need to retry with modern servers */ -if (rc == -EAGAIN ) - rc = -EHOSTDOWN ;return rc; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 7/486 smb: client: Store original IO parameters and prevent zero IO sizes
In reply to Sasha LevinFrom: Wang Zhaolong <[email protected]>
[ Upstream commit 287906b20035a04a234d1a3c64f760a5678387be ]
During mount option processing and negotiation with the server, the original user-specified rsize/wsize values were being modified directly. This makes it impossible to recover these values after a connection reset, leading to potential degraded performance after reconnection.
The other problem is that When negotiating read and write sizes, there are cases where the negotiated values might calculate to zero, especially during reconnection when server->max_read or server->max_write might be reset. In general, these values come from the negotiation response. According to MS-SMB2 specification, these values should be at least 65536 bytes.
This patch improves IO parameter handling:
1. Adds vol_rsize and vol_wsize fields to store the original user-specified values separately from the negotiated values
2. Uses got_rsize/got_wsize flags to determine if values were user-specified rather than checking for non-zero values, which is more reliable
3. Adds a prevent_zero_iosize() helper function to ensure IO sizes are never negotiated down to zero, which could happen in edge cases like when server->max_read/write is zero
The changes make the CIFS client more resilient to unusual server responses and reconnection scenarios, preventing potential failures when IO sizes are calculated to be zero.
--- fs/smb/client/fs_context.c | 2 ++ fs/smb/client/fs_context.h | 3 +++ fs/smb/client/smb1ops.c | 6 +++--- fs/smb/client/smb2ops.c | 27 +++++++++++++++++++-------- fs/smb/common/smb2pdu.h | 3 +++ 5 files changed, 30 insertions(+), 11 deletions(-)
fs/smb/client/fs_context.c +2 -0
@@ -1237,6 +1237,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,case Opt_rsize: ctx->rsize = result.uint_32; ctx->got_rsize = true; + ctx->vol_rsize = ctx->rsize;break ;case Opt_wsize: ctx->wsize = result.uint_32;
@@ -1252,6 +1253,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc, ctx->wsize, PAGE_SIZE); } } + ctx->vol_wsize = ctx->wsize;break ;case Opt_acregmax:if (result.uint_32 >CIFS_MAX_ACTIMEO /HZ ) {
fs/smb/client/fs_context.h +3 -0
@@ -253,6 +253,9 @@ struct smb3_fs_context { bool use_client_guid:1;/* reuse existing guid for multichannel */ u8 client_guid[SMB2_CLIENT_GUID_SIZE ]; +/* User-specified original r/wsize value */ +unsigned int vol_rsize; +unsigned int vol_wsize;unsigned int bsize;unsigned int rasize;unsigned int rsize;
fs/smb/client/smb1ops.c +3 -3
@@ -437,8 +437,8 @@ cifs_negotiate_wsize(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)unsigned int wsize;/* start with specified wsize, or default */ -if (ctx->wsize) - wsize = ctx->wsize; +if (ctx->got_wsize) + wsize = ctx->vol_wsize;else if (tcon->unix_ext && (unix_cap &CIFS_UNIX_LARGE_WRITE_CAP )) wsize =CIFS_DEFAULT_IOSIZE ;else
@@ -490,7 +490,7 @@ cifs_negotiate_rsize(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)else defsize = server->maxBuf -sizeof (READ_RSP ); - rsize = ctx->rsize ? ctx->rsize : defsize; + rsize = ctx->got_rsize ? ctx->vol_rsize : defsize;/* * no CAP_LARGE_READ_X? Then MS-CIFS states that we must limit this to
fs/smb/client/smb2ops.c +19 -8
@@ -467,6 +467,17 @@ smb2_negotiate(const unsigned int xid,return rc; } +static inline unsigned int +prevent_zero_iosize (unsigned int size,const char *type) +{ +if (size ==0 ) { +cifs_dbg (VFS ,"SMB: Zero %ssize calculated, using minimum value %u\n" , + type,CIFS_MIN_DEFAULT_IOSIZE ); +return CIFS_MIN_DEFAULT_IOSIZE ; + } +return size; +} +static unsigned int smb2_negotiate_wsize (struct cifs_tcon *tcon,struct smb3_fs_context *ctx) {
@@ -474,12 +485,12 @@ smb2_negotiate_wsize(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)unsigned int wsize;/* start with specified wsize, or default */ - wsize = ctx->wsize ? ctx->wsize :CIFS_DEFAULT_IOSIZE ; + wsize = ctx->got_wsize ? ctx->vol_wsize :CIFS_DEFAULT_IOSIZE ; wsize = min_t(unsigned int, wsize, server->max_write);if (!(server->capabilities &SMB2_GLOBAL_CAP_LARGE_MTU )) wsize = min_t(unsigned int, wsize, SMB2_MAX_BUFFER_SIZE); -return wsize; +return prevent_zero_iosize (wsize,"w" ); } static unsigned int
@@ -489,7 +500,7 @@ smb3_negotiate_wsize(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)unsigned int wsize;/* start with specified wsize, or default */ - wsize = ctx->wsize ? ctx->wsize :SMB3_DEFAULT_IOSIZE ; + wsize = ctx->got_wsize ? ctx->vol_wsize :SMB3_DEFAULT_IOSIZE ; wsize = min_t(unsigned int, wsize, server->max_write);#ifdef CONFIG_CIFS_SMB_DIRECT if (server->rdma) {
@@ -511,7 +522,7 @@ smb3_negotiate_wsize(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)if (!(server->capabilities &SMB2_GLOBAL_CAP_LARGE_MTU )) wsize = min_t(unsigned int, wsize, SMB2_MAX_BUFFER_SIZE); -return wsize; +return prevent_zero_iosize (wsize,"w" ); } static unsigned int
@@ -521,13 +532,13 @@ smb2_negotiate_rsize(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)unsigned int rsize;/* start with specified rsize, or default */ - rsize = ctx->rsize ? ctx->rsize :CIFS_DEFAULT_IOSIZE ; + rsize = ctx->got_rsize ? ctx->vol_rsize :CIFS_DEFAULT_IOSIZE ; rsize = min_t(unsigned int, rsize, server->max_read);if (!(server->capabilities &SMB2_GLOBAL_CAP_LARGE_MTU )) rsize = min_t(unsigned int, rsize, SMB2_MAX_BUFFER_SIZE); -return rsize; +return prevent_zero_iosize (rsize,"r" ); } static unsigned int
@@ -537,7 +548,7 @@ smb3_negotiate_rsize(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)unsigned int rsize;/* start with specified rsize, or default */ - rsize = ctx->rsize ? ctx->rsize :SMB3_DEFAULT_IOSIZE ; + rsize = ctx->got_rsize ? ctx->vol_rsize :SMB3_DEFAULT_IOSIZE ; rsize = min_t(unsigned int, rsize, server->max_read);#ifdef CONFIG_CIFS_SMB_DIRECT if (server->rdma) {
@@ -560,7 +571,7 @@ smb3_negotiate_rsize(struct cifs_tcon *tcon, struct smb3_fs_context *ctx)if (!(server->capabilities &SMB2_GLOBAL_CAP_LARGE_MTU )) rsize = min_t(unsigned int, rsize, SMB2_MAX_BUFFER_SIZE); -return rsize; +return prevent_zero_iosize (rsize,"r" ); }/*
fs/smb/common/smb2pdu.h +3 -0
@@ -95,6 +95,9 @@*/ #define SMB3_DEFAULT_IOSIZE (4 * 1024 * 1024) +/* According to MS-SMB2 specification The minimum recommended value is 65536.*/ +#define CIFS_MIN_DEFAULT_IOSIZE (65536) +/* * SMB2 Header Definition *
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 8/486 fuse: Return EPERM rather than ENOSYS from link()
In reply to Sasha LevinFrom: Matt Johnston <[email protected]>
[ Upstream commit 8344213571b2ac8caf013cfd3b37bc3467c3a893 ]
link() is documented to return EPERM when a filesystem doesn't support the operation, return that instead.
--- fs/fuse/dir.c | 2 ++ 1 file changed, 2 insertions(+)
fs/fuse/dir.c +2 -0
@@ -1133,6 +1133,8 @@ static int fuse_link(struct dentry *entry, struct inode *newdir,else if (err == -EINTR )fuse_invalidate_attr (inode); +if (err == -ENOSYS ) + err = -EPERM ;return err; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 9/486 exfat: call bh_read in get_block only when necessary
In reply to Sasha LevinFrom: Sungjong Seo <[email protected]>
[ Upstream commit c73e680d1f84059e1b1ea82a537f6ccc1c563eb4 ]
With commit 11a347fb6cef ("exfat: change to get file size from DataLength"), exfat_get_block() can now handle valid_size. However, most partial unwritten blocks that could be mapped with other blocks are being inefficiently processed separately as individual blocks.
Except for partial unwritten blocks that require independent processing, let's handle them simply as before.
--- fs/exfat/inode.c | 159 +++++++++++++++++++++++------------------------ 1 file changed, 77 insertions(+), 82 deletions(-)
fs/exfat/inode.c +77 -82
@@ -274,9 +274,11 @@ static int exfat_get_block(struct inode *inode, sector_t iblock,sector_t last_block;sector_t phys =0 ;sector_t valid_blks; +loff_t i_size;mutex_lock (&sbi->s_lock); - last_block =EXFAT_B_TO_BLK_ROUND_UP (i_size_read (inode), sb); + i_size =i_size_read (inode); + last_block =EXFAT_B_TO_BLK_ROUND_UP (i_size, sb);if (iblock >= last_block && !create) goto done;
@@ -305,102 +307,95 @@ static int exfat_get_block(struct inode *inode, sector_t iblock,if (buffer_delay (bh_result))clear_buffer_delay (bh_result); -if (create) { +/* +* In most cases, we just need to set bh_result to mapped, unmapped +* or new status as follows: +* 1. i_size == valid_size +* 2. write case (create == 1) +* 3. direct_read (!bh_result->b_folio) +* -> the unwritten part will be zeroed in exfat_direct_IO() +* +* Otherwise, in the case of buffered read, it is necessary to take +* care the last nested block if valid_size is not equal to i_size. +*/ +if (i_size == ei->valid_size || create || !bh_result->b_folio) valid_blks =EXFAT_B_TO_BLK_ROUND_UP (ei->valid_size, sb); +else + valid_blks =EXFAT_B_TO_BLK (ei->valid_size, sb); -if (iblock + max_blocks < valid_blks) { -/* The range has been written, map it */ - goto done; - }else if (iblock < valid_blks) { -/* -* The range has been partially written, -* map the written part. -*/ - max_blocks = valid_blks - iblock; - goto done; - } +/* The range has been fully written, map it */ +if (iblock + max_blocks < valid_blks) + goto done; -/* The area has not been written, map and mark as new. */ -set_buffer_new (bh_result); +/* The range has been partially written, map the written part */ +if (iblock < valid_blks) { + max_blocks = valid_blks - iblock; + goto done; + } +/* The area has not been written, map and mark as new for create case */ +if (create) { +set_buffer_new (bh_result); ei->valid_size =EXFAT_BLK_TO_B (iblock + max_blocks, sb);mark_inode_dirty (inode); - }else { - valid_blks =EXFAT_B_TO_BLK (ei->valid_size, sb); + goto done; + } -if (iblock + max_blocks < valid_blks) { -/* The range has been written, map it */ - goto done; - }else if (iblock < valid_blks) { -/* -* The area has been partially written, -* map the written part. -*/ - max_blocks = valid_blks - iblock; +/* +* The area has just one block partially written. +* In that case, we should read and fill the unwritten part of +* a block with zero. +*/ +if (bh_result->b_folio && iblock == valid_blks && + (ei->valid_size & (sb->s_blocksize -1 ))) { +loff_t size, pos; +void *addr; + + max_blocks =1 ; + +/* +* No buffer_head is allocated. +* (1) bmap: It's enough to set blocknr without I/O. +* (2) read: The unwritten part should be filled with zero. +* If a folio does not have any buffers, +* let's returns -EAGAIN to fallback to +* block_read_full_folio() for per-bh IO. +*/ +if (!folio_buffers (bh_result->b_folio)) { + err = -EAGAIN ; goto done; - }else if (iblock == valid_blks && - (ei->valid_size & (sb->s_blocksize -1 ))) { -/* -* The block has been partially written, -* zero the unwritten part and map the block. -*/ -loff_t size, pos; -void *addr; - - max_blocks =1 ; - -/* -* For direct read, the unwritten part will be zeroed in -* exfat_direct_IO() -*/ -if (!bh_result->b_folio) - goto done; - -/* -* No buffer_head is allocated. -* (1) bmap: It's enough to fill bh_result without I/O. -* (2) read: The unwritten part should be filled with 0 -* If a folio does not have any buffers, -* let's returns -EAGAIN to fallback to -* per-bh IO like block_read_full_folio(). -*/ -if (!folio_buffers (bh_result->b_folio)) { - err = -EAGAIN ; - goto done; - } + } - pos =EXFAT_BLK_TO_B (iblock, sb); - size = ei->valid_size - pos; - addr =folio_address (bh_result->b_folio) + -offset_in_folio (bh_result->b_folio, pos); + pos =EXFAT_BLK_TO_B (iblock, sb); + size = ei->valid_size - pos; + addr =folio_address (bh_result->b_folio) + +offset_in_folio (bh_result->b_folio, pos); -/* Check if bh->b_data points to proper addr in folio */ -if (bh_result->b_data != addr) { -exfat_fs_error_ratelimit (sb, +/* Check if bh->b_data points to proper addr in folio */ +if (bh_result->b_data != addr) { +exfat_fs_error_ratelimit (sb,"b_data(%p) != folio_addr(%p)" , bh_result->b_data, addr); - err = -EINVAL ; - goto done; - } - -/* Read a block */ - err =bh_read (bh_result,0 ); -if (err <0 ) - goto done; + err = -EINVAL ; + goto done; + } -/* Zero unwritten part of a block */ -memset (bh_result->b_data + size,0 , - bh_result->b_size - size); +/* Read a block */ + err =bh_read (bh_result,0 ); +if (err <0 ) + goto done; - err =0 ; - }else { -/* -* The range has not been written, clear the mapped flag -* to only zero the cache and do not read from disk. -*/ -clear_buffer_mapped (bh_result); - } +/* Zero unwritten part of a block */ +memset (bh_result->b_data + size,0 , bh_result->b_size - size); + err =0 ; + goto done; } + +/* +* The area has not been written, clear mapped for read/bmap cases. +* If so, it will be filled with zero without reading from disk. +*/ +clear_buffer_mapped (bh_result); done: bh_result->b_size =EXFAT_BLK_TO_B (max_blocks, sb);if (err <0 )
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 10/486 io_uring/msg: initialise msg request opcode
In reply to Sasha LevinFrom: Pavel Begunkov <[email protected]>
[ Upstream commit 9cc0bbdaba2a66ad90bc6ce45163b7745baffe98 ]
It's risky to have msg request opcode set to garbage, so at least initialise it to nop. Later we might want to add a user inaccessible opcode for such cases.
--- io_uring/msg_ring.c | 1 + 1 file changed, 1 insertion(+)
io_uring/msg_ring.c +1 -0
@@ -94,6 +94,7 @@ static int io_msg_remote_post(struct io_ring_ctx *ctx, struct io_kiocb *req,kmem_cache_free (req_cachep, req);return -EOWNERDEAD ; } + req->opcode =IORING_OP_NOP ; req->cqe.user_data = user_data;io_req_set_res (req, res, cflags);percpu_ref_get (&ctx->refs);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 11/486 NFSv4: Check for delegation validity in nfs_start_delegation_return_locked()
In reply to Sasha LevinFrom: Trond Myklebust <[email protected]>
[ Upstream commit 9e8f324bd44c1fe026b582b75213de4eccfa1163 ]
Check that the delegation is still attached after taking the spin lock in nfs_start_delegation_return_locked().
--- fs/nfs/delegation.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/nfs/delegation.c +2 -1
@@ -307,7 +307,8 @@ nfs_start_delegation_return_locked(struct nfs_inode *nfsi)if (delegation ==NULL ) goto out;spin_lock (&delegation->lock); -if (!test_and_set_bit (NFS_DELEGATION_RETURNING , &delegation->flags)) { +if (delegation->inode && + !test_and_set_bit (NFS_DELEGATION_RETURNING , &delegation->flags)) {clear_bit (NFS_DELEGATION_RETURN_DELAYED , &delegation->flags);/* Refcount matched in nfs_end_delegation_return() */ ret =nfs_get_delegation (delegation);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 12/486 NFS: Don't allow waiting for exiting tasks
In reply to Sasha LevinFrom: Trond Myklebust <[email protected]>
[ Upstream commit 8d3ca331026a7f9700d3747eed59a67b8f828cdc ]
Once a task calls exit_signals() it can no longer be signalled. So do not allow it to do killable waits.
--- fs/nfs/inode.c | 2 ++ fs/nfs/internal.h | 5 +++++ fs/nfs/nfs3proc.c | 2 +- fs/nfs/nfs4proc.c | 9 +++++++-- 4 files changed, 15 insertions(+), 3 deletions(-)
fs/nfs/inode.c +2 -0
@@ -74,6 +74,8 @@ nfs_fattr_to_ino_t(struct nfs_fattr *fattr)int nfs_wait_bit_killable (struct wait_bit_key *key,int mode) { +if (unlikely (nfs_current_task_exiting ())) +return -EINTR ;schedule ();if (signal_pending_state (mode, current))return -ERESTARTSYS ;
fs/nfs/internal.h +5 -0
@@ -901,6 +901,11 @@ static inline u32 nfs_stateid_hash(const nfs4_stateid *stateid) NFS4_STATEID_OTHER_SIZE); } +static inline bool nfs_current_task_exiting (void ) +{ +return (current->flags &PF_EXITING ) !=0 ; +} +static inline bool nfs_error_is_fatal (int err) {switch (err) {
fs/nfs/nfs3proc.c +1 -1
@@ -39,7 +39,7 @@ nfs3_rpc_wrapper(struct rpc_clnt *clnt, struct rpc_message *msg, int flags)__set_current_state (TASK_KILLABLE |TASK_FREEZABLE_UNSAFE );schedule_timeout (NFS_JUKEBOX_RETRY_TIME ); res = -ERESTARTSYS ; - }while (!fatal_signal_pending (current)); + }while (!fatal_signal_pending (current) && !nfs_current_task_exiting ());return res; }
fs/nfs/nfs4proc.c +7 -2
@@ -434,6 +434,8 @@ static int nfs4_delay_killable(long *timeout) {might_sleep (); +if (unlikely (nfs_current_task_exiting ())) +return -EINTR ;__set_current_state (TASK_KILLABLE |TASK_FREEZABLE_UNSAFE );schedule_timeout (nfs4_update_delay (timeout));if (!__fatal_signal_pending (current))
@@ -445,6 +447,8 @@ static int nfs4_delay_interruptible(long *timeout) {might_sleep (); +if (unlikely (nfs_current_task_exiting ())) +return -EINTR ;__set_current_state (TASK_INTERRUPTIBLE |TASK_FREEZABLE_UNSAFE );schedule_timeout (nfs4_update_delay (timeout));if (!signal_pending (current))
@@ -1765,7 +1769,8 @@ static void nfs_set_open_stateid_locked(struct nfs4_state *state,rcu_read_unlock ();trace_nfs4_open_stateid_update_wait (state->inode, stateid,0 ); -if (!fatal_signal_pending (current)) { +if (!fatal_signal_pending (current) && + !nfs_current_task_exiting ()) {if (schedule_timeout (5 *HZ ) ==0 ) status = -EAGAIN ;else
@@ -3569,7 +3574,7 @@ static bool nfs4_refresh_open_old_stateid(nfs4_stateid *dst,write_sequnlock (&state->seqlock);trace_nfs4_close_stateid_update_wait (state->inode, dst,0 ); -if (fatal_signal_pending (current)) +if (fatal_signal_pending (current) ||nfs_current_task_exiting ()) status = -EINTR ;else if (schedule_timeout (5 *HZ ) !=0 )
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 13/486 SUNRPC: Don't allow waiting for exiting tasks
In reply to Sasha LevinFrom: Trond Myklebust <[email protected]>
[ Upstream commit 14e41b16e8cb677bb440dca2edba8b041646c742 ]
Once a task calls exit_signals() it can no longer be signalled. So do not allow it to do killable waits.
--- net/sunrpc/sched.c | 2 ++ 1 file changed, 2 insertions(+)
net/sunrpc/sched.c +2 -0
@@ -276,6 +276,8 @@ EXPORT_SYMBOL_GPL(rpc_destroy_wait_queue);static int rpc_wait_bit_killable (struct wait_bit_key *key,int mode) { +if (unlikely (current->flags &PF_EXITING )) +return -EINTR ;schedule ();if (signal_pending_state (mode, current))return -ERESTARTSYS ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 14/486 arm64: Add support for HIP09 Spectre-BHB mitigation
In reply to Sasha LevinFrom: Jinqian Yang <[email protected]>
[ Upstream commit e18c09b204e81702ea63b9f1a81ab003b72e3174 ]
The HIP09 processor is vulnerable to the Spectre-BHB (Branch History Buffer) attack, which can be exploited to leak information through branch prediction side channels. This commit adds the MIDR of HIP09 to the list for software mitigation.
--- arch/arm64/include/asm/cputype.h | 2 ++ arch/arm64/kernel/proton-pack.c | 1 + 2 files changed, 3 insertions(+)
arch/arm64/include/asm/cputype.h +2 -0
@@ -131,6 +131,7 @@#define FUJITSU_CPU_PART_A64FX 0x001#define HISI_CPU_PART_TSV110 0xD01 +#define HISI_CPU_PART_HIP09 0xD02#define APPLE_CPU_PART_M1_ICESTORM 0x022#define APPLE_CPU_PART_M1_FIRESTORM 0x023
@@ -206,6 +207,7 @@#define MIDR_NVIDIA_CARMEL MIDR_CPU_MODEL(ARM_CPU_IMP_NVIDIA, NVIDIA_CPU_PART_CARMEL)#define MIDR_FUJITSU_A64FX MIDR_CPU_MODEL(ARM_CPU_IMP_FUJITSU, FUJITSU_CPU_PART_A64FX)#define MIDR_HISI_TSV110 MIDR_CPU_MODEL(ARM_CPU_IMP_HISI, HISI_CPU_PART_TSV110) +#define MIDR_HISI_HIP09 MIDR_CPU_MODEL(ARM_CPU_IMP_HISI, HISI_CPU_PART_HIP09)#define MIDR_APPLE_M1_ICESTORM MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_ICESTORM)#define MIDR_APPLE_M1_FIRESTORM MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_FIRESTORM)#define MIDR_APPLE_M1_ICESTORM_PRO MIDR_CPU_MODEL(ARM_CPU_IMP_APPLE, APPLE_CPU_PART_M1_ICESTORM_PRO)
arch/arm64/kernel/proton-pack.c +1 -0
@@ -901,6 +901,7 @@ static u8 spectre_bhb_loop_affected(void)MIDR_ALL_VERSIONS (MIDR_CORTEX_A77 ),MIDR_ALL_VERSIONS (MIDR_NEOVERSE_N1 ),MIDR_ALL_VERSIONS (MIDR_QCOM_KRYO_4XX_GOLD ), + MIDR_ALL_VERSIONS(MIDR_HISI_HIP09), {}, };static const struct midr_range spectre_bhb_k11_list[] = {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 15/486 iommufd: Extend IOMMU_GET_HW_INFO to report PASID capability
In reply to Sasha LevinFrom: Yi Liu <[email protected]>
[ Upstream commit 803f97298e7de9242eb677a1351dcafbbcc9117e ]
PASID usage requires PASID support in both device and IOMMU. Since the iommu drivers always enable the PASID capability for the device if it is supported, this extends the IOMMU_GET_HW_INFO to report the PASID capability to userspace. Also, enhances the selftest accordingly.
--- drivers/iommu/iommufd/device.c | 34 +++++++++++++++++++++++++++++++++- drivers/pci/ats.c | 33 +++++++++++++++++++++++++++++++++ include/linux/pci-ats.h | 3 +++ include/uapi/linux/iommufd.h | 14 +++++++++++++- 4 files changed, 82 insertions(+), 2 deletions(-)
drivers/iommu/iommufd/device.c +33 -1
@@ -3,6 +3,7 @@*/ #include <linux/iommu.h> #include <linux/iommufd.h> +#include <linux/pci-ats.h> #include <linux/slab.h> #include <uapi/linux/iommufd.h>
@@ -1304,7 +1305,8 @@ int iommufd_get_hw_info(struct iommufd_ucmd *ucmd)void *data;int rc; -if (cmd->flags || cmd->__reserved) +if (cmd->flags || cmd->__reserved[0 ] || cmd->__reserved[1 ] || + cmd->__reserved[2 ])return -EOPNOTSUPP ; idev =iommufd_get_device (ucmd, cmd->dev_id);
@@ -1361,6 +1363,36 @@ int iommufd_get_hw_info(struct iommufd_ucmd *ucmd)if (device_iommu_capable (idev->dev,IOMMU_CAP_DIRTY_TRACKING )) cmd->out_capabilities |=IOMMU_HW_CAP_DIRTY_TRACKING ; + cmd->out_max_pasid_log2 =0 ; +/* +* Currently, all iommu drivers enable PASID in the probe_device() +* op if iommu and device supports it. So the max_pasids stored in +* dev->iommu indicates both PASID support and enable status. A +* non-zero dev->iommu->max_pasids means PASID is supported and +* enabled. The iommufd only reports PASID capability to userspace +* if it's enabled. +*/ +if (idev->dev->iommu->max_pasids) { + cmd->out_max_pasid_log2 =ilog2 (idev->dev->iommu->max_pasids); + +if (dev_is_pci (idev->dev)) { +struct pci_dev *pdev =to_pci_dev (idev->dev); +int ctrl; + + ctrl =pci_pasid_status (pdev); + +WARN_ON_ONCE (ctrl <0 || + !(ctrl &PCI_PASID_CTRL_ENABLE )); + +if (ctrl &PCI_PASID_CTRL_EXEC ) + cmd->out_capabilities |= +IOMMU_HW_CAP_PCI_PASID_EXEC ; +if (ctrl &PCI_PASID_CTRL_PRIV ) + cmd->out_capabilities |= +IOMMU_HW_CAP_PCI_PASID_PRIV ; + } + } + rc =iommufd_ucmd_respond (ucmd,sizeof (*cmd)); out_free:kfree (data);
drivers/pci/ats.c +33 -0
@@ -538,4 +538,37 @@ int pci_max_pasids(struct pci_dev *pdev) return (1 << FIELD_GET(PCI_PASID_CAP_WIDTH, supported)); }EXPORT_SYMBOL_GPL (pci_max_pasids); + +/** +* pci_pasid_status - Check the PASID status +* @pdev: PCI device structure +* +* Returns a negative value when no PASID capability is present. +* Otherwise the value of the control register is returned. +* Status reported are: +* +* PCI_PASID_CTRL_ENABLE - PASID enabled +* PCI_PASID_CTRL_EXEC - Execute permission enabled +* PCI_PASID_CTRL_PRIV - Privileged mode enabled +*/ +int pci_pasid_status (struct pci_dev *pdev) +{ +int pasid; +u16 ctrl; + +if (pdev->is_virtfn) + pdev =pci_physfn (pdev); + + pasid = pdev->pasid_cap; +if (!pasid) +return -EINVAL ; + +pci_read_config_word (pdev, pasid +PCI_PASID_CTRL , &ctrl); + + ctrl &=PCI_PASID_CTRL_ENABLE |PCI_PASID_CTRL_EXEC | +PCI_PASID_CTRL_PRIV ; + +return ctrl; +} +EXPORT_SYMBOL_GPL (pci_pasid_status);#endif /* CONFIG_PCI_PASID */
include/linux/pci-ats.h +3 -0
@@ -42,6 +42,7 @@ int pci_enable_pasid(struct pci_dev *pdev, int features);void pci_disable_pasid (struct pci_dev *pdev);int pci_pasid_features (struct pci_dev *pdev);int pci_max_pasids (struct pci_dev *pdev); +int pci_pasid_status (struct pci_dev *pdev);#else /* CONFIG_PCI_PASID */ static inline int pci_enable_pasid (struct pci_dev *pdev,int features) {return -EINVAL ; }
@@ -50,6 +51,8 @@ static inline int pci_pasid_features(struct pci_dev *pdev) {return -EINVAL ; }static inline int pci_max_pasids (struct pci_dev *pdev) {return -EINVAL ; } +static inline int pci_pasid_status (struct pci_dev *pdev) +{return -EINVAL ; }#endif /* CONFIG_PCI_PASID */ #endif /* LINUX_PCI_ATS_H */
include/uapi/linux/iommufd.h +13 -1
@@ -504,9 +504,17 @@ enum iommu_hw_info_type {* IOMMU_HWPT_GET_DIRTY_BITMAP * IOMMU_HWPT_SET_DIRTY_TRACKING * +* @IOMMU_HW_CAP_PCI_PASID_EXEC: Execute Permission Supported, user ignores it +* when the struct +* iommu_hw_info::out_max_pasid_log2 is zero. +* @IOMMU_HW_CAP_PCI_PASID_PRIV: Privileged Mode Supported, user ignores it +* when the struct +* iommu_hw_info::out_max_pasid_log2 is zero. */ enum iommufd_hw_capabilities {IOMMU_HW_CAP_DIRTY_TRACKING =1 <<0 , +IOMMU_HW_CAP_PCI_PASID_EXEC =1 <<1 , +IOMMU_HW_CAP_PCI_PASID_PRIV =1 <<2 , };/**
@@ -522,6 +530,9 @@ enum iommufd_hw_capabilities {* iommu_hw_info_type. * @out_capabilities: Output the generic iommu capability info type as defined * in the enum iommu_hw_capabilities. +* @out_max_pasid_log2: Output the width of PASIDs. 0 means no PASID support. +* PCI devices turn to out_capabilities to check if the +* specific capabilities is supported or not. * @__reserved: Must be 0 * * Query an iommu type specific hardware information data from an iommu behind
@@ -545,7 +556,8 @@ struct iommu_hw_info {__u32 data_len;__aligned_u64 data_uptr;__u32 out_data_type; -__u32 __reserved; +__u8 out_max_pasid_log2; +__u8 __reserved[3 ];__aligned_u64 out_capabilities; };#define IOMMU_GET_HW_INFO _IO(IOMMUFD_TYPE, IOMMUFD_CMD_GET_HW_INFO)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 16/486 tracing: Mark binary printing functions with __printf() attribute
In reply to Sasha LevinFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 196a062641fe68d9bfe0ad36b6cd7628c99ad22c ]
Binary printing functions are using printf() type of format, and compiler is not happy about them as is:
kernel/trace/trace.c:3292:9: error: function ‘trace_vbprintk’ might be a candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format] kernel/trace/trace_seq.c:182:9: error: function ‘trace_seq_bprintf’ might be a candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]
Fix the compilation errors by adding __printf() attribute.
While at it, move existing __printf() attributes from the implementations to the declarations. IT also fixes incorrect attribute parameters that are used for trace_array_printk().
--- include/linux/trace.h | 4 ++-- include/linux/trace_seq.h | 8 ++++---- kernel/trace/trace.c | 11 +++-------- kernel/trace/trace.h | 16 +++++++++------- 4 files changed, 18 insertions(+), 21 deletions(-)
include/linux/trace.h +2 -2
@@ -72,8 +72,8 @@ static inline int unregister_ftrace_export(struct trace_export *export)static inline void trace_printk_init_buffers (void ) { } -static inline int trace_array_printk (struct trace_array *tr,unsigned long ip, -const char *fmt, ...) +static inline __printf(3, 4) +int trace_array_printk(struct trace_array *tr, unsigned long ip, const char *fmt, ...) {return 0 ; }
include/linux/trace_seq.h +4 -4
@@ -88,8 +88,8 @@ extern __printf(2, 3)void trace_seq_printf (struct trace_seq *s,const char *fmt, ...); extern __printf(2, 0) void trace_seq_vprintf(struct trace_seq *s, const char *fmt, va_list args); -extern void -trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary); +extern __printf(2, 0) +void trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary); extern int trace_print_seq(struct seq_file *m, struct trace_seq *s); extern int trace_seq_to_user(struct trace_seq *s, char __user *ubuf, int cnt);
@@ -113,8 +113,8 @@ static inline __printf(2, 3)void trace_seq_printf (struct trace_seq *s,const char *fmt, ...) { } -static inline void -trace_seq_bprintf (struct trace_seq *s,const char *fmt,const u32 *binary) +static inline __printf(2, 0) +void trace_seq_bprintf(struct trace_seq *s, const char *fmt, const u32 *binary) { }
kernel/trace/trace.c +3 -8
@@ -3343,10 +3343,9 @@ int trace_vbprintk(unsigned long ip, const char *fmt, va_list args) }EXPORT_SYMBOL_GPL (trace_vbprintk); -__printf(3, 0) -static int -__trace_array_vprintk (struct trace_buffer *buffer, -unsigned long ip,const char *fmt,va_list args) +static __printf(3, 0) +int __trace_array_vprintk(struct trace_buffer *buffer, + unsigned long ip, const char *fmt, va_list args) { struct trace_event_call *call = &event_print;struct ring_buffer_event *event;
@@ -3399,7 +3398,6 @@ __trace_array_vprintk(struct trace_buffer *buffer,return len; } -__printf(3, 0)int trace_array_vprintk (struct trace_array *tr,unsigned long ip,const char *fmt,va_list args) {
@@ -3429,7 +3427,6 @@ int trace_array_vprintk(struct trace_array *tr,* Note, trace_array_init_printk() must be called on @tr before this * can be used. */ -__printf(3, 0)int trace_array_printk (struct trace_array *tr,unsigned long ip,const char *fmt, ...) {
@@ -3474,7 +3471,6 @@ int trace_array_init_printk(struct trace_array *tr) }EXPORT_SYMBOL_GPL (trace_array_init_printk); -__printf(3, 4)int trace_array_printk_buf (struct trace_buffer *buffer,unsigned long ip,const char *fmt, ...) {
@@ -3490,7 +3486,6 @@ int trace_array_printk_buf(struct trace_buffer *buffer,return ret; } -__printf(2, 0)int trace_vprintk (unsigned long ip,const char *fmt,va_list args) {return trace_array_vprintk (printk_trace, ip, fmt, args);
kernel/trace/trace.h +9 -7
@@ -818,13 +818,15 @@ static inline void __init disable_tracing_selftest(const char *reason)extern void *head_page (struct trace_array_cpu *data);extern unsigned long long ns2usecs (u64 nsec); -extern int -trace_vbprintk (unsigned long ip,const char *fmt,va_list args); -extern int -trace_vprintk (unsigned long ip,const char *fmt,va_list args); -extern int -trace_array_vprintk (struct trace_array *tr, -unsigned long ip,const char *fmt,va_list args); + +__printf(2, 0) +int trace_vbprintk (unsigned long ip,const char *fmt,va_list args); +__printf(2, 0) +int trace_vprintk (unsigned long ip,const char *fmt,va_list args); +__printf(3, 0) +int trace_array_vprintk (struct trace_array *tr, +unsigned long ip,const char *fmt,va_list args); +__printf(3, 4)int trace_array_printk_buf (struct trace_buffer *buffer,unsigned long ip,const char *fmt, ...);void trace_printk_seq (struct trace_seq *s);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 17/486 ACPI: PNP: Add Intel OC Watchdog IDs to non-PNP device list
In reply to Sasha LevinFrom: Diogo Ivo <[email protected]>
[ Upstream commit f06777cf2bbc21dd8c71d6e3906934e56b4e18e4 ]
Intel Over-Clocking Watchdogs are described in ACPI tables by both the generic PNP0C02 _CID and their ACPI _HID. The presence of the _CID then causes the PNP scan handler to attach to the watchdog, preventing the actual watchdog driver from binding. Address this by adding the ACPI _HIDs to the list of non-PNP devices, so that the PNP scan handler is bypassed.
Note that these watchdogs can be described by multiple _HIDs for what seems to be identical hardware. This commit is not a complete list of all the possible watchdog ACPI _HIDs.
--- drivers/acpi/acpi_pnp.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/acpi/acpi_pnp.c +2 -0
@@ -355,8 +355,10 @@ static bool acpi_pnp_match(const char *idstr, const struct acpi_device_id **matc* device represented by it. */ static const struct acpi_device_id acpi_nonpnp_device_ids[] = { + {"INT3F0D" }, {"INTC1080" }, {"INTC1081" }, + {"INTC1099" }, {"" }, };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 18/486 tpm: Convert warn to dbg in tpm2_start_auth_session()
In reply to Sasha LevinFrom: Jonathan McDowell <[email protected]>
[ Upstream commit 6359691b4fbcaf3ed86f53043a1f7c6cc54c09be ]
TPM2 sessions have been flushed lazily since commit df745e25098dc ("tpm:
Lazily flush the auth session"). If /dev/tpm{rm}0 is not accessed in-between two in-kernel calls, it is possible that a TPM2 session is re-started before the previous one has been completed.
This causes a spurios warning in a legit run-time condition, which is also correctly addressed with a fast return path:
[ 2.944047] tpm tpm0: auth session is active
Address the issue by changing dev_warn_once() call to a dev_dbg_once() call.
[jarkko: Rewrote the commit message, and instead of dropping converted
to a debug message.]
--- drivers/char/tpm/tpm2-sessions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/char/tpm/tpm2-sessions.c +1 -1
@@ -982,7 +982,7 @@ int tpm2_start_auth_session(struct tpm_chip *chip)int rc;if (chip->auth) { -dev_warn_once (&chip->dev,"auth session is active\n" ); +dev_dbg_once (&chip->dev,"auth session is active\n" );return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 19/486 mailbox: pcc: Use acpi_os_ioremap() instead of ioremap()
In reply to Sasha LevinFrom: Sudeep Holla <[email protected]>
[ Upstream commit d181acea5b864e91f38f5771b8961215ce5017ae ]
The Platform Communication Channel (PCC) mailbox driver currently uses ioremap() to map channel shared memory regions. However it is preferred to use acpi_os_ioremap(), which is mapping function specific to EFI/ACPI defined memory regions. It ensures that the correct memory attributes are applied when mapping ACPI-provided regions.
While at it, also add checks for handling any errors with the mapping.
--- drivers/mailbox/pcc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/mailbox/pcc.c +6 -2
@@ -419,8 +419,12 @@ int pcc_mbox_ioremap(struct mbox_chan *chan)return -1 ; pchan_info = chan->con_priv; pcc_mbox_chan = &pchan_info->chan; - pcc_mbox_chan->shmem =ioremap (pcc_mbox_chan->shmem_base_addr, - pcc_mbox_chan->shmem_size); + + pcc_mbox_chan->shmem =acpi_os_ioremap (pcc_mbox_chan->shmem_base_addr, + pcc_mbox_chan->shmem_size); +if (!pcc_mbox_chan->shmem) +return -ENXIO ; +return 0 ; }EXPORT_SYMBOL_GPL (pcc_mbox_ioremap);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 20/486 mailbox: use error ret code of of_parse_phandle_with_args()
In reply to Sasha LevinFrom: Tudor Ambarus <[email protected]>
[ Upstream commit 24fdd5074b205cfb0ef4cd0751a2d03031455929 ]
In case of error, of_parse_phandle_with_args() returns -EINVAL when the passed index is negative, or -ENOENT when the index is for an empty phandle. The mailbox core overwrote the error return code with a less precise -ENODEV. Use the error returned code from of_parse_phandle_with_args().
--- drivers/mailbox/mailbox.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/mailbox/mailbox.c +4 -3
@@ -415,11 +415,12 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index)mutex_lock (&con_mutex); -if (of_parse_phandle_with_args (dev->of_node,"mboxes" , -"#mbox-cells" , index, &spec)) { + ret =of_parse_phandle_with_args (dev->of_node,"mboxes" ,"#mbox-cells" , + index, &spec); +if (ret) {dev_dbg (dev,"%s: can't parse \"mboxes\" property\n" , __func__);mutex_unlock (&con_mutex); -return ERR_PTR (-ENODEV ); +return ERR_PTR (ret); } chan =ERR_PTR (-EPROBE_DEFER );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 21/486 riscv: Allow NOMMU kernels to access all of RAM
In reply to Sasha LevinFrom: Samuel Holland <[email protected]>
[ Upstream commit 2c0391b29b27f315c1b4c29ffde66f50b29fab99 ]
NOMMU kernels currently cannot access memory below the kernel link address. Remove this restriction by setting PAGE_OFFSET to the actual start of RAM, as determined from the devicetree. The kernel link address must be a constant, so keep using CONFIG_PAGE_OFFSET for that purpose.
--- arch/riscv/include/asm/page.h | 12 ++++-------- arch/riscv/include/asm/pgtable.h | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-)
arch/riscv/include/asm/page.h +4 -8
@@ -26,12 +26,9 @@* When not using MMU this corresponds to the first free page in * physical memory (aligned on a page boundary). */ -#ifdef CONFIG_64BIT #ifdef CONFIG_MMU +#ifdef CONFIG_64BIT #define PAGE_OFFSET kernel_map.page_offset -#else -#define PAGE_OFFSET _AC(CONFIG_PAGE_OFFSET, UL) -#endif /* * By default, CONFIG_PAGE_OFFSET value corresponds to SV57 address space so * define the PAGE_OFFSET value for SV48 and SV39.
@@ -41,6 +38,9 @@#else #define PAGE_OFFSET _AC(CONFIG_PAGE_OFFSET, UL)#endif /* CONFIG_64BIT */ +#else +#define PAGE_OFFSET ((unsigned long)phys_ram_base) +#endif /* CONFIG_MMU */ #ifndef __ASSEMBLY__
@@ -97,11 +97,7 @@ typedef struct page *pgtable_t;#define MIN_MEMBLOCK_ADDR 0#endif -#ifdef CONFIG_MMU #define ARCH_PFN_OFFSET (PFN_DOWN((unsigned long)phys_ram_base)) -#else -#define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT) -#endif /* CONFIG_MMU */ struct kernel_mapping {unsigned long page_offset;
arch/riscv/include/asm/pgtable.h +1 -1
@@ -12,7 +12,7 @@#include <asm/pgtable-bits.h> #ifndef CONFIG_MMU -#define KERNEL_LINK_ADDR PAGE_OFFSET +#define KERNEL_LINK_ADDR _AC(CONFIG_PAGE_OFFSET, UL)#define KERN_VIRT_SIZE (UL(-1))#else
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 22/486 fbdev: fsl-diu-fb: add missing device_remove_file()
In reply to Sasha LevinFrom: Shixiong Ou <[email protected]>
[ Upstream commit 86d16cd12efa547ed43d16ba7a782c1251c80ea8 ]
Call device_remove_file() when driver remove.
--- drivers/video/fbdev/fsl-diu-fb.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/fbdev/fsl-diu-fb.c +1 -0
@@ -1827,6 +1827,7 @@ static void fsl_diu_remove(struct platform_device *pdev)int i; data =dev_get_drvdata (&pdev->dev); +device_remove_file (&pdev->dev, &data->dev_attr);disable_lcdc (&data->fsl_diu_info[0 ]);free_irq (data->irq, data->diu_reg);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 23/486 fbcon: Use correct erase colour for clearing in fbcon
In reply to Sasha LevinFrom: Zsolt Kajtar <[email protected]>
[ Upstream commit 892c788d73fe4a94337ed092cb998c49fa8ecaf4 ]
The erase colour calculation for fbcon clearing should use get_color instead of attr_col_ec, like everything else. The latter is similar but is not correct. For example it's missing the depth dependent remapping and doesn't care about blanking.
The problem can be reproduced by setting up the background colour to grey (vt.color=0x70) and having an fbcon console set to 2bpp (4 shades of gray). Now the background attribute should be 1 (dark gray) on the console.
If the screen is scrolled when pressing enter in a shell prompt at the bottom line then the new line is cleared using colour 7 instead of 1. That's not something fillrect likes (at 2bbp it expect 0-3) so the result is interesting.
This patch switches to get_color with vc_video_erase_char to determine the erase colour from attr_col_ec. That makes the latter function redundant as no other users were left.
Use correct erase colour for clearing in fbcon
--- drivers/video/fbdev/core/bitblit.c | 5 ++-- drivers/video/fbdev/core/fbcon.c | 10 +++++--- drivers/video/fbdev/core/fbcon.h | 38 +--------------------------- drivers/video/fbdev/core/fbcon_ccw.c | 5 ++-- drivers/video/fbdev/core/fbcon_cw.c | 5 ++-- drivers/video/fbdev/core/fbcon_ud.c | 5 ++-- drivers/video/fbdev/core/tileblit.c | 8 +++--- 7 files changed, 18 insertions(+), 58 deletions(-)
drivers/video/fbdev/core/bitblit.c +2 -3
@@ -59,12 +59,11 @@ static void bit_bmove(struct vc_data *vc, struct fb_info *info, int sy, }static void bit_clear (struct vc_data *vc,struct fb_info *info,int sy, -int sx,int height,int width) +int sx,int height,int width,int fg,int bg) { -int bgshift = (vc->vc_hi_font_mask) ?13 :12 ;struct fb_fillrect region; - region.color =attr_bgcol_ec (bgshift, vc, info); + region.color = bg; region.dx = sx * vc->vc_font.width; region.dy = sy * vc->vc_font.height; region.width = width * vc->vc_font.width;
drivers/video/fbdev/core/fbcon.c +6 -4
@@ -1258,7 +1258,7 @@ static void __fbcon_clear(struct vc_data *vc, unsigned int sy, unsigned int sx, {struct fb_info *info =fbcon_info_from_console (vc->vc_num);struct fbcon_ops *ops = info->fbcon_par; - +int fg, bg;struct fbcon_display *p = &fb_display[vc->vc_num];u_int y_break;
@@ -1279,16 +1279,18 @@ static void __fbcon_clear(struct vc_data *vc, unsigned int sy, unsigned int sx,fbcon_clear_margins (vc,0 ); } + fg =get_color (vc, info, vc->vc_video_erase_char,1 ); + bg =get_color (vc, info, vc->vc_video_erase_char,0 );/* Split blits that cross physical y_wrap boundary */ y_break = p->vrows - p->yscroll;if (sy < y_break && sy + height -1 >= y_break) {u_int b = y_break - sy; - ops->clear (vc, info,real_y (p, sy), sx, b, width); + ops->clear (vc, info,real_y (p, sy), sx, b, width, fg, bg); ops->clear (vc, info,real_y (p, sy + b), sx, height - b, - width); + width, fg, bg); }else - ops->clear (vc, info,real_y (p, sy), sx, height, width); + ops->clear (vc, info,real_y (p, sy), sx, height, width, fg, bg); } static void fbcon_clear(struct vc_data *vc, unsigned int sy, unsigned int sx,
drivers/video/fbdev/core/fbcon.h +1 -37
@@ -55,7 +55,7 @@ struct fbcon_ops {void (*bmove)(struct vc_data *vc,struct fb_info *info,int sy,int sx,int dy,int dx,int height,int width);void (*clear)(struct vc_data *vc,struct fb_info *info,int sy, -int sx,int height,int width); +int sx,int height,int width,int fb,int bg);void (*putcs)(struct vc_data *vc,struct fb_info *info,const unsigned short *s,int count,int yy,int xx,int fg,int bg);
@@ -116,42 +116,6 @@ static inline int mono_col(const struct fb_info *info)return (~(0xfff << max_len)) &0xff ; } -static inline int attr_col_ec (int shift,struct vc_data *vc, -struct fb_info *info,int is_fg) -{ -int is_mono01; -int col; -int fg; -int bg; - -if (!vc) -return 0 ; - -if (vc->vc_can_do_color) -return is_fg ?attr_fgcol (shift,vc->vc_video_erase_char) - :attr_bgcol (shift,vc->vc_video_erase_char); - -if (!info) -return 0 ; - - col =mono_col (info); - is_mono01 = info->fix.visual ==FB_VISUAL_MONO01 ; - -if (attr_reverse (vc->vc_video_erase_char)) { - fg = is_mono01 ? col :0 ; - bg = is_mono01 ?0 : col; - } -else { - fg = is_mono01 ?0 : col; - bg = is_mono01 ? col :0 ; - } - -return is_fg ? fg : bg; -} - -#define attr_bgcol_ec (bgshift, vc, info) attr_col_ec(bgshift, vc, info, 0) -#define attr_fgcol_ec (fgshift, vc, info) attr_col_ec(fgshift, vc, info, 1) -/* * Scroll Method */
drivers/video/fbdev/core/fbcon_ccw.c +2 -3
@@ -78,14 +78,13 @@ static void ccw_bmove(struct vc_data *vc, struct fb_info *info, int sy, }static void ccw_clear (struct vc_data *vc,struct fb_info *info,int sy, -int sx,int height,int width) +int sx,int height,int width,int fg,int bg) {struct fbcon_ops *ops = info->fbcon_par;struct fb_fillrect region; -int bgshift = (vc->vc_hi_font_mask) ?13 :12 ;u32 vyres =GETVYRES (ops->p, info); - region.color =attr_bgcol_ec (bgshift,vc,info); + region.color = bg; region.dx = sy * vc->vc_font.height; region.dy = vyres - ((sx + width) * vc->vc_font.width); region.height = width * vc->vc_font.width;
drivers/video/fbdev/core/fbcon_cw.c +2 -3
@@ -63,14 +63,13 @@ static void cw_bmove(struct vc_data *vc, struct fb_info *info, int sy, }static void cw_clear (struct vc_data *vc,struct fb_info *info,int sy, -int sx,int height,int width) +int sx,int height,int width,int fg,int bg) {struct fbcon_ops *ops = info->fbcon_par;struct fb_fillrect region; -int bgshift = (vc->vc_hi_font_mask) ?13 :12 ;u32 vxres =GETVXRES (ops->p, info); - region.color =attr_bgcol_ec (bgshift,vc,info); + region.color = bg; region.dx = vxres - ((sy + height) * vc->vc_font.height); region.dy = sx * vc->vc_font.width; region.height = width * vc->vc_font.width;
drivers/video/fbdev/core/fbcon_ud.c +2 -3
@@ -64,15 +64,14 @@ static void ud_bmove(struct vc_data *vc, struct fb_info *info, int sy, }static void ud_clear (struct vc_data *vc,struct fb_info *info,int sy, -int sx,int height,int width) +int sx,int height,int width,int fg,int bg) {struct fbcon_ops *ops = info->fbcon_par;struct fb_fillrect region; -int bgshift = (vc->vc_hi_font_mask) ?13 :12 ;u32 vyres =GETVYRES (ops->p, info);u32 vxres =GETVXRES (ops->p, info); - region.color =attr_bgcol_ec (bgshift,vc,info); + region.color = bg; region.dy = vyres - ((sy + height) * vc->vc_font.height); region.dx = vxres - ((sx + width) * vc->vc_font.width); region.width = width * vc->vc_font.width;
drivers/video/fbdev/core/tileblit.c +3 -5
@@ -32,16 +32,14 @@ static void tile_bmove(struct vc_data *vc, struct fb_info *info, int sy, }static void tile_clear (struct vc_data *vc,struct fb_info *info,int sy, -int sx,int height,int width) +int sx,int height,int width,int fg,int bg) {struct fb_tilerect rect; -int bgshift = (vc->vc_hi_font_mask) ?13 :12 ; -int fgshift = (vc->vc_hi_font_mask) ?9 :8 ; rect.index = vc->vc_video_erase_char & ((vc->vc_hi_font_mask) ?0x1ff :0xff ); - rect.fg =attr_fgcol_ec (fgshift, vc, info); - rect.bg =attr_bgcol_ec (bgshift, vc, info); + rect.fg = fg; + rect.bg = bg; rect.sx = sx; rect.sy = sy; rect.width = width;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 24/486 fbdev: core: tileblit: Implement missing margin clearing for tileblit
In reply to Sasha LevinFrom: Zsolt Kajtar <[email protected]>
[ Upstream commit 76d3ca89981354e1f85a3e0ad9ac4217d351cc72 ]
I was wondering why there's garbage at the bottom of the screen when tile blitting is used with an odd mode like 1080, 600 or 200. Sure there's only space for half a tile but the same area is clean when the buffer is bitmap.
Then later I found that it's supposed to be cleaned but that's not implemented. So I took what's in bitblit and adapted it for tileblit.
This implementation was tested for both the horizontal and vertical case, and now does the same as what's done for bitmap buffers.
If anyone is interested to reproduce the problem then I could bet that'd be on a S3 or Ark. Just set up a mode with an odd line count and make sure that the virtual size covers the complete tile at the bottom. E.g. for 600 lines that's 608 virtual lines for a 16 tall tile. Then the bottom area should be cleaned.
For the right side it's more difficult as there the drivers won't let an odd size happen, unless the code is modified. But once it reports back a few pixel columns short then fbcon won't use the last column. With the patch that column is now clean.
Btw. the virtual size should be rounded up by the driver for both axes (not only the horizontal) so that it's dividable by the tile size. That's a driver bug but correcting it is not in scope for this patch.
Implement missing margin clearing for tileblit
--- drivers/video/fbdev/core/tileblit.c | 37 ++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-)
drivers/video/fbdev/core/tileblit.c +36 -1
@@ -74,7 +74,42 @@ static void tile_putcs(struct vc_data *vc, struct fb_info *info,static void tile_clear_margins (struct vc_data *vc,struct fb_info *info,int color,int bottom_only) { -return ; +unsigned int cw = vc->vc_font.width; +unsigned int ch = vc->vc_font.height; +unsigned int rw = info->var.xres - (vc->vc_cols*cw); +unsigned int bh = info->var.yres - (vc->vc_rows*ch); +unsigned int rs = info->var.xres - rw; +unsigned int bs = info->var.yres - bh; +unsigned int vwt = info->var.xres_virtual / cw; +unsigned int vht = info->var.yres_virtual / ch; +struct fb_tilerect rect; + + rect.index = vc->vc_video_erase_char & + ((vc->vc_hi_font_mask) ?0x1ff :0xff ); + rect.fg = color; + rect.bg = color; + +if ((int ) rw >0 && !bottom_only) { + rect.sx = (info->var.xoffset + rs + cw -1 ) / cw; + rect.sy =0 ; + rect.width = (rw + cw -1 ) / cw; + rect.height = vht; +if (rect.width + rect.sx > vwt) + rect.width = vwt - rect.sx; +if (rect.sx < vwt) + info->tileops->fb_tilefill (info, &rect); + } + +if ((int ) bh >0 ) { + rect.sx = info->var.xoffset / cw; + rect.sy = (info->var.yoffset + bs) / ch; + rect.width = rs / cw; + rect.height = (bh + ch -1 ) / ch; +if (rect.height + rect.sy > vht) + rect.height = vht - rect.sy; +if (rect.sy < vht) + info->tileops->fb_tilefill (info, &rect); + } } static void tile_cursor(struct vc_data *vc, struct fb_info *info, bool enable,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 25/486 cifs: Set default Netbios RFC1001 server name to hostname in UNC
In reply to Sasha LevinFrom: Pali Rohár <[email protected]>
[ Upstream commit be786e509c1af9b2dcf25c3d601f05c8c251f482 ]
Windows SMB servers (including SMB2+) which are working over RFC1001 require that Netbios server name specified in RFC1001 Session Request packet is same as the UNC host name. Netbios server name can be already specified manually via -o servern= option.
With this change the RFC1001 server name is set automatically by extracting the hostname from the mount source.
--- fs/smb/client/fs_context.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
fs/smb/client/fs_context.c +11 -0
@@ -1028,6 +1028,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,int i, opt;bool is_smb3 = !strcmp (fc->fs_type->name,"smb3" );bool skip_parsing = false; +char *hostname;cifs_dbg (FYI ,"CIFS: parsing cifs mount option '%s'\n" , param->key);
@@ -1360,6 +1361,16 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,cifs_errorf (fc,"OOM when copying UNC string\n" ); goto cifs_parse_mount_err; } + hostname =extract_hostname (ctx->UNC); +if (IS_ERR (hostname)) { +cifs_errorf (fc,"Cannot extract hostname from UNC string\n" ); + goto cifs_parse_mount_err; + } +/* last byte, type, is 0x20 for servr type */ +memset (ctx->target_rfc1001_name,0x20 ,RFC1001_NAME_LEN_WITH_NULL ); +for (i =0 ; i <RFC1001_NAME_LEN && hostname[i] !=0 ; i++) + ctx->target_rfc1001_name[i] =toupper (hostname[i]); +kfree (hostname);break ;case Opt_user:kfree (ctx->username);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 26/486 cifs: add validation check for the fields in smb_aces
In reply to Sasha LevinFrom: Namjae Jeon <[email protected]>
[ Upstream commit eeb827f2922eb07ffbf7d53569cc95b38272646f ]
cifs.ko is missing validation check when accessing smb_aces. This patch add validation check for the fields in smb_aces.
--- fs/smb/client/cifsacl.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
fs/smb/client/cifsacl.c +16 -1
@@ -811,7 +811,23 @@ static void parse_dacl(struct smb_acl *pdacl, char *end_of_acl,return ;for (i =0 ; i < num_aces; ++i) { +if (end_of_acl - acl_base < acl_size) +break ; + ppace[i] = (struct smb_ace *) (acl_base + acl_size); + acl_base = (char *)ppace[i]; + acl_size = offsetof(struct smb_ace , sid) + + offsetof(struct smb_sid , sub_auth); + +if (end_of_acl - acl_base < acl_size || + ppace[i]->sid.num_subauth ==0 || + ppace[i]->sid.num_subauth >SID_MAX_SUB_AUTHORITIES || + (end_of_acl - acl_base < + acl_size +sizeof (__le32) * ppace[i]->sid.num_subauth) || + (le16_to_cpu (ppace[i]->size) < + acl_size +sizeof (__le32) * ppace[i]->sid.num_subauth)) +break ; +#ifdef CONFIG_CIFS_DEBUG2 dump_ace (ppace[i], end_of_acl);#endif
@@ -855,7 +871,6 @@ static void parse_dacl(struct smb_acl *pdacl, char *end_of_acl,(void *)ppace[i], sizeof(struct smb_ace)); */ - acl_base = (char *)ppace[i]; acl_size =le16_to_cpu (ppace[i]->size); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 27/486 cifs: Fix establishing NetBIOS session for SMB2+ connection
In reply to Sasha LevinFrom: Pali Rohár <[email protected]>
[ Upstream commit 781802aa5a5950f99899f13ff9d760f5db81d36d ]
Function ip_rfc1001_connect() which establish NetBIOS session for SMB connections, currently uses smb_send() function for sending NetBIOS Session Request packet. This function expects that the passed buffer is SMB packet and for SMB2+ connections it mangles packet header, which breaks prepared NetBIOS Session Request packet. Result is that this function send garbage packet for SMB2+ connection, which SMB2+ server cannot parse. That function is not mangling packets for SMB1 connections, so it somehow works for SMB1.
Fix this problem and instead of smb_send(), use smb_send_kvec() function which does not mangle prepared packet, this function send them as is. Just API of this function takes struct msghdr (kvec) instead of packet buffer.
[MS-SMB2] specification allows SMB2 protocol to use NetBIOS as a transport protocol. NetBIOS can be used over TCP via port 139. So this is a valid configuration, just not so common. And even recent Windows versions (e.g. Windows Server 2022) still supports this configuration: SMB over TCP port 139, including for modern SMB2 and SMB3 dialects.
This change fixes SMB2 and SMB3 connections over TCP port 139 which requires establishing of NetBIOS session. Tested that this change fixes establishing of SMB2 and SMB3 connections with Windows Server 2022.
--- fs/smb/client/cifsproto.h | 3 +++ fs/smb/client/connect.c | 20 +++++++++++++++----- fs/smb/client/transport.c | 2 +- 3 files changed, 19 insertions(+), 6 deletions(-)
fs/smb/client/cifsproto.h +3 -0
@@ -31,6 +31,9 @@ extern void cifs_small_buf_release(void *);extern void free_rsp_buf (int ,void *);extern int smb_send (struct TCP_Server_Info *,struct smb_hdr *,unsigned int /* length */ ); +extern int smb_send_kvec (struct TCP_Server_Info *server, +struct msghdr *msg, +size_t *sent);extern unsigned int _get_xid (void );extern void _free_xid (unsigned int );#define get_xid () \
fs/smb/client/connect.c +15 -5
@@ -3043,8 +3043,10 @@ ip_rfc1001_connect(struct TCP_Server_Info *server)* sessinit is sent but no second negprot */ struct rfc1002_session_packet req = {}; -struct smb_hdr *smb_buf = (struct smb_hdr *)&req; +struct msghdr msg = {}; +struct kvec iov = {};unsigned int len; +size_t sent; req.trailer.session_req.called_len =sizeof (req.trailer.session_req.called_name);
@@ -3073,10 +3075,18 @@ ip_rfc1001_connect(struct TCP_Server_Info *server)* As per rfc1002, @len must be the number of bytes that follows the * length field of a rfc1002 session request payload. */ - len = sizeof(req) - offsetof(struct rfc1002_session_packet, trailer.session_req); + len =sizeof (req.trailer.session_req); + req.type =RFC1002_SESSION_REQUEST ; + req.flags =0 ; + req.length =cpu_to_be16 (len); + len += offsetof(typeof(req), trailer.session_req); + iov.iov_base = &req; + iov.iov_len = len; +iov_iter_kvec (&msg.msg_iter,ITER_SOURCE , &iov,1 , len); + rc =smb_send_kvec (server, &msg, &sent); +if (rc <0 || len != sent) +return (rc == -EINTR || rc == -EAGAIN ) ? rc : -ECONNABORTED ; - smb_buf->smb_buf_length =cpu_to_be32 ((RFC1002_SESSION_REQUEST <<24 ) | len); - rc =smb_send (server, smb_buf, len);/* * RFC1001 layer in at least one server requires very short break before * negprot presumably because not expecting negprot to follow so fast.
@@ -3085,7 +3095,7 @@ ip_rfc1001_connect(struct TCP_Server_Info *server)*/ usleep_range (1000 ,2000 ); -return rc; +return 0 ; } static int
fs/smb/client/transport.c +1 -1
@@ -179,7 +179,7 @@ delete_mid(struct mid_q_entry *mid)* Our basic "send data to server" function. Should be called with srv_mutex * held. The caller is responsible for handling the results. */ -static int +int smb_send_kvec (struct TCP_Server_Info *server,struct msghdr *smb_msg,size_t *sent) {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 28/486 NFSv4: Treat ENETUNREACH errors as fatal for state recovery
In reply to Sasha LevinFrom: Trond Myklebust <[email protected]>
[ Upstream commit 0af5fb5ed3d2fd9e110c6112271f022b744a849a ]
If a containerised process is killed and causes an ENETUNREACH or ENETDOWN error to be propagated to the state manager, then mark the nfs_client as being dead so that we don't loop in functions that are expecting recovery to succeed.
--- fs/nfs/nfs4state.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
fs/nfs/nfs4state.c +9 -1
@@ -2740,7 +2740,15 @@ static void nfs4_state_manager(struct nfs_client *clp)pr_warn_ratelimited ("NFS: state manager%s%s failed on NFSv4 server %s" " with error %d\n" , section_sep, section, clp->cl_hostname, -status); -ssleep (1 ); +switch (status) { +case -ENETDOWN : +case -ENETUNREACH : +nfs_mark_client_ready (clp, -EIO ); +break ; +default : +ssleep (1 ); +break ; + } out_drain:memalloc_nofs_restore (memflags);nfs4_end_drain_session (clp);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 29/486 SUNRPC: rpc_clnt_set_transport() must not change the autobind setting
In reply to Sasha LevinFrom: Trond Myklebust <[email protected]>
[ Upstream commit bf9be373b830a3e48117da5d89bb6145a575f880 ]
The autobind setting was supposed to be determined in rpc_create(), since commit c2866763b402 ("SUNRPC: use sockaddr + size when creating remote transport endpoints").
--- net/sunrpc/clnt.c | 3 --- 1 file changed, 3 deletions(-)
net/sunrpc/clnt.c +0 -3
@@ -270,9 +270,6 @@ static struct rpc_xprt *rpc_clnt_set_transport(struct rpc_clnt *clnt, old =rcu_dereference_protected (clnt->cl_xprt,lockdep_is_held (&clnt->cl_lock)); -if (!xprt_bound (xprt)) - clnt->cl_autobind =1 ; - clnt->cl_timeout = timeout;rcu_assign_pointer (clnt->cl_xprt, xprt);spin_unlock (&clnt->cl_lock);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 30/486 SUNRPC: rpcbind should never reset the port to the value '0'
In reply to Sasha LevinFrom: Trond Myklebust <[email protected]>
[ Upstream commit 214c13e380ad7636631279f426387f9c4e3c14d9 ]
If we already had a valid port number for the RPC service, then we should not allow the rpcbind client to set it to the invalid value '0'.
--- net/sunrpc/rpcb_clnt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/sunrpc/rpcb_clnt.c +3 -2
@@ -820,9 +820,10 @@ static void rpcb_getport_done(struct rpc_task *child, void *data) }trace_rpcb_setport (child, map->r_status, map->r_port); - xprt->ops->set_port (xprt, map->r_port); -if (map->r_port) +if (map->r_port) { + xprt->ops->set_port (xprt, map->r_port);xprt_set_bound (xprt); + } }/*
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 31/486 spi-rockchip: Fix register out of bounds access
In reply to Sasha LevinFrom: Luis de Arquer <[email protected]>
[ Upstream commit 7a874e8b54ea21094f7fd2d428b164394c6cb316 ]
Do not write native chip select stuff for GPIO chip selects. GPIOs can be numbered much higher than native CS. Also, it makes no sense.
--- drivers/spi/spi-rockchip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-rockchip.c +1 -1
@@ -547,7 +547,7 @@ static int rockchip_spi_config(struct rockchip_spi *rs, cr0 |= (spi->mode &0x3U ) <<CR0_SCPH_OFFSET ;if (spi->mode &SPI_LSB_FIRST ) cr0 |=CR0_FBM_LSB <<CR0_FBM_OFFSET ; -if (spi->mode &SPI_CS_HIGH ) +if ((spi->mode &SPI_CS_HIGH ) && !(spi_get_csgpiod (spi,0 ))) cr0 |=BIT (spi_get_chipselect (spi,0 )) <<CR0_SOI_OFFSET ;if (xfer->rx_buf && xfer->tx_buf)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 32/486 ASoC: codecs: wsa884x: Correct VI sense channel mask
In reply to Sasha LevinFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 060fac202eb8e5c83961f0e0bf6dad8ab6e46643 ]
VI sense port on WSA883x speaker takes only one channel, so use 0x1 as channel mask. This fixes garbage being recorded by the speaker when testing the VI sense feedback path.
--- sound/soc/codecs/wsa884x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wsa884x.c +1 -1
@@ -891,7 +891,7 @@ static const struct sdw_port_config wsa884x_pconfig[WSA884X_MAX_SWR_PORTS] = { }, [WSA884X_PORT_VISENSE] = { .num = WSA884X_PORT_VISENSE + 1, - .ch_mask = 0x3, + .ch_mask = 0x1, }, [WSA884X_PORT_CPS] = { .num = WSA884X_PORT_CPS + 1,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 33/486 ASoC: codecs: wsa883x: Correct VI sense channel mask
In reply to Sasha LevinFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit ed3b274abc4008efffebf1997968a3f2720a86d3 ]
VI sense port on WSA883x speaker takes only one channel, so use 0x1 as channel mask. This fixes garbage being recorded by the speaker when testing the VI sense feedback path.
--- sound/soc/codecs/wsa883x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wsa883x.c +1 -1
@@ -529,7 +529,7 @@ static const struct sdw_port_config wsa883x_pconfig[WSA883X_MAX_SWR_PORTS] = { }, [WSA883X_PORT_VISENSE ] = { .num =WSA883X_PORT_VISENSE +1 , - .ch_mask =0x3 , + .ch_mask =0x1 , }, };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 34/486 mctp: Fix incorrect tx flow invalidation condition in mctp-i2c
In reply to Sasha LevinFrom: Daniel Hsu <[email protected]>
[ Upstream commit 70facbf978ac90c6da17a3de2a8dd111b06f1bac ]
Previously, the condition for invalidating the tx flow in mctp_i2c_invalidate_tx_flow() checked if rc was nonzero. However, this could incorrectly trigger the invalidation even when rc > 0 was returned as a success status.
This patch updates the condition to explicitly check for rc < 0, ensuring that only error cases trigger the invalidation.
--- drivers/net/mctp/mctp-i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/mctp/mctp-i2c.c +1 -1
@@ -538,7 +538,7 @@ static void mctp_i2c_xmit(struct mctp_i2c_dev *midev, struct sk_buff *skb) rc =__i2c_transfer (midev->adapter, &msg,1 );/* on tx errors, the flow can no longer be considered valid */ -if (rc) +if (rc <0 )mctp_i2c_invalidate_tx_flow (midev, skb);break ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 35/486 net: tn40xx: add pci-id of the aqr105-based Tehuti TN4010 cards
In reply to Sasha LevinFrom: Hans-Frieder Vogt <[email protected]>
[ Upstream commit 53377b5c2952097527b01ce2f1d9a9332f042f70 ]
Add the PCI-ID of the AQR105-based Tehuti TN4010 cards to allow loading of the tn40xx driver on these cards. Here, I chose the detailed definition with the subvendor ID similar to the QT2025 cards with the PCI-ID TEHUTI:0x4022, because there is a card with an AQ2104 hiding amongst the AQR105 cards, and they all come with the same PCI-ID (TEHUTI:0x4025). But the AQ2104 is currently not supported.
--- drivers/net/ethernet/tehuti/tn40.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/tehuti/tn40.c +4 -0
@@ -1832,6 +1832,10 @@ static const struct pci_device_id tn40_id_table[] = { PCI_VENDOR_ID_ASUSTEK, 0x8709) }, {PCI_DEVICE_SUB (PCI_VENDOR_ID_TEHUTI ,0x4022 , PCI_VENDOR_ID_EDIMAX, 0x8103) }, + { PCI_DEVICE_SUB(PCI_VENDOR_ID_TEHUTI, PCI_DEVICE_ID_TEHUTI_TN9510, + PCI_VENDOR_ID_TEHUTI, 0x3015) }, + { PCI_DEVICE_SUB(PCI_VENDOR_ID_TEHUTI, PCI_DEVICE_ID_TEHUTI_TN9510, + PCI_VENDOR_ID_EDIMAX, 0x8102) }, { } };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 36/486 net: tn40xx: create swnode for mdio and aqr105 phy and add to mdiobus
In reply to Sasha LevinFrom: Hans-Frieder Vogt <[email protected]>
[ Upstream commit 25b6a6d29d4082f6ac231c056ac321a996eb55c9 ]
In case of an AQR105-based device, create a software node for the mdio function, with a child node for the Aquantia AQR105 PHY, providing a firmware-name (and a bit more, which may be used for future checks) to allow the PHY to load a MAC specific firmware from the file system.
The name of the PHY software node follows the naming convention suggested in the patch for the mdiobus_scan function (in the same patch series).
--- drivers/net/ethernet/tehuti/tn40.c | 5 +- drivers/net/ethernet/tehuti/tn40.h | 33 ++++++++++ drivers/net/ethernet/tehuti/tn40_mdio.c | 82 ++++++++++++++++++++++++- 3 files changed, 117 insertions(+), 3 deletions(-)
drivers/net/ethernet/tehuti/tn40.c +4 -1
@@ -1778,7 +1778,7 @@ static int tn40_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ret =tn40_phy_register (priv);if (ret) {dev_err (&pdev->dev,"failed to set up PHY.\n" ); - goto err_free_irq; + goto err_cleanup_swnodes; } ret =tn40_priv_init (priv);
@@ -1795,6 +1795,8 @@ static int tn40_probe(struct pci_dev *pdev, const struct pci_device_id *ent)return 0 ; err_unregister_phydev:tn40_phy_unregister (priv); +err_cleanup_swnodes: +tn40_swnodes_cleanup (priv); err_free_irq:pci_free_irq_vectors (pdev); err_unset_drvdata:
@@ -1816,6 +1818,7 @@ static void tn40_remove(struct pci_dev *pdev)unregister_netdev (ndev);tn40_phy_unregister (priv); +tn40_swnodes_cleanup (priv);pci_free_irq_vectors (priv->pdev);pci_set_drvdata (pdev,NULL );iounmap (priv->regs);
drivers/net/ethernet/tehuti/tn40.h +33 -0
@@ -4,10 +4,13 @@#ifndef _TN40_H_#define _TN40_H_ +#include <linux/property.h> #include "tn40_regs.h" #define TN40_DRV_NAME "tn40xx" +#define PCI_DEVICE_ID_TEHUTI_TN9510 0x4025 +#define TN40_MDIO_SPEED_1MHZ (1)#define TN40_MDIO_SPEED_6MHZ (6)
@@ -102,10 +105,39 @@ struct tn40_txdb {int size;/* Number of elements in the db */ }; +#define NODE_PROP (_NAME, _PROP) ( \ + (const struct software_node) { \ + .name = _NAME, \ + .properties = _PROP, \ + }) + +#define NODE_PAR_PROP (_NAME, _PAR, _PROP) ( \ + (const struct software_node) { \ + .name = _NAME, \ + .parent = _PAR, \ + .properties = _PROP, \ + }) + +enum tn40_swnodes { +SWNODE_MDIO , +SWNODE_PHY , +SWNODE_MAX +}; + +struct tn40_nodes { +char phy_name[32 ]; +char mdio_name[32 ]; +struct property_entry phy_props[3 ]; +struct software_node swnodes[SWNODE_MAX ]; +const struct software_node *group[SWNODE_MAX +1 ]; +}; +struct tn40_priv {struct net_device *ndev;struct pci_dev *pdev; +struct tn40_nodes nodes; +struct napi_struct napi;/* RX FIFOs: 1 for data (full) descs, and 2 for free descs */ struct tn40_rxd_fifo rxd_fifo0;
@@ -225,6 +257,7 @@ static inline void tn40_write_reg(struct tn40_priv *priv, u32 reg, u32 val)int tn40_set_link_speed (struct tn40_priv *priv,u32 speed); +void tn40_swnodes_cleanup (struct tn40_priv *priv);int tn40_mdiobus_init (struct tn40_priv *priv);int tn40_phy_register (struct tn40_priv *priv);
drivers/net/ethernet/tehuti/tn40_mdio.c +80 -2
106 lines not on this page · raw message
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 37/486 thermal/drivers/mediatek/lvts: Start sensor interrupts disabled
In reply to Sasha LevinFrom: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit 2738fb3ec6838a10d2c4ce65cefdb3b90b11bd61 ]
Interrupts are enabled per sensor in lvts_update_irq_mask() as needed, there's no point in enabling all of them during initialization. Change the MONINT register initial value so all sensor interrupts start disabled.
--- drivers/thermal/mediatek/lvts_thermal.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/thermal/mediatek/lvts_thermal.c +1 -2
@@ -65,7 +65,6 @@#define LVTS_HW_FILTER 0x0#define LVTS_TSSEL_CONF 0x13121110#define LVTS_CALSCALE_CONF 0x300 -#define LVTS_MONINT_CONF 0x0300318C#define LVTS_MONINT_OFFSET_SENSOR0 0xC#define LVTS_MONINT_OFFSET_SENSOR1 0x180
@@ -929,7 +928,7 @@ static int lvts_irq_init(struct lvts_ctrl *lvts_ctrl)* The LVTS_MONINT register layout is the same as the LVTS_MONINTSTS * register, except we set the bits to enable the interrupt. */ -writel (LVTS_MONINT_CONF ,LVTS_MONINT (lvts_ctrl->base)); +writel (0 ,LVTS_MONINT (lvts_ctrl->base));return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 38/486 thermal/drivers/qoriq: Power down TMU on system suspend
In reply to Sasha LevinFrom: Alice Guo <[email protected]>
[ Upstream commit 229f3feb4b0442835b27d519679168bea2de96c2 ]
Enable power-down of TMU (Thermal Management Unit) for TMU version 2 during system suspend to save power. Save approximately 4.3mW on VDD_ANA_1P8 on i.MX93 platforms.
--- drivers/thermal/qoriq_thermal.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/thermal/qoriq_thermal.c +13 -0
@@ -18,6 +18,7 @@#define SITES_MAX 16#define TMR_DISABLE 0x0#define TMR_ME 0x80000000 +#define TMR_CMD BIT(29)#define TMR_ALPF 0x0c000000#define TMR_ALPF_V2 0x03000000#define TMTMIR_DEFAULT 0x0000000f
@@ -356,6 +357,12 @@ static int qoriq_tmu_suspend(struct device *dev)if (ret)return ret; +if (data->ver >TMU_VER1 ) { + ret =regmap_set_bits (data->regmap,REGS_TMR ,TMR_CMD ); +if (ret) +return ret; + } +clk_disable_unprepare (data->clk);return 0 ;
@@ -370,6 +377,12 @@ static int qoriq_tmu_resume(struct device *dev)if (ret)return ret; +if (data->ver >TMU_VER1 ) { + ret =regmap_clear_bits (data->regmap,REGS_TMR ,TMR_CMD ); +if (ret) +return ret; + } +/* Enable monitoring */ return regmap_update_bits (data->regmap,REGS_TMR ,TMR_ME ,TMR_ME ); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 39/486 Bluetooth: btmtksdio: Prevent enabling interrupts after IRQ handler removal
In reply to Sasha LevinFrom: Sean Wang <[email protected]>
[ Upstream commit 6ac4233afb9a389a7629b7f812395d1d1eca5a83 ]
Ensure interrupts are not re-enabled when the IRQ handler has already been removed. This prevents unexpected IRQ handler execution due to stale or unhandled interrupts.
Modify btmtksdio_txrx_work to check if bdev->func->irq_handler exists before calling sdio_writel to enable interrupts.
--- drivers/bluetooth/btmtksdio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/bluetooth/btmtksdio.c +2 -1
@@ -610,7 +610,8 @@ static void btmtksdio_txrx_work(struct work_struct *work) }while (int_status ||time_is_before_jiffies (txrx_timeout));/* Enable interrupt */ -sdio_writel (bdev->func,C_INT_EN_SET ,MTK_REG_CHLPCR ,NULL ); +if (bdev->func->irq_handler) +sdio_writel (bdev->func,C_INT_EN_SET ,MTK_REG_CHLPCR ,NULL );sdio_release_host (bdev->func);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 40/486 Bluetooth: Disable SCO support if READ_VOICE_SETTING is unsupported/broken
In reply to Sasha LevinFrom: Pedro Nishiyama <[email protected]>
[ Upstream commit 14d17c78a4b1660c443bae9d38c814edea506f62 ]
A SCO connection without the proper voice_setting can cause the controller to lock up.
--- net/bluetooth/hci_event.c | 3 +++ 1 file changed, 3 insertions(+)
net/bluetooth/hci_event.c +3 -0
@@ -932,6 +932,9 @@ static u8 hci_cc_read_buffer_size(struct hci_dev *hdev, void *data, hdev->sco_pkts =8 ; } +if (!read_voice_setting_capable (hdev)) + hdev->sco_pkts =0 ; + hdev->acl_cnt = hdev->acl_pkts; hdev->sco_cnt = hdev->sco_pkts;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 41/486 exit: fix the usage of delay_group_leader->exit_code in do_notify_parent() and pidfs_exit()
In reply to Sasha LevinFrom: Oleg Nesterov <[email protected]>
[ Upstream commit 9133607de37a4887c6f89ed937176a0a0c1ebb17 ]
Consider a process with a group leader L and a sub-thread T. L does sys_exit(1), then T does sys_exit_group(2).
In this case wait_task_zombie(L) will notice SIGNAL_GROUP_EXIT and use L->signal->group_exit_code, this is correct.
But, before that, do_notify_parent(L) called by release_task(T) will use L->exit_code != L->signal->group_exit_code, and this is not consistent. We don't really care, I think that nobody relies on the info which comes with SIGCHLD, if nothing else SIGCHLD < SIGRTMIN can be queued only once.
But pidfs_exit() is more problematic, I think pidfs_exit_info->exit_code should report ->group_exit_code in this case, just like wait_task_zombie().
TODO: with this change we can hopefully cleanup (or may be even kill) the similar SIGNAL_GROUP_EXIT checks, at least in wait_task_zombie().
--- kernel/exit.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/exit.c +3 -0
@@ -266,6 +266,9 @@ void release_task(struct task_struct *p) leader = p->group_leader;if (leader != p &&thread_group_empty (leader) && leader->exit_state ==EXIT_ZOMBIE ) { +/* for pidfs_exit() and do_notify_parent() */ +if (leader->signal->flags &SIGNAL_GROUP_EXIT ) + leader->exit_code = leader->signal->group_exit_code;/* * If we were the last child thread and the leader has * exited already, and the leader's parent ignores SIGCHLD,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 42/486 dql: Fix dql->limit value when reset.
In reply to Sasha LevinFrom: Jing Su <[email protected]>
[ Upstream commit 3a17f23f7c36bac3a3584aaf97d3e3e0b2790396 ]
Executing dql_reset after setting a non-zero value for limit_min can lead to an unreasonable situation where dql->limit is less than dql->limit_min.
For instance, after setting /sys/class/net/eth*/queues/tx-0/byte_queue_limits/limit_min, an ifconfig down/up operation might cause the ethernet driver to call netdev_tx_reset_queue, which in turn invokes dql_reset.
In this case, dql->limit is reset to 0 while dql->limit_min remains non-zero value, which is unexpected. The limit should always be greater than or equal to limit_min.
--- lib/dynamic_queue_limits.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/dynamic_queue_limits.c +1 -1
@@ -190,7 +190,7 @@ EXPORT_SYMBOL(dql_completed);void dql_reset (struct dql *dql) {/* Reset all dynamic values */ - dql->limit =0 ; + dql->limit = dql->min_limit; dql->num_queued =0 ; dql->num_completed =0 ; dql->last_obj_cnt =0 ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 43/486 lockdep: Fix wait context check on softirq for PREEMPT_RT
In reply to Sasha LevinFrom: Ryo Takakura <[email protected]>
[ Upstream commit 61c39d8c83e2077f33e0a2c8980a76a7f323f0ce ]
Since:
0c1d7a2c2d32 ("lockdep: Remove softirq accounting on PREEMPT_RT.")
the wait context test for mutex usage within "in softirq context" fails as it references @softirq_context:
| wait context tests |
--------------------------------------------------------------------------
| rcu | raw | spin |mutex |
--------------------------------------------------------------------------
in hardirq context: ok | ok | ok | ok |
in hardirq context (not threaded): ok | ok | ok | ok |
in softirq context: ok | ok | ok |FAILED|As a fix, add lockdep map for BH disabled section. This fixes the issue by letting us catch cases when local_bh_disable() gets called with preemption disabled where local_lock doesn't get acquired. In the case of "in softirq context" selftest, local_bh_disable() was being called with preemption disable as it's early in the boot.
[ boqun: Move the lockdep annotations into __local_bh_*() to avoid false
positives because of unpaired local_bh_disable() reported by Borislav Petkov and Peter Zijlstra, and make bh_lock_map only exist for PREEMPT_RT. ]
[ mingo: Restored authorship and improved the bh_lock_map definition. ]
--- kernel/softirq.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
kernel/softirq.c +18 -0
@@ -126,6 +126,18 @@ static DEFINE_PER_CPU(struct softirq_ctrl, softirq_ctrl) = { .lock = INIT_LOCAL_LOCK(softirq_ctrl.lock), }; +#ifdef CONFIG_DEBUG_LOCK_ALLOC +static struct lock_class_key bh_lock_key; +struct lockdep_map bh_lock_map = { + .name ="local_bh" , + .key = &bh_lock_key, + .wait_type_outer =LD_WAIT_FREE , + .wait_type_inner =LD_WAIT_CONFIG ,/* PREEMPT_RT makes BH preemptible. */ + .lock_type =LD_LOCK_PERCPU , +}; +EXPORT_SYMBOL_GPL (bh_lock_map); +#endif +/** * local_bh_blocked() - Check for idle whether BH processing is blocked *
@@ -148,6 +160,8 @@ void __local_bh_disable_ip(unsigned long ip, unsigned int cnt)WARN_ON_ONCE (in_hardirq ()); +lock_map_acquire_read (&bh_lock_map); +/* First entry of a task into a BH disabled section? */ if (!current->softirq_disable_cnt) {if (preemptible ()) {
@@ -211,6 +225,8 @@ void __local_bh_enable_ip(unsigned long ip, unsigned int cnt)WARN_ON_ONCE (in_hardirq ());lockdep_assert_irqs_enabled (); +lock_map_release (&bh_lock_map); +local_irq_save (flags); curcnt =__this_cpu_read (softirq_ctrl.cnt);
@@ -261,6 +277,8 @@ static inline void ksoftirqd_run_begin(void)/* Counterpart to ksoftirqd_run_begin() */ static inline void ksoftirqd_run_end (void ) { +/* pairs with the lock_map_acquire_read() in ksoftirqd_run_begin() */ +lock_map_release (&bh_lock_map);__local_bh_enable (SOFTIRQ_OFFSET , true);WARN_ON_ONCE (in_interrupt ());local_irq_enable ();
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 44/486 objtool: Properly disable uaccess validation
In reply to Sasha LevinFrom: Josh Poimboeuf <[email protected]>
[ Upstream commit e1a9dda74dbffbc3fa2069ff418a1876dc99fb14 ]
If opts.uaccess isn't set, the uaccess validation is disabled, but only
partially: it doesn't read the uaccess_safe_builtin list but still tries to do the validation. Disable it completely to prevent false warnings.
--- tools/objtool/check.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
tools/objtool/check.c +9 -2
@@ -3352,7 +3352,7 @@ static int handle_insn_ops(struct instruction *insn,if (update_cfi_state (insn, next_insn, &state->cfi, op))return 1 ; -if (!insn->alt_group) +if (!opts.uaccess || !insn->alt_group)continue ;if (op->dest.type ==OP_DEST_PUSHF ) {
@@ -3819,6 +3819,9 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,return 0 ;case INSN_STAC : +if (!opts.uaccess) +break ; +if (state.uaccess) {WARN_INSN (insn,"recursive UACCESS enable" );return 1 ;
@@ -3828,6 +3831,9 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,break ;case INSN_CLAC : +if (!opts.uaccess) +break ; +if (!state.uaccess && func) {WARN_INSN (insn,"redundant UACCESS disable" );return 1 ;
@@ -4303,7 +4309,8 @@ static int validate_symbol(struct objtool_file *file, struct section *sec,if (!insn || insn->ignore || insn->visited)return 0 ; - state->uaccess = sym->uaccess_safe; +if (opts.uaccess) + state->uaccess = sym->uaccess_safe; ret =validate_branch (file,insn_func (insn), insn, *state);if (ret)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 45/486 PCI: dwc: ep: Ensure proper iteration over outbound map windows
In reply to Sasha LevinFrom: Frank Li <[email protected]>
[ Upstream commit f3e1dccba0a0833fc9a05fb838ebeb6ea4ca0e1a ]
Most systems' PCIe outbound map windows have non-zero physical addresses, but the possibility of encountering zero increased after following commit ("PCI: dwc: Use parent_bus_offset").
'ep->outbound_addr[n]', representing 'parent_bus_address', might be 0 on some hardware, which trims high address bits through bus fabric before sending to the PCIe controller.
Replace the iteration logic with 'for_each_set_bit()' to ensure only allocated map windows are iterated when determining the ATU index from a given address.
--- drivers/pci/controller/dwc/pcie-designware-ep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/dwc/pcie-designware-ep.c +1 -1
@@ -280,7 +280,7 @@ static int dw_pcie_find_index(struct dw_pcie_ep *ep, phys_addr_t addr,u32 index;struct dw_pcie *pci =to_dw_pcie_from_ep (ep); -for (index =0 ; index < pci->num_ob_windows; index++) { +for_each_set_bit (index, ep->ob_window_map, pci->num_ob_windows) {if (ep->outbound_addr[index] != addr)continue ; *atu_index = index;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 46/486 r8169: disable RTL8126 ZRX-DC timeout
In reply to Sasha LevinFrom: ChunHao Lin <[email protected]>
[ Upstream commit b48688ea3c9ac8d5d910c6e91fb7f80d846581f0 ]
Disable it due to it dose not meet ZRX-DC specification. If it is enabled, device will exit L1 substate every 100ms. Disable it for saving more power in L1 substate.
--- drivers/net/ethernet/realtek/r8169_main.c | 27 +++++++++++++++++++++++ 1 file changed, 27 insertions(+)
drivers/net/ethernet/realtek/r8169_main.c +27 -0
@@ -2850,6 +2850,32 @@ static u32 rtl_csi_read(struct rtl8169_private *tp, int addr) RTL_R32(tp, CSIDR) : ~0; } +static void rtl_disable_zrxdc_timeout (struct rtl8169_private *tp) +{ +struct pci_dev *pdev = tp->pci_dev; +u32 csi; +int rc; +u8 val; + +#define RTL_GEN3_RELATED_OFF 0x0890 +#define RTL_GEN3_ZRXDC_NONCOMPL 0x1 +if (pdev->cfg_size >RTL_GEN3_RELATED_OFF ) { + rc =pci_read_config_byte (pdev,RTL_GEN3_RELATED_OFF , &val); +if (rc ==PCIBIOS_SUCCESSFUL ) { + val &= ~RTL_GEN3_ZRXDC_NONCOMPL ; + rc =pci_write_config_byte (pdev,RTL_GEN3_RELATED_OFF , + val); +if (rc ==PCIBIOS_SUCCESSFUL ) +return ; + } + } + +netdev_notice_once (tp->dev, +"No native access to PCI extended config space, falling back to CSI\n" ); + csi =rtl_csi_read (tp,RTL_GEN3_RELATED_OFF ); +rtl_csi_write (tp,RTL_GEN3_RELATED_OFF , csi & ~RTL_GEN3_ZRXDC_NONCOMPL ); +} +static void rtl_set_aspm_entry_latency (struct rtl8169_private *tp,u8 val) {struct pci_dev *pdev = tp->pci_dev;
@@ -3816,6 +3842,7 @@ static void rtl_hw_start_8125b(struct rtl8169_private *tp)static void rtl_hw_start_8126a (struct rtl8169_private *tp) { +rtl_disable_zrxdc_timeout (tp);rtl_set_def_aspm_entry_latency (tp);rtl_hw_start_8125_common (tp); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 47/486 tools/build: Don't pass test log files to linker
In reply to Sasha LevinFrom: Ian Rogers <[email protected]>
[ Upstream commit 935e7cb5bb80106ff4f2fe39640f430134ef8cd8 ]
Separate test log files from object files. Depend on test log output but don't pass to the linker.
--- tools/build/Makefile.build | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tools/build/Makefile.build +5 -1
@@ -149,6 +149,10 @@ objprefix := $(subst ./,,$(OUTPUT)$(dir)/) obj-y := $(addprefix $(objprefix),$(obj-y)) subdir-obj-y := $(addprefix $(objprefix),$(subdir-obj-y)) +# Separate out test log files from real build objects. +test-y := $(filter %_log, $(obj-y)) +obj-y := $(filter-out %_log, $(obj-y)) + # Final '$(obj)-in.o' object in-target := $(objprefix)$(obj)-in.o
@@ -159,7 +163,7 @@ $(subdir-y): $(sort $(subdir-obj-y)): $(subdir-y) ; -$(in-target): $(obj-y) FORCE +$(in-target): $(obj-y) $(test-y) FORCE $(call rule_mkdir) $(call if_changed,$(host)ld_multi)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 48/486 pNFS/flexfiles: Report ENETDOWN as a connection error
In reply to Sasha LevinFrom: Trond Myklebust <[email protected]>
[ Upstream commit aa42add73ce9b9e3714723d385c254b75814e335 ]
If the client should see an ENETDOWN when trying to connect to the data server, it might still be able to talk to the metadata server through another NIC. If so, report the error.
--- fs/nfs/flexfilelayout/flexfilelayout.c | 1 + 1 file changed, 1 insertion(+)
fs/nfs/flexfilelayout/flexfilelayout.c +1 -0
@@ -1263,6 +1263,7 @@ static void ff_layout_io_track_ds_error(struct pnfs_layout_segment *lseg,case -ECONNRESET :case -EHOSTDOWN :case -EHOSTUNREACH : +case -ENETDOWN :case -ENETUNREACH :case -EADDRINUSE :case -ENOBUFS :
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 49/486 drm/amdgpu/discovery: check ip_discovery fw file available
In reply to Sasha LevinFrom: Flora Cui <[email protected]>
[ Upstream commit 017fbb6690c2245b1b4ef39b66c79d2990fe63dd ]
--- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +16 -15
@@ -111,8 +111,7 @@#include "amdgpu_isp.h" #endif -#define FIRMWARE_IP_DISCOVERY "amdgpu/ip_discovery.bin" -MODULE_FIRMWARE (FIRMWARE_IP_DISCOVERY ); +MODULE_FIRMWARE ("amdgpu/ip_discovery.bin" );#define mmIP_DISCOVERY_VERSION 0x16A00#define mmRCC_CONFIG_MEMSIZE 0xde3
@@ -295,21 +294,13 @@ static int amdgpu_discovery_read_binary_from_mem(struct amdgpu_device *adev,return ret; } -static int amdgpu_discovery_read_binary_from_file (struct amdgpu_device *adev,uint8_t *binary) +static int amdgpu_discovery_read_binary_from_file (struct amdgpu_device *adev, +uint8_t *binary, +const char *fw_name) {const struct firmware *fw; -const char *fw_name;int r; -switch (amdgpu_discovery) { -case 2 : - fw_name =FIRMWARE_IP_DISCOVERY ; -break ; -default : -dev_warn (adev->dev,"amdgpu_discovery is not set properly\n" ); -return -EINVAL ; - } - r =request_firmware (&fw, fw_name, adev->dev);if (r) { dev_err(adev->dev, "can't load firmware \"%s\"\n",
@@ -402,10 +393,19 @@ static int amdgpu_discovery_verify_npsinfo(struct amdgpu_device *adev,return 0 ; } +static const char *amdgpu_discovery_get_fw_name (struct amdgpu_device *adev) +{ +if (amdgpu_discovery ==2 ) +return "amdgpu/ip_discovery.bin" ; + +return NULL ; +} +static int amdgpu_discovery_init (struct amdgpu_device *adev) {struct table_info *info;struct binary_header *bhdr; +const char *fw_name;uint16_t offset;uint16_t size;uint16_t checksum;
@@ -417,9 +417,10 @@ static int amdgpu_discovery_init(struct amdgpu_device *adev)return -ENOMEM ;/* Read from file if it is the preferred option */ -if (amdgpu_discovery ==2 ) { + fw_name =amdgpu_discovery_get_fw_name (adev); +if (fw_name !=NULL ) {dev_info (adev->dev,"use ip discovery information from file" ); - r =amdgpu_discovery_read_binary_from_file (adev, adev->mman.discovery_bin); + r =amdgpu_discovery_read_binary_from_file (adev, adev->mman.discovery_bin, fw_name);if (r) {dev_err (adev->dev,"failed to read ip discovery binary from file\n" );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 50/486 drm/amdkfd: set precise mem ops caps to disabled for gfx 11 and 12
In reply to Sasha LevinFrom: Jonathan Kim <[email protected]>
[ Upstream commit f82d27dcff939d3cbecbc60e1b71e2518c37e81d ]
Clause instructions with precise memory enabled currently hang the shader so set capabilities flag to disabled since it's unsafe to use for debugging.
--- drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +0 -4
@@ -2002,10 +2002,6 @@ static void kfd_topology_set_capabilities(struct kfd_topology_device *dev) dev->node_props.debug_prop |=HSA_DBG_WATCH_ADDR_MASK_LO_BIT_GFX10 |HSA_DBG_WATCH_ADDR_MASK_HI_BIT ; -if (KFD_GC_VERSION (dev->gpu) >=IP_VERSION (11 ,0 ,0 )) - dev->node_props.capability |= -HSA_CAP_TRAP_DEBUG_PRECISE_MEMORY_OPERATIONS_SUPPORTED ; -if (KFD_GC_VERSION (dev->gpu) >=IP_VERSION (12 ,0 ,0 )) dev->node_props.capability |=HSA_CAP_TRAP_DEBUG_PRECISE_ALU_OPERATIONS_SUPPORTED ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 51/486 PCI: vmd: Disable MSI remapping bypass under Xen
In reply to Sasha LevinFrom: Roger Pau Monne <[email protected]>
[ Upstream commit 6c4d5aadf5df31ea0ac025980670eee9beaf466b ]
MSI remapping bypass (directly configuring MSI entries for devices on the VMD bus) won't work under Xen, as Xen is not aware of devices in such bus, and hence cannot configure the entries using the pIRQ interface in the PV case, and in the PVH case traps won't be setup for MSI entries for such devices.
Until Xen is aware of devices in the VMD bus prevent the VMD_FEAT_CAN_BYPASS_MSI_REMAP capability from being used when running as any kind of Xen guest.
The MSI remapping bypass is an optional feature of VMD bridges, and hence when running under Xen it will be masked and devices will be forced to redirect its interrupts from the VMD bridge. That mode of operation must always be supported by VMD bridges and works when Xen is not aware of devices behind the VMD bridge.
Message-ID: <[email protected]>
--- drivers/pci/controller/vmd.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/pci/controller/vmd.c +20 -0
@@ -17,6 +17,8 @@#include <linux/rculist.h> #include <linux/rcupdate.h> +#include <xen/xen.h> +#include <asm/irqdomain.h> #define VMD_CFGBAR 0
@@ -970,6 +972,24 @@ static int vmd_probe(struct pci_dev *dev, const struct pci_device_id *id)struct vmd_dev *vmd;int err; +if (xen_domain ()) { +/* +* Xen doesn't have knowledge about devices in the VMD bus +* because the config space of devices behind the VMD bridge is +* not known to Xen, and hence Xen cannot discover or configure +* them in any way. +* +* Bypass of MSI remapping won't work in that case as direct +* write by Linux to the MSI entries won't result in functional +* interrupts, as Xen is the entity that manages the host +* interrupt controller and must configure interrupts. However +* multiplexing of interrupts by the VMD bridge will work under +* Xen, so force the usage of that mode which must always be +* supported by VMD bridges. +*/ + features &= ~VMD_FEAT_CAN_BYPASS_MSI_REMAP ; + } +if (resource_size (&dev->resource[VMD_CFGBAR ]) < (1 <<20 ))return -ENOMEM ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 52/486 xen/pci: Do not register devices with segments >= 0x10000
In reply to Sasha LevinFrom: Roger Pau Monne <[email protected]>
[ Upstream commit 5ccf1b8ae76ddf348e02a0d1564ff9baf8b6c415 ]
The current hypercall interface for doing PCI device operations always uses a segment field that has a 16 bit width. However on Linux there are buses like VMD that hook up devices into the PCI hierarchy at segment >= 0x10000, after the maximum possible segment enumerated in ACPI.
Attempting to register or manage those devices with Xen would result in errors at best, or overlaps with existing devices living on the truncated equivalent segment values. Note also that the VMD segment numbers are arbitrarily assigned by the OS, and hence there would need to be some negotiation between Xen and the OS to agree on how to enumerate VMD segments and devices behind them.
Skip notifying Xen about those devices. Given how VMD bridges can multiplex interrupts on behalf of devices behind them there's no need for Xen to be aware of such devices for them to be usable by Linux.
Message-ID: <[email protected]>
--- drivers/xen/pci.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
drivers/xen/pci.c +32 -0
@@ -43,6 +43,18 @@ static int xen_add_device(struct device *dev) pci_mcfg_reserved = true; }#endif + +if (pci_domain_nr (pci_dev->bus) >>16 ) { +/* +* The hypercall interface is limited to 16bit PCI segment +* values, do not attempt to register devices with Xen in +* segments greater or equal than 0x10000. +*/ +dev_info (dev, +"not registering with Xen: invalid PCI segment\n" ); +return 0 ; + } +if (pci_seg_supported) { DEFINE_RAW_FLEX(struct physdev_pci_device_add, add, optarr, 1);
@@ -149,6 +161,16 @@ static int xen_remove_device(struct device *dev)int r;struct pci_dev *pci_dev =to_pci_dev (dev); +if (pci_domain_nr (pci_dev->bus) >>16 ) { +/* +* The hypercall interface is limited to 16bit PCI segment +* values. +*/ +dev_info (dev, +"not unregistering with Xen: invalid PCI segment\n" ); +return 0 ; + } +if (pci_seg_supported) {struct physdev_pci_device device = { .seg =pci_domain_nr (pci_dev->bus),
@@ -182,6 +204,16 @@ int xen_reset_device(const struct pci_dev *dev) .flags = PCI_DEVICE_RESET_FLR, }; +if (pci_domain_nr (dev->bus) >>16 ) { +/* +* The hypercall interface is limited to 16bit PCI segment +* values. +*/ +dev_info (&dev->dev, +"unable to notify Xen of device reset: invalid PCI segment\n" ); +return 0 ; + } +return HYPERVISOR_physdev_op (PHYSDEVOP_pci_device_reset, &device); }EXPORT_SYMBOL_GPL (xen_reset_device);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 53/486 ext4: on a remount, only log the ro or r/w state when it has changed
In reply to Sasha LevinFrom: Nicolas Bretz <[email protected]>
[ Upstream commit d7b0befd09320e3356a75cb96541c030515e7f5f ]
A user complained that a message such as:
EXT4-fs (nvme0n1p3): re-mounted UUID ro. Quota mode: none.
implied that the file system was previously mounted read/write and was now remounted read-only, when it could have been some other mount state that had changed by the "mount -o remount" operation. Fix this by only logging "ro"or "r/w" when it has changed.
https://bugzilla.kernel.org/show_bug.cgi?id=219132
--- fs/ext4/super.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
fs/ext4/super.c +4 -3
@@ -6744,6 +6744,7 @@ static int ext4_reconfigure(struct fs_context *fc) {struct super_block *sb = fc->root->d_sb;int ret; +bool old_ro =sb_rdonly (sb); fc->s_fs_info =EXT4_SB (sb);
@@ -6755,9 +6756,9 @@ static int ext4_reconfigure(struct fs_context *fc)if (ret <0 )return ret; -ext4_msg (sb,KERN_INFO ,"re-mounted %pU %s. Quota mode: %s." , - &sb->s_uuid,sb_rdonly (sb) ?"ro" :"r/w" , -ext4_quota_mode (sb)); +ext4_msg (sb,KERN_INFO ,"re-mounted %pU%s." , + &sb->s_uuid, + (old_ro !=sb_rdonly (sb)) ? (sb_rdonly (sb) ?" ro" :" r/w" ) :"" );return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 54/486 libnvdimm/labels: Fix divide error in nd_label_data_init()
In reply to Sasha LevinFrom: Robert Richter <[email protected]>
[ Upstream commit ef1d3455bbc1922f94a91ed58d3d7db440652959 ]
If a faulty CXL memory device returns a broken zero LSA size in its memory device information (Identify Memory Device (Opcode 4000h), CXL spec. 3.1, 8.2.9.9.1.1), a divide error occurs in the libnvdimm driver:
Oops: divide error: 0000 [#1] PREEMPT SMP NOPTI RIP: 0010:nd_label_data_init+0x10e/0x800 [libnvdimm]
Code and flow:
1) CXL Command 4000h returns LSA size = 0
2) config_size is assigned to zero LSA size (CXL pmem driver):
drivers/cxl/pmem.c: .config_size = mds->lsa_size,
3) max_xfer is set to zero (nvdimm driver):
drivers/nvdimm/label.c: max_xfer = min_t(size_t, ndd->nsarea.max_xfer, config_size);
4) A subsequent DIV_ROUND_UP() causes a division by zero:
drivers/nvdimm/label.c: /* Make our initial read size a multiple of max_xfer size */ drivers/nvdimm/label.c: read_size = min(DIV_ROUND_UP(read_size, max_xfer) * max_xfer,drivers/nvdimm/label.c- config_size);
Fix this by checking the config size parameter by extending an existing check.
--- drivers/nvdimm/label.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvdimm/label.c +2 -1
@@ -442,7 +442,8 @@ int nd_label_data_init(struct nvdimm_drvdata *ndd)if (ndd->data)return 0 ; -if (ndd->nsarea.status || ndd->nsarea.max_xfer ==0 ) { +if (ndd->nsarea.status || ndd->nsarea.max_xfer ==0 || + ndd->nsarea.config_size ==0 ) {dev_dbg (ndd->dev,"failed to init config data area: (%u:%u)\n" , ndd->nsarea.max_xfer, ndd->nsarea.config_size);return -ENXIO ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 55/486 pidfs: improve multi-threaded exec and premature thread-group leader exit polling
In reply to Sasha LevinFrom: Christian Brauner <[email protected]>
[ Upstream commit 0fb482728ba1ee2130eaa461bf551f014447997c ]
This is another attempt trying to make pidfd polling for multi-threaded exec and premature thread-group leader exit consistent.
A quick recap of these two cases:
(1) During a multi-threaded exec by a subthread, i.e., non-thread-group leader thread, all other threads in the thread-group including the thread-group leader are killed and the struct pid of the thread-group leader will be taken over by the subthread that called exec. IOW, two tasks change their TIDs.
(2) A premature thread-group leader exit means that the thread-group leader exited before all of the other subthreads in the thread-group have exited.
Both cases lead to inconsistencies for pidfd polling with PIDFD_THREAD. Any caller that holds a PIDFD_THREAD pidfd to the current thread-group leader may or may not see an exit notification on the file descriptor depending on when poll is performed. If the poll is performed before the exec of the subthread has concluded an exit notification is generated for the old thread-group leader. If the poll is performed after the exec of the subthread has concluded no exit notification is generated for the old thread-group leader.
The correct behavior would be to simply not generate an exit notification on the struct pid of a subhthread exec because the struct pid is taken over by the subthread and thus remains alive.
But this is difficult to handle because a thread-group may exit prematurely as mentioned in (2). In that case an exit notification is reliably generated but the subthreads may continue to run for an indeterminate amount of time and thus also may exec at some point.
So far there was no way to distinguish between (1) and (2) internally. This tiny series tries to address this problem by discarding PIDFD_THREAD notification on premature thread-group leader exit.
If that works correctly then no exit notifications are generated for a PIDFD_THREAD pidfd for a thread-group leader until all subthreads have been reaped. If a subthread should exec aftewards no exit notification will be generated until that task exits or it creates subthreads and repeates the cycle.
--- fs/pidfs.c | 9 +++++---- kernel/exit.c | 6 +++--- kernel/signal.c | 3 +-- 3 files changed, 9 insertions(+), 9 deletions(-)
fs/pidfs.c +5 -4
@@ -95,20 +95,21 @@ static void pidfd_show_fdinfo(struct seq_file *m, struct file *f)static __poll_t pidfd_poll (struct file *file,struct poll_table_struct *pts) {struct pid *pid =pidfd_pid (file); -bool thread = file->f_flags &PIDFD_THREAD ;struct task_struct *task;__poll_t poll_flags =0 ;poll_wait (file, &pid->wait_pidfd, pts);/* -* Depending on PIDFD_THREAD, inform pollers when the thread -* or the whole thread-group exits. +* Don't wake waiters if the thread-group leader exited +* prematurely. They either get notified when the last subthread +* exits or not at all if one of the remaining subthreads execs +* and assumes the struct pid of the old thread-group leader. */ guard (rcu)(); task =pid_task (pid,PIDTYPE_PID );if (!task) poll_flags =EPOLLIN |EPOLLRDNORM |EPOLLHUP ; -else if (task->exit_state && (thread ||thread_group_empty (task))) +else if (task->exit_state && !delay_group_leader (task)) poll_flags =EPOLLIN |EPOLLRDNORM ;return poll_flags;
kernel/exit.c +3 -3
@@ -745,10 +745,10 @@ static void exit_notify(struct task_struct *tsk, int group_dead) tsk->exit_state =EXIT_ZOMBIE ;/* -* sub-thread or delay_group_leader(), wake up the -* PIDFD_THREAD waiters. +* Ignore thread-group leaders that exited before all +* subthreads did. */ -if (!thread_group_empty (tsk)) +if (!delay_group_leader (tsk))do_notify_pidfd (tsk);if (unlikely (tsk->ptrace)) {
kernel/signal.c +1 -2
@@ -2063,8 +2063,7 @@ bool do_notify_parent(struct task_struct *tsk, int sig)WARN_ON_ONCE (!tsk->ptrace && (tsk->group_leader != tsk || !thread_group_empty (tsk)));/* -* tsk is a group leader and has no threads, wake up the -* non-PIDFD_THREAD waiters. +* Notify for thread-group leaders without subthreads. */ if (thread_group_empty (tsk))do_notify_pidfd (tsk);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 56/486 staging: vchiq_arm: Create keep-alive thread during probe
In reply to Sasha LevinFrom: Stefan Wahren <[email protected]>
[ Upstream commit 86bc8821700665ad3962f3ef0d93667f59cf7031 ]
Creating the keep-alive thread in vchiq_platform_init_state have the following advantages:
- abort driver probe if kthread_create fails (more consistent behavior)
- make resource release process easier
Since vchiq_keepalive_thread_func is defined below vchiq_platform_init_state, the latter must be moved.
--- .../interface/vchiq_arm/vchiq_arm.c | 69 +++++++++---------- 1 file changed, 34 insertions(+), 35 deletions(-)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +34 -35
@@ -588,29 +588,6 @@ static int vchiq_platform_init(struct platform_device *pdev, struct vchiq_statereturn 0 ; } -int -vchiq_platform_init_state (struct vchiq_state *state) -{ -struct vchiq_arm_state *platform_state; - - platform_state =devm_kzalloc (state->dev,sizeof (*platform_state),GFP_KERNEL ); -if (!platform_state) -return -ENOMEM ; - -rwlock_init (&platform_state->susp_res_lock); - -init_completion (&platform_state->ka_evt); -atomic_set (&platform_state->ka_use_count,0 ); -atomic_set (&platform_state->ka_use_ack_count,0 ); -atomic_set (&platform_state->ka_release_count,0 ); - - platform_state->state = state; - - state->platform_state = (struct opaque_platform_state *)platform_state; - -return 0 ; -} -static struct vchiq_arm_state *vchiq_platform_get_arm_state (struct vchiq_state *state) {return (struct vchiq_arm_state *)state->platform_state;
@@ -1358,6 +1335,39 @@ vchiq_keepalive_thread_func(void *v)return 0 ; } +int +vchiq_platform_init_state (struct vchiq_state *state) +{ +struct vchiq_arm_state *platform_state; +char threadname[16 ]; + + platform_state =devm_kzalloc (state->dev,sizeof (*platform_state),GFP_KERNEL ); +if (!platform_state) +return -ENOMEM ; + +snprintf (threadname,sizeof (threadname),"vchiq-keep/%d" , + state->id); + platform_state->ka_thread =kthread_create (&vchiq_keepalive_thread_func, + (void *)state, threadname); +if (IS_ERR (platform_state->ka_thread)) { +dev_err (state->dev,"couldn't create thread %s\n" , threadname); +return PTR_ERR (platform_state->ka_thread); + } + +rwlock_init (&platform_state->susp_res_lock); + +init_completion (&platform_state->ka_evt); +atomic_set (&platform_state->ka_use_count,0 ); +atomic_set (&platform_state->ka_use_ack_count,0 ); +atomic_set (&platform_state->ka_release_count,0 ); + + platform_state->state = state; + + state->platform_state = (struct opaque_platform_state *)platform_state; + +return 0 ; +} +int vchiq_use_internal (struct vchiq_state *state,struct vchiq_service *service,enum USE_TYPE_E use_type)
@@ -1678,7 +1688,6 @@ void vchiq_platform_conn_state_changed(struct vchiq_state *state, enum vchiq_connstate newstate) {struct vchiq_arm_state *arm_state =vchiq_platform_get_arm_state (state); -char threadname[16 ];dev_dbg (state->dev,"suspend: %d: %s->%s\n" , state->id,get_conn_state_name (oldstate),get_conn_state_name (newstate));
@@ -1693,17 +1702,7 @@ void vchiq_platform_conn_state_changed(struct vchiq_state *state, arm_state->first_connect =1 ;write_unlock_bh (&arm_state->susp_res_lock); -snprintf (threadname,sizeof (threadname),"vchiq-keep/%d" , - state->id); - arm_state->ka_thread =kthread_create (&vchiq_keepalive_thread_func, - (void *)state, - threadname); -if (IS_ERR (arm_state->ka_thread)) { -dev_err (state->dev,"suspend: Couldn't create thread %s\n" , - threadname); - }else { -wake_up_process (arm_state->ka_thread); - } +wake_up_process (arm_state->ka_thread); }static const struct of_device_id vchiq_of_match[] = {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 57/486 mmc: host: Wait for Vdd to settle on card power off
In reply to Sasha LevinFrom: Erick Shepherd <[email protected]>
[ Upstream commit 31e75ed964582257f59156ce6a42860e1ae4cc39 ]
The SD spec version 6.0 section 6.4.1.5 requires that Vdd must be lowered to less than 0.5V for a minimum of 1 ms when powering off a card. Increase wait to 15 ms so that voltage has time to drain down to 0.5V and cards can power off correctly. Issues with voltage drain time were only observed on Apollo Lake and Bay Trail host controllers so this fix is limited to those devices.
--- drivers/mmc/host/sdhci-pci-core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-pci-core.c +5 -1
@@ -609,8 +609,12 @@ static void sdhci_intel_set_power(struct sdhci_host *host, unsigned char mode,sdhci_set_power (host, mode, vdd); -if (mode ==MMC_POWER_OFF ) +if (mode ==MMC_POWER_OFF ) { +if (slot->chip->pdev->device ==PCI_DEVICE_ID_INTEL_APL_SD || + slot->chip->pdev->device ==PCI_DEVICE_ID_INTEL_BYT_SD ) +usleep_range (15000 ,17500 );return ; + }/* * Bus power might not enable after D3 -> D0 transition due to the
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 58/486 drm/amdgpu: Skip pcie_replay_count sysfs creation for VF
In reply to Sasha LevinFrom: Victor Skvortsov <[email protected]>
[ Upstream commit 9c05636ca72a2dbf41bf0900380f438a0de47319 ]
VFs cannot read the NAK_COUNTER register. This information is only available through PMFW metrics.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 27 ++++++++++++++++------ 1 file changed, 20 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +20 -7
@@ -168,6 +168,24 @@ static ssize_t amdgpu_device_get_pcie_replay_count(struct device *dev, static DEVICE_ATTR(pcie_replay_count, 0444, amdgpu_device_get_pcie_replay_count, NULL); +static int amdgpu_device_attr_sysfs_init (struct amdgpu_device *adev) +{ +int ret =0 ; + +if (!amdgpu_sriov_vf (adev)) + ret =sysfs_create_file (&adev->dev->kobj, + &dev_attr_pcie_replay_count.attr); + +return ret; +} + +static void amdgpu_device_attr_sysfs_fini (struct amdgpu_device *adev) +{ +if (!amdgpu_sriov_vf (adev)) +sysfs_remove_file (&adev->dev->kobj, + &dev_attr_pcie_replay_count.attr); +} +static ssize_t amdgpu_sysfs_reg_state_get (struct file *f,struct kobject *kobj,struct bin_attribute *attr,char *buf,loff_t ppos,size_t count)
@@ -4028,11 +4046,6 @@ static bool amdgpu_device_check_iommu_remap(struct amdgpu_device *adev) }#endif -static const struct attribute *amdgpu_dev_attributes[] = { - &dev_attr_pcie_replay_count.attr, -NULL -}; -static void amdgpu_device_set_mcbp (struct amdgpu_device *adev) {if (amdgpu_mcbp ==1 )
@@ -4475,7 +4488,7 @@ int amdgpu_device_init(struct amdgpu_device *adev, }else adev->ucode_sysfs_en = true; - r =sysfs_create_files (&adev->dev->kobj, amdgpu_dev_attributes); + r =amdgpu_device_attr_sysfs_init (adev);if (r)dev_err (adev->dev,"Could not create amdgpu device attr\n" );
@@ -4605,7 +4618,7 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev)amdgpu_pm_sysfs_fini (adev);if (adev->ucode_sysfs_en)amdgpu_ucode_sysfs_fini (adev); -sysfs_remove_files (&adev->dev->kobj, amdgpu_dev_attributes); +amdgpu_device_attr_sysfs_fini (adev);amdgpu_fru_sysfs_fini (adev);amdgpu_reg_state_sysfs_fini (adev);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 59/486 cgroup/rstat: avoid disabling irqs for O(num_cpu)
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit 0efc297a3c4974dbd609ee36fc6345720b6ca735 ]
cgroup_rstat_flush_locked() grabs the irq safe cgroup_rstat_lock while iterating all possible cpus. It only drops the lock if there is scheduler or spin lock contention. If neither, then interrupts can be disabled for a long time. On large machines this can disable interrupts for a long enough time to drop network packets. On 400+ CPU machines I've seen interrupt disabled for over 40 msec.
Prevent rstat from disabling interrupts while processing all possible cpus. Instead drop and reacquire cgroup_rstat_lock for each cpu. This approach was previously discussed in
https://lore.kernel.org/lkml/ZBz%2FV5a7%[email protected]/,
though this was in the context of an non-irq rstat spin lock.
Benchmark this change with:
1) a single stat_reader process with 400 threads, each reading a test memcg's memory.stat repeatedly for 10 seconds.
2) 400 memory hog processes running in the test memcg and repeatedly charging memory until oom killed. Then they repeat charging and oom killing.
v6.14-rc6 with CONFIG_IRQSOFF_TRACER with stat_reader and hogs, finds interrupts are disabled by rstat for 45341 usec:
# => started at: _raw_spin_lock_irq
# => ended at: cgroup_rstat_flush
#
#
# _------=> CPU#
# / _-----=> irqs-off/BH-disabled
# | / _----=> need-resched # || / _---=> hardirq/softirq # ||| / _--=> preempt-depth # |||| / _-=> migrate-disable # ||||| / delay # cmd pid |||||| time | caller # \ / |||||| \ | / stat_rea-96532 52d.... 0us*: _raw_spin_lock_irq stat_rea-96532 52d.... 45342us : cgroup_rstat_flush stat_rea-96532 52d.... 45342us : tracer_hardirqs_on <-cgroup_rstat_flush stat_rea-96532 52d.... 45343us : <stack trace>
=> memcg1_stat_format
=> memory_stat_format
=> memory_stat_show
=> seq_read_iter
=> vfs_read
=> ksys_read
=> do_syscall_64
=> entry_SYSCALL_64_after_hwframe
With this patch the CONFIG_IRQSOFF_TRACER doesn't find rstat to be the longest holder. The longest irqs-off holder has irqs disabled for 4142 usec, a huge reduction from previous 45341 usec rstat finding.
Running stat_reader memory.stat reader for 10 seconds:
- without memory hogs: 9.84M accesses => 12.7M accesses
- with memory hogs: 9.46M accesses => 11.1M accesses
The throughput of memory.stat access improves.
The mode of memory.stat access latency after grouping by of 2 buckets:
- without memory hogs: 64 usec => 16 usec
- with memory hogs: 64 usec => 8 usec
The memory.stat latency improves.
--- kernel/cgroup/rstat.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
kernel/cgroup/rstat.c +5 -7
@@ -323,13 +323,11 @@ static void cgroup_rstat_flush_locked(struct cgroup *cgrp)rcu_read_unlock (); } -/* play nice and yield if necessary */ -if (need_resched () ||spin_needbreak (&cgroup_rstat_lock)) { -__cgroup_rstat_unlock (cgrp, cpu); -if (!cond_resched ()) -cpu_relax (); -__cgroup_rstat_lock (cgrp, cpu); - } +/* play nice and avoid disabling interrupts for a long time */ +__cgroup_rstat_unlock (cgrp, cpu); +if (!cond_resched ()) +cpu_relax (); +__cgroup_rstat_lock (cgrp, cpu); } }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 60/486 wifi: mt76: only mark tx-status-failed frames as ACKed on mt76x0/2
In reply to Sasha LevinFrom: Felix Fietkau <[email protected]>
[ Upstream commit 0c5a89ceddc1728a40cb3313948401dd70e3c649 ]
The interrupt status polling is unreliable, which can cause status events to get lost. On all newer chips, txs-timeout is an indication that the packet was either never sent, or never acked.
Fixes issues with inactivity polling.
--- drivers/net/wireless/mediatek/mt76/mt76.h | 1 + drivers/net/wireless/mediatek/mt76/mt76x0/pci.c | 3 ++- drivers/net/wireless/mediatek/mt76/mt76x0/usb.c | 3 ++- drivers/net/wireless/mediatek/mt76/mt76x2/pci.c | 3 ++- drivers/net/wireless/mediatek/mt76/mt76x2/usb.c | 3 ++- drivers/net/wireless/mediatek/mt76/tx.c | 3 ++- 6 files changed, 11 insertions(+), 5 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76.h +1 -0
@@ -489,6 +489,7 @@ struct mt76_hw_cap {#define MT_DRV_RX_DMA_HDR BIT(3)#define MT_DRV_HW_MGMT_TXQ BIT(4)#define MT_DRV_AMSDU_OFFLOAD BIT(5) +#define MT_DRV_IGNORE_TXS_FAILED BIT(6)struct mt76_driver_ops {u32 drv_flags;
drivers/net/wireless/mediatek/mt76/mt76x0/pci.c +2 -1
@@ -156,7 +156,8 @@ mt76x0e_probe(struct pci_dev *pdev, const struct pci_device_id *id)static const struct mt76_driver_ops drv_ops = { .txwi_size =sizeof (struct mt76x02_txwi ), .drv_flags =MT_DRV_TX_ALIGNED4_SKBS | -MT_DRV_SW_RX_AIRTIME , +MT_DRV_SW_RX_AIRTIME | +MT_DRV_IGNORE_TXS_FAILED , .survey_flags =SURVEY_INFO_TIME_TX , .update_survey = mt76x02_update_channel, .set_channel = mt76x0_set_channel,
drivers/net/wireless/mediatek/mt76/mt76x0/usb.c +2 -1
@@ -214,7 +214,8 @@ static int mt76x0u_probe(struct usb_interface *usb_intf, const struct usb_device_id *id) {static const struct mt76_driver_ops drv_ops = { - .drv_flags =MT_DRV_SW_RX_AIRTIME , + .drv_flags =MT_DRV_SW_RX_AIRTIME | +MT_DRV_IGNORE_TXS_FAILED , .survey_flags =SURVEY_INFO_TIME_TX , .update_survey = mt76x02_update_channel, .set_channel = mt76x0_set_channel,
drivers/net/wireless/mediatek/mt76/mt76x2/pci.c +2 -1
@@ -22,7 +22,8 @@ mt76x2e_probe(struct pci_dev *pdev, const struct pci_device_id *id)static const struct mt76_driver_ops drv_ops = { .txwi_size =sizeof (struct mt76x02_txwi ), .drv_flags =MT_DRV_TX_ALIGNED4_SKBS | -MT_DRV_SW_RX_AIRTIME , +MT_DRV_SW_RX_AIRTIME | +MT_DRV_IGNORE_TXS_FAILED , .survey_flags =SURVEY_INFO_TIME_TX , .update_survey = mt76x02_update_channel, .set_channel = mt76x2e_set_channel,
drivers/net/wireless/mediatek/mt76/mt76x2/usb.c +2 -1
@@ -30,7 +30,8 @@ static int mt76x2u_probe(struct usb_interface *intf, const struct usb_device_id *id) {static const struct mt76_driver_ops drv_ops = { - .drv_flags =MT_DRV_SW_RX_AIRTIME , + .drv_flags =MT_DRV_SW_RX_AIRTIME | +MT_DRV_IGNORE_TXS_FAILED , .survey_flags =SURVEY_INFO_TIME_TX , .update_survey = mt76x02_update_channel, .set_channel = mt76x2u_set_channel,
drivers/net/wireless/mediatek/mt76/tx.c +2 -1
@@ -100,7 +100,8 @@ __mt76_tx_status_skb_done(struct mt76_dev *dev, struct sk_buff *skb, u8 flags,return ;/* Tx status can be unreliable. if it fails, mark the frame as ACKed */ -if (flags &MT_TX_CB_TXS_FAILED ) { +if (flags &MT_TX_CB_TXS_FAILED && + (dev->drv->drv_flags &MT_DRV_IGNORE_TXS_FAILED )) { info->status.rates[0 ].count =0 ; info->status.rates[0 ].idx =-1 ; info->flags |=IEEE80211_TX_STAT_ACK ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 61/486 wifi: mt76: mt7996: fix SER reset trigger on WED reset
In reply to Sasha LevinFrom: Rex Lu <[email protected]>
[ Upstream commit 8d38abdf6c182225c5c0a81451fa51b7b36a635d ]
The firmware needs a specific trigger when WED is being reset due to an ethernet reset condition. This helps prevent further L1 SER failure.
--- drivers/net/wireless/mediatek/mt76/mt7996/mcu.h | 3 ++- drivers/net/wireless/mediatek/mt76/mt7996/mmio.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/mcu.h +2 -1
@@ -908,7 +908,8 @@ enum {UNI_CMD_SER_SET_RECOVER_L3_TX_DISABLE ,UNI_CMD_SER_SET_RECOVER_L3_BF ,UNI_CMD_SER_SET_RECOVER_L4_MDP , -UNI_CMD_SER_SET_RECOVER_FULL , +UNI_CMD_SER_SET_RECOVER_FROM_ETH , +UNI_CMD_SER_SET_RECOVER_FULL =8 ,UNI_CMD_SER_SET_SYSTEM_ASSERT ,/* action */ UNI_CMD_SER_ENABLE = 1,
drivers/net/wireless/mediatek/mt76/mt7996/mmio.c +1 -1
@@ -281,7 +281,7 @@ static int mt7996_mmio_wed_reset(struct mtk_wed_device *wed)if (test_and_set_bit (MT76_STATE_WED_RESET , &mphy->state))return -EBUSY ; - ret =mt7996_mcu_set_ser (dev,UNI_CMD_SER_TRIGGER ,UNI_CMD_SER_SET_RECOVER_L1 , + ret =mt7996_mcu_set_ser (dev,UNI_CMD_SER_TRIGGER ,UNI_CMD_SER_SET_RECOVER_FROM_ETH , mphy->band_idx);if (ret) goto out;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 62/486 wifi: mt76: mt7996: revise TXS size
In reply to Sasha LevinFrom: Benjamin Lin <[email protected]>
[ Upstream commit 593c829b4326f7b3b15a69e97c9044ecbad3c319 ]
Size of MPDU/PPDU TXS is 12 DWs.
In mt7996/mt7992, last 4 DWs are reserved, so TXS size was mistakenly considered to be 8 DWs. However, in mt7990, 9th DW of TXS starts to be used.
--- drivers/net/wireless/mediatek/mt76/mt76_connac3_mac.h | 3 +++ drivers/net/wireless/mediatek/mt76/mt7996/mac.c | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt76_connac3_mac.h +3 -0
@@ -314,6 +314,9 @@ enum tx_frag_idx {#define MT_TXFREE_INFO_COUNT GENMASK(27, 24)#define MT_TXFREE_INFO_STAT GENMASK(29, 28) +#define MT_TXS_HDR_SIZE 4/* Unit: DW */ +#define MT_TXS_SIZE 12/* Unit: DW */ +#define MT_TXS0_BW GENMASK(31, 29)#define MT_TXS0_TID GENMASK(28, 26)#define MT_TXS0_AMPDU BIT(25)
drivers/net/wireless/mediatek/mt76/mt7996/mac.c +2 -2
@@ -1399,7 +1399,7 @@ bool mt7996_rx_check(struct mt76_dev *mdev, void *data, int len)mt7996_mac_tx_free (dev, data, len);return false;case PKT_TYPE_TXS : -for (rxd +=4 ; rxd +8 <= end; rxd +=8 ) +for (rxd +=MT_TXS_HDR_SIZE ; rxd +MT_TXS_SIZE <= end; rxd +=MT_TXS_SIZE )mt7996_mac_add_txs (dev, rxd);return false;case PKT_TYPE_RX_FW_MONITOR :
@@ -1442,7 +1442,7 @@ void mt7996_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,mt7996_mcu_rx_event (dev, skb);break ;case PKT_TYPE_TXS : -for (rxd +=4 ; rxd +8 <= end; rxd +=8 ) +for (rxd +=MT_TXS_HDR_SIZE ; rxd +MT_TXS_SIZE <= end; rxd +=MT_TXS_SIZE )mt7996_mac_add_txs (dev, rxd);dev_kfree_skb (skb);break ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 63/486 wifi: mt76: mt7925: load the appropriate CLC data based on hardware type
In reply to Sasha LevinFrom: Ming Yen Hsieh <[email protected]>
[ Upstream commit f2027ef3f733d3f0bb7f27fa3343784058f946ab ]
Read the EEPROM to determine the hardware type and uses this to load the correct CLC data.
--- .../net/wireless/mediatek/mt76/mt7925/mcu.c | 61 ++++++++++++++++++- .../wireless/mediatek/mt76/mt7925/mt7925.h | 3 + 2 files changed, 63 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +60 -1
@@ -616,6 +616,54 @@ int mt7925_mcu_uni_rx_ba(struct mt792x_dev *dev,return ret; } +static int mt7925_mcu_read_eeprom (struct mt792x_dev *dev,u32 offset,u8 *val) +{ +struct { +u8 rsv[4 ]; + +__le16 tag; +__le16 len; + +__le32 addr; +__le32 valid; +u8 data[MT7925_EEPROM_BLOCK_SIZE ]; + } __packed req = { + .tag =cpu_to_le16 (1 ), + .len =cpu_to_le16 (sizeof (req) -4 ), + .addr =cpu_to_le32 (round_down (offset, +MT7925_EEPROM_BLOCK_SIZE )), + }; +struct evt { +u8 rsv[4 ]; + +__le16 tag; +__le16 len; + +__le32 ver; +__le32 addr; +__le32 valid; +__le32 size; +__le32 magic_num; +__le32 type; +__le32 rsv1[4 ]; +u8 data[32 ]; + } __packed *res; +struct sk_buff *skb; +int ret; + + ret =mt76_mcu_send_and_get_msg (&dev->mt76,MCU_WM_UNI_CMD_QUERY (EFUSE_CTRL ), + &req,sizeof (req), true, &skb); +if (ret) +return ret; + + res = (struct evt *)skb->data; + *val = res->data[offset %MT7925_EEPROM_BLOCK_SIZE ]; + +dev_kfree_skb (skb); + +return 0 ; +} +static int mt7925_load_clc (struct mt792x_dev *dev,const char *fw_name) {const struct mt76_connac2_fw_trailer *hdr;
@@ -624,13 +672,20 @@ static int mt7925_load_clc(struct mt792x_dev *dev, const char *fw_name)struct mt76_dev *mdev = &dev->mt76;struct mt792x_phy *phy = &dev->phy;const struct firmware *fw; +u8 *clc_base =NULL , hw_encap =0 ;int ret, i, len, offset =0 ; -u8 *clc_base =NULL ;if (mt7925_disable_clc ||mt76_is_usb (&dev->mt76))return 0 ; +if (mt76_is_mmio (&dev->mt76)) { + ret =mt7925_mcu_read_eeprom (dev,MT_EE_HW_TYPE , &hw_encap); +if (ret) +return ret; + hw_encap =u8_get_bits (hw_encap,MT_EE_HW_TYPE_ENCAP ); + } + ret =request_firmware (&fw, fw_name, mdev->dev);if (ret)return ret;
@@ -675,6 +730,10 @@ static int mt7925_load_clc(struct mt792x_dev *dev, const char *fw_name)if (phy->clc[clc->idx])continue ; +/* header content sanity */ +if (u8_get_bits (clc->type,MT_EE_HW_TYPE_ENCAP ) != hw_encap) +continue ; + phy->clc[clc->idx] =devm_kmemdup (mdev->dev, clc,le32_to_cpu (clc->len),GFP_KERNEL );
drivers/net/wireless/mediatek/mt76/mt7925/mt7925.h +3 -0
@@ -147,9 +147,12 @@ enum mt7925_eeprom_field {MT_EE_CHIP_ID =0x000 ,MT_EE_VERSION =0x002 ,MT_EE_MAC_ADDR =0x004 , +MT_EE_HW_TYPE =0xa71 , __MT_EE_MAX =0x9ff }; +#define MT_EE_HW_TYPE_ENCAP GENMASK(1, 0) +enum {TXPWR_USER , TXPWR_EEPROM,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 64/486 wifi: mt76: mt7925: fix fails to enter low power mode in suspend state
In reply to Sasha LevinFrom: Quan Zhou <[email protected]>
[ Upstream commit 2d5630b0c9466ac6549495828aa7dce7424a272a ]
The mt7925 sometimes fails to enter low power mode during suspend. This is caused by the chip firmware sending an additional ACK event to the host after processing the suspend command. Due to timing issues, this event may not reach the host, causing the chip to get stuck. To resolve this, the ACK flag in the suspend command is removed, as it is not needed in the MT7925 architecture. This prevents the firmware from sending the additional ACK event, ensuring the device can reliably enter low power mode during suspend.
--- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +3 -0
@@ -3287,6 +3287,9 @@ int mt7925_mcu_fill_message(struct mt76_dev *mdev, struct sk_buff *skb,else uni_txd->option =MCU_CMD_UNI_EXT_ACK ; +if (cmd ==MCU_UNI_CMD (HIF_CTRL )) + uni_txd->option &= ~MCU_CMD_ACK ; + goto exit; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 65/486 x86/headers: Replace __ASSEMBLY__ with __ASSEMBLER__ in UAPI headers
In reply to Sasha LevinFrom: Thomas Huth <[email protected]>
[ Upstream commit 8a141be3233af7d4f7014ebc44d5452d46b2b1be ]
__ASSEMBLY__ is only defined by the Makefile of the kernel, so this is not really useful for UAPI headers (unless the userspace Makefile defines it, too). Let's switch to __ASSEMBLER__ which gets set automatically by the compiler when compiling assembly code.
--- arch/x86/include/uapi/asm/bootparam.h | 4 ++-- arch/x86/include/uapi/asm/e820.h | 4 ++-- arch/x86/include/uapi/asm/ldt.h | 4 ++-- arch/x86/include/uapi/asm/msr.h | 4 ++-- arch/x86/include/uapi/asm/ptrace-abi.h | 6 +++--- arch/x86/include/uapi/asm/ptrace.h | 4 ++-- arch/x86/include/uapi/asm/setup_data.h | 4 ++-- arch/x86/include/uapi/asm/signal.h | 8 ++++---- 8 files changed, 19 insertions(+), 19 deletions(-)
arch/x86/include/uapi/asm/bootparam.h +2 -2
@@ -26,7 +26,7 @@#define XLF_5LEVEL_ENABLED (1<<6)#define XLF_MEM_ENCRYPTION (1<<7) -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/types.h> #include <linux/screen_info.h>
@@ -210,6 +210,6 @@ enum x86_hardware_subarch { X86_NR_SUBARCHS, }; -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _ASM_X86_BOOTPARAM_H */
arch/x86/include/uapi/asm/e820.h +2 -2
@@ -54,7 +54,7 @@*/ #define E820_RESERVED_KERN 128 -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__ #include <linux/types.h> struct e820entry { __u64 addr; /* start of memory segment */
@@ -76,7 +76,7 @@ struct e820map {#define BIOS_ROM_BASE 0xffe00000#define BIOS_ROM_END 0xffffffff -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _UAPI_ASM_X86_E820_H */
arch/x86/include/uapi/asm/ldt.h +2 -2
@@ -12,7 +12,7 @@/* The size of each LDT entry. */ #define LDT_ENTRY_SIZE 8 -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__/* * Note on 64bit base and limit is ignored and you cannot set DS/ES/CS * not to the default values if you still want to do syscalls. This
@@ -44,5 +44,5 @@ struct user_desc {#define MODIFY_LDT_CONTENTS_STACK 1#define MODIFY_LDT_CONTENTS_CODE 2 -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ #endif /* _ASM_X86_LDT_H */
arch/x86/include/uapi/asm/msr.h +2 -2
@@ -2,7 +2,7 @@#ifndef _UAPI_ASM_X86_MSR_H#define _UAPI_ASM_X86_MSR_H -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/types.h> #include <linux/ioctl.h>
@@ -10,5 +10,5 @@#define X86_IOC_RDMSR_REGS _IOWR('c', 0xA0, __u32[8])#define X86_IOC_WRMSR_REGS _IOWR('c', 0xA1, __u32[8]) -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _UAPI_ASM_X86_MSR_H */
arch/x86/include/uapi/asm/ptrace-abi.h +3 -3
@@ -25,7 +25,7 @@#else /* __i386__ */ -#if defined(__ASSEMBLY__) || defined(__FRAME_OFFSETS) +#if defined(__ASSEMBLER__) || defined(__FRAME_OFFSETS)/* * C ABI says these regs are callee-preserved. They aren't saved on kernel entry * unless syscall needs a complete, fully filled "struct pt_regs".
@@ -57,7 +57,7 @@#define EFLAGS 144#define RSP 152#define SS 160 -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ /* top of stack page */ #define FRAME_SIZE 168
@@ -87,7 +87,7 @@#define PTRACE_SINGLEBLOCK 33/* resume execution until next branch */ -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/types.h> #endif
arch/x86/include/uapi/asm/ptrace.h +2 -2
@@ -7,7 +7,7 @@#include <asm/processor-flags.h> -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#ifdef __i386__/* this struct defines the way the registers are stored on the
@@ -81,6 +81,6 @@ struct pt_regs { -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ #endif /* _UAPI_ASM_X86_PTRACE_H */
arch/x86/include/uapi/asm/setup_data.h +2 -2
@@ -18,7 +18,7 @@#define SETUP_INDIRECT (1<<31)#define SETUP_TYPE_MAX (SETUP_ENUM_MAX | SETUP_INDIRECT) -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/types.h>
@@ -78,6 +78,6 @@ struct ima_setup_data {__u64 size; } __attribute__((packed)); -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _UAPI_ASM_X86_SETUP_DATA_H */
arch/x86/include/uapi/asm/signal.h +4 -4
@@ -2,7 +2,7 @@#ifndef _UAPI_ASM_X86_SIGNAL_H#define _UAPI_ASM_X86_SIGNAL_H -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/types.h> #include <linux/compiler.h>
@@ -16,7 +16,7 @@ struct siginfo;typedef unsigned long sigset_t ;#endif /* __KERNEL__ */ -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #define SIGHUP 1
@@ -68,7 +68,7 @@ typedef unsigned long sigset_t;#include <asm-generic/signal-defs.h> -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__# ifndef __KERNEL__
@@ -106,6 +106,6 @@ typedef struct sigaltstack {__kernel_size_t ss_size; } stack_t; -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _UAPI_ASM_X86_SIGNAL_H */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 66/486 x86/stackprotector/64: Only export __ref_stack_chk_guard on CONFIG_SMP
In reply to Sasha LevinFrom: Ingo Molnar <[email protected]>
[ Upstream commit 91d5451d97ce35cbd510277fa3b7abf9caa4e34d ]
The __ref_stack_chk_guard symbol doesn't exist on UP:
<stdin>:4:15: error: ‘__ref_stack_chk_guard’ undeclared here (not in a function)
Fix the #ifdef around the entry.S export.
--- arch/x86/entry/entry.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/entry/entry.S +1 -1
@@ -63,7 +63,7 @@ THUNK warn_thunk_thunk, __warn_thunk * entirely in the C code, and use an alias emitted by the linker script * instead. */ -#ifdef CONFIG_STACKPROTECTOR +#if defined(CONFIG_STACKPROTECTOR) && defined(CONFIG_SMP) EXPORT_SYMBOL(__ref_stack_chk_guard); #endif #endif
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 67/486 x86/smpboot: Fix INIT delay assignment for extended Intel Families
In reply to Sasha LevinFrom: Sohil Mehta <[email protected]>
[ Upstream commit 7a2ad752746bfb13e89a83984ecc52a48bae4969 ]
Some old crusty CPUs need an extra delay that slows down booting. See the comment above 'init_udelay' for details. Newer CPUs don't need the delay.
Right now, for Intel, Family 6 and only Family 6 skips the delay. That leaves out both the Family 15 (Pentium 4s) and brand new Family 18/19 models.
The omission of Family 15 (Pentium 4s) seems like an oversight and 18/19 do not need the delay.
Skip the delay on all Intel processors Family 6 and beyond.
--- arch/x86/kernel/smpboot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/kernel/smpboot.c +3 -3
@@ -681,9 +681,9 @@ static void __init smp_quirk_init_udelay(void)return ;/* if modern processor, use no delay */ -if (((boot_cpu_data.x86_vendor ==X86_VENDOR_INTEL ) && (boot_cpu_data.x86 ==6 )) || - ((boot_cpu_data.x86_vendor ==X86_VENDOR_HYGON ) && (boot_cpu_data.x86 >=0x18 )) || - ((boot_cpu_data.x86_vendor ==X86_VENDOR_AMD ) && (boot_cpu_data.x86 >=0xF ))) { +if ((boot_cpu_data.x86_vendor ==X86_VENDOR_INTEL && boot_cpu_data.x86_vfm >=INTEL_PENTIUM_PRO ) || + (boot_cpu_data.x86_vendor ==X86_VENDOR_HYGON && boot_cpu_data.x86 >=0x18 ) || + (boot_cpu_data.x86_vendor ==X86_VENDOR_AMD && boot_cpu_data.x86 >=0xF )) { init_udelay =0 ;return ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 68/486 x86/microcode: Update the Intel processor flag scan check
In reply to Sasha LevinFrom: Sohil Mehta <[email protected]>
[ Upstream commit 7e6b0a2e4152f4046af95eeb46f8b4f9b2a7398d ]
The Family model check to read the processor flag MSR is misleading and potentially incorrect. It doesn't consider Family while comparing the model number. The original check did have a Family number but it got lost/moved during refactoring.
intel_collect_cpu_info() is called through multiple paths such as early initialization, CPU hotplug as well as IFS image load. Some of these flows would be error prone due to the ambiguous check.
Correct the processor flag scan check to use a Family number and update it to a VFM based one to make it more readable.
--- arch/x86/include/asm/intel-family.h | 1 + arch/x86/kernel/cpu/microcode/intel.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
arch/x86/include/asm/intel-family.h +1 -0
@@ -46,6 +46,7 @@#define INTEL_ANY IFM(X86_FAMILY_ANY, X86_MODEL_ANY)#define INTEL_PENTIUM_PRO IFM(6, 0x01) +#define INTEL_PENTIUM_III_DESCHUTES IFM(6, 0x05)#define INTEL_CORE_YONAH IFM(6, 0x0E)
arch/x86/kernel/cpu/microcode/intel.c +1 -1
@@ -74,7 +74,7 @@ void intel_collect_cpu_info(struct cpu_signature *sig) sig->pf =0 ; sig->rev =intel_get_microcode_revision (); -if (x86_model (sig->sig) >=5 ||x86_family (sig->sig) >6 ) { +if (IFM (x86_family (sig->sig),x86_model (sig->sig)) >=INTEL_PENTIUM_III_DESCHUTES ) {unsigned int val[2 ];/* get processor flags from MSR 0x17 */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 69/486 x86/mm: Check return value from memblock_phys_alloc_range()
In reply to Sasha LevinFrom: Philip Redkin <[email protected]>
[ Upstream commit 631ca8909fd5c62b9fda9edda93924311a78a9c4 ]
At least with CONFIG_PHYSICAL_START=0x100000, if there is < 4 MiB of contiguous free memory available at this point, the kernel will crash and burn because memblock_phys_alloc_range() returns 0 on failure, which leads memblock_phys_free() to throw the first 4 MiB of physical memory to the wolves.
At a minimum it should fail gracefully with a meaningful diagnostic, but in fact everything seems to work fine without the weird reserve allocation.
--- arch/x86/mm/init.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/x86/mm/init.c +7 -2
@@ -645,8 +645,13 @@ static void __init memory_map_top_down(unsigned long map_start,*/ addr =memblock_phys_alloc_range (PMD_SIZE ,PMD_SIZE , map_start, map_end); -memblock_phys_free (addr,PMD_SIZE ); - real_end = addr +PMD_SIZE ; +if (!addr) { +pr_warn ("Failed to release memory for alloc_low_pages()" ); + real_end =max (map_start,ALIGN_DOWN (map_end,PMD_SIZE )); + }else { +memblock_phys_free (addr,PMD_SIZE ); + real_end = addr +PMD_SIZE ; + }/* step_size need to be small so pgt_buf from BRK could cover it */ step_size =PMD_SIZE ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 70/486 i2c: qup: Vote for interconnect bandwidth to DRAM
In reply to Sasha LevinFrom: Stephan Gerhold <[email protected]>
[ Upstream commit d4f35233a6345f62637463ef6e0708f44ffaa583 ]
When the I2C QUP controller is used together with a DMA engine it needs to vote for the interconnect path to the DRAM. Otherwise it may be unable to access the memory quickly enough.
The requested peak bandwidth is dependent on the I2C core clock.
To avoid sending votes too often the bandwidth is always requested when a DMA transfer starts, but dropped only on runtime suspend. Runtime suspend should only happen if no transfer is active. After resumption we can defer the next vote until the first DMA transfer actually happens.
The implementation is largely identical to the one introduced for spi-qup in commit ecdaa9473019 ("spi: qup: Vote for interconnect bandwidth to DRAM") since both drivers represent the same hardware block.
--- drivers/i2c/busses/i2c-qup.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
drivers/i2c/busses/i2c-qup.c +36 -0
@@ -14,6 +14,7 @@#include <linux/dma-mapping.h> #include <linux/err.h> #include <linux/i2c.h> +#include <linux/interconnect.h> #include <linux/interrupt.h> #include <linux/io.h> #include <linux/module.h>
@@ -150,6 +151,8 @@/* TAG length for DATA READ in RX FIFO */ #define READ_RX_TAGS_LEN 2 +#define QUP_BUS_WIDTH 8 +static unsigned int scl_freq;module_param_named (scl_freq, scl_freq, uint,0444 );MODULE_PARM_DESC (scl_freq,"SCL frequency override" );
@@ -227,6 +230,7 @@ struct qup_i2c_dev {int irq;struct clk *clk;struct clk *pclk; +struct icc_path *icc_path;struct i2c_adapter adap;int clk_ctl;
@@ -255,6 +259,10 @@ struct qup_i2c_dev {/* To configure when bus is in run state */ u32 config_run; +/* bandwidth votes */ +u32 src_clk_freq; +u32 cur_bw_clk_freq; +/* dma parameters */ bool is_dma;/* To check if the current transfer is using DMA */
@@ -453,6 +461,23 @@ static int qup_i2c_bus_active(struct qup_i2c_dev *qup, int len)return ret; } +static int qup_i2c_vote_bw (struct qup_i2c_dev *qup,u32 clk_freq) +{ +u32 needed_peak_bw; +int ret; + +if (qup->cur_bw_clk_freq == clk_freq) +return 0 ; + + needed_peak_bw =Bps_to_icc (clk_freq *QUP_BUS_WIDTH ); + ret =icc_set_bw (qup->icc_path,0 , needed_peak_bw); +if (ret) +return ret; + + qup->cur_bw_clk_freq = clk_freq; +return 0 ; +} +static void qup_i2c_write_tx_fifo_v1 (struct qup_i2c_dev *qup) {struct qup_i2c_block *blk = &qup->blk;
@@ -838,6 +863,10 @@ static int qup_i2c_bam_xfer(struct i2c_adapter *adap, struct i2c_msg *msg,int ret =0 ;int idx =0 ; + ret =qup_i2c_vote_bw (qup, qup->src_clk_freq); +if (ret) +return ret; +enable_irq (qup->irq); ret =qup_i2c_req_dma (qup);
@@ -1643,6 +1672,7 @@ static void qup_i2c_disable_clocks(struct qup_i2c_dev *qup) config =readl (qup->base +QUP_CONFIG ); config |=QUP_CLOCK_AUTO_GATE ;writel (config, qup->base +QUP_CONFIG ); +qup_i2c_vote_bw (qup,0 );clk_disable_unprepare (qup->pclk); }
@@ -1743,6 +1773,11 @@ static int qup_i2c_probe(struct platform_device *pdev) goto fail_dma; } qup->is_dma = true; + + qup->icc_path =devm_of_icc_get (&pdev->dev,NULL ); +if (IS_ERR (qup->icc_path)) +return dev_err_probe (&pdev->dev,PTR_ERR (qup->icc_path), +"failed to get interconnect path\n" ); } nodma:
@@ -1791,6 +1826,7 @@ static int qup_i2c_probe(struct platform_device *pdev)qup_i2c_enable_clocks (qup); src_clk_freq =clk_get_rate (qup->clk); } + qup->src_clk_freq = src_clk_freq;/* * Bootloaders might leave a pending interrupt on certain QUP's,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 71/486 i2c: pxa: fix call balance of i2c->clk handling routines
In reply to Sasha LevinFrom: Vitalii Mordan <[email protected]>
[ Upstream commit be7113d2e2a6f20cbee99c98d261a1fd6fd7b549 ]
If the clock i2c->clk was not enabled in i2c_pxa_probe(), it should not be disabled in any path.
Found by Linux Verification Center (linuxtesting.org) with Klever.
--- drivers/i2c/busses/i2c-pxa.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-pxa.c +4 -1
@@ -1503,7 +1503,10 @@ static int i2c_pxa_probe(struct platform_device *dev) i2c->adap.name); } -clk_prepare_enable (i2c->clk); + ret =clk_prepare_enable (i2c->clk); +if (ret) +return dev_err_probe (&dev->dev, ret, +"failed to enable clock\n" );if (i2c->use_pio) { i2c->adap.algo = &i2c_pxa_pio_algorithm;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 72/486 btrfs: make btrfs_discard_workfn() block_group ref explicit
In reply to Sasha LevinFrom: Boris Burkov <[email protected]>
[ Upstream commit 895c6721d310c036dcfebb5ab845822229fa35eb ]
Currently, the async discard machinery owns a ref to the block_group when the block_group is queued on a discard list. However, to handle races with discard cancellation and the discard workfn, we have a specific logic to detect that the block_group is *currently* running in the workfn, to protect the workfn's usage amidst cancellation.
As far as I can tell, this doesn't have any overt bugs (though finish_discard_pass() and remove_from_discard_list() racing can have a surprising outcome for the caller of remove_from_discard_list() in that it is again added at the end).
But it is needlessly complicated to rely on locking and the nullity of discard_ctl->block_group. Simplify this significantly by just taking a refcount while we are in the workfn and unconditionally drop it in both the remove and workfn paths, regardless of if they race.
--- fs/btrfs/discard.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-)
fs/btrfs/discard.c +16 -18
@@ -167,13 +167,7 @@ static bool remove_from_discard_list(struct btrfs_discard_ctl *discard_ctl, block_group->discard_eligible_time =0 ; queued = !list_empty (&block_group->discard_list);list_del_init (&block_group->discard_list); -/* -* If the block group is currently running in the discard workfn, we -* don't want to deref it, since it's still being used by the workfn. -* The workfn will notice this case and deref the block group when it is -* finished. -*/ -if (queued && !running) +if (queued)btrfs_put_block_group (block_group);spin_unlock (&discard_ctl->lock);
@@ -260,9 +254,10 @@ static struct btrfs_block_group *peek_discard_list( block_group->discard_cursor = block_group->start; block_group->discard_state =BTRFS_DISCARD_EXTENTS ; } - discard_ctl->block_group = block_group; }if (block_group) { +btrfs_get_block_group (block_group); + discard_ctl->block_group = block_group; *discard_state = block_group->discard_state; *discard_index = block_group->discard_index; }
@@ -493,9 +488,20 @@ static void btrfs_discard_workfn(struct work_struct *work) block_group =peek_discard_list (discard_ctl, &discard_state, &discard_index, now); -if (!block_group || !btrfs_run_discard_work (discard_ctl)) +if (!block_group)return ; +if (!btrfs_run_discard_work (discard_ctl)) { +spin_lock (&discard_ctl->lock); +btrfs_put_block_group (block_group); + discard_ctl->block_group =NULL ; +spin_unlock (&discard_ctl->lock); +return ; + }if (now < block_group->discard_eligible_time) { +spin_lock (&discard_ctl->lock); +btrfs_put_block_group (block_group); + discard_ctl->block_group =NULL ; +spin_unlock (&discard_ctl->lock);btrfs_discard_schedule_work (discard_ctl, false);return ; }
@@ -547,15 +553,7 @@ static void btrfs_discard_workfn(struct work_struct *work)spin_lock (&discard_ctl->lock); discard_ctl->prev_discard = trimmed; discard_ctl->prev_discard_time = now; -/* -* If the block group was removed from the discard list while it was -* running in this workfn, then we didn't deref it, since this function -* still owned that reference. But we set the discard_ctl->block_group -* back to NULL, so we can use that condition to know that now we need -* to deref the block_group. -*/ -if (discard_ctl->block_group ==NULL ) -btrfs_put_block_group (block_group); +btrfs_put_block_group (block_group); discard_ctl->block_group =NULL ;__btrfs_discard_schedule_work (discard_ctl, now, false);spin_unlock (&discard_ctl->lock);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 73/486 btrfs: avoid linker error in btrfs_find_create_tree_block()
In reply to Sasha LevinFrom: Mark Harmstone <[email protected]>
[ Upstream commit 7ef3cbf17d2734ca66c4ed8573be45f4e461e7ee ]
The inline function btrfs_is_testing() is hardcoded to return 0 if CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set. Currently we're relying on the compiler optimizing out the call to alloc_test_extent_buffer() in btrfs_find_create_tree_block(), as it's not been defined (it's behind an
#ifdef).
Add a stub version of alloc_test_extent_buffer() to avoid linker errors on non-standard optimization levels. This problem was seen on GCC 14 with -O0 and is helps to see symbols that would be otherwise optimized out.
--- fs/btrfs/extent_io.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/btrfs/extent_io.c +5 -2
@@ -2826,10 +2826,10 @@ struct extent_buffer *find_extent_buffer(struct btrfs_fs_info *fs_info,return eb; } -#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS struct extent_buffer *alloc_test_extent_buffer (struct btrfs_fs_info *fs_info,u64 start) { +#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS struct extent_buffer *eb, *exists =NULL ;int ret;
@@ -2865,8 +2865,11 @@ struct extent_buffer *alloc_test_extent_buffer(struct btrfs_fs_info *fs_info, free_eb:btrfs_release_extent_buffer (eb);return exists; -} +#else +/* Stub to avoid linker error when compiled with optimizations turned off. */ +return NULL ;#endif +}static struct extent_buffer *grab_extent_buffer (struct btrfs_fs_info *fs_info,struct page *page)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 74/486 btrfs: run btrfs_error_commit_super() early
In reply to Sasha LevinFrom: Qu Wenruo <[email protected]>
[ Upstream commit df94a342efb451deb0e32b495d1d6cd4bb3a1648 ]
[BUG]
Even after all the error fixes related the "ASSERT(list_empty(&fs_info->delayed_iputs));" in close_ctree(), I can still hit it reliably with my experimental 2K block size.
[CAUSE]
In my case, all the error is triggered after the fs is already in error status.
I find the following call trace to be the cause of race:
Main thread | endio_write_workers
---------------------------------------------+---------------------------
close_ctree() | |- btrfs_error_commit_super() | | |- btrfs_cleanup_transaction() | | | |- btrfs_destroy_all_ordered_extents() | | | |- btrfs_wait_ordered_roots() | | |- btrfs_run_delayed_iputs() | | | btrfs_finish_ordered_io() | | |- btrfs_put_ordered_extent() | | |- btrfs_add_delayed_iput() |- ASSERT(list_empty(delayed_iputs)) |
!!! Triggered !!!
The root cause is that, btrfs_wait_ordered_roots() only wait for ordered extents to finish their IOs, not to wait for them to finish and removed.
[FIX]
Since btrfs_error_commit_super() will flush and wait for all ordered extents, it should be executed early, before we start flushing the workqueues.
And since btrfs_error_commit_super() now runs early, there is no need to run btrfs_run_delayed_iputs() inside it, so just remove the btrfs_run_delayed_iputs() call from btrfs_error_commit_super().
--- fs/btrfs/disk-io.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
fs/btrfs/disk-io.c +8 -7
@@ -4254,6 +4254,14 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info)/* clear out the rbtree of defraggable inodes */ btrfs_cleanup_defrag_inodes (fs_info); +/* +* Handle the error fs first, as it will flush and wait for all ordered +* extents. This will generate delayed iputs, thus we want to handle +* it first. +*/ +if (unlikely (BTRFS_FS_ERROR (fs_info))) +btrfs_error_commit_super (fs_info); +/* * Wait for any fixup workers to complete. * If we don't wait for them here and they are still running by the time
@@ -4343,9 +4351,6 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info)btrfs_err (fs_info,"commit super ret %d" , ret); } -if (BTRFS_FS_ERROR (fs_info)) -btrfs_error_commit_super (fs_info); -kthread_stop (fs_info->transaction_kthread);kthread_stop (fs_info->cleaner_kthread);
@@ -4468,10 +4473,6 @@ static void btrfs_error_commit_super(struct btrfs_fs_info *fs_info)/* cleanup FS via transaction */ btrfs_cleanup_transaction (fs_info); -mutex_lock (&fs_info->cleaner_mutex); -btrfs_run_delayed_iputs (fs_info); -mutex_unlock (&fs_info->cleaner_mutex); -down_write (&fs_info->cleanup_work_sem);up_write (&fs_info->cleanup_work_sem); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 75/486 btrfs: fix non-empty delayed iputs list on unmount due to async workers
In reply to Sasha LevinFrom: Filipe Manana <[email protected]>
[ Upstream commit cda76788f8b0f7de3171100e3164ec1ce702292e ]
At close_ctree() after we have ran delayed iputs either explicitly through calling btrfs_run_delayed_iputs() or later during the call to btrfs_commit_super() or btrfs_error_commit_super(), we assert that the delayed iputs list is empty.
We have (another) race where this assertion might fail because we have queued an async write into the fs_info->workers workqueue. Here's how it happens:
1) We are submitting a data bio for an inode that is not the data relocation inode, so we call btrfs_wq_submit_bio();
2) btrfs_wq_submit_bio() submits a work for the fs_info->workers queue that will run run_one_async_done();
3) We enter close_ctree(), flush several work queues except fs_info->workers, explicitly run delayed iputs with a call to btrfs_run_delayed_iputs() and then again shortly after by calling btrfs_commit_super() or btrfs_error_commit_super(), which also run delayed iputs;
4) run_one_async_done() is executed in the work queue, and because there was an IO error (bio->bi_status is not 0) it calls btrfs_bio_end_io(), which drops the final reference on the associated ordered extent by calling btrfs_put_ordered_extent() - and that adds a delayed iput for the inode;
5) At close_ctree() we find that after stopping the cleaner and transaction kthreads the delayed iputs list is not empty, failing the following assertion:
ASSERT(list_empty(&fs_info->delayed_iputs));
Fix this by flushing the fs_info->workers workqueue before running delayed iputs at close_ctree().
David reported this when running generic/648, which exercises IO error paths by using the DM error table.
--- fs/btrfs/disk-io.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
fs/btrfs/disk-io.c +13 -0
@@ -4282,6 +4282,19 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info)*/ btrfs_flush_workqueue (fs_info->delalloc_workers); +/* +* We can have ordered extents getting their last reference dropped from +* the fs_info->workers queue because for async writes for data bios we +* queue a work for that queue, at btrfs_wq_submit_bio(), that runs +* run_one_async_done() which calls btrfs_bio_end_io() in case the bio +* has an error, and that later function can do the final +* btrfs_put_ordered_extent() on the ordered extent attached to the bio, +* which adds a delayed iput for the inode. So we must flush the queue +* so that we don't have delayed iputs after committing the current +* transaction below and stopping the cleaner and transaction kthreads. +*/ +btrfs_flush_workqueue (fs_info->workers); +/* * When finishing a compressed write bio we schedule a work queue item * to finish an ordered extent - btrfs_finish_compressed_write_work()
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 76/486 btrfs: properly limit inline data extent according to block size
In reply to Sasha LevinFrom: Qu Wenruo <[email protected]>
[ Upstream commit 23019d3e6617a8ec99a8d2f5947aa3dd8a74a1b8 ]
Btrfs utilizes inline data extent for the following cases:
- Regular small files
- Symlinks
And "btrfs check" detects any file extents that are too large as an error.
It's not a problem for 4K block size, but for the incoming smaller block sizes (2K), it can cause problems due to bad limits:
- Non-compressed inline data extents
We do not allow a non-compressed inline data extent to be as large as block size.
- Symlinks
Currently the only real limit on symlinks are 4K, which can be larger than 2K block size.
These will result btrfs-check to report too large file extents.
Fix it by adding proper size checks for the above cases.
--- fs/btrfs/inode.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
fs/btrfs/inode.c +10 -1
@@ -623,6 +623,10 @@ static bool can_cow_file_range_inline(struct btrfs_inode *inode,if (size > fs_info->sectorsize)return false; +/* We do not allow a non-compressed extent to be as large as block size. */ +if (data_len >= fs_info->sectorsize) +return false; +/* We cannot exceed the maximum inline data size. */ if (data_len >BTRFS_MAX_INLINE_DATA_SIZE (fs_info))return false;
@@ -8683,7 +8687,12 @@ static int btrfs_symlink(struct mnt_idmap *idmap, struct inode *dir,struct extent_buffer *leaf; name_len =strlen (symname); -if (name_len >BTRFS_MAX_INLINE_DATA_SIZE (fs_info)) +/* +* Symlinks utilize uncompressed inline extent data, which should not +* reach block size. +*/ +if (name_len >BTRFS_MAX_INLINE_DATA_SIZE (fs_info) || + name_len >= fs_info->sectorsize)return -ENAMETOOLONG ; inode =new_inode (dir->i_sb);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 77/486 btrfs: prevent inline data extents read from touching blocks beyond its range
In reply to Sasha LevinFrom: Qu Wenruo <[email protected]>
[ Upstream commit 1a5b5668d711d3d1ef447446beab920826decec3 ]
Currently reading an inline data extent will zero out the remaining range in the page.
This is not yet causing problems even for block size < page size (subpage) cases because:
1) An inline data extent always starts at file offset 0 Meaning at page read, we always read the inline extent first, before any other blocks in the page. Then later blocks are properly read out and re-fill the zeroed out ranges.
2) Currently btrfs will read out the whole page if a buffered write is not page aligned
So a page is either fully uptodate at buffered write time (covers the whole page), or we will read out the whole page first. Meaning there is nothing to lose for such an inline extent read.
But it's still not ideal:
- We're zeroing out the page twice
Once done by read_inline_extent()/uncompress_inline(), once done by btrfs_do_readpage() for ranges beyond i_size.
- We're touching blocks that don't belong to the inline extent In the incoming patches, we can have a partial uptodate folio, of which some dirty blocks can exist while the page is not fully uptodate:
The page size is 16K and block size is 4K:
0 4K 8K 12K 16K | | |/////////| |
And range [8K, 12K) is dirtied by a buffered write, the remaining blocks are not uptodate.
If range [0, 4K) contains an inline data extent, and we try to read the whole page, the current behavior will overwrite range [8K, 12K) with zero and cause data loss.
So to make the behavior more consistent and in preparation for future changes, limit the inline data extents read to only zero out the range inside the first block, not the whole page.
--- fs/btrfs/inode.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
fs/btrfs/inode.c +8 -6
@@ -6817,6 +6817,7 @@ static noinline int uncompress_inline(struct btrfs_path *path, {int ret;struct extent_buffer *leaf = path->nodes[0 ]; +const u32 blocksize = leaf->fs_info->sectorsize;char *tmp;size_t max_size;unsigned long inline_size;
@@ -6833,7 +6834,7 @@ static noinline int uncompress_inline(struct btrfs_path *path,read_extent_buffer (leaf, tmp, ptr, inline_size); - max_size = min_t(unsigned long, PAGE_SIZE, max_size); + max_size = min_t(unsigned long, blocksize, max_size); ret =btrfs_decompress (compress_type, tmp, folio,0 , inline_size, max_size);
@@ -6845,8 +6846,8 @@ static noinline int uncompress_inline(struct btrfs_path *path,* cover that region here. */ -if (max_size <PAGE_SIZE ) -folio_zero_range (folio, max_size,PAGE_SIZE - max_size); +if (max_size < blocksize) +folio_zero_range (folio, max_size, blocksize - max_size);kfree (tmp);return ret; }
@@ -6854,6 +6855,7 @@ static noinline int uncompress_inline(struct btrfs_path *path,static int read_inline_extent (struct btrfs_inode *inode,struct btrfs_path *path,struct folio *folio) { +const u32 blocksize = path->nodes[0 ]->fs_info->sectorsize;struct btrfs_file_extent_item *fi;void *kaddr;size_t copy_size;
@@ -6868,14 +6870,14 @@ static int read_inline_extent(struct btrfs_inode *inode, struct btrfs_path *pathif (btrfs_file_extent_compression (path->nodes[0 ], fi) !=BTRFS_COMPRESS_NONE )return uncompress_inline (path, folio, fi); - copy_size =min_t (u64,PAGE_SIZE , + copy_size =min_t (u64, blocksize,btrfs_file_extent_ram_bytes (path->nodes[0 ], fi)); kaddr =kmap_local_folio (folio,0 );read_extent_buffer (path->nodes[0 ], kaddr,btrfs_file_extent_inline_start (fi), copy_size);kunmap_local (kaddr); -if (copy_size <PAGE_SIZE ) -folio_zero_range (folio, copy_size,PAGE_SIZE - copy_size); +if (copy_size < blocksize) +folio_zero_range (folio, copy_size, blocksize - copy_size);return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 78/486 btrfs: get zone unusable bytes while holding lock at btrfs_reclaim_bgs_work()
In reply to Sasha LevinFrom: Filipe Manana <[email protected]>
[ Upstream commit 1283b8c125a83bf7a7dbe90c33d3472b6d7bf612 ]
At btrfs_reclaim_bgs_work(), we are grabbing a block group's zone unusable bytes while not under the protection of the block group's spinlock, so this can trigger race reports from KCSAN (or similar tools) since that field is typically updated while holding the lock, such as at __btrfs_add_free_space_zoned() for example.
Fix this by grabbing the zone unusable bytes while we are still in the critical section holding the block group's spinlock, which is right above where we are currently grabbing it.
--- fs/btrfs/block-group.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
fs/btrfs/block-group.c +11 -7
@@ -1891,6 +1891,17 @@ void btrfs_reclaim_bgs_work(struct work_struct *work)up_write (&space_info->groups_sem); goto next; } + +/* +* Cache the zone_unusable value before turning the block group +* to read only. As soon as the block group is read only it's +* zone_unusable value gets moved to the block group's read-only +* bytes and isn't available for calculations anymore. We also +* cache it before unlocking the block group, to prevent races +* (reports from KCSAN and such tools) with tasks updating it. +*/ + zone_unusable = bg->zone_unusable; +spin_unlock (&bg->lock);spin_unlock (&space_info->lock);
@@ -1907,13 +1918,6 @@ void btrfs_reclaim_bgs_work(struct work_struct *work) goto next; } -/* -* Cache the zone_unusable value before turning the block group -* to read only. As soon as the blog group is read only it's -* zone_unusable value gets moved to the block group's read-only -* bytes and isn't available for calculations anymore. -*/ - zone_unusable = bg->zone_unusable; ret =inc_block_group_ro (bg,0 );up_write (&space_info->groups_sem);if (ret <0 )
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 79/486 btrfs: send: return -ENAMETOOLONG when attempting a path that is too long
In reply to Sasha LevinFrom: Filipe Manana <[email protected]>
[ Upstream commit a77749b3e21813566cea050bbb3414ae74562eba ]
When attempting to build a too long path we are currently returning -ENOMEM, which is very odd and misleading. So update fs_path_ensure_buf() to return -ENAMETOOLONG instead. Also, while at it, move the WARN_ON() into the if statement's expression, as it makes it clear what is being tested and also has the effect of adding 'unlikely' to the statement, which allows the compiler to generate better code as this condition is never expected to happen.
--- fs/btrfs/send.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
fs/btrfs/send.c +2 -4
@@ -487,10 +487,8 @@ static int fs_path_ensure_buf(struct fs_path *p, int len)if (p->buf_len >= len)return 0 ; -if (len >PATH_MAX ) { -WARN_ON (1 ); -return -ENOMEM ; - } +if (WARN_ON (len >PATH_MAX )) +return -ENAMETOOLONG ; path_len = p->end - p->start; old_buf_len = p->buf_len;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 80/486 btrfs: zoned: exit btrfs_can_activate_zone if BTRFS_FS_NEED_ZONE_FINISH is set
In reply to Sasha LevinFrom: Johannes Thumshirn <[email protected]>
[ Upstream commit 26b38e28162ef4ceb1e0482299820fbbd7dbcd92 ]
If BTRFS_FS_NEED_ZONE_FINISH is already set for the whole filesystem, exit early in btrfs_can_activate_zone(). There's no need to check if BTRFS_FS_NEED_ZONE_FINISH needs to be set if it is already set.
--- fs/btrfs/zoned.c | 3 +++ 1 file changed, 3 insertions(+)
fs/btrfs/zoned.c +3 -0
@@ -2326,6 +2326,9 @@ bool btrfs_can_activate_zone(struct btrfs_fs_devices *fs_devices, u64 flags)if (!btrfs_is_zoned (fs_info))return true; +if (test_bit (BTRFS_FS_NEED_ZONE_FINISH , &fs_info->flags)) +return false; +/* Check if there is a device with active zones left */ mutex_lock (&fs_info->chunk_mutex);spin_lock (&fs_info->zone_active_bgs_lock);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 81/486 blk-cgroup: improve policy registration error handling
In reply to Sasha LevinFrom: Chen Linxuan <[email protected]>
[ Upstream commit e1a0202c6bfda24002a3ae2115154fa90104c649 ]
This patch improve the returned error code of blkcg_policy_register().
1. Move the validation check for cpd/pd_alloc_fn and cpd/pd_free_fn function pairs to the start of blkcg_policy_register(). This ensures we immediately return -EINVAL if the function pairs are not correctly provided, rather than returning -ENOSPC after locking and unlocking mutexes unnecessarily.
Those locks should not contention any problems, as error of policy registration is a super cold path.
2. Return -ENOMEM when cpd_alloc_fn() failed.
--- block/blk-cgroup.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
block/blk-cgroup.c +12 -10
@@ -1725,27 +1725,27 @@ int blkcg_policy_register(struct blkcg_policy *pol)struct blkcg *blkcg;int i, ret; +/* +* Make sure cpd/pd_alloc_fn and cpd/pd_free_fn in pairs, and policy +* without pd_alloc_fn/pd_free_fn can't be activated. +*/ +if ((!pol->cpd_alloc_fn ^ !pol->cpd_free_fn) || + (!pol->pd_alloc_fn ^ !pol->pd_free_fn)) +return -EINVAL ; +mutex_lock (&blkcg_pol_register_mutex);mutex_lock (&blkcg_pol_mutex);/* find an empty slot */ - ret = -ENOSPC ;for (i =0 ; i <BLKCG_MAX_POLS ; i++)if (!blkcg_policy[i])break ;if (i >=BLKCG_MAX_POLS ) {pr_warn ("blkcg_policy_register: BLKCG_MAX_POLS too small\n" ); + ret = -ENOSPC ; goto err_unlock; } -/* -* Make sure cpd/pd_alloc_fn and cpd/pd_free_fn in pairs, and policy -* without pd_alloc_fn/pd_free_fn can't be activated. -*/ -if ((!pol->cpd_alloc_fn ^ !pol->cpd_free_fn) || - (!pol->pd_alloc_fn ^ !pol->pd_free_fn)) - goto err_unlock; -/* register @pol */ pol->plid = i; blkcg_policy[pol->plid] = pol;
@@ -1756,8 +1756,10 @@ int blkcg_policy_register(struct blkcg_policy *pol)struct blkcg_policy_data *cpd; cpd = pol->cpd_alloc_fn (GFP_KERNEL ); -if (!cpd) +if (!cpd) { + ret = -ENOMEM ; goto err_free_cpds; + } blkcg->cpd[pol->plid] = cpd; cpd->blkcg = blkcg;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 82/486 drm/amdgpu: release xcp_mgr on exit
In reply to Sasha LevinFrom: Flora Cui <[email protected]>
[ Upstream commit b5aaa82e2b12feaaa6958f7fa0917ddcc03c24ee ]
Free on driver cleanup.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -0
@@ -4668,6 +4668,9 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev)kfree (adev->fru_info); adev->fru_info =NULL ; +kfree (adev->xcp_mgr); + adev->xcp_mgr =NULL ; + px =amdgpu_device_supports_px (adev_to_drm (adev)); if (px || (!dev_is_removable(&adev->pdev->dev) &&
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 83/486 drm/amd/display: Guard against setting dispclk low for dcn31x
In reply to Sasha LevinFrom: Jing Zhou <[email protected]>
[ Upstream commit 9c2f4ae64bb6f6d83a54d88b9ee0f369cdbb9fa8 ]
[WHY]
We should never apply a minimum dispclk value while in prepare_bandwidth or while displays are active. This is always an optimizaiton for when all displays are disabled.
[HOW]
Defer dispclk optimization until safe_to_lower = true and display_count reaches 0.
Since 0 has a special value in this logic (ie. no dispclk required) we also need adjust the logic that clamps it for the actual request to PMFW.
--- .../dc/clk_mgr/dcn315/dcn315_clk_mgr.c | 20 +++++++++++-------- .../dc/clk_mgr/dcn316/dcn316_clk_mgr.c | 13 +++++++++--- 2 files changed, 22 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c +12 -8
@@ -130,7 +130,7 @@ static void dcn315_update_clocks(struct clk_mgr *clk_mgr_base,struct clk_mgr_internal *clk_mgr =TO_CLK_MGR_INTERNAL (clk_mgr_base);struct dc_clocks *new_clocks = &context->bw_ctx.bw.dcn.clk;struct dc *dc = clk_mgr_base->ctx->dc; -int display_count; +int display_count =0 ;bool update_dppclk = false;bool update_dispclk = false;bool dpp_clock_lowered = false;
@@ -204,15 +204,19 @@ static void dcn315_update_clocks(struct clk_mgr *clk_mgr_base, update_dppclk = true; } -if (should_set_clock (safe_to_lower, new_clocks->dispclk_khz, clk_mgr_base->clks.dispclk_khz)) { -/* No need to apply the w/a if we haven't taken over from bios yet */ -if (clk_mgr_base->clks.dispclk_khz) -dcn315_disable_otg_wa (clk_mgr_base, context, true); +if (should_set_clock (safe_to_lower, new_clocks->dispclk_khz, clk_mgr_base->clks.dispclk_khz) && + (new_clocks->dispclk_khz >0 || (safe_to_lower && display_count ==0 ))) { +int requested_dispclk_khz = new_clocks->dispclk_khz; +dcn315_disable_otg_wa (clk_mgr_base, context, true); + +/* Clamp the requested clock to PMFW based on their limit. */ +if (dc->debug.min_disp_clk_khz >0 && requested_dispclk_khz < dc->debug.min_disp_clk_khz) + requested_dispclk_khz = dc->debug.min_disp_clk_khz; + +dcn315_smu_set_dispclk (clk_mgr, requested_dispclk_khz); clk_mgr_base->clks.dispclk_khz = new_clocks->dispclk_khz; -dcn315_smu_set_dispclk (clk_mgr, clk_mgr_base->clks.dispclk_khz); -if (clk_mgr_base->clks.dispclk_khz) -dcn315_disable_otg_wa (clk_mgr_base, context, false); +dcn315_disable_otg_wa (clk_mgr_base, context, false); update_dispclk = true; }
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_clk_mgr.c +10 -3
@@ -140,7 +140,7 @@ static void dcn316_update_clocks(struct clk_mgr *clk_mgr_base,struct clk_mgr_internal *clk_mgr =TO_CLK_MGR_INTERNAL (clk_mgr_base);struct dc_clocks *new_clocks = &context->bw_ctx.bw.dcn.clk;struct dc *dc = clk_mgr_base->ctx->dc; -int display_count; +int display_count =0 ;bool update_dppclk = false;bool update_dispclk = false;bool dpp_clock_lowered = false;
@@ -211,11 +211,18 @@ static void dcn316_update_clocks(struct clk_mgr *clk_mgr_base, update_dppclk = true; } -if (should_set_clock (safe_to_lower, new_clocks->dispclk_khz, clk_mgr_base->clks.dispclk_khz)) { +if (should_set_clock (safe_to_lower, new_clocks->dispclk_khz, clk_mgr_base->clks.dispclk_khz) && + (new_clocks->dispclk_khz >0 || (safe_to_lower && display_count ==0 ))) { +int requested_dispclk_khz = new_clocks->dispclk_khz; +dcn316_disable_otg_wa (clk_mgr_base, context, safe_to_lower, true); +/* Clamp the requested clock to PMFW based on their limit. */ +if (dc->debug.min_disp_clk_khz >0 && requested_dispclk_khz < dc->debug.min_disp_clk_khz) + requested_dispclk_khz = dc->debug.min_disp_clk_khz; + +dcn316_smu_set_dispclk (clk_mgr, requested_dispclk_khz); clk_mgr_base->clks.dispclk_khz = new_clocks->dispclk_khz; -dcn316_smu_set_dispclk (clk_mgr, clk_mgr_base->clks.dispclk_khz);dcn316_disable_otg_wa (clk_mgr_base, context, safe_to_lower, false); update_dispclk = true;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 84/486 drm/amdgpu: adjust drm_firmware_drivers_only() handling
In reply to Sasha LevinFrom: Alex Deucher <[email protected]>
[ Upstream commit e00e5c223878a60e391e5422d173c3382d378f87 ]
Move to probe so we can check the PCI device type and only apply the drm_firmware_drivers_only() check for PCI DISPLAY classes. Also add a module parameter to override the nomodeset kernel parameter as a workaround for platforms that have this hardcoded on their kernel command lines.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +14 -0
@@ -172,6 +172,7 @@ uint amdgpu_sdma_phase_quantum = 32;char *amdgpu_disable_cu;char *amdgpu_virtual_display;bool enforce_isolation; +int amdgpu_modeset =-1 ;/* Specifies the default granularity for SVM, used in buffer * migration and restoration of backing memory when handling
@@ -1037,6 +1038,13 @@ module_param_named(user_partt_mode, amdgpu_user_partt_mode, uint, 0444);module_param (enforce_isolation, bool,0444 );MODULE_PARM_DESC (enforce_isolation,"enforce process isolation between graphics and compute . enforce_isolation = on" ); +/** +* DOC: modeset (int) +* Override nomodeset (1 = override, -1 = auto). The default is -1 (auto). +*/ +MODULE_PARM_DESC (modeset,"Override nomodeset (1 = enable, -1 = auto)" ); +module_param_named (modeset, amdgpu_modeset, int,0444 ); +/** * DOC: seamless (int) * Seamless boot will keep the image on the screen during the boot process.
@@ -2248,6 +2256,12 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,int ret, retry =0 , i;bool supports_atomic = false; +if ((pdev->class >>8 ) ==PCI_CLASS_DISPLAY_VGA || + (pdev->class >>8 ) ==PCI_CLASS_DISPLAY_OTHER ) { +if (drm_firmware_drivers_only () && amdgpu_modeset ==-1 ) +return -EINVAL ; + } +/* skip devices which are owned by radeon */ for (i =0 ; i <ARRAY_SIZE (amdgpu_unsupported_pciidlist); i++) {if (amdgpu_unsupported_pciidlist[i] == pdev->device)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 85/486 i3c: master: svc: Fix missing STOP for master request
In reply to Sasha LevinFrom: Stanley Chu <[email protected]>
[ Upstream commit 0430bf9bc1ac068c8b8c540eb93e5751872efc51 ]
The controller driver nacked the master request but didn't emit a STOP to end the transaction. The driver shall refuse the unsupported requests and return the controller state to IDLE by emitting a STOP.
--- drivers/i3c/master/svc-i3c-master.c | 1 + 1 file changed, 1 insertion(+)
drivers/i3c/master/svc-i3c-master.c +1 -0
@@ -511,6 +511,7 @@ static void svc_i3c_master_ibi_work(struct work_struct *work)queue_work (master->base.wq, &master->hj_work);break ;case SVC_I3C_MSTATUS_IBITYPE_MASTER_REQUEST : +svc_i3c_master_emit_stop (master);default :break ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 86/486 s390/tlb: Use mm_has_pgste() instead of mm_alloc_pgste()
In reply to Sasha LevinFrom: Heiko Carstens <[email protected]>
[ Upstream commit 9291ea091b29bb3e37c4b3416c7c1e49e472c7d5 ]
An mm has pgstes only after s390_enable_sie() has been called, while mm_alloc_pgste() may be always true (e.g. via sysctl setting).
Limit the calls to gmap_unlink() in pte_free_tlb() to those cases where there might be something to unlink.
--- arch/s390/include/asm/tlb.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/include/asm/tlb.h +1 -1
@@ -85,7 +85,7 @@ static inline void pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, tlb->mm->context.flush_mm =1 ; tlb->freed_tables =1 ; tlb->cleared_pmds =1 ; -if (mm_alloc_pgste (tlb->mm)) +if (mm_has_pgste (tlb->mm))gmap_unlink (tlb->mm, (unsigned long *)pte, address);tlb_remove_ptdesc (tlb, pte); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 87/486 dlm: make tcp still work in multi-link env
In reply to Sasha LevinFrom: Heming Zhao <[email protected]>
[ Upstream commit 03d2b62208a336a3bb984b9465ef6d89a046ea22 ]
This patch bypasses multi-link errors in TCP mode, allowing dlm to operate on the first tcp link.
--- fs/dlm/lowcomms.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/dlm/lowcomms.c +2 -2
@@ -1826,8 +1826,8 @@ static int dlm_tcp_listen_validate(void) {/* We don't support multi-homed hosts */ if (dlm_local_count >1 ) { -log_print ("TCP protocol can't handle multi-homed hosts, try SCTP" ); -return -EINVAL ; +log_print ("Detect multi-homed hosts but use only the first IP address." ); +log_print ("Try SCTP, if you want to enable multi-link." ); }return 0 ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 88/486 clocksource/drivers/timer-riscv: Stop stimecmp when cpu hotplug
In reply to Sasha LevinFrom: Nick Hu <[email protected]>
[ Upstream commit 70c93b026ed07078e933583591aa9ca6701cd9da ]
Stop the timer when the cpu is going to be offline otherwise the timer interrupt may be pending while performing power-down.
--- drivers/clocksource/timer-riscv.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/clocksource/timer-riscv.c +6 -0
@@ -126,7 +126,13 @@ static int riscv_timer_starting_cpu(unsigned int cpu)static int riscv_timer_dying_cpu (unsigned int cpu) { +/* +* Stop the timer when the cpu is going to be offline otherwise +* the timer interrupt may be pending while performing power-down. +*/ +riscv_clock_event_stop ();disable_percpu_irq (riscv_clock_event_irq); +return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 89/486 um: Store full CSGSFS and SS register from mcontext
In reply to Sasha LevinFrom: Benjamin Berg <[email protected]>
[ Upstream commit cef721e0d53d2b64f2ba177c63a0dfdd7c0daf17 ]
Doing this allows using registers as retrieved from an mcontext to be pushed to a process using PTRACE_SETREGS.
It is not entirely clear to me why CSGSFS was masked. Doing so creates issues when using the mcontext as process state in seccomp and simply copying the register appears to work perfectly fine for ptrace.
--- arch/x86/um/os-Linux/mcontext.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/um/os-Linux/mcontext.c +1 -2
@@ -27,7 +27,6 @@ void get_regs_from_mc(struct uml_pt_regs *regs, mcontext_t *mc)COPY (RIP );COPY2 (EFLAGS ,EFL );COPY2 (CS ,CSGSFS ); - regs->gp[CS /sizeof (unsigned long )] &=0xffff ; - regs->gp[CS /sizeof (unsigned long )] |=3 ; + regs->gp[SS /sizeof (unsigned long )] = mc->gregs[REG_CSGSFS ] >>48 ;#endif }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 90/486 um: Update min_low_pfn to match changes in uml_reserved
In reply to Sasha LevinFrom: Tiwei Bie <[email protected]>
[ Upstream commit e82cf3051e6193f61e03898f8dba035199064d36 ]
When uml_reserved is updated, min_low_pfn must also be updated accordingly. Otherwise, min_low_pfn will not accurately reflect the lowest available PFN.
--- arch/um/kernel/mem.c | 1 + 1 file changed, 1 insertion(+)
arch/um/kernel/mem.c +1 -0
@@ -70,6 +70,7 @@ void __init mem_init(void)map_memory (brk_end,__pa (brk_end), uml_reserved - brk_end,1 ,1 ,0 );memblock_free ((void *)brk_end, uml_reserved - brk_end); uml_reserved = brk_end; + min_low_pfn =PFN_UP (__pa (uml_reserved));/* this will put all low memory onto the freelists */ memblock_free_all ();
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 91/486 wifi: mwifiex: Fix HT40 bandwidth issue.
In reply to Sasha LevinFrom: Jeff Chen <[email protected]>
[ Upstream commit 4fcfcbe457349267fe048524078e8970807c1a5b ]
This patch addresses an issue where, despite the AP supporting 40MHz bandwidth, the connection was limited to 20MHz. Without this fix, even if the access point supports 40MHz, the bandwidth after connection remains at 20MHz. This issue is not a regression.
--- drivers/net/wireless/marvell/mwifiex/11n.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/wireless/marvell/mwifiex/11n.c +4 -2
@@ -403,12 +403,14 @@ mwifiex_cmd_append_11n_tlv(struct mwifiex_private *priv,if (sband->ht_cap.cap &IEEE80211_HT_CAP_SUP_WIDTH_20_40 && bss_desc->bcn_ht_oper->ht_param & -IEEE80211_HT_PARAM_CHAN_WIDTH_ANY ) +IEEE80211_HT_PARAM_CHAN_WIDTH_ANY ) { + chan_list->chan_scan_param[0 ].radio_type |= +CHAN_BW_40MHZ <<2 ;SET_SECONDARYCHAN (chan_list->chan_scan_param[0 ]. radio_type, (bss_desc->bcn_ht_oper->ht_param &IEEE80211_HT_PARAM_CHA_SEC_OFFSET )); - + } *buffer +=struct_size (chan_list, chan_scan_param,1 ); ret_len +=struct_size (chan_list, chan_scan_param,1 ); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 92/486 bnxt_en: Query FW parameters when the CAPS_CHANGE bit is set
In reply to Sasha LevinFrom: shantiprasad shettar <[email protected]>
[ Upstream commit a6c81e32aeacbfd530d576fa401edd506ec966ef ]
Newer FW can set the CAPS_CHANGE flag during ifup if some capabilities or configurations have changed. For example, the CoS queue configurations may have changed. Support this new flag by treating it almost like FW reset. The driver will essentially rediscover all features and capabilities, reconfigure all backing store context memory, reset everything to default, and reserve all resources.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +6 -2
@@ -11776,6 +11776,7 @@ static int bnxt_hwrm_if_change(struct bnxt *bp, bool up)struct hwrm_func_drv_if_change_input *req;bool fw_reset = !bp->irq_tbl;bool resc_reinit = false; +bool caps_change = false;int rc, retry =0 ;u32 flags =0 ;
@@ -11831,8 +11832,11 @@ static int bnxt_hwrm_if_change(struct bnxt *bp, bool up)set_bit (BNXT_STATE_ABORT_ERR , &bp->state);return -ENODEV ; } -if (resc_reinit || fw_reset) { -if (fw_reset) { +if (flags &FUNC_DRV_IF_CHANGE_RESP_FLAGS_CAPS_CHANGE ) + caps_change = true; + +if (resc_reinit || fw_reset || caps_change) { +if (fw_reset || caps_change) {set_bit (BNXT_STATE_FW_RESET_DET , &bp->state);if (!test_bit (BNXT_STATE_IN_FW_RESET , &bp->state))bnxt_ulp_irq_stop (bp);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 93/486 riscv: Call secondary mmu notifier when flushing the tlb
In reply to Sasha LevinFrom: Alexandre Ghiti <[email protected]>
[ Upstream commit d9be2b9b60497a82aeceec3a98d8b37fdd2960f2 ]
This is required to allow the IOMMU driver to correctly flush its own TLB.
--- arch/riscv/mm/tlbflush.c | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-)
arch/riscv/mm/tlbflush.c +22 -15
@@ -4,6 +4,7 @@#include <linux/smp.h> #include <linux/sched.h> #include <linux/hugetlb.h> +#include <linux/mmu_notifier.h> #include <asm/sbi.h> #include <asm/mmu_context.h>
@@ -78,10 +79,17 @@ static void __ipi_flush_tlb_range_asid(void *info)local_flush_tlb_range_asid (d->start, d->size, d->stride, d->asid); } -static void __flush_tlb_range (const struct cpumask *cmask,unsigned long asid, +static inline unsigned long get_mm_asid (struct mm_struct *mm) +{ +return mm ?cntx2asid (atomic_long_read (&mm->context.id)) :FLUSH_TLB_NO_ASID ; +} + +static void __flush_tlb_range (struct mm_struct *mm, +const struct cpumask *cmask,unsigned long start,unsigned long size,unsigned long stride) { +unsigned long asid =get_mm_asid (mm);unsigned int cpu;if (cpumask_empty (cmask))
@@ -105,30 +113,26 @@ static void __flush_tlb_range(const struct cpumask *cmask, unsigned long asid, }put_cpu (); -} -static inline unsigned long get_mm_asid (struct mm_struct *mm) -{ -return cntx2asid (atomic_long_read (&mm->context.id)); +if (mm) +mmu_notifier_arch_invalidate_secondary_tlbs (mm, start, start + size); }void flush_tlb_mm (struct mm_struct *mm) { -__flush_tlb_range (mm_cpumask (mm),get_mm_asid (mm), -0 ,FLUSH_TLB_MAX_SIZE ,PAGE_SIZE ); +__flush_tlb_range (mm,mm_cpumask (mm),0 ,FLUSH_TLB_MAX_SIZE ,PAGE_SIZE ); }void flush_tlb_mm_range (struct mm_struct *mm,unsigned long start,unsigned long end,unsigned int page_size) { -__flush_tlb_range (mm_cpumask (mm),get_mm_asid (mm), - start, end - start, page_size); +__flush_tlb_range (mm,mm_cpumask (mm), start, end - start, page_size); }void flush_tlb_page (struct vm_area_struct *vma,unsigned long addr) { -__flush_tlb_range (mm_cpumask (vma->vm_mm),get_mm_asid (vma->vm_mm), +__flush_tlb_range (vma->vm_mm,mm_cpumask (vma->vm_mm), addr,PAGE_SIZE ,PAGE_SIZE ); }
@@ -161,13 +165,13 @@ void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, } } -__flush_tlb_range (mm_cpumask (vma->vm_mm),get_mm_asid (vma->vm_mm), +__flush_tlb_range (vma->vm_mm,mm_cpumask (vma->vm_mm), start, end - start, stride_size); }void flush_tlb_kernel_range (unsigned long start,unsigned long end) { -__flush_tlb_range (cpu_online_mask,FLUSH_TLB_NO_ASID , +__flush_tlb_range (NULL , cpu_online_mask, start, end - start,PAGE_SIZE ); }
@@ -175,7 +179,7 @@ void flush_tlb_kernel_range(unsigned long start, unsigned long end)void flush_pmd_tlb_range (struct vm_area_struct *vma,unsigned long start,unsigned long end) { -__flush_tlb_range (mm_cpumask (vma->vm_mm),get_mm_asid (vma->vm_mm), +__flush_tlb_range (vma->vm_mm,mm_cpumask (vma->vm_mm), start, end - start,PMD_SIZE ); }#endif
@@ -189,7 +193,10 @@ void arch_tlbbatch_add_pending(struct arch_tlbflush_unmap_batch *batch, struct mm_struct *mm, unsigned long uaddr) { +unsigned long start = uaddr &PAGE_MASK ; +cpumask_or (&batch->cpumask, &batch->cpumask,mm_cpumask (mm)); +mmu_notifier_arch_invalidate_secondary_tlbs (mm, start, start +PAGE_SIZE ); }void arch_flush_tlb_batched_pending (struct mm_struct *mm)
@@ -199,7 +206,7 @@ void arch_flush_tlb_batched_pending(struct mm_struct *mm)void arch_tlbbatch_flush (struct arch_tlbflush_unmap_batch *batch) { -__flush_tlb_range (&batch->cpumask,FLUSH_TLB_NO_ASID ,0 , -FLUSH_TLB_MAX_SIZE ,PAGE_SIZE ); +__flush_tlb_range (NULL , &batch->cpumask, +0 ,FLUSH_TLB_MAX_SIZE ,PAGE_SIZE );cpumask_clear (&batch->cpumask); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 94/486 ext4: reorder capability check last
In reply to Sasha LevinFrom: Christian Göttsche <[email protected]>
[ Upstream commit 1b419c889c0767a5b66d0a6c566cae491f1cb0f7 ]
capable() calls refer to enabled LSMs whether to permit or deny the request. This is relevant in connection with SELinux, where a capability check results in a policy decision and by default a denial message on insufficient permission is issued.
It can lead to three undesired cases:
1. A denial message is generated, even in case the operation was an unprivileged one and thus the syscall succeeded, creating noise.
2. To avoid the noise from 1. the policy writer adds a rule to ignore those denial messages, hiding future syscalls, where the task performs an actual privileged operation, leading to hidden limited functionality of that task.
3. To avoid the noise from 1. the policy writer adds a rule to permit the task the requested capability, while it does not need it, violating the principle of least privilege.
--- fs/ext4/balloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ext4/balloc.c +2 -2
@@ -649,8 +649,8 @@ static int ext4_has_free_clusters(struct ext4_sb_info *sbi,/* Hm, nope. Are (enough) root reserved clusters available? */ if (uid_eq (sbi->s_resuid,current_fsuid ()) || (!gid_eq (sbi->s_resgid,GLOBAL_ROOT_GID ) &&in_group_p (sbi->s_resgid)) || -capable (CAP_SYS_RESOURCE ) || - (flags &EXT4_MB_USE_ROOT_BLOCKS )) { + (flags &EXT4_MB_USE_ROOT_BLOCKS ) || +capable (CAP_SYS_RESOURCE )) {if (free_clusters >= (nclusters + dirty_clusters + resv_clusters))
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 95/486 hypfs_create_cpu_files(): add missing check for hypfs_mkdir() failure
In reply to Sasha LevinFrom: Al Viro <[email protected]>
[ Upstream commit 00cdfdcfa0806202aea56b02cedbf87ef1e75df8 ]
--- arch/s390/hypfs/hypfs_diag_fs.c | 2 ++ 1 file changed, 2 insertions(+)
arch/s390/hypfs/hypfs_diag_fs.c +2 -0
@@ -208,6 +208,8 @@ static int hypfs_create_cpu_files(struct dentry *cpus_dir, void *cpu_info)snprintf (buffer,TMP_SIZE ,"%d" ,cpu_info__cpu_addr (diag204_get_info_type (), cpu_info)); cpu_dir =hypfs_mkdir (cpus_dir, buffer); +if (IS_ERR (cpu_dir)) +return PTR_ERR (cpu_dir); rc =hypfs_create_u64 (cpu_dir,"mgmtime" ,cpu_info__acc_time (diag204_get_info_type (), cpu_info) -cpu_info__lp_time (diag204_get_info_type (), cpu_info));
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 96/486 scsi: st: Tighten the page format heuristics with MODE SELECT
In reply to Sasha LevinFrom: Kai Mäkisara <[email protected]>
[ Upstream commit 8db816c6f176321e42254badd5c1a8df8bfcfdb4 ]
In the days when SCSI-2 was emerging, some drives did claim SCSI-2 but did not correctly implement it. The st driver first tries MODE SELECT with the page format bit set to set the block descriptor. If not successful, the non-page format is tried.
The test only tests the sense code and this triggers also from illegal parameter in the parameter list. The test is limited to "old" devices and made more strict to remove false alarms.
--- drivers/scsi/st.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/st.c +3 -1
@@ -3081,7 +3081,9 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned lon cmd_in == MTSETDRVBUFFER || cmd_in == SET_DENS_AND_BLK) {if (cmdstatp->sense_hdr.sense_key ==ILLEGAL_REQUEST && - !(STp->use_pf &PF_TESTED )) { + cmdstatp->sense_hdr.asc ==0x24 && + (STp->device)->scsi_level <=SCSI_2 && + !(STp->use_pf &PF_TESTED )) {/* Try the other possible state of Page Format if not already tried */ STp->use_pf = (STp->use_pf ^USE_PF ) |PF_TESTED ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 97/486 scsi: st: ERASE does not change tape location
In reply to Sasha LevinFrom: Kai Mäkisara <[email protected]>
[ Upstream commit ad77cebf97bd42c93ab4e3bffd09f2b905c1959a ]
The SCSI ERASE command erases from the current position onwards. Don't clear the position variables.
--- drivers/scsi/st.c | 1 - 1 file changed, 1 deletion(-)
drivers/scsi/st.c +0 -1
@@ -2894,7 +2894,6 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned lon timeout = STp->long_timeout *8 ;DEBC_printk (STp,"Erasing tape.\n" ); - fileno = blkno = at_sm =0 ;break ;case MTSETBLK :/* Set block length */ case MTSETDENSITY :/* Set tape density */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 98/486 vfio/pci: Handle INTx IRQ_NOTCONNECTED
In reply to Sasha LevinFrom: Alex Williamson <[email protected]>
[ Upstream commit 860be250fc32de9cb24154bf21b4e36f40925707 ]
Some systems report INTx as not routed by setting pdev->irq to IRQ_NOTCONNECTED, resulting in a -ENOTCONN error when trying to setup eventfd signaling. Include this in the set of conditions for which the PIN register is virtualized to zero.
Additionally consolidate vfio_pci_get_irq_count() to use this virtualized value in reporting INTx support via ioctl and sanity checking ioctl paths since pdev->irq is re-used when the device is in MSI mode.
The combination of these results in both the config space of the device and the ioctl interface behaving as if the device does not support INTx.
--- drivers/vfio/pci/vfio_pci_config.c | 3 ++- drivers/vfio/pci/vfio_pci_core.c | 10 +--------- drivers/vfio/pci/vfio_pci_intrs.c | 2 +- 3 files changed, 4 insertions(+), 11 deletions(-)
drivers/vfio/pci/vfio_pci_config.c +2 -1
@@ -1813,7 +1813,8 @@ int vfio_config_init(struct vfio_pci_core_device *vdev)cpu_to_le16 (PCI_COMMAND_MEMORY ); } -if (!IS_ENABLED (CONFIG_VFIO_PCI_INTX ) || vdev->nointx) +if (!IS_ENABLED (CONFIG_VFIO_PCI_INTX ) || vdev->nointx || + vdev->pdev->irq ==IRQ_NOTCONNECTED ) vconfig[PCI_INTERRUPT_PIN ] =0 ; ret =vfio_cap_init (vdev);
drivers/vfio/pci/vfio_pci_core.c +1 -9
@@ -727,15 +727,7 @@ EXPORT_SYMBOL_GPL(vfio_pci_core_finish_enable);static int vfio_pci_get_irq_count (struct vfio_pci_core_device *vdev,int irq_type) {if (irq_type ==VFIO_PCI_INTX_IRQ_INDEX ) { -u8 pin; - -if (!IS_ENABLED (CONFIG_VFIO_PCI_INTX ) || - vdev->nointx || vdev->pdev->is_virtfn) -return 0 ; - -pci_read_config_byte (vdev->pdev,PCI_INTERRUPT_PIN , &pin); - -return pin ?1 :0 ; +return vdev->vconfig[PCI_INTERRUPT_PIN ] ?1 :0 ; }else if (irq_type ==VFIO_PCI_MSI_IRQ_INDEX ) {u8 pos;u16 flags;
drivers/vfio/pci/vfio_pci_intrs.c +1 -1
@@ -259,7 +259,7 @@ static int vfio_intx_enable(struct vfio_pci_core_device *vdev,if (!is_irq_none (vdev))return -EINVAL ; -if (!pdev->irq) +if (!pdev->irq || pdev->irq ==IRQ_NOTCONNECTED )return -ENODEV ; name =kasprintf (GFP_KERNEL_ACCOUNT ,"vfio-intx(%s)" ,pci_name (pdev));
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 99/486 libbpf: Pass BPF token from find_prog_btf_id to BPF_BTF_GET_FD_BY_ID
In reply to Sasha LevinFrom: Mykyta Yatsenko <[email protected]>
[ Upstream commit 974ef9f0d23edc1a802691c585b84514b414a96d ]
Pass BPF token from bpf_program__set_attach_target to BPF_BTF_GET_FD_BY_ID bpf command.
When freplace program attaches to target program, it needs to look up for BTF of the target, this may require BPF token, if, for example, running from user namespace.
--- tools/lib/bpf/bpf.c | 3 ++- tools/lib/bpf/bpf.h | 3 ++- tools/lib/bpf/btf.c | 15 +++++++++++++-- tools/lib/bpf/libbpf.c | 10 +++++----- tools/lib/bpf/libbpf_internal.h | 1 + 5 files changed, 23 insertions(+), 9 deletions(-)
tools/lib/bpf/bpf.c +2 -1
@@ -1095,7 +1095,7 @@ int bpf_map_get_fd_by_id(__u32 id)int bpf_btf_get_fd_by_id_opts (__u32 id,const struct bpf_get_fd_by_id_opts *opts) { - const size_t attr_sz = offsetofend(union bpf_attr, open_flags); + const size_t attr_sz = offsetofend(union bpf_attr, fd_by_id_token_fd);union bpf_attr attr;int fd;
@@ -1105,6 +1105,7 @@ int bpf_btf_get_fd_by_id_opts(__u32 id,memset (&attr,0 , attr_sz); attr.btf_id = id; attr.open_flags =OPTS_GET (opts, open_flags,0 ); + attr.fd_by_id_token_fd =OPTS_GET (opts, token_fd,0 ); fd =sys_bpf_fd (BPF_BTF_GET_FD_BY_ID , &attr, attr_sz);return libbpf_err_errno (fd);
tools/lib/bpf/bpf.h +2 -1
@@ -484,9 +484,10 @@ LIBBPF_API int bpf_link_get_next_id(__u32 start_id, __u32 *next_id);struct bpf_get_fd_by_id_opts {size_t sz;/* size of this struct for forward/backward compatibility */ __u32 open_flags;/* permissions requested for the operation on fd */ +__u32 token_fd; size_t :0; }; -#define bpf_get_fd_by_id_opts__last_field open_flags +#define bpf_get_fd_by_id_opts__last_field token_fd LIBBPF_API int bpf_prog_get_fd_by_id(__u32 id); LIBBPF_API int bpf_prog_get_fd_by_id_opts(__u32 id,
tools/lib/bpf/btf.c +13 -2
@@ -1618,12 +1618,18 @@ struct btf *btf_get_from_fd(int btf_fd, struct btf *base_btf)return btf; } -struct btf *btf__load_from_kernel_by_id_split (__u32 id,struct btf *base_btf) +struct btf *btf_load_from_kernel (__u32 id,struct btf *base_btf,int token_fd) {struct btf *btf;int btf_fd; +LIBBPF_OPTS (bpf_get_fd_by_id_opts, opts); + +if (token_fd) { + opts.open_flags |=BPF_F_TOKEN_FD ; + opts.token_fd = token_fd; + } - btf_fd =bpf_btf_get_fd_by_id (id); + btf_fd =bpf_btf_get_fd_by_id_opts (id, &opts);if (btf_fd <0 )return libbpf_err_ptr (-errno);
@@ -1633,6 +1639,11 @@ struct btf *btf__load_from_kernel_by_id_split(__u32 id, struct btf *base_btf)return libbpf_ptr (btf); } +struct btf *btf__load_from_kernel_by_id_split (__u32 id,struct btf *base_btf) +{ +return btf_load_from_kernel (id, base_btf,0 ); +} +struct btf *btf__load_from_kernel_by_id (__u32 id) {return btf__load_from_kernel_by_id_split (id,NULL );
tools/lib/bpf/libbpf.c +5 -5
@@ -9936,7 +9936,7 @@ int libbpf_find_vmlinux_btf_id(const char *name,return libbpf_err (err); } -static int libbpf_find_prog_btf_id (const char *name,__u32 attach_prog_fd) +static int libbpf_find_prog_btf_id (const char *name,__u32 attach_prog_fd,int token_fd) {struct bpf_prog_info info;__u32 info_len =sizeof (info);
@@ -9956,7 +9956,7 @@ static int libbpf_find_prog_btf_id(const char *name, __u32 attach_prog_fd)pr_warn ("The target program doesn't have BTF\n" ); goto out; } - btf =btf__load_from_kernel_by_id (info.btf_id); + btf =btf_load_from_kernel (info.btf_id,NULL , token_fd); err =libbpf_get_error (btf);if (err) {pr_warn ("Failed to get BTF %d of the program: %d\n" , info.btf_id, err);
@@ -10039,7 +10039,7 @@ static int libbpf_find_attach_btf_id(struct bpf_program *prog, const char *attacpr_warn ("prog '%s': attach program FD is not set\n" , prog->name);return -EINVAL ; } - err =libbpf_find_prog_btf_id (attach_name, attach_prog_fd); + err =libbpf_find_prog_btf_id (attach_name, attach_prog_fd, prog->obj->token_fd);if (err <0 ) {pr_warn ("prog '%s': failed to find BPF program (FD %d) BTF ID for '%s': %d\n" , prog->name, attach_prog_fd, attach_name, err);
@@ -12804,7 +12804,7 @@ struct bpf_link *bpf_program__attach_freplace(const struct bpf_program *prog,if (target_fd) {LIBBPF_OPTS (bpf_link_create_opts, target_opts); - btf_id =libbpf_find_prog_btf_id (attach_func_name, target_fd); + btf_id =libbpf_find_prog_btf_id (attach_func_name, target_fd, prog->obj->token_fd);if (btf_id <0 )return libbpf_err_ptr (btf_id);
@@ -13629,7 +13629,7 @@ int bpf_program__set_attach_target(struct bpf_program *prog,if (attach_prog_fd) { btf_id =libbpf_find_prog_btf_id (attach_func_name, - attach_prog_fd); + attach_prog_fd, prog->obj->token_fd);if (btf_id <0 )return libbpf_err (btf_id); }else {
tools/lib/bpf/libbpf_internal.h +1 -0
@@ -408,6 +408,7 @@ int libbpf__load_raw_btf(const char *raw_types, size_t types_len,int btf_load_into_kernel (struct btf *btf,char *log_buf,size_t log_sz,__u32 log_level,int token_fd); +struct btf *btf_load_from_kernel (__u32 id,struct btf *base_btf,int token_fd);struct btf *btf_get_from_fd (int btf_fd,struct btf *base_btf); void btf_get_kernel_prefix_kind(enum bpf_attach_type attach_type,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 100/486 bpf: Return prog btf_id without capable check
In reply to Sasha LevinFrom: Mykyta Yatsenko <[email protected]>
[ Upstream commit 07651ccda9ff10a8ca427670cdd06ce2c8e4269c ]
Return prog's btf_id from bpf_prog_get_info_by_fd regardless of capable check. This patch enables scenario, when freplace program, running from user namespace, requires to query target prog's btf.
--- kernel/bpf/syscall.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/bpf/syscall.c +2 -2
@@ -4606,6 +4606,8 @@ static int bpf_prog_get_info_by_fd(struct file *file, info.recursion_misses = stats.misses; info.verified_insns = prog->aux->verified_insns; +if (prog->aux->btf) + info.btf_id =btf_obj_id (prog->aux->btf);if (!bpf_capable ()) { info.jited_prog_len =0 ;
@@ -4752,8 +4754,6 @@ static int bpf_prog_get_info_by_fd(struct file *file, } } -if (prog->aux->btf) - info.btf_id =btf_obj_id (prog->aux->btf); info.attach_btf_id = prog->aux->attach_btf_id;if (attach_btf) info.attach_btf_obj_id =btf_obj_id (attach_btf);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 101/486 PCI: dwc: Use resource start as ioremap() input in dw_pcie_pme_turn_off()
In reply to Sasha LevinFrom: Frank Li <[email protected]>
[ Upstream commit 8f4a489b370e6612700aa16b9e4373b2d85d7503 ]
The msg_res region translates writes into PCIe Message TLPs. Previously we mapped this region using atu.cpu_addr, the input address programmed into the ATU.
"cpu_addr" is a misnomer because when a bus fabric translates addresses between the CPU and the ATU, the ATU input address is different from the CPU address. A future patch will rename "cpu_addr" and correct the value to be the ATU input address instead of the CPU physical address.
Map the msg_res region before writing to it using the msg_res resource start, a CPU physical address.
--- drivers/pci/controller/dwc/pcie-designware-host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/dwc/pcie-designware-host.c +1 -1
@@ -902,7 +902,7 @@ static int dw_pcie_pme_turn_off(struct dw_pcie *pci)if (ret)return ret; - mem =ioremap (atu.cpu_addr, pci->region_align); + mem =ioremap (pci->pp.msg_res->start, pci->region_align);if (!mem)return -ENOMEM ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 102/486 jbd2: do not try to recover wiped journal
In reply to Sasha LevinFrom: Jan Kara <[email protected]>
[ Upstream commit a662f3c03b754e1f97a2781fa242e95bdb139798 ]
If a journal is wiped, we will set journal->j_tail to 0. However if 'write' argument is not set (as it happens for read-only device or for ocfs2), the on-disk superblock is not updated accordingly and thus jbd2_journal_recover() cat try to recover the wiped journal. Fix the check in jbd2_journal_recover() to use journal->j_tail for checking empty journal instead.
--- fs/jbd2/recovery.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
fs/jbd2/recovery.c +6 -5
@@ -287,19 +287,20 @@ static int fc_do_one_pass(journal_t *journal,int jbd2_journal_recover (journal_t *journal) {int err, err2; -journal_superblock_t * sb; -struct recovery_info info;memset (&info,0 ,sizeof (info)); - sb = journal->j_superblock;/* * The journal superblock's s_start field (the current log head) * is always zero if, and only if, the journal was cleanly -* unmounted. +* unmounted. We use its in-memory version j_tail here because +* jbd2_journal_wipe() could have updated it without updating journal +* superblock. */ -if (!sb->s_start) { +if (!journal->j_tail) { +journal_superblock_t *sb = journal->j_superblock; +jbd2_debug (1 ,"No recovery required, last transaction %d, head block %u\n" ,be32_to_cpu (sb->s_sequence),be32_to_cpu (sb->s_head)); journal->j_transaction_sequence =be32_to_cpu (sb->s_sequence) +1 ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 103/486 tcp: reorganize tcp_in_ack_event() and tcp_count_delivered()
In reply to Sasha LevinFrom: Ilpo Järvinen <[email protected]>
[ Upstream commit 149dfb31615e22271d2525f078c95ea49bc4db24 ]
- Move tcp_count_delivered() earlier and split tcp_count_delivered_ce() out of it
- Move tcp_in_ack_event() later
- While at it, remove the inline from tcp_in_ack_event() and let the compiler to decide
Accurate ECN's heuristics does not know if there is going to be ACE field based CE counter increase or not until after rtx queue has been processed. Only then the number of ACKed bytes/pkts is available. As CE or not affects presence of FLAG_ECE, that information for tcp_in_ack_event is not yet available in the old location of the call to tcp_in_ack_event().
--- net/ipv4/tcp_input.c | 56 +++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 24 deletions(-)
net/ipv4/tcp_input.c +32 -24
@@ -419,6 +419,20 @@ static bool tcp_ecn_rcv_ecn_echo(const struct tcp_sock *tp, const struct tcphdrreturn false; } +static void tcp_count_delivered_ce (struct tcp_sock *tp,u32 ecn_count) +{ + tp->delivered_ce += ecn_count; +} + +/* Updates the delivered and delivered_ce counts */ +static void tcp_count_delivered (struct tcp_sock *tp,u32 delivered, +bool ece_ack) +{ + tp->delivered += delivered; +if (ece_ack) +tcp_count_delivered_ce (tp, delivered); +} +/* Buffer size and advertised window tuning. * * 1. Tuning sk->sk_sndbuf, when connection enters established state.
@@ -1154,15 +1168,6 @@ void tcp_mark_skb_lost(struct sock *sk, struct sk_buff *skb) } } -/* Updates the delivered and delivered_ce counts */ -static void tcp_count_delivered (struct tcp_sock *tp,u32 delivered, -bool ece_ack) -{ - tp->delivered += delivered; -if (ece_ack) - tp->delivered_ce += delivered; -} -/* This procedure tags the retransmission queue when SACKs arrive. * * We have three tag bits: SACKED(S), RETRANS(R) and LOST(L).
@@ -3862,12 +3867,23 @@ static void tcp_process_tlp_ack(struct sock *sk, u32 ack, int flag) } } -static inline void tcp_in_ack_event (struct sock *sk,u32 flags) +static void tcp_in_ack_event (struct sock *sk,int flag) {const struct inet_connection_sock *icsk =inet_csk (sk); -if (icsk->icsk_ca_ops->in_ack_event) - icsk->icsk_ca_ops->in_ack_event (sk, flags); +if (icsk->icsk_ca_ops->in_ack_event) { +u32 ack_ev_flags =0 ; + +if (flag &FLAG_WIN_UPDATE ) + ack_ev_flags |=CA_ACK_WIN_UPDATE ; +if (flag &FLAG_SLOWPATH ) { + ack_ev_flags |=CA_ACK_SLOWPATH ; +if (flag &FLAG_ECE ) + ack_ev_flags |=CA_ACK_ECE ; + } + + icsk->icsk_ca_ops->in_ack_event (sk, ack_ev_flags); + } }/* Congestion control has updated the cwnd already. So if we're in
@@ -3984,12 +4000,8 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)tcp_snd_una_update (tp, ack); flag |=FLAG_WIN_UPDATE ; -tcp_in_ack_event (sk,CA_ACK_WIN_UPDATE ); -NET_INC_STATS (sock_net (sk),LINUX_MIB_TCPHPACKS ); }else { -u32 ack_ev_flags =CA_ACK_SLOWPATH ; -if (ack_seq !=TCP_SKB_CB (skb)->end_seq) flag |=FLAG_DATA ;else
@@ -4001,19 +4013,12 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) flag |=tcp_sacktag_write_queue (sk, skb, prior_snd_una, &sack_state); -if (tcp_ecn_rcv_ecn_echo (tp,tcp_hdr (skb))) { +if (tcp_ecn_rcv_ecn_echo (tp,tcp_hdr (skb))) flag |=FLAG_ECE ; - ack_ev_flags |=CA_ACK_ECE ; - }if (sack_state.sack_delivered)tcp_count_delivered (tp, sack_state.sack_delivered, flag &FLAG_ECE ); - -if (flag &FLAG_WIN_UPDATE ) - ack_ev_flags |=CA_ACK_WIN_UPDATE ; - -tcp_in_ack_event (sk, ack_ev_flags); }/* This is a deviation from RFC3168 since it states that:
@@ -4040,6 +4045,8 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)tcp_rack_update_reo_wnd (sk, &rs); +tcp_in_ack_event (sk, flag); +if (tp->tlp_high_seq)tcp_process_tlp_ack (sk, ack, flag);
@@ -4071,6 +4078,7 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)return 1 ; no_queue: +tcp_in_ack_event (sk, flag);/* If data was DSACKed, see if we can undo a cwnd reduction. */ if (flag &FLAG_DSACKING_ACK ) { tcp_fastretrans_alert(sk, prior_snd_una, num_dupack, &flag,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 104/486 rtc: rv3032: fix EERD location
In reply to Sasha LevinFrom: Alexandre Belloni <[email protected]>
[ Upstream commit b0f9cb4a0706b0356e84d67e48500b77b343debe ]
EERD is bit 2 in CTRL1
--- drivers/rtc/rtc-rv3032.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-rv3032.c +1 -1
@@ -69,7 +69,7 @@#define RV3032_CLKOUT2_FD_MSK GENMASK(6, 5)#define RV3032_CLKOUT2_OS BIT(7) -#define RV3032_CTRL1_EERD BIT(3) +#define RV3032_CTRL1_EERD BIT(2)#define RV3032_CTRL1_WADA BIT(5)#define RV3032_CTRL2_STOP BIT(0)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 105/486 objtool: Fix error handling inconsistencies in check()
In reply to Sasha LevinFrom: Josh Poimboeuf <[email protected]>
[ Upstream commit b745962cb97569aad026806bb0740663cf813147 ]
Make sure all fatal errors are funneled through the 'out' label with a negative ret.
--- tools/objtool/check.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
tools/objtool/check.c +6 -4
@@ -4757,8 +4757,10 @@ int check(struct objtool_file *file)init_cfi_state (&force_undefined_cfi); force_undefined_cfi.force_undefined = true; -if (!cfi_hash_alloc (1UL << (file->elf->symbol_bits -3 ))) +if (!cfi_hash_alloc (1UL << (file->elf->symbol_bits -3 ))) { + ret =-1 ; goto out; + }cfi_hash_add (&init_cfi);cfi_hash_add (&func_cfi);
@@ -4775,7 +4777,7 @@ int check(struct objtool_file *file)if (opts.retpoline) { ret =validate_retpoline (file);if (ret <0 ) -return ret; + goto out; warnings += ret; }
@@ -4811,7 +4813,7 @@ int check(struct objtool_file *file)*/ ret =validate_unrets (file);if (ret <0 ) -return ret; + goto out; warnings += ret; }
@@ -4874,7 +4876,7 @@ int check(struct objtool_file *file)if (opts.prefix) { ret =add_prefix_symbols (file);if (ret <0 ) -return ret; + goto out; warnings += ret; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 106/486 thunderbolt: Do not add non-active NVM if NVM upgrade is disabled for retimer
In reply to Sasha LevinFrom: Mika Westerberg <[email protected]>
[ Upstream commit ad79c278e478ca8c1a3bf8e7a0afba8f862a48a1 ]
This is only used to write a new NVM in order to upgrade the retimer firmware. It does not make sense to expose it if upgrade is disabled. This also makes it consistent with the router NVM upgrade.
--- drivers/thunderbolt/retimer.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/thunderbolt/retimer.c +5 -3
@@ -93,9 +93,11 @@ static int tb_retimer_nvm_add(struct tb_retimer *rt)if (ret) goto err_nvm; - ret =tb_nvm_add_non_active (nvm, nvm_write); -if (ret) - goto err_nvm; +if (!rt->no_nvm_upgrade) { + ret =tb_nvm_add_non_active (nvm, nvm_write); +if (ret) + goto err_nvm; + } rt->nvm = nvm;dev_dbg (&rt->dev,"NVM version %x.%x\n" , nvm->major, nvm->minor);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 107/486 erofs: initialize decompression early
In reply to Sasha LevinFrom: Gao Xiang <[email protected]>
[ Upstream commit fe1e57d44d7f106df9048e815e4862cf63921220 ]
- Rename erofs_init_managed_cache() to z_erofs_init_super();
- Move the initialization of managed_pslots into z_erofs_init_super() too;
- Move z_erofs_init_super() and packed inode preparation upwards, before the root inode initialization.
Therefore, the root directory can also be compressible.
--- fs/erofs/internal.h | 4 ++-- fs/erofs/super.c | 46 ++++++++++++++++++++++----------------------- fs/erofs/zdata.c | 4 ++-- 3 files changed, 26 insertions(+), 28 deletions(-)
fs/erofs/internal.h +2 -2
@@ -453,6 +453,7 @@ int __init erofs_init_shrinker(void);void erofs_exit_shrinker (void );int __init z_erofs_init_subsystem (void );void z_erofs_exit_subsystem (void ); +int z_erofs_init_super (struct super_block *sb);unsigned long z_erofs_shrink_scan (struct erofs_sb_info *sbi,unsigned long nr_shrink); int z_erofs_map_blocks_iter(struct inode *inode, struct erofs_map_blocks *map,
@@ -462,7 +463,6 @@ void z_erofs_put_gbuf(void *ptr);int z_erofs_gbuf_growsize (unsigned int nrpages);int __init z_erofs_gbuf_init (void );void z_erofs_gbuf_exit (void ); -int erofs_init_managed_cache (struct super_block *sb);int z_erofs_parse_cfgs (struct super_block *sb,struct erofs_super_block *dsb);#else static inline void erofs_shrinker_register (struct super_block *sb) {}
@@ -471,7 +471,7 @@ static inline int erofs_init_shrinker(void) { return 0; }static inline void erofs_exit_shrinker (void ) {}static inline int z_erofs_init_subsystem (void ) {return 0 ; }static inline void z_erofs_exit_subsystem (void ) {} -static inline int erofs_init_managed_cache (struct super_block *sb) {return 0 ; } +static inline int z_erofs_init_super (struct super_block *sb) {return 0 ; }#endif /* !CONFIG_EROFS_FS_ZIP */ #ifdef CONFIG_EROFS_FS_BACKED_BY_FILE
fs/erofs/super.c +22 -24
84 lines not on this page · raw message
fs/erofs/zdata.c +2 -2
@@ -666,18 +666,18 @@ static const struct address_space_operations z_erofs_cache_aops = { .invalidate_folio = z_erofs_cache_invalidate_folio, }; -int erofs_init_managed_cache (struct super_block *sb) +int z_erofs_init_super (struct super_block *sb) {struct inode *const inode =new_inode (sb);if (!inode)return -ENOMEM ; -set_nlink (inode,1 ); inode->i_size =OFFSET_MAX ; inode->i_mapping->a_ops = &z_erofs_cache_aops;mapping_set_gfp_mask (inode->i_mapping,GFP_KERNEL );EROFS_SB (sb)->managed_cache = inode; +xa_init (&EROFS_SB (sb)->managed_pslots);return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 108/486 spi: spi-mux: Fix coverity issue, unchecked return value
In reply to Sasha LevinFrom: Sergio Perez Gonzalez <[email protected]>
[ Upstream commit 5a5fc308418aca275a898d638bc38c093d101855 ]
The return value of spi_setup() is not captured within spi_mux_select() and it is assumed to be always success.
CID: 1638374
--- drivers/spi/spi-mux.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/spi/spi-mux.c +1 -3
@@ -68,9 +68,7 @@ static int spi_mux_select(struct spi_device *spi) priv->current_cs =spi_get_chipselect (spi,0 ); -spi_setup (priv->spi); - -return 0 ; +return spi_setup (priv->spi); }static int spi_mux_setup (struct spi_device *spi)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 109/486 ASoC: pcm6240: Drop bogus code handling IRQ as GPIO
In reply to Sasha LevinFrom: Linus Walleij <[email protected]>
[ Upstream commit 17fdf318f5fbe5c27353ae917c0c5a2899d9c259 ]
The current code for the IRQ in pcm6240 makes no sense:
it looks up an IRQ with of_irq_get(), treat it as a GPIO by issuing gpio_request(), gpio_direction_input() and gpio_to_irq() on it.
This is just wrong, if the device tree assigns the IRQ from a GPIO number this is just incorrect: it is clearly stated that GPIO providers and IRQ providers are orthogonal.
It is possible to look up an IRQ to a corresponding GPIO line but this is taking an IRQ and pretending it's a GPIO, which is just semantically wrong.
Drop the offending code and treat the IRQ that we get from the device tree as any other IRQ, see for example other codec drivers.
The DT bindings for this codec does not have any in-tree DTS files, which may explain why things are weird.
As a bonus, this moves the driver away from the legacy <linux/gpio.h> include.
--- sound/soc/codecs/pcm6240.c | 28 +++++++--------------------- sound/soc/codecs/pcm6240.h | 7 +------ 2 files changed, 8 insertions(+), 27 deletions(-)
sound/soc/codecs/pcm6240.c +7 -21
@@ -14,7 +14,7 @@#include <linux/unaligned.h> #include <linux/firmware.h> -#include <linux/gpio.h> +#include <linux/gpio/consumer.h> #include <linux/i2c.h> #include <linux/module.h> #include <linux/of_irq.h>
@@ -2035,10 +2035,8 @@ static const struct regmap_config pcmdevice_i2c_regmap = {static void pcmdevice_remove (struct pcmdevice_priv *pcm_dev) { -if (gpio_is_valid (pcm_dev->irq_info.gpio)) { -gpio_free (pcm_dev->irq_info.gpio); -free_irq (pcm_dev->irq_info.nmb, pcm_dev); - } +if (pcm_dev->irq) +free_irq (pcm_dev->irq, pcm_dev);mutex_destroy (&pcm_dev->codec_lock); }
@@ -2110,7 +2108,7 @@ static int pcmdevice_i2c_probe(struct i2c_client *i2c) ndev =1 ; dev_addrs[0 ] = i2c->addr; } - pcm_dev->irq_info.gpio =of_irq_get (np,0 ); + pcm_dev->irq =of_irq_get (np,0 );for (i =0 ; i < ndev; i++) pcm_dev->addr[i] = dev_addrs[i];
@@ -2133,22 +2131,10 @@ static int pcmdevice_i2c_probe(struct i2c_client *i2c)if (pcm_dev->chip_id ==PCM1690 ) goto skip_interrupt; -if (gpio_is_valid (pcm_dev->irq_info.gpio)) { -dev_dbg (pcm_dev->dev,"irq-gpio = %d" , pcm_dev->irq_info.gpio); - - ret =gpio_request (pcm_dev->irq_info.gpio,"PCMDEV-IRQ" ); -if (!ret) { -int gpio = pcm_dev->irq_info.gpio; - -gpio_direction_input (gpio); - pcm_dev->irq_info.nmb =gpio_to_irq (gpio); - - }else -dev_err (pcm_dev->dev,"%s: GPIO %d request error\n" , - __func__, pcm_dev->irq_info.gpio); +if (pcm_dev->irq) { +dev_dbg (pcm_dev->dev,"irq = %d" , pcm_dev->irq); }else -dev_err (pcm_dev->dev,"Looking up irq-gpio failed %d\n" , - pcm_dev->irq_info.gpio); +dev_err (pcm_dev->dev,"No irq provided\n" ); skip_interrupt: ret = devm_snd_soc_register_component(&i2c->dev,
sound/soc/codecs/pcm6240.h +1 -6
@@ -208,11 +208,6 @@ struct pcmdevice_regbin {struct pcmdevice_config_info **cfg_info; }; -struct pcmdevice_irqinfo { -int gpio; -int nmb; -}; -struct pcmdevice_priv {struct snd_soc_component *component;struct i2c_client *client;
@@ -221,7 +216,7 @@ struct pcmdevice_priv {struct gpio_desc *hw_rst;struct regmap *regmap;struct pcmdevice_regbin regbin; -struct pcmdevice_irqinfo irq_info; +int irq;unsigned int addr[PCMDEVICE_MAX_I2C_DEVICES ];unsigned int chip_id;int cur_conf;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 110/486 ASoC: mediatek: mt6359: Add stub for mt6359_accdet_enable_jack_detect
In reply to Sasha LevinFrom: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit 0116a7d84b32537a10d9bea1fd1bfc06577ef527 ]
Add a stub for mt6359_accdet_enable_jack_detect() to prevent linker failures in the machine sound drivers calling it when CONFIG_SND_SOC_MT6359_ACCDET is not enabled.
--- sound/soc/codecs/mt6359-accdet.h | 9 +++++++++ 1 file changed, 9 insertions(+)
sound/soc/codecs/mt6359-accdet.h +9 -0
@@ -123,6 +123,15 @@ struct mt6359_accdet { struct workqueue_struct *jd_workqueue; }; +#if IS_ENABLED (CONFIG_SND_SOC_MT6359_ACCDET )int mt6359_accdet_enable_jack_detect (struct snd_soc_component *component,struct snd_soc_jack *jack); +#else +static inline int +mt6359_accdet_enable_jack_detect (struct snd_soc_component *component, +struct snd_soc_jack *jack) +{ +return -EOPNOTSUPP ; +} +#endif #endif
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 111/486 bpf: Allow pre-ordering for bpf cgroup progs
In reply to Sasha LevinFrom: Yonghong Song <[email protected]>
[ Upstream commit 4b82b181a26cff8bf7adc3a85a88d121d92edeaf ]
Currently for bpf progs in a cgroup hierarchy, the effective prog array is computed from bottom cgroup to upper cgroups (post-ordering). For example, the following cgroup hierarchy
root cgroup: p1, p2
subcgroup: p3, p4
have BPF_F_ALLOW_MULTI for both cgroup levels.
The effective cgroup array ordering looks like
p3 p4 p1 p2
and at run time, progs will execute based on that order.
But in some cases, it is desirable to have root prog executes earlier than children progs (pre-ordering). For example,
- prog p1 intends to collect original pkt dest addresses.
- prog p3 will modify original pkt dest addresses to a proxy address for security reason.
The end result is that prog p1 gets proxy address which is not what it wants. Putting p1 to every child cgroup is not desirable either as it will duplicate itself in many child cgroups. And this is exactly a use case we are encountering in Meta.
To fix this issue, let us introduce a flag BPF_F_PREORDER. If the flag is specified at attachment time, the prog has higher priority and the ordering with that flag will be from top to bottom (pre-ordering). For example, in the above example,
root cgroup: p1, p2
subcgroup: p3, p4
Let us say p2 and p4 are marked with BPF_F_PREORDER. The final effective array ordering will be
p2 p4 p3 p1
--- include/linux/bpf-cgroup.h | 1 + include/uapi/linux/bpf.h | 1 + kernel/bpf/cgroup.c | 33 +++++++++++++++++++++++++-------- kernel/bpf/syscall.c | 3 ++- tools/include/uapi/linux/bpf.h | 1 + 5 files changed, 30 insertions(+), 9 deletions(-)
include/linux/bpf-cgroup.h +1 -0
@@ -111,6 +111,7 @@ struct bpf_prog_list {struct bpf_prog *prog;struct bpf_cgroup_link *link;struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE ]; +u32 flags; };int cgroup_bpf_inherit (struct cgroup *cgrp);
include/uapi/linux/bpf.h +1 -0
@@ -1206,6 +1206,7 @@ enum bpf_perf_event_type {#define BPF_F_BEFORE (1U << 3)#define BPF_F_AFTER (1U << 4)#define BPF_F_ID (1U << 5) +#define BPF_F_PREORDER (1U << 6)#define BPF_F_LINK BPF_F_LINK/* 1 << 13 */ /* If BPF_F_STRICT_ALIGNMENT is used in BPF_PROG_LOAD command, the
kernel/bpf/cgroup.c +25 -8
@@ -369,7 +369,7 @@ static struct bpf_prog *prog_list_prog(struct bpf_prog_list *pl)/* count number of elements in the list. * it's slow but the list cannot be long */ -static u32 prog_list_length (struct hlist_head *head) +static u32 prog_list_length (struct hlist_head *head,int *preorder_cnt) {struct bpf_prog_list *pl;u32 cnt =0 ;
@@ -377,6 +377,8 @@ static u32 prog_list_length(struct hlist_head *head)hlist_for_each_entry (pl, head, node) {if (!prog_list_prog (pl))continue ; +if (preorder_cnt && (pl->flags &BPF_F_PREORDER )) + (*preorder_cnt)++; cnt++; }return cnt;
@@ -400,7 +402,7 @@ static bool hierarchy_allows_attach(struct cgroup *cgrp,if (flags &BPF_F_ALLOW_MULTI )return true; - cnt =prog_list_length (&p->bpf.progs[atype]); + cnt =prog_list_length (&p->bpf.progs[atype],NULL );WARN_ON_ONCE (cnt >1 );if (cnt ==1 )return !!(flags &BPF_F_ALLOW_OVERRIDE );
@@ -423,12 +425,12 @@ static int compute_effective_progs(struct cgroup *cgrp,struct bpf_prog_array *progs;struct bpf_prog_list *pl;struct cgroup *p = cgrp; -int cnt =0 ; +int i, j, cnt =0 , preorder_cnt =0 , fstart, bstart, init_bstart;/* count number of effective programs by walking parents */ do {if (cnt ==0 || (p->bpf.flags[atype] &BPF_F_ALLOW_MULTI )) - cnt +=prog_list_length (&p->bpf.progs[atype]); + cnt +=prog_list_length (&p->bpf.progs[atype], &preorder_cnt); p =cgroup_parent (p); }while (p);
@@ -439,20 +441,34 @@ static int compute_effective_progs(struct cgroup *cgrp,/* populate the array with effective progs */ cnt =0 ; p = cgrp; + fstart = preorder_cnt; + bstart = preorder_cnt -1 ;do {if (cnt >0 && !(p->bpf.flags[atype] &BPF_F_ALLOW_MULTI ))continue ; + init_bstart = bstart;hlist_for_each_entry (pl, &p->bpf.progs[atype], node) {if (!prog_list_prog (pl))continue ; - item = &progs->items[cnt]; +if (pl->flags &BPF_F_PREORDER ) { + item = &progs->items[bstart]; + bstart--; + }else { + item = &progs->items[fstart]; + fstart++; + } item->prog =prog_list_prog (pl);bpf_cgroup_storages_assign (item->cgroup_storage, pl->storage); cnt++; } + +/* reverse pre-ordering progs at this cgroup level */ +for (i = bstart +1 , j = init_bstart; i < j; i++, j--) +swap (progs->items[i], progs->items[j]); + }while ((p =cgroup_parent (p))); *array = progs;
@@ -663,7 +679,7 @@ static int __cgroup_bpf_attach(struct cgroup *cgrp,*/ return -EPERM ; -if (prog_list_length (progs) >=BPF_CGROUP_MAX_PROGS ) +if (prog_list_length (progs,NULL ) >=BPF_CGROUP_MAX_PROGS )return -E2BIG ; pl = find_attach_entry(progs, prog, link, replace_prog,
@@ -698,6 +714,7 @@ static int __cgroup_bpf_attach(struct cgroup *cgrp, pl->prog = prog; pl->link = link; + pl->flags = flags;bpf_cgroup_storages_assign (pl->storage, storage); cgrp->bpf.flags[atype] = saved_flags;
@@ -1073,7 +1090,7 @@ static int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr, lockdep_is_held(&cgroup_mutex)); total_cnt +=bpf_prog_array_length (effective); }else { - total_cnt +=prog_list_length (&cgrp->bpf.progs[atype]); + total_cnt +=prog_list_length (&cgrp->bpf.progs[atype],NULL ); } }
@@ -1105,7 +1122,7 @@ static int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr,u32 id; progs = &cgrp->bpf.progs[atype]; - cnt =min_t (int,prog_list_length (progs), total_cnt); + cnt =min_t (int,prog_list_length (progs,NULL ), total_cnt); i =0 ;hlist_for_each_entry (pl, progs, node) { prog =prog_list_prog (pl);
kernel/bpf/syscall.c +2 -1
@@ -4042,7 +4042,8 @@ static int bpf_prog_attach_check_attach_type(const struct bpf_prog *prog,#define BPF_F_ATTACH_MASK_BASE \ (BPF_F_ALLOW_OVERRIDE | \ BPF_F_ALLOW_MULTI | \ - BPF_F_REPLACE) + BPF_F_REPLACE | \ + BPF_F_PREORDER)#define BPF_F_ATTACH_MASK_MPROG \ (BPF_F_REPLACE | \
tools/include/uapi/linux/bpf.h +1 -0
@@ -1206,6 +1206,7 @@ enum bpf_perf_event_type {#define BPF_F_BEFORE (1U << 3)#define BPF_F_AFTER (1U << 4)#define BPF_F_ID (1U << 5) +#define BPF_F_PREORDER (1U << 6)#define BPF_F_LINK BPF_F_LINK/* 1 << 13 */ /* If BPF_F_STRICT_ALIGNMENT is used in BPF_PROG_LOAD command, the
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 112/486 kbuild: fix argument parsing in scripts/config
In reply to Sasha LevinFrom: Seyediman Seyedarab <[email protected]>
[ Upstream commit f757f6011c92b5a01db742c39149bed9e526478f ]
The script previously assumed --file was always the first argument, which caused issues when it appeared later. This patch updates the parsing logic to scan all arguments to find --file, sets the config file correctly, and resets the argument list with the remaining commands.
It also fixes --refresh to respect --file by passing KCONFIG_CONFIG=$FN to make oldconfig.
--- scripts/config | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)
scripts/config +16 -10
@@ -32,6 +32,7 @@ commands: Disable option directly after other option --module-after|-M beforeopt option Turn option into module directly after other option + --refresh Refresh the config using old settings commands can be repeated multiple times
@@ -124,16 +125,22 @@ undef_var() { txt_delete "^# $name is not set" "$FN" } -if [ "$1" = "--file" ]; then - FN="$2" - if [ "$FN" = "" ] ; then - usage +FN=.config +CMDS=() +while [[ $# -gt 0 ]]; do + if [ "$1" = "--file" ]; then + if [ "$2" = "" ]; then + usage + fi + FN="$2" + shift 2 + else + CMDS+=("$1") + shift fi - shift 2 -else - FN=.config -fi +done +set -- "${CMDS[@]}" if [ "$1" = "" ] ; then usage fi
@@ -217,9 +224,8 @@ while [ "$1" != "" ] ; do set_var "${CONFIG_}$B" "${CONFIG_}$B=m" "${CONFIG_}$A" ;; - # undocumented because it ignores --file (fixme) --refresh) - yes "" | make oldconfig + yes "" | make oldconfig KCONFIG_CONFIG=$FN ;; *)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 113/486 kconfig: do not clear SYMBOL_VALID when reading include/config/auto.conf
In reply to Sasha LevinFrom: Masahiro Yamada <[email protected]>
[ Upstream commit 226ac19c217f24f0927d0a73cf9ee613971a188d ]
When conf_read_simple() is called with S_DEF_AUTO, it is meant to read previous symbol values from include/config/auto.conf to determine which include/config/* files should be touched.
This process should not modify the current symbol status in any way. However, conf_touch_deps() currently invalidates all symbol values and recalculates them, which is totally unneeded.
--- scripts/kconfig/confdata.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
scripts/kconfig/confdata.c +12 -7
@@ -385,7 +385,7 @@ int conf_read_simple(const char *name, int def) def_flags =SYMBOL_DEF << def;for_all_symbols (sym) { - sym->flags &= ~(def_flags|SYMBOL_VALID ); + sym->flags &= ~def_flags;switch (sym->type) {case S_INT :case S_HEX :
@@ -398,7 +398,11 @@ int conf_read_simple(const char *name, int def) } } -expr_invalidate_all (); +if (def ==S_DEF_USER ) { +for_all_symbols (sym) + sym->flags &= ~SYMBOL_VALID; +expr_invalidate_all (); + }while (getline_stripped (&line, &line_asize, in) !=-1 ) {struct menu *choice;
@@ -464,6 +468,9 @@ int conf_read_simple(const char *name, int def)if (conf_set_sym_val (sym, def, def_flags, val))continue ; +if (def !=S_DEF_USER ) +continue ; +/* * If this is a choice member, give it the highest priority. * If conflicting CONFIG options are given from an input file,
@@ -967,10 +974,8 @@ static int conf_touch_deps(void) depfile_path[depfile_prefix_len] =0 ;conf_read_simple (name,S_DEF_AUTO ); -sym_calc_value (modules_sym);for_all_symbols (sym) { -sym_calc_value (sym);if (sym_is_choice (sym))continue ;if (sym->flags &SYMBOL_WRITE ) {
@@ -1084,12 +1089,12 @@ int conf_write_autoconf(int overwrite)if (ret)return -1 ; -if (conf_touch_deps ()) -return 1 ; -for_all_symbols (sym)sym_calc_value (sym); +if (conf_touch_deps ()) +return 1 ; + ret =__conf_write_autoconf (conf_get_autoheader_name (), print_symbol_for_c, &comment_style_c);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 114/486 crypto: octeontx2 - suppress auth failure screaming due to negative tests
In reply to Sasha LevinFrom: Shashank Gupta <[email protected]>
[ Upstream commit 64b7871522a4cba99d092e1c849d6f9092868aaa ]
This patch addresses an issue where authentication failures were being erroneously reported due to negative test failures in the "ccm(aes)" selftest.pr_debug suppress unnecessary screaming of these tests.
--- drivers/crypto/marvell/octeontx2/otx2_cptvf_reqmgr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/crypto/marvell/octeontx2/otx2_cptvf_reqmgr.c +4 -3
@@ -264,9 +264,10 @@ static int cpt_process_ccode(struct otx2_cptlfs_info *lfs,break ; } -dev_err (&pdev->dev, -"Request failed with software error code 0x%x\n" , - cpt_status->s.uc_compcode); +pr_debug ("Request failed with software error code 0x%x: algo = %s driver = %s\n" , + cpt_status->s.uc_compcode, + info->req->areq->tfm->__crt_alg->cra_name, + info->req->areq->tfm->__crt_alg->cra_driver_name);otx2_cpt_dump_sg_list (pdev, info->req);break ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 115/486 dm: restrict dm device size to 2^63-512 bytes
In reply to Sasha LevinFrom: Mikulas Patocka <[email protected]>
[ Upstream commit 45fc728515c14f53f6205789de5bfd72a95af3b8 ]
The devices with size >= 2^63 bytes can't be used reliably by userspace because the type off_t is a signed 64-bit integer.
Therefore, we limit the maximum size of a device mapper device to 2^63-512 bytes.
--- drivers/md/dm-table.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/md/dm-table.c +4 -0
@@ -697,6 +697,10 @@ int dm_table_add_target(struct dm_table *t, const char *type,DMERR ("%s: zero-length target" ,dm_device_name (t->md));return -EINVAL ; } +if (start + len < start || start + len >LLONG_MAX >>SECTOR_SHIFT ) { +DMERR ("%s: too large device" ,dm_device_name (t->md)); +return -EINVAL ; + } ti->type =dm_get_target_type (type);if (!ti->type) {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 116/486 net/smc: use the correct ndev to find pnetid by pnetid table
In reply to Sasha LevinFrom: Guangguan Wang <[email protected]>
[ Upstream commit bfc6c67ec2d64d0ca4e5cc3e1ac84298a10b8d62 ]
When using smc_pnet in SMC, it will only search the pnetid in the base_ndev of the netdev hierarchy(both HW PNETID and User-defined sw pnetid). This may not work for some scenarios when using SMC in container on cloud environment.
In container, there have choices of different container network, such as directly using host network, virtual network IPVLAN, veth, etc. Different choices of container network have different netdev hierarchy. Examples of netdev hierarchy show below. (eth0 and eth1 in host below is the netdev directly related to the physical device).
_______________________________
| _________________ |
| |POD | |
| | | |
| | eth0_________ | |
| |____| |__| |
| | | |
| | | |
| eth1|base_ndev| eth0_______ |
| | | | RDMA ||
| host |_________| |_______||
---------------------------------
netdev hierarchy if directly using host network
________________________________
| _________________ |
| |POD __________ | |
| | |upper_ndev| | |
| |eth0|__________| | |
| |_______|_________| |
| |lower netdev |
| __|______ |
| eth1| | eth0_______ |
| |base_ndev| | RDMA ||
| host |_________| |_______||
---------------------------------
netdev hierarchy if using IPVLAN
_______________________________
| _____________________ |
| |POD _________ | |
| | |base_ndev|| |
| |eth0(veth)|_________|| |
| |____________|________| |
| |pairs |
| _______|_ |
| | | eth0_______ |
| veth|base_ndev| | RDMA ||
| |_________| |_______||
| _________ |
| eth1|base_ndev| |
| host |_________| |
---------------------------------
netdev hierarchy if using vethDue to some reasons, the eth1 in host is not RDMA attached netdevice, pnetid is needed to map the eth1(in host) with RDMA device so that POD can do SMC-R. Because the eth1(in host) is managed by CNI plugin(such as Terway, network management plugin in container environment), and in cloud environment the eth(in host) can dynamically be inserted by CNI when POD create and dynamically be removed by CNI when POD destroy and no POD related to the eth(in host) anymore. It is hard to config the pnetid to the eth1(in host). But it is easy to config the pnetid to the netdevice which can be seen in POD. When do SMC-R, both the container directly using host network and the container using veth network can successfully match the RDMA device, because the configured pnetid netdev is a base_ndev. But the container using IPVLAN can not successfully match the RDMA device and 0x03030000 fallback happens, because the configured pnetid netdev is not a base_ndev. Additionally, if config pnetid to the eth1(in host) also can not work for matching RDMA device when using veth network and doing SMC-R in POD.
To resolve the problems list above, this patch extends to search user -defined sw pnetid in the clc handshake ndev when no pnetid can be found in the base_ndev, and the base_ndev take precedence over ndev for backward compatibility. This patch also can unify the pnetid setup of different network choices list above in container(Config user-defined sw pnetid in the netdevice can be seen in POD).
--- net/smc/smc_pnet.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
net/smc/smc_pnet.c +5 -3
@@ -1079,14 +1079,16 @@ static void smc_pnet_find_roce_by_pnetid(struct net_device *ndev, struct smc_init_info *ini) {u8 ndev_pnetid[SMC_MAX_PNETID_LEN ]; +struct net_device *base_ndev;struct net *net; - ndev =pnet_find_base_ndev (ndev); + base_ndev =pnet_find_base_ndev (ndev); net =dev_net (ndev); -if (smc_pnetid_by_dev_port (ndev->dev.parent, ndev->dev_port, +if (smc_pnetid_by_dev_port (base_ndev->dev.parent, base_ndev->dev_port, ndev_pnetid) && +smc_pnet_find_ndev_pnetid_by_table (base_ndev, ndev_pnetid) &&smc_pnet_find_ndev_pnetid_by_table (ndev, ndev_pnetid)) { -smc_pnet_find_rdma_dev (ndev, ini); +smc_pnet_find_rdma_dev (base_ndev, ini);return ;/* pnetid could not be determined */ }_smc_pnet_find_roce_by_pnetid (ndev_pnetid, ini,NULL , net);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 117/486 xen: Add support for XenServer 6.1 platform device
In reply to Sasha LevinFrom: Frediano Ziglio <[email protected]>
[ Upstream commit 2356f15caefc0cc63d9cc5122641754f76ef9b25 ]
On XenServer on Windows machine a platform device with ID 2 instead of 1 is used.
This device is mainly identical to device 1 but due to some Windows update behaviour it was decided to use a device with a different ID.
This causes compatibility issues with Linux which expects, if Xen is detected, to find a Xen platform device (5853:0001) otherwise code will crash due to some missing initialization (specifically grant tables). Specifically from dmesg
RIP: 0010:gnttab_expand+0x29/0x210
Code: 90 0f 1f 44 00 00 55 31 d2 48 89 e5 41 57 41 56 41 55 41 89 fd
41 54 53 48 83 ec 10 48 8b 05 7e 9a 49 02 44 8b 35 a7 9a 49 02
<8b> 48 04 8d 44 39 ff f7 f1 45 8d 24 06 89 c3 e8 43 fe ff ff
44 39
RSP: 0000:ffffba34c01fbc88 EFLAGS: 00010086
...The device 2 is presented by Xapi adding device specification to Qemu command line.
Message-ID: <[email protected]>
--- drivers/xen/platform-pci.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/xen/platform-pci.c +4 -0
@@ -26,6 +26,8 @@#define DRV_NAME "xen-platform-pci" +#define PCI_DEVICE_ID_XEN_PLATFORM_XS61 0x0002 +static unsigned long platform_mmio;static unsigned long platform_mmio_alloc;static unsigned long platform_mmiolen;
@@ -174,6 +176,8 @@ static int platform_pci_probe(struct pci_dev *pdev,static const struct pci_device_id platform_pci_tbl[] = { {PCI_VENDOR_ID_XEN ,PCI_DEVICE_ID_XEN_PLATFORM ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,0 }, + {PCI_VENDOR_ID_XEN ,PCI_DEVICE_ID_XEN_PLATFORM_XS61 , +PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,0 }, {0 ,} };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 118/486 pinctrl-tegra: Restore SFSEL bit when freeing pins
In reply to Sasha LevinFrom: Prathamesh Shete <[email protected]>
[ Upstream commit c12bfa0fee65940b10ff5187349f76c6f6b1df9c ]
Each pin can be configured as a Special Function IO (SFIO) or GPIO, where the SFIO enables the pin to operate in alternative modes such as I2C, SPI, etc.
The current implementation sets all the pins back to SFIO mode even if they were initially in GPIO mode. This can cause glitches on the pins when pinctrl_gpio_free() is called.
Avoid these undesired glitches by storing the pin's SFIO/GPIO state on GPIO request and restoring it on GPIO free.
--- drivers/pinctrl/tegra/pinctrl-tegra.c | 59 +++++++++++++++++++++++---- drivers/pinctrl/tegra/pinctrl-tegra.h | 6 +++ 2 files changed, 57 insertions(+), 8 deletions(-)
drivers/pinctrl/tegra/pinctrl-tegra.c +51 -8
@@ -278,8 +278,8 @@ static int tegra_pinctrl_set_mux(struct pinctrl_dev *pctldev,return 0 ; } -static const struct tegra_pingroup *tegra_pinctrl_get_group (struct pinctrl_dev *pctldev, -unsigned int offset) +static int tegra_pinctrl_get_group_index (struct pinctrl_dev *pctldev, +unsigned int offset) {struct tegra_pmx *pmx =pinctrl_dev_get_drvdata (pctldev);unsigned int group, num_pins, j;
@@ -292,12 +292,35 @@ static const struct tegra_pingroup *tegra_pinctrl_get_group(struct pinctrl_dev *continue ;for (j =0 ; j < num_pins; j++) {if (offset == pins[j]) -return &pmx->soc->groups[group]; +return group; } } -dev_err (pctldev->dev,"Pingroup not found for pin %u\n" , offset); -return NULL ; +return -EINVAL ; +} + +static const struct tegra_pingroup *tegra_pinctrl_get_group (struct pinctrl_dev *pctldev, +unsigned int offset, +int group_index) +{ +struct tegra_pmx *pmx =pinctrl_dev_get_drvdata (pctldev); + +if (group_index <0 || group_index > pmx->soc->ngroups) +return NULL ; + +return &pmx->soc->groups[group_index]; +} + +static struct tegra_pingroup_config *tegra_pinctrl_get_group_config (struct pinctrl_dev *pctldev, +unsigned int offset, +int group_index) +{ +struct tegra_pmx *pmx =pinctrl_dev_get_drvdata (pctldev); + +if (group_index <0 ) +return NULL ; + +return &pmx->pingroup_configs[group_index]; } static int tegra_pinctrl_gpio_request_enable(struct pinctrl_dev *pctldev,
@@ -306,12 +329,15 @@ static int tegra_pinctrl_gpio_request_enable(struct pinctrl_dev *pctldev, {struct tegra_pmx *pmx =pinctrl_dev_get_drvdata (pctldev);const struct tegra_pingroup *group; +struct tegra_pingroup_config *config; +int group_index;u32 value;if (!pmx->soc->sfsel_in_mux)return 0 ; - group =tegra_pinctrl_get_group (pctldev, offset); + group_index =tegra_pinctrl_get_group_index (pctldev, offset); + group =tegra_pinctrl_get_group (pctldev, offset, group_index);if (!group)return -EINVAL ;
@@ -319,7 +345,11 @@ static int tegra_pinctrl_gpio_request_enable(struct pinctrl_dev *pctldev,if (group->mux_reg <0 || group->sfsel_bit <0 )return -EINVAL ; + config =tegra_pinctrl_get_group_config (pctldev, offset, group_index); +if (!config) +return -EINVAL ; value =pmx_readl (pmx, group->mux_bank, group->mux_reg); + config->is_sfsel = (value &BIT (group->sfsel_bit)) !=0 ; value &= ~BIT (group->sfsel_bit);pmx_writel (pmx, value, group->mux_bank, group->mux_reg);
@@ -332,12 +362,15 @@ static void tegra_pinctrl_gpio_disable_free(struct pinctrl_dev *pctldev, {struct tegra_pmx *pmx =pinctrl_dev_get_drvdata (pctldev);const struct tegra_pingroup *group; +struct tegra_pingroup_config *config; +int group_index;u32 value;if (!pmx->soc->sfsel_in_mux)return ; - group =tegra_pinctrl_get_group (pctldev, offset); + group_index =tegra_pinctrl_get_group_index (pctldev, offset); + group =tegra_pinctrl_get_group (pctldev, offset, group_index);if (!group)return ;
@@ -345,8 +378,12 @@ static void tegra_pinctrl_gpio_disable_free(struct pinctrl_dev *pctldev,if (group->mux_reg <0 || group->sfsel_bit <0 )return ; + config =tegra_pinctrl_get_group_config (pctldev, offset, group_index); +if (!config) +return ; value =pmx_readl (pmx, group->mux_bank, group->mux_reg); - value |=BIT (group->sfsel_bit); +if (config->is_sfsel) + value |=BIT (group->sfsel_bit);pmx_writel (pmx, value, group->mux_bank, group->mux_reg); }
@@ -791,6 +828,12 @@ int tegra_pinctrl_probe(struct platform_device *pdev, pmx->dev = &pdev->dev; pmx->soc = soc_data; + pmx->pingroup_configs =devm_kcalloc (&pdev->dev, + pmx->soc->ngroups,sizeof (*pmx->pingroup_configs), +GFP_KERNEL ); +if (!pmx->pingroup_configs) +return -ENOMEM ; +/* * Each mux group will appear in 4 functions' list of groups. * This over-allocates slightly, since not all groups are mux groups.
drivers/pinctrl/tegra/pinctrl-tegra.h +6 -0
@@ -8,6 +8,10 @@ #ifndef __PINMUX_TEGRA_H__ #define __PINMUX_TEGRA_H__ +struct tegra_pingroup_config { + bool is_sfsel; +}; + struct tegra_pmx { struct device *dev; struct pinctrl_dev *pctl;
@@ -21,6 +25,8 @@ struct tegra_pmx {int nbanks;void __iomem **regs;u32 *backup_regs; +/* Array of size soc->ngroups */ +struct tegra_pingroup_config *pingroup_configs; };enum tegra_pinconf_param {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 119/486 mfd: tps65219: Remove TPS65219_REG_TI_DEV_ID check
In reply to Sasha LevinFrom: Shree Ramamoorthy <[email protected]>
[ Upstream commit 76b58d5111fdcffce615beb71520bc7a6f1742c9 ]
The chipid macro/variable and regmap_read function call is not needed because the TPS65219_REG_TI_DEV_ID register value is not a consistent value across TPS65219 PMIC config versions. Reading from the DEV_ID register without a consistent value to compare it to isn't useful. There isn't a way to verify the match data ID is the same ID read from the DEV_ID device register. 0xF0 isn't a DEV_ID value consistent across TPS65219 NVM configurations.
For TPS65215, there is a consistent value in bits 5-0 of the DEV_ID register. However, there are other error checks in place within probe() that apply to both PMICs rather than keeping this isolated check for one PMIC.
--- drivers/mfd/tps65219.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/mfd/tps65219.c +0 -7
@@ -228,7 +228,6 @@ static const struct regmap_irq_chip tps65219_irq_chip = {static int tps65219_probe (struct i2c_client *client) {struct tps65219 *tps; -unsigned int chipid;bool pwr_button;int ret;
@@ -253,12 +252,6 @@ static int tps65219_probe(struct i2c_client *client)if (ret)return ret; - ret =regmap_read (tps->regmap,TPS65219_REG_TI_DEV_ID , &chipid); -if (ret) { -dev_err (tps->dev,"Failed to read device ID: %d\n" , ret); -return ret; - } - ret =devm_mfd_add_devices (tps->dev,PLATFORM_DEVID_AUTO , tps65219_cells,ARRAY_SIZE (tps65219_cells),NULL ,0 ,regmap_irq_get_domain (tps->irq_data));
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 120/486 drm/amdgpu/gfx12: don't read registers in mqd init
In reply to Sasha LevinFrom: Alex Deucher <[email protected]>
[ Upstream commit fc3c139cf0432b79fd08e23100a559ee51cd0be4 ]
Just use the default values. There's not need to get the value from hardware and it could cause problems if we do that at runtime and gfxoff is active.
--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 48 ++++++++++++++++++-------- 1 file changed, 33 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +33 -15
@@ -52,6 +52,24 @@#define RLCG_UCODE_LOADING_START_ADDRESS 0x00002000L +#define regCP_GFX_MQD_CONTROL_DEFAULT 0x00000100 +#define regCP_GFX_HQD_VMID_DEFAULT 0x00000000 +#define regCP_GFX_HQD_QUEUE_PRIORITY_DEFAULT 0x00000000 +#define regCP_GFX_HQD_QUANTUM_DEFAULT 0x00000a01 +#define regCP_GFX_HQD_CNTL_DEFAULT 0x00f00000 +#define regCP_RB_DOORBELL_CONTROL_DEFAULT 0x00000000 +#define regCP_GFX_HQD_RPTR_DEFAULT 0x00000000 + +#define regCP_HQD_EOP_CONTROL_DEFAULT 0x00000006 +#define regCP_HQD_PQ_DOORBELL_CONTROL_DEFAULT 0x00000000 +#define regCP_MQD_CONTROL_DEFAULT 0x00000100 +#define regCP_HQD_PQ_CONTROL_DEFAULT 0x00308509 +#define regCP_HQD_PQ_DOORBELL_CONTROL_DEFAULT 0x00000000 +#define regCP_HQD_PQ_RPTR_DEFAULT 0x00000000 +#define regCP_HQD_PERSISTENT_STATE_DEFAULT 0x0be05501 +#define regCP_HQD_IB_CONTROL_DEFAULT 0x00300000 + +MODULE_FIRMWARE ("amdgpu/gc_12_0_0_pfp.bin" );MODULE_FIRMWARE ("amdgpu/gc_12_0_0_me.bin" );MODULE_FIRMWARE ("amdgpu/gc_12_0_0_mec.bin" );
@@ -2851,25 +2869,25 @@ static int gfx_v12_0_gfx_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_mqd_base_addr_hi =upper_32_bits (prop->mqd_gpu_addr);/* set up mqd control */ - tmp =RREG32_SOC15 (GC ,0 , regCP_GFX_MQD_CONTROL); + tmp = regCP_GFX_MQD_CONTROL_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_GFX_MQD_CONTROL ,VMID ,0 ); tmp =REG_SET_FIELD (tmp,CP_GFX_MQD_CONTROL ,PRIV_STATE ,1 ); tmp =REG_SET_FIELD (tmp,CP_GFX_MQD_CONTROL ,CACHE_POLICY ,0 ); mqd->cp_gfx_mqd_control = tmp;/* set up gfx_hqd_vimd with 0x0 to indicate the ring buffer's vmid */ - tmp =RREG32_SOC15 (GC ,0 , regCP_GFX_HQD_VMID); + tmp = regCP_GFX_HQD_VMID_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_GFX_HQD_VMID ,VMID ,0 ); mqd->cp_gfx_hqd_vmid =0 ;/* set up default queue priority level * 0x0 = low priority, 0x1 = high priority */ - tmp =RREG32_SOC15 (GC ,0 , regCP_GFX_HQD_QUEUE_PRIORITY); + tmp = regCP_GFX_HQD_QUEUE_PRIORITY_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_GFX_HQD_QUEUE_PRIORITY ,PRIORITY_LEVEL ,0 ); mqd->cp_gfx_hqd_queue_priority = tmp;/* set up time quantum */ - tmp =RREG32_SOC15 (GC ,0 , regCP_GFX_HQD_QUANTUM); + tmp = regCP_GFX_HQD_QUANTUM_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_GFX_HQD_QUANTUM ,QUANTUM_EN ,1 ); mqd->cp_gfx_hqd_quantum = tmp;
@@ -2891,7 +2909,7 @@ static int gfx_v12_0_gfx_mqd_init(struct amdgpu_device *adev, void *m,/* set up the gfx_hqd_control, similar as CP_RB0_CNTL */ rb_bufsz =order_base_2 (prop->queue_size /4 ) -1 ; - tmp =RREG32_SOC15 (GC ,0 , regCP_GFX_HQD_CNTL); + tmp = regCP_GFX_HQD_CNTL_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_GFX_HQD_CNTL ,RB_BUFSZ , rb_bufsz); tmp =REG_SET_FIELD (tmp,CP_GFX_HQD_CNTL ,RB_BLKSZ , rb_bufsz -2 );#ifdef __BIG_ENDIAN
@@ -2900,7 +2918,7 @@ static int gfx_v12_0_gfx_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_gfx_hqd_cntl = tmp;/* set up cp_doorbell_control */ - tmp =RREG32_SOC15 (GC ,0 , regCP_RB_DOORBELL_CONTROL); + tmp = regCP_RB_DOORBELL_CONTROL_DEFAULT;if (prop->use_doorbell) { tmp =REG_SET_FIELD (tmp,CP_RB_DOORBELL_CONTROL ,DOORBELL_OFFSET , prop->doorbell_index);
@@ -2912,7 +2930,7 @@ static int gfx_v12_0_gfx_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_rb_doorbell_control = tmp;/* reset read and write pointers, similar to CP_RB0_WPTR/_RPTR */ - mqd->cp_gfx_hqd_rptr =RREG32_SOC15 (GC ,0 , regCP_GFX_HQD_RPTR); + mqd->cp_gfx_hqd_rptr = regCP_GFX_HQD_RPTR_DEFAULT;/* active the queue */ mqd->cp_gfx_hqd_active =1 ;
@@ -3007,14 +3025,14 @@ static int gfx_v12_0_compute_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_hqd_eop_base_addr_hi =upper_32_bits (eop_base_addr);/* set the EOP size, register value is 2^(EOP_SIZE+1) dwords */ - tmp =RREG32_SOC15 (GC ,0 , regCP_HQD_EOP_CONTROL); + tmp = regCP_HQD_EOP_CONTROL_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_HQD_EOP_CONTROL ,EOP_SIZE , (order_base_2 (GFX12_MEC_HPD_SIZE /4 ) -1 )); mqd->cp_hqd_eop_control = tmp;/* enable doorbell? */ - tmp =RREG32_SOC15 (GC ,0 , regCP_HQD_PQ_DOORBELL_CONTROL); + tmp = regCP_HQD_PQ_DOORBELL_CONTROL_DEFAULT;if (prop->use_doorbell) { tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_DOORBELL_CONTROL,
@@ -3043,7 +3061,7 @@ static int gfx_v12_0_compute_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_mqd_base_addr_hi =upper_32_bits (prop->mqd_gpu_addr);/* set MQD vmid to 0 */ - tmp =RREG32_SOC15 (GC ,0 , regCP_MQD_CONTROL); + tmp = regCP_MQD_CONTROL_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_MQD_CONTROL ,VMID ,0 ); mqd->cp_mqd_control = tmp;
@@ -3053,7 +3071,7 @@ static int gfx_v12_0_compute_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_hqd_pq_base_hi =upper_32_bits (hqd_gpu_addr);/* set up the HQD, this is similar to CP_RB0_CNTL */ - tmp =RREG32_SOC15 (GC ,0 , regCP_HQD_PQ_CONTROL); + tmp = regCP_HQD_PQ_CONTROL_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_HQD_PQ_CONTROL ,QUEUE_SIZE , (order_base_2 (prop->queue_size /4 ) -1 )); tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, RPTR_BLOCK_SIZE,
@@ -3078,7 +3096,7 @@ static int gfx_v12_0_compute_mqd_init(struct amdgpu_device *adev, void *m, tmp =0 ;/* enable the doorbell if requested */ if (prop->use_doorbell) { - tmp =RREG32_SOC15 (GC ,0 , regCP_HQD_PQ_DOORBELL_CONTROL); + tmp = regCP_HQD_PQ_DOORBELL_CONTROL_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_HQD_PQ_DOORBELL_CONTROL ,DOORBELL_OFFSET , prop->doorbell_index);
@@ -3093,17 +3111,17 @@ static int gfx_v12_0_compute_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_hqd_pq_doorbell_control = tmp;/* reset read and write pointers, similar to CP_RB0_WPTR/_RPTR */ - mqd->cp_hqd_pq_rptr =RREG32_SOC15 (GC ,0 , regCP_HQD_PQ_RPTR); + mqd->cp_hqd_pq_rptr = regCP_HQD_PQ_RPTR_DEFAULT;/* set the vmid for the queue */ mqd->cp_hqd_vmid =0 ; - tmp =RREG32_SOC15 (GC ,0 , regCP_HQD_PERSISTENT_STATE); + tmp = regCP_HQD_PERSISTENT_STATE_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_HQD_PERSISTENT_STATE ,PRELOAD_SIZE ,0x55 ); mqd->cp_hqd_persistent_state = tmp;/* set MIN_IB_AVAIL_SIZE */ - tmp =RREG32_SOC15 (GC ,0 , regCP_HQD_IB_CONTROL); + tmp = regCP_HQD_IB_CONTROL_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_HQD_IB_CONTROL ,MIN_IB_AVAIL_SIZE ,3 ); mqd->cp_hqd_ib_control = tmp;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 121/486 drm/amdgpu/gfx11: don't read registers in mqd init
In reply to Sasha LevinFrom: Alex Deucher <[email protected]>
[ Upstream commit e27b36ea6ba5f29e91fcfb375ea29503708fcf43 ]
Just use the default values. There's not need to get the value from hardware and it could cause problems if we do that at runtime and gfxoff is active.
--- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 47 ++++++++++++++++++-------- 1 file changed, 32 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +32 -15
@@ -63,6 +63,23 @@#define regPC_CONFIG_CNTL_1 0x194d#define regPC_CONFIG_CNTL_1_BASE_IDX 1 +#define regCP_GFX_MQD_CONTROL_DEFAULT 0x00000100 +#define regCP_GFX_HQD_VMID_DEFAULT 0x00000000 +#define regCP_GFX_HQD_QUEUE_PRIORITY_DEFAULT 0x00000000 +#define regCP_GFX_HQD_QUANTUM_DEFAULT 0x00000a01 +#define regCP_GFX_HQD_CNTL_DEFAULT 0x00a00000 +#define regCP_RB_DOORBELL_CONTROL_DEFAULT 0x00000000 +#define regCP_GFX_HQD_RPTR_DEFAULT 0x00000000 + +#define regCP_HQD_EOP_CONTROL_DEFAULT 0x00000006 +#define regCP_HQD_PQ_DOORBELL_CONTROL_DEFAULT 0x00000000 +#define regCP_MQD_CONTROL_DEFAULT 0x00000100 +#define regCP_HQD_PQ_CONTROL_DEFAULT 0x00308509 +#define regCP_HQD_PQ_DOORBELL_CONTROL_DEFAULT 0x00000000 +#define regCP_HQD_PQ_RPTR_DEFAULT 0x00000000 +#define regCP_HQD_PERSISTENT_STATE_DEFAULT 0x0be05501 +#define regCP_HQD_IB_CONTROL_DEFAULT 0x00300000 +MODULE_FIRMWARE ("amdgpu/gc_11_0_0_pfp.bin" );MODULE_FIRMWARE ("amdgpu/gc_11_0_0_me.bin" );MODULE_FIRMWARE ("amdgpu/gc_11_0_0_mec.bin" );
@@ -3896,7 +3913,7 @@ static void gfx_v11_0_gfx_mqd_set_priority(struct amdgpu_device *adev,if (prop->hqd_pipe_priority ==AMDGPU_GFX_PIPE_PRIO_HIGH ) priority =1 ; - tmp =RREG32_SOC15 (GC ,0 , regCP_GFX_HQD_QUEUE_PRIORITY); + tmp = regCP_GFX_HQD_QUEUE_PRIORITY_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_GFX_HQD_QUEUE_PRIORITY ,PRIORITY_LEVEL , priority); mqd->cp_gfx_hqd_queue_priority = tmp; }
@@ -3918,14 +3935,14 @@ static int gfx_v11_0_gfx_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_mqd_base_addr_hi =upper_32_bits (prop->mqd_gpu_addr);/* set up mqd control */ - tmp =RREG32_SOC15 (GC ,0 , regCP_GFX_MQD_CONTROL); + tmp = regCP_GFX_MQD_CONTROL_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_GFX_MQD_CONTROL ,VMID ,0 ); tmp =REG_SET_FIELD (tmp,CP_GFX_MQD_CONTROL ,PRIV_STATE ,1 ); tmp =REG_SET_FIELD (tmp,CP_GFX_MQD_CONTROL ,CACHE_POLICY ,0 ); mqd->cp_gfx_mqd_control = tmp;/* set up gfx_hqd_vimd with 0x0 to indicate the ring buffer's vmid */ - tmp =RREG32_SOC15 (GC ,0 , regCP_GFX_HQD_VMID); + tmp = regCP_GFX_HQD_VMID_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_GFX_HQD_VMID ,VMID ,0 ); mqd->cp_gfx_hqd_vmid =0 ;
@@ -3933,7 +3950,7 @@ static int gfx_v11_0_gfx_mqd_init(struct amdgpu_device *adev, void *m,gfx_v11_0_gfx_mqd_set_priority (adev, mqd, prop);/* set up time quantum */ - tmp =RREG32_SOC15 (GC ,0 , regCP_GFX_HQD_QUANTUM); + tmp = regCP_GFX_HQD_QUANTUM_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_GFX_HQD_QUANTUM ,QUANTUM_EN ,1 ); mqd->cp_gfx_hqd_quantum = tmp;
@@ -3955,7 +3972,7 @@ static int gfx_v11_0_gfx_mqd_init(struct amdgpu_device *adev, void *m,/* set up the gfx_hqd_control, similar as CP_RB0_CNTL */ rb_bufsz =order_base_2 (prop->queue_size /4 ) -1 ; - tmp =RREG32_SOC15 (GC ,0 , regCP_GFX_HQD_CNTL); + tmp = regCP_GFX_HQD_CNTL_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_GFX_HQD_CNTL ,RB_BUFSZ , rb_bufsz); tmp =REG_SET_FIELD (tmp,CP_GFX_HQD_CNTL ,RB_BLKSZ , rb_bufsz -2 );#ifdef __BIG_ENDIAN
@@ -3964,7 +3981,7 @@ static int gfx_v11_0_gfx_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_gfx_hqd_cntl = tmp;/* set up cp_doorbell_control */ - tmp =RREG32_SOC15 (GC ,0 , regCP_RB_DOORBELL_CONTROL); + tmp = regCP_RB_DOORBELL_CONTROL_DEFAULT;if (prop->use_doorbell) { tmp =REG_SET_FIELD (tmp,CP_RB_DOORBELL_CONTROL ,DOORBELL_OFFSET , prop->doorbell_index);
@@ -3976,7 +3993,7 @@ static int gfx_v11_0_gfx_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_rb_doorbell_control = tmp;/* reset read and write pointers, similar to CP_RB0_WPTR/_RPTR */ - mqd->cp_gfx_hqd_rptr =RREG32_SOC15 (GC ,0 , regCP_GFX_HQD_RPTR); + mqd->cp_gfx_hqd_rptr = regCP_GFX_HQD_RPTR_DEFAULT;/* active the queue */ mqd->cp_gfx_hqd_active =1 ;
@@ -4062,14 +4079,14 @@ static int gfx_v11_0_compute_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_hqd_eop_base_addr_hi =upper_32_bits (eop_base_addr);/* set the EOP size, register value is 2^(EOP_SIZE+1) dwords */ - tmp =RREG32_SOC15 (GC ,0 , regCP_HQD_EOP_CONTROL); + tmp = regCP_HQD_EOP_CONTROL_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_HQD_EOP_CONTROL ,EOP_SIZE , (order_base_2 (GFX11_MEC_HPD_SIZE /4 ) -1 )); mqd->cp_hqd_eop_control = tmp;/* enable doorbell? */ - tmp =RREG32_SOC15 (GC ,0 , regCP_HQD_PQ_DOORBELL_CONTROL); + tmp = regCP_HQD_PQ_DOORBELL_CONTROL_DEFAULT;if (prop->use_doorbell) { tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_DOORBELL_CONTROL,
@@ -4098,7 +4115,7 @@ static int gfx_v11_0_compute_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_mqd_base_addr_hi =upper_32_bits (prop->mqd_gpu_addr);/* set MQD vmid to 0 */ - tmp =RREG32_SOC15 (GC ,0 , regCP_MQD_CONTROL); + tmp = regCP_MQD_CONTROL_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_MQD_CONTROL ,VMID ,0 ); mqd->cp_mqd_control = tmp;
@@ -4108,7 +4125,7 @@ static int gfx_v11_0_compute_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_hqd_pq_base_hi =upper_32_bits (hqd_gpu_addr);/* set up the HQD, this is similar to CP_RB0_CNTL */ - tmp =RREG32_SOC15 (GC ,0 , regCP_HQD_PQ_CONTROL); + tmp = regCP_HQD_PQ_CONTROL_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_HQD_PQ_CONTROL ,QUEUE_SIZE , (order_base_2 (prop->queue_size /4 ) -1 )); tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, RPTR_BLOCK_SIZE,
@@ -4134,7 +4151,7 @@ static int gfx_v11_0_compute_mqd_init(struct amdgpu_device *adev, void *m, tmp =0 ;/* enable the doorbell if requested */ if (prop->use_doorbell) { - tmp =RREG32_SOC15 (GC ,0 , regCP_HQD_PQ_DOORBELL_CONTROL); + tmp = regCP_HQD_PQ_DOORBELL_CONTROL_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_HQD_PQ_DOORBELL_CONTROL ,DOORBELL_OFFSET , prop->doorbell_index);
@@ -4149,17 +4166,17 @@ static int gfx_v11_0_compute_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_hqd_pq_doorbell_control = tmp;/* reset read and write pointers, similar to CP_RB0_WPTR/_RPTR */ - mqd->cp_hqd_pq_rptr =RREG32_SOC15 (GC ,0 , regCP_HQD_PQ_RPTR); + mqd->cp_hqd_pq_rptr = regCP_HQD_PQ_RPTR_DEFAULT;/* set the vmid for the queue */ mqd->cp_hqd_vmid =0 ; - tmp =RREG32_SOC15 (GC ,0 , regCP_HQD_PERSISTENT_STATE); + tmp = regCP_HQD_PERSISTENT_STATE_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_HQD_PERSISTENT_STATE ,PRELOAD_SIZE ,0x55 ); mqd->cp_hqd_persistent_state = tmp;/* set MIN_IB_AVAIL_SIZE */ - tmp =RREG32_SOC15 (GC ,0 , regCP_HQD_IB_CONTROL); + tmp = regCP_HQD_IB_CONTROL_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_HQD_IB_CONTROL ,MIN_IB_AVAIL_SIZE ,3 ); mqd->cp_hqd_ib_control = tmp;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 122/486 drm/amdgpu: Update SRIOV video codec caps
In reply to Sasha LevinFrom: David Rosca <[email protected]>
[ Upstream commit 19478f2011f8b53dee401c91423c4e0b73753e4f ]
There have been multiple fixes to the video caps that are missing for SRIOV. Update the SRIOV caps with correct values.
--- drivers/gpu/drm/amd/amdgpu/nv.c | 16 ++++++++-------- drivers/gpu/drm/amd/amdgpu/soc21.c | 10 ++-------- 2 files changed, 10 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/amdgpu/nv.c +8 -8
@@ -141,23 +141,23 @@ static struct amdgpu_video_codec_info sriov_sc_video_codecs_encode_array[] = { };static struct amdgpu_video_codec_info sriov_sc_video_codecs_decode_array_vcn0[] = { - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2 ,4096 ,4096 ,3 )}, - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4 ,4096 ,4096 ,5 )}, + {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2 ,1920 ,1088 ,3 )}, + {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4 ,1920 ,1088 ,5 )}, {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC ,4096 ,4096 ,52 )}, - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1 ,4096 ,4096 ,4 )}, + {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1 ,1920 ,1088 ,4 )}, {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC ,8192 ,4352 ,186 )}, - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG ,4096 ,4096 ,0 )}, + {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG ,16384 ,16384 ,0 )}, {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9 ,8192 ,4352 ,0 )}, {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1 ,8192 ,4352 ,0 )}, };static struct amdgpu_video_codec_info sriov_sc_video_codecs_decode_array_vcn1[] = { - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2 ,4096 ,4096 ,3 )}, - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4 ,4096 ,4096 ,5 )}, + {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2 ,1920 ,1088 ,3 )}, + {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4 ,1920 ,1088 ,5 )}, {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC ,4096 ,4096 ,52 )}, - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1 ,4096 ,4096 ,4 )}, + {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1 ,1920 ,1088 ,4 )}, {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC ,8192 ,4352 ,186 )}, - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG ,4096 ,4096 ,0 )}, + {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG ,16384 ,16384 ,0 )}, {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9 ,8192 ,4352 ,0 )}, };
drivers/gpu/drm/amd/amdgpu/soc21.c +2 -8
@@ -117,23 +117,17 @@ static struct amdgpu_video_codecs sriov_vcn_4_0_0_video_codecs_encode_vcn1 = { };static struct amdgpu_video_codec_info sriov_vcn_4_0_0_video_codecs_decode_array_vcn0[] = { - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2 ,4096 ,4096 ,3 )}, - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4 ,4096 ,4096 ,5 )}, {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC ,4096 ,4096 ,52 )}, - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1 ,4096 ,4096 ,4 )}, {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC ,8192 ,4352 ,186 )}, - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG ,4096 ,4096 ,0 )}, + {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG ,16384 ,16384 ,0 )}, {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9 ,8192 ,4352 ,0 )}, {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1 ,8192 ,4352 ,0 )}, };static struct amdgpu_video_codec_info sriov_vcn_4_0_0_video_codecs_decode_array_vcn1[] = { - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2 ,4096 ,4096 ,3 )}, - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4 ,4096 ,4096 ,5 )}, {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC ,4096 ,4096 ,52 )}, - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1 ,4096 ,4096 ,4 )}, {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC ,8192 ,4352 ,186 )}, - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG ,4096 ,4096 ,0 )}, + {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG ,16384 ,16384 ,0 )}, {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9 ,8192 ,4352 ,0 )}, };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 123/486 ASoC: sun4i-codec: support hp-det-gpios property
In reply to Sasha LevinFrom: Ryan Walklin <[email protected]>
[ Upstream commit a149377c033afe6557c50892ebbfc0e8b7e2e253 ]
Add support for GPIO headphone detection with the hp-det-gpios property. In order for this to properly disable the path upon removal of headphones, the output must be labelled Headphone which is a common sink in the driver.
Describe a headphone jack and detection GPIO in the driver, check for a corresponding device tree node, and enable jack detection in a new machine init function if described.
--
Changelog v1..v2:
- Separate DAPM changes into separate patch and add rationale.
--- sound/soc/sunxi/sun4i-codec.c | 53 +++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+)
sound/soc/sunxi/sun4i-codec.c +53 -0
@@ -21,6 +21,7 @@#include <linux/gpio/consumer.h> #include <sound/core.h> +#include <sound/jack.h> #include <sound/pcm.h> #include <sound/pcm_params.h> #include <sound/soc.h>
@@ -235,6 +236,7 @@ struct sun4i_codec {struct clk *clk_module;struct reset_control *rst;struct gpio_desc *gpio_pa; +struct gpio_desc *gpio_hp;/* ADC_FIFOC register is at different offset on different SoCs */ struct regmap_field *reg_adc_fifoc;
@@ -1263,6 +1265,49 @@ static struct snd_soc_dai_driver dummy_cpu_dai = { .ops = &dummy_dai_ops, }; +static struct snd_soc_jack sun4i_headphone_jack; + +static struct snd_soc_jack_pin sun4i_headphone_jack_pins[] = { + { .pin ="Headphone" , .mask =SND_JACK_HEADPHONE }, +}; + +static struct snd_soc_jack_gpio sun4i_headphone_jack_gpio = { + .name ="hp-det" , + .report =SND_JACK_HEADPHONE , + .debounce_time =150 , +}; + +static int sun4i_codec_machine_init (struct snd_soc_pcm_runtime *rtd) +{ +struct snd_soc_card *card = rtd->card; +struct sun4i_codec *scodec =snd_soc_card_get_drvdata (card); +int ret; + +if (scodec->gpio_hp) { + ret =snd_soc_card_jack_new_pins (card,"Headphone Jack" , +SND_JACK_HEADPHONE , + &sun4i_headphone_jack, + sun4i_headphone_jack_pins, +ARRAY_SIZE (sun4i_headphone_jack_pins)); +if (ret) { +dev_err (rtd->dev, +"Headphone jack creation failed: %d\n" , ret); +return ret; + } + + sun4i_headphone_jack_gpio.desc = scodec->gpio_hp; + ret =snd_soc_jack_add_gpios (&sun4i_headphone_jack,1 , + &sun4i_headphone_jack_gpio); + +if (ret) { +dev_err (rtd->dev,"Headphone GPIO not added: %d\n" , ret); +return ret; + } + } + +return 0 ; +} +static struct snd_soc_dai_link *sun4i_codec_create_link (struct device *dev,int *num_links) {
@@ -1288,6 +1333,7 @@ static struct snd_soc_dai_link *sun4i_codec_create_link(struct device *dev, link->codecs->name =dev_name (dev); link->platforms->name =dev_name (dev); link->dai_fmt =SND_SOC_DAIFMT_I2S ; + link->init = sun4i_codec_machine_init; *num_links =1 ;
@@ -1728,6 +1774,13 @@ static int sun4i_codec_probe(struct platform_device *pdev)return ret; } + scodec->gpio_hp =devm_gpiod_get_optional (&pdev->dev,"hp-det" ,GPIOD_IN ); +if (IS_ERR (scodec->gpio_hp)) { + ret =PTR_ERR (scodec->gpio_hp); +dev_err_probe (&pdev->dev, ret,"Failed to get hp-det gpio\n" ); +return ret; + } +/* reg_field setup */ scodec->reg_adc_fifoc = devm_regmap_field_alloc(&pdev->dev, scodec->regmap,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 124/486 clk: qcom: lpassaudiocc-sc7280: Add support for LPASS resets for QCM6490
In reply to Sasha LevinFrom: Taniya Das <[email protected]>
[ Upstream commit cdbbc480f4146cb659af97f4020601fde5fb65a7 ]
On the QCM6490 boards, the LPASS firmware controls the complete clock controller functionalities and associated power domains. However, only the LPASS resets required to be controlled by the high level OS. Thus, add support for the resets in the clock driver to enable the Audio SW driver to assert/deassert the audio resets as needed.
--- drivers/clk/qcom/lpassaudiocc-sc7280.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)
drivers/clk/qcom/lpassaudiocc-sc7280.c +19 -4
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2021, The Linux Foundation. All rights reserved. +* Copyright (c) 2025, Qualcomm Innovation Center, Inc. All rights reserved. */ #include <linux/clk-provider.h>
@@ -713,14 +714,24 @@ static const struct qcom_reset_map lpass_audio_cc_sc7280_resets[] = { [LPASS_AUDIO_SWR_WSA_CGCR] = { 0xb0, 1 }, }; +static const struct regmap_config lpass_audio_cc_sc7280_reset_regmap_config = { + .name ="lpassaudio_cc_reset" , + .reg_bits =32 , + .reg_stride =4 , + .val_bits =32 , + .fast_io = true, + .max_register =0xc8 , +}; +static const struct qcom_cc_desc lpass_audio_cc_reset_sc7280_desc = { - .config = &lpass_audio_cc_sc7280_regmap_config, + .config = &lpass_audio_cc_sc7280_reset_regmap_config, .resets = lpass_audio_cc_sc7280_resets, .num_resets =ARRAY_SIZE (lpass_audio_cc_sc7280_resets), };static const struct of_device_id lpass_audio_cc_sc7280_match_table[] = { - { .compatible ="qcom,sc7280-lpassaudiocc" }, + { .compatible ="qcom,qcm6490-lpassaudiocc" , .data = &lpass_audio_cc_reset_sc7280_desc }, + { .compatible ="qcom,sc7280-lpassaudiocc" , .data = &lpass_audio_cc_sc7280_desc }, { } };MODULE_DEVICE_TABLE (of, lpass_audio_cc_sc7280_match_table);
@@ -752,13 +763,17 @@ static int lpass_audio_cc_sc7280_probe(struct platform_device *pdev)struct regmap *regmap;int ret; + desc =device_get_match_data (&pdev->dev); + +if (of_device_is_compatible (pdev->dev.of_node,"qcom,qcm6490-lpassaudiocc" )) +return qcom_cc_probe_by_index (pdev,1 , desc); + ret =lpass_audio_setup_runtime_pm (pdev);if (ret)return ret; lpass_audio_cc_sc7280_regmap_config.name ="lpassaudio_cc" ; lpass_audio_cc_sc7280_regmap_config.max_register =0x2f000 ; - desc = &lpass_audio_cc_sc7280_desc; regmap =qcom_cc_map (pdev, desc);if (IS_ERR (regmap)) {
@@ -772,7 +787,7 @@ static int lpass_audio_cc_sc7280_probe(struct platform_device *pdev)regmap_write (regmap,0x4 ,0x3b );regmap_write (regmap,0x8 ,0xff05 ); - ret =qcom_cc_really_probe (&pdev->dev, &lpass_audio_cc_sc7280_desc, regmap); + ret =qcom_cc_really_probe (&pdev->dev, desc, regmap);if (ret) {dev_err (&pdev->dev,"Failed to register LPASS AUDIO CC clocks\n" ); goto exit;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 125/486 f2fs: defer readonly check vs norecovery
In reply to Sasha LevinFrom: Eric Sandeen <[email protected]>
[ Upstream commit 9cca49875997a1a7e92800a828a62bacb0f577b9 ]
Defer the readonly-vs-norecovery check until after option parsing is done so that option parsing does not require an active superblock for the test. Add a helpful message, while we're at it.
(I think could be moved back into parsing after we switch to the new mount API if desired, as the fs context will have RO state available.)
--- fs/f2fs/super.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
fs/f2fs/super.c +7 -3
@@ -728,10 +728,8 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)set_opt (sbi,DISABLE_ROLL_FORWARD );break ;case Opt_norecovery: -/* this option mounts f2fs with ro */ +/* requires ro mount, checked in f2fs_default_check */ set_opt (sbi,NORECOVERY ); -if (!f2fs_readonly (sb)) -return -EINVAL ;break ;case Opt_discard:if (!f2fs_hw_support_discard (sbi)) {
@@ -1406,6 +1404,12 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)f2fs_err (sbi,"Allow to mount readonly mode only" );return -EROFS ; } + +if (test_opt (sbi,NORECOVERY ) && !f2fs_readonly (sbi->sb)) { +f2fs_err (sbi,"norecovery requires readonly mount" ); +return -EINVAL ; + } +return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 126/486 ext4: reject the 'data_err=abort' option in nojournal mode
In reply to Sasha LevinFrom: Baokun Li <[email protected]>
[ Upstream commit 26343ca0df715097065b02a6cddb4a029d5b9327 ]
data_err=abort aborts the journal on I/O errors. However, this option is meaningless if journal is disabled, so it is rejected in nojournal mode to reduce unnecessary checks. Also, this option is ignored upon remount.
--- fs/ext4/super.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
fs/ext4/super.c +12 -0
@@ -2787,6 +2787,13 @@ static int ext4_check_opt_consistency(struct fs_context *fc, }if (is_remount) { +if (!sbi->s_journal && +ctx_test_mount_opt (ctx,EXT4_MOUNT_DATA_ERR_ABORT )) { +ext4_msg (NULL ,KERN_WARNING , +"Remounting fs w/o journal so ignoring data_err option" ); +ctx_clear_mount_opt (ctx,EXT4_MOUNT_DATA_ERR_ABORT ); + } +if (ctx_test_mount_opt (ctx,EXT4_MOUNT_DAX_ALWAYS ) && (test_opt (sb,DATA_FLAGS ) ==EXT4_MOUNT_JOURNAL_DATA )) { ext4_msg(NULL, KERN_ERR, "can't mount with "
@@ -5396,6 +5403,11 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb) "data=, fs mounted w/o journal"); goto failed_mount3a; } +if (test_opt (sb,DATA_ERR_ABORT )) { +ext4_msg (sb,KERN_ERR , +"can't mount with data_err=abort, fs mounted w/o journal" ); + goto failed_mount3a; + } sbi->s_def_mount_opt &= ~EXT4_MOUNT_JOURNAL_CHECKSUM ;clear_opt (sb,JOURNAL_CHECKSUM );clear_opt (sb,DATA_FLAGS );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 127/486 ext4: do not convert the unwritten extents if data writeback fails
In reply to Sasha LevinFrom: Baokun Li <[email protected]>
[ Upstream commit e856f93e0fb249955f7d5efb18fe20500a9ccc6d ]
When dioread_nolock is turned on (the default), it will convert unwritten extents to written at ext4_end_io_end(), even if the data writeback fails.
It leads to the possibility that stale data may be exposed when the physical block corresponding to the file data is read-only (i.e., writes return -EIO, but reads are normal).
Therefore a new ext4_io_end->flags EXT4_IO_END_FAILED is added, which indicates that some bio write-back failed in the current ext4_io_end. When this flag is set, the unwritten to written conversion is no longer performed. Users can read the data normally until the caches are dropped, after that, the failed extents can only be read to all 0.
--- fs/ext4/ext4.h | 3 ++- fs/ext4/page-io.c | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-)
fs/ext4/ext4.h +2 -1
@@ -278,7 +278,8 @@ struct ext4_system_blocks {/* * Flags for ext4_io_end->flags */ -#define EXT4_IO_END_UNWRITTEN 0x0001 +#define EXT4_IO_END_UNWRITTEN 0x0001 +#define EXT4_IO_END_FAILED 0x0002struct ext4_io_end_vec {struct list_head list;/* list of io_end_vec */
fs/ext4/page-io.c +14 -2
@@ -181,14 +181,25 @@ static int ext4_end_io_end(ext4_io_end_t *io_end)"list->prev 0x%p\n" , io_end, inode->i_ino, io_end->list.next, io_end->list.prev); - io_end->handle =NULL ;/* Following call will use up the handle */ - ret =ext4_convert_unwritten_io_end_vec (handle, io_end); +/* +* Do not convert the unwritten extents if data writeback fails, +* or stale data may be exposed. +*/ + io_end->handle =NULL ;/* Following call will use up the handle */ +if (unlikely (io_end->flag &EXT4_IO_END_FAILED )) { + ret = -EIO ; +if (handle) +jbd2_journal_free_reserved (handle); + }else { + ret =ext4_convert_unwritten_io_end_vec (handle, io_end); + }if (ret <0 && !ext4_forced_shutdown (inode->i_sb)) {ext4_msg (inode->i_sb,KERN_EMERG ,"failed to convert unwritten extents to written " "extents -- potential data loss! " "(inode %lu, error %d)" , inode->i_ino, ret); } +ext4_clear_io_unwritten_flag (io_end);ext4_release_io_end (io_end);return ret;
@@ -344,6 +355,7 @@ static void ext4_end_bio(struct bio *bio) bio->bi_status, inode->i_ino, (unsigned long long ) bi_sector >> (inode->i_blkbits - 9)); + io_end->flag |=EXT4_IO_END_FAILED ;mapping_set_error (inode->i_mapping,blk_status_to_errno (bio->bi_status)); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 128/486 RDMA/uverbs: Propagate errors from rdma_lookup_get_uobject()
In reply to Sasha LevinFrom: Maher Sanalla <[email protected]>
[ Upstream commit 81f8f7454ad9e0bf95efdec6542afdc9a6ab1e24 ]
Currently, the IB uverbs API calls uobj_get_uobj_read(), which in turn uses the rdma_lookup_get_uobject() helper to retrieve user objects. In case of failure, uobj_get_uobj_read() returns NULL, overriding the error code from rdma_lookup_get_uobject(). The IB uverbs API then translates this NULL to -EINVAL, masking the actual error and complicating debugging. For example, applications calling ibv_modify_qp that fails with EBUSY when retrieving the QP uobject will see the overridden error code EINVAL instead, masking the actual error.
Furthermore, based on rdma-core commit:
"2a22f1ced5f3 ("Merge pull request #1568 from jakemoroni/master")" Kernel's IB uverbs return values are either ignored and passed on as is to application or overridden with other errnos in a few cases.
Thus, to improve error reporting and debuggability, propagate the original error from rdma_lookup_get_uobject() instead of replacing it with EINVAL.
--- drivers/infiniband/core/uverbs_cmd.c | 144 ++++++++++++++------------- include/rdma/uverbs_std_types.h | 2 +- 2 files changed, 77 insertions(+), 69 deletions(-)
drivers/infiniband/core/uverbs_cmd.c +76 -68
@@ -718,8 +718,8 @@ static int ib_uverbs_reg_mr(struct uverbs_attr_bundle *attrs) goto err_free; pd =uobj_get_obj_read (pd,UVERBS_OBJECT_PD , cmd.pd_handle, attrs); -if (!pd) { - ret = -EINVAL ; +if (IS_ERR (pd)) { + ret =PTR_ERR (pd); goto err_free; }
@@ -809,8 +809,8 @@ static int ib_uverbs_rereg_mr(struct uverbs_attr_bundle *attrs)if (cmd.flags &IB_MR_REREG_PD ) { new_pd =uobj_get_obj_read (pd,UVERBS_OBJECT_PD , cmd.pd_handle, attrs); -if (!new_pd) { - ret = -EINVAL ; +if (IS_ERR (new_pd)) { + ret =PTR_ERR (new_pd); goto put_uobjs; } }else {
@@ -919,8 +919,8 @@ static int ib_uverbs_alloc_mw(struct uverbs_attr_bundle *attrs)return PTR_ERR (uobj); pd =uobj_get_obj_read (pd,UVERBS_OBJECT_PD , cmd.pd_handle, attrs); -if (!pd) { - ret = -EINVAL ; +if (IS_ERR (pd)) { + ret =PTR_ERR (pd); goto err_free; }
@@ -1127,8 +1127,8 @@ static int ib_uverbs_resize_cq(struct uverbs_attr_bundle *attrs)return ret; cq =uobj_get_obj_read (cq,UVERBS_OBJECT_CQ , cmd.cq_handle, attrs); -if (!cq) -return -EINVAL ; +if (IS_ERR (cq)) +return PTR_ERR (cq); ret = cq->device->ops.resize_cq (cq, cmd.cqe, &attrs->driver_udata);if (ret)
@@ -1189,8 +1189,8 @@ static int ib_uverbs_poll_cq(struct uverbs_attr_bundle *attrs)return ret; cq =uobj_get_obj_read (cq,UVERBS_OBJECT_CQ , cmd.cq_handle, attrs); -if (!cq) -return -EINVAL ; +if (IS_ERR (cq)) +return PTR_ERR (cq);/* we copy a struct ib_uverbs_poll_cq_resp to user space */ header_ptr = attrs->ucore.outbuf;
@@ -1238,8 +1238,8 @@ static int ib_uverbs_req_notify_cq(struct uverbs_attr_bundle *attrs)return ret; cq =uobj_get_obj_read (cq,UVERBS_OBJECT_CQ , cmd.cq_handle, attrs); -if (!cq) -return -EINVAL ; +if (IS_ERR (cq)) +return PTR_ERR (cq);ib_req_notify_cq (cq, cmd.solicited_only ?IB_CQ_SOLICITED :IB_CQ_NEXT_COMP );
@@ -1321,8 +1321,8 @@ static int create_qp(struct uverbs_attr_bundle *attrs, ind_tbl =uobj_get_obj_read (rwq_ind_table,UVERBS_OBJECT_RWQ_IND_TBL , cmd->rwq_ind_tbl_handle, attrs); -if (!ind_tbl) { - ret = -EINVAL ; +if (IS_ERR (ind_tbl)) { + ret =PTR_ERR (ind_tbl); goto err_put; }
@@ -1360,8 +1360,10 @@ static int create_qp(struct uverbs_attr_bundle *attrs,if (cmd->is_srq) { srq =uobj_get_obj_read (srq,UVERBS_OBJECT_SRQ , cmd->srq_handle, attrs); -if (!srq || srq->srq_type ==IB_SRQT_XRC ) { - ret = -EINVAL ; +if (IS_ERR (srq) || + srq->srq_type ==IB_SRQT_XRC ) { + ret =IS_ERR (srq) ?PTR_ERR (srq) : + -EINVAL ; goto err_put; } }
@@ -1371,23 +1373,29 @@ static int create_qp(struct uverbs_attr_bundle *attrs, rcq =uobj_get_obj_read ( cq,UVERBS_OBJECT_CQ , cmd->recv_cq_handle, attrs); -if (!rcq) { - ret = -EINVAL ; +if (IS_ERR (rcq)) { + ret =PTR_ERR (rcq); goto err_put; } } } } -if (has_sq) +if (has_sq) { scq =uobj_get_obj_read (cq,UVERBS_OBJECT_CQ , cmd->send_cq_handle, attrs); +if (IS_ERR (scq)) { + ret =PTR_ERR (scq); + goto err_put; + } + } +if (!ind_tbl && cmd->qp_type !=IB_QPT_XRC_INI ) rcq = rcq ?: scq; pd =uobj_get_obj_read (pd,UVERBS_OBJECT_PD , cmd->pd_handle, attrs); -if (!pd || (!scq && has_sq)) { - ret = -EINVAL ; +if (IS_ERR (pd)) { + ret =PTR_ERR (pd); goto err_put; }
@@ -1482,18 +1490,18 @@ static int create_qp(struct uverbs_attr_bundle *attrs, err_put:if (!IS_ERR (xrcd_uobj))uobj_put_read (xrcd_uobj); -if (pd) +if (!IS_ERR_OR_NULL (pd))uobj_put_obj_read (pd); -if (scq) +if (!IS_ERR_OR_NULL (scq))rdma_lookup_put_uobject (&scq->uobject->uevent.uobject,UVERBS_LOOKUP_READ ); -if (rcq && rcq != scq) +if (!IS_ERR_OR_NULL (rcq) && rcq != scq)rdma_lookup_put_uobject (&rcq->uobject->uevent.uobject,UVERBS_LOOKUP_READ ); -if (srq) +if (!IS_ERR_OR_NULL (srq))rdma_lookup_put_uobject (&srq->uobject->uevent.uobject,UVERBS_LOOKUP_READ ); -if (ind_tbl) +if (!IS_ERR_OR_NULL (ind_tbl))uobj_put_obj_read (ind_tbl);uobj_alloc_abort (&obj->uevent.uobject, attrs);
@@ -1655,8 +1663,8 @@ static int ib_uverbs_query_qp(struct uverbs_attr_bundle *attrs) } qp =uobj_get_obj_read (qp,UVERBS_OBJECT_QP , cmd.qp_handle, attrs); -if (!qp) { - ret = -EINVAL ; +if (IS_ERR (qp)) { + ret =PTR_ERR (qp); goto out; }
@@ -1761,8 +1769,8 @@ static int modify_qp(struct uverbs_attr_bundle *attrs, qp =uobj_get_obj_read (qp,UVERBS_OBJECT_QP , cmd->base.qp_handle, attrs); -if (!qp) { - ret = -EINVAL ; +if (IS_ERR (qp)) { + ret =PTR_ERR (qp); goto out; }
@@ -2028,8 +2036,8 @@ static int ib_uverbs_post_send(struct uverbs_attr_bundle *attrs)return -ENOMEM ; qp =uobj_get_obj_read (qp,UVERBS_OBJECT_QP , cmd.qp_handle, attrs); -if (!qp) { - ret = -EINVAL ; +if (IS_ERR (qp)) { + ret =PTR_ERR (qp); goto out; }
@@ -2066,9 +2074,9 @@ static int ib_uverbs_post_send(struct uverbs_attr_bundle *attrs) ud->ah =uobj_get_obj_read (ah,UVERBS_OBJECT_AH , user_wr->wr.ud.ah, attrs); -if (!ud->ah) { +if (IS_ERR (ud->ah)) { + ret =PTR_ERR (ud->ah);kfree (ud); - ret = -EINVAL ; goto out_put; } ud->remote_qpn = user_wr->wr.ud.remote_qpn;
@@ -2305,8 +2313,8 @@ static int ib_uverbs_post_recv(struct uverbs_attr_bundle *attrs)return PTR_ERR (wr); qp =uobj_get_obj_read (qp,UVERBS_OBJECT_QP , cmd.qp_handle, attrs); -if (!qp) { - ret = -EINVAL ; +if (IS_ERR (qp)) { + ret =PTR_ERR (qp); goto out; }
@@ -2356,8 +2364,8 @@ static int ib_uverbs_post_srq_recv(struct uverbs_attr_bundle *attrs)return PTR_ERR (wr); srq =uobj_get_obj_read (srq,UVERBS_OBJECT_SRQ , cmd.srq_handle, attrs); -if (!srq) { - ret = -EINVAL ; +if (IS_ERR (srq)) { + ret =PTR_ERR (srq); goto out; }
@@ -2413,8 +2421,8 @@ static int ib_uverbs_create_ah(struct uverbs_attr_bundle *attrs) } pd =uobj_get_obj_read (pd,UVERBS_OBJECT_PD , cmd.pd_handle, attrs); -if (!pd) { - ret = -EINVAL ; +if (IS_ERR (pd)) { + ret =PTR_ERR (pd); goto err; }
@@ -2483,8 +2491,8 @@ static int ib_uverbs_attach_mcast(struct uverbs_attr_bundle *attrs)return ret; qp =uobj_get_obj_read (qp,UVERBS_OBJECT_QP , cmd.qp_handle, attrs); -if (!qp) -return -EINVAL ; +if (IS_ERR (qp)) +return PTR_ERR (qp); obj = qp->uobject;
@@ -2533,8 +2541,8 @@ static int ib_uverbs_detach_mcast(struct uverbs_attr_bundle *attrs)return ret; qp =uobj_get_obj_read (qp,UVERBS_OBJECT_QP , cmd.qp_handle, attrs); -if (!qp) -return -EINVAL ; +if (IS_ERR (qp)) +return PTR_ERR (qp); obj = qp->uobject;mutex_lock (&obj->mcast_lock);
@@ -2668,8 +2676,8 @@ static int kern_spec_to_ib_spec_action(struct uverbs_attr_bundle *attrs,UVERBS_OBJECT_FLOW_ACTION , kern_spec->action.handle, attrs); -if (!ib_spec->action.act) -return -EINVAL ; +if (IS_ERR (ib_spec->action.act)) +return PTR_ERR (ib_spec->action.act); ib_spec->action.size =sizeof (struct ib_flow_spec_action_handle ); flow_resources_add(uflow_res,
@@ -2686,8 +2694,8 @@ static int kern_spec_to_ib_spec_action(struct uverbs_attr_bundle *attrs,UVERBS_OBJECT_COUNTERS , kern_spec->flow_count.handle, attrs); -if (!ib_spec->flow_count.counters) -return -EINVAL ; +if (IS_ERR (ib_spec->flow_count.counters)) +return PTR_ERR (ib_spec->flow_count.counters); ib_spec->flow_count.size =sizeof (struct ib_flow_spec_action_count ); flow_resources_add(uflow_res,
@@ -2905,14 +2913,14 @@ static int ib_uverbs_ex_create_wq(struct uverbs_attr_bundle *attrs)return PTR_ERR (obj); pd =uobj_get_obj_read (pd,UVERBS_OBJECT_PD , cmd.pd_handle, attrs); -if (!pd) { - err = -EINVAL ; +if (IS_ERR (pd)) { + err =PTR_ERR (pd); goto err_uobj; } cq =uobj_get_obj_read (cq,UVERBS_OBJECT_CQ , cmd.cq_handle, attrs); -if (!cq) { - err = -EINVAL ; +if (IS_ERR (cq)) { + err =PTR_ERR (cq); goto err_put_pd; }
@@ -3013,8 +3021,8 @@ static int ib_uverbs_ex_modify_wq(struct uverbs_attr_bundle *attrs)return -EINVAL ; wq =uobj_get_obj_read (wq,UVERBS_OBJECT_WQ , cmd.wq_handle, attrs); -if (!wq) -return -EINVAL ; +if (IS_ERR (wq)) +return PTR_ERR (wq);if (cmd.attr_mask &IB_WQ_FLAGS ) { wq_attr.flags = cmd.flags;
@@ -3097,8 +3105,8 @@ static int ib_uverbs_ex_create_rwq_ind_table(struct uverbs_attr_bundle *attrs) num_read_wqs++) { wq =uobj_get_obj_read (wq,UVERBS_OBJECT_WQ , wqs_handles[num_read_wqs], attrs); -if (!wq) { - err = -EINVAL ; +if (IS_ERR (wq)) { + err =PTR_ERR (wq); goto put_wqs; }
@@ -3253,8 +3261,8 @@ static int ib_uverbs_ex_create_flow(struct uverbs_attr_bundle *attrs) } qp =uobj_get_obj_read (qp,UVERBS_OBJECT_QP , cmd.qp_handle, attrs); -if (!qp) { - err = -EINVAL ; +if (IS_ERR (qp)) { + err =PTR_ERR (qp); goto err_uobj; }
@@ -3400,15 +3408,15 @@ static int __uverbs_create_xsrq(struct uverbs_attr_bundle *attrs,if (ib_srq_has_cq (cmd->srq_type)) { attr.ext.cq =uobj_get_obj_read (cq,UVERBS_OBJECT_CQ , cmd->cq_handle, attrs); -if (!attr.ext.cq) { - ret = -EINVAL ; +if (IS_ERR (attr.ext.cq)) { + ret =PTR_ERR (attr.ext.cq); goto err_put_xrcd; } } pd =uobj_get_obj_read (pd,UVERBS_OBJECT_PD , cmd->pd_handle, attrs); -if (!pd) { - ret = -EINVAL ; +if (IS_ERR (pd)) { + ret =PTR_ERR (pd); goto err_put_cq; }
@@ -3515,8 +3523,8 @@ static int ib_uverbs_modify_srq(struct uverbs_attr_bundle *attrs)return ret; srq =uobj_get_obj_read (srq,UVERBS_OBJECT_SRQ , cmd.srq_handle, attrs); -if (!srq) -return -EINVAL ; +if (IS_ERR (srq)) +return PTR_ERR (srq); attr.max_wr = cmd.max_wr; attr.srq_limit = cmd.srq_limit;
@@ -3543,8 +3551,8 @@ static int ib_uverbs_query_srq(struct uverbs_attr_bundle *attrs)return ret; srq =uobj_get_obj_read (srq,UVERBS_OBJECT_SRQ , cmd.srq_handle, attrs); -if (!srq) -return -EINVAL ; +if (IS_ERR (srq)) +return PTR_ERR (srq); ret =ib_query_srq (srq, &attr);
@@ -3669,8 +3677,8 @@ static int ib_uverbs_ex_modify_cq(struct uverbs_attr_bundle *attrs)return -EOPNOTSUPP ; cq =uobj_get_obj_read (cq,UVERBS_OBJECT_CQ , cmd.cq_handle, attrs); -if (!cq) -return -EINVAL ; +if (IS_ERR (cq)) +return PTR_ERR (cq); ret =rdma_set_cq_moderation (cq, cmd.attr.cq_count, cmd.attr.cq_period);
include/rdma/uverbs_std_types.h +1 -1
@@ -34,7 +34,7 @@static inline void *_uobj_get_obj_read (struct ib_uobject *uobj) {if (IS_ERR (uobj)) -return NULL ; +return ERR_CAST (uobj);return uobj->object; }#define uobj_get_obj_read (_object, _type, _id, _attrs) \
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 129/486 posix-timers: Add cond_resched() to posix_timer_add() search loop
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit 5f2909c6cd13564a07ae692a95457f52295c4f22 ]
With a large number of POSIX timers the search for a valid ID might cause a soft lockup on PREEMPT_NONE/VOLUNTARY kernels.
Add cond_resched() to the loop to prevent that.
[ tglx: Split out from Eric's series ]
--- kernel/time/posix-timers.c | 1 + 1 file changed, 1 insertion(+)
kernel/time/posix-timers.c +1 -0
@@ -118,6 +118,7 @@ static int posix_timer_add(struct k_itimer *timer)return id; }spin_unlock (&hash_lock); +cond_resched (); }/* POSIX return code when no timer ID could be allocated */ return -EAGAIN ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 130/486 posix-timers: Ensure that timer initialization is fully visible
In reply to Sasha LevinFrom: Thomas Gleixner <[email protected]>
[ Upstream commit 2389c6efd3ad8edb3bcce0019b4edcc7d9c7de19 ]
Frederic pointed out that the memory operations to initialize the timer are not guaranteed to be visible, when __lock_timer() observes timer::it_signal valid under timer::it_lock:
T0 T1
--------- -----------
do_timer_create()
// A
new_timer->.... = ....
spin_lock(current->sighand)
// B
WRITE_ONCE(new_timer->it_signal, current->signal)
spin_unlock(current->sighand)
sys_timer_*()
t = __lock_timer()
spin_lock(&timr->it_lock)
// observes B
if (timr->it_signal == current->signal)
return timr;
if (!t)
return;
// Is not guaranteed to observe AProtect the write of timer::it_signal, which makes the timer valid, with timer::it_lock as well. This guarantees that T1 must observe the initialization A completely, when it observes the valid signal pointer under timer::it_lock. sighand::siglock must still be taken to protect the signal::posix_timers list.
--- kernel/time/posix-timers.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
kernel/time/posix-timers.c +14 -7
@@ -514,14 +514,21 @@ static int do_timer_create(clockid_t which_clock, struct sigevent *event,if (error) goto out; -spin_lock_irq (¤t->sighand->siglock); -/* This makes the timer valid in the hash table */ -WRITE_ONCE (new_timer->it_signal, current->signal); -hlist_add_head (&new_timer->list, ¤t->signal->posix_timers); -spin_unlock_irq (¤t->sighand->siglock);/* -* After unlocking sighand::siglock @new_timer is subject to -* concurrent removal and cannot be touched anymore +* timer::it_lock ensures that __lock_timer() observes a fully +* initialized timer when it observes a valid timer::it_signal. +* +* sighand::siglock is required to protect signal::posix_timers. +*/ + scoped_guard (spinlock_irq, &new_timer->it_lock) { +guard (spinlock)(¤t->sighand->siglock); +/* This makes the timer valid in the hash table */ +WRITE_ONCE (new_timer->it_signal, current->signal); +hlist_add_head (&new_timer->list, ¤t->signal->posix_timers); + } +/* +* After unlocking @new_timer is subject to concurrent removal and +* cannot be touched anymore */ return 0 ; out:
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 131/486 net: stmmac: dwmac-rk: Validate GRF and peripheral GRF during probe
In reply to Sasha LevinFrom: Jonas Karlman <[email protected]>
[ Upstream commit 247e84f66a3d1946193d739fec5dc3d69833fd00 ]
All Rockchip GMAC variants typically write to GRF regs to control e.g. interface mode, speed and MAC rx/tx delay. Newer SoCs such as RK3576 and RK3588 use a mix of GRF and peripheral GRF regs. These syscon regmaps is located with help of a rockchip,grf and rockchip,php-grf phandle.
However, validating the rockchip,grf and rockchip,php-grf syscon regmap is deferred until e.g. interface mode or speed is configured, inside the individual SoC specific operations.
Change to validate the rockchip,grf and rockchip,php-grf syscon regmap at probe time to simplify all SoC specific operations.
This should not introduce any backward compatibility issues as all GMAC nodes have been added together with a rockchip,grf phandle (and rockchip,php-grf where required) in their initial commit.
--- .../net/ethernet/stmicro/stmmac/dwmac-rk.c | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +19 -2
@@ -33,6 +33,7 @@ struct rk_gmac_ops {void (*set_clock_selection)(struct rk_priv_data *bsp_priv,bool input,bool enable);void (*integrated_phy_powerup)(struct rk_priv_data *bsp_priv); +bool php_grf_required;bool regs_valid;u32 regs[]; };
@@ -1263,6 +1264,7 @@ static const struct rk_gmac_ops rk3576_ops = { .set_rgmii_speed = rk3576_set_gmac_speed, .set_rmii_speed = rk3576_set_gmac_speed, .set_clock_selection = rk3576_set_clock_selection, + .php_grf_required = true, .regs_valid = true, .regs = { 0x2a220000, /* gmac0 */
@@ -1410,6 +1412,7 @@ static const struct rk_gmac_ops rk3588_ops = { .set_rgmii_speed = rk3588_set_gmac_speed, .set_rmii_speed = rk3588_set_gmac_speed, .set_clock_selection = rk3588_set_clock_selection, + .php_grf_required = true, .regs_valid = true, .regs = { 0xfe1b0000, /* gmac0 */
@@ -1830,8 +1833,22 @@ static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev, bsp_priv->grf =syscon_regmap_lookup_by_phandle (dev->of_node,"rockchip,grf" ); - bsp_priv->php_grf =syscon_regmap_lookup_by_phandle (dev->of_node, -"rockchip,php-grf" ); +if (IS_ERR (bsp_priv->grf)) { +dev_err_probe (dev,PTR_ERR (bsp_priv->grf), +"failed to lookup rockchip,grf\n" ); +return ERR_CAST (bsp_priv->grf); + } + +if (ops->php_grf_required) { + bsp_priv->php_grf = +syscon_regmap_lookup_by_phandle (dev->of_node, +"rockchip,php-grf" ); +if (IS_ERR (bsp_priv->php_grf)) { +dev_err_probe (dev,PTR_ERR (bsp_priv->php_grf), +"failed to lookup rockchip,php-grf\n" ); +return ERR_CAST (bsp_priv->php_grf); + } + }if (plat->phy_node) { bsp_priv->integrated_phy = of_property_read_bool(plat->phy_node,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 132/486 net: hsr: Fix PRP duplicate detection
In reply to Sasha LevinFrom: Jaakko Karrenpalo <[email protected]>
[ Upstream commit 05fd00e5e7b1ac60d264f72423fba38cc382b447 ]
Add PRP specific function for handling duplicate packets. This is needed because of potential L2 802.1p prioritization done by network switches.
The L2 prioritization can re-order the PRP packets from a node causing the existing implementation to discard the frame(s) that have been received 'late' because the sequence number is before the previous received packet. This can happen if the node is sending multiple frames back-to-back with different priority.
--- net/hsr/hsr_device.c | 2 + net/hsr/hsr_forward.c | 4 +- net/hsr/hsr_framereg.c | 95 ++++++++++++++++++++++++++++++++++++++++-- net/hsr/hsr_framereg.h | 8 +++- net/hsr/hsr_main.h | 2 + 5 files changed, 104 insertions(+), 7 deletions(-)
net/hsr/hsr_device.c +2 -0
@@ -543,6 +543,7 @@ static struct hsr_proto_ops hsr_ops = { .drop_frame = hsr_drop_frame, .fill_frame_info = hsr_fill_frame_info, .invalid_dan_ingress_frame = hsr_invalid_dan_ingress_frame, + .register_frame_out = hsr_register_frame_out, };static struct hsr_proto_ops prp_ops = {
@@ -553,6 +554,7 @@ static struct hsr_proto_ops prp_ops = { .fill_frame_info = prp_fill_frame_info, .handle_san_frame = prp_handle_san_frame, .update_san_info = prp_update_san_info, + .register_frame_out = prp_register_frame_out, };void hsr_dev_setup (struct net_device *dev)
net/hsr/hsr_forward.c +2 -2
@@ -524,8 +524,8 @@ static void hsr_forward_do(struct hsr_frame_info *frame)* Also for SAN, this shouldn't be done. */ if (!frame->is_from_san && -hsr_register_frame_out (port, frame->node_src, - frame->sequence_nr)) + hsr->proto_ops->register_frame_out && + hsr->proto_ops->register_frame_out (port, frame))continue ; if (frame->is_supervision && port->type == HSR_PT_MASTER &&
net/hsr/hsr_framereg.c +92 -3
121 lines not on this page · raw message
net/hsr/hsr_framereg.h +6 -2
@@ -44,8 +44,7 @@ void hsr_addr_subst_dest(struct hsr_node *node_src, struct sk_buff *skb,void hsr_register_frame_in (struct hsr_node *node,struct hsr_port *port,u16 sequence_nr); -int hsr_register_frame_out (struct hsr_port *port,struct hsr_node *node, -u16 sequence_nr); +int hsr_register_frame_out (struct hsr_port *port,struct hsr_frame_info *frame);void hsr_prune_nodes (struct timer_list *t);void hsr_prune_proxy_nodes (struct timer_list *t);
@@ -73,6 +72,8 @@ void prp_update_san_info(struct hsr_node *node, bool is_sup);bool hsr_is_node_in_db (struct list_head *node_db,const unsigned char addr[ETH_ALEN ]); +int prp_register_frame_out (struct hsr_port *port,struct hsr_frame_info *frame); +struct hsr_node {struct list_head mac_list;/* Protect R/W access to seq_out */
@@ -89,6 +90,9 @@ struct hsr_node {bool san_b;u16 seq_out[HSR_PT_PORTS ];bool removed; +/* PRP specific duplicate handling */ +u16 seq_expected[HSR_PT_PORTS ]; +u16 seq_start[HSR_PT_PORTS ];struct rcu_head rcu_head; };
net/hsr/hsr_main.h +2 -0
@@ -183,6 +183,8 @@ struct hsr_proto_ops { struct hsr_frame_info *frame);bool (*invalid_dan_ingress_frame)(__be16 protocol);void (*update_san_info)(struct hsr_node *node,bool is_sup); +int (*register_frame_out)(struct hsr_port *port, +struct hsr_frame_info *frame); };struct hsr_self_node {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 133/486 timer_list: Don't use %pK through printk()
In reply to Sasha LevinFrom: Thomas Weißschuh <[email protected]>
[ Upstream commit a52067c24ccf6ee4c85acffa0f155e9714f9adce ]
This reverts commit f590308536db ("timer debug: Hide kernel addresses via %pK in /proc/timer_list")
The timer list helper SEQ_printf() uses either the real seq_printf() for procfs output or vprintk() to print to the kernel log, when invoked from SysRq-q. It uses %pK for printing pointers.
In the past %pK was prefered over %p as it would not leak raw pointer values into the kernel log. Since commit ad67b74d2469 ("printk: hash addresses printed with %p") the regular %p has been improved to avoid this issue.
Furthermore, restricted pointers ("%pK") were never meant to be used through printk(). They can still unintentionally leak raw pointers or acquire sleeping looks in atomic contexts.
Switch to the regular pointer formatting which is safer, easier to reason about and sufficient here.
--- kernel/time/timer_list.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/time/timer_list.c +2 -2
@@ -46,7 +46,7 @@ static void print_timer(struct seq_file *m, struct hrtimer *taddr, struct hrtimer *timer, int idx, u64 now) { - SEQ_printf(m, " #%d: <%pK>, %ps", idx, taddr, timer->function); + SEQ_printf(m, " #%d: <%p>, %ps", idx, taddr, timer->function);SEQ_printf (m,", S:%02x" , timer->state);SEQ_printf (m,"\n" ); SEQ_printf(m, " # expires at %Lu-%Lu nsecs [in %Ld to %Ld nsecs]\n",
@@ -98,7 +98,7 @@ print_active_timers(struct seq_file *m, struct hrtimer_clock_base *base,static void print_base (struct seq_file *m,struct hrtimer_clock_base *base,u64 now) { -SEQ_printf (m," .base: %pK\n" , base); +SEQ_printf (m," .base: %p\n" , base);SEQ_printf (m," .index: %d\n" , base->index);SEQ_printf (m," .resolution: %u nsecs\n" , hrtimer_resolution);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 134/486 wifi: rtw89: set force HE TB mode when connecting to 11ax AP
In reply to Sasha LevinFrom: Dian-Syuan Yang <[email protected]>
[ Upstream commit a9b56f219a0fa550f92e65ac58443a7892380e09 ]
Some of 11ax AP set the UL HE-SIG-A2 reserved subfield to all 0s, which will cause the 11be chip to recognize trigger frame as EHT. We propose a method to bypass the "UL HE-SIG-A2 reserved subfield" and always uses HE TB in response to the AP's trigger frame.
--- drivers/net/wireless/realtek/rtw89/mac.c | 26 +++++++++++++++++++ drivers/net/wireless/realtek/rtw89/mac.h | 2 ++ drivers/net/wireless/realtek/rtw89/mac80211.c | 1 + drivers/net/wireless/realtek/rtw89/reg.h | 4 +++ 4 files changed, 33 insertions(+)
drivers/net/wireless/realtek/rtw89/mac.c +26 -0
@@ -4745,6 +4745,32 @@ void rtw89_mac_set_he_obss_narrow_bw_ru(struct rtw89_dev *rtwdev,rtw89_write32_set (rtwdev, reg, mac->narrow_bw_ru_dis.mask); } +void rtw89_mac_set_he_tb (struct rtw89_dev *rtwdev, +struct rtw89_vif_link *rtwvif_link) +{ +struct ieee80211_bss_conf *bss_conf; +bool set; +u32 reg; + +if (rtwdev->chip->chip_gen !=RTW89_CHIP_BE ) +return ; + +rcu_read_lock (); + + bss_conf =rtw89_vif_rcu_dereference_link (rtwvif_link, true); + set = bss_conf->he_support && !bss_conf->eht_support; + +rcu_read_unlock (); + + reg =rtw89_mac_reg_by_idx (rtwdev,R_BE_CLIENT_OM_CTRL , + rtwvif_link->mac_idx); + +if (set) +rtw89_write32_set (rtwdev, reg,B_BE_TRIG_DIS_EHTTB ); +else +rtw89_write32_clr (rtwdev, reg,B_BE_TRIG_DIS_EHTTB ); +} +void rtw89_mac_stop_ap (struct rtw89_dev *rtwdev,struct rtw89_vif_link *rtwvif_link) {rtw89_mac_port_cfg_func_sw (rtwdev, rtwvif_link);
drivers/net/wireless/realtek/rtw89/mac.h +2 -0
@@ -1160,6 +1160,8 @@ void rtw89_mac_port_cfg_rx_sync(struct rtw89_dev *rtwdev, struct rtw89_vif_link *rtwvif_link, bool en);void rtw89_mac_set_he_obss_narrow_bw_ru (struct rtw89_dev *rtwdev,struct rtw89_vif_link *rtwvif_link); +void rtw89_mac_set_he_tb (struct rtw89_dev *rtwdev, +struct rtw89_vif_link *rtwvif_link);void rtw89_mac_stop_ap (struct rtw89_dev *rtwdev,struct rtw89_vif_link *rtwvif_link);void rtw89_mac_enable_beacon_for_ap_vifs (struct rtw89_dev *rtwdev,bool en);int rtw89_mac_remove_vif (struct rtw89_dev *rtwdev,struct rtw89_vif_link *vif);
drivers/net/wireless/realtek/rtw89/mac80211.c +1 -0
@@ -669,6 +669,7 @@ static void __rtw89_ops_bss_link_assoc(struct rtw89_dev *rtwdev,rtw89_chip_cfg_txpwr_ul_tb_offset (rtwdev, rtwvif_link);rtw89_mac_port_update (rtwdev, rtwvif_link);rtw89_mac_set_he_obss_narrow_bw_ru (rtwdev, rtwvif_link); +rtw89_mac_set_he_tb (rtwdev, rtwvif_link); } static void __rtw89_ops_bss_assoc(struct rtw89_dev *rtwdev,
drivers/net/wireless/realtek/rtw89/reg.h +4 -0
@@ -7093,6 +7093,10 @@#define B_BE_MACLBK_RDY_NUM_MASK GENMASK(7, 3)#define B_BE_MACLBK_EN BIT(0) +#define R_BE_CLIENT_OM_CTRL 0x11040 +#define R_BE_CLIENT_OM_CTRL_C1 0x15040 +#define B_BE_TRIG_DIS_EHTTB BIT(24) +#define R_BE_WMAC_NAV_CTL 0x11080#define R_BE_WMAC_NAV_CTL_C1 0x15080#define B_BE_WMAC_NAV_UPPER_EN BIT(26)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 135/486 netfilter: conntrack: Bound nf_conntrack sysctl writes
In reply to Sasha LevinFrom: Nicolas Bouchinet <[email protected]>
[ Upstream commit 8b6861390ffee6b8ed78b9395e3776c16fec6579 ]
nf_conntrack_max and nf_conntrack_expect_max sysctls were authorized to be written any negative value, which would then be stored in the unsigned int variables nf_conntrack_max and nf_ct_expect_max variables.
While the do_proc_dointvec_conv function is supposed to limit writing handled by proc_dointvec proc_handler to INT_MAX. Such a negative value being written in an unsigned int leads to a very high value, exceeding this limit.
Moreover, the nf_conntrack_expect_max sysctl documentation specifies the minimum value is 1.
The proc_handlers have thus been updated to proc_dointvec_minmax in order to specify the following write bounds :
* Bound nf_conntrack_max sysctl writings between SYSCTL_ZERO and SYSCTL_INT_MAX.
* Bound nf_conntrack_expect_max sysctl writings between SYSCTL_ONE and SYSCTL_INT_MAX as defined in the sysctl documentation.
With this patch applied, sysctl writes outside the defined in the bound will thus lead to a write error :
``` sysctl -w net.netfilter.nf_conntrack_expect_max=-1 sysctl: setting key "net.netfilter.nf_conntrack_expect_max": Invalid argument ```
--- net/netfilter/nf_conntrack_standalone.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
net/netfilter/nf_conntrack_standalone.c +9 -3
@@ -619,7 +619,9 @@ static struct ctl_table nf_ct_sysctl_table[] = { .data = &nf_conntrack_max, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_INT_MAX, }, [NF_SYSCTL_CT_COUNT] = { .procname = "nf_conntrack_count",
@@ -655,7 +657,9 @@ static struct ctl_table nf_ct_sysctl_table[] = { .data = &nf_ct_expect_max, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, + .extra1 = SYSCTL_ONE, + .extra2 = SYSCTL_INT_MAX, }, [NF_SYSCTL_CT_ACCT] = { .procname = "nf_conntrack_acct",
@@ -948,7 +952,9 @@ static struct ctl_table nf_ct_netfilter_table[] = { .data = &nf_conntrack_max, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_INT_MAX, }, };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 136/486 PNP: Expand length of fixup id string
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit 425b1c97b07f2290700f708edabef32861e2b2db ]
GCC 15's -Wunterminated-string-initialization saw that "id" was not including the required trailing NUL character. Instead of marking "id" with __nonstring[1], expand the length of the string as it is used in (debugging) format strings that expect a properly formed C string.
--- include/linux/pnp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/pnp.h +1 -1
@@ -290,7 +290,7 @@ static inline void pnp_set_drvdata(struct pnp_dev *pdev, void *data) }struct pnp_fixup { -char id[7 ]; +char id[8 ];void (*quirk_function) (struct pnp_dev *dev);/* fixup function */ };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 137/486 phy: rockchip: usbdp: Only verify link rates/lanes/voltage when the corresponding set flags are set
In reply to Sasha LevinFrom: Andy Yan <[email protected]>
[ Upstream commit 969a38be437b68dc9e12e3c3f08911c9f9c8be73 ]
According documentation of phy_configure_opts_dp, at the configure stage, link rates should only be verify/configure when set_rate flag is set, the same applies to lanes and voltage.
So do it as the documentation says.
Because voltage setting depends on the lanes, link rates set previously, so record the link rates and lanes at it's verify stage.
--- drivers/phy/rockchip/phy-rockchip-usbdp.c | 87 ++++++++++++++--------- 1 file changed, 53 insertions(+), 34 deletions(-)
drivers/phy/rockchip/phy-rockchip-usbdp.c +53 -34
@@ -187,6 +187,8 @@ struct rk_udphy {u32 dp_aux_din_sel;bool dp_sink_hpd_sel;bool dp_sink_hpd_cfg; +unsigned int link_rate; +unsigned int lanes;u8 bw;int id;
@@ -1102,15 +1104,19 @@ static int rk_udphy_dp_phy_power_off(struct phy *phy)return 0 ; } -static int rk_udphy_dp_phy_verify_link_rate (unsigned int link_rate) +/* +* Verify link rate +*/ +static int rk_udphy_dp_phy_verify_link_rate (struct rk_udphy *udphy, +struct phy_configure_opts_dp *dp) { -switch (link_rate) { +switch (dp->link_rate) {case 1620 :case 2700 :case 5400 :case 8100 : + udphy->link_rate = dp->link_rate;break ; -default :return -EINVAL ; }
@@ -1118,45 +1124,44 @@ static int rk_udphy_dp_phy_verify_link_rate(unsigned int link_rate)return 0 ; } -static int rk_udphy_dp_phy_verify_config (struct rk_udphy *udphy, -struct phy_configure_opts_dp *dp) +static int rk_udphy_dp_phy_verify_lanes (struct rk_udphy *udphy, +struct phy_configure_opts_dp *dp) { -int i, ret; - -/* If changing link rate was required, verify it's supported. */ - ret =rk_udphy_dp_phy_verify_link_rate (dp->link_rate); -if (ret) -return ret; - -/* Verify lane count. */ switch (dp->lanes) {case 1 :case 2 :case 4 :/* valid lane count. */ + udphy->lanes = dp->lanes;break ;default :return -EINVAL ; } -/* -* If changing voltages is required, check swing and pre-emphasis -* levels, per-lane. -*/ -if (dp->set_voltages) { -/* Lane count verified previously. */ -for (i =0 ; i < dp->lanes; i++) { -if (dp->voltage[i] >3 || dp->pre[i] >3 ) -return -EINVAL ; +return 0 ; +} -/* -* Sum of voltage swing and pre-emphasis levels cannot -* exceed 3. -*/ -if (dp->voltage[i] + dp->pre[i] >3 ) -return -EINVAL ; - } +/* +* If changing voltages is required, check swing and pre-emphasis +* levels, per-lane. +*/ +static int rk_udphy_dp_phy_verify_voltages (struct rk_udphy *udphy, +struct phy_configure_opts_dp *dp) +{ +int i; + +/* Lane count verified previously. */ +for (i =0 ; i < udphy->lanes; i++) { +if (dp->voltage[i] >3 || dp->pre[i] >3 ) +return -EINVAL ; + +/* +* Sum of voltage swing and pre-emphasis levels cannot +* exceed 3. +*/ +if (dp->voltage[i] + dp->pre[i] >3 ) +return -EINVAL ; }return 0 ;
@@ -1196,9 +1201,23 @@ static int rk_udphy_dp_phy_configure(struct phy *phy,u32 i, val, lane;int ret; - ret =rk_udphy_dp_phy_verify_config (udphy, dp); -if (ret) -return ret; +if (dp->set_rate) { + ret =rk_udphy_dp_phy_verify_link_rate (udphy, dp); +if (ret) +return ret; + } + +if (dp->set_lanes) { + ret =rk_udphy_dp_phy_verify_lanes (udphy, dp); +if (ret) +return ret; + } + +if (dp->set_voltages) { + ret =rk_udphy_dp_phy_verify_voltages (udphy, dp); +if (ret) +return ret; + }if (dp->set_rate) { regmap_update_bits(udphy->pma_regmap, CMN_DP_RSTN_OFFSET,
@@ -1243,9 +1262,9 @@ static int rk_udphy_dp_phy_configure(struct phy *phy, }if (dp->set_voltages) { -for (i =0 ; i < dp->lanes; i++) { +for (i =0 ; i < udphy->lanes; i++) { lane = udphy->dp_lane_sel[i]; -switch (dp->link_rate) { +switch (udphy->link_rate) {case 1620 :case 2700 : regmap_update_bits(udphy->pma_regmap,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 138/486 arm64/mm: Check pmd_table() in pmd_trans_huge()
In reply to Sasha LevinFrom: Ryan Roberts <[email protected]>
[ Upstream commit d1770e909898c108e8c7d30ca039053e8818a9c9 ]
Check for pmd_table() in pmd_trans_huge() rather then just checking for the PMD_TABLE_BIT. But ensure all present-invalid entries are handled correctly by always setting PTE_VALID before checking with pmd_table().
--- arch/arm64/include/asm/pgtable.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
arch/arm64/include/asm/pgtable.h +12 -12
@@ -554,18 +554,6 @@ static inline int pmd_protnone(pmd_t pmd)#endif #define pmd_present (pmd) pte_present(pmd_pte(pmd)) - -/* -* THP definitions. -*/ - -#ifdef CONFIG_TRANSPARENT_HUGEPAGE -static inline int pmd_trans_huge (pmd_t pmd) -{ -return pmd_val (pmd) &&pmd_present (pmd) && !(pmd_val (pmd) &PMD_TABLE_BIT ); -} -#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ -#define pmd_dirty (pmd) pte_dirty(pmd_pte(pmd))#define pmd_young (pmd) pte_young(pmd_pte(pmd))#define pmd_valid (pmd) pte_valid(pmd_pte(pmd))
@@ -725,6 +713,18 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,#define pmd_leaf_size (pmd) (pmd_cont(pmd) ? CONT_PMD_SIZE : PMD_SIZE)#define pte_leaf_size (pte) (pte_cont(pte) ? CONT_PTE_SIZE : PAGE_SIZE) +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +static inline int pmd_trans_huge (pmd_t pmd) +{ +/* +* If pmd is present-invalid, pmd_table() won't detect it +* as a table, so force the valid bit for the comparison. +*/ +return pmd_val (pmd) &&pmd_present (pmd) && + !pmd_table (__pmd (pmd_val (pmd) |PTE_VALID )); +} +#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ +#if defined(CONFIG_ARM64_64K_PAGES ) ||CONFIG_PGTABLE_LEVELS <3 static inline bool pud_sect (pud_t pud) {return false; }static inline bool pud_table (pud_t pud) {return true; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 139/486 arm64/mm: Check PUD_TYPE_TABLE in pud_bad()
In reply to Sasha LevinFrom: Ryan Roberts <[email protected]>
[ Upstream commit bfb1d2b9021c21891427acc86eb848ccedeb274e ]
pud_bad() is currently defined in terms of pud_table(). Although for some configs, pud_table() is hard-coded to true i.e. when using 64K base pages or when page table levels are less than 3.
pud_bad() is intended to check that the pud is configured correctly. Hence let's open-code the same check that the full version of pud_table() uses into pud_bad(). Then it always performs the check regardless of the config.
--- arch/arm64/include/asm/pgtable.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/include/asm/pgtable.h +2 -1
@@ -806,7 +806,8 @@ static inline unsigned long pmd_page_vaddr(pmd_t pmd) pr_err("%s:%d: bad pmd %016llx.\n", __FILE__, __LINE__, pmd_val(e))#define pud_none (pud) (!pud_val(pud)) -#define pud_bad (pud) (!pud_table(pud)) +#define pud_bad (pud) ((pud_val(pud) & PUD_TYPE_MASK) != \ + PUD_TYPE_TABLE)#define pud_present (pud) pte_present(pud_pte(pud))#ifndef __PAGETABLE_PMD_FOLDED#define pud_leaf (pud) (pud_present(pud) && !pud_table(pud))
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 140/486 mmc: dw_mmc: add exynos7870 DW MMC support
In reply to Sasha LevinFrom: Kaustabh Chakraborty <[email protected]>
[ Upstream commit 7cbe799ac10fd8be85af5e0615c4337f81e575f3 ]
Add support for Exynos7870 DW MMC controllers, for both SMU and non-SMU variants. These controllers require a quirk to access 64-bit FIFO in 32-bit accesses (DW_MMC_QUIRK_FIFO64_32).
--- drivers/mmc/host/dw_mmc-exynos.c | 41 +++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-)
drivers/mmc/host/dw_mmc-exynos.c +40 -1
@@ -27,6 +27,8 @@ enum dw_mci_exynos_type {DW_MCI_TYPE_EXYNOS5420_SMU ,DW_MCI_TYPE_EXYNOS7 ,DW_MCI_TYPE_EXYNOS7_SMU , +DW_MCI_TYPE_EXYNOS7870 , +DW_MCI_TYPE_EXYNOS7870_SMU , DW_MCI_TYPE_ARTPEC8, };
@@ -69,6 +71,12 @@ static struct dw_mci_exynos_compatible { }, { .compatible = "samsung,exynos7-dw-mshc-smu", .ctrl_type = DW_MCI_TYPE_EXYNOS7_SMU, + }, { + .compatible = "samsung,exynos7870-dw-mshc", + .ctrl_type = DW_MCI_TYPE_EXYNOS7870, + }, { + .compatible = "samsung,exynos7870-dw-mshc-smu", + .ctrl_type = DW_MCI_TYPE_EXYNOS7870_SMU, }, { .compatible = "axis,artpec8-dw-mshc", .ctrl_type = DW_MCI_TYPE_ARTPEC8,
@@ -85,6 +93,8 @@ static inline u8 dw_mci_exynos_get_ciu_div(struct dw_mci *host)return EXYNOS4210_FIXED_CIU_CLK_DIV ; else if (priv->ctrl_type == DW_MCI_TYPE_EXYNOS7 || priv->ctrl_type == DW_MCI_TYPE_EXYNOS7_SMU || + priv->ctrl_type == DW_MCI_TYPE_EXYNOS7870 || + priv->ctrl_type == DW_MCI_TYPE_EXYNOS7870_SMU || priv->ctrl_type == DW_MCI_TYPE_ARTPEC8) return SDMMC_CLKSEL_GET_DIV(mci_readl(host, CLKSEL64)) + 1; else
@@ -100,7 +110,8 @@ static void dw_mci_exynos_config_smu(struct dw_mci *host)* set for non-ecryption mode at this time. */ if (priv->ctrl_type ==DW_MCI_TYPE_EXYNOS5420_SMU || - priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7_SMU ) { + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7_SMU || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870_SMU ) {mci_writel (host,MPSBEGIN0 ,0 );mci_writel (host,MPSEND0 ,SDMMC_ENDING_SEC_NR_MAX ); mci_writel(host, MPSCTRL0, SDMMC_MPSCTRL_SECURE_WRITE_BIT |
@@ -126,6 +137,12 @@ static int dw_mci_exynos_priv_init(struct dw_mci *host)DQS_CTRL_GET_RD_DELAY (priv->saved_strobe_ctrl); } +if (priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870 || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870_SMU ) { +/* Quirk needed for certain Exynos SoCs */ + host->quirks |=DW_MMC_QUIRK_FIFO64_32 ; + } +if (priv->ctrl_type ==DW_MCI_TYPE_ARTPEC8 ) {/* Quirk needed for the ARTPEC-8 SoC */ host->quirks |=DW_MMC_QUIRK_EXTENDED_TMOUT ;
@@ -143,6 +160,8 @@ static void dw_mci_exynos_set_clksel_timing(struct dw_mci *host, u32 timing)if (priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7 || priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7_SMU || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870 || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870_SMU || priv->ctrl_type ==DW_MCI_TYPE_ARTPEC8 ) clksel =mci_readl (host,CLKSEL64 );else
@@ -152,6 +171,8 @@ static void dw_mci_exynos_set_clksel_timing(struct dw_mci *host, u32 timing)if (priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7 || priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7_SMU || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870 || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870_SMU || priv->ctrl_type ==DW_MCI_TYPE_ARTPEC8 )mci_writel (host,CLKSEL64 , clksel);else
@@ -222,6 +243,8 @@ static int dw_mci_exynos_resume_noirq(struct device *dev)if (priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7 || priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7_SMU || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870 || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870_SMU || priv->ctrl_type ==DW_MCI_TYPE_ARTPEC8 ) clksel =mci_readl (host,CLKSEL64 );else
@@ -230,6 +253,8 @@ static int dw_mci_exynos_resume_noirq(struct device *dev)if (clksel &SDMMC_CLKSEL_WAKEUP_INT ) {if (priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7 || priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7_SMU || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870 || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870_SMU || priv->ctrl_type ==DW_MCI_TYPE_ARTPEC8 )mci_writel (host,CLKSEL64 , clksel);else
@@ -409,6 +434,8 @@ static inline u8 dw_mci_exynos_get_clksmpl(struct dw_mci *host)if (priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7 || priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7_SMU || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870 || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870_SMU || priv->ctrl_type ==DW_MCI_TYPE_ARTPEC8 )return SDMMC_CLKSEL_CCLK_SAMPLE (mci_readl (host,CLKSEL64 ));else
@@ -422,6 +449,8 @@ static inline void dw_mci_exynos_set_clksmpl(struct dw_mci *host, u8 sample)if (priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7 || priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7_SMU || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870 || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870_SMU || priv->ctrl_type ==DW_MCI_TYPE_ARTPEC8 ) clksel =mci_readl (host,CLKSEL64 );else
@@ -429,6 +458,8 @@ static inline void dw_mci_exynos_set_clksmpl(struct dw_mci *host, u8 sample) clksel =SDMMC_CLKSEL_UP_SAMPLE (clksel, sample);if (priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7 || priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7_SMU || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870 || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870_SMU || priv->ctrl_type ==DW_MCI_TYPE_ARTPEC8 )mci_writel (host,CLKSEL64 , clksel);else
@@ -443,6 +474,8 @@ static inline u8 dw_mci_exynos_move_next_clksmpl(struct dw_mci *host)if (priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7 || priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7_SMU || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870 || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870_SMU || priv->ctrl_type ==DW_MCI_TYPE_ARTPEC8 ) clksel =mci_readl (host,CLKSEL64 );else
@@ -453,6 +486,8 @@ static inline u8 dw_mci_exynos_move_next_clksmpl(struct dw_mci *host)if (priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7 || priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7_SMU || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870 || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870_SMU || priv->ctrl_type ==DW_MCI_TYPE_ARTPEC8 )mci_writel (host,CLKSEL64 , clksel);else
@@ -632,6 +667,10 @@ static const struct of_device_id dw_mci_exynos_match[] = { .data = &exynos_drv_data, }, { .compatible = "samsung,exynos7-dw-mshc-smu", .data = &exynos_drv_data, }, + { .compatible = "samsung,exynos7870-dw-mshc", + .data = &exynos_drv_data, }, + { .compatible = "samsung,exynos7870-dw-mshc-smu", + .data = &exynos_drv_data, }, { .compatible = "axis,artpec8-dw-mshc", .data = &artpec_drv_data, }, {},
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 141/486 mmc: sdhci: Disable SD card clock before changing parameters
In reply to Sasha LevinFrom: Erick Shepherd <[email protected]>
[ Upstream commit fb3bbc46c94f261b6156ee863c1b06c84cf157dc ]
Per the SD Host Controller Simplified Specification v4.20 §3.2.3, change the SD card clock parameters only after first disabling the external card clock. Doing this fixes a spurious clock pulse on Baytrail and Apollo Lake SD controllers which otherwise breaks voltage switching with a specific Swissbit SD card.
--- drivers/mmc/host/sdhci.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci.c +7 -2
@@ -2035,10 +2035,15 @@ void sdhci_set_clock(struct sdhci_host *host, unsigned int clock) host->mmc->actual_clock =0 ; -sdhci_writew (host,0 ,SDHCI_CLOCK_CONTROL ); + clk =sdhci_readw (host,SDHCI_CLOCK_CONTROL ); +if (clk &SDHCI_CLOCK_CARD_EN ) +sdhci_writew (host, clk & ~SDHCI_CLOCK_CARD_EN , +SDHCI_CLOCK_CONTROL ); -if (clock ==0 ) +if (clock ==0 ) { +sdhci_writew (host,0 ,SDHCI_CLOCK_CONTROL );return ; + } clk =sdhci_calc_clk (host, clock, &host->mmc->actual_clock);sdhci_enable_clk (host, clk);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 142/486 usb: xhci: Don't change the status of stalled TDs on failed Stop EP
In reply to Sasha LevinFrom: Michal Pecio <[email protected]>
[ Upstream commit dfc88357b6b6356dadea06b2c0bc8041f5e11720 ]
When the device stalls an endpoint, current TD is assigned -EPIPE status and Reset Endpoint is queued. If a Stop Endpoint is pending at the time, it will run before Reset Endpoint and fail due to the stall. Its handler will change TD's status to -EPROTO before Reset Endpoint handler runs and initiates giveback.
Check if the stall has already been handled and don't try to do it again. Since xhci_handle_halted_endpoint() performs this check too, not overwriting td->status is the only difference.
I haven't seen this case yet, but I have seen a related one where the xHC has already executed Reset Endpoint, EP Context state is now Stopped and EP_HALTED is set. If the xHC took a bit longer to execute Reset Endpoint, said case would become this one.
--- drivers/usb/host/xhci-ring.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-ring.c +11 -1
@@ -1156,7 +1156,14 @@ static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci, int slot_id,*/ switch (GET_EP_CTX_STATE (ep_ctx)) {case EP_STATE_HALTED : -xhci_dbg (xhci,"Stop ep completion raced with stall, reset ep\n" ); +xhci_dbg (xhci,"Stop ep completion raced with stall\n" ); +/* +* If the halt happened before Stop Endpoint failed, its transfer event +* should have already been handled and Reset Endpoint should be pending. +*/ +if (ep->ep_state &EP_HALTED ) + goto reset_done; +if (ep->ep_state &EP_HAS_STREAMS ) { reset_type =EP_SOFT_RESET ; }else {
@@ -1167,8 +1174,11 @@ static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci, int slot_id, }/* reset ep, reset handler cleans up cancelled tds */ err =xhci_handle_halted_endpoint (xhci, ep, td, reset_type); +xhci_dbg (xhci,"Stop ep completion resetting ep, status %d\n" , err);if (err)break ; +reset_done: +/* Reset EP handler will clean up cancelled TDs */ ep->ep_state &= ~EP_STOP_CMD_PENDING ;return ;case EP_STATE_STOPPED :
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 143/486 wifi: iwlwifi: mvm: fix setting the TK when associated
In reply to Sasha LevinFrom: Avraham Stern <[email protected]>
[ Upstream commit 3ad61970ac9e164be1b09b46c01aa942e8966132 ]
When running secured ranging and the initiator is associated with the responder, the TK was not set in the range request command. Fix it.
--- drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c +4 -0
@@ -773,7 +773,11 @@ iwl_mvm_ftm_set_secured_ranging(struct iwl_mvm *mvm, struct ieee80211_vif *vif, target.bssid = bssid; target.cipher = cipher; + target.tk =NULL ;ieee80211_iter_keys (mvm->hw, vif, iter, &target); + +if (!WARN_ON (!target.tk)) +memcpy (tk, target.tk,TK_11AZ_LEN ); }else {memcpy (tk, entry->tk,sizeof (entry->tk)); }
Signature · 1 line
2.39.5