Commit graph

1,267,977 commits

Author SHA1 Message Date
Josef Bacik
f094323867 sunrpc: pass in the sv_stats struct through svc_create_pooled
Since only one service actually reports the rpc stats there's not much
of a reason to have a pointer to it in the svc_program struct.  Adjust
the svc_create_pooled function to take the sv_stats as an argument and
pass the struct through there as desired instead of getting it from the
svc_program->pg_stats.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2024-03-01 09:12:08 -05:00
Josef Bacik
a2214ed588 nfsd: stop setting ->pg_stats for unused stats
A lot of places are setting a blank svc_stats in ->pg_stats and never
utilizing these stats.  Remove all of these extra structs as we're not
reporting these stats anywhere.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2024-03-01 09:12:08 -05:00
Josef Bacik
ab42f4d9a2 sunrpc: don't change ->sv_stats if it doesn't exist
We check for the existence of ->sv_stats elsewhere except in the core
processing code.  It appears that only nfsd actual exports these values
anywhere, everybody else just has a write only copy of sv_stats in their
svc_program.  Add a check for ->sv_stats before every adjustment to
allow us to eliminate the stats struct from all the users who don't
report the stats.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2024-03-01 09:12:07 -05:00
Jorge Mora
31e4bb8fb8 NFSD: fix LISTXATTRS returning more bytes than maxcount
The maxcount is the maximum number of bytes for the LISTXATTRS4resok
result. This includes the cookie and the count for the name array,
thus subtract 12 bytes from the maxcount: 8 (cookie) + 4 (array count)
when filling up the name array.

Fixes: 23e50fe3a5 ("nfsd: implement the xattr functions and en/decode logic")
Signed-off-by: Jorge Mora <mora@netapp.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2024-03-01 09:12:07 -05:00
Jorge Mora
2f73f37d66 NFSD: fix LISTXATTRS returning a short list with eof=TRUE
If the XDR buffer is not large enough to fit all attributes
and the remaining bytes left in the XDR buffer (xdrleft) is
equal to the number of bytes for the current attribute, then
the loop will prematurely exit without setting eof to FALSE.
Also in this case, adding the eof flag to the buffer will
make the reply 4 bytes larger than lsxa_maxcount.

Need to check if there are enough bytes to fit not only the
next attribute name but also the eof as well.

Fixes: 23e50fe3a5 ("nfsd: implement the xattr functions and en/decode logic")
Signed-off-by: Jorge Mora <mora@netapp.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2024-03-01 09:12:07 -05:00
Jorge Mora
61ab5e0758 NFSD: change LISTXATTRS cookie encoding to big-endian
Function nfsd4_listxattr_validate_cookie() expects the cookie
as an offset to the list thus it needs to be encoded in big-endian.

Fixes: 23e50fe3a5 ("nfsd: implement the xattr functions and en/decode logic")
Signed-off-by: Jorge Mora <mora@netapp.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2024-03-01 09:12:06 -05:00
Jorge Mora
52a357db80 NFSD: fix nfsd4_listxattr_validate_cookie
If LISTXATTRS is sent with a correct cookie but a small maxcount,
this could lead function nfsd4_listxattr_validate_cookie to
return NFS4ERR_BAD_COOKIE. If maxcount = 20, then second check
on function gives RHS = 3 thus any cookie larger than 3 returns
NFS4ERR_BAD_COOKIE.

There is no need to validate the cookie on the return XDR buffer
since attribute referenced by cookie will be the first in the
return buffer.

Fixes: 23e50fe3a5 ("nfsd: implement the xattr functions and en/decode logic")
Signed-off-by: Jorge Mora <mora@netapp.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2024-03-01 09:12:06 -05:00
NeilBrown
5ff318f645 nfsd: use __fput_sync() to avoid delayed closing of files.
Calling fput() directly or though filp_close() from a kernel thread like
nfsd causes the final __fput() (if necessary) to be called from a
workqueue.  This means that nfsd is not forced to wait for any work to
complete.  If the ->release or ->destroy_inode function is slow for any
reason, this can result in nfsd closing files more quickly than the
workqueue can complete the close and the queue of pending closes can
grow without bounces (30 million has been seen at one customer site,
though this was in part due to a slowness in xfs which has since been
fixed).

nfsd does not need this.  It is quite appropriate and safe for nfsd to
do its own close work.  There is no reason that close should ever wait
for nfsd, so no deadlock can occur.

It should be safe and sensible to change all fput() calls to
__fput_sync().  However in the interests of caution this patch only
changes two - the two that can be most directly affected by client
behaviour and could occur at high frequency.

- the fput() implicitly in flip_close() is changed to __fput_sync()
  by calling get_file() first to ensure filp_close() doesn't do
  the final fput() itself.  If is where files opened for IO are closed.

- the fput() in nfsd_read() is also changed.  This is where directories
  opened for readdir are closed.

This ensure that minimal fput work is queued to the workqueue.

This removes the need for the flush_delayed_fput() call in
nfsd_file_close_inode_sync()

Signed-off-by: NeilBrown <neilb@suse.de>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2024-03-01 09:12:05 -05:00
NeilBrown
ffb4025961 nfsd: Don't leave work of closing files to a work queue
The work of closing a file can have non-trivial cost.  Doing it in a
separate work queue thread means that cost isn't imposed on the nfsd
threads and an imbalance can be created.  This can result in files being
queued for the work queue more quickly that the work queue can process
them, resulting in unbounded growth of the queue and memory exhaustion.

To avoid this work imbalance that exhausts memory, this patch moves all
closing of files into the nfsd threads.  This means that when the work
imposes a cost, that cost appears where it would be expected - in the
work of the nfsd thread.  A subsequent patch will ensure the final
__fput() is called in the same (nfsd) thread which calls filp_close().

Files opened for NFSv3 are never explicitly closed by the client and are
kept open by the server in the "filecache", which responds to memory
pressure, is garbage collected even when there is no pressure, and
sometimes closes files when there is particular need such as for rename.
These files currently have filp_close() called in a dedicated work
queue, so their __fput() can have no effect on nfsd threads.

This patch discards the work queue and instead has each nfsd thread call
flip_close() on as many as 8 files from the filecache each time it acts
on a client request (or finds there are no pending client requests).  If
there are more to be closed, more threads are woken.  This spreads the
work of __fput() over multiple threads and imposes any cost on those
threads.

The number 8 is somewhat arbitrary.  It needs to be greater than 1 to
ensure that files are closed more quickly than they can be added to the
cache.  It needs to be small enough to limit the per-request delays that
will be imposed on clients when all threads are busy closing files.

Signed-off-by: NeilBrown <neilb@suse.de>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2024-03-01 09:12:05 -05:00
Chuck Lever
561141dd49 SUNRPC: Use a static buffer for the checksum initialization vector
Allocating and zeroing a buffer during every call to
krb5_etm_checksum() is inefficient. Instead, set aside a static
buffer that is the maximum crypto block size, and use a portion
(or all) of that.

Reported-by: Markus Elfring <Markus.Elfring@web.de>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2024-03-01 09:12:05 -05:00
Zhipeng Lu
3cfcfc102a SUNRPC: fix some memleaks in gssx_dec_option_array
The creds and oa->data need to be freed in the error-handling paths after
their allocation. So this patch add these deallocations in the
corresponding paths.

Fixes: 1d658336b0 ("SUNRPC: Add RPC based upcall mechanism for RPCGSS auth")
Signed-off-by: Zhipeng Lu <alexious@zju.edu.cn>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2024-03-01 09:12:04 -05:00
Zhipeng Lu
e67b652d8e SUNRPC: fix a memleak in gss_import_v2_context
The ctx->mech_used.data allocated by kmemdup is not freed in neither
gss_import_v2_context nor it only caller gss_krb5_import_sec_context,
which frees ctx on error.

Thus, this patch reform the last call of gss_import_v2_context to the
gss_krb5_import_ctx_v2, preventing the memleak while keepping the return
formation.

Fixes: 47d8480776 ("gss_krb5: handle new context format from gssd")
Signed-off-by: Zhipeng Lu <alexious@zju.edu.cn>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2024-03-01 09:12:04 -05:00
Théo Lebrun
b824f841a4 gpio: nomadik: fix Kconfig dependencies inbetween pinctrl & GPIO
PINCTRL_NOMADIK cannot select GPIO_NOMADIK without first selecting
GPIOLIB on which GPIO_NOMADIK depends. GPIO_NOMADIK depends on OF_GPIO,
it is a direct dependency.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202403010917.pnDhdS1Y-lkp@intel.com/
Closes: https://lore.kernel.org/oe-kbuild-all/202403011102.v8w2zPOU-lkp@intel.com/
Closes: https://lore.kernel.org/oe-kbuild-all/202403011329.1VnABMRz-lkp@intel.com/
Closes: https://lore.kernel.org/oe-kbuild-all/202403011546.Hpt8sBTa-lkp@intel.com/
Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
Link: https://lore.kernel.org/r/20240301-mbly-gpio-kconfig-fix-v1-1-2785cebd475d@bootlin.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2024-03-01 14:30:28 +01:00
Xiaobing Li
3fcb9d1720 io_uring/sqpoll: statistics of the true utilization of sq threads
Count the running time and actual IO processing time of the sqpoll
thread, and output the statistical data to fdinfo.

