Commit graph

1216134 commits

Author SHA1 Message Date
Joel Fernandes (Google)
fc09027786 sched/rt: Fix live lock between select_fallback_rq() and RT push
During RCU-boost testing with the TREE03 rcutorture config, I found that
after a few hours, the machine locks up.

On tracing, I found that there is a live lock happening between 2 CPUs.
One CPU has an RT task running, while another CPU is being offlined
which also has an RT task running.  During this offlining, all threads
are migrated. The migration thread is repeatedly scheduled to migrate
actively running tasks on the CPU being offlined. This results in a live
lock because select_fallback_rq() keeps picking the CPU that an RT task
is already running on only to get pushed back to the CPU being offlined.

It is anyway pointless to pick CPUs for pushing tasks to if they are
being offlined only to get migrated away to somewhere else. This could
also add unwanted latency to this task.

Fix these issues by not selecting CPUs in RT if they are not 'active'
for scheduling, using the cpu_active_mask. Other parts in core.c already
use cpu_active_mask to prevent tasks from being put on CPUs going
offline.

With this fix I ran the tests for days and could not reproduce the
hang. Without the patch, I hit it in a few hours.

Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Tested-by: Paul E. McKenney <paulmck@kernel.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20230923011409.3522762-1-joel@joelfernandes.org
2023-09-28 22:58:13 +02:00
Quang Le
e6e43b8aa7 fs/smb/client: Reset password pointer to NULL
Forget to reset ctx->password to NULL will lead to bug like double free

Cc: stable@vger.kernel.org
Cc: Willy Tarreau <w@1wt.eu>
Reviewed-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Quang Le <quanglex97@gmail.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
2023-09-28 14:49:51 -05:00
Linus Torvalds
9ed22ae6be spi: Fixes for v6.6
A small set of device specific fixes, the most major one is for the GXP
 driver which would probably have been confusing some callers with
 returning the length rather than 0 on successful writes.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmUVfbcACgkQJNaLcl1U
 h9CrRAf+PmW5OJYtAsOo987ro01DvIWv5XDhEQjljQB5Dd+qbPL5XvR9cKpk4KUc
 kyvsWFS517Z298XItVGp+xDXrllvRjLn1ShUEoisEG8M+j84GN5M/eKw7W1Q7GxX
 iPUTdsgKJRhnKxtvuKtCpmBT24Ari54AiPHtS2tyZGJeo9ehdaUG+LIsJS/zzUuh
 KqfBBS7Gc9KE9alWqTeIx8Q2/ecVk3LEzdITPnNIkcXRHs2sUWGbs8O/u8ZNoD0F
 4+vibLweDQ+SNlYVGjSJAG6Qq9dikIPDZlW+WSv/aGuf4MR1gE6sl97Okwb1q26r
 sg6wbt/pDrYHOA33ZzoV5IMvjzsBRQ==
 =SQJb
 -----END PGP SIGNATURE-----

Merge tag 'spi-fix-v6.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull spi fixes from Mark Brown:
 "A small set of device specific fixes, the most major one is for the
  GXP driver which would probably have been confusing some callers with
  returning the length rather than 0 on successful writes"

* tag 'spi-fix-v6.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
  spi: spi-gxp: BUG: Correct spi write return value
  dt-bindings: spi: fsl-imx-cspi: Document missing entries
  spi: cs42l43: Remove spurious pm_runtime_disable
2023-09-28 11:12:42 -07:00
Linus Torvalds
5d959343ae LoongArch fixes for v6.6-rc4
-----BEGIN PGP SIGNATURE-----
 
 iQJKBAABCAA0FiEEzOlt8mkP+tbeiYy5AoYrw/LiJnoFAmUT9IEWHGNoZW5odWFj
 YWlAa2VybmVsLm9yZwAKCRAChivD8uImesv0D/0YfPF+lZ5riqJRuDOa+GLT2lir
 6LD1poWr1GTsRAM0qn0q7LLb64LmDOG4Y5WoU+I0/JZVMPjcLGKDOi9YUDD4YSgV
 6QAiWeHLMHrnLyTGr5N7gYStyqh28O0//Z7upVjXeDuJ20Z1tXk+oUpg8f/98q3j
 ANyGlEOObExghBbhrS7pWXN4BT3t/PyN8/GJTPvcaAfcjmyk0NVUk25758WYKiX1
 niPd2LSiTUplMYkXnxYnqheEo73tNRkK8HdYQnUEMOwYALwz1XyPMCIZGNhTrxd1
 krphBce1nCt1Q7M8A1vUqH8XeK6mdwMIsHrWRzg0CtU0BVUnfBJgCiM4lsPBGtZF
 p9z0YADMujM696SjVExFwam3r1gARketu+idz5Rtt7FUumOWXeXYGBF4yCZ+y5S8
 oZQ2E5hLX3z/WoMaYESiW5Gm6PLDJvJbX9UhaZINStl77CS088L5fU3leuhQM6jP
 e1fLBR68N5EHNJqjaWsp/7+ap3v7O6lwSO1QsRDjXiCWmZ96ybIBYNawPyEoKOSU
 1B9Qc7Er7aNUM8SDbIuzOmrWYhVCbq+5tyJAKbPifsl9jowA5P7hqFBWJ5l/ijsy
 njMg+bbl8/NBU/+PZAaRmnXZJGMnwy/W/zfNQjm/cGXRB1vXa7/symkFIIY8UI5c
 P3pJC4n1fedzOi4P5Q==
 =g9gX
 -----END PGP SIGNATURE-----

Merge tag 'loongarch-fixes-6.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson

Pull LoongArch fixes from Huacai Chen:
 "Fix high_memory calculation and module loader errors with latest
  binutils"

* tag 'loongarch-fixes-6.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson:
  LoongArch: Add support for 64_PCREL relocation type
  LoongArch: Add support for 32_PCREL relocation type
  LoongArch: Define relocation types for ABI v2.10
  LoongArch: numa: Fix high_memory calculation
2023-09-28 10:27:45 -07:00
Linus Torvalds
52a6d9b53e - fix Alchemy build with MMC support disabled
-----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCAA4FiEEbt46xwy6kEcDOXoUeZbBVTGwZHAFAmUVMw0aHHRzYm9nZW5k
 QGFscGhhLmZyYW5rZW4uZGUACgkQeZbBVTGwZHCRuA//a/mpqqNgINLX7RPgP+5e
 Fd8QWY3XdUVwVmL1KCU991igwLZePTzEqm92CGrystykJRCWvriDYkZlGTHRwj9I
 mNqR7bM0cCdlZ5J+/9qr1c6stWoPJQ37NIeO6xkfiBPfjIFi7BvilhzvlgYJ2ww8
 C5ADQOiUQ4vuqULZOrUhi6vAAXZozrtiBnhY7Woim6aMk3woznnaD0m6kmlggyi/
 Tr/7tg4Eba8RUjN6TQuRBJVTIn2ZVaZ9KUyZC3ehSCSvTZmiC1oNO1aSzKE0vdz4
 oUt7ug1yICAZU7+g03VZ+iTQnVhXUZGBqYzYnQXg9CpHXasiaWTejqynT4ugWKrU
 vBJ/h7sbjNU9T1UgcuT6vsEqwWBOdPqJFEAj4tJSlDP9lY08MKlTn8l9qIEN5cMA
 7kl8J5O3pwtdQAUwJmwppWynW8+jiAuvzN6vDkhNoGN1zgpn4bTLsKCsKy9ZzznN
 I62ApFRwkRo8RHViDjA7WR4l+8e/7UYJqf0vl3tBGni7q5tL83ns7wpy0uzqk7W/
 loHGJIqAEI/yRCNPFQfyeWBZXJs2faMUbLCpkB0McbIpESWae2vqCZnulgH+ecJ3
 BOgvlA1ut8uAljXoI4vWLziZsuO2aMqtUFIhqZjzlYr8YDaz1xodPcN99pQ7mkVq
 Arw07BQK6Ur7ThJDbQnFz9I=
 =O/EB
 -----END PGP SIGNATURE-----

Merge tag 'mips-fixes_6.6_1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux

Pull MIPS fix from Thomas Bogendoerfer:

 - fix Alchemy build with MMC support disabled

* tag 'mips-fixes_6.6_1' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux:
  MIPS: Alchemy: only build mmc support helpers if au1xmmc is enabled
2023-09-28 10:24:26 -07:00
Geert Uytterhoeven
684f7e6d28 iomap: Spelling s/preceeding/preceding/g
Fix a misspelling of "preceding".

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Bill O'Donnell <bodonnel@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
2023-09-28 09:26:58 -07:00
Chuck Lever
0d32a6bbb8 NFSD: Fix zero NFSv4 READ results when RQ_SPLICE_OK is not set
nfsd4_encode_readv() uses xdr->buf->page_len as a starting point for
the nfsd_iter_read() sink buffer -- page_len is going to be offset
by the parts of the COMPOUND that have already been encoded into
xdr->buf->pages.

However, that value must be captured /before/
xdr_reserve_space_vec() advances page_len by the expected size of
the read payload. Otherwise, the whole front part of the first
page of the payload in the reply will be uninitialized.

Mantas hit this because sec=krb5i forces RQ_SPLICE_OK off, which
invokes the readv part of the nfsd4_encode_read() path. Also,
older Linux NFS clients appear to send shorter READ requests
for files smaller than a page, whereas newer clients just send
page-sized requests and let the server send as many bytes as
are in the file.

Reported-by: Mantas Mikulėnas <grawity@gmail.com>
Closes: https://lore.kernel.org/linux-nfs/f1d0b234-e650-0f6e-0f5d-126b3d51d1eb@gmail.com/
Fixes: 703d752155 ("NFSD: Hoist rq_vec preparation into nfsd_read() [step two]")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2023-09-28 10:34:28 -04:00
Damien Le Moal
49728bdc70 ata: libata-eh: Fix compilation warning in ata_eh_link_report()
The 6 bytes length of the tries_buf string in ata_eh_link_report() is
too short and results in a gcc compilation warning with W-!:

