6.6.78-rc1 review
Subsystems (7)
Greg Kroah-Hartman
maintainerPATCH 158/273 PCI: Avoid putting some root ports into D3 on TUXEDO Sirius Gen1
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Werner Sembach <[email protected]>
commit b1049f2d68693c80a576c4578d96774a68df2bad upstream.
commit 9d26d3a8f1b0 ("PCI: Put PCIe ports into D3 during suspend") sets the policy that all PCIe ports are allowed to use D3. When the system is suspended if the port is not power manageable by the platform and won't be used for wakeup via a PME this sets up the policy for these ports to go into D3hot.
This policy generally makes sense from an OSPM perspective but it leads to problems with wakeup from suspend on the TUXEDO Sirius 16 Gen 1 with a specific old BIOS. This manifests as a system hang.
On the affected Device + BIOS combination, add a quirk for the root port of the problematic controller to ensure that these root ports are not put into D3hot at suspend.
This patch is based on
https://lore.kernel.org/linux-pci/[email protected]
but with the added condition both in the documentation and in the code to apply only to the TUXEDO Sirius 16 Gen 1 with a specific old BIOS and only the affected root ports.
--- arch/x86/pci/fixup.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
arch/x86/pci/fixup.c +30 -0
@@ -1010,4 +1010,34 @@ DECLARE_PCI_FIXUP_SUSPEND(PCI_VENDOR_ID_DECLARE_PCI_FIXUP_RESUME (PCI_VENDOR_ID_AMD ,0x1668 , amd_rp_pme_resume);DECLARE_PCI_FIXUP_SUSPEND (PCI_VENDOR_ID_AMD ,0x1669 , amd_rp_pme_suspend);DECLARE_PCI_FIXUP_RESUME (PCI_VENDOR_ID_AMD ,0x1669 , amd_rp_pme_resume); + +/* +* Putting PCIe root ports on Ryzen SoCs with USB4 controllers into D3hot +* may cause problems when the system attempts wake up from s2idle. +* +* On the TUXEDO Sirius 16 Gen 1 with a specific old BIOS this manifests as +* a system hang. +*/ +static const struct dmi_system_id quirk_tuxeo_rp_d3_dmi_table[] = { + { + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), +DMI_EXACT_MATCH (DMI_BOARD_NAME ,"APX958" ), +DMI_EXACT_MATCH (DMI_BIOS_VERSION ,"V1.00A00_20240108" ), + }, + }, + {} +}; + +static void quirk_tuxeo_rp_d3 (struct pci_dev *pdev) +{ +struct pci_dev *root_pdev; + +if (dmi_check_system (quirk_tuxeo_rp_d3_dmi_table)) { + root_pdev =pcie_find_root_port (pdev); +if (root_pdev) + root_pdev->dev_flags |=PCI_DEV_FLAGS_NO_D3 ; + } +} +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_AMD ,0x1502 , quirk_tuxeo_rp_d3);#endif /* CONFIG_SUSPEND */
Greg Kroah-Hartman
maintainerPATCH 159/273 PCI: endpoint: Finish virtual EP removal in pci_epf_remove_vepf()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zijun Hu <[email protected]>
commit 3b9f942eb21c92041905e3943a8d5177c9a9d89d upstream.
When removing a virtual Endpoint, pci_epf_remove_vepf() failed to clear epf_vf->epf_pf, which caused a subsequent pci_epf_add_vepf() to incorrectly return -EBUSY:
pci_epf_add_vepf(epf_pf, epf_vf) // add pci_epf_remove_vepf(epf_pf, epf_vf) // remove pci_epf_add_vepf(epf_pf, epf_vf) // add again, -EBUSY error
Fix by clearing epf_vf->epf_pf in pci_epf_remove_vepf().
--- drivers/pci/endpoint/pci-epf-core.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/endpoint/pci-epf-core.c +1 -0
@@ -202,6 +202,7 @@ void pci_epf_remove_vepf(struct pci_epfmutex_lock (&epf_pf->lock);clear_bit (epf_vf->vfunc_no, &epf_pf->vfunction_num_map); + epf_vf->epf_pf =NULL ;list_del (&epf_vf->list);mutex_unlock (&epf_pf->lock); }
Greg Kroah-Hartman
maintainerPATCH 160/273 nvme-pci: Add TUXEDO InfinityFlex to Samsung sleep quirk
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Georg Gottleuber <[email protected]>
commit dbf2bb1a1319b7c7d8828905378a6696cca6b0f2 upstream.
On the TUXEDO InfinityFlex, a Samsung 990 Evo NVMe leads to a high power consumption in s2idle sleep (4 watts).
This patch applies 'Force No Simple Suspend' quirk to achieve a sleep with a lower power consumption, typically around 1.4 watts.
--- drivers/nvme/host/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/host/pci.c +2 -1
@@ -2949,7 +2949,8 @@ static unsigned long check_vendor_combin* because of high power consumption (> 2 Watt) in s2idle * sleep. Only some boards with Intel CPU are affected. */ -if (dmi_match (DMI_BOARD_NAME ,"GMxPXxx" ) || +if (dmi_match (DMI_BOARD_NAME ,"DN50Z-140HC-YD" ) || +dmi_match (DMI_BOARD_NAME ,"GMxPXxx" ) ||dmi_match (DMI_BOARD_NAME ,"PH4PG31" ) ||dmi_match (DMI_BOARD_NAME ,"PH4PRX1_PH6PRX1" ) ||dmi_match (DMI_BOARD_NAME ,"PH6PG01_PH6PG71" ))
Greg Kroah-Hartman
maintainerPATCH 161/273 nvme-pci: Add TUXEDO IBP Gen9 to Samsung sleep quirk
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Georg Gottleuber <[email protected]>
commit 11cb3529d18514f7d28ad2190533192aedefd761 upstream.
On the TUXEDO InfinityBook Pro Gen9 Intel, a Samsung 990 Evo NVMe leads to a high power consumption in s2idle sleep (4 watts).
This patch applies 'Force No Simple Suspend' quirk to achieve a sleep with a lower power consumption, typically around 1.2 watts.
--- drivers/nvme/host/pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/nvme/host/pci.c +1 -0
@@ -2951,6 +2951,7 @@ static unsigned long check_vendor_combin*/ if (dmi_match (DMI_BOARD_NAME ,"DN50Z-140HC-YD" ) ||dmi_match (DMI_BOARD_NAME ,"GMxPXxx" ) || +dmi_match (DMI_BOARD_NAME ,"GXxMRXx" ) ||dmi_match (DMI_BOARD_NAME ,"PH4PG31" ) ||dmi_match (DMI_BOARD_NAME ,"PH4PRX1_PH6PRX1" ) ||dmi_match (DMI_BOARD_NAME ,"PH6PG01_PH6PG71" ))
Greg Kroah-Hartman
maintainerPATCH 162/273 scsi: st: Dont set pos_unknown just after device recognition
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kai Mäkisara <[email protected]>
commit 98b37881b7492ae9048ad48260cc8a6ee9eb39fd upstream.
Commit 9604eea5bd3a ("scsi: st: Add third party poweron reset handling") in v6.6 added new code to handle the Power On/Reset Unit Attention (POR UA) sense data. This was in addition to the existing method. When this Unit Attention is received, the driver blocks attempts to read, write and some other operations because the reset may have rewinded the tape. Because of the added code, also the initial POR UA resulted in blocking operations, including those that are used to set the driver options after the device is recognized. Also, reading and writing are refused, whereas they succeeded before this commit.
Add code to not set pos_unknown to block operations if the POR UA is received from the first test_ready() call after the st device has been created. This restores the behavior before v6.6.
--- drivers/scsi/st.c | 6 ++++++ drivers/scsi/st.h | 1 + 2 files changed, 7 insertions(+)
drivers/scsi/st.c +6 -0
@@ -1028,6 +1028,11 @@ static int test_ready(struct scsi_tape * retval = new_session ?CHKRES_NEW_SESSION :CHKRES_READY ;break ; } +if (STp->first_tur) { +/* Don't set pos_unknown right after device recognition */ + STp->pos_unknown =0 ; + STp->first_tur =0 ; + }if (SRpnt !=NULL )st_release_request (SRpnt);
@@ -4326,6 +4331,7 @@ static int st_probe(struct device *dev)blk_queue_rq_timeout (tpnt->device->request_queue,ST_TIMEOUT ); tpnt->long_timeout =ST_LONG_TIMEOUT ; tpnt->try_dio = try_direct_io; + tpnt->first_tur =1 ;for (i =0 ; i <ST_NBR_MODES ; i++) { STm = &(tpnt->modes[i]);
drivers/scsi/st.h +1 -0
@@ -170,6 +170,7 @@ struct scsi_tape {unsigned char rew_at_close;/* rewind necessary at close */ unsigned char inited;unsigned char cleaning_req;/* cleaning requested? */ +unsigned char first_tur;/* first TEST UNIT READY */ int block_size;int min_block;int max_block;
Greg Kroah-Hartman
maintainerPATCH 163/273 scsi: qla2xxx: Move FCE Trace buffer allocation to user control
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Quinn Tran <[email protected]>
commit 841df27d619ee1f5ca6473e15227b39d6136562d upstream.
Currently FCE Tracing is enabled to log additional ELS events. Instead, user will enable or disable this feature through debugfs.
Modify existing DFS knob to allow user to enable or disable this feature.
echo [1 | 0] > /sys/kernel/debug/qla2xxx/qla2xxx_??/fce cat /sys/kernel/debug/qla2xxx/qla2xxx_??/fce
--- drivers/scsi/qla2xxx/qla_def.h | 2 drivers/scsi/qla2xxx/qla_dfs.c | 124 ++++++++++++++++++++++++++++++++-------- drivers/scsi/qla2xxx/qla_gbl.h | 3 drivers/scsi/qla2xxx/qla_init.c | 28 ++++++--- 4 files changed, 126 insertions(+), 31 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +2 -0
@@ -4099,6 +4099,8 @@ struct qla_hw_data { uint32_t npiv_supported :1; uint32_t pci_channel_io_perm_failure :1; uint32_t fce_enabled :1; + uint32_t user_enabled_fce :1; + uint32_t fce_dump_buf_alloced :1; uint32_t fac_supported :1; uint32_t chip_reset_done :1;
drivers/scsi/qla2xxx/qla_dfs.c +102 -22
155 lines not on this page · raw message
drivers/scsi/qla2xxx/qla_gbl.h +3 -0
@@ -11,6 +11,9 @@/* * Global Function Prototypes in qla_init.c source file. */ +int qla2x00_alloc_fce_trace (scsi_qla_host_t *); +void qla2x00_free_fce_trace (struct qla_hw_data *ha); +void qla_enable_fce_trace (scsi_qla_host_t *);extern int qla2x00_initialize_adapter (scsi_qla_host_t *);extern int qla24xx_post_prli_work (struct scsi_qla_host *vha,fc_port_t *fcport);
drivers/scsi/qla2xxx/qla_init.c +19 -9
@@ -2681,7 +2681,7 @@ exit:return rval; } -static void qla_enable_fce_trace (scsi_qla_host_t *vha) +void qla_enable_fce_trace (scsi_qla_host_t *vha) {int rval;struct qla_hw_data *ha = vha->hw;
@@ -3717,25 +3717,24 @@ qla24xx_chip_diag(scsi_qla_host_t *vha)return rval; } -static void -qla2x00_alloc_fce_trace (scsi_qla_host_t *vha) +int qla2x00_alloc_fce_trace (scsi_qla_host_t *vha) {dma_addr_t tc_dma;void *tc;struct qla_hw_data *ha = vha->hw;if (!IS_FWI2_CAPABLE (ha)) -return ; +return -EINVAL ;if (!IS_QLA25XX (ha) && !IS_QLA81XX (ha) && !IS_QLA83XX (ha) && !IS_QLA27XX (ha) && !IS_QLA28XX (ha)) -return ; +return -EINVAL ;if (ha->fce) {ql_dbg (ql_dbg_init, vha,0x00bd ,"%s: FCE Mem is already allocated.\n" , __func__); -return ; +return -EIO ; }/* Allocate memory for Fibre Channel Event Buffer. */
@@ -3745,7 +3744,7 @@ qla2x00_alloc_fce_trace(scsi_qla_host_tql_log (ql_log_warn, vha,0x00be ,"Unable to allocate (%d KB) for FCE.\n" ,FCE_SIZE /1024 ); -return ; +return -ENOMEM ; } ql_dbg(ql_dbg_init, vha, 0x00c0,
@@ -3754,6 +3753,16 @@ qla2x00_alloc_fce_trace(scsi_qla_host_t ha->fce_dma = tc_dma; ha->fce = tc; ha->fce_bufs =FCE_NUM_BUFFERS ; +return 0 ; +} + +void qla2x00_free_fce_trace (struct qla_hw_data *ha) +{ +if (!ha->fce) +return ; +dma_free_coherent (&ha->pdev->dev,FCE_SIZE , ha->fce, ha->fce_dma); + ha->fce =NULL ; + ha->fce_dma =0 ; } static void
@@ -3844,9 +3853,10 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *vif (ha->tgt.atio_ring) mq_size += ha->tgt.atio_q_length *sizeof (request_t); -qla2x00_alloc_fce_trace (vha); -if (ha->fce) +if (ha->fce) { fce_size =sizeof (struct qla2xxx_fce_chain ) +FCE_SIZE ; + ha->flags.fce_dump_buf_alloced =1 ; + }qla2x00_alloc_eft_trace (vha);if (ha->eft) eft_size =EFT_SIZE ;
Greg Kroah-Hartman
maintainerPATCH 164/273 scsi: ufs: qcom: Fix crypto key eviction
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 7a0905caf5665be41094a6ceb5e9d2524de4627a upstream.
Commit 56541c7c4468 ("scsi: ufs: ufs-qcom: Switch to the new ICE API") introduced an incorrect check of the algorithm ID into the key eviction path, and thus qcom_ice_evict_key() is no longer ever called. Fix it.
--- drivers/ufs/host/ufs-qcom.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
drivers/ufs/host/ufs-qcom.c +8 -10
@@ -158,8 +158,9 @@ static int ufs_qcom_ice_program_key(stru {struct ufs_qcom_host *host =ufshcd_get_variant (hba);union ufs_crypto_cap_entry cap; -bool config_enable = - cfg->config_enable &UFS_CRYPTO_CONFIGURATION_ENABLE ; + +if (!(cfg->config_enable &UFS_CRYPTO_CONFIGURATION_ENABLE )) +return qcom_ice_evict_key (host->ice, slot);/* Only AES-256-XTS has been tested so far. */ cap = hba->crypto_cap_array[cfg->crypto_cap_idx];
@@ -167,14 +168,11 @@ static int ufs_qcom_ice_program_key(stru cap.key_size != UFS_CRYPTO_KEY_SIZE_256)return -EOPNOTSUPP ; -if (config_enable) -return qcom_ice_program_key (host->ice, -QCOM_ICE_CRYPTO_ALG_AES_XTS , -QCOM_ICE_CRYPTO_KEY_SIZE_256 , - cfg->crypto_key, - cfg->data_unit_size, slot); -else - return qcom_ice_evict_key(host->ice, slot); +return qcom_ice_program_key (host->ice, +QCOM_ICE_CRYPTO_ALG_AES_XTS , +QCOM_ICE_CRYPTO_KEY_SIZE_256 , + cfg->crypto_key, + cfg->data_unit_size, slot); }#else
Greg Kroah-Hartman
maintainerPATCH 165/273 scsi: storvsc: Set correct data length for sending SCSI command without payload
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Long Li <[email protected]>
commit 87c4b5e8a6b65189abd9ea5010ab308941f964a4 upstream.
In StorVSC, payload->range.len is used to indicate if this SCSI command carries payload. This data is allocated as part of the private driver data by the upper layer and may get passed to lower driver uninitialized.
For example, the SCSI error handling mid layer may send TEST_UNIT_READY or REQUEST_SENSE while reusing the buffer from a failed command. The private data section may have stale data from the previous command.
If the SCSI command doesn't carry payload, the driver may use this value as is for communicating with host, resulting in possible corruption.
Fix this by always initializing this value.
--- drivers/scsi/storvsc_drv.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/storvsc_drv.c +1 -0
@@ -1800,6 +1800,7 @@ static int storvsc_queuecommand(struct S length =scsi_bufflen (scmnd); payload = (struct vmbus_packet_mpb_array *)&cmd_request->mpb; + payload->range.len =0 ; payload_sz =0 ;if (scsi_sg_count (scmnd)) {
Greg Kroah-Hartman
maintainerPATCH 166/273 kbuild: Move -Wenum-enum-conversion to W=2
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
commit 8f6629c004b193d23612641c3607e785819e97ab upstream.
-Wenum-enum-conversion was strengthened in clang-19 to warn for C, which caused the kernel to move it to W=1 in commit 75b5ab134bb5 ("kbuild:
Move -Wenum-{compare-conditional,enum-conversion} into W=1") because there were numerous instances that would break builds with -Werror. Unfortunately, this is not a full solution, as more and more developers, subsystems, and distributors are building with W=1 as well, so they continue to see the numerous instances of this warning.
Since the move to W=1, there have not been many new instances that have appeared through various build reports and the ones that have appeared seem to be following similar existing patterns, suggesting that most instances of this warning will not be real issues. The only alternatives for silencing this warning are adding casts (which is generally seen as an ugly practice) or refactoring the enums to macro defines or a unified enum (which may be undesirable because of type safety in other parts of the code).
Move the warning to W=2, where warnings that occur frequently but may be relevant should reside.
--- scripts/Makefile.extrawarn | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
scripts/Makefile.extrawarn +4 -1
@@ -144,7 +144,6 @@ KBUILD_CFLAGS += -Wno-tautological-const KBUILD_CFLAGS += $(call cc-disable-warning, unaligned-access) KBUILD_CFLAGS += $(call cc-disable-warning, cast-function-type-strict) KBUILD_CFLAGS += -Wno-enum-compare-conditional -KBUILD_CFLAGS += -Wno-enum-enum-conversion endif endif
@@ -176,6 +175,10 @@ KBUILD_CFLAGS += -Wno-type-limits KBUILD_CFLAGS += -Wno-shift-negative-value ifdef CONFIG_CC_IS_CLANG +KBUILD_CFLAGS += -Wno-enum-enum-conversion +endif + +ifdef CONFIG_CC_IS_CLANG KBUILD_CFLAGS += -Wno-initializer-overrides else KBUILD_CFLAGS += -Wno-maybe-uninitialized
Greg Kroah-Hartman
maintainerPATCH 167/273 rust: init: use explicit ABI to clean warning in future compilers
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Miguel Ojeda <[email protected]>
commit c21bdb3d8a850afdfa4afe77eea39ae9533629b0 upstream.
Starting with Rust 1.86.0 (currently in nightly, to be released on 2025-04-03), the missing_abi lint is warn-by-default [1]:
error: extern declarations without an explicit ABI are deprecated
--> rust/doctests_kernel_generated.rs:3158:1
|
3158 | extern {
| ^^^^^^ help: explicitly specify the C ABI: extern "C" |
= note: -D missing-abi implied by -D warnings = help: to override -D warnings add #[allow(missing_abi)]
Thus clean it up.
--- rust/kernel/init.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
rust/kernel/init.rs +1 -1
@@ -788,7 +788,7 @@ pub unsafe trait PinInit<T: ?Sized, E =/// use kernel::{types::Opaque, init::pin_init_from_closure}; /// #[repr(C)] /// struct RawFoo([u8; 16]); -/// extern { +/// extern "C" { /// fn init_foo(_: *mut RawFoo); /// } ///
Greg Kroah-Hartman
maintainerPATCH 168/273 x86/boot: Use -std=gnu11 to fix build with GCC 15
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nathan Chancellor <[email protected]>
commit ee2ab467bddfb2d7f68d996dbab94d7b88f8eaf7 upstream.
GCC 15 changed the default C standard version to C23, which should not have impacted the kernel because it requests the gnu11 standard via '-std=' in the main Makefile. However, the x86 compressed boot Makefile uses its own set of KBUILD_CFLAGS without a '-std=' value (i.e., using the default), resulting in errors from the kernel's definitions of bool, true, and false in stddef.h, which are reserved keywords under C23.
./include/linux/stddef.h:11:9: error: expected identifier before ‘false’
11 | false = 0,
./include/linux/types.h:35:33: error: two or more data types in declaration specifiers
35 | typedef _Bool bool;
Set '-std=gnu11' in the x86 compressed boot Makefile to resolve the error and consistently use the same C standard version for the entire kernel.
--- arch/x86/boot/compressed/Makefile | 1 + 1 file changed, 1 insertion(+)
arch/x86/boot/compressed/Makefile +1 -0
@@ -34,6 +34,7 @@ targets := vmlinux vmlinux.bin vmlinux.b # avoid errors with '-march=i386', and future flags may depend on the target to # be valid. KBUILD_CFLAGS := -m$(BITS) -O2 $(CLANG_FLAGS) +KBUILD_CFLAGS += -std=gnu11 KBUILD_CFLAGS += -fno-strict-aliasing -fPIE KBUILD_CFLAGS += -Wundef KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
Greg Kroah-Hartman
maintainerPATCH 169/273 ubi: Add a check for ubi_num
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Denis Arefev <[email protected]>
commit 97bbf9e312c3fbaf0baa56120238825d2eb23b8a upstream.
Added a check for ubi_num for negative numbers
If the variable ubi_num takes negative values then we get:
qemu-system-arm ... -append "ubi.mtd=0,0,0,-22222345" ...
[ 0.745065] ubi_attach_mtd_dev from ubi_init+0x178/0x218 [ 0.745230] ubi_init from do_one_initcall+0x70/0x1ac [ 0.745344] do_one_initcall from kernel_init_freeable+0x198/0x224 [ 0.745474] kernel_init_freeable from kernel_init+0x18/0x134 [ 0.745600] kernel_init from ret_from_fork+0x14/0x28 [ 0.745727] Exception stack(0x90015fb0 to 0x90015ff8)
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/mtd/ubi/build.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/ubi/build.c +1 -1
@@ -1462,7 +1462,7 @@ static int ubi_mtd_param_parse(const chaif (token) {int err =kstrtoint (token,10 , &p->ubi_num); -if (err) { +if (err || p->ubi_num <UBI_DEV_NUM_AUTO ) {pr_err ("UBI error: bad value for ubi_num parameter: %s\n" , token);return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 170/273 ARM: dts: dra7: Add bus_dma_limit for l4 cfg bus
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Romain Naour <[email protected]>
commit c1472ec1dc4419d0bae663c1a1e6cb98dc7881ad upstream.
A bus_dma_limit was added for l3 bus by commit cfb5d65f2595 ("ARM: dts: dra7: Add bus_dma_limit for L3 bus") to fix an issue observed only with SATA on DRA7-EVM with 4GB RAM and CONFIG_ARM_LPAE enabled.
Since kernel 5.13, the SATA issue can be reproduced again following the SATA node move from L3 bus to L4_cfg in commit 8af15365a368 ("ARM: dts: Configure interconnect target module for dra7 sata").
Fix it by adding an empty dma-ranges property to l4_cfg and segment@100000 nodes (parent device tree node of SATA controller) to inherit the 2GB dma ranges limit from l3 bus node.
Note: A similar fix was applied for PCIe controller by commit 90d4d3f4ea45 ("ARM: dts: dra7: Fix bus_dma_limit for PCIe").
--- arch/arm/boot/dts/ti/omap/dra7-l4.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/boot/dts/ti/omap/dra7-l4.dtsi +2 -0
@@ -12,6 +12,7 @@ ranges = <0x00000000 0x4a000000 0x100000>, /* segment 0 */ <0x00100000 0x4a100000 0x100000>, /* segment 1 */ <0x00200000 0x4a200000 0x100000>; /* segment 2 */ + dma-ranges; segment@0 { /* 0x4a000000 */ compatible = "simple-pm-bus";
@@ -557,6 +558,7 @@ <0x0007e000 0x0017e000 0x001000>, /* ap 124 */ <0x00059000 0x00159000 0x001000>, /* ap 125 */ <0x0005a000 0x0015a000 0x001000>; /* ap 126 */ + dma-ranges; target-module@2000 { /* 0x4a102000, ap 27 3c.0 */ compatible = "ti,sysc";
Greg Kroah-Hartman
maintainerPATCH 171/273 ARM: dts: ti/omap: gta04: fix pm issues caused by spi module
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Kemnade <[email protected]>
commit 0cfbd7805fe13406500e6a6f2aa08f198d5db4bd upstream.
Despite CM_IDLEST1_CORE and CM_FCLKEN1_CORE behaving normal, disabling SPI leads to messages like when suspending:
Powerdomain (core_pwrdm) didn't enter target state 0 and according to /sys/kernel/debug/pm_debug/count off state is not entered. That was not connected to SPI during the discussion of disabling SPI. See:
https://lore.kernel.org/linux-omap/20230122100852.32ae082c@aktux/
The reason is that SPI is per default in slave mode. Linux driver will turn it to master per default. It slave mode, the powerdomain seems to be kept active if active chip select input is sensed.
Fix that by explicitly disabling the SPI3 pins which used to be muxed by the bootloader since they are available on an optionally fitted header which would require dtb overlays anyways.
--- arch/arm/boot/dts/ti/omap/omap3-gta04.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm/boot/dts/ti/omap/omap3-gta04.dtsi +10 -0
@@ -446,6 +446,7 @@ pinctrl-names = "default"; pinctrl-0 = < &hsusb2_2_pins + &mcspi3hog_pins >; hsusb2_2_pins: hsusb2-2-pins {
@@ -459,6 +460,15 @@ >; }; + mcspi3hog_pins: mcspi3hog-pins { + pinctrl-single,pins = < + OMAP3630_CORE2_IOPAD(0x25dc, PIN_OUTPUT_PULLDOWN | MUX_MODE4) /* etk_d0 */ + OMAP3630_CORE2_IOPAD(0x25de, PIN_OUTPUT_PULLDOWN | MUX_MODE4) /* etk_d1 */ + OMAP3630_CORE2_IOPAD(0x25e0, PIN_OUTPUT_PULLDOWN | MUX_MODE4) /* etk_d2 */ + OMAP3630_CORE2_IOPAD(0x25e2, PIN_OUTPUT_PULLDOWN | MUX_MODE4) /* etk_d3 */ + >; + }; + spi_gpio_pins: spi-gpio-pinmux-pins { pinctrl-single,pins = < OMAP3630_CORE2_IOPAD(0x25d8, PIN_OUTPUT | MUX_MODE4) /* clk */
Greg Kroah-Hartman
maintainerPATCH 172/273 arm64: dts: qcom: sm6115: Fix MPSS memory length
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 472d65e7cb591c8379dd6f40561f96be73a46f0f upstream.
The address space in MPSS/Modem PAS (Peripheral Authentication Service) remoteproc node should point to the QDSP PUB address space (QDSP6...SS_PUB) which has a length of 0x10000. Value of 0x100 was copied from older DTS, but it grew since then.
This should have no functional impact on Linux users, because PAS loader does not use this address space at all.
--- arch/arm64/boot/dts/qcom/sm6115.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm6115.dtsi +1 -1
@@ -1667,7 +1667,7 @@ remoteproc_mpss: remoteproc@6080000 { compatible = "qcom,sm6115-mpss-pas"; - reg = <0x0 0x06080000 0x0 0x100>; + reg = <0x0 0x06080000 0x0 0x10000>; interrupts-extended = <&intc GIC_SPI 307 IRQ_TYPE_EDGE_RISING>, <&modem_smp2p_in 0 IRQ_TYPE_EDGE_RISING>,
Greg Kroah-Hartman
maintainerPATCH 173/273 arm64: dts: qcom: sm6115: Fix CDSP memory length
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 846f49c3f01680f4af3043bf5b7abc9cf71bb42d upstream.
The address space in MPSS/Modem PAS (Peripheral Authentication Service) remoteproc node should point to the QDSP PUB address space (QDSP6...SS_PUB) which has a length of 0x4040. Value of 0x100000 covers entire Touring/CDSP memory block seems to big here.
This should have no functional impact on Linux users, because PAS loader does not use this address space at all.
--- arch/arm64/boot/dts/qcom/sm6115.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm6115.dtsi +1 -1
@@ -2384,7 +2384,7 @@ remoteproc_cdsp: remoteproc@b300000 { compatible = "qcom,sm6115-cdsp-pas"; - reg = <0x0 0x0b300000 0x0 0x100000>; + reg = <0x0 0x0b300000 0x0 0x4040>; interrupts-extended = <&intc GIC_SPI 265 IRQ_TYPE_EDGE_RISING>, <&cdsp_smp2p_in 0 IRQ_TYPE_EDGE_RISING>,
Greg Kroah-Hartman
maintainerPATCH 174/273 arm64: dts: qcom: sm6115: Fix ADSP memory base and length
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 47d178caac3ec13f5f472afda25fcfdfaa00d0da upstream.
The address space in ADSP PAS (Peripheral Authentication Service) remoteproc node should point to the QDSP PUB address space (QDSP6...SS_PUB): 0x0a40_0000 with length of 0x4040.
0x0ab0_0000, value used so far, is the SSC_QUPV3 block, so entierly unrelated.
Correct the base address and length, which should have no functional impact on Linux users, because PAS loader does not use this address space at all.
--- arch/arm64/boot/dts/qcom/sm6115.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/sm6115.dtsi +2 -2
@@ -2310,9 +2310,9 @@ }; }; - remoteproc_adsp: remoteproc@ab00000 { + remoteproc_adsp: remoteproc@a400000 { compatible = "qcom,sm6115-adsp-pas"; - reg = <0x0 0x0ab00000 0x0 0x100>; + reg = <0x0 0x0a400000 0x0 0x4040>; interrupts-extended = <&intc GIC_SPI 282 IRQ_TYPE_EDGE_RISING>, <&adsp_smp2p_in 0 IRQ_TYPE_EDGE_RISING>,
Greg Kroah-Hartman
maintainerPATCH 175/273 arm64: dts: qcom: sm6350: Fix ADSP memory length
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit b0805a864459a29831577d2a47165afebe338faf upstream.
The address space in ADSP (Peripheral Authentication Service) remoteproc node should point to the QDSP PUB address space (QDSP6...SS_PUB) which has a length of 0x10000.
This should have no functional impact on Linux users, because PAS loader does not use this address space at all.
--- arch/arm64/boot/dts/qcom/sm6350.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm6350.dtsi +1 -1
@@ -1259,7 +1259,7 @@ adsp: remoteproc@3000000 { compatible = "qcom,sm6350-adsp-pas"; - reg = <0 0x03000000 0 0x100>; + reg = <0x0 0x03000000 0x0 0x10000>; interrupts-extended = <&pdc 6 IRQ_TYPE_LEVEL_HIGH>, <&smp2p_adsp_in 0 IRQ_TYPE_EDGE_RISING>,
Greg Kroah-Hartman
maintainerPATCH 176/273 arm64: dts: qcom: sm6350: Fix MPSS memory length
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit cd8d83de9cc9ecfb1f9a12bc838041c4eb4d10bd upstream.
The address space in MPSS/Modem PAS (Peripheral Authentication Service) remoteproc node should point to the QDSP PUB address space (QDSP6...SS_PUB) which has a length of 0x10000. Value of 0x4040 was copied from older DTS, but it grew since then.
This should have no functional impact on Linux users, because PAS loader does not use this address space at all.
--- arch/arm64/boot/dts/qcom/sm6350.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm6350.dtsi +1 -1
@@ -1480,7 +1480,7 @@ mpss: remoteproc@4080000 { compatible = "qcom,sm6350-mpss-pas"; - reg = <0x0 0x04080000 0x0 0x4040>; + reg = <0x0 0x04080000 0x0 0x10000>; interrupts-extended = <&intc GIC_SPI 136 IRQ_TYPE_EDGE_RISING>, <&modem_smp2p_in 0 IRQ_TYPE_EDGE_RISING>,
Greg Kroah-Hartman
maintainerPATCH 177/273 arm64: dts: qcom: sm6350: Fix uart1 interconnect path
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luca Weiss <[email protected]>
commit be2f81eaa2c8e81d3de5b73dca5e133f63384cb3 upstream.
The path MASTER_QUP_0 to SLAVE_EBI_CH0 would be qup-memory path and not qup-config. Since the qup-memory path is not part of the qcom,geni-uart bindings, just replace that path with the correct path for qup-config.
--- arch/arm64/boot/dts/qcom/sm6350.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm6350.dtsi +1 -1
@@ -935,7 +935,7 @@ power-domains = <&rpmhpd SM6350_CX>; operating-points-v2 = <&qup_opp_table>; interconnects = <&clk_virt MASTER_QUP_CORE_0 0 &clk_virt SLAVE_QUP_CORE_0 0>, - <&aggre1_noc MASTER_QUP_0 0 &clk_virt SLAVE_EBI_CH0 0>; + <&gem_noc MASTER_AMPSS_M0 0 &config_noc SLAVE_QUP_0 0>; interconnect-names = "qup-core", "qup-config"; status = "disabled"; };
Greg Kroah-Hartman
maintainerPATCH 178/273 arm64: dts: qcom: sm6375: Fix ADSP memory length
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit bf4dda83da27b7efc49326ebb82cbd8b3e637c38 upstream.
The address space in ADSP (Peripheral Authentication Service) remoteproc node should point to the QDSP PUB address space (QDSP6...SS_PUB) which has a length of 0x10000.
This should have no functional impact on Linux users, because PAS loader does not use this address space at all.
--- arch/arm64/boot/dts/qcom/sm6375.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm6375.dtsi +1 -1
@@ -1514,7 +1514,7 @@ remoteproc_adsp: remoteproc@a400000 { compatible = "qcom,sm6375-adsp-pas"; - reg = <0 0x0a400000 0 0x100>; + reg = <0 0x0a400000 0 0x10000>; interrupts-extended = <&intc GIC_SPI 282 IRQ_TYPE_LEVEL_HIGH>, <&smp2p_adsp_in 0 IRQ_TYPE_EDGE_RISING>,
Greg Kroah-Hartman
maintainerPATCH 179/273 arm64: dts: qcom: sm6375: Fix CDSP memory base and length
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit c9f7f341e896836c99709421a23bae5f53039aab upstream.
The address space in CDSP PAS (Peripheral Authentication Service) remoteproc node should point to the QDSP PUB address space (QDSP6...SS_PUB): 0x0b30_0000 with length of 0x10000.
0x0b00_0000, value used so far, is the main region of CDSP.
Correct the base address and length, which should have no functional impact on Linux users, because PAS loader does not use this address space at all.
--- arch/arm64/boot/dts/qcom/sm6375.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/sm6375.dtsi +2 -2
@@ -1550,9 +1550,9 @@ }; }; - remoteproc_cdsp: remoteproc@b000000 { + remoteproc_cdsp: remoteproc@b300000 { compatible = "qcom,sm6375-cdsp-pas"; - reg = <0x0 0x0b000000 0x0 0x100000>; + reg = <0x0 0x0b300000 0x0 0x10000>; interrupts-extended = <&intc GIC_SPI 265 IRQ_TYPE_EDGE_RISING>, <&smp2p_cdsp_in 0 IRQ_TYPE_EDGE_RISING>,
Greg Kroah-Hartman
maintainerPATCH 180/273 arm64: dts: qcom: sm6375: Fix MPSS memory base and length
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 918e71ba0c08c3d609ad69067854b0f675c4a253 upstream.
The address space in MPSS/Modem PAS (Peripheral Authentication Service) remoteproc node should point to the QDSP PUB address space (QDSP6...SS_PUB): 0x0608_0000 with length of 0x10000.
0x0600_0000, value used so far, is the main region of Modem.
Correct the base address and length, which should have no functional impact on Linux users, because PAS loader does not use this address space at all.
--- arch/arm64/boot/dts/qcom/sm6375.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/sm6375.dtsi +2 -2
@@ -1471,9 +1471,9 @@ #power-domain-cells = <1>; }; - remoteproc_mss: remoteproc@6000000 { + remoteproc_mss: remoteproc@6080000 { compatible = "qcom,sm6375-mpss-pas"; - reg = <0 0x06000000 0 0x4040>; + reg = <0x0 0x06080000 0x0 0x10000>; interrupts-extended = <&intc GIC_SPI 307 IRQ_TYPE_EDGE_RISING>, <&smp2p_modem_in 0 IRQ_TYPE_EDGE_RISING>,
Greg Kroah-Hartman
maintainerPATCH 181/273 arm64: dts: qcom: sm8350: Fix ADSP memory base and length
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit f9ba85566ddd5a3db8fa291aaecd70c4e55a3732 upstream.
The address space in ADSP PAS (Peripheral Authentication Service) remoteproc node should point to the QDSP PUB address space (QDSP6...SS_PUB): 0x0300_0000 with length of 0x10000. 0x1730_0000, value used so far, was copied from downstream DTS, is in the middle of unused space and downstream DTS describes the PIL loader, which is a bit different interface.
Assume existing value (thus downstream DTS) is not really describing the intended ADSP PAS region.
Correct the base address and length, which also moves the node to different place to keep things sorted by unit address. The diff looks big, but only the unit address and "reg" property were changed. This should have no functional impact on Linux users, because PAS loader does not use this address space at all.
--- arch/arm64/boot/dts/qcom/sm8350.dtsi | 272 +++++++++++++++++------------------ 1 file changed, 136 insertions(+), 136 deletions(-)
arch/arm64/boot/dts/qcom/sm8350.dtsi +136 -136
@@ -1819,6 +1819,142 @@ #hwlock-cells = <1>; }; + adsp: remoteproc@3000000 { + compatible = "qcom,sm8350-adsp-pas"; + reg = <0x0 0x03000000 0x0 0x10000>; + + interrupts-extended = <&pdc 6 IRQ_TYPE_EDGE_RISING>, + <&smp2p_adsp_in 0 IRQ_TYPE_EDGE_RISING>, + <&smp2p_adsp_in 1 IRQ_TYPE_EDGE_RISING>, + <&smp2p_adsp_in 2 IRQ_TYPE_EDGE_RISING>, + <&smp2p_adsp_in 3 IRQ_TYPE_EDGE_RISING>; + interrupt-names = "wdog", "fatal", "ready", + "handover", "stop-ack"; + + clocks = <&rpmhcc RPMH_CXO_CLK>; + clock-names = "xo"; + + power-domains = <&rpmhpd RPMHPD_LCX>, + <&rpmhpd RPMHPD_LMX>; + power-domain-names = "lcx", "lmx"; + + memory-region = <&pil_adsp_mem>; + + qcom,qmp = <&aoss_qmp>; + + qcom,smem-states = <&smp2p_adsp_out 0>; + qcom,smem-state-names = "stop"; + + status = "disabled"; + + glink-edge { + interrupts-extended = <&ipcc IPCC_CLIENT_LPASS + IPCC_MPROC_SIGNAL_GLINK_QMP + IRQ_TYPE_EDGE_RISING>; + mboxes = <&ipcc IPCC_CLIENT_LPASS + IPCC_MPROC_SIGNAL_GLINK_QMP>; + + label = "lpass"; + qcom,remote-pid = <2>; + + apr { + compatible = "qcom,apr-v2"; + qcom,glink-channels = "apr_audio_svc"; + qcom,domain = <APR_DOMAIN_ADSP>; + #address-cells = <1>; + #size-cells = <0>; + + service@3 { + reg = <APR_SVC_ADSP_CORE>; + compatible = "qcom,q6core"; + qcom,protection-domain = "avs/audio", "msm/adsp/audio_pd"; + }; + + q6afe: service@4 { + compatible = "qcom,q6afe"; + reg = <APR_SVC_AFE>; + qcom,protection-domain = "avs/audio", "msm/adsp/audio_pd"; + + q6afedai: dais { + compatible = "qcom,q6afe-dais"; + #address-cells = <1>; + #size-cells = <0>; + #sound-dai-cells = <1>; + }; + + q6afecc: clock-controller { + compatible = "qcom,q6afe-clocks"; + #clock-cells = <2>; + }; + }; + + q6asm: service@7 { + compatible = "qcom,q6asm"; + reg = <APR_SVC_ASM>; + qcom,protection-domain = "avs/audio", "msm/adsp/audio_pd"; + + q6asmdai: dais { + compatible = "qcom,q6asm-dais"; + #address-cells = <1>; + #size-cells = <0>; + #sound-dai-cells = <1>; + iommus = <&apps_smmu 0x1801 0x0>; + + dai@0 { + reg = <0>; + }; + + dai@1 { + reg = <1>; + }; + + dai@2 { + reg = <2>; + }; + }; + }; + + q6adm: service@8 { + compatible = "qcom,q6adm"; + reg = <APR_SVC_ADM>; + qcom,protection-domain = "avs/audio", "msm/adsp/audio_pd"; + + q6routing: routing { + compatible = "qcom,q6adm-routing"; + #sound-dai-cells = <0>; + }; + }; + }; + + fastrpc { + compatible = "qcom,fastrpc"; + qcom,glink-channels = "fastrpcglink-apps-dsp"; + label = "adsp"; + qcom,non-secure-domain; + #address-cells = <1>; + #size-cells = <0>; + + compute-cb@3 { + compatible = "qcom,fastrpc-compute-cb"; + reg = <3>; + iommus = <&apps_smmu 0x1803 0x0>; + }; + + compute-cb@4 { + compatible = "qcom,fastrpc-compute-cb"; + reg = <4>; + iommus = <&apps_smmu 0x1804 0x0>; + }; + + compute-cb@5 { + compatible = "qcom,fastrpc-compute-cb"; + reg = <5>; + iommus = <&apps_smmu 0x1805 0x0>; + }; + }; + }; + }; + lpass_tlmm: pinctrl@33c0000 { compatible = "qcom,sm8350-lpass-lpi-pinctrl"; reg = <0 0x033c0000 0 0x20000>,
@@ -3204,142 +3340,6 @@ <GIC_SPI 707 IRQ_TYPE_LEVEL_HIGH>; }; - adsp: remoteproc@17300000 { - compatible = "qcom,sm8350-adsp-pas"; - reg = <0 0x17300000 0 0x100>; - - interrupts-extended = <&pdc 6 IRQ_TYPE_EDGE_RISING>, - <&smp2p_adsp_in 0 IRQ_TYPE_EDGE_RISING>, - <&smp2p_adsp_in 1 IRQ_TYPE_EDGE_RISING>, - <&smp2p_adsp_in 2 IRQ_TYPE_EDGE_RISING>, - <&smp2p_adsp_in 3 IRQ_TYPE_EDGE_RISING>; - interrupt-names = "wdog", "fatal", "ready", - "handover", "stop-ack"; - - clocks = <&rpmhcc RPMH_CXO_CLK>; - clock-names = "xo"; - - power-domains = <&rpmhpd RPMHPD_LCX>, - <&rpmhpd RPMHPD_LMX>; - power-domain-names = "lcx", "lmx"; - - memory-region = <&pil_adsp_mem>; - - qcom,qmp = <&aoss_qmp>; - - qcom,smem-states = <&smp2p_adsp_out 0>; - qcom,smem-state-names = "stop"; - - status = "disabled"; - - glink-edge { - interrupts-extended = <&ipcc IPCC_CLIENT_LPASS - IPCC_MPROC_SIGNAL_GLINK_QMP - IRQ_TYPE_EDGE_RISING>; - mboxes = <&ipcc IPCC_CLIENT_LPASS - IPCC_MPROC_SIGNAL_GLINK_QMP>; - - label = "lpass"; - qcom,remote-pid = <2>; - - apr { - compatible = "qcom,apr-v2"; - qcom,glink-channels = "apr_audio_svc"; - qcom,domain = <APR_DOMAIN_ADSP>; - #address-cells = <1>; - #size-cells = <0>; - - service@3 { - reg = <APR_SVC_ADSP_CORE>; - compatible = "qcom,q6core"; - qcom,protection-domain = "avs/audio", "msm/adsp/audio_pd"; - }; - - q6afe: service@4 { - compatible = "qcom,q6afe"; - reg = <APR_SVC_AFE>; - qcom,protection-domain = "avs/audio", "msm/adsp/audio_pd"; - - q6afedai: dais { - compatible = "qcom,q6afe-dais"; - #address-cells = <1>; - #size-cells = <0>; - #sound-dai-cells = <1>; - }; - - q6afecc: clock-controller { - compatible = "qcom,q6afe-clocks"; - #clock-cells = <2>; - }; - }; - - q6asm: service@7 { - compatible = "qcom,q6asm"; - reg = <APR_SVC_ASM>; - qcom,protection-domain = "avs/audio", "msm/adsp/audio_pd"; - - q6asmdai: dais { - compatible = "qcom,q6asm-dais"; - #address-cells = <1>; - #size-cells = <0>; - #sound-dai-cells = <1>; - iommus = <&apps_smmu 0x1801 0x0>; - - dai@0 { - reg = <0>; - }; - - dai@1 { - reg = <1>; - }; - - dai@2 { - reg = <2>; - }; - }; - }; - - q6adm: service@8 { - compatible = "qcom,q6adm"; - reg = <APR_SVC_ADM>; - qcom,protection-domain = "avs/audio", "msm/adsp/audio_pd"; - - q6routing: routing { - compatible = "qcom,q6adm-routing"; - #sound-dai-cells = <0>; - }; - }; - }; - - fastrpc { - compatible = "qcom,fastrpc"; - qcom,glink-channels = "fastrpcglink-apps-dsp"; - label = "adsp"; - qcom,non-secure-domain; - #address-cells = <1>; - #size-cells = <0>; - - compute-cb@3 { - compatible = "qcom,fastrpc-compute-cb"; - reg = <3>; - iommus = <&apps_smmu 0x1803 0x0>; - }; - - compute-cb@4 { - compatible = "qcom,fastrpc-compute-cb"; - reg = <4>; - iommus = <&apps_smmu 0x1804 0x0>; - }; - - compute-cb@5 { - compatible = "qcom,fastrpc-compute-cb"; - reg = <5>; - iommus = <&apps_smmu 0x1805 0x0>; - }; - }; - }; - }; - intc: interrupt-controller@17a00000 { compatible = "arm,gic-v3"; #interrupt-cells = <3>;
Greg Kroah-Hartman
maintainerPATCH 182/273 arm64: dts: qcom: sm8350: Fix CDSP memory base and length
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit f4afd8ba453b6e82245b9068868c72c831aec84e upstream.
The address space in CDSP PAS (Peripheral Authentication Service) remoteproc node should point to the QDSP PUB address space (QDSP6...SS_PUB): 0x0a30_0000 with length of 0x10000. 0x9890_0000, value used so far, was copied from downstream DTS, is in the middle of RAM/DDR space and downstream DTS describes the PIL loader, which is a bit different interface. Datasheet says that one of the main CDSP address spaces is 0x0980_0000, which is oddly similar to 0x9890_0000, but quite different.
Assume existing value (thus downstream DTS) is not really describing the intended CDSP PAS region.
Correct the base address and length, which also moves the node to different place to keep things sorted by unit address. The diff looks big, but only the unit address and "reg" property were changed. This should have no functional impact on Linux users, because PAS loader does not use this address space at all.
--- arch/arm64/boot/dts/qcom/sm8350.dtsi | 218 +++++++++++++++++------------------ 1 file changed, 109 insertions(+), 109 deletions(-)
arch/arm64/boot/dts/qcom/sm8350.dtsi +109 -109
@@ -2435,6 +2435,115 @@ qcom,bcm-voters = <&apps_bcm_voter>; }; + cdsp: remoteproc@a300000 { + compatible = "qcom,sm8350-cdsp-pas"; + reg = <0x0 0x0a300000 0x0 0x10000>; + + interrupts-extended = <&intc GIC_SPI 578 IRQ_TYPE_EDGE_RISING>, + <&smp2p_cdsp_in 0 IRQ_TYPE_EDGE_RISING>, + <&smp2p_cdsp_in 1 IRQ_TYPE_EDGE_RISING>, + <&smp2p_cdsp_in 2 IRQ_TYPE_EDGE_RISING>, + <&smp2p_cdsp_in 3 IRQ_TYPE_EDGE_RISING>; + interrupt-names = "wdog", "fatal", "ready", + "handover", "stop-ack"; + + clocks = <&rpmhcc RPMH_CXO_CLK>; + clock-names = "xo"; + + power-domains = <&rpmhpd RPMHPD_CX>, + <&rpmhpd RPMHPD_MXC>; + power-domain-names = "cx", "mxc"; + + interconnects = <&compute_noc MASTER_CDSP_PROC 0 &mc_virt SLAVE_EBI1 0>; + + memory-region = <&pil_cdsp_mem>; + + qcom,qmp = <&aoss_qmp>; + + qcom,smem-states = <&smp2p_cdsp_out 0>; + qcom,smem-state-names = "stop"; + + status = "disabled"; + + glink-edge { + interrupts-extended = <&ipcc IPCC_CLIENT_CDSP + IPCC_MPROC_SIGNAL_GLINK_QMP + IRQ_TYPE_EDGE_RISING>; + mboxes = <&ipcc IPCC_CLIENT_CDSP + IPCC_MPROC_SIGNAL_GLINK_QMP>; + + label = "cdsp"; + qcom,remote-pid = <5>; + + fastrpc { + compatible = "qcom,fastrpc"; + qcom,glink-channels = "fastrpcglink-apps-dsp"; + label = "cdsp"; + qcom,non-secure-domain; + #address-cells = <1>; + #size-cells = <0>; + + compute-cb@1 { + compatible = "qcom,fastrpc-compute-cb"; + reg = <1>; + iommus = <&apps_smmu 0x2161 0x0400>, + <&apps_smmu 0x1181 0x0420>; + }; + + compute-cb@2 { + compatible = "qcom,fastrpc-compute-cb"; + reg = <2>; + iommus = <&apps_smmu 0x2162 0x0400>, + <&apps_smmu 0x1182 0x0420>; + }; + + compute-cb@3 { + compatible = "qcom,fastrpc-compute-cb"; + reg = <3>; + iommus = <&apps_smmu 0x2163 0x0400>, + <&apps_smmu 0x1183 0x0420>; + }; + + compute-cb@4 { + compatible = "qcom,fastrpc-compute-cb"; + reg = <4>; + iommus = <&apps_smmu 0x2164 0x0400>, + <&apps_smmu 0x1184 0x0420>; + }; + + compute-cb@5 { + compatible = "qcom,fastrpc-compute-cb"; + reg = <5>; + iommus = <&apps_smmu 0x2165 0x0400>, + <&apps_smmu 0x1185 0x0420>; + }; + + compute-cb@6 { + compatible = "qcom,fastrpc-compute-cb"; + reg = <6>; + iommus = <&apps_smmu 0x2166 0x0400>, + <&apps_smmu 0x1186 0x0420>; + }; + + compute-cb@7 { + compatible = "qcom,fastrpc-compute-cb"; + reg = <7>; + iommus = <&apps_smmu 0x2167 0x0400>, + <&apps_smmu 0x1187 0x0420>; + }; + + compute-cb@8 { + compatible = "qcom,fastrpc-compute-cb"; + reg = <8>; + iommus = <&apps_smmu 0x2168 0x0400>, + <&apps_smmu 0x1188 0x0420>; + }; + + /* note: secure cb9 in downstream */ + }; + }; + }; + usb_1: usb@a6f8800 { compatible = "qcom,sm8350-dwc3", "qcom,dwc3"; reg = <0 0x0a6f8800 0 0x400>;
@@ -3508,115 +3617,6 @@ #freq-domain-cells = <1>; #clock-cells = <1>; }; - - cdsp: remoteproc@98900000 { - compatible = "qcom,sm8350-cdsp-pas"; - reg = <0 0x98900000 0 0x1400000>; - - interrupts-extended = <&intc GIC_SPI 578 IRQ_TYPE_EDGE_RISING>, - <&smp2p_cdsp_in 0 IRQ_TYPE_EDGE_RISING>, - <&smp2p_cdsp_in 1 IRQ_TYPE_EDGE_RISING>, - <&smp2p_cdsp_in 2 IRQ_TYPE_EDGE_RISING>, - <&smp2p_cdsp_in 3 IRQ_TYPE_EDGE_RISING>; - interrupt-names = "wdog", "fatal", "ready", - "handover", "stop-ack"; - - clocks = <&rpmhcc RPMH_CXO_CLK>; - clock-names = "xo"; - - power-domains = <&rpmhpd RPMHPD_CX>, - <&rpmhpd RPMHPD_MXC>; - power-domain-names = "cx", "mxc"; - - interconnects = <&compute_noc MASTER_CDSP_PROC 0 &mc_virt SLAVE_EBI1 0>; - - memory-region = <&pil_cdsp_mem>; - - qcom,qmp = <&aoss_qmp>; - - qcom,smem-states = <&smp2p_cdsp_out 0>; - qcom,smem-state-names = "stop"; - - status = "disabled"; - - glink-edge { - interrupts-extended = <&ipcc IPCC_CLIENT_CDSP - IPCC_MPROC_SIGNAL_GLINK_QMP - IRQ_TYPE_EDGE_RISING>; - mboxes = <&ipcc IPCC_CLIENT_CDSP - IPCC_MPROC_SIGNAL_GLINK_QMP>; - - label = "cdsp"; - qcom,remote-pid = <5>; - - fastrpc { - compatible = "qcom,fastrpc"; - qcom,glink-channels = "fastrpcglink-apps-dsp"; - label = "cdsp"; - qcom,non-secure-domain; - #address-cells = <1>; - #size-cells = <0>; - - compute-cb@1 { - compatible = "qcom,fastrpc-compute-cb"; - reg = <1>; - iommus = <&apps_smmu 0x2161 0x0400>, - <&apps_smmu 0x1181 0x0420>; - }; - - compute-cb@2 { - compatible = "qcom,fastrpc-compute-cb"; - reg = <2>; - iommus = <&apps_smmu 0x2162 0x0400>, - <&apps_smmu 0x1182 0x0420>; - }; - - compute-cb@3 { - compatible = "qcom,fastrpc-compute-cb"; - reg = <3>; - iommus = <&apps_smmu 0x2163 0x0400>, - <&apps_smmu 0x1183 0x0420>; - }; - - compute-cb@4 { - compatible = "qcom,fastrpc-compute-cb"; - reg = <4>; - iommus = <&apps_smmu 0x2164 0x0400>, - <&apps_smmu 0x1184 0x0420>; - }; - - compute-cb@5 { - compatible = "qcom,fastrpc-compute-cb"; - reg = <5>; - iommus = <&apps_smmu 0x2165 0x0400>, - <&apps_smmu 0x1185 0x0420>; - }; - - compute-cb@6 { - compatible = "qcom,fastrpc-compute-cb"; - reg = <6>; - iommus = <&apps_smmu 0x2166 0x0400>, - <&apps_smmu 0x1186 0x0420>; - }; - - compute-cb@7 { - compatible = "qcom,fastrpc-compute-cb"; - reg = <7>; - iommus = <&apps_smmu 0x2167 0x0400>, - <&apps_smmu 0x1187 0x0420>; - }; - - compute-cb@8 { - compatible = "qcom,fastrpc-compute-cb"; - reg = <8>; - iommus = <&apps_smmu 0x2168 0x0400>, - <&apps_smmu 0x1188 0x0420>; - }; - - /* note: secure cb9 in downstream */ - }; - }; - }; }; thermal_zones: thermal-zones {
Greg Kroah-Hartman
maintainerPATCH 183/273 arm64: dts: qcom: sm8350: Fix MPSS memory length
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit da1937dec9cd986e685b6a429b528a4cbc7b1603 upstream.
The address space in MPSS/Modem PAS (Peripheral Authentication Service) remoteproc node should point to the QDSP PUB address space (QDSP6...SS_PUB) which has a length of 0x10000. Value of 0x4040 was copied from older DTS, but it grew since then.
This should have no functional impact on Linux users, because PAS loader does not use this address space at all.
--- arch/arm64/boot/dts/qcom/sm8350.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm8350.dtsi +1 -1
@@ -2156,7 +2156,7 @@ mpss: remoteproc@4080000 { compatible = "qcom,sm8350-mpss-pas"; - reg = <0x0 0x04080000 0x0 0x4040>; + reg = <0x0 0x04080000 0x0 0x10000>; interrupts-extended = <&intc GIC_SPI 264 IRQ_TYPE_EDGE_RISING>, <&smp2p_modem_in 0 IRQ_TYPE_EDGE_RISING>,
Greg Kroah-Hartman
maintainerPATCH 184/273 arm64: dts: qcom: sm8450: Fix CDSP memory length
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 3751fe2cba2a9fba2204ef62102bc4bb027cec7b upstream.
The address space in CDSP PAS (Peripheral Authentication Service) remoteproc node should point to the QDSP PUB address space (QDSP6...SS_PUB) which has a length of 0x10000. Value of 0x1400000 was copied from older DTS, but it does not look accurate at all.
This should have no functional impact on Linux users, because PAS loader does not use this address space at all.
--- arch/arm64/boot/dts/qcom/sm8450.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm8450.dtsi +1 -1
@@ -2475,7 +2475,7 @@ remoteproc_cdsp: remoteproc@32300000 { compatible = "qcom,sm8450-cdsp-pas"; - reg = <0 0x32300000 0 0x1400000>; + reg = <0 0x32300000 0 0x10000>; interrupts-extended = <&intc GIC_SPI 578 IRQ_TYPE_EDGE_RISING>, <&smp2p_cdsp_in 0 IRQ_TYPE_EDGE_RISING>,
Greg Kroah-Hartman
maintainerPATCH 185/273 arm64: dts: qcom: sm8450: Fix MPSS memory length
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit fa6442e87ab7c4a58c0b5fc64aab1aacc8034712 upstream.
The address space in MPSS/Modem PAS (Peripheral Authentication Service) remoteproc node should point to the QDSP PUB address space (QDSP6...SS_PUB) which has a length of 0x10000. Value of 0x4040 was copied from older DTS, but it grew since then.
This should have no functional impact on Linux users, because PAS loader does not use this address space at all.
--- arch/arm64/boot/dts/qcom/sm8450.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm8450.dtsi +1 -1
@@ -2581,7 +2581,7 @@ remoteproc_mpss: remoteproc@4080000 { compatible = "qcom,sm8450-mpss-pas"; - reg = <0x0 0x04080000 0x0 0x4040>; + reg = <0x0 0x04080000 0x0 0x10000>; interrupts-extended = <&intc GIC_SPI 264 IRQ_TYPE_EDGE_RISING>, <&smp2p_modem_in 0 IRQ_TYPE_EDGE_RISING>,
Greg Kroah-Hartman
maintainerPATCH 186/273 arm64: dts: qcom: sm8550: Fix CDSP memory length
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 6b2570e1e43e4acd0fcb98c6489736fe1c67b222 upstream.
The address space in CDSP PAS (Peripheral Authentication Service) remoteproc node should point to the QDSP PUB address space (QDSP6...SS_PUB) which has a length of 0x10000. Value of 0x1400000 was copied from older DTS, but it does not look accurate at all.
This should have no functional impact on Linux users, because PAS loader does not use this address space at all.
--- arch/arm64/boot/dts/qcom/sm8550.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm8550.dtsi +1 -1
@@ -4089,7 +4089,7 @@ remoteproc_cdsp: remoteproc@32300000 { compatible = "qcom,sm8550-cdsp-pas"; - reg = <0x0 0x32300000 0x0 0x1400000>; + reg = <0x0 0x32300000 0x0 0x10000>; interrupts-extended = <&intc GIC_SPI 578 IRQ_TYPE_EDGE_RISING>, <&smp2p_cdsp_in 0 IRQ_TYPE_EDGE_RISING>,
Greg Kroah-Hartman
maintainerPATCH 187/273 arm64: dts: qcom: sm8550: Fix MPSS memory length
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 8ef227e93a513d431f9345f23cd4d2d65607b985 upstream.
The address space in MPSS/Modem PAS (Peripheral Authentication Service) remoteproc node should point to the QDSP PUB address space (QDSP6...SS_PUB) which has a length of 0x10000. Value of 0x4040 was copied from older DTS, but it grew since then.
This should have no functional impact on Linux users, because PAS loader does not use this address space at all.
--- arch/arm64/boot/dts/qcom/sm8550.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm8550.dtsi +1 -1
@@ -1986,7 +1986,7 @@ remoteproc_mpss: remoteproc@4080000 { compatible = "qcom,sm8550-mpss-pas"; - reg = <0x0 0x04080000 0x0 0x4040>; + reg = <0x0 0x04080000 0x0 0x10000>; interrupts-extended = <&intc GIC_SPI 264 IRQ_TYPE_EDGE_RISING>, <&smp2p_modem_in 0 IRQ_TYPE_EDGE_RISING>,
Greg Kroah-Hartman
maintainerPATCH 188/273 arm64: dts: qcom: sm8550: correct MDSS interconnects
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
commit b8591df49cde459e3b84cdc0517d7bf92053d244 upstream.
SM8550 lists two interconnects for the display subsystem, mdp0-mem (between MDP and LLCC) and mdp1-mem (between LLCC and EBI, memory). The second interconnect is a misuse. mdpN-mem paths should be used for several outboud MDP interconnects rather than the path between LLCC and memory. This kind of misuse can result in bandwidth underflows, possibly degrading picture quality as the required memory bandwidth is divided between all mdpN-mem paths (and LLCC-EBI should not be a part of such division).
Drop the second path and use direct MDP-EBI path for mdp0-mem until we support separate MDP-LLCC and LLCC-EBI paths.
--- arch/arm64/boot/dts/qcom/sm8550.dtsi | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/qcom/sm8550.dtsi +2 -3
@@ -2448,9 +2448,8 @@ power-domains = <&dispcc MDSS_GDSC>; - interconnects = <&mmss_noc MASTER_MDP 0 &gem_noc SLAVE_LLCC 0>, - <&mc_virt MASTER_LLCC 0 &mc_virt SLAVE_EBI1 0>; - interconnect-names = "mdp0-mem", "mdp1-mem"; + interconnects = <&mmss_noc MASTER_MDP 0 &mc_virt SLAVE_EBI1 0>; + interconnect-names = "mdp0-mem"; iommus = <&apps_smmu 0x1c00 0x2>;
Greg Kroah-Hartman
maintainerPATCH 189/273 crypto: qce - fix priority to be less than ARMv8 CE
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 49b9258b05b97c6464e1964b6a2fddb3ddb65d17 upstream.
As QCE is an order of magnitude slower than the ARMv8 Crypto Extensions on the CPU, and is also less well tested, give it a lower priority. Previously the QCE SHA algorithms had higher priority than the ARMv8 CE equivalents, and the ciphers such as AES-XTS had the same priority which meant the QCE versions were chosen if they happened to be loaded later.
--- drivers/crypto/qce/aead.c | 2 +- drivers/crypto/qce/sha.c | 2 +- drivers/crypto/qce/skcipher.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/crypto/qce/aead.c +1 -1
@@ -786,7 +786,7 @@ static int qce_aead_register_one(const s alg->init = qce_aead_init; alg->exit = qce_aead_exit; - alg->base.cra_priority =300 ; + alg->base.cra_priority =275 ; alg->base.cra_flags =CRYPTO_ALG_ASYNC |CRYPTO_ALG_ALLOCATES_MEMORY | CRYPTO_ALG_KERN_DRIVER_ONLY |
drivers/crypto/qce/sha.c +1 -1
@@ -482,7 +482,7 @@ static int qce_ahash_register_one(const base = &alg->halg.base; base->cra_blocksize = def->blocksize; - base->cra_priority =300 ; + base->cra_priority =175 ; base->cra_flags =CRYPTO_ALG_ASYNC |CRYPTO_ALG_KERN_DRIVER_ONLY ; base->cra_ctxsize =sizeof (struct qce_sha_ctx ); base->cra_alignmask =0 ;
drivers/crypto/qce/skcipher.c +1 -1
@@ -461,7 +461,7 @@ static int qce_skcipher_register_one(con alg->encrypt = qce_skcipher_encrypt; alg->decrypt = qce_skcipher_decrypt; - alg->base.cra_priority =300 ; + alg->base.cra_priority =275 ; alg->base.cra_flags =CRYPTO_ALG_ASYNC |CRYPTO_ALG_ALLOCATES_MEMORY |CRYPTO_ALG_KERN_DRIVER_ONLY ;
Greg Kroah-Hartman
maintainerPATCH 190/273 arm64: tegra: Fix typo in Tegra234 dce-fabric compatible
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sumit Gupta <[email protected]>
commit 604120fd9e9df50ee0e803d3c6e77a1f45d2c58e upstream.
The compatible string for the Tegra DCE fabric is currently defined as 'nvidia,tegra234-sce-fabric' but this is incorrect because this is the compatible string for SCE fabric. Update the compatible for the DCE fabric to correct the compatible string.
This compatible needs to be correct in order for the interconnect to catch things such as improper data accesses.
--- arch/arm64/boot/dts/nvidia/tegra234.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/nvidia/tegra234.dtsi +1 -1
@@ -1889,7 +1889,7 @@ }; dce-fabric@de00000 { - compatible = "nvidia,tegra234-sce-fabric"; + compatible = "nvidia,tegra234-dce-fabric"; reg = <0x0 0xde00000 0x0 0x40000>; interrupts = <GIC_SPI 381 IRQ_TYPE_LEVEL_HIGH>; status = "okay";
Greg Kroah-Hartman
maintainerPATCH 191/273 arm64: tegra: Disable Tegra234 sce-fabric node
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sumit Gupta <[email protected]>
commit a5e6fc0a10fe280989f1367a3b4f8047c7d00ea6 upstream.
Access to safety cluster engine (SCE) fabric registers was blocked by firewall after the introduction of Functional Safety Island in Tegra234. After that, any access by software to SCE registers is correctly resulting in the internal bus error. However, when CPUs try accessing the SCE-fabric registers to print error info, another firewall error occurs as the fabric registers are also firewall protected. This results in a second error to be printed. Disable the SCE fabric node to avoid printing the misleading error. The first error info will be printed by the interrupt from the fabric causing the actual access.
--- arch/arm64/boot/dts/nvidia/tegra234.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/nvidia/tegra234.dtsi +1 -1
@@ -1709,7 +1709,7 @@ compatible = "nvidia,tegra234-sce-fabric"; reg = <0x0 0xb600000 0x0 0x40000>; interrupts = <GIC_SPI 173 IRQ_TYPE_LEVEL_HIGH>; - status = "okay"; + status = "disabled"; }; rce-fabric@be00000 {
Greg Kroah-Hartman
maintainerPATCH 192/273 pwm: microchip-core: fix incorrect comparison with max period
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Conor Dooley <[email protected]>
commit 752b6e3af374460a2de18f0c10bfa06bf844dbe8 upstream.
In mchp_core_pwm_apply_locked(), if hw_period_steps is equal to its max, an error is reported and .apply fails. The max value is actually a permitted value however, and so this check can fail where multiple channels are enabled.
For example, the first channel to be configured requests a period that sets hw_period_steps to the maximum value, and when a second channel is enabled the driver reads hw_period_steps back from the hardware and finds it to be the maximum possible value, triggering the warning on a permitted value. The value to be avoided is 255 (PERIOD_STEPS_MAX + 1), as that will produce undesired behaviour, so test for greater than, rather than equal to.
--- drivers/pwm/pwm-microchip-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pwm/pwm-microchip-core.c +1 -1
@@ -328,7 +328,7 @@ static int mchp_core_pwm_apply_locked(st* mchp_core_pwm_calc_period(). * The period is locked and we cannot change this, so we abort. */ -if (hw_period_steps ==MCHPCOREPWM_PERIOD_STEPS_MAX ) +if (hw_period_steps >MCHPCOREPWM_PERIOD_STEPS_MAX )return -EINVAL ; prescale = hw_prescale;
Greg Kroah-Hartman
maintainerPATCH 193/273 xfs: Propagate errors from xfs_reflink_cancel_cow_range in xfs_dax_write_iomap_end
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
commit fb95897b8c60653805aa09daec575ca30983f768 upstream.
In xfs_dax_write_iomap_end(), directly return the result of xfs_reflink_cancel_cow_range() when !written, ensuring proper error propagation and improving code robustness.
--- fs/xfs/xfs_iomap.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
fs/xfs/xfs_iomap.c +2 -4
@@ -923,10 +923,8 @@ xfs_dax_write_iomap_end(if (!xfs_is_cow_inode (ip))return 0 ; -if (!written) { -xfs_reflink_cancel_cow_range (ip, pos, length, true); -return 0 ; - } +if (!written) +return xfs_reflink_cancel_cow_range (ip, pos, length, true);return xfs_reflink_end_cow (ip, pos, written); }
Greg Kroah-Hartman
maintainerPATCH 194/273 xfs: Add error handling for xfs_reflink_cancel_cow_range
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wentao Liang <[email protected]>
commit 26b63bee2f6e711c5a169997fd126fddcfb90848 upstream.
In xfs_inactive(), xfs_reflink_cancel_cow_range() is called without error handling, risking unnoticed failures and inconsistent behavior compared to other parts of the code.
Fix this issue by adding an error handling for the xfs_reflink_cancel_cow_range(), improving code robustness.
--- fs/xfs/xfs_inode.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/xfs/xfs_inode.c +5 -2
@@ -1738,8 +1738,11 @@ xfs_inactive( goto out;/* Try to clean out the cow blocks if there are any. */ -if (xfs_inode_has_cow_data (ip)) -xfs_reflink_cancel_cow_range (ip,0 ,NULLFILEOFF , true); +if (xfs_inode_has_cow_data (ip)) { + error =xfs_reflink_cancel_cow_range (ip,0 ,NULLFILEOFF , true); +if (error) + goto out; + }if (VFS_I (ip)->i_nlink !=0 ) {/*
Greg Kroah-Hartman
maintainerPATCH 195/273 ACPI: PRM: Remove unnecessary strict handler address checks
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aubrey Li <[email protected]>
commit 7f5704b6a143b8eca640cba820968e798d065e91 upstream.
Commit 088984c8d54c ("ACPI: PRM: Find EFI_MEMORY_RUNTIME block for PRM handler and context") added unnecessary strict handler address checks, causing the PRM module to fail in translating memory error addresses.
Both static data buffer address and ACPI parameter buffer address may be NULL if they are not needed, as described in section 4.1.2 PRM Handler Information Structure of Platform Runtime Mechanism specification [1].
Here are two examples from real hardware:
----PRMT.dsl----
- staic data address is not used
[10Ch 0268 2] Revision : 0000
[10Eh 0270 2] Length : 002C
[110h 0272 16] Handler GUID : F6A58D47-E04F-4F5A-86B8-2A50D4AA109B
[120h 0288 8] Handler address : 0000000065CE51F4 [128h 0296 8] Satic Data Address : 0000000000000000 [130h 0304 8] ACPI Parameter Address : 000000006522A718
- ACPI parameter address is not used
[1B0h 0432 2] Revision : 0000
[1B2h 0434 2] Length : 002C
[1B4h 0436 16] Handler GUID : 657E8AE6-A8FC-4877-BB28-42E7DE1899A5
[1C4h 0452 8] Handler address : 0000000065C567C8 [1CCh 0460 8] Satic Data Address : 000000006113FB98 [1D4h 0468 8] ACPI Parameter Address : 0000000000000000
--- drivers/acpi/prmt.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/acpi/prmt.c +1 -3
@@ -263,9 +263,7 @@ static acpi_status acpi_platformrt_spaceif (!handler || !module) goto invalid_guid; -if (!handler->handler_addr || - !handler->static_data_buffer_addr || - !handler->acpi_param_buffer_addr) { +if (!handler->handler_addr) { buffer->prm_status =PRM_HANDLER_ERROR ;return AE_OK ; }
Greg Kroah-Hartman
maintainerPATCH 196/273 tpm: Change to kvalloc() in eventlog/acpi.c
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jarkko Sakkinen <[email protected]>
commit a3a860bc0fd6c07332e4911cf9a238d20de90173 upstream.
The following failure was reported on HPE ProLiant D320:
[ 10.693310][ T1] tpm_tis STM0925:00: 2.0 TPM (device-id 0x3, rev-id 0) [ 10.848132][ T1] ------------[ cut here ]------------ [ 10.853559][ T1] WARNING: CPU: 59 PID: 1 at mm/page_alloc.c:4727 __alloc_pages_noprof+0x2ca/0x330 [ 10.862827][ T1] Modules linked in: [ 10.866671][ T1] CPU: 59 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.12.0-lp155.2.g52785e2-default #1 openSUSE Tumbleweed (unreleased) 588cd98293a7c9eba9013378d807364c088c9375 [ 10.882741][ T1] Hardware name: HPE ProLiant DL320 Gen12/ProLiant DL320 Gen12, BIOS 1.20 10/28/2024 [ 10.892170][ T1] RIP: 0010:__alloc_pages_noprof+0x2ca/0x330 [ 10.898103][ T1] Code: 24 08 e9 4a fe ff ff e8 34 36 fa ff e9 88 fe ff ff 83 fe 0a 0f 86 b3 fd ff ff 80 3d 01 e7 ce 01 00 75 09 c6 05 f8 e6 ce 01 01 <0f> 0b 45 31 ff e9 e5 fe ff ff f7 c2 00 00 08 00 75 42 89 d9 80 e1 [ 10.917750][ T1] RSP: 0000:ffffb7cf40077980 EFLAGS: 00010246 [ 10.923777][ T1] RAX: 0000000000000000 RBX: 0000000000040cc0 RCX: 0000000000000000 [ 10.931727][ T1] RDX: 0000000000000000 RSI: 000000000000000c RDI: 0000000000040cc0
The above transcript shows that ACPI pointed a 16 MiB buffer for the log events because RSI maps to the 'order' parameter of __alloc_pages_noprof(). Address the bug by moving from devm_kmalloc() to devm_add_action() and kvmalloc() and devm_add_action().
--- drivers/char/tpm/eventlog/acpi.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/char/tpm/eventlog/acpi.c +13 -2
@@ -63,6 +63,11 @@ static bool tpm_is_tpm2_log(void *bios_ereturn n ==0 ; } +static void tpm_bios_log_free (void *data) +{ +kvfree (data); +} +/* read binary bios log */ int tpm_read_log_acpi (struct tpm_chip *chip) {
@@ -136,7 +141,7 @@ int tpm_read_log_acpi(struct tpm_chip *c }/* malloc EventLog space */ - log->bios_event_log =devm_kmalloc (&chip->dev, len,GFP_KERNEL ); + log->bios_event_log =kvmalloc (len,GFP_KERNEL );if (!log->bios_event_log)return -ENOMEM ;
@@ -162,10 +167,16 @@ int tpm_read_log_acpi(struct tpm_chip *c goto err; } + ret =devm_add_action (&chip->dev, tpm_bios_log_free, log->bios_event_log); +if (ret) { + log->bios_event_log =NULL ; + goto err; + } +return format; err: -devm_kfree (&chip->dev, log->bios_event_log); +tpm_bios_log_free (log->bios_event_log); log->bios_event_log =NULL ;return ret; }
Greg Kroah-Hartman
maintainerPATCH 197/273 Reset per-task monitors also for idle tasks
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabriele Monaco <[email protected]>
commit 8259cb14a70680553d5e82d65d1302fe589e9b39 upstream.
RV per-task monitors are implemented through a monitor structure available for each task_struct. This structure is reset every time the monitor is (re-)started, to avoid inconsistencies if the monitor was activated previously.
To do so, we reset the monitor on all threads using the macro for_each_process_thread. However, this macro excludes the idle tasks on each CPU. Idle tasks could be considered tasks on their own right and it should be up to the model whether to ignore them or not.
Reset monitors also on the idle tasks for each present CPU whenever we reset all per-task monitors.
--- include/rv/da_monitor.h | 4 ++++ 1 file changed, 4 insertions(+)
include/rv/da_monitor.h +4 -0
@@ -14,6 +14,7 @@#include <rv/automata.h> #include <linux/rv.h> #include <linux/bug.h> +#include <linux/sched.h> #ifdef CONFIG_RV_REACTORS
@@ -324,10 +325,13 @@ static inline struct da_monitor *da_get_ static void da_monitor_reset_all_##name(void) \ { \ struct task_struct *g, *p; \ + int cpu; \ \ read_lock(&tasklist_lock); \ for_each_process_thread(g, p) \ da_monitor_reset_##name(da_get_monitor_##name(p)); \ + for_each_present_cpu(cpu) \ + da_monitor_reset_##name(da_get_monitor_##name(idle_task(cpu))); \ read_unlock(&tasklist_lock); \ } \ \
Greg Kroah-Hartman
maintainerPATCH 198/273 kfence: skip __GFP_THISNODE allocations on NUMA systems
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marco Elver <[email protected]>
commit e64f81946adf68cd75e2207dd9a51668348a4af8 upstream.
On NUMA systems, __GFP_THISNODE indicates that an allocation _must_ be on a particular node, and failure to allocate on the desired node will result in a failed allocation.
Skip __GFP_THISNODE allocations if we are running on a NUMA system, since KFENCE can't guarantee which node its pool pages are allocated on.
--- mm/kfence/core.c | 2 ++ 1 file changed, 2 insertions(+)
mm/kfence/core.c +2 -0
@@ -21,6 +21,7 @@#include <linux/log2.h> #include <linux/memblock.h> #include <linux/moduleparam.h> +#include <linux/nodemask.h> #include <linux/notifier.h> #include <linux/panic_notifier.h> #include <linux/random.h>
@@ -1065,6 +1066,7 @@ void *__kfence_alloc(struct kmem_cache ** properties (e.g. reside in DMAable memory). */ if ((flags &GFP_ZONEMASK ) || + ((flags & __GFP_THISNODE) &&num_online_nodes () >1 ) || (s->flags & (SLAB_CACHE_DMA |SLAB_CACHE_DMA32 ))) {atomic_long_inc (&counters[KFENCE_COUNTER_SKIP_INCOMPAT ]);return NULL ;
Greg Kroah-Hartman
maintainerPATCH 199/273 media: ccs: Clean up parsed CCS static data on parse failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sakari Ailus <[email protected]>
commit da73efa8e675a2b58f1c7ae61201acfe57714bf7 upstream.
ccs_data_parse() releases the allocated in-memory data structure when the parser fails, but it does not clean up parsed metadata that is there to help access the actual data. Do that, in order to return the data structure in a sane state.
--- drivers/media/i2c/ccs/ccs-data.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/media/i2c/ccs/ccs-data.c +7 -5
@@ -10,6 +10,7 @@#include <linux/limits.h> #include <linux/mm.h> #include <linux/slab.h> +#include <linux/string.h> #include "ccs-data-defs.h"
@@ -948,15 +949,15 @@ int ccs_data_parse(struct ccs_data_conta rval =__ccs_data_parse (&bin, ccsdata, data, len, dev, verbose);if (rval) -return rval; + goto out_cleanup; rval =bin_backing_alloc (&bin);if (rval) -return rval; + goto out_cleanup; rval =__ccs_data_parse (&bin, ccsdata, data, len, dev, false);if (rval) - goto out_free; + goto out_cleanup;if (verbose && ccsdata->version)print_ccs_data_version (dev, ccsdata->version);
@@ -965,15 +966,16 @@ int ccs_data_parse(struct ccs_data_conta rval = -EPROTO ;dev_dbg (dev,"parsing mismatch; base %p; now %p; end %p\n" , bin.base, bin.now, bin.end); - goto out_free; + goto out_cleanup; } ccsdata->backing = bin.base;return 0 ; -out_free: +out_cleanup:kvfree (bin.base); +memset (ccsdata,0 ,sizeof (*ccsdata));return rval; }
Greg Kroah-Hartman
maintainerPATCH 200/273 iio: light: as73211: fix channel handling in only-color triggered buffer
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit ab09c6cfe01b317f515bcd944668697241a54b9d upstream.
The channel index is off by one unit if AS73211_SCAN_MASK_ALL is not set (optimized path for color channel readings), and it must be shifted instead of leaving an empty channel for the temperature when it is off.
Once the channel index is fixed, the uninitialized channel must be set to zero to avoid pushing uninitialized data.
Add available_scan_masks for all channels and only-color channels to let the IIO core demux and repack the enabled channels.
--- drivers/iio/light/as73211.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-)
drivers/iio/light/as73211.c +20 -4
@@ -154,6 +154,12 @@ struct as73211_data { BIT(AS73211_SCAN_INDEX_TEMP) | \ AS73211_SCAN_MASK_COLOR) +static const unsigned long as73211_scan_masks[] = { +AS73211_SCAN_MASK_COLOR , +AS73211_SCAN_MASK_ALL , +0 +}; +static const struct iio_chan_spec as73211_channels[] = { { .type =IIO_TEMP ,
@@ -602,9 +608,12 @@ static irqreturn_t as73211_trigger_handl/* AS73211 starts reading at address 2 */ ret =i2c_master_recv (data->client, - (char *)&scan.chan[1 ],3 *sizeof (scan.chan[1 ])); + (char *)&scan.chan[0 ],3 *sizeof (scan.chan[0 ]));if (ret <0 ) goto done; + +/* Avoid pushing uninitialized data */ + scan.chan[3 ] =0 ; }if (data_result) {
@@ -612,9 +621,15 @@ static irqreturn_t as73211_trigger_handl* Saturate all channels (in case of overflows). Temperature channel * is not affected by overflows. */ - scan.chan[1 ] =cpu_to_le16 (U16_MAX ); - scan.chan[2 ] =cpu_to_le16 (U16_MAX ); - scan.chan[3 ] =cpu_to_le16 (U16_MAX ); +if (*indio_dev->active_scan_mask ==AS73211_SCAN_MASK_ALL ) { + scan.chan[1 ] =cpu_to_le16 (U16_MAX ); + scan.chan[2 ] =cpu_to_le16 (U16_MAX ); + scan.chan[3 ] =cpu_to_le16 (U16_MAX ); + }else { + scan.chan[0 ] =cpu_to_le16 (U16_MAX ); + scan.chan[1 ] =cpu_to_le16 (U16_MAX ); + scan.chan[2 ] =cpu_to_le16 (U16_MAX ); + } }iio_push_to_buffers_with_timestamp (indio_dev, &scan,iio_get_time_ns (indio_dev));
@@ -684,6 +699,7 @@ static int as73211_probe(struct i2c_clie indio_dev->channels = as73211_channels; indio_dev->num_channels =ARRAY_SIZE (as73211_channels); indio_dev->modes =INDIO_DIRECT_MODE ; + indio_dev->available_scan_masks = as73211_scan_masks; ret =i2c_smbus_read_byte_data (data->client,AS73211_REG_OSR );if (ret <0 )
Greg Kroah-Hartman
maintainerPATCH 201/273 soc: mediatek: mtk-devapc: Fix leaking IO map on error paths
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit c0eb059a4575ed57f265d9883a5203799c19982c upstream.
Error paths of mtk_devapc_probe() should unmap the memory. Reported by Smatch:
drivers/soc/mediatek/mtk-devapc.c:292 mtk_devapc_probe() warn: 'ctx->infra_base' from of_iomap() not released on lines: 277,281,286.
--- drivers/soc/mediatek/mtk-devapc.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
drivers/soc/mediatek/mtk-devapc.c +13 -5
@@ -273,23 +273,31 @@ static int mtk_devapc_probe(struct platfreturn -EINVAL ; devapc_irq =irq_of_parse_and_map (node,0 ); -if (!devapc_irq) -return -EINVAL ; +if (!devapc_irq) { + ret = -EINVAL ; + goto err; + } ctx->infra_clk =devm_clk_get_enabled (&pdev->dev,"devapc-infra-clock" ); -if (IS_ERR (ctx->infra_clk)) -return -EINVAL ; +if (IS_ERR (ctx->infra_clk)) { + ret = -EINVAL ; + goto err; + } ret =devm_request_irq (&pdev->dev, devapc_irq, devapc_violation_irq,IRQF_TRIGGER_NONE ,"devapc" , ctx);if (ret) -return ret; + goto err;platform_set_drvdata (pdev, ctx);start_devapc (ctx);return 0 ; + +err: +iounmap (ctx->infra_base); +return ret; }static int mtk_devapc_remove (struct platform_device *pdev)
Greg Kroah-Hartman
maintainerPATCH 202/273 soc: qcom: smem_state: fix missing of_node_put in error path
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 70096b4990848229d0784c5e51dc3c7c072f1111 upstream.
If of_parse_phandle_with_args() succeeds, the OF node reference should be dropped, regardless of number of phandle arguments.
--- drivers/soc/qcom/smem_state.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/soc/qcom/smem_state.c +2 -1
@@ -116,7 +116,8 @@ struct qcom_smem_state *qcom_smem_state_if (args.args_count !=1 ) {dev_err (dev,"invalid #qcom,smem-state-cells\n" ); -return ERR_PTR (-EINVAL ); + state =ERR_PTR (-EINVAL ); + goto put; } state =of_node_to_state (args.np);
Greg Kroah-Hartman
maintainerPATCH 203/273 media: mmp: Bring back registration of the device
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lubomir Rintel <[email protected]>
commit fbb5298bf1a7b71723cd2bb193642429ceb0fb84 upstream.
In commit 4af65141e38e ("media: marvell: cafe: Register V4L2 device earlier"), a call to v4l2_device_register() was moved away from mccic_register() into its caller, marvell/cafe's cafe_pci_probe(). This is not the only caller though -- there's also marvell/mmp.
Add v4l2_device_register() into mmpcam_probe() to unbreak the MMP camera driver, in a fashion analogous to what's been done to the Cafe driver. Same for the teardown path.
--- drivers/media/platform/marvell/mmp-driver.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
drivers/media/platform/marvell/mmp-driver.c +17 -4
@@ -231,12 +231,22 @@ static int mmpcam_probe(struct platform_mcam_init_clk (mcam);/* +* Register with V4L. +*/ + + ret =v4l2_device_register (mcam->dev, &mcam->v4l2_dev); +if (ret) +return ret; + +/* * Create a match of the sensor against its OF node. */ ep =fwnode_graph_get_next_endpoint (of_fwnode_handle (pdev->dev.of_node),NULL ); -if (!ep) -return -ENODEV ; +if (!ep) { + ret = -ENODEV ; + goto out_v4l2_device_unregister; + }v4l2_async_nf_init (&mcam->notifier, &mcam->v4l2_dev);
@@ -245,7 +255,7 @@ static int mmpcam_probe(struct platform_fwnode_handle_put (ep);if (IS_ERR (asd)) { ret =PTR_ERR (asd); - goto out; + goto out_v4l2_device_unregister; }/*
@@ -253,7 +263,7 @@ static int mmpcam_probe(struct platform_*/ ret =mccic_register (mcam);if (ret) - goto out; + goto out_v4l2_device_unregister;/* * Add OF clock provider.
@@ -282,6 +292,8 @@ static int mmpcam_probe(struct platform_return 0 ; out:mccic_shutdown (mcam); +out_v4l2_device_unregister: +v4l2_device_unregister (&mcam->v4l2_dev);return ret; }
@@ -292,6 +304,7 @@ static void mmpcam_remove(struct platforstruct mcam_camera *mcam = &cam->mcam;mccic_shutdown (mcam); +v4l2_device_unregister (&mcam->v4l2_dev);pm_runtime_force_suspend (mcam->dev); }
Greg Kroah-Hartman
maintainerPATCH 204/273 media: mc: fix endpoint iteration
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cosmin Tanislav <[email protected]>
commit fb2bd86270cd0ad004f4c614ba4f8c63a5720e25 upstream.
When creating links from a subdev to a sink, the current logic tries to iterate over the endpoints of dev's fwnode.
This might not be correct when the subdev uses a different fwnode compared to the dev's fwnode.
If, when registering, the subdev's fwnode is not set, the code inside v4l2_async_register_subdev will set it to the dev's fwnode.
To fix this, just use the subdev's fwnode.
--- drivers/media/v4l2-core/v4l2-mc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/v4l2-core/v4l2-mc.c +1 -1
@@ -329,7 +329,7 @@ int v4l2_create_fwnode_links_to_pad(struif (!(sink->flags &MEDIA_PAD_FL_SINK ))return -EINVAL ; -fwnode_graph_for_each_endpoint (dev_fwnode (src_sd->dev), endpoint) { +fwnode_graph_for_each_endpoint (src_sd->fwnode, endpoint) {struct fwnode_handle *remote_ep;int src_idx, sink_idx, ret;struct media_pad *src;
Greg Kroah-Hartman
maintainerPATCH 205/273 media: imx296: Add standby delay during probe
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Naushir Patuck <[email protected]>
commit 57d10bcac67707caaa542e09dee86e13ea85defc upstream.
Add a 2-5ms delay when coming out of standby and before reading the sensor info register durning probe, as instructed by the datasheet. This standby delay is already present when the sensor starts streaming.
During a cold-boot, reading the IMX296_SENSOR_INFO register would often return a value of 0x0000, if this delay is not present before.
--- drivers/media/i2c/imx296.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/i2c/imx296.c +2 -0
@@ -960,6 +960,8 @@ static int imx296_identify_model(structreturn ret; } +usleep_range (2000 ,5000 ); + ret =imx296_read (sensor,IMX296_SENSOR_INFO );if (ret <0 ) { dev_err(sensor->dev, "failed to read sensor information (%d)\n",
Greg Kroah-Hartman
maintainerPATCH 206/273 media: ov5640: fix get_light_freq on auto
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sam Bobrowicz <[email protected]>
commit 001d3753538d26ddcbef011f5643cfff58a7f672 upstream.
Light frequency was not properly returned when in auto mode and the detected frequency was 60Hz.
--- drivers/media/i2c/ov5640.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/i2c/ov5640.c +1 -0
@@ -1982,6 +1982,7 @@ static int ov5640_get_light_freq(struct light_freq =50 ; }else {/* 60Hz */ + light_freq =60 ; } }
Greg Kroah-Hartman
maintainerPATCH 207/273 media: ccs: Fix CCS static data parsing for large block sizes
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sakari Ailus <[email protected]>
commit 82b696750f0b60e7513082a10ad42786854f59f8 upstream.
The length field of the CCS static data blocks was mishandled, leading to wrong interpretation of the length header for blocks that are 16 kiB in size. Such large blocks are very, very rare and so this wasn't found earlier.
As the length is used as part of input validation, the issue has no security implications.
--- drivers/media/i2c/ccs/ccs-data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ccs/ccs-data.c +1 -1
@@ -98,7 +98,7 @@ ccs_data_parse_length_specifier(const st plen = ((size_t ) (__len3->length[0 ] & ((1 <<CCS_DATA_LENGTH_SPECIFIER_SIZE_SHIFT ) -1 )) - <<16 ) + (__len3->length[0 ] <<8 ) + __len3->length[1 ]; + <<16 ) + (__len3->length[1 ] <<8 ) + __len3->length[2 ];break ; }default :
Greg Kroah-Hartman
maintainerPATCH 208/273 media: ccs: Fix cleanup order in ccs_probe()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mehdi Djait <[email protected]>
commit 6fdbff0f54786e94f0f630ff200ec1d666b1633e upstream.
ccs_limits is allocated in ccs_read_all_limits() after the allocation of mdata.backing. Ensure that resources are freed in the reverse order of their allocation by moving out_free_ccs_limits up.
--- drivers/media/i2c/ccs/ccs-core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/i2c/ccs/ccs-core.c +3 -3
@@ -3658,15 +3658,15 @@ out_media_entity_cleanup: out_cleanup:ccs_cleanup (sensor); +out_free_ccs_limits: +kfree (sensor->ccs_limits); + out_release_mdata:kvfree (sensor->mdata.backing); out_release_sdata:kvfree (sensor->sdata.backing); -out_free_ccs_limits: -kfree (sensor->ccs_limits); - out_power_off:ccs_power_off (&client->dev);mutex_destroy (&sensor->mutex);
Greg Kroah-Hartman
maintainerPATCH 209/273 media: i2c: ds90ub9x3: Fix extra fwnode_handle_put()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomi Valkeinen <[email protected]>
commit 60b45ece41c5632a3a3274115a401cb244180646 upstream.
The ub913 and ub953 drivers call fwnode_handle_put(priv->sd.fwnode) as part of their remove process, and if the driver is removed multiple times, eventually leads to put "overflow", possibly causing memory corruption or crash.
The fwnode_handle_put() is a leftover from commit 905f88ccebb1 ("media:
i2c: ds90ub9x3: Fix sub-device matching"), which changed the code related to the sd.fwnode, but missed removing these fwnode_handle_put() calls.
--- drivers/media/i2c/ds90ub913.c | 1 - drivers/media/i2c/ds90ub953.c | 1 - 2 files changed, 2 deletions(-)
drivers/media/i2c/ds90ub913.c +0 -1
@@ -792,7 +792,6 @@ static void ub913_subdev_uninit(struct uv4l2_async_unregister_subdev (&priv->sd);ub913_v4l2_nf_unregister (priv);v4l2_subdev_cleanup (&priv->sd); -fwnode_handle_put (priv->sd.fwnode);media_entity_cleanup (&priv->sd.entity); }
drivers/media/i2c/ds90ub953.c +0 -1
@@ -1290,7 +1290,6 @@ static void ub953_subdev_uninit(struct uv4l2_async_unregister_subdev (&priv->sd);ub953_v4l2_notifier_unregister (priv);v4l2_subdev_cleanup (&priv->sd); -fwnode_handle_put (priv->sd.fwnode);media_entity_cleanup (&priv->sd.entity); }
Greg Kroah-Hartman
maintainerPATCH 210/273 media: i2c: ds90ub960: Fix use of non-existing registers on UB9702
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomi Valkeinen <[email protected]>
commit 698cf6df87ffa83f259703e7443c15a4c5ceae86 upstream.
UB9702 doesn't have the registers for SP and EQ. Adjust the code in ub960_rxport_wait_locks() to not use those registers for UB9702. As these values are only used for a debug print here, there's no functional change.
--- drivers/media/i2c/ds90ub960.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
drivers/media/i2c/ds90ub960.c +16 -8
@@ -1577,16 +1577,24 @@ static int ub960_rxport_wait_locks(strucub960_rxport_read16 (priv, nport,UB960_RR_RX_FREQ_HIGH , &v); - ret =ub960_rxport_get_strobe_pos (priv, nport, &strobe_pos); -if (ret) -return ret; +if (priv->hw_data->is_ub9702) { +dev_dbg (dev,"\trx%u: locked, freq %llu Hz\n" , + nport, (v *1000000ULL ) >>8 ); + }else { + ret =ub960_rxport_get_strobe_pos (priv, nport, + &strobe_pos); +if (ret) +return ret; - ret =ub960_rxport_get_eq_level (priv, nport, &eq_level); -if (ret) -return ret; + ret =ub960_rxport_get_eq_level (priv, nport, &eq_level); +if (ret) +return ret; -dev_dbg (dev,"\trx%u: locked, SP: %d, EQ: %u, freq %llu Hz\n" , - nport, strobe_pos, eq_level, (v *1000000ULL ) >>8 ); +dev_dbg (dev, +"\trx%u: locked, SP: %d, EQ: %u, freq %llu Hz\n" , + nport, strobe_pos, eq_level, + (v *1000000ULL ) >>8 ); + } }return 0 ;
Greg Kroah-Hartman
maintainerPATCH 211/273 media: i2c: ds90ub960: Fix UB9702 VC map
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomi Valkeinen <[email protected]>
commit 5dbbd0609b83f6eb72c005e2e5979d0cd25243c8 upstream.
The driver uses a static CSI-2 virtual channel mapping where all virtual channels from an RX port are mapped to a virtual channel number matching the RX port number.
The UB960 and UB9702 have different registers for the purpose, and the UB9702 version is not correct. Each of the VC_ID_MAP registers do not contain a single mapping, as the driver currently thinks, but two.
This can cause received VCs other than 0 to be mapped in a wrong way.
Fix this by writing both mappings to each register.
--- drivers/media/i2c/ds90ub960.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/ds90ub960.c +1 -1
@@ -2534,7 +2534,7 @@ static int ub960_configure_ports_for_strfor (i =0 ; i <8 ; i++)ub960_rxport_write (priv, nport,UB960_RR_VC_ID_MAP (i), - nport); + (nport <<4 ) | nport); }break ;
Greg Kroah-Hartman
maintainerPATCH 212/273 media: i2c: ds90ub960: Fix logging SP & EQ status only for UB9702
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomi Valkeinen <[email protected]>
commit 42d0ec194aa12e9b97f09a94fe565ba2e5f631a2 upstream.
UB9702 does not have SP and EQ registers, but the driver uses them in log_status(). Fix this by separating the SP and EQ related log_status() work into a separate function (for clarity) and calling that function only for UB960.
--- drivers/media/i2c/ds90ub960.c | 90 +++++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 40 deletions(-)
drivers/media/i2c/ds90ub960.c +50 -40
@@ -2956,6 +2956,54 @@ static const struct v4l2_subdev_pad_ops .init_cfg = ub960_init_cfg, }; +static void ub960_log_status_ub960_sp_eq (struct ub960_data *priv, +unsigned int nport) +{ +struct device *dev = &priv->client->dev; +u8 eq_level; +s8 strobe_pos; +u8 v =0 ; + +/* Strobe */ + +ub960_read (priv,UB960_XR_AEQ_CTL1 , &v); + +dev_info (dev,"\t%s strobe\n" , + (v &UB960_XR_AEQ_CTL1_AEQ_SFILTER_EN ) ?"Adaptive" : +"Manual" ); + +if (v &UB960_XR_AEQ_CTL1_AEQ_SFILTER_EN ) { +ub960_read (priv,UB960_XR_SFILTER_CFG , &v); + +dev_info (dev,"\tStrobe range [%d, %d]\n" , + ((v >>UB960_XR_SFILTER_CFG_SFILTER_MIN_SHIFT ) &0xf ) -7 , + ((v >>UB960_XR_SFILTER_CFG_SFILTER_MAX_SHIFT ) &0xf ) -7 ); + } + +ub960_rxport_get_strobe_pos (priv, nport, &strobe_pos); + +dev_info (dev,"\tStrobe pos %d\n" , strobe_pos); + +/* EQ */ + +ub960_rxport_read (priv, nport,UB960_RR_AEQ_BYPASS , &v); + +dev_info (dev,"\t%s EQ\n" , + (v &UB960_RR_AEQ_BYPASS_ENABLE ) ?"Manual" : +"Adaptive" ); + +if (!(v &UB960_RR_AEQ_BYPASS_ENABLE )) { +ub960_rxport_read (priv, nport,UB960_RR_AEQ_MIN_MAX , &v); + +dev_info (dev,"\tEQ range [%u, %u]\n" , + (v >>UB960_RR_AEQ_MIN_MAX_AEQ_FLOOR_SHIFT ) &0xf , + (v >>UB960_RR_AEQ_MIN_MAX_AEQ_MAX_SHIFT ) &0xf ); + } + +if (ub960_rxport_get_eq_level (priv, nport, &eq_level) ==0 ) +dev_info (dev,"\tEQ level %u\n" , eq_level); +} +static int ub960_log_status (struct v4l2_subdev *sd) {struct ub960_data *priv =sd_to_ub960 (sd);
@@ -3003,8 +3051,6 @@ static int ub960_log_status(struct v4l2_for (nport =0 ; nport < priv->hw_data->num_rxports; nport++) {struct ub960_rxport *rxport = priv->rxports[nport]; -u8 eq_level; -s8 strobe_pos;unsigned int i;dev_info (dev,"RX %u\n" , nport);
@@ -3040,44 +3086,8 @@ static int ub960_log_status(struct v4l2_ub960_rxport_read (priv, nport,UB960_RR_CSI_ERR_COUNTER , &v);dev_info (dev,"\tcsi_err_counter %u\n" , v); -/* Strobe */ - -ub960_read (priv,UB960_XR_AEQ_CTL1 , &v); - -dev_info (dev,"\t%s strobe\n" , - (v &UB960_XR_AEQ_CTL1_AEQ_SFILTER_EN ) ?"Adaptive" : -"Manual" ); - -if (v &UB960_XR_AEQ_CTL1_AEQ_SFILTER_EN ) { -ub960_read (priv,UB960_XR_SFILTER_CFG , &v); - -dev_info (dev,"\tStrobe range [%d, %d]\n" , - ((v >>UB960_XR_SFILTER_CFG_SFILTER_MIN_SHIFT ) &0xf ) -7 , - ((v >>UB960_XR_SFILTER_CFG_SFILTER_MAX_SHIFT ) &0xf ) -7 ); - } - -ub960_rxport_get_strobe_pos (priv, nport, &strobe_pos); - -dev_info (dev,"\tStrobe pos %d\n" , strobe_pos); - -/* EQ */ - -ub960_rxport_read (priv, nport,UB960_RR_AEQ_BYPASS , &v); - -dev_info (dev,"\t%s EQ\n" , - (v &UB960_RR_AEQ_BYPASS_ENABLE ) ?"Manual" : -"Adaptive" ); - -if (!(v &UB960_RR_AEQ_BYPASS_ENABLE )) { -ub960_rxport_read (priv, nport,UB960_RR_AEQ_MIN_MAX , &v); - -dev_info (dev,"\tEQ range [%u, %u]\n" , - (v >>UB960_RR_AEQ_MIN_MAX_AEQ_FLOOR_SHIFT ) &0xf , - (v >>UB960_RR_AEQ_MIN_MAX_AEQ_MAX_SHIFT ) &0xf ); - } - -if (ub960_rxport_get_eq_level (priv, nport, &eq_level) ==0 ) -dev_info (dev,"\tEQ level %u\n" , eq_level); +if (!priv->hw_data->is_ub9702) +ub960_log_status_ub960_sp_eq (priv, nport);/* GPIOs */ for (i =0 ; i <UB960_NUM_BC_GPIOS ; i++) {
Greg Kroah-Hartman
maintainerPATCH 213/273 media: uvcvideo: Fix crash during unbind if gpio unit is in use
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
commit a9ea1a3d88b7947ce8cadb2afceee7a54872bbc5 upstream.
We used the wrong device for the device managed functions. We used the usb device, when we should be using the interface device.
If we unbind the driver from the usb interface, the cleanup functions are never called. In our case, the IRQ is never disabled.
If an IRQ is triggered, it will try to access memory sections that are already free, causing an OOPS.
We cannot use the function devm_request_threaded_irq here. The devm_* clean functions may be called after the main structure is released by uvc_delete.
Luckily this bug has small impact, as it is only affected by devices with gpio units and the user has to unbind the device, a disconnect will not trigger this error.
--- drivers/media/usb/uvc/uvc_driver.c | 28 +++++++++++++++++++++------- drivers/media/usb/uvc/uvcvideo.h | 1 + 2 files changed, 22 insertions(+), 7 deletions(-)
drivers/media/usb/uvc/uvc_driver.c +21 -7
@@ -1280,14 +1280,14 @@ static int uvc_gpio_parse(struct uvc_devstruct gpio_desc *gpio_privacy;int irq; - gpio_privacy =devm_gpiod_get_optional (&dev->udev->dev,"privacy" , + gpio_privacy =devm_gpiod_get_optional (&dev->intf->dev,"privacy" ,GPIOD_IN );if (IS_ERR_OR_NULL (gpio_privacy))return PTR_ERR_OR_ZERO (gpio_privacy); irq =gpiod_to_irq (gpio_privacy);if (irq <0 ) -return dev_err_probe (&dev->udev->dev, irq, +return dev_err_probe (&dev->intf->dev, irq,"No IRQ for privacy GPIO\n" ); unit =uvc_alloc_entity (UVC_EXT_GPIO_UNIT ,UVC_EXT_GPIO_UNIT_ID ,0 ,1 );
@@ -1313,15 +1313,27 @@ static int uvc_gpio_parse(struct uvc_devstatic int uvc_gpio_init_irq (struct uvc_device *dev) {struct uvc_entity *unit = dev->gpio_unit; +int ret;if (!unit || unit->gpio.irq <0 )return 0 ; -return devm_request_threaded_irq (&dev->udev->dev, unit->gpio.irq,NULL , - uvc_gpio_irq, -IRQF_ONESHOT |IRQF_TRIGGER_FALLING | -IRQF_TRIGGER_RISING , -"uvc_privacy_gpio" , dev); + ret =request_threaded_irq (unit->gpio.irq,NULL , uvc_gpio_irq, +IRQF_ONESHOT |IRQF_TRIGGER_FALLING | +IRQF_TRIGGER_RISING , +"uvc_privacy_gpio" , dev); + + unit->gpio.initialized = !ret; + +return ret; +} + +static void uvc_gpio_deinit (struct uvc_device *dev) +{ +if (!dev->gpio_unit || !dev->gpio_unit->gpio.initialized) +return ; + +free_irq (dev->gpio_unit->gpio.irq, dev); }/* ------------------------------------------------------------------------
@@ -1918,6 +1930,8 @@ static void uvc_unregister_video(struct {struct uvc_streaming *stream; +uvc_gpio_deinit (dev); +list_for_each_entry (stream, &dev->streams, list) {/* Nothing to do here, continue. */ if (!video_is_registered (&stream->vdev))
drivers/media/usb/uvc/uvcvideo.h +1 -0
@@ -229,6 +229,7 @@ struct uvc_entity {u8 *bmControls;struct gpio_desc *gpio_privacy;int irq; +bool initialized; } gpio; };
Greg Kroah-Hartman
maintainerPATCH 214/273 media: uvcvideo: Fix event flags in uvc_ctrl_send_events
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
commit c31cffd5ae2c3d7ef21d9008977a9d117ce7a64e upstream.
If there is an event that needs the V4L2_EVENT_CTRL_CH_FLAGS flag, all the following events will have that flag, regardless if they need it or not.
This is because we keep using the same variable all the time and we do not reset its original value.
--- drivers/media/usb/uvc/uvc_ctrl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/usb/uvc/uvc_ctrl.c +2 -2
@@ -1626,13 +1626,13 @@ static void uvc_ctrl_send_events(struct {struct uvc_control_mapping *mapping;struct uvc_control *ctrl; -u32 changes =V4L2_EVENT_CTRL_CH_VALUE ;unsigned int i;unsigned int j;for (i =0 ; i < xctrls_count; ++i) { - ctrl =uvc_find_control (handle->chain, xctrls[i].id, &mapping); +u32 changes =V4L2_EVENT_CTRL_CH_VALUE ; + ctrl =uvc_find_control (handle->chain, xctrls[i].id, &mapping);if (ctrl->info.flags &UVC_CTRL_FLAG_ASYNCHRONOUS )/* Notification will be sent from an Interrupt event. */ continue ;
Greg Kroah-Hartman
maintainerPATCH 215/273 media: uvcvideo: Support partial control reads
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
commit f00ee2ca8da25ebccb8e19956d853c9055e2c8d0 upstream.
Some cameras, like the ELMO MX-P3, do not return all the bytes requested from a control if it can fit in less bytes.
Eg: Returning 0xab instead of 0x00ab.
usb 3-9: Failed to query (GET_DEF) UVC control 3 on unit 2: 1 (exp. 2).
Extend the returned value from the camera and return it.
--- drivers/media/usb/uvc/uvc_video.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
drivers/media/usb/uvc/uvc_video.c +21 -0
@@ -79,6 +79,27 @@ int uvc_query_ctrl(struct uvc_device *deif (likely (ret == size))return 0 ; +/* +* Some devices return shorter USB control packets than expected if the +* returned value can fit in less bytes. Zero all the bytes that the +* device has not written. +* +* This quirk is applied to all controls, regardless of their data type. +* Most controls are little-endian integers, in which case the missing +* bytes become 0 MSBs. For other data types, a different heuristic +* could be implemented if a device is found needing it. +* +* We exclude UVC_GET_INFO from the quirk. UVC_GET_LEN does not need +* to be excluded because its size is always 1. +*/ +if (ret >0 && query !=UVC_GET_INFO ) { +memset (data + ret,0 , size - ret); +dev_warn_once (&dev->udev->dev, +"UVC non compliance: %s control %u on unit %u returned %d bytes when we expected %u.\n" , +uvc_query_name (query), cs, unit, ret, size); +return 0 ; + } +if (ret != -EPIPE ) { dev_err(&dev->udev->dev, "Failed to query (%s) UVC control %u on unit %u: %d (exp. %u).\n",
Greg Kroah-Hartman
maintainerPATCH 216/273 media: uvcvideo: Remove redundant NULL assignment
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
commit 04d3398f66d2d31c4b8caea88f051a4257b7a161 upstream.
ctrl->handle will only be different than NULL for controls that have mappings. This is because that assignment is only done inside uvc_ctrl_set() for mapped controls.
--- drivers/media/usb/uvc/uvc_ctrl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/media/usb/uvc/uvc_ctrl.c +1 -3
@@ -1593,10 +1593,8 @@ bool uvc_ctrl_status_event_async(structstruct uvc_device *dev = chain->dev;struct uvc_ctrl_work *w = &dev->async_ctrl; -if (list_empty (&ctrl->info.mappings)) { - ctrl->handle =NULL ; +if (list_empty (&ctrl->info.mappings))return false; - } w->data = data; w->urb = urb;
Greg Kroah-Hartman
maintainerPATCH 217/273 mm: kmemleak: fix upper boundary check for physical address objects
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Catalin Marinas <[email protected]>
commit 488b5b9eca68497b533ced059be5eff19578bbca upstream.
Memblock allocations are registered by kmemleak separately, based on their physical address. During the scanning stage, it checks whether an object is within the min_low_pfn and max_low_pfn boundaries and ignores it otherwise.
With the recent addition of __percpu pointer leak detection (commit 6c99d4eb7c5e ("kmemleak: enable tracking for percpu pointers")), kmemleak started reporting leaks in setup_zone_pageset() and setup_per_cpu_pageset(). These were caused by the node_data[0] object (initialised in alloc_node_data()) ending on the PFN_PHYS(max_low_pfn) boundary. The non-strict upper boundary check introduced by commit 84c326299191 ("mm: kmemleak: check physical address when scan") causes the pg_data_t object to be ignored (not scanned) and the __percpu pointers it contains to be reported as leaks.
Make the max_low_pfn upper boundary check strict when deciding whether to ignore a physical address object and not scan it.
--- mm/kmemleak.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/kmemleak.c +1 -1
@@ -1549,7 +1549,7 @@ static void kmemleak_scan(void)unsigned long phys = object->pointer;if (PHYS_PFN (phys) < min_low_pfn || -PHYS_PFN (phys + object->size) >= max_low_pfn) +PHYS_PFN (phys + object->size) > max_low_pfn)__paint_it (object,KMEMLEAK_BLACK ); }
Greg Kroah-Hartman
maintainerPATCH 218/273 ata: libata-sff: Ensure that we cannot write outside the allocated buffer
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <[email protected]>
commit 6e74e53b34b6dec5a50e1404e2680852ec6768d2 upstream.
reveliofuzzing reported that a SCSI_IOCTL_SEND_COMMAND ioctl with out_len set to 0xd42, SCSI command set to ATA_16 PASS-THROUGH, ATA command set to ATA_NOP, and protocol set to ATA_PROT_PIO, can cause ata_pio_sector() to write outside the allocated buffer, overwriting random memory.
While a ATA device is supposed to abort a ATA_NOP command, there does seem to be a bug either in libata-sff or QEMU, where either this status is not set, or the status is cleared before read by ata_sff_hsm_move(). Anyway, that is most likely a separate bug.
Looking at __atapi_pio_bytes(), it already has a safety check to ensure that __atapi_pio_bytes() cannot write outside the allocated buffer.
Add a similar check to ata_pio_sector(), such that also ata_pio_sector() cannot write outside the allocated buffer.
--- drivers/ata/libata-sff.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/ata/libata-sff.c +10 -8
@@ -602,7 +602,7 @@ static void ata_pio_sector(struct ata_qu {struct ata_port *ap = qc->ap;struct page *page; -unsigned int offset; +unsigned int offset, count;if (!qc->cursg) { qc->curbytes = qc->nbytes;
@@ -618,25 +618,27 @@ static void ata_pio_sector(struct ata_qu page =nth_page (page, (offset >>PAGE_SHIFT )); offset %=PAGE_SIZE ; -trace_ata_sff_pio_transfer_data (qc, offset, qc->sect_size); +/* don't overrun current sg */ + count =min (qc->cursg->length - qc->cursg_ofs, qc->sect_size); + +trace_ata_sff_pio_transfer_data (qc, offset, count);/* * Split the transfer when it splits a page boundary. Note that the * split still has to be dword aligned like all ATA data transfers. */ WARN_ON_ONCE (offset %4 ); -if (offset + qc->sect_size >PAGE_SIZE ) { +if (offset + count >PAGE_SIZE ) {unsigned int split_len =PAGE_SIZE - offset;ata_pio_xfer (qc, page, offset, split_len); -ata_pio_xfer (qc,nth_page (page,1 ),0 , - qc->sect_size - split_len); +ata_pio_xfer (qc,nth_page (page,1 ),0 , count - split_len); }else { -ata_pio_xfer (qc, page, offset, qc->sect_size); +ata_pio_xfer (qc, page, offset, count); } - qc->curbytes += qc->sect_size; - qc->cursg_ofs += qc->sect_size; + qc->curbytes += count; + qc->cursg_ofs += count;if (qc->cursg_ofs == qc->cursg->length) { qc->cursg =sg_next (qc->cursg);
Greg Kroah-Hartman
maintainerPATCH 219/273 crypto: qce - fix goto jump in error path
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartosz Golaszewski <[email protected]>
commit 5278275c1758a38199b43530adfc50098f4b41c7 upstream.
If qce_check_version() fails, we should jump to err_dma as we already called qce_dma_request() a couple lines before.
--- drivers/crypto/qce/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/qce/core.c +1 -1
@@ -247,7 +247,7 @@ static int qce_crypto_probe(struct platf ret =qce_check_version (qce);if (ret) - goto err_clks; + goto err_dma;spin_lock_init (&qce->lock); tasklet_init(&qce->done_tasklet, qce_tasklet_req_done,
Greg Kroah-Hartman
maintainerPATCH 220/273 crypto: qce - unregister previously registered algos in error path
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bartosz Golaszewski <[email protected]>
commit e80cf84b608725303113d6fe98bb727bf7b7a40d upstream.
If we encounter an error when registering alorithms with the crypto framework, we just bail out and don't unregister the ones we successfully registered in prior iterations of the loop.
Add code that goes back over the algos and unregisters them before returning an error from qce_register_algs().
--- drivers/crypto/qce/core.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/crypto/qce/core.c +7 -4
@@ -51,16 +51,19 @@ static void qce_unregister_algs(struct qstatic int qce_register_algs (struct qce_device *qce) {const struct qce_algo_ops *ops; -int i, ret = -ENODEV ; +int i, j, ret = -ENODEV ;for (i =0 ; i <ARRAY_SIZE (qce_ops); i++) { ops = qce_ops[i]; ret = ops->register_algs (qce); -if (ret) -break ; +if (ret) { +for (j = i -1 ; j >=0 ; j--) + ops->unregister_algs (qce); +return ret; + } } -return ret; +return 0 ; }static int qce_handle_request (struct crypto_async_request *async_req)
Greg Kroah-Hartman
maintainerPATCH 221/273 nvmem: qcom-spmi-sdam: Set size in struct nvmem_config
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luca Weiss <[email protected]>
commit e88f516ea417c71bb3702603ac6af9e95338cfa6 upstream.
Let the nvmem core know what size the SDAM is, most notably this fixes the size of /sys/bus/nvmem/devices/spmi_sdam*/nvmem being '0' and makes user space work with that file.
~ # hexdump -C -s 64 /sys/bus/nvmem/devices/spmi_sdam2/nvmem
00000040 02 01 00 00 04 00 00 00 00 00 00 00 00 00 00 00 |................| 00000050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00000080
--- drivers/nvmem/qcom-spmi-sdam.c | 1 + 1 file changed, 1 insertion(+)
drivers/nvmem/qcom-spmi-sdam.c +1 -0
@@ -144,6 +144,7 @@ static int sdam_probe(struct platform_de sdam->sdam_config.owner =THIS_MODULE ; sdam->sdam_config.add_legacy_fixed_of_cells = true; sdam->sdam_config.stride =1 ; + sdam->sdam_config.size = sdam->size; sdam->sdam_config.word_size =1 ; sdam->sdam_config.reg_read = sdam_read; sdam->sdam_config.reg_write = sdam_write;
Greg Kroah-Hartman
maintainerPATCH 222/273 nvmem: core: improve range check for nvmem_cell_write()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jennifer Berringer <[email protected]>
commit 31507fc2ad36e0071751a710449db19c85d82a7f upstream.
When __nvmem_cell_entry_write() is called for an nvmem cell that does not need bit shifting, it requires that the len parameter exactly matches the nvmem cell size. However, when the nvmem cell has a nonzero bit_offset, it was skipping this check.
Accepting values of len larger than the cell size results in nvmem_cell_prepare_write_buffer() trying to write past the end of a heap buffer that it allocates. Add a check to avoid that problem and instead return -EINVAL when len doesn't match the number of bits expected by the nvmem cell when bit_offset is nonzero.
This check uses cell->nbits in order to allow providing the smaller size to cells that are shifted into another byte by bit_offset. For example, a cell with nbits=8 and nonzero bit_offset would have bytes=2 but should accept a 1-byte write here, although no current callers depend on this.
--- drivers/nvmem/core.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/nvmem/core.c +2 -0
@@ -1725,6 +1725,8 @@ static int __nvmem_cell_entry_write(strureturn -EINVAL ;if (cell->bit_offset || cell->nbits) { +if (len !=BITS_TO_BYTES (cell->nbits) && len != cell->bytes) +return -EINVAL ; buf =nvmem_cell_prepare_write_buffer (cell, buf, len);if (IS_ERR (buf))return PTR_ERR (buf);
Greg Kroah-Hartman
maintainerPATCH 223/273 nvmem: imx-ocotp-ele: simplify read beyond device check
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sascha Hauer <[email protected]>
commit 343aa1e289e8e3dba5e3d054c4eb27da7b4e1ecc upstream.
Do the read beyond device check on function entry in bytes instead of 32bit words which is easier to follow.
--- drivers/nvmem/imx-ocotp-ele.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/nvmem/imx-ocotp-ele.c +3 -3
@@ -71,13 +71,13 @@ static int imx_ocotp_reg_read(void *contvoid *p;int i; +if (offset + bytes > priv->data->size) + bytes = priv->data->size - offset; + index = offset; num_bytes =round_up (bytes,4 ); count = num_bytes >>2 ; -if (count > ((priv->data->size >>2 ) - index)) - count = (priv->data->size >>2 ) - index; - p =kzalloc (num_bytes,GFP_KERNEL );if (!p)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 224/273 nvmem: imx-ocotp-ele: fix reading from non zero offset
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sascha Hauer <[email protected]>
commit 3c9e2cb6cecf65f7501004038c5d1ed85fb7db84 upstream.
In imx_ocotp_reg_read() the offset comes in as bytes and not as words. This means we have to divide offset by 4 to get to the correct word offset.
Also the incoming offset might not be word aligned. In order to read from the OCOTP the driver aligns down the previous word boundary and reads from there. This means we have to skip this alignment offset from the temporary buffer when copying the data to the output buffer.
--- drivers/nvmem/imx-ocotp-ele.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/nvmem/imx-ocotp-ele.c +5 -3
@@ -70,12 +70,14 @@ static int imx_ocotp_reg_read(void *contu32 *buf;void *p;int i; +u8 skipbytes;if (offset + bytes > priv->data->size) bytes = priv->data->size - offset; - index = offset; - num_bytes =round_up (bytes,4 ); + index = offset >>2 ; + skipbytes = offset - (index <<2 ); + num_bytes =round_up (bytes + skipbytes,4 ); count = num_bytes >>2 ; p =kzalloc (num_bytes,GFP_KERNEL );
@@ -96,7 +98,7 @@ static int imx_ocotp_reg_read(void *cont *buf++ =readl_relaxed (reg + (i <<2 )); } -memcpy (val, (u8 *)p, bytes); +memcpy (val, ((u8 *)p) + skipbytes, bytes);mutex_unlock (&priv->lock);
Greg Kroah-Hartman
maintainerPATCH 225/273 nvmem: imx-ocotp-ele: set word length to 1
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sascha Hauer <[email protected]>
commit 1b2cb4d0b5b6a9d9fe78470704309ec75f8a1c3a upstream.
The ELE hardware internally has a word length of 4. However, among other things we store MAC addresses in the ELE OCOTP. With a length of 6 bytes these are naturally unaligned to the word length. Therefore we must support unaligned reads in reg_read() and indeed it works properly when reg_read() is called via nvmem_reg_read(). Setting the word size to 4 has the only visible effect that doing unaligned reads from userspace via bin_attr_nvmem_read() do not work because they are rejected by that function.
Given that we have to abstract from word accesses to byte accesses in the driver, set the word size to 1. This allows bytewise accesses from userspace to be able to test what the driver has to support anyway.
--- drivers/nvmem/imx-ocotp-ele.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvmem/imx-ocotp-ele.c +1 -1
@@ -129,7 +129,7 @@ static int imx_ele_ocotp_probe(struct pl priv->config.owner =THIS_MODULE ; priv->config.size = priv->data->size; priv->config.reg_read = priv->data->reg_read; - priv->config.word_size =4 ; + priv->config.word_size =1 ; priv->config.stride =1 ; priv->config.priv = priv; priv->config.read_only = true;
Greg Kroah-Hartman
maintainerPATCH 226/273 io_uring: fix multishots with selected buffers
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
commit d63b0e8a628e62ca85a0f7915230186bb92f8bb4 upstream.
We do io_kbuf_recycle() when arming a poll but every iteration of a multishot can grab more buffers, which is why we need to flush the kbuf ring state before continuing with waiting.
--- io_uring/poll.c | 2 ++ 1 file changed, 2 insertions(+)
io_uring/poll.c +2 -0
@@ -350,8 +350,10 @@ void io_poll_task_func(struct io_kiocb * ret =io_poll_check_events (req, ts);if (ret ==IOU_POLL_NO_ACTION ) { +io_kbuf_recycle (req,0 );return ; }else if (ret ==IOU_POLL_REQUEUE ) { +io_kbuf_recycle (req,0 );__io_poll_execute (req,0 );return ; }
Greg Kroah-Hartman
maintainerPATCH 227/273 io_uring/net: dont retry connect operation on EPOLLERR
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Axboe <[email protected]>
commit 8c8492ca64e79c6e0f433e8c9d2bcbd039ef83d0 upstream.
If a socket is shutdown before the connection completes, POLLERR is set in the poll mask. However, connect ignores this as it doesn't know, and attempts the connection again. This may lead to a bogus -ETIMEDOUT result, where it should have noticed the POLLERR and just returned -ECONNRESET instead.
Have the poll logic check for whether or not POLLERR is set in the mask, and if so, mark the request as failed. Then connect can appropriately fail the request rather than retry it.
--- io_uring/net.c | 5 +++++ io_uring/poll.c | 2 ++ 2 files changed, 7 insertions(+)
io_uring/net.c +5 -0
@@ -1533,6 +1533,11 @@ int io_connect(struct io_kiocb *req, uns io = &__io; } +if (unlikely (req->flags &REQ_F_FAIL )) { + ret = -ECONNRESET ; + goto out; + } + file_flags = force_nonblock ?O_NONBLOCK :0 ; ret = __sys_connect_file(req->file, &io->address,
io_uring/poll.c +2 -0
@@ -308,6 +308,8 @@ static int io_poll_check_events(struct ireturn IOU_POLL_REISSUE ; } } +if (unlikely (req->cqe.res &EPOLLERR )) +req_set_fail (req);if (req->apoll_events &EPOLLONESHOT )return IOU_POLL_DONE ;
Greg Kroah-Hartman
maintainerPATCH 228/273 io_uring: fix io_req_prep_async with provided buffers
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
io_req_prep_async() can import provided buffers, commit the ring state by giving up on that before, it'll be reimported later if needed.
--- io_uring/io_uring.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
io_uring/io_uring.c +4 -1
@@ -1779,6 +1779,7 @@ int io_req_prep_async(struct io_kiocb *r {const struct io_cold_def *cdef = &io_cold_defs[req->opcode];const struct io_issue_def *def = &io_issue_defs[req->opcode]; +int ret;/* assign early for deferred execution for non-fixed file */ if (def->needs_file && !(req->flags &REQ_F_FIXED_FILE ) && !req->file)
@@ -1791,7 +1792,9 @@ int io_req_prep_async(struct io_kiocb *rif (io_alloc_async_data (req))return -EAGAIN ; } -return cdef->prep_async (req); + ret = cdef->prep_async (req); +io_kbuf_recycle (req,0 ); +return ret; }static u32 io_get_sequence (struct io_kiocb *req)
Greg Kroah-Hartman
maintainerPATCH 229/273 io_uring/rw: commit provided buffer state on async
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Begunkov <[email protected]>
When we get -EIOCBQUEUED, we need to ensure that the buffer is consumed from the provided buffer ring, which can be done with io_kbuf_recycle()
+ REQ_F_PARTIAL_IO.
--- io_uring/rw.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
io_uring/rw.c +10 -0
@@ -793,6 +793,8 @@ static int __io_read(struct io_kiocb *re goto done; ret =0 ; }else if (ret == -EIOCBQUEUED ) { + req->flags |=REQ_F_PARTIAL_IO ; +io_kbuf_recycle (req, issue_flags);if (iovec)kfree (iovec);return IOU_ISSUE_SKIP_COMPLETE ;
@@ -816,6 +818,9 @@ static int __io_read(struct io_kiocb *re goto done; } + req->flags |=REQ_F_PARTIAL_IO ; +io_kbuf_recycle (req, issue_flags); + io = req->async_data; s = &io->s;/*
@@ -956,6 +961,11 @@ int io_write(struct io_kiocb *req, unsigelse ret2 = -EINVAL ; +if (ret2 == -EIOCBQUEUED ) { + req->flags |=REQ_F_PARTIAL_IO ; +io_kbuf_recycle (req, issue_flags); + } +if (req->flags &REQ_F_REISSUE ) { req->flags &= ~REQ_F_REISSUE ; ret2 = -EAGAIN ;
Greg Kroah-Hartman
maintainerPATCH 230/273 vfio/platform: check the bounds of read/write syscalls
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Williamson <[email protected]>
commit ce9ff21ea89d191e477a02ad7eabf4f996b80a69 upstream.
count and offset are passed from user space and not checked, only offset is capped to 40 bits, which can be used to read/write out of bounds of the device.
--- drivers/vfio/platform/vfio_platform_common.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/vfio/platform/vfio_platform_common.c +10 -0
@@ -393,6 +393,11 @@ static ssize_t vfio_platform_read_mmio(s count =min_t (size_t, count, reg->size - off); +if (off >= reg->size) +return -EINVAL ; + + count =min_t (size_t, count, reg->size - off); +if (!reg->ioaddr) { reg->ioaddr =ioremap (reg->addr, reg->size);
@@ -474,6 +479,11 @@ static ssize_t vfio_platform_write_mmio(if (off >= reg->size)return -EINVAL ; + + count =min_t (size_t, count, reg->size - off); + +if (off >= reg->size) +return -EINVAL ; count =min_t (size_t, count, reg->size - off);
Greg Kroah-Hartman
maintainerPATCH 231/273 selftests: mptcp: connect: -f: no reconnect
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu Baerts (NGI0) <[email protected]>
commit 5368a67307b3b2c347dc8965ac55b888be665934 upstream.
The '-f' parameter is there to force the kernel to emit MPTCP FASTCLOSE by closing the connection with unread bytes in the receive queue.
The xdisconnect() helper was used to stop the connection, but it does more than that: it will shut it down, then wait before reconnecting to the same address. This causes the mptcp_join's "fastclose test" to fail all the time.
This failure is due to a recent change, with commit 218cc166321f ("selftests: mptcp: avoid spurious errors on disconnect"), but that went unnoticed because the test is currently ignored. The recent modification only shown an existing issue: xdisconnect() doesn't need to be used here, only the shutdown() part is needed.
--- tools/testing/selftests/net/mptcp/mptcp_connect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/mptcp/mptcp_connect.c +1 -1
@@ -1302,7 +1302,7 @@ again:return ret;if (cfg_truncate >0 ) { -xdisconnect (fd); +shutdown (fd,SHUT_WR ); }else if (--cfg_repeat >0 ) {xdisconnect (fd);
Greg Kroah-Hartman
maintainerPATCH 232/273 pnfs/flexfiles: retry getting layout segment for reads
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <[email protected]>
commit eb3fabde15bccdf34f1c9b35a83aa4c0dacbb4ca upstream.
If ff_layout_pg_get_read()'s attempt to get a layout segment results in -EAGAIN have ff_layout_pg_init_read() retry it after sleeping.
If "softerr" mount is used, use 'io_maxretrans' to limit the number of attempts to get a layout segment.
This fixes a long-standing issue of O_DIRECT reads failing with -EAGAIN (11) when using flexfiles Client Side Mirroring (CSM).
--- fs/nfs/flexfilelayout/flexfilelayout.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)
fs/nfs/flexfilelayout/flexfilelayout.c +21 -6
@@ -839,6 +839,9 @@ ff_layout_pg_init_read(struct nfs_pageiostruct nfs4_pnfs_ds *ds;u32 ds_idx; +if (NFS_SERVER (pgio->pg_inode)->flags & + (NFS_MOUNT_SOFT |NFS_MOUNT_SOFTERR )) + pgio->pg_maxretrans = io_maxretrans; retry:ff_layout_pg_check_layout (pgio, req);/* Use full layout for now */
@@ -852,6 +855,8 @@ retry:if (!pgio->pg_lseg) goto out_nolseg; } +/* Reset wb_nio, since getting layout segment was successful */ + req->wb_nio =0 ; ds =ff_layout_get_ds_for_read (pgio, &ds_idx);if (!ds) {
@@ -868,14 +873,24 @@ retry: pgm->pg_bsize = mirror->mirror_ds->ds_versions[0 ].rsize; pgio->pg_mirror_idx = ds_idx; - -if (NFS_SERVER (pgio->pg_inode)->flags & - (NFS_MOUNT_SOFT |NFS_MOUNT_SOFTERR )) - pgio->pg_maxretrans = io_maxretrans;return ; out_nolseg: -if (pgio->pg_error <0 ) -return ; +if (pgio->pg_error <0 ) { +if (pgio->pg_error != -EAGAIN ) +return ; +/* Retry getting layout segment if lower layer returned -EAGAIN */ +if (pgio->pg_maxretrans && req->wb_nio++ > pgio->pg_maxretrans) { +if (NFS_SERVER (pgio->pg_inode)->flags &NFS_MOUNT_SOFTERR ) + pgio->pg_error = -ETIMEDOUT ; +else + pgio->pg_error = -EIO ; +return ; + } + pgio->pg_error =0 ; +/* Sleep for 1 second before retrying */ +ssleep (1 ); + goto retry; + } out_mds: trace_pnfs_mds_fallback_pg_init_read(pgio->pg_inode, 0, NFS4_MAX_UINT64, IOMODE_READ,
Greg Kroah-Hartman
maintainerPATCH 233/273 ocfs2: fix incorrect CPU endianness conversion causing mount failure
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heming Zhao <[email protected]>
commit f921da2c34692dfec5f72b5ae347b1bea22bb369 upstream.
Commit 23aab037106d ("ocfs2: fix UBSAN warning in ocfs2_verify_volume()") introduced a regression bug. The blksz_bits value is already converted to CPU endian in the previous code; therefore, the code shouldn't use le32_to_cpu() anymore.
--- fs/ocfs2/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/super.c +1 -1
@@ -2343,7 +2343,7 @@ static int ocfs2_verify_volume(struct ocmlog (ML_ERROR ,"found superblock with incorrect block " "size bits: found %u, should be 9, 10, 11, or 12\n" , blksz_bits); - }else if ((1 <<le32_to_cpu (blksz_bits)) != blksz) { + }else if ((1 << blksz_bits) != blksz) {mlog (ML_ERROR ,"found superblock with incorrect block " "size: found %u, should be %u\n" ,1 << blksz_bits, blksz); } else if (le16_to_cpu(di->id2.i_super.s_major_rev_level) !=
Greg Kroah-Hartman
maintainerPATCH 234/273 ocfs2: handle a symlink read error correctly
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Wilcox (Oracle) <[email protected]>
commit 2b4c2094da6d84e69b843dd3317902e977bf64bd upstream.
Patch series "Convert ocfs2 to use folios".
Mark did a conversion of ocfs2 to use folios and sent it to me as a giant patch for review ;-)
So I've redone it as individual patches, and credited Mark for the patches where his code is substantially the same. It's not a bad way to do it; his patch had some bugs and my patches had some bugs. Hopefully all our bugs were different from each other. And hopefully Mark likes all the changes I made to his code!
This patch (of 23):
If we can't read the buffer, be sure to unlock the page before returning.
--- fs/ocfs2/symlink.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/ocfs2/symlink.c +3 -2
@@ -65,7 +65,7 @@ static int ocfs2_fast_symlink_read_folioif (status <0 ) {mlog_errno (status); -return status; + goto out; } fe = (struct ocfs2_dinode *) bh->b_data;
@@ -76,9 +76,10 @@ static int ocfs2_fast_symlink_read_foliomemcpy (kaddr, link, len +1 );kunmap_atomic (kaddr);SetPageUptodate (page); +out:unlock_page (page);brelse (bh); -return 0 ; +return status; }const struct address_space_operations ocfs2_fast_symlink_aops = {
Greg Kroah-Hartman
maintainerPATCH 235/273 nilfs2: fix possible int overflows in nilfs_fiemap()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikita Zhandarovich <[email protected]>
commit 6438ef381c183444f7f9d1de18f22661cba1e946 upstream.
Since nilfs_bmap_lookup_contig() in nilfs_fiemap() calculates its result by being prepared to go through potentially maxblocks == INT_MAX blocks, the value in n may experience an overflow caused by left shift of blkbits.
While it is extremely unlikely to occur, play it safe and cast right hand expression to wider type to mitigate the issue.
Found by Linux Verification Center (linuxtesting.org) with static analysis tool SVACE.
--- fs/nilfs2/inode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/nilfs2/inode.c +3 -3
@@ -1267,7 +1267,7 @@ int nilfs_fiemap(struct inode *inode, stif (size) {if (phys && blkphy << blkbits == phys + size) {/* The current extent goes on */ - size += n << blkbits; + size += (u64 )n << blkbits; }else {/* Terminate the current extent */ ret = fiemap_fill_next_extent(
@@ -1280,14 +1280,14 @@ int nilfs_fiemap(struct inode *inode, st flags =FIEMAP_EXTENT_MERGED ; logical = blkoff << blkbits; phys = blkphy << blkbits; - size = n << blkbits; + size = (u64 )n << blkbits; } }else {/* Start a new extent */ flags =FIEMAP_EXTENT_MERGED ; logical = blkoff << blkbits; phys = blkphy << blkbits; - size = n << blkbits; + size = (u64 )n << blkbits; } blkoff += n; }
Greg Kroah-Hartman
maintainerPATCH 236/273 mailbox: tegra-hsp: Clear mailbox before using message
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pekka Pessi <[email protected]>
commit 0b7f8328f988178b55ee11d772a6e1238c04d29d upstream.
The Tegra RCE (Camera) driver expects the mailbox to be empty before processing the IVC messages. On RT kernel, the threads processing the IVC messages (which are invoked after mbox_chan_received_data() is called) may be on a different CPU or running with a higher priority than the HSP interrupt handler thread. This can cause it to act on the message before the mailbox gets cleared in the HSP interrupt handler resulting in a loss of IVC notification.
Fix this by clearing the mailbox data register before calling mbox_chan_received_data().
--- drivers/mailbox/tegra-hsp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/mailbox/tegra-hsp.c +4 -2
@@ -388,7 +388,6 @@ static void tegra_hsp_sm_recv32(struct t value =tegra_hsp_channel_readl (channel,HSP_SM_SHRD_MBOX ); value &= ~HSP_SM_SHRD_MBOX_FULL ; msg = (void *)(unsigned long )value; -mbox_chan_received_data (channel->chan, msg);/* * Need to clear all bits here since some producers, such as TCU, depend
@@ -398,6 +397,8 @@ static void tegra_hsp_sm_recv32(struct t* explicitly, so we have to make sure we cover all possible cases. */ tegra_hsp_channel_writel (channel,0x0 ,HSP_SM_SHRD_MBOX ); + +mbox_chan_received_data (channel->chan, msg); }static const struct tegra_hsp_sm_ops tegra_hsp_sm_32bit_ops = {
@@ -433,7 +434,6 @@ static void tegra_hsp_sm_recv128(struct value[3 ] =tegra_hsp_channel_readl (channel,HSP_SHRD_MBOX_TYPE1_DATA3 ); msg = (void *)(unsigned long )value; -mbox_chan_received_data (channel->chan, msg);/* * Clear data registers and tag.
@@ -443,6 +443,8 @@ static void tegra_hsp_sm_recv128(structtegra_hsp_channel_writel (channel,0x0 ,HSP_SHRD_MBOX_TYPE1_DATA2 );tegra_hsp_channel_writel (channel,0x0 ,HSP_SHRD_MBOX_TYPE1_DATA3 );tegra_hsp_channel_writel (channel,0x0 ,HSP_SHRD_MBOX_TYPE1_TAG ); + +mbox_chan_received_data (channel->chan, msg); }static const struct tegra_hsp_sm_ops tegra_hsp_sm_128bit_ops = {
Greg Kroah-Hartman
maintainerPATCH 237/273 NFC: nci: Add bounds checking in nci_hci_create_pipe()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 110b43ef05342d5a11284cc8b21582b698b4ef1c upstream.
The "pipe" variable is a u8 which comes from the network. If it's more than 127, then it results in memory corruption in the caller, nci_hci_connect_gate().
--- net/nfc/nci/hci.c | 2 ++ 1 file changed, 2 insertions(+)
net/nfc/nci/hci.c +2 -0
@@ -542,6 +542,8 @@ static u8 nci_hci_create_pipe(struct ncipr_debug ("pipe created=%d\n" , pipe); +if (pipe >=NCI_HCI_MAX_PIPES ) + pipe =NCI_HCI_INVALID_PIPE ;return pipe; }
Greg Kroah-Hartman
maintainerPATCH 238/273 i3c: master: Fix missing ret assignment in set_speed()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Li <[email protected]>
commit b266e0d4dac00eecdfaf50ec3f708fd0c3b39637 upstream.
Fix a probe failure in the i3c master driver that occurs when no i3c devices are connected to the bus.
The issue arises in i3c_master_bus_init() where the ret value is not updated after calling master->ops->set_speed(). If no devices are present, ret remains set to I3C_ERROR_M2, causing the code to incorrectly proceed to err_bus_cleanup.
--- drivers/i3c/master.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i3c/master.c +1 -1
@@ -1878,7 +1878,7 @@ static int i3c_master_bus_init(struct i3 goto err_bus_cleanup;if (master->ops->set_speed) { - master->ops->set_speed (master,I3C_OPEN_DRAIN_NORMAL_SPEED ); + ret = master->ops->set_speed (master,I3C_OPEN_DRAIN_NORMAL_SPEED );if (ret) goto err_bus_cleanup; }
Greg Kroah-Hartman
maintainerPATCH 239/273 irqchip/apple-aic: Only handle PMC interrupt as FIQ when configured so
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nick Chan <[email protected]>
commit 698244bbb3bfd32ddf9a0b70a12b1c7d69056497 upstream.
The CPU PMU in Apple SoCs can be configured to fire its interrupt in one of several ways, and since Apple A11 one of the methods is FIQ, but the check of the configuration register fails to test explicitely for FIQ mode. It tests whether the IMODE bitfield is zero or not and the PMCRO_IACT bit is set. That results in false positives when the IMODE bitfield is not zero, but does not have the mode PMCR0_IMODE_FIQ.
Only handle the PMC interrupt as a FIQ when the CPU PMU has been configured to fire FIQs, i.e. the IMODE bitfield value is PMCR0_IMODE_FIQ and PMCR0_IACT is set.
--- drivers/irqchip/irq-apple-aic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/irqchip/irq-apple-aic.c +2 -1
@@ -563,7 +563,8 @@ static void __exception_irq_entry aic_ha AIC_FIQ_HWIRQ(AIC_TMR_EL02_VIRT)); } -if (read_sysreg_s (SYS_IMP_APL_PMCR0_EL1 ) &PMCR0_IACT ) { +if ((read_sysreg_s (SYS_IMP_APL_PMCR0_EL1 ) & (PMCR0_IMODE |PMCR0_IACT )) == + (FIELD_PREP (PMCR0_IMODE ,PMCR0_IMODE_FIQ ) |PMCR0_IACT )) {int irq;if (cpumask_test_cpu (smp_processor_id (), &aic_irqc->fiq_aff[AIC_CPU_PMU_P ]->aff))
Greg Kroah-Hartman
maintainerPATCH 240/273 mtd: onenand: Fix uninitialized retlen in do_otp_read()
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ivan Stepchenko <[email protected]>
commit 70a71f8151b9879b0950668ce3ad76263261fee0 upstream.
The function do_otp_read() does not set the output parameter *retlen, which is expected to contain the number of bytes actually read. As a result, in onenand_otp_walk(), the tmp_retlen variable remains uninitialized after calling do_otp_walk() and used to change the values of the buf, len and retlen variables.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/mtd/nand/onenand/onenand_base.c | 1 + 1 file changed, 1 insertion(+)
drivers/mtd/nand/onenand/onenand_base.c +1 -0
@@ -2923,6 +2923,7 @@ static int do_otp_read(struct mtd_info * ret =ONENAND_IS_4KB_PAGE (this) ?onenand_mlc_read_ops_nolock (mtd, from, &ops) :onenand_read_ops_nolock (mtd, from, &ops); + *retlen = ops.retlen;/* Exit OTP access mode */ this->command (mtd,ONENAND_CMD_RESET ,0 ,0 );
Greg Kroah-Hartman
maintainerPATCH 241/273 misc: misc_minor_alloc to use ida for all dynamic/misc dynamic minors
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vimal Agrawal <[email protected]>
commit 6d04d2b554b14ae6c428a9c60b6c85f1e5c89f68 upstream.
misc_minor_alloc was allocating id using ida for minor only in case of MISC_DYNAMIC_MINOR but misc_minor_free was always freeing ids using ida_free causing a mismatch and following warn:
Quoted 3 lines
Quoted 3 lines
WARNING: CPU: 0 PID: 159 at lib/idr.c:525 ida_free+0x3e0/0x41f
ida_freecalled for id=127 which is not allocated. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
...
Quoted 3 lines
Quoted 3 lines
[<60941eb4>] ida_free+0x3e0/0x41f [<605ac993>] misc_minor_free+0x3e/0xbc [<605acb82>] misc_deregister+0x171/0x1b3
misc_minor_alloc is changed to allocate id from ida for all minors falling in the range of dynamic/ misc dynamic minors
--- drivers/char/misc.c | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-)
drivers/char/misc.c +29 -8
@@ -63,16 +63,30 @@ static DEFINE_MUTEX(misc_mtx);#define DYNAMIC_MINORS 128/* like dynamic majors */ static DEFINE_IDA (misc_minors_ida); -static int misc_minor_alloc (void ) +static int misc_minor_alloc (int minor) { -int ret; +int ret =0 ; - ret =ida_alloc_max (&misc_minors_ida,DYNAMIC_MINORS -1 ,GFP_KERNEL ); -if (ret >=0 ) { - ret =DYNAMIC_MINORS - ret -1 ; +if (minor ==MISC_DYNAMIC_MINOR ) { +/* allocate free id */ + ret =ida_alloc_max (&misc_minors_ida,DYNAMIC_MINORS -1 ,GFP_KERNEL ); +if (ret >=0 ) { + ret =DYNAMIC_MINORS - ret -1 ; + }else { + ret =ida_alloc_range (&misc_minors_ida,MISC_DYNAMIC_MINOR +1 , +MINORMASK ,GFP_KERNEL ); + } }else { - ret =ida_alloc_range (&misc_minors_ida,MISC_DYNAMIC_MINOR +1 , -MINORMASK ,GFP_KERNEL ); +/* specific minor, check if it is in dynamic or misc dynamic range */ +if (minor <DYNAMIC_MINORS ) { + minor =DYNAMIC_MINORS - minor -1 ; + ret =ida_alloc_range (&misc_minors_ida, minor, minor,GFP_KERNEL ); + }else if (minor >MISC_DYNAMIC_MINOR ) { + ret =ida_alloc_range (&misc_minors_ida, minor, minor,GFP_KERNEL ); + }else { +/* case of non-dynamic minors, no need to allocate id */ + ret =0 ; + } }return ret; }
@@ -219,7 +233,7 @@ int misc_register(struct miscdevice *mismutex_lock (&misc_mtx);if (is_dynamic) { -int i =misc_minor_alloc (); +int i =misc_minor_alloc (misc->minor);if (i <0 ) { err = -EBUSY ;
@@ -228,6 +242,7 @@ int misc_register(struct miscdevice *mis misc->minor = i; }else {struct miscdevice *c; +int i;list_for_each_entry (c, &misc_list, list) {if (c->minor == misc->minor) {
@@ -235,6 +250,12 @@ int misc_register(struct miscdevice *mis goto out; } } + + i =misc_minor_alloc (misc->minor); +if (i <0 ) { + err = -EBUSY ; + goto out; + } } dev =MKDEV (MISC_MAJOR , misc->minor);
Greg Kroah-Hartman
maintainerPATCH 242/273 misc: fastrpc: Deregister device nodes properly in error scenarios
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anandu Krishnan E <[email protected]>
commit 637c20002dc8c347001292664055bfbf56544ec6 upstream.
During fastrpc_rpmsg_probe, if secure device node registration succeeds but non-secure device node registration fails, the secure device node deregister is not called during error cleanup. Add proper exit paths to ensure proper cleanup in case of error.
--- drivers/misc/fastrpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/fastrpc.c +1 -1
@@ -2327,7 +2327,7 @@ static int fastrpc_rpmsg_probe(struct rp err =fastrpc_device_register (rdev, data, false, domains[domain_id]);if (err) - goto fdev_error; + goto populate_error;break ;default : err = -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 243/273 misc: fastrpc: Fix registered buffer page address
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ekansh Gupta <[email protected]>
commit 6ca4ea1f88a06a04ed7b2c9c6bf9f00833b68214 upstream.
For registered buffers, fastrpc driver sends the buffer information to remote subsystem. There is a problem with current implementation where the page address is being sent with an offset leading to improper buffer address on DSP. This is leads to functional failures as DSP expects base address in page information and extracts offset information from remote arguments. Mask the offset and pass the base page address to DSP.
This issue is observed is a corner case when some buffer which is registered with fastrpc framework is passed with some offset by user and then the DSP implementation tried to read the data. As DSP expects base address and takes care of offsetting with remote arguments, passing an offsetted address will result in some unexpected data read in DSP.
All generic usecases usually pass the buffer as it is hence is problem is not usually observed. If someone tries to pass offsetted buffer and then tries to compare data at HLOS and DSP end, then the ambiguity will be observed.
--- drivers/misc/fastrpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/fastrpc.c +1 -1
@@ -988,7 +988,7 @@ static int fastrpc_get_args(u32 kernel,mmap_read_lock (current->mm); vma =find_vma (current->mm, ctx->args[i].ptr);if (vma) - pages[i].addr += ctx->args[i].ptr - + pages[i].addr += (ctx->args[i].ptr &PAGE_MASK ) - vma->vm_start;mmap_read_unlock (current->mm);
Greg Kroah-Hartman
maintainerPATCH 244/273 misc: fastrpc: Fix copy buffer page size
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ekansh Gupta <[email protected]>
commit e966eae72762ecfdbdb82627e2cda48845b9dd66 upstream.
For non-registered buffer, fastrpc driver copies the buffer and pass it to the remote subsystem. There is a problem with current implementation of page size calculation which is not considering the offset in the calculation. This might lead to passing of improper and out-of-bounds page size which could result in memory issue. Calculate page start and page end using the offset adjusted address instead of absolute address.
--- drivers/misc/fastrpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/misc/fastrpc.c +2 -2
@@ -1015,8 +1015,8 @@ static int fastrpc_get_args(u32 kernel, (pkt_size - rlen); pages[i].addr = pages[i].addr &PAGE_MASK ; - pg_start = (args &PAGE_MASK ) >>PAGE_SHIFT ; - pg_end = ((args + len -1 ) &PAGE_MASK ) >>PAGE_SHIFT ; + pg_start = (rpra[i].buf.pv &PAGE_MASK ) >>PAGE_SHIFT ; + pg_end = ((rpra[i].buf.pv + len -1 ) &PAGE_MASK ) >>PAGE_SHIFT ; pages[i].size = (pg_end - pg_start +1 ) *PAGE_SIZE ; args = args + mlen; rlen -= mlen;
Greg Kroah-Hartman
maintainerPATCH 245/273 net/ncsi: wait for the last response to Deselect Package before configuring channel
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Fertser <[email protected]>
commit 6bb194d036c6e1b329dcdff459338cdd9a54802a upstream.
The NCSI state machine as it's currently implemented assumes that transition to the next logical state is performed either explicitly by calling schedule_work(&ndp->work) to re-queue itself or implicitly after processing the predefined (ndp->pending_req_num) number of replies. Thus to avoid the configuration FSM from advancing prematurely and getting out of sync with the process it's essential to not skip waiting for a reply.
This patch makes the code wait for reception of the Deselect Package response for the last package probed before proceeding to channel configuration.
Thanks go to Potin Lai and Cosmo Chou for the initial investigation and testing.
--- net/ncsi/ncsi-manage.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
net/ncsi/ncsi-manage.c +7 -6
@@ -1385,6 +1385,12 @@ static void ncsi_probe_channel(struct nc nd->state = ncsi_dev_state_probe_package;break ;case ncsi_dev_state_probe_package: +if (ndp->package_probe_id >=8 ) { +/* Last package probed, finishing */ + ndp->flags |=NCSI_DEV_PROBED ; +break ; + } + ndp->pending_req_num =1 ; nca.type =NCSI_PKT_CMD_SP ;
@@ -1501,13 +1507,8 @@ static void ncsi_probe_channel(struct ncif (ret) goto error; -/* Probe next package */ +/* Probe next package after receiving response */ ndp->package_probe_id++; -if (ndp->package_probe_id >=8 ) { -/* Probe finished */ - ndp->flags |=NCSI_DEV_PROBED ; -break ; - } nd->state = ncsi_dev_state_probe_package; ndp->active_package =NULL ;break ;
Greg Kroah-Hartman
maintainerPATCH 246/273 net: phy: c45-tjaxx: add delay between MDIO write and read in soft_reset
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Milos Reljin <[email protected]>
commit bd1bbab717608757cccbbe08b0d46e6c3ed0ced5 upstream.
In application note (AN13663) for TJA1120, on page 30, there's a figure with average PHY startup timing values following software reset. The time it takes for SMI to become operational after software reset ranges roughly from 500 us to 1500 us.
This commit adds 2000 us delay after MDIO write which triggers software reset. Without this delay, soft_reset function returns an error and prevents successful PHY init.
--- drivers/net/phy/nxp-c45-tja11xx.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/phy/nxp-c45-tja11xx.c +2 -0
@@ -1302,6 +1302,8 @@ static int nxp_c45_soft_reset(struct phyif (ret)return ret; +usleep_range (2000 ,2050 ); + return phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1, VEND1_DEVICE_CONTROL, ret, !(ret & DEVICE_CONTROL_RESET), 20000,
Greg Kroah-Hartman
maintainerPATCH 247/273 maple_tree: simplify split calculation
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Yang <[email protected]>
commit 4f6a6bed0bfef4b966f076f33eb4f5547226056a upstream.
Patch series "simplify split calculation", v3.
This patch (of 3):
The current calculation for splitting nodes tries to enforce a minimum span on the leaf nodes. This code is complex and never worked correctly to begin with, due to the min value being passed as 0 for all leaves.
The calculation should just split the data as equally as possible between the new nodes. Note that b_end will be one more than the data, so the left side is still favoured in the calculation.
The current code may also lead to a deficient node by not leaving enough data for the right side of the split. This issue is also addressed with the split calculation change.
--- lib/maple_tree.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-)
lib/maple_tree.c +6 -17
@@ -1870,11 +1870,11 @@ static inline int mab_no_null_split(stru* Return: The first split location. The middle split is set in @mid_split. */ static inline int mab_calc_split (struct ma_state *mas, -struct maple_big_node *bn,unsigned char *mid_split,unsigned long min) +struct maple_big_node *bn,unsigned char *mid_split) {unsigned char b_end = bn->b_end;int split = b_end /2 ;/* Assume equal split. */ -unsigned char slot_min, slot_count = mt_slots[bn->type]; +unsigned char slot_count = mt_slots[bn->type];/* * To support gap tracking, all NULL entries are kept together and a node cannot
@@ -1907,18 +1907,7 @@ static inline int mab_calc_split(struct split = b_end /3 ; *mid_split = split *2 ; }else { - slot_min = mt_min_slots[bn->type]; - *mid_split =0 ; -/* -* Avoid having a range less than the slot count unless it -* causes one node to be deficient. -* NOTE: mt_min_slots is 1 based, b_end and split are zero. -*/ -while ((split < slot_count -1 ) && - ((bn->pivot[split] - min) < slot_count -1 ) && - (b_end - split > slot_min)) - split++; }/* Avoid ending a node on a NULL entry */
@@ -2402,7 +2391,7 @@ static inline struct maple_enodestatic inline unsigned char mas_mab_to_node (struct ma_state *mas,struct maple_big_node *b_node,struct maple_enode **left,struct maple_enode **right,struct maple_enode **middle, -unsigned char *mid_split,unsigned long min) +unsigned char *mid_split) {unsigned char split =0 ;unsigned char slot_count = mt_slots[b_node->type];
@@ -2415,7 +2404,7 @@ static inline unsigned char mas_mab_to_nif (b_node->b_end < slot_count) { split = b_node->b_end; }else { - split =mab_calc_split (mas, b_node, mid_split, min); + split =mab_calc_split (mas, b_node, mid_split); *right =mas_new_ma_node (mas, b_node); }
@@ -2905,7 +2894,7 @@ static int mas_spanning_rebalance(struct mast->bn->b_end--; mast->bn->type =mte_node_type (mast->orig_l->node); split =mas_mab_to_node (mas, mast->bn, &left, &right, &middle, - &mid_split, mast->orig_l->min); + &mid_split);mast_set_split_parents (mast, left, middle, right, split, mid_split);mast_cp_to_nodes (mast, left, middle, right, split, mid_split);
@@ -3413,7 +3402,7 @@ static int mas_split(struct ma_state *maif (mas_push_data (mas, height, &mast, false))break ; - split =mab_calc_split (mas, b_node, &mid_split, prev_l_mas.min); + split =mab_calc_split (mas, b_node, &mid_split);mast_split_data (&mast, mas, split);/* * Usually correct, mab_mas_cp in the above call overwrites
Greg Kroah-Hartman
maintainerPATCH 248/273 scripts/gdb: fix aarch64 userspace detection in get_current_task
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kiszka <[email protected]>
commit 4ebc417ef9cb34010a71270421fe320ec5d88aa2 upstream.
At least recent gdb releases (seen with 14.2) return SP_EL0 as signed long which lets the right-shift always return 0.
--- scripts/gdb/linux/cpus.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/gdb/linux/cpus.py +1 -1
@@ -172,7 +172,7 @@ def get_current_task(cpu): var_ptr = gdb.parse_and_eval("&pcpu_hot.current_task") return per_cpu(var_ptr, cpu).dereference() elif utils.is_target_arch("aarch64"): - current_task_addr = gdb.parse_and_eval("$SP_EL0") + current_task_addr = gdb.parse_and_eval("(unsigned long)$SP_EL0") if (current_task_addr >> 63) != 0: current_task = current_task_addr.cast(task_ptr_type) return current_task.dereference()
Greg Kroah-Hartman
maintainerPATCH 249/273 tracing/osnoise: Fix resetting of tracepoints
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
commit e3ff4245928f948f3eb2e852aa350b870421c358 upstream.
If a timerlat tracer is started with the osnoise option OSNOISE_WORKLOAD disabled, but then that option is enabled and timerlat is removed, the tracepoints that were enabled on timerlat registration do not get disabled. If the option is disabled again and timelat is started, then it triggers a warning in the tracepoint code due to registering the tracepoint again without ever disabling it.
Do not use the same user space defined options to know to disable the tracepoints when timerlat is removed. Instead, set a global flag when it is enabled and use that flag to know to disable the events.
~# echo NO_OSNOISE_WORKLOAD > /sys/kernel/tracing/osnoise/options ~# echo timerlat > /sys/kernel/tracing/current_tracer ~# echo OSNOISE_WORKLOAD > /sys/kernel/tracing/osnoise/options ~# echo nop > /sys/kernel/tracing/current_tracer
~# echo NO_OSNOISE_WORKLOAD > /sys/kernel/tracing/osnoise/options ~# echo timerlat > /sys/kernel/tracing/current_tracer
Triggers:
------------[ cut here ]------------ WARNING: CPU: 6 PID: 1337 at kernel/tracepoint.c:294 tracepoint_add_func+0x3b6/0x3f0 Modules linked in: CPU: 6 UID: 0 PID: 1337 Comm: rtla Not tainted 6.13.0-rc4-test-00018-ga867c441128e-dirty #73 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 RIP: 0010:tracepoint_add_func+0x3b6/0x3f0 Code: 48 8b 53 28 48 8b 73 20 4c 89 04 24 e8 23 59 11 00 4c 8b 04 24 e9 36 fe ff ff 0f 0b b8 ea ff ff ff 45 84 e4 0f 84 68 fe ff ff <0f> 0b e9 61 fe ff ff 48 8b 7b 18 48 85 ff 0f 84 4f ff ff ff 49 8b RSP: 0018:ffffb9b003a87ca0 EFLAGS: 00010202 RAX: 00000000ffffffef RBX: ffffffff92f30860 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffff9bf59e91ccd0 RDI: ffffffff913b6410 RBP: 000000000000000a R08: 00000000000005c7 R09: 0000000000000002 R10: ffffb9b003a87ce0 R11: 0000000000000002 R12: 0000000000000001 R13: ffffb9b003a87ce0 R14: ffffffffffffffef R15: 0000000000000008 FS: 00007fce81209240(0000) GS:ffff9bf6fdd00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000055e99b728000 CR3: 00000001277c0002 CR4: 0000000000172ef0 Call Trace: <TASK> ? __warn.cold+0xb7/0x14d ? tracepoint_add_func+0x3b6/0x3f0 ? report_bug+0xea/0x170 ? handle_bug+0x58/0x90 ? exc_invalid_op+0x17/0x70 ? asm_exc_invalid_op+0x1a/0x20 ? __pfx_trace_sched_migrate_callback+0x10/0x10 ? tracepoint_add_func+0x3b6/0x3f0 ? __pfx_trace_sched_migrate_callback+0x10/0x10 ? __pfx_trace_sched_migrate_callback+0x10/0x10 tracepoint_probe_register+0x78/0xb0 ? __pfx_trace_sched_migrate_callback+0x10/0x10 osnoise_workload_start+0x2b5/0x370 timerlat_tracer_init+0x76/0x1b0 tracing_set_tracer+0x244/0x400 tracing_set_trace_write+0xa0/0xe0 vfs_write+0xfc/0x570 ? do_sys_openat2+0x9c/0xe0 ksys_write+0x72/0xf0 do_syscall_64+0x79/0x1c0 entry_SYSCALL_64_after_hwframe+0x76/0x7e
--- kernel/trace/trace_osnoise.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
kernel/trace/trace_osnoise.c +14 -3
@@ -1235,6 +1235,8 @@ static void trace_sched_migrate_callback } } +static bool monitor_enabled; +static int register_migration_monitor (void ) {int ret =0 ;
@@ -1243,16 +1245,25 @@ static int register_migration_monitor(vo* Timerlat thread migration check is only required when running timerlat in user-space. * Thus, enable callback only if timerlat is set with no workload. */ -if (timerlat_enabled () && !test_bit (OSN_WORKLOAD , &osnoise_options)) +if (timerlat_enabled () && !test_bit (OSN_WORKLOAD , &osnoise_options)) { +if (WARN_ON_ONCE (monitor_enabled)) +return 0 ; + ret =register_trace_sched_migrate_task (trace_sched_migrate_callback,NULL ); +if (!ret) + monitor_enabled = true; + } return ret; }static void unregister_migration_monitor (void ) { -if (timerlat_enabled () && !test_bit (OSN_WORKLOAD , &osnoise_options)) -unregister_trace_sched_migrate_task (trace_sched_migrate_callback,NULL ); +if (!monitor_enabled) +return ; + +unregister_trace_sched_migrate_task (trace_sched_migrate_callback,NULL ); + monitor_enabled = false; }#else static int register_migration_monitor (void )
Greg Kroah-Hartman
maintainerPATCH 250/273 rtla/osnoise: Distinguish missing workload option
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomas Glozar <[email protected]>
commit 80d3ba1cf51bfbbb3b098434f2b2c95cd7c0ae5c upstream.
osnoise_set_workload returns -1 for both missing OSNOISE_WORKLOAD option and failure in setting the option.
Return -1 for missing and -2 for failure to distinguish them.
--- tools/tracing/rtla/src/osnoise.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/tracing/rtla/src/osnoise.c +1 -1
@@ -867,7 +867,7 @@ int osnoise_set_workload(struct osnoise_ retval =osnoise_options_set_option ("OSNOISE_WORKLOAD" , onoff);if (retval <0 ) -return -1 ; +return -2 ; context->opt_workload = onoff;
Greg Kroah-Hartman
maintainerPATCH 251/273 rtla/timerlat_hist: Set OSNOISE_WORKLOAD for kernel threads
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomas Glozar <[email protected]>
commit d8d866171a414ed88bd0d720864095fd75461134 upstream.
When using rtla timerlat with userspace threads (-u or -U), rtla disables the OSNOISE_WORKLOAD option in /sys/kernel/tracing/osnoise/options. This option is not re-enabled in a subsequent run with kernel-space threads, leading to rtla collecting no results if the previous run exited abnormally:
$ rtla timerlat hist -u ^\Quit (core dumped) $ rtla timerlat hist -k -d 1s Index over: count: min: avg: max: ALL: IRQ Thr Usr count: 0 0 0 min: - - - avg: - - - max: - - -
The issue persists until OSNOISE_WORKLOAD is set manually by running:
$ echo OSNOISE_WORKLOAD > /sys/kernel/tracing/osnoise/options
Set OSNOISE_WORKLOAD when running rtla with kernel-space threads if available to fix the issue.
--- tools/tracing/rtla/src/timerlat_hist.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
tools/tracing/rtla/src/timerlat_hist.c +9 -6
@@ -900,12 +900,15 @@ timerlat_hist_apply_config(struct osnoisauto_house_keeping (¶ms->monitored_cpus); } -if (params->user_hist) { - retval =osnoise_set_workload (tool->context,0 ); -if (retval) { -err_msg ("Failed to set OSNOISE_WORKLOAD option\n" ); - goto out_err; - } +/* +* Set workload according to type of thread if the kernel supports it. +* On kernels without support, user threads will have already failed +* on missing timerlat_fd, and kernel threads do not need it. +*/ + retval =osnoise_set_workload (tool->context, params->kernel_workload); +if (retval <-1 ) { +err_msg ("Failed to set OSNOISE_WORKLOAD option\n" ); + goto out_err; }return 0 ;
Greg Kroah-Hartman
maintainerPATCH 252/273 rtla/timerlat_top: Set OSNOISE_WORKLOAD for kernel threads
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomas Glozar <[email protected]>
commit 217f0b1e990e30a1f06f6d531fdb4530f4788d48 upstream.
When using rtla timerlat with userspace threads (-u or -U), rtla disables the OSNOISE_WORKLOAD option in /sys/kernel/tracing/osnoise/options. This option is not re-enabled in a subsequent run with kernel-space threads, leading to rtla collecting no results if the previous run exited abnormally:
$ rtla timerlat top -u
^\Quit (core dumped)
$ rtla timerlat top -k -d 1s
Timer Latency
0 00:00:01 | IRQ Timer Latency (us) | Thread Timer Latency (us)
CPU COUNT | cur min avg max | cur min avg maxThe issue persists until OSNOISE_WORKLOAD is set manually by running:
$ echo OSNOISE_WORKLOAD > /sys/kernel/tracing/osnoise/options
Set OSNOISE_WORKLOAD when running rtla with kernel-space threads if available to fix the issue.
--- tools/tracing/rtla/src/timerlat_top.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
tools/tracing/rtla/src/timerlat_top.c +9 -6
@@ -679,12 +679,15 @@ timerlat_top_apply_config(struct osnoiseauto_house_keeping (¶ms->monitored_cpus); } -if (params->user_top) { - retval =osnoise_set_workload (top->context,0 ); -if (retval) { -err_msg ("Failed to set OSNOISE_WORKLOAD option\n" ); - goto out_err; - } +/* +* Set workload according to type of thread if the kernel supports it. +* On kernels without support, user threads will have already failed +* on missing timerlat_fd, and kernel threads do not need it. +*/ + retval =osnoise_set_workload (top->context, params->kernel_workload); +if (retval <-1 ) { +err_msg ("Failed to set OSNOISE_WORKLOAD option\n" ); + goto out_err; }return 0 ;
Greg Kroah-Hartman
maintainerPATCH 253/273 rtla: Add trace_instance_stop
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomas Glozar <[email protected]>
commit e879b5dcf8d044f3865a32d95cc5b213f314c54f upstream.
Support not only turning trace on for the timerlat tracer, but also turning it off.
This will be used in subsequent patches to stop the timerlat tracer without also wiping the trace buffer.
--- tools/tracing/rtla/src/trace.c | 8 ++++++++ tools/tracing/rtla/src/trace.h | 1 + 2 files changed, 9 insertions(+)
tools/tracing/rtla/src/trace.c +8 -0
@@ -197,6 +197,14 @@ int trace_instance_start(struct trace_in }/* +* trace_instance_stop - stop tracing a given rtla instance +*/ +int trace_instance_stop (struct trace_instance *trace) +{ +return tracefs_trace_off (trace->inst); +} + +/* * trace_events_free - free a list of trace events */ static void trace_events_free (struct trace_events *events)
tools/tracing/rtla/src/trace.h +1 -0
@@ -21,6 +21,7 @@ struct trace_instance {int trace_instance_init (struct trace_instance *trace,char *tool_name);int trace_instance_start (struct trace_instance *trace); +int trace_instance_stop (struct trace_instance *trace);void trace_instance_destroy (struct trace_instance *trace);struct trace_seq *get_trace_seq (void );
Greg Kroah-Hartman
maintainerPATCH 254/273 rtla/timerlat_hist: Stop timerlat tracer on signal
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomas Glozar <[email protected]>
commit c73cab9dbed04d8f65ca69177b4b21ed3e09dfa7 upstream.
Currently, when either SIGINT from the user or SIGALRM from the duration timer is caught by rtla-timerlat, stop_tracing is set to break out of the main loop. This is not sufficient for cases where the timerlat tracer is producing more data than rtla can consume, since in that case, rtla is looping indefinitely inside tracefs_iterate_raw_events, never reaches the check of stop_tracing and hangs.
In addition to setting stop_tracing, also stop the timerlat tracer on received signal (SIGINT or SIGALRM). This will stop new samples so that the existing samples may be processed and tracefs_iterate_raw_events eventually exits.
--- tools/tracing/rtla/src/timerlat_hist.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
tools/tracing/rtla/src/timerlat_hist.c +10 -1
@@ -949,9 +949,12 @@ out_err: }static int stop_tracing; +static struct trace_instance *hist_inst =NULL ;static void stop_hist (int sig) { stop_tracing =1 ; +if (hist_inst) +trace_instance_stop (hist_inst); }/*
@@ -997,6 +1000,12 @@ int timerlat_hist_main(int argc, char *a } trace = &tool->trace; +/* +* Save trace instance into global variable so that SIGINT can stop +* the timerlat tracer. +* Otherwise, rtla could loop indefinitely when overloaded. +*/ + hist_inst = trace; retval =enable_timerlat (trace);if (retval) {
@@ -1129,7 +1138,7 @@ int timerlat_hist_main(int argc, char *a return_value =0 ; -if (trace_is_off (&tool->trace, &record->trace)) { +if (trace_is_off (&tool->trace, &record->trace) && !stop_tracing) {printf ("rtla timerlat hit stop tracing\n" );if (!params->no_aa)
Greg Kroah-Hartman
maintainerPATCH 255/273 rtla/timerlat_top: Stop timerlat tracer on signal
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomas Glozar <[email protected]>
commit a4dfce7559d75430c464294ddee554be2a413c4a upstream.
Currently, when either SIGINT from the user or SIGALRM from the duration timer is caught by rtla-timerlat, stop_tracing is set to break out of the main loop. This is not sufficient for cases where the timerlat tracer is producing more data than rtla can consume, since in that case, rtla is looping indefinitely inside tracefs_iterate_raw_events, never reaches the check of stop_tracing and hangs.
In addition to setting stop_tracing, also stop the timerlat tracer on received signal (SIGINT or SIGALRM). This will stop new samples so that the existing samples may be processed and tracefs_iterate_raw_events eventually exits.
--- tools/tracing/rtla/src/timerlat_top.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
tools/tracing/rtla/src/timerlat_top.c +11 -1
@@ -728,9 +728,12 @@ out_err: }static int stop_tracing; +static struct trace_instance *top_inst =NULL ;static void stop_top (int sig) { stop_tracing =1 ; +if (top_inst) +trace_instance_stop (top_inst); }/*
@@ -777,6 +780,13 @@ int timerlat_top_main(int argc, char *ar } trace = &top->trace; +/* +* Save trace instance into global variable so that SIGINT can stop +* the timerlat tracer. +* Otherwise, rtla could loop indefinitely when overloaded. +*/ + top_inst = trace; + retval =enable_timerlat (trace);if (retval) {
@@ -925,7 +935,7 @@ int timerlat_top_main(int argc, char *ar return_value =0 ; -if (trace_is_off (&top->trace, &record->trace)) { +if (trace_is_off (&top->trace, &record->trace) && !stop_tracing) {printf ("rtla timerlat hit stop tracing\n" );if (!params->no_aa)
Greg Kroah-Hartman
maintainerPATCH 256/273 pinctrl: samsung: fix fwnode refcount cleanup if platform_get_irq_optional() fails
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Javier Carrasco <[email protected]>
commit 459915f55509f4bfd6076daa1428e28490ddee3b upstream.
Commit 50ebd19e3585 ("pinctrl: samsung: drop pin banks references on error paths") fixed the pin bank references on the error paths of the probe function, but there is still an error path where this is not done.
If samsung_pinctrl_get_soc_data() does not fail, the child references will have acquired, and they will need to be released in the error path of platform_get_irq_optional(), as it is done in the following error paths within the probe function.
Replace the direct return in the error path with a goto instruction to the cleanup function.
[krzysztof: change Fixes SHA to point to commit introducing the return
leading to OF node leak]
--- drivers/pinctrl/samsung/pinctrl-samsung.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pinctrl/samsung/pinctrl-samsung.c +1 -1
@@ -1150,7 +1150,7 @@ static int samsung_pinctrl_probe(struct ret =platform_get_irq_optional (pdev,0 );if (ret <0 && ret != -ENXIO ) -return ret; + goto err_put_banks;if (ret >0 ) drvdata->irq = ret;
Greg Kroah-Hartman
maintainerPATCH 257/273 ptp: Ensure info->enable callback is always set
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Weißschuh <[email protected]>
commit fd53aa40e65f518453115b6f56183b0c201db26b upstream.
The ioctl and sysfs handlers unconditionally call the ->enable callback. Not all drivers implement that callback, leading to NULL dereferences. Example of affected drivers: ptp_s390.c, ptp_vclock.c and ptp_mock.c.
Instead use a dummy callback if no better was specified by the driver.
--- drivers/ptp/ptp_clock.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/ptp/ptp_clock.c +8 -0
@@ -189,6 +189,11 @@ static int ptp_getcycles64(struct ptp_clreturn info->gettime64 (info, ts); } +static int ptp_enable (struct ptp_clock_info *ptp,struct ptp_clock_request *request,int on) +{ +return -EOPNOTSUPP ; +} +static void ptp_aux_kworker (struct kthread_work *work) { struct ptp_clock *ptp = container_of(work, struct ptp_clock,
@@ -251,6 +256,9 @@ struct ptp_clock *ptp_clock_register(str ptp->info->getcrosscycles = ptp->info->getcrosststamp; } +if (!ptp->info->enable) + ptp->info->enable = ptp_enable; +if (ptp->info->do_aux_work) {kthread_init_delayed_work (&ptp->aux_work, ptp_aux_kworker); ptp->kworker =kthread_create_worker (0 ,"ptp%d" , ptp->index);
Greg Kroah-Hartman
maintainerPATCH 258/273 rtc: zynqmp: Fix optional clock name property
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Simek <[email protected]>
commit 2a388ff22d2cbfc5cbd628ef085bdcd3b7dc64f5 upstream.
Clock description in DT binding introduced by commit f69060c14431 ("dt-bindings: rtc: zynqmp: Add clock information") is talking about "rtc" clock name but driver is checking "rtc_clk" name instead. Because clock is optional property likely in was never handled properly by the driver.
--- drivers/rtc/rtc-zynqmp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/rtc/rtc-zynqmp.c +2 -2
@@ -318,8 +318,8 @@ static int xlnx_rtc_probe(struct platforreturn ret; } -/* Getting the rtc_clk info */ - xrtcdev->rtc_clk =devm_clk_get_optional (&pdev->dev,"rtc_clk" ); +/* Getting the rtc info */ + xrtcdev->rtc_clk =devm_clk_get_optional (&pdev->dev,"rtc" );if (IS_ERR (xrtcdev->rtc_clk)) {if (PTR_ERR (xrtcdev->rtc_clk) != -EPROBE_DEFER )dev_warn (&pdev->dev,"Device clock not found.\n" );
Greg Kroah-Hartman
maintainerPATCH 259/273 MIPS: ftrace: Declare ftrace_get_parent_ra_addr() as static
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: WangYuli <[email protected]>
commit ddd068d81445b17ac0bed084dfeb9e58b4df3ddd upstream.
Declare ftrace_get_parent_ra_addr() as static to suppress clang compiler warning that 'no previous prototype'. This function is not intended to be called from other parts.
Fix follow error with clang-19:
arch/mips/kernel/ftrace.c:251:15: error: no previous prototype for function 'ftrace_get_parent_ra_addr' [-Werror,-Wmissing-prototypes]
251 | unsigned long ftrace_get_parent_ra_addr(unsigned long self_ra, unsigned long
| ^arch/mips/kernel/ftrace.c:251:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
251 | unsigned long ftrace_get_parent_ra_addr(unsigned long self_ra, unsigned long
| ^
| static1 error generated.
--- arch/mips/kernel/ftrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/kernel/ftrace.c +1 -1
@@ -248,7 +248,7 @@ int ftrace_disable_ftrace_graph_caller(v#define S_R_SP (0xafb0 << 16)/* s{d,w} R, offset(sp) */ #define OFFSET_MASK 0xffff/* stack offset range: 0 ~ PT_SIZE */ -unsigned long ftrace_get_parent_ra_addr (unsigned long self_ra,unsigned long +static unsigned long ftrace_get_parent_ra_addr (unsigned long self_ra,unsigned long old_parent_ra,unsigned long parent_ra_addr,unsigned long fp) {unsigned long sp, ip, tmp;
Greg Kroah-Hartman
maintainerPATCH 260/273 spi: atmel-quadspi: Create `atmel_qspi_ops` to support newer SoC families
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Csókás, Bence <[email protected]>
commit c0a0203cf57963792d59b3e4317a1d07b73df42a upstream.
Refactor the code to introduce an ops struct, to prepare for merging support for later SoCs, such as SAMA7G5. This code was based on the vendor's kernel (linux4microchip). Cc'ing original contributors.
--- drivers/spi/atmel-quadspi.c | 111 ++++++++++++++++++++++++++++++-------------- 1 file changed, 77 insertions(+), 34 deletions(-)
drivers/spi/atmel-quadspi.c +77 -34
@@ -138,11 +138,15 @@#define QSPI_WPSR_WPVSRC_MASK GENMASK(15, 8)#define QSPI_WPSR_WPVSRC (src) (((src) << 8) & QSPI_WPSR_WPVSRC) +#define ATMEL_QSPI_TIMEOUT 1000/* ms */ +struct atmel_qspi_caps {bool has_qspick;bool has_ricr; }; +struct atmel_qspi_ops ; +struct atmel_qspi {void __iomem *regs;void __iomem *mem;
@@ -150,13 +154,22 @@ struct atmel_qspi {struct clk *qspick;struct platform_device *pdev;const struct atmel_qspi_caps *caps; +const struct atmel_qspi_ops *ops;resource_size_t mmap_size;u32 pending; +u32 irq_mask;u32 mr;u32 scr;struct completion cmd_completion; }; +struct atmel_qspi_ops { +int (*set_cfg)(struct atmel_qspi *aq,const struct spi_mem_op *op, +u32 *offset); +int (*transfer)(struct spi_mem *mem,const struct spi_mem_op *op, +u32 offset); +}; +struct atmel_qspi_mode {u8 cmd_buswidth;u8 addr_buswidth;
@@ -404,10 +417,60 @@ static int atmel_qspi_set_cfg(struct atmreturn 0 ; } +static int atmel_qspi_wait_for_completion (struct atmel_qspi *aq,u32 irq_mask) +{ +int err =0 ; +u32 sr; + +/* Poll INSTRuction End status */ + sr =atmel_qspi_read (aq,QSPI_SR ); +if ((sr & irq_mask) == irq_mask) +return 0 ; + +/* Wait for INSTRuction End interrupt */ +reinit_completion (&aq->cmd_completion); + aq->pending = sr & irq_mask; + aq->irq_mask = irq_mask; +atmel_qspi_write (irq_mask, aq,QSPI_IER ); +if (!wait_for_completion_timeout (&aq->cmd_completion, +msecs_to_jiffies (ATMEL_QSPI_TIMEOUT ))) + err = -ETIMEDOUT ; +atmel_qspi_write (irq_mask, aq,QSPI_IDR ); + +return err; +} + +static int atmel_qspi_transfer (struct spi_mem *mem, +const struct spi_mem_op *op,u32 offset) +{ +struct atmel_qspi *aq =spi_controller_get_devdata (mem->spi->controller); + +/* Skip to the final steps if there is no data */ +if (!op->data.nbytes) +return atmel_qspi_wait_for_completion (aq, +QSPI_SR_CMD_COMPLETED ); + +/* Dummy read of QSPI_IFR to synchronize APB and AHB accesses */ + (void )atmel_qspi_read (aq,QSPI_IFR ); + +/* Send/Receive data */ +if (op->data.dir ==SPI_MEM_DATA_IN ) +memcpy_fromio (op->data.buf.in, aq->mem + offset, + op->data.nbytes); +else +memcpy_toio (aq->mem + offset, op->data.buf.out, + op->data.nbytes); + +/* Release the chip-select */ +atmel_qspi_write (QSPI_CR_LASTXFER , aq,QSPI_CR ); + +return atmel_qspi_wait_for_completion (aq,QSPI_SR_CMD_COMPLETED ); +} +static int atmel_qspi_exec_op (struct spi_mem *mem,const struct spi_mem_op *op) {struct atmel_qspi *aq =spi_controller_get_devdata (mem->spi->controller); -u32 sr, offset; +u32 offset;int err;/*
@@ -416,46 +479,20 @@ static int atmel_qspi_exec_op(struct spi* when the flash memories overrun the controller's memory space. */ if (op->addr.val + op->data.nbytes > aq->mmap_size) -return -ENOTSUPP ; +return -EOPNOTSUPP ; + +if (op->addr.nbytes >4 ) +return -EOPNOTSUPP ; err =pm_runtime_resume_and_get (&aq->pdev->dev);if (err <0 )return err; - err =atmel_qspi_set_cfg (aq, op, &offset); + err = aq->ops->set_cfg (aq, op, &offset);if (err) goto pm_runtime_put; -/* Skip to the final steps if there is no data */ -if (op->data.nbytes) { -/* Dummy read of QSPI_IFR to synchronize APB and AHB accesses */ - (void )atmel_qspi_read (aq,QSPI_IFR ); - -/* Send/Receive data */ -if (op->data.dir ==SPI_MEM_DATA_IN ) -memcpy_fromio (op->data.buf.in, aq->mem + offset, - op->data.nbytes); -else -memcpy_toio (aq->mem + offset, op->data.buf.out, - op->data.nbytes); - -/* Release the chip-select */ -atmel_qspi_write (QSPI_CR_LASTXFER , aq,QSPI_CR ); - } - -/* Poll INSTRuction End status */ - sr =atmel_qspi_read (aq,QSPI_SR ); -if ((sr &QSPI_SR_CMD_COMPLETED ) ==QSPI_SR_CMD_COMPLETED ) - goto pm_runtime_put; - -/* Wait for INSTRuction End interrupt */ -reinit_completion (&aq->cmd_completion); - aq->pending = sr &QSPI_SR_CMD_COMPLETED ; -atmel_qspi_write (QSPI_SR_CMD_COMPLETED , aq,QSPI_IER ); -if (!wait_for_completion_timeout (&aq->cmd_completion, -msecs_to_jiffies (1000 ))) - err = -ETIMEDOUT ; -atmel_qspi_write (QSPI_SR_CMD_COMPLETED , aq,QSPI_IDR ); + err = aq->ops->transfer (mem, op, offset); pm_runtime_put:pm_runtime_mark_last_busy (&aq->pdev->dev);
@@ -571,12 +608,17 @@ static irqreturn_t atmel_qspi_interrupt(return IRQ_NONE ; aq->pending |= pending; -if ((aq->pending &QSPI_SR_CMD_COMPLETED ) ==QSPI_SR_CMD_COMPLETED ) +if ((aq->pending & aq->irq_mask) == aq->irq_mask)complete (&aq->cmd_completion);return IRQ_HANDLED ; } +static const struct atmel_qspi_ops atmel_qspi_ops = { + .set_cfg = atmel_qspi_set_cfg, + .transfer = atmel_qspi_transfer, +}; +static int atmel_qspi_probe (struct platform_device *pdev) {struct spi_controller *ctrl;
@@ -601,6 +643,7 @@ static int atmel_qspi_probe(struct platfinit_completion (&aq->cmd_completion); aq->pdev = pdev; + aq->ops = &atmel_qspi_ops;/* Map the registers */ res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"qspi_base" );
Greg Kroah-Hartman
maintainerPATCH 261/273 spi: atmel-qspi: Memory barriers after memory-mapped I/O
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bence Csókás <[email protected]>
commit be92ab2de0ee1a13291c3b47b2d7eb24d80c0a2c upstream.
The QSPI peripheral control and status registers are accessible via the SoC's APB bus, whereas MMIO transactions' data travels on the AHB bus.
Microchip documentation and even sample code from Atmel emphasises the need for a memory barrier before the first MMIO transaction to the AHB-connected QSPI, and before the last write to its registers via APB. This is achieved by the following lines in atmel_qspi_transfer():
/* Dummy read of QSPI_IFR to synchronize APB and AHB accesses */ (void)atmel_qspi_read(aq, QSPI_IFR);
However, the current documentation makes no mention to synchronization requirements in the other direction, i.e. after the last data written via AHB, and before the first register access on APB.
In our case, we were facing an issue where the QSPI peripheral would cease to send any new CSR (nCS Rise) interrupts, leading to a timeout in atmel_qspi_wait_for_completion() and ultimately this panic in higher levels:
ubi0 error: ubi_io_write: error -110 while writing 63108 bytes
to PEB 491:128, written 63104 bytes
After months of extensive research of the codebase, fiddling around the debugger with kgdb, and back-and-forth with Microchip, we came to the conclusion that the issue is probably that the peripheral is still busy receiving on AHB when the LASTXFER bit is written to its Control Register on APB, therefore this write gets lost, and the peripheral still thinks there is more data to come in the MMIO transfer. This was first formulated when we noticed that doubling the write() of QSPI_CR_LASTXFER seemed to solve the problem.
Ultimately, the solution is to introduce memory barriers after the AHB-mapped MMIO transfers, to ensure ordering.
--- drivers/spi/atmel-quadspi.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/spi/atmel-quadspi.c +9 -2
@@ -454,13 +454,20 @@ static int atmel_qspi_transfer(struct sp (void )atmel_qspi_read (aq,QSPI_IFR );/* Send/Receive data */ -if (op->data.dir ==SPI_MEM_DATA_IN ) +if (op->data.dir ==SPI_MEM_DATA_IN ) {memcpy_fromio (op->data.buf.in, aq->mem + offset, op->data.nbytes); -else + +/* Synchronize AHB and APB accesses again */ +rmb (); + }else {memcpy_toio (aq->mem + offset, op->data.buf.out, op->data.nbytes); +/* Synchronize AHB and APB accesses again */ +wmb (); + } +/* Release the chip-select */ atmel_qspi_write (QSPI_CR_LASTXFER , aq,QSPI_CR );
Greg Kroah-Hartman
maintainerPATCH 262/273 net/ncsi: use dev_set_mac_address() for Get MC MAC Address handling
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Fertser <[email protected]>
commit 05d91cdb1f9108426b14975ef4eeddf15875ca05 upstream.
Copy of the rationale from 790071347a0a1a89e618eedcd51c687ea783aeb3:
Change ndo_set_mac_address to dev_set_mac_address because dev_set_mac_address provides a way to notify network layer about MAC change. In other case, services may not aware about MAC change and keep using old one which set from network adapter driver.
As example, DHCP client from systemd do not update MAC address without notification from net subsystem which leads to the problem with acquiring the right address from DHCP server.
Since dev_set_mac_address requires RTNL lock the operation can not be performed directly in the response handler, see 9e2bbab94b88295dcc57c7580393c9ee08d7314d.
The way of selecting the first suitable MAC address from the list is changed, instead of having the driver check it this patch just assumes any valid MAC should be good.
--- net/ncsi/ncsi-rsp.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
net/ncsi/ncsi-rsp.c +8 -10
@@ -1089,14 +1089,12 @@ static int ncsi_rsp_handler_netlink(strustatic int ncsi_rsp_handler_gmcma (struct ncsi_request *nr) {struct ncsi_dev_priv *ndp = nr->ndp; +struct sockaddr *saddr = &ndp->pending_mac;struct net_device *ndev = ndp->ndev.dev;struct ncsi_rsp_gmcma_pkt *rsp; -struct sockaddr saddr; -int ret =-1 ;int i; rsp = (struct ncsi_rsp_gmcma_pkt *)skb_network_header (nr->rsp); - saddr.sa_family = ndev->type; ndev->priv_flags |=IFF_LIVE_ADDR_CHANGE ; netdev_info(ndev, "NCSI: Received %d provisioned MAC addresses\n",
@@ -1108,20 +1106,20 @@ static int ncsi_rsp_handler_gmcma(struct rsp->addresses[i][4], rsp->addresses[i][5]); } + saddr->sa_family = ndev->type;for (i =0 ; i < rsp->address_count; i++) { -memcpy (saddr.sa_data, &rsp->addresses[i],ETH_ALEN ); - ret = ndev->netdev_ops->ndo_set_mac_address (ndev, &saddr); -if (ret <0 ) { +if (!is_valid_ether_addr (rsp->addresses[i])) {netdev_warn (ndev,"NCSI: Unable to assign %pM to device\n" , - saddr.sa_data); + rsp->addresses[i]);continue ; } -netdev_warn (ndev,"NCSI: Set MAC address to %pM\n" , saddr.sa_data); +memcpy (saddr->sa_data, rsp->addresses[i],ETH_ALEN ); +netdev_warn (ndev,"NCSI: Will set MAC address to %pM\n" , saddr->sa_data);break ; } - ndp->gma_flag = ret ==0 ; -return ret; + ndp->gma_flag =1 ; +return 0 ; } static struct ncsi_rsp_handler {
Greg Kroah-Hartman
maintainerPATCH 263/273 ocfs2: check dir i_size in ocfs2_find_entry
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Su Yue <[email protected]>
commit b0fce54b8c0d8e5f2b4c243c803c5996e73baee8 upstream.
syz reports an out of bounds read:
==================================================================
BUG: KASAN: slab-out-of-bounds in ocfs2_match fs/ocfs2/dir.c:334 [inline] BUG: KASAN: slab-out-of-bounds in ocfs2_search_dirblock+0x283/0x6e0 fs/ocfs2/dir.c:367 Read of size 1 at addr ffff88804d8b9982 by task syz-executor.2/14802 CPU: 0 UID: 0 PID: 14802 Comm: syz-executor.2 Not tainted 6.13.0-rc4 #2 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 Sched_ext: serialise (enabled+all), task: runnable_at=-10ms Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x229/0x350 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x164/0x530 mm/kasan/report.c:489 kasan_report+0x147/0x180 mm/kasan/report.c:602 ocfs2_match fs/ocfs2/dir.c:334 [inline] ocfs2_search_dirblock+0x283/0x6e0 fs/ocfs2/dir.c:367 ocfs2_find_entry_id fs/ocfs2/dir.c:414 [inline] ocfs2_find_entry+0x1143/0x2db0 fs/ocfs2/dir.c:1078 ocfs2_find_files_on_disk+0x18e/0x530 fs/ocfs2/dir.c:1981 ocfs2_lookup_ino_from_name+0xb6/0x110 fs/ocfs2/dir.c:2003 ocfs2_lookup+0x30a/0xd40 fs/ocfs2/namei.c:122 lookup_open fs/namei.c:3627 [inline] open_last_lookups fs/namei.c:3748 [inline] path_openat+0x145a/0x3870 fs/namei.c:3984 do_filp_open+0xe9/0x1c0 fs/namei.c:4014 do_sys_openat2+0x135/0x1d0 fs/open.c:1402 do_sys_open fs/open.c:1417 [inline] __do_sys_openat fs/open.c:1433 [inline] __se_sys_openat fs/open.c:1428 [inline] __x64_sys_openat+0x15d/0x1c0 fs/open.c:1428 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf6/0x210 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f01076903ad Code: c3 e8 a7 2b 00 00 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 89 f8 48 89
f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f01084acfc8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f01077cbf80 RCX: 00007f01076903ad
RDX: 0000000000105042 RSI: 0000000020000080 RDI: ffffffffffffff9c
RBP: 00007f01077cbf80 R08: 0000000000000000 R09: 0000000000000000
R10: 00000000000001ff R11: 0000000000000246 R12: 0000000000000000
R13: 00007f01077cbf80 R14: 00007f010764fc90 R15: 00007f010848d000
</TASK> ==================================================================
And a general protection fault in ocfs2_prepare_dir_for_insert:
==================================================================
loop0: detected capacity change from 0 to 32768
JBD2: Ignoring recovery information on journal
ocfs2: Mounting device (7,0) on (node local, slot 0) with ordered data mode.
Oops: general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] PREEMPT SMP KASAN NOPTI KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f] CPU: 0 UID: 0 PID: 5096 Comm: syz-executor792 Not tainted 6.11.0-rc4-syzkaller-00002-gb0da640826ba #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 RIP: 0010:ocfs2_find_dir_space_id fs/ocfs2/dir.c:3406 [inline] RIP: 0010:ocfs2_prepare_dir_for_insert+0x3309/0x5c70 fs/ocfs2/dir.c:4280 Code: 00 00 e8 2a 25 13 fe e9 ba 06 00 00 e8 20 25 13 fe e9 4f 01 00 00 e8 16 25 13 fe 49 8d 7f 08 49 8d 5f 09 48 89 f8 48 c1 e8 03 <42> 0f b6 04 20 84 c0 0f 85 bd 23 00 00 48 89 d8 48 c1 e8 03 42 0f RSP: 0018:ffffc9000af9f020 EFLAGS: 00010202 RAX: 0000000000000001 RBX: 0000000000000009 RCX: ffff88801e27a440 RDX: 0000000000000000 RSI: 0000000000000400 RDI: 0000000000000008 RBP: ffffc9000af9f830 R08: ffffffff8380395b R09: ffffffff838090a7 R10: 0000000000000002 R11: ffff88801e27a440 R12: dffffc0000000000 R13: ffff88803c660878 R14: f700000000000088 R15: 0000000000000000 FS: 000055555a677380(0000) GS:ffff888020800000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000560bce569178 CR3: 000000001de5a000 CR4: 0000000000350ef0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> ocfs2_mknod+0xcaf/0x2b40 fs/ocfs2/namei.c:292 vfs_mknod+0x36d/0x3b0 fs/namei.c:4088 do_mknodat+0x3ec/0x5b0 __do_sys_mknodat fs/namei.c:4166 [inline] __se_sys_mknodat fs/namei.c:4163 [inline] __x64_sys_mknodat+0xa7/0xc0 fs/namei.c:4163 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f2dafda3a99 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 17 00 00 90 48 89
f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffe336a6658 EFLAGS: 00000246 ORIG_RAX:
0000000000000103
RAX: ffffffffffffffda RBX: 0000000000000000 RCX:00007f2dafda3a99
RDX: 00000000000021c0 RSI: 0000000020000040 RDI:00000000ffffff9c
RBP: 00007f2dafe1b5f0 R08: 0000000000004480 R09:000055555a6784c0
R10: 0000000000000103 R11: 0000000000000246 R12:00007ffe336a6680
R13: 00007ffe336a68a8 R14: 431bde82d7b634db R15:00007f2dafdec03b
</TASK> ==================================================================
The two reports are all caused invalid negative i_size of dir inode. For ocfs2, dir_inode can't be negative or zero.
Here add a check in which is called by ocfs2_check_dir_for_entry(). It fixes the second report as ocfs2_check_dir_for_entry() must be called before ocfs2_prepare_dir_for_insert(). Also set a up limit for dir with OCFS2_INLINE_DATA_FL. The i_size can't be great than blocksize.
--- fs/ocfs2/dir.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-)
fs/ocfs2/dir.c +21 -4
@@ -1065,26 +1065,39 @@ int ocfs2_find_entry(const char *name, i {struct buffer_head *bh;struct ocfs2_dir_entry *res_dir =NULL ; +int ret =0 ;if (ocfs2_dir_indexed (dir))return ocfs2_find_entry_dx (name, namelen, dir, lookup); +if (unlikely (i_size_read (dir) <=0 )) { + ret = -EFSCORRUPTED ; +mlog_errno (ret); + goto out; + }/* * The unindexed dir code only uses part of the lookup * structure, so there's no reason to push it down further * than this. */ -if (OCFS2_I (dir)->ip_dyn_features &OCFS2_INLINE_DATA_FL ) +if (OCFS2_I (dir)->ip_dyn_features &OCFS2_INLINE_DATA_FL ) { +if (unlikely (i_size_read (dir) > dir->i_sb->s_blocksize)) { + ret = -EFSCORRUPTED ; +mlog_errno (ret); + goto out; + } bh =ocfs2_find_entry_id (name, namelen, dir, &res_dir); -else + }else { bh =ocfs2_find_entry_el (name, namelen, dir, &res_dir); + }if (bh ==NULL )return -ENOENT ; lookup->dl_leaf_bh = bh; lookup->dl_entry = res_dir; -return 0 ; +out: +return ret; }/*
@@ -2012,6 +2025,7 @@ int ocfs2_lookup_ino_from_name(struct in* * Return 0 if the name does not exist * Return -EEXIST if the directory contains the name +* Return -EFSCORRUPTED if found corruption * * Callers should have i_rwsem + a cluster lock on dir */
@@ -2025,9 +2039,12 @@ int ocfs2_check_dir_for_entry(struct inotrace_ocfs2_check_dir_for_entry ( (unsigned long long )OCFS2_I (dir)->ip_blkno, namelen, name); -if (ocfs2_find_entry (name, namelen, dir, &lookup) ==0 ) { + ret =ocfs2_find_entry (name, namelen, dir, &lookup); +if (ret ==0 ) { ret = -EEXIST ;mlog_errno (ret); + }else if (ret == -ENOENT ) { + ret =0 ; }ocfs2_free_dir_lookup_result (&lookup);
Greg Kroah-Hartman
maintainerPATCH 264/273 Revert "btrfs: avoid monopolizing a core when activating a swap file"
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Koichiro Den <[email protected]>
This reverts commit 6e1a8225930719a9f352d56320214e33e2dde0a6.
The backport for linux-6.6.y, commit 6e1a82259307 ("btrfs: avoid monopolizing a core when activating a swap file"), inserted cond_resched() in the wrong location.
Revert it now; a subsequent commit will re-backport the original patch.
--- fs/btrfs/inode.c | 2 -- 1 file changed, 2 deletions(-)
fs/btrfs/inode.c +0 -2
@@ -7153,8 +7153,6 @@ noinline int can_nocow_extent(struct ino ret = -EAGAIN ; goto out; } - -cond_resched (); }if (orig_start)
Greg Kroah-Hartman
maintainerPATCH 265/273 btrfs: avoid monopolizing a core when activating a swap file
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit 2c8507c63f5498d4ee4af404a8e44ceae4345056 upstream.
This commit re-attempts the backport of the change to the linux-6.6.y branch. Commit 6e1a82259307 ("btrfs: avoid monopolizing a core when activating a swap file") on this branch was reverted.
During swap activation we iterate over the extents of a file and we can have many thousands of them, so we can end up in a busy loop monopolizing a core. Avoid this by doing a voluntary reschedule after processing each extent.
--- fs/btrfs/inode.c | 2 ++ 1 file changed, 2 insertions(+)
fs/btrfs/inode.c +2 -0
@@ -10833,6 +10833,8 @@ static int btrfs_swap_activate(struct sw } start += len; + +cond_resched (); }if (bsi.block_len)
Greg Kroah-Hartman
maintainerPATCH 266/273 cachefiles: Fix NULL pointer dereference in object->file
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zizhi Wo <[email protected]>
commit 31ad74b20227ce6b40910ff78b1c604e42975cf1 upstream.
At present, the object->file has the NULL pointer dereference problem in ondemand-mode. The root cause is that the allocated fd and object->file lifetime are inconsistent, and the user-space invocation to anon_fd uses object->file. Following is the process that triggers the issue:
[write fd] [umount]
cachefiles_ondemand_fd_write_iter
fscache_cookie_state_machine
cachefiles_withdraw_cookie
if (!file) return -ENOBUFS
cachefiles_clean_up_object cachefiles_unmark_inode_in_use fput(object->file) object->file = NULL
// file NULL pointer dereference!
__cachefiles_write(..., file, ...)
Fix this issue by add an additional reference count to the object->file before write/llseek, and decrement after it finished.
--- fs/cachefiles/interface.c | 14 ++++++++++---- fs/cachefiles/ondemand.c | 30 ++++++++++++++++++++++++------ 2 files changed, 34 insertions(+), 10 deletions(-)
fs/cachefiles/interface.c +10 -4
@@ -327,6 +327,8 @@ static void cachefiles_commit_object(strstatic void cachefiles_clean_up_object (struct cachefiles_object *object,struct cachefiles_cache *cache) { +struct file *file; +if (test_bit (FSCACHE_COOKIE_RETIRED , &object->cookie->flags)) {if (!test_bit (CACHEFILES_OBJECT_USING_TMPFILE , &object->flags)) {cachefiles_see_object (object, cachefiles_obj_see_clean_delete);
@@ -342,10 +344,14 @@ static void cachefiles_clean_up_object(s }cachefiles_unmark_inode_in_use (object, object->file); -if (object->file) { -fput (object->file); - object->file =NULL ; - } + +spin_lock (&object->lock); + file = object->file; + object->file =NULL ; +spin_unlock (&object->lock); + +if (file) +fput (file); }/*
fs/cachefiles/ondemand.c +24 -6
@@ -61,20 +61,26 @@ static ssize_t cachefiles_ondemand_fd_wr {struct cachefiles_object *object = kiocb->ki_filp->private_data;struct cachefiles_cache *cache = object->volume->cache; -struct file *file = object->file; +struct file *file;size_t len = iter->count;loff_t pos = kiocb->ki_pos;const struct cred *saved_cred;int ret; -if (!file) +spin_lock (&object->lock); + file = object->file; +if (!file) { +spin_unlock (&object->lock);return -ENOBUFS ; + } +get_file (file); +spin_unlock (&object->lock);cachefiles_begin_secure (cache, &saved_cred); ret =__cachefiles_prepare_write (object, file, &pos, &len, true);cachefiles_end_secure (cache, saved_cred);if (ret <0 ) -return ret; + goto out;trace_cachefiles_ondemand_fd_write (object,file_inode (file), pos, len); ret =__cachefiles_write (object, file, pos, iter,NULL ,NULL );
@@ -83,6 +89,8 @@ static ssize_t cachefiles_ondemand_fd_wr kiocb->ki_pos += ret; } +out: +fput (file);return ret; }
@@ -90,12 +98,22 @@ static loff_t cachefiles_ondemand_fd_lls int whence) {struct cachefiles_object *object = filp->private_data; -struct file *file = object->file; +struct file *file; +loff_t ret; -if (!file) +spin_lock (&object->lock); + file = object->file; +if (!file) { +spin_unlock (&object->lock);return -ENOBUFS ; + } +get_file (file); +spin_unlock (&object->lock); -return vfs_llseek (file, pos, whence); + ret =vfs_llseek (file, pos, whence); +fput (file); + +return ret; } static long cachefiles_ondemand_fd_ioctl(struct file *filp, unsigned int ioctl,
Greg Kroah-Hartman
maintainerPATCH 267/273 mptcp: pm: only set fullmesh for subflow endp
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Matthieu Baerts (NGI0)" <[email protected]>
commit 1bb0d1348546ad059f55c93def34e67cb2a034a6 upstream.
With the in-kernel path-manager, it is possible to change the 'fullmesh' flag. The code in mptcp_pm_nl_fullmesh() expects to change it only on 'subflow' endpoints, to recreate more or less subflows using the linked address.
Unfortunately, the set_flags() hook was a bit more permissive, and allowed 'implicit' endpoints to get the 'fullmesh' flag while it is not allowed before.
That's what syzbot found, triggering the following warning:
WARNING: CPU: 0 PID: 6499 at net/mptcp/pm_netlink.c:1496 __mark_subflow_endp_available net/mptcp/pm_netlink.c:1496 [inline] WARNING: CPU: 0 PID: 6499 at net/mptcp/pm_netlink.c:1496 mptcp_pm_nl_fullmesh net/mptcp/pm_netlink.c:1980 [inline] WARNING: CPU: 0 PID: 6499 at net/mptcp/pm_netlink.c:1496 mptcp_nl_set_flags net/mptcp/pm_netlink.c:2003 [inline] WARNING: CPU: 0 PID: 6499 at net/mptcp/pm_netlink.c:1496 mptcp_pm_nl_set_flags+0x974/0xdc0 net/mptcp/pm_netlink.c:2064 Modules linked in: CPU: 0 UID: 0 PID: 6499 Comm: syz.1.413 Not tainted 6.13.0-rc5-syzkaller-00172-gd1bf27c4e176 #0 Hardware name: Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 RIP: 0010:__mark_subflow_endp_available net/mptcp/pm_netlink.c:1496 [inline] RIP: 0010:mptcp_pm_nl_fullmesh net/mptcp/pm_netlink.c:1980 [inline] RIP: 0010:mptcp_nl_set_flags net/mptcp/pm_netlink.c:2003 [inline] RIP: 0010:mptcp_pm_nl_set_flags+0x974/0xdc0 net/mptcp/pm_netlink.c:2064 Code: 01 00 00 49 89 c5 e8 fb 45 e8 f5 e9 b8 fc ff ff e8 f1 45 e8 f5 4c 89 f7 be 03 00 00 00 e8 44 1d 0b f9 eb a0 e8 dd 45 e8 f5 90 <0f> 0b 90 e9 17 ff ff ff 89 d9 80 e1 07 38 c1 0f 8c c9 fc ff ff 48 RSP: 0018:ffffc9000d307240 EFLAGS: 00010293 RAX: ffffffff8bb72e03 RBX: 0000000000000000 RCX: ffff88807da88000 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffffc9000d307430 R08: ffffffff8bb72cf0 R09: 1ffff1100b842a5e R10: dffffc0000000000 R11: ffffed100b842a5f R12: ffff88801e2e5ac0 R13: ffff88805c214800 R14: ffff88805c2152e8 R15: 1ffff1100b842a5d FS: 00005555619f6500(0000) GS:ffff8880b8600000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000020002840 CR3: 00000000247e6000 CR4: 00000000003526f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> genl_family_rcv_msg_doit net/netlink/genetlink.c:1115 [inline] genl_family_rcv_msg net/netlink/genetlink.c:1195 [inline] genl_rcv_msg+0xb14/0xec0 net/netlink/genetlink.c:1210 netlink_rcv_skb+0x1e3/0x430 net/netlink/af_netlink.c:2542 genl_rcv+0x28/0x40 net/netlink/genetlink.c:1219 netlink_unicast_kernel net/netlink/af_netlink.c:1321 [inline] netlink_unicast+0x7f6/0x990 net/netlink/af_netlink.c:1347 netlink_sendmsg+0x8e4/0xcb0 net/netlink/af_netlink.c:1891 sock_sendmsg_nosec net/socket.c:711 [inline] __sock_sendmsg+0x221/0x270 net/socket.c:726 ____sys_sendmsg+0x52a/0x7e0 net/socket.c:2583 ___sys_sendmsg net/socket.c:2637 [inline] __sys_sendmsg+0x269/0x350 net/socket.c:2669 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f5fe8785d29 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fff571f5558 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f5fe8975fa0 RCX: 00007f5fe8785d29 RDX: 0000000000000000 RSI: 0000000020000480 RDI: 0000000000000007 RBP: 00007f5fe8801b08 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f5fe8975fa0 R14: 00007f5fe8975fa0 R15: 00000000000011f4 </TASK>
Here, syzbot managed to set the 'fullmesh' flag on an 'implicit' and used -- according to 'id_avail_bitmap' -- endpoint, causing the PM to try decrement the local_addr_used counter which is only incremented for the 'subflow' endpoint.
Note that 'no type' endpoints -- not 'subflow', 'signal', 'implicit' -- are fine, because their ID will not be marked as used in the 'id_avail' bitmap, and setting 'fullmesh' can help forcing the creation of subflow when receiving an ADD_ADDR.
[ Conflicts in pm_netlink.c, because the code has been moved around in
commit 6a42477fe449 ("mptcp: update set_flags interfaces"), but the same fix can still be applied at the original place. ]
--- net/mptcp/pm_netlink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mptcp/pm_netlink.c +2 -1
@@ -2069,7 +2069,8 @@ int mptcp_pm_nl_set_flags(struct net *nereturn -EINVAL ; }if ((addr->flags &MPTCP_PM_ADDR_FLAG_FULLMESH ) && - (entry->flags &MPTCP_PM_ADDR_FLAG_SIGNAL )) { + (entry->flags & (MPTCP_PM_ADDR_FLAG_SIGNAL | +MPTCP_PM_ADDR_FLAG_IMPLICIT ))) {spin_unlock_bh (&pernet->lock);return -EINVAL ; }
Greg Kroah-Hartman
maintainerPATCH 268/273 mptcp: prevent excessive coalescing on receive
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
commit 56b824eb49d6258aa0bad09a406ceac3f643cdae upstream.
Currently the skb size after coalescing is only limited by the skb layout (the skb must not carry frag_list). A single coalesced skb covering several MSS can potentially fill completely the receive buffer. In such a case, the snd win will zero until the receive buffer will be empty again, affecting tput badly.
--- net/mptcp/protocol.c | 1 + 1 file changed, 1 insertion(+)
net/mptcp/protocol.c +1 -0
@@ -138,6 +138,7 @@ static bool mptcp_try_coalesce(struct soint delta;if (MPTCP_SKB_CB (from)->offset || + ((to->len + from->len) > (sk->sk_rcvbuf >>3 )) || !skb_try_coalesce (to, from, &fragstolen, &delta))return false;
Greg Kroah-Hartman
maintainerPATCH 269/273 selftests: mptcp: join: fix AF_INET6 variable
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Matthieu Baerts (NGI0)" <[email protected]>
The Fixes commit is a backport renaming a variable, from AF_INET6 to MPTCP_LIB_AF_INET6.
The commit has been applied without conflicts, except that it missed one extra variable that was in v6.6, but not in the version linked to the Fixes commit.
This variable has then been renamed too to avoid these errors:
LISTENER_CREATED 10.0.2.1:10100 ./mptcp_join.sh: line 2944: [: 2: unary operator expected
LISTENER_CLOSED 10.0.2.1:10100 ./mptcp_join.sh: line 2944: [: 2: unary operator expected
--- tools/testing/selftests/net/mptcp/mptcp_join.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/mptcp/mptcp_join.sh +1 -1
@@ -2941,7 +2941,7 @@ verify_listener_events() type=$(mptcp_lib_evts_get_info type "$evt" "$e_type") family=$(mptcp_lib_evts_get_info family "$evt" "$e_type") sport=$(mptcp_lib_evts_get_info sport "$evt" "$e_type") - if [ $family ] && [ $family = $AF_INET6 ]; then + if [ $family ] && [ $family = $MPTCP_LIB_AF_INET6 ]; then saddr=$(mptcp_lib_evts_get_info saddr6 "$evt" "$e_type") else saddr=$(mptcp_lib_evts_get_info saddr4 "$evt" "$e_type")
Greg Kroah-Hartman
maintainerPATCH 270/273 x86/mm/ident_map: Use gbpages only where full GB page should be mapped.
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steve Wahl <[email protected]>
commit cc31744a294584a36bf764a0ffa3255a8e69f036 upstream.
When ident_pud_init() uses only GB pages to create identity maps, large ranges of addresses not actually requested can be included in the resulting table; a 4K request will map a full GB. This can include a lot of extra address space past that requested, including areas marked reserved by the BIOS. That allows processor speculation into reserved regions, that on UV systems can cause system halts.
Only use GB pages when map creation requests include the full GB page of space. Fall back to using smaller 2M pages when only portions of a GB page are included in the request.
No attempt is made to coalesce mapping requests. If a request requires a map entry at the 2M (pmd) level, subsequent mapping requests within the same 1G region will also be at the pmd level, even if adjacent or overlapping such requests could have been combined to map a full GB page. Existing usage starts with larger regions and then adds smaller regions, so this should not have any great consequence.
--- arch/x86/mm/ident_map.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-)
arch/x86/mm/ident_map.c +18 -5
@@ -26,18 +26,31 @@ static int ident_pud_init(struct x86_mapfor (; addr < end; addr = next) {pud_t *pud = pud_page +pud_index (addr);pmd_t *pmd; +bool use_gbpage; next = (addr &PUD_MASK ) +PUD_SIZE ;if (next > end) next = end; -if (info->direct_gbpages) { -pud_t pudval; +/* if this is already a gbpage, this portion is already mapped */ +if (pud_leaf (*pud)) +continue ; + +/* Is using a gbpage allowed? */ + use_gbpage = info->direct_gbpages; -if (pud_present (*pud)) -continue ; +/* Don't use gbpage if it maps more than the requested region. */ +/* at the begining: */ + use_gbpage &= ((addr & ~PUD_MASK ) ==0 ); +/* ... or at the end: */ + use_gbpage &= ((next & ~PUD_MASK ) ==0 ); + +/* Never overwrite existing mappings */ + use_gbpage &= !pud_present (*pud); + +if (use_gbpage) { +pud_t pudval; - addr &=PUD_MASK ; pudval =__pud ((addr - info->offset) | info->page_flag);set_pud (pud, pudval);continue ;
Greg Kroah-Hartman
maintainerPATCH 271/273 tty: xilinx_uartps: split sysrq handling
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Anderson <[email protected]>
commit b06f388994500297bb91be60ffaf6825ecfd2afe upstream.
lockdep detects the following circular locking dependency:
CPU 0 CPU 1
========================== ============================cdns_uart_isr() printk()
uart_port_lock(port) console_lock()
cdns_uart_console_write()
if (!port->sysrq)
uart_port_lock(port)
uart_handle_break()
port->sysrq = ... uart_handle_sysrq_char()
printk()
console_lock()
The fixed commit attempts to avoid this situation by only taking the port lock in cdns_uart_console_write if port->sysrq unset. However, if (as shown above) cdns_uart_console_write runs before port->sysrq is set, then it will try to take the port lock anyway. This may result in a deadlock.
Fix this by splitting sysrq handling into two parts. We use the prepare helper under the port lock and defer handling until we release the lock.
--- drivers/tty/serial/xilinx_uartps.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/tty/serial/xilinx_uartps.c +4 -6
@@ -268,7 +268,7 @@ static void cdns_uart_handle_rx(void *decontinue ; } -if (uart_handle_sysrq_char (port, data)) +if (uart_prepare_sysrq_char (port, data))continue ;if (is_rxbs_support) {
@@ -369,7 +369,7 @@ static irqreturn_t cdns_uart_isr(int irq !(readl(port->membase + CDNS_UART_CR) & CDNS_UART_CR_RX_DIS))cdns_uart_handle_rx (dev_id, isrstatus); -spin_unlock (&port->lock); +uart_unlock_and_check_sysrq (port);return IRQ_HANDLED ; }
@@ -1229,10 +1229,8 @@ static void cdns_uart_console_write(struunsigned int imr, ctrl;int locked =1 ; -if (port->sysrq) - locked =0 ; -else if (oops_in_progress) - locked =spin_trylock_irqsave (&port->lock, flags); +if (oops_in_progress) + locked =uart_port_trylock_irqsave (port, &flags);else spin_lock_irqsave (&port->lock, flags);
Greg Kroah-Hartman
maintainerPATCH 272/273 KVM: x86: Make x2APIC ID 100% readonly
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 4b7c3f6d04bd53f2e5b228b6821fb8f5d1ba3071 upstream.
Ignore the userspace provided x2APIC ID when fixing up APIC state for KVM_SET_LAPIC, i.e. make the x2APIC fully readonly in KVM. Commit a92e2543d6a8 ("KVM: x86: use hardware-compatible format for APIC ID register"), which added the fixup, didn't intend to allow userspace to modify the x2APIC ID. In fact, that commit is when KVM first started treating the x2APIC ID as readonly, apparently to fix some race:
static inline u32 kvm_apic_id(struct kvm_lapic *apic) {
- return (kvm_lapic_get_reg(apic, APIC_ID) >> 24) & 0xff;
+ /* To avoid a race between apic_base and following APIC_ID update when
+ * switching to x2apic_mode, the x2apic mode returns initial x2apic id.
+ */
+ if (apic_x2apic_mode(apic))
+ return apic->vcpu->vcpu_id;
+
+ return kvm_lapic_get_reg(apic, APIC_ID) >> 24;
}
Furthermore, KVM doesn't support delivering interrupts to vCPUs with a modified x2APIC ID, but KVM *does* return the modified value on a guest RDMSR and for KVM_GET_LAPIC. I.e. no remotely sane setup can actually work with a modified x2APIC ID.
Making the x2APIC ID fully readonly fixes a WARN in KVM's optimized map calculation, which expects the LDR to align with the x2APIC ID.
WARNING: CPU: 2 PID: 958 at arch/x86/kvm/lapic.c:331 kvm_recalculate_apic_map+0x609/0xa00 [kvm] CPU: 2 PID: 958 Comm: recalc_apic_map Not tainted 6.4.0-rc3-vanilla+ #35 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Arch Linux 1.16.2-1-1 04/01/2014 RIP: 0010:kvm_recalculate_apic_map+0x609/0xa00 [kvm] Call Trace: <TASK> kvm_apic_set_state+0x1cf/0x5b0 [kvm] kvm_arch_vcpu_ioctl+0x1806/0x2100 [kvm] kvm_vcpu_ioctl+0x663/0x8a0 [kvm] __x64_sys_ioctl+0xb8/0xf0 do_syscall_64+0x56/0x80 entry_SYSCALL_64_after_hwframe+0x46/0xb0 RIP: 0033:0x7fade8b9dd6f
Unfortunately, the WARN can still trigger for other CPUs than the current one by racing against KVM_SET_LAPIC, so remove it completely.
Message-ID: <[email protected]>
--- arch/x86/kvm/lapic.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)
arch/x86/kvm/lapic.c +15 -7
@@ -338,10 +338,8 @@ static void kvm_recalculate_logical_map(* reversing the LDR calculation to get cluster of APICs, i.e. no * additional work is required. */ -if (apic_x2apic_mode (apic)) { -WARN_ON_ONCE (ldr !=kvm_apic_calc_x2apic_ldr (kvm_x2apic_id (apic))); +if (apic_x2apic_mode (apic))return ; - }if (WARN_ON_ONCE (!kvm_apic_map_get_logical_dest (new, ldr, &cluster, &mask))) {
@@ -2964,18 +2962,28 @@ static int kvm_apic_state_fixup(struct k struct kvm_lapic_state *s, bool set) {if (apic_x2apic_mode (vcpu->arch.apic)) { +u32 x2apic_id =kvm_x2apic_id (vcpu->arch.apic);u32 *id = (u32 *)(s->regs +APIC_ID );u32 *ldr = (u32 *)(s->regs +APIC_LDR );u64 icr;if (vcpu->kvm->arch.x2apic_format) { -if (*id != vcpu->vcpu_id) +if (*id != x2apic_id)return -EINVAL ; }else { +/* +* Ignore the userspace value when setting APIC state. +* KVM's model is that the x2APIC ID is readonly, e.g. +* KVM only supports delivering interrupts to KVM's +* version of the x2APIC ID. However, for backwards +* compatibility, don't reject attempts to set a +* mismatched ID for userspace that hasn't opted into +* x2apic_format. +*/ if (set) - *id >>=24 ; + *id = x2apic_id;else - *id <<=24 ; + *id = x2apic_id <<24 ; }/*
@@ -2984,7 +2992,7 @@ static int kvm_apic_state_fixup(struct k* split to ICR+ICR2 in userspace for backwards compatibility. */ if (set) { - *ldr =kvm_apic_calc_x2apic_ldr (*id); + *ldr =kvm_apic_calc_x2apic_ldr (x2apic_id); icr =__kvm_lapic_get_reg (s->regs,APIC_ICR ) | (u64 )__kvm_lapic_get_reg (s->regs,APIC_ICR2 ) <<32 ;
Greg Kroah-Hartman
maintainerPATCH 273/273 KVM: x86: Re-split x2APIC ICR into ICR+ICR2 for AMD (x2AVIC)
In reply to Greg Kroah-Hartman6.6-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 73b42dc69be8564d4951a14d00f827929fe5ef79 upstream.
Re-introduce the "split" x2APIC ICR storage that KVM used prior to Intel's IPI virtualization support, but only for AMD. While not stated anywhere in the APM, despite stating the ICR is a single 64-bit register, AMD CPUs store the 64-bit ICR as two separate 32-bit values in ICR and ICR2. When IPI virtualization (IPIv on Intel, all AVIC flavors on AMD) is enabled, KVM needs to match CPU behavior as some ICR ICR writes will be handled by the CPU, not by KVM.
Add a kvm_x86_ops knob to control the underlying format used by the CPU to store the x2APIC ICR, and tune it to AMD vs. Intel regardless of whether or not x2AVIC is enabled. If KVM is handling all ICR writes, the storage format for x2APIC mode doesn't matter, and having the behavior follow AMD versus Intel will provide better test coverage and ease debugging.
--- arch/x86/include/asm/kvm_host.h | 2 + arch/x86/kvm/lapic.c | 42 ++++++++++++++++++++++++++++------------ arch/x86/kvm/svm/svm.c | 2 + arch/x86/kvm/vmx/vmx.c | 2 + 4 files changed, 36 insertions(+), 12 deletions(-)
arch/x86/include/asm/kvm_host.h +2 -0
@@ -1650,6 +1650,8 @@ struct kvm_x86_ops {void (*enable_irq_window)(struct kvm_vcpu *vcpu);void (*update_cr8_intercept)(struct kvm_vcpu *vcpu,int tpr,int irr);bool (*check_apicv_inhibit_reasons)(enum kvm_apicv_inhibit reason); + +const bool x2apic_icr_is_split;const unsigned long required_apicv_inhibits;bool allow_apicv_in_x2apic_without_x2apic_virtualization;void (*refresh_apicv_exec_ctrl)(struct kvm_vcpu *vcpu);
arch/x86/kvm/lapic.c +30 -12
73 lines not on this page · raw message
arch/x86/kvm/svm/svm.c +2 -0
@@ -5014,6 +5014,8 @@ static struct kvm_x86_ops svm_x86_ops __ .enable_nmi_window = svm_enable_nmi_window, .enable_irq_window = svm_enable_irq_window, .update_cr8_intercept = svm_update_cr8_intercept, + + .x2apic_icr_is_split = true, .set_virtual_apic_mode = avic_refresh_virtual_apic_mode, .refresh_apicv_exec_ctrl = avic_refresh_apicv_exec_ctrl, .apicv_post_state_restore = avic_apicv_post_state_restore,
arch/x86/kvm/vmx/vmx.c +2 -0
@@ -8323,6 +8323,8 @@ static struct kvm_x86_ops vmx_x86_ops __ .enable_nmi_window = vmx_enable_nmi_window, .enable_irq_window = vmx_enable_irq_window, .update_cr8_intercept = vmx_update_cr8_intercept, + + .x2apic_icr_is_split = false, .set_virtual_apic_mode = vmx_set_virtual_apic_mode, .set_apic_access_page_addr = vmx_set_apic_access_page_addr, .refresh_apicv_exec_ctrl = vmx_refresh_apicv_exec_ctrl,
Hello,
Quoted 7 lines · On Thu, 13 Feb 2025 15:26:12 +0100 Greg Kroah-Hartman…
This is the start of the stable review cycle for the 6.6.78 release. There are 273 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 15 Feb 2025 14:23:11 +0000. Anything received after that time might be too late.
This rc kernel passes DAMON functionality test[1] on my test machine. Attaching the test results summary below. Please note that I retrieved the kernel from linux-stable-rc tree[2].
[1] https://github.com/damonitor/damon-tests/tree/next/corr
[2] e4f2e2ad0f5f ("Linux 6.6.78-rc1")
Thanks,
SJ
[...]
---
ok 1 selftests: damon: debugfs_attrs.sh
ok 2 selftests: damon: debugfs_schemes.sh
ok 3 selftests: damon: debugfs_target_ids.sh
ok 4 selftests: damon: debugfs_empty_targets.sh
ok 5 selftests: damon: debugfs_huge_count_read_write.sh
ok 6 selftests: damon: debugfs_duplicate_context_creation.sh
ok 7 selftests: damon: debugfs_rm_non_contexts.sh
ok 8 selftests: damon: sysfs.sh
ok 9 selftests: damon: sysfs_update_removed_scheme_dir.sh
ok 10 selftests: damon: reclaim.sh
ok 11 selftests: damon: lru_sort.sh
ok 1 selftests: damon-tests: kunit.sh
ok 2 selftests: damon-tests: huge_count_read_write.sh
ok 3 selftests: damon-tests: buffer_overflow.sh
ok 4 selftests: damon-tests: rm_contexts.sh
ok 5 selftests: damon-tests: record_null_deref.sh
ok 6 selftests: damon-tests: dbgfs_target_ids_read_before_terminate_race.sh ok 7 selftests: damon-tests: dbgfs_target_ids_pid_leak.sh
ok 8 selftests: damon-tests: damo_tests.sh
ok 9 selftests: damon-tests: masim-record.sh
ok 10 selftests: damon-tests: build_i386.sh
ok 11 selftests: damon-tests: build_arm64.sh # SKIP
ok 12 selftests: damon-tests: build_m68k.sh # SKIP
ok 13 selftests: damon-tests: build_i386_idle_flag.sh
ok 14 selftests: damon-tests: build_i386_highpte.sh
ok 15 selftests: damon-tests: build_nomemcg.sh
[33m
[92mPASS [39m
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.6.78 release. There are 273 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 15 Feb 2025 14:23:11 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.6.78-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.6.y
and the diffstat can be found below.thanks,
greg k-h
On ARCH_BRCMSTB using 32-bit and 64-bit ARM kernels, build tested on BMIPS_GENERIC:
Signature · 1 line
Florian
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.6.78 release. There are 273 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
The kernel, bpf tool, perf tool, and kselftest builds fine for v6.6.78-rc1 on x86 and arm64 Azure VM.
Kernel binary size for x86 build:
text data bss dec hex filename 27313546 16699406 4653056 48666008 2e69598 vmlinux
Kernel binary size for arm64 build:
text data bss dec hex filename 34690958 13850078 970368 49511404 2f37bec vmlinux
Thanks,
Hardik
Am 13.02.2025 um 15:26 schrieb Greg Kroah-Hartman:
Quoted 4 lines
This is the start of the stable review cycle for the 6.6.78 release. There are 273 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Builds, boots and works on my 2-socket Ivy Bridge Xeon E5-2697 v2 server. No dmesg oddities or regressions found.
Beste Grüße,
Peter Schneider
Signature · 8 lines
Climb the mountain not to plant your flag, but to embrace the challenge, enjoy the air and behold the view. Climb it so you can see the world, not so the world can see you. -- David McCullough Jr. OpenPGP: 0xA3828BD796CCE11A8CADE8866E3A92C92C3FF244 Download: https://www.peters-netzplatz.de/download/pschneider1968_pub.asc https://keys.mailvelope.com/pks/lookup?op=get&[email protected] https://keys.mailvelope.com/pks/lookup?op=get&[email protected]
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.6.78 release. There are 273 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 15 Feb 2025 14:23:11 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.6.78-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.6.y
and the diffstat can be found below.thanks,
greg k-h
Built and booted successfully on RISC-V RV64 (HiFive Unmatched).
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.6.78 release. There are 273 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 15 Feb 2025 14:23:11 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.6.78-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.6.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v6.6:
10 builds: 10 pass, 0 fail
26 boots: 26 pass, 0 fail
116 tests: 116 pass, 0 failLinux version: 6.6.78-rc1-ge4f2e2ad0f5f
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra194-p3509-0000+p3668-0000,
tegra20-ventana, tegra210-p2371-2180,
tegra210-p3450-0000, tegra30-cardhu-a04Jon
Hi Greg,
Quoted 4 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.6.78 release. There are 273 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
No problems seen on x86_64 and aarch64 with our testing.
Thanks,
Harshit
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.6.78 release. There are 273 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 15 Feb 2025 14:23:11 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.6.78-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.6.y
and the diffstat can be found below.thanks,
greg k-h
Thank you! LGTM with Alpine Linux configs and packaging.
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 6.6.78 release. There are 273 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sat, 15 Feb 2025 14:23:11 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v6.x/stable-review/patch-6.6.78-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-6.6.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
## Build
* kernel: 6.6.78-rc1
* git: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
* git commit: e4f2e2ad0f5f9ba880bae6771875ab6c3b9eb64e
* git describe: v6.6.77-274-ge4f2e2ad0f5f
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-6.6.y/build/v6.6.77-274-ge4f2e2ad0f5f
## Test Regressions (compared to v6.6.75-390-ge5534ef3ba23)
## Metric Regressions (compared to v6.6.75-390-ge5534ef3ba23)
## Test Fixes (compared to v6.6.75-390-ge5534ef3ba23)
## Metric Fixes (compared to v6.6.75-390-ge5534ef3ba23)
## Test result summary
total: 56711, pass: 45681, fail: 1533, skip: 9334, xfail: 163
## Build Summary
* arc: 6 total, 5 passed, 1 failed
* arm: 133 total, 133 passed, 0 failed
* arm64: 38 total, 37 passed, 1 failed
* i386: 26 total, 24 passed, 2 failed
* mips: 24 total, 24 passed, 0 failed
* parisc: 3 total, 3 passed, 0 failed
* powerpc: 30 total, 30 passed, 0 failed
* riscv: 18 total, 18 passed, 0 failed
* s390: 13 total, 12 passed, 1 failed
* sh: 12 total, 10 passed, 2 failed
* sparc: 7 total, 6 passed, 1 failed
* x86_64: 32 total, 32 passed, 0 failed
## Test suites summary
* boot
* commands
* kselftest-arm64
* kselftest-breakpoints
* kselftest-capabilities
* kselftest-clone3
* kselftest-core
* kselftest-cpu-hotplug
* kselftest-exec
* kselftest-fpu
* kselftest-ftrace
* kselftest-futex
* kselftest-gpio
* kselftest-intel_pstate
* kselftest-ipc
* kselftest-kcmp
* kselftest-kvm
* kselftest-membarrier
* kselftest-memfd
* kselftest-mincore
* kselftest-mqueue
* kselftest-net
* kselftest-net-mptcp
* kselftest-openat2
* kselftest-ptrace
* kselftest-rseq
* kselftest-rtc
* kselftest-seccomp
* kselftest-sigaltstack
* kselftest-size
* kselftest-tc-testing
* kselftest-timers
* kselftest-tmpfs
* kselftest-tpm2
* kselftest-user_events
* kselftest-vDSO
* kselftest-x86
* kunit
* kvm-unit-tests
* libgpiod
* libhugetlbfs
* log-parser-boot
* log-parser-build-clang
* log-parser-build-gcc
* log-parser-test
* ltp-capability
* ltp-commands
* ltp-containers
* ltp-controllers
* ltp-cpuhotplug
* ltp-crypto
* ltp-cve
* ltp-dio
* ltp-fcntl-locktests
* ltp-filecaps
* ltp-fs
* ltp-fs_bind
* ltp-fs_perms_simple
* ltp-hugetlb
* ltp-ipc
* ltp-math
* ltp-mm
* ltp-nptl
* ltp-pty
* ltp-sched
* ltp-smoke
* ltp-syscalls
* ltp-tracing
* perf
* rcutorture
--
Linaro LKFT
https://lkft.linaro.org
Quoted 5 lines · On Thu, 13 Feb 2025 15:26:12 +0100 Greg Kroah-Hartman…
This is the start of the stable review cycle for the 6.6.78 release. There are 273 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Boot-tested under QEMU for Rust x86_64:
Thanks!
Cheers,
Miguel