Variable description:
"work_time" in the code represents the sum of the jiffies of the sq
thread actually processing IO, that is, how many milliseconds it
actually takes to process IO. "total_time" represents the total time
that the sq thread has elapsed from the beginning of the loop to the
current time point, that is, how many milliseconds it has spent in
total.

The test tool is fio, and its parameters are as follows:
[global]
ioengine=io_uring
direct=1
group_reporting
bs=128k
norandommap=1
randrepeat=0
refill_buffers
ramp_time=30s
time_based
runtime=1m
clocksource=clock_gettime
overwrite=1
log_avg_msec=1000
numjobs=1

[disk0]
filename=/dev/nvme0n1
rw=read
iodepth=16
hipri
sqthread_poll=1

The test results are as follows:
Every 2.0s: cat /proc/9230/fdinfo/6 | grep -E Sq
SqMask: 0x3
SqHead: 3197153
SqTail: 3197153
CachedSqHead:   3197153
SqThread:       9231
SqThreadCpu:    11
SqTotalTime:    18099614
SqWorkTime:     16748316

The test results corresponding to different iodepths are as follows:
|-----------|-------|-------|-------|------|-------|
|   iodepth |   1   |   4   |   8   |  16  |  64   |
|-----------|-------|-------|-------|------|-------|
|utilization| 2.9%  | 8.8%  | 10.9% | 92.9%| 84.4% |
|-----------|-------|-------|-------|------|-------|
|    idle   | 97.1% | 91.2% | 89.1% | 7.1% | 15.6% |
|-----------|-------|-------|-------|------|-------|

Signed-off-by: Xiaobing Li <xiaobing.li@samsung.com>
Link: https://lore.kernel.org/r/20240228091251.543383-1-xiaobing.li@samsung.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2024-03-01 06:28:19 -07:00
Jens Axboe
eb18c29dd2 io_uring/net: move recv/recvmsg flags out of retry loop
The flags don't change, just intialize them once rather than every loop
for multishot.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
2024-03-01 06:28:19 -07:00
Bill O'Donnell
6b91bfa165
qnx4: convert qnx4 to use the new mount api
Convert the qnx4 filesystem to use the new mount API.

Tested mount, umount, and remount using a qnx4 boot image.

Signed-off-by: Bill O'Donnell <bodonnel@redhat.com>
Link: https://lore.kernel.org/r/20240229161649.800957-1-bodonnel@redhat.com
Acked-by: Anders Larsen <al@alarsen.net>
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-03-01 13:58:50 +01:00
Nguyen Dinh Phi
24a8b7bfb9
fs: use inode_set_ctime_to_ts to set inode ctime to current time
The function inode_set_ctime_current simply retrieves the current time
and assigns it to the field __i_ctime without any alterations. Therefore,
it is possible to set ctime to now directly using inode_set_ctime_to_ts

Signed-off-by: Nguyen Dinh Phi <phind.uet@gmail.com>
Link: https://lore.kernel.org/r/20240228173031.3208743-1-phind.uet@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-03-01 13:58:46 +01:00
Joerg Roedel
f675692832 Arm SMMU updates for 6.9
- Device-tree binding updates for a bunch of Qualcomm SoCs
 
 - SMMUv2:
   * Support for Qualcomm X1E80100 MDSS
 
 - SMMUv3:
   * Significant rework of the driver's STE manipulation and domain
     handling code. This is the initial part of a larger scale rework
     aiming to improve the driver's implementation of the IOMMU API
     in preparation for hooking up IOMMUFD support.
 -----BEGIN PGP SIGNATURE-----
 
 iQFEBAABCgAuFiEEPxTL6PPUbjXGY88ct6xw3ITBYzQFAmXgsIQQHHdpbGxAa2Vy
 bmVsLm9yZwAKCRC3rHDchMFjNPAVCACqkmHrSK4HHUlpxttGgTbdyJjGPY4AGKg7
 Lc9ThuItZ16yAuDdhpRlR3P3ztelGfneCXgvLVj/TUTuEdhztC1KUTsjIoYOi9X/
 i6ke8HdBC/tkTJEhKF0qUGcyxfe08c552zQEGsKHUnZH1cBy5BzxAXCVJ/293fUS
 9nQ/hyDU5KtibqUPwCEPhgw5EjnmoXvy7VQDOe7TtLCFiwmBgbmW/mUf2kPM6oJ8
 2CIMPL4jB4kl7NbxjuJjc3ngT7mZ+O0OV2T6p9tGPnw3oES14KtjKQttFlFBBCDA
 qhKqIoHd38Z/DVXrlXQVsQjKbkAXu96A+d/dADr6eqczJ07oarOB
 =vamV
 -----END PGP SIGNATURE-----

Merge tag 'arm-smmu-updates' of git://git.kernel.org/pub/scm/linux/kernel/git/will/linux into arm/smmu

Arm SMMU updates for 6.9

- Device-tree binding updates for a bunch of Qualcomm SoCs

- SMMUv2:
  * Support for Qualcomm X1E80100 MDSS

- SMMUv3:
  * Significant rework of the driver's STE manipulation and domain
    handling code. This is the initial part of a larger scale rework
    aiming to improve the driver's implementation of the IOMMU API
    in preparation for hooking up IOMMUFD support.
2024-03-01 13:57:40 +01:00
Zhangfei Gao
6384c56c99 iommu/sva: Fix SVA handle sharing in multi device case
iommu_sva_bind_device will directly goto out in multi-device
case when found existing domain, ignoring list_add handle,
which causes the handle to fail to be shared.

Fixes: 65d4418c50 ("iommu/sva: Restore SVA handle sharing")
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Link: https://lore.kernel.org/r/20240227064821.128-1-zhangfei.gao@linaro.org
Signed-off-by: Joerg Roedel <jroedel@suse.de>
2024-03-01 13:53:58 +01:00
Lu Baolu
def054b01a iommu/vt-d: Use device rbtree in iopf reporting path
The existing I/O page fault handler currently locates the PCI device by
calling pci_get_domain_bus_and_slot(). This function searches the list
of all PCI devices until the desired device is found. To improve lookup
efficiency, replace it with device_rbtree_find() to search the device
within the probed device rbtree.

The I/O page fault is initiated by the device, which does not have any
synchronization mechanism with the software to ensure that the device
stays in the probed device tree. Theoretically, a device could be released
by the IOMMU subsystem after device_rbtree_find() and before
iopf_get_dev_fault_param(), which would cause a use-after-free problem.

Add a mutex to synchronize the I/O page fault reporting path and the IOMMU
release device path. This lock doesn't introduce any performance overhead,
as the conflict between I/O page fault reporting and device releasing is
very rare.

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20240220065939.121116-3-baolu.lu@linux.intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
2024-03-01 13:51:21 +01:00
Lu Baolu
1a75cc710b iommu/vt-d: Use rbtree to track iommu probed devices
Use a red-black tree(rbtree) to track devices probed by the driver's
probe_device callback. These devices need to be looked up quickly by
a source ID when the hardware reports a fault, either recoverable or
unrecoverable.

Fault reporting paths are critical. Searching a list in this scenario
is inefficient, with an algorithm complexity of O(n). An rbtree is a
self-balancing binary search tree, offering an average search time
complexity of O(log(n)). This significant performance improvement
makes rbtrees a better choice.

Furthermore, rbtrees are implemented on a per-iommu basis, eliminating
the need for global searches and further enhancing efficiency in
critical fault paths. The rbtree is protected by a spin lock with
interrupts disabled to ensure thread-safe access even within interrupt
contexts.

Co-developed-by: Huang Jiaqing <jiaqing.huang@intel.com>
Signed-off-by: Huang Jiaqing <jiaqing.huang@intel.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/20240220065939.121116-2-baolu.lu@linux.intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
2024-03-01 13:51:20 +01:00
Tina Zhang
8ca918cbc2 iommu/vt-d: Merge intel_svm_bind_mm() into its caller
intel_svm_set_dev_pasid() is the only caller of intel_svm_bind_mm().
Merge them and remove intel_svm_bind_mm(). No functional change
intended.

Signed-off-by: Tina Zhang <tina.zhang@intel.com>
Link: https://lore.kernel.org/r/20240219125723.1645703-4-tina.zhang@intel.com
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
2024-03-01 13:51:20 +01:00
Tina Zhang
cb0b95e562 iommu/vt-d: Remove initialization for dynamically heap-allocated rcu_head
The rcu_head structures allocated dynamically in the heap don't need any
initialization. Therefore, remove the init_rcu_head().

Signed-off-by: Tina Zhang <tina.zhang@intel.com>
Link: https://lore.kernel.org/r/20240219125723.1645703-3-tina.zhang@intel.com
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
2024-03-01 13:51:19 +01:00
Tina Zhang
b4b1054f6c iommu/vt-d: Remove treatment for revoking PASIDs with pending page faults
Commit 2f26e0a9c9 ("iommu/vt-d: Add basic SVM PASID support") added a
special treatment to mandate that no page faults may be outstanding for
the PASID after intel_svm_unbind_mm() is called, as the PASID will be
released and reused after unbind.