drivers/ata/libata-eh.c: In function ‘ata_eh_link_report’:
drivers/ata/libata-eh.c:2371:59: warning: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size 4 [-Wformat-truncation=]
 2371 |                 snprintf(tries_buf, sizeof(tries_buf), " t%d",
      |                                                           ^~
drivers/ata/libata-eh.c:2371:56: note: directive argument in the range [-2147483648, 4]
 2371 |                 snprintf(tries_buf, sizeof(tries_buf), " t%d",
      |                                                        ^~~~~~
drivers/ata/libata-eh.c:2371:17: note: ‘snprintf’ output between 4 and 14 bytes into a destination of size 6
 2371 |                 snprintf(tries_buf, sizeof(tries_buf), " t%d",
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2372 |                          ap->eh_tries);
      |                          ~~~~~~~~~~~~~

Avoid this warning by increasing the string size to 16B.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-09-28 21:24:18 +09:00
Damien Le Moal
ed518d9ba9 ata: libata-core: Fix compilation warning in ata_dev_config_ncq()
The 24 bytes length allocated to the ncq_desc string in
ata_dev_config_lba() for ata_dev_config_ncq() to use is too short,
causing the following gcc compilation warnings when compiling with W=1:

drivers/ata/libata-core.c: In function ‘ata_dev_configure’:
drivers/ata/libata-core.c:2378:56: warning: ‘%d’ directive output may be truncated writing between 1 and 2 bytes into a region of size between 1 and 11 [-Wformat-truncation=]
 2378 |                 snprintf(desc, desc_sz, "NCQ (depth %d/%d)%s", hdepth,
      |                                                        ^~
In function ‘ata_dev_config_ncq’,
    inlined from ‘ata_dev_config_lba’ at drivers/ata/libata-core.c:2649:8,
    inlined from ‘ata_dev_configure’ at drivers/ata/libata-core.c:2952:9:
drivers/ata/libata-core.c:2378:41: note: directive argument in the range [1, 32]
 2378 |                 snprintf(desc, desc_sz, "NCQ (depth %d/%d)%s", hdepth,
      |                                         ^~~~~~~~~~~~~~~~~~~~~
drivers/ata/libata-core.c:2378:17: note: ‘snprintf’ output between 16 and 31 bytes into a destination of size 24
 2378 |                 snprintf(desc, desc_sz, "NCQ (depth %d/%d)%s", hdepth,
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 2379 |                         ddepth, aa_desc);
      |                         ~~~~~~~~~~~~~~~~

Avoid these warnings and the potential truncation by changing the size
of the ncq_desc string to 32 characters.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-09-28 21:24:10 +09:00
Damien Le Moal
99398d2070 scsi: sd: Do not issue commands to suspended disks on shutdown
If an error occurs when resuming a host adapter before the devices
attached to the adapter are resumed, the adapter low level driver may
remove the scsi host, resulting in a call to sd_remove() for the
disks of the host. This in turn results in a call to sd_shutdown() which
will issue a synchronize cache command and a start stop unit command to
spindown the disk. sd_shutdown() issues the commands only if the device
is not already runtime suspended but does not check the power state for
system-wide suspend/resume. That is, the commands may be issued with the
device in a suspended state, which causes PM resume to hang, forcing a
reset of the machine to recover.

Fix this by tracking the suspended state of a disk by introducing the
suspended boolean field in the scsi_disk structure. This flag is set to
true when the disk is suspended is sd_suspend_common() and resumed with
sd_resume(). When suspended is true, sd_shutdown() is not executed from
sd_remove().

Cc: stable@vger.kernel.org
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-09-28 21:23:18 +09:00
Damien Le Moal
75e2bd5f1e ata: libata-core: Do not register PM operations for SAS ports
libsas does its own domain based power management of ports. For such
ports, libata should not use a device type defining power management
operations as executing these operations for suspend/resume in addition
to libsas calls to ata_sas_port_suspend() and ata_sas_port_resume() is
not necessary (and likely dangerous to do, even though problems are not
seen currently).

Introduce the new ata_port_sas_type device_type for ports managed by
libsas. This new device type is used in ata_tport_add() and is defined
without power management operations.

Fixes: 2fcbdcb4c8 ("[SCSI] libata: export ata_port suspend/resume infrastructure for sas")
Cc: stable@vger.kernel.org
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-09-28 21:23:14 +09:00
Damien Le Moal
8b4d9469d0 ata: libata-scsi: Fix delayed scsi_rescan_device() execution
Commit 6aa0365a3c ("ata: libata-scsi: Avoid deadlock on rescan after
device resume") modified ata_scsi_dev_rescan() to check the scsi device
"is_suspended" power field to ensure that the scsi device associated
with an ATA device is fully resumed when scsi_rescan_device() is
executed. However, this fix is problematic as:
1) It relies on a PM internal field that should not be used without PM
   device locking protection.
2) The check for is_suspended and the call to scsi_rescan_device() are
   not atomic and a suspend PM event may be triggered between them,
   casuing scsi_rescan_device() to be called on a suspended device and
   in that function blocking while holding the scsi device lock. This
   would deadlock a following resume operation.
These problems can trigger PM deadlocks on resume, especially with
resume operations triggered quickly after or during suspend operations.
E.g., a simple bash script like:

for (( i=0; i<10; i++ )); do
	echo "+2 > /sys/class/rtc/rtc0/wakealarm
	echo mem > /sys/power/state
done

that triggers a resume 2 seconds after starting suspending a system can
quickly lead to a PM deadlock preventing the system from correctly
resuming.

Fix this by replacing the check on is_suspended with a check on the
return value given by scsi_rescan_device() as that function will fail if
called against a suspended device. Also make sure rescan tasks already
scheduled are first cancelled before suspending an ata port.

Fixes: 6aa0365a3c ("ata: libata-scsi: Avoid deadlock on rescan after device resume")
Cc: stable@vger.kernel.org
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-09-28 21:23:10 +09:00
Damien Le Moal
ff48b37802 scsi: Do not attempt to rescan suspended devices
scsi_rescan_device() takes a scsi device lock before executing a device
handler and device driver rescan methods. Waiting for the completion of
any command issued to the device by these methods will thus be done with
the device lock held. As a result, there is a risk of deadlocking within
the power management code if scsi_rescan_device() is called to handle a
device resume with the associated scsi device not yet resumed.

Avoid such situation by checking that the target scsi device is in the
running state, that is, fully capable of executing commands, before
proceeding with the rescan and bailout returning -EWOULDBLOCK otherwise.
With this error return, the caller can retry rescaning the device after
a delay.

The state check is done with the device lock held and is thus safe
against incoming suspend power management operations.

Fixes: 6aa0365a3c ("ata: libata-scsi: Avoid deadlock on rescan after device resume")
Cc: stable@vger.kernel.org
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
2023-09-28 21:23:07 +09:00
Damien Le Moal
aa3998dbeb ata: libata-scsi: Disable scsi device manage_system_start_stop
The introduction of a device link to create a consumer/supplier
relationship between the scsi device of an ATA device and the ATA port
of that ATA device fixes the ordering of system suspend and resume
operations. For suspend, the scsi device is suspended first and the ata
port after it. This is fine as this allows the synchronize cache and
START STOP UNIT commands issued by the scsi disk driver to be executed
before the ata port is disabled.

For resume operations, the ata port is resumed first, followed
by the scsi device. This allows having the request queue of the scsi
device to be unfrozen after the ata port resume is scheduled in EH,
thus avoiding to see new requests prematurely issued to the ATA device.
Since libata sets manage_system_start_stop to 1, the scsi disk resume
operation also results in issuing a START STOP UNIT command to the
device being resumed so that the device exits standby power mode.

However, restoring the ATA device to the active power mode must be
synchronized with libata EH processing of the port resume operation to
avoid either 1) seeing the start stop unit command being received too
early when the port is not yet resumed and ready to accept commands, or
after the port resume process issues commands such as IDENTIFY to
revalidate the device. In this last case, the risk is that the device
revalidation fails with timeout errors as the drive is still spun down.

Commit 0a85890559 ("ata,scsi: do not issue START STOP UNIT on resume")
disabled issuing the START STOP UNIT command to avoid issues with it.
But this is incorrect as transitioning a device to the active power
mode from the standby power mode set on suspend requires a media access
command. The IDENTIFY, READ LOG and SET FEATURES commands executed in
libata EH context triggered by the ata port resume operation may thus
fail.

Fix these synchronization issues is by handling a device power mode
transitions for system suspend and resume directly in libata EH context,
without relying on the scsi disk driver management triggered with the
manage_system_start_stop flag.

To do this, the following libata helper functions are introduced:

1) ata_dev_power_set_standby():

This function issues a STANDBY IMMEDIATE command to transitiom a device
to the standby power mode. For HDDs, this spins down the disks. This
function applies only to ATA and ZAC devices and does nothing otherwise.
This function also does nothing for devices that have the
ATA_FLAG_NO_POWEROFF_SPINDOWN or ATA_FLAG_NO_HIBERNATE_SPINDOWN flag
set.

For suspend, call ata_dev_power_set_standby() in
ata_eh_handle_port_suspend() before the port is disabled and frozen.
ata_eh_unload() is also modified to transition all enabled devices to
the standby power mode when the system is shutdown or devices removed.

2) ata_dev_power_set_active() and

This function applies to ATA or ZAC devices and issues a VERIFY command
for 1 sector at LBA 0 to transition the device to the active power mode.
For HDDs, since this function will complete only once the disk spin up.
Its execution uses the same timeouts as for reset, to give the drive
enough time to complete spinup without triggering a command timeout.

For resume, call ata_dev_power_set_active() in
ata_eh_revalidate_and_attach() after the port has been enabled and
before any other command is issued to the device.

With these changes, the manage_system_start_stop and no_start_on_resume
scsi device flags do not need to be set in ata_scsi_dev_config(). The
flag manage_runtime_start_stop is still set to allow the sd driver to
spinup/spindown a disk through the sd runtime operations.

