6.13.3-rc1 review
Subsystems (6)
Greg Kroah-Hartman
maintainerPATCH 275/443 PCI: dwc: ep: Write BAR_MASK before iATU registers in pci_epc_set_bar()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <[email protected]>
commit 33a6938e0c3373f2d11f92d098f337668cd64fdd upstream.
The "DesignWare Cores PCI Express Controller Register Descriptions, Version 4.60a", section "1.21.70 IATU_LWR_TARGET_ADDR_OFF_INBOUND_i", fields LWR_TARGET_RW and LWR_TARGET_HW both state that:
"Field size depends on log2(BAR_MASK+1) in BAR match mode."
I.e. only the upper bits are writable, and the number of writable bits is dependent on the configured BAR_MASK.
If we do not write the BAR_MASK before writing the iATU registers, we are relying the reset value of the BAR_MASK being larger than the requested BAR size (which is supplied in the struct pci_epf_bar which is passed to pci_epc_set_bar()). The reset value of the BAR_MASK is SoC dependent.
Thus, if the struct pci_epf_bar requests a BAR size that is larger than the reset value of the BAR_MASK, the iATU will try to write to read-only bits, which will cause the iATU to end up redirecting to a physical address that is different from the address that was intended.
Thus, we should always write the iATU registers after writing the BAR_MASK.
--- drivers/pci/controller/dwc/pcie-designware-ep.c | 28 ++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-)
drivers/pci/controller/dwc/pcie-designware-ep.c +15 -13
@@ -222,19 +222,10 @@ static int dw_pcie_ep_set_bar(struct pciif ((flags &PCI_BASE_ADDRESS_MEM_TYPE_64 ) && (bar &1 ))return -EINVAL ; - reg =PCI_BASE_ADDRESS_0 + (4 * bar); - -if (!(flags &PCI_BASE_ADDRESS_SPACE )) - type =PCIE_ATU_TYPE_MEM ; -else - type =PCIE_ATU_TYPE_IO ; - - ret =dw_pcie_ep_inbound_atu (ep, func_no, type, epf_bar->phys_addr, bar); -if (ret) -return ret; -if (ep->epf_bar[bar]) -return 0 ; + goto config_atu; + + reg =PCI_BASE_ADDRESS_0 + (4 * bar);dw_pcie_dbi_ro_wr_en (pci);
@@ -246,9 +237,20 @@ static int dw_pcie_ep_set_bar(struct pcidw_pcie_ep_writel_dbi (ep, func_no, reg +4 ,0 ); } - ep->epf_bar[bar] = epf_bar;dw_pcie_dbi_ro_wr_dis (pci); +config_atu: +if (!(flags &PCI_BASE_ADDRESS_SPACE )) + type =PCIE_ATU_TYPE_MEM ; +else + type =PCIE_ATU_TYPE_IO ; + + ret =dw_pcie_ep_inbound_atu (ep, func_no, type, epf_bar->phys_addr, bar); +if (ret) +return ret; + + ep->epf_bar[bar] = epf_bar; +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 276/443 PCI: dwc: ep: Prevent changing BAR size/flags in pci_epc_set_bar()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Niklas Cassel <[email protected]>
commit 3708acbd5f169ebafe1faa519cb28adc56295546 upstream.
In commit 4284c88fff0e ("PCI: designware-ep: Allow pci_epc_set_bar() update inbound map address") set_bar() was modified to support dynamically changing the backing physical address of a BAR that was already configured.
This means that set_bar() can be called twice, without ever calling clear_bar() (as calling clear_bar() would clear the BAR's PCI address assigned by the host).
This can only be done if the new BAR size/flags does not differ from the existing BAR configuration. Add these missing checks.
If we allow set_bar() to set e.g. a new BAR size that differs from the existing BAR size, the new address translation range will be smaller than the BAR size already determined by the host, which would mean that a read past the new BAR size would pass the iATU untranslated, which could allow the host to read memory not belonging to the new struct pci_epf_bar.
While at it, add comments which clarifies the support for dynamically changing the physical address of a BAR. (Which was also missing.)
--- drivers/pci/controller/dwc/pcie-designware-ep.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-)
drivers/pci/controller/dwc/pcie-designware-ep.c +21 -1
@@ -222,8 +222,28 @@ static int dw_pcie_ep_set_bar(struct pciif ((flags &PCI_BASE_ADDRESS_MEM_TYPE_64 ) && (bar &1 ))return -EINVAL ; -if (ep->epf_bar[bar]) +/* +* Certain EPF drivers dynamically change the physical address of a BAR +* (i.e. they call set_bar() twice, without ever calling clear_bar(), as +* calling clear_bar() would clear the BAR's PCI address assigned by the +* host). +*/ +if (ep->epf_bar[bar]) { +/* +* We can only dynamically change a BAR if the new BAR size and +* BAR flags do not differ from the existing configuration. +*/ +if (ep->epf_bar[bar]->barno != bar || + ep->epf_bar[bar]->size != size || + ep->epf_bar[bar]->flags != flags) +return -EINVAL ; + +/* +* When dynamically changing a BAR, skip writing the BAR reg, as +* that would clear the BAR's PCI address assigned by the host. +*/ goto config_atu; + } reg =PCI_BASE_ADDRESS_0 + (4 * bar);
Greg Kroah-Hartman
maintainerPATCH 277/443 nvme-pci: Add TUXEDO InfinityFlex to Samsung sleep quirk
In reply to Greg Kroah-Hartman6.13-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
@@ -3148,7 +3148,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 278/443 nvme-pci: Add TUXEDO IBP Gen9 to Samsung sleep quirk
In reply to Greg Kroah-Hartman6.13-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
@@ -3150,6 +3150,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 279/443 KVM: x86/mmu: Ensure NX huge page recovery thread is alive before waking
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sean Christopherson <[email protected]>
commit 43fb96ae78551d7bfa4ecca956b258f085d67c40 upstream.
When waking a VM's NX huge page recovery thread, ensure the thread is actually alive before trying to wake it. Now that the thread is spawned on-demand during KVM_RUN, a VM without a recovery thread is reachable via the related module params.
BUG: kernel NULL pointer dereference, address: 0000000000000040 #PF: supervisor read access in kernel mode #PF: error_code(0x0000) - not-present page Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015 RIP: 0010:vhost_task_wake+0x5/0x10 Call Trace: <TASK> set_nx_huge_pages+0xcc/0x1e0 [kvm] param_attr_store+0x8a/0xd0 module_attr_store+0x1a/0x30 kernfs_fop_write_iter+0x12f/0x1e0 vfs_write+0x233/0x3e0 ksys_write+0x60/0xd0 do_syscall_64+0x5b/0x160 entry_SYSCALL_64_after_hwframe+0x4b/0x53 RIP: 0033:0x7f3b52710104 </TASK> Modules linked in: kvm_intel kvm CR2: 0000000000000040
Message-ID: <[email protected]>
--- arch/x86/kvm/mmu/mmu.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-)
arch/x86/kvm/mmu/mmu.c +26 -7
@@ -7090,6 +7090,19 @@ static void mmu_destroy_caches(void)kmem_cache_destroy (mmu_page_header_cache); } +static void kvm_wake_nx_recovery_thread (struct kvm *kvm) +{ +/* +* The NX recovery thread is spawned on-demand at the first KVM_RUN and +* may not be valid even though the VM is globally visible. Do nothing, +* as such a VM can't have any possible NX huge pages. +*/ +struct vhost_task *nx_thread =READ_ONCE (kvm->arch.nx_huge_page_recovery_thread); + +if (nx_thread) +vhost_task_wake (nx_thread); +} +static int get_nx_huge_pages (char *buffer,const struct kernel_param *kp) {if (nx_hugepage_mitigation_hard_disabled)
@@ -7150,7 +7163,7 @@ static int set_nx_huge_pages(const charkvm_mmu_zap_all_fast (kvm);mutex_unlock (&kvm->slots_lock); -vhost_task_wake (kvm->arch.nx_huge_page_recovery_thread); +kvm_wake_nx_recovery_thread (kvm); }mutex_unlock (&kvm_lock); }
@@ -7279,7 +7292,7 @@ static int set_nx_huge_pages_recovery_pamutex_lock (&kvm_lock);list_for_each_entry (kvm, &vm_list, vm_list) -vhost_task_wake (kvm->arch.nx_huge_page_recovery_thread); +kvm_wake_nx_recovery_thread (kvm);mutex_unlock (&kvm_lock); }
@@ -7415,14 +7428,20 @@ static void kvm_mmu_start_lpage_recovery { struct kvm_arch *ka = container_of(once, struct kvm_arch, nx_once); struct kvm *kvm = container_of(ka, struct kvm, arch); +struct vhost_task *nx_thread; kvm->arch.nx_huge_page_last =get_jiffies_64 (); - kvm->arch.nx_huge_page_recovery_thread =vhost_task_create ( - kvm_nx_huge_page_recovery_worker, kvm_nx_huge_page_recovery_worker_kill, - kvm,"kvm-nx-lpage-recovery" ); + nx_thread =vhost_task_create (kvm_nx_huge_page_recovery_worker, + kvm_nx_huge_page_recovery_worker_kill, + kvm,"kvm-nx-lpage-recovery" ); + +if (!nx_thread) +return ; + +vhost_task_start (nx_thread); -if (kvm->arch.nx_huge_page_recovery_thread) -vhost_task_start (kvm->arch.nx_huge_page_recovery_thread); +/* Make the task visible only once it is fully started. */ +WRITE_ONCE (kvm->arch.nx_huge_page_recovery_thread, nx_thread); }int kvm_mmu_post_init_vm (struct kvm *kvm)
Greg Kroah-Hartman
maintainerPATCH 280/443 scsi: st: Dont set pos_unknown just after device recognition
In reply to Greg Kroah-Hartman6.13-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
@@ -1030,6 +1030,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);
@@ -4328,6 +4333,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 281/443 scsi: qla2xxx: Move FCE Trace buffer allocation to user control
In reply to Greg Kroah-Hartman6.13-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
@@ -4098,6 +4098,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 282/443 scsi: ufs: qcom: Fix crypto key eviction
In reply to Greg Kroah-Hartman6.13-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
@@ -155,8 +155,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];
@@ -164,14 +165,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 283/443 scsi: ufs: core: Fix use-after free in init error and remove paths
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: André Draszik <[email protected]>
commit f8fb2403ddebb5eea0033d90d9daae4c88749ada upstream.
devm_blk_crypto_profile_init() registers a cleanup handler to run when the associated (platform-) device is being released. For UFS, the crypto private data and pointers are stored as part of the ufs_hba's data structure 'struct ufs_hba::crypto_profile'. This structure is allocated as part of the underlying ufshcd and therefore Scsi_host allocation.
During driver release or during error handling in ufshcd_pltfrm_init(), this structure is released as part of ufshcd_dealloc_host() before the (platform-) device associated with the crypto call above is released. Once this device is released, the crypto cleanup code will run, using the just-released 'struct ufs_hba::crypto_profile'. This causes a use-after-free situation:
Call trace: kfree+0x60/0x2d8 (P) kvfree+0x44/0x60 blk_crypto_profile_destroy_callback+0x28/0x70 devm_action_release+0x1c/0x30 release_nodes+0x6c/0x108 devres_release_all+0x98/0x100 device_unbind_cleanup+0x20/0x70 really_probe+0x218/0x2d0
In other words, the initialisation code flow is:
platform-device probe
ufshcd_pltfrm_init()
ufshcd_alloc_host()
scsi_host_alloc()
allocation of struct ufs_hba
creation of scsi-host devices
devm_blk_crypto_profile_init()
devm registration of cleanup handler using platform-device
and during error handling of ufshcd_pltfrm_init() or during driver removal:
ufshcd_dealloc_host()
scsi_host_put()
put_device(scsi-host)
release of struct ufs_hba
put_device(platform-device)
crypto cleanup handler
To fix this use-after free, change ufshcd_alloc_host() to register a devres action to automatically cleanup the underlying SCSI device on ufshcd destruction, without requiring explicit calls to ufshcd_dealloc_host(). This way:
* the crypto profile and all other ufs_hba-owned resources are destroyed before SCSI (as they've been registered after)
* a memleak is plugged in tc-dwc-g210-pci.c remove() as a side-effect
* EXPORT_SYMBOL_GPL(ufshcd_dealloc_host) can be removed fully as it's not needed anymore
* no future drivers using ufshcd_alloc_host() could ever forget adding the cleanup
--- drivers/ufs/core/ufshcd.c | 31 +++++++++++++++++++++---------- drivers/ufs/host/ufshcd-pci.c | 2 -- drivers/ufs/host/ufshcd-pltfrm.c | 28 +++++++++------------------- include/ufs/ufshcd.h | 1 - 4 files changed, 30 insertions(+), 32 deletions(-)
drivers/ufs/core/ufshcd.c +21 -10
@@ -10293,16 +10293,6 @@ EXPORT_SYMBOL_GPL(ufshcd_system_thaw);#endif /* CONFIG_PM_SLEEP */ /** -* ufshcd_dealloc_host - deallocate Host Bus Adapter (HBA) -* @hba: pointer to Host Bus Adapter (HBA) -*/ -void ufshcd_dealloc_host (struct ufs_hba *hba) -{ -scsi_host_put (hba->host); -} -EXPORT_SYMBOL_GPL (ufshcd_dealloc_host); - -/** * ufshcd_set_dma_mask - Set dma mask based on the controller * addressing capability * @hba: per adapter instance
@@ -10321,11 +10311,25 @@ static int ufshcd_set_dma_mask(struct uf }/** +* ufshcd_devres_release - devres cleanup handler, invoked during release of +* hba->dev +* @host: pointer to SCSI host +*/ +static void ufshcd_devres_release (void *host) +{ +scsi_host_put (host); +} + +/** * ufshcd_alloc_host - allocate Host Bus Adapter (HBA) * @dev: pointer to device handle * @hba_handle: driver private handle * * Return: 0 on success, non-zero value on failure. +* +* NOTE: There is no corresponding ufshcd_dealloc_host() because this function +* keeps track of its allocations using devres and deallocates everything on +* device removal automatically. */ int ufshcd_alloc_host (struct device *dev,struct ufs_hba **hba_handle) {
@@ -10347,6 +10351,13 @@ int ufshcd_alloc_host(struct device *dev err = -ENOMEM ; goto out_error; } + + err =devm_add_action_or_reset (dev, ufshcd_devres_release, + host); +if (err) +return dev_err_probe (dev, err, +"failed to add ufshcd dealloc action\n" ); + host->nr_maps =HCTX_TYPE_POLL +1 ; hba =shost_priv (host); hba->host = host;
drivers/ufs/host/ufshcd-pci.c +0 -2
@@ -562,7 +562,6 @@ static void ufshcd_pci_remove(struct pcipm_runtime_forbid (&pdev->dev);pm_runtime_get_noresume (&pdev->dev);ufshcd_remove (hba); -ufshcd_dealloc_host (hba); }/**
@@ -605,7 +604,6 @@ ufshcd_pci_probe(struct pci_dev *pdev, c err =ufshcd_init (hba, mmio_base, pdev->irq);if (err) {dev_err (&pdev->dev,"Initialization failed\n" ); -ufshcd_dealloc_host (hba);return err; }
drivers/ufs/host/ufshcd-pltfrm.c +9 -19
@@ -465,21 +465,17 @@ int ufshcd_pltfrm_init(struct platform_dstruct device *dev = &pdev->dev; mmio_base =devm_platform_ioremap_resource (pdev,0 ); -if (IS_ERR (mmio_base)) { - err =PTR_ERR (mmio_base); - goto out; - } +if (IS_ERR (mmio_base)) +return PTR_ERR (mmio_base); irq =platform_get_irq (pdev,0 ); -if (irq <0 ) { - err = irq; - goto out; - } +if (irq <0 ) +return irq; err =ufshcd_alloc_host (dev, &hba);if (err) {dev_err (dev,"Allocation failed\n" ); - goto out; +return err; } hba->vops = vops;
@@ -488,13 +484,13 @@ int ufshcd_pltfrm_init(struct platform_dif (err) {dev_err (dev,"%s: clock parse failed %d\n" , __func__, err); - goto dealloc_host; +return err; } err =ufshcd_parse_regulator_info (hba);if (err) {dev_err (dev,"%s: regulator init failed %d\n" , __func__, err); - goto dealloc_host; +return err; }ufshcd_init_lanes_per_dir (hba);
@@ -502,25 +498,20 @@ int ufshcd_pltfrm_init(struct platform_d err =ufshcd_parse_operating_points (hba);if (err) {dev_err (dev,"%s: OPP parse failed %d\n" , __func__, err); - goto dealloc_host; +return err; } err =ufshcd_init (hba, mmio_base, irq);if (err) {dev_err_probe (dev, err,"Initialization failed with error %d\n" , err); - goto dealloc_host; +return err; }pm_runtime_set_active (dev);pm_runtime_enable (dev);return 0 ; - -dealloc_host: -ufshcd_dealloc_host (hba); -out: -return err; }EXPORT_SYMBOL_GPL (ufshcd_pltfrm_init);
@@ -534,7 +525,6 @@ void ufshcd_pltfrm_remove(struct platforpm_runtime_get_sync (&pdev->dev);ufshcd_remove (hba); -ufshcd_dealloc_host (hba);pm_runtime_disable (&pdev->dev);pm_runtime_put_noidle (&pdev->dev); }
include/ufs/ufshcd.h +0 -1
@@ -1297,7 +1297,6 @@ static inline void ufshcd_rmwl(struct ufvoid ufshcd_enable_irq (struct ufs_hba *hba);void ufshcd_disable_irq (struct ufs_hba *hba);int ufshcd_alloc_host (struct device *,struct ufs_hba **); -void ufshcd_dealloc_host (struct ufs_hba *);int ufshcd_hba_enable (struct ufs_hba *hba);int ufshcd_init (struct ufs_hba *,void __iomem *,unsigned int );int ufshcd_link_recovery (struct ufs_hba *hba);
Greg Kroah-Hartman
maintainerPATCH 284/443 scsi: storvsc: Set correct data length for sending SCSI command without payload
In reply to Greg Kroah-Hartman6.13-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 285/443 scsi: core: Do not retry I/Os during depopulation
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Igor Pylypiv <[email protected]>
commit 9ff7c383b8ac0c482a1da7989f703406d78445c6 upstream.
Fail I/Os instead of retry to prevent user space processes from being blocked on the I/O completion for several minutes.
Retrying I/Os during "depopulation in progress" or "depopulation restore in progress" results in a continuous retry loop until the depopulation completes or until the I/O retry loop is aborted due to a timeout by the scsi_cmd_runtime_exceeced().
Depopulation is slow and can take 24+ hours to complete on 20+ TB HDDs. Most I/Os in the depopulation retry loop end up taking several minutes before returning the failure to user space.
--- drivers/scsi/scsi_lib.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/scsi/scsi_lib.c +7 -2
@@ -868,13 +868,18 @@ static void scsi_io_completion_action(stcase 0x1a :/* start stop unit in progress */ case 0x1b :/* sanitize in progress */ case 0x1d :/* configuration in progress */ -case 0x24 :/* depopulation in progress */ -case 0x25 :/* depopulation restore in progress */ action =ACTION_DELAYED_RETRY ;break ;case 0x0a :/* ALUA state transition */ action =ACTION_DELAYED_REPREP ;break ; +/* +* Depopulation might take many hours, +* thus it is not worthwhile to retry. +*/ +case 0x24 :/* depopulation in progress */ +case 0x25 :/* depopulation restore in progress */ + fallthrough;default : action =ACTION_FAIL ;break ;
Greg Kroah-Hartman
maintainerPATCH 286/443 kbuild: Move -Wenum-enum-conversion to W=2
In reply to Greg Kroah-Hartman6.13-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
@@ -130,7 +130,6 @@ KBUILD_CFLAGS += $(call cc-disable-warni KBUILD_CFLAGS += -Wno-tautological-constant-out-of-range-compare KBUILD_CFLAGS += $(call cc-disable-warning, unaligned-access) KBUILD_CFLAGS += -Wno-enum-compare-conditional -KBUILD_CFLAGS += -Wno-enum-enum-conversion endif endif
@@ -154,6 +153,10 @@ KBUILD_CFLAGS += -Wno-missing-field-init 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_GCC KBUILD_CFLAGS += -Wno-maybe-uninitialized endif
Greg Kroah-Hartman
maintainerPATCH 287/443 pidfs: check for valid ioctl commands
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <[email protected]>
commit 8ce3528188207a2e1896cc3173fba6d99a59013a upstream.
Prior to doing any work, check whether the provided ioctl command is supported by pidfs.
--- fs/pidfs.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
fs/pidfs.c +24 -0
@@ -190,6 +190,27 @@ static long pidfd_info(struct task_strucreturn 0 ; } +static bool pidfs_ioctl_valid (unsigned int cmd) +{ +switch (cmd) { +case FS_IOC_GETVERSION : +case PIDFD_GET_CGROUP_NAMESPACE : +case PIDFD_GET_INFO : +case PIDFD_GET_IPC_NAMESPACE : +case PIDFD_GET_MNT_NAMESPACE : +case PIDFD_GET_NET_NAMESPACE : +case PIDFD_GET_PID_FOR_CHILDREN_NAMESPACE : +case PIDFD_GET_TIME_NAMESPACE : +case PIDFD_GET_TIME_FOR_CHILDREN_NAMESPACE : +case PIDFD_GET_UTS_NAMESPACE : +case PIDFD_GET_USER_NAMESPACE : +case PIDFD_GET_PID_NAMESPACE : +return true; + } + +return false; +} +static long pidfd_ioctl (struct file *file,unsigned int cmd,unsigned long arg) { struct task_struct *task __free(put_task) = NULL;
@@ -198,6 +219,9 @@ static long pidfd_ioctl(struct file *filstruct ns_common *ns_common =NULL ;struct pid_namespace *pid_ns; +if (!pidfs_ioctl_valid (cmd)) +return -ENOIOCTLCMD ; + task =get_pid_task (pid,PIDTYPE_PID );if (!task)return -ESRCH ;
Greg Kroah-Hartman
maintainerPATCH 288/443 pidfs: improve ioctl handling
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Brauner <[email protected]>
commit 091ee63e36e8289f9067f659a48d497911e49d6f upstream.
Pidfs supports extensible and non-extensible ioctls. The extensible ioctls need to check for the ioctl number itself not just the ioctl command otherwise both backward- and forward compatibility are broken.
The pidfs ioctl handler also needs to look at the type of the ioctl command to guard against cases where "[...] a daemon receives some random file descriptor from a (potentially less privileged) client and expects the FD to be of some specific type, it might call ioctl() on this FD with some type-specific command and expect the call to fail if the FD is of the wrong type; but due to the missing type check, the kernel instead performs some action that userspace didn't expect." (cf. [1]]
--- fs/pidfs.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
fs/pidfs.c +11 -1
@@ -195,7 +195,6 @@ static bool pidfs_ioctl_valid(unsigned iswitch (cmd) {case FS_IOC_GETVERSION :case PIDFD_GET_CGROUP_NAMESPACE : -case PIDFD_GET_INFO :case PIDFD_GET_IPC_NAMESPACE :case PIDFD_GET_MNT_NAMESPACE :case PIDFD_GET_NET_NAMESPACE :
@@ -208,6 +207,17 @@ static bool pidfs_ioctl_valid(unsigned ireturn true; } +/* Extensible ioctls require some more careful checks. */ +switch (_IOC_NR (cmd)) { +case _IOC_NR (PIDFD_GET_INFO ): +/* +* Try to prevent performing a pidfd ioctl when someone +* erronously mistook the file descriptor for a pidfd. +* This is not perfect but will catch most cases. +*/ +return (_IOC_TYPE (cmd) ==_IOC_TYPE (PIDFD_GET_INFO )); + } +return false; }
Greg Kroah-Hartman
maintainerPATCH 289/443 rust: init: use explicit ABI to clean warning in future compilers
In reply to Greg Kroah-Hartman6.13-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
@@ -854,7 +854,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 290/443 x86: rust: set rustc-abi=x86-softfloat on rustc>=1.86.0
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alice Ryhl <[email protected]>
commit 6273a058383e05465083b535ed9469f2c8a48321 upstream.
When using Rust on the x86 architecture, we are currently using the unstable target.json feature to specify the compilation target. Rustc is going to change how softfloat is specified in the target.json file on x86, thus update generate_rust_target.rs to specify softfloat using the new option.
Note that if you enable this parameter with a compiler that does not recognize it, then that triggers a warning but it does not break the build.
[ For future reference, this solves the following error:
RUSTC L rust/core.o
error: Error loading target specification: target feature soft-float is incompatible with the ABI but gets enabled in target spec. Run rustc --print target-list for a list of built-in targets
- Miguel ]
[ Added 6.13.y too to Cc: stable tag and added reasoning to avoid
over-backporting. - Miguel ]
--- scripts/generate_rust_target.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
scripts/generate_rust_target.rs +18 -0
@@ -165,6 +165,18 @@ impl KernelConfig {let option ="CONFIG_" .to_owned () + option; self.0 .contains_key (&option) } + +/// Is the rustc version at least `major.minor.patch`? +fn rustc_version_atleast (&self, major:u32 , minor:u32 , patch:u32 ) ->bool { +let check_version =100000 * major +100 * minor + patch; +let actual_version = self + .0 + .get ("CONFIG_RUSTC_VERSION" ) + .unwrap () + .parse ::<u32 >() + .unwrap (); + check_version <= actual_version + } }fn main () {
@@ -182,6 +194,9 @@ fn main() { } }else if cfg.has ("X86_64" ) { ts.push ("arch" ,"x86_64" ); +if cfg.rustc_version_atleast (1 ,86 ,0 ) { + ts.push ("rustc-abi" ,"x86-softfloat" ); + } ts.push ("data-layout" , "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128",
@@ -215,6 +230,9 @@ fn main() {panic! ("32-bit x86 only works under UML" ); } ts.push ("arch" ,"x86" ); +if cfg.rustc_version_atleast (1 ,86 ,0 ) { + ts.push ("rustc-abi" ,"x86-softfloat" ); + } ts.push ("data-layout" , "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-i128:128-f64:32:64-f80:32-n8:16:32-S128",
Greg Kroah-Hartman
maintainerPATCH 291/443 x86/acpi: Fix LAPIC/x2APIC parsing order
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Rui <[email protected]>
commit 0141978ae75bd48bac13fca6de131a5071c32011 upstream.
On some systems, the same CPU (with the same APIC ID) is assigned a different logical CPU id after commit ec9aedb2aa1a ("x86/acpi: Ignore invalid x2APIC entries").
This means that Linux enumerates the CPUs in a different order, which violates ACPI specification[1] that states:
"OSPM should initialize processors in the order that they appear in
the MADT"
The problematic commit parses all LAPIC entries before any x2APIC entries, aiming to ignore x2APIC entries with APIC ID < 255 when valid LAPIC entries exist. However, it disrupts the CPU enumeration order on systems where x2APIC entries precede LAPIC entries in the MADT.
Fix this problem by:
1) Parsing LAPIC entries first without registering them in the topology to evaluate whether valid LAPIC entries exist.
2) Restoring the MADT in order parser which invokes either the LAPIC or the X2APIC parser function depending on the entry type.
The X2APIC parser still ignores entries < 0xff in case that #1 found valid LAPIC entries independent of their position in the MADT table.
--- arch/x86/kernel/acpi/boot.c | 50 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 5 deletions(-)
arch/x86/kernel/acpi/boot.c +45 -5
@@ -227,6 +227,28 @@ acpi_parse_x2apic(union acpi_subtable_he }static int __init +acpi_check_lapic (union acpi_subtable_headers *header,const unsigned long end) +{ +struct acpi_madt_local_apic *processor =NULL ; + + processor = (struct acpi_madt_local_apic *)header; + +if (BAD_MADT_ENTRY (processor, end)) +return -EINVAL ; + +/* Ignore invalid ID */ +if (processor->id ==0xff ) +return 0 ; + +/* Ignore processors that can not be onlined */ +if (!acpi_is_processor_usable (processor->lapic_flags)) +return 0 ; + + has_lapic_cpus = true; +return 0 ; +} + +static int __init acpi_parse_lapic (union acpi_subtable_headers * header,const unsigned long end) {struct acpi_madt_local_apic *processor =NULL ;
@@ -257,7 +279,6 @@ acpi_parse_lapic(union acpi_subtable_hea processor->processor_id,/* ACPI ID */ processor->lapic_flags & ACPI_MADT_ENABLED); - has_lapic_cpus = true;return 0 ; }
@@ -1029,6 +1050,8 @@ static int __init early_acpi_parse_madt_static int __init acpi_parse_madt_lapic_entries (void ) {int count, x2count =0 ; +struct acpi_subtable_proc madt_proc[2 ]; +int ret;if (!boot_cpu_has (X86_FEATURE_APIC ))return -ENODEV ;
@@ -1037,10 +1060,27 @@ static int __init acpi_parse_madt_lapic_ acpi_parse_sapic, MAX_LOCAL_APIC);if (!count) { - count =acpi_table_parse_madt (ACPI_MADT_TYPE_LOCAL_APIC , - acpi_parse_lapic,MAX_LOCAL_APIC ); - x2count =acpi_table_parse_madt (ACPI_MADT_TYPE_LOCAL_X2APIC , - acpi_parse_x2apic,MAX_LOCAL_APIC ); +/* Check if there are valid LAPIC entries */ +acpi_table_parse_madt (ACPI_MADT_TYPE_LOCAL_APIC , acpi_check_lapic,MAX_LOCAL_APIC ); + +/* +* Enumerate the APIC IDs in the order that they appear in the +* MADT, no matter LAPIC entry or x2APIC entry is used. +*/ +memset (madt_proc,0 ,sizeof (madt_proc)); + madt_proc[0 ].id =ACPI_MADT_TYPE_LOCAL_APIC ; + madt_proc[0 ].handler = acpi_parse_lapic; + madt_proc[1 ].id =ACPI_MADT_TYPE_LOCAL_X2APIC ; + madt_proc[1 ].handler = acpi_parse_x2apic; + ret =acpi_table_parse_entries_array (ACPI_SIG_MADT , +sizeof (struct acpi_table_madt ), + madt_proc,ARRAY_SIZE (madt_proc),MAX_LOCAL_APIC ); +if (ret <0 ) { +pr_err ("Error parsing LAPIC/X2APIC entries\n" ); +return ret; + } + count = madt_proc[0 ].count; + x2count = madt_proc[1 ].count; }if (!count && !x2count) {pr_err ("No LAPIC entries present\n" );
Greg Kroah-Hartman
maintainerPATCH 292/443 x86/boot: Use -std=gnu11 to fix build with GCC 15
In reply to Greg Kroah-Hartman6.13-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
@@ -25,6 +25,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 293/443 ubi: Add a check for ubi_num
In reply to Greg Kroah-Hartman6.13-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
@@ -1537,7 +1537,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 294/443 ARM: dts: dra7: Add bus_dma_limit for l4 cfg bus
In reply to Greg Kroah-Hartman6.13-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 295/443 ARM: dts: ti/omap: gta04: fix pm issues caused by spi module
In reply to Greg Kroah-Hartman6.13-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 296/443 arm64: dts: mediatek: mt8183: Disable DPI display output by default
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
commit 93a680af46436780fd64f4e856a4cfa8b393be6e upstream.
This reverts commit 377548f05bd0905db52a1d50e5b328b9b4eb049d.
Most SoC dtsi files have the display output interfaces disabled by default, and only enabled on boards that utilize them. The MT8183 has it backwards: the display outputs are left enabled by default, and only disabled at the board level.
Reverse the situation for the DPI output so that it follows the normal scheme. For ease of backporting the DSI output is handled in a separate patch.
--- arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 5 ----- arch/arm64/boot/dts/mediatek/mt8183.dtsi | 1 + 2 files changed, 1 insertion(+), 5 deletions(-)
arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi +0 -5
@@ -269,11 +269,6 @@ }; }; -&dpi0 { - /* TODO Re-enable after DP to Type-C port muxing can be described */ - status = "disabled"; -}; - &gic { mediatek,broken-save-restore-fw; };
arch/arm64/boot/dts/mediatek/mt8183.dtsi +1 -0
@@ -1846,6 +1846,7 @@ <&mmsys CLK_MM_DPI_MM>, <&apmixedsys CLK_APMIXED_TVDPLL>; clock-names = "pixel", "engine", "pll"; + status = "disabled"; port { dpi_out: endpoint { };
Greg Kroah-Hartman
maintainerPATCH 297/443 arm64: dts: mediatek: mt8183: Disable DSI display output by default
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
commit 26f6e91fa29a58fdc76b47f94f8f6027944a490c upstream.
Most SoC dtsi files have the display output interfaces disabled by default, and only enabled on boards that utilize them. The MT8183 has it backwards: the display outputs are left enabled by default, and only disabled at the board level.
Reverse the situation for the DSI output so that it follows the normal scheme. For ease of backporting the DPI output is handled in a separate patch.
--- arch/arm64/boot/dts/mediatek/mt8183-pumpkin.dts | 4 ---- arch/arm64/boot/dts/mediatek/mt8183.dtsi | 1 + 2 files changed, 1 insertion(+), 4 deletions(-)
arch/arm64/boot/dts/mediatek/mt8183-pumpkin.dts +0 -4
@@ -522,10 +522,6 @@ status = "okay"; }; -&dsi0 { - status = "disabled"; -}; - &dpi0 { pinctrl-names = "default", "sleep"; pinctrl-0 = <&dpi_func_pins>;
arch/arm64/boot/dts/mediatek/mt8183.dtsi +1 -0
@@ -1835,6 +1835,7 @@ resets = <&mmsys MT8183_MMSYS_SW0_RST_B_DISP_DSI0>; phys = <&mipi_tx0>; phy-names = "dphy"; + status = "disabled"; }; dpi0: dpi@14015000 {
Greg Kroah-Hartman
maintainerPATCH 298/443 arm64: dts: qcom: sdx75: Fix MPSS memory length
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 9a27f0e1869e992e4107e2af8ec348e1a3b9d4d5 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/sdx75.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sdx75.dtsi +1 -1
@@ -893,7 +893,7 @@ remoteproc_mpss: remoteproc@4080000 { compatible = "qcom,sdx75-mpss-pas"; - reg = <0 0x04080000 0 0x4040>; + reg = <0 0x04080000 0 0x10000>; interrupts-extended = <&intc GIC_SPI 250 IRQ_TYPE_EDGE_RISING>, <&smp2p_modem_in 0 IRQ_TYPE_EDGE_RISING>,
Greg Kroah-Hartman
maintainerPATCH 299/443 arm64: dts: qcom: x1e80100: Fix ADSP memory base and length
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 7a003077366946a5ed1adab6d177efb2ab59e815 upstream.
The address space in ADSP PAS (Peripheral Authentication Service) remoteproc node should point to the QDSP PUB address space (QDSP6...SS_PUB): 0x0680_0000 with length of 0x10000.
0x3000_0000, value used so far, is the main region of CDSP and was simply copied from other/older DTS.
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/x1e80100.dtsi | 274 ++++++++++++++++----------------- 1 file changed, 137 insertions(+), 137 deletions(-)
arch/arm64/boot/dts/qcom/x1e80100.dtsi +137 -137
@@ -3518,6 +3518,143 @@ #interconnect-cells = <2>; }; + remoteproc_adsp: remoteproc@6800000 { + compatible = "qcom,x1e80100-adsp-pas"; + reg = <0x0 0x06800000 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"; + + interconnects = <&lpass_lpicx_noc MASTER_LPASS_PROC QCOM_ICC_TAG_ALWAYS + &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>; + + memory-region = <&adspslpi_mem>, + <&q6_adsp_dtb_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>; + + 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 0x1003 0x80>, + <&apps_smmu 0x1063 0x0>; + dma-coherent; + }; + + compute-cb@4 { + compatible = "qcom,fastrpc-compute-cb"; + reg = <4>; + iommus = <&apps_smmu 0x1004 0x80>, + <&apps_smmu 0x1064 0x0>; + dma-coherent; + }; + + compute-cb@5 { + compatible = "qcom,fastrpc-compute-cb"; + reg = <5>; + iommus = <&apps_smmu 0x1005 0x80>, + <&apps_smmu 0x1065 0x0>; + dma-coherent; + }; + + compute-cb@6 { + compatible = "qcom,fastrpc-compute-cb"; + reg = <6>; + iommus = <&apps_smmu 0x1006 0x80>, + <&apps_smmu 0x1066 0x0>; + dma-coherent; + }; + + compute-cb@7 { + compatible = "qcom,fastrpc-compute-cb"; + reg = <7>; + iommus = <&apps_smmu 0x1007 0x80>, + <&apps_smmu 0x1067 0x0>; + dma-coherent; + }; + }; + + gpr { + compatible = "qcom,gpr"; + qcom,glink-channels = "adsp_apps"; + qcom,domain = <GPR_DOMAIN_ID_ADSP>; + qcom,intents = <512 20>; + #address-cells = <1>; + #size-cells = <0>; + + q6apm: service@1 { + compatible = "qcom,q6apm"; + reg = <GPR_APM_MODULE_IID>; + #sound-dai-cells = <0>; + qcom,protection-domain = "avs/audio", + "msm/adsp/audio_pd"; + + q6apmbedai: bedais { + compatible = "qcom,q6apm-lpass-dais"; + #sound-dai-cells = <1>; + }; + + q6apmdai: dais { + compatible = "qcom,q6apm-dais"; + iommus = <&apps_smmu 0x1001 0x80>, + <&apps_smmu 0x1061 0x0>; + }; + }; + + q6prm: service@2 { + compatible = "qcom,q6prm"; + reg = <GPR_PRM_MODULE_IID>; + qcom,protection-domain = "avs/audio", + "msm/adsp/audio_pd"; + + q6prmcc: clock-controller { + compatible = "qcom,q6prm-lpass-clocks"; + #clock-cells = <2>; + }; + }; + }; + }; + }; + lpass_wsa2macro: codec@6aa0000 { compatible = "qcom,x1e80100-lpass-wsa-macro", "qcom,sm8550-lpass-wsa-macro"; reg = <0 0x06aa0000 0 0x1000>;
@@ -6111,143 +6248,6 @@ interrupts = <GIC_SPI 266 IRQ_TYPE_LEVEL_HIGH>; }; - remoteproc_adsp: remoteproc@30000000 { - compatible = "qcom,x1e80100-adsp-pas"; - reg = <0 0x30000000 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"; - - interconnects = <&lpass_lpicx_noc MASTER_LPASS_PROC QCOM_ICC_TAG_ALWAYS - &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>; - - memory-region = <&adspslpi_mem>, - <&q6_adsp_dtb_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>; - - 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 0x1003 0x80>, - <&apps_smmu 0x1063 0x0>; - dma-coherent; - }; - - compute-cb@4 { - compatible = "qcom,fastrpc-compute-cb"; - reg = <4>; - iommus = <&apps_smmu 0x1004 0x80>, - <&apps_smmu 0x1064 0x0>; - dma-coherent; - }; - - compute-cb@5 { - compatible = "qcom,fastrpc-compute-cb"; - reg = <5>; - iommus = <&apps_smmu 0x1005 0x80>, - <&apps_smmu 0x1065 0x0>; - dma-coherent; - }; - - compute-cb@6 { - compatible = "qcom,fastrpc-compute-cb"; - reg = <6>; - iommus = <&apps_smmu 0x1006 0x80>, - <&apps_smmu 0x1066 0x0>; - dma-coherent; - }; - - compute-cb@7 { - compatible = "qcom,fastrpc-compute-cb"; - reg = <7>; - iommus = <&apps_smmu 0x1007 0x80>, - <&apps_smmu 0x1067 0x0>; - dma-coherent; - }; - }; - - gpr { - compatible = "qcom,gpr"; - qcom,glink-channels = "adsp_apps"; - qcom,domain = <GPR_DOMAIN_ID_ADSP>; - qcom,intents = <512 20>; - #address-cells = <1>; - #size-cells = <0>; - - q6apm: service@1 { - compatible = "qcom,q6apm"; - reg = <GPR_APM_MODULE_IID>; - #sound-dai-cells = <0>; - qcom,protection-domain = "avs/audio", - "msm/adsp/audio_pd"; - - q6apmbedai: bedais { - compatible = "qcom,q6apm-lpass-dais"; - #sound-dai-cells = <1>; - }; - - q6apmdai: dais { - compatible = "qcom,q6apm-dais"; - iommus = <&apps_smmu 0x1001 0x80>, - <&apps_smmu 0x1061 0x0>; - }; - }; - - q6prm: service@2 { - compatible = "qcom,q6prm"; - reg = <GPR_PRM_MODULE_IID>; - qcom,protection-domain = "avs/audio", - "msm/adsp/audio_pd"; - - q6prmcc: clock-controller { - compatible = "qcom,q6prm-lpass-clocks"; - #clock-cells = <2>; - }; - }; - }; - }; - }; - remoteproc_cdsp: remoteproc@32300000 { compatible = "qcom,x1e80100-cdsp-pas"; reg = <0 0x32300000 0 0x1400000>;
Greg Kroah-Hartman
maintainerPATCH 300/443 arm64: dts: qcom: x1e80100: Fix CDSP memory length
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 3de1bf12c6bfb9a92f0803941ecae39b08470446 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/x1e80100.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/x1e80100.dtsi +1 -1
@@ -6250,7 +6250,7 @@ remoteproc_cdsp: remoteproc@32300000 { compatible = "qcom,x1e80100-cdsp-pas"; - reg = <0 0x32300000 0 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 301/443 arm64: dts: qcom: sm6115: Fix MPSS memory length
In reply to Greg Kroah-Hartman6.13-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
@@ -2027,7 +2027,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 302/443 arm64: dts: qcom: sm6115: Fix CDSP memory length
In reply to Greg Kroah-Hartman6.13-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
@@ -2744,7 +2744,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 303/443 arm64: dts: qcom: sm6115: Fix ADSP memory base and length
In reply to Greg Kroah-Hartman6.13-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
@@ -2670,9 +2670,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 304/443 arm64: dts: qcom: sm6350: Fix ADSP memory length
In reply to Greg Kroah-Hartman6.13-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
@@ -1283,7 +1283,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_EDGE_RISING>, <&smp2p_adsp_in 0 IRQ_TYPE_EDGE_RISING>,
Greg Kroah-Hartman
maintainerPATCH 305/443 arm64: dts: qcom: sm6350: Fix MPSS memory length
In reply to Greg Kroah-Hartman6.13-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
@@ -1503,7 +1503,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 306/443 arm64: dts: qcom: sm6350: Fix uart1 interconnect path
In reply to Greg Kroah-Hartman6.13-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
@@ -936,7 +936,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 307/443 arm64: dts: qcom: sm6375: Fix ADSP memory length
In reply to Greg Kroah-Hartman6.13-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
@@ -1559,7 +1559,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_EDGE_RISING>, <&smp2p_adsp_in 0 IRQ_TYPE_EDGE_RISING>,
Greg Kroah-Hartman
maintainerPATCH 308/443 arm64: dts: qcom: sm6375: Fix CDSP memory base and length
In reply to Greg Kroah-Hartman6.13-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
@@ -1595,9 +1595,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 309/443 arm64: dts: qcom: sm6375: Fix MPSS memory base and length
In reply to Greg Kroah-Hartman6.13-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
@@ -1516,9 +1516,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 310/443 arm64: dts: qcom: sm8350: Fix ADSP memory base and length
In reply to Greg Kroah-Hartman6.13-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
@@ -1876,6 +1876,142 @@ reg = <0x0 0x1fc0000 0x0 0x30000>; }; + 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>,
@@ -3285,142 +3421,6 @@ dma-coherent; }; - 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 311/443 arm64: dts: qcom: sm8350: Fix CDSP memory base and length
In reply to Greg Kroah-Hartman6.13-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
@@ -2496,6 +2496,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>;
@@ -3589,115 +3698,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 312/443 arm64: dts: qcom: sm8350: Fix MPSS memory length
In reply to Greg Kroah-Hartman6.13-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
@@ -2214,7 +2214,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 313/443 arm64: dts: qcom: sm8450: Fix ADSP memory base and length
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit 13c96bee5d5e5b61a9d8d000c9bb37bb9a2a0551 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, which also matches downstream DTS. 0x3000_0000, value used so far, was in datasheet is the region of CDSP.
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/sm8450.dtsi | 212 +++++++++++++++++------------------ 1 file changed, 106 insertions(+), 106 deletions(-)
arch/arm64/boot/dts/qcom/sm8450.dtsi +106 -106
@@ -2496,6 +2496,112 @@ }; }; + remoteproc_adsp: remoteproc@3000000 { + compatible = "qcom,sm8450-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 = <&adsp_mem>; + + qcom,qmp = <&aoss_qmp>; + + qcom,smem-states = <&smp2p_adsp_out 0>; + qcom,smem-state-names = "stop"; + + status = "disabled"; + + remoteproc_adsp_glink: 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>; + + gpr { + compatible = "qcom,gpr"; + qcom,glink-channels = "adsp_apps"; + qcom,domain = <GPR_DOMAIN_ID_ADSP>; + qcom,intents = <512 20>; + #address-cells = <1>; + #size-cells = <0>; + + q6apm: service@1 { + compatible = "qcom,q6apm"; + reg = <GPR_APM_MODULE_IID>; + #sound-dai-cells = <0>; + qcom,protection-domain = "avs/audio", + "msm/adsp/audio_pd"; + + q6apmdai: dais { + compatible = "qcom,q6apm-dais"; + iommus = <&apps_smmu 0x1801 0x0>; + }; + + q6apmbedai: bedais { + compatible = "qcom,q6apm-lpass-dais"; + #sound-dai-cells = <1>; + }; + }; + + q6prm: service@2 { + compatible = "qcom,q6prm"; + reg = <GPR_PRM_MODULE_IID>; + qcom,protection-domain = "avs/audio", + "msm/adsp/audio_pd"; + + q6prmcc: clock-controller { + compatible = "qcom,q6prm-lpass-clocks"; + #clock-cells = <2>; + }; + }; + }; + + 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>; + }; + }; + }; + }; + wsa2macro: codec@31e0000 { compatible = "qcom,sm8450-lpass-wsa-macro"; reg = <0 0x031e0000 0 0x1000>;
@@ -2692,112 +2798,6 @@ status = "disabled"; }; - remoteproc_adsp: remoteproc@30000000 { - compatible = "qcom,sm8450-adsp-pas"; - reg = <0 0x30000000 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 = <&adsp_mem>; - - qcom,qmp = <&aoss_qmp>; - - qcom,smem-states = <&smp2p_adsp_out 0>; - qcom,smem-state-names = "stop"; - - status = "disabled"; - - remoteproc_adsp_glink: 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>; - - gpr { - compatible = "qcom,gpr"; - qcom,glink-channels = "adsp_apps"; - qcom,domain = <GPR_DOMAIN_ID_ADSP>; - qcom,intents = <512 20>; - #address-cells = <1>; - #size-cells = <0>; - - q6apm: service@1 { - compatible = "qcom,q6apm"; - reg = <GPR_APM_MODULE_IID>; - #sound-dai-cells = <0>; - qcom,protection-domain = "avs/audio", - "msm/adsp/audio_pd"; - - q6apmdai: dais { - compatible = "qcom,q6apm-dais"; - iommus = <&apps_smmu 0x1801 0x0>; - }; - - q6apmbedai: bedais { - compatible = "qcom,q6apm-lpass-dais"; - #sound-dai-cells = <1>; - }; - }; - - q6prm: service@2 { - compatible = "qcom,q6prm"; - reg = <GPR_PRM_MODULE_IID>; - qcom,protection-domain = "avs/audio", - "msm/adsp/audio_pd"; - - q6prmcc: clock-controller { - compatible = "qcom,q6prm-lpass-clocks"; - #clock-cells = <2>; - }; - }; - }; - - 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>; - }; - }; - }; - }; - remoteproc_cdsp: remoteproc@32300000 { compatible = "qcom,sm8450-cdsp-pas"; reg = <0 0x32300000 0 0x1400000>;
Greg Kroah-Hartman
maintainerPATCH 314/443 arm64: dts: qcom: sm8450: Fix CDSP memory length
In reply to Greg Kroah-Hartman6.13-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
@@ -2800,7 +2800,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 315/443 arm64: dts: qcom: sm8450: Fix MPSS memory length
In reply to Greg Kroah-Hartman6.13-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
@@ -2907,7 +2907,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 316/443 arm64: dts: qcom: sm8550: Fix ADSP memory base and length
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit a6a8f54bc2af555738322783ba1e990c2ae7f443 upstream.
The address space in ADSP PAS (Peripheral Authentication Service) remoteproc node should point to the QDSP PUB address space (QDSP6...SS_PUB): 0x0680_0000 with length of 0x10000.
0x3000_0000, value used so far, is the main region of CDSP. Downstream DTS uses 0x0300_0000, which is oddly similar to 0x3000_0000, yet quite different and points to unused area.
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/sm8550.dtsi | 262 +++++++++++++++++------------------ 1 file changed, 131 insertions(+), 131 deletions(-)
arch/arm64/boot/dts/qcom/sm8550.dtsi +131 -131
@@ -2354,6 +2354,137 @@ }; }; + remoteproc_adsp: remoteproc@6800000 { + compatible = "qcom,sm8550-adsp-pas"; + reg = <0x0 0x06800000 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"; + + interconnects = <&lpass_lpicx_noc MASTER_LPASS_PROC 0 &mc_virt SLAVE_EBI1 0>; + + memory-region = <&adspslpi_mem>, <&q6_adsp_dtb_mem>; + + qcom,qmp = <&aoss_qmp>; + + qcom,smem-states = <&smp2p_adsp_out 0>; + qcom,smem-state-names = "stop"; + + status = "disabled"; + + remoteproc_adsp_glink: 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>; + + 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 0x1003 0x80>, + <&apps_smmu 0x1063 0x0>; + dma-coherent; + }; + + compute-cb@4 { + compatible = "qcom,fastrpc-compute-cb"; + reg = <4>; + iommus = <&apps_smmu 0x1004 0x80>, + <&apps_smmu 0x1064 0x0>; + dma-coherent; + }; + + compute-cb@5 { + compatible = "qcom,fastrpc-compute-cb"; + reg = <5>; + iommus = <&apps_smmu 0x1005 0x80>, + <&apps_smmu 0x1065 0x0>; + dma-coherent; + }; + + compute-cb@6 { + compatible = "qcom,fastrpc-compute-cb"; + reg = <6>; + iommus = <&apps_smmu 0x1006 0x80>, + <&apps_smmu 0x1066 0x0>; + dma-coherent; + }; + + compute-cb@7 { + compatible = "qcom,fastrpc-compute-cb"; + reg = <7>; + iommus = <&apps_smmu 0x1007 0x80>, + <&apps_smmu 0x1067 0x0>; + dma-coherent; + }; + }; + + gpr { + compatible = "qcom,gpr"; + qcom,glink-channels = "adsp_apps"; + qcom,domain = <GPR_DOMAIN_ID_ADSP>; + qcom,intents = <512 20>; + #address-cells = <1>; + #size-cells = <0>; + + q6apm: service@1 { + compatible = "qcom,q6apm"; + reg = <GPR_APM_MODULE_IID>; + #sound-dai-cells = <0>; + qcom,protection-domain = "avs/audio", + "msm/adsp/audio_pd"; + + q6apmdai: dais { + compatible = "qcom,q6apm-dais"; + iommus = <&apps_smmu 0x1001 0x80>, + <&apps_smmu 0x1061 0x0>; + }; + + q6apmbedai: bedais { + compatible = "qcom,q6apm-lpass-dais"; + #sound-dai-cells = <1>; + }; + }; + + q6prm: service@2 { + compatible = "qcom,q6prm"; + reg = <GPR_PRM_MODULE_IID>; + qcom,protection-domain = "avs/audio", + "msm/adsp/audio_pd"; + + q6prmcc: clock-controller { + compatible = "qcom,q6prm-lpass-clocks"; + #clock-cells = <2>; + }; + }; + }; + }; + }; + lpass_wsa2macro: codec@6aa0000 { compatible = "qcom,sm8550-lpass-wsa-macro"; reg = <0 0x06aa0000 0 0x1000>;
@@ -4576,137 +4707,6 @@ interrupts = <GIC_SPI 266 IRQ_TYPE_LEVEL_HIGH>; }; - remoteproc_adsp: remoteproc@30000000 { - compatible = "qcom,sm8550-adsp-pas"; - reg = <0x0 0x30000000 0x0 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"; - - interconnects = <&lpass_lpicx_noc MASTER_LPASS_PROC 0 &mc_virt SLAVE_EBI1 0>; - - memory-region = <&adspslpi_mem>, <&q6_adsp_dtb_mem>; - - qcom,qmp = <&aoss_qmp>; - - qcom,smem-states = <&smp2p_adsp_out 0>; - qcom,smem-state-names = "stop"; - - status = "disabled"; - - remoteproc_adsp_glink: 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>; - - 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 0x1003 0x80>, - <&apps_smmu 0x1063 0x0>; - dma-coherent; - }; - - compute-cb@4 { - compatible = "qcom,fastrpc-compute-cb"; - reg = <4>; - iommus = <&apps_smmu 0x1004 0x80>, - <&apps_smmu 0x1064 0x0>; - dma-coherent; - }; - - compute-cb@5 { - compatible = "qcom,fastrpc-compute-cb"; - reg = <5>; - iommus = <&apps_smmu 0x1005 0x80>, - <&apps_smmu 0x1065 0x0>; - dma-coherent; - }; - - compute-cb@6 { - compatible = "qcom,fastrpc-compute-cb"; - reg = <6>; - iommus = <&apps_smmu 0x1006 0x80>, - <&apps_smmu 0x1066 0x0>; - dma-coherent; - }; - - compute-cb@7 { - compatible = "qcom,fastrpc-compute-cb"; - reg = <7>; - iommus = <&apps_smmu 0x1007 0x80>, - <&apps_smmu 0x1067 0x0>; - dma-coherent; - }; - }; - - gpr { - compatible = "qcom,gpr"; - qcom,glink-channels = "adsp_apps"; - qcom,domain = <GPR_DOMAIN_ID_ADSP>; - qcom,intents = <512 20>; - #address-cells = <1>; - #size-cells = <0>; - - q6apm: service@1 { - compatible = "qcom,q6apm"; - reg = <GPR_APM_MODULE_IID>; - #sound-dai-cells = <0>; - qcom,protection-domain = "avs/audio", - "msm/adsp/audio_pd"; - - q6apmdai: dais { - compatible = "qcom,q6apm-dais"; - iommus = <&apps_smmu 0x1001 0x80>, - <&apps_smmu 0x1061 0x0>; - }; - - q6apmbedai: bedais { - compatible = "qcom,q6apm-lpass-dais"; - #sound-dai-cells = <1>; - }; - }; - - q6prm: service@2 { - compatible = "qcom,q6prm"; - reg = <GPR_PRM_MODULE_IID>; - qcom,protection-domain = "avs/audio", - "msm/adsp/audio_pd"; - - q6prmcc: clock-controller { - compatible = "qcom,q6prm-lpass-clocks"; - #clock-cells = <2>; - }; - }; - }; - }; - }; - nsp_noc: interconnect@320c0000 { compatible = "qcom,sm8550-nsp-noc"; reg = <0 0x320c0000 0 0xe080>;
Greg Kroah-Hartman
maintainerPATCH 317/443 arm64: dts: qcom: sm8550: Fix CDSP memory length
In reply to Greg Kroah-Hartman6.13-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
@@ -4716,7 +4716,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 318/443 arm64: dts: qcom: sm8550: Fix MPSS memory length
In reply to Greg Kroah-Hartman6.13-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
@@ -2314,7 +2314,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 319/443 arm64: dts: qcom: sm8650: Fix ADSP memory base and length
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit b6ddc5c37323f7875c2533cc4949be58d15e430a upstream.
The address space in ADSP PAS (Peripheral Authentication Service) remoteproc node should point to the QDSP PUB address space (QDSP6...SS_PUB): 0x0680_0000 with length of 0x10000.
0x3000_0000, value used so far, is the main region of CDSP. Downstream DTS uses 0x0300_0000, which is oddly similar to 0x3000_0000, yet quite different and points to unused area.
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/sm8650.dtsi | 296 +++++++++++++++++------------------ 1 file changed, 148 insertions(+), 148 deletions(-)
arch/arm64/boot/dts/qcom/sm8650.dtsi +148 -148
@@ -2904,6 +2904,154 @@ }; }; + remoteproc_adsp: remoteproc@6800000 { + compatible = "qcom,sm8650-adsp-pas"; + reg = <0x0 0x06800000 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"; + + interconnects = <&lpass_lpicx_noc MASTER_LPASS_PROC QCOM_ICC_TAG_ALWAYS + &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>; + + power-domains = <&rpmhpd RPMHPD_LCX>, + <&rpmhpd RPMHPD_LMX>; + power-domain-names = "lcx", + "lmx"; + + memory-region = <&adspslpi_mem>, <&q6_adsp_dtb_mem>; + + qcom,qmp = <&aoss_qmp>; + + qcom,smem-states = <&smp2p_adsp_out 0>; + qcom,smem-state-names = "stop"; + + status = "disabled"; + + remoteproc_adsp_glink: 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>; + + qcom,remote-pid = <2>; + + label = "lpass"; + + 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 0x1003 0x80>, + <&apps_smmu 0x1043 0x20>; + dma-coherent; + }; + + compute-cb@4 { + compatible = "qcom,fastrpc-compute-cb"; + reg = <4>; + + iommus = <&apps_smmu 0x1004 0x80>, + <&apps_smmu 0x1044 0x20>; + dma-coherent; + }; + + compute-cb@5 { + compatible = "qcom,fastrpc-compute-cb"; + reg = <5>; + + iommus = <&apps_smmu 0x1005 0x80>, + <&apps_smmu 0x1045 0x20>; + dma-coherent; + }; + + compute-cb@6 { + compatible = "qcom,fastrpc-compute-cb"; + reg = <6>; + + iommus = <&apps_smmu 0x1006 0x80>, + <&apps_smmu 0x1046 0x20>; + dma-coherent; + }; + + compute-cb@7 { + compatible = "qcom,fastrpc-compute-cb"; + reg = <7>; + + iommus = <&apps_smmu 0x1007 0x40>, + <&apps_smmu 0x1067 0x0>, + <&apps_smmu 0x1087 0x0>; + dma-coherent; + }; + }; + + gpr { + compatible = "qcom,gpr"; + qcom,glink-channels = "adsp_apps"; + qcom,domain = <GPR_DOMAIN_ID_ADSP>; + qcom,intents = <512 20>; + #address-cells = <1>; + #size-cells = <0>; + + q6apm: service@1 { + compatible = "qcom,q6apm"; + reg = <GPR_APM_MODULE_IID>; + #sound-dai-cells = <0>; + qcom,protection-domain = "avs/audio", + "msm/adsp/audio_pd"; + + q6apmbedai: bedais { + compatible = "qcom,q6apm-lpass-dais"; + #sound-dai-cells = <1>; + }; + + q6apmdai: dais { + compatible = "qcom,q6apm-dais"; + iommus = <&apps_smmu 0x1001 0x80>, + <&apps_smmu 0x1061 0x0>; + }; + }; + + q6prm: service@2 { + compatible = "qcom,q6prm"; + reg = <GPR_PRM_MODULE_IID>; + qcom,protection-domain = "avs/audio", + "msm/adsp/audio_pd"; + + q6prmcc: clock-controller { + compatible = "qcom,q6prm-lpass-clocks"; + #clock-cells = <2>; + }; + }; + }; + }; + }; + lpass_wsa2macro: codec@6aa0000 { compatible = "qcom,sm8650-lpass-wsa-macro", "qcom,sm8550-lpass-wsa-macro"; reg = <0 0x06aa0000 0 0x1000>;
@@ -5322,154 +5470,6 @@ interrupts = <GIC_SPI 266 IRQ_TYPE_LEVEL_HIGH>; }; - remoteproc_adsp: remoteproc@30000000 { - compatible = "qcom,sm8650-adsp-pas"; - reg = <0 0x30000000 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"; - - interconnects = <&lpass_lpicx_noc MASTER_LPASS_PROC QCOM_ICC_TAG_ALWAYS - &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>; - - power-domains = <&rpmhpd RPMHPD_LCX>, - <&rpmhpd RPMHPD_LMX>; - power-domain-names = "lcx", - "lmx"; - - memory-region = <&adspslpi_mem>, <&q6_adsp_dtb_mem>; - - qcom,qmp = <&aoss_qmp>; - - qcom,smem-states = <&smp2p_adsp_out 0>; - qcom,smem-state-names = "stop"; - - status = "disabled"; - - remoteproc_adsp_glink: 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>; - - qcom,remote-pid = <2>; - - label = "lpass"; - - 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 0x1003 0x80>, - <&apps_smmu 0x1043 0x20>; - dma-coherent; - }; - - compute-cb@4 { - compatible = "qcom,fastrpc-compute-cb"; - reg = <4>; - - iommus = <&apps_smmu 0x1004 0x80>, - <&apps_smmu 0x1044 0x20>; - dma-coherent; - }; - - compute-cb@5 { - compatible = "qcom,fastrpc-compute-cb"; - reg = <5>; - - iommus = <&apps_smmu 0x1005 0x80>, - <&apps_smmu 0x1045 0x20>; - dma-coherent; - }; - - compute-cb@6 { - compatible = "qcom,fastrpc-compute-cb"; - reg = <6>; - - iommus = <&apps_smmu 0x1006 0x80>, - <&apps_smmu 0x1046 0x20>; - dma-coherent; - }; - - compute-cb@7 { - compatible = "qcom,fastrpc-compute-cb"; - reg = <7>; - - iommus = <&apps_smmu 0x1007 0x40>, - <&apps_smmu 0x1067 0x0>, - <&apps_smmu 0x1087 0x0>; - dma-coherent; - }; - }; - - gpr { - compatible = "qcom,gpr"; - qcom,glink-channels = "adsp_apps"; - qcom,domain = <GPR_DOMAIN_ID_ADSP>; - qcom,intents = <512 20>; - #address-cells = <1>; - #size-cells = <0>; - - q6apm: service@1 { - compatible = "qcom,q6apm"; - reg = <GPR_APM_MODULE_IID>; - #sound-dai-cells = <0>; - qcom,protection-domain = "avs/audio", - "msm/adsp/audio_pd"; - - q6apmbedai: bedais { - compatible = "qcom,q6apm-lpass-dais"; - #sound-dai-cells = <1>; - }; - - q6apmdai: dais { - compatible = "qcom,q6apm-dais"; - iommus = <&apps_smmu 0x1001 0x80>, - <&apps_smmu 0x1061 0x0>; - }; - }; - - q6prm: service@2 { - compatible = "qcom,q6prm"; - reg = <GPR_PRM_MODULE_IID>; - qcom,protection-domain = "avs/audio", - "msm/adsp/audio_pd"; - - q6prmcc: clock-controller { - compatible = "qcom,q6prm-lpass-clocks"; - #clock-cells = <2>; - }; - }; - }; - }; - }; - nsp_noc: interconnect@320c0000 { compatible = "qcom,sm8650-nsp-noc"; reg = <0 0x320c0000 0 0xf080>;
Greg Kroah-Hartman
maintainerPATCH 320/443 arm64: dts: qcom: sm8650: Fix CDSP memory length
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit aca0053f051625a224c2e802a0e88755770819e4 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/sm8650.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm8650.dtsi +1 -1
@@ -5481,7 +5481,7 @@ remoteproc_cdsp: remoteproc@32300000 { compatible = "qcom,sm8650-cdsp-pas"; - reg = <0 0x32300000 0 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 321/443 arm64: dts: qcom: sm8650: Fix MPSS memory length
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit d4fa87daf3dd39d6bd4b69613e22bfb43c737831 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/sm8650.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sm8650.dtsi +1 -1
@@ -2853,7 +2853,7 @@ remoteproc_mpss: remoteproc@4080000 { compatible = "qcom,sm8650-mpss-pas"; - reg = <0 0x04080000 0 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 322/443 arm64: dts: qcom: sm8550: correct MDSS interconnects
In reply to Greg Kroah-Hartman6.13-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
@@ -3003,9 +3003,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 323/443 arm64: dts: qcom: sm8650: correct MDSS interconnects
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
commit 9fa33cbca3d2842f1f47ed4e5f6574e611dae32b upstream.
SM8650 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/sm8650.dtsi | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
arch/arm64/boot/dts/qcom/sm8650.dtsi +1 -4
@@ -3603,11 +3603,8 @@ resets = <&dispcc DISP_CC_MDSS_CORE_BCR>; interconnects = <&mmss_noc MASTER_MDP QCOM_ICC_TAG_ALWAYS - &gem_noc SLAVE_LLCC QCOM_ICC_TAG_ALWAYS>, - <&mc_virt MASTER_LLCC QCOM_ICC_TAG_ALWAYS &mc_virt SLAVE_EBI1 QCOM_ICC_TAG_ALWAYS>; - interconnect-names = "mdp0-mem", - "mdp1-mem"; + interconnect-names = "mdp0-mem"; power-domains = <&dispcc MDSS_GDSC>;
Greg Kroah-Hartman
maintainerPATCH 324/443 crypto: qce - fix priority to be less than ARMv8 CE
In reply to Greg Kroah-Hartman6.13-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 325/443 arm64: tegra: Fix typo in Tegra234 dce-fabric compatible
In reply to Greg Kroah-Hartman6.13-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
@@ -3995,7 +3995,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 326/443 arm64: tegra: Disable Tegra234 sce-fabric node
In reply to Greg Kroah-Hartman6.13-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
@@ -3815,7 +3815,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 327/443 parisc: Temporarily disable jump label support
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Helge Deller <[email protected]>
commit 3599bae489d86fbabe039f9a2ab5472ffb04f7f1 upstream.
The 32-bit Debian kernel 6.12 fails to boot and crashes like this:
init (pid 65): Protection id trap (code 7)
CPU: 0 UID: 0 PID: 65 Comm: init Not tainted 6.12.9 #2 Hardware name: 9000/778/B160L
YZrvWESTHLNXBCVMcbcbcbcbOGFRQPDI
PSW: 00000000000001000000000000001111 Not tainted
r00-03 0004000f 110d39d0 109a6558 12974400 r04-07 12a810e0 12a810e0 00000000 12a81144 r08-11 12a81174 00000007 00000000 00000002 r12-15 f8c55c08 0000006c 00000001 f8c55c08 r16-19 00000002 f8c58620 002da3a8 0000004e r20-23 00001a46 0000000f 10754f84 00000000 r24-27 00000000 00000003 12ae6980 1127b9d0 r28-31 00000000 00000000 12974440 109a6558
sr00-03 00000000 00000000 00000000 00000010
sr04-07 00000000 00000000 00000000 00000000
IASQ: 00000000 00000000 IAOQ: 110d39d0 110d39d4
IIR: baadf00d ISR: 00000000 IOR: 110d39d0
CPU: 0 CR30: 128740c0 CR31: 00000000
ORIG_R28: 000003f3
IAOQ[0]: 0x110d39d0
IAOQ[1]: 0x110d39d4
RP(r2): security_sk_free+0x70/0x1a4
Backtrace: [<10d8c844>] __sk_destruct+0x2bc/0x378 [<10d8e33c>] sk_destruct+0x68/0x8c [<10d8e3dc>] __sk_free+0x7c/0x148 [<10d8e560>] sk_free+0xb8/0xf0 [<10f6420c>] unix_release_sock+0x3ac/0x50c [<10f643b8>] unix_release+0x4c/0x7c [<10d832f8>] __sock_release+0x5c/0xf8 [<10d833b4>] sock_close+0x20/0x44 [<107ba52c>] __fput+0xf8/0x468 [<107baa08>] __fput_sync+0xb4/0xd4 [<107b471c>] sys_close+0x44/0x94 [<10405334>] syscall_exit+0x0/0x10
Bisecting points to this commit which triggers the issue:
commit 417c5643cd67a55f424b203b492082035d0236c3 Author: KP Singh <[email protected]> Date: Fri Aug 16 17:43:07 2024 +0200 lsm: replace indirect LSM hook calls with static calls
After more analysis it seems that we don't fully implement the static calls and jump tables yet. Additionally the functions which mark kernel memory read-only or read-write-executable needs to be further enhanced to be able to fully support static calls.
Enabling CONFIG_SECURITY_YAMA=y was one possibility to trigger the issue, although YAMA isn't the reason for the fault.
As a temporary solution disable JUMP_LABEL functionality to avoid the crashes.
--- arch/parisc/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/parisc/Kconfig +2 -2
@@ -60,8 +60,8 @@ config PARISC select HAVE_ARCH_MMAP_RND_BITS select HAVE_ARCH_AUDITSYSCALL select HAVE_ARCH_HASH - select HAVE_ARCH_JUMP_LABEL - select HAVE_ARCH_JUMP_LABEL_RELATIVE + # select HAVE_ARCH_JUMP_LABEL + # select HAVE_ARCH_JUMP_LABEL_RELATIVE select HAVE_ARCH_KFENCE select HAVE_ARCH_SECCOMP_FILTER select HAVE_ARCH_TRACEHOOK
Greg Kroah-Hartman
maintainerPATCH 328/443 pwm: microchip-core: fix incorrect comparison with max period
In reply to Greg Kroah-Hartman6.13-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
@@ -327,7 +327,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 329/443 xfs: dont call remap_verify_area with sb write protection held
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christoph Hellwig <[email protected]>
commit f5f0ed89f13e3e5246404a322ee85169a226bfb5 upstream.
The XFS_IOC_EXCHANGE_RANGE ioctl with the XFS_EXCHANGE_RANGE_TO_EOF flag operates on a range bounded by the end of the file. This means the actual amount of blocks exchanged is derived from the inode size, which is only stable with the IOLOCK (i_rwsem) held. Do that, it currently calls remap_verify_area from inside the sb write protection which nests outside the IOLOCK. But this makes fsnotify_file_area_perm which is called from remap_verify_area unhappy when the kernel is built with lockdep and the recently added CONFIG_FANOTIFY_ACCESS_PERMISSIONS option.
Fix this by always calling remap_verify_area before taking the write protection, and passing a 0 size to remap_verify_area similar to the FICLONE/FICLONERANGE ioctls when they are asked to clone until the file end.
(Note: the size argument gets passed to fsnotify_file_area_perm, but then isn't actually used there).
--- fs/xfs/xfs_exchrange.c | 71 ++++++++++++++++++------------------------------- 1 file changed, 27 insertions(+), 44 deletions(-)
fs/xfs/xfs_exchrange.c +27 -44
@@ -326,22 +326,6 @@ out_trans_cancel:* successfully but before locks are dropped. */ -/* Verify that we have security clearance to perform this operation. */ -static int -xfs_exchange_range_verify_area ( -struct xfs_exchrange *fxr) -{ -int ret; - - ret =remap_verify_area (fxr->file1, fxr->file1_offset, fxr->length, - true); -if (ret) -return ret; - -return remap_verify_area (fxr->file2, fxr->file2_offset, fxr->length, - true); -} -/* * Performs necessary checks before doing a range exchange, having stabilized * mutable inode attributes via i_rwsem.
@@ -352,11 +336,13 @@ xfs_exchange_range_checks( unsigned int alloc_unit) {struct inode *inode1 =file_inode (fxr->file1); +loff_t size1 =i_size_read (inode1);struct inode *inode2 =file_inode (fxr->file2); +loff_t size2 =i_size_read (inode2);uint64_t allocmask = alloc_unit -1 ;int64_t test_len;uint64_t blen; -loff_t size1, size2, tmp; +loff_t tmp;int error;/* Don't touch certain kinds of inodes */
@@ -365,24 +351,25 @@ xfs_exchange_range_checks(if (IS_SWAPFILE (inode1) ||IS_SWAPFILE (inode2))return -ETXTBSY ; - size1 =i_size_read (inode1); - size2 =i_size_read (inode2); -/* Ranges cannot start after EOF. */ if (fxr->file1_offset > size1 || fxr->file2_offset > size2)return -EINVAL ; -/* -* If the caller said to exchange to EOF, we set the length of the -* request large enough to cover everything to the end of both files. -*/ if (fxr->flags &XFS_EXCHANGE_RANGE_TO_EOF ) { +/* +* If the caller said to exchange to EOF, we set the length of +* the request large enough to cover everything to the end of +* both files. +*/ fxr->length =max_t (int64_t, size1 - fxr->file1_offset, size2 - fxr->file2_offset); - - error =xfs_exchange_range_verify_area (fxr); -if (error) -return error; + }else { +/* +* Otherwise we require both ranges to end within EOF. +*/ +if (fxr->file1_offset + fxr->length > size1 || + fxr->file2_offset + fxr->length > size2) +return -EINVAL ; }/*
@@ -399,15 +386,6 @@ xfs_exchange_range_checks(return -EINVAL ;/* -* We require both ranges to end within EOF, unless we're exchanging -* to EOF. -*/ -if (!(fxr->flags &XFS_EXCHANGE_RANGE_TO_EOF ) && - (fxr->file1_offset + fxr->length > size1 || - fxr->file2_offset + fxr->length > size2)) -return -EINVAL ; - -/* * Make sure we don't hit any file size limits. If we hit any size * limits such that test_length was adjusted, we abort the whole * operation.
@@ -744,6 +722,7 @@ xfs_exchange_range( {struct inode *inode1 =file_inode (fxr->file1);struct inode *inode2 =file_inode (fxr->file2); +loff_t check_len = fxr->length;int ret; BUILD_BUG_ON(XFS_EXCHANGE_RANGE_ALL_FLAGS &
@@ -776,14 +755,18 @@ xfs_exchange_range(return -EBADF ;/* -* If we're not exchanging to EOF, we can check the areas before -* stabilizing both files' i_size. +* If we're exchanging to EOF we can't calculate the length until taking +* the iolock. Pass a 0 length to remap_verify_area similar to the +* FICLONE and FICLONERANGE ioctls that support cloning to EOF as well. */ -if (!(fxr->flags &XFS_EXCHANGE_RANGE_TO_EOF )) { - ret =xfs_exchange_range_verify_area (fxr); -if (ret) -return ret; - } +if (fxr->flags &XFS_EXCHANGE_RANGE_TO_EOF ) + check_len =0 ; + ret =remap_verify_area (fxr->file1, fxr->file1_offset, check_len, true); +if (ret) +return ret; + ret =remap_verify_area (fxr->file2, fxr->file2_offset, check_len, true); +if (ret) +return ret;/* Update cmtime if the fd/inode don't forbid it. */ if (!(fxr->file1->f_mode &FMODE_NOCMTIME ) && !IS_NOCMTIME (inode1))
Greg Kroah-Hartman
maintainerPATCH 330/443 xfs: Propagate errors from xfs_reflink_cancel_cow_range in xfs_dax_write_iomap_end
In reply to Greg Kroah-Hartman6.13-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
@@ -976,10 +976,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 331/443 xfs: Add error handling for xfs_reflink_cancel_cow_range
In reply to Greg Kroah-Hartman6.13-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
@@ -1404,8 +1404,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 332/443 accel/ivpu: Fix error handling in ivpu_boot()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacek Lawrynowicz <[email protected]>
commit f3be8a9b1afffbcc70f8e41063b151b1038d7813 upstream.
Ensure IRQs and IPC are properly disabled if HW sched or DCT initialization fails.
--- drivers/accel/ivpu/ivpu_drv.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/accel/ivpu/ivpu_drv.c +6 -2
@@ -397,15 +397,19 @@ int ivpu_boot(struct ivpu_device *vdev)if (ivpu_fw_is_cold_boot (vdev)) { ret =ivpu_pm_dct_init (vdev);if (ret) - goto err_diagnose_failure; + goto err_disable_ipc; ret =ivpu_hw_sched_init (vdev);if (ret) - goto err_diagnose_failure; + goto err_disable_ipc; }return 0 ; +err_disable_ipc: +ivpu_ipc_disable (vdev); +ivpu_hw_irq_disable (vdev); +disable_irq (vdev->irq); err_diagnose_failure:ivpu_hw_diagnose_failure (vdev);ivpu_mmu_evtq_dump (vdev);
Signature · 1 line
2.48.1
Greg Kroah-Hartman
maintainerPATCH 333/443 accel/ivpu: Clear runtime_error after pm_runtime_resume_and_get() fails
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacek Lawrynowicz <[email protected]>
commit f2bc2afe34c107a02ce829a4039e85514feafe55 upstream.
pm_runtime_resume_and_get() sets dev->power.runtime_error that causes all subsequent pm_runtime_get_sync() calls to fail.
Clear the runtime_error using pm_runtime_set_suspended(), so the driver doesn't have to be reloaded to recover when the NPU fails to boot during runtime resume.
--- drivers/accel/ivpu/ivpu_pm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/accel/ivpu/ivpu_pm.c +4 -1
@@ -309,7 +309,10 @@ int ivpu_rpm_get(struct ivpu_device *vdeint ret; ret =pm_runtime_resume_and_get (vdev->drm.dev); -drm_WARN_ON (&vdev->drm, ret <0 ); +if (ret <0 ) { +ivpu_err (vdev,"Failed to resume NPU: %d\n" , ret); +pm_runtime_set_suspended (vdev->drm.dev); + }return ret; }
Greg Kroah-Hartman
maintainerPATCH 334/443 accel/ivpu: Fix error handling in recovery/reset
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jacek Lawrynowicz <[email protected]>
commit 41a2d8286c905614f29007f1bc8e652d54654b82 upstream.
Disable runtime PM for the duration of reset/recovery so it is possible to set the correct runtime PM state depending on the outcome of the ivpu_resume(). Don’t suspend or reset the HW if the NPU is suspended when the reset/recovery is requested. Also, move common reset/recovery code to separate functions for better code readability.
--- drivers/accel/ivpu/ivpu_pm.c | 79 +++++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 36 deletions(-)
drivers/accel/ivpu/ivpu_pm.c +43 -36
@@ -115,41 +115,57 @@ err_power_down:return ret; } -static void ivpu_pm_recovery_work (struct work_struct *work) +static void ivpu_pm_reset_begin (struct ivpu_device *vdev) { - struct ivpu_pm_info *pm = container_of(work, struct ivpu_pm_info, recovery_work); -struct ivpu_device *vdev = pm->vdev; -char *evt[2 ] = {"IVPU_PM_EVENT=IVPU_RECOVER" ,NULL }; -int ret; - -ivpu_err (vdev,"Recovering the NPU (reset #%d)\n" ,atomic_read (&vdev->pm->reset_counter)); - - ret =pm_runtime_resume_and_get (vdev->drm.dev); -if (ret) -ivpu_err (vdev,"Failed to resume NPU: %d\n" , ret); - -ivpu_jsm_state_dump (vdev); -ivpu_dev_coredump (vdev); +pm_runtime_disable (vdev->drm.dev);atomic_inc (&vdev->pm->reset_counter);atomic_set (&vdev->pm->reset_pending,1 );down_write (&vdev->pm->reset_lock); +} + +static void ivpu_pm_reset_complete (struct ivpu_device *vdev) +{ +int ret; -ivpu_suspend (vdev);ivpu_pm_prepare_cold_boot (vdev);ivpu_jobs_abort_all (vdev);ivpu_ms_cleanup_all (vdev); ret =ivpu_resume (vdev); -if (ret) +if (ret) {ivpu_err (vdev,"Failed to resume NPU: %d\n" , ret); +pm_runtime_set_suspended (vdev->drm.dev); + }else { +pm_runtime_set_active (vdev->drm.dev); + }up_write (&vdev->pm->reset_lock);atomic_set (&vdev->pm->reset_pending,0 ); -kobject_uevent_env (&vdev->drm.dev->kobj,KOBJ_CHANGE , evt);pm_runtime_mark_last_busy (vdev->drm.dev); -pm_runtime_put_autosuspend (vdev->drm.dev); +pm_runtime_enable (vdev->drm.dev); +} + +static void ivpu_pm_recovery_work (struct work_struct *work) +{ + struct ivpu_pm_info *pm = container_of(work, struct ivpu_pm_info, recovery_work); +struct ivpu_device *vdev = pm->vdev; +char *evt[2 ] = {"IVPU_PM_EVENT=IVPU_RECOVER" ,NULL }; + +ivpu_err (vdev,"Recovering the NPU (reset #%d)\n" ,atomic_read (&vdev->pm->reset_counter)); + +ivpu_pm_reset_begin (vdev); + +if (!pm_runtime_status_suspended (vdev->drm.dev)) { +ivpu_jsm_state_dump (vdev); +ivpu_dev_coredump (vdev); +ivpu_suspend (vdev); + } + +ivpu_pm_reset_complete (vdev); + +kobject_uevent_env (&vdev->drm.dev->kobj,KOBJ_CHANGE , evt); }void ivpu_pm_trigger_recovery (struct ivpu_device *vdev,const char *reason)
@@ -328,16 +344,13 @@ void ivpu_pm_reset_prepare_cb(struct pcistruct ivpu_device *vdev =pci_get_drvdata (pdev);ivpu_dbg (vdev,PM ,"Pre-reset..\n" ); -atomic_inc (&vdev->pm->reset_counter); -atomic_set (&vdev->pm->reset_pending,1 ); -pm_runtime_get_sync (vdev->drm.dev); -down_write (&vdev->pm->reset_lock); -ivpu_prepare_for_reset (vdev); -ivpu_hw_reset (vdev); -ivpu_pm_prepare_cold_boot (vdev); -ivpu_jobs_abort_all (vdev); -ivpu_ms_cleanup_all (vdev); +ivpu_pm_reset_begin (vdev); + +if (!pm_runtime_status_suspended (vdev->drm.dev)) { +ivpu_prepare_for_reset (vdev); +ivpu_hw_reset (vdev); + }ivpu_dbg (vdev,PM ,"Pre-reset done.\n" ); }
@@ -345,18 +358,12 @@ void ivpu_pm_reset_prepare_cb(struct pcivoid ivpu_pm_reset_done_cb (struct pci_dev *pdev) {struct ivpu_device *vdev =pci_get_drvdata (pdev); -int ret;ivpu_dbg (vdev,PM ,"Post-reset..\n" ); - ret =ivpu_resume (vdev); -if (ret) -ivpu_err (vdev,"Failed to set RESUME state: %d\n" , ret); -up_write (&vdev->pm->reset_lock); -atomic_set (&vdev->pm->reset_pending,0 ); -ivpu_dbg (vdev,PM ,"Post-reset done.\n" ); -pm_runtime_mark_last_busy (vdev->drm.dev); -pm_runtime_put_autosuspend (vdev->drm.dev); +ivpu_pm_reset_complete (vdev); + +ivpu_dbg (vdev,PM ,"Post-reset done.\n" ); }void ivpu_pm_init (struct ivpu_device *vdev)
Greg Kroah-Hartman
maintainerPATCH 335/443 ACPI: PRM: Remove unnecessary strict handler address checks
In reply to Greg Kroah-Hartman6.13-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
@@ -287,9 +287,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 336/443 tpm: Change to kvalloc() in eventlog/acpi.c
In reply to Greg Kroah-Hartman6.13-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 ;
@@ -161,10 +166,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 337/443 Reset per-task monitors also for idle tasks
In reply to Greg Kroah-Hartman6.13-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 338/443 hrtimers: Force migrate away hrtimers queued after CPUHP_AP_HRTIMERS_DYING
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frederic Weisbecker <[email protected]>
commit 53dac345395c0d2493cbc2f4c85fe38aef5b63f5 upstream.
hrtimers are migrated away from the dying CPU to any online target at the CPUHP_AP_HRTIMERS_DYING stage in order not to delay bandwidth timers handling tasks involved in the CPU hotplug forward progress.
However wakeups can still be performed by the outgoing CPU after CPUHP_AP_HRTIMERS_DYING. Those can result again in bandwidth timers being armed. Depending on several considerations (crystal ball power management based election, earliest timer already enqueued, timer migration enabled or not), the target may eventually be the current CPU even if offline. If that happens, the timer is eventually ignored.
The most notable example is RCU which had to deal with each and every of those wake-ups by deferring them to an online CPU, along with related workarounds:
_ e787644caf76 (rcu: Defer RCU kthreads wakeup when CPU is dying) _ 9139f93209d1 (rcu/nocb: Fix RT throttling hrtimer armed from offline CPU) _ f7345ccc62a4 (rcu/nocb: Fix rcuog wake-up from offline softirq)
The problem isn't confined to RCU though as the stop machine kthread (which runs CPUHP_AP_HRTIMERS_DYING) reports its completion at the end of its work through cpu_stop_signal_done() and performs a wake up that eventually arms the deadline server timer:
WARNING: CPU: 94 PID: 588 at kernel/time/hrtimer.c:1086 hrtimer_start_range_ns+0x289/0x2d0
CPU: 94 UID: 0 PID: 588 Comm: migration/94 Not tainted
Stopper: multi_cpu_stop+0x0/0x120 <- stop_machine_cpuslocked+0x66/0xc0
RIP: 0010:hrtimer_start_range_ns+0x289/0x2d0
Call Trace:
<TASK>
start_dl_timer
enqueue_dl_entity
dl_server_start
enqueue_task_fair
enqueue_task
ttwu_do_activate
try_to_wake_up
complete
cpu_stopper_threadInstead of providing yet another bandaid to work around the situation, fix it in the hrtimers infrastructure instead: always migrate away a timer to an online target whenever it is enqueued from an offline CPU.
This will also allow to revert all the above RCU disgraceful hacks.
--- include/linux/hrtimer_defs.h | 1 kernel/time/hrtimer.c | 103 ++++++++++++++++++++++++++++++++++--------- 2 files changed, 83 insertions(+), 21 deletions(-)
include/linux/hrtimer_defs.h +1 -0
@@ -125,6 +125,7 @@ struct hrtimer_cpu_base {ktime_t softirq_expires_next;struct hrtimer *softirq_next_timer;struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES ]; +call_single_data_t csd; }____cacheline_aligned ;
kernel/time/hrtimer.c +82 -21
176 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 339/443 jiffies: Cast to unsigned long in secs_to_jiffies() conversion
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Easwar Hariharan <[email protected]>
commit bb2784d9ab49587ba4fbff37a319fff2924db289 upstream.
While converting users of msecs_to_jiffies(), lkp reported that some range checks would always be true because of the mismatch between the implied int value of secs_to_jiffies() vs the unsigned long return value of the msecs_to_jiffies() calls it was replacing.
Fix this by casting the secs_to_jiffies() input value to unsigned long.
--- include/linux/jiffies.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/jiffies.h +1 -1
@@ -537,7 +537,7 @@ static __always_inline unsigned long msecs_to_jiffies(const unsigned int m)* * Return: jiffies value */ -#define secs_to_jiffies (_secs) ((_secs) * HZ) +#define secs_to_jiffies (_secs) (unsigned long)((_secs) * HZ)extern unsigned long __usecs_to_jiffies (const unsigned int u);#if !(USEC_PER_SEC %HZ )
Signature · 1 line
2.48.1
Greg Kroah-Hartman
maintainerPATCH 340/443 iommufd: Fix struct iommu_hwpt_pgfault init and padding
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolin Chen <[email protected]>
commit e721f619e3ec9bae08bf419c3944cf1e6966c821 upstream.
The iommu_hwpt_pgfault is used to report IO page fault data to userspace, but iommufd_fault_fops_read was never zeroing its padding. This leaks the content of the kernel stack memory to userspace.
Also, the iommufd uAPI requires explicit padding and use of __aligned_u64 to ensure ABI compatibility's with 32 bit.
pahole result, before:
struct iommu_hwpt_pgfault {
__u32 flags; /* 0 4 */
__u32 dev_id; /* 4 4 */
__u32 pasid; /* 8 4 */
__u32 grpid; /* 12 4 */
__u32 perm; /* 16 4 */ /* XXX 4 bytes hole, try to pack */
__u64 addr; /* 24 8 */
__u32 length; /* 32 4 */
__u32 cookie; /* 36 4 */
/* size: 40, cachelines: 1, members: 8 */
/* sum members: 36, holes: 1, sum holes: 4 */
/* last cacheline: 40 bytes */
};pahole result, after:
struct iommu_hwpt_pgfault {
__u32 flags; /* 0 4 */
__u32 dev_id; /* 4 4 */
__u32 pasid; /* 8 4 */
__u32 grpid; /* 12 4 */
__u32 perm; /* 16 4 */
__u32 __reserved; /* 20 4 */
__u64 addr __attribute__((__aligned__(8))); /* 24 8 */
__u32 length; /* 32 4 */
__u32 cookie; /* 36 4 */ /* size: 40, cachelines: 1, members: 9 */
/* forced alignments: 1 */
/* last cacheline: 40 bytes */
} __attribute__((__aligned__(8)));--- drivers/iommu/iommufd/fault.c | 2 +- include/uapi/linux/iommufd.h | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/iommu/iommufd/fault.c +1 -1
@@ -247,7 +247,7 @@ static ssize_t iommufd_fault_fops_read(s {size_t fault_size =sizeof (struct iommu_hwpt_pgfault );struct iommufd_fault *fault = filep->private_data; -struct iommu_hwpt_pgfault data; +struct iommu_hwpt_pgfault data = {};struct iommufd_device *idev;struct iopf_group *group;struct iopf_fault *iopf;
include/uapi/linux/iommufd.h +3 -1
@@ -868,6 +868,7 @@ enum iommu_hwpt_pgfault_perm {* @pasid: Process Address Space ID * @grpid: Page Request Group Index * @perm: Combination of enum iommu_hwpt_pgfault_perm +* @__reserved: Must be 0. * @addr: Fault address * @length: a hint of how much data the requestor is expecting to fetch. For * example, if the PRI initiator knows it is going to do a 10MB
@@ -883,7 +884,8 @@ struct iommu_hwpt_pgfault {__u32 pasid;__u32 grpid;__u32 perm; -__u64 addr; +__u32 __reserved; +__aligned_u64 addr;__u32 length;__u32 cookie; };
Greg Kroah-Hartman
maintainerPATCH 341/443 kfence: skip __GFP_THISNODE allocations on NUMA systems
In reply to Greg Kroah-Hartman6.13-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>
@@ -1084,6 +1085,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 342/443 media: ccs: Clean up parsed CCS static data on parse failure
In reply to Greg Kroah-Hartman6.13-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 343/443 mm/hugetlb: fix avoid_reserve to allow taking folio from subpool
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Xu <[email protected]>
commit 58db7c5fbe7daa42098d4965133a864f98ba90ba upstream.
Patch series "mm/hugetlb: Refactor hugetlb allocation resv accounting", v2.
This is a follow up on Ackerley's series here as replacement:
https://lore.kernel.org/r/[email protected]
The goal of this series is to cleanup hugetlb resv accounting, especially during folio allocation, to decouple a few things:
- Hugetlb folios v.s. Hugetlbfs: IOW, the hope is in the future hugetlb folios can be allocated completely without hugetlbfs.
- Decouple VMA v.s. hugetlb folio allocations: allocating a hugetlb folio should not always require a hugetlbfs VMA. For example, either it got allocated from the inode level (see hugetlbfs_fallocate() where it used a pesudo VMA for allocation), or it can be allocated by other kernel subsystems.
It paves way for other users to allocate hugetlb folios out of either system reservations, or subpools (instead of hugetlbfs, as a file system). For longer term, this prepares hugetlb as a separate concept versus hugetlbfs, so that hugetlb folios can be allocated by not only hugetlbfs and other things.
Tests I've done:
- I had a reproducer in patch 1 for the bug I found, this will start to work after patch 1 or the whole set applied.
- Hugetlb regression tests (on x86_64 2MBs), includes:
- All vmtests on hugetlbfs
- libhugetlbfs test suite (which may fail some tests, but no new failures will be introduced by this series, so all such failures happen before this series so shouldn't be relevant).
This patch (of 7):
Since commit 04f2cbe35699 ("hugetlb: guarantee that COW faults for a process that called mmap(MAP_PRIVATE) on hugetlbfs will succeed"), avoid_reserve was introduced for a special case of CoW on hugetlb private mappings, and only if the owner VMA is trying to allocate yet another hugetlb folio that is not reserved within the private vma reserved map.
Later on, in commit d85f69b0b533 ("mm/hugetlb: alloc_huge_page handle areas hole punched by fallocate"), alloc_huge_page() enforced to not consume any global reservation as long as avoid_reserve=true. This operation doesn't look correct, because even if it will enforce the allocation to not use global reservation at all, it will still try to take one reservation from the spool (if the subpool existed). Then since the spool reserved pages take from global reservation, it'll also take one reservation globally.
Logically it can cause global reservation to go wrong.
I wrote a reproducer below, trigger this special path, and every run of such program will cause global reservation count to increment by one, until it hits the number of free pages:
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/mman.h>
#define MSIZE (2UL << 20)
int main(int argc, char *argv[])
{
const char *path;
int *buf;
int fd, ret;
pid_t child; if (argc < 2) {
printf("usage: %s <hugetlb_file>\n", argv[0]);
return -1;
}
path = argv[1];
fd = open(path, O_RDWR | O_CREAT, 0666);
if (fd < 0) {
perror("open failed");
return -1;
}
ret = fallocate(fd, 0, 0, MSIZE);
if (ret != 0) {
perror("fallocate");
return -1;
}
buf = mmap(NULL, MSIZE, PROT_READ|PROT_WRITE,
MAP_PRIVATE, fd, 0);
if (buf == MAP_FAILED) {
perror("mmap() failed");
return -1;
}
/* Allocate a page */
*buf = 1;
child = fork();
if (child == 0) {
/* child doesn't need to do anything */
exit(0);
}
/* Trigger CoW from owner */
*buf = 2;
munmap(buf, MSIZE);
close(fd);
unlink(path);
return 0;}
It can only reproduce with a sub-mount when there're reserved pages on the spool, like:
# sysctl vm.nr_hugepages=128 # mkdir ./hugetlb-pool # mount -t hugetlbfs -o min_size=8M,pagesize=2M none ./hugetlb-pool
Then run the reproducer on the mountpoint:
# ./reproducer ./hugetlb-pool/test
Fix it by taking the reservation from spool if available. In general, avoid_reserve is IMHO more about "avoid vma resv map", not spool's.
I copied stable, however I have no intention for backporting if it's not a clean cherry-pick, because private hugetlb mapping, and then fork() on top is too rare to hit.
--- mm/hugetlb.c | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-)
mm/hugetlb.c +3 -19
@@ -1394,8 +1394,7 @@ static unsigned long available_huge_pagestatic struct folio *dequeue_hugetlb_folio_vma (struct hstate *h,struct vm_area_struct *vma, -unsigned long address,int avoid_reserve, -long chg) +unsigned long address,long chg) {struct folio *folio =NULL ;struct mempolicy *mpol;
@@ -1411,10 +1410,6 @@ static struct folio *dequeue_hugetlb_folif (!vma_has_reserves (vma, chg) && !available_huge_pages (h)) goto err; -/* If reserves cannot be used, ensure enough pages are in the pool */ -if (avoid_reserve && !available_huge_pages (h)) - goto err; - gfp_mask =htlb_alloc_mask (h); nid =huge_node (vma, address, gfp_mask, &mpol, &nodemask);
@@ -1430,7 +1425,7 @@ static struct folio *dequeue_hugetlb_fol folio =dequeue_hugetlb_folio_nodemask (h, gfp_mask, nid, nodemask); -if (folio && !avoid_reserve &&vma_has_reserves (vma, chg)) { +if (folio &&vma_has_reserves (vma, chg)) {folio_set_hugetlb_restore_reserve (folio); h->resv_huge_pages--; }
@@ -3007,17 +3002,6 @@ struct folio *alloc_hugetlb_folio(struct gbl_chg =hugepage_subpool_get_pages (spool,1 );if (gbl_chg <0 ) goto out_end_reservation; - -/* -* Even though there was no reservation in the region/reserve -* map, there could be reservations associated with the -* subpool that can be used. This would be indicated if the -* return value of hugepage_subpool_get_pages() is zero. -* However, if avoid_reserve is specified we still avoid even -* the subpool reservations. -*/ -if (avoid_reserve) - gbl_chg =1 ; }/* If this allocation is not consuming a reservation, charge it now.
@@ -3040,7 +3024,7 @@ struct folio *alloc_hugetlb_folio(struct* from the global free pool (global change). gbl_chg == 0 indicates * a reservation exists for the allocation. */ - folio =dequeue_hugetlb_folio_vma (h, vma, addr, avoid_reserve, gbl_chg); + folio =dequeue_hugetlb_folio_vma (h, vma, addr, gbl_chg);if (!folio) {spin_unlock_irq (&hugetlb_lock); folio =alloc_buddy_hugetlb_folio_with_mpol (h, vma, addr);
Greg Kroah-Hartman
maintainerPATCH 344/443 iio: chemical: bme680: Fix uninitialized variable in __bme680_read_raw()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 20eb1fae4145bc45717aa8a6d05fcd6a64ed856a upstream.
The bme680_read_temp() function takes a pointer to s16 but we're passing an int pointer to it. This will not work on big endian systems and it also means that the other 16 bits are uninitialized.
Pass an s16 type variable.
--- drivers/iio/chemical/bme680_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/chemical/bme680_core.c +2 -2
@@ -874,11 +874,11 @@ static int bme680_read_raw(struct iio_dev *indio_dev,case IIO_CHAN_INFO_RAW :switch (chan->type) {case IIO_TEMP : - ret =bme680_read_temp (data, (s16 *)&chan_val); + ret =bme680_read_temp (data, &temp_chan_val);if (ret)return ret; - *val = chan_val; + *val = temp_chan_val;return IIO_VAL_INT ;case IIO_PRESSURE : ret =bme680_read_press (data, &chan_val);
Signature · 1 line
2.48.1
Greg Kroah-Hartman
maintainerPATCH 345/443 iio: dac: ad3552r-common: fix ad3541/2r ranges
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Angelo Dureghello <[email protected]>
commit 1e758b613212b6964518a67939535910b5aee831 upstream.
Fix ad3541/2r voltage ranges to be as per ad3542r datasheet, rev. C, table 38 (page 57).
The wrong ad354xr ranges was generating erroneous Vpp output.
In more details:
- fix wrong number of ranges, they are 5 ranges, not 6,
- remove non-existent 0-3V range,
- adjust order, since ad3552r_find_range() get a wrong index, producing a wrong Vpp as output.
Retested all the ranges on real hardware, EVALAD3542RFMCZ:
adi,output-range-microvolt (fdt):
<(000000) (2500000)>; ok (Rfbx1, switch 10) <(000000) (5000000)>; ok (Rfbx1, switch 10) <(000000) (10000000)>; ok (Rfbx1, switch 10)
<(-5000000) (5000000)>; ok (Rfbx2, switch +/- 5) <(-2500000) (7500000)>; ok (Rfbx2, switch -2.5/7.5)
--- drivers/iio/dac/ad3552r-common.c | 5 ++--- drivers/iio/dac/ad3552r.h | 8 +++----- 2 files changed, 5 insertions(+), 8 deletions(-)
drivers/iio/dac/ad3552r-common.c +2 -3
@@ -22,11 +22,10 @@ EXPORT_SYMBOL_NS_GPL(ad3552r_ch_ranges,const s32 ad3542r_ch_ranges[AD3542R_MAX_RANGES ][2 ] = { [AD3542R_CH_OUTPUT_RANGE_0__2P5V ] = {0 ,2500 }, - [AD3542R_CH_OUTPUT_RANGE_0__3V ] = {0 ,3000 }, [AD3542R_CH_OUTPUT_RANGE_0__5V ] = {0 ,5000 }, [AD3542R_CH_OUTPUT_RANGE_0__10V ] = {0 ,10000 }, - [AD3542R_CH_OUTPUT_RANGE_NEG_2P5__7P5V ] = {-2500 ,7500 }, - [AD3542R_CH_OUTPUT_RANGE_NEG_5__5V ] = {-5000 ,5000 } + [AD3542R_CH_OUTPUT_RANGE_NEG_5__5V ] = {-5000 ,5000 }, + [AD3542R_CH_OUTPUT_RANGE_NEG_2P5__7P5V ] = {-2500 ,7500 } };EXPORT_SYMBOL_NS_GPL (ad3542r_ch_ranges,"IIO_AD3552R" );
drivers/iio/dac/ad3552r.h +3 -5
@@ -131,7 +131,7 @@#define AD3552R_CH1_ACTIVE BIT(1)#define AD3552R_MAX_RANGES 5 -#define AD3542R_MAX_RANGES 6 +#define AD3542R_MAX_RANGES 5#define AD3552R_QUAD_SPI 2extern const s32 ad3552r_ch_ranges[AD3552R_MAX_RANGES ][2 ];
@@ -189,16 +189,14 @@ enum ad3552r_ch_vref_select {enum ad3542r_ch_output_range {/* Range from 0 V to 2.5 V. Requires Rfb1x connection */ AD3542R_CH_OUTPUT_RANGE_0__2P5V , -/* Range from 0 V to 3 V. Requires Rfb1x connection */ -AD3542R_CH_OUTPUT_RANGE_0__3V ,/* Range from 0 V to 5 V. Requires Rfb1x connection */ AD3542R_CH_OUTPUT_RANGE_0__5V ,/* Range from 0 V to 10 V. Requires Rfb2x connection */ AD3542R_CH_OUTPUT_RANGE_0__10V , -/* Range from -2.5 V to 7.5 V. Requires Rfb2x connection */ -AD3542R_CH_OUTPUT_RANGE_NEG_2P5__7P5V ,/* Range from -5 V to 5 V. Requires Rfb2x connection */ AD3542R_CH_OUTPUT_RANGE_NEG_5__5V , +/* Range from -2.5 V to 7.5 V. Requires Rfb2x connection */ +AD3542R_CH_OUTPUT_RANGE_NEG_2P5__7P5V , };enum ad3552r_ch_output_range {
Greg Kroah-Hartman
maintainerPATCH 346/443 iio: dac: ad3552r-hs: clear reset status flag
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Angelo Dureghello <[email protected]>
commit 012b8276f08a67b9f2e2fd0f35363ae4a75e5267 upstream.
Clear reset status flag, to keep error status register clean after reset (ad3552r manual, rev B table 38).
Reset error flag was left to 1, so debugging registers, the "Error Status Register" was dirty (0x01). It is important to clear this bit, so if there is any reset event over normal working mode, it is possible to detect it.
--- drivers/iio/dac/ad3552r-hs.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/iio/dac/ad3552r-hs.c +6 -0
@@ -329,6 +329,12 @@ static int ad3552r_hs_setup(struct ad355dev_info (st->dev,"Chip ID error. Expected 0x%x, Read 0x%x\n" ,AD3552R_ID , id); +/* Clear reset error flag, see ad3552r manual, rev B table 38. */ + ret = st->data->bus_reg_write (st->back,AD3552R_REG_ADDR_ERR_STATUS , +AD3552R_MASK_RESET_STATUS ,1 ); +if (ret) +return ret; + ret = st->data->bus_reg_write (st->back,AD3552R_REG_ADDR_SH_REFERENCE_CONFIG ,0 ,1 );
Greg Kroah-Hartman
maintainerPATCH 347/443 iio: light: as73211: fix channel handling in only-color triggered buffer
In reply to Greg Kroah-Hartman6.13-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
@@ -177,6 +177,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 ,
@@ -672,9 +678,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) {
@@ -682,9 +691,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));
@@ -758,6 +773,7 @@ static int as73211_probe(struct i2c_clie indio_dev->channels = data->spec_dev->channels; indio_dev->num_channels = data->spec_dev->num_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 348/443 iommu/tegra241-cmdqv: Read SMMU IDR1.CMDQS instead of hardcoding
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolin Chen <[email protected]>
commit e94dc6ddda8dd3770879a132d577accd2cce25f9 upstream.
The hardware limitation "max=19" actually comes from SMMU Command Queue. So, it'd be more natural for tegra241-cmdqv driver to read it out rather than hardcoding it itself.
This is not an issue yet for a kernel on a baremetal system, but a guest kernel setting the queue base/size in form of IPA/gPA might result in a noncontiguous queue in the physical address space, if underlying physical pages backing up the guest RAM aren't contiguous entirely: e.g. 2MB-page backed guest RAM cannot guarantee a contiguous queue if it is 8MB (capped to VCMDQ_LOG2SIZE_MAX=19). This might lead to command errors when HW does linear-read from a noncontiguous queue memory.
Adding this extra IDR1.CMDQS cap (in the guest kernel) allows VMM to set SMMU's IDR1.CMDQS=17 for the case mentioned above, so a guest-level queue will be capped to maximum 2MB, ensuring a contiguous queue memory.
--- drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c +5 -3
@@ -79,7 +79,6 @@#define TEGRA241_VCMDQ_PAGE1 (q) (TEGRA241_VCMDQ_PAGE1_BASE + 0x80*(q))#define VCMDQ_ADDR GENMASK(47, 5)#define VCMDQ_LOG2SIZE GENMASK(4, 0) -#define VCMDQ_LOG2SIZE_MAX 19#define TEGRA241_VCMDQ_BASE 0x00000#define TEGRA241_VCMDQ_CONS_INDX_BASE 0x00008
@@ -505,12 +504,15 @@ static int tegra241_vcmdq_alloc_smmu_cmdq(struct tegra241_vcmdq *vcmdq)struct arm_smmu_cmdq *cmdq = &vcmdq->cmdq;struct arm_smmu_queue *q = &cmdq->q;char name[16 ]; +u32 regval;int ret;snprintf (name,16 ,"vcmdq%u" , vcmdq->idx); -/* Queue size, capped to ensure natural alignment */ - q->llq.max_n_shift =min_t (u32,CMDQ_MAX_SZ_SHIFT ,VCMDQ_LOG2SIZE_MAX ); +/* Cap queue size to SMMU's IDR1.CMDQS and ensure natural alignment */ + regval =readl_relaxed (smmu->base +ARM_SMMU_IDR1 ); + q->llq.max_n_shift = +min_t (u32,CMDQ_MAX_SZ_SHIFT ,FIELD_GET (IDR1_CMDQS , regval));/* Use the common helper to init the VCMDQ, and then... */ ret = arm_smmu_init_one_queue(smmu, q, vcmdq->page0,
Signature · 1 line
2.48.1
Greg Kroah-Hartman
maintainerPATCH 349/443 iommufd/fault: Destroy response and mutex in iommufd_fault_destroy()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolin Chen <[email protected]>
commit 3f4818ec139030f425476bf8a10b616bab53a7b5 upstream.
Both were missing in the initial patch.
--- drivers/iommu/iommufd/fault.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/iommu/iommufd/fault.c +8 -0
@@ -213,6 +213,7 @@ void iommufd_fault_destroy(struct iommuf { struct iommufd_fault *fault = container_of(obj, struct iommufd_fault, obj);struct iopf_group *group, *next; +unsigned long index;/* * The iommufd object's reference count is zero at this point.
@@ -225,6 +226,13 @@ void iommufd_fault_destroy(struct iommufiopf_group_response (group,IOMMU_PAGE_RESP_INVALID );iopf_free_group (group); } +xa_for_each (&fault->response, index, group) { +xa_erase (&fault->response, index); +iopf_group_response (group,IOMMU_PAGE_RESP_INVALID ); +iopf_free_group (group); + } +xa_destroy (&fault->response); +mutex_destroy (&fault->mutex); } static void iommufd_compose_fault_message(struct iommu_fault *fault,
Greg Kroah-Hartman
maintainerPATCH 350/443 iommufd/fault: Use a separate spinlock to protect fault->deliver list
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolin Chen <[email protected]>
commit 3d49020a327cd7d069059317c11df24e407ccfa3 upstream.
The fault->mutex serializes the fault read()/write() fops and the iommufd_fault_auto_response_faults(), mainly for fault->response. Also, it was conveniently used to fence the fault->deliver in poll() fop and iommufd_fault_iopf_handler().
However, copy_from/to_user() may sleep if pagefaults are enabled. Thus, they could take a long time to wait for user pages to swap in, blocking iommufd_fault_iopf_handler() and its caller that is typically a shared IRQ handler of an IOMMU driver, resulting in a potential global DOS.
Instead of reusing the mutex to protect the fault->deliver list, add a separate spinlock, nested under the mutex, to do the job. iommufd_fault_iopf_handler() would no longer be blocked by copy_from/to_user().
Add a free_list in iommufd_auto_response_faults(), so the spinlock can simply fence a fast list_for_each_entry_safe routine.
Provide two deliver list helpers for iommufd_fault_fops_read() to use:
- Fetch the first iopf_group out of the fault->deliver list
- Restore an iopf_group back to the head of the fault->deliver list
Lastly, move the mutex closer to the response in the fault structure, and update its kdoc accordingly.
--- drivers/iommu/iommufd/fault.c | 34 ++++++++++++++++++++------------ drivers/iommu/iommufd/iommufd_private.h | 29 +++++++++++++++++++++++++-- 2 files changed, 49 insertions(+), 14 deletions(-)
drivers/iommu/iommufd/fault.c +22 -12
@@ -103,15 +103,23 @@ static void iommufd_auto_response_faults {struct iommufd_fault *fault = hwpt->fault;struct iopf_group *group, *next; +struct list_head free_list;unsigned long index;if (!fault)return ; +INIT_LIST_HEAD (&free_list);mutex_lock (&fault->mutex); +spin_lock (&fault->lock);list_for_each_entry_safe (group, next, &fault->deliver, node) {if (group->attach_handle != &handle->handle)continue ; +list_move (&group->node, &free_list); + } +spin_unlock (&fault->lock); + +list_for_each_entry_safe (group, next, &free_list, node) {list_del (&group->node);iopf_group_response (group,IOMMU_PAGE_RESP_INVALID );iopf_free_group (group);
@@ -266,17 +274,19 @@ static ssize_t iommufd_fault_fops_read(sreturn -ESPIPE ;mutex_lock (&fault->mutex); -while (!list_empty (&fault->deliver) && count > done) { - group =list_first_entry (&fault->deliver, - struct iopf_group, node); - -if (group->fault_count * fault_size > count - done) +while ((group =iommufd_fault_deliver_fetch (fault))) { +if (done >= count || + group->fault_count * fault_size > count - done) { +iommufd_fault_deliver_restore (fault, group);break ; + } rc =xa_alloc (&fault->response, &group->cookie, group, xa_limit_32b,GFP_KERNEL ); -if (rc) +if (rc) { +iommufd_fault_deliver_restore (fault, group);break ; + } idev =to_iommufd_handle (group->attach_handle)->idev;list_for_each_entry (iopf, &group->faults, list) {
@@ -285,13 +295,12 @@ static ssize_t iommufd_fault_fops_read(s group->cookie);if (copy_to_user (buf + done, &data, fault_size)) {xa_erase (&fault->response, group->cookie); +iommufd_fault_deliver_restore (fault, group); rc = -EFAULT ;break ; } done += fault_size; } - -list_del (&group->node); }mutex_unlock (&fault->mutex);
@@ -349,10 +358,10 @@ static __poll_t iommufd_fault_fops_poll(__poll_t pollflags =EPOLLOUT ;poll_wait (filep, &fault->wait_queue, wait); -mutex_lock (&fault->mutex); +spin_lock (&fault->lock);if (!list_empty (&fault->deliver)) pollflags |=EPOLLIN |EPOLLRDNORM ; -mutex_unlock (&fault->mutex); +spin_unlock (&fault->lock);return pollflags; }
@@ -394,6 +403,7 @@ int iommufd_fault_alloc(struct iommufd_uINIT_LIST_HEAD (&fault->deliver);xa_init_flags (&fault->response,XA_FLAGS_ALLOC1 );mutex_init (&fault->mutex); +spin_lock_init (&fault->lock);init_waitqueue_head (&fault->wait_queue); filep = anon_inode_getfile("[iommufd-pgfault]", &iommufd_fault_fops,
@@ -442,9 +452,9 @@ int iommufd_fault_iopf_handler(struct io hwpt = group->attach_handle->domain->fault_data; fault = hwpt->fault; -mutex_lock (&fault->mutex); +spin_lock (&fault->lock);list_add_tail (&group->node, &fault->deliver); -mutex_unlock (&fault->mutex); +spin_unlock (&fault->lock);wake_up_interruptible (&fault->wait_queue);
drivers/iommu/iommufd/iommufd_private.h +27 -2
@@ -443,14 +443,39 @@ struct iommufd_fault {struct iommufd_ctx *ictx;struct file *filep; -/* The lists of outstanding faults protected by below mutex. */ -struct mutex mutex; +spinlock_t lock;/* protects the deliver list */ struct list_head deliver; +struct mutex mutex;/* serializes response flows */ struct xarray response;struct wait_queue_head wait_queue; }; +/* Fetch the first node out of the fault->deliver list */ +static inline struct iopf_group * +iommufd_fault_deliver_fetch (struct iommufd_fault *fault) +{ +struct list_head *list = &fault->deliver; +struct iopf_group *group =NULL ; + +spin_lock (&fault->lock); +if (!list_empty (list)) { + group = list_first_entry(list, struct iopf_group, node); +list_del (&group->node); + } +spin_unlock (&fault->lock); +return group; +} + +/* Restore a node back to the head of the fault->deliver list */ +static inline void iommufd_fault_deliver_restore (struct iommufd_fault *fault, +struct iopf_group *group) +{ +spin_lock (&fault->lock); +list_add (&group->node, &fault->deliver); +spin_unlock (&fault->lock); +} +struct iommufd_attach_handle {struct iommu_attach_handle handle;struct iommufd_device *idev;
Greg Kroah-Hartman
maintainerPATCH 351/443 soc: samsung: exynos-pmu: Fix uninitialized ret in tensor_set_bits_atomic()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit eca836dfd8386b32f1aae60f8e323218ac6a0b75 upstream.
If tensor_set_bits_atomic() is called with a mask of 0 the function will just iterate over its bit, not perform any updates and return stack value of 'ret'.
Also reported by smatch:
drivers/soc/samsung/exynos-pmu.c:129 tensor_set_bits_atomic() error: uninitialized symbol 'ret'.
--- drivers/soc/samsung/exynos-pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/soc/samsung/exynos-pmu.c +1 -1
@@ -126,7 +126,7 @@ static int tensor_set_bits_atomic(void *if (ret)return ret; } -return ret; +return 0 ; }static bool tensor_is_atomic (unsigned int reg)
Greg Kroah-Hartman
maintainerPATCH 352/443 soc: mediatek: mtk-devapc: Fix leaking IO map on error paths
In reply to Greg Kroah-Hartman6.13-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 void mtk_devapc_remove (struct platform_device *pdev)
Greg Kroah-Hartman
maintainerPATCH 353/443 soc: mediatek: mtk-devapc: Fix leaking IO map on driver remove
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Krzysztof Kozlowski <[email protected]>
commit c9c0036c1990da8d2dd33563e327e05a775fcf10 upstream.
Driver removal should fully clean up - unmap the memory.
--- drivers/soc/mediatek/mtk-devapc.c | 1 + 1 file changed, 1 insertion(+)
drivers/soc/mediatek/mtk-devapc.c +1 -0
@@ -305,6 +305,7 @@ static void mtk_devapc_remove(struct plastruct mtk_devapc_context *ctx =platform_get_drvdata (pdev);stop_devapc (ctx); +iounmap (ctx->infra_base); }static struct platform_driver mtk_devapc_driver = {
Greg Kroah-Hartman
maintainerPATCH 354/443 soc: qcom: llcc: Enable LLCC_WRCACHE at boot on X1
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Dybcio <[email protected]>
commit 35d8bc131de0f0f280f0db42499512d79f05f456 upstream.
The Last Level Cache is split into many slices, each one of which can be toggled on or off.
Only certain slices are recommended to be turned on unconditionally, in order to reach optimal performance/latency/power levels.
Enable WRCACHE on X1 at boot, in accordance with internal recommendations.
No significant performance difference is expected.
--- drivers/soc/qcom/llcc-qcom.c | 1 + 1 file changed, 1 insertion(+)
drivers/soc/qcom/llcc-qcom.c +1 -0
@@ -3004,6 +3004,7 @@ static const struct llcc_slice_config x1 .fixed_size = true, .bonus_ways = 0xfff, .cache_mode = 0, + .activate_on_init = true, }, { .usecase_id = LLCC_CAMEXP0, .slice_id = 4,
Greg Kroah-Hartman
maintainerPATCH 355/443 soc: qcom: smem_state: fix missing of_node_put in error path
In reply to Greg Kroah-Hartman6.13-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
@@ -112,7 +112,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 356/443 media: mmp: Bring back registration of the device
In reply to Greg Kroah-Hartman6.13-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
@@ -232,12 +232,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);
@@ -246,7 +256,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; }/*
@@ -254,7 +264,7 @@ static int mmpcam_probe(struct platform_*/ ret =mccic_register (mcam);if (ret) - goto out; + goto out_v4l2_device_unregister;/* * Add OF clock provider.
@@ -283,6 +293,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; }
@@ -293,6 +305,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 357/443 media: Documentation: tx-rx: Fix formatting
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sakari Ailus <[email protected]>
commit b76fb1f2c5a39e8e1b785e94a08448847fe4c626 upstream.
Fix formatting under "``.enable_streams()`` and ``.disable_streams()`` callbacks" in tx-rx.rst.
--- Documentation/driver-api/media/tx-rx.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/driver-api/media/tx-rx.rst +1 -1
@@ -50,7 +50,7 @@ The :ref:`V4L2_CID_LINK_FREQ <v4l2-cid-link-freq>` control is used to tell the receiver the frequency of the bus (i.e. it is not the same as the symbol rate). ``.enable_streams()`` and ``.disable_streams()`` callbacks -^^^^^^^^^^^^^^^^^^^^^^^^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The struct v4l2_subdev_pad_ops->enable_streams() and struct v4l2_subdev_pad_ops->disable_streams() callbacks are used by the receiver driver
Signature · 1 line
2.48.1
Greg Kroah-Hartman
maintainerPATCH 358/443 media: mc: fix endpoint iteration
In reply to Greg Kroah-Hartman6.13-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 359/443 media: nuvoton: Fix an error check in npcm_video_ece_init()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhen Lei <[email protected]>
commit c4b7779abc6633677e6edb79e2809f4f61fde157 upstream.
When function of_find_device_by_node() fails, it returns NULL instead of an error code. So the corresponding error check logic should be modified to check whether the return value is NULL and set the error code to be returned as -ENODEV.
--- drivers/media/platform/nuvoton/npcm-video.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/nuvoton/npcm-video.c +2 -2
@@ -1665,9 +1665,9 @@ static int npcm_video_ece_init(struct npdev_info (dev,"Support HEXTILE pixel format\n" ); ece_pdev =of_find_device_by_node (ece_node); -if (IS_ERR (ece_pdev)) { +if (!ece_pdev) {dev_err (dev,"Failed to find ECE device\n" ); -return PTR_ERR (ece_pdev); +return -ENODEV ; }of_node_put (ece_node);
Greg Kroah-Hartman
maintainerPATCH 360/443 media: imx296: Add standby delay during probe
In reply to Greg Kroah-Hartman6.13-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
@@ -954,6 +954,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 361/443 media: intel/ipu6: remove cpu latency qos request on error
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislaw Gruszka <[email protected]>
commit facb541ff0805314e0b56e508f7d3cbd07af513c upstream.
Fix cpu latency qos list corruption like below. It happens when we do not remove cpu latency request on error path and free corresponding memory.
[ 30.634378] l7 kernel: list_add corruption. prev->next should be next (ffffffff9645e960), but was 0000000100100001. (prev=ffff8e9e877e20a8). [ 30.634388] l7 kernel: WARNING: CPU: 2 PID: 2008 at lib/list_debug.c:32 __list_add_valid_or_report+0x83/0xa0 <snip> [ 30.634640] l7 kernel: Call Trace: [ 30.634650] l7 kernel: <TASK> [ 30.634659] l7 kernel: ? __list_add_valid_or_report+0x83/0xa0 [ 30.634669] l7 kernel: ? __warn.cold+0x93/0xf6 [ 30.634678] l7 kernel: ? __list_add_valid_or_report+0x83/0xa0 [ 30.634690] l7 kernel: ? report_bug+0xff/0x140 [ 30.634702] l7 kernel: ? handle_bug+0x58/0x90 [ 30.634712] l7 kernel: ? exc_invalid_op+0x17/0x70 [ 30.634723] l7 kernel: ? asm_exc_invalid_op+0x1a/0x20 [ 30.634733] l7 kernel: ? __list_add_valid_or_report+0x83/0xa0 [ 30.634742] l7 kernel: plist_add+0xdd/0x140 [ 30.634754] l7 kernel: pm_qos_update_target+0xa0/0x1f0 [ 30.634764] l7 kernel: cpu_latency_qos_update_request+0x61/0xc0 [ 30.634773] l7 kernel: intel_dp_aux_xfer+0x4c7/0x6e0 [i915 1f824655ed04687c2b0d23dbce759fa785f6d033]
--- drivers/media/pci/intel/ipu6/ipu6-isys.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/pci/intel/ipu6/ipu6-isys.c +1 -0
@@ -1133,6 +1133,7 @@ static int isys_probe(struct auxiliary_d free_fw_msg_bufs:free_fw_msg_bufs (isys); out_remove_pkg_dir_shared_buffer: +cpu_latency_qos_remove_request (&isys->pm_qos);if (!isp->secure_mode)ipu6_cpd_free_pkg_dir (adev); remove_shared_buffer:
Greg Kroah-Hartman
maintainerPATCH 362/443 media: ov5640: fix get_light_freq on auto
In reply to Greg Kroah-Hartman6.13-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 363/443 media: stm32: dcmipp: correct dma_set_mask_and_coherent mask value
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alain Volmat <[email protected]>
commit b36077ba289b827b4e76e25e8d8e0cc90fa09186 upstream.
Correct the call to dma_set_mask_and_coherent which should be set to DMA_BIT_MASK(32).
--- drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-bytecap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-bytecap.c +1 -1
@@ -887,7 +887,7 @@ struct dcmipp_ent_device *dcmipp_bytecap q->dev = dev;/* DCMIPP requires 16 bytes aligned buffers */ - ret =dma_set_mask_and_coherent (dev,DMA_BIT_MASK (32 ) & ~0x0f ); + ret =dma_set_mask_and_coherent (dev,DMA_BIT_MASK (32 ));if (ret) {dev_err (dev,"Failed to set DMA mask\n" ); goto err_mutex_destroy;
Greg Kroah-Hartman
maintainerPATCH 364/443 media: venus: destroy hfi session after m2m_ctx release
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergey Senozhatsky <[email protected]>
commit df4ff47448fe0d392b29868e8398e3b0e587514d upstream.
This partially reverts commit that made hfi_session_destroy() the first step of vdec/venc close(). The reason being is a regression report when, supposedly, encode/decoder is closed with still active streaming (no ->stop_streaming() call before close()) and pending pkts, so isr_thread cannot find instance and fails to process those pending pkts. This was the idea behind the original patch - make it impossible to use instance under destruction, because this is racy, but apparently there are uses cases that depend on that unsafe pattern. Return to the old (unsafe) behaviour for the time being (until a better fix is found).
--- drivers/media/platform/qcom/venus/core.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/media/platform/qcom/venus/core.c +2 -6
@@ -506,18 +506,14 @@ static __maybe_unused int venus_runtime_suspend(struct device *dev)void venus_close_common (struct venus_inst *inst) {/* -* First, remove the inst from the ->instances list, so that -* to_instance() will return NULL. -*/ -hfi_session_destroy (inst); -/* -* Second, make sure we don't have IRQ/IRQ-thread currently running +* Make sure we don't have IRQ/IRQ-thread currently running * or pending execution, which would race with the inst destruction. */ synchronize_irq (inst->core->irq);v4l2_m2m_ctx_release (inst->m2m_ctx);v4l2_m2m_release (inst->m2m_dev); +hfi_session_destroy (inst);v4l2_fh_del (&inst->fh);v4l2_fh_exit (&inst->fh);v4l2_ctrl_handler_free (&inst->ctrl_handler);
Signature · 1 line
2.48.1
Greg Kroah-Hartman
maintainerPATCH 365/443 media: ccs: Fix CCS static data parsing for large block sizes
In reply to Greg Kroah-Hartman6.13-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 366/443 media: ccs: Fix cleanup order in ccs_probe()
In reply to Greg Kroah-Hartman6.13-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
@@ -3566,15 +3566,15 @@ out_disable_runtime_pm: 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 367/443 media: i2c: ds90ub9x3: Fix extra fwnode_handle_put()
In reply to Greg Kroah-Hartman6.13-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
@@ -793,7 +793,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
@@ -1288,7 +1288,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 368/443 media: i2c: ds90ub960: Fix use of non-existing registers on UB9702
In reply to Greg Kroah-Hartman6.13-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
@@ -1576,16 +1576,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 369/443 media: i2c: ds90ub960: Fix UB9702 VC map
In reply to Greg Kroah-Hartman6.13-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
@@ -2532,7 +2532,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 370/443 media: i2c: ds90ub960: Fix logging SP & EQ status only for UB9702
In reply to Greg Kroah-Hartman6.13-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
@@ -2949,6 +2949,54 @@ static const struct v4l2_subdev_pad_ops .set_fmt = ub960_set_fmt, }; +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);
@@ -2996,8 +3044,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);
@@ -3033,44 +3079,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 371/443 media: uvcvideo: Fix crash during unbind if gpio unit is in use
In reply to Greg Kroah-Hartman6.13-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
@@ -234,6 +234,7 @@ struct uvc_entity {u8 *bmControls;struct gpio_desc *gpio_privacy;int irq; +bool initialized; } gpio; };
Greg Kroah-Hartman
maintainerPATCH 372/443 media: uvcvideo: Fix event flags in uvc_ctrl_send_events
In reply to Greg Kroah-Hartman6.13-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
@@ -1673,13 +1673,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 373/443 media: uvcvideo: Support partial control reads
In reply to Greg Kroah-Hartman6.13-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 374/443 media: uvcvideo: Only save async fh if success
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
commit d9fecd096f67a4469536e040a8a10bbfb665918b upstream.
Now we keep a reference to the active fh for any call to uvc_ctrl_set, regardless if it is an actual set or if it is a just a try or if the device refused the operation.
We should only keep the file handle if the device actually accepted applying the operation.
--- drivers/media/usb/uvc/uvc_ctrl.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/media/usb/uvc/uvc_ctrl.c +11 -7
@@ -1811,7 +1811,10 @@ int uvc_ctrl_begin(struct uvc_video_chai }static int uvc_ctrl_commit_entity (struct uvc_device *dev, -struct uvc_entity *entity,int rollback,struct uvc_control **err_ctrl) +struct uvc_fh *handle, +struct uvc_entity *entity, +int rollback, +struct uvc_control **err_ctrl) {struct uvc_control *ctrl;unsigned int i;
@@ -1859,6 +1862,10 @@ static int uvc_ctrl_commit_entity(struct *err_ctrl = ctrl;return ret; } + +if (!rollback && handle && + ctrl->info.flags &UVC_CTRL_FLAG_ASYNCHRONOUS ) + ctrl->handle = handle; }return 0 ;
@@ -1895,8 +1902,8 @@ int __uvc_ctrl_commit(struct uvc_fh *han/* Find the control. */ list_for_each_entry (entity, &chain->entities, chain) { - ret =uvc_ctrl_commit_entity (chain->dev, entity, rollback, - &err_ctrl); + ret =uvc_ctrl_commit_entity (chain->dev, handle, entity, + rollback, &err_ctrl);if (ret <0 ) {if (ctrls) ctrls->error_idx =
@@ -2046,9 +2053,6 @@ int uvc_ctrl_set(struct uvc_fh *handle, mapping->set (mapping, value,uvc_ctrl_data (ctrl,UVC_CTRL_DATA_CURRENT )); -if (ctrl->info.flags &UVC_CTRL_FLAG_ASYNCHRONOUS ) - ctrl->handle = handle; - ctrl->dirty =1 ; ctrl->modified =1 ;return 0 ;
@@ -2377,7 +2381,7 @@ int uvc_ctrl_restore_values(struct uvc_d ctrl->dirty =1 ; } - ret =uvc_ctrl_commit_entity (dev, entity,0 ,NULL ); + ret =uvc_ctrl_commit_entity (dev,NULL , entity,0 ,NULL );if (ret <0 )return ret; }
Greg Kroah-Hartman
maintainerPATCH 375/443 media: uvcvideo: Remove redundant NULL assignment
In reply to Greg Kroah-Hartman6.13-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
@@ -1640,10 +1640,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 376/443 media: uvcvideo: Remove dangling pointers
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
commit 221cd51efe4565501a3dbf04cc011b537dcce7fb upstream.
When an async control is written, we copy a pointer to the file handle that started the operation. That pointer will be used when the device is done. Which could be anytime in the future.
If the user closes that file descriptor, its structure will be freed, and there will be one dangling pointer per pending async control, that the driver will try to use.
Clean all the dangling pointers during release().
To avoid adding a performance penalty in the most common case (no async operation), a counter has been introduced with some logic to make sure that it is properly handled.
--- drivers/media/usb/uvc/uvc_ctrl.c | 59 +++++++++++++++++++++++++++++++++++++-- drivers/media/usb/uvc/uvc_v4l2.c | 2 + drivers/media/usb/uvc/uvcvideo.h | 9 +++++ 3 files changed, 67 insertions(+), 3 deletions(-)
drivers/media/usb/uvc/uvc_ctrl.c +57 -2
@@ -1579,6 +1579,40 @@ static void uvc_ctrl_send_slave_event(stuvc_ctrl_send_event (chain, handle, ctrl, mapping, val, changes); } +static void uvc_ctrl_set_handle (struct uvc_fh *handle,struct uvc_control *ctrl, +struct uvc_fh *new_handle) +{ +lockdep_assert_held (&handle->chain->ctrl_mutex); + +if (new_handle) { +if (ctrl->handle) +dev_warn_ratelimited (&handle->stream->dev->udev->dev, +"UVC non compliance: Setting an async control with a pending operation." ); + +if (new_handle == ctrl->handle) +return ; + +if (ctrl->handle) { +WARN_ON (!ctrl->handle->pending_async_ctrls); +if (ctrl->handle->pending_async_ctrls) + ctrl->handle->pending_async_ctrls--; + } + + ctrl->handle = new_handle; + handle->pending_async_ctrls++; +return ; + } + +/* Cannot clear the handle for a control not owned by us.*/ +if (WARN_ON (ctrl->handle != handle)) +return ; + + ctrl->handle =NULL ; +if (WARN_ON (!handle->pending_async_ctrls)) +return ; + handle->pending_async_ctrls--; +} +void uvc_ctrl_status_event (struct uvc_video_chain *chain,struct uvc_control *ctrl,const u8 *data) {
@@ -1589,7 +1623,8 @@ void uvc_ctrl_status_event(struct uvc_vimutex_lock (&chain->ctrl_mutex); handle = ctrl->handle; - ctrl->handle =NULL ; +if (handle) +uvc_ctrl_set_handle (handle, ctrl,NULL );list_for_each_entry (mapping, &ctrl->info.mappings, list) {s32 value =__uvc_ctrl_get_value (mapping, data);
@@ -1863,7 +1898,7 @@ static int uvc_ctrl_commit_entity(structif (!rollback && handle && ctrl->info.flags &UVC_CTRL_FLAG_ASYNCHRONOUS ) - ctrl->handle = handle; +uvc_ctrl_set_handle (handle, ctrl, handle); }return 0 ;
@@ -2772,6 +2807,26 @@ int uvc_ctrl_init_device(struct uvc_devireturn 0 ; } +void uvc_ctrl_cleanup_fh (struct uvc_fh *handle) +{ +struct uvc_entity *entity; + +guard (mutex)(&handle->chain->ctrl_mutex); + +if (!handle->pending_async_ctrls) +return ; + +list_for_each_entry (entity, &handle->chain->dev->entities, list) { +for (unsigned int i =0 ; i < entity->ncontrols; ++i) { +if (entity->controls[i].handle != handle) +continue ; +uvc_ctrl_set_handle (handle, &entity->controls[i],NULL ); + } + } + +WARN_ON (handle->pending_async_ctrls); +} +/* * Cleanup device controls. */
drivers/media/usb/uvc/uvc_v4l2.c +2 -0
@@ -652,6 +652,8 @@ static int uvc_v4l2_release(struct fileuvc_dbg (stream->dev,CALLS ,"%s\n" , __func__); +uvc_ctrl_cleanup_fh (handle); +/* Only free resources if this is a privileged handle. */ if (uvc_has_privileges (handle))uvc_queue_release (&stream->queue);
drivers/media/usb/uvc/uvcvideo.h +8 -1
@@ -338,7 +338,11 @@ struct uvc_video_chain {struct uvc_entity *processing;/* Processing unit */ struct uvc_entity *selector;/* Selector unit */ -struct mutex ctrl_mutex;/* Protects ctrl.info */ +struct mutex ctrl_mutex;/* +* Protects ctrl.info, +* ctrl.handle and +* uvc_fh.pending_async_ctrls +*/ struct v4l2_prio_state prio;/* V4L2 priority state */ u32 caps;/* V4L2 chain-wide caps */
@@ -613,6 +617,7 @@ struct uvc_fh {struct uvc_video_chain *chain;struct uvc_streaming *stream;enum uvc_handle_state state; +unsigned int pending_async_ctrls; };struct uvc_driver {
@@ -798,6 +803,8 @@ int uvc_ctrl_is_accessible(struct uvc_viint uvc_xu_ctrl_query (struct uvc_video_chain *chain,struct uvc_xu_control_query *xqry); +void uvc_ctrl_cleanup_fh (struct uvc_fh *handle); +/* Utility functions */ struct usb_host_endpoint *uvc_find_endpoint (struct usb_host_interface *alts,u8 epaddr);
Greg Kroah-Hartman
maintainerPATCH 377/443 mm: kmemleak: fix upper boundary check for physical address objects
In reply to Greg Kroah-Hartman6.13-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
@@ -1689,7 +1689,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 378/443 mm: gup: fix infinite loop within __get_longterm_locked
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhaoyang Huang <[email protected]>
commit 1aaf8c122918aa8897605a9aa1e8ed6600d6f930 upstream.
We can run into an infinite loop in __get_longterm_locked() when collect_longterm_unpinnable_folios() finds only folios that are isolated from the LRU or were never added to the LRU. This can happen when all folios to be pinned are never added to the LRU, for example when vm_ops->fault allocated pages using cma_alloc() and never added them to the LRU.
Fix it by simply taking a look at the list in the single caller, to see if anything was added.
--- mm/gup.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
mm/gup.c +4 -10
@@ -2323,13 +2323,13 @@ static void pofs_unpin(struct pages_or_f/* * Returns the number of collected folios. Return value is always >= 0. */ -static unsigned long collect_longterm_unpinnable_folios ( +static void collect_longterm_unpinnable_folios (struct list_head *movable_folio_list,struct pages_or_folios *pofs) { -unsigned long i, collected =0 ;struct folio *prev_folio =NULL ;bool drain_allow = true; +unsigned long i;for (i =0 ; i < pofs->nr_entries; i++) {struct folio *folio =pofs_get_folio (pofs, i);
@@ -2341,8 +2341,6 @@ static unsigned long collect_longterm_unif (folio_is_longterm_pinnable (folio))continue ; - collected++; -if (folio_is_device_coherent (folio))continue ;
@@ -2364,8 +2362,6 @@ static unsigned long collect_longterm_unNR_ISOLATED_ANON +folio_is_file_lru (folio), folio_nr_pages(folio)); } - -return collected; }/*
@@ -2442,11 +2438,9 @@ static long check_and_migrate_movable_pages_or_folios(struct pages_or_folios *pofs) {LIST_HEAD (movable_folio_list); -unsigned long collected; - collected =collect_longterm_unpinnable_folios (&movable_folio_list, - pofs); -if (!collected) +collect_longterm_unpinnable_folios (&movable_folio_list, pofs); +if (list_empty (&movable_folio_list))return 0 ;return migrate_longterm_unpinnable_folios (&movable_folio_list, pofs);
Greg Kroah-Hartman
maintainerPATCH 379/443 mm/vmscan: accumulate nr_demoted for accurate demotion statistics
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Zhijian <[email protected]>
commit a479b078fddb0ad7f9e3c6da22d9cf8f2b5c7799 upstream.
In shrink_folio_list(), demote_folio_list() can be called 2 times. Currently stat->nr_demoted will only store the last nr_demoted( the later nr_demoted is always zero, the former nr_demoted will get lost), as a result number of demoted pages is not accurate.
Accumulate the nr_demoted count across multiple calls to demote_folio_list(), ensuring accurate reporting of demotion statistics.
--- mm/vmscan.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
mm/vmscan.c +4 -3
@@ -1053,7 +1053,7 @@ static unsigned int shrink_folio_list(ststruct folio_batch free_folios;LIST_HEAD (ret_folios);LIST_HEAD (demote_folios); -unsigned int nr_reclaimed =0 ; +unsigned int nr_reclaimed =0 , nr_demoted =0 ;unsigned int pgactivate =0 ;bool do_demote_pass;struct swap_iocb *plug =NULL ;
@@ -1522,8 +1522,9 @@ keep:/* 'folio_list' is always empty here */ /* Migrate folios selected for demotion */ - stat->nr_demoted =demote_folio_list (&demote_folios, pgdat); - nr_reclaimed += stat->nr_demoted; + nr_demoted =demote_folio_list (&demote_folios, pgdat); + nr_reclaimed += nr_demoted; + stat->nr_demoted += nr_demoted;/* Folios that could not be demoted are still in @demote_folios */ if (!list_empty (&demote_folios)) {/* Folios which weren't demoted go back on @folio_list */
Greg Kroah-Hartman
maintainerPATCH 380/443 mm/hugetlb: fix hugepage allocation for interleaved memory nodes
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ritesh Harjani (IBM) <[email protected]>
commit 76e961157e078bc5d3cd2df08317e00b00a829eb upstream.
gather_bootmem_prealloc() assumes the start nid as 0 and size as num_node_state(N_MEMORY). That means in case if memory attached numa nodes are interleaved, then gather_bootmem_prealloc_parallel() will fail to scan few of these nodes.
Since memory attached numa nodes can be interleaved in any fashion, hence ensure that the current code checks for all numa node ids (.size = nr_node_ids). Let's still keep max_threads as N_MEMORY, so that it can distributes all nr_node_ids among the these many no. threads.
e.g. qemu cmdline
========================
numa_cmd="-numa node,nodeid=1,memdev=mem1,cpus=2-3 -numa node,nodeid=0,cpus=0-1 -numa dist,src=0,dst=1,val=20" mem_cmd="-object memory-backend-ram,id=mem1,size=16G"
w/o this patch for cmdline (default_hugepagesz=1GB hugepagesz=1GB hugepages=2):
==========================
~ # cat /proc/meminfo |grep -i huge AnonHugePages: 0 kB ShmemHugePages: 0 kB FileHugePages: 0 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 1048576 kB Hugetlb: 0 kB
with this patch for cmdline (default_hugepagesz=1GB hugepagesz=1GB hugepages=2):
===========================
~ # cat /proc/meminfo |grep -i huge
AnonHugePages: 0 kB ShmemHugePages: 0 kB FileHugePages: 0 kB HugePages_Total: 2 HugePages_Free: 2 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 1048576 kB Hugetlb: 2097152 kB
--- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/hugetlb.c +1 -1
@@ -3273,7 +3273,7 @@ static void __init gather_bootmem_preall .thread_fn = gather_bootmem_prealloc_parallel, .fn_arg = NULL, .start = 0, - .size = num_node_state(N_MEMORY), + .size = nr_node_ids, .align = 1, .min_chunk = 1, .max_threads = num_node_state(N_MEMORY),
Greg Kroah-Hartman
maintainerPATCH 381/443 mm/compaction: fix UBSAN shift-out-of-bounds warning
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liu Shixin <[email protected]>
commit d1366e74342e75555af2648a2964deb2d5c92200 upstream.
syzkaller reported a UBSAN shift-out-of-bounds warning of (1UL << order) in isolate_freepages_block(). The bogus compound_order can be any value because it is union with flags. Add back the MAX_PAGE_ORDER check to fix the warning.
--- mm/compaction.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
mm/compaction.c +2 -1
@@ -630,7 +630,8 @@ static unsigned long isolate_freepages_bif (PageCompound (page)) {const unsigned int order =compound_order (page); -if (blockpfn + (1UL << order) <= end_pfn) { +if ((order <=MAX_PAGE_ORDER ) && + (blockpfn + (1UL << order) <= end_pfn)) { blockpfn += (1UL << order) -1 ; page += (1UL << order) -1 ; nr_scanned += (1UL << order) -1 ;
Greg Kroah-Hartman
maintainerPATCH 382/443 ata: libata-core: Add ATA_QUIRK_NOLPM for Samsung SSD 870 QVO drives
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Baumann <[email protected]>
commit cc77e2ce187d26cc66af3577bf896d7410eb25ab upstream.
Disabling link power management on Samsung SSD 870 QVO drives to make them work again after the switch of the default LPM policy to low.
Testing so far has shown that regular Samsung SSD 870 (the non QVO variants) do not need it and work fine with the default LPM policy.
--- drivers/ata/libata-core.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/ata/libata-core.c +4 -0
@@ -4143,6 +4143,10 @@ static const struct ata_dev_quirks_entry {"Samsung SSD 860*" ,NULL ,ATA_QUIRK_NO_NCQ_TRIM |ATA_QUIRK_ZERO_AFTER_TRIM | ATA_QUIRK_NO_NCQ_ON_ATI }, + { "Samsung SSD 870 QVO*", NULL, ATA_QUIRK_NO_NCQ_TRIM | +ATA_QUIRK_ZERO_AFTER_TRIM | +ATA_QUIRK_NO_NCQ_ON_ATI | + ATA_QUIRK_NOLPM }, { "Samsung SSD 870*", NULL, ATA_QUIRK_NO_NCQ_TRIM |ATA_QUIRK_ZERO_AFTER_TRIM | ATA_QUIRK_NO_NCQ_ON_ATI },
Greg Kroah-Hartman
maintainerPATCH 383/443 ata: libata-sff: Ensure that we cannot write outside the allocated buffer
In reply to Greg Kroah-Hartman6.13-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
@@ -601,7 +601,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;
@@ -617,25 +617,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 384/443 irqchip/irq-mvebu-icu: Fix access to msi_data from irq_domain::host_data
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Eichenberger <[email protected]>
commit 987f379b54091cc1b1db986bde71cee1081350b3 upstream.
mvebu_icu_translate() incorrectly casts irq_domain::host_data directly to mvebu_icu_msi_data. However, host_data actually points to a structure of type msi_domain_info.
This incorrect cast causes issues such as the thermal sensors of the CP110 platform malfunctioning. Specifically, the translation of the SEI interrupt to IRQ_TYPE_EDGE_RISING fails, preventing proper interrupt handling. The following error was observed:
genirq: Setting trigger mode 4 for irq 85 failed (irq_chip_set_type_parent+0x0/0x34) armada_thermal f2400000.system-controller:thermal-sensor@70: Cannot request threaded IRQ 85
Resolve the issue by first casting host_data to msi_domain_info and then accessing mvebu_icu_msi_data through msi_domain_info::chip_data.
--- drivers/irqchip/irq-mvebu-icu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/irqchip/irq-mvebu-icu.c +2 -1
@@ -68,7 +68,8 @@ static int mvebu_icu_translate(struct ir unsigned long *hwirq, unsigned int *type) { unsigned int param_count = static_branch_unlikely(&legacy_bindings) ? 3 : 2; -struct mvebu_icu_msi_data *msi_data = d->host_data; +struct msi_domain_info *info = d->host_data; +struct mvebu_icu_msi_data *msi_data = info->chip_data;struct mvebu_icu *icu = msi_data->icu;/* Check the count of the parameters in dt */
Greg Kroah-Hartman
maintainerPATCH 385/443 crypto: qce - fix goto jump in error path
In reply to Greg Kroah-Hartman6.13-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 386/443 crypto: qce - unregister previously registered algos in error path
In reply to Greg Kroah-Hartman6.13-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 387/443 ceph: fix memory leak in ceph_mds_auth_match()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antoine Viallon <[email protected]>
commit 3b7d93db450e9d8ead80d75e2a303248f1528c35 upstream.
We now free the temporary target path substring allocation on every possible branch, instead of omitting the default branch. In some cases, a memory leak occured, which could rapidly crash the system (depending on how many file accesses were attempted).
This was detected in production because it caused a continuous memory growth, eventually triggering kernel OOM and completely hard-locking the kernel.
Relevant kmemleak stacktrace:
unreferenced object 0xffff888131e69900 (size 128):
comm "git", pid 66104, jiffies 4295435999
hex dump (first 32 bytes):
76 6f 6c 75 6d 65 73 2f 63 6f 6e 74 61 69 6e 65 volumes/containe
72 73 2f 67 69 74 65 61 2f 67 69 74 65 61 2f 67 rs/gitea/gitea/g
backtrace (crc 2f3bb450):
[<ffffffffaa68fb49>] __kmalloc_noprof+0x359/0x510
[<ffffffffc32bf1df>] ceph_mds_check_access+0x5bf/0x14e0 [ceph]
[<ffffffffc3235722>] ceph_open+0x312/0xd80 [ceph]
[<ffffffffaa7dd786>] do_dentry_open+0x456/0x1120
[<ffffffffaa7e3729>] vfs_open+0x79/0x360
[<ffffffffaa832875>] path_openat+0x1de5/0x4390
[<ffffffffaa834fcc>] do_filp_open+0x19c/0x3c0
[<ffffffffaa7e44a1>] do_sys_openat2+0x141/0x180
[<ffffffffaa7e4945>] __x64_sys_open+0xe5/0x1a0
[<ffffffffac2cc2f7>] do_syscall_64+0xb7/0x210
[<ffffffffac400130>] entry_SYSCALL_64_after_hwframe+0x77/0x7fIt can be triggered by mouting a subdirectory of a CephFS filesystem, and then trying to access files on this subdirectory with an auth token using a path-scoped capability:
$ ceph auth get client.services
[client.services]
key = REDACTED
caps mds = "allow rw fsname=cephfs path=/volumes/"
caps mon = "allow r fsname=cephfs"
caps osd = "allow rw tag cephfs data=cephfs" $ cat /proc/self/mounts
services@[REDACTED].cephfs=/volumes/containers /ceph/containers ceph rw,noatime,name=services,secret=<hidden>,ms_mode=prefer-crc,mount_timeout=300,acl,mon_addr=[REDACTED]:3300,recover_session=clean 0 0 $ seq 1 1000000 | xargs -P32 --replace={} touch /ceph/containers/file-{} && \
seq 1 1000000 | xargs -P32 --replace={} cat /ceph/containers/file-{}[ idryomov: combine if statements, rename rc to path_matched and make
it a bool, formatting ]
--- fs/ceph/mds_client.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
fs/ceph/mds_client.c +8 -8
@@ -5690,18 +5690,18 @@ static int ceph_mds_auth_match(struct ce* * All the other cases --> mismatch */ +bool path_matched = true;char *first =strstr (_tpath, auth->match.path); -if (first != _tpath) { -if (free_tpath) -kfree (_tpath); -return 0 ; +if (first != _tpath || + (tlen > len && _tpath[len] !='/' )) { + path_matched = false; } -if (tlen > len && _tpath[len] !='/' ) { -if (free_tpath) -kfree (_tpath); +if (free_tpath) +kfree (_tpath); + +if (!path_matched)return 0 ; - } } }
Greg Kroah-Hartman
maintainerPATCH 388/443 nvmem: qcom-spmi-sdam: Set size in struct nvmem_config
In reply to Greg Kroah-Hartman6.13-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 389/443 nvmem: core: improve range check for nvmem_cell_write()
In reply to Greg Kroah-Hartman6.13-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
@@ -1790,6 +1790,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 390/443 nvmem: imx-ocotp-ele: simplify read beyond device check
In reply to Greg Kroah-Hartman6.13-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
@@ -72,13 +72,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 391/443 nvmem: imx-ocotp-ele: fix MAC address byte order
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sascha Hauer <[email protected]>
commit 391b06ecb63e6eacd054582cb4eb738dfbf5eb77 upstream.
According to the i.MX93 Fusemap the two MAC addresses are stored in words 315 to 317 like this:
315 MAC1_ADDR_31_0[31:0]
316 MAC1_ADDR_47_32[47:32]
MAC2_ADDR_15_0[15:0]
317 MAC2_ADDR_47_16[31:0]
This means the MAC addresses are stored in reverse byte order. We have to swap the bytes before passing them to the upper layers. The storage format is consistent to the one used on i.MX6 using imx-ocotp driver which does the same byte swapping as introduced here.
With this patch the MAC address on my i.MX93 TQ board correctly reads as 00:d0:93:6b:27:b8 instead of b8:27:6b:93:d0:00.
--- drivers/nvmem/imx-ocotp-ele.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
drivers/nvmem/imx-ocotp-ele.c +22 -0
@@ -109,6 +109,26 @@ static int imx_ocotp_reg_read(void *contreturn 0 ; }; +static int imx_ocotp_cell_pp (void *context,const char *id,int index, +unsigned int offset,void *data,size_t bytes) +{ +u8 *buf = data; +int i; + +/* Deal with some post processing of nvmem cell data */ +if (id && !strcmp (id,"mac-address" )) +for (i =0 ; i < bytes /2 ; i++) +swap (buf[i], buf[bytes - i -1 ]); + +return 0 ; +} + +static void imx_ocotp_fixup_dt_cell_info (struct nvmem_device *nvmem, +struct nvmem_cell_info *cell) +{ + cell->read_post_process = imx_ocotp_cell_pp; +} +static int imx_ele_ocotp_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev;
@@ -135,6 +155,8 @@ static int imx_ele_ocotp_probe(struct pl priv->config.stride =1 ; priv->config.priv = priv; priv->config.read_only = true; + priv->config.add_legacy_fixed_of_cells = true; + priv->config.fixup_dt_cell_info = imx_ocotp_fixup_dt_cell_info;mutex_init (&priv->lock); nvmem =devm_nvmem_register (dev, &priv->config);
Greg Kroah-Hartman
maintainerPATCH 392/443 nvmem: imx-ocotp-ele: fix reading from non zero offset
In reply to Greg Kroah-Hartman6.13-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
@@ -71,12 +71,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 );
@@ -100,7 +102,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 393/443 nvmem: imx-ocotp-ele: set word length to 1
In reply to Greg Kroah-Hartman6.13-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
@@ -153,7 +153,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 394/443 io_uring: fix multishots with selected buffers
In reply to Greg Kroah-Hartman6.13-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
@@ -315,8 +315,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 395/443 io_uring/net: dont retry connect operation on EPOLLERR
In reply to Greg Kroah-Hartman6.13-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
@@ -1709,6 +1709,11 @@ int io_connect(struct io_kiocb *req, unsint ret;bool force_nonblock = issue_flags &IO_URING_F_NONBLOCK ; +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->addr, connect->addr_len,
io_uring/poll.c +2 -0
@@ -273,6 +273,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 396/443 vfio/platform: check the bounds of read/write syscalls
In reply to Greg Kroah-Hartman6.13-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 397/443 selftests: mptcp: connect: -f: no reconnect
In reply to Greg Kroah-Hartman6.13-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 398/443 pnfs/flexfiles: retry getting layout segment for reads
In reply to Greg Kroah-Hartman6.13-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
@@ -847,6 +847,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:pnfs_generic_pg_check_layout (pgio, req);/* Use full layout for now */
@@ -860,6 +863,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) {
@@ -876,14 +881,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 399/443 ocfs2: fix incorrect CPU endianness conversion causing mount failure
In reply to Greg Kroah-Hartman6.13-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
@@ -2340,7 +2340,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 400/443 ocfs2: handle a symlink read error correctly
In reply to Greg Kroah-Hartman6.13-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 401/443 nilfs2: fix possible int overflows in nilfs_fiemap()
In reply to Greg Kroah-Hartman6.13-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
@@ -1188,7 +1188,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(
@@ -1201,14 +1201,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 402/443 nfs: Make NFS_FSCACHE select NETFS_SUPPORT instead of depending on it
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dragan Simic <[email protected]>
commit 90190ba1c3b11687e2c251fda1f5d9893b4bab17 upstream.
Having the NFS_FSCACHE option depend on the NETFS_SUPPORT options makes selecting NFS_FSCACHE impossible unless another option that additionally selects NETFS_SUPPORT is already selected.
As a result, for example, being able to reach and select the NFS_FSCACHE option requires the CEPH_FS or CIFS option to be selected beforehand, which obviously doesn't make much sense.
Let's correct this by making the NFS_FSCACHE option actually select the NETFS_SUPPORT option, instead of depending on it.
--- fs/nfs/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/nfs/Kconfig +2 -1
@@ -170,7 +170,8 @@ config ROOT_NFS config NFS_FSCACHE bool "Provide NFS client caching support" - depends on NFS_FS=m && NETFS_SUPPORT || NFS_FS=y && NETFS_SUPPORT=y + depends on NFS_FS + select NETFS_SUPPORT select FSCACHE help Say Y here if you want NFS data to be cached locally on disc through
Greg Kroah-Hartman
maintainerPATCH 403/443 NFSD: Encode COMPOUND operation status on page boundaries
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
commit ef3675b45bcb6c17cabbbde620c6cea52ffb21ac upstream.
J. David reports an odd corruption of a READDIR reply sent to a FreeBSD client.
xdr_reserve_space() has to do a special trick when the @nbytes value requests more space than there is in the current page of the XDR buffer.
In that case, xdr_reserve_space() returns a pointer to the start of the next page, and then the next call to xdr_reserve_space() invokes __xdr_commit_encode() to copy enough of the data item back into the previous page to make that data item contiguous across the page boundary.
But we need to be careful in the case where buffer space is reserved early for a data item whose value will be inserted into the buffer later.
One such caller, nfsd4_encode_operation(), reserves 8 bytes in the encoding buffer for each COMPOUND operation. However, a READDIR result can sometimes encode file names so that there are only 4 bytes left at the end of the current XDR buffer page (though plenty of pages are left to handle the remaining encoding tasks).
If a COMPOUND operation follows the READDIR result (say, a GETATTR), then nfsd4_encode_operation() will reserve 8 bytes for the op number
(9) and the op status (usually NFS4_OK). In this weird case, xdr_reserve_space() returns a pointer to byte zero of the next buffer page, as it assumes the data item will be copied back into place (in the previous page) on the next call to xdr_reserve_space().
nfsd4_encode_operation() writes the op num into the buffer, then saves the next 4-byte location for the op's status code. The next xdr_reserve_space() call is part of GETATTR encoding, so the op num gets copied back into the previous page, but the saved location for the op status continues to point to the wrong spot in the current XDR buffer page because __xdr_commit_encode() moved that data item.
After GETATTR encoding is complete, nfsd4_encode_operation() writes the op status over the first XDR data item in the GETATTR result. The NFS4_OK status code (0) makes it look like there are zero items in the GETATTR's attribute bitmask.
The patch description of commit 2825a7f90753 ("nfsd4: allow encoding across page boundaries") [2014] remarks that NFSD "can't handle a new operation starting close to the end of a page." This bug appears to be one reason for that remark.
--- fs/nfsd/nfs4xdr.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
fs/nfsd/nfs4xdr.c +10 -10
@@ -5760,15 +5760,14 @@ nfsd4_encode_operation(struct nfsd4_compstruct nfs4_stateowner *so = resp->cstate.replay_owner;struct svc_rqst *rqstp = resp->rqstp;const struct nfsd4_operation *opdesc = op->opdesc; -int post_err_offset; +unsigned int op_status_offset;nfsd4_enc encoder; -__be32 *p; - p =xdr_reserve_space (xdr,8 ); -if (!p) +if (xdr_stream_encode_u32 (xdr, op->opnum) !=XDR_UNIT ) + goto release; + op_status_offset = xdr->buf->len; +if (!xdr_reserve_space (xdr,XDR_UNIT )) goto release; - *p++ =cpu_to_be32 (op->opnum); - post_err_offset = xdr->buf->len;if (op->opnum ==OP_ILLEGAL ) goto status;
@@ -5809,20 +5808,21 @@ nfsd4_encode_operation(struct nfsd4_comp* bug if we had to do this on a non-idempotent op: */ warn_on_nonidempotent_op (op); -xdr_truncate_encode (xdr, post_err_offset); +xdr_truncate_encode (xdr, op_status_offset +XDR_UNIT ); }if (so) { -int len = xdr->buf->len - post_err_offset; +int len = xdr->buf->len - (op_status_offset +XDR_UNIT ); so->so_replay.rp_status = op->status; so->so_replay.rp_buflen = len; -read_bytes_from_xdr_buf (xdr->buf, post_err_offset, +read_bytes_from_xdr_buf (xdr->buf, op_status_offset +XDR_UNIT , so->so_replay.rp_buf, len); } status: op->status =nfsd4_map_status (op->status, resp->cstate.minorversion); - *p = op->status; +write_bytes_to_xdr_buf (xdr->buf, op_status_offset, + &op->status,XDR_UNIT ); release:if (opdesc && opdesc->op_release) opdesc->op_release (&op->u);
Greg Kroah-Hartman
maintainerPATCH 404/443 mailbox: tegra-hsp: Clear mailbox before using message
In reply to Greg Kroah-Hartman6.13-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 405/443 mailbox: zynqmp: Remove invalid __percpu annotation in zynqmp_ipi_probe()
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uros Bizjak <[email protected]>
commit 170a264d2611a0bfa96b7818730473db5e7546fc upstream.
struct zynqmp_ipi_pdata __percpu *pdata is not a per-cpu variable, so it should not be annotated with __percpu annotation.
Remove invalid __percpu annotation to fix several
zynqmp-ipi-mailbox.c:920:15: warning: incorrect type in assignment (different address spaces)
zynqmp-ipi-mailbox.c:920:15: expected struct zynqmp_ipi_pdata [noderef] __percpu *pdata
zynqmp-ipi-mailbox.c:920:15: got void *
zynqmp-ipi-mailbox.c:927:56: warning: incorrect type in argument 3 (different address spaces)
zynqmp-ipi-mailbox.c:927:56: expected unsigned int [usertype] *out_value
zynqmp-ipi-mailbox.c:927:56: got unsigned int [noderef] __percpu *
...
and several
drivers/mailbox/zynqmp-ipi-mailbox.c:924:9: warning: dereference of noderef expression
...
sparse warnings.
There were no changes in the resulting object file.
--- drivers/mailbox/zynqmp-ipi-mailbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mailbox/zynqmp-ipi-mailbox.c +1 -1
@@ -905,7 +905,7 @@ static int zynqmp_ipi_probe(struct platf {struct device *dev = &pdev->dev;struct device_node *nc, *np = pdev->dev.of_node; -struct zynqmp_ipi_pdata __percpu *pdata; +struct zynqmp_ipi_pdata *pdata;struct of_phandle_args out_irq;struct zynqmp_ipi_mbox *mbox;int num_mboxes, ret = -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 406/443 NFC: nci: Add bounds checking in nci_hci_create_pipe()
In reply to Greg Kroah-Hartman6.13-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 407/443 fgraph: Fix set_graph_notrace with setting TRACE_GRAPH_NOTRACE_BIT
In reply to Greg Kroah-Hartman6.13-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
commit c8c9b1d2d5b4377c72a979f5a26e842a869aefc9 upstream.
The code was restructured where the function graph notrace code, that would not trace a function and all its children is done by setting a NOTRACE flag when the function that is not to be traced is hit.
There's a TRACE_GRAPH_NOTRACE_BIT which defines the bit in the flags and a TRACE_GRAPH_NOTRACE which is the mask with that bit set. But the restructuring used TRACE_GRAPH_NOTRACE_BIT when it should have used TRACE_GRAPH_NOTRACE.
For example:
# cd /sys/kernel/tracing
# echo set_track_prepare stack_trace_save > set_graph_notrace
# echo function_graph > current_tracer
# cat trace
[..]
0) | __slab_free() {
0) | free_to_partial_list() {
0) | arch_stack_walk() {
0) | __unwind_start() {
0) 0.501 us | get_stack_info();Where a non filter trace looks like:
# echo > set_graph_notrace
# cat trace
0) | free_to_partial_list() {
0) | set_track_prepare() {
0) | stack_trace_save() {
0) | arch_stack_walk() {
0) | __unwind_start() {Where the filter should look like:
# cat trace
0) | free_to_partial_list() {
0) | _raw_spin_lock_irqsave() {
0) 0.350 us | preempt_count_add();
0) 0.351 us | do_raw_spin_lock();
0) 2.440 us | }--- kernel/trace/trace_functions_graph.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace_functions_graph.c +1 -1
@@ -198,7 +198,7 @@ int trace_graph_entry(struct ftrace_grap* returning from the function. */ if (ftrace_graph_notrace_addr (trace->func)) { - *task_var |=TRACE_GRAPH_NOTRACE_BIT ; + *task_var |=TRACE_GRAPH_NOTRACE ;/* * Need to return 1 to have the return called * that will clear the NOTRACE bit.
Greg Kroah-Hartman
maintainerPATCH 408/443 i3c: master: Fix missing ret assignment in set_speed()
In reply to Greg Kroah-Hartman6.13-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
@@ -1919,7 +1919,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 409/443 irqchip/apple-aic: Only handle PMC interrupt as FIQ when configured so
In reply to Greg Kroah-Hartman6.13-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
@@ -577,7 +577,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 410/443 mtd: onenand: Fix uninitialized retlen in do_otp_read()
In reply to Greg Kroah-Hartman6.13-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 411/443 misc: misc_minor_alloc to use ida for all dynamic/misc dynamic minors
In reply to Greg Kroah-Hartman6.13-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 412/443 misc: fastrpc: Deregister device nodes properly in error scenarios
In reply to Greg Kroah-Hartman6.13-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
@@ -2344,7 +2344,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 413/443 misc: fastrpc: Fix registered buffer page address
In reply to Greg Kroah-Hartman6.13-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
@@ -992,7 +992,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 414/443 misc: fastrpc: Fix copy buffer page size
In reply to Greg Kroah-Hartman6.13-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
@@ -1019,8 +1019,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 415/443 net/ncsi: wait for the last response to Deselect Package before configuring channel
In reply to Greg Kroah-Hartman6.13-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 416/443 net: phy: c45-tjaxx: add delay between MDIO write and read in soft_reset
In reply to Greg Kroah-Hartman6.13-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
@@ -1297,6 +1297,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 417/443 maple_tree: simplify split calculation
In reply to Greg Kroah-Hartman6.13-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
@@ -1863,11 +1863,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
@@ -1900,18 +1900,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 */
@@ -2377,7 +2366,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];
@@ -2390,7 +2379,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); }
@@ -2877,7 +2866,7 @@ static void mas_spanning_rebalance(struc 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);
@@ -3365,7 +3354,7 @@ static void mas_split(struct ma_state *mif (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 418/443 scripts/gdb: fix aarch64 userspace detection in get_current_task
In reply to Greg Kroah-Hartman6.13-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
@@ -167,7 +167,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 419/443 tracing/osnoise: Fix resetting of tracepoints
In reply to Greg Kroah-Hartman6.13-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
@@ -1229,6 +1229,8 @@ static void trace_sched_migrate_callback } } +static bool monitor_enabled; +static int register_migration_monitor (void ) {int ret =0 ;
@@ -1237,16 +1239,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 420/443 rtla/osnoise: Distinguish missing workload option
In reply to Greg Kroah-Hartman6.13-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 421/443 rtla/timerlat_hist: Set OSNOISE_WORKLOAD for kernel threads
In reply to Greg Kroah-Hartman6.13-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
@@ -1100,12 +1100,15 @@ timerlat_hist_apply_config(struct osnois } } -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 422/443 rtla/timerlat_top: Set OSNOISE_WORKLOAD for kernel threads
In reply to Greg Kroah-Hartman6.13-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
@@ -851,12 +851,15 @@ timerlat_top_apply_config(struct osnoise } } -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; }if (isatty (STDOUT_FILENO ) && !params->quiet)