kconfig: merge_config: use an empty file as initfile
Subsystems (82)
Sasha Levin
maintainerPATCH 1/642 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/642 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/642 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
@@ -863,48 +863,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));
@@ -914,15 +932,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 ; }
@@ -951,7 +970,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); }
@@ -2458,7 +2478,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/642 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
@@ -152,16 +152,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/642 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
@@ -258,7 +258,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,
@@ -270,11 +270,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;
@@ -313,7 +313,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/642 cifs: Fix access_flags_to_smbopen_mode
In reply to Sasha LevinFrom: Pali Rohár <[email protected]>
[ Upstream commit 6aa9f1c9cd09c1c39a35da4fe5f43446ec18ce1e ]
When converting access_flags to SMBOPEN mode, check for all possible access flags, not only GENERIC_READ and GENERIC_WRITE flags.
--- fs/smb/client/cifssmb.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-)
fs/smb/client/cifssmb.c +24 -8
@@ -1038,15 +1038,31 @@ static __u16 convert_disposition(int disposition)static int access_flags_to_smbopen_mode (const int access_flags) { -int masked_flags = access_flags & (GENERIC_READ |GENERIC_WRITE ); - -if (masked_flags ==GENERIC_READ ) -return SMBOPEN_READ ; -else if (masked_flags ==GENERIC_WRITE ) +/* +* SYSTEM_SECURITY grants both read and write access to SACL, treat is as read/write. +* MAXIMUM_ALLOWED grants as many access as possible, so treat it as read/write too. +* SYNCHRONIZE as is does not grant any specific access, so do not check its mask. +* If only SYNCHRONIZE bit is specified then fallback to read access. +*/ +bool with_write_flags = access_flags & (FILE_WRITE_DATA |FILE_APPEND_DATA |FILE_WRITE_EA | +FILE_DELETE_CHILD |FILE_WRITE_ATTRIBUTES |DELETE | +WRITE_DAC |WRITE_OWNER |SYSTEM_SECURITY | +MAXIMUM_ALLOWED |GENERIC_WRITE |GENERIC_ALL ); +bool with_read_flags = access_flags & (FILE_READ_DATA |FILE_READ_EA |FILE_EXECUTE | +FILE_READ_ATTRIBUTES |READ_CONTROL | +SYSTEM_SECURITY |MAXIMUM_ALLOWED |GENERIC_ALL | +GENERIC_EXECUTE |GENERIC_READ ); +bool with_execute_flags = access_flags & (FILE_EXECUTE |MAXIMUM_ALLOWED |GENERIC_ALL | +GENERIC_EXECUTE ); + +if (with_write_flags && with_read_flags) +return SMBOPEN_READWRITE ; +else if (with_write_flags)return SMBOPEN_WRITE ; - -/* just go for read/write */ -return SMBOPEN_READWRITE ; +else if (with_execute_flags) +return SMBOPEN_EXECUTE ; +else +return SMBOPEN_READ ; }int
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 7/642 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
@@ -3922,11 +3922,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 &&
@@ -3946,6 +3948,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 8/642 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
@@ -1327,6 +1327,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;
@@ -1342,6 +1343,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
@@ -279,6 +279,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 9/642 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
@@ -1137,6 +1137,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 10/642 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 11/642 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
@@ -93,6 +93,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 12/642 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 13/642 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
@@ -905,6 +905,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
@@ -443,6 +443,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))
@@ -454,6 +456,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))
@@ -1774,7 +1778,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
@@ -3578,7 +3583,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 14/642 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 15/642 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
@@ -132,6 +132,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
@@ -208,6 +209,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 16/642 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
@@ -608,9 +608,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 , };/**
@@ -626,6 +634,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
@@ -649,7 +660,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 17/642 ring-buffer: Use kaslr address instead of text delta
In reply to Sasha LevinFrom: Steven Rostedt <[email protected]>
[ Upstream commit bcba8d4dbe6880ce9883409df486de35d3946704 ]
Instead of saving off the text and data pointers and using them to compare with the current boot's text and data pointers, just save off the KASLR offset. Then that can be used to figure out how to read the previous boots buffer.
The last_boot_info will now show this offset, but only if it is for a previous boot:
~# cat instances/boot_mapped/last_boot_info
39000000 [kernel]
~# echo function > instances/boot_mapped/current_tracer ~# cat instances/boot_mapped/last_boot_info
# Current
If the KASLR offset saved is for the current boot, the last_boot_info will show the value of "current".
--- include/linux/ring_buffer.h | 3 +-- kernel/trace/ring_buffer.c | 31 ++++++++++++------------------- kernel/trace/trace.c | 30 +++++++++++++++++++++--------- kernel/trace/trace.h | 9 +++++---- 4 files changed, 39 insertions(+), 34 deletions(-)
include/linux/ring_buffer.h +1 -2
@@ -94,8 +94,7 @@ struct trace_buffer *__ring_buffer_alloc_range(unsigned long size, unsigned flagunsigned long range_size, struct lock_class_key *key); -bool ring_buffer_last_boot_delta (struct trace_buffer *buffer,long *text, -long *data); +bool ring_buffer_last_boot_delta (struct trace_buffer *buffer,unsigned long *kaslr_addr);/* * Because the ring buffer is generic, if other users of the ring buffer get
kernel/trace/ring_buffer.c +12 -19
@@ -31,6 +31,7 @@#include <asm/local64.h> #include <asm/local.h> +#include <asm/setup.h> #include "trace.h"
@@ -49,8 +50,7 @@ static void update_pages_handler(struct work_struct *work);struct ring_buffer_meta {int magic;int struct_size; -unsigned long text_addr; -unsigned long data_addr; +unsigned long kaslr_addr;unsigned long first_buffer;unsigned long head_buffer;unsigned long commit_buffer;
@@ -550,8 +550,7 @@ struct trace_buffer {unsigned long range_addr_start;unsigned long range_addr_end; -long last_text_delta; -long last_data_delta; +unsigned long kaslr_addr;unsigned int subbuf_size;unsigned int subbuf_order;
@@ -1891,16 +1890,13 @@ static void rb_meta_validate_events(struct ring_buffer_per_cpu *cpu_buffer) } } -/* Used to calculate data delta */ -static char rb_data_ptr[] ="" ; - -#define THIS_TEXT_PTR ((unsigned long)rb_meta_init_text_addr) -#define THIS_DATA_PTR ((unsigned long)rb_data_ptr) -static void rb_meta_init_text_addr (struct ring_buffer_meta *meta) { - meta->text_addr =THIS_TEXT_PTR ; - meta->data_addr =THIS_DATA_PTR ; +#ifdef CONFIG_RANDOMIZE_BASE + meta->kaslr_addr =kaslr_offset (); +#else + meta->kaslr_addr =0 ; +#endif }static void rb_range_meta_init (struct trace_buffer *buffer,int nr_pages)
@@ -1928,8 +1924,7 @@ static void rb_range_meta_init(struct trace_buffer *buffer, int nr_pages) meta->first_buffer += delta; meta->head_buffer += delta; meta->commit_buffer += delta; - buffer->last_text_delta =THIS_TEXT_PTR - meta->text_addr; - buffer->last_data_delta =THIS_DATA_PTR - meta->data_addr; + buffer->kaslr_addr = meta->kaslr_addr;continue ; }
@@ -2482,17 +2477,15 @@ struct trace_buffer *__ring_buffer_alloc_range(unsigned long size, unsigned flag* * Returns: The true if the delta is non zero */ -bool ring_buffer_last_boot_delta (struct trace_buffer *buffer,long *text, -long *data) +bool ring_buffer_last_boot_delta (struct trace_buffer *buffer,unsigned long *kaslr_addr) {if (!buffer)return false; -if (!buffer->last_text_delta) +if (!buffer->kaslr_addr)return false; - *text = buffer->last_text_delta; - *data = buffer->last_data_delta; + *kaslr_addr = buffer->kaslr_addr;return true; }
kernel/trace/trace.c +21 -9
@@ -50,7 +50,7 @@#include <linux/irq_work.h> #include <linux/workqueue.h> -#include <asm/setup.h> /* COMMAND_LINE_SIZE */ +#include <asm/setup.h> /* COMMAND_LINE_SIZE and kaslr_offset() */ #include "trace.h" #include "trace_output.h"
@@ -4193,7 +4193,7 @@ static enum print_line_t print_trace_fmt(struct trace_iterator *iter)* safe to use if the array has delta offsets * Force printing via the fields. */ -if ((tr->text_delta || tr->data_delta) && +if ((tr->text_delta) && event->type > __TRACE_LAST_TYPE)return print_event_fields (iter, event);
@@ -5990,7 +5990,7 @@ ssize_t tracing_resize_ring_buffer(struct trace_array *tr,static void update_last_data (struct trace_array *tr) { -if (!tr->text_delta && !tr->data_delta) +if (!(tr->flags &TRACE_ARRAY_FL_LAST_BOOT ))return ;/*
@@ -6003,7 +6003,8 @@ static void update_last_data(struct trace_array *tr)/* Using current data now */ tr->text_delta =0 ; - tr->data_delta =0 ; + + tr->flags &= ~TRACE_ARRAY_FL_LAST_BOOT ; }/**
@@ -6821,8 +6822,17 @@ tracing_last_boot_read(struct file *filp, char __user *ubuf, size_t cnt, loff_tseq_buf_init (&seq, buf,64 ); -seq_buf_printf (&seq,"text delta:\t%ld\n" , tr->text_delta); -seq_buf_printf (&seq,"data delta:\t%ld\n" , tr->data_delta); +/* +* Do not leak KASLR address. This only shows the KASLR address of +* the last boot. When the ring buffer is started, the LAST_BOOT +* flag gets cleared, and this should only report "current". +* Otherwise it shows the KASLR address from the previous boot which +* should not be the same as the current boot. +*/ +if (tr->flags &TRACE_ARRAY_FL_LAST_BOOT ) +seq_buf_printf (&seq,"%lx\t[kernel]\n" , tr->kaslr_addr); +else +seq_buf_puts (&seq,"# Current\n" );return simple_read_from_buffer (ubuf, cnt, ppos, buf,seq_buf_used (&seq)); }
@@ -9210,8 +9220,10 @@ allocate_trace_buffer(struct trace_array *tr, struct array_buffer *buf, int size tr->range_addr_start, tr->range_addr_size); -ring_buffer_last_boot_delta (buf->buffer, - &tr->text_delta, &tr->data_delta); +#ifdef CONFIG_RANDOMIZE_BASE +if (ring_buffer_last_boot_delta (buf->buffer, &tr->kaslr_addr)) + tr->text_delta =kaslr_offset () - tr->kaslr_addr; +#endif /* * This is basically the same as a mapped buffer, * with the same restrictions.
@@ -10469,7 +10481,7 @@ __init static void enable_instances(void)* to it. */ if (start) { - tr->flags |=TRACE_ARRAY_FL_BOOT ; + tr->flags |=TRACE_ARRAY_FL_BOOT |TRACE_ARRAY_FL_LAST_BOOT ; tr->ref++; }
kernel/trace/trace.h +5 -4
@@ -348,8 +348,8 @@ struct trace_array {unsigned int mapped;unsigned long range_addr_start;unsigned long range_addr_size; +unsigned long kaslr_addr;long text_delta; -long data_delta;struct trace_pid_list __rcu *filtered_pids;struct trace_pid_list __rcu *filtered_no_pids;
@@ -433,9 +433,10 @@ struct trace_array { };enum { -TRACE_ARRAY_FL_GLOBAL =BIT (0 ), -TRACE_ARRAY_FL_BOOT =BIT (1 ), -TRACE_ARRAY_FL_MOD_INIT =BIT (2 ), +TRACE_ARRAY_FL_GLOBAL =BIT (0 ), +TRACE_ARRAY_FL_BOOT =BIT (1 ), +TRACE_ARRAY_FL_LAST_BOOT =BIT (2 ), +TRACE_ARRAY_FL_MOD_INIT =BIT (3 ), };#ifdef CONFIG_MODULES
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 18/642 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
@@ -3322,10 +3322,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 ring_buffer_event *event;int len =0 , size;
@@ -3375,7 +3374,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) {
@@ -3405,7 +3403,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, ...) {
@@ -3450,7 +3447,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, ...) {
@@ -3466,7 +3462,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
@@ -837,13 +837,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 19/642 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 20/642 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 21/642 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 22/642 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 23/642 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
@@ -24,12 +24,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.
@@ -39,6 +36,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__
@@ -95,11 +95,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 24/642 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 25/642 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 26/642 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 27/642 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
@@ -1118,6 +1118,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);
@@ -1450,6 +1451,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 28/642 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 29/642 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
@@ -3028,8 +3028,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);
@@ -3058,10 +3060,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.
@@ -3070,7 +3080,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 30/642 cifs: Fix getting DACL-only xattr system.cifs_acl and system.smb3_acl
In reply to Sasha LevinFrom: Pali Rohár <[email protected]>
[ Upstream commit ad9364a6835c45c52f47587ffbe0577bb7cd4c5b ]
Currently ->get_acl() callback always create request for OWNER, GROUP and DACL, even when only DACLs was requested by user. Change API callback to request only information for which the caller asked. Therefore when only DACLs requested, then SMB client will prepare and send DACL-only request.
This change fixes retrieving of "system.cifs_acl" and "system.smb3_acl" xattrs to contain only DACL structure as documented.
Note that setting/changing of "system.cifs_acl" and "system.smb3_acl" xattrs already takes only DACL structure and ignores all other fields.
--- fs/smb/client/cifsacl.c | 4 ++-- fs/smb/client/cifssmb.c | 3 +-- fs/smb/client/smb2pdu.c | 4 +--- fs/smb/client/xattr.c | 15 +++++++++++---- 4 files changed, 15 insertions(+), 11 deletions(-)
fs/smb/client/cifsacl.c +2 -2
@@ -1565,7 +1565,7 @@ cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,int rc =0 ;struct tcon_link *tlink =cifs_sb_tlink (cifs_sb);struct smb_version_operations *ops; -const u32 info =0 ; +const u32 info =OWNER_SECINFO |GROUP_SECINFO |DACL_SECINFO ;cifs_dbg (NOISY ,"converting ACL to mode for %s\n" , path);
@@ -1619,7 +1619,7 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 *pnmode,struct tcon_link *tlink;struct smb_version_operations *ops;bool mode_from_sid, id_from_sid; -const u32 info =0 ; +const u32 info =OWNER_SECINFO |GROUP_SECINFO |DACL_SECINFO ;bool posix; tlink =cifs_sb_tlink (cifs_sb);
fs/smb/client/cifssmb.c +1 -2
@@ -3416,8 +3416,7 @@ CIFSSMBGetCIFSACL(const unsigned int xid, struct cifs_tcon *tcon, __u16 fid,/* BB TEST with big acls that might need to be e.g. larger than 16K */ pSMB->MaxSetupCount =0 ; pSMB->Fid = fid;/* file handle always le */ - pSMB->AclFlags =cpu_to_le32 (CIFS_ACL_OWNER |CIFS_ACL_GROUP | -CIFS_ACL_DACL | info); + pSMB->AclFlags =cpu_to_le32 (info); pSMB->ByteCount =cpu_to_le16 (11 );/* 3 bytes pad + 8 bytes parm */ inc_rfc1001_len (pSMB,11 ); iov[0 ].iov_base = (char *)pSMB;
fs/smb/client/smb2pdu.c +1 -3
@@ -3909,12 +3909,10 @@ SMB2_query_acl(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, u64 volatile_fid, void **data, u32 *plen, u32 extra_info) { - __u32 additional_info = OWNER_SECINFO | GROUP_SECINFO | DACL_SECINFO | - extra_info; *plen =0 ;return query_info (xid, tcon, persistent_fid, volatile_fid, -0 ,SMB2_O_INFO_SECURITY , additional_info, +0 ,SMB2_O_INFO_SECURITY , extra_info,SMB2_MAX_BUFFER_SIZE ,MIN_SEC_DESC_LEN , data, plen); }
fs/smb/client/xattr.c +11 -4
@@ -320,10 +320,17 @@ static int cifs_xattr_get(const struct xattr_handler *handler,if (pTcon->ses->server->ops->get_acl ==NULL ) goto out;/* rc already EOPNOTSUPP */ -if (handler->flags ==XATTR_CIFS_NTSD_FULL ) { - extra_info =SACL_SECINFO ; - }else { - extra_info =0 ; +switch (handler->flags) { +case XATTR_CIFS_NTSD_FULL : + extra_info =OWNER_SECINFO |GROUP_SECINFO |DACL_SECINFO |SACL_SECINFO ; +break ; +case XATTR_CIFS_NTSD : + extra_info =OWNER_SECINFO |GROUP_SECINFO |DACL_SECINFO ; +break ; +case XATTR_CIFS_ACL : +default : + extra_info =DACL_SECINFO ; +break ; } pacl = pTcon->ses->server->ops->get_acl (cifs_sb, inode, full_path, &acllen, extra_info);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 31/642 cifs: Check if server supports reparse points before using them
In reply to Sasha LevinFrom: Pali Rohár <[email protected]>
[ Upstream commit 6c06be908ca190e2d8feae1cf452d78598cd0b94 ]
Do not attempt to query or create reparse point when server fs does not support it. This will prevent creating unusable empty object on the server.
--- fs/smb/client/cifssmb.c | 3 +++ fs/smb/client/link.c | 3 ++- fs/smb/client/smb2inode.c | 8 ++++++++ fs/smb/client/smb2ops.c | 4 ++-- 4 files changed, 15 insertions(+), 3 deletions(-)
fs/smb/client/cifssmb.c +3 -0
@@ -2725,6 +2725,9 @@ int cifs_query_reparse_point(const unsigned int xid,if (cap_unix (tcon->ses))return -EOPNOTSUPP ; +if (!(le32_to_cpu (tcon->fsAttrInfo.Attributes) &FILE_SUPPORTS_REPARSE_POINTS )) +return -EOPNOTSUPP ; + oparms = (struct cifs_open_parms ) { .tcon = tcon, .cifs_sb = cifs_sb,
fs/smb/client/link.c +2 -1
@@ -643,7 +643,8 @@ cifs_symlink(struct mnt_idmap *idmap, struct inode *inode,case CIFS_SYMLINK_TYPE_NATIVE :case CIFS_SYMLINK_TYPE_NFS :case CIFS_SYMLINK_TYPE_WSL : -if (server->ops->create_reparse_symlink) { +if (server->ops->create_reparse_symlink && + (le32_to_cpu (pTcon->fsAttrInfo.Attributes) &FILE_SUPPORTS_REPARSE_POINTS )) { rc = server->ops->create_reparse_symlink(xid, inode, direntry, pTcon,
fs/smb/client/smb2inode.c +8 -0
@@ -1273,6 +1273,14 @@ struct inode *smb2_get_reparse_inode(struct cifs_open_info_data *data,int rc;int i; +/* +* If server filesystem does not support reparse points then do not +* attempt to create reparse point. This will prevent creating unusable +* empty object on the server. +*/ +if (!(le32_to_cpu (tcon->fsAttrInfo.Attributes) &FILE_SUPPORTS_REPARSE_POINTS )) +return ERR_PTR (-EOPNOTSUPP ); + oparms = CIFS_OPARMS(cifs_sb, tcon, full_path, SYNCHRONIZE | DELETE | FILE_READ_ATTRIBUTES |
fs/smb/client/smb2ops.c +2 -2
@@ -5237,7 +5237,7 @@ static int smb2_make_node(unsigned int xid, struct inode *inode, const char *full_path, umode_t mode, dev_t dev) { struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); -int rc; +int rc = -EOPNOTSUPP ;/* * Check if mounted with mount parm 'sfu' mount parm.
@@ -5248,7 +5248,7 @@ static int smb2_make_node(unsigned int xid, struct inode *inode,if (cifs_sb->mnt_cifs_flags &CIFS_MOUNT_UNX_EMUL ) { rc =cifs_sfu_make_node (xid, inode, dentry, tcon, full_path, mode, dev); - }else { + }else if (le32_to_cpu (tcon->fsAttrInfo.Attributes) &FILE_SUPPORTS_REPARSE_POINTS ) { rc =smb2_mknod_reparse (xid, inode, dentry, tcon, full_path, mode, dev); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 32/642 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
@@ -2739,7 +2739,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 33/642 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 34/642 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 35/642 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 36/642 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 37/642 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 38/642 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
@@ -537,7 +537,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 39/642 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 40/642 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 41/642 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 42/642 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 43/642 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 44/642 Bluetooth: btmtk: Remove the resetting step before downloading the fw
In reply to Sasha LevinFrom: Hao Qin <[email protected]>
[ Upstream commit 33634e2ab7c6369391e0ca4b9b97dc861e33d20e ]
Remove the resetting step before downloading the fw, as it may cause other usb devices to fail to initialise when connected during boot on kernels 6.11 and newer.
--- drivers/bluetooth/btmtk.c | 10 ---------- 1 file changed, 10 deletions(-)
drivers/bluetooth/btmtk.c +0 -10
@@ -1330,13 +1330,6 @@ int btmtk_usb_setup(struct hci_dev *hdev)break ;case 0x7922 :case 0x7925 : -/* Reset the device to ensure it's in the initial state before -* downloading the firmware to ensure. -*/ - -if (!test_bit (BTMTK_FIRMWARE_LOADED , &btmtk_data->flags)) -btmtk_usb_subsys_reset (hdev, dev_id); - fallthrough;case 0x7961 :btmtk_fw_get_filename (fw_bin_name,sizeof (fw_bin_name), dev_id, fw_version, fw_flavor);
@@ -1345,12 +1338,9 @@ int btmtk_usb_setup(struct hci_dev *hdev) btmtk_usb_hci_wmt_sync);if (err <0 ) {bt_dev_err (hdev,"Failed to set up firmware (%d)" , err); -clear_bit (BTMTK_FIRMWARE_LOADED , &btmtk_data->flags);return err; } -set_bit (BTMTK_FIRMWARE_LOADED , &btmtk_data->flags); -/* It's Device EndPoint Reset Option Register */ err =btmtk_usb_uhw_reg_write (hdev,MTK_EP_RST_OPT ,MTK_EP_RST_IN_OUT_OPT );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 45/642 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
@@ -930,6 +930,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 46/642 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
@@ -265,6 +265,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
Re: [PATCH AUTOSEL 6.14 046/642] exit: fix the usage of delay_group_leader->exit_code in do_notify_parent() and pidfs_exit()
I'm on PTO until May 15, can't read the code.
Does 6.14 have pidfs_exit() ? If no, then I don't think this patch should be backported.
Yes, do_notify_parent() can use the "wrong" exit_code too, but this is minor and we need more changes to make it actually correct.
Oleg.
Quoted 47 lines · Sasha Levin
From: 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 doessys_exit_group(2).In this case
wait_task_zombie(L)will noticeSIGNAL_GROUP_EXITand useL->signal->group_exit_code, this is correct.But, before that,
do_notify_parent(L)called byrelease_task(T)will useL->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 thinkpidfs_exit_info->exit_codeshould report ->group_exit_code in this case, just likewait_task_zombie().TODO: with this change we can hopefully cleanup (or may be even kill) the similar
SIGNAL_GROUP_EXITchecks, at least inwait_task_zombie().Signed-off-by Oleg Nesterov <[email protected]>Signed-off-by Christian Brauner <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- kernel/exit.c | 3 +++ 1 file changed, 3 insertions(+)kernel/exit.c +3
-0@@ -265,6 +265,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 47/642 RISC-V: add vector extension validation checks
In reply to Sasha LevinFrom: Conor Dooley <[email protected]>
[ Upstream commit 9324571e9eea231321acf0a3d0fbc85a6e0f6ff6 ]
Using Clement's new validation callbacks, support checking that dependencies have been satisfied for the vector extensions. From the kernel's perfective, it's not required to differentiate between the conditions for all the various vector subsets - it's the firmware's job to not report impossible combinations. Instead, the kernel only has to check that the correct config options are enabled and to enforce its requirement of the d extension being present for FPU support.
Since vector will now be disabled proactively, there's no need to clear the bit in elf_hwcap in riscv_fill_hwcap() any longer.
--- arch/riscv/include/asm/cpufeature.h | 3 ++ arch/riscv/kernel/cpufeature.c | 60 +++++++++++++++++++---------- 2 files changed, 43 insertions(+), 20 deletions(-)
arch/riscv/include/asm/cpufeature.h +3 -0
@@ -56,6 +56,9 @@ void __init riscv_user_isa_enable(void);#define __RISCV_ISA_EXT_BUNDLE (_name, _bundled_exts) \ _RISCV_ISA_EXT_DATA(_name, RISCV_ISA_EXT_INVALID, _bundled_exts, \ ARRAY_SIZE(_bundled_exts), NULL) +#define __RISCV_ISA_EXT_BUNDLE_VALIDATE (_name, _bundled_exts, _validate) \ + _RISCV_ISA_EXT_DATA(_name, RISCV_ISA_EXT_INVALID, _bundled_exts, \ + ARRAY_SIZE(_bundled_exts), _validate)/* Used to declare extensions that are a superset of other extensions (Zvbb for instance) */ #define __RISCV_ISA_EXT_SUPERSET (_name, _id, _sub_exts) \
arch/riscv/kernel/cpufeature.c +40 -20
85 lines not on this page · raw message
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 48/642 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 49/642 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 50/642 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
@@ -3208,7 +3208,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 ) {
@@ -3675,6 +3675,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 ;
@@ -3684,6 +3687,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 ;
@@ -4159,7 +4165,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 51/642 net/mlx5e: Use right API to free bitmap memory
In reply to Sasha LevinFrom: Mark Zhang <[email protected]>
[ Upstream commit cac48eb6d383ee4f037e320608efa5dec029e26a ]
Use bitmap_free() to free memory allocated with bitmap_zalloc_node().
This fixes memtrack error:
mtl rsc inconsistency: memtrack_free: .../drivers/net/ethernet/mellanox/mlx5/core/en_main.c::466: kfree for unknown address=0xFFFF0000CA3619E8, device=0x0
--- drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/en_main.c +2 -2
@@ -359,7 +359,7 @@ static int mlx5e_rq_shampo_hd_info_alloc(struct mlx5e_rq *rq, int node)return 0 ; err_nomem: -kvfree (shampo->bitmap); +bitmap_free (shampo->bitmap);kvfree (shampo->pages);return -ENOMEM ;
@@ -367,7 +367,7 @@ static int mlx5e_rq_shampo_hd_info_alloc(struct mlx5e_rq *rq, int node)static void mlx5e_rq_shampo_hd_info_free (struct mlx5e_rq *rq) { -kvfree (rq->mpwqe.shampo->bitmap); +bitmap_free (rq->mpwqe.shampo->bitmap);kvfree (rq->mpwqe.shampo->pages); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 52/642 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
@@ -282,7 +282,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 53/642 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;
@@ -3822,6 +3848,7 @@ static void rtl_hw_start_8125d(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 54/642 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
@@ -129,6 +129,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
@@ -139,7 +143,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 55/642 PCI: xilinx-cpm: Add cpm_csr register mapping for CPM5_HOST1 variant
In reply to Sasha LevinFrom: Thippeswamy Havalige <[email protected]>
[ Upstream commit 9e141923cf86b2e1c83d21b87fb4de3d14a20c99 ]
Update the CPM5 check to include CPM5_HOST1 variant. Previously, only CPM5 was considered when mapping the "cpm_csr" register.
With this change, CPM5_HOST1 is also supported, ensuring proper resource mapping for this variant.
--- drivers/pci/controller/pcie-xilinx-cpm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pci/controller/pcie-xilinx-cpm.c +2 -1
@@ -538,7 +538,8 @@ static int xilinx_cpm_pcie_parse_dt(struct xilinx_cpm_pcie *port,if (IS_ERR (port->cfg))return PTR_ERR (port->cfg); -if (port->variant->version ==CPM5 ) { +if (port->variant->version ==CPM5 || + port->variant->version ==CPM5_HOST1 ) { port->reg_base =devm_platform_ioremap_resource_byname (pdev,"cpm_csr" );if (IS_ERR (port->reg_base))
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 56/642 i2c: qcom-geni: Update i2c frequency table to match hardware guidance
In reply to Sasha LevinFrom: Mukesh Kumar Savaliya <[email protected]>
[ Upstream commit a815975cbaeb4ab29f45312ef23be2871b2e8b82 ]
With the current settings, the I2C buses are achieving around 370KHz instead of the expected 400KHz. For 100KHz and 1MHz, the settings are now more compliant and adhere to the Qualcomm’s internal programming guide.
Update the I2C frequency table to align with the recommended values outlined in the I2C hardware programming guide, ensuring proper communication and performance.
--- drivers/i2c/busses/i2c-qcom-geni.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/i2c/busses/i2c-qcom-geni.c +3 -3
@@ -148,9 +148,9 @@ struct geni_i2c_clk_fld {* source_clock = 19.2 MHz */ static const struct geni_i2c_clk_fld geni_i2c_clk_map_19p2mhz[] = { - {KHZ (100 ),7 ,10 ,11 ,26 }, - {KHZ (400 ),2 ,5 ,12 ,24 }, - {KHZ (1000 ),1 ,3 ,9 ,18 }, + {KHZ (100 ),7 ,10 ,12 ,26 }, + {KHZ (400 ),2 ,5 ,11 ,22 }, + {KHZ (1000 ),1 ,2 ,8 ,18 }, {}, };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 57/642 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
@@ -1264,6 +1264,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 58/642 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
@@ -113,8 +113,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
@@ -297,21 +296,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",
@@ -404,10 +395,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;
@@ -419,9 +419,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 59/642 drm/amdgpu: rework how the cleaner shader is emitted v3
In reply to Sasha LevinFrom: Christian König <[email protected]>
[ Upstream commit b7fbcd77bb467d09ba14cb4ec3b121dc85bb3100 ]
Instead of emitting the cleaner shader for every job which has the enforce_isolation flag set only emit it for the first submission from every client.
v2: add missing NULL check
v3: fix another NULL pointer deref
--- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 27 ++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +21 -6
@@ -754,6 +754,7 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job, bool need_pipe_sync) {struct amdgpu_device *adev = ring->adev; +struct amdgpu_isolation *isolation = &adev->isolation[ring->xcp_id];unsigned vmhub = ring->vm_hub;struct amdgpu_vmid_mgr *id_mgr = &adev->vm_manager.id_mgr[vmhub];struct amdgpu_vmid *id = &id_mgr->ids[job->vmid];
@@ -761,8 +762,9 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job,bool gds_switch_needed = ring->funcs->emit_gds_switch && job->gds_switch_needed;bool vm_flush_needed = job->vm_needs_flush; -struct dma_fence *fence =NULL ; +bool cleaner_shader_needed = false;bool pasid_mapping_needed = false; +struct dma_fence *fence =NULL ;unsigned int patch;int r;
@@ -785,8 +787,12 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job, pasid_mapping_needed &= adev->gmc.gmc_funcs->emit_pasid_mapping && ring->funcs->emit_wreg; + cleaner_shader_needed = adev->gfx.enable_cleaner_shader && + ring->funcs->emit_cleaner_shader && job->base.s_fence && + &job->base.s_fence->scheduled == isolation->spearhead; +if (!vm_flush_needed && !gds_switch_needed && !need_pipe_sync && - !(job->enforce_isolation && !job->vmid)) + !cleaner_shader_needed)return 0 ;amdgpu_ring_ib_begin (ring);
@@ -797,9 +803,7 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job,if (need_pipe_sync)amdgpu_ring_emit_pipeline_sync (ring); -if (adev->gfx.enable_cleaner_shader && - ring->funcs->emit_cleaner_shader && - job->enforce_isolation) +if (cleaner_shader_needed) ring->funcs->emit_cleaner_shader (ring);if (vm_flush_needed) {
@@ -821,7 +825,7 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job, job->oa_size); } -if (vm_flush_needed || pasid_mapping_needed) { +if (vm_flush_needed || pasid_mapping_needed || cleaner_shader_needed) { r =amdgpu_fence_emit (ring, &fence,NULL ,0 );if (r)return r;
@@ -843,6 +847,17 @@ int amdgpu_vm_flush(struct amdgpu_ring *ring, struct amdgpu_job *job, id->pasid_mapping =dma_fence_get (fence);mutex_unlock (&id_mgr->lock); } + +/* +* Make sure that all other submissions wait for the cleaner shader to +* finish before we push them to the HW. +*/ +if (cleaner_shader_needed) { +mutex_lock (&adev->enforce_isolation_mutex); +dma_fence_put (isolation->spearhead); + isolation->spearhead =dma_fence_get (fence); +mutex_unlock (&adev->enforce_isolation_mutex); + }dma_fence_put (fence);amdgpu_ring_patch_cond_exec (ring, patch);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 60/642 drm/amdgpu: rework how isolation is enforced v2
In reply to Sasha LevinFrom: Christian König <[email protected]>
[ Upstream commit bd22e44ad415ac22e3a4f9a983d2a085f6cb4427 ]
Limiting the number of available VMIDs to enforce isolation causes some issues with gang submit and applying certain HW workarounds which require multiple VMIDs to work correctly.
So instead start to track all submissions to the relevant engines in a per partition data structure and use the dma_fences of the submissions to enforce isolation similar to what a VMID limit does.
v2: use ~0l for jobs without isolation to distinct it from kernel
submissions which uses NULL for the owner. Add some warning when we are OOM.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 13 ++- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 98 +++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 43 ++++------ drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 16 +++- drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 19 +++++ drivers/gpu/drm/amd/amdgpu/amdgpu_sync.h | 1 + 6 files changed, 155 insertions(+), 35 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +11 -2
@@ -1187,9 +1187,15 @@ struct amdgpu_device {bool debug_enable_ras_aca;bool debug_exp_resets; -bool enforce_isolation[MAX_XCP ]; -/* Added this mutex for cleaner shader isolation between GFX and compute processes */ +/* Protection for the following isolation structure */ struct mutex enforce_isolation_mutex; +bool enforce_isolation[MAX_XCP ]; +struct amdgpu_isolation { +void *owner; +struct dma_fence *spearhead; +struct amdgpu_sync active; +struct amdgpu_sync prev; + } isolation[MAX_XCP ];struct amdgpu_init_level *init_lvl; };
@@ -1470,6 +1476,9 @@ void amdgpu_device_pcie_port_wreg(struct amdgpu_device *adev,struct dma_fence *amdgpu_device_get_gang (struct amdgpu_device *adev);struct dma_fence *amdgpu_device_switch_gang (struct amdgpu_device *adev,struct dma_fence *gang); +struct dma_fence *amdgpu_device_enforce_isolation (struct amdgpu_device *adev, +struct amdgpu_ring *ring, +struct amdgpu_job *job);bool amdgpu_device_has_display_hardware (struct amdgpu_device *adev);ssize_t amdgpu_get_soft_full_reset_mask (struct amdgpu_ring *ring);ssize_t amdgpu_show_reset_mask (char *buf,uint32_t supported_reset);
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +97 -1
122 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +15 -28
55 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +12 -4
@@ -342,17 +342,24 @@ amdgpu_job_prepare_job(struct drm_sched_job *sched_job, {struct amdgpu_ring *ring =to_amdgpu_ring (s_entity->rq->sched);struct amdgpu_job *job =to_amdgpu_job (sched_job); -struct dma_fence *fence =NULL ; +struct dma_fence *fence;int r; r =drm_sched_entity_error (s_entity);if (r) goto error; -if (job->gang_submit) +if (job->gang_submit) { fence =amdgpu_device_switch_gang (ring->adev, job->gang_submit); +if (fence) +return fence; + } + + fence =amdgpu_device_enforce_isolation (ring->adev, ring, job); +if (fence) +return fence; -if (!fence && job->vm && !job->vmid) { +if (job->vm && !job->vmid) { r =amdgpu_vmid_grab (job->vm, ring, job, &fence);if (r) {dev_err (ring->adev->dev,"Error getting VM ID (%d)\n" , r);
@@ -365,9 +372,10 @@ amdgpu_job_prepare_job(struct drm_sched_job *sched_job,*/ if (!fence) job->vm =NULL ; +return fence; } -return fence; +return NULL ; error:dma_fence_set_error (&job->base.s_fence->finished, r);
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +19 -0
@@ -399,6 +399,25 @@ int amdgpu_sync_clone(struct amdgpu_sync *source, struct amdgpu_sync *clone)return 0 ; } +/** +* amdgpu_sync_move - move all fences from src to dst +* +* @src: source of the fences, empty after function +* @dst: destination for the fences +* +* Moves all fences from source to destination. All fences in destination are +* freed and source is empty after the function call. +*/ +void amdgpu_sync_move (struct amdgpu_sync *src,struct amdgpu_sync *dst) +{ +unsigned int i; + +amdgpu_sync_free (dst); + +for (i =0 ; i <HASH_SIZE (src->fences); ++i) +hlist_move_list (&src->fences[i], &dst->fences[i]); +} +/** * amdgpu_sync_push_to_job - push fences into job * @sync: sync object to get the fences from
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.h +1 -0
@@ -56,6 +56,7 @@ struct dma_fence *amdgpu_sync_peek_fence(struct amdgpu_sync *sync, struct amdgpu_ring *ring);struct dma_fence *amdgpu_sync_get_fence (struct amdgpu_sync *sync);int amdgpu_sync_clone (struct amdgpu_sync *source,struct amdgpu_sync *clone); +void amdgpu_sync_move (struct amdgpu_sync *src,struct amdgpu_sync *dst);int amdgpu_sync_push_to_job (struct amdgpu_sync *sync,struct amdgpu_job *job);int amdgpu_sync_wait (struct amdgpu_sync *sync,bool intr);void amdgpu_sync_free (struct amdgpu_sync *sync);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 61/642 drm/amdgpu: use GFP_NOWAIT for memory allocations
In reply to Sasha LevinFrom: Christian König <[email protected]>
[ Upstream commit 16590745b571c07869ef8958e0bbe44ab6f08d1f ]
In the critical submission path memory allocations can't wait for reclaim since that can potentially wait for submissions to finish.
Finally clean that up and mark most memory allocations in the critical path with GFP_NOWAIT. The only exception left is the dma_fence_array() used when no VMID is available, but that will be cleaned up later on.
--- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 8 ++++---- drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 18 +++++++++++------- drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 11 +++++++---- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 11 ++++++----- drivers/gpu/drm/amd/amdgpu/amdgpu_sync.h | 3 ++- 6 files changed, 32 insertions(+), 23 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +4 -4
@@ -499,7 +499,7 @@ static int vm_update_pds(struct amdgpu_vm *vm, struct amdgpu_sync *sync)if (ret)return ret; -return amdgpu_sync_fence (sync, vm->last_update); +return amdgpu_sync_fence (sync, vm->last_update,GFP_KERNEL ); }static uint64_t get_pte_flags (struct amdgpu_device *adev,struct kgd_mem *mem)
@@ -1263,7 +1263,7 @@ static int unmap_bo_from_gpuvm(struct kgd_mem *mem, (void )amdgpu_vm_clear_freed (adev, vm, &bo_va->last_pt_update); - (void )amdgpu_sync_fence (sync, bo_va->last_pt_update); + (void )amdgpu_sync_fence (sync, bo_va->last_pt_update,GFP_KERNEL );return 0 ; }
@@ -1287,7 +1287,7 @@ static int update_gpuvm_pte(struct kgd_mem *mem,return ret; } -return amdgpu_sync_fence (sync, bo_va->last_pt_update); +return amdgpu_sync_fence (sync, bo_va->last_pt_update,GFP_KERNEL ); } static int map_bo_to_gpuvm(struct kgd_mem *mem,
@@ -2969,7 +2969,7 @@ int amdgpu_amdkfd_gpuvm_restore_process_bos(void *info, struct dma_fence __rcu * }dma_resv_for_each_fence (&cursor, bo->tbo.base.resv,DMA_RESV_USAGE_KERNEL , fence) { - ret =amdgpu_sync_fence (&sync_obj, fence); + ret =amdgpu_sync_fence (&sync_obj, fence,GFP_KERNEL );if (ret) {pr_debug ("Memory eviction: Sync BO fence failed. Try again\n" ); goto validate_map_fail;
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +11 -7
@@ -428,7 +428,7 @@ static int amdgpu_cs_p2_dependencies(struct amdgpu_cs_parser *p,dma_fence_put (old); } - r =amdgpu_sync_fence (&p->sync, fence); + r =amdgpu_sync_fence (&p->sync, fence,GFP_KERNEL );dma_fence_put (fence);if (r)return r;
@@ -450,7 +450,7 @@ static int amdgpu_syncobj_lookup_and_add(struct amdgpu_cs_parser *p,return r; } - r =amdgpu_sync_fence (&p->sync, fence); + r =amdgpu_sync_fence (&p->sync, fence,GFP_KERNEL );dma_fence_put (fence);return r; }
@@ -1124,7 +1124,8 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p)if (r)return r; - r =amdgpu_sync_fence (&p->sync, fpriv->prt_va->last_pt_update); + r =amdgpu_sync_fence (&p->sync, fpriv->prt_va->last_pt_update, +GFP_KERNEL );if (r)return r;
@@ -1135,7 +1136,8 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p)if (r)return r; - r =amdgpu_sync_fence (&p->sync, bo_va->last_pt_update); + r =amdgpu_sync_fence (&p->sync, bo_va->last_pt_update, +GFP_KERNEL );if (r)return r; }
@@ -1154,7 +1156,8 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p)if (r)return r; - r =amdgpu_sync_fence (&p->sync, bo_va->last_pt_update); + r =amdgpu_sync_fence (&p->sync, bo_va->last_pt_update, +GFP_KERNEL );if (r)return r; }
@@ -1167,7 +1170,7 @@ static int amdgpu_cs_vm_handling(struct amdgpu_cs_parser *p)if (r)return r; - r =amdgpu_sync_fence (&p->sync, vm->last_update); + r =amdgpu_sync_fence (&p->sync, vm->last_update,GFP_KERNEL );if (r)return r;
@@ -1248,7 +1251,8 @@ static int amdgpu_cs_sync_rings(struct amdgpu_cs_parser *p)continue ; } - r =amdgpu_sync_fence (&p->gang_leader->explicit_sync, fence); + r =amdgpu_sync_fence (&p->gang_leader->explicit_sync, fence, +GFP_KERNEL );dma_fence_put (fence);if (r)return r;
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c +7 -4
@@ -209,7 +209,7 @@ static int amdgpu_vmid_grab_idle(struct amdgpu_ring *ring,return 0 ; } - fences =kmalloc_array (id_mgr->num_ids,sizeof (void *),GFP_KERNEL ); + fences =kmalloc_array (id_mgr->num_ids,sizeof (void *),GFP_NOWAIT );if (!fences)return -ENOMEM ;
@@ -313,7 +313,8 @@ static int amdgpu_vmid_grab_reserved(struct amdgpu_vm *vm,/* Good we can use this VMID. Remember this submission as * user of the VMID. */ - r =amdgpu_sync_fence (&(*id)->active, &job->base.s_fence->finished); + r =amdgpu_sync_fence (&(*id)->active, &job->base.s_fence->finished, +GFP_NOWAIT );if (r)return r;
@@ -372,7 +373,8 @@ static int amdgpu_vmid_grab_used(struct amdgpu_vm *vm,* user of the VMID. */ r =amdgpu_sync_fence (&(*id)->active, - &job->base.s_fence->finished); + &job->base.s_fence->finished, +GFP_NOWAIT );if (r)return r;
@@ -424,7 +426,8 @@ int amdgpu_vmid_grab(struct amdgpu_vm *vm, struct amdgpu_ring *ring,/* Remember this submission as user of the VMID */ r =amdgpu_sync_fence (&id->active, - &job->base.s_fence->finished); + &job->base.s_fence->finished, +GFP_NOWAIT );if (r) goto error;
drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c +2 -2
@@ -1335,14 +1335,14 @@ int amdgpu_mes_ctx_map_meta_data(struct amdgpu_device *adev,DRM_ERROR ("failed to do vm_bo_update on meta data\n" ); goto error_del_bo_va; } -amdgpu_sync_fence (&sync, bo_va->last_pt_update); +amdgpu_sync_fence (&sync, bo_va->last_pt_update,GFP_KERNEL ); r =amdgpu_vm_update_pdes (adev, vm, false);if (r) {DRM_ERROR ("failed to update pdes on meta data\n" ); goto error_del_bo_va; } -amdgpu_sync_fence (&sync, vm->last_update); +amdgpu_sync_fence (&sync, vm->last_update,GFP_KERNEL );amdgpu_sync_wait (&sync, false);drm_exec_fini (&exec);
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +6 -5
@@ -152,7 +152,8 @@ static bool amdgpu_sync_add_later(struct amdgpu_sync *sync, struct dma_fence *f)* * Add the fence to the sync object. */ -int amdgpu_sync_fence (struct amdgpu_sync *sync,struct dma_fence *f) +int amdgpu_sync_fence (struct amdgpu_sync *sync,struct dma_fence *f, +gfp_t flags) {struct amdgpu_sync_entry *e;
@@ -162,7 +163,7 @@ int amdgpu_sync_fence(struct amdgpu_sync *sync, struct dma_fence *f)if (amdgpu_sync_add_later (sync, f))return 0 ; - e =kmem_cache_alloc (amdgpu_sync_slab,GFP_KERNEL ); + e =kmem_cache_alloc (amdgpu_sync_slab, flags);if (!e)return -ENOMEM ;
@@ -249,7 +250,7 @@ int amdgpu_sync_resv(struct amdgpu_device *adev, struct amdgpu_sync *sync,struct dma_fence *tmp =dma_fence_chain_contained (f);if (amdgpu_sync_test_fence (adev, mode, owner, tmp)) { - r =amdgpu_sync_fence (sync, f); + r =amdgpu_sync_fence (sync, f,GFP_KERNEL );dma_fence_put (f);if (r)return r;
@@ -281,7 +282,7 @@ int amdgpu_sync_kfd(struct amdgpu_sync *sync, struct dma_resv *resv)if (fence_owner !=AMDGPU_FENCE_OWNER_KFD )continue ; - r =amdgpu_sync_fence (sync, f); + r =amdgpu_sync_fence (sync, f,GFP_KERNEL );if (r)break ; }
@@ -388,7 +389,7 @@ int amdgpu_sync_clone(struct amdgpu_sync *source, struct amdgpu_sync *clone)hash_for_each_safe (source->fences, i, tmp, e, node) { f = e->fence;if (!dma_fence_is_signaled (f)) { - r =amdgpu_sync_fence (clone, f); + r =amdgpu_sync_fence (clone, f,GFP_KERNEL );if (r)return r; }else {
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.h +2 -1
@@ -47,7 +47,8 @@ struct amdgpu_sync { };void amdgpu_sync_create (struct amdgpu_sync *sync); -int amdgpu_sync_fence (struct amdgpu_sync *sync,struct dma_fence *f); +int amdgpu_sync_fence (struct amdgpu_sync *sync,struct dma_fence *f, +gfp_t flags);int amdgpu_sync_resv (struct amdgpu_device *adev,struct amdgpu_sync *sync,struct dma_resv *resv,enum amdgpu_sync_mode mode,void *owner);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 62/642 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
@@ -2006,10 +2006,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 63/642 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 64/642 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 65/642 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
@@ -6776,6 +6776,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);
@@ -6787,9 +6788,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 66/642 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 67/642 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
@@ -188,20 +188,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
@@ -744,10 +744,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
@@ -2180,8 +2180,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 68/642 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
@@ -280,29 +280,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;
@@ -1011,6 +988,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)
@@ -1331,7 +1341,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));
@@ -1346,17 +1355,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 69/642 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
@@ -610,8 +610,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 70/642 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
@@ -224,6 +224,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)
@@ -4123,11 +4141,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 )
@@ -4572,7 +4585,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" );
@@ -4709,7 +4722,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 71/642 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 72/642 wifi: mt76: Check link_conf pointer in mt76_connac_mcu_sta_basic_tlv()
In reply to Sasha LevinFrom: Shayne Chen <[email protected]>
[ Upstream commit 9890624c1b3948c1c7f1d0e19ef0bb7680b8c80d ]
This is a preliminary patch to introduce MLO support for MT7996 driver.
--- drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +1 -1
@@ -391,7 +391,7 @@ void mt76_connac_mcu_sta_basic_tlv(struct mt76_dev *dev, struct sk_buff *skb, basic->conn_type =cpu_to_le32 (CONNECTION_INFRA_BC );if (vif->type ==NL80211_IFTYPE_STATION && - !is_zero_ether_addr (link_conf->bssid)) { + link_conf && !is_zero_ether_addr (link_conf->bssid)) {memcpy (basic->peer_addr, link_conf->bssid,ETH_ALEN ); basic->aid =cpu_to_le16 (vif->cfg.aid); }else {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 73/642 wifi: mt76: scan: fix setting tx_info fields
In reply to Sasha LevinFrom: Felix Fietkau <[email protected]>
[ Upstream commit 5b5f1ca9ce73ab6c35e5cd3348f8432ba190d7f4 ]
ieee80211_tx_prepare_skb initializes the skb cb, so fields need to be set afterwards.
--- drivers/net/wireless/mediatek/mt76/scan.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
drivers/net/wireless/mediatek/mt76/scan.c +13 -8
@@ -52,11 +52,6 @@ mt76_scan_send_probe(struct mt76_dev *dev, struct cfg80211_ssid *ssid)ether_addr_copy (hdr->addr3, req->bssid); } - info =IEEE80211_SKB_CB (skb); -if (req->no_cck) - info->flags |=IEEE80211_TX_CTL_NO_CCK_RATE ; - info->control.flags |=IEEE80211_TX_CTRL_DONT_USE_RATE_MASK ; -if (req->ie_len)skb_put_data (skb, req->ie, req->ie_len);
@@ -64,10 +59,20 @@ mt76_scan_send_probe(struct mt76_dev *dev, struct cfg80211_ssid *ssid)skb_set_queue_mapping (skb,IEEE80211_AC_VO );rcu_read_lock (); -if (ieee80211_tx_prepare_skb (phy->hw, vif, skb, band,NULL )) -mt76_tx (phy,NULL , mvif->wcid, skb); -else + +if (!ieee80211_tx_prepare_skb (phy->hw, vif, skb, band,NULL )) {ieee80211_free_txskb (phy->hw, skb); + goto out; + } + + info =IEEE80211_SKB_CB (skb); +if (req->no_cck) + info->flags |=IEEE80211_TX_CTL_NO_CCK_RATE ; + info->control.flags |=IEEE80211_TX_CTRL_DONT_USE_RATE_MASK ; + +mt76_tx (phy,NULL , mvif->wcid, skb); + +out:rcu_read_unlock (); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 74/642 wifi: mt76: mt7996: implement driver specific get_txpower function
In reply to Sasha LevinFrom: Felix Fietkau <[email protected]>
[ Upstream commit 86db2c5d4ed390b97a5b455a97e2cd9c4f3eff2b ]
Fixes reporting tx power for vifs that don't have a channel context assigned. Report the tx power of a phy that is covered by the vif's radio mask.
--- .../net/wireless/mediatek/mt76/mt7996/main.c | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7996/main.c +28 -1
@@ -601,6 +601,33 @@ static void mt7996_configure_filter(struct ieee80211_hw *hw,mutex_unlock (&dev->mt76.mutex); } +static int +mt7996_get_txpower (struct ieee80211_hw *hw,struct ieee80211_vif *vif, +unsigned int link_id,int *dbm) +{ +struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv; +struct mt7996_phy *phy =mt7996_vif_link_phy (&mvif->deflink); +struct mt7996_dev *dev =mt7996_hw_dev (hw); +struct wireless_dev *wdev; +int n_chains, delta, i; + +if (!phy) { + wdev =ieee80211_vif_to_wdev (vif); +for (i =0 ; i < hw->wiphy->n_radio; i++) +if (wdev->radio_mask &BIT (i)) + phy = dev->radio_phy[i]; + +if (!phy) +return -EINVAL ; + } + + n_chains =hweight16 (phy->mt76->chainmask); + delta =mt76_tx_power_nss_delta (n_chains); + *dbm =DIV_ROUND_UP (phy->mt76->txpower_cur + delta,2 ); + +return 0 ; +} +static u8 mt7996_get_rates_table (struct mt7996_phy *phy,struct ieee80211_bss_conf *conf,bool beacon,bool mcast)
@@ -1650,7 +1677,7 @@ const struct ieee80211_ops mt7996_ops = { .remain_on_channel = mt76_remain_on_channel, .cancel_remain_on_channel = mt76_cancel_remain_on_channel, .release_buffered_frames = mt76_release_buffered_frames, - .get_txpower = mt76_get_txpower, + .get_txpower = mt7996_get_txpower, .channel_switch_beacon = mt7996_channel_switch_beacon, .get_stats = mt7996_get_stats, .get_et_sset_count = mt7996_get_et_sset_count,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 75/642 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
@@ -491,6 +491,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 76/642 wifi: mt76: mt7996: use the correct vif link for scanning/roc
In reply to Sasha LevinFrom: Felix Fietkau <[email protected]>
[ Upstream commit 13b4c81083cc4b59fb639a511c0a9a7c38efde7e ]
Use the newly added offchannel_link pointer in vif data
--- .../net/wireless/mediatek/mt76/mt7996/mac.c | 40 +++++++++++++------ .../net/wireless/mediatek/mt76/mt7996/main.c | 1 + 2 files changed, 28 insertions(+), 13 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7996/mac.c +27 -13
@@ -832,7 +832,8 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi,u8 band_idx = (info->hw_queue &MT_TX_HW_QUEUE_PHY ) >>2 ;u8 p_fmt, q_idx, omac_idx =0 , wmm_idx =0 ;bool is_8023 = info->flags &IEEE80211_TX_CTL_HW_80211_ENCAP ; -struct mt76_vif_link *mvif; +struct mt76_vif_link *mlink =NULL ; +struct mt7996_vif *mvif;u16 tx_count =15 ;u32 val; bool inband_disc = !!(changed & (BSS_CHANGED_UNSOL_BCAST_PROBE_RESP |
@@ -840,11 +841,18 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi,bool beacon = !!(changed & (BSS_CHANGED_BEACON |BSS_CHANGED_BEACON_ENABLED )) && (!inband_disc); - mvif = vif ? (struct mt76_vif_link *)vif->drv_priv :NULL ; -if (mvif) { - omac_idx = mvif->omac_idx; - wmm_idx = mvif->wmm_idx; - band_idx = mvif->band_idx; +if (vif) { + mvif = (struct mt7996_vif *)vif->drv_priv; +if (wcid->offchannel) + mlink =rcu_dereference (mvif->mt76.offchannel_link); +if (!mlink) + mlink = &mvif->deflink.mt76; + } + +if (mlink) { + omac_idx = mlink->omac_idx; + wmm_idx = mlink->wmm_idx; + band_idx = mlink->band_idx; }if (inband_disc) {
@@ -910,13 +918,13 @@ void mt7996_mac_write_txwi(struct mt7996_dev *dev, __le32 *txwi,is_multicast_ether_addr (hdr->addr1);u8 idx =MT7996_BASIC_RATES_TBL ; -if (mvif) { -if (mcast && mvif->mcast_rates_idx) - idx = mvif->mcast_rates_idx; -else if (beacon && mvif->beacon_rates_idx) - idx = mvif->beacon_rates_idx; +if (mlink) { +if (mcast && mlink->mcast_rates_idx) + idx = mlink->mcast_rates_idx; +else if (beacon && mlink->beacon_rates_idx) + idx = mlink->beacon_rates_idx;else - idx = mvif->basic_rates_idx; + idx = mlink->basic_rates_idx; } val =FIELD_PREP (MT_TXD6_TX_RATE , idx) |MT_TXD6_FIXED_BW ;
@@ -984,8 +992,14 @@ int mt7996_tx_prepare_skb(struct mt76_dev *mdev, void *txwi_ptr,if (vif) {struct mt7996_vif *mvif = (struct mt7996_vif *)vif->drv_priv; +struct mt76_vif_link *mlink =NULL ; + +if (wcid->offchannel) + mlink =rcu_dereference (mvif->mt76.offchannel_link); +if (!mlink) + mlink = &mvif->deflink.mt76; - txp->fw.bss_idx = mvif->deflink.mt76.idx; + txp->fw.bss_idx = mlink->idx; } txp->fw.token =cpu_to_le16 (id);
drivers/net/wireless/mediatek/mt76/mt7996/main.c +1 -0
@@ -249,6 +249,7 @@ int mt7996_vif_link_add(struct mt76_phy *mphy, struct ieee80211_vif *vif, mlink->band_idx = band_idx; mlink->wmm_idx = vif->type ==NL80211_IFTYPE_AP ?0 :3 ; mlink->wcid = &link->sta.wcid; + mlink->wcid->offchannel = mlink->offchannel; ret =mt7996_mcu_add_dev_info (phy, vif, link_conf, mlink, true);if (ret)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 77/642 wifi: mt76: scan: set vif offchannel link for scanning/roc
In reply to Sasha LevinFrom: Felix Fietkau <[email protected]>
[ Upstream commit 3ba20af886d1f604dceeb4d4c8ff872e2c4e885e ]
The driver needs to know what vif link to use
--- drivers/net/wireless/mediatek/mt76/channel.c | 3 +++ drivers/net/wireless/mediatek/mt76/mt76.h | 2 ++ 2 files changed, 5 insertions(+)
drivers/net/wireless/mediatek/mt76/channel.c +3 -0
@@ -293,6 +293,7 @@ struct mt76_vif_link *mt76_get_vif_phy_link(struct mt76_phy *phy,kfree (mlink);return ERR_PTR (ret); } +rcu_assign_pointer (mvif->offchannel_link, mlink);return mlink; }
@@ -301,10 +302,12 @@ void mt76_put_vif_phy_link(struct mt76_phy *phy, struct ieee80211_vif *vif, struct mt76_vif_link *mlink) {struct mt76_dev *dev = phy->dev; +struct mt76_vif_data *mvif = mlink->mvif;if (IS_ERR_OR_NULL (mlink) || !mlink->offchannel)return ; +rcu_assign_pointer (mvif->offchannel_link,NULL ); dev->drv->vif_link_remove (phy, vif, &vif->bss_conf, mlink);kfree (mlink); }
drivers/net/wireless/mediatek/mt76/mt76.h +2 -0
@@ -351,6 +351,7 @@ struct mt76_wcid {u8 hw_key_idx;u8 hw_key_idx2; + u8 offchannel:1; u8 sta:1; u8 sta_disabled:1; u8 amsdu:1;
@@ -788,6 +789,7 @@ struct mt76_vif_link {struct mt76_vif_data {struct mt76_vif_link __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS ]; +struct mt76_vif_link __rcu *offchannel_link;struct mt76_phy *roc_phy;u16 valid_links;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 78/642 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 79/642 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
@@ -1413,7 +1413,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 :
@@ -1456,7 +1456,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 80/642 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
@@ -631,6 +631,54 @@ int mt7925_mcu_uni_rx_ba(struct mt792x_dev *dev, enable, false); } +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;
@@ -639,13 +687,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;
@@ -690,6 +745,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
@@ -167,9 +167,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 81/642 wifi: mt76: mt7925: Simplify HIF suspend handling to avoid suspend fail
In reply to Sasha LevinFrom: Quan Zhou <[email protected]>
[ Upstream commit bf39813599b0375a3eebbbc6837f728554b3883a ]
System suspend failures may occur due to inappropriate handling of traffic not idle event by the WiFi driver. The WiFi firmware's traffic not idle indication does not need to be tied to suspend. Fix the flow to ensuring the system can suspend properly.
--- drivers/net/wireless/mediatek/mt76/mt7925/mcu.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7925/mcu.c +4 -8
@@ -348,14 +348,10 @@ mt7925_mcu_handle_hif_ctrl_basic(struct mt792x_dev *dev, struct tlv *tlv) basic = (struct mt7925_mcu_hif_ctrl_basic_tlv *)tlv;if (basic->hifsuspend) { -if (basic->hif_tx_traffic_status ==HIF_TRAFFIC_IDLE && - basic->hif_rx_traffic_status ==HIF_TRAFFIC_IDLE ) -/* success */ - dev->hif_idle = true; -else -/* busy */ -/* invalid */ - dev->hif_idle = false; + dev->hif_idle = true; +if (!(basic->hif_tx_traffic_status ==HIF_TRAFFIC_IDLE && + basic->hif_rx_traffic_status ==HIF_TRAFFIC_IDLE )) +dev_info (dev->mt76.dev,"Hif traffic not idle.\n" ); }else { dev->hif_resumed = true; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 82/642 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
@@ -3294,6 +3294,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 83/642 x86/headers: Replace __ASSEMBLY__ with __ASSEMBLER__ in non-UAPI headers
In reply to Sasha LevinFrom: Thomas Huth <[email protected]>
[ Upstream commit 24a295e4ef1ca8e97d8b7015e1887b6e83e1c8be ]
While the GCC and Clang compilers already define __ASSEMBLER__ automatically when compiling assembly code, __ASSEMBLY__ is a macro that only gets defined by the Makefiles in the kernel.
This can be very confusing when switching between userspace and kernelspace coding, or when dealing with UAPI headers that rather should use __ASSEMBLER__ instead. So let's standardize on the __ASSEMBLER__ macro that is provided by the compilers now.
This is mostly a mechanical patch (done with a simple "sed -i" statement), with some manual tweaks in <asm/frame.h>, <asm/hw_irq.h> and <asm/setup.h> that mentioned this macro in comments with some missing underscores.
--- arch/x86/boot/boot.h | 4 ++-- arch/x86/entry/vdso/extable.h | 2 +- arch/x86/include/asm/alternative.h | 6 +++--- arch/x86/include/asm/asm.h | 10 +++++----- arch/x86/include/asm/boot.h | 2 +- arch/x86/include/asm/cpufeature.h | 4 ++-- arch/x86/include/asm/cpumask.h | 4 ++-- arch/x86/include/asm/current.h | 4 ++-- arch/x86/include/asm/desc_defs.h | 4 ++-- arch/x86/include/asm/dwarf2.h | 2 +- arch/x86/include/asm/fixmap.h | 4 ++-- arch/x86/include/asm/frame.h | 10 +++++----- arch/x86/include/asm/fred.h | 4 ++-- arch/x86/include/asm/fsgsbase.h | 4 ++-- arch/x86/include/asm/ftrace.h | 8 ++++---- arch/x86/include/asm/hw_irq.h | 4 ++-- arch/x86/include/asm/ibt.h | 12 ++++++------ arch/x86/include/asm/idtentry.h | 6 +++--- arch/x86/include/asm/inst.h | 2 +- arch/x86/include/asm/irqflags.h | 10 +++++----- arch/x86/include/asm/jump_label.h | 4 ++-- arch/x86/include/asm/kasan.h | 2 +- arch/x86/include/asm/kexec.h | 4 ++-- arch/x86/include/asm/linkage.h | 6 +++--- arch/x86/include/asm/mem_encrypt.h | 4 ++-- arch/x86/include/asm/msr.h | 4 ++-- arch/x86/include/asm/nops.h | 2 +- arch/x86/include/asm/nospec-branch.h | 6 +++--- arch/x86/include/asm/orc_types.h | 4 ++-- arch/x86/include/asm/page.h | 4 ++-- arch/x86/include/asm/page_32.h | 4 ++-- arch/x86/include/asm/page_32_types.h | 4 ++-- arch/x86/include/asm/page_64.h | 4 ++-- arch/x86/include/asm/page_64_types.h | 2 +- arch/x86/include/asm/page_types.h | 4 ++-- arch/x86/include/asm/paravirt.h | 14 +++++++------- arch/x86/include/asm/paravirt_types.h | 4 ++-- arch/x86/include/asm/percpu.h | 4 ++-- arch/x86/include/asm/pgtable-2level_types.h | 4 ++-- arch/x86/include/asm/pgtable-3level_types.h | 4 ++-- arch/x86/include/asm/pgtable-invert.h | 4 ++-- arch/x86/include/asm/pgtable.h | 12 ++++++------ arch/x86/include/asm/pgtable_32.h | 4 ++-- arch/x86/include/asm/pgtable_32_areas.h | 2 +- arch/x86/include/asm/pgtable_64.h | 6 +++--- arch/x86/include/asm/pgtable_64_types.h | 4 ++-- arch/x86/include/asm/pgtable_types.h | 10 +++++----- arch/x86/include/asm/prom.h | 4 ++-- arch/x86/include/asm/pti.h | 4 ++-- arch/x86/include/asm/ptrace.h | 4 ++-- arch/x86/include/asm/purgatory.h | 4 ++-- arch/x86/include/asm/pvclock-abi.h | 4 ++-- arch/x86/include/asm/realmode.h | 4 ++-- arch/x86/include/asm/segment.h | 8 ++++---- arch/x86/include/asm/setup.h | 6 +++--- arch/x86/include/asm/setup_data.h | 4 ++-- arch/x86/include/asm/shared/tdx.h | 4 ++-- arch/x86/include/asm/shstk.h | 4 ++-- arch/x86/include/asm/signal.h | 8 ++++---- arch/x86/include/asm/smap.h | 6 +++--- arch/x86/include/asm/smp.h | 4 ++-- arch/x86/include/asm/tdx.h | 4 ++-- arch/x86/include/asm/thread_info.h | 12 ++++++------ arch/x86/include/asm/unwind_hints.h | 4 ++-- arch/x86/include/asm/vdso/getrandom.h | 4 ++-- arch/x86/include/asm/vdso/gettimeofday.h | 4 ++-- arch/x86/include/asm/vdso/processor.h | 4 ++-- arch/x86/include/asm/vdso/vsyscall.h | 4 ++-- arch/x86/include/asm/xen/interface.h | 10 +++++----- arch/x86/include/asm/xen/interface_32.h | 4 ++-- arch/x86/include/asm/xen/interface_64.h | 4 ++-- arch/x86/math-emu/control_w.h | 2 +- arch/x86/math-emu/exception.h | 6 +++--- arch/x86/math-emu/fpu_emu.h | 6 +++--- arch/x86/math-emu/status_w.h | 6 +++--- arch/x86/realmode/rm/realmode.h | 4 ++-- arch/x86/realmode/rm/wakeup.h | 2 +- tools/arch/x86/include/asm/asm.h | 8 ++++---- tools/arch/x86/include/asm/nops.h | 2 +- tools/arch/x86/include/asm/orc_types.h | 4 ++-- tools/arch/x86/include/asm/pvclock-abi.h | 4 ++-- 81 files changed, 201 insertions(+), 201 deletions(-)
arch/x86/boot/boot.h +2 -2
@@ -16,7 +16,7 @@#define STACK_SIZE 1024/* Minimum number of bytes for stack */ -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/stdarg.h> #include <linux/types.h>
@@ -327,6 +327,6 @@ void probe_cards(int unsafe);/* video-vesa.c */ void vesa_store_edid (void ); -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* BOOT_BOOT_H */
arch/x86/entry/vdso/extable.h +1 -1
@@ -7,7 +7,7 @@* vDSO uses a dedicated handler the addresses are relative to the overall * exception table, not each individual entry. */ -#ifdef __ASSEMBLY__ +#ifdef __ASSEMBLER__#define _ASM_VDSO_EXTABLE_HANDLE (from, to) \ ASM_VDSO_EXTABLE_HANDLE from to
arch/x86/include/asm/alternative.h +3 -3
@@ -15,7 +15,7 @@#define ALT_DIRECT_CALL (feature) ((ALT_FLAG_DIRECT_CALL << ALT_FLAGS_SHIFT) | (feature))#define ALT_CALL_ALWAYS ALT_DIRECT_CALL(X86_FEATURE_ALWAYS) -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/stddef.h>
@@ -286,7 +286,7 @@ static inline int alternatives_text_reserved(void *start, void *end)void BUG_func (void );void nop_func (void ); -#else /* __ASSEMBLY__ */ +#else /* __ASSEMBLER__ */ #ifdef CONFIG_SMP .macro LOCK_PREFIX
@@ -369,6 +369,6 @@ void nop_func(void); ALTERNATIVE_2 oldinstr, newinstr_no, X86_FEATURE_ALWAYS, \ newinstr_yes, ft_flags -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _ASM_X86_ALTERNATIVE_H */
arch/x86/include/asm/asm.h +5 -5
@@ -2,7 +2,7 @@#ifndef _ASM_X86_ASM_H#define _ASM_X86_ASM_H -#ifdef __ASSEMBLY__ +#ifdef __ASSEMBLER__# define __ASM_FORM (x, ...) x,## __VA_ARGS__# define __ASM_FORM_RAW (x, ...) x,## __VA_ARGS__# define __ASM_FORM_COMMA (x, ...) x,## __VA_ARGS__,
@@ -113,7 +113,7 @@#endif -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__ #ifndef __pic__ static __always_inline __pure void *rip_rel_ptr(void *p) {
@@ -144,7 +144,7 @@ static __always_inline __pure void *rip_rel_ptr(void *p)# include <asm/extable_fixup_types.h> /* Exception table entry */ -#ifdef __ASSEMBLY__ +#ifdef __ASSEMBLER__# define _ASM_EXTABLE_TYPE (from, to, type) \ .pushsection "__ex_table","a" ; \
@@ -164,7 +164,7 @@ static __always_inline __pure void *rip_rel_ptr(void *p)# define _ASM_NOKPROBE (entry)# endif -#else /* ! __ASSEMBLY__ */ +#else /* ! __ASSEMBLER__ */ # define DEFINE_EXTABLE_TYPE_REG \ ".macro extable_type_reg type:req reg:req\n" \
@@ -221,7 +221,7 @@ static __always_inline __pure void *rip_rel_ptr(void *p)*/ registerunsigned long current_stack_pointer asm (_ASM_SP );#define ASM_CALL_CONSTRAINT "+r" (current_stack_pointer) -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #define _ASM_EXTABLE (from, to) \ _ASM_EXTABLE_TYPE(from, to, EX_TYPE_DEFAULT)
arch/x86/include/asm/boot.h +1 -1
@@ -74,7 +74,7 @@# define BOOT_STACK_SIZE 0x1000#endif -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__extern unsigned int output_len;extern const unsigned long kernel_text_size;extern const unsigned long kernel_total_size;
arch/x86/include/asm/cpufeature.h +2 -2
@@ -4,7 +4,7 @@#include <asm/processor.h> -#if defined(__KERNEL__) && !defined(__ASSEMBLY__) +#if defined(__KERNEL__) && !defined(__ASSEMBLER__)#include <asm/asm.h> #include <linux/bitops.h>
@@ -208,5 +208,5 @@ static __always_inline bool _static_cpu_has(u16 bit)#define CPU_FEATURE_TYPEVAL boot_cpu_data.x86_vendor, boot_cpu_data.x86, \ boot_cpu_data.x86_model -#endif /* defined(__KERNEL__) && !defined(__ASSEMBLY__) */ +#endif /* defined(__KERNEL__) && !defined(__ASSEMBLER__) */ #endif /* _ASM_X86_CPUFEATURE_H */
arch/x86/include/asm/cpumask.h +2 -2
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_CPUMASK_H#define _ASM_X86_CPUMASK_H -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/cpumask.h> extern void setup_cpu_local_masks (void );
@@ -34,5 +34,5 @@ static __always_inline void arch_cpumask_clear_cpu(int cpu, struct cpumask *dstp#define arch_cpu_is_offline (cpu) unlikely(!arch_cpu_online(cpu)) -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _ASM_X86_CPUMASK_H */
arch/x86/include/asm/current.h +2 -2
@@ -5,7 +5,7 @@#include <linux/build_bug.h> #include <linux/compiler.h> -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/cache.h> #include <asm/percpu.h>
@@ -51,6 +51,6 @@ static __always_inline struct task_struct *get_current(void)#define current get_current() -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _ASM_X86_CURRENT_H */
arch/x86/include/asm/desc_defs.h +2 -2
@@ -58,7 +58,7 @@#define DESC_USER (_DESC_DPL(3)) -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/types.h>
@@ -166,7 +166,7 @@ struct desc_ptr {unsigned long address; } __attribute__((packed)) ; -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ /* Boot IDT definitions */ #define BOOT_IDT_ENTRIES 32
arch/x86/include/asm/dwarf2.h +1 -1
@@ -2,7 +2,7 @@#ifndef _ASM_X86_DWARF2_H#define _ASM_X86_DWARF2_H -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#warning "asm/dwarf2.h should be only included in pure assembly files"#endif
arch/x86/include/asm/fixmap.h +2 -2
@@ -31,7 +31,7 @@/* fixmap starts downwards from the 507th entry in level2_fixmap_pgt */ #define FIXMAP_PMD_TOP 507 -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/kernel.h> #include <asm/apicdef.h> #include <asm/page.h>
@@ -196,5 +196,5 @@ void __init *early_memremap_decrypted_wp(resource_size_t phys_addr,void __early_set_fixmap (enum fixed_addresses idx,phys_addr_t phys,pgprot_t flags); -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ #endif /* _ASM_X86_FIXMAP_H */
arch/x86/include/asm/frame.h +5 -5
@@ -11,7 +11,7 @@#ifdef CONFIG_FRAME_POINTER -#ifdef __ASSEMBLY__ +#ifdef __ASSEMBLER__ .macro FRAME_BEGIN push %_ASM_BP
@@ -51,7 +51,7 @@ .endm#endif /* CONFIG_X86_64 */ -#else /* !__ASSEMBLY__ */ +#else /* !__ASSEMBLER__ */ #define FRAME_BEGIN \ "push %" _ASM_BP "\n" \
@@ -82,18 +82,18 @@ static inline unsigned long encode_frame_pointer(struct pt_regs *regs)#endif /* CONFIG_X86_64 */ -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #define FRAME_OFFSET __ASM_SEL(4, 8)#else /* !CONFIG_FRAME_POINTER */ -#ifdef __ASSEMBLY__ +#ifdef __ASSEMBLER__ .macro ENCODE_FRAME_POINTER ptregs_offset=0 .endm -#else /* !__ASSEMBLY */ +#else /* !__ASSEMBLER__ */ #define ENCODE_FRAME_POINTER
arch/x86/include/asm/fred.h +2 -2
@@ -32,7 +32,7 @@#define FRED_CONFIG_INT_STKLVL (l) (_AT(unsigned long, l) << 9)#define FRED_CONFIG_ENTRYPOINT (p) _AT(unsigned long, (p)) -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#ifdef CONFIG_X86_FRED #include <linux/kernel.h>
@@ -113,6 +113,6 @@ static inline void fred_entry_from_kvm(unsigned int type, unsigned int vector) {static inline void fred_sync_rsp0 (unsigned long rsp0) { }static inline void fred_update_rsp0 (void ) { }#endif /* CONFIG_X86_FRED */ -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ #endif /* ASM_X86_FRED_H */
arch/x86/include/asm/fsgsbase.h +2 -2
@@ -2,7 +2,7 @@#ifndef _ASM_FSGSBASE_H#define _ASM_FSGSBASE_H -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#ifdef CONFIG_X86_64
@@ -80,6 +80,6 @@ extern unsigned long x86_fsgsbase_read_task(struct task_struct *task,#endif /* CONFIG_X86_64 */ -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _ASM_FSGSBASE_H */
arch/x86/include/asm/ftrace.h +4 -4
@@ -22,7 +22,7 @@#define ARCH_SUPPORTS_FTRACE_OPS 1#endif -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__extern void __fentry__ (void );static inline unsigned long ftrace_call_adjust (unsigned long addr)
@@ -118,11 +118,11 @@ struct dyn_arch_ftrace { };#endif /* CONFIG_DYNAMIC_FTRACE */ -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* CONFIG_FUNCTION_TRACER */ -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__void prepare_ftrace_return (unsigned long ip,unsigned long *parent,unsigned long frame_pointer);
@@ -166,6 +166,6 @@ static inline bool arch_trace_is_compat_syscall(struct pt_regs *regs) }#endif /* CONFIG_FTRACE_SYSCALLS && CONFIG_IA32_EMULATION */ #endif /* !COMPILE_OFFSETS */ -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ #endif /* _ASM_X86_FTRACE_H */
arch/x86/include/asm/hw_irq.h +2 -2
@@ -16,7 +16,7 @@#include <asm/irq_vectors.h> -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/percpu.h> #include <linux/profile.h>
@@ -128,6 +128,6 @@ extern char spurious_entries_start[];typedef struct irq_desc *vector_irq_t [NR_VECTORS ];DECLARE_PER_CPU (vector_irq_t, vector_irq); -#endif /* !ASSEMBLY_ */ +#endif /* !__ASSEMBLER__ */ #endif /* _ASM_X86_HW_IRQ_H */
arch/x86/include/asm/ibt.h +6 -6
@@ -21,7 +21,7 @@#define HAS_KERNEL_IBT 1 -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#ifdef CONFIG_X86_64 #define ASM_ENDBR "endbr64\n\t"
@@ -77,7 +77,7 @@ static inline bool is_endbr(u32 val) extern __noendbr u64 ibt_save(bool disable); extern __noendbr void ibt_restore(u64 save); -#else /* __ASSEMBLY__ */ +#else /* __ASSEMBLER__ */ #ifdef CONFIG_X86_64 #define ENDBR endbr64
@@ -85,13 +85,13 @@ extern __noendbr void ibt_restore(u64 save);#define ENDBR endbr32#endif -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #else /* !IBT */ #define HAS_KERNEL_IBT 0 -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#define ASM_ENDBR #define IBT_NOSEAL (name)
@@ -103,11 +103,11 @@ static inline bool is_endbr(u32 val) { return false; }static inline u64 ibt_save (bool disable) {return 0 ; }static inline void ibt_restore (u64 save) { } -#else /* __ASSEMBLY__ */ +#else /* __ASSEMBLER__ */ #define ENDBR -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* CONFIG_X86_KERNEL_IBT */
arch/x86/include/asm/idtentry.h +3 -3
@@ -7,7 +7,7 @@#define IDT_ALIGN (8 * (1 + HAS_KERNEL_IBT)) -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/entry-common.h> #include <linux/hardirq.h>
@@ -474,7 +474,7 @@ static inline void fred_install_sysvec(unsigned int vector, const idtentry_t fun idt_install_sysvec(vector, asm_##function); \ } -#else /* !__ASSEMBLY__ */ +#else /* !__ASSEMBLER__ */ /* * The ASM variants for DECLARE_IDTENTRY*() which emit the ASM entry stubs.
@@ -579,7 +579,7 @@ SYM_CODE_START(spurious_entries_start) SYM_CODE_END(spurious_entries_start)#endif -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ /* * The actual entry points. Note that DECLARE_IDTENTRY*() serves two
arch/x86/include/asm/inst.h +1 -1
@@ -6,7 +6,7 @@#ifndef X86_ASM_INST_H #define X86_ASM_INST_H -#ifdef __ASSEMBLY__ +#ifdef __ASSEMBLER__#define REG_NUM_INVALID 100
arch/x86/include/asm/irqflags.h +5 -5
@@ -4,7 +4,7 @@#include <asm/processor-flags.h> -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <asm/nospec-branch.h>
@@ -101,7 +101,7 @@ static __always_inline void halt(void)#ifdef CONFIG_PARAVIRT_XXL #include <asm/paravirt.h> #else -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/types.h> static __always_inline unsigned long arch_local_save_flags (void )
@@ -137,10 +137,10 @@ static __always_inline unsigned long arch_local_irq_save(void)#endif -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* CONFIG_PARAVIRT_XXL */ -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__ static __always_inline int arch_irqs_disabled_flags(unsigned long flags) {return !(flags &X86_EFLAGS_IF );
@@ -158,6 +158,6 @@ static __always_inline void arch_local_irq_restore(unsigned long flags)if (!arch_irqs_disabled_flags (flags))arch_local_irq_enable (); } -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ #endif
arch/x86/include/asm/jump_label.h +2 -2
@@ -7,7 +7,7 @@#include <asm/asm.h> #include <asm/nops.h> -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/stringify.h> #include <linux/types.h>
@@ -55,6 +55,6 @@ static __always_inline bool arch_static_branch_jump(struct static_key * const keextern int arch_jump_entry_size (struct jump_entry *entry); -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif
arch/x86/include/asm/kasan.h +1 -1
@@ -23,7 +23,7 @@ (1ULL << (__VIRTUAL_MASK_SHIFT - \ KASAN_SHADOW_SCALE_SHIFT))) -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#ifdef CONFIG_KASAN void __init kasan_early_init (void );
arch/x86/include/asm/kexec.h +2 -2
@@ -13,7 +13,7 @@# define KEXEC_CONTROL_PAGE_SIZE 4096# define KEXEC_CONTROL_CODE_MAX_SIZE 2048 -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/string.h> #include <linux/kernel.h>
@@ -225,6 +225,6 @@ unsigned int arch_crash_get_elfcorehdr_size(void);#define crash_get_elfcorehdr_size arch_crash_get_elfcorehdr_size#endif -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _ASM_X86_KEXEC_H */
arch/x86/include/asm/linkage.h +3 -3
@@ -38,7 +38,7 @@#define ASM_FUNC_ALIGN __stringify(__FUNC_ALIGN)#define SYM_F_ALIGN __FUNC_ALIGN -#ifdef __ASSEMBLY__ +#ifdef __ASSEMBLER__#if defined(CONFIG_MITIGATION_RETHUNK ) && !defined(__DISABLE_EXPORTS) && !defined(BUILD_VDSO )#define RET jmp __x86_return_thunk
@@ -50,7 +50,7 @@#endif #endif /* CONFIG_MITIGATION_RETPOLINE */ -#else /* __ASSEMBLY__ */ +#else /* __ASSEMBLER__ */ #if defined(CONFIG_MITIGATION_RETHUNK ) && !defined(__DISABLE_EXPORTS) && !defined(BUILD_VDSO )#define ASM_RET "jmp __x86_return_thunk\n\t"
@@ -62,7 +62,7 @@#endif #endif /* CONFIG_MITIGATION_RETPOLINE */ -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ /* * Depending on -fpatchable-function-entry=N,N usage (CONFIG_CALL_PADDING) the
arch/x86/include/asm/mem_encrypt.h +2 -2
@@ -10,7 +10,7 @@#ifndef __X86_MEM_ENCRYPT_H__#define __X86_MEM_ENCRYPT_H__ -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/init.h> #include <linux/cc_platform.h>
@@ -114,6 +114,6 @@ void add_encrypt_protection_map(void);extern char __start_bss_decrypted[], __end_bss_decrypted[], __start_bss_decrypted_unused[]; -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* __X86_MEM_ENCRYPT_H__ */
arch/x86/include/asm/msr.h +2 -2
@@ -4,7 +4,7 @@#include "msr-index.h" -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <asm/asm.h> #include <asm/errno.h>
@@ -397,5 +397,5 @@ static inline int wrmsr_safe_regs_on_cpu(unsigned int cpu, u32 regs[8])return wrmsr_safe_regs (regs); }#endif /* CONFIG_SMP */ -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _ASM_X86_MSR_H */
arch/x86/include/asm/nops.h +1 -1
@@ -82,7 +82,7 @@#define ASM_NOP7 _ASM_BYTES(BYTES_NOP7)#define ASM_NOP8 _ASM_BYTES(BYTES_NOP8) -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__extern const unsigned char *const x86_nops[];#endif
arch/x86/include/asm/nospec-branch.h +3 -3
@@ -177,7 +177,7 @@ add $(BITS_PER_LONG/8), %_ASM_SP; \ lfence; -#ifdef __ASSEMBLY__ +#ifdef __ASSEMBLER__/* * (ab)use RETPOLINE_SAFE on RET to annotate away 'bare' RET instructions
@@ -335,7 +335,7 @@#define CLEAR_BRANCH_HISTORY_VMEXIT #endif -#else /* __ASSEMBLY__ */ +#else /* __ASSEMBLER__ */ typedef u8 retpoline_thunk_t [RETPOLINE_THUNK_SIZE ];extern retpoline_thunk_t __x86_indirect_thunk_array[];
@@ -602,6 +602,6 @@ static __always_inline void mds_idle_clear_cpu_buffers(void)mds_clear_cpu_buffers (); } -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _ASM_X86_NOSPEC_BRANCH_H_ */
arch/x86/include/asm/orc_types.h +2 -2
@@ -45,7 +45,7 @@#define ORC_TYPE_REGS 3#define ORC_TYPE_REGS_PARTIAL 4 -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <asm/byteorder.h> /*
@@ -73,6 +73,6 @@ struct orc_entry {#endif } __packed; -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _ORC_TYPES_H */
arch/x86/include/asm/page.h +2 -2
@@ -14,7 +14,7 @@#include <asm/page_32.h> #endif /* CONFIG_X86_64 */ -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__struct page ;
@@ -84,7 +84,7 @@ static __always_inline u64 __is_canonical_address(u64 vaddr, u8 vaddr_bits) return __canonical_address(vaddr, vaddr_bits) == vaddr; } -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #include <asm-generic/memory_model.h> #include <asm-generic/getorder.h>
arch/x86/include/asm/page_32.h +2 -2
@@ -4,7 +4,7 @@#include <asm/page_32_types.h> -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#define __phys_addr_nodebug (x) ((x) - PAGE_OFFSET)#ifdef CONFIG_DEBUG_VIRTUAL
@@ -26,6 +26,6 @@ static inline void copy_page(void *to, void *from) {memcpy (to, from,PAGE_SIZE ); } -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ #endif /* _ASM_X86_PAGE_32_H */
arch/x86/include/asm/page_32_types.h +2 -2
@@ -63,7 +63,7 @@*/ #define KERNEL_IMAGE_SIZE (512 * 1024 * 1024) -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__/* * This much address space is reserved for vmalloc() and iomap()
@@ -75,6 +75,6 @@ extern int sysctl_legacy_va_layout;extern void find_low_pfn_range (void );extern void setup_bootmem_allocator (void ); -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ #endif /* _ASM_X86_PAGE_32_DEFS_H */
arch/x86/include/asm/page_64.h +2 -2
@@ -4,7 +4,7 @@#include <asm/page_64_types.h> -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <asm/cpufeatures.h> #include <asm/alternative.h>
@@ -94,7 +94,7 @@ static __always_inline unsigned long task_size_max(void) }#endif /* CONFIG_X86_5LEVEL */ -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ #ifdef CONFIG_X86_VSYSCALL_EMULATION # define __HAVE_ARCH_GATE_AREA 1
arch/x86/include/asm/page_64_types.h +1 -1
@@ -2,7 +2,7 @@#ifndef _ASM_X86_PAGE_64_DEFS_H#define _ASM_X86_PAGE_64_DEFS_H -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <asm/kaslr.h> #endif
arch/x86/include/asm/page_types.h +2 -2
@@ -43,7 +43,7 @@#define IOREMAP_MAX_ORDER (PMD_SHIFT)#endif /* CONFIG_X86_64 */ -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#ifdef CONFIG_DYNAMIC_PHYSICAL_MASK extern phys_addr_t physical_mask;
@@ -66,6 +66,6 @@ bool pfn_range_is_mapped(unsigned long start_pfn, unsigned long end_pfn);extern void initmem_init (void ); -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ #endif /* _ASM_X86_PAGE_DEFS_H */
arch/x86/include/asm/paravirt.h +7 -7
@@ -6,7 +6,7 @@#include <asm/paravirt_types.h> -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__struct mm_struct ;#endif
@@ -15,7 +15,7 @@ struct mm_struct;#include <asm/asm.h> #include <asm/nospec-branch.h> -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/bug.h> #include <linux/types.h> #include <linux/cpumask.h>
@@ -720,7 +720,7 @@ static __always_inline unsigned long arch_local_irq_save(void)extern void default_banner (void );void native_pv_lock_init (void )__init ; -#else /* __ASSEMBLY__ */ +#else /* __ASSEMBLER__ */ #ifdef CONFIG_X86_64 #ifdef CONFIG_PARAVIRT_XXL
@@ -740,18 +740,18 @@ void native_pv_lock_init(void) __init;#endif /* CONFIG_PARAVIRT_XXL */ #endif /* CONFIG_X86_64 */ -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #else /* CONFIG_PARAVIRT */ # define default_banner x86_init_noop -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__static inline void native_pv_lock_init (void ) { }#endif #endif /* !CONFIG_PARAVIRT */ -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__ #ifndef CONFIG_PARAVIRT_XXL static inline void paravirt_enter_mmap(struct mm_struct *mm) {
@@ -769,5 +769,5 @@ static inline void paravirt_set_cap(void) { }#endif -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _ASM_X86_PARAVIRT_H */
arch/x86/include/asm/paravirt_types.h +2 -2
@@ -4,7 +4,7 @@#ifdef CONFIG_PARAVIRT -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/types.h> #include <asm/desc_defs.h>
@@ -518,7 +518,7 @@ unsigned long pv_native_read_cr2(void);#define paravirt_nop ((void *)nop_func) -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #define ALT_NOT_XEN ALT_NOT(X86_FEATURE_XENPV)
arch/x86/include/asm/percpu.h +2 -2
@@ -10,7 +10,7 @@# define __percpu_rel#endif -#ifdef __ASSEMBLY__ +#ifdef __ASSEMBLER__#ifdef CONFIG_SMP # define __percpu %__percpu_seg:
@@ -619,7 +619,7 @@ do { \/* We can use this directly for local CPU (faster). */ DECLARE_PER_CPU_READ_MOSTLY(unsigned long, this_cpu_off); -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ #ifdef CONFIG_SMP
arch/x86/include/asm/pgtable-2level_types.h +2 -2
@@ -2,7 +2,7 @@#ifndef _ASM_X86_PGTABLE_2LEVEL_DEFS_H#define _ASM_X86_PGTABLE_2LEVEL_DEFS_H -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/types.h> typedef unsigned long pteval_t ;
@@ -16,7 +16,7 @@ typedef union {pteval_t pte; pteval_t pte_low; } pte_t; -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ #define SHARED_KERNEL_PMD 0
arch/x86/include/asm/pgtable-3level_types.h +2 -2
@@ -2,7 +2,7 @@#ifndef _ASM_X86_PGTABLE_3LEVEL_DEFS_H#define _ASM_X86_PGTABLE_3LEVEL_DEFS_H -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/types.h> typedef u64 pteval_t ;
@@ -25,7 +25,7 @@ typedef union { };pmdval_t pmd; } pmd_t; -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ #define SHARED_KERNEL_PMD (!static_cpu_has(X86_FEATURE_PTI))
arch/x86/include/asm/pgtable-invert.h +2 -2
@@ -2,7 +2,7 @@#ifndef _ASM_PGTABLE_INVERT_H#define _ASM_PGTABLE_INVERT_H 1 -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__/* * A clear pte value is special, and doesn't get inverted.
@@ -36,6 +36,6 @@ static inline u64 flip_protnone_guard(u64 oldval, u64 val, u64 mask)return val; } -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif
arch/x86/include/asm/pgtable.h +6 -6
@@ -15,7 +15,7 @@ cachemode2protval(_PAGE_CACHE_MODE_UC_MINUS))) \ : (prot)) -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/spinlock.h> #include <asm/x86_init.h> #include <asm/pkru.h>
@@ -973,7 +973,7 @@ static inline pgd_t pti_set_user_pgtbl(pgd_t *pgdp, pgd_t pgd) }#endif /* CONFIG_MITIGATION_PAGE_TABLE_ISOLATION */ -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #ifdef CONFIG_X86_32
@@ -982,7 +982,7 @@ static inline pgd_t pti_set_user_pgtbl(pgd_t *pgdp, pgd_t pgd)# include <asm/pgtable_64.h> #endif -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/mm_types.h> #include <linux/mmdebug.h> #include <linux/log2.h>
@@ -1233,12 +1233,12 @@ static inline int pgd_none(pgd_t pgd) }#endif /* CONFIG_PGTABLE_LEVELS > 4 */ -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #define KERNEL_PGD_BOUNDARY pgd_index(PAGE_OFFSET)#define KERNEL_PGD_PTRS (PTRS_PER_PGD - KERNEL_PGD_BOUNDARY) -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__extern int direct_gbpages;void init_mem_mapping (void );
@@ -1812,6 +1812,6 @@ bool arch_is_platform_page(u64 paddr);WARN_ON_ONCE (pgd_present (*pgdp) && !pgd_same (*pgdp, pgd)); \set_pgd (pgdp, pgd); \ }) -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _ASM_X86_PGTABLE_H */
arch/x86/include/asm/pgtable_32.h +2 -2
@@ -13,7 +13,7 @@* This file contains the functions and defines necessary to modify and use * the i386 page table tree. */ -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <asm/processor.h> #include <linux/threads.h> #include <asm/paravirt.h>
@@ -45,7 +45,7 @@ do { \flush_tlb_one_kernel ((vaddr)); \ } while (0) -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ /* * This is used to calculate the .brk reservation for initial pagetables.
arch/x86/include/asm/pgtable_32_areas.h +1 -1
@@ -13,7 +13,7 @@*/ #define VMALLOC_OFFSET (8 * 1024 * 1024) -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__extern bool __vmalloc_start_set;/* set once high_memory is set */ #endif
arch/x86/include/asm/pgtable_64.h +3 -3
@@ -5,7 +5,7 @@#include <linux/const.h> #include <asm/pgtable_64_types.h> -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__/* * This file contains the functions and defines necessary to modify and use
@@ -270,7 +270,7 @@ static inline bool gup_fast_permitted(unsigned long start, unsigned long end)#include <asm/pgtable-invert.h> -#else /* __ASSEMBLY__ */ +#else /* __ASSEMBLER__ */ #define l4_index (x) (((x) >> 39) & 511)#define pud_index (x) (((x) >> PUD_SHIFT) & (PTRS_PER_PUD - 1))
@@ -291,5 +291,5 @@ L3_START_KERNEL = pud_index(__START_KERNEL_map) i = i +1 ; \ .endr -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _ASM_X86_PGTABLE_64_H */
arch/x86/include/asm/pgtable_64_types.h +2 -2
@@ -4,7 +4,7 @@#include <asm/sparsemem.h> -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/types.h> #include <asm/kaslr.h>
@@ -44,7 +44,7 @@ static inline bool pgtable_l5_enabled(void)extern unsigned int pgdir_shift;extern unsigned int ptrs_per_p4d; -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ #define SHARED_KERNEL_PMD 0
arch/x86/include/asm/pgtable_types.h +5 -5
@@ -164,7 +164,7 @@* to have the WB mode at index 0 (all bits clear). This is the default * right now and likely would break too much if changed. */ -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__enum page_cache_mode { _PAGE_CACHE_MODE_WB =0 , _PAGE_CACHE_MODE_WC = 1,
@@ -239,7 +239,7 @@ enum page_cache_mode {#define __PAGE_KERNEL_IO_NOCACHE __PAGE_KERNEL_NOCACHE -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#define __PAGE_KERNEL_ENC (__PAGE_KERNEL | _ENC)#define __PAGE_KERNEL_ENC_WP (__PAGE_KERNEL_WP | _ENC)
@@ -262,7 +262,7 @@ enum page_cache_mode {#define PAGE_KERNEL_IO __pgprot_mask(__PAGE_KERNEL_IO)#define PAGE_KERNEL_IO_NOCACHE __pgprot_mask(__PAGE_KERNEL_IO_NOCACHE) -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ /* * early identity mapping pte attrib macros.
@@ -281,7 +281,7 @@ enum page_cache_mode {# include <asm/pgtable_64_types.h> #endif -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/types.h>
@@ -580,6 +580,6 @@ extern int __init kernel_map_pages_in_pgd(pgd_t *pgd, u64 pfn, unsigned long page_flags);extern int __init kernel_unmap_pages_in_pgd (pgd_t *pgd,unsigned long address,unsigned long numpages); -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ #endif /* _ASM_X86_PGTABLE_DEFS_H */
arch/x86/include/asm/prom.h +2 -2
@@ -8,7 +8,7 @@#ifndef _ASM_X86_PROM_H#define _ASM_X86_PROM_H -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/of.h> #include <linux/types.h>
@@ -33,5 +33,5 @@ static inline void x86_flattree_get_config(void) { }extern char cmd_line[COMMAND_LINE_SIZE ]; -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif
arch/x86/include/asm/pti.h +2 -2
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_PTI_H#define _ASM_X86_PTI_H -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#ifdef CONFIG_MITIGATION_PAGE_TABLE_ISOLATION extern void pti_init (void );
@@ -11,5 +11,5 @@ extern void pti_finalize(void);static inline void pti_check_boottime_disable (void ) { }#endif -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _ASM_X86_PTI_H */
arch/x86/include/asm/ptrace.h +2 -2
@@ -6,7 +6,7 @@#include <asm/page_types.h> #include <uapi/asm/ptrace.h> -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#ifdef __i386__ struct pt_regs {
@@ -469,5 +469,5 @@ extern int do_set_thread_area(struct task_struct *p, int idx,# define do_set_thread_area_64 (p, s, t) (0)#endif -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ #endif /* _ASM_X86_PTRACE_H */
arch/x86/include/asm/purgatory.h +2 -2
@@ -2,10 +2,10 @@#ifndef _ASM_X86_PURGATORY_H#define _ASM_X86_PURGATORY_H -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/purgatory.h> extern void purgatory (void ); -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _ASM_PURGATORY_H */
arch/x86/include/asm/pvclock-abi.h +2 -2
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_PVCLOCK_ABI_H#define _ASM_X86_PVCLOCK_ABI_H -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__/* * These structs MUST NOT be changed.
@@ -44,5 +44,5 @@ struct pvclock_wall_clock {#define PVCLOCK_GUEST_STOPPED (1 << 1)/* PVCLOCK_COUNTS_FROM_ZERO broke ABI and can't be used anymore. */ #define PVCLOCK_COUNTS_FROM_ZERO (1 << 2) -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _ASM_X86_PVCLOCK_ABI_H */
arch/x86/include/asm/realmode.h +2 -2
@@ -9,7 +9,7 @@#define TH_FLAGS_SME_ACTIVE_BIT 0#define TH_FLAGS_SME_ACTIVE BIT(TH_FLAGS_SME_ACTIVE_BIT) -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/types.h> #include <asm/io.h>
@@ -95,6 +95,6 @@ void reserve_real_mode(void);void load_trampoline_pgtable (void );void init_real_mode (void ); -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _ARCH_X86_REALMODE_H */
arch/x86/include/asm/segment.h +4 -4
@@ -233,7 +233,7 @@#define VDSO_CPUNODE_BITS 12#define VDSO_CPUNODE_MASK 0xfff -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__/* Helper functions to store/load CPU and node numbers */
@@ -265,7 +265,7 @@ static inline void vdso_read_cpunode(unsigned *cpu, unsigned *node) *node = (p >> VDSO_CPUNODE_BITS); } -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ #ifdef __KERNEL__
@@ -286,7 +286,7 @@ static inline void vdso_read_cpunode(unsigned *cpu, unsigned *node)*/ #define XEN_EARLY_IDT_HANDLER_SIZE (8 + ENDBR_INSN_SIZE) -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__extern const char early_idt_handler_array[NUM_EXCEPTION_VECTORS ][EARLY_IDT_HANDLER_SIZE ];extern void early_ignore_irq (void );
@@ -350,7 +350,7 @@ static inline void __loadsegment_fs(unsigned short value)#define savesegment (seg, value) \ asm("mov %%" #seg ",%0":"=r" (value) : : "memory") -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ #endif /* __KERNEL__ */ #endif /* _ASM_X86_SEGMENT_H */
arch/x86/include/asm/setup.h +3 -3
@@ -27,7 +27,7 @@#define OLD_CL_ADDRESS 0x020/* Relative to real mode data */ #define NEW_CL_POINTER 0x228/* Relative to real mode data */ -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/cache.h> #include <asm/bootparam.h>
@@ -141,7 +141,7 @@ extern bool builtin_cmdline_added __ro_after_init;#define builtin_cmdline_added 0#endif -#else /* __ASSEMBLY */ +#else /* __ASSEMBLER__ */ .macro __RESERVE_BRK name, size .pushsection .bss..brk, "aw"
@@ -153,6 +153,6 @@ SYM_DATA_END(__brk_\name)#define RESERVE_BRK (name, size) __RESERVE_BRK name, size -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _ASM_X86_SETUP_H */
arch/x86/include/asm/setup_data.h +2 -2
@@ -4,7 +4,7 @@#include <uapi/asm/setup_data.h> -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__ struct pci_setup_rom { struct setup_data data;
@@ -27,6 +27,6 @@ struct efi_setup_data {u64 reserved[8 ]; }; -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _ASM_X86_SETUP_DATA_H */
arch/x86/include/asm/shared/tdx.h +2 -2
@@ -106,7 +106,7 @@#define TDX_PS_1G 2#define TDX_PS_NR (TDX_PS_1G + 1) -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/compiler_attributes.h>
@@ -177,5 +177,5 @@ static __always_inline u64 hcall_func(u64 exit_reason)return exit_reason; } -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ #endif /* _ASM_X86_SHARED_TDX_H */
arch/x86/include/asm/shstk.h +2 -2
@@ -2,7 +2,7 @@#ifndef _ASM_X86_SHSTK_H#define _ASM_X86_SHSTK_H -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/types.h> struct task_struct ;
@@ -37,6 +37,6 @@ static inline int shstk_update_last_frame(unsigned long val) { return 0; }static inline bool shstk_is_enabled (void ) {return false; }#endif /* CONFIG_X86_USER_SHADOW_STACK */ -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _ASM_X86_SHSTK_H */
arch/x86/include/asm/signal.h +4 -4
@@ -2,7 +2,7 @@#ifndef _ASM_X86_SIGNAL_H#define _ASM_X86_SIGNAL_H -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/linkage.h> /* Most things should be clean enough to redefine this at will, if care
@@ -28,9 +28,9 @@ typedef struct {#define SA_IA32_ABI 0x02000000u#define SA_X32_ABI 0x01000000u -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #include <uapi/asm/signal.h> -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#define __ARCH_HAS_SA_RESTORER
@@ -101,5 +101,5 @@ struct pt_regs;#endif /* !__i386__ */ -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _ASM_X86_SIGNAL_H */
arch/x86/include/asm/smap.h +3 -3
@@ -13,7 +13,7 @@#include <asm/cpufeatures.h> #include <asm/alternative.h> -#ifdef __ASSEMBLY__ +#ifdef __ASSEMBLER__#define ASM_CLAC \ ALTERNATIVE "", "clac", X86_FEATURE_SMAP
@@ -21,7 +21,7 @@#define ASM_STAC \ ALTERNATIVE "", "stac", X86_FEATURE_SMAP -#else /* __ASSEMBLY__ */ +#else /* __ASSEMBLER__ */ static __always_inline void clac(void) {
@@ -61,6 +61,6 @@ static __always_inline void smap_restore(unsigned long flags)#define ASM_STAC \ ALTERNATIVE("", "stac", X86_FEATURE_SMAP) -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _ASM_X86_SMAP_H */
arch/x86/include/asm/smp.h +2 -2
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_SMP_H#define _ASM_X86_SMP_H -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/cpumask.h> #include <asm/cpumask.h>
@@ -175,7 +175,7 @@ extern void nmi_selftest(void);extern unsigned int smpboot_control;extern unsigned long apic_mmio_base; -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ /* Control bits for startup_64 */ #define STARTUP_READ_APICID 0x80000000
arch/x86/include/asm/tdx.h +2 -2
@@ -30,7 +30,7 @@#define TDX_SUCCESS 0ULL#define TDX_RND_NO_ENTROPY 0x8000020300000000ULL -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <uapi/asm/mce.h>
@@ -126,5 +126,5 @@ static inline int tdx_enable(void) { return -ENODEV; }static inline const char *tdx_dump_mce_info (struct mce *m) {return NULL ; }#endif /* CONFIG_INTEL_TDX_HOST */ -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ #endif /* _ASM_X86_TDX_H */
arch/x86/include/asm/thread_info.h +6 -6
@@ -54,7 +54,7 @@* - this struct should fit entirely inside of one cache line * - this struct shares the supervisor stack pages */ -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__struct task_struct ;#include <asm/cpufeature.h> #include <linux/atomic.h>
@@ -73,7 +73,7 @@ struct thread_info { .flags = 0, \ } -#else /* !__ASSEMBLY__ */ +#else /* !__ASSEMBLER__ */ #include <asm/asm-offsets.h>
@@ -161,7 +161,7 @@ struct thread_info {* * preempt_count needs to be 1 initially, until the scheduler is functional. */ -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__/* * Walks up the stack frames to make sure that the specified object is
@@ -213,7 +213,7 @@ static inline int arch_within_stack_frames(const void * const stack, #endif } -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ /* * Thread-synchronous status.
@@ -224,7 +224,7 @@ static inline int arch_within_stack_frames(const void * const stack,*/ #define TS_COMPAT 0x0002/* 32bit syscall active (64BIT)*/ -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#ifdef CONFIG_COMPAT #define TS_I386_REGS_POKED 0x0004/* regs poked by 32-bit ptracer */
@@ -242,6 +242,6 @@ static inline int arch_within_stack_frames(const void * const stack,extern void arch_setup_new_exec (void );#define arch_setup_new_exec arch_setup_new_exec -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ #endif /* _ASM_X86_THREAD_INFO_H */
arch/x86/include/asm/unwind_hints.h +2 -2
@@ -5,7 +5,7 @@#include "orc_types.h" -#ifdef __ASSEMBLY__ +#ifdef __ASSEMBLER__ .macro UNWIND_HINT_END_OF_STACKUNWIND_HINT type=UNWIND_HINT_TYPE_END_OF_STACK
@@ -88,6 +88,6 @@#define UNWIND_HINT_RESTORE \ UNWIND_HINT(UNWIND_HINT_TYPE_RESTORE, 0, 0, 0) -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _ASM_X86_UNWIND_HINTS_H */
arch/x86/include/asm/vdso/getrandom.h +2 -2
@@ -5,7 +5,7 @@#ifndef __ASM_VDSO_GETRANDOM_H#define __ASM_VDSO_GETRANDOM_H -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <asm/unistd.h>
@@ -37,6 +37,6 @@ static __always_inline const struct vdso_rng_data *__arch_get_vdso_rng_data(voidreturn &vdso_rng_data; } -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ #endif /* __ASM_VDSO_GETRANDOM_H */
arch/x86/include/asm/vdso/gettimeofday.h +2 -2
@@ -10,7 +10,7 @@#ifndef __ASM_VDSO_GETTIMEOFDAY_H#define __ASM_VDSO_GETTIMEOFDAY_H -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <uapi/linux/time.h> #include <asm/vgtod.h>
@@ -350,6 +350,6 @@ static __always_inline u64 vdso_calc_ns(const struct vdso_data *vd, u64 cycles, }#define vdso_calc_ns vdso_calc_ns -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ #endif /* __ASM_VDSO_GETTIMEOFDAY_H */
arch/x86/include/asm/vdso/processor.h +2 -2
@@ -5,7 +5,7 @@#ifndef __ASM_VDSO_PROCESSOR_H#define __ASM_VDSO_PROCESSOR_H -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ static __always_inline void rep_nop(void)
@@ -22,6 +22,6 @@ struct getcpu_cache;notrace long __vdso_getcpu (unsigned *cpu,unsigned *node,struct getcpu_cache *unused); -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* __ASM_VDSO_PROCESSOR_H */
arch/x86/include/asm/vdso/vsyscall.h +2 -2
@@ -10,7 +10,7 @@#define VDSO_PAGE_PVCLOCK_OFFSET 0#define VDSO_PAGE_HVCLOCK_OFFSET 1 -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <vdso/datapage.h> #include <asm/vgtod.h>
@@ -37,6 +37,6 @@ struct vdso_rng_data *__x86_get_k_vdso_rng_data(void)/* The asm-generic header needs to be included after the definitions above */ #include <asm-generic/vdso/vsyscall.h> -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ #endif /* __ASM_VDSO_VSYSCALL_H */
arch/x86/include/asm/xen/interface.h +5 -5
@@ -72,7 +72,7 @@#endif #endif -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__/* Explicitly size integers that represent pfns in the public interface * with Xen so that on ARM we can have one ABI that works for 32 and 64 * bit guests. */
@@ -137,7 +137,7 @@ DEFINE_GUEST_HANDLE(xen_ulong_t);#define TI_SET_DPL (_ti, _dpl) ((_ti)->flags |= (_dpl))#define TI_SET_IF (_ti, _if) ((_ti)->flags |= ((!!(_if))<<2)) -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__ struct trap_info { uint8_t vector; /* exception vector */ uint8_t flags; /* 0-3: privilege level; 4: clear event enable? */
@@ -186,7 +186,7 @@ struct arch_shared_info {uint32_t wc_sec_hi; #endif }; -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ #ifdef CONFIG_X86_32 #include <asm/xen/interface_32.h>
@@ -196,7 +196,7 @@ struct arch_shared_info {#include <asm/pvclock-abi.h> -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__/* * The following is all CPU context. Note that the fpu_ctxt block is filled * in by FXSAVE if the CPU has feature FXSR; otherwise FSAVE is used.
@@ -376,7 +376,7 @@ struct xen_pmu_arch { } c; }; -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ /* * Prefix forces emulation of some non-trapping instructions.
arch/x86/include/asm/xen/interface_32.h +2 -2
@@ -44,7 +44,7 @@*/ #define __HYPERVISOR_VIRT_START 0xF5800000 -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__ struct cpu_user_regs { uint32_t ebx;
@@ -85,7 +85,7 @@ typedef struct xen_callback xen_callback_t;#define XEN_CALLBACK (__cs, __eip) \ ((struct xen_callback){ .cs = (__cs), .eip = (unsigned long)(__eip) }) -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ /*
arch/x86/include/asm/xen/interface_64.h +2 -2
@@ -77,7 +77,7 @@#define VGCF_in_syscall (1<<_VGCF_in_syscall)#define VGCF_IN_SYSCALL VGCF_in_syscall -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__ struct iret_context {/* Top of stack (%rsp at point of hypercall). */
@@ -143,7 +143,7 @@ typedef unsigned long xen_callback_t;#define XEN_CALLBACK (__cs, __rip) \ ((unsigned long)(__rip)) -#endif /* !__ASSEMBLY__ */ +#endif /* !__ASSEMBLER__ */ #endif /* _ASM_X86_XEN_INTERFACE_64_H */
arch/x86/math-emu/control_w.h +1 -1
@@ -11,7 +11,7 @@#ifndef _CONTROLW_H_#define _CONTROLW_H_ -#ifdef __ASSEMBLY__ +#ifdef __ASSEMBLER__#define _Const_ (x) $##x#else #define _Const_ (x) x
arch/x86/math-emu/exception.h +3 -3
@@ -10,7 +10,7 @@#ifndef _EXCEPTION_H_#define _EXCEPTION_H_ -#ifdef __ASSEMBLY__ +#ifdef __ASSEMBLER__#define Const_ (x) $##x#else #define Const_ (x) x
@@ -37,7 +37,7 @@#define PRECISION_LOST_UP Const_((EX_Precision | SW_C1))#define PRECISION_LOST_DOWN Const_(EX_Precision) -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#ifdef DEBUG #define EXCEPTION (x) { printk("exception in %s at line %d\n", \
@@ -46,6 +46,6 @@#define EXCEPTION (x) FPU_exception(x)#endif -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _EXCEPTION_H_ */
arch/x86/math-emu/fpu_emu.h +3 -3
@@ -20,7 +20,7 @@*/ #define PECULIAR_486 -#ifdef __ASSEMBLY__ +#ifdef __ASSEMBLER__#include "fpu_asm.h" #define Const (x) $##x#else
@@ -68,7 +68,7 @@#define FPU_Exception Const(0x80000000)/* Added to tag returns. */ -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include "fpu_system.h"
@@ -213,6 +213,6 @@ asmlinkage int FPU_round(FPU_REG *arg, unsigned int extent, int dummy,#include "fpu_proto.h" #endif -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _FPU_EMU_H_ */
arch/x86/math-emu/status_w.h +3 -3
@@ -13,7 +13,7 @@#include "fpu_emu.h" /* for definition of PECULIAR_486 */ -#ifdef __ASSEMBLY__ +#ifdef __ASSEMBLER__#define Const__ (x) $##x#else #define Const__ (x) x
@@ -37,7 +37,7 @@#define SW_Exc_Mask Const__(0x27f)/* Status word exception bit mask */ -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#define COMP_A_gt_B 1#define COMP_A_eq_B 2
@@ -63,6 +63,6 @@ static inline void setcc(int cc)# define clear_C1 ()#endif /* PECULIAR_486 */ -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _STATUS_H_ */
arch/x86/realmode/rm/realmode.h +2 -2
@@ -2,7 +2,7 @@#ifndef ARCH_X86_REALMODE_RM_REALMODE_H #define ARCH_X86_REALMODE_RM_REALMODE_H -#ifdef __ASSEMBLY__ +#ifdef __ASSEMBLER__/* * 16-bit ljmpw to the real_mode_seg
@@ -12,7 +12,7 @@*/ #define LJMPW_RM (to) .byte 0xea ; .word (to), real_mode_seg -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ /* * Signature at the end of the realmode region
arch/x86/realmode/rm/wakeup.h +1 -1
@@ -7,7 +7,7 @@#ifndef ARCH_X86_KERNEL_ACPI_RM_WAKEUP_H #define ARCH_X86_KERNEL_ACPI_RM_WAKEUP_H -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <linux/types.h> /* This must match data at wakeup.S */
tools/arch/x86/include/asm/asm.h +4 -4
@@ -2,7 +2,7 @@#ifndef _ASM_X86_ASM_H#define _ASM_X86_ASM_H -#ifdef __ASSEMBLY__ +#ifdef __ASSEMBLER__# define __ASM_FORM (x, ...) x,## __VA_ARGS__# define __ASM_FORM_RAW (x, ...) x,## __VA_ARGS__# define __ASM_FORM_COMMA (x, ...) x,## __VA_ARGS__,
@@ -123,7 +123,7 @@#ifdef __KERNEL__/* Exception table entry */ -#ifdef __ASSEMBLY__ +#ifdef __ASSEMBLER__# define _ASM_EXTABLE_HANDLE (from, to, handler) \ .pushsection "__ex_table","a" ; \ .balign 4 ; \
@@ -154,7 +154,7 @@# define _ASM_NOKPROBE (entry)# endif -#else /* ! __ASSEMBLY__ */ +#else /* ! __ASSEMBLER__ */ # define _EXPAND_EXTABLE_HANDLE (x) #x# define _ASM_EXTABLE_HANDLE (from, to, handler) \ " .pushsection \"__ex_table\",\"a\"\n" \
@@ -186,7 +186,7 @@*/ registerunsigned long current_stack_pointer asm (_ASM_SP );#define ASM_CALL_CONSTRAINT "+r" (current_stack_pointer) -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* __KERNEL__ */
tools/arch/x86/include/asm/nops.h +1 -1
@@ -82,7 +82,7 @@#define ASM_NOP7 _ASM_BYTES(BYTES_NOP7)#define ASM_NOP8 _ASM_BYTES(BYTES_NOP8) -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__extern const unsigned char *const x86_nops[];#endif
tools/arch/x86/include/asm/orc_types.h +2 -2
@@ -45,7 +45,7 @@#define ORC_TYPE_REGS 3#define ORC_TYPE_REGS_PARTIAL 4 -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__#include <asm/byteorder.h> /*
@@ -73,6 +73,6 @@ struct orc_entry {#endif } __packed; -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _ORC_TYPES_H */
tools/arch/x86/include/asm/pvclock-abi.h +2 -2
@@ -1,7 +1,7 @@/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _ASM_X86_PVCLOCK_ABI_H#define _ASM_X86_PVCLOCK_ABI_H -#ifndef __ASSEMBLY__ +#ifndef __ASSEMBLER__/* * These structs MUST NOT be changed.
@@ -44,5 +44,5 @@ struct pvclock_wall_clock {#define PVCLOCK_GUEST_STOPPED (1 << 1)/* PVCLOCK_COUNTS_FROM_ZERO broke ABI and can't be used anymore. */ #define PVCLOCK_COUNTS_FROM_ZERO (1 << 2) -#endif /* __ASSEMBLY__ */ +#endif /* __ASSEMBLER__ */ #endif /* _ASM_X86_PVCLOCK_ABI_H */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 84/642 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 85/642 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 86/642 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
@@ -676,9 +676,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 87/642 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 88/642 x86/amd_node: Add SMN offsets to exclusive region access
In reply to Sasha LevinFrom: Mario Limonciello <[email protected]>
[ Upstream commit 83518453074d1f3eadbf7e61652b608a60087317 ]
Offsets 0x60 and 0x64 are used internally by kernel drivers that call the amd_smn_read() and amd_smn_write() functions. If userspace accesses the regions at the same time as the kernel it may cause malfunctions in drivers using the offsets.
Add these offsets to the exclusions so that the kernel is tainted if a non locked down userspace tries to access them.
--- arch/x86/kernel/amd_node.c | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+)
arch/x86/kernel/amd_node.c +41 -0
@@ -93,6 +93,7 @@ static struct pci_dev **amd_roots;/* Protect the PCI config register pairs used for SMN. */ static DEFINE_MUTEX (smn_mutex); +static bool smn_exclusive;#define SMN_INDEX_OFFSET 0x60#define SMN_DATA_OFFSET 0x64
@@ -146,6 +147,9 @@ static int __amd_smn_rw(u8 i_off, u8 d_off, u16 node, u32 address, u32 *value, bif (!root)return err; +if (!smn_exclusive) +return err; +guard (mutex)(&smn_mutex); err =pci_write_config_dword (root, i_off, address);
@@ -193,6 +197,39 @@ static int amd_cache_roots(void)return 0 ; } +static int reserve_root_config_spaces (void ) +{ +struct pci_dev *root =NULL ; +struct pci_bus *bus =NULL ; + +while ((bus =pci_find_next_bus (bus))) { +/* Root device is Device 0 Function 0 on each Primary Bus. */ + root =pci_get_slot (bus,0 ); +if (!root) +continue ; + +if (root->vendor !=PCI_VENDOR_ID_AMD && + root->vendor !=PCI_VENDOR_ID_HYGON ) +continue ; + +pci_dbg (root,"Reserving PCI config space\n" ); + +/* +* There are a few SMN index/data pairs and other registers +* that shouldn't be accessed by user space. +* So reserve the entire PCI config space for simplicity rather +* than covering specific registers piecemeal. +*/ +if (!pci_request_config_region_exclusive (root,0 ,PCI_CFG_SPACE_SIZE ,NULL )) { +pci_err (root,"Failed to reserve config space\n" ); +return -EEXIST ; + } + } + + smn_exclusive = true; +return 0 ; +} +static int __init amd_smn_init (void ) {int err;
@@ -209,6 +246,10 @@ static int __init amd_smn_init(void)if (err)return err; + err =reserve_root_config_spaces (); +if (err) +return err; +return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 89/642 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 90/642 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 91/642 i2c: amd-asf: Set cmd variable when encountering an error
In reply to Sasha LevinFrom: Shyam Sundar S K <[email protected]>
[ Upstream commit b719afaa1e5d88a1b51d76adf344ff4a48efdb45 ]
In the event of ASF error during the transfer, update the cmd and exit the process, as data processing is not performed when a command fails.
--- drivers/i2c/busses/i2c-amd-asf-plat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/busses/i2c-amd-asf-plat.c +1 -1
@@ -69,7 +69,7 @@ static void amd_asf_process_target(struct work_struct *work)/* Check if no error bits are set in target status register */ if (reg &ASF_ERROR_STATUS ) {/* Set bank as full */ - cmd =0 ; + cmd =1 ; reg |=GENMASK (3 ,2 );outb_p (reg,ASFDATABNKSEL ); }else {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 92/642 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 93/642 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 94/642 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
@@ -2842,10 +2842,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;
@@ -2881,8 +2881,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 folio *folio)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 95/642 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
@@ -4328,6 +4328,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
@@ -4418,9 +4426,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);
@@ -4543,10 +4548,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 96/642 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
@@ -4356,6 +4356,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 97/642 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
@@ -583,6 +583,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;
@@ -8660,7 +8664,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 98/642 btrfs: allow buffered write to avoid full page read if it's block aligned
In reply to Sasha LevinFrom: Qu Wenruo <[email protected]>
[ Upstream commit 0d31ca6584f21821c708752d379871b9fce2dc48 ]
[BUG]
Since the support of block size (sector size) < page size for btrfs, test case generic/563 fails with 4K block size and 64K page size:
--- tests/generic/563.out 2024-04-25 18:13:45.178550333 +0930
+++ /home/adam/xfstests-dev/results//generic/563.out.bad 2024-09-30 09:09:16.155312379 +0930
@@ -3,7 +3,8 @@
read is in range
write is in range
write -> read/write
-read is in range
+read has value of 8388608
+read is NOT in range -33792 .. 33792
write is in range
...
[CAUSE]
The test case creates a 8MiB file, then does buffered write into the 8MiB using 4K block size, to overwrite the whole file.
On 4K page sized systems, since the write range covers the full block and page, btrfs will not bother reading the page, just like what XFS and EXT4 do.
But on 64K page sized systems, although the 4K sized write is still block aligned, it's not page aligned anymore, thus btrfs will read the full page, which will be accounted by cgroup and fail the test.
As the test case itself expects such 4K block aligned write should not trigger any read.
Such expected behavior is an optimization to reduce folio reads when possible, and unfortunately btrfs does not implement such optimization.
[FIX]
To skip the full page read, we need to do the following modification:
- Do not trigger full page read as long as the buffered write is block aligned
This is pretty simple by modifying the check inside prepare_uptodate_page().
- Skip already uptodate blocks during full page read Or we can lead to the following data corruption:
0 32K 64K |///////| |
Where the file range [0, 32K) is dirtied by buffered write, the remaining range [32K, 64K) is not.
When reading the full page, since [0,32K) is only dirtied but not written back, there is no data extent map for it, but a hole covering [0, 64k).
If we continue reading the full page range [0, 64K), the dirtied range will be filled with 0 (since there is only a hole covering the whole range).
This causes the dirtied range to get lost.
With this optimization, btrfs can pass generic/563 even if the page size is larger than fs block size.
--- fs/btrfs/extent_io.c | 4 ++++ fs/btrfs/file.c | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-)
fs/btrfs/extent_io.c +4 -0
@@ -974,6 +974,10 @@ static int btrfs_do_readpage(struct folio *folio, struct extent_map **em_cached,end_folio_read (folio, true, cur, iosize);break ; } +if (btrfs_folio_test_uptodate (fs_info, folio, cur, blocksize)) { +end_folio_read (folio, true, cur, blocksize); +continue ; + } em =get_extent_map (BTRFS_I (inode), folio, cur, end - cur +1 , em_cached);if (IS_ERR (em)) {end_folio_read (folio, false, cur, end +1 - cur);
fs/btrfs/file.c +3 -2
@@ -804,14 +804,15 @@ static int prepare_uptodate_folio(struct inode *inode, struct folio *folio, u64 {u64 clamp_start =max_t (u64, pos,folio_pos (folio));u64 clamp_end =min_t (u64, pos + len,folio_pos (folio) +folio_size (folio)); +const u32 blocksize =inode_to_fs_info (inode)->sectorsize;int ret =0 ;if (folio_test_uptodate (folio))return 0 ;if (!force_uptodate && -IS_ALIGNED (clamp_start,PAGE_SIZE ) && -IS_ALIGNED (clamp_end,PAGE_SIZE )) +IS_ALIGNED (clamp_start, blocksize) && +IS_ALIGNED (clamp_end, blocksize))return 0 ; ret =btrfs_read_folio (NULL , folio);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 99/642 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
@@ -6768,6 +6768,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;
@@ -6784,7 +6785,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);
@@ -6796,14 +6797,15 @@ 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; }static int read_inline_extent (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;
@@ -6818,14 +6820,14 @@ static int read_inline_extent(struct btrfs_path *path, struct folio *folio)if (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
Re: [PATCH AUTOSEL 6.14 099/642] btrfs: prevent inline data extents read from touching blocks beyond its range
Quoted 43 lines · Sasha Levin
From: 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 bybtrfs_do_readpage()for ranges beyondi_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.
Quoted 8 lines
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.
Reviewed-by Filipe Manana <[email protected]>Signed-off-by Qu Wenruo <[email protected]>Signed-off-by David Sterba <[email protected]>Signed-off-by Sasha Levin <[email protected]>
This is not a stable dependency and the patch is not fixing anything but a preparation so this does not make much sense for stable backports, please drop it. Thanks.
Sasha Levin
maintainerRe: [PATCH AUTOSEL 6.14 099/642] btrfs: prevent inline data extents read from touching blocks beyond its range
Quoted 48 lines · David Sterba
Quoted 47 lines · Sasha Levin
From: 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 bybtrfs_do_readpage()for ranges beyondi_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.
Quoted 8 lines
Quoted 4 lines
Reviewed-by Filipe Manana <[email protected]>Signed-off-by Qu Wenruo <[email protected]>Signed-off-by David Sterba <[email protected]>Signed-off-by Sasha Levin <[email protected]>This is not a stable dependency and the patch is not fixing anything but a preparation so this does not make much sense for stable backports, please drop it. Thanks.
Will do, thanks!
Signature · 2 lines
Thanks, Sasha
Sasha Levin
maintainerPATCH 100/642 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
@@ -1888,6 +1888,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);
@@ -1904,13 +1915,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 101/642 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 102/642 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
@@ -2330,6 +2330,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 103/642 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
@@ -1727,27 +1727,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;
@@ -1758,8 +1758,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 104/642 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
@@ -4778,6 +4778,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 105/642 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 106/642 drm/amdgpu: don't free conflicting apertures for non-display devices
In reply to Sasha LevinFrom: Alex Deucher <[email protected]>
[ Upstream commit 9deacd6c55f1b31e5ab20db79df2e14ac480203c ]
PCI_CLASS_ACCELERATOR_PROCESSING devices won't ever be the sysfb, so there is no need to free conflicting apertures.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +11 -4
@@ -4370,10 +4370,17 @@ int amdgpu_device_init(struct amdgpu_device *adev,if (r)return r; -/* Get rid of things like offb */ - r =aperture_remove_conflicting_pci_devices (adev->pdev, amdgpu_kms_driver.name); -if (r) -return r; +/* +* No need to remove conflicting FBs for non-display class devices. +* This prevents the sysfb from being freed accidently. +*/ +if ((pdev->class >>8 ) ==PCI_CLASS_DISPLAY_VGA || + (pdev->class >>8 ) ==PCI_CLASS_DISPLAY_OTHER ) { +/* Get rid of things like offb */ + r =aperture_remove_conflicting_pci_devices (adev->pdev, amdgpu_kms_driver.name); +if (r) +return r; + }/* Enable TMZ based on IP_VERSION */ amdgpu_gmc_tmz_set (adev);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 107/642 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
@@ -173,6 +173,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
@@ -1033,6 +1034,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.
@@ -2244,6 +2252,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
Re: [PATCH AUTOSEL 6.14 107/642] drm/amdgpu: adjust drm_firmware_drivers_only() handling
Hi
Am 06.05.25 um 00:05 schrieb Sasha Levin:
Quoted 10 lines
From: 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.
I just came across this patch because it got backported into various older releases. It was part of the series at [1]. From the cover letter:
Quoted 1 line
Quoted 1 line
Quoted 1 line
There are a number of systems and cloud providers out there that have nomodeset hardcoded in their kernel parameters to block nouveau for the nvidia driver. This prevents the amdgpu driver from loading. Unfortunately the end user cannot easily change this. The preferred way to block modules from loading is to use modprobe.blacklist=<driver>. That is what providers should be using to block specific drivers.
Drop the check to allow the driver to load even when nomodeset is specified on the kernel command line.
<<<
Why was that series never on dri-devel?
Why is this necessary in the upstream kernel? It works around a problem with the user's configuration. The series' cover letter already states the correct solution.
Firmware-only parameters affect all drivers; why not try for a common solution? At least the test against the PCI class appears useful in the common case.
Best regards
Thomas
Quoted 47 lines
Reviewed-by Kent Russell <[email protected]>Signed-off-by Alex Deucher <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +14
-0@@ -173,6 +173,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 @@ -1033,6 +1034,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. @@ -2244,6 +2252,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 · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Re: [PATCH AUTOSEL 6.14 107/642] drm/amdgpu: adjust drm_firmware_drivers_only() handling
Am 21.08.25 um 11:32 schrieb Thomas Zimmermann:
Quoted 7 lines
Hi
Am 06.05.25 um 00:05 schrieb Sasha Levin:
Quoted 4 lines
From: Alex Deucher <[email protected]>
[ Upstream commit
e00e5c223878a60e391e5422d173c3382d378f87]
Quoted 8 lines
Quoted 6 lines
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.I just came across this patch because it got backported into various older releases. It was part of the series at [1]. From the cover letter:
[1] https://lore.kernel.org/all/[email protected]/
Quoted 74 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
There are a number of systems and cloud providers out there that have nomodeset hardcoded in their kernel parameters to block nouveau for the nvidia driver. This prevents the amdgpu driver from loading. Unfortunately the end user cannot easily change this. The preferred way to block modules from loading is to use modprobe.blacklist=<driver>. That is what providers should be using to block specific drivers.
Drop the check to allow the driver to load even when nomodeset is specified on the kernel command line.
<<<
Why was that series never on dri-devel?
Why is this necessary in the upstream kernel? It works around a problem with the user's configuration. The series' cover letter already states the correct solution.
Firmware-only parameters affect all drivers; why not try for a common solution? At least the test against the PCI class appears useful in the common case.
Best regards
ThomasQuoted 47 lines
Reviewed-by Kent Russell <[email protected]>Signed-off-by Alex Deucher <[email protected]>Signed-off-by Sasha Levin <[email protected]>---
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c| 14 ++++++++++++++1 file changed, 14 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1
-0@@ -173,6 +173,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 @@ -1033,6 +1034,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)");drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2
-0+module_param_named (modeset, amdgpu_modeset, int,0444 ); +/**
* DOC: seamless (int)
* Seamless boot will keep the image on the screen during the boot process.drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0
-0@@ -2244,6 +2252,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 · 7 lines
-- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Re: [PATCH AUTOSEL 6.14 107/642] drm/amdgpu: adjust drm_firmware_drivers_only() handling
In reply to Thomas ZimmermannQuoted 28 lines · Thomas Zimmermann
Hi
Am 06.05.25 um 00:05 schrieb Sasha Levin:
Quoted 10 lines
From: 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.I just came across this patch because it got backported into various older releases. It was part of the series at [1]. From the cover letter:
Quoted 1 line
Quoted 1 line
Quoted 1 line
There are a number of systems and cloud providers out there that have nomodeset hardcoded in their kernel parameters to block nouveau for the nvidia driver. This prevents the amdgpu driver from loading. Unfortunately the end user cannot easily change this. The preferred way to block modules from loading is to use modprobe.blacklist=<driver>. That is what providers should be using to block specific drivers.
Quoted 6 lines
Drop the check to allow the driver to load even when nomodeset is specified on the kernel command line.
<<<
Why was that series never on dri-devel?
I guess I should have sent these to dri-devel as well.
Quoted 4 lines
Why is this necessary in the upstream kernel? It works around a problem with the user's configuration. The series' cover letter already states the correct solution.
IIRC, the customers were not willing to change their kernel configurations across their fleet, but required a way to load the amdgpu driver, but keep nouveau blocked. That said, doing this in the core would also not solve the problem since the goal of nomodeset was to block nouveau.
Quoted 4 lines
Firmware-only parameters affect all drivers; why not try for a common solution? At least the test against the PCI class appears useful in the common case.
I can port the changes to the core if there is interest.
Alex
Quoted 63 lines
Best regards
ThomasQuoted 37 lines
Reviewed-by Kent Russell <[email protected]>Signed-off-by Alex Deucher <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +8
-0@@ -173,6 +173,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 @@ -1033,6 +1034,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. @@ -2244,6 +2252,12 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,int ret, retry =0 , i;bool supports_atomic = false;drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c static int amdgpu_pci_probe(struct pci_dev *pdev, · line 2263
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +6
-0+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)--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Sasha Levin
maintainerPATCH 108/642 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
@@ -551,6 +551,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 109/642 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
@@ -84,7 +84,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,virt_to_ptdesc (pte)); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 110/642 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 111/642 loop: move vfs_fsync() out of loop_update_dio()
In reply to Sasha LevinFrom: Ming Lei <[email protected]>
[ Upstream commit 86947bdc28894520ed5aab0cf21b99ff0b659e07 ]
If vfs_flush() is called with queue frozen, the queue freeze lock may be connected with FS internal lock, and lockdep warning can be triggered because the queue freeze lock is connected with too many global or sub-system locks.
Fix the warning by moving vfs_fsync() out of loop_update_dio():
- vfs_fsync() is only needed when switching to dio
- only loop_change_fd() and loop_configure() may switch from buffered IO to direct IO, so call vfs_fsync() directly here. This way is safe because either loop is in unbound, or new file isn't attached
- for the other two cases of set_status and set_block_size, direct IO can only become off, so no need to call vfs_fsync()
--- drivers/block/loop.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/block/loop.c +14 -6
@@ -205,8 +205,6 @@ static bool lo_can_use_dio(struct loop_device *lo)*/ static inline void loop_update_dio (struct loop_device *lo) { -bool dio_in_use = lo->lo_flags &LO_FLAGS_DIRECT_IO ; -lockdep_assert_held (&lo->lo_mutex);WARN_ON_ONCE (lo->lo_state == Lo_bound && lo->lo_queue->mq_freeze_depth ==0 );
@@ -215,10 +213,6 @@ static inline void loop_update_dio(struct loop_device *lo) lo->lo_flags |=LO_FLAGS_DIRECT_IO ;if ((lo->lo_flags &LO_FLAGS_DIRECT_IO ) && !lo_can_use_dio (lo)) lo->lo_flags &= ~LO_FLAGS_DIRECT_IO ; - -/* flush dirty pages before starting to issue direct I/O */ -if ((lo->lo_flags &LO_FLAGS_DIRECT_IO ) && !dio_in_use) -vfs_fsync (lo->lo_backing_file,0 ); }/**
@@ -545,6 +539,13 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev,if (get_loop_size (lo, file) !=get_loop_size (lo, old_file)) goto out_err; +/* +* We might switch to direct I/O mode for the loop device, write back +* all dirty data the page cache now that so that the individual I/O +* operations don't have to do that. +*/ +vfs_fsync (file,0 ); +/* and ... switch */ disk_force_media_change (lo->lo_disk); memflags =blk_mq_freeze_queue (lo->lo_queue);
@@ -1023,6 +1024,13 @@ static int loop_configure(struct loop_device *lo, blk_mode_t mode,if (error) goto out_unlock; +/* +* We might switch to direct I/O mode for the loop device, write back +* all dirty data the page cache now that so that the individual I/O +* operations don't have to do that. +*/ +vfs_fsync (file,0 ); +loop_update_dio (lo);loop_sysfs_init (lo);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 112/642 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 113/642 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 114/642 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
@@ -66,6 +66,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 115/642 net/mlx5: Preserve rate settings when creating a rate node
In reply to Sasha LevinFrom: Carolina Jubran <[email protected]>
[ Upstream commit f88c349c75e3784a3f5463f5b403ff28dd823782 ]
Modify esw_qos_create_node_sched_elem() to receive max_rate and bw_share values while maintaining the previous configuration.
This change is essential for the upcoming patch that will modify rate nodes and requires the existing settings to be preserved unless explicitly changed.
--- drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/esw/qos.c +9 -4
@@ -305,8 +305,9 @@ static int esw_qos_set_node_min_rate(struct mlx5_esw_sched_node *node,return 0 ; } -static int esw_qos_create_node_sched_elem (struct mlx5_core_dev *dev,u32 parent_element_id, -u32 *tsar_ix) +static int +esw_qos_create_node_sched_elem (struct mlx5_core_dev *dev,u32 parent_element_id, +u32 max_rate,u32 bw_share,u32 *tsar_ix) {u32 tsar_ctx[MLX5_ST_SZ_DW (scheduling_context)] = {};void *attr;
@@ -323,6 +324,8 @@ static int esw_qos_create_node_sched_elem(struct mlx5_core_dev *dev, u32 parent_ SCHEDULING_CONTEXT_ELEMENT_TYPE_TSAR);MLX5_SET (scheduling_context, tsar_ctx, parent_element_id, parent_element_id); +MLX5_SET (scheduling_context, tsar_ctx, max_average_bw, max_rate); +MLX5_SET (scheduling_context, tsar_ctx, bw_share, bw_share); attr =MLX5_ADDR_OF (scheduling_context, tsar_ctx, element_attributes);MLX5_SET (tsar_element, attr, tsar_type,TSAR_ELEMENT_TSAR_TYPE_DWRR );
@@ -396,7 +399,8 @@ __esw_qos_create_vports_sched_node(struct mlx5_eswitch *esw, struct mlx5_esw_schu32 tsar_ix;int err; - err =esw_qos_create_node_sched_elem (esw->dev, esw->qos.root_tsar_ix, &tsar_ix); + err =esw_qos_create_node_sched_elem (esw->dev, esw->qos.root_tsar_ix,0 , +0 , &tsar_ix);if (err) {NL_SET_ERR_MSG_MOD (extack,"E-Switch create TSAR for node failed" );return ERR_PTR (err);
@@ -463,7 +467,8 @@ static int esw_qos_create(struct mlx5_eswitch *esw, struct netlink_ext_ack *extaif (!MLX5_CAP_GEN (dev, qos) || !MLX5_CAP_QOS (dev, esw_scheduling))return -EOPNOTSUPP ; - err =esw_qos_create_node_sched_elem (esw->dev,0 , &esw->qos.root_tsar_ix); + err =esw_qos_create_node_sched_elem (esw->dev,0 ,0 ,0 , + &esw->qos.root_tsar_ix);if (err) {esw_warn (dev,"E-Switch create root TSAR failed (%d)\n" , err);return err;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 116/642 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 117/642 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
@@ -12097,6 +12097,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 ;
@@ -12152,8 +12153,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 118/642 ixgbe: add support for thermal sensor event reception
In reply to Sasha LevinFrom: Jedrzej Jagielski <[email protected]>
[ Upstream commit affead2d904e8f82c0b89e23b3835242eb8c3e1a ]
E610 NICs unlike the previous devices utilising ixgbe driver are notified in the case of overheating by the FW ACI event.
In event of overheat when threshold is exceeded, FW suspends all traffic and sends overtemp event to the driver. Then driver logs appropriate message and disables the adapter instance. The card remains in that state until the platform is rebooted.
This approach is a solution to the fact current version of the E610 FW doesn't support reading thermal sensor data by the SW. So give to user at least any info that overtemp event has occurred, without interface disappearing from the OS without any note.
--- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 4 ++++ drivers/net/ethernet/intel/ixgbe/ixgbe_type_e610.h | 3 +++ 2 files changed, 7 insertions(+)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +4 -0
@@ -3185,6 +3185,10 @@ static void ixgbe_handle_fw_event(struct ixgbe_adapter *adapter)case ixgbe_aci_opc_get_link_status:ixgbe_handle_link_status_event (adapter, &event);break ; +case ixgbe_aci_opc_temp_tca_event: +e_crit (drv,"%s\n" , ixgbe_overheat_msg); +ixgbe_down (adapter); +break ;default :e_warn (hw,"unknown FW async event captured\n" );break ;
drivers/net/ethernet/intel/ixgbe/ixgbe_type_e610.h +3 -0
@@ -171,6 +171,9 @@ enum ixgbe_aci_opc { ixgbe_aci_opc_done_alt_write =0x0904 , ixgbe_aci_opc_clear_port_alt_write =0x0906 , +/* TCA Events */ + ixgbe_aci_opc_temp_tca_event =0x0C94 , +/* debug commands */ ixgbe_aci_opc_debug_dump_internals = 0xFF08,
Signature · 1 line
2.39.5