Fixes: 0a85890559 ("ata,scsi: do not issue START STOP UNIT on resume")
Cc: stable@vger.kernel.org
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-09-28 21:23:03 +09:00
Damien Le Moal
3cc2ffe5c1 scsi: sd: Differentiate system and runtime start/stop management
The underlying device and driver of a SCSI disk may have different
system and runtime power mode control requirements. This is because
runtime power management affects only the SCSI disk, while system level
power management affects all devices, including the controller for the
SCSI disk.

For instance, issuing a START STOP UNIT command when a SCSI disk is
runtime suspended and resumed is fine: the command is translated to a
STANDBY IMMEDIATE command to spin down the ATA disk and to a VERIFY
command to wake it up. The SCSI disk runtime operations have no effect
on the ata port device used to connect the ATA disk. However, for
system suspend/resume operations, the ATA port used to connect the
device will also be suspended and resumed, with the resume operation
requiring re-validating the device link and the device itself. In this
case, issuing a VERIFY command to spinup the disk must be done before
starting to revalidate the device, when the ata port is being resumed.
In such case, we must not allow the SCSI disk driver to issue START STOP
UNIT commands.

Allow a low level driver to refine the SCSI disk start/stop management
by differentiating system and runtime cases with two new SCSI device
flags: manage_system_start_stop and manage_runtime_start_stop. These new
flags replace the current manage_start_stop flag. Drivers setting the
manage_start_stop are modifed to set both new flags, thus preserving the
existing start/stop management behavior. For backward compatibility, the
old manage_start_stop sysfs device attribute is kept as a read-only
attribute showing a value of 1 for devices enabling both new flags and 0
otherwise.

Fixes: 0a85890559 ("ata,scsi: do not issue START STOP UNIT on resume")
Cc: stable@vger.kernel.org
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-09-28 21:23:00 +09:00
Damien Le Moal
fb99ef1786 ata: libata-scsi: link ata port and scsi device
There is no direct device ancestry defined between an ata_device and
its scsi device which prevents the power management code from correctly
ordering suspend and resume operations. Create such ancestry with the
ata device as the parent to ensure that the scsi device (child) is
suspended before the ata device and that resume handles the ata device
before the scsi device.

The parent-child (supplier-consumer) relationship is established between
the ata_port (parent) and the scsi device (child) with the function
device_add_link(). The parent used is not the ata_device as the PM
operations are defined per port and the status of all devices connected
through that port is controlled from the port operations.

The device link is established with the new function
ata_scsi_slave_alloc(), and this function is used to define the
->slave_alloc callback of the scsi host template of all ata drivers.

Fixes: a19a93e4c6 ("scsi: core: pm: Rely on the device driver core for async power management")
Cc: stable@vger.kernel.org
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: John Garry <john.g.garry@oracle.com>
2023-09-28 21:22:57 +09:00
Damien Le Moal
84d76529c6 ata: libata-core: Fix port and device removal
Whenever an ATA adapter driver is removed (e.g. rmmod),
ata_port_detach() is called repeatedly for all the adapter ports to
remove (unload) the devices attached to the port and delete the port
device itself. Removing of devices is done using libata EH with the
ATA_PFLAG_UNLOADING port flag set. This causes libata EH to execute
ata_eh_unload() which disables all devices attached to the port.

ata_port_detach() finishes by calling scsi_remove_host() to remove the
scsi host associated with the port. This function will trigger the
removal of all scsi devices attached to the host and in the case of
disks, calls to sd_shutdown() which will flush the device write cache
and stop the device. However, given that the devices were already
disabled by ata_eh_unload(), the synchronize write cache command and
start stop unit commands fail. E.g. running "rmmod ahci" with first
removing sd_mod results in error messages like:

ata13.00: disable device
sd 0:0:0:0: [sda] Synchronizing SCSI cache
sd 0:0:0:0: [sda] Synchronize Cache(10) failed: Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
sd 0:0:0:0: [sda] Stopping disk
sd 0:0:0:0: [sda] Start/Stop Unit failed: Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK

Fix this by removing all scsi devices of the ata devices connected to
the port before scheduling libata EH to disable the ATA devices.

Fixes: 720ba12620 ("[PATCH] libata-hp: update unload-unplug")
Cc: stable@vger.kernel.org
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>
Tested-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
2023-09-28 21:22:53 +09:00
Damien Le Moal
3b8e0af4a7 ata: libata-core: Fix ata_port_request_pm() locking
The function ata_port_request_pm() checks the port flag
ATA_PFLAG_PM_PENDING and calls ata_port_wait_eh() if this flag is set to
ensure that power management operations for a port are not scheduled
simultaneously. However, this flag check is done without holding the
port lock.

Fix this by taking the port lock on entry to the function and checking
the flag under this lock. The lock is released and re-taken if
ata_port_wait_eh() needs to be called. The two WARN_ON() macros checking
that the ATA_PFLAG_PM_PENDING flag was cleared are removed as the first
call is racy and the second one done without holding the port lock.

Fixes: 5ef4108291 ("ata: add ata port system PM callbacks")
Cc: stable@vger.kernel.org
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>
Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
2023-09-28 21:22:50 +09:00
Pu Wen
a5ef7d68ce x86/srso: Add SRSO mitigation for Hygon processors
Add mitigation for the speculative return stack overflow vulnerability
which exists on Hygon processors too.

Signed-off-by: Pu Wen <puwen@hygon.cn>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Borislav Petkov (AMD) <bp@alien8.de>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/tencent_4A14812842F104E93AA722EC939483CEFF05@qq.com
2023-09-28 09:57:07 +02:00
Krzysztof Kozlowski
d75e870c32
arm64: defconfig: enable syscon-poweroff driver
Enable the generic syscon-poweroff driver used on all Exynos ARM64 SoCs
(e.g. Exynos5433) and few APM SoCs.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
Link: https://lore.kernel.org/r/20230901115732.45854-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2023-09-28 09:17:05 +02:00
Arnd Bergmann
5e8a380b2d
ARM: locomo: fix locomolcd_power declaration
The locomolcd driver has one remaining missing-prototype warning:

drivers/video/backlight/locomolcd.c:83:6: error: no previous prototype for 'locomolcd_power' [-Werror=missing-prototypes]

There is in fact an unused prototype with a similar name in a global
header, so move the actual one there and remove the old one.

Link: https://lore.kernel.org/r/20230927194844.680771-1-arnd@kernel.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2023-09-28 09:15:51 +02:00
Arnd Bergmann
5106e65f23 Arm SCMI fix for v6.6
A single fix to address scmi_perf_attributes_get() using the protocol
 version even before it was populated and ending up with unexpected
 bogowatts power scale.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEunHlEgbzHrJD3ZPhAEG6vDF+4pgFAmUUGkkACgkQAEG6vDF+
 4phm7g/+LjCMNZ0uxp/qxcZszFJln2wO2MFnY2X55o/anFlLoMQdeDlzBgGGP5Ul
 UmMo29Aq0n6FmPkrj2oV+3QR5oRKSauSbkLDxYGP4GVxpZ8zC8YotNV4z9XfxbnZ
 +SoZflXFCO/P/lPq7MMVJNcB4WqQjUv+yg9uHaejN2kXwhmntxoUqYb+82TgL/No
 Vb9rTkvRCLO6K/jxUgIWT0uwu1aBx7yOzx74Fe79IwWgGCdikk18hR13KhzsxnVz
 FHgoGnoo3cffx6gZPKNTIH032pSn24JuYRxT+FCY8IXbZYAkeHG8L5AklFDBRcHs
 zKOjnmAcPSNYDSaC5BpaJo6J7qbXnGiCUVZWlD5UzjVvOsdQRElDlQRpxwbAoRED
 3jxOSAN8V1GnC5cZvAPmMKtJk/5/2tw3pxOg4fxuvXVhetwg4fEiFghTzZN3N028
 yMpciPRU5M5EuROGLs6+NGdK93aLsDDYPnOoPe4jdBD77M0WcxrruC9I80wn6yQR
 +qxwlooebt9WR+ZkOYnsIBsWcRbvn/dMvnotTM7Tm2gblK2uVmhySKjYR931/p1D
 6gDOilbUebN/RN1CPcP1NzOVl0IuRblXe3Ps5TD7liwCCzVYxD5kwfIJMC6o8Cfr
 QPkqtCRv4jPbUQdrGCOEDRD+GqiF3nNvuGUQ6mqBFFvR4h9NbPU=
 =v9wZ
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmUVKAEACgkQYKtH/8kJ
 UidgWRAA0D9EEbxqHt5WjBW75jifD09oUD1+XnyYCIVa9fyB11uInUJxAjG/xSGg
 JSqK54TRnK32OpwFeClv6k38WdpRw3GemCBNxvAXrF4wN4f1xKD0O0rM46U0AoFb
 fSqoO3TZN2wgOJbdPmIUSBJJ9To2jquQeKi+qDZ5o2utUfjVHfJqVIqpZR2SPTf2
 vXoFRfPcx5rmSrXNX57U1pv1NCTp3y14RT2VJwzND/Nb8jMjxYQFWslBcFSJNTRn
 oTzdSSP4W+XZOGF13N2pfuLe2mqqSnMHeXlBD9oMvgGfFO0gAQ1xc4V1CNc6tzjc
 xrbhGYwEUqXqo+TJa8uLYbUE4aaPdkP4VBn3cNn/5BrkAooZwOAfRaNYoXFNRwZw
 nZ3e0e6qKsyA/frOt7lqFU/J81HHxEQpEKg1bVqPpuviYNRNNfms4XPrtx9+DWPd
 xdQoqUW3jGJ4yzgxh4V1ZDvIFP2/1C1gilayXxtHcoo9H3Grue9n6ApTcO1HJQaC
 JIHIwSWn2PkxZ919fPmqJHY8bFLkjJHWYRM+oPrp/Cn5B3NLQ1ICGPbDRmS5x/Vs
 mTBjjkwRVJcHmMLN+5/XdQYKRzrHAtKD8Um6V4nJ1iRkI7IQykGY4KHqmyxCRWMh
 mcMsq89suKAAimy+kTmg1kP/OYR5zAMaikQx/QsmOYgxRdAGkHU=
 =ZyGq
 -----END PGP SIGNATURE-----