This is unnecessary anymore as no outstanding page faults have been
ensured in the driver's remove_dev_pasid path:

- Tear down the pasid entry, which guarantees that new page faults for
  the PASID will be rejected by the iommu hardware.
- All outstanding page faults have been responded to.
- All hardware pending faults are drained in intel_drain_pasid_prq().

Remove this unnecessary code.

Signed-off-by: Tina Zhang <tina.zhang@intel.com>
Link: https://lore.kernel.org/r/20240219125723.1645703-2-tina.zhang@intel.com
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
2024-03-01 13:51:19 +01:00
Jingqi Liu
967912a3a5 iommu/vt-d: Add the document for Intel IOMMU debugfs
This document guides users to dump the Intel IOMMU internals by debugfs.

Signed-off-by: Jingqi Liu <Jingqi.liu@intel.com>
Link: https://lore.kernel.org/r/20240207090742.23857-1-Jingqi.liu@intel.com
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
2024-03-01 13:51:19 +01:00
Erick Archer
8379054869 iommu/vt-d: Use kcalloc() instead of kzalloc()
This is an effort to get rid of all multiplications from allocation
functions in order to prevent integer overflows [1].

Here the multiplication is obviously safe because DMAR_LATENCY_NUM
is the number of latency types defined in the "latency_type" enum.

enum latency_type {
	DMAR_LATENCY_INV_IOTLB = 0,
	DMAR_LATENCY_INV_DEVTLB,
	DMAR_LATENCY_INV_IEC,
	DMAR_LATENCY_PRQ,
	DMAR_LATENCY_NUM
};

However, using kcalloc() is more appropriate [2] and improves
readability. This patch has no effect on runtime behavior.