Merge tag 'scmi-fix-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux into arm/fixes

Arm SCMI fix for v6.6

A single fix to address scmi_perf_attributes_get() using the protocol
version even before it was populated and ending up with unexpected
bogowatts power scale.

* tag 'scmi-fix-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux:
  firmware: arm_scmi: Fixup perf power-cost/microwatt support

Link: https://lore.kernel.org/r/20230927121604.158645-1-sudeep.holla@arm.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2023-09-28 09:15:12 +02:00
Arnd Bergmann
79684f2ea3 Arm FF-A fix for v6.6
It has been reported that the driver sets the memory region attributes
 for MEM_LEND operation when the specification clearly states not to. The
 fix here addresses the issue by ensuring the memory region attributes are
 cleared for the memory lending operation.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEunHlEgbzHrJD3ZPhAEG6vDF+4pgFAmUUG70ACgkQAEG6vDF+
 4pg0Og//dteLTtj/mHej4fIL3ih0qNN6Ih1NXlqfcgc4Yw7EcLhnKZabwGy3Ybdq
 4egdPwHXLPMS7XAxg7y2WWoMA7+raFYp8vYOWOjHdTPmgDjzxHMybMP3J31RSjfL
 gi4DoF8g2EF0bwtMvk0A3pTqgQG3YOfMupf9CLPZg5XOmPVDAq5R1zn3hu/Dz/ic
 5nkJNkA3VCmLrSzfSEQtC8vDPT0pNID6sLCgByJvx6qqPKAlO6Mhpe1f93N2BMsK
 Z24SjevzPHjGFS4MwaW8evDpdTuESUd0MQBV5/yCha8gvJOK2Q0629qLM5fpii7j
 ZxHkGaj1pSj9zqCCKOxJVFanxTEJQo8dAbzz446jB7pBkeT4T4sIAsHe+Jw7QIOS
 kFT3xOfZwYpCU7nJWEgOaDuNBlHFD5ZiP922tXatX6nj7gEopVpUSg0u1R9/BMHa
 DLK3xaF/Gd38KFN52WBV98+jFyE9dUYVu1PLG+uJDvKyS6PoKKmRckNxdtPDpEeH
 Lsez4ES9dbb2c+nCrAseUeuFW1D8HBEHo705MIGsefqfqISOrh1A3oj7gEwnv6ho
 ZOLKbSHX3ufx3WOm4R8aFtRafP7ZL8X6ovQDCzzYhAitnF2bp+zfjJOkJv4X7OLV
 jz8AtdwCT6qW5rg0PCDNo8CrAYN1GA0/+ria17JpKF37Pk5hdjQ=
 =Flo6
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmUVJ9oACgkQYKtH/8kJ
 UidcBRAApJskT2y1BVlZZTtyUuu9cck/dfGfzhP50XiO6m0YYr6W+RnLjWj4o/oc
 5Ct7eJsqh8jZ2XbZQfXY/eojts/xyfFq48MBWBkuMECE3M5rsjkPTu1N+WOJiVUt
 BlbLmwx5xNuK2JbSdHN/Et4xguau6ZbhZ08nW8+uHOJtxquUjCapWqN9r5cYki8V
 NQhdaaT0/YlA4sMPsCN9HkEVR0VYlHkcQo9f8onXg93rUpK3p7hWhz5pUZDJEwZE
 CSb+is4ADsNAzioLCTZh9MDMQoaduxQXzw8QjYKY6mxK1VIFDmDmblMl7UFARQs7
 ufvqzGZpCqVNrjQK7+vHXakrG5hOA2VmMRhMt60KrY4AVTgpZYNzGqpIz7dlOuxd
 8FDwjHEeYZXgtfUA6dxD19oRi49shO3HB34YrTbGi7GOOjuWJl4c3wJtR/Ps1vha
 GFnggmOqjRFYi+YBzShCn/pZGgcAHWadcLn3zklCcnNaRj+2voXyqKOkDbuhteFs
 4zt1ggvykeAQ8mU9+HwiwIZek9X7hsKI7bz2jKTV8uugqr5DDTnY7vwOtGvZochk
 GBpEZH12e5Cf9QO74Nam5kvLJqpj3orhSul0jnWZ1R8n9Obv0IH/ytthctDnP4Ek
 XFqGiBoQzDTNIjANcmr0UG46l+95J9Lbi7iyk+tX7z5+wVxkQ7U=
 =MdPT
 -----END PGP SIGNATURE-----

Merge tag 'ffa-fix-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux into arm/fixes

Arm FF-A fix for v6.6

It has been reported that the driver sets the memory region attributes
for MEM_LEND operation when the specification clearly states not to. The
fix here addresses the issue by ensuring the memory region attributes are
cleared for the memory lending operation.

* tag 'ffa-fix-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux:
  firmware: arm_ffa: Don't set the memory region attributes for MEM_LEND

Link: https://lore.kernel.org/r/20230927121555.158619-1-sudeep.holla@arm.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2023-09-28 09:14:34 +02:00
William A. Kennington III
92e73d807b i2c: npcm7xx: Fix callback completion ordering
Sometimes, our completions race with new master transfers and override
the bus->operation and bus->master_or_slave variables. This causes
transactions to timeout and kernel crashes less frequently.

To remedy this, we re-order all completions to the very end of the
function.

Fixes: 56a1485b10 ("i2c: npcm7xx: Add Nuvoton NPCM I2C controller driver")
Signed-off-by: William A. Kennington III <william@wkennington.com>
Reviewed-by: Tali Perry <tali.perry1@gmail.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
2023-09-27 21:32:06 +02:00
Linus Torvalds
633b47cb00 SCSI fixes on 20230927
Single fix for libata: older devices don't support command duration
 limits (CDL) and some don't support report opcodes, meaning there's no
 way to tell if they support the command or not. Reduce the problems of
 incorrectly using CDL commands on older devices by checking SCSI spec
 compliance at SPC-5 (the spec which introduced the command) before
 turning on CDL.
 
 Signed-off-by: James E.J. Bottomley <jejb@linux.ibm.com>
 -----BEGIN PGP SIGNATURE-----
 
 iJwEABMIAEQWIQTnYEDbdso9F2cI+arnQslM7pishQUCZRQglCYcamFtZXMuYm90
 dG9tbGV5QGhhbnNlbnBhcnRuZXJzaGlwLmNvbQAKCRDnQslM7pishYJdAP4rjE8a
 /X3Vs7C0PoFDl6HlkN3w4Eeq54vLMmxNez2tywEA6cB3RdwG58g34p8wBt7Lb6UI
 1HAIhRub2mpHZyQH0/U=
 =qq6Q
 -----END PGP SIGNATURE-----

Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
 "A single fix for libata: older devices don't support command duration
  limits (CDL) and some don't support report opcodes, meaning there's no
  way to tell if they support the command or not.

  Reduce the problems of incorrectly using CDL commands on older devices
  by checking SCSI spec compliance at SPC-5 (the spec which introduced
  the command) before turning on CDL"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: core: ata: Do no try to probe for CDL on old drives
2023-09-27 09:58:02 -07:00
Linus Torvalds
b6cd17050b VFIO fixes for v6.6-rc4
- The new PDS vfio-pci variant driver only supports SR-IOV VF devices
    and incorrectly made a direct reference to the physfn field of the
    pci_dev.  Fix this both by making the Kconfig depend on IOV support
    as well as using the correct wrapper for this access. (Shixiong Ou)
 
  - Resolve an error path issue where on unwind of the mdev registration
    the created kset is not unregistered and the wrong error code is
    returned. (Jinjie Ruan)
 -----BEGIN PGP SIGNATURE-----
 
 iQJPBAABCAA5FiEEQvbATlQL0amee4qQI5ubbjuwiyIFAmUTT/gbHGFsZXgud2ls
 bGlhbXNvbkByZWRoYXQuY29tAAoJECObm247sIsiHqoQAIbGaIWXR6ATW0WihWdx
 Q87kkY8cjMFeXY4LeSAe52p29HuXIVOHfTW1Ap6i9cuoDsAwsFl8xqHmbXhJCpbc
 n+SKUDdJ0uzS5YWee/e5DVPfLRbzWhFFg6xqpvQsla3Wi7Ix1JlDN4uUgg9fb+fq
 O5qjulKOzX7J0V/raPsPktRcjE4W68/+awVT9P2uR8R80VdSLFz0i1C1yeq+ZOoJ
 RiEmT1OId4bB2CknQix3qibnpMxd8zXm+vAWnFaRyJukKKQmZ46WRivJW+FciWMs
 Ec3cI02T7iJq7MA1YnPpVbRRm0rA5dvLIvMsGs/ibsrZ8c3Pwa/eTUePI0rF3Qg7
 ZjDZTA9iiKflwWWcUTzm3w41tdRyzDlTNcpiCteIN3wx/GMleN2aOEAZDSCbH9Gf
 mLtVW2NHa7UC/pPNiO09kJ0NIKZ9UL4zc3gISoRZIoGNO3Y0XfQalkccSNQX677O
 vdjN2HhoCTGsLohd+i2iOXANZkreHXULPcFImEws2khOA0P+l7hTy7WK/4J/VTei
 sT95Cg7DTwk/sS6n59aNPwjQDGQ/De1d98YHFNTerWBqbLizIZoS1buzYcMbctZx
 xcabFyY+CbMEj6BEclnm5QSoZPJ+du1HrhDE8Asa4kWnzIIDD/tRTqyN5ndlnICp
 moAPgUwBsX0RO4qpLCp96WOW
 =yMVA
 -----END PGP SIGNATURE-----

Merge tag 'vfio-v6.6-rc4' of https://github.com/awilliam/linux-vfio