Link: https://github.com/KSPP/linux/issues/162 [1]
Link: https://www.kernel.org/doc/html/next/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments [2]
Signed-off-by: Erick Archer <erick.archer@gmx.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20240211175143.9229-1-erick.archer@gmx.com
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
2024-03-01 13:51:18 +01:00
Lu Baolu
4b8d18c0c9 iommu/vt-d: Remove INTEL_IOMMU_BROKEN_GFX_WA
Commit 62edf5dc4a ("intel-iommu: Restore DMAR_BROKEN_GFX_WA option for
broken graphics drivers") was introduced 24 years ago as a temporary
workaround for graphics drivers that used physical addresses for DMA and
avoided DMA APIs. This workaround was disabled by default.

As 24 years have passed, it is expected that graphics driver developers
have migrated their drivers to use kernel DMA APIs. Therefore, this
workaround is no longer required and could been removed.

The Intel iommu driver also provides a "igfx_off" option to turn off
the DMA translation for the graphic dedicated IOMMU. Hence, there is
really no good reason to keep this config option.

Suggested-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Link: https://lore.kernel.org/r/20240130060823.57990-1-baolu.lu@linux.intel.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
2024-03-01 13:51:17 +01:00
Arnd Bergmann
d474a94e2c Microchip AT91 device tree updates for v6.9
It contains:
 - use DMA for DBGU of at91sam9x5ek.dtsi and USART3 of
   at91sam9g25-gardena-smart-gateway.dts
 - the new SAMA7G54 Curiosity board
 - cleanups
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQTsZ8eserC1pmhwqDmejrg/N2X7/QUCZdzYNwAKCRCejrg/N2X7
 /SUvAP0ZzfQrUHYKMFZdU7lURoEfXeViXYUe+Lt0AMk/9JNEtgEA56z+MxKBj7s/
 SF/606oWinPTxmfzjfVqMe0PRc5QIgw=
 =Hq32
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmXhzoMACgkQYKtH/8kJ
 UiddSg//dmFik2j/1sjoNjdfcFDxbwYBzIrPUI0N99RjtCmHs1cSSI0UPoa5GIG2
 xyTYS0ZieN2yxt35rN6y/y+pcuziRerWdjtifjy6HVSuzp/qf1chmRerqgrMjWqe
 BDqFxbf8bLM3lHlK04mRgFYuHds0a/popuwxZkAmAFFHg23ri5IRjebM5v7P8IL7
 CsXp49mFNYkpPOZ0d2ClS4AIvDFH8IA4nOyP+lOgN6aga2N3kilnZ3o9MG3iJRFl
 AiNrvxzyzWlyMeDEAnieKpGoEasE4hsxDYFcgVvXri+xjHDR9jB8bbKJ+Sxvvsfo
 xBDHJwa/SBIMKjy+fYTEIdGh6dpRr0QgHUcxh/DFHjuVksHWuyIR2aGkf4f78Lxq
 gdwNqRYlPTIJbm2d50MU12MXX28K9o+WNxNfS0qd6mMm1iCHFInoneRpEEp/Yg9H
 4vY2Vhq6R7eiW9KzaXKbrBrAvs66IxhnXfGTdmemrJh96EL0eN3KeI08kphcHF16
 BdcKabOLjNg/qQU7Salpe6Es3K6QlOFcouo66RmgnYYn3INb52gbSlJVrh1/M8MF
 nGXr3ONvSTD8wtRv/rmZZqCQBeNu+QR6VYL5ZuBefLVKCn+5AMtT63OlhhT2GJ4G
 TwgqMpUs03qBEiUiPHmnAiHXbL4hrc3t/ivnaHxesnPKtv7fkik=
 =+mcN
 -----END PGP SIGNATURE-----

Merge tag 'at91-dt-6.9' of https://git.kernel.org/pub/scm/linux/kernel/git/at91/linux into soc/dt

Microchip AT91 device tree updates for v6.9

It contains:
- use DMA for DBGU of at91sam9x5ek.dtsi and USART3 of
  at91sam9g25-gardena-smart-gateway.dts
- the new SAMA7G54 Curiosity board
- cleanups

* tag 'at91-dt-6.9' of https://git.kernel.org/pub/scm/linux/kernel/git/at91/linux:
  ARM: dts: microchip: sama7g5: add sama7g5 compatible
  ARM: dts: microchip: sam9x60: align dmas to the opening '<'
  ARM: dts: microchip: sama7g5: align dmas to the opening '<'
  ARM: dts: microchip: sama7g54_curiosity: Add initial device tree of the board
  ARM: dts: microchip: sama7g5: Add flexcom 10 node
  dt-bindings: ARM: at91: Document Microchip SAMA7G54 Curiosity
  ARM: dts: microchip: gardena-smart-gateway: Use DMA for USART3
  ARM: dts: microchip: at91sam9x5ek: Use DMA for DBGU serial port

Link: https://lore.kernel.org/r/20240226183635.1964704-1-claudiu.beznea@tuxon.dev
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2024-03-01 13:48:03 +01:00
Krzysztof Kozlowski
b5a1f7513a iommu: re-use local fwnode variable in iommu_ops_from_fwnode()
iommu_ops_from_fwnode() stores &iommu_spec->np->fwnode in local
variable, so use it to simplify the code (iommu_spec is not changed
between these dereferences).

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240216144027.185959-4-krzysztof.kozlowski@linaro.org
Signed-off-by: Joerg Roedel <jroedel@suse.de>
2024-03-01 13:47:01 +01:00
Krzysztof Kozlowski
5896e6e39b iommu: constify fwnode in iommu_ops_from_fwnode()
Make pointer to fwnode_handle a pointer to const for code safety.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240216144027.185959-3-krzysztof.kozlowski@linaro.org
Signed-off-by: Joerg Roedel <jroedel@suse.de>
2024-03-01 13:47:01 +01:00
Krzysztof Kozlowski
b42a905b6a iommu: constify of_phandle_args in xlate
The xlate callbacks are supposed to translate of_phandle_args to proper
provider without modifying the of_phandle_args.  Make the argument
pointer to const for code safety and readability.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240216144027.185959-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Joerg Roedel <jroedel@suse.de>
2024-03-01 13:46:57 +01:00
Krzysztof Kozlowski
e70e9ecd7c iommu: constify pointer to bus_type
Make pointer to bus_type a pointer to const for code safety.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Link: https://lore.kernel.org/r/20240216144027.185959-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Joerg Roedel <jroedel@suse.de>
2024-03-01 13:46:57 +01:00
Arnd Bergmann
b797b9cde4 arm64: ZynqMP DT changes for 6.9
dt-bindings:
 - Describe firmware for Versal NET
 - Describe all firmware child nodes
 - Align versal-fpga node name with dt schema
 - Describe k26 rev2 and kv260
 
 DTs:
 - Align firmware node with dt schema
 - Add an optee node
 - Describe reset for CANs
 - Update ECAM size to discover up to 256 buses
 - Describe assigned-clocks for uarts
 - Add u-boot node
 - Comment SMMU entries
 - Align dwc3 nodes with dt schema
 - Rename i2c groups to match dt schema
 - Small DT updates (comments)
 - Fix default clock frequency for si570 (zcu102, zcu106)
 - Add output-enable pins and cover MIO38 (SOM)
 -----BEGIN PGP SIGNATURE-----
 
 iF0EABECAB0WIQQbPNTMvXmYlBPRwx7KSWXLKUoMIQUCZdyDIwAKCRDKSWXLKUoM
 IRTlAKCBnBVaSTKA2VR6roEHzjsg2ri+jgCfcnNnm1wc5KdnKsW17kHmKGjTFaI=
 =0Qlr
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmXhzg8ACgkQYKtH/8kJ
 UieZLRAA2UvwLSnLB49ByEj1y0jLCqjWBxAdivzi/hAq3XTw7+CljUupWBggYIYG
 Y3P1Md26+LbUNvlIeEMP/HCznJC3tQiuVmPtpGAJXJoRbFNgpSxqn76Q+FQ03mLc
 UBAtybk9DXxqxqx5lIYbLQ5CtZMPdUObN+kXksu/Uw27vUVjDWsKOIfwpK+D04aj
 req2R6dWEp6diP94++oH33PQPn3i5EeAXM8nN3mDpuS+ffLqdnAhvhb3s2xHNi8m
 B+gpGP59lTRC0AGmoh9TJo+ErEogMDW5PTA3GKlhlZVXNFxkyA2W1tkiVyhvBfu9
 3TrC+pmZeofB3n0d68ekJ5gt8TNeecjvM09DgO6K7imPLXkR5aMagyx+WJHU06O6
 0naQzCYwsMQuDKnspFWYviszk648fvQqNpcU5A/rHkm2mFUTFGV2ZNLRh9YA6UfO
 vRDr7iIQ3N3F0kDmiPBbKoMKEu5o+WFWc8YgjnHbLTThalsGACzHYYyFjQdcnkh7
 9cnG9qdb/dduFFtrp54Uk2I/DF+tBTaiYWvWCHbNDw23nu5u4mLS3t9ORhXPyg7k
 KKikhRXhCjab2hFMGtC7zhiUnGpoK4BPckJSYPCXVNM55qkZO0PgKr7W5Ieor0BM
 XRK4UqbkX8e0knxF0YIGsESno6876hrL1T5E+jO4ldhNUR9nu7U=
 =dkX9
 -----END PGP SIGNATURE-----

Merge tag 'zynqmp-dt-for-6.9' of https://github.com/Xilinx/linux-xlnx into soc/dt

arm64: ZynqMP DT changes for 6.9

dt-bindings:
- Describe firmware for Versal NET
- Describe all firmware child nodes
- Align versal-fpga node name with dt schema
- Describe k26 rev2 and kv260

DTs:
- Align firmware node with dt schema
- Add an optee node
- Describe reset for CANs
- Update ECAM size to discover up to 256 buses
- Describe assigned-clocks for uarts
- Add u-boot node
- Comment SMMU entries
- Align dwc3 nodes with dt schema
- Rename i2c groups to match dt schema
- Small DT updates (comments)
- Fix default clock frequency for si570 (zcu102, zcu106)
- Add output-enable pins and cover MIO38 (SOM)

* tag 'zynqmp-dt-for-6.9' of https://github.com/Xilinx/linux-xlnx: (21 commits)
  dt-bindings: firmware: xilinx: Describe soc-nvmem subnode
  dt-bindings: soc: xilinx: Add support for KV260 CC
  dt-bindings: soc: xilinx: Add support for K26 rev2 SOMs
  arm64: zynqmp: Align usb clock nodes with binding
  arm64: zynqmp: Comment all smmu entries
  arm64: zynqmp: Rename i2c?-gpio to i2c?-gpio-grp
  arm64: zynqmp: Disable Tri-state for MIO38 Pin
  arm64: zynqmp: Remove incorrect comment from kv260s
  arm64: zynqmp: Introduce u-boot options node with bootscr-address
  arm64: zynqmp: Fix comment to be aligned with board name.
  arm64: zynqmp: Update ECAM size to discover up to 256 buses
  arm64: zynqmp: Describe assigned-clocks for uarts
  arm64: zynqmp: Setup default si570 frequency to 156.25MHz
  arm64: zynqmp: Add resets property for CAN nodes
  arm64: zynqmp: Add an OP-TEE node to the device tree
  arm64: zynqmp: Add output-enable pins to SOMs
  arm64: zynqmp: Rename zynqmp-power node to power-management
  dt-bindings: firmware: xilinx: Sort node names (clock-controller)
  dt-bindings: firmware: xilinx: Describe missing child nodes
  dt-bindings: firmware: xilinx: Fix versal-fpga node name
  ...

Link: https://lore.kernel.org/r/CAHTX3dLEoFMTGg1Q4+OuOwWYd8N73YBTXki8Vvj3cGHUpLJ0=A@mail.gmail.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2024-03-01 13:46:07 +01:00
Arnd Bergmann
b339605081 Add PowerVR Series5 SGX GPUs for the TI SoCs
With the Imagination Rogue GPU binding added, let's also add the devicetree
 binding for earlier SGX GPUs. Let's also patch the TI SoCs for the related
 SGX GPU nodes.
 
 Based on the mailing list discussions, the conclusion was that we need two
 separate device tree bindings, one for Rogue and upcoming GPUS, and one for
 the older SGX GPUs.
 
 For merging the changes, I applied the binding changes together with the
 TI SoC related changes into a branch leaving out the sun6i and mips changes
 as suggested by Rob.
 
 These changes are mostly 32-bit SoCs, but also contains one arm64 change.
 It does not cause any merge conflicts.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEkgNvrZJU/QSQYIcQG9Q+yVyrpXMFAmXcZiwRHHRvbnlAYXRv
 bWlkZS5jb20ACgkQG9Q+yVyrpXNyoBAAgI4qgIZWMNuccDnSwn+UCTDySqa+EBCK
 l7M9jrrLJ8Z+8Wz498lGp6hMD+3fa1bUHYmf8WE9+hWvUL4YcTpAxueTMJ8lvQE0
 b6SM85G08p8Golm+PNXjz+JrJed83bfjZeZQJZqYZsrRyS8fw1Q/dpilydZhURpR
 gm8Sh7V1Q1FXHyh/j3C4Yo5m048bG50PmAp3Cqw8Pu5UvW+mNPMFc+3c06O6wtWy
 jgNb6JiNFkRlNkpnnx+JTjXaZcrsB2k1uodOMYBJjc8fndRlhKPuNYvA9ZEAhgQU
 W4L4BL/uJODciRY9yIciB8Qn5ulsjTJOW+pwQfhRnPAjf4h5/Dw68GJLLtBAtSbt
 2Kt2t+Ma1CBDxumvCpj6FK48rmCKeF3i+HVbgQyqMjh3izDvXLlMCaDXuw5ema3j
 7ihNEw+am0Upy84meT4qzksX73QnVF/3reWGnH97I+fpxW/ec4UcjeU1zEJvSwZ1
 +GwEzl4eufFyBph70pJrU7RUpI52kMm8gdM3Wlcr4I+IkSQITx8pm0ed+l4lKJTI
 YFCZq9RZaf8uGPIi6fUXBeZOHjEJRVpqyrMIBI8Vb4KZAMk8tj1o0UjmxLiU2pLF
 tOzd0s/LJrsKOCDDXWVxk2Y33L+mPm65LV0U3ZJA3k3BVi8k+n/FGqxaSIKmrsEd
 eWjzriVh43w=
 =4Z+H
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmXhzNQACgkQYKtH/8kJ
 UicMlBAA1NuNlFF56ckjDUWXLtL2oQlS/0Wi1uiqCJ6SjvGgly5STBOgLphKfZr2
 tdv43qJf9c8lfseZR6KzEirjc21Lk615jJkXq5Qh6P9FnhvyL6WfZ0XvKkSYZ06e
 sFCfLuFeehaR0i7gN0hFq+4tybotoJS29iu5HYPcDuD+dsNn71B73TmhzWvo6bSd
 ELCjftUkgZWPxHsG+oSDrhmuGSYLCSaDAmJvhCE8hwHLQ7b4ukwGHHu3iLGHJN+e
 vgyviRCYiknGSS1T6I5OHZWUySu3fExexpxtUkSlMsnkDXqGExjD/nanKeQ3nQJp
 ilmJ7jxS/or3Y28PYwDWwRX715FkoBfrPlzNDAFW4QVTNxspYbL1akhdnafofvC2
 ehSpCHW4C8FR04Ias4ofzPPDAPTEzszxpeFHJcYdfSpIv48PHOkHgRuQta0iv8S7
 jP46Q4hMUf+8qZT3MArmN9IjcSW3zVJDO4alWPmBRwUjOQw8vXSx3XrzHQF0Ivmb
 J6AGb/higgCSMrYBBhsnpbXmbBCems/mh4IO/6Ni5hWoX86Qj4Hz1+8qbG5A4aeL
 HM0lujl0ufnHNzIJKlsE/mJhE20fQgHsEkkRDpexDtyYq7B1Vmjx7pJweZyiss67
 j0yWw/6RvUfe/17XI33r2qqtiwr2fZfg2PNPIV1Dr0qXQftB/PA=
 =PpqJ
 -----END PGP SIGNATURE-----

Merge tag 'sgx-for-v6.9-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into soc/dt

Add PowerVR Series5 SGX GPUs for the TI SoCs

With the Imagination Rogue GPU binding added, let's also add the devicetree
binding for earlier SGX GPUs. Let's also patch the TI SoCs for the related
SGX GPU nodes.

Based on the mailing list discussions, the conclusion was that we need two
separate device tree bindings, one for Rogue and upcoming GPUS, and one for
the older SGX GPUs.

For merging the changes, I applied the binding changes together with the
TI SoC related changes into a branch leaving out the sun6i and mips changes
as suggested by Rob.

These changes are mostly 32-bit SoCs, but also contains one arm64 change.
It does not cause any merge conflicts.

* tag 'sgx-for-v6.9-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap:
  arm64: dts: ti: k3-am654-main: Add device tree entry for SGX GPU
  ARM: dts: DRA7xx: Add device tree entry for SGX GPU
  ARM: dts: AM437x: Add device tree entry for SGX GPU
  ARM: dts: AM33xx: Add device tree entry for SGX GPU
  ARM: dts: omap5: Add device tree entry for SGX GPU
  ARM: dts: omap4: Add device tree entry for SGX GPU
  ARM: dts: omap3: Add device tree entry for SGX GPU
  dt-bindings: gpu: Add PowerVR Series5 SGX GPUs
  dt-bindings: gpu: Rename img,powervr to img,powervr-rogue

Link: https://lore.kernel.org/r/pull-1708943489-872615@atomide.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2024-03-01 13:40:52 +01:00
Arnd Bergmann
06d179e31c i.MX arm64 device tree for 6.9:
- New board support: Apalis eval v1.2 carrier board, Variscite
   VAR-SOM-MX93, phyBOARD-Segin-i.MX93.
 - A series from Adam Ford to enable bluetooth, configure multiple queues
   on eqos, remove unnecessary clock configuration for i.MX8 Beacon boards.
 - Several changesets from Alexander Stein to add i.MX8DXP support, enable
   audio and GPU for i.MX8QXP, re-parent MEDIA_MIPI_PHY1_REF clock for
   i.MX8MP, and improve MBA8xx board description.
 - A few dt-schema fixes from Fabio Estevam for i.MX8MM and i.MX93 devices.
 - A bunch of changes from Frank Li to improve i.MX8QM and i.MX8DXL
   support, correcting edma3 power-domains and interrupt numbers, adding
   I2C, FlexCAN and SMMU devices, etc.
 - A series from Frieder Schrempf to improve imx8mm-kontron board
   descriptions, disabling pulls, fixing up RTC device, adding EEPROM,
   and refactoring OSM-S module, etc.
 - A set of Data Modul i.MX8M Plus eDM SBC improvements from Marek Vasut.
 - A series from Shengjiu Wang to add PDM micphone and SPDIF sound card
   support for imx8mm-evk board.
 - A series of imx8mm-venice boards improvement from Tim Harvey to add
   TPM device, fix USB OTG VBUS etc.
 - Other small and random improvements on various boards.
 -----BEGIN PGP SIGNATURE-----
 
 iQFIBAABCgAyFiEEFmJXigPl4LoGSz08UFdYWoewfM4FAmXb+44UHHNoYXduZ3Vv
 QGtlcm5lbC5vcmcACgkQUFdYWoewfM7XrggAlnkIk0aNw4wTD2OLflPHgE0gD3PR
 D2kn+tXx7iUEIv0JM7x4I4aOUOmZIKKSPn1KdJa1kyUAOxgrQR7bs80jsmmmSi57
 GvVsAR7F/a7enOW1rQXqrCmWJgckD1d5Lb+z5b4JnkQsqQSbTwiyHwIzkRvlAGHK
 zmuN5JSgYt0PKNYd5YylP0uvbnE0aYsDFyRhMxvRYNayb0t1w2gMoGDKc7mHrhXb
 84hU9koauUNtzVH2xGH6G2P6PmdOJ6OhQoPIQ+ZCOWvBlAtKzelGGgaySFO3EKAu
 RkZXqFi1RDofabwZq+aEXFFY7aNEHwkjLdYj0pFiAPRIhJ7cIrRUAGD+tg==
 =7WYT
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmXhzCUACgkQYKtH/8kJ
 UieNgBAAmcz37LIo3ZP1W99t4DNw8lc+TtWLW8dIw1Vew5pojRTIh9docQB+o+Ge
 7W/GTY1DZ2gO8k3V9WQBsHSk6OTumikBRtuPzQKsrL9SR99MkOzCdPMkuXxfUnD5
 WFnzBH/pLr/CmHG+ID8QwWcEDpPwItJWGoK9JtRDeINJEADQuUDAxeW9jeuDihMn
 g3aC/DvhO02LyoY/3Jn5JgZVPl4ZdJBUR04O7VesEn/ktupVJ3QM0FZUFfm1Cinx
 7aivbuf6v4kiQIDmtjR8AmkuJ1vkYCVAMRyNdGnQ04fMn2mXnzH/5cMveH+QSFcl
 6/7EU7R2J/nJZAHAuvsEkrz5b1fXsivE+Z9OTGDeqXB1+BuSmDmCUWlkkrRQaTiO
 ifieyIAtRIeK5py0FNlHNDMA+oQo8oORzOhnP4FhxaSX1G6hpNkYMB1y95TVlcP2
 Z0F486eLr+tyPn97eTK57b47/a2YHBywKFktSF75tVv60QM4fZEtOev2PzEvQqIy
 jLWfp1dMyX8sguNvw2swJ/6rYRVyCGsj6ImvcwR5J7EnhQZKSw4mHFZ0rhaFSioQ
 mh9RxVoaLY17k1N82nOinkgnv5/jODYLXfo1dl3tAqxjiq6QVosVOQ2rxVLhF9fP
 yTfoxPl48a9CGISFwtMjvtmg7baCS92unbN0D8Zp7+UZ2IBwmIU=
 =ZRvF
 -----END PGP SIGNATURE-----

Merge tag 'imx-dt64-6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux into soc/dt

i.MX arm64 device tree for 6.9:

- New board support: Apalis eval v1.2 carrier board, Variscite
  VAR-SOM-MX93, phyBOARD-Segin-i.MX93.
- A series from Adam Ford to enable bluetooth, configure multiple queues
  on eqos, remove unnecessary clock configuration for i.MX8 Beacon boards.
- Several changesets from Alexander Stein to add i.MX8DXP support, enable
  audio and GPU for i.MX8QXP, re-parent MEDIA_MIPI_PHY1_REF clock for
  i.MX8MP, and improve MBA8xx board description.
- A few dt-schema fixes from Fabio Estevam for i.MX8MM and i.MX93 devices.
- A bunch of changes from Frank Li to improve i.MX8QM and i.MX8DXL
  support, correcting edma3 power-domains and interrupt numbers, adding
  I2C, FlexCAN and SMMU devices, etc.
- A series from Frieder Schrempf to improve imx8mm-kontron board
  descriptions, disabling pulls, fixing up RTC device, adding EEPROM,
  and refactoring OSM-S module, etc.
- A set of Data Modul i.MX8M Plus eDM SBC improvements from Marek Vasut.
- A series from Shengjiu Wang to add PDM micphone and SPDIF sound card
  support for imx8mm-evk board.
- A series of imx8mm-venice boards improvement from Tim Harvey to add
  TPM device, fix USB OTG VBUS etc.
- Other small and random improvements on various boards.

* tag 'imx-dt64-6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux: (77 commits)
  arm64: dts: imx8mm-kontron-bl-osm-s: Fix Ethernet PHY compatible
  arm64: dts: imx8-apalis-v1.1: Remove reset-names from ethernet-phy
  arm64: dts: imx8mp-evk: Fix hdmi@3d node
  arm64: dts: imx93-var-som: Remove phy-supply from eqos
  arm64: dts: imx8mp-phyboard-pollux: Disable pull-up for CD GPIO
  arm64: dts: imx8mp-phyboard-pollux: Reduce drive strength for eqos tx lines
  arm64: dts: imx8mp-phyboard-pollux: Set debug uart muxing to 0x140
  arm64: dts: imx8mp-phyboard-pollux: Add and update rtc devicetree node
  arm64: dts: imx8mm-evk: Add spdif sound card support
  arm64: dts: mba8xx: Add missing #interrupt-cells
  arm64: dts: imx8mp: Set SPI NOR to max 40 MHz on Data Modul i.MX8M Plus eDM SBC
  arm64: dts: imx8mn: tqma8mqnl-mba8mx: Add USB DR overlay
  arm64: dts: imx8mq: tqma8mq-mba8mx: Add missing USB vbus supply
  arm64: dts: freescale: imx8mm/imx8mq: mba8mx: Use PCIe clock generator
  arm64: dts: imx8mn-beacon: Remove unnecessary clock configuration
  arm64: dts: imx8mn: Slow default video_pll clock rate
  arm64: dts: imx8mp-beacon: Configure multiple queues on eqos
  arm64: dts: imx8mp-beacon: Enable Bluetooth
  arm64: dts: freescale: minor whitespace cleanup
  arm64: dts: lx2160a: Fix DTS for full PL011 UART
  ...

Link: https://lore.kernel.org/r/20240226034147.233993-4-shawnguo2@yeah.net
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2024-03-01 13:37:57 +01:00
Jens Axboe
86b1e613eb Merge tag 'md-6.9-20240301' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md into for-6.9/block
Pull MD updates from Song:

"The major changes are:

 1. Refactor raid1 read_balance, by Yu Kuai and Paul Luse.
 2. Clean up and fix for md_ioctl, by Li Nan.
 3. Other small fixes, by Gui-Dong Han and Heming Zhao."

* tag 'md-6.9-20240301' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md: (22 commits)
  md/raid1: factor out helpers to choose the best rdev from read_balance()
  md/raid1: factor out the code to manage sequential IO
  md/raid1: factor out choose_bb_rdev() from read_balance()
  md/raid1: factor out choose_slow_rdev() from read_balance()
  md/raid1: factor out read_first_rdev() from read_balance()
  md/raid1-10: factor out a new helper raid1_should_read_first()
  md/raid1-10: add a helper raid1_check_read_range()
  md/raid1: fix choose next idle in read_balance()
  md/raid1: record nonrot rdevs while adding/removing rdevs to conf
  md/raid1: factor out helpers to add rdev to conf
  md: add a new helper rdev_has_badblock()
  md/raid5: fix atomicity violation in raid5_cache_count
  md/md-bitmap: fix incorrect usage for sb_index
  md: check mddev->pers before calling md_set_readonly()
  md: clean up openers check in do_md_stop() and md_set_readonly()
  md: sync blockdev before stopping raid or setting readonly
  md: factor out a helper to sync mddev
  md: Don't clear MD_CLOSING when the raid is about to stop
  md: return directly before setting did_set_md_closing
  md: clean up invalid BUG_ON in md_ioctl
  ...
2024-03-01 05:37:13 -07:00
Andi Shyti
3f2f20da79 drm/i915/guc: Use the new gt_to_guc() wrapper
Get the guc reference from the gt using the gt_to_guc() helper.

Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231229102734.674362-3-andi.shyti@linux.intel.com
2024-03-01 13:19:43 +01:00
Andi Shyti
01b2b8cc1e drm/i915/gt: Create the gt_to_guc() wrapper
We already have guc_to_gt() and getting to guc from the GT it
requires some mental effort. Add the gt_to_guc().

Given the reference to the "gt", the gt_to_guc() will return the
pinter to the "guc".

Update all the files under the gt/ directory.

Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231229102734.674362-2-andi.shyti@linux.intel.com
2024-03-01 13:19:43 +01:00
Uros Bizjak
ce3576ebd6 locking/rtmutex: Use try_cmpxchg_relaxed() in mark_rt_mutex_waiters()
Use try_cmpxchg() instead of cmpxchg(*ptr, old, new) == old.

The x86 CMPXCHG instruction returns success in the ZF flag, so this change
saves a compare after CMPXCHG (and related move instruction in front of CMPXCHG).

Also, try_cmpxchg() implicitly assigns old *ptr value to "old" when CMPXCHG
fails. There is no need to re-read the value in the loop.

Note that the value from *ptr should be read using READ_ONCE() to prevent
the compiler from merging, refetching or reordering the read.

No functional change intended.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Waiman Long <longman@redhat.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@kernel.org>
Link: https://lore.kernel.org/r/20240124104953.612063-1-ubizjak@gmail.com
2024-03-01 13:02:05 +01:00
Arnd Bergmann
a634daed69 i.MX ARM device tree for 6.9:
- New board support: Sielaff i.MX6 Solo, Apalis Evaluation Board v1.2.
 - A bunch of i.MX7 TQMA7/MBA7 updates from Alexander Stein that add
   various devices, improve hardware descriptions and fix dt-schema
   warnings, etc.
 - Correct touchscreen rotation for imx6sl-tolino-shine2hd board.
 - An imx53-qsb update from Dmitry Baryshkov to add HDMI expander support.
 - A couple of i.MX1 and i.MX28 device node name fixes from Fabio Estevam.
 - Enable usb3-lpm-capable for LS1021A usb3 node.
 - A couple of imx6dl-yapp4 board improvements from Michal Vokáč.
 - A series from Sebastian Reichel to improve imx6ull descriptions.
 -----BEGIN PGP SIGNATURE-----
 
 iQFIBAABCgAyFiEEFmJXigPl4LoGSz08UFdYWoewfM4FAmXb9SsUHHNoYXduZ3Vv
 QGtlcm5lbC5vcmcACgkQUFdYWoewfM5mZggAn8fEfOw9G4uRmOQFee2aEtofqu48
 bwd3dZyQVShJgJh6AgEQ1QeEvYOvpzIOmugleDMrcxAINuJ3YJfAPtY8dtrIcx88
 0ZRiceeRKQVqI4h2HpJ/t0HRs8XsjadnnFtEtiJXt6YYmALk4cBVGzGbuDI6au66
 HZ4HGqM4LGQUSVclV43vt7rZdXxewcLkBgQ5hOsQwQ2rzAWF5uTPRQF8I1kXkBN4
 gHRamiwV6fqttHimMZNOhvLzl4Hmv5gcAWCIs9iD7nDLIY5VN0j9aiNunynWmA83
 A7zGea4Sb/vbHt0dCcCDFwZ4z8rAewoSrCguaJ7h5xugjUWjckkPyQ/JYg==
 =+Fvs
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmXhw1oACgkQYKtH/8kJ
 UidaMw//Q2rzALCWUvO8Neee9IBzyiC5D+tb66a2olkeR+4hYNuMnyVGBP5c3uwk
 eXAptmVel2dGdeoJ7W9MMcaAER7K/r9jHCWtSW9rJt7eHPBqsZVxlwfhztaJzGvQ
 VxOX2yXdrcBLw+X7hBSKrjqCXnwSVlBW0e8Bh5KPfxUowr40V5PArGT9bpt0cPDi
 lW0HQvjnaocA0gJwXmtaVvoSg6C0F9iMYvzB+7aEAcH31unaeu64jRt+LZlDQlvr
 dyfI1jEKBOMncfJ4YaXi+eB0yQadv4Cw8agN7AqStXAT1oJNestZCKe1o3C2yZij
 Spaz1ydjukRwlU7oKU0b/BKZQxEB2yMDzCURkXpNAm9+TkruidD7xtyOJ7O9T/uz
 2F3qwc7oQu0EBX1/Uj7ruEadrKMKHm8/P8K4ojXZ3kTv05I7YvXekAvoGhaJ8wrv
 2ou4+MjScpbSrOONtMRoCMBWWYNFBF1j9TmQtgmhf7afcO918f1jqmvt3OvRI7pr
 wAKt/aTlHWIP62GfxDyLOXp3QQdq/I9xqUkagxUYowHCWuSoEMC68ZxKCVs7Ut7e
 XEcqTTrizyx6k3ErRhznfZSGOfkH48moGl20yjYM+GLl/zLFcwlwyKkiSPpPubND
 KUGY9+9EEtIHxHnoLSQW/zzWSHAonsq/ojCkUvIerld4jA68Ce4=
 =iYGr
 -----END PGP SIGNATURE-----

Merge tag 'imx-dt-6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux into soc/dt

i.MX ARM device tree for 6.9:

- New board support: Sielaff i.MX6 Solo, Apalis Evaluation Board v1.2.
- A bunch of i.MX7 TQMA7/MBA7 updates from Alexander Stein that add
  various devices, improve hardware descriptions and fix dt-schema
  warnings, etc.
- Correct touchscreen rotation for imx6sl-tolino-shine2hd board.
- An imx53-qsb update from Dmitry Baryshkov to add HDMI expander support.
- A couple of i.MX1 and i.MX28 device node name fixes from Fabio Estevam.
- Enable usb3-lpm-capable for LS1021A usb3 node.
- A couple of imx6dl-yapp4 board improvements from Michal Vokáč.
- A series from Sebastian Reichel to improve imx6ull descriptions.

* tag 'imx-dt-6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux: (43 commits)
  ARM: dts: nxp: imx: fix weim node name
  ARM: dts: nxp: imx6ul: fix touchscreen node name
  ARM: dts: nxp: imx6ul: xnur-gpio -> xnur-gpios
  ARM: dts: imx6ul: Remove fsl,anatop from usbotg1
  ARM: dts: imx6ull: fix pinctrl node name
  ARM: dts: imx1-apf9328: Fix Ethernet node name
  ARM: dts: imx28-evk: Use 'eeprom' as the node name
  ARM: dts: ls1021a: Enable usb3-lpm-capable for usb3 node
  ARM: dts: imx6dl-yapp4: Move the internal switch PHYs under the switch node
  ARM: dts: imx6dl-yapp4: Fix typo in the QCA switch register address
  ARM: dts: imx6ul: Set macaddress location in ocotp
  ARM: dts: imx53-qsb: add support for the HDMI expander
  ARM: dts: imx6ull-dhcom: Remove /omit-if-no-ref/ from node usdhc1-pwrseq
  ARM: dts: imx: Add support for Apalis Evaluation Board v1.2
  ARM: dts: imx6: skov: add aliases for all ethernet nodes
  ARM: dts: imx6qdl-hummingboard: Add rtc0 and rtc1 aliases to fix hctosys
  ARM: dts: imx6dl: Add support for Sielaff i.MX6 Solo board
  ARM: dts: imx6ul: Add missing #thermal-sensor-cells to tempmon
  ARM: dts: imx6sl-tolino-shine2hd: fix touchscreen rotation
  ARM: dts: imx6ull-dhcor: Remove 900MHz operating point
  ...

Link: https://lore.kernel.org/r/20240226034147.233993-3-shawnguo2@yeah.net
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2024-03-01 13:00:26 +01:00
Arnd Bergmann
911c87949c i.MX dt-bindings for 6.9:
- New compatibles for boards: TQMa8Xx, Sielaff i.MX6 Solo, Toradex Apalis
   imx6q-eval-v1.2, VAR-SOM-MX93, phyBOARD-Segin-i.MX93, UNI-T UTi260B.
 - Add vendor prefix for UNI-T.
 -----BEGIN PGP SIGNATURE-----
 
 iQFIBAABCgAyFiEEFmJXigPl4LoGSz08UFdYWoewfM4FAmXb72cUHHNoYXduZ3Vv
 QGtlcm5lbC5vcmcACgkQUFdYWoewfM7xowf9HXigQ2XniaCjTcDJSWCs7ZI8STfj
 fmGIOvmf/dHLbDtDILAOptbAfKAEf7WI7n4lrCDLnZ0JQ66PxwzSPlelv2KMhQ+G
 8yg8sUT3KRySjQHA/pJPplRC4CgqlzqQ/5AdVHIdvtCzCYtbOnPtvGLMUPLrrMes
 fm8I9PD8dIrCuHV/Ab+9gLTM9UWcDD/yT3OWYkC9nj9xA0COjJTWNAKsHf3McMX2
 dXf0EmOdRJBsvVWPJKdfdP5aa968phxTac6TpTFSPNLPiuHryhP5VGD8/KvPC/yY
 AF8EhxEhEkFzkv0X6LkkqyaflWanm13HaFu53NmUQmqCXQtVT6rdAH9Kbg==
 =DRG4
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmXhwmoACgkQYKtH/8kJ
 Uie5Gg//RlarXzla5HxbtVdfQGzn0rCBYRZ2e7Y/HzPa/Z5h1Y6MlmnqN/RsrmHg
 FPeAu0LZKnKGlmFlYbxcuBlKhXPpJpJ1C8BFb4dExE0p8vdvu3sG7pFpxt+graWn
 fB6GiJ9myUeLkQM2I91tw0nt5UJGsDRrimf5bmGNaRj+PCgLlERJ22KlbSQYftYT
 s1fzMoQG5UlMNrafPknMMwR9aigzZsmUq6v8YOLHXuxmJEZALcTwRBJHq6i+sA/L
 6QFQgdLQipotSBJsxw+/gWuzgQ74rdNl9uLLnz3Sb8zm5m4WdOnObpQZddjD3Kg2
 QCRLbA/cYkupD1NtWlLtEqgWpKe5LpHPnc4n0GHxiipf+1ba/jFoUKHPv+mhrUFb
 2svXC8FUqJs0re2G+tSV8ZSdLb7wXLHPdjjeOUFp0ivgKzFPPrbu5GAdOhw+QsFW
 Om31bXUO3fTXBXUhO+IoNzEPNj6ncQ/T3hLCTGcPhEX9Xtp+cil1LUHFUZf2ZzD7
 O5sixglE2e50rs52hHHeDqEisNcDA0dQ9zUkp4P8cnxV6ot3VE8QSNlMYT2vBa2m
 tKih0QaUwraESOgycurz5n6uTzfDAb5an5caVjTDoxU9HztY0MxcDTLY7H+ki46c
 zo+l2N0DlQFIPSVm+4qEI2j9niEQ0EBM9MO6XyY9IJs39ZvIUuY=
 =zd5N
 -----END PGP SIGNATURE-----

Merge tag 'imx-bindings-6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux into soc/dt

i.MX dt-bindings for 6.9:

- New compatibles for boards: TQMa8Xx, Sielaff i.MX6 Solo, Toradex Apalis
  imx6q-eval-v1.2, VAR-SOM-MX93, phyBOARD-Segin-i.MX93, UNI-T UTi260B.
- Add vendor prefix for UNI-T.

* tag 'imx-bindings-6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux:
  dt-bindings: arm: add UNI-T UTi260B
  dt-bindings: vendor-prefixes: add UNI-T
  dt-bindings: arm: fsl: remove redundant company name
  dt-bindings: arm: fsl: add imx8qm apalis eval v1.2 carrier board
  dt-bindings: arm: fsl: Add toradex,apalis_imx6q-eval-v1.2 board
  dt-bindings: arm: fsl: Add phyBOARD-Segin-i.MX93
  dt-bindings: arm: fsl: Add Sielaff i.MX6 Solo board
  dt-bindings: arm: fsl: Add VAR-SOM-MX93 with Symphony
  dt-bindings: arm: add TQMa8Xx boards

Link: https://lore.kernel.org/r/20240226034147.233993-2-shawnguo2@yeah.net
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2024-03-01 12:56:26 +01:00
Arnd Bergmann
fe37e5cb49 SoCFPGA DTS updates for v6.9
- Drop the "master" suffix in I3C controller node name
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEoHhMeiyk5VmwVMwNGZQEC4GjKPQFAmXb5p4ACgkQGZQEC4Gj
 KPTPag//a2kJliXMJ+uRLOhjV/hWgT5k3JJpPKRP+i7rgXEgGdup2mIrv1sVFIsX
 LLF1IUm9GeAhl80W7PFwLydMHMpQN81VmNTBjwCZXLlJ5x5gSCQwdukIqws9b/Yq
 nd0djDvY/HkmIgA1JR0YQqa8UByDQduG7B8uMny35amt1d1q4LEqyi+OaURtioBR
 /3lybf6lP1GClmKUJAmtec9wA8s+hNg/21uT4lhGXXGMqWlZpCCMUHfFqIhJ5/0r
 LVCslZEph90pjKO84h4xomaXZerujiJx7Fcyc6Xx1DJx1KpNueircsD2jMPKAvcQ
 y72RyTRFd1ntV8rbUXtBh7kXnPPC5tx8Xj1a0XtiNe1MVRrUti9deuYVvEr8SAXZ
 iy6RbFkK+CHM+0pkbNNWri/GSoLc3wQ+OKIV7T/83ht97A3AtkqZKElVQfAXK+dL
 6qZom9J7LA8danrkHtZqSMaL3381V06osfAcyAqDp6R3/z14SRdCdbg2mU4zyTcn
 Oyxz9i+PUqkwHUkYpzEB8mUMd3Q0WnkKwPZ0+fryjB/4arvXFCby40Iy3toIqW7v
 5WdcgoNpcKhZid8ZfNIxg/RpUgJvFcdJo2WPSJSblAOK/CTezR2JEfOLekX0ern3
 ByDt90q1Fbk2U6k1FitjrsAqh2X9D0SiDrv5XSmV4N9Cfu1cypA=
 =W+lw
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmXhwj0ACgkQYKtH/8kJ
 UicjwA/9GvwZCOY5BanSlv9euvSh4KPUHw4SqoCA03tYVQGwdimz3mVeZM1oDRpe
 GC24ZNg35zlcHi1+lvA7yvvZHmv26iHgaP0r2uipSV0yD/6NXHuODYyOANCc++K0
 IwD/7SHrLj825144pTz8603Q2wFDM2SyZKNPa1VmiPFtRYaG/LSq7qqKvj3N4Gbj
 X64vQVJAokj9Z08sWMwfkawZ7OWtZ5rWWukGU96Or32GhT+2EHSyRqDgD7w6Dt79
 7j7ntsnQcAieX9qE2Um/d4ojz/G8Bmyx622gG8fy5pDzKy3cvB2sf+2TOCHss6S0
 u2zZOkKoo4IblIslUL5TAgFleha08NGjK+hGg7RcyXT+2r2p+d162ZRMVzdGGBHP
 IgxwenCVBlDxhhlmxi3VmK35EZ5dl+y6NGLtMLhfkQvBBQ3eSt5N7CuGyuApdiKE
 v4VoXgC656dLklV3ffY/ETxHNDX60Zc9wZtZbqGTrxgn4/RDiaWZCmPjs75NAPyJ
 SoPO3amXP+vgTG8pQDuUO7+lvJZXn4M9CBR9OZRHTegVzlPLSow7Df5XjhiWpO0z
 wUmpPfqbSx2Me0FQgzrsuS1WSKXwS2MQf1Oxn62YjLGaETzn36jIzx2WApER5Nso
 lsRvW/jq1kq0v7k4kLxoaYEvENuWqlhb/em1Qf/QKgRr65OqT20=
 =rvLj
 -----END PGP SIGNATURE-----

Merge tag 'socfpga_dts_updates_for_v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/dinguyen/linux into soc/dt

SoCFPGA DTS updates for v6.9
- Drop the "master" suffix in I3C controller node name

* tag 'socfpga_dts_updates_for_v6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/dinguyen/linux:
  arm64: dts: intel: agilex5: drop "master" I3C node name suffix

Link: https://lore.kernel.org/r/20240226012528.20380-1-dinguyen@kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2024-03-01 12:55:40 +01:00
Uros Bizjak
e807c2a370 locking/x86: Implement local_xchg() using CMPXCHG without the LOCK prefix
Implement local_xchg() using the CMPXCHG instruction without the LOCK prefix.
XCHG is expensive due to the implied LOCK prefix.  The processor
cannot prefetch cachelines if XCHG is used.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Waiman Long <longman@redhat.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@kernel.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Link: https://lore.kernel.org/r/20240124105816.612670-1-ubizjak@gmail.com
2024-03-01 12:54:25 +01:00
Uros Bizjak
721f791ce1 x86/boot: Use 32-bit XOR to clear registers
x86_64 zero extends 32-bit operations, so for 64-bit operands,
XORL r32,r32 is functionally equal to XORQ r64,r64, but avoids
a REX prefix byte when legacy registers are used.

Slightly smaller code generated, no change in functionality.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20240124103859.611372-1-ubizjak@gmail.com
2024-03-01 12:47:37 +01:00
Christian Brauner
2558e3b231
libfs: add stashed_dentry_prune()
Both pidfs and nsfs use a memory location to stash a dentry for reuse by
concurrent openers. Right now two custom
dentry->d_prune::{ns,pidfs}_prune_dentry() methods are needed that do
the same thing. The only thing that differs is that they need to get to
the memory location to store or retrieve the dentry from differently.
Fix that by remember the stashing location for the dentry in
dentry->d_fsdata which allows us to retrieve it in dentry->d_prune. That
in turn makes it possible to add a common helper that pidfs and nsfs can
both use.

Link: https://lore.kernel.org/r/CAHk-=wg8cHY=i3m6RnXQ2Y2W8psicKWQEZq1=94ivUiviM-0OA@mail.gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-03-01 12:26:29 +01:00
Christian Brauner
159a0d9fd5
libfs: improve path_from_stashed() helper
In earlier patches we moved both nsfs and pidfs to path_from_stashed().
The helper currently tries to add and stash a new dentry if a reusable
dentry couldn't be found and returns EAGAIN if it lost the race to stash
the dentry. The caller can use EAGAIN to retry.

The helper and the two filesystems be written in a way that makes
returning EAGAIN unnecessary. To do this we need to change the
dentry->d_prune() implementation of nsfs and pidfs to not simply replace
the stashed dentry with NULL but to use a cmpxchg() and only replace
their own dentry.

Then path_from_stashed() can then be changed to not just stash a new
dentry when no dentry is currently stashed but also when an already dead
dentry is stashed. If another task managed to install a dentry in the
meantime it can simply be reused. Pack that into a loop and call it a
day.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/r/CAHk-=wgtLF5Z5=15-LKAczWm=-tUjHO+Bpf7WjBG+UU3s=fEQw@mail.gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-03-01 12:26:23 +01:00
Christian Brauner
b28ddcc32d
pidfs: convert to path_from_stashed() helper
Moving pidfds from the anonymous inode infrastructure to a separate tiny
in-kernel filesystem similar to sockfs, pipefs, and anon_inodefs causes
selinux denials and thus various userspace components that make heavy
use of pidfds to fail as pidfds used anon_inode_getfile() which aren't
subject to any LSM hooks. But dentry_open() is and that would cause
regressions.

The failures that are seen are selinux denials. But the core failure is
dbus-broker. That cascades into other services failing that depend on
dbus-broker. For example, when dbus-broker fails to start polkit and all
the others won't be able to work because they depend on dbus-broker.

The reason for dbus-broker failing is because it doesn't handle failures
for SO_PEERPIDFD correctly. Last kernel release we introduced
SO_PEERPIDFD (and SCM_PIDFD). SO_PEERPIDFD allows dbus-broker and polkit
and others to receive a pidfd for the peer of an AF_UNIX socket. This is
the first time in the history of Linux that we can safely authenticate
clients in a race-free manner.

dbus-broker immediately made use of this but messed up the error
checking. It only allowed EINVAL as a valid failure for SO_PEERPIDFD.
That's obviously problematic not just because of LSM denials but because
of seccomp denials that would prevent SO_PEERPIDFD from working; or any
other new error code from there.

So this is catching a flawed implementation in dbus-broker as well. It
has to fallback to the old pid-based authentication when SO_PEERPIDFD
doesn't work no matter the reasons otherwise it'll always risk such
failures. So overall that LSM denial should not have caused dbus-broker
to fail. It can never assume that a feature released one kernel ago like
SO_PEERPIDFD can be assumed to be available.

So, the next fix separate from the selinux policy update is to try and
fix dbus-broker at [3]. That should make it into Fedora as well. In
addition the selinux reference policy should also be updated. See [4]
for that. If Selinux is in enforcing mode in userspace and it encounters
anything that it doesn't know about it will deny it by default. And the
policy is entirely in userspace including declaring new types for stuff
like nsfs or pidfs to allow it.

For now we continue to raise S_PRIVATE on the inode if it's a pidfs
inode which means things behave exactly like before.

Link: https://bugzilla.redhat.com/show_bug.cgi?id=2265630
Link: https://github.com/fedora-selinux/selinux-policy/pull/2050
Link: https://github.com/bus1/dbus-broker/pull/343 [3]
Link: https://github.com/SELinuxProject/refpolicy/pull/762 [4]
Reported-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20240222190334.GA412503@dev-arch.thelio-3990X
Link: https://lore.kernel.org/r/20240218-neufahrzeuge-brauhaus-fb0eb6459771@brauner
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-03-01 12:24:53 +01:00
Christian Brauner
1fa08aece4
nsfs: convert to path_from_stashed() helper
Use the newly added path_from_stashed() helper for nsfs.

Link: https://lore.kernel.org/r/20240218-neufahrzeuge-brauhaus-fb0eb6459771@brauner
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-03-01 12:23:44 +01:00
Christian Brauner
07fd7c3298
libfs: add path_from_stashed()
Add a helper for both nsfs and pidfs to reuse an already stashed dentry
or to add and stash a new dentry.

Link: https://lore.kernel.org/r/20240218-neufahrzeuge-brauhaus-fb0eb6459771@brauner
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-03-01 12:23:44 +01:00
Christian Brauner
cb12fd8e0d
pidfd: add pidfs
This moves pidfds from the anonymous inode infrastructure to a tiny
pseudo filesystem. This has been on my todo for quite a while as it will
unblock further work that we weren't able to do simply because of the
very justified limitations of anonymous inodes. Moving pidfds to a tiny
pseudo filesystem allows:

* statx() on pidfds becomes useful for the first time.
* pidfds can be compared simply via statx() and then comparing inode
  numbers.
* pidfds have unique inode numbers for the system lifetime.
* struct pid is now stashed in inode->i_private instead of
  file->private_data. This means it is now possible to introduce
  concepts that operate on a process once all file descriptors have been
  closed. A concrete example is kill-on-last-close.
* file->private_data is freed up for per-file options for pidfds.
* Each struct pid will refer to a different inode but the same struct
  pid will refer to the same inode if it's opened multiple times. In
  contrast to now where each struct pid refers to the same inode. Even
  if we were to move to anon_inode_create_getfile() which creates new
  inodes we'd still be associating the same struct pid with multiple
  different inodes.

The tiny pseudo filesystem is not visible anywhere in userspace exactly
like e.g., pipefs and sockfs. There's no lookup, there's no complex
inode operations, nothing. Dentries and inodes are always deleted when
the last pidfd is closed.

We allocate a new inode for each struct pid and we reuse that inode for
all pidfds. We use iget_locked() to find that inode again based on the
inode number which isn't recycled. We allocate a new dentry for each
pidfd that uses the same inode. That is similar to anonymous inodes
which reuse the same inode for thousands of dentries. For pidfds we're
talking way less than that. There usually won't be a lot of concurrent
openers of the same struct pid. They can probably often be counted on
two hands. I know that systemd does use separate pidfd for the same
struct pid for various complex process tracking issues. So I think with
that things actually become way simpler. Especially because we don't
have to care about lookup. Dentries and inodes continue to be always
deleted.

The code is entirely optional and fairly small. If it's not selected we
fallback to anonymous inodes. Heavily inspired by nsfs which uses a
similar stashing mechanism just for namespaces.

Link: https://lore.kernel.org/r/20240213-vfs-pidfd_fs-v1-2-f863f58cfce1@kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
2024-03-01 12:23:37 +01:00