Pull VFIO fixes from Alex Williamson:

 - The new PDS vfio-pci variant driver only supports SR-IOV VF devices
   and incorrectly made a direct reference to the physfn field of the
   pci_dev.  Fix this both by making the Kconfig depend on IOV support
   as well as using the correct wrapper for this access (Shixiong Ou)

 - Resolve an error path issue where on unwind of the mdev registration
   the created kset is not unregistered and the wrong error code is
   returned (Jinjie Ruan)

* tag 'vfio-v6.6-rc4' of https://github.com/awilliam/linux-vfio:
  vfio/mdev: Fix a null-ptr-deref bug for mdev_unregister_parent()
  vfio/pds: Use proper PF device access helper
  vfio/pds: Add missing PCI_IOV depends
2023-09-27 09:33:55 -07:00
Charles Kearney
1a8196a93e
spi: spi-gxp: BUG: Correct spi write return value
Bug fix to correct return value of gxp_spi_write function to zero.
Completion of succesful operation should return zero.

Fixes: 730bc8ba5e spi: spi-gxp: Add support for HPE GXP SoCs

Signed-off-by: Charles Kearney <charles.kearney@hpe.com>
Link: https://lore.kernel.org/r/20230920215339.4125856-2-charles.kearney@hpe.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-27 17:06:36 +02:00
Frederic Weisbecker
1a6a464774 timers: Tag (hr)timer softirq as hotplug safe
Specific stress involving frequent CPU-hotplug operations, such as
running rcutorture for example, may trigger the following message:

  NOHZ tick-stop error: local softirq work is pending, handler #02!!!"

This happens in the CPU-down hotplug process, after
CPUHP_AP_SMPBOOT_THREADS whose teardown callback parks ksoftirqd, and
before the target CPU shuts down through CPUHP_AP_IDLE_DEAD. In this
fragile intermediate state, softirqs waiting for threaded handling may be
forever ignored and eventually reported by the idle task as in the above
example.

However some vectors are known to be safe as long as the corresponding
subsystems have teardown callbacks handling the migration of their
events. The above error message reports pending timers softirq although
this vector can be considered as hotplug safe because the
CPUHP_TIMERS_PREPARE teardown callback performs the necessary migration
of timers after the death of the CPU. Hrtimers also have a similar
hotplug handling.

Therefore this error message, as far as (hr-)timers are concerned, can
be considered spurious and the relevant softirq vectors can be marked as
hotplug safe.

Fixes: 0345691b24 ("tick/rcu: Stop allowing RCU_SOFTIRQ in idle")
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20230912104406.312185-6-frederic@kernel.org
2023-09-27 16:54:03 +02:00
Petr Tesarik
2d5780bbef swiotlb: fix the check whether a device has used software IO TLB
When CONFIG_SWIOTLB_DYNAMIC=y, devices which do not use the software IO TLB
can avoid swiotlb lookup. A flag is added by commit 1395706a14 ("swiotlb:
search the software IO TLB only if the device makes use of it"), the flag
is correctly set, but it is then never checked. Add the actual check here.

Note that this code is an alternative to the default pool check, not an
additional check, because:

1. swiotlb_find_pool() also searches the default pool;
2. if dma_uses_io_tlb is false, the default swiotlb pool is not used.

Tested in a KVM guest against a QEMU RAM-backed SATA disk over virtio and
*not* using software IO TLB, this patch increases IOPS by approx 2% for
4-way parallel I/O.

The write memory barrier in swiotlb_dyn_alloc() is not needed, because a
newly allocated pool must always be observed by swiotlb_find_slots() before
an address from that pool is passed to is_swiotlb_buffer().

Correctness was verified using the following litmus test:

C swiotlb-new-pool

(*
 * Result: Never
 *
 * Check that a newly allocated pool is always visible when the
 *  corresponding swiotlb buffer is visible.
 *)

{
	mem_pools = default;
}

P0(int **mem_pools, int *pool)
{
	/* add_mem_pool() */
	WRITE_ONCE(*pool, 999);
	rcu_assign_pointer(*mem_pools, pool);
}

P1(int **mem_pools, int *flag, int *buf)
{
	/* swiotlb_find_slots() */
	int *r0;
	int r1;

	rcu_read_lock();
	r0 = READ_ONCE(*mem_pools);
	r1 = READ_ONCE(*r0);
	rcu_read_unlock();

	if (r1) {
		WRITE_ONCE(*flag, 1);
		smp_mb();
	}

	/* device driver (presumed) */
	WRITE_ONCE(*buf, r1);
}

P2(int **mem_pools, int *flag, int *buf)
{
	/* device driver (presumed) */
	int r0 = READ_ONCE(*buf);

	/* is_swiotlb_buffer() */
	int r1;
	int *r2;
	int r3;

	smp_rmb();
	r1 = READ_ONCE(*flag);
	if (r1) {
		/* swiotlb_find_pool() */
		rcu_read_lock();
		r2 = READ_ONCE(*mem_pools);
		r3 = READ_ONCE(*r2);
		rcu_read_unlock();
	}
}

exists (2:r0<>0 /\ 2:r3=0) (* Not found. *)

Fixes: 1395706a14 ("swiotlb: search the software IO TLB only if the device makes use of it")
Reported-by: Jonathan Corbet <corbet@lwn.net>
Closes: https://lore.kernel.org/linux-iommu/87a5uz3ob8.fsf@meer.lwn.net/
Signed-off-by: Petr Tesarik <petr@tesarici.cz>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2023-09-27 11:19:15 +02:00
Arnd Bergmann
a16d7a3d46 ASPEED Maintainers update
Andrew has changed addresses and the git tree has long since been at a
 different location.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE+nHMAt9PCBDH63wBa3ZZB4FHcJ4FAmUSvbMACgkQa3ZZB4FH
 cJ7JHw/9HZNN0QOJAVuBIkRyxAo9kqrPZ39B1pDWIJJGaSji0xFjbZgSbUyPnGNK
 zEoD/WqJ++wNo+l1C218QBPL7ocxbaSU7QpGlXdRtbs0V0wnc23i709I5+0go4gg
 PJyaDjizXdfY2Dz8QcYXp0HDBdwOBqb3ZuDGu0NlZSm/J6Fl18+aeE76gCUD9TBl
 46SvX06Mz62HGMbqF4JOcWIH7U6/qRuMQ3As6D7AaoYXdwaGifdLcCsJpFmrsMko
 A1wI+l9U0REkJx/D/pmGEd4KTkzOL67ndsi4/s2UuolJsKShuAbvNSAudF5U9v65
 rjLlw6baIuuZjwIqQoyy74Td1L9zpgzd3ZW8eCWp1o3jFvH46RpRN78T03M2r4Bi
 Vt2rWpppiJyZWMrgwFmZrdKmCcbTH8+r4p6CoPE44Fb7Y3m/SVja3/vwtpACfvzh
 Z9zf4cmtRRU41uoUA9HYUVpyT3jHtchDAYFIz8RuF1nlO5ytIkAMGnkcW0emGS9m
 YumkZOezAMFUGakPP7kSh/J1x6klm5K7X6KaR5Bwnzb4nJWSBAZgi016LUANyuGt
 XO44fH9pER4helHRKvGx+iC885yMoS5N+bgoXQ5ilCv5dUkaWC4i2HQWEzu8HtYg
 lZqRxNnD0ff4jnztAv1sOHoWuK5wu87pRgrCTScBxam+6oJcF2c=
 =SQij
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmUT8NUACgkQYKtH/8kJ
 UiegpQ/+IU6FxrlIjYX5ATh8BA+Zu2kQMpkwQH8La98rkzUj22CrME+/bKI3nAiV
 GDO0OdJMLlUfcQr5OHg/IHL1bAGVLU/GDVvjS/6efmpeNCm1V4sovhwqL4gT6HpP
 RtYp4kVKcIeRJoOZx5PtXalu+tMNmooL1sXj+lqer8K93e0u/PCqihY9/kFOlCxk
 PeWxFqTDoba+rYi2eQY0A8dt7hEs6nxSXE12HQJdsUWouljdFCn/hgGt53qmS8rm
 JONnghmEmmF/gooLYZEI14B5ELsILi62/7UNyUlPGO/oPNh6jJxN9PkE64b0JzZM
 V4aulyut3Ko21gW3vO/BhOhBiUh7ipkfydX2UZZSnfWNrbPWT6NJYV1n5yyLYBfD
 KfP1rNrduefpE3qhTDB/uXoED3oIjb/B79ytSAhSq6F32KPUWIYRdpmRR2xFjs+T
 fvYudE1wi5Bfw6fMd3PkkEvz1GNdoO/hp+oi0kWWv8VoXDFXl5dzuyO5aCB4P9wN
 cA4rXLP8oIqmDgGgCWASnvBA40HD4N2Gxco2hiT1PrIOWyv8dYkQ68fUJnH8aQ19
 TIF75WGEDxhzFycRAaZP0SAMUI+ocjyHHTGgKpHcQlGVbS3I91k0eFxKzbOOumsG
 5J3VBwbcTBJCPgMy7FwglzvWA4McwgVb1DHuFQFG24q1TAoMHlE=
 =Jbmx
 -----END PGP SIGNATURE-----

Merge tag 'aspeed-6.6-maintainers' of git://git.kernel.org/pub/scm/linux/kernel/git/joel/bmc into arm/fixes

ASPEED Maintainers update

Andrew has changed addresses and the git tree has long since been at a
different location.

* tag 'aspeed-6.6-maintainers' of git://git.kernel.org/pub/scm/linux/kernel/git/joel/bmc:
  MAINTAINERS: aspeed: Update Andrew's email address
  MAINTAINERS: aspeed: Update git tree URL

Link: https://lore.kernel.org/r/CACPK8Xc+D=YBc2Dhk-6-gOuvKN0xGgZYNop6oJVa=VNgaEYOHw@mail.gmail.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2023-09-27 11:07:33 +02:00
Mingtong Bao
a776cc4971 soc: loongson: loongson2_guts: Remove unneeded semicolon
No functional modification involved.

./drivers/soc/loongson/loongson2_guts.c:73:2-3: Unneeded semicolon.

Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Mingtong Bao <baomingtong001@208suo.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2023-09-27 11:05:47 +02:00
Dongliang Mu
daacef89cd soc: loongson: loongson2_guts: Convert to devm_platform_ioremap_resource()
Use devm_platform_ioremap_resource() to simplify code.

Signed-off-by: Dongliang Mu <dzm91@hust.edu.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2023-09-27 11:05:47 +02:00
Binbin Zhou
a2fd542287 soc: loongson: loongson_pm2: Populate children syscon nodes
The syscon poweroff and reboot nodes logically belong to the Power
Management Unit so populate possible children.

Without it, the reboot/poweroff feature becomes unavailable.

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2023-09-27 11:05:19 +02:00
Binbin Zhou
8c4102f20a dt-bindings: soc: loongson,ls2k-pmc: Allow syscon-reboot/syscon-poweroff as child
The reboot and poweroff features are actually part of the Power
Management Unit system controller, thus allow them as its children,
instead of specifying as separate device nodes with syscon phandle.

Without it, the reboot/poweroff feature becomes unavailable.

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2023-09-27 11:05:19 +02:00
Binbin Zhou
e26e788a2a soc: loongson: loongson_pm2: Drop useless of_device_id compatible
Now, "loongson,ls2k0500-pmc" is used as fallback compatible, so the
ls2k1000 compatible in the driver can be dropped directly.

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2023-09-27 11:05:19 +02:00
Binbin Zhou
380054cb05 dt-bindings: soc: loongson,ls2k-pmc: Use fallbacks for ls2k-pmc compatible
The Loongson-2K series chips (ls2k0500/ls2k1000/ls2k2000) share the same
PM system controller, using ls2k0500 compatible as fallback for the
others.

Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2023-09-27 11:05:19 +02:00
Binbin Zhou
8e4a28f979 soc: loongson: loongson_pm2: Add dependency for INPUT
Since commit 67694c076b ("soc: loongson2_pm: add power management
support"), the Loongson-2K PM driver was added, but it didn't update the
Kconfig entry for the INPUT dependency, leading to build errors, so
update the Kconfig entry to depend on INPUT.

/opt/crosstool/gcc-13.2.0-nolibc/loongarch64-linux/bin/loongarch64-linux-ld:
drivers/soc/loongson/loongson2_pm.o: in function `loongson2_power_button_init':
/work/lnx/next/linux-next-20230825/LOONG64/../drivers/soc/loongson/loongson2_pm.c:101:(.text+0x350): undefined reference to `input_allocate_device'
/opt/crosstool/gcc-13.2.0-nolibc/loongarch64-linux/bin/loongarch64-linux-ld:
/work/lnx/next/linux-next-20230825/LOONG64/../drivers/soc/loongson/loongson2_pm.c:109:(.text+0x3dc): undefined reference to `input_set_capability'
/opt/crosstool/gcc-13.2.0-nolibc/loongarch64-linux/bin/loongarch64-linux-ld:
/work/lnx/next/linux-next-20230825/LOONG64/../drivers/soc/loongson/loongson2_pm.c:111:(.text+0x3e4): undefined reference to `input_register_device'
/opt/crosstool/gcc-13.2.0-nolibc/loongarch64-linux/bin/loongarch64-linux-ld:
/work/lnx/next/linux-next-20230825/LOONG64/../drivers/soc/loongson/loongson2_pm.c:125:(.text+0x3fc): undefined reference to `input_free_device'
/opt/crosstool/gcc-13.2.0-nolibc/loongarch64-linux/bin/loongarch64-linux-ld: drivers/soc/loongson/loongson2_pm.o: in function `input_report_key':
/work/lnx/next/linux-next-20230825/LOONG64/../include/linux/input.h:425:(.text+0x58c): undefined reference to `input_event'

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2023-09-27 11:05:19 +02:00
Arnd Bergmann
68bb0c78d3 Remove a few unused declarations in TEE subsystem
-----BEGIN PGP SIGNATURE-----
 
 iQJOBAABCgA4FiEEFV+gSSXZJY9ZyuB5LinzTIcAHJcFAmUBckwaHGplbnMud2lr
 bGFuZGVyQGxpbmFyby5vcmcACgkQLinzTIcAHJcQtQ/9Fqr9GRh8yGkFR1vtjL8B
 myBqJUCz/wVnixevLUurnVfpltkTkoa4yDTsUzlpzYIxmOqtaguQbAdKDFNNurce
 WqIoHz//XUYjurtQRbu54h5OrUAbaiwfVBzO6S2HKAnlUcAU7O8p+5V95QSSNgS6
 EsymTKlNdKQ0sdZuwi8ifKGRma3PAQNYXJ3TyRpiHD9KSyMJL7YyutelE/qWtQFU
 eg9Gfd+1dFyVC7aihEFMiD4PFbYvgFw6CT5df7e2/e/rbJSapjG/fW68dhJVNtmk
 v8iP6ot/Zs6V1InlfHzNWaLhlDRa1s7mQ6i17+r0+jj6tzR11PQVWd9PFk2uK964
 xcX+IeYQn4aBcj6SXz1s3IrTIJS2o2LNgYcgxLfMqwY8UasK1Z9Qrwt1Vxy4/Ihy
 2sGy53noTjudPE29DFizbIHjz5jV0OpQbBb1UMDYTcJgG5Pw8tIanfYvTGxQypCm
 oC0xN+RGXjbzti86NdOEc7BvPRihIx51AqmV8mdKLA4Ps5PxYnL9YkkikcqXFDEO
 +n/wGKhEF7X2AjBB5tsz794+WFl9fiuDsjBWL4sEoLoSRaQWabSmfiua4UvlvwdY
 MG9HhbQ9rQcjdPppbA/B1hUsKEYGBq8p7igaXzErlUNzKBkLyzszIKNDJ2uYLoHS
 IYwOa2UYg173FQRow1a7OME=
 =Uuct
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmUT8AQACgkQYKtH/8kJ
 UicIjxAA3/UQXHP58cMGZjD4OAyfJetSZwB4+OIV9xzpuWwW4c1uoFD16ZlRyP5S
 xuH34vLFWTkDsvtdkzF4kuRhFjCWTh5eFGByyOZAxoRoSjCUWLpPU5+48VO8Aqb3
 xyG9UeMzmxBb4oZCfrQjlPHzflP1c4knsQesPr6XFBOS8O4TmjLSFOh2qANly/j2
 ICRQyUbcUxLJ8GUM0cAkCSNyVgCzvuDKXnOyxxHBPTQn68g/4Y26DRH3kFj32je6
 XPlsIZrezwlYGYNg1Xo2io+8WYYF06BhBnsk58+133S2uXEjoXACFrCQqdGimRUj
 7avhF4u8cyC4MHUHxAXKmJWnuvhuqlOyGW1UeSckLrLyrUCvx/PUlJC2duzXRc9c
 PshzVVVO2w8X78GBOvTxH8RSnINRG5IGmF9mD8AnrhpNjZSqGLbl6nOGPQAExwyF
 ndW3qt5DYNTMd5JYuB7ueyYTuFH/RU9qtqUICRgRgK6UG2XBN8PHo0ElEzi7okXT
 kj7ZqOQcLpx5PNDPNRBtY6zlbiApF7MrPJmtP8XDodRmPV2QYzOPqTwxGeQgSY/k
 YBBSQS8P0HWShEtPzvKkrBcWbt7f7V5xNMP40JOnuuUnvevQSefgBpoGQ3fum4U1
 Mrt3N7Hb0cht4FRZW7TfvovRRa+Tzhjy7litH9QhMhac0x34vS8=
 =DxWr
 -----END PGP SIGNATURE-----

Merge tag 'optee-for-for-v6.6' of https://git.linaro.org/people/jens.wiklander/linux-tee into arm/fixes

Remove a few unused declarations in TEE subsystem

* tag 'optee-for-for-v6.6' of https://git.linaro.org/people/jens.wiklander/linux-tee:
  tee: Remove unused declarations

Link: https://lore.kernel.org/r/20230913083909.GA473533@rayden
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2023-09-27 11:04:04 +02:00
Arnd Bergmann
c374e875aa RISC-V Devicetree fixes for v6.6-rc3
Starfive:
 A fix for the size of the NOR flash that was causing complaints from the
 MTD subsystem during boot & two issues that a certain someone introduced
 while resolving merge conflicts. Of the latter, one is a cosmetic
 ordering change & the other lead to the usb controller being disabled.
 
 Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZQWTcwAKCRB4tDGHoIJi
 0ne4AP9ZmfxP2ddJK1YehAz1UBya0SyepjQKRuYySA9x+x9tGQD9GJo8mZj7RKoT
 NLC+pBByca0YfsFKGtTLYQgljOjSUAg=
 =noL2
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmUT7/MACgkQYKtH/8kJ
 UicB4w/+JAZ6Yxo0Tjq5R0miMtqxn4AEIsz8JKhP9vS4Lcwn03kf98bGbGYgc0OY
 vgBxHw4vnU1HkTWWwOTVSs3JOmzwqHYAOZMV6BKwpIdddlg+e4s/fDh/L+QI14FL
 /KHyViAKywBhnldcVLsizPucnR9OngKBC6eqATFibwZ5UNoK0Lloi+bGzsWI4JCW
 A3xV27bue/qL6VDWASLcyX9SEEoB6dBWditO+0EgTNX0l4+dpkD5B1qH0E4B7t3v
 sqIoOIz+0GOLWWT6NU6c7uGJoTihx9fn7C6Ez3jmkXyX+2TdZb1J8jsiNk4o1AvG
 MVQiSvtvh+f5kJVfIeKu5/8NMvZjxc59iC4wzR9GKbMaVSXlF+OTlyWPlfvDXOQW
 C4PvV2C01cW8UoWZ+aljsMtUMUxznsq2PVZJjYf29UhYTXidTrsz7snejiBesVEp
 56tm1lJGMtSv9UvKMhKB5itV/Ldiw9fFBP4yF7HIzL3HkzN3CiZqnLJ6xjBma3iU
 0V8x45iGTSFHLeeIJceM3JqnDhjbn9Pyiu5ZtafQVyFSfR3AWgPLL59wqmKAsWwx
 RAliPexLXZjJOoYtBgir4UFaUUbHU2yUi2zLN1sf/hv9MBwDwaUeYvbYKfoxft5C
 eJk0u3HlE7doof9b8TJ613t2wnyBKa3W+j7v+ku5lsbiPngZRn8=
 =YF+6
 -----END PGP SIGNATURE-----

Merge tag 'riscv-dt-fixes-for-v6.6-rc3' of https://git.kernel.org/pub/scm/linux/kernel/git/conor/linux into arm/fixes

RISC-V Devicetree fixes for v6.6-rc3

Starfive:
A fix for the size of the NOR flash that was causing complaints from the
MTD subsystem during boot & two issues that a certain someone introduced
while resolving merge conflicts. Of the latter, one is a cosmetic
ordering change & the other lead to the usb controller being disabled.

Signed-off-by: Conor Dooley <conor.dooley@microchip.com>

* tag 'riscv-dt-fixes-for-v6.6-rc3' of https://git.kernel.org/pub/scm/linux/kernel/git/conor/linux:
  riscv: dts: starfive: visionfive 2: Fix uart0 pins sort order
  riscv: dts: starfive: visionfive 2: Enable usb0
  riscv: dts: starfive: fix NOR flash reserved-data partition size

Link: https://lore.kernel.org/r/20230916-previous-oversold-9d30891ac6cf@spud
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2023-09-27 11:03:47 +02:00
Mikko Rapeli
7d3e4e9d3b
arm64: defconfig: remove CONFIG_COMMON_CLK_NPCM8XX=y
There is no code for this config option and enabling it in defconfig
causes warnings from tools which are detecting unused and obsolete
kernel config flags since the flag will be completely missing from
effective build config after "make olddefconfig".

Fixes yocto kernel recipe build time warning:

WARNING: [kernel config]: This BSP contains fragments with warnings:
...
[INFO]: the following symbols were not found in the active
configuration:
     - CONFIG_COMMON_CLK_NPCM8XX

The flag was added with commit 45472f1e53
v5.19-rc4-15-g45472f1e5348 so 6.1 and 6.4 stable kernel trees are
affected.

Fixes: 45472f1e53 ("arm64: defconfig: Add Nuvoton NPCM family support")
Cc: stable@kernel.org
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Bjorn Andersson <quic_bjorande@quicinc.com>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Cc: Konrad Dybcio <konrad.dybcio@linaro.org>
Cc: Neil Armstrong <neil.armstrong@linaro.org>
Cc: Tomer Maimon <tmaimon77@gmail.com>
Cc: Bruce Ashfield <bruce.ashfield@gmail.com>
Cc: Jon Mason <jon.mason@arm.com>
Cc: Jon Mason <jdmason@kudzu.us>
Cc: Ross Burton <ross@burtonini.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2023-09-27 11:03:25 +02:00
Arnd Bergmann
48519d648b i.MX fixes for 6.6:
- A couple of i.MX8MP device tree changes from Adam Ford to fix clock
   configuration regressions caused by 16c9845248 ("arm64: dts: imx8mp:
   don't initialize audio clocks from CCM node").
 - Fix pmic-irq-hog GPIO line in imx93-tqma9352 device tree.
 - Fix a mmemory leak with error handling path of imx_dsp_setup_channels()
   in imx-dsp driver.
 - Fix HDMI node in imx8mm-evk device tree.
 - Add missing clock enable functionality for imx8mm_soc_uid() function
   in soc-imx8m driver.
 - Add missing imx8mm-prt8mm.dtb build target.
 -----BEGIN PGP SIGNATURE-----
 
 iQFIBAABCgAyFiEEFmJXigPl4LoGSz08UFdYWoewfM4FAmUSzbIUHHNoYXduZ3Vv
 QGtlcm5lbC5vcmcACgkQUFdYWoewfM6CQgf+JGQJnoZoqywXkg8f8RExTShFuMs3
 I01NX+XabEnhGOA88Bx8e8whBUYqZKzPL4UauNBTTIaiJiTRVR3KjSFt5znvrMlW
 +sc0MhQUgQYIfM1iBt/pkIiz58n96kkzzj6LHjqpUav15EpudvmxiUCNEQUmBxQM
 mj85U1dIn2PqvZP2lGhDMmjAetSftt0BpyeyUUGgjZUS4g4XvQ3wFzyC/wf807uj
 COITEEWogt0uCuTLzmbVtpSNR+5TY/naPHHxaepFFSooArsoa51xGJHMk6J/o9i2
 d+BEM4CV0OC8XzDSpm0k1Yvxb+ImM23RM50qn3V8ZRQcf0Cwt46R0ikT2Q==
 =jN5j
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIyBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmUT77sACgkQYKtH/8kJ
 UicmKg/2NOZ/kCrtHBg0MMbmRhm1cfTuMkYVtjy8K0iO+SaWAfk+sKPAD+xPC75d
 I/aZWffEI78SWDxAsH35HpFT/emjZZ+AkOZWiRsn822vMZw+z0oeqX0DvRuWmLW/
 n8gxI9EfQEMnuy0VzORovGLlSg2lgmkF51xC0PQXKkzET40NhQwaYLjJoGocrtA8
 z+rS+C0T9MEoaAhoFZuFDwlLi5rPF1qkwnav6rzDMrMcfwTF+aRkKMT7C7CNxdqR
 Rf4e+0CrYjGU2Q5MEda289AM47OAy8I+7Dr2b9kuPaKHcf0qWvkSWv21vWsJYA7D
 B4/Ya+5BNxR4282m1XfSKULgPQF5C2k+jQhpGgQZeCKRNFuCnpsdwWOnuuoE/Lvz
 BiqCDKU2SShjOS3vzEfipjoOnD5mrSVR0Gh3lYfYX6MGmZvYqCSCUFzEExDmnNmH
 QFAnwvEEH7dlYV4LAkLkp4WbgoPtjtO6OGhjiNzjsUX6523SOgUkbR9ADw755/p/
 Fx++cZga/+wmJmSFW8qlkK9JR773I9I6J5JfRjTVTU6TLkTiEsaZSflrW0OuuCDD
 zAmEAoaG6IxvCKw9x2xtVBoKXaKxI46xWX/UbdCOVLCHMTU/6VZdjIrvgG9Qkwh1
 EK1lvpcJlUv5LUfpHdKChLnafLAIbx7/8CHPsZXI6UfuDWsi8g==
 =i6SQ
 -----END PGP SIGNATURE-----

Merge tag 'imx-fixes-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux into arm/fixes

i.MX fixes for 6.6:

- A couple of i.MX8MP device tree changes from Adam Ford to fix clock
  configuration regressions caused by 16c9845248 ("arm64: dts: imx8mp:
  don't initialize audio clocks from CCM node").
- Fix pmic-irq-hog GPIO line in imx93-tqma9352 device tree.
- Fix a mmemory leak with error handling path of imx_dsp_setup_channels()
  in imx-dsp driver.
- Fix HDMI node in imx8mm-evk device tree.
- Add missing clock enable functionality for imx8mm_soc_uid() function
  in soc-imx8m driver.
- Add missing imx8mm-prt8mm.dtb build target.

* tag 'imx-fixes-6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux:
  arm64: dts: imx: Add imx8mm-prt8mm.dtb to build
  arm64: dts: imx8mm-evk: Fix hdmi@3d node
  soc: imx8m: Enable OCOTP clock for imx8mm before reading registers
  arm64: dts: imx8mp-beacon-kit: Fix audio_pll2 clock
  arm64: dts: imx8mp: Fix SDMA2/3 clocks
  arm64: dts: freescale: tqma9352: Fix gpio hog
  firmware: imx-dsp: Fix an error handling path in imx_dsp_setup_channels()

Link: https://lore.kernel.org/r/20230926123710.GT7231@dragon
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2023-09-27 11:02:51 +02:00
Arnd Bergmann
3c50ffba88 Fixes for omaps and ti-sysc
Fixes for several ti-sysc interconnect target module driver issues for
 external abort on non-linefetch, am35x soc match, and uart module quirks
 handling needed for devices to work and to allow device wake-up to work.
 
 Fixes for droid4 boot time errors and warnings as noticed after boot doing
 dmesg -lerr,warn. Let's also cut down the debug uart noise by using
 overrun-throttle-ms, and downgrade the u-boot version warnings to
 debug statements to further reduce the boot time noise with warnings.
 -----BEGIN PGP SIGNATURE-----
 
 iQJFBAABCAAvFiEEkgNvrZJU/QSQYIcQG9Q+yVyrpXMFAmUSkggRHHRvbnlAYXRv
 bWlkZS5jb20ACgkQG9Q+yVyrpXN4FBAAqYkLeemuf95UAlqTya17Qx4gSxklv9vj
 p+kZo5BUpyeReBQ0VKVO89m6xCOHfaAANDQb6RldEpiUdQb2WOMZSMNYddFraJFc
 AEViT9GBjy81hIwZS23WSKTnQ7UbBpIwC67VnRjGdCr3aOSJSlGQN9PiMl8xIYhS
 fy505IYD0m0vqZluAGURxb0LjNrEsKVlOZxL9C4Yk0VEeGdezR3EVfZkv+admHkU
 V9cd9LjeEOBCUI11Em63Ov6w6rYFxfaUfYnJstEX1KlbD6bOpF/vlSZV+kuKo9hs
 5wJACcmLAShWWxi/zTp7gEAeRe4vdGW2aPAEHgP8ZEtCjJ6vJExwOaxwqLwiWCuZ
 /tSISSSAVlGwtLFCxFJq5bkU+WBrYzUfKqecYO5mObOBa/a1YX5MLK0Ipq4BkNWs
 cF1JF6tfzaqfLtMvxQZM6rOVpse118hzYP/X5nKnwqwlToaAXZxg52yxfGYoP6qi
 Cs1Mvm8CU2WQy5vrCboNVP7r1td99O+HD3uq+6S5Mr8xU4RKxhMXUQF4PG/T0KuB
 bjvB3MXTBSI/Q/Lr3h4s1Z8C736t6uTh7QIU9Q+6b8nTU6fIkqrMiKKD3wC2Sxrv
 NouElMgf2izpuAwIeWVnibm3dnZN7bz3GDNdPbUsqHm/jtkDocXsC8Ql1AT0EWfw
 kskW29YG978=
 =MC3p
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmUT76kACgkQYKtH/8kJ
 UifnDg//XBoZDNRWXC+Rg9Az/vHaQwURIznU2j2AgrPzfSKN3zfFKNeba3Y6XQ7E
 mFVBmfxaKhzfOKMlSssoe0eObS7p2NqiZDx+jRtlt22g6UJopjRLUlZXcTZ++NiB
 rkUho5HfvRhzWb1cqwf+ZDkKcNnMs6F2bg89XBfP3cGa5O8CGbuyt3TXkVvoaJZL
 3n5vCIFJfIYJ7jx/6LMQyRU56bEhjhL/NTtmcqupr02PxtVk2VHIsVaWW/ttLv6g
 iksKs5PAYxF5GRx4CkiTBYUkB2W4yZTK2ImoDipvtgzqCfkFYigPEL9E1wVPnr5w
 L6rjgEgT+TNpomC5fOQ73bUIEQ5ZUQI0CuGfkTygJPkGSQGdsGfdPepT89U13wun
 7G0S48lwVfdC/6vgV5MbKcQmBNN6ghrKKt1ppuZPPHyYNff5ig1CjEJXbv74MFX8
 tIYynAngTROqtHsJKgIXhAd49pX/gMDHDTtRu0fXRCrMwSQQczoSC4mJcr3UX2Jr
 m7k+Cq8iPOPZUWIIZ8/TLpXXe3ibcO1tYEgrz7cBlkN1I2/zEyR72dVy2cosrx5R
 P/TVR2tNE5+E1EMVZsxcgLrZsL3h1pvXq1N6eQVTltXFnId70zplu5X5/id7ovFH
 5aivXWvt0833Lz/Vu3pA/DkM1qMIDngFTwDHDXKlGJv1RayTztI=
 =IurW
 -----END PGP SIGNATURE-----

Merge tag 'omap-for-v6.6/fixes-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into arm/fixes

Fixes for omaps and ti-sysc

Fixes for several ti-sysc interconnect target module driver issues for
external abort on non-linefetch, am35x soc match, and uart module quirks
handling needed for devices to work and to allow device wake-up to work.

Fixes for droid4 boot time errors and warnings as noticed after boot doing
dmesg -lerr,warn. Let's also cut down the debug uart noise by using
overrun-throttle-ms, and downgrade the u-boot version warnings to
debug statements to further reduce the boot time noise with warnings.

* tag 'omap-for-v6.6/fixes-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap:
  bus: ti-sysc: Fix SYSC_QUIRK_SWSUP_SIDLE_ACT handling for uart wake-up
  ARM: omap2+: Downgrade u-boot version warnings to debug statements
  ARM: dts: ti: omap: Fix noisy serial with overrun-throttle-ms for mapphone
  ARM: dts: ti: omap: motorola-mapphone: Fix abe_clkctrl warning on boot
  ARM: dts: ti: omap: Fix bandgap thermal cells addressing for omap3/4
  bus: ti-sysc: Fix missing AM35xx SoC matching
  bus: ti-sysc: Use fsleep() instead of usleep_range() in sysc_reset()

Link: https://lore.kernel.org/r/pull-1695715881-95183@atomide.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2023-09-27 11:02:33 +02:00
Randy Dunlap
59a98f4f1e
ARM: uniphier: fix cache kernel-doc warnings
Fix kernel-doc warning(s) as reported by lkp:

arch/arm/mm/cache-uniphier.c:72: warning: cannot understand function prototype: 'struct uniphier_cache_data '
cache-uniphier.c:82: warning: Function parameter or member 'way_ctrl_base' not described in 'uniphier_cache_data'

Fixes: e7ecbc057b ("ARM: uniphier: add outer cache support")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: kernel test robot <lkp@intel.com>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Olof Johansson <olof@lixom.net>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: soc@kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Link: lore.kernel.org/r/202309260130.Uvwh8ceE-lkp@intel.com # fixes only one item
Link: https://lore.kernel.org/r/20230926003548.22066-1-rdunlap@infradead.org
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2023-09-27 11:02:14 +02:00
Tiezhu Yang
b1dc55a3d6 LoongArch: Add support for 64_PCREL relocation type
When build and update kernel with the latest upstream binutils and
loongson3_defconfig, module loader fails with:

  kmod: zsmalloc: Unknown relocation type 109
  kmod: fuse: Unknown relocation type 109
  kmod: fuse: Unknown relocation type 109
  kmod: radeon: Unknown relocation type 109
  kmod: nf_tables: Unknown relocation type 109
  kmod: nf_tables: Unknown relocation type 109

This is because the latest upstream binutils replaces a pair of ADD64
and SUB64 with 64_PCREL, so add support for 64_PCREL relocation type.

Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ecb802d02eeb
Cc: <stable@vger.kernel.org>
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
2023-09-27 16:19:13 +08:00
Tiezhu Yang
c1c2ce2d3b LoongArch: Add support for 32_PCREL relocation type
When build and update kernel with the latest upstream binutils and
loongson3_defconfig, module loader fails with:

  kmod: zsmalloc: Unsupport relocation type 99, please add its support.
  kmod: fuse: Unsupport relocation type 99, please add its support.
  kmod: ipmi_msghandler: Unsupport relocation type 99, please add its support.
  kmod: ipmi_msghandler: Unsupport relocation type 99, please add its support.
  kmod: pstore: Unsupport relocation type 99, please add its support.
  kmod: drm_display_helper: Unsupport relocation type 99, please add its support.
  kmod: drm_display_helper: Unsupport relocation type 99, please add its support.
  kmod: drm_display_helper: Unsupport relocation type 99, please add its support.
  kmod: fuse: Unsupport relocation type 99, please add its support.
  kmod: fat: Unsupport relocation type 99, please add its support.

This is because the latest upstream binutils replaces a pair of ADD32
and SUB32 with 32_PCREL, so add support for 32_PCREL relocation type.

Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=ecb802d02eeb
Cc: <stable@vger.kernel.org>
Co-developed-by: Youling Tang <tangyouling@loongson.cn>
Signed-off-by: Youling Tang <tangyouling@loongson.cn>
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
2023-09-27 16:19:13 +08:00
Tiezhu Yang
2761498876 LoongArch: Define relocation types for ABI v2.10
The relocation types from 101 to 109 are used by GNU binutils >= 2.41,
add their definitions to use them in later patches.

Link: https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=include/elf/loongarch.h#l230
Cc: <stable@vger.kernel.org>
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
2023-09-27 16:19:13 +08:00
Huacai Chen
1943feecf8 LoongArch: numa: Fix high_memory calculation
For 64bit kernel without HIGHMEM, high_memory is the virtual address of
the highest physical address in the system. But __va(get_num_physpages()
<< PAGE_SHIFT) is not what we want for high_memory because there may be
holes in the physical address space. On the other hand, max_low_pfn is
calculated from memblock_end_of_DRAM(), which is exactly corresponding
to the highest physical address, so use it for high_memory calculation.

Cc: <stable@vger.kernel.org>
Fixes: d4b6f1562a ("LoongArch: Add Non-Uniform Memory Access (NUMA) support")
Signed-off-by: Chong Qiao <qiaochong@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
2023-09-27 16:19:13 +08:00
Wenhua Lin
26d9e5640d gpio: pmic-eic-sprd: Add can_sleep flag for PMIC EIC chip
The drivers uses a mutex and I2C bus access in its PMIC EIC chip
get implementation. This means these functions can sleep and the PMIC EIC
chip should set the can_sleep property to true.

This will ensure that a warning is printed when trying to get the
value from a context that potentially can't sleep.

Fixes: 348f3cde84 ("gpio: Add Spreadtrum PMIC EIC driver support")
Signed-off-by: Wenhua Lin <Wenhua.Lin@unisoc.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-09-27 09:12:09 +02:00
Chengfeng Ye
9e8bc2dda5 gpio: timberdale: Fix potential deadlock on &tgpio->lock
As timbgpio_irq_enable()/timbgpio_irq_disable() callback could be
executed under irq context, it could introduce double locks on
&tgpio->lock if it preempts other execution units requiring
the same locks.

timbgpio_gpio_set()
--> timbgpio_update_bit()
--> spin_lock(&tgpio->lock)
<interrupt>
   --> timbgpio_irq_disable()
   --> spin_lock_irqsave(&tgpio->lock)

This flaw was found by an experimental static analysis tool I am
developing for irq-related deadlock.

To prevent the potential deadlock, the patch uses spin_lock_irqsave()
on &tgpio->lock inside timbgpio_gpio_set() to prevent the possible
deadlock scenario.

Signed-off-by: Chengfeng Ye <dg573847474@gmail.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2023-09-27 08:51:28 +02:00
Karol Wachowski
645d694559 accel/ivpu: Use cached buffers for FW loading
Create buffers with cache coherency on the CPU side (write-back) while
disabling snooping on the VPU side. These buffers require an explicit
cache flush after each CPU-side modification.

Configuring pages as write-combined may introduce significant delays,
potentially taking hundreds of milliseconds for 64 MB buffers.

Added internal DRM_IVPU_BO_NOSNOOP mask which disables snooping on the
VPU side. Allocate FW runtime memory buffer (64 MB) as cached with
snooping-disabled.

This fixes random long FW loading times and boot params memory
corruption on warmboot (due to missed wmb).

Fixes: 02d5b0aacd ("accel/ivpu: Implement firmware parsing and booting")
Signed-off-by: Karol Wachowski <karol.wachowski@linux.intel.com>
Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com>
Signed-off-by: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230926120943.GD846747@linux.intel.com
2023-09-27 07:40:43 +02:00