kconfig: merge_config: use an empty file as initfile
Subsystems (82)
Sasha Levin
maintainerPATCH 119/642 riscv: Call secondary mmu notifier when flushing the tlb
In reply to Sasha LevinFrom: Alexandre Ghiti <[email protected]>
[ Upstream commit d9be2b9b60497a82aeceec3a98d8b37fdd2960f2 ]
This is required to allow the IOMMU driver to correctly flush its own TLB.
--- arch/riscv/mm/tlbflush.c | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-)
arch/riscv/mm/tlbflush.c +22 -15
@@ -4,6 +4,7 @@#include <linux/smp.h> #include <linux/sched.h> #include <linux/hugetlb.h> +#include <linux/mmu_notifier.h> #include <asm/sbi.h> #include <asm/mmu_context.h>
@@ -78,10 +79,17 @@ static void __ipi_flush_tlb_range_asid(void *info)local_flush_tlb_range_asid (d->start, d->size, d->stride, d->asid); } -static void __flush_tlb_range (const struct cpumask *cmask,unsigned long asid, +static inline unsigned long get_mm_asid (struct mm_struct *mm) +{ +return mm ?cntx2asid (atomic_long_read (&mm->context.id)) :FLUSH_TLB_NO_ASID ; +} + +static void __flush_tlb_range (struct mm_struct *mm, +const struct cpumask *cmask,unsigned long start,unsigned long size,unsigned long stride) { +unsigned long asid =get_mm_asid (mm);unsigned int cpu;if (cpumask_empty (cmask))
@@ -105,30 +113,26 @@ static void __flush_tlb_range(const struct cpumask *cmask, unsigned long asid, }put_cpu (); -} -static inline unsigned long get_mm_asid (struct mm_struct *mm) -{ -return cntx2asid (atomic_long_read (&mm->context.id)); +if (mm) +mmu_notifier_arch_invalidate_secondary_tlbs (mm, start, start + size); }void flush_tlb_mm (struct mm_struct *mm) { -__flush_tlb_range (mm_cpumask (mm),get_mm_asid (mm), -0 ,FLUSH_TLB_MAX_SIZE ,PAGE_SIZE ); +__flush_tlb_range (mm,mm_cpumask (mm),0 ,FLUSH_TLB_MAX_SIZE ,PAGE_SIZE ); }void flush_tlb_mm_range (struct mm_struct *mm,unsigned long start,unsigned long end,unsigned int page_size) { -__flush_tlb_range (mm_cpumask (mm),get_mm_asid (mm), - start, end - start, page_size); +__flush_tlb_range (mm,mm_cpumask (mm), start, end - start, page_size); }void flush_tlb_page (struct vm_area_struct *vma,unsigned long addr) { -__flush_tlb_range (mm_cpumask (vma->vm_mm),get_mm_asid (vma->vm_mm), +__flush_tlb_range (vma->vm_mm,mm_cpumask (vma->vm_mm), addr,PAGE_SIZE ,PAGE_SIZE ); }
@@ -161,13 +165,13 @@ void flush_tlb_range(struct vm_area_struct *vma, unsigned long start, } } -__flush_tlb_range (mm_cpumask (vma->vm_mm),get_mm_asid (vma->vm_mm), +__flush_tlb_range (vma->vm_mm,mm_cpumask (vma->vm_mm), start, end - start, stride_size); }void flush_tlb_kernel_range (unsigned long start,unsigned long end) { -__flush_tlb_range (cpu_online_mask,FLUSH_TLB_NO_ASID , +__flush_tlb_range (NULL , cpu_online_mask, start, end - start,PAGE_SIZE ); }
@@ -175,7 +179,7 @@ void flush_tlb_kernel_range(unsigned long start, unsigned long end)void flush_pmd_tlb_range (struct vm_area_struct *vma,unsigned long start,unsigned long end) { -__flush_tlb_range (mm_cpumask (vma->vm_mm),get_mm_asid (vma->vm_mm), +__flush_tlb_range (vma->vm_mm,mm_cpumask (vma->vm_mm), start, end - start,PMD_SIZE ); }#endif
@@ -189,7 +193,10 @@ void arch_tlbbatch_add_pending(struct arch_tlbflush_unmap_batch *batch, struct mm_struct *mm, unsigned long uaddr) { +unsigned long start = uaddr &PAGE_MASK ; +cpumask_or (&batch->cpumask, &batch->cpumask,mm_cpumask (mm)); +mmu_notifier_arch_invalidate_secondary_tlbs (mm, start, start +PAGE_SIZE ); }void arch_flush_tlb_batched_pending (struct mm_struct *mm)
@@ -199,7 +206,7 @@ void arch_flush_tlb_batched_pending(struct mm_struct *mm)void arch_tlbbatch_flush (struct arch_tlbflush_unmap_batch *batch) { -__flush_tlb_range (&batch->cpumask,FLUSH_TLB_NO_ASID ,0 , -FLUSH_TLB_MAX_SIZE ,PAGE_SIZE ); +__flush_tlb_range (NULL , &batch->cpumask, +0 ,FLUSH_TLB_MAX_SIZE ,PAGE_SIZE );cpumask_clear (&batch->cpumask); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 120/642 ext4: reorder capability check last
In reply to Sasha LevinFrom: Christian Göttsche <[email protected]>
[ Upstream commit 1b419c889c0767a5b66d0a6c566cae491f1cb0f7 ]
capable() calls refer to enabled LSMs whether to permit or deny the request. This is relevant in connection with SELinux, where a capability check results in a policy decision and by default a denial message on insufficient permission is issued.
It can lead to three undesired cases:
1. A denial message is generated, even in case the operation was an unprivileged one and thus the syscall succeeded, creating noise.
2. To avoid the noise from 1. the policy writer adds a rule to ignore those denial messages, hiding future syscalls, where the task performs an actual privileged operation, leading to hidden limited functionality of that task.
3. To avoid the noise from 1. the policy writer adds a rule to permit the task the requested capability, while it does not need it, violating the principle of least privilege.
--- fs/ext4/balloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ext4/balloc.c +2 -2
@@ -649,8 +649,8 @@ static int ext4_has_free_clusters(struct ext4_sb_info *sbi,/* Hm, nope. Are (enough) root reserved clusters available? */ if (uid_eq (sbi->s_resuid,current_fsuid ()) || (!gid_eq (sbi->s_resgid,GLOBAL_ROOT_GID ) &&in_group_p (sbi->s_resgid)) || -capable (CAP_SYS_RESOURCE ) || - (flags &EXT4_MB_USE_ROOT_BLOCKS )) { + (flags &EXT4_MB_USE_ROOT_BLOCKS ) || +capable (CAP_SYS_RESOURCE )) {if (free_clusters >= (nclusters + dirty_clusters + resv_clusters))
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 121/642 hypfs_create_cpu_files(): add missing check for hypfs_mkdir() failure
In reply to Sasha LevinFrom: Al Viro <[email protected]>
[ Upstream commit 00cdfdcfa0806202aea56b02cedbf87ef1e75df8 ]
--- arch/s390/hypfs/hypfs_diag_fs.c | 2 ++ 1 file changed, 2 insertions(+)
arch/s390/hypfs/hypfs_diag_fs.c +2 -0
@@ -208,6 +208,8 @@ static int hypfs_create_cpu_files(struct dentry *cpus_dir, void *cpu_info)snprintf (buffer,TMP_SIZE ,"%d" ,cpu_info__cpu_addr (diag204_get_info_type (), cpu_info)); cpu_dir =hypfs_mkdir (cpus_dir, buffer); +if (IS_ERR (cpu_dir)) +return PTR_ERR (cpu_dir); rc =hypfs_create_u64 (cpu_dir,"mgmtime" ,cpu_info__acc_time (diag204_get_info_type (), cpu_info) -cpu_info__lp_time (diag204_get_info_type (), cpu_info));
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 122/642 scsi: st: Tighten the page format heuristics with MODE SELECT
In reply to Sasha LevinFrom: Kai Mäkisara <[email protected]>
[ Upstream commit 8db816c6f176321e42254badd5c1a8df8bfcfdb4 ]
In the days when SCSI-2 was emerging, some drives did claim SCSI-2 but did not correctly implement it. The st driver first tries MODE SELECT with the page format bit set to set the block descriptor. If not successful, the non-page format is tried.
The test only tests the sense code and this triggers also from illegal parameter in the parameter list. The test is limited to "old" devices and made more strict to remove false alarms.
--- drivers/scsi/st.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/st.c +3 -1
@@ -3084,7 +3084,9 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned lon cmd_in == MTSETDRVBUFFER || cmd_in == SET_DENS_AND_BLK) {if (cmdstatp->sense_hdr.sense_key ==ILLEGAL_REQUEST && - !(STp->use_pf &PF_TESTED )) { + cmdstatp->sense_hdr.asc ==0x24 && + (STp->device)->scsi_level <=SCSI_2 && + !(STp->use_pf &PF_TESTED )) {/* Try the other possible state of Page Format if not already tried */ STp->use_pf = (STp->use_pf ^USE_PF ) |PF_TESTED ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 123/642 scsi: st: ERASE does not change tape location
In reply to Sasha LevinFrom: Kai Mäkisara <[email protected]>
[ Upstream commit ad77cebf97bd42c93ab4e3bffd09f2b905c1959a ]
The SCSI ERASE command erases from the current position onwards. Don't clear the position variables.
--- drivers/scsi/st.c | 1 - 1 file changed, 1 deletion(-)
drivers/scsi/st.c +0 -1
@@ -2897,7 +2897,6 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned lon timeout = STp->long_timeout *8 ;DEBC_printk (STp,"Erasing tape.\n" ); - fileno = blkno = at_sm =0 ;break ;case MTSETBLK :/* Set block length */ case MTSETDENSITY :/* Set tape density */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 124/642 vfio/pci: Handle INTx IRQ_NOTCONNECTED
In reply to Sasha LevinFrom: Alex Williamson <[email protected]>
[ Upstream commit 860be250fc32de9cb24154bf21b4e36f40925707 ]
Some systems report INTx as not routed by setting pdev->irq to IRQ_NOTCONNECTED, resulting in a -ENOTCONN error when trying to setup eventfd signaling. Include this in the set of conditions for which the PIN register is virtualized to zero.
Additionally consolidate vfio_pci_get_irq_count() to use this virtualized value in reporting INTx support via ioctl and sanity checking ioctl paths since pdev->irq is re-used when the device is in MSI mode.
The combination of these results in both the config space of the device and the ioctl interface behaving as if the device does not support INTx.
--- drivers/vfio/pci/vfio_pci_config.c | 3 ++- drivers/vfio/pci/vfio_pci_core.c | 10 +--------- drivers/vfio/pci/vfio_pci_intrs.c | 2 +- 3 files changed, 4 insertions(+), 11 deletions(-)
drivers/vfio/pci/vfio_pci_config.c +2 -1
@@ -1814,7 +1814,8 @@ int vfio_config_init(struct vfio_pci_core_device *vdev)cpu_to_le16 (PCI_COMMAND_MEMORY ); } -if (!IS_ENABLED (CONFIG_VFIO_PCI_INTX ) || vdev->nointx) +if (!IS_ENABLED (CONFIG_VFIO_PCI_INTX ) || vdev->nointx || + vdev->pdev->irq ==IRQ_NOTCONNECTED ) vconfig[PCI_INTERRUPT_PIN ] =0 ; ret =vfio_cap_init (vdev);
drivers/vfio/pci/vfio_pci_core.c +1 -9
@@ -727,15 +727,7 @@ EXPORT_SYMBOL_GPL(vfio_pci_core_finish_enable);static int vfio_pci_get_irq_count (struct vfio_pci_core_device *vdev,int irq_type) {if (irq_type ==VFIO_PCI_INTX_IRQ_INDEX ) { -u8 pin; - -if (!IS_ENABLED (CONFIG_VFIO_PCI_INTX ) || - vdev->nointx || vdev->pdev->is_virtfn) -return 0 ; - -pci_read_config_byte (vdev->pdev,PCI_INTERRUPT_PIN , &pin); - -return pin ?1 :0 ; +return vdev->vconfig[PCI_INTERRUPT_PIN ] ?1 :0 ; }else if (irq_type ==VFIO_PCI_MSI_IRQ_INDEX ) {u8 pos;u16 flags;
drivers/vfio/pci/vfio_pci_intrs.c +1 -1
@@ -259,7 +259,7 @@ static int vfio_intx_enable(struct vfio_pci_core_device *vdev,if (!is_irq_none (vdev))return -EINVAL ; -if (!pdev->irq) +if (!pdev->irq || pdev->irq ==IRQ_NOTCONNECTED )return -ENODEV ; name =kasprintf (GFP_KERNEL_ACCOUNT ,"vfio-intx(%s)" ,pci_name (pdev));
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 125/642 bpftool: Using the right format specifiers
In reply to Sasha LevinFrom: Jiayuan Chen <[email protected]>
[ Upstream commit 3775be3417cc3243b0df0492bd308559dcf0560b ]
Fixed some formatting specifiers errors, such as using %d for int and %u for unsigned int, as well as other byte-length types.
Perform type cast using the type derived from the data type itself, for example, if it's originally an int, it will be cast to unsigned int if forced to unsigned.
--- kernel/bpf/disasm.c | 4 ++-- tools/bpf/bpftool/btf.c | 14 +++++++------- tools/bpf/bpftool/btf_dumper.c | 2 +- tools/bpf/bpftool/cgroup.c | 2 +- tools/bpf/bpftool/common.c | 4 ++-- tools/bpf/bpftool/jit_disasm.c | 3 ++- tools/bpf/bpftool/map_perf_ring.c | 6 +++--- tools/bpf/bpftool/net.c | 4 ++-- tools/bpf/bpftool/netlink_dumper.c | 6 +++--- tools/bpf/bpftool/prog.c | 12 ++++++------ tools/bpf/bpftool/tracelog.c | 2 +- tools/bpf/bpftool/xlated_dumper.c | 6 +++--- 12 files changed, 33 insertions(+), 32 deletions(-)
kernel/bpf/disasm.c +2 -2
@@ -202,7 +202,7 @@ void print_bpf_insn(const struct bpf_insn_cbs *cbs, insn->dst_reg, class ==BPF_ALU ?'w' :'r' , insn->dst_reg); }else if (is_addr_space_cast (insn)) { -verbose (cbs->private_data,"(%02x) r%d = addr_space_cast(r%d, %d, %d)\n" , +verbose (cbs->private_data,"(%02x) r%d = addr_space_cast(r%d, %u, %u)\n" , insn->code, insn->dst_reg, insn->src_reg, ((u32 )insn->imm) >>16 , (u16 )insn->imm); }else if (is_mov_percpu_addr (insn)) {
@@ -369,7 +369,7 @@ void print_bpf_insn(const struct bpf_insn_cbs *cbs, insn->code, class ==BPF_JMP32 ?'w' :'r' , insn->dst_reg, bpf_jmp_string[BPF_OP (insn->code) >>4 ], - insn->imm, insn->off); + (u32)insn->imm, insn->off); } }else { verbose(cbs->private_data, "(%02x) %s\n",
tools/bpf/bpftool/btf.c +7 -7
@@ -253,7 +253,7 @@ static int dump_btf_type(const struct btf *btf, __u32 id,if (btf_kflag (t))printf ("\n\t'%s' val=%d" , name, v->val);else -printf ("\n\t'%s' val=%u" , name, v->val); +printf ("\n\t'%s' val=%u" , name, (__u32 )v->val); } }if (json_output)
@@ -1022,7 +1022,7 @@ static int do_dump(int argc, char **argv)for (i =0 ; i < root_type_cnt; i++) {if (root_type_ids[i] == root_id) { err = -EINVAL ; -p_err ("duplicate root_id %d supplied" , root_id); +p_err ("duplicate root_id %u supplied" , root_id); goto done; } }
@@ -1132,7 +1132,7 @@ build_btf_type_table(struct hashmap *tab, enum bpf_obj_type type,break ;default : err =-1 ; -p_err ("unexpected object type: %d" , type); +p_err ("unexpected object type: %u" , type); goto err_free; }if (err) {
@@ -1155,7 +1155,7 @@ build_btf_type_table(struct hashmap *tab, enum bpf_obj_type type,break ;default : err =-1 ; -p_err ("unexpected object type: %d" , type); +p_err ("unexpected object type: %u" , type); goto err_free; }if (fd <0 ) {
@@ -1188,7 +1188,7 @@ build_btf_type_table(struct hashmap *tab, enum bpf_obj_type type,break ;default : err =-1 ; -p_err ("unexpected object type: %d" , type); +p_err ("unexpected object type: %u" , type); goto err_free; }if (!btf_id)
@@ -1254,12 +1254,12 @@ show_btf_plain(struct bpf_btf_info *info, int fd, n =0 ;hashmap__for_each_key_entry (btf_prog_table, entry, info->id) { -printf ("%s%lu" , n++ ==0 ?" prog_ids " :"," , entry->value); +printf ("%s%lu" , n++ ==0 ?" prog_ids " :"," , (unsigned long )entry->value); } n =0 ;hashmap__for_each_key_entry (btf_map_table, entry, info->id) { -printf ("%s%lu" , n++ ==0 ?" map_ids " :"," , entry->value); +printf ("%s%lu" , n++ ==0 ?" map_ids " :"," , (unsigned long )entry->value); }emit_obj_refs_plain (refs_table, info->id,"\n\tpids " );
tools/bpf/bpftool/btf_dumper.c +1 -1
@@ -653,7 +653,7 @@ static int __btf_dumper_type_only(const struct btf *btf, __u32 type_id,case BTF_KIND_ARRAY : array = (struct btf_array *)(t +1 );BTF_PRINT_TYPE (array->type); -BTF_PRINT_ARG ("[%d]" , array->nelems); +BTF_PRINT_ARG ("[%u]" , array->nelems);break ;case BTF_KIND_PTR :BTF_PRINT_TYPE (t->type);
tools/bpf/bpftool/cgroup.c +1 -1
@@ -191,7 +191,7 @@ static int show_bpf_prog(int id, enum bpf_attach_type attach_type,if (attach_btf_name)printf (" %-15s" , attach_btf_name);else if (info.attach_btf_id) -printf (" attach_btf_obj_id=%d attach_btf_id=%d" , +printf (" attach_btf_obj_id=%u attach_btf_id=%u" , info.attach_btf_obj_id, info.attach_btf_id);printf ("\n" ); }
tools/bpf/bpftool/common.c +2 -2
@@ -713,7 +713,7 @@ ifindex_to_arch(__u32 ifindex, __u64 ns_dev, __u64 ns_ino, const char **opt)int vendor_id;if (!ifindex_to_name_ns (ifindex, ns_dev, ns_ino, devname)) { -p_err ("Can't get net device name for ifindex %d: %s" , ifindex, +p_err ("Can't get net device name for ifindex %u: %s" , ifindex,strerror (errno));return NULL ; }
@@ -738,7 +738,7 @@ ifindex_to_arch(__u32 ifindex, __u64 ns_dev, __u64 ns_ino, const char **opt)/* No NFP support in LLVM, we have no valid triple to return. */ default :p_err ("Can't get arch name for device vendor id 0x%04x" , - vendor_id); + (unsigned int )vendor_id);return NULL ; } }
tools/bpf/bpftool/jit_disasm.c +2 -1
@@ -343,7 +343,8 @@ int disasm_print_insn(unsigned char *image, ssize_t len, int opcodes, {const struct bpf_line_info *linfo =NULL ;unsigned int nr_skip =0 ; -int count, i, pc =0 ; +int count, i; +unsigned int pc =0 ;disasm_ctx_t ctx;if (!len)
tools/bpf/bpftool/map_perf_ring.c +3 -3
@@ -91,15 +91,15 @@ print_bpf_output(void *private_data, int cpu, struct perf_event_header *event)jsonw_end_object (json_wtr); }else {if (e->header.type ==PERF_RECORD_SAMPLE ) { -printf ("== @%lld.%09lld CPU: %d index: %d =====\n" , +printf ("== @%llu.%09llu CPU: %d index: %d =====\n" , e->time /1000000000ULL , e->time %1000000000ULL , cpu, idx);fprint_hex (stdout, e->data, e->size," " );printf ("\n" ); }else if (e->header.type ==PERF_RECORD_LOST ) { -printf ("lost %lld events\n" , lost->lost); +printf ("lost %llu events\n" , lost->lost); }else { -printf ("unknown event type=%d size=%d\n" , +printf ("unknown event type=%u size=%u\n" , e->header.type, e->header.size); } }
tools/bpf/bpftool/net.c +2 -2
@@ -476,7 +476,7 @@ static void __show_dev_tc_bpf(const struct ip_devname_ifindex *dev,for (i =0 ; i < optq.count; i++) {NET_START_OBJECT ;NET_DUMP_STR ("devname" ,"%s" , dev->devname); -NET_DUMP_UINT ("ifindex" ,"(%u)" , dev->ifindex); +NET_DUMP_UINT ("ifindex" ,"(%u)" , (unsigned int )dev->ifindex);NET_DUMP_STR ("kind" ," %s" , attach_loc_strings[loc]); ret =__show_dev_tc_bpf_name (prog_ids[i], prog_name,sizeof (prog_name));
@@ -831,7 +831,7 @@ static void show_link_netfilter(void)if (err) {if (errno ==ENOENT )break ; -p_err ("can't get next link: %s (id %d)" ,strerror (errno), id); +p_err ("can't get next link: %s (id %u)" ,strerror (errno), id);break ; }
tools/bpf/bpftool/netlink_dumper.c +3 -3
@@ -45,7 +45,7 @@ static int do_xdp_dump_one(struct nlattr *attr, unsigned int ifindex,NET_START_OBJECT ;if (name)NET_DUMP_STR ("devname" ,"%s" , name); -NET_DUMP_UINT ("ifindex" ,"(%d)" , ifindex); +NET_DUMP_UINT ("ifindex" ,"(%u)" , ifindex);if (mode ==XDP_ATTACHED_MULTI ) {if (json_output) {
@@ -74,7 +74,7 @@ int do_xdp_dump(struct ifinfomsg *ifinfo, struct nlattr **tb)if (!tb[IFLA_XDP ])return 0 ; -return do_xdp_dump_one (tb[IFLA_XDP ], ifinfo->ifi_index, +return do_xdp_dump_one (tb[IFLA_XDP ], (unsigned int )ifinfo->ifi_index,libbpf_nla_getattr_str (tb[IFLA_IFNAME ])); }
@@ -168,7 +168,7 @@ int do_filter_dump(struct tcmsg *info, struct nlattr **tb, const char *kind,NET_START_OBJECT ;if (devname[0 ] !='\0' )NET_DUMP_STR ("devname" ,"%s" , devname); -NET_DUMP_UINT ("ifindex" ,"(%u)" , ifindex); +NET_DUMP_UINT ("ifindex" ,"(%u)" , (unsigned int )ifindex);NET_DUMP_STR ("kind" ," %s" , kind); ret =do_bpf_filter_dump (tb[TCA_OPTIONS ]);NET_END_OBJECT_FINAL ;
tools/bpf/bpftool/prog.c +6 -6
@@ -521,10 +521,10 @@ static void print_prog_header_plain(struct bpf_prog_info *info, int fd)print_dev_plain (info->ifindex, info->netns_dev, info->netns_ino);printf ("%s" , info->gpl_compatible ?" gpl" :"" );if (info->run_time_ns) -printf (" run_time_ns %lld run_cnt %lld" , +printf (" run_time_ns %llu run_cnt %llu" , info->run_time_ns, info->run_cnt);if (info->recursion_misses) -printf (" recursion_misses %lld" , info->recursion_misses); +printf (" recursion_misses %llu" , info->recursion_misses);printf ("\n" ); }
@@ -569,7 +569,7 @@ static void print_prog_plain(struct bpf_prog_info *info, int fd, bool orphaned) }if (info->btf_id) -printf ("\n\tbtf_id %d" , info->btf_id); +printf ("\n\tbtf_id %u" , info->btf_id);emit_obj_refs_plain (refs_table, info->id,"\n\tpids " );
@@ -1164,7 +1164,7 @@ static int get_run_data(const char *fname, void **data_ptr, unsigned int *size) }if (nb_read > buf_size - block_size) {if (buf_size ==UINT32_MAX ) { -p_err ("data_in/ctx_in is too long (max: %d)" , +p_err ("data_in/ctx_in is too long (max: %u)" ,UINT32_MAX ); goto err_free; }
@@ -2252,7 +2252,7 @@ static char *profile_target_name(int tgt_fd) t =btf__type_by_id (btf, func_info.type_id);if (!t) { -p_err ("btf %d doesn't have type %d" , +p_err ("btf %u doesn't have type %u" , info.btf_id, func_info.type_id); goto out; }
@@ -2330,7 +2330,7 @@ static int profile_open_perf_events(struct profiler_bpf *obj)continue ;for (cpu =0 ; cpu < obj->rodata->num_cpu; cpu++) {if (profile_open_perf_event (m, cpu, map_fd)) { -p_err ("failed to create event %s on cpu %d" , +p_err ("failed to create event %s on cpu %u" , metrics[m].name, cpu);return -1 ; }
tools/bpf/bpftool/tracelog.c +1 -1
@@ -78,7 +78,7 @@ static bool get_tracefs_pipe(char *mnt)return false;/* Allow room for NULL terminating byte and pipe file name */ -snprintf (format,sizeof (format),"%%*s %%%zds %%99s %%*s %%*d %%*d\\n" , +snprintf (format,sizeof (format),"%%*s %%%zus %%99s %%*s %%*d %%*d\\n" ,PATH_MAX -strlen (pipe_name) -1 );while (fscanf (fp, format, mnt, type) ==2 )if (strcmp (type, fstype) ==0 ) {
tools/bpf/bpftool/xlated_dumper.c +3 -3
@@ -199,13 +199,13 @@ static const char *print_imm(void *private_data,if (insn->src_reg ==BPF_PSEUDO_MAP_FD )snprintf (dd->scratch_buff,sizeof (dd->scratch_buff), -"map[id:%u]" , insn->imm); +"map[id:%d]" , insn->imm);else if (insn->src_reg ==BPF_PSEUDO_MAP_VALUE )snprintf (dd->scratch_buff,sizeof (dd->scratch_buff), -"map[id:%u][0]+%u" , insn->imm, (insn +1 )->imm); +"map[id:%d][0]+%d" , insn->imm, (insn +1 )->imm);else if (insn->src_reg ==BPF_PSEUDO_MAP_IDX_VALUE )snprintf (dd->scratch_buff,sizeof (dd->scratch_buff), -"map[idx:%u]+%u" , insn->imm, (insn +1 )->imm); +"map[idx:%d]+%d" , insn->imm, (insn +1 )->imm);else if (insn->src_reg ==BPF_PSEUDO_FUNC )snprintf (dd->scratch_buff,sizeof (dd->scratch_buff),"subprog[%+d]" , insn->imm);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 126/642 libbpf: Pass BPF token from find_prog_btf_id to BPF_BTF_GET_FD_BY_ID
In reply to Sasha LevinFrom: Mykyta Yatsenko <[email protected]>
[ Upstream commit 974ef9f0d23edc1a802691c585b84514b414a96d ]
Pass BPF token from bpf_program__set_attach_target to BPF_BTF_GET_FD_BY_ID bpf command.
When freplace program attaches to target program, it needs to look up for BTF of the target, this may require BPF token, if, for example, running from user namespace.
--- tools/lib/bpf/bpf.c | 3 ++- tools/lib/bpf/bpf.h | 3 ++- tools/lib/bpf/btf.c | 15 +++++++++++++-- tools/lib/bpf/libbpf.c | 10 +++++----- tools/lib/bpf/libbpf_internal.h | 1 + 5 files changed, 23 insertions(+), 9 deletions(-)
tools/lib/bpf/bpf.c +2 -1
@@ -1097,7 +1097,7 @@ int bpf_map_get_fd_by_id(__u32 id)int bpf_btf_get_fd_by_id_opts (__u32 id,const struct bpf_get_fd_by_id_opts *opts) { - const size_t attr_sz = offsetofend(union bpf_attr, open_flags); + const size_t attr_sz = offsetofend(union bpf_attr, fd_by_id_token_fd);union bpf_attr attr;int fd;
@@ -1107,6 +1107,7 @@ int bpf_btf_get_fd_by_id_opts(__u32 id,memset (&attr,0 , attr_sz); attr.btf_id = id; attr.open_flags =OPTS_GET (opts, open_flags,0 ); + attr.fd_by_id_token_fd =OPTS_GET (opts, token_fd,0 ); fd =sys_bpf_fd (BPF_BTF_GET_FD_BY_ID , &attr, attr_sz);return libbpf_err_errno (fd);
tools/lib/bpf/bpf.h +2 -1
@@ -487,9 +487,10 @@ LIBBPF_API int bpf_link_get_next_id(__u32 start_id, __u32 *next_id);struct bpf_get_fd_by_id_opts {size_t sz;/* size of this struct for forward/backward compatibility */ __u32 open_flags;/* permissions requested for the operation on fd */ +__u32 token_fd; size_t :0; }; -#define bpf_get_fd_by_id_opts__last_field open_flags +#define bpf_get_fd_by_id_opts__last_field token_fd LIBBPF_API int bpf_prog_get_fd_by_id(__u32 id); LIBBPF_API int bpf_prog_get_fd_by_id_opts(__u32 id,
tools/lib/bpf/btf.c +13 -2
@@ -1619,12 +1619,18 @@ struct btf *btf_get_from_fd(int btf_fd, struct btf *base_btf)return btf; } -struct btf *btf__load_from_kernel_by_id_split (__u32 id,struct btf *base_btf) +struct btf *btf_load_from_kernel (__u32 id,struct btf *base_btf,int token_fd) {struct btf *btf;int btf_fd; +LIBBPF_OPTS (bpf_get_fd_by_id_opts, opts); + +if (token_fd) { + opts.open_flags |=BPF_F_TOKEN_FD ; + opts.token_fd = token_fd; + } - btf_fd =bpf_btf_get_fd_by_id (id); + btf_fd =bpf_btf_get_fd_by_id_opts (id, &opts);if (btf_fd <0 )return libbpf_err_ptr (-errno);
@@ -1634,6 +1640,11 @@ struct btf *btf__load_from_kernel_by_id_split(__u32 id, struct btf *base_btf)return libbpf_ptr (btf); } +struct btf *btf__load_from_kernel_by_id_split (__u32 id,struct btf *base_btf) +{ +return btf_load_from_kernel (id, base_btf,0 ); +} +struct btf *btf__load_from_kernel_by_id (__u32 id) {return btf__load_from_kernel_by_id_split (id,NULL );
tools/lib/bpf/libbpf.c +5 -5
@@ -9959,7 +9959,7 @@ int libbpf_find_vmlinux_btf_id(const char *name,return libbpf_err (err); } -static int libbpf_find_prog_btf_id (const char *name,__u32 attach_prog_fd) +static int libbpf_find_prog_btf_id (const char *name,__u32 attach_prog_fd,int token_fd) {struct bpf_prog_info info;__u32 info_len =sizeof (info);
@@ -9979,7 +9979,7 @@ static int libbpf_find_prog_btf_id(const char *name, __u32 attach_prog_fd)pr_warn ("The target program doesn't have BTF\n" ); goto out; } - btf =btf__load_from_kernel_by_id (info.btf_id); + btf =btf_load_from_kernel (info.btf_id,NULL , token_fd); err =libbpf_get_error (btf);if (err) {pr_warn ("Failed to get BTF %d of the program: %s\n" , info.btf_id,errstr (err));
@@ -10062,7 +10062,7 @@ static int libbpf_find_attach_btf_id(struct bpf_program *prog, const char *attacpr_warn ("prog '%s': attach program FD is not set\n" , prog->name);return -EINVAL ; } - err =libbpf_find_prog_btf_id (attach_name, attach_prog_fd); + err =libbpf_find_prog_btf_id (attach_name, attach_prog_fd, prog->obj->token_fd);if (err <0 ) {pr_warn ("prog '%s': failed to find BPF program (FD %d) BTF ID for '%s': %s\n" , prog->name, attach_prog_fd, attach_name,errstr (err));
@@ -12858,7 +12858,7 @@ struct bpf_link *bpf_program__attach_freplace(const struct bpf_program *prog,if (target_fd) {LIBBPF_OPTS (bpf_link_create_opts, target_opts); - btf_id =libbpf_find_prog_btf_id (attach_func_name, target_fd); + btf_id =libbpf_find_prog_btf_id (attach_func_name, target_fd, prog->obj->token_fd);if (btf_id <0 )return libbpf_err_ptr (btf_id);
@@ -13679,7 +13679,7 @@ int bpf_program__set_attach_target(struct bpf_program *prog,if (attach_prog_fd) { btf_id =libbpf_find_prog_btf_id (attach_func_name, - attach_prog_fd); + attach_prog_fd, prog->obj->token_fd);if (btf_id <0 )return libbpf_err (btf_id); }else {
tools/lib/bpf/libbpf_internal.h +1 -0
@@ -409,6 +409,7 @@ int libbpf__load_raw_btf(const char *raw_types, size_t types_len,int btf_load_into_kernel (struct btf *btf,char *log_buf,size_t log_sz,__u32 log_level,int token_fd); +struct btf *btf_load_from_kernel (__u32 id,struct btf *base_btf,int token_fd);struct btf *btf_get_from_fd (int btf_fd,struct btf *base_btf); void btf_get_kernel_prefix_kind(enum bpf_attach_type attach_type,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 127/642 bpf: Return prog btf_id without capable check
In reply to Sasha LevinFrom: Mykyta Yatsenko <[email protected]>
[ Upstream commit 07651ccda9ff10a8ca427670cdd06ce2c8e4269c ]
Return prog's btf_id from bpf_prog_get_info_by_fd regardless of capable check. This patch enables scenario, when freplace program, running from user namespace, requires to query target prog's btf.
--- kernel/bpf/syscall.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/bpf/syscall.c +2 -2
@@ -4733,6 +4733,8 @@ static int bpf_prog_get_info_by_fd(struct file *file, info.recursion_misses = stats.misses; info.verified_insns = prog->aux->verified_insns; +if (prog->aux->btf) + info.btf_id =btf_obj_id (prog->aux->btf);if (!bpf_capable ()) { info.jited_prog_len =0 ;
@@ -4879,8 +4881,6 @@ static int bpf_prog_get_info_by_fd(struct file *file, } } -if (prog->aux->btf) - info.btf_id =btf_obj_id (prog->aux->btf); info.attach_btf_id = prog->aux->attach_btf_id;if (attach_btf) info.attach_btf_obj_id =btf_obj_id (attach_btf);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 128/642 PCI: dwc: Use resource start as ioremap() input in dw_pcie_pme_turn_off()
In reply to Sasha LevinFrom: Frank Li <[email protected]>
[ Upstream commit 8f4a489b370e6612700aa16b9e4373b2d85d7503 ]
The msg_res region translates writes into PCIe Message TLPs. Previously we mapped this region using atu.cpu_addr, the input address programmed into the ATU.
"cpu_addr" is a misnomer because when a bus fabric translates addresses between the CPU and the ATU, the ATU input address is different from the CPU address. A future patch will rename "cpu_addr" and correct the value to be the ATU input address instead of the CPU physical address.
Map the msg_res region before writing to it using the msg_res resource start, a CPU physical address.
--- drivers/pci/controller/dwc/pcie-designware-host.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/dwc/pcie-designware-host.c +1 -1
@@ -908,7 +908,7 @@ static int dw_pcie_pme_turn_off(struct dw_pcie *pci)if (ret)return ret; - mem =ioremap (atu.cpu_addr, pci->region_align); + mem =ioremap (pci->pp.msg_res->start, pci->region_align);if (!mem)return -ENOMEM ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 129/642 jbd2: do not try to recover wiped journal
In reply to Sasha LevinFrom: Jan Kara <[email protected]>
[ Upstream commit a662f3c03b754e1f97a2781fa242e95bdb139798 ]
If a journal is wiped, we will set journal->j_tail to 0. However if 'write' argument is not set (as it happens for read-only device or for ocfs2), the on-disk superblock is not updated accordingly and thus jbd2_journal_recover() cat try to recover the wiped journal. Fix the check in jbd2_journal_recover() to use journal->j_tail for checking empty journal instead.
--- fs/jbd2/recovery.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
fs/jbd2/recovery.c +6 -5
@@ -287,19 +287,20 @@ static int fc_do_one_pass(journal_t *journal,int jbd2_journal_recover (journal_t *journal) {int err, err2; -journal_superblock_t * sb; -struct recovery_info info;memset (&info,0 ,sizeof (info)); - sb = journal->j_superblock;/* * The journal superblock's s_start field (the current log head) * is always zero if, and only if, the journal was cleanly -* unmounted. +* unmounted. We use its in-memory version j_tail here because +* jbd2_journal_wipe() could have updated it without updating journal +* superblock. */ -if (!sb->s_start) { +if (!journal->j_tail) { +journal_superblock_t *sb = journal->j_superblock; +jbd2_debug (1 ,"No recovery required, last transaction %d, head block %u\n" ,be32_to_cpu (sb->s_sequence),be32_to_cpu (sb->s_head)); journal->j_transaction_sequence =be32_to_cpu (sb->s_sequence) +1 ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 130/642 tcp: reorganize tcp_in_ack_event() and tcp_count_delivered()
In reply to Sasha LevinFrom: Ilpo Järvinen <[email protected]>
[ Upstream commit 149dfb31615e22271d2525f078c95ea49bc4db24 ]
- Move tcp_count_delivered() earlier and split tcp_count_delivered_ce() out of it
- Move tcp_in_ack_event() later
- While at it, remove the inline from tcp_in_ack_event() and let the compiler to decide
Accurate ECN's heuristics does not know if there is going to be ACE field based CE counter increase or not until after rtx queue has been processed. Only then the number of ACKed bytes/pkts is available. As CE or not affects presence of FLAG_ECE, that information for tcp_in_ack_event is not yet available in the old location of the call to tcp_in_ack_event().
--- net/ipv4/tcp_input.c | 56 +++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 24 deletions(-)
net/ipv4/tcp_input.c +32 -24
@@ -419,6 +419,20 @@ static bool tcp_ecn_rcv_ecn_echo(const struct tcp_sock *tp, const struct tcphdrreturn false; } +static void tcp_count_delivered_ce (struct tcp_sock *tp,u32 ecn_count) +{ + tp->delivered_ce += ecn_count; +} + +/* Updates the delivered and delivered_ce counts */ +static void tcp_count_delivered (struct tcp_sock *tp,u32 delivered, +bool ece_ack) +{ + tp->delivered += delivered; +if (ece_ack) +tcp_count_delivered_ce (tp, delivered); +} +/* Buffer size and advertised window tuning. * * 1. Tuning sk->sk_sndbuf, when connection enters established state.
@@ -1154,15 +1168,6 @@ void tcp_mark_skb_lost(struct sock *sk, struct sk_buff *skb) } } -/* Updates the delivered and delivered_ce counts */ -static void tcp_count_delivered (struct tcp_sock *tp,u32 delivered, -bool ece_ack) -{ - tp->delivered += delivered; -if (ece_ack) - tp->delivered_ce += delivered; -} -/* This procedure tags the retransmission queue when SACKs arrive. * * We have three tag bits: SACKED(S), RETRANS(R) and LOST(L).
@@ -3862,12 +3867,23 @@ static void tcp_process_tlp_ack(struct sock *sk, u32 ack, int flag) } } -static inline void tcp_in_ack_event (struct sock *sk,u32 flags) +static void tcp_in_ack_event (struct sock *sk,int flag) {const struct inet_connection_sock *icsk =inet_csk (sk); -if (icsk->icsk_ca_ops->in_ack_event) - icsk->icsk_ca_ops->in_ack_event (sk, flags); +if (icsk->icsk_ca_ops->in_ack_event) { +u32 ack_ev_flags =0 ; + +if (flag &FLAG_WIN_UPDATE ) + ack_ev_flags |=CA_ACK_WIN_UPDATE ; +if (flag &FLAG_SLOWPATH ) { + ack_ev_flags |=CA_ACK_SLOWPATH ; +if (flag &FLAG_ECE ) + ack_ev_flags |=CA_ACK_ECE ; + } + + icsk->icsk_ca_ops->in_ack_event (sk, ack_ev_flags); + } }/* Congestion control has updated the cwnd already. So if we're in
@@ -3984,12 +4000,8 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)tcp_snd_una_update (tp, ack); flag |=FLAG_WIN_UPDATE ; -tcp_in_ack_event (sk,CA_ACK_WIN_UPDATE ); -NET_INC_STATS (sock_net (sk),LINUX_MIB_TCPHPACKS ); }else { -u32 ack_ev_flags =CA_ACK_SLOWPATH ; -if (ack_seq !=TCP_SKB_CB (skb)->end_seq) flag |=FLAG_DATA ;else
@@ -4001,19 +4013,12 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) flag |=tcp_sacktag_write_queue (sk, skb, prior_snd_una, &sack_state); -if (tcp_ecn_rcv_ecn_echo (tp,tcp_hdr (skb))) { +if (tcp_ecn_rcv_ecn_echo (tp,tcp_hdr (skb))) flag |=FLAG_ECE ; - ack_ev_flags |=CA_ACK_ECE ; - }if (sack_state.sack_delivered)tcp_count_delivered (tp, sack_state.sack_delivered, flag &FLAG_ECE ); - -if (flag &FLAG_WIN_UPDATE ) - ack_ev_flags |=CA_ACK_WIN_UPDATE ; - -tcp_in_ack_event (sk, ack_ev_flags); }/* This is a deviation from RFC3168 since it states that:
@@ -4040,6 +4045,8 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)tcp_rack_update_reo_wnd (sk, &rs); +tcp_in_ack_event (sk, flag); +if (tp->tlp_high_seq)tcp_process_tlp_ack (sk, ack, flag);
@@ -4071,6 +4078,7 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag)return 1 ; no_queue: +tcp_in_ack_event (sk, flag);/* If data was DSACKed, see if we can undo a cwnd reduction. */ if (flag &FLAG_DSACKING_ACK ) { tcp_fastretrans_alert(sk, prior_snd_una, num_dupack, &flag,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 131/642 rtc: rv3032: fix EERD location
In reply to Sasha LevinFrom: Alexandre Belloni <[email protected]>
[ Upstream commit b0f9cb4a0706b0356e84d67e48500b77b343debe ]
EERD is bit 2 in CTRL1
--- drivers/rtc/rtc-rv3032.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/rtc/rtc-rv3032.c +1 -1
@@ -69,7 +69,7 @@#define RV3032_CLKOUT2_FD_MSK GENMASK(6, 5)#define RV3032_CLKOUT2_OS BIT(7) -#define RV3032_CTRL1_EERD BIT(3) +#define RV3032_CTRL1_EERD BIT(2)#define RV3032_CTRL1_WADA BIT(5)#define RV3032_CTRL2_STOP BIT(0)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 132/642 objtool: Fix error handling inconsistencies in check()
In reply to Sasha LevinFrom: Josh Poimboeuf <[email protected]>
[ Upstream commit b745962cb97569aad026806bb0740663cf813147 ]
Make sure all fatal errors are funneled through the 'out' label with a negative ret.
--- tools/objtool/check.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
tools/objtool/check.c +6 -4
@@ -4632,8 +4632,10 @@ int check(struct objtool_file *file)init_cfi_state (&force_undefined_cfi); force_undefined_cfi.force_undefined = true; -if (!cfi_hash_alloc (1UL << (file->elf->symbol_bits -3 ))) +if (!cfi_hash_alloc (1UL << (file->elf->symbol_bits -3 ))) { + ret =-1 ; goto out; + }cfi_hash_add (&init_cfi);cfi_hash_add (&func_cfi);
@@ -4650,7 +4652,7 @@ int check(struct objtool_file *file)if (opts.retpoline) { ret =validate_retpoline (file);if (ret <0 ) -return ret; + goto out; warnings += ret; }
@@ -4686,7 +4688,7 @@ int check(struct objtool_file *file)*/ ret =validate_unrets (file);if (ret <0 ) -return ret; + goto out; warnings += ret; }
@@ -4749,7 +4751,7 @@ int check(struct objtool_file *file)if (opts.prefix) { ret =add_prefix_symbols (file);if (ret <0 ) -return ret; + goto out; warnings += ret; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 133/642 thunderbolt: Do not add non-active NVM if NVM upgrade is disabled for retimer
In reply to Sasha LevinFrom: Mika Westerberg <[email protected]>
[ Upstream commit ad79c278e478ca8c1a3bf8e7a0afba8f862a48a1 ]
This is only used to write a new NVM in order to upgrade the retimer firmware. It does not make sense to expose it if upgrade is disabled. This also makes it consistent with the router NVM upgrade.
--- drivers/thunderbolt/retimer.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/thunderbolt/retimer.c +5 -3
@@ -93,9 +93,11 @@ static int tb_retimer_nvm_add(struct tb_retimer *rt)if (ret) goto err_nvm; - ret =tb_nvm_add_non_active (nvm, nvm_write); -if (ret) - goto err_nvm; +if (!rt->no_nvm_upgrade) { + ret =tb_nvm_add_non_active (nvm, nvm_write); +if (ret) + goto err_nvm; + } rt->nvm = nvm;dev_dbg (&rt->dev,"NVM version %x.%x\n" , nvm->major, nvm->minor);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 134/642 erofs: initialize decompression early
In reply to Sasha LevinFrom: Gao Xiang <[email protected]>
[ Upstream commit fe1e57d44d7f106df9048e815e4862cf63921220 ]
- Rename erofs_init_managed_cache() to z_erofs_init_super();
- Move the initialization of managed_pslots into z_erofs_init_super() too;
- Move z_erofs_init_super() and packed inode preparation upwards, before the root inode initialization.
Therefore, the root directory can also be compressible.
--- fs/erofs/internal.h | 4 ++-- fs/erofs/super.c | 46 ++++++++++++++++++++++----------------------- fs/erofs/zdata.c | 4 ++-- 3 files changed, 26 insertions(+), 28 deletions(-)
fs/erofs/internal.h +2 -2
@@ -446,6 +446,7 @@ int __init erofs_init_shrinker(void);void erofs_exit_shrinker (void );int __init z_erofs_init_subsystem (void );void z_erofs_exit_subsystem (void ); +int z_erofs_init_super (struct super_block *sb);unsigned long z_erofs_shrink_scan (struct erofs_sb_info *sbi,unsigned long nr_shrink); int z_erofs_map_blocks_iter(struct inode *inode, struct erofs_map_blocks *map,
@@ -455,7 +456,6 @@ void z_erofs_put_gbuf(void *ptr);int z_erofs_gbuf_growsize (unsigned int nrpages);int __init z_erofs_gbuf_init (void );void z_erofs_gbuf_exit (void ); -int erofs_init_managed_cache (struct super_block *sb);int z_erofs_parse_cfgs (struct super_block *sb,struct erofs_super_block *dsb);#else static inline void erofs_shrinker_register (struct super_block *sb) {}
@@ -464,7 +464,7 @@ static inline int erofs_init_shrinker(void) { return 0; }static inline void erofs_exit_shrinker (void ) {}static inline int z_erofs_init_subsystem (void ) {return 0 ; }static inline void z_erofs_exit_subsystem (void ) {} -static inline int erofs_init_managed_cache (struct super_block *sb) {return 0 ; } +static inline int z_erofs_init_super (struct super_block *sb) {return 0 ; }#endif /* !CONFIG_EROFS_FS_ZIP */ #ifdef CONFIG_EROFS_FS_BACKED_BY_FILE
fs/erofs/super.c +22 -24
84 lines not on this page · raw message
fs/erofs/zdata.c +2 -2
@@ -644,18 +644,18 @@ static const struct address_space_operations z_erofs_cache_aops = { .invalidate_folio = z_erofs_cache_invalidate_folio, }; -int erofs_init_managed_cache (struct super_block *sb) +int z_erofs_init_super (struct super_block *sb) {struct inode *const inode =new_inode (sb);if (!inode)return -ENOMEM ; -set_nlink (inode,1 ); inode->i_size =OFFSET_MAX ; inode->i_mapping->a_ops = &z_erofs_cache_aops;mapping_set_gfp_mask (inode->i_mapping,GFP_KERNEL );EROFS_SB (sb)->managed_cache = inode; +xa_init (&EROFS_SB (sb)->managed_pslots);return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 135/642 spi: spi-mux: Fix coverity issue, unchecked return value
In reply to Sasha LevinFrom: Sergio Perez Gonzalez <[email protected]>
[ Upstream commit 5a5fc308418aca275a898d638bc38c093d101855 ]
The return value of spi_setup() is not captured within spi_mux_select() and it is assumed to be always success.
CID: 1638374
--- drivers/spi/spi-mux.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/spi/spi-mux.c +1 -3
@@ -68,9 +68,7 @@ static int spi_mux_select(struct spi_device *spi) priv->current_cs =spi_get_chipselect (spi,0 ); -spi_setup (priv->spi); - -return 0 ; +return spi_setup (priv->spi); }static int spi_mux_setup (struct spi_device *spi)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 136/642 ASoC: sma1307: Add NULL check in sma1307_setting_loaded()
In reply to Sasha LevinFrom: Chenyuan Yang <[email protected]>
[ Upstream commit 0ec6bd16705fe21d6429d6b8f7981eae2142bba8 ]
All varibale allocated by kzalloc and devm_kzalloc could be NULL. Multiple pointer checks and their cleanup are added.
This issue is found by our static analysis tool
--- sound/soc/codecs/sma1307.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
sound/soc/codecs/sma1307.c +28 -0
@@ -1728,6 +1728,11 @@ static void sma1307_setting_loaded(struct sma1307_priv *sma1307, const char *fil } data =kzalloc (fw->size,GFP_KERNEL ); +if (!data) { +release_firmware (fw); + sma1307->set.status = false; +return ; + } size = fw->size >>2 ;memcpy (data, fw->data, fw->size);
@@ -1741,6 +1746,12 @@ static void sma1307_setting_loaded(struct sma1307_priv *sma1307, const char *fil sma1307->set.header =devm_kzalloc (sma1307->dev, sma1307->set.header_size,GFP_KERNEL ); +if (!sma1307->set.header) { +kfree (data); + sma1307->set.status = false; +return ; + } +memcpy (sma1307->set.header, data, sma1307->set.header_size *sizeof (int ));
@@ -1756,6 +1767,13 @@ static void sma1307_setting_loaded(struct sma1307_priv *sma1307, const char *fil sma1307->set.def =devm_kzalloc (sma1307->dev, sma1307->set.def_size *sizeof (int ),GFP_KERNEL ); +if (!sma1307->set.def) { +kfree (data); +kfree (sma1307->set.header); + sma1307->set.status = false; +return ; + } +memcpy (sma1307->set.def, &data[sma1307->set.header_size], sma1307->set.def_size *sizeof (int ));
@@ -1768,6 +1786,16 @@ static void sma1307_setting_loaded(struct sma1307_priv *sma1307, const char *fil = devm_kzalloc(sma1307->dev, sma1307->set.mode_size *2 *sizeof (int ),GFP_KERNEL ); +if (!sma1307->set.mode_set[i]) { +kfree (data); +kfree (sma1307->set.header); +kfree (sma1307->set.def); +for (int j =0 ; j < i; j++) +kfree (sma1307->set.mode_set[j]); + sma1307->set.status = false; +return ; + } +for (int j =0 ; j < sma1307->set.mode_size; j++) { sma1307->set.mode_set[i][2 * j] = data[offset + ((num_mode +1 ) * j)];
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 137/642 ASoC: pcm6240: Drop bogus code handling IRQ as GPIO
In reply to Sasha LevinFrom: Linus Walleij <[email protected]>
[ Upstream commit 17fdf318f5fbe5c27353ae917c0c5a2899d9c259 ]
The current code for the IRQ in pcm6240 makes no sense:
it looks up an IRQ with of_irq_get(), treat it as a GPIO by issuing gpio_request(), gpio_direction_input() and gpio_to_irq() on it.
This is just wrong, if the device tree assigns the IRQ from a GPIO number this is just incorrect: it is clearly stated that GPIO providers and IRQ providers are orthogonal.
It is possible to look up an IRQ to a corresponding GPIO line but this is taking an IRQ and pretending it's a GPIO, which is just semantically wrong.
Drop the offending code and treat the IRQ that we get from the device tree as any other IRQ, see for example other codec drivers.
The DT bindings for this codec does not have any in-tree DTS files, which may explain why things are weird.
As a bonus, this moves the driver away from the legacy <linux/gpio.h> include.
--- sound/soc/codecs/pcm6240.c | 28 +++++++--------------------- sound/soc/codecs/pcm6240.h | 7 +------ 2 files changed, 8 insertions(+), 27 deletions(-)
sound/soc/codecs/pcm6240.c +7 -21
@@ -14,7 +14,7 @@#include <linux/unaligned.h> #include <linux/firmware.h> -#include <linux/gpio.h> +#include <linux/gpio/consumer.h> #include <linux/i2c.h> #include <linux/module.h> #include <linux/of_irq.h>
@@ -2035,10 +2035,8 @@ static const struct regmap_config pcmdevice_i2c_regmap = {static void pcmdevice_remove (struct pcmdevice_priv *pcm_dev) { -if (gpio_is_valid (pcm_dev->irq_info.gpio)) { -gpio_free (pcm_dev->irq_info.gpio); -free_irq (pcm_dev->irq_info.nmb, pcm_dev); - } +if (pcm_dev->irq) +free_irq (pcm_dev->irq, pcm_dev);mutex_destroy (&pcm_dev->codec_lock); }
@@ -2109,7 +2107,7 @@ static int pcmdevice_i2c_probe(struct i2c_client *i2c) ndev =1 ; dev_addrs[0 ] = i2c->addr; } - pcm_dev->irq_info.gpio =of_irq_get (np,0 ); + pcm_dev->irq =of_irq_get (np,0 );for (i =0 ; i < ndev; i++) pcm_dev->addr[i] = dev_addrs[i];
@@ -2132,22 +2130,10 @@ static int pcmdevice_i2c_probe(struct i2c_client *i2c)if (pcm_dev->chip_id ==PCM1690 ) goto skip_interrupt; -if (gpio_is_valid (pcm_dev->irq_info.gpio)) { -dev_dbg (pcm_dev->dev,"irq-gpio = %d" , pcm_dev->irq_info.gpio); - - ret =gpio_request (pcm_dev->irq_info.gpio,"PCMDEV-IRQ" ); -if (!ret) { -int gpio = pcm_dev->irq_info.gpio; - -gpio_direction_input (gpio); - pcm_dev->irq_info.nmb =gpio_to_irq (gpio); - - }else -dev_err (pcm_dev->dev,"%s: GPIO %d request error\n" , - __func__, pcm_dev->irq_info.gpio); +if (pcm_dev->irq) { +dev_dbg (pcm_dev->dev,"irq = %d" , pcm_dev->irq); }else -dev_err (pcm_dev->dev,"Looking up irq-gpio failed %d\n" , - pcm_dev->irq_info.gpio); +dev_err (pcm_dev->dev,"No irq provided\n" ); skip_interrupt: ret = devm_snd_soc_register_component(&i2c->dev,
sound/soc/codecs/pcm6240.h +1 -6
@@ -208,11 +208,6 @@ struct pcmdevice_regbin {struct pcmdevice_config_info **cfg_info; }; -struct pcmdevice_irqinfo { -int gpio; -int nmb; -}; -struct pcmdevice_priv {struct snd_soc_component *component;struct i2c_client *client;
@@ -221,7 +216,7 @@ struct pcmdevice_priv {struct gpio_desc *hw_rst;struct regmap *regmap;struct pcmdevice_regbin regbin; -struct pcmdevice_irqinfo irq_info; +int irq;unsigned int addr[PCMDEVICE_MAX_I2C_DEVICES ];unsigned int chip_id;int cur_conf;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 138/642 ASoC: mediatek: mt6359: Add stub for mt6359_accdet_enable_jack_detect
In reply to Sasha LevinFrom: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit 0116a7d84b32537a10d9bea1fd1bfc06577ef527 ]
Add a stub for mt6359_accdet_enable_jack_detect() to prevent linker failures in the machine sound drivers calling it when CONFIG_SND_SOC_MT6359_ACCDET is not enabled.
--- sound/soc/codecs/mt6359-accdet.h | 9 +++++++++ 1 file changed, 9 insertions(+)
sound/soc/codecs/mt6359-accdet.h +9 -0
@@ -123,6 +123,15 @@ struct mt6359_accdet { struct workqueue_struct *jd_workqueue; }; +#if IS_ENABLED (CONFIG_SND_SOC_MT6359_ACCDET )int mt6359_accdet_enable_jack_detect (struct snd_soc_component *component,struct snd_soc_jack *jack); +#else +static inline int +mt6359_accdet_enable_jack_detect (struct snd_soc_component *component, +struct snd_soc_jack *jack) +{ +return -EOPNOTSUPP ; +} +#endif #endif
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 139/642 kunit: tool: Fix bug in parsing test plan
In reply to Sasha LevinFrom: Rae Moar <[email protected]>
[ Upstream commit 1d4c06d51963f89f67c7b75d5c0c34e9d1bb2ae6 ]
A bug was identified where the KTAP below caused an infinite loop:
TAP version 13
ok 4 test_case
1..4
The infinite loop was caused by the parser not parsing a test plan if following a test result line.
Fix this bug by parsing test plan line to avoid the infinite loop.
--- tools/testing/kunit/kunit_parser.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
tools/testing/kunit/kunit_parser.py +4 -5
@@ -759,7 +759,7 @@ def parse_test(lines: LineStream, expected_num: int, log: List[str], is_subtest: # If parsing the main/top-level test, parse KTAP version line and # test plan test.name = "main" - ktap_line = parse_ktap_header(lines, test, printer) + parse_ktap_header(lines, test, printer) test.log.extend(parse_diagnostic(lines)) parse_test_plan(lines, test) parent_test = True
@@ -768,13 +768,12 @@ def parse_test(lines: LineStream, expected_num: int, log: List[str], is_subtest: # the KTAP version line and/or subtest header line ktap_line = parse_ktap_header(lines, test, printer) subtest_line = parse_test_header(lines, test) + test.log.extend(parse_diagnostic(lines)) + parse_test_plan(lines, test) parent_test = (ktap_line or subtest_line) if parent_test: - # If KTAP version line and/or subtest header is found, attempt - # to parse test plan and print test header - test.log.extend(parse_diagnostic(lines)) - parse_test_plan(lines, test) print_test_header(test, printer) + expected_count = test.expected_count subtests = [] test_num = 1
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 140/642 bpf: Allow pre-ordering for bpf cgroup progs
In reply to Sasha LevinFrom: Yonghong Song <[email protected]>
[ Upstream commit 4b82b181a26cff8bf7adc3a85a88d121d92edeaf ]
Currently for bpf progs in a cgroup hierarchy, the effective prog array is computed from bottom cgroup to upper cgroups (post-ordering). For example, the following cgroup hierarchy
root cgroup: p1, p2
subcgroup: p3, p4
have BPF_F_ALLOW_MULTI for both cgroup levels.
The effective cgroup array ordering looks like
p3 p4 p1 p2
and at run time, progs will execute based on that order.
But in some cases, it is desirable to have root prog executes earlier than children progs (pre-ordering). For example,
- prog p1 intends to collect original pkt dest addresses.
- prog p3 will modify original pkt dest addresses to a proxy address for security reason.
The end result is that prog p1 gets proxy address which is not what it wants. Putting p1 to every child cgroup is not desirable either as it will duplicate itself in many child cgroups. And this is exactly a use case we are encountering in Meta.
To fix this issue, let us introduce a flag BPF_F_PREORDER. If the flag is specified at attachment time, the prog has higher priority and the ordering with that flag will be from top to bottom (pre-ordering). For example, in the above example,
root cgroup: p1, p2
subcgroup: p3, p4
Let us say p2 and p4 are marked with BPF_F_PREORDER. The final effective array ordering will be
p2 p4 p3 p1
--- include/linux/bpf-cgroup.h | 1 + include/uapi/linux/bpf.h | 1 + kernel/bpf/cgroup.c | 33 +++++++++++++++++++++++++-------- kernel/bpf/syscall.c | 3 ++- tools/include/uapi/linux/bpf.h | 1 + 5 files changed, 30 insertions(+), 9 deletions(-)
include/linux/bpf-cgroup.h +1 -0
@@ -111,6 +111,7 @@ struct bpf_prog_list {struct bpf_prog *prog;struct bpf_cgroup_link *link;struct bpf_cgroup_storage *storage[MAX_BPF_CGROUP_STORAGE_TYPE ]; +u32 flags; };int cgroup_bpf_inherit (struct cgroup *cgrp);
include/uapi/linux/bpf.h +1 -0
@@ -1207,6 +1207,7 @@ enum bpf_perf_event_type {#define BPF_F_BEFORE (1U << 3)#define BPF_F_AFTER (1U << 4)#define BPF_F_ID (1U << 5) +#define BPF_F_PREORDER (1U << 6)#define BPF_F_LINK BPF_F_LINK/* 1 << 13 */ /* If BPF_F_STRICT_ALIGNMENT is used in BPF_PROG_LOAD command, the
kernel/bpf/cgroup.c +25 -8
@@ -369,7 +369,7 @@ static struct bpf_prog *prog_list_prog(struct bpf_prog_list *pl)/* count number of elements in the list. * it's slow but the list cannot be long */ -static u32 prog_list_length (struct hlist_head *head) +static u32 prog_list_length (struct hlist_head *head,int *preorder_cnt) {struct bpf_prog_list *pl;u32 cnt =0 ;
@@ -377,6 +377,8 @@ static u32 prog_list_length(struct hlist_head *head)hlist_for_each_entry (pl, head, node) {if (!prog_list_prog (pl))continue ; +if (preorder_cnt && (pl->flags &BPF_F_PREORDER )) + (*preorder_cnt)++; cnt++; }return cnt;
@@ -400,7 +402,7 @@ static bool hierarchy_allows_attach(struct cgroup *cgrp,if (flags &BPF_F_ALLOW_MULTI )return true; - cnt =prog_list_length (&p->bpf.progs[atype]); + cnt =prog_list_length (&p->bpf.progs[atype],NULL );WARN_ON_ONCE (cnt >1 );if (cnt ==1 )return !!(flags &BPF_F_ALLOW_OVERRIDE );
@@ -423,12 +425,12 @@ static int compute_effective_progs(struct cgroup *cgrp,struct bpf_prog_array *progs;struct bpf_prog_list *pl;struct cgroup *p = cgrp; -int cnt =0 ; +int i, j, cnt =0 , preorder_cnt =0 , fstart, bstart, init_bstart;/* count number of effective programs by walking parents */ do {if (cnt ==0 || (p->bpf.flags[atype] &BPF_F_ALLOW_MULTI )) - cnt +=prog_list_length (&p->bpf.progs[atype]); + cnt +=prog_list_length (&p->bpf.progs[atype], &preorder_cnt); p =cgroup_parent (p); }while (p);
@@ -439,20 +441,34 @@ static int compute_effective_progs(struct cgroup *cgrp,/* populate the array with effective progs */ cnt =0 ; p = cgrp; + fstart = preorder_cnt; + bstart = preorder_cnt -1 ;do {if (cnt >0 && !(p->bpf.flags[atype] &BPF_F_ALLOW_MULTI ))continue ; + init_bstart = bstart;hlist_for_each_entry (pl, &p->bpf.progs[atype], node) {if (!prog_list_prog (pl))continue ; - item = &progs->items[cnt]; +if (pl->flags &BPF_F_PREORDER ) { + item = &progs->items[bstart]; + bstart--; + }else { + item = &progs->items[fstart]; + fstart++; + } item->prog =prog_list_prog (pl);bpf_cgroup_storages_assign (item->cgroup_storage, pl->storage); cnt++; } + +/* reverse pre-ordering progs at this cgroup level */ +for (i = bstart +1 , j = init_bstart; i < j; i++, j--) +swap (progs->items[i], progs->items[j]); + }while ((p =cgroup_parent (p))); *array = progs;
@@ -663,7 +679,7 @@ static int __cgroup_bpf_attach(struct cgroup *cgrp,*/ return -EPERM ; -if (prog_list_length (progs) >=BPF_CGROUP_MAX_PROGS ) +if (prog_list_length (progs,NULL ) >=BPF_CGROUP_MAX_PROGS )return -E2BIG ; pl = find_attach_entry(progs, prog, link, replace_prog,
@@ -698,6 +714,7 @@ static int __cgroup_bpf_attach(struct cgroup *cgrp, pl->prog = prog; pl->link = link; + pl->flags = flags;bpf_cgroup_storages_assign (pl->storage, storage); cgrp->bpf.flags[atype] = saved_flags;
@@ -1073,7 +1090,7 @@ static int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr, lockdep_is_held(&cgroup_mutex)); total_cnt +=bpf_prog_array_length (effective); }else { - total_cnt +=prog_list_length (&cgrp->bpf.progs[atype]); + total_cnt +=prog_list_length (&cgrp->bpf.progs[atype],NULL ); } }
@@ -1105,7 +1122,7 @@ static int __cgroup_bpf_query(struct cgroup *cgrp, const union bpf_attr *attr,u32 id; progs = &cgrp->bpf.progs[atype]; - cnt =min_t (int,prog_list_length (progs), total_cnt); + cnt =min_t (int,prog_list_length (progs,NULL ), total_cnt); i =0 ;hlist_for_each_entry (pl, progs, node) { prog =prog_list_prog (pl);
kernel/bpf/syscall.c +2 -1
@@ -4169,7 +4169,8 @@ static int bpf_prog_attach_check_attach_type(const struct bpf_prog *prog,#define BPF_F_ATTACH_MASK_BASE \ (BPF_F_ALLOW_OVERRIDE | \ BPF_F_ALLOW_MULTI | \ - BPF_F_REPLACE) + BPF_F_REPLACE | \ + BPF_F_PREORDER)#define BPF_F_ATTACH_MASK_MPROG \ (BPF_F_REPLACE | \
tools/include/uapi/linux/bpf.h +1 -0
@@ -1207,6 +1207,7 @@ enum bpf_perf_event_type {#define BPF_F_BEFORE (1U << 3)#define BPF_F_AFTER (1U << 4)#define BPF_F_ID (1U << 5) +#define BPF_F_PREORDER (1U << 6)#define BPF_F_LINK BPF_F_LINK/* 1 << 13 */ /* If BPF_F_STRICT_ALIGNMENT is used in BPF_PROG_LOAD command, the
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 141/642 kbuild: fix argument parsing in scripts/config
In reply to Sasha LevinFrom: Seyediman Seyedarab <[email protected]>
[ Upstream commit f757f6011c92b5a01db742c39149bed9e526478f ]
The script previously assumed --file was always the first argument, which caused issues when it appeared later. This patch updates the parsing logic to scan all arguments to find --file, sets the config file correctly, and resets the argument list with the remaining commands.
It also fixes --refresh to respect --file by passing KCONFIG_CONFIG=$FN to make oldconfig.
--- scripts/config | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)
scripts/config +16 -10
@@ -32,6 +32,7 @@ commands: Disable option directly after other option --module-after|-M beforeopt option Turn option into module directly after other option + --refresh Refresh the config using old settings commands can be repeated multiple times
@@ -124,16 +125,22 @@ undef_var() { txt_delete "^# $name is not set" "$FN" } -if [ "$1" = "--file" ]; then - FN="$2" - if [ "$FN" = "" ] ; then - usage +FN=.config +CMDS=() +while [[ $# -gt 0 ]]; do + if [ "$1" = "--file" ]; then + if [ "$2" = "" ]; then + usage + fi + FN="$2" + shift 2 + else + CMDS+=("$1") + shift fi - shift 2 -else - FN=.config -fi +done +set -- "${CMDS[@]}" if [ "$1" = "" ] ; then usage fi
@@ -217,9 +224,8 @@ while [ "$1" != "" ] ; do set_var "${CONFIG_}$B" "${CONFIG_}$B=m" "${CONFIG_}$A" ;; - # undocumented because it ignores --file (fixme) --refresh) - yes "" | make oldconfig + yes "" | make oldconfig KCONFIG_CONFIG=$FN ;; *)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 142/642 kconfig: do not clear SYMBOL_VALID when reading include/config/auto.conf
In reply to Sasha LevinFrom: Masahiro Yamada <[email protected]>
[ Upstream commit 226ac19c217f24f0927d0a73cf9ee613971a188d ]
When conf_read_simple() is called with S_DEF_AUTO, it is meant to read previous symbol values from include/config/auto.conf to determine which include/config/* files should be touched.
This process should not modify the current symbol status in any way. However, conf_touch_deps() currently invalidates all symbol values and recalculates them, which is totally unneeded.
--- scripts/kconfig/confdata.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
scripts/kconfig/confdata.c +12 -7
@@ -385,7 +385,7 @@ int conf_read_simple(const char *name, int def) def_flags =SYMBOL_DEF << def;for_all_symbols (sym) { - sym->flags &= ~(def_flags|SYMBOL_VALID ); + sym->flags &= ~def_flags;switch (sym->type) {case S_INT :case S_HEX :
@@ -398,7 +398,11 @@ int conf_read_simple(const char *name, int def) } } -expr_invalidate_all (); +if (def ==S_DEF_USER ) { +for_all_symbols (sym) + sym->flags &= ~SYMBOL_VALID; +expr_invalidate_all (); + }while (getline_stripped (&line, &line_asize, in) !=-1 ) {struct menu *choice;
@@ -464,6 +468,9 @@ int conf_read_simple(const char *name, int def)if (conf_set_sym_val (sym, def, def_flags, val))continue ; +if (def !=S_DEF_USER ) +continue ; +/* * If this is a choice member, give it the highest priority. * If conflicting CONFIG options are given from an input file,
@@ -967,10 +974,8 @@ static int conf_touch_deps(void) depfile_path[depfile_prefix_len] =0 ;conf_read_simple (name,S_DEF_AUTO ); -sym_calc_value (modules_sym);for_all_symbols (sym) { -sym_calc_value (sym);if (sym_is_choice (sym))continue ;if (sym->flags &SYMBOL_WRITE ) {
@@ -1084,12 +1089,12 @@ int conf_write_autoconf(int overwrite)if (ret)return -1 ; -if (conf_touch_deps ()) -return 1 ; -for_all_symbols (sym)sym_calc_value (sym); +if (conf_touch_deps ()) +return 1 ; + ret =__conf_write_autoconf (conf_get_autoheader_name (), print_symbol_for_c, &comment_style_c);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 143/642 crypto: octeontx2 - suppress auth failure screaming due to negative tests
In reply to Sasha LevinFrom: Shashank Gupta <[email protected]>
[ Upstream commit 64b7871522a4cba99d092e1c849d6f9092868aaa ]
This patch addresses an issue where authentication failures were being erroneously reported due to negative test failures in the "ccm(aes)" selftest.pr_debug suppress unnecessary screaming of these tests.
--- drivers/crypto/marvell/octeontx2/otx2_cptvf_reqmgr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/crypto/marvell/octeontx2/otx2_cptvf_reqmgr.c +4 -3
@@ -264,9 +264,10 @@ static int cpt_process_ccode(struct otx2_cptlfs_info *lfs,break ; } -dev_err (&pdev->dev, -"Request failed with software error code 0x%x\n" , - cpt_status->s.uc_compcode); +pr_debug ("Request failed with software error code 0x%x: algo = %s driver = %s\n" , + cpt_status->s.uc_compcode, + info->req->areq->tfm->__crt_alg->cra_name, + info->req->areq->tfm->__crt_alg->cra_driver_name);otx2_cpt_dump_sg_list (pdev, info->req);break ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 144/642 dm: restrict dm device size to 2^63-512 bytes
In reply to Sasha LevinFrom: Mikulas Patocka <[email protected]>
[ Upstream commit 45fc728515c14f53f6205789de5bfd72a95af3b8 ]
The devices with size >= 2^63 bytes can't be used reliably by userspace because the type off_t is a signed 64-bit integer.
Therefore, we limit the maximum size of a device mapper device to 2^63-512 bytes.
--- drivers/md/dm-table.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/md/dm-table.c +4 -0
@@ -697,6 +697,10 @@ int dm_table_add_target(struct dm_table *t, const char *type,DMERR ("%s: zero-length target" ,dm_device_name (t->md));return -EINVAL ; } +if (start + len < start || start + len >LLONG_MAX >>SECTOR_SHIFT ) { +DMERR ("%s: too large device" ,dm_device_name (t->md)); +return -EINVAL ; + } ti->type =dm_get_target_type (type);if (!ti->type) {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 145/642 net/smc: use the correct ndev to find pnetid by pnetid table
In reply to Sasha LevinFrom: Guangguan Wang <[email protected]>
[ Upstream commit bfc6c67ec2d64d0ca4e5cc3e1ac84298a10b8d62 ]
When using smc_pnet in SMC, it will only search the pnetid in the base_ndev of the netdev hierarchy(both HW PNETID and User-defined sw pnetid). This may not work for some scenarios when using SMC in container on cloud environment.
In container, there have choices of different container network, such as directly using host network, virtual network IPVLAN, veth, etc. Different choices of container network have different netdev hierarchy. Examples of netdev hierarchy show below. (eth0 and eth1 in host below is the netdev directly related to the physical device).
_______________________________
| _________________ |
| |POD | |
| | | |
| | eth0_________ | |
| |____| |__| |
| | | |
| | | |
| eth1|base_ndev| eth0_______ |
| | | | RDMA ||
| host |_________| |_______||
---------------------------------
netdev hierarchy if directly using host network
________________________________
| _________________ |
| |POD __________ | |
| | |upper_ndev| | |
| |eth0|__________| | |
| |_______|_________| |
| |lower netdev |
| __|______ |
| eth1| | eth0_______ |
| |base_ndev| | RDMA ||
| host |_________| |_______||
---------------------------------
netdev hierarchy if using IPVLAN
_______________________________
| _____________________ |
| |POD _________ | |
| | |base_ndev|| |
| |eth0(veth)|_________|| |
| |____________|________| |
| |pairs |
| _______|_ |
| | | eth0_______ |
| veth|base_ndev| | RDMA ||
| |_________| |_______||
| _________ |
| eth1|base_ndev| |
| host |_________| |
---------------------------------
netdev hierarchy if using vethDue to some reasons, the eth1 in host is not RDMA attached netdevice, pnetid is needed to map the eth1(in host) with RDMA device so that POD can do SMC-R. Because the eth1(in host) is managed by CNI plugin(such as Terway, network management plugin in container environment), and in cloud environment the eth(in host) can dynamically be inserted by CNI when POD create and dynamically be removed by CNI when POD destroy and no POD related to the eth(in host) anymore. It is hard to config the pnetid to the eth1(in host). But it is easy to config the pnetid to the netdevice which can be seen in POD. When do SMC-R, both the container directly using host network and the container using veth network can successfully match the RDMA device, because the configured pnetid netdev is a base_ndev. But the container using IPVLAN can not successfully match the RDMA device and 0x03030000 fallback happens, because the configured pnetid netdev is not a base_ndev. Additionally, if config pnetid to the eth1(in host) also can not work for matching RDMA device when using veth network and doing SMC-R in POD.
To resolve the problems list above, this patch extends to search user -defined sw pnetid in the clc handshake ndev when no pnetid can be found in the base_ndev, and the base_ndev take precedence over ndev for backward compatibility. This patch also can unify the pnetid setup of different network choices list above in container(Config user-defined sw pnetid in the netdevice can be seen in POD).
--- net/smc/smc_pnet.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
net/smc/smc_pnet.c +5 -3
@@ -1079,14 +1079,16 @@ static void smc_pnet_find_roce_by_pnetid(struct net_device *ndev, struct smc_init_info *ini) {u8 ndev_pnetid[SMC_MAX_PNETID_LEN ]; +struct net_device *base_ndev;struct net *net; - ndev =pnet_find_base_ndev (ndev); + base_ndev =pnet_find_base_ndev (ndev); net =dev_net (ndev); -if (smc_pnetid_by_dev_port (ndev->dev.parent, ndev->dev_port, +if (smc_pnetid_by_dev_port (base_ndev->dev.parent, base_ndev->dev_port, ndev_pnetid) && +smc_pnet_find_ndev_pnetid_by_table (base_ndev, ndev_pnetid) &&smc_pnet_find_ndev_pnetid_by_table (ndev, ndev_pnetid)) { -smc_pnet_find_rdma_dev (ndev, ini); +smc_pnet_find_rdma_dev (base_ndev, ini);return ;/* pnetid could not be determined */ }_smc_pnet_find_roce_by_pnetid (ndev_pnetid, ini,NULL , net);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 146/642 xen: Add support for XenServer 6.1 platform device
In reply to Sasha LevinFrom: Frediano Ziglio <[email protected]>
[ Upstream commit 2356f15caefc0cc63d9cc5122641754f76ef9b25 ]
On XenServer on Windows machine a platform device with ID 2 instead of 1 is used.
This device is mainly identical to device 1 but due to some Windows update behaviour it was decided to use a device with a different ID.
This causes compatibility issues with Linux which expects, if Xen is detected, to find a Xen platform device (5853:0001) otherwise code will crash due to some missing initialization (specifically grant tables). Specifically from dmesg
RIP: 0010:gnttab_expand+0x29/0x210
Code: 90 0f 1f 44 00 00 55 31 d2 48 89 e5 41 57 41 56 41 55 41 89 fd
41 54 53 48 83 ec 10 48 8b 05 7e 9a 49 02 44 8b 35 a7 9a 49 02
<8b> 48 04 8d 44 39 ff f7 f1 45 8d 24 06 89 c3 e8 43 fe ff ff
44 39
RSP: 0000:ffffba34c01fbc88 EFLAGS: 00010086
...The device 2 is presented by Xapi adding device specification to Qemu command line.
Message-ID: <[email protected]>
--- drivers/xen/platform-pci.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/xen/platform-pci.c +4 -0
@@ -26,6 +26,8 @@#define DRV_NAME "xen-platform-pci" +#define PCI_DEVICE_ID_XEN_PLATFORM_XS61 0x0002 +static unsigned long platform_mmio;static unsigned long platform_mmio_alloc;static unsigned long platform_mmiolen;
@@ -174,6 +176,8 @@ static int platform_pci_probe(struct pci_dev *pdev,static const struct pci_device_id platform_pci_tbl[] = { {PCI_VENDOR_ID_XEN ,PCI_DEVICE_ID_XEN_PLATFORM ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,0 }, + {PCI_VENDOR_ID_XEN ,PCI_DEVICE_ID_XEN_PLATFORM_XS61 , +PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,0 }, {0 ,} };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 147/642 pinctrl-tegra: Restore SFSEL bit when freeing pins
In reply to Sasha LevinFrom: Prathamesh Shete <[email protected]>
[ Upstream commit c12bfa0fee65940b10ff5187349f76c6f6b1df9c ]
Each pin can be configured as a Special Function IO (SFIO) or GPIO, where the SFIO enables the pin to operate in alternative modes such as I2C, SPI, etc.
The current implementation sets all the pins back to SFIO mode even if they were initially in GPIO mode. This can cause glitches on the pins when pinctrl_gpio_free() is called.
Avoid these undesired glitches by storing the pin's SFIO/GPIO state on GPIO request and restoring it on GPIO free.
--- drivers/pinctrl/tegra/pinctrl-tegra.c | 59 +++++++++++++++++++++++---- drivers/pinctrl/tegra/pinctrl-tegra.h | 6 +++ 2 files changed, 57 insertions(+), 8 deletions(-)
drivers/pinctrl/tegra/pinctrl-tegra.c +51 -8
@@ -278,8 +278,8 @@ static int tegra_pinctrl_set_mux(struct pinctrl_dev *pctldev,return 0 ; } -static const struct tegra_pingroup *tegra_pinctrl_get_group (struct pinctrl_dev *pctldev, -unsigned int offset) +static int tegra_pinctrl_get_group_index (struct pinctrl_dev *pctldev, +unsigned int offset) {struct tegra_pmx *pmx =pinctrl_dev_get_drvdata (pctldev);unsigned int group, num_pins, j;
@@ -292,12 +292,35 @@ static const struct tegra_pingroup *tegra_pinctrl_get_group(struct pinctrl_dev *continue ;for (j =0 ; j < num_pins; j++) {if (offset == pins[j]) -return &pmx->soc->groups[group]; +return group; } } -dev_err (pctldev->dev,"Pingroup not found for pin %u\n" , offset); -return NULL ; +return -EINVAL ; +} + +static const struct tegra_pingroup *tegra_pinctrl_get_group (struct pinctrl_dev *pctldev, +unsigned int offset, +int group_index) +{ +struct tegra_pmx *pmx =pinctrl_dev_get_drvdata (pctldev); + +if (group_index <0 || group_index > pmx->soc->ngroups) +return NULL ; + +return &pmx->soc->groups[group_index]; +} + +static struct tegra_pingroup_config *tegra_pinctrl_get_group_config (struct pinctrl_dev *pctldev, +unsigned int offset, +int group_index) +{ +struct tegra_pmx *pmx =pinctrl_dev_get_drvdata (pctldev); + +if (group_index <0 ) +return NULL ; + +return &pmx->pingroup_configs[group_index]; } static int tegra_pinctrl_gpio_request_enable(struct pinctrl_dev *pctldev,
@@ -306,12 +329,15 @@ static int tegra_pinctrl_gpio_request_enable(struct pinctrl_dev *pctldev, {struct tegra_pmx *pmx =pinctrl_dev_get_drvdata (pctldev);const struct tegra_pingroup *group; +struct tegra_pingroup_config *config; +int group_index;u32 value;if (!pmx->soc->sfsel_in_mux)return 0 ; - group =tegra_pinctrl_get_group (pctldev, offset); + group_index =tegra_pinctrl_get_group_index (pctldev, offset); + group =tegra_pinctrl_get_group (pctldev, offset, group_index);if (!group)return -EINVAL ;
@@ -319,7 +345,11 @@ static int tegra_pinctrl_gpio_request_enable(struct pinctrl_dev *pctldev,if (group->mux_reg <0 || group->sfsel_bit <0 )return -EINVAL ; + config =tegra_pinctrl_get_group_config (pctldev, offset, group_index); +if (!config) +return -EINVAL ; value =pmx_readl (pmx, group->mux_bank, group->mux_reg); + config->is_sfsel = (value &BIT (group->sfsel_bit)) !=0 ; value &= ~BIT (group->sfsel_bit);pmx_writel (pmx, value, group->mux_bank, group->mux_reg);
@@ -332,12 +362,15 @@ static void tegra_pinctrl_gpio_disable_free(struct pinctrl_dev *pctldev, {struct tegra_pmx *pmx =pinctrl_dev_get_drvdata (pctldev);const struct tegra_pingroup *group; +struct tegra_pingroup_config *config; +int group_index;u32 value;if (!pmx->soc->sfsel_in_mux)return ; - group =tegra_pinctrl_get_group (pctldev, offset); + group_index =tegra_pinctrl_get_group_index (pctldev, offset); + group =tegra_pinctrl_get_group (pctldev, offset, group_index);if (!group)return ;
@@ -345,8 +378,12 @@ static void tegra_pinctrl_gpio_disable_free(struct pinctrl_dev *pctldev,if (group->mux_reg <0 || group->sfsel_bit <0 )return ; + config =tegra_pinctrl_get_group_config (pctldev, offset, group_index); +if (!config) +return ; value =pmx_readl (pmx, group->mux_bank, group->mux_reg); - value |=BIT (group->sfsel_bit); +if (config->is_sfsel) + value |=BIT (group->sfsel_bit);pmx_writel (pmx, value, group->mux_bank, group->mux_reg); }
@@ -791,6 +828,12 @@ int tegra_pinctrl_probe(struct platform_device *pdev, pmx->dev = &pdev->dev; pmx->soc = soc_data; + pmx->pingroup_configs =devm_kcalloc (&pdev->dev, + pmx->soc->ngroups,sizeof (*pmx->pingroup_configs), +GFP_KERNEL ); +if (!pmx->pingroup_configs) +return -ENOMEM ; +/* * Each mux group will appear in 4 functions' list of groups. * This over-allocates slightly, since not all groups are mux groups.
drivers/pinctrl/tegra/pinctrl-tegra.h +6 -0
@@ -8,6 +8,10 @@ #ifndef __PINMUX_TEGRA_H__ #define __PINMUX_TEGRA_H__ +struct tegra_pingroup_config { + bool is_sfsel; +}; + struct tegra_pmx { struct device *dev; struct pinctrl_dev *pctl;
@@ -21,6 +25,8 @@ struct tegra_pmx {int nbanks;void __iomem **regs;u32 *backup_regs; +/* Array of size soc->ngroups */ +struct tegra_pingroup_config *pingroup_configs; };enum tegra_pinconf_param {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 148/642 mfd: syscon: Add check for invalid resource size
In reply to Sasha LevinFrom: Eder Zulian <[email protected]>
[ Upstream commit ba09916efb29f80e438a54e634970209ce12750f ]
Add a consistency check to avoid assigning an invalid value to max_register due to a possible DT misconfiguration.
--- drivers/mfd/syscon.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/mfd/syscon.c +8 -1
@@ -47,6 +47,7 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_res)struct regmap_config syscon_config = syscon_regmap_config;struct resource res;struct reset_control *reset; +resource_size_t res_size;WARN_ON (!mutex_is_locked (&syscon_list_lock));
@@ -96,6 +97,12 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_res) } } + res_size =resource_size (&res); +if (res_size < reg_io_width) { + ret = -EFAULT ; + goto err_regmap; + } + syscon_config.name =kasprintf (GFP_KERNEL ,"%pOFn@%pa" , np, &res.start);if (!syscon_config.name) { ret = -ENOMEM ;
@@ -103,7 +110,7 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_res) } syscon_config.reg_stride = reg_io_width; syscon_config.val_bits = reg_io_width *8 ; - syscon_config.max_register =resource_size (&res) - reg_io_width; + syscon_config.max_register = res_size - reg_io_width;if (!syscon_config.max_register) syscon_config.max_register_is_0 = true;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 149/642 mfd: tps65219: Remove TPS65219_REG_TI_DEV_ID check
In reply to Sasha LevinFrom: Shree Ramamoorthy <[email protected]>
[ Upstream commit 76b58d5111fdcffce615beb71520bc7a6f1742c9 ]
The chipid macro/variable and regmap_read function call is not needed because the TPS65219_REG_TI_DEV_ID register value is not a consistent value across TPS65219 PMIC config versions. Reading from the DEV_ID register without a consistent value to compare it to isn't useful. There isn't a way to verify the match data ID is the same ID read from the DEV_ID device register. 0xF0 isn't a DEV_ID value consistent across TPS65219 NVM configurations.
For TPS65215, there is a consistent value in bits 5-0 of the DEV_ID register. However, there are other error checks in place within probe() that apply to both PMICs rather than keeping this isolated check for one PMIC.
--- drivers/mfd/tps65219.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/mfd/tps65219.c +0 -7
@@ -221,7 +221,6 @@ static const struct regmap_irq_chip tps65219_irq_chip = {static int tps65219_probe (struct i2c_client *client) {struct tps65219 *tps; -unsigned int chipid;bool pwr_button;int ret;
@@ -246,12 +245,6 @@ static int tps65219_probe(struct i2c_client *client)if (ret)return ret; - ret =regmap_read (tps->regmap,TPS65219_REG_TI_DEV_ID , &chipid); -if (ret) { -dev_err (tps->dev,"Failed to read device ID: %d\n" , ret); -return ret; - } - ret =devm_mfd_add_devices (tps->dev,PLATFORM_DEVID_AUTO , tps65219_cells,ARRAY_SIZE (tps65219_cells),NULL ,0 ,regmap_irq_get_domain (tps->irq_data));
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 150/642 drm/amdgpu/gfx12: don't read registers in mqd init
In reply to Sasha LevinFrom: Alex Deucher <[email protected]>
[ Upstream commit fc3c139cf0432b79fd08e23100a559ee51cd0be4 ]
Just use the default values. There's not need to get the value from hardware and it could cause problems if we do that at runtime and gfxoff is active.
--- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c | 48 ++++++++++++++++++-------- 1 file changed, 33 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c +33 -15
@@ -52,6 +52,24 @@#define RLCG_UCODE_LOADING_START_ADDRESS 0x00002000L +#define regCP_GFX_MQD_CONTROL_DEFAULT 0x00000100 +#define regCP_GFX_HQD_VMID_DEFAULT 0x00000000 +#define regCP_GFX_HQD_QUEUE_PRIORITY_DEFAULT 0x00000000 +#define regCP_GFX_HQD_QUANTUM_DEFAULT 0x00000a01 +#define regCP_GFX_HQD_CNTL_DEFAULT 0x00f00000 +#define regCP_RB_DOORBELL_CONTROL_DEFAULT 0x00000000 +#define regCP_GFX_HQD_RPTR_DEFAULT 0x00000000 + +#define regCP_HQD_EOP_CONTROL_DEFAULT 0x00000006 +#define regCP_HQD_PQ_DOORBELL_CONTROL_DEFAULT 0x00000000 +#define regCP_MQD_CONTROL_DEFAULT 0x00000100 +#define regCP_HQD_PQ_CONTROL_DEFAULT 0x00308509 +#define regCP_HQD_PQ_DOORBELL_CONTROL_DEFAULT 0x00000000 +#define regCP_HQD_PQ_RPTR_DEFAULT 0x00000000 +#define regCP_HQD_PERSISTENT_STATE_DEFAULT 0x0be05501 +#define regCP_HQD_IB_CONTROL_DEFAULT 0x00300000 + +MODULE_FIRMWARE ("amdgpu/gc_12_0_0_pfp.bin" );MODULE_FIRMWARE ("amdgpu/gc_12_0_0_me.bin" );MODULE_FIRMWARE ("amdgpu/gc_12_0_0_mec.bin" );
@@ -2891,25 +2909,25 @@ static int gfx_v12_0_gfx_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_mqd_base_addr_hi =upper_32_bits (prop->mqd_gpu_addr);/* set up mqd control */ - tmp =RREG32_SOC15 (GC ,0 , regCP_GFX_MQD_CONTROL); + tmp = regCP_GFX_MQD_CONTROL_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_GFX_MQD_CONTROL ,VMID ,0 ); tmp =REG_SET_FIELD (tmp,CP_GFX_MQD_CONTROL ,PRIV_STATE ,1 ); tmp =REG_SET_FIELD (tmp,CP_GFX_MQD_CONTROL ,CACHE_POLICY ,0 ); mqd->cp_gfx_mqd_control = tmp;/* set up gfx_hqd_vimd with 0x0 to indicate the ring buffer's vmid */ - tmp =RREG32_SOC15 (GC ,0 , regCP_GFX_HQD_VMID); + tmp = regCP_GFX_HQD_VMID_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_GFX_HQD_VMID ,VMID ,0 ); mqd->cp_gfx_hqd_vmid =0 ;/* set up default queue priority level * 0x0 = low priority, 0x1 = high priority */ - tmp =RREG32_SOC15 (GC ,0 , regCP_GFX_HQD_QUEUE_PRIORITY); + tmp = regCP_GFX_HQD_QUEUE_PRIORITY_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_GFX_HQD_QUEUE_PRIORITY ,PRIORITY_LEVEL ,0 ); mqd->cp_gfx_hqd_queue_priority = tmp;/* set up time quantum */ - tmp =RREG32_SOC15 (GC ,0 , regCP_GFX_HQD_QUANTUM); + tmp = regCP_GFX_HQD_QUANTUM_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_GFX_HQD_QUANTUM ,QUANTUM_EN ,1 ); mqd->cp_gfx_hqd_quantum = tmp;
@@ -2931,7 +2949,7 @@ static int gfx_v12_0_gfx_mqd_init(struct amdgpu_device *adev, void *m,/* set up the gfx_hqd_control, similar as CP_RB0_CNTL */ rb_bufsz =order_base_2 (prop->queue_size /4 ) -1 ; - tmp =RREG32_SOC15 (GC ,0 , regCP_GFX_HQD_CNTL); + tmp = regCP_GFX_HQD_CNTL_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_GFX_HQD_CNTL ,RB_BUFSZ , rb_bufsz); tmp =REG_SET_FIELD (tmp,CP_GFX_HQD_CNTL ,RB_BLKSZ , rb_bufsz -2 );#ifdef __BIG_ENDIAN
@@ -2940,7 +2958,7 @@ static int gfx_v12_0_gfx_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_gfx_hqd_cntl = tmp;/* set up cp_doorbell_control */ - tmp =RREG32_SOC15 (GC ,0 , regCP_RB_DOORBELL_CONTROL); + tmp = regCP_RB_DOORBELL_CONTROL_DEFAULT;if (prop->use_doorbell) { tmp =REG_SET_FIELD (tmp,CP_RB_DOORBELL_CONTROL ,DOORBELL_OFFSET , prop->doorbell_index);
@@ -2952,7 +2970,7 @@ static int gfx_v12_0_gfx_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_rb_doorbell_control = tmp;/* reset read and write pointers, similar to CP_RB0_WPTR/_RPTR */ - mqd->cp_gfx_hqd_rptr =RREG32_SOC15 (GC ,0 , regCP_GFX_HQD_RPTR); + mqd->cp_gfx_hqd_rptr = regCP_GFX_HQD_RPTR_DEFAULT;/* active the queue */ mqd->cp_gfx_hqd_active =1 ;
@@ -3047,14 +3065,14 @@ static int gfx_v12_0_compute_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_hqd_eop_base_addr_hi =upper_32_bits (eop_base_addr);/* set the EOP size, register value is 2^(EOP_SIZE+1) dwords */ - tmp =RREG32_SOC15 (GC ,0 , regCP_HQD_EOP_CONTROL); + tmp = regCP_HQD_EOP_CONTROL_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_HQD_EOP_CONTROL ,EOP_SIZE , (order_base_2 (GFX12_MEC_HPD_SIZE /4 ) -1 )); mqd->cp_hqd_eop_control = tmp;/* enable doorbell? */ - tmp =RREG32_SOC15 (GC ,0 , regCP_HQD_PQ_DOORBELL_CONTROL); + tmp = regCP_HQD_PQ_DOORBELL_CONTROL_DEFAULT;if (prop->use_doorbell) { tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_DOORBELL_CONTROL,
@@ -3083,7 +3101,7 @@ static int gfx_v12_0_compute_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_mqd_base_addr_hi =upper_32_bits (prop->mqd_gpu_addr);/* set MQD vmid to 0 */ - tmp =RREG32_SOC15 (GC ,0 , regCP_MQD_CONTROL); + tmp = regCP_MQD_CONTROL_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_MQD_CONTROL ,VMID ,0 ); mqd->cp_mqd_control = tmp;
@@ -3093,7 +3111,7 @@ static int gfx_v12_0_compute_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_hqd_pq_base_hi =upper_32_bits (hqd_gpu_addr);/* set up the HQD, this is similar to CP_RB0_CNTL */ - tmp =RREG32_SOC15 (GC ,0 , regCP_HQD_PQ_CONTROL); + tmp = regCP_HQD_PQ_CONTROL_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_HQD_PQ_CONTROL ,QUEUE_SIZE , (order_base_2 (prop->queue_size /4 ) -1 )); tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, RPTR_BLOCK_SIZE,
@@ -3118,7 +3136,7 @@ static int gfx_v12_0_compute_mqd_init(struct amdgpu_device *adev, void *m, tmp =0 ;/* enable the doorbell if requested */ if (prop->use_doorbell) { - tmp =RREG32_SOC15 (GC ,0 , regCP_HQD_PQ_DOORBELL_CONTROL); + tmp = regCP_HQD_PQ_DOORBELL_CONTROL_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_HQD_PQ_DOORBELL_CONTROL ,DOORBELL_OFFSET , prop->doorbell_index);
@@ -3133,17 +3151,17 @@ static int gfx_v12_0_compute_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_hqd_pq_doorbell_control = tmp;/* reset read and write pointers, similar to CP_RB0_WPTR/_RPTR */ - mqd->cp_hqd_pq_rptr =RREG32_SOC15 (GC ,0 , regCP_HQD_PQ_RPTR); + mqd->cp_hqd_pq_rptr = regCP_HQD_PQ_RPTR_DEFAULT;/* set the vmid for the queue */ mqd->cp_hqd_vmid =0 ; - tmp =RREG32_SOC15 (GC ,0 , regCP_HQD_PERSISTENT_STATE); + tmp = regCP_HQD_PERSISTENT_STATE_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_HQD_PERSISTENT_STATE ,PRELOAD_SIZE ,0x55 ); mqd->cp_hqd_persistent_state = tmp;/* set MIN_IB_AVAIL_SIZE */ - tmp =RREG32_SOC15 (GC ,0 , regCP_HQD_IB_CONTROL); + tmp = regCP_HQD_IB_CONTROL_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_HQD_IB_CONTROL ,MIN_IB_AVAIL_SIZE ,3 ); mqd->cp_hqd_ib_control = tmp;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 151/642 drm/amdgpu/gfx11: don't read registers in mqd init
In reply to Sasha LevinFrom: Alex Deucher <[email protected]>
[ Upstream commit e27b36ea6ba5f29e91fcfb375ea29503708fcf43 ]
Just use the default values. There's not need to get the value from hardware and it could cause problems if we do that at runtime and gfxoff is active.
--- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c | 47 ++++++++++++++++++-------- 1 file changed, 32 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c +32 -15
@@ -64,6 +64,23 @@#define regPC_CONFIG_CNTL_1 0x194d#define regPC_CONFIG_CNTL_1_BASE_IDX 1 +#define regCP_GFX_MQD_CONTROL_DEFAULT 0x00000100 +#define regCP_GFX_HQD_VMID_DEFAULT 0x00000000 +#define regCP_GFX_HQD_QUEUE_PRIORITY_DEFAULT 0x00000000 +#define regCP_GFX_HQD_QUANTUM_DEFAULT 0x00000a01 +#define regCP_GFX_HQD_CNTL_DEFAULT 0x00a00000 +#define regCP_RB_DOORBELL_CONTROL_DEFAULT 0x00000000 +#define regCP_GFX_HQD_RPTR_DEFAULT 0x00000000 + +#define regCP_HQD_EOP_CONTROL_DEFAULT 0x00000006 +#define regCP_HQD_PQ_DOORBELL_CONTROL_DEFAULT 0x00000000 +#define regCP_MQD_CONTROL_DEFAULT 0x00000100 +#define regCP_HQD_PQ_CONTROL_DEFAULT 0x00308509 +#define regCP_HQD_PQ_DOORBELL_CONTROL_DEFAULT 0x00000000 +#define regCP_HQD_PQ_RPTR_DEFAULT 0x00000000 +#define regCP_HQD_PERSISTENT_STATE_DEFAULT 0x0be05501 +#define regCP_HQD_IB_CONTROL_DEFAULT 0x00300000 +MODULE_FIRMWARE ("amdgpu/gc_11_0_0_pfp.bin" );MODULE_FIRMWARE ("amdgpu/gc_11_0_0_me.bin" );MODULE_FIRMWARE ("amdgpu/gc_11_0_0_mec.bin" );
@@ -3958,7 +3975,7 @@ static void gfx_v11_0_gfx_mqd_set_priority(struct amdgpu_device *adev,if (prop->hqd_pipe_priority ==AMDGPU_GFX_PIPE_PRIO_HIGH ) priority =1 ; - tmp =RREG32_SOC15 (GC ,0 , regCP_GFX_HQD_QUEUE_PRIORITY); + tmp = regCP_GFX_HQD_QUEUE_PRIORITY_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_GFX_HQD_QUEUE_PRIORITY ,PRIORITY_LEVEL , priority); mqd->cp_gfx_hqd_queue_priority = tmp; }
@@ -3980,14 +3997,14 @@ static int gfx_v11_0_gfx_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_mqd_base_addr_hi =upper_32_bits (prop->mqd_gpu_addr);/* set up mqd control */ - tmp =RREG32_SOC15 (GC ,0 , regCP_GFX_MQD_CONTROL); + tmp = regCP_GFX_MQD_CONTROL_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_GFX_MQD_CONTROL ,VMID ,0 ); tmp =REG_SET_FIELD (tmp,CP_GFX_MQD_CONTROL ,PRIV_STATE ,1 ); tmp =REG_SET_FIELD (tmp,CP_GFX_MQD_CONTROL ,CACHE_POLICY ,0 ); mqd->cp_gfx_mqd_control = tmp;/* set up gfx_hqd_vimd with 0x0 to indicate the ring buffer's vmid */ - tmp =RREG32_SOC15 (GC ,0 , regCP_GFX_HQD_VMID); + tmp = regCP_GFX_HQD_VMID_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_GFX_HQD_VMID ,VMID ,0 ); mqd->cp_gfx_hqd_vmid =0 ;
@@ -3995,7 +4012,7 @@ static int gfx_v11_0_gfx_mqd_init(struct amdgpu_device *adev, void *m,gfx_v11_0_gfx_mqd_set_priority (adev, mqd, prop);/* set up time quantum */ - tmp =RREG32_SOC15 (GC ,0 , regCP_GFX_HQD_QUANTUM); + tmp = regCP_GFX_HQD_QUANTUM_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_GFX_HQD_QUANTUM ,QUANTUM_EN ,1 ); mqd->cp_gfx_hqd_quantum = tmp;
@@ -4017,7 +4034,7 @@ static int gfx_v11_0_gfx_mqd_init(struct amdgpu_device *adev, void *m,/* set up the gfx_hqd_control, similar as CP_RB0_CNTL */ rb_bufsz =order_base_2 (prop->queue_size /4 ) -1 ; - tmp =RREG32_SOC15 (GC ,0 , regCP_GFX_HQD_CNTL); + tmp = regCP_GFX_HQD_CNTL_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_GFX_HQD_CNTL ,RB_BUFSZ , rb_bufsz); tmp =REG_SET_FIELD (tmp,CP_GFX_HQD_CNTL ,RB_BLKSZ , rb_bufsz -2 );#ifdef __BIG_ENDIAN
@@ -4026,7 +4043,7 @@ static int gfx_v11_0_gfx_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_gfx_hqd_cntl = tmp;/* set up cp_doorbell_control */ - tmp =RREG32_SOC15 (GC ,0 , regCP_RB_DOORBELL_CONTROL); + tmp = regCP_RB_DOORBELL_CONTROL_DEFAULT;if (prop->use_doorbell) { tmp =REG_SET_FIELD (tmp,CP_RB_DOORBELL_CONTROL ,DOORBELL_OFFSET , prop->doorbell_index);
@@ -4038,7 +4055,7 @@ static int gfx_v11_0_gfx_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_rb_doorbell_control = tmp;/* reset read and write pointers, similar to CP_RB0_WPTR/_RPTR */ - mqd->cp_gfx_hqd_rptr =RREG32_SOC15 (GC ,0 , regCP_GFX_HQD_RPTR); + mqd->cp_gfx_hqd_rptr = regCP_GFX_HQD_RPTR_DEFAULT;/* active the queue */ mqd->cp_gfx_hqd_active =1 ;
@@ -4124,14 +4141,14 @@ static int gfx_v11_0_compute_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_hqd_eop_base_addr_hi =upper_32_bits (eop_base_addr);/* set the EOP size, register value is 2^(EOP_SIZE+1) dwords */ - tmp =RREG32_SOC15 (GC ,0 , regCP_HQD_EOP_CONTROL); + tmp = regCP_HQD_EOP_CONTROL_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_HQD_EOP_CONTROL ,EOP_SIZE , (order_base_2 (GFX11_MEC_HPD_SIZE /4 ) -1 )); mqd->cp_hqd_eop_control = tmp;/* enable doorbell? */ - tmp =RREG32_SOC15 (GC ,0 , regCP_HQD_PQ_DOORBELL_CONTROL); + tmp = regCP_HQD_PQ_DOORBELL_CONTROL_DEFAULT;if (prop->use_doorbell) { tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_DOORBELL_CONTROL,
@@ -4160,7 +4177,7 @@ static int gfx_v11_0_compute_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_mqd_base_addr_hi =upper_32_bits (prop->mqd_gpu_addr);/* set MQD vmid to 0 */ - tmp =RREG32_SOC15 (GC ,0 , regCP_MQD_CONTROL); + tmp = regCP_MQD_CONTROL_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_MQD_CONTROL ,VMID ,0 ); mqd->cp_mqd_control = tmp;
@@ -4170,7 +4187,7 @@ static int gfx_v11_0_compute_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_hqd_pq_base_hi =upper_32_bits (hqd_gpu_addr);/* set up the HQD, this is similar to CP_RB0_CNTL */ - tmp =RREG32_SOC15 (GC ,0 , regCP_HQD_PQ_CONTROL); + tmp = regCP_HQD_PQ_CONTROL_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_HQD_PQ_CONTROL ,QUEUE_SIZE , (order_base_2 (prop->queue_size /4 ) -1 )); tmp = REG_SET_FIELD(tmp, CP_HQD_PQ_CONTROL, RPTR_BLOCK_SIZE,
@@ -4196,7 +4213,7 @@ static int gfx_v11_0_compute_mqd_init(struct amdgpu_device *adev, void *m, tmp =0 ;/* enable the doorbell if requested */ if (prop->use_doorbell) { - tmp =RREG32_SOC15 (GC ,0 , regCP_HQD_PQ_DOORBELL_CONTROL); + tmp = regCP_HQD_PQ_DOORBELL_CONTROL_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_HQD_PQ_DOORBELL_CONTROL ,DOORBELL_OFFSET , prop->doorbell_index);
@@ -4211,17 +4228,17 @@ static int gfx_v11_0_compute_mqd_init(struct amdgpu_device *adev, void *m, mqd->cp_hqd_pq_doorbell_control = tmp;/* reset read and write pointers, similar to CP_RB0_WPTR/_RPTR */ - mqd->cp_hqd_pq_rptr =RREG32_SOC15 (GC ,0 , regCP_HQD_PQ_RPTR); + mqd->cp_hqd_pq_rptr = regCP_HQD_PQ_RPTR_DEFAULT;/* set the vmid for the queue */ mqd->cp_hqd_vmid =0 ; - tmp =RREG32_SOC15 (GC ,0 , regCP_HQD_PERSISTENT_STATE); + tmp = regCP_HQD_PERSISTENT_STATE_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_HQD_PERSISTENT_STATE ,PRELOAD_SIZE ,0x55 ); mqd->cp_hqd_persistent_state = tmp;/* set MIN_IB_AVAIL_SIZE */ - tmp =RREG32_SOC15 (GC ,0 , regCP_HQD_IB_CONTROL); + tmp = regCP_HQD_IB_CONTROL_DEFAULT; tmp =REG_SET_FIELD (tmp,CP_HQD_IB_CONTROL ,MIN_IB_AVAIL_SIZE ,3 ); mqd->cp_hqd_ib_control = tmp;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 152/642 drm/amdgpu: Update SRIOV video codec caps
In reply to Sasha LevinFrom: David Rosca <[email protected]>
[ Upstream commit 19478f2011f8b53dee401c91423c4e0b73753e4f ]
There have been multiple fixes to the video caps that are missing for SRIOV. Update the SRIOV caps with correct values.
--- drivers/gpu/drm/amd/amdgpu/nv.c | 16 ++++++++-------- drivers/gpu/drm/amd/amdgpu/soc21.c | 10 ++-------- 2 files changed, 10 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/amdgpu/nv.c +8 -8
@@ -141,23 +141,23 @@ static struct amdgpu_video_codec_info sriov_sc_video_codecs_encode_array[] = { };static struct amdgpu_video_codec_info sriov_sc_video_codecs_decode_array_vcn0[] = { - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2 ,4096 ,4096 ,3 )}, - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4 ,4096 ,4096 ,5 )}, + {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2 ,1920 ,1088 ,3 )}, + {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4 ,1920 ,1088 ,5 )}, {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC ,4096 ,4096 ,52 )}, - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1 ,4096 ,4096 ,4 )}, + {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1 ,1920 ,1088 ,4 )}, {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC ,8192 ,4352 ,186 )}, - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG ,4096 ,4096 ,0 )}, + {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG ,16384 ,16384 ,0 )}, {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9 ,8192 ,4352 ,0 )}, {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1 ,8192 ,4352 ,0 )}, };static struct amdgpu_video_codec_info sriov_sc_video_codecs_decode_array_vcn1[] = { - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2 ,4096 ,4096 ,3 )}, - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4 ,4096 ,4096 ,5 )}, + {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2 ,1920 ,1088 ,3 )}, + {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4 ,1920 ,1088 ,5 )}, {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC ,4096 ,4096 ,52 )}, - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1 ,4096 ,4096 ,4 )}, + {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1 ,1920 ,1088 ,4 )}, {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC ,8192 ,4352 ,186 )}, - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG ,4096 ,4096 ,0 )}, + {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG ,16384 ,16384 ,0 )}, {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9 ,8192 ,4352 ,0 )}, };
drivers/gpu/drm/amd/amdgpu/soc21.c +2 -8
@@ -117,23 +117,17 @@ static struct amdgpu_video_codecs sriov_vcn_4_0_0_video_codecs_encode_vcn1 = { };static struct amdgpu_video_codec_info sriov_vcn_4_0_0_video_codecs_decode_array_vcn0[] = { - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2 ,4096 ,4096 ,3 )}, - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4 ,4096 ,4096 ,5 )}, {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC ,4096 ,4096 ,52 )}, - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1 ,4096 ,4096 ,4 )}, {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC ,8192 ,4352 ,186 )}, - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG ,4096 ,4096 ,0 )}, + {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG ,16384 ,16384 ,0 )}, {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9 ,8192 ,4352 ,0 )}, {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1 ,8192 ,4352 ,0 )}, };static struct amdgpu_video_codec_info sriov_vcn_4_0_0_video_codecs_decode_array_vcn1[] = { - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2 ,4096 ,4096 ,3 )}, - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4 ,4096 ,4096 ,5 )}, {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC ,4096 ,4096 ,52 )}, - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1 ,4096 ,4096 ,4 )}, {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC ,8192 ,4352 ,186 )}, - {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG ,4096 ,4096 ,0 )}, + {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG ,16384 ,16384 ,0 )}, {codec_info_build (AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9 ,8192 ,4352 ,0 )}, };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 153/642 ASoC: sun4i-codec: support hp-det-gpios property
In reply to Sasha LevinFrom: Ryan Walklin <[email protected]>
[ Upstream commit a149377c033afe6557c50892ebbfc0e8b7e2e253 ]
Add support for GPIO headphone detection with the hp-det-gpios property. In order for this to properly disable the path upon removal of headphones, the output must be labelled Headphone which is a common sink in the driver.
Describe a headphone jack and detection GPIO in the driver, check for a corresponding device tree node, and enable jack detection in a new machine init function if described.
--
Changelog v1..v2:
- Separate DAPM changes into separate patch and add rationale.
--- sound/soc/sunxi/sun4i-codec.c | 53 +++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+)
sound/soc/sunxi/sun4i-codec.c +53 -0
@@ -22,6 +22,7 @@#include <linux/gpio/consumer.h> #include <sound/core.h> +#include <sound/jack.h> #include <sound/pcm.h> #include <sound/pcm_params.h> #include <sound/soc.h>
@@ -331,6 +332,7 @@ struct sun4i_codec {struct clk *clk_module;struct reset_control *rst;struct gpio_desc *gpio_pa; +struct gpio_desc *gpio_hp;/* ADC_FIFOC register is at different offset on different SoCs */ struct regmap_field *reg_adc_fifoc;
@@ -1583,6 +1585,49 @@ static struct snd_soc_dai_driver dummy_cpu_dai = { .ops = &dummy_dai_ops, }; +static struct snd_soc_jack sun4i_headphone_jack; + +static struct snd_soc_jack_pin sun4i_headphone_jack_pins[] = { + { .pin ="Headphone" , .mask =SND_JACK_HEADPHONE }, +}; + +static struct snd_soc_jack_gpio sun4i_headphone_jack_gpio = { + .name ="hp-det" , + .report =SND_JACK_HEADPHONE , + .debounce_time =150 , +}; + +static int sun4i_codec_machine_init (struct snd_soc_pcm_runtime *rtd) +{ +struct snd_soc_card *card = rtd->card; +struct sun4i_codec *scodec =snd_soc_card_get_drvdata (card); +int ret; + +if (scodec->gpio_hp) { + ret =snd_soc_card_jack_new_pins (card,"Headphone Jack" , +SND_JACK_HEADPHONE , + &sun4i_headphone_jack, + sun4i_headphone_jack_pins, +ARRAY_SIZE (sun4i_headphone_jack_pins)); +if (ret) { +dev_err (rtd->dev, +"Headphone jack creation failed: %d\n" , ret); +return ret; + } + + sun4i_headphone_jack_gpio.desc = scodec->gpio_hp; + ret =snd_soc_jack_add_gpios (&sun4i_headphone_jack,1 , + &sun4i_headphone_jack_gpio); + +if (ret) { +dev_err (rtd->dev,"Headphone GPIO not added: %d\n" , ret); +return ret; + } + } + +return 0 ; +} +static struct snd_soc_dai_link *sun4i_codec_create_link (struct device *dev,int *num_links) {
@@ -1608,6 +1653,7 @@ static struct snd_soc_dai_link *sun4i_codec_create_link(struct device *dev, link->codecs->name =dev_name (dev); link->platforms->name =dev_name (dev); link->dai_fmt =SND_SOC_DAIFMT_I2S ; + link->init = sun4i_codec_machine_init; *num_links =1 ;
@@ -2301,6 +2347,13 @@ static int sun4i_codec_probe(struct platform_device *pdev)return ret; } + scodec->gpio_hp =devm_gpiod_get_optional (&pdev->dev,"hp-det" ,GPIOD_IN ); +if (IS_ERR (scodec->gpio_hp)) { + ret =PTR_ERR (scodec->gpio_hp); +dev_err_probe (&pdev->dev, ret,"Failed to get hp-det gpio\n" ); +return ret; + } +/* reg_field setup */ scodec->reg_adc_fifoc = devm_regmap_field_alloc(&pdev->dev, scodec->regmap,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 154/642 ASoC: sun4i-codec: correct dapm widgets and controls for h616
In reply to Sasha LevinFrom: Ryan Walklin <[email protected]>
[ Upstream commit ae5f76d4044d1580849316c49290678605e0889d ]
The previous H616 support patch added a single LINEOUT DAPM pin switch to the card controls. As the codec in this SoC only has a single route, this seemed reasonable at the time, however is redundant given the existing DAPM codec widget definitions controlling the digital and analog sides of the codec.
It is also insufficient to describe the scenario where separate components (muxes, jack detection etc) are used to modify the audio route external to the SoC. For example the Anbernic RG(##)XX series of devices uses a headphone jack detection switch, GPIO-controlled speaker amplifier and a passive external mux chip to route audio.
Remove the redundant LINEOUT card control, and add a Speaker pin switch control and Headphone DAPM widget to allow control of the above hardware.
--- sound/soc/sunxi/sun4i-codec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/soc/sunxi/sun4i-codec.c +2 -1
@@ -1962,10 +1962,11 @@ static const struct snd_soc_component_driver sun50i_h616_codec_codec = { };static const struct snd_kcontrol_new sun50i_h616_card_controls[] = { -SOC_DAPM_PIN_SWITCH ("LINEOUT" ), +SOC_DAPM_PIN_SWITCH ("Speaker" ), };static const struct snd_soc_dapm_widget sun50i_h616_codec_card_dapm_widgets[] = { +SND_SOC_DAPM_HP ("Headphone" ,NULL ),SND_SOC_DAPM_LINE ("Line Out" ,NULL ),SND_SOC_DAPM_SPK ("Speaker" , sun4i_codec_spk_event), };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 155/642 clk: qcom: lpassaudiocc-sc7280: Add support for LPASS resets for QCM6490
In reply to Sasha LevinFrom: Taniya Das <[email protected]>
[ Upstream commit cdbbc480f4146cb659af97f4020601fde5fb65a7 ]
On the QCM6490 boards, the LPASS firmware controls the complete clock controller functionalities and associated power domains. However, only the LPASS resets required to be controlled by the high level OS. Thus, add support for the resets in the clock driver to enable the Audio SW driver to assert/deassert the audio resets as needed.
--- drivers/clk/qcom/lpassaudiocc-sc7280.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-)
drivers/clk/qcom/lpassaudiocc-sc7280.c +19 -4
@@ -1,6 +1,7 @@// SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2021, The Linux Foundation. All rights reserved. +* Copyright (c) 2025, Qualcomm Innovation Center, Inc. All rights reserved. */ #include <linux/clk-provider.h>
@@ -713,14 +714,24 @@ static const struct qcom_reset_map lpass_audio_cc_sc7280_resets[] = { [LPASS_AUDIO_SWR_WSA_CGCR] = { 0xb0, 1 }, }; +static const struct regmap_config lpass_audio_cc_sc7280_reset_regmap_config = { + .name ="lpassaudio_cc_reset" , + .reg_bits =32 , + .reg_stride =4 , + .val_bits =32 , + .fast_io = true, + .max_register =0xc8 , +}; +static const struct qcom_cc_desc lpass_audio_cc_reset_sc7280_desc = { - .config = &lpass_audio_cc_sc7280_regmap_config, + .config = &lpass_audio_cc_sc7280_reset_regmap_config, .resets = lpass_audio_cc_sc7280_resets, .num_resets =ARRAY_SIZE (lpass_audio_cc_sc7280_resets), };static const struct of_device_id lpass_audio_cc_sc7280_match_table[] = { - { .compatible ="qcom,sc7280-lpassaudiocc" }, + { .compatible ="qcom,qcm6490-lpassaudiocc" , .data = &lpass_audio_cc_reset_sc7280_desc }, + { .compatible ="qcom,sc7280-lpassaudiocc" , .data = &lpass_audio_cc_sc7280_desc }, { } };MODULE_DEVICE_TABLE (of, lpass_audio_cc_sc7280_match_table);
@@ -752,13 +763,17 @@ static int lpass_audio_cc_sc7280_probe(struct platform_device *pdev)struct regmap *regmap;int ret; + desc =device_get_match_data (&pdev->dev); + +if (of_device_is_compatible (pdev->dev.of_node,"qcom,qcm6490-lpassaudiocc" )) +return qcom_cc_probe_by_index (pdev,1 , desc); + ret =lpass_audio_setup_runtime_pm (pdev);if (ret)return ret; lpass_audio_cc_sc7280_regmap_config.name ="lpassaudio_cc" ; lpass_audio_cc_sc7280_regmap_config.max_register =0x2f000 ; - desc = &lpass_audio_cc_sc7280_desc; regmap =qcom_cc_map (pdev, desc);if (IS_ERR (regmap)) {
@@ -772,7 +787,7 @@ static int lpass_audio_cc_sc7280_probe(struct platform_device *pdev)regmap_write (regmap,0x4 ,0x3b );regmap_write (regmap,0x8 ,0xff05 ); - ret =qcom_cc_really_probe (&pdev->dev, &lpass_audio_cc_sc7280_desc, regmap); + ret =qcom_cc_really_probe (&pdev->dev, desc, regmap);if (ret) {dev_err (&pdev->dev,"Failed to register LPASS AUDIO CC clocks\n" ); goto exit;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 156/642 f2fs: defer readonly check vs norecovery
In reply to Sasha LevinFrom: Eric Sandeen <[email protected]>
[ Upstream commit 9cca49875997a1a7e92800a828a62bacb0f577b9 ]
Defer the readonly-vs-norecovery check until after option parsing is done so that option parsing does not require an active superblock for the test. Add a helpful message, while we're at it.
(I think could be moved back into parsing after we switch to the new mount API if desired, as the fs context will have RO state available.)
--- fs/f2fs/super.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
fs/f2fs/super.c +7 -3
@@ -728,10 +728,8 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)set_opt (sbi,DISABLE_ROLL_FORWARD );break ;case Opt_norecovery: -/* this option mounts f2fs with ro */ +/* requires ro mount, checked in f2fs_default_check */ set_opt (sbi,NORECOVERY ); -if (!f2fs_readonly (sb)) -return -EINVAL ;break ;case Opt_discard:if (!f2fs_hw_support_discard (sbi)) {
@@ -1418,6 +1416,12 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)f2fs_err (sbi,"Allow to mount readonly mode only" );return -EROFS ; } + +if (test_opt (sbi,NORECOVERY ) && !f2fs_readonly (sbi->sb)) { +f2fs_err (sbi,"norecovery requires readonly mount" ); +return -EINVAL ; + } +return 0 ; }
Signature · 1 line
2.39.5
Re: [PATCH AUTOSEL 6.14 156/642] f2fs: defer readonly check vs norecovery
This commit is in no way a bugfix and I don't see any reason to backport it to stable kernels.
Thanks,
-Eric
Quoted 48 lines · Sasha Levin
From: Eric Sandeen <[email protected]>
[ Upstream commit
9cca49875997a1a7e92800a828a62bacb0f577b9]Defer the readonly-vs-norecovery check until after option parsing is done so that option parsing does not require an active superblock for the test. Add a helpful message, while we're at it.
(I think could be moved back into parsing after we switch to the new mount API if desired, as the fs context will have RO state available.)
Signed-off-by Eric Sandeen <[email protected]>Reviewed-by Chao Yu <[email protected]>Signed-off-by Jaegeuk Kim <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- fs/f2fs/super.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)fs/f2fs/super.c +7
-3@@ -728,10 +728,8 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)set_opt (sbi,DISABLE_ROLL_FORWARD );break ;case Opt_norecovery: -/* this option mounts f2fs with ro */ +/* requires ro mount, checked in f2fs_default_check */ set_opt (sbi,NORECOVERY ); -if (!f2fs_readonly (sb)) -return -EINVAL ;break ;case Opt_discard:if (!f2fs_hw_support_discard (sbi)) {@@ -1418,6 +1416,12 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)f2fs_err (sbi,"Allow to mount readonly mode only" );return -EROFS ; } + +if (test_opt (sbi,NORECOVERY ) && !f2fs_readonly (sbi->sb)) { +f2fs_err (sbi,"norecovery requires readonly mount" ); +return -EINVAL ; + } +return 0 ; }
Sasha Levin
maintainerPATCH 157/642 leds: Kconfig: leds-st1202: Add select for required LEDS_TRIGGER_PATTERN
In reply to Sasha LevinFrom: Manuel Fombuena <[email protected]>
[ Upstream commit be2f92844d0f8cb059cb6958c6d9582d381ca68e ]
leds-st1202 requires the LED Pattern Trigger (LEDS_TRIGGER_PATTERN), which is not selected when LED Trigger support is (LEDS_TRIGGERS).
To reproduce this:
- make menuconfig KCONFIG_CONFIG=
- select LEDS_ST1202 dependencies OF, I2C and LEDS_CLASS.
- select LEDS_ST1202
- LEDS_TRIGGERS is selected but LEDS_TRIGGER_PATTERN isn't.
The absence of LEDS_TRIGGER_PATTERN explicitly required can lead to builds in which LEDS_ST1202 is selected while LEDS_TRIGGER_PATTERN isn't. The direct result of that would be that /sys/class/leds/<led>/hw_pattern wouldn't be available and there would be no way of interacting with the driver and hardware from user space.
Add select LEDS_TRIGGER_PATTERN to Kconfig to meet the requirement and indirectly document it as well.
--- drivers/leds/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/leds/Kconfig +1 -0
@@ -971,6 +971,7 @@ config LEDS_ST1202 depends on I2C depends on OF select LEDS_TRIGGERS + select LEDS_TRIGGER_PATTERN help Say Y to enable support for LEDs connected to LED1202 LED driver chips accessed via the I2C bus.
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 158/642 leds: leds-st1202: Initialize hardware before DT node child operations
In reply to Sasha LevinFrom: Manuel Fombuena <[email protected]>
[ Upstream commit a17d9e736ddd78323e77d3066c1e86371a99023c ]
Arguably, there are more chances of errors occurring during the initialization of the hardware, so this should complete successfully before the devicetree node's children are initialized.
st1202_dt_init() fills the led_classdev struct.
st1202_setup() initializes the hardware. Specifically, resets the chip, enables its phase-shift delay feature, enables the device and disables all the LEDs channels. All that writing to registers, with no input from st1202_dt_init().
Real-world testing corroborates that calling st1202_setup() before st1202_dt_init() doesn't cause any issue during initialization.
Switch the order of st1202_dt_init() and st1202_setup() to ensure the hardware is correctly initialized before the led_classdev struct is filled.
--- drivers/leds/leds-st1202.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/leds/leds-st1202.c +2 -2
@@ -350,11 +350,11 @@ static int st1202_probe(struct i2c_client *client)return ret; chip->client = client; - ret =st1202_dt_init (chip); + ret =st1202_setup (chip);if (ret <0 )return ret; - ret =st1202_setup (chip); + ret =st1202_dt_init (chip);if (ret <0 )return ret;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 159/642 ext4: reject the 'data_err=abort' option in nojournal mode
In reply to Sasha LevinFrom: Baokun Li <[email protected]>
[ Upstream commit 26343ca0df715097065b02a6cddb4a029d5b9327 ]
data_err=abort aborts the journal on I/O errors. However, this option is meaningless if journal is disabled, so it is rejected in nojournal mode to reduce unnecessary checks. Also, this option is ignored upon remount.
--- fs/ext4/super.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
fs/ext4/super.c +12 -0
@@ -2785,6 +2785,13 @@ static int ext4_check_opt_consistency(struct fs_context *fc, }if (is_remount) { +if (!sbi->s_journal && +ctx_test_mount_opt (ctx,EXT4_MOUNT_DATA_ERR_ABORT )) { +ext4_msg (NULL ,KERN_WARNING , +"Remounting fs w/o journal so ignoring data_err option" ); +ctx_clear_mount_opt (ctx,EXT4_MOUNT_DATA_ERR_ABORT ); + } +if (ctx_test_mount_opt (ctx,EXT4_MOUNT_DAX_ALWAYS ) && (test_opt (sb,DATA_FLAGS ) ==EXT4_MOUNT_JOURNAL_DATA )) { ext4_msg(NULL, KERN_ERR, "can't mount with "
@@ -5428,6 +5435,11 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb) "data=, fs mounted w/o journal"); goto failed_mount3a; } +if (test_opt (sb,DATA_ERR_ABORT )) { +ext4_msg (sb,KERN_ERR , +"can't mount with data_err=abort, fs mounted w/o journal" ); + goto failed_mount3a; + } sbi->s_def_mount_opt &= ~EXT4_MOUNT_JOURNAL_CHECKSUM ;clear_opt (sb,JOURNAL_CHECKSUM );clear_opt (sb,DATA_FLAGS );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 160/642 ext4: do not convert the unwritten extents if data writeback fails
In reply to Sasha LevinFrom: Baokun Li <[email protected]>
[ Upstream commit e856f93e0fb249955f7d5efb18fe20500a9ccc6d ]
When dioread_nolock is turned on (the default), it will convert unwritten extents to written at ext4_end_io_end(), even if the data writeback fails.
It leads to the possibility that stale data may be exposed when the physical block corresponding to the file data is read-only (i.e., writes return -EIO, but reads are normal).
Therefore a new ext4_io_end->flags EXT4_IO_END_FAILED is added, which indicates that some bio write-back failed in the current ext4_io_end. When this flag is set, the unwritten to written conversion is no longer performed. Users can read the data normally until the caches are dropped, after that, the failed extents can only be read to all 0.
--- fs/ext4/ext4.h | 3 ++- fs/ext4/page-io.c | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-)
fs/ext4/ext4.h +2 -1
@@ -278,7 +278,8 @@ struct ext4_system_blocks {/* * Flags for ext4_io_end->flags */ -#define EXT4_IO_END_UNWRITTEN 0x0001 +#define EXT4_IO_END_UNWRITTEN 0x0001 +#define EXT4_IO_END_FAILED 0x0002struct ext4_io_end_vec {struct list_head list;/* list of io_end_vec */
fs/ext4/page-io.c +14 -2
@@ -181,14 +181,25 @@ static int ext4_end_io_end(ext4_io_end_t *io_end)"list->prev 0x%p\n" , io_end, inode->i_ino, io_end->list.next, io_end->list.prev); - io_end->handle =NULL ;/* Following call will use up the handle */ - ret =ext4_convert_unwritten_io_end_vec (handle, io_end); +/* +* Do not convert the unwritten extents if data writeback fails, +* or stale data may be exposed. +*/ + io_end->handle =NULL ;/* Following call will use up the handle */ +if (unlikely (io_end->flag &EXT4_IO_END_FAILED )) { + ret = -EIO ; +if (handle) +jbd2_journal_free_reserved (handle); + }else { + ret =ext4_convert_unwritten_io_end_vec (handle, io_end); + }if (ret <0 && !ext4_forced_shutdown (inode->i_sb)) {ext4_msg (inode->i_sb,KERN_EMERG ,"failed to convert unwritten extents to written " "extents -- potential data loss! " "(inode %lu, error %d)" , inode->i_ino, ret); } +ext4_clear_io_unwritten_flag (io_end);ext4_release_io_end (io_end);return ret;
@@ -344,6 +355,7 @@ static void ext4_end_bio(struct bio *bio) bio->bi_status, inode->i_ino, (unsigned long long ) bi_sector >> (inode->i_blkbits - 9)); + io_end->flag |=EXT4_IO_END_FAILED ;mapping_set_error (inode->i_mapping,blk_status_to_errno (bio->bi_status)); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 161/642 RDMA/uverbs: Propagate errors from rdma_lookup_get_uobject()
In reply to Sasha LevinFrom: Maher Sanalla <[email protected]>
[ Upstream commit 81f8f7454ad9e0bf95efdec6542afdc9a6ab1e24 ]
Currently, the IB uverbs API calls uobj_get_uobj_read(), which in turn uses the rdma_lookup_get_uobject() helper to retrieve user objects. In case of failure, uobj_get_uobj_read() returns NULL, overriding the error code from rdma_lookup_get_uobject(). The IB uverbs API then translates this NULL to -EINVAL, masking the actual error and complicating debugging. For example, applications calling ibv_modify_qp that fails with EBUSY when retrieving the QP uobject will see the overridden error code EINVAL instead, masking the actual error.
Furthermore, based on rdma-core commit:
"2a22f1ced5f3 ("Merge pull request #1568 from jakemoroni/master")" Kernel's IB uverbs return values are either ignored and passed on as is to application or overridden with other errnos in a few cases.
Thus, to improve error reporting and debuggability, propagate the original error from rdma_lookup_get_uobject() instead of replacing it with EINVAL.
--- drivers/infiniband/core/uverbs_cmd.c | 144 ++++++++++++++------------- include/rdma/uverbs_std_types.h | 2 +- 2 files changed, 77 insertions(+), 69 deletions(-)
drivers/infiniband/core/uverbs_cmd.c +76 -68
@@ -716,8 +716,8 @@ static int ib_uverbs_reg_mr(struct uverbs_attr_bundle *attrs) goto err_free; pd =uobj_get_obj_read (pd,UVERBS_OBJECT_PD , cmd.pd_handle, attrs); -if (!pd) { - ret = -EINVAL ; +if (IS_ERR (pd)) { + ret =PTR_ERR (pd); goto err_free; }
@@ -807,8 +807,8 @@ static int ib_uverbs_rereg_mr(struct uverbs_attr_bundle *attrs)if (cmd.flags &IB_MR_REREG_PD ) { new_pd =uobj_get_obj_read (pd,UVERBS_OBJECT_PD , cmd.pd_handle, attrs); -if (!new_pd) { - ret = -EINVAL ; +if (IS_ERR (new_pd)) { + ret =PTR_ERR (new_pd); goto put_uobjs; } }else {
@@ -917,8 +917,8 @@ static int ib_uverbs_alloc_mw(struct uverbs_attr_bundle *attrs)return PTR_ERR (uobj); pd =uobj_get_obj_read (pd,UVERBS_OBJECT_PD , cmd.pd_handle, attrs); -if (!pd) { - ret = -EINVAL ; +if (IS_ERR (pd)) { + ret =PTR_ERR (pd); goto err_free; }
@@ -1125,8 +1125,8 @@ static int ib_uverbs_resize_cq(struct uverbs_attr_bundle *attrs)return ret; cq =uobj_get_obj_read (cq,UVERBS_OBJECT_CQ , cmd.cq_handle, attrs); -if (!cq) -return -EINVAL ; +if (IS_ERR (cq)) +return PTR_ERR (cq); ret = cq->device->ops.resize_cq (cq, cmd.cqe, &attrs->driver_udata);if (ret)
@@ -1187,8 +1187,8 @@ static int ib_uverbs_poll_cq(struct uverbs_attr_bundle *attrs)return ret; cq =uobj_get_obj_read (cq,UVERBS_OBJECT_CQ , cmd.cq_handle, attrs); -if (!cq) -return -EINVAL ; +if (IS_ERR (cq)) +return PTR_ERR (cq);/* we copy a struct ib_uverbs_poll_cq_resp to user space */ header_ptr = attrs->ucore.outbuf;
@@ -1236,8 +1236,8 @@ static int ib_uverbs_req_notify_cq(struct uverbs_attr_bundle *attrs)return ret; cq =uobj_get_obj_read (cq,UVERBS_OBJECT_CQ , cmd.cq_handle, attrs); -if (!cq) -return -EINVAL ; +if (IS_ERR (cq)) +return PTR_ERR (cq);ib_req_notify_cq (cq, cmd.solicited_only ?IB_CQ_SOLICITED :IB_CQ_NEXT_COMP );
@@ -1319,8 +1319,8 @@ static int create_qp(struct uverbs_attr_bundle *attrs, ind_tbl =uobj_get_obj_read (rwq_ind_table,UVERBS_OBJECT_RWQ_IND_TBL , cmd->rwq_ind_tbl_handle, attrs); -if (!ind_tbl) { - ret = -EINVAL ; +if (IS_ERR (ind_tbl)) { + ret =PTR_ERR (ind_tbl); goto err_put; }
@@ -1358,8 +1358,10 @@ static int create_qp(struct uverbs_attr_bundle *attrs,if (cmd->is_srq) { srq =uobj_get_obj_read (srq,UVERBS_OBJECT_SRQ , cmd->srq_handle, attrs); -if (!srq || srq->srq_type ==IB_SRQT_XRC ) { - ret = -EINVAL ; +if (IS_ERR (srq) || + srq->srq_type ==IB_SRQT_XRC ) { + ret =IS_ERR (srq) ?PTR_ERR (srq) : + -EINVAL ; goto err_put; } }
@@ -1369,23 +1371,29 @@ static int create_qp(struct uverbs_attr_bundle *attrs, rcq =uobj_get_obj_read ( cq,UVERBS_OBJECT_CQ , cmd->recv_cq_handle, attrs); -if (!rcq) { - ret = -EINVAL ; +if (IS_ERR (rcq)) { + ret =PTR_ERR (rcq); goto err_put; } } } } -if (has_sq) +if (has_sq) { scq =uobj_get_obj_read (cq,UVERBS_OBJECT_CQ , cmd->send_cq_handle, attrs); +if (IS_ERR (scq)) { + ret =PTR_ERR (scq); + goto err_put; + } + } +if (!ind_tbl && cmd->qp_type !=IB_QPT_XRC_INI ) rcq = rcq ?: scq; pd =uobj_get_obj_read (pd,UVERBS_OBJECT_PD , cmd->pd_handle, attrs); -if (!pd || (!scq && has_sq)) { - ret = -EINVAL ; +if (IS_ERR (pd)) { + ret =PTR_ERR (pd); goto err_put; }
@@ -1480,18 +1488,18 @@ static int create_qp(struct uverbs_attr_bundle *attrs, err_put:if (!IS_ERR (xrcd_uobj))uobj_put_read (xrcd_uobj); -if (pd) +if (!IS_ERR_OR_NULL (pd))uobj_put_obj_read (pd); -if (scq) +if (!IS_ERR_OR_NULL (scq))rdma_lookup_put_uobject (&scq->uobject->uevent.uobject,UVERBS_LOOKUP_READ ); -if (rcq && rcq != scq) +if (!IS_ERR_OR_NULL (rcq) && rcq != scq)rdma_lookup_put_uobject (&rcq->uobject->uevent.uobject,UVERBS_LOOKUP_READ ); -if (srq) +if (!IS_ERR_OR_NULL (srq))rdma_lookup_put_uobject (&srq->uobject->uevent.uobject,UVERBS_LOOKUP_READ ); -if (ind_tbl) +if (!IS_ERR_OR_NULL (ind_tbl))uobj_put_obj_read (ind_tbl);uobj_alloc_abort (&obj->uevent.uobject, attrs);
@@ -1653,8 +1661,8 @@ static int ib_uverbs_query_qp(struct uverbs_attr_bundle *attrs) } qp =uobj_get_obj_read (qp,UVERBS_OBJECT_QP , cmd.qp_handle, attrs); -if (!qp) { - ret = -EINVAL ; +if (IS_ERR (qp)) { + ret =PTR_ERR (qp); goto out; }
@@ -1759,8 +1767,8 @@ static int modify_qp(struct uverbs_attr_bundle *attrs, qp =uobj_get_obj_read (qp,UVERBS_OBJECT_QP , cmd->base.qp_handle, attrs); -if (!qp) { - ret = -EINVAL ; +if (IS_ERR (qp)) { + ret =PTR_ERR (qp); goto out; }
@@ -2026,8 +2034,8 @@ static int ib_uverbs_post_send(struct uverbs_attr_bundle *attrs)return -ENOMEM ; qp =uobj_get_obj_read (qp,UVERBS_OBJECT_QP , cmd.qp_handle, attrs); -if (!qp) { - ret = -EINVAL ; +if (IS_ERR (qp)) { + ret =PTR_ERR (qp); goto out; }
@@ -2064,9 +2072,9 @@ static int ib_uverbs_post_send(struct uverbs_attr_bundle *attrs) ud->ah =uobj_get_obj_read (ah,UVERBS_OBJECT_AH , user_wr->wr.ud.ah, attrs); -if (!ud->ah) { +if (IS_ERR (ud->ah)) { + ret =PTR_ERR (ud->ah);kfree (ud); - ret = -EINVAL ; goto out_put; } ud->remote_qpn = user_wr->wr.ud.remote_qpn;
@@ -2303,8 +2311,8 @@ static int ib_uverbs_post_recv(struct uverbs_attr_bundle *attrs)return PTR_ERR (wr); qp =uobj_get_obj_read (qp,UVERBS_OBJECT_QP , cmd.qp_handle, attrs); -if (!qp) { - ret = -EINVAL ; +if (IS_ERR (qp)) { + ret =PTR_ERR (qp); goto out; }
@@ -2354,8 +2362,8 @@ static int ib_uverbs_post_srq_recv(struct uverbs_attr_bundle *attrs)return PTR_ERR (wr); srq =uobj_get_obj_read (srq,UVERBS_OBJECT_SRQ , cmd.srq_handle, attrs); -if (!srq) { - ret = -EINVAL ; +if (IS_ERR (srq)) { + ret =PTR_ERR (srq); goto out; }
@@ -2411,8 +2419,8 @@ static int ib_uverbs_create_ah(struct uverbs_attr_bundle *attrs) } pd =uobj_get_obj_read (pd,UVERBS_OBJECT_PD , cmd.pd_handle, attrs); -if (!pd) { - ret = -EINVAL ; +if (IS_ERR (pd)) { + ret =PTR_ERR (pd); goto err; }
@@ -2481,8 +2489,8 @@ static int ib_uverbs_attach_mcast(struct uverbs_attr_bundle *attrs)return ret; qp =uobj_get_obj_read (qp,UVERBS_OBJECT_QP , cmd.qp_handle, attrs); -if (!qp) -return -EINVAL ; +if (IS_ERR (qp)) +return PTR_ERR (qp); obj = qp->uobject;
@@ -2531,8 +2539,8 @@ static int ib_uverbs_detach_mcast(struct uverbs_attr_bundle *attrs)return ret; qp =uobj_get_obj_read (qp,UVERBS_OBJECT_QP , cmd.qp_handle, attrs); -if (!qp) -return -EINVAL ; +if (IS_ERR (qp)) +return PTR_ERR (qp); obj = qp->uobject;mutex_lock (&obj->mcast_lock);
@@ -2666,8 +2674,8 @@ static int kern_spec_to_ib_spec_action(struct uverbs_attr_bundle *attrs,UVERBS_OBJECT_FLOW_ACTION , kern_spec->action.handle, attrs); -if (!ib_spec->action.act) -return -EINVAL ; +if (IS_ERR (ib_spec->action.act)) +return PTR_ERR (ib_spec->action.act); ib_spec->action.size =sizeof (struct ib_flow_spec_action_handle ); flow_resources_add(uflow_res,
@@ -2684,8 +2692,8 @@ static int kern_spec_to_ib_spec_action(struct uverbs_attr_bundle *attrs,UVERBS_OBJECT_COUNTERS , kern_spec->flow_count.handle, attrs); -if (!ib_spec->flow_count.counters) -return -EINVAL ; +if (IS_ERR (ib_spec->flow_count.counters)) +return PTR_ERR (ib_spec->flow_count.counters); ib_spec->flow_count.size =sizeof (struct ib_flow_spec_action_count ); flow_resources_add(uflow_res,
@@ -2903,14 +2911,14 @@ static int ib_uverbs_ex_create_wq(struct uverbs_attr_bundle *attrs)return PTR_ERR (obj); pd =uobj_get_obj_read (pd,UVERBS_OBJECT_PD , cmd.pd_handle, attrs); -if (!pd) { - err = -EINVAL ; +if (IS_ERR (pd)) { + err =PTR_ERR (pd); goto err_uobj; } cq =uobj_get_obj_read (cq,UVERBS_OBJECT_CQ , cmd.cq_handle, attrs); -if (!cq) { - err = -EINVAL ; +if (IS_ERR (cq)) { + err =PTR_ERR (cq); goto err_put_pd; }
@@ -3011,8 +3019,8 @@ static int ib_uverbs_ex_modify_wq(struct uverbs_attr_bundle *attrs)return -EINVAL ; wq =uobj_get_obj_read (wq,UVERBS_OBJECT_WQ , cmd.wq_handle, attrs); -if (!wq) -return -EINVAL ; +if (IS_ERR (wq)) +return PTR_ERR (wq);if (cmd.attr_mask &IB_WQ_FLAGS ) { wq_attr.flags = cmd.flags;
@@ -3095,8 +3103,8 @@ static int ib_uverbs_ex_create_rwq_ind_table(struct uverbs_attr_bundle *attrs) num_read_wqs++) { wq =uobj_get_obj_read (wq,UVERBS_OBJECT_WQ , wqs_handles[num_read_wqs], attrs); -if (!wq) { - err = -EINVAL ; +if (IS_ERR (wq)) { + err =PTR_ERR (wq); goto put_wqs; }
@@ -3251,8 +3259,8 @@ static int ib_uverbs_ex_create_flow(struct uverbs_attr_bundle *attrs) } qp =uobj_get_obj_read (qp,UVERBS_OBJECT_QP , cmd.qp_handle, attrs); -if (!qp) { - err = -EINVAL ; +if (IS_ERR (qp)) { + err =PTR_ERR (qp); goto err_uobj; }
@@ -3398,15 +3406,15 @@ static int __uverbs_create_xsrq(struct uverbs_attr_bundle *attrs,if (ib_srq_has_cq (cmd->srq_type)) { attr.ext.cq =uobj_get_obj_read (cq,UVERBS_OBJECT_CQ , cmd->cq_handle, attrs); -if (!attr.ext.cq) { - ret = -EINVAL ; +if (IS_ERR (attr.ext.cq)) { + ret =PTR_ERR (attr.ext.cq); goto err_put_xrcd; } } pd =uobj_get_obj_read (pd,UVERBS_OBJECT_PD , cmd->pd_handle, attrs); -if (!pd) { - ret = -EINVAL ; +if (IS_ERR (pd)) { + ret =PTR_ERR (pd); goto err_put_cq; }
@@ -3513,8 +3521,8 @@ static int ib_uverbs_modify_srq(struct uverbs_attr_bundle *attrs)return ret; srq =uobj_get_obj_read (srq,UVERBS_OBJECT_SRQ , cmd.srq_handle, attrs); -if (!srq) -return -EINVAL ; +if (IS_ERR (srq)) +return PTR_ERR (srq); attr.max_wr = cmd.max_wr; attr.srq_limit = cmd.srq_limit;
@@ -3541,8 +3549,8 @@ static int ib_uverbs_query_srq(struct uverbs_attr_bundle *attrs)return ret; srq =uobj_get_obj_read (srq,UVERBS_OBJECT_SRQ , cmd.srq_handle, attrs); -if (!srq) -return -EINVAL ; +if (IS_ERR (srq)) +return PTR_ERR (srq); ret =ib_query_srq (srq, &attr);
@@ -3667,8 +3675,8 @@ static int ib_uverbs_ex_modify_cq(struct uverbs_attr_bundle *attrs)return -EOPNOTSUPP ; cq =uobj_get_obj_read (cq,UVERBS_OBJECT_CQ , cmd.cq_handle, attrs); -if (!cq) -return -EINVAL ; +if (IS_ERR (cq)) +return PTR_ERR (cq); ret =rdma_set_cq_moderation (cq, cmd.attr.cq_count, cmd.attr.cq_period);
include/rdma/uverbs_std_types.h +1 -1
@@ -34,7 +34,7 @@static inline void *_uobj_get_obj_read (struct ib_uobject *uobj) {if (IS_ERR (uobj)) -return NULL ; +return ERR_CAST (uobj);return uobj->object; }#define uobj_get_obj_read (_object, _type, _id, _attrs) \
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 162/642 posix-timers: Add cond_resched() to posix_timer_add() search loop
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit 5f2909c6cd13564a07ae692a95457f52295c4f22 ]
With a large number of POSIX timers the search for a valid ID might cause a soft lockup on PREEMPT_NONE/VOLUNTARY kernels.
Add cond_resched() to the loop to prevent that.
[ tglx: Split out from Eric's series ]
--- kernel/time/posix-timers.c | 1 + 1 file changed, 1 insertion(+)
kernel/time/posix-timers.c +1 -0
@@ -118,6 +118,7 @@ static int posix_timer_add(struct k_itimer *timer)return id; }spin_unlock (&hash_lock); +cond_resched (); }/* POSIX return code when no timer ID could be allocated */ return -EAGAIN ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 163/642 posix-timers: Ensure that timer initialization is fully visible
In reply to Sasha LevinFrom: Thomas Gleixner <[email protected]>
[ Upstream commit 2389c6efd3ad8edb3bcce0019b4edcc7d9c7de19 ]
Frederic pointed out that the memory operations to initialize the timer are not guaranteed to be visible, when __lock_timer() observes timer::it_signal valid under timer::it_lock:
T0 T1
--------- -----------
do_timer_create()
// A
new_timer->.... = ....
spin_lock(current->sighand)
// B
WRITE_ONCE(new_timer->it_signal, current->signal)
spin_unlock(current->sighand)
sys_timer_*()
t = __lock_timer()
spin_lock(&timr->it_lock)
// observes B
if (timr->it_signal == current->signal)
return timr;
if (!t)
return;
// Is not guaranteed to observe AProtect the write of timer::it_signal, which makes the timer valid, with timer::it_lock as well. This guarantees that T1 must observe the initialization A completely, when it observes the valid signal pointer under timer::it_lock. sighand::siglock must still be taken to protect the signal::posix_timers list.
--- kernel/time/posix-timers.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
kernel/time/posix-timers.c +14 -7
@@ -463,14 +463,21 @@ static int do_timer_create(clockid_t which_clock, struct sigevent *event,if (error) goto out; -spin_lock_irq (¤t->sighand->siglock); -/* This makes the timer valid in the hash table */ -WRITE_ONCE (new_timer->it_signal, current->signal); -hlist_add_head (&new_timer->list, ¤t->signal->posix_timers); -spin_unlock_irq (¤t->sighand->siglock);/* -* After unlocking sighand::siglock @new_timer is subject to -* concurrent removal and cannot be touched anymore +* timer::it_lock ensures that __lock_timer() observes a fully +* initialized timer when it observes a valid timer::it_signal. +* +* sighand::siglock is required to protect signal::posix_timers. +*/ + scoped_guard (spinlock_irq, &new_timer->it_lock) { +guard (spinlock)(¤t->sighand->siglock); +/* This makes the timer valid in the hash table */ +WRITE_ONCE (new_timer->it_signal, current->signal); +hlist_add_head (&new_timer->list, ¤t->signal->posix_timers); + } +/* +* After unlocking @new_timer is subject to concurrent removal and +* cannot be touched anymore */ return 0 ; out:
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 164/642 net: stmmac: dwmac-rk: Validate GRF and peripheral GRF during probe
In reply to Sasha LevinFrom: Jonas Karlman <[email protected]>
[ Upstream commit 247e84f66a3d1946193d739fec5dc3d69833fd00 ]
All Rockchip GMAC variants typically write to GRF regs to control e.g. interface mode, speed and MAC rx/tx delay. Newer SoCs such as RK3576 and RK3588 use a mix of GRF and peripheral GRF regs. These syscon regmaps is located with help of a rockchip,grf and rockchip,php-grf phandle.
However, validating the rockchip,grf and rockchip,php-grf syscon regmap is deferred until e.g. interface mode or speed is configured, inside the individual SoC specific operations.
Change to validate the rockchip,grf and rockchip,php-grf syscon regmap at probe time to simplify all SoC specific operations.
This should not introduce any backward compatibility issues as all GMAC nodes have been added together with a rockchip,grf phandle (and rockchip,php-grf where required) in their initial commit.
--- .../net/ethernet/stmicro/stmmac/dwmac-rk.c | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +19 -2
@@ -33,6 +33,7 @@ struct rk_gmac_ops {void (*set_clock_selection)(struct rk_priv_data *bsp_priv,bool input,bool enable);void (*integrated_phy_powerup)(struct rk_priv_data *bsp_priv); +bool php_grf_required;bool regs_valid;u32 regs[]; };
@@ -1254,6 +1255,7 @@ static const struct rk_gmac_ops rk3576_ops = { .set_rgmii_speed = rk3576_set_gmac_speed, .set_rmii_speed = rk3576_set_gmac_speed, .set_clock_selection = rk3576_set_clock_selection, + .php_grf_required = true, .regs_valid = true, .regs = { 0x2a220000, /* gmac0 */
@@ -1401,6 +1403,7 @@ static const struct rk_gmac_ops rk3588_ops = { .set_rgmii_speed = rk3588_set_gmac_speed, .set_rmii_speed = rk3588_set_gmac_speed, .set_clock_selection = rk3588_set_clock_selection, + .php_grf_required = true, .regs_valid = true, .regs = { 0xfe1b0000, /* gmac0 */
@@ -1812,8 +1815,22 @@ static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev, bsp_priv->grf =syscon_regmap_lookup_by_phandle (dev->of_node,"rockchip,grf" ); - bsp_priv->php_grf =syscon_regmap_lookup_by_phandle (dev->of_node, -"rockchip,php-grf" ); +if (IS_ERR (bsp_priv->grf)) { +dev_err_probe (dev,PTR_ERR (bsp_priv->grf), +"failed to lookup rockchip,grf\n" ); +return ERR_CAST (bsp_priv->grf); + } + +if (ops->php_grf_required) { + bsp_priv->php_grf = +syscon_regmap_lookup_by_phandle (dev->of_node, +"rockchip,php-grf" ); +if (IS_ERR (bsp_priv->php_grf)) { +dev_err_probe (dev,PTR_ERR (bsp_priv->php_grf), +"failed to lookup rockchip,php-grf\n" ); +return ERR_CAST (bsp_priv->php_grf); + } + }if (plat->phy_node) { bsp_priv->integrated_phy = of_property_read_bool(plat->phy_node,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 165/642 net: hsr: Fix PRP duplicate detection
In reply to Sasha LevinFrom: Jaakko Karrenpalo <[email protected]>
[ Upstream commit 05fd00e5e7b1ac60d264f72423fba38cc382b447 ]
Add PRP specific function for handling duplicate packets. This is needed because of potential L2 802.1p prioritization done by network switches.
The L2 prioritization can re-order the PRP packets from a node causing the existing implementation to discard the frame(s) that have been received 'late' because the sequence number is before the previous received packet. This can happen if the node is sending multiple frames back-to-back with different priority.
--- net/hsr/hsr_device.c | 2 + net/hsr/hsr_forward.c | 4 +- net/hsr/hsr_framereg.c | 95 ++++++++++++++++++++++++++++++++++++++++-- net/hsr/hsr_framereg.h | 8 +++- net/hsr/hsr_main.h | 2 + 5 files changed, 104 insertions(+), 7 deletions(-)
net/hsr/hsr_device.c +2 -0
@@ -616,6 +616,7 @@ static struct hsr_proto_ops hsr_ops = { .drop_frame = hsr_drop_frame, .fill_frame_info = hsr_fill_frame_info, .invalid_dan_ingress_frame = hsr_invalid_dan_ingress_frame, + .register_frame_out = hsr_register_frame_out, };static struct hsr_proto_ops prp_ops = {
@@ -626,6 +627,7 @@ static struct hsr_proto_ops prp_ops = { .fill_frame_info = prp_fill_frame_info, .handle_san_frame = prp_handle_san_frame, .update_san_info = prp_update_san_info, + .register_frame_out = prp_register_frame_out, };void hsr_dev_setup (struct net_device *dev)
net/hsr/hsr_forward.c +2 -2
@@ -536,8 +536,8 @@ static void hsr_forward_do(struct hsr_frame_info *frame)* Also for SAN, this shouldn't be done. */ if (!frame->is_from_san && -hsr_register_frame_out (port, frame->node_src, - frame->sequence_nr)) + hsr->proto_ops->register_frame_out && + hsr->proto_ops->register_frame_out (port, frame))continue ; if (frame->is_supervision && port->type == HSR_PT_MASTER &&
net/hsr/hsr_framereg.c +92 -3
121 lines not on this page · raw message
net/hsr/hsr_framereg.h +6 -2
@@ -44,8 +44,7 @@ void hsr_addr_subst_dest(struct hsr_node *node_src, struct sk_buff *skb,void hsr_register_frame_in (struct hsr_node *node,struct hsr_port *port,u16 sequence_nr); -int hsr_register_frame_out (struct hsr_port *port,struct hsr_node *node, -u16 sequence_nr); +int hsr_register_frame_out (struct hsr_port *port,struct hsr_frame_info *frame);void hsr_prune_nodes (struct timer_list *t);void hsr_prune_proxy_nodes (struct timer_list *t);
@@ -73,6 +72,8 @@ void prp_update_san_info(struct hsr_node *node, bool is_sup);bool hsr_is_node_in_db (struct list_head *node_db,const unsigned char addr[ETH_ALEN ]); +int prp_register_frame_out (struct hsr_port *port,struct hsr_frame_info *frame); +struct hsr_node {struct list_head mac_list;/* Protect R/W access to seq_out */
@@ -89,6 +90,9 @@ struct hsr_node {bool san_b;u16 seq_out[HSR_PT_PORTS ];bool removed; +/* PRP specific duplicate handling */ +u16 seq_expected[HSR_PT_PORTS ]; +u16 seq_start[HSR_PT_PORTS ];struct rcu_head rcu_head; };
net/hsr/hsr_main.h +2 -0
@@ -175,6 +175,8 @@ struct hsr_proto_ops { struct hsr_frame_info *frame);bool (*invalid_dan_ingress_frame)(__be16 protocol);void (*update_san_info)(struct hsr_node *node,bool is_sup); +int (*register_frame_out)(struct hsr_port *port, +struct hsr_frame_info *frame); };struct hsr_self_node {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 166/642 timer_list: Don't use %pK through printk()
In reply to Sasha LevinFrom: Thomas Weißschuh <[email protected]>
[ Upstream commit a52067c24ccf6ee4c85acffa0f155e9714f9adce ]
This reverts commit f590308536db ("timer debug: Hide kernel addresses via %pK in /proc/timer_list")
The timer list helper SEQ_printf() uses either the real seq_printf() for procfs output or vprintk() to print to the kernel log, when invoked from SysRq-q. It uses %pK for printing pointers.
In the past %pK was prefered over %p as it would not leak raw pointer values into the kernel log. Since commit ad67b74d2469 ("printk: hash addresses printed with %p") the regular %p has been improved to avoid this issue.
Furthermore, restricted pointers ("%pK") were never meant to be used through printk(). They can still unintentionally leak raw pointers or acquire sleeping looks in atomic contexts.
Switch to the regular pointer formatting which is safer, easier to reason about and sufficient here.
--- kernel/time/timer_list.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/time/timer_list.c +2 -2
@@ -46,7 +46,7 @@ static void print_timer(struct seq_file *m, struct hrtimer *taddr, struct hrtimer *timer, int idx, u64 now) { - SEQ_printf(m, " #%d: <%pK>, %ps", idx, taddr, timer->function); + SEQ_printf(m, " #%d: <%p>, %ps", idx, taddr, timer->function);SEQ_printf (m,", S:%02x" , timer->state);SEQ_printf (m,"\n" ); SEQ_printf(m, " # expires at %Lu-%Lu nsecs [in %Ld to %Ld nsecs]\n",
@@ -98,7 +98,7 @@ print_active_timers(struct seq_file *m, struct hrtimer_clock_base *base,static void print_base (struct seq_file *m,struct hrtimer_clock_base *base,u64 now) { -SEQ_printf (m," .base: %pK\n" , base); +SEQ_printf (m," .base: %p\n" , base);SEQ_printf (m," .index: %d\n" , base->index);SEQ_printf (m," .resolution: %u nsecs\n" , hrtimer_resolution);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 167/642 wifi: rtw89: coex: Fix coexistence report not show as expected
In reply to Sasha LevinFrom: Ching-Te Ku <[email protected]>
[ Upstream commit a36230aa5f5efceaf5f81682673732a921b91518 ]
This report will feedback some basic information from firmware(PTA counter, report counter, mailbox counter etc). And the report version need to match driver & firmware both side. The original logic break the switch case logic before driver update the report version. It made the report can not be parsed correctly. Delete the break at the version 7 and 8.
Add logic to count C2H event report.
--- drivers/net/wireless/realtek/rtw89/coex.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/realtek/rtw89/coex.c +1 -2
@@ -1372,11 +1372,9 @@ static u32 _chk_btc_report(struct rtw89_dev *rtwdev, }else if (ver->fcxbtcrpt ==8 ) { pfinfo = &pfwinfo->rpt_ctrl.finfo.v8; pcinfo->req_len =sizeof (pfwinfo->rpt_ctrl.finfo.v8); -break ; }else if (ver->fcxbtcrpt ==7 ) { pfinfo = &pfwinfo->rpt_ctrl.finfo.v7; pcinfo->req_len =sizeof (pfwinfo->rpt_ctrl.finfo.v7); -break ; }else { goto err; }
@@ -8115,6 +8113,7 @@ void rtw89_btc_c2h_handle(struct rtw89_dev *rtwdev, struct sk_buff *skb,return ; func =rtw89_btc_c2h_get_index_by_ver (rtwdev, func); + pfwinfo->cnt_c2h++;switch (func) {case BTF_EVNT_BUF_OVERFLOW :
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 168/642 wifi: rtw89: set force HE TB mode when connecting to 11ax AP
In reply to Sasha LevinFrom: Dian-Syuan Yang <[email protected]>
[ Upstream commit a9b56f219a0fa550f92e65ac58443a7892380e09 ]
Some of 11ax AP set the UL HE-SIG-A2 reserved subfield to all 0s, which will cause the 11be chip to recognize trigger frame as EHT. We propose a method to bypass the "UL HE-SIG-A2 reserved subfield" and always uses HE TB in response to the AP's trigger frame.
--- drivers/net/wireless/realtek/rtw89/mac.c | 26 +++++++++++++++++++ drivers/net/wireless/realtek/rtw89/mac.h | 2 ++ drivers/net/wireless/realtek/rtw89/mac80211.c | 1 + drivers/net/wireless/realtek/rtw89/reg.h | 4 +++ 4 files changed, 33 insertions(+)
drivers/net/wireless/realtek/rtw89/mac.c +26 -0
@@ -4826,6 +4826,32 @@ void rtw89_mac_set_he_obss_narrow_bw_ru(struct rtw89_dev *rtwdev,rtw89_write32_set (rtwdev, reg, mac->narrow_bw_ru_dis.mask); } +void rtw89_mac_set_he_tb (struct rtw89_dev *rtwdev, +struct rtw89_vif_link *rtwvif_link) +{ +struct ieee80211_bss_conf *bss_conf; +bool set; +u32 reg; + +if (rtwdev->chip->chip_gen !=RTW89_CHIP_BE ) +return ; + +rcu_read_lock (); + + bss_conf =rtw89_vif_rcu_dereference_link (rtwvif_link, true); + set = bss_conf->he_support && !bss_conf->eht_support; + +rcu_read_unlock (); + + reg =rtw89_mac_reg_by_idx (rtwdev,R_BE_CLIENT_OM_CTRL , + rtwvif_link->mac_idx); + +if (set) +rtw89_write32_set (rtwdev, reg,B_BE_TRIG_DIS_EHTTB ); +else +rtw89_write32_clr (rtwdev, reg,B_BE_TRIG_DIS_EHTTB ); +} +void rtw89_mac_stop_ap (struct rtw89_dev *rtwdev,struct rtw89_vif_link *rtwvif_link) {rtw89_mac_port_cfg_func_sw (rtwdev, rtwvif_link);
drivers/net/wireless/realtek/rtw89/mac.h +2 -0
@@ -1185,6 +1185,8 @@ void rtw89_mac_port_cfg_rx_sync(struct rtw89_dev *rtwdev, struct rtw89_vif_link *rtwvif_link, bool en);void rtw89_mac_set_he_obss_narrow_bw_ru (struct rtw89_dev *rtwdev,struct rtw89_vif_link *rtwvif_link); +void rtw89_mac_set_he_tb (struct rtw89_dev *rtwdev, +struct rtw89_vif_link *rtwvif_link);void rtw89_mac_stop_ap (struct rtw89_dev *rtwdev,struct rtw89_vif_link *rtwvif_link);void rtw89_mac_enable_beacon_for_ap_vifs (struct rtw89_dev *rtwdev,bool en);int rtw89_mac_remove_vif (struct rtw89_dev *rtwdev,struct rtw89_vif_link *vif);
drivers/net/wireless/realtek/rtw89/mac80211.c +1 -0
@@ -670,6 +670,7 @@ static void __rtw89_ops_bss_link_assoc(struct rtw89_dev *rtwdev,rtw89_chip_cfg_txpwr_ul_tb_offset (rtwdev, rtwvif_link);rtw89_mac_port_update (rtwdev, rtwvif_link);rtw89_mac_set_he_obss_narrow_bw_ru (rtwdev, rtwvif_link); +rtw89_mac_set_he_tb (rtwdev, rtwvif_link); } static void __rtw89_ops_bss_assoc(struct rtw89_dev *rtwdev,
drivers/net/wireless/realtek/rtw89/reg.h +4 -0
@@ -7095,6 +7095,10 @@#define B_BE_MACLBK_RDY_NUM_MASK GENMASK(7, 3)#define B_BE_MACLBK_EN BIT(0) +#define R_BE_CLIENT_OM_CTRL 0x11040 +#define R_BE_CLIENT_OM_CTRL_C1 0x15040 +#define B_BE_TRIG_DIS_EHTTB BIT(24) +#define R_BE_WMAC_NAV_CTL 0x11080#define R_BE_WMAC_NAV_CTL_C1 0x15080#define B_BE_WMAC_NAV_UPPER_EN BIT(26)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 169/642 netfilter: conntrack: Bound nf_conntrack sysctl writes
In reply to Sasha LevinFrom: Nicolas Bouchinet <[email protected]>
[ Upstream commit 8b6861390ffee6b8ed78b9395e3776c16fec6579 ]
nf_conntrack_max and nf_conntrack_expect_max sysctls were authorized to be written any negative value, which would then be stored in the unsigned int variables nf_conntrack_max and nf_ct_expect_max variables.
While the do_proc_dointvec_conv function is supposed to limit writing handled by proc_dointvec proc_handler to INT_MAX. Such a negative value being written in an unsigned int leads to a very high value, exceeding this limit.
Moreover, the nf_conntrack_expect_max sysctl documentation specifies the minimum value is 1.
The proc_handlers have thus been updated to proc_dointvec_minmax in order to specify the following write bounds :
* Bound nf_conntrack_max sysctl writings between SYSCTL_ZERO and SYSCTL_INT_MAX.
* Bound nf_conntrack_expect_max sysctl writings between SYSCTL_ONE and SYSCTL_INT_MAX as defined in the sysctl documentation.
With this patch applied, sysctl writes outside the defined in the bound will thus lead to a write error :
``` sysctl -w net.netfilter.nf_conntrack_expect_max=-1 sysctl: setting key "net.netfilter.nf_conntrack_expect_max": Invalid argument ```
--- net/netfilter/nf_conntrack_standalone.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
net/netfilter/nf_conntrack_standalone.c +9 -3
@@ -618,7 +618,9 @@ static struct ctl_table nf_ct_sysctl_table[] = { .data = &nf_conntrack_max, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_INT_MAX, }, [NF_SYSCTL_CT_COUNT] = { .procname = "nf_conntrack_count",
@@ -654,7 +656,9 @@ static struct ctl_table nf_ct_sysctl_table[] = { .data = &nf_ct_expect_max, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, + .extra1 = SYSCTL_ONE, + .extra2 = SYSCTL_INT_MAX, }, [NF_SYSCTL_CT_ACCT] = { .procname = "nf_conntrack_acct",
@@ -947,7 +951,9 @@ static struct ctl_table nf_ct_netfilter_table[] = { .data = &nf_conntrack_max, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_INT_MAX, }, };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 170/642 PNP: Expand length of fixup id string
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit 425b1c97b07f2290700f708edabef32861e2b2db ]
GCC 15's -Wunterminated-string-initialization saw that "id" was not including the required trailing NUL character. Instead of marking "id" with __nonstring[1], expand the length of the string as it is used in (debugging) format strings that expect a properly formed C string.
--- include/linux/pnp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/pnp.h +1 -1
@@ -290,7 +290,7 @@ static inline void pnp_set_drvdata(struct pnp_dev *pdev, void *data) }struct pnp_fixup { -char id[7 ]; +char id[8 ];void (*quirk_function) (struct pnp_dev *dev);/* fixup function */ };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 171/642 phy: rockchip: usbdp: Only verify link rates/lanes/voltage when the corresponding set flags are set
In reply to Sasha LevinFrom: Andy Yan <[email protected]>
[ Upstream commit 969a38be437b68dc9e12e3c3f08911c9f9c8be73 ]
According documentation of phy_configure_opts_dp, at the configure stage, link rates should only be verify/configure when set_rate flag is set, the same applies to lanes and voltage.
So do it as the documentation says.
Because voltage setting depends on the lanes, link rates set previously, so record the link rates and lanes at it's verify stage.
--- drivers/phy/rockchip/phy-rockchip-usbdp.c | 87 ++++++++++++++--------- 1 file changed, 53 insertions(+), 34 deletions(-)
drivers/phy/rockchip/phy-rockchip-usbdp.c +53 -34
@@ -187,6 +187,8 @@ struct rk_udphy {u32 dp_aux_din_sel;bool dp_sink_hpd_sel;bool dp_sink_hpd_cfg; +unsigned int link_rate; +unsigned int lanes;u8 bw;int id;
@@ -1102,15 +1104,19 @@ static int rk_udphy_dp_phy_power_off(struct phy *phy)return 0 ; } -static int rk_udphy_dp_phy_verify_link_rate (unsigned int link_rate) +/* +* Verify link rate +*/ +static int rk_udphy_dp_phy_verify_link_rate (struct rk_udphy *udphy, +struct phy_configure_opts_dp *dp) { -switch (link_rate) { +switch (dp->link_rate) {case 1620 :case 2700 :case 5400 :case 8100 : + udphy->link_rate = dp->link_rate;break ; -default :return -EINVAL ; }
@@ -1118,45 +1124,44 @@ static int rk_udphy_dp_phy_verify_link_rate(unsigned int link_rate)return 0 ; } -static int rk_udphy_dp_phy_verify_config (struct rk_udphy *udphy, -struct phy_configure_opts_dp *dp) +static int rk_udphy_dp_phy_verify_lanes (struct rk_udphy *udphy, +struct phy_configure_opts_dp *dp) { -int i, ret; - -/* If changing link rate was required, verify it's supported. */ - ret =rk_udphy_dp_phy_verify_link_rate (dp->link_rate); -if (ret) -return ret; - -/* Verify lane count. */ switch (dp->lanes) {case 1 :case 2 :case 4 :/* valid lane count. */ + udphy->lanes = dp->lanes;break ;default :return -EINVAL ; } -/* -* If changing voltages is required, check swing and pre-emphasis -* levels, per-lane. -*/ -if (dp->set_voltages) { -/* Lane count verified previously. */ -for (i =0 ; i < dp->lanes; i++) { -if (dp->voltage[i] >3 || dp->pre[i] >3 ) -return -EINVAL ; +return 0 ; +} -/* -* Sum of voltage swing and pre-emphasis levels cannot -* exceed 3. -*/ -if (dp->voltage[i] + dp->pre[i] >3 ) -return -EINVAL ; - } +/* +* If changing voltages is required, check swing and pre-emphasis +* levels, per-lane. +*/ +static int rk_udphy_dp_phy_verify_voltages (struct rk_udphy *udphy, +struct phy_configure_opts_dp *dp) +{ +int i; + +/* Lane count verified previously. */ +for (i =0 ; i < udphy->lanes; i++) { +if (dp->voltage[i] >3 || dp->pre[i] >3 ) +return -EINVAL ; + +/* +* Sum of voltage swing and pre-emphasis levels cannot +* exceed 3. +*/ +if (dp->voltage[i] + dp->pre[i] >3 ) +return -EINVAL ; }return 0 ;
@@ -1196,9 +1201,23 @@ static int rk_udphy_dp_phy_configure(struct phy *phy,u32 i, val, lane;int ret; - ret =rk_udphy_dp_phy_verify_config (udphy, dp); -if (ret) -return ret; +if (dp->set_rate) { + ret =rk_udphy_dp_phy_verify_link_rate (udphy, dp); +if (ret) +return ret; + } + +if (dp->set_lanes) { + ret =rk_udphy_dp_phy_verify_lanes (udphy, dp); +if (ret) +return ret; + } + +if (dp->set_voltages) { + ret =rk_udphy_dp_phy_verify_voltages (udphy, dp); +if (ret) +return ret; + }if (dp->set_rate) { regmap_update_bits(udphy->pma_regmap, CMN_DP_RSTN_OFFSET,
@@ -1243,9 +1262,9 @@ static int rk_udphy_dp_phy_configure(struct phy *phy, }if (dp->set_voltages) { -for (i =0 ; i < dp->lanes; i++) { +for (i =0 ; i < udphy->lanes; i++) { lane = udphy->dp_lane_sel[i]; -switch (dp->link_rate) { +switch (udphy->link_rate) {case 1620 :case 2700 : regmap_update_bits(udphy->pma_regmap,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 172/642 arm64/mm: Check pmd_table() in pmd_trans_huge()
In reply to Sasha LevinFrom: Ryan Roberts <[email protected]>
[ Upstream commit d1770e909898c108e8c7d30ca039053e8818a9c9 ]
Check for pmd_table() in pmd_trans_huge() rather then just checking for the PMD_TABLE_BIT. But ensure all present-invalid entries are handled correctly by always setting PTE_VALID before checking with pmd_table().
--- arch/arm64/include/asm/pgtable.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
arch/arm64/include/asm/pgtable.h +12 -12
@@ -548,18 +548,6 @@ static inline int pmd_protnone(pmd_t pmd)#endif #define pmd_present (pmd) pte_present(pmd_pte(pmd)) - -/* -* THP definitions. -*/ - -#ifdef CONFIG_TRANSPARENT_HUGEPAGE -static inline int pmd_trans_huge (pmd_t pmd) -{ -return pmd_val (pmd) &&pmd_present (pmd) && !(pmd_val (pmd) &PMD_TABLE_BIT ); -} -#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ -#define pmd_dirty (pmd) pte_dirty(pmd_pte(pmd))#define pmd_young (pmd) pte_young(pmd_pte(pmd))#define pmd_valid (pmd) pte_valid(pmd_pte(pmd))
@@ -724,6 +712,18 @@ extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,#define pmd_leaf_size (pmd) (pmd_cont(pmd) ? CONT_PMD_SIZE : PMD_SIZE)#define pte_leaf_size (pte) (pte_cont(pte) ? CONT_PTE_SIZE : PAGE_SIZE) +#ifdef CONFIG_TRANSPARENT_HUGEPAGE +static inline int pmd_trans_huge (pmd_t pmd) +{ +/* +* If pmd is present-invalid, pmd_table() won't detect it +* as a table, so force the valid bit for the comparison. +*/ +return pmd_val (pmd) &&pmd_present (pmd) && + !pmd_table (__pmd (pmd_val (pmd) |PTE_VALID )); +} +#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ +#if defined(CONFIG_ARM64_64K_PAGES ) ||CONFIG_PGTABLE_LEVELS <3 static inline bool pud_sect (pud_t pud) {return false; }static inline bool pud_table (pud_t pud) {return true; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 173/642 arm64/mm: Check PUD_TYPE_TABLE in pud_bad()
In reply to Sasha LevinFrom: Ryan Roberts <[email protected]>
[ Upstream commit bfb1d2b9021c21891427acc86eb848ccedeb274e ]
pud_bad() is currently defined in terms of pud_table(). Although for some configs, pud_table() is hard-coded to true i.e. when using 64K base pages or when page table levels are less than 3.
pud_bad() is intended to check that the pud is configured correctly. Hence let's open-code the same check that the full version of pud_table() uses into pud_bad(). Then it always performs the check regardless of the config.
--- arch/arm64/include/asm/pgtable.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/include/asm/pgtable.h +2 -1
@@ -805,7 +805,8 @@ static inline unsigned long pmd_page_vaddr(pmd_t pmd) pr_err("%s:%d: bad pmd %016llx.\n", __FILE__, __LINE__, pmd_val(e))#define pud_none (pud) (!pud_val(pud)) -#define pud_bad (pud) (!pud_table(pud)) +#define pud_bad (pud) ((pud_val(pud) & PUD_TYPE_MASK) != \ + PUD_TYPE_TABLE)#define pud_present (pud) pte_present(pud_pte(pud))#ifndef __PAGETABLE_PMD_FOLDED#define pud_leaf (pud) (pud_present(pud) && !pud_table(pud))
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 174/642 mmc: dw_mmc: add exynos7870 DW MMC support
In reply to Sasha LevinFrom: Kaustabh Chakraborty <[email protected]>
[ Upstream commit 7cbe799ac10fd8be85af5e0615c4337f81e575f3 ]
Add support for Exynos7870 DW MMC controllers, for both SMU and non-SMU variants. These controllers require a quirk to access 64-bit FIFO in 32-bit accesses (DW_MMC_QUIRK_FIFO64_32).
--- drivers/mmc/host/dw_mmc-exynos.c | 41 +++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-)
drivers/mmc/host/dw_mmc-exynos.c +40 -1
@@ -27,6 +27,8 @@ enum dw_mci_exynos_type {DW_MCI_TYPE_EXYNOS5420_SMU ,DW_MCI_TYPE_EXYNOS7 ,DW_MCI_TYPE_EXYNOS7_SMU , +DW_MCI_TYPE_EXYNOS7870 , +DW_MCI_TYPE_EXYNOS7870_SMU , DW_MCI_TYPE_ARTPEC8, };
@@ -69,6 +71,12 @@ static struct dw_mci_exynos_compatible { }, { .compatible = "samsung,exynos7-dw-mshc-smu", .ctrl_type = DW_MCI_TYPE_EXYNOS7_SMU, + }, { + .compatible = "samsung,exynos7870-dw-mshc", + .ctrl_type = DW_MCI_TYPE_EXYNOS7870, + }, { + .compatible = "samsung,exynos7870-dw-mshc-smu", + .ctrl_type = DW_MCI_TYPE_EXYNOS7870_SMU, }, { .compatible = "axis,artpec8-dw-mshc", .ctrl_type = DW_MCI_TYPE_ARTPEC8,
@@ -85,6 +93,8 @@ static inline u8 dw_mci_exynos_get_ciu_div(struct dw_mci *host)return EXYNOS4210_FIXED_CIU_CLK_DIV ; else if (priv->ctrl_type == DW_MCI_TYPE_EXYNOS7 || priv->ctrl_type == DW_MCI_TYPE_EXYNOS7_SMU || + priv->ctrl_type == DW_MCI_TYPE_EXYNOS7870 || + priv->ctrl_type == DW_MCI_TYPE_EXYNOS7870_SMU || priv->ctrl_type == DW_MCI_TYPE_ARTPEC8) return SDMMC_CLKSEL_GET_DIV(mci_readl(host, CLKSEL64)) + 1; else
@@ -100,7 +110,8 @@ static void dw_mci_exynos_config_smu(struct dw_mci *host)* set for non-ecryption mode at this time. */ if (priv->ctrl_type ==DW_MCI_TYPE_EXYNOS5420_SMU || - priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7_SMU ) { + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7_SMU || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870_SMU ) {mci_writel (host,MPSBEGIN0 ,0 );mci_writel (host,MPSEND0 ,SDMMC_ENDING_SEC_NR_MAX ); mci_writel(host, MPSCTRL0, SDMMC_MPSCTRL_SECURE_WRITE_BIT |
@@ -126,6 +137,12 @@ static int dw_mci_exynos_priv_init(struct dw_mci *host)DQS_CTRL_GET_RD_DELAY (priv->saved_strobe_ctrl); } +if (priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870 || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870_SMU ) { +/* Quirk needed for certain Exynos SoCs */ + host->quirks |=DW_MMC_QUIRK_FIFO64_32 ; + } +if (priv->ctrl_type ==DW_MCI_TYPE_ARTPEC8 ) {/* Quirk needed for the ARTPEC-8 SoC */ host->quirks |=DW_MMC_QUIRK_EXTENDED_TMOUT ;
@@ -143,6 +160,8 @@ static void dw_mci_exynos_set_clksel_timing(struct dw_mci *host, u32 timing)if (priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7 || priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7_SMU || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870 || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870_SMU || priv->ctrl_type ==DW_MCI_TYPE_ARTPEC8 ) clksel =mci_readl (host,CLKSEL64 );else
@@ -152,6 +171,8 @@ static void dw_mci_exynos_set_clksel_timing(struct dw_mci *host, u32 timing)if (priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7 || priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7_SMU || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870 || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870_SMU || priv->ctrl_type ==DW_MCI_TYPE_ARTPEC8 )mci_writel (host,CLKSEL64 , clksel);else
@@ -222,6 +243,8 @@ static int dw_mci_exynos_resume_noirq(struct device *dev)if (priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7 || priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7_SMU || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870 || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870_SMU || priv->ctrl_type ==DW_MCI_TYPE_ARTPEC8 ) clksel =mci_readl (host,CLKSEL64 );else
@@ -230,6 +253,8 @@ static int dw_mci_exynos_resume_noirq(struct device *dev)if (clksel &SDMMC_CLKSEL_WAKEUP_INT ) {if (priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7 || priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7_SMU || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870 || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870_SMU || priv->ctrl_type ==DW_MCI_TYPE_ARTPEC8 )mci_writel (host,CLKSEL64 , clksel);else
@@ -409,6 +434,8 @@ static inline u8 dw_mci_exynos_get_clksmpl(struct dw_mci *host)if (priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7 || priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7_SMU || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870 || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870_SMU || priv->ctrl_type ==DW_MCI_TYPE_ARTPEC8 )return SDMMC_CLKSEL_CCLK_SAMPLE (mci_readl (host,CLKSEL64 ));else
@@ -422,6 +449,8 @@ static inline void dw_mci_exynos_set_clksmpl(struct dw_mci *host, u8 sample)if (priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7 || priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7_SMU || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870 || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870_SMU || priv->ctrl_type ==DW_MCI_TYPE_ARTPEC8 ) clksel =mci_readl (host,CLKSEL64 );else
@@ -429,6 +458,8 @@ static inline void dw_mci_exynos_set_clksmpl(struct dw_mci *host, u8 sample) clksel =SDMMC_CLKSEL_UP_SAMPLE (clksel, sample);if (priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7 || priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7_SMU || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870 || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870_SMU || priv->ctrl_type ==DW_MCI_TYPE_ARTPEC8 )mci_writel (host,CLKSEL64 , clksel);else
@@ -443,6 +474,8 @@ static inline u8 dw_mci_exynos_move_next_clksmpl(struct dw_mci *host)if (priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7 || priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7_SMU || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870 || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870_SMU || priv->ctrl_type ==DW_MCI_TYPE_ARTPEC8 ) clksel =mci_readl (host,CLKSEL64 );else
@@ -453,6 +486,8 @@ static inline u8 dw_mci_exynos_move_next_clksmpl(struct dw_mci *host)if (priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7 || priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7_SMU || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870 || + priv->ctrl_type ==DW_MCI_TYPE_EXYNOS7870_SMU || priv->ctrl_type ==DW_MCI_TYPE_ARTPEC8 )mci_writel (host,CLKSEL64 , clksel);else
@@ -632,6 +667,10 @@ static const struct of_device_id dw_mci_exynos_match[] = { .data = &exynos_drv_data, }, { .compatible = "samsung,exynos7-dw-mshc-smu", .data = &exynos_drv_data, }, + { .compatible = "samsung,exynos7870-dw-mshc", + .data = &exynos_drv_data, }, + { .compatible = "samsung,exynos7870-dw-mshc-smu", + .data = &exynos_drv_data, }, { .compatible = "axis,artpec8-dw-mshc", .data = &artpec_drv_data, }, {},
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 175/642 mmc: sdhci: Disable SD card clock before changing parameters
In reply to Sasha LevinFrom: Erick Shepherd <[email protected]>
[ Upstream commit fb3bbc46c94f261b6156ee863c1b06c84cf157dc ]
Per the SD Host Controller Simplified Specification v4.20 §3.2.3, change the SD card clock parameters only after first disabling the external card clock. Doing this fixes a spurious clock pulse on Baytrail and Apollo Lake SD controllers which otherwise breaks voltage switching with a specific Swissbit SD card.
--- drivers/mmc/host/sdhci.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci.c +7 -2
@@ -2065,10 +2065,15 @@ void sdhci_set_clock(struct sdhci_host *host, unsigned int clock) host->mmc->actual_clock =0 ; -sdhci_writew (host,0 ,SDHCI_CLOCK_CONTROL ); + clk =sdhci_readw (host,SDHCI_CLOCK_CONTROL ); +if (clk &SDHCI_CLOCK_CARD_EN ) +sdhci_writew (host, clk & ~SDHCI_CLOCK_CARD_EN , +SDHCI_CLOCK_CONTROL ); -if (clock ==0 ) +if (clock ==0 ) { +sdhci_writew (host,0 ,SDHCI_CLOCK_CONTROL );return ; + } clk =sdhci_calc_clk (host, clock, &host->mmc->actual_clock);sdhci_enable_clk (host, clk);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 176/642 usb: xhci: Don't change the status of stalled TDs on failed Stop EP
In reply to Sasha LevinFrom: Michal Pecio <[email protected]>
[ Upstream commit dfc88357b6b6356dadea06b2c0bc8041f5e11720 ]
When the device stalls an endpoint, current TD is assigned -EPIPE status and Reset Endpoint is queued. If a Stop Endpoint is pending at the time, it will run before Reset Endpoint and fail due to the stall. Its handler will change TD's status to -EPROTO before Reset Endpoint handler runs and initiates giveback.
Check if the stall has already been handled and don't try to do it again. Since xhci_handle_halted_endpoint() performs this check too, not overwriting td->status is the only difference.
I haven't seen this case yet, but I have seen a related one where the xHC has already executed Reset Endpoint, EP Context state is now Stopped and EP_HALTED is set. If the xHC took a bit longer to execute Reset Endpoint, said case would become this one.
--- drivers/usb/host/xhci-ring.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-ring.c +11 -1
@@ -1164,7 +1164,14 @@ static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci, int slot_id,*/ switch (GET_EP_CTX_STATE (ep_ctx)) {case EP_STATE_HALTED : -xhci_dbg (xhci,"Stop ep completion raced with stall, reset ep\n" ); +xhci_dbg (xhci,"Stop ep completion raced with stall\n" ); +/* +* If the halt happened before Stop Endpoint failed, its transfer event +* should have already been handled and Reset Endpoint should be pending. +*/ +if (ep->ep_state &EP_HALTED ) + goto reset_done; +if (ep->ep_state &EP_HAS_STREAMS ) { reset_type =EP_SOFT_RESET ; }else {
@@ -1175,8 +1182,11 @@ static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci, int slot_id, }/* reset ep, reset handler cleans up cancelled tds */ err =xhci_handle_halted_endpoint (xhci, ep, td, reset_type); +xhci_dbg (xhci,"Stop ep completion resetting ep, status %d\n" , err);if (err)break ; +reset_done: +/* Reset EP handler will clean up cancelled TDs */ ep->ep_state &= ~EP_STOP_CMD_PENDING ;return ;case EP_STATE_STOPPED :
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 177/642 wifi: iwlwifi: mvm: fix setting the TK when associated
In reply to Sasha LevinFrom: Avraham Stern <[email protected]>
[ Upstream commit 3ad61970ac9e164be1b09b46c01aa942e8966132 ]
When running secured ranging and the initiator is associated with the responder, the TK was not set in the range request command. Fix it.
--- drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/intel/iwlwifi/mvm/ftm-initiator.c +4 -0
@@ -773,7 +773,11 @@ iwl_mvm_ftm_set_secured_ranging(struct iwl_mvm *mvm, struct ieee80211_vif *vif, target.bssid = bssid; target.cipher = cipher; + target.tk =NULL ;ieee80211_iter_keys (mvm->hw, vif, iter, &target); + +if (!WARN_ON (!target.tk)) +memcpy (tk, target.tk,TK_11AZ_LEN ); }else {memcpy (tk, entry->tk,sizeof (entry->tk)); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 178/642 hwmon: (dell-smm) Increment the number of fans
In reply to Sasha LevinFrom: Kurt Borja <[email protected]>
[ Upstream commit dbcfcb239b3b452ef8782842c36fb17dd1b9092f ]
Some Alienware laptops that support the SMM interface, may have up to 4 fans.
Tested on an Alienware x15 r1.
--- Documentation/hwmon/dell-smm-hwmon.rst | 14 +++++++------- drivers/hwmon/dell-smm-hwmon.c | 5 ++++- 2 files changed, 11 insertions(+), 8 deletions(-)
Documentation/hwmon/dell-smm-hwmon.rst +7 -7
@@ -32,12 +32,12 @@ Temperature sensors and fans can be queried and set via the standard =============================== ======= ======================================= Name Perm Description =============================== ======= ======================================= -fan[1-3]_input RO Fan speed in RPM. -fan[1-3]_label RO Fan label. -fan[1-3]_min RO Minimal Fan speed in RPM -fan[1-3]_max RO Maximal Fan speed in RPM -fan[1-3]_target RO Expected Fan speed in RPM -pwm[1-3] RW Control the fan PWM duty-cycle. +fan[1-4]_input RO Fan speed in RPM. +fan[1-4]_label RO Fan label. +fan[1-4]_min RO Minimal Fan speed in RPM +fan[1-4]_max RO Maximal Fan speed in RPM +fan[1-4]_target RO Expected Fan speed in RPM +pwm[1-4] RW Control the fan PWM duty-cycle. pwm1_enable WO Enable or disable automatic BIOS fan control (not supported on all laptops, see below for details).
@@ -93,7 +93,7 @@ Again, when you find new codes, we'd be happy to have your patches! --------------------------- The driver also exports the fans as thermal cooling devices with -``type`` set to ``dell-smm-fan[1-3]``. This allows for easy fan control +``type`` set to ``dell-smm-fan[1-4]``. This allows for easy fan control using one of the thermal governors. Module parameters
drivers/hwmon/dell-smm-hwmon.c +4 -1
@@ -73,7 +73,7 @@#define DELL_SMM_LEGACY_EXECUTE 0x1#define DELL_SMM_NO_TEMP 10 -#define DELL_SMM_NO_FANS 3 +#define DELL_SMM_NO_FANS 4struct smm_regs {unsigned int eax;
@@ -1074,11 +1074,14 @@ static const struct hwmon_channel_info * const dell_smm_info[] = { HWMON_F_INPUT | HWMON_F_LABEL | HWMON_F_MIN | HWMON_F_MAX | HWMON_F_TARGET, HWMON_F_INPUT | HWMON_F_LABEL | HWMON_F_MIN | HWMON_F_MAX | + HWMON_F_TARGET, + HWMON_F_INPUT | HWMON_F_LABEL | HWMON_F_MIN | HWMON_F_MAX | HWMON_F_TARGET ),HWMON_CHANNEL_INFO (pwm,HWMON_PWM_INPUT |HWMON_PWM_ENABLE ,HWMON_PWM_INPUT , +HWMON_PWM_INPUT ,HWMON_PWM_INPUT ),NULL
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 179/642 iommu: Keep dev->iommu state consistent
In reply to Sasha LevinFrom: Robin Murphy <[email protected]>
[ Upstream commit 3832862eb9c4dfa0e80b2522bfaedbc8a43de97d ]
At the moment, if of_iommu_configure() allocates dev->iommu itself via iommu_fwspec_init(), then suffers a DT parsing failure, it cleans up the fwspec but leaves the empty dev_iommu hanging around. So far this is benign (if a tiny bit wasteful), but we'd like to be able to reason about dev->iommu having a consistent and unambiguous lifecycle. Thus make sure that the of_iommu cleanup undoes precisely whatever it did.
--- drivers/iommu/iommu-priv.h | 2 ++ drivers/iommu/iommu.c | 2 +- drivers/iommu/of_iommu.c | 6 +++++- 3 files changed, 8 insertions(+), 2 deletions(-)
drivers/iommu/iommu-priv.h +2 -0
@@ -17,6 +17,8 @@ static inline const struct iommu_ops *dev_iommu_ops(struct device *dev)return dev->iommu->iommu_dev->ops; } +void dev_iommu_free (struct device *dev); +const struct iommu_ops *iommu_ops_from_fwnode (const struct fwnode_handle *fwnode);static inline const struct iommu_ops *iommu_fwspec_ops (struct iommu_fwspec *fwspec)
drivers/iommu/iommu.c +1 -1
@@ -352,7 +352,7 @@ static struct dev_iommu *dev_iommu_get(struct device *dev)return param; } -static void dev_iommu_free (struct device *dev) +void dev_iommu_free (struct device *dev) {struct dev_iommu *param = dev->iommu;
drivers/iommu/of_iommu.c +5 -1
@@ -116,6 +116,7 @@ static void of_pci_check_device_ats(struct device *dev, struct device_node *np)int of_iommu_configure (struct device *dev,struct device_node *master_np,const u32 *id) { +bool dev_iommu_present;int err;if (!master_np)
@@ -127,6 +128,7 @@ int of_iommu_configure(struct device *dev, struct device_node *master_np,mutex_unlock (&iommu_probe_device_lock);return 0 ; } + dev_iommu_present = dev->iommu;/* * We don't currently walk up the tree looking for a parent IOMMU.
@@ -147,8 +149,10 @@ int of_iommu_configure(struct device *dev, struct device_node *master_np, err =of_iommu_configure_device (master_np, dev, id); } -if (err) +if (err && dev_iommu_present)iommu_fwspec_free (dev); +else if (err && dev->iommu) +dev_iommu_free (dev);mutex_unlock (&iommu_probe_device_lock);if (!err && dev->bus)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 180/642 printk: Check CON_SUSPEND when unblanking a console
In reply to Sasha LevinFrom: Marcos Paulo de Souza <[email protected]>
[ Upstream commit 72c96a2dacc0fb056d13a5f02b0845c4c910fe54 ]
The commit 9e70a5e109a4 ("printk: Add per-console suspended state") introduced the CON_SUSPENDED flag for consoles. The suspended consoles will stop receiving messages, so don't unblank suspended consoles because it won't be showing anything either way.
--- kernel/printk/printk.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
kernel/printk/printk.c +12 -2
@@ -3340,7 +3340,12 @@ void console_unblank(void)*/ cookie =console_srcu_read_lock ();for_each_console_srcu (c) { -if ((console_srcu_read_flags (c) &CON_ENABLED ) && c->unblank) { +short flags =console_srcu_read_flags (c); + +if (flags &CON_SUSPENDED ) +continue ; + +if ((flags &CON_ENABLED ) && c->unblank) { found_unblank = true;break ; }
@@ -3377,7 +3382,12 @@ void console_unblank(void) cookie =console_srcu_read_lock ();for_each_console_srcu (c) { -if ((console_srcu_read_flags (c) &CON_ENABLED ) && c->unblank) +short flags =console_srcu_read_flags (c); + +if (flags &CON_SUSPENDED ) +continue ; + +if ((flags &CON_ENABLED ) && c->unblank) c->unblank (); }console_srcu_read_unlock (cookie);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 181/642 wifi: iwlwifi: don't warn when if there is a FW error
In reply to Sasha LevinFrom: Miri Korenblit <[email protected]>
[ Upstream commit c7f50d0433a016d43681592836a3d484817bfb34 ]
iwl_trans_reclaim is warning if it is called when the FW is not alive. But if it is called when there is a pending restart, i.e. after a FW error, there is no need to warn, instead - return silently.
--- drivers/net/wireless/intel/iwlwifi/iwl-trans.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/iwl-trans.c +4 -1
@@ -2,7 +2,7 @@/* * Copyright (C) 2015 Intel Mobile Communications GmbH * Copyright (C) 2016-2017 Intel Deutschland GmbH -* Copyright (C) 2019-2021, 2023-2024 Intel Corporation +* Copyright (C) 2019-2021, 2023-2025 Intel Corporation */ #include <linux/kernel.h> #include <linux/bsearch.h>
@@ -641,6 +641,9 @@ IWL_EXPORT_SYMBOL(iwl_trans_tx);void iwl_trans_reclaim (struct iwl_trans *trans,int queue,int ssn,struct sk_buff_head *skbs,bool is_flush) { +if (unlikely (test_bit (STATUS_FW_ERROR , &trans->status))) +return ; +if (WARN_ONCE (trans->state !=IWL_TRANS_FW_ALIVE ,"bad state = %d\n" , trans->state))return ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 182/642 wifi: iwlwifi: w/a FW SMPS mode selection
In reply to Sasha LevinFrom: Daniel Gabay <[email protected]>
[ Upstream commit b2e709805ce955f80803b7cab3421813c79e1df4 ]
The FW is now responsible of determining the SMPS mode.
If the user disabled power save in a certain vif, we send the vif-level power command to clear out the POWER_FLAGS_POWER_MANAGEMENT_ENA_MSK bit for that vif.
But erroneously, the FW checks DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK in the device-level command to determine the SMPS mode.
To W/A this, send also the device-level command when the power save of a vif changes, and disable power save if there is any vif that has power save disabled.
--- drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 15 +++++++++++++++ .../net/wireless/intel/iwlwifi/mvm/mld-mac80211.c | 3 ++- drivers/net/wireless/intel/iwlwifi/mvm/mvm.h | 3 +++ 3 files changed, 20 insertions(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c +15 -0
@@ -4099,6 +4099,20 @@ iwl_mvm_sta_state_authorized_to_assoc(struct iwl_mvm *mvm,return 0 ; } +void iwl_mvm_smps_workaround (struct iwl_mvm *mvm,struct ieee80211_vif *vif, +bool update) +{ +struct iwl_mvm_vif *mvmvif =iwl_mvm_vif_from_mac80211 (vif); + +if (!iwl_mvm_has_rlc_offload (mvm)) +return ; + + mvmvif->ps_disabled = !vif->cfg.ps; + +if (update) +iwl_mvm_power_update_mac (mvm); +} +/* Common part for MLD and non-MLD modes */ int iwl_mvm_mac_sta_state_common(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
@@ -4191,6 +4205,7 @@ int iwl_mvm_mac_sta_state_common(struct ieee80211_hw *hw, new_state == IEEE80211_STA_AUTHORIZED) { ret =iwl_mvm_sta_state_assoc_to_authorized (mvm, vif, sta, callbacks); +iwl_mvm_smps_workaround (mvm, vif, true); } else if (old_state == IEEE80211_STA_AUTHORIZED && new_state == IEEE80211_STA_ASSOC) { ret = iwl_mvm_sta_state_authorized_to_assoc(mvm, vif, sta,
drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c +2 -1
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* -* Copyright (C) 2022-2024 Intel Corporation +* Copyright (C) 2022-2025 Intel Corporation */ #include "mvm.h"
@@ -887,6 +887,7 @@ static void iwl_mvm_mld_vif_cfg_changed_station(struct iwl_mvm *mvm, }if (changes &BSS_CHANGED_PS ) { +iwl_mvm_smps_workaround (mvm, vif, false); ret =iwl_mvm_power_update_mac (mvm);if (ret)IWL_ERR (mvm,"failed to update power mode\n" );
drivers/net/wireless/intel/iwlwifi/mvm/mvm.h +3 -0
@@ -3043,4 +3043,7 @@ iwl_mvm_send_ap_tx_power_constraint_cmd(struct iwl_mvm *mvm,struct ieee80211_vif *vif, struct ieee80211_bss_conf *bss_conf, bool is_ap); + +void iwl_mvm_smps_workaround (struct iwl_mvm *mvm,struct ieee80211_vif *vif, +bool update);#endif /* __IWL_MVM_H__ */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 183/642 wifi: iwlwifi: fix debug actions order
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit eb29b4ffafb20281624dcd2cbb768d6f30edf600 ]
The order of actions taken for debug was implemented incorrectly. Now we implemented the dump split and do the FW reset only in the middle of the dump (rather than the FW killing itself on error.) As a result, some of the actions taken when applying the config will now crash the device, so we need to fix the order.
--- drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/wireless/intel/iwlwifi/iwl-dbg-tlv.c +5 -5
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* -* Copyright (C) 2018-2024 Intel Corporation +* Copyright (C) 2018-2025 Intel Corporation */ #include <linux/firmware.h> #include "iwl-drv.h"
@@ -1372,15 +1372,15 @@ void _iwl_dbg_tlv_time_point(struct iwl_fw_runtime *fwrt,switch (tp_id) {case IWL_FW_INI_TIME_POINT_EARLY :iwl_dbg_tlv_init_cfg (fwrt); -iwl_dbg_tlv_apply_config (fwrt, conf_list);iwl_dbg_tlv_update_drams (fwrt);iwl_dbg_tlv_tp_trigger (fwrt, sync, trig_list, tp_data,NULL ); +iwl_dbg_tlv_apply_config (fwrt, conf_list);break ;case IWL_FW_INI_TIME_POINT_AFTER_ALIVE :iwl_dbg_tlv_apply_buffers (fwrt);iwl_dbg_tlv_send_hcmds (fwrt, hcmd_list); -iwl_dbg_tlv_apply_config (fwrt, conf_list);iwl_dbg_tlv_tp_trigger (fwrt, sync, trig_list, tp_data,NULL ); +iwl_dbg_tlv_apply_config (fwrt, conf_list);break ;case IWL_FW_INI_TIME_POINT_PERIODIC :iwl_dbg_tlv_set_periodic_trigs (fwrt);
@@ -1390,14 +1390,14 @@ void _iwl_dbg_tlv_time_point(struct iwl_fw_runtime *fwrt,case IWL_FW_INI_TIME_POINT_MISSED_BEACONS :case IWL_FW_INI_TIME_POINT_FW_DHC_NOTIFICATION :iwl_dbg_tlv_send_hcmds (fwrt, hcmd_list); -iwl_dbg_tlv_apply_config (fwrt, conf_list);iwl_dbg_tlv_tp_trigger (fwrt, sync, trig_list, tp_data, iwl_dbg_tlv_check_fw_pkt); +iwl_dbg_tlv_apply_config (fwrt, conf_list);break ;default :iwl_dbg_tlv_send_hcmds (fwrt, hcmd_list); -iwl_dbg_tlv_apply_config (fwrt, conf_list);iwl_dbg_tlv_tp_trigger (fwrt, sync, trig_list, tp_data,NULL ); +iwl_dbg_tlv_apply_config (fwrt, conf_list);break ; } }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 184/642 wifi: iwlwifi: mark Br device not integrated
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 5f0ab2f35a43773a0dfe1297129a8dbff906b932 ]
This is a discrete device, don't mark it as integrated. This also means we cannot set the LTR delay.
--- drivers/net/wireless/intel/iwlwifi/cfg/dr.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/wireless/intel/iwlwifi/cfg/dr.c +0 -2
@@ -148,11 +148,9 @@ const struct iwl_cfg_trans_params iwl_br_trans_cfg = { .mq_rx_supported = true, .rf_id = true, .gen2 = true, - .integrated = true, .umac_prph_offset = 0x300000, .xtal_latency = 12000, .low_latency_xtal = true, - .ltr_delay = IWL_CFG_TRANS_LTR_DELAY_2500US, };const char iwl_br_name[] ="Intel(R) TBD Br device" ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 185/642 wifi: iwlwifi: fix the ECKV UEFI variable name
In reply to Sasha LevinFrom: Emmanuel Grumbach <[email protected]>
[ Upstream commit 3ea2970b0578011ab8402ad0cff39712255f63df ]
This UEFI variable name was badly named. Fix its name and also use the right GUID to find it: we need to use the BT_WIFI (a.k.a. Common) GUID.
--- drivers/net/wireless/intel/iwlwifi/fw/uefi.c | 8 +++++--- drivers/net/wireless/intel/iwlwifi/fw/uefi.h | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-)
drivers/net/wireless/intel/iwlwifi/fw/uefi.c +5 -3
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause /* -* Copyright(c) 2021-2024 Intel Corporation +* Copyright(c) 2021-2025 Intel Corporation */ #include "iwl-drv.h"
@@ -678,8 +678,10 @@ int iwl_uefi_get_eckv(struct iwl_fw_runtime *fwrt, u32 *extl_clk)struct uefi_cnv_var_eckv *data;int ret =0 ; - data =iwl_uefi_get_verified_variable (fwrt->trans,IWL_UEFI_ECKV_NAME , -"ECKV" ,sizeof (*data),NULL ); + data =iwl_uefi_get_verified_variable_guid (fwrt->trans, + &IWL_EFI_WIFI_BT_GUID , +IWL_UEFI_ECKV_NAME , +"ECKV" ,sizeof (*data),NULL );if (IS_ERR (data))return -EINVAL ;
drivers/net/wireless/intel/iwlwifi/fw/uefi.h +2 -2
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ /* -* Copyright(c) 2021-2024 Intel Corporation +* Copyright(c) 2021-2025 Intel Corporation */ #ifndef __iwl_fw_uefi__#define __iwl_fw_uefi__
@@ -19,7 +19,7 @@#define IWL_UEFI_WTAS_NAME L"UefiCnvWlanWTAS"#define IWL_UEFI_SPLC_NAME L"UefiCnvWlanSPLC"#define IWL_UEFI_WRDD_NAME L"UefiCnvWlanWRDD" -#define IWL_UEFI_ECKV_NAME L"UefiCnvWlanECKV" +#define IWL_UEFI_ECKV_NAME L"UefiCnvCommonECKV"#define IWL_UEFI_DSM_NAME L"UefiCnvWlanGeneralCfg"#define IWL_UEFI_WBEM_NAME L"UefiCnvWlanWBEM"#define IWL_UEFI_PUNCTURING_NAME L"UefiCnvWlanPuncturing"
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 186/642 wifi: mac80211: don't include MLE in ML reconf per-STA profile
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit c3171bed65ec323803b6b73f74017f7d0fd7aa6c ]
In the multi-link reconfiguration frame, the per-STA profile for added links shouldn't include the multi-link element. Set the association ID to an invalid value, so it doesn't erroneously match the link ID if that happens to be zero.
--- net/mac80211/ieee80211_i.h | 2 +- net/mac80211/mlme.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
net/mac80211/ieee80211_i.h +1 -1
@@ -462,7 +462,7 @@ struct ieee80211_mgd_assoc_data {bool s1g;bool spp_amsdu; -unsigned int assoc_link_id; +s8 assoc_link_id;u8 fils_nonces[2 *FILS_NONCE_LEN ];u8 fils_kek[FILS_MAX_KEK_LEN ];
net/mac80211/mlme.c +2 -0
@@ -10156,6 +10156,8 @@ int ieee80211_mgd_assoc_ml_reconf(struct ieee80211_sub_if_data *sdata,if (!data)return -ENOMEM ; + data->assoc_link_id =-1 ; + uapsd_supported = true;ieee80211_ml_reconf_selectors (userspace_selectors); for (link_id = 0; link_id < IEEE80211_MLD_MAX_NUM_LINKS;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 187/642 wifi: cfg80211: Update the link address when a link is added
In reply to Sasha LevinFrom: Ilan Peer <[email protected]>
[ Upstream commit e16caea70610ed4226034dfcdaa5c43b36ff9e0a ]
When links are added, update the wireless device link addresses based on the information provided by the driver.
--- include/net/cfg80211.h | 1 + net/wireless/mlme.c | 4 ++++ 2 files changed, 5 insertions(+)
include/net/cfg80211.h +1 -0
@@ -9750,6 +9750,7 @@ struct cfg80211_mlo_reconf_done_data {u16 added_links;struct {struct cfg80211_bss *bss; +u8 *addr; } links[IEEE80211_MLD_MAX_NUM_LINKS ]; };
net/wireless/mlme.c +4 -0
@@ -1361,6 +1361,10 @@ void cfg80211_mlo_reconf_add_done(struct net_device *dev,if (data->added_links &BIT (link_id)) { wdev->links[link_id].client.current_bss =bss_from_pub (bss); + +memcpy (wdev->links[link_id].addr, + data->links[link_id].addr, +ETH_ALEN ); }else {cfg80211_unhold_bss (bss_from_pub (bss));cfg80211_put_bss (wiphy, bss);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 188/642 wifi: mac80211: fix warning on disconnect during failed ML reconf
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 0e104aa3676d020f6c442cd7fbaeb72adaaab6fc ]
If multi-link reconfiguration fails, we can disconnect with a local link already allocated but the BSS entry not assigned yet, which leads to a warning in cfg80211. Add a check to avoid the warning.
--- net/mac80211/mlme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/mlme.c +1 -1
@@ -4298,7 +4298,7 @@ static void __ieee80211_disconnect(struct ieee80211_sub_if_data *sdata)struct ieee80211_link_data *link; link =sdata_dereference (sdata->link[link_id], sdata); -if (!link) +if (!link || !link->conf->bss)continue ;cfg80211_unlink_bss (local->hw.wiphy, link->conf->bss); link->conf->bss =NULL ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 189/642 wifi: mac80211_hwsim: Fix MLD address translation
In reply to Sasha LevinFrom: Ilan Peer <[email protected]>
[ Upstream commit 65bff0be9b154621b617fc2e4bd89f1e18e97cdb ]
Do address translations only between shared links. It is possible that while an non-AP MLD station and an AP MLD station have shared links, the frame is intended to be sent on a link which is not shared (for example when sending a probe response).
--- drivers/net/wireless/virtual/mac80211_hwsim.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/net/wireless/virtual/mac80211_hwsim.c +8 -6
@@ -4,7 +4,7 @@* Copyright (c) 2008, Jouni Malinen <[email protected]> * Copyright (c) 2011, Javier Lopez <[email protected]> * Copyright (c) 2016 - 2017 Intel Deutschland GmbH -* Copyright (C) 2018 - 2024 Intel Corporation +* Copyright (C) 2018 - 2025 Intel Corporation */ /*
@@ -1983,11 +1983,13 @@ static void mac80211_hwsim_tx(struct ieee80211_hw *hw,return ; } -if (sta && sta->mlo) { -if (WARN_ON (!link_sta)) { -ieee80211_free_txskb (hw, skb); -return ; - } +/* Do address translations only between shared links. It is +* possible that while an non-AP MLD station and an AP MLD +* station have shared links, the frame is intended to be sent +* on a link which is not shared (for example when sending a +* probe response). +*/ +if (sta && sta->mlo && link_sta) {/* address translation to link addresses on TX */ ether_addr_copy (hdr->addr1, link_sta->addr);ether_addr_copy (hdr->addr2, bss_conf->addr);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 190/642 wifi: mac80211: fix U-APSD check in ML reconfiguration
In reply to Sasha LevinFrom: Johannes Berg <[email protected]>
[ Upstream commit 7a6a740be17e049a2742c76bb1dadb3d78c930d9 ]
If U-APSD isn't enabled by us, then IEEE80211_STA_UAPSD_ENABLED won't be set, but the AP can still support it in that case. Only require U-APSD from the AP if we enabled it, don't require it to be disabled on the AP if we didn't.
--- net/mac80211/mlme.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
net/mac80211/mlme.c +4 -5
@@ -10216,12 +10216,11 @@ int ieee80211_mgd_assoc_ml_reconf(struct ieee80211_sub_if_data *sdata, } } -/* Require U-APSD support to be similar to the current valid -* links -*/ -if (uapsd_supported != - !!(sdata->u.mgd.flags &IEEE80211_STA_UAPSD_ENABLED )) { +/* Require U-APSD support if we enabled it */ +if (sdata->u.mgd.flags &IEEE80211_STA_UAPSD_ENABLED && + !uapsd_supported) { err = -EINVAL ; +sdata_info (sdata,"U-APSD on but not available on (all) new links\n" ); goto err_free; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 191/642 wifi: cfg80211: allow IR in 20 MHz configurations
In reply to Sasha LevinFrom: Anjaneyulu <[email protected]>
[ Upstream commit cf4bd1608882792d4742e27a819493312904a680 ]
Some regulatory bodies doesn't allow IR (initiate radioation) on a specific subband, but allows it for channels with a bandwidth of 20 MHz. Add a channel flag that indicates that, and consider it in cfg80211_reg_check_beaconing.
While on it, fix the kernel doc of enum nl80211_reg_rule_flags and change it to use BIT().
--- include/net/cfg80211.h | 3 +++ include/uapi/linux/nl80211.h | 52 ++++++++++++++++++++---------------- net/wireless/chan.c | 8 +++++- net/wireless/nl80211.c | 4 +++ net/wireless/reg.c | 4 ++- 5 files changed, 46 insertions(+), 25 deletions(-)
include/net/cfg80211.h +3 -0
@@ -127,6 +127,8 @@ struct wiphy;* even if it is otherwise disabled. * @IEEE80211_CHAN_ALLOW_6GHZ_VLP_AP: Allow using this channel for AP operation * with very low power (VLP), even if otherwise set to NO_IR. +* @IEEE80211_CHAN_ALLOW_20MHZ_ACTIVITY: Allow activity on a 20 MHz channel, +* even if otherwise set to NO_IR. */ enum ieee80211_channel_flags {IEEE80211_CHAN_DISABLED =BIT (0 ),
@@ -155,6 +157,7 @@ enum ieee80211_channel_flags {IEEE80211_CHAN_NO_6GHZ_AFC_CLIENT =BIT (23 ),IEEE80211_CHAN_CAN_MONITOR =BIT (24 ),IEEE80211_CHAN_ALLOW_6GHZ_VLP_AP =BIT (25 ), + IEEE80211_CHAN_ALLOW_20MHZ_ACTIVITY = BIT(26), };#define IEEE80211_CHAN_NO_HT40 \
include/uapi/linux/nl80211.h +29 -23
72 lines not on this page · raw message
net/wireless/chan.c +7 -1
@@ -6,7 +6,7 @@* * Copyright 2009 Johannes Berg <[email protected]> * Copyright 2013-2014 Intel Mobile Communications GmbH -* Copyright 2018-2024 Intel Corporation +* Copyright 2018-2025 Intel Corporation */ #include <linux/export.h>
@@ -1497,6 +1497,12 @@ bool cfg80211_reg_check_beaconing(struct wiphy *wiphy,if (cfg->reg_power ==IEEE80211_REG_VLP_AP ) permitting_flags |=IEEE80211_CHAN_ALLOW_6GHZ_VLP_AP ; +if ((cfg->iftype ==NL80211_IFTYPE_P2P_GO || + cfg->iftype ==NL80211_IFTYPE_AP ) && + (chandef->width ==NL80211_CHAN_WIDTH_20_NOHT || + chandef->width ==NL80211_CHAN_WIDTH_20 )) + permitting_flags |=IEEE80211_CHAN_ALLOW_20MHZ_ACTIVITY ; +return _cfg80211_reg_can_beacon (wiphy, chandef, cfg->iftype, check_no_ir ?IEEE80211_CHAN_NO_IR :0 , permitting_flags);
net/wireless/nl80211.c +4 -0
@@ -1234,6 +1234,10 @@ static int nl80211_msg_put_channel(struct sk_buff *msg, struct wiphy *wiphy,if ((chan->flags &IEEE80211_CHAN_ALLOW_6GHZ_VLP_AP ) &&nla_put_flag (msg,NL80211_FREQUENCY_ATTR_ALLOW_6GHZ_VLP_AP )) goto nla_put_failure; +if ((chan->flags &IEEE80211_CHAN_ALLOW_20MHZ_ACTIVITY ) && +nla_put_flag (msg, +NL80211_FREQUENCY_ATTR_ALLOW_20MHZ_ACTIVITY )) + goto nla_put_failure; } if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_MAX_TX_POWER,
net/wireless/reg.c +3 -1
@@ -5,7 +5,7 @@* Copyright 2008-2011 Luis R. Rodriguez <[email protected]> * Copyright 2013-2014 Intel Mobile Communications GmbH * Copyright 2017 Intel Deutschland GmbH -* Copyright (C) 2018 - 2024 Intel Corporation +* Copyright (C) 2018 - 2025 Intel Corporation * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above
@@ -1603,6 +1603,8 @@ static u32 map_regdom_flags(u32 rd_flags) channel_flags |=IEEE80211_CHAN_PSD ;if (rd_flags &NL80211_RRF_ALLOW_6GHZ_VLP_AP ) channel_flags |=IEEE80211_CHAN_ALLOW_6GHZ_VLP_AP ; +if (rd_flags &NL80211_RRF_ALLOW_20MHZ_ACTIVITY ) + channel_flags |=IEEE80211_CHAN_ALLOW_20MHZ_ACTIVITY ;return channel_flags; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 192/642 r8169: increase max jumbo packet size on RTL8125/RTL8126
In reply to Sasha LevinFrom: Heiner Kallweit <[email protected]>
[ Upstream commit 473367a5ffe1607a61be481e2feda684eb5faea9 ]
Realtek confirmed that all RTL8125/RTL8126 chip versions support up to 16K jumbo packets. Reflect this in the driver.
Tested by Rui on RTL8125B with 12K jumbo packets.
--- drivers/net/ethernet/realtek/r8169_main.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/realtek/r8169_main.c +4 -0
@@ -89,6 +89,7 @@#define JUMBO_6K (6 * SZ_1K - VLAN_ETH_HLEN - ETH_FCS_LEN)#define JUMBO_7K (7 * SZ_1K - VLAN_ETH_HLEN - ETH_FCS_LEN)#define JUMBO_9K (9 * SZ_1K - VLAN_ETH_HLEN - ETH_FCS_LEN) +#define JUMBO_16K (SZ_16K - VLAN_ETH_HLEN - ETH_FCS_LEN) static const struct { const char *name;
@@ -5353,6 +5354,9 @@ static int rtl_jumbo_max(struct rtl8169_private *tp)/* RTL8168c */ case RTL_GIGA_MAC_VER_18 ... RTL_GIGA_MAC_VER_24:return JUMBO_6K ; +/* RTL8125/8126 */ + case RTL_GIGA_MAC_VER_61 ... RTL_GIGA_MAC_VER_71: +return JUMBO_16K ;default :return JUMBO_9K ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 193/642 ipv6: save dontfrag in cork
In reply to Sasha LevinFrom: Willem de Bruijn <[email protected]>
[ Upstream commit a18dfa9925b9ef6107ea3aa5814ca3c704d34a8a ]
When spanning datagram construction over multiple send calls using MSG_MORE, per datagram settings are configured on the first send.
That is when ip(6)_setup_cork stores these settings for subsequent use in __ip(6)_append_data and others.
The only flag that escaped this was dontfrag. As a result, a datagram could be constructed with df=0 on the first sendmsg, but df=1 on a next. Which is what cmsg_ip.sh does in an upcoming MSG_MORE test in the "diff" scenario.
Changing datagram conditions in the middle of constructing an skb makes this already complex code path even more convoluted. It is here unintentional. Bring this flag in line with expected sockopt/cmsg behavior.
And stop passing ipc6 to __ip6_append_data, to avoid such issues in the future. This is already the case for __ip_append_data.
inet6_cork had a 6 byte hole, so the 1B flag has no impact.
--- include/linux/ipv6.h | 1 + net/ipv6/ip6_output.c | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-)
include/linux/ipv6.h +1 -0
@@ -207,6 +207,7 @@ struct inet6_cork {struct ipv6_txoptions *opt;u8 hop_limit;u8 tclass; + u8 dontfrag:1; };/* struct ipv6_pinfo - ipv6 private area */
net/ipv6/ip6_output.c +5 -4
@@ -1386,6 +1386,7 @@ static int ip6_setup_cork(struct sock *sk, struct inet_cork_full *cork, } v6_cork->hop_limit = ipc6->hlimit; v6_cork->tclass = ipc6->tclass; + v6_cork->dontfrag = ipc6->dontfrag;if (rt->dst.flags &DST_XFRM_TUNNEL ) mtu =READ_ONCE (np->pmtudisc) >=IPV6_PMTUDISC_PROBE ?READ_ONCE (rt->dst.dev->mtu) :dst_mtu (&rt->dst);
@@ -1421,7 +1422,7 @@ static int __ip6_append_data(struct sock *sk,int getfrag (void *from,char *to,int offset,int len,int odd,struct sk_buff *skb), void *from, size_t length, int transhdrlen, - unsigned int flags, struct ipcm6_cookie *ipc6) + unsigned int flags) { struct sk_buff *skb, *skb_prev = NULL;struct inet_cork *cork = &cork_full->base;
@@ -1475,7 +1476,7 @@ static int __ip6_append_data(struct sock *sk,if (headersize + transhdrlen > mtu) goto emsgsize; -if (cork->length + length > mtu - headersize && ipc6->dontfrag && +if (cork->length + length > mtu - headersize && v6_cork->dontfrag && (sk->sk_protocol ==IPPROTO_UDP || sk->sk_protocol ==IPPROTO_ICMPV6 || sk->sk_protocol ==IPPROTO_RAW )) {
@@ -1855,7 +1856,7 @@ int ip6_append_data(struct sock *sk,return __ip6_append_data (sk, &sk->sk_write_queue, &inet->cork, &np->cork,sk_page_frag (sk), getfrag, - from, length, transhdrlen, flags, ipc6); + from, length, transhdrlen, flags); }EXPORT_SYMBOL_GPL (ip6_append_data);
@@ -2060,7 +2061,7 @@ struct sk_buff *ip6_make_skb(struct sock *sk, err =__ip6_append_data (sk, &queue, cork, &v6_cork, ¤t->task_frag, getfrag, from, length + exthdrlen, transhdrlen + exthdrlen, - flags, ipc6); + flags);if (err) {__ip6_flush_pending_frames (sk, &queue, cork, &v6_cork);return ERR_PTR (err);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 194/642 drm/amd/display: remove minimum Dispclk and apply oem panel timing.
In reply to Sasha LevinFrom: Charlene Liu <[email protected]>
[ Upstream commit 756e58e83e89d372b94269c0cde61fe55da76947 ]
[why & how]
1. apply oem panel timing (not only on OLED)
2. remove MIN_DPP_DISP_CLK request in driver.
This fix will apply for dcn31x but not
sync with DML's output.
--- drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c | 2 -- drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_clk_mgr.c | 2 -- drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c | 3 ++- 3 files changed, 2 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c +0 -2
@@ -194,8 +194,6 @@ static void dcn315_update_clocks(struct clk_mgr *clk_mgr_base,// workaround: Limit dppclk to 100Mhz to avoid lower eDP panel switch to plus 4K monitor underflow. if (new_clocks->dppclk_khz <MIN_DPP_DISP_CLK ) new_clocks->dppclk_khz =MIN_DPP_DISP_CLK ; -if (new_clocks->dispclk_khz <MIN_DPP_DISP_CLK ) - new_clocks->dispclk_khz =MIN_DPP_DISP_CLK ;if (should_set_clock (safe_to_lower, new_clocks->dppclk_khz, clk_mgr->base.clks.dppclk_khz)) {if (clk_mgr->base.clks.dppclk_khz > new_clocks->dppclk_khz)
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_clk_mgr.c +0 -2
@@ -201,8 +201,6 @@ static void dcn316_update_clocks(struct clk_mgr *clk_mgr_base,// workaround: Limit dppclk to 100Mhz to avoid lower eDP panel switch to plus 4K monitor underflow. if (new_clocks->dppclk_khz <100000 ) new_clocks->dppclk_khz =100000 ; -if (new_clocks->dispclk_khz <100000 ) - new_clocks->dispclk_khz =100000 ;if (should_set_clock (safe_to_lower, new_clocks->dppclk_khz, clk_mgr->base.clks.dppclk_khz)) {if (clk_mgr->base.clks.dppclk_khz > new_clocks->dppclk_khz)
drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c +2 -1
@@ -1065,7 +1065,8 @@ void dce110_edp_backlight_control(DC_LOG_DC ("edp_receiver_ready_T9 skipped\n" ); } -if (!enable && link->dpcd_sink_ext_caps.bits.oled) { +if (!enable) { +/*follow oem panel config's requirement*/ pre_T11_delay += link->panel_config.pps.extra_pre_t11_ms;msleep (pre_T11_delay); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 195/642 drm/amd/display: calculate the remain segments for all pipes
In reply to Sasha LevinFrom: Zhikai Zhai <[email protected]>
[ Upstream commit d3069feecdb5542604d29b59acfd1fd213bad95b ]
[WHY]
In some cases the remain de-tile buffer segments will be greater than zero if we don't add the non-top pipe to calculate, at this time the override de-tile buffer size will be valid and used. But it makes the de-tile buffer segments used finally for all of pipes exceed the maximum.
[HOW]
Add the non-top pipe to calculate the remain de-tile buffer segments. Don't set override size to use the average according to pipe count if the value exceed the maximum.
--- .../dc/resource/dcn315/dcn315_resource.c | 42 +++++++++---------- 1 file changed, 20 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/display/dc/resource/dcn315/dcn315_resource.c +20 -22
@@ -1698,7 +1698,7 @@ static int dcn315_populate_dml_pipes_from_context( pipes[pipe_cnt].dout.dsc_input_bpc =0 ;DC_FP_START ();dcn31_zero_pipe_dcc_fraction (pipes, pipe_cnt); -if (pixel_rate_crb && !pipe->top_pipe && !pipe->prev_odm_pipe) { +if (pixel_rate_crb) {int bpp =source_format_to_bpp (pipes[pipe_cnt].pipe.src.source_format);/* Ceil to crb segment size */ int approx_det_segs_required_for_pstate = dcn_get_approx_det_segs_required_for_pstate(
@@ -1755,28 +1755,26 @@ static int dcn315_populate_dml_pipes_from_context(continue ; } -if (!pipe->top_pipe && !pipe->prev_odm_pipe) { -bool split_required = pipe->stream->timing.pix_clk_100hz >=dcn_get_max_non_odm_pix_rate_100hz (&dc->dml.soc) - || (pipe->plane_state && pipe->plane_state->src_rect.width >5120 ); - -if (remaining_det_segs >MIN_RESERVED_DET_SEGS && crb_pipes !=0 ) - pipes[pipe_cnt].pipe.src.det_size_override += (remaining_det_segs -MIN_RESERVED_DET_SEGS ) / crb_pipes + - (crb_idx < (remaining_det_segs -MIN_RESERVED_DET_SEGS ) % crb_pipes ?1 :0 ); -if (pipes[pipe_cnt].pipe.src.det_size_override >2 *DCN3_15_MAX_DET_SEGS ) { -/* Clamp to 2 pipe split max det segments */ - remaining_det_segs += pipes[pipe_cnt].pipe.src.det_size_override -2 * (DCN3_15_MAX_DET_SEGS ); - pipes[pipe_cnt].pipe.src.det_size_override =2 *DCN3_15_MAX_DET_SEGS ; - } -if (pipes[pipe_cnt].pipe.src.det_size_override >DCN3_15_MAX_DET_SEGS || split_required) { -/* If we are splitting we must have an even number of segments */ - remaining_det_segs += pipes[pipe_cnt].pipe.src.det_size_override %2 ; - pipes[pipe_cnt].pipe.src.det_size_override -= pipes[pipe_cnt].pipe.src.det_size_override %2 ; - } -/* Convert segments into size for DML use */ - pipes[pipe_cnt].pipe.src.det_size_override *=DCN3_15_CRB_SEGMENT_SIZE_KB ; - - crb_idx++; +bool split_required = pipe->stream->timing.pix_clk_100hz >=dcn_get_max_non_odm_pix_rate_100hz (&dc->dml.soc) + || (pipe->plane_state && pipe->plane_state->src_rect.width >5120 ); + +if (remaining_det_segs >MIN_RESERVED_DET_SEGS && crb_pipes !=0 ) + pipes[pipe_cnt].pipe.src.det_size_override += (remaining_det_segs -MIN_RESERVED_DET_SEGS ) / crb_pipes + + (crb_idx < (remaining_det_segs -MIN_RESERVED_DET_SEGS ) % crb_pipes ?1 :0 ); +if (pipes[pipe_cnt].pipe.src.det_size_override >2 *DCN3_15_MAX_DET_SEGS ) { +/* Clamp to 2 pipe split max det segments */ + remaining_det_segs += pipes[pipe_cnt].pipe.src.det_size_override -2 * (DCN3_15_MAX_DET_SEGS ); + pipes[pipe_cnt].pipe.src.det_size_override =2 *DCN3_15_MAX_DET_SEGS ; + } +if (pipes[pipe_cnt].pipe.src.det_size_override >DCN3_15_MAX_DET_SEGS || split_required) { +/* If we are splitting we must have an even number of segments */ + remaining_det_segs += pipes[pipe_cnt].pipe.src.det_size_override %2 ; + pipes[pipe_cnt].pipe.src.det_size_override -= pipes[pipe_cnt].pipe.src.det_size_override %2 ; } +/* Convert segments into size for DML use */ + pipes[pipe_cnt].pipe.src.det_size_override *=DCN3_15_CRB_SEGMENT_SIZE_KB ; + + crb_idx++; pipe_cnt++; } }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 196/642 drm/amd/display: not abort link train when bw is low
In reply to Sasha LevinFrom: Peichen Huang <[email protected]>
[ Upstream commit 8a21da2842bb22b2b80e5902d0438030d729bfd3 ]
[WHY]
DP tunneling should not abort link train even bandwidth become too low after downgrade. Otherwise, it would fail compliance test.
[HOW}
Do link train with downgrade settings even bandwidth is not enough
--- .../gpu/drm/amd/display/dc/link/protocols/link_dp_training.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_training.c +1 -4
@@ -1782,13 +1782,10 @@ bool perform_link_training_with_retries( is_link_bw_min = ((cur_link_settings.link_rate <=LINK_RATE_LOW ) && (cur_link_settings.lane_count <=LANE_COUNT_ONE )); -if (is_link_bw_low) { +if (is_link_bw_low)DC_LOG_WARNING ("%s: Link(%d) bandwidth too low after fallback req_bw(%d) > link_bw(%d)\n" , __func__, link->link_index, req_bw, link_bw); - -return false; - } }msleep (delay_between_attempts);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 197/642 drm/amd/display: Do not enable replay when vtotal update is pending.
In reply to Sasha LevinFrom: Danny Wang <[email protected]>
[ Upstream commit bd00b29b5f236dce677089319176dee5872b5a7a ]
[Why&How]
Vtotal is not applied to HW when handling vsync interrupt. Make sure vtotal is aligned before enable replay.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 9 +++++++-- .../gpu/drm/amd/display/dc/core/dc_hw_sequencer.c | 15 +++++++++++++++ drivers/gpu/drm/amd/display/dc/dc_hw_types.h | 1 + .../drm/amd/display/dc/hwss/dce110/dce110_hwseq.c | 7 ++----- .../drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c | 7 ++----- .../drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 8 ++------ .../drm/amd/display/dc/hwss/dcn31/dcn31_hwseq.c | 4 +--- .../drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c | 3 +-- .../drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 10 +++------- .../gpu/drm/amd/display/dc/hwss/hw_sequencer.h | 6 ++++++ 10 files changed, 40 insertions(+), 30 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +7 -2
@@ -452,6 +452,7 @@ bool dc_stream_adjust_vmin_vmax(struct dc *dc,if (dc->caps.max_v_total !=0 && (adjust->v_total_max > dc->caps.max_v_total || adjust->v_total_min > dc->caps.max_v_total)) { + stream->adjust.timing_adjust_pending = false;if (adjust->allow_otg_v_count_halt)return set_long_vtotal (dc, stream, adjust);else
@@ -465,7 +466,7 @@ bool dc_stream_adjust_vmin_vmax(struct dc *dc, dc->hwss.set_drr (&pipe,1 , *adjust); - + stream->adjust.timing_adjust_pending = false;return true; } }
@@ -3127,8 +3128,12 @@ static void copy_stream_update_to_stream(struct dc *dc,if (update->vrr_active_fixed) stream->vrr_active_fixed = *update->vrr_active_fixed; -if (update->crtc_timing_adjust) +if (update->crtc_timing_adjust) { +if (stream->adjust.v_total_min != update->crtc_timing_adjust->v_total_min || + stream->adjust.v_total_max != update->crtc_timing_adjust->v_total_max) + stream->adjust.timing_adjust_pending = true; stream->adjust = *update->crtc_timing_adjust; + }if (update->dpms_off) stream->dpms_off = *update->dpms_off;
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +15 -0
@@ -609,6 +609,21 @@ void set_p_state_switch_method( } } +void set_drr_and_clear_adjust_pending ( +struct pipe_ctx *pipe_ctx, +struct dc_stream_state *stream, +struct drr_params *params) +{ +/* params can be null.*/ +if (pipe_ctx && pipe_ctx->stream_res.tg && + pipe_ctx->stream_res.tg->funcs->set_drr) + pipe_ctx->stream_res.tg->funcs->set_drr ( + pipe_ctx->stream_res.tg, params); + +if (stream) + stream->adjust.timing_adjust_pending = false; +} + void get_fams2_visual_confirm_color( struct dc *dc, struct dc_state *context,
drivers/gpu/drm/amd/display/dc/dc_hw_types.h +1 -0
@@ -1015,6 +1015,7 @@ struct dc_crtc_timing_adjust {uint32_t v_total_mid;uint32_t v_total_mid_frame_num;uint32_t allow_otg_v_count_halt; +uint8_t timing_adjust_pending; };
drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c +2 -5
@@ -1655,9 +1655,7 @@ enum dc_status dce110_apply_single_controller_ctx_to_hw( params.vertical_total_min = stream->adjust.v_total_min; params.vertical_total_max = stream->adjust.v_total_max; -if (pipe_ctx->stream_res.tg->funcs->set_drr) - pipe_ctx->stream_res.tg->funcs->set_drr ( - pipe_ctx->stream_res.tg, ¶ms); +set_drr_and_clear_adjust_pending (pipe_ctx, stream, ¶ms);// DRR should set trigger event to monitor surface update event if (stream->adjust.v_total_min !=0 && stream->adjust.v_total_max !=0 )
@@ -2105,8 +2103,7 @@ static void set_drr(struct pipe_ctx **pipe_ctx,struct timing_generator *tg = pipe_ctx[i]->stream_res.tg;if ((tg !=NULL ) && tg->funcs) { -if (tg->funcs->set_drr) - tg->funcs->set_drr (tg, ¶ms); +set_drr_and_clear_adjust_pending (pipe_ctx[i], pipe_ctx[i]->stream, ¶ms);if (adjust.v_total_max !=0 && adjust.v_total_min !=0 )if (tg->funcs->set_static_screen_control) tg->funcs->set_static_screen_control(
drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c +2 -5
@@ -1112,9 +1112,7 @@ static void dcn10_reset_back_end_for_pipe( pipe_ctx->stream_res.tg->funcs->disable_crtc (pipe_ctx->stream_res.tg); pipe_ctx->stream_res.tg->funcs->enable_optc_clock (pipe_ctx->stream_res.tg, false); -if (pipe_ctx->stream_res.tg->funcs->set_drr) - pipe_ctx->stream_res.tg->funcs->set_drr ( - pipe_ctx->stream_res.tg,NULL ); +set_drr_and_clear_adjust_pending (pipe_ctx, pipe_ctx->stream,NULL );if (dc_is_hdmi_tmds_signal (pipe_ctx->stream->signal)) pipe_ctx->stream->link->phy_state.symclk_ref_cnts.otg =0 ; }
@@ -3217,8 +3215,7 @@ void dcn10_set_drr(struct pipe_ctx **pipe_ctx,struct timing_generator *tg = pipe_ctx[i]->stream_res.tg;if ((tg !=NULL ) && tg->funcs) { -if (tg->funcs->set_drr) - tg->funcs->set_drr (tg, ¶ms); +set_drr_and_clear_adjust_pending (pipe_ctx[i], pipe_ctx[i]->stream, ¶ms);if (adjust.v_total_max !=0 && adjust.v_total_min !=0 )if (tg->funcs->set_static_screen_control) tg->funcs->set_static_screen_control(
drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c +2 -6
@@ -952,9 +952,7 @@ enum dc_status dcn20_enable_stream_timing( params.vertical_total_max = stream->adjust.v_total_max; params.vertical_total_mid = stream->adjust.v_total_mid; params.vertical_total_mid_frame_num = stream->adjust.v_total_mid_frame_num; -if (pipe_ctx->stream_res.tg->funcs->set_drr) - pipe_ctx->stream_res.tg->funcs->set_drr ( - pipe_ctx->stream_res.tg, ¶ms); +set_drr_and_clear_adjust_pending (pipe_ctx, stream, ¶ms);// DRR should set trigger event to monitor surface update event if (stream->adjust.v_total_min !=0 && stream->adjust.v_total_max !=0 )
@@ -2849,9 +2847,7 @@ void dcn20_reset_back_end_for_pipe( pipe_ctx->stream_res.tg->funcs->set_odm_bypass ( pipe_ctx->stream_res.tg, &pipe_ctx->stream->timing); -if (pipe_ctx->stream_res.tg->funcs->set_drr) - pipe_ctx->stream_res.tg->funcs->set_drr ( - pipe_ctx->stream_res.tg,NULL ); +set_drr_and_clear_adjust_pending (pipe_ctx, pipe_ctx->stream,NULL );/* TODO - convert symclk_ref_cnts for otg to a bit map to solve * the case where the same symclk is shared across multiple otg * instances
drivers/gpu/drm/amd/display/dc/hwss/dcn31/dcn31_hwseq.c +1 -3
@@ -538,9 +538,7 @@ static void dcn31_reset_back_end_for_pipe(if (dc_is_hdmi_tmds_signal (pipe_ctx->stream->signal)) pipe_ctx->stream->link->phy_state.symclk_ref_cnts.otg =0 ; -if (pipe_ctx->stream_res.tg->funcs->set_drr) - pipe_ctx->stream_res.tg->funcs->set_drr ( - pipe_ctx->stream_res.tg,NULL ); +set_drr_and_clear_adjust_pending (pipe_ctx, pipe_ctx->stream,NULL );/* DPMS may already disable or */ /* dpms_off status is incorrect due to fastboot
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c +1 -2
@@ -1473,8 +1473,7 @@ void dcn35_set_drr(struct pipe_ctx **pipe_ctx, num_frames =2 * (frame_rate %60 ); } } -if (tg->funcs->set_drr) - tg->funcs->set_drr (tg, ¶ms); +set_drr_and_clear_adjust_pending (pipe_ctx[i], pipe_ctx[i]->stream, ¶ms);if (adjust.v_total_max !=0 && adjust.v_total_min !=0 )if (tg->funcs->set_static_screen_control) tg->funcs->set_static_screen_control(
drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +3 -7
@@ -830,10 +830,7 @@ enum dc_status dcn401_enable_stream_timing( } hws->funcs.wait_for_blank_complete (pipe_ctx->stream_res.opp); - -if (pipe_ctx->stream_res.tg->funcs->set_drr) - pipe_ctx->stream_res.tg->funcs->set_drr ( - pipe_ctx->stream_res.tg, ¶ms); +set_drr_and_clear_adjust_pending (pipe_ctx, stream, ¶ms);/* Event triggers and num frames initialized for DRR, but can be * later updated for PSR use. Note DRR trigger events are generated
@@ -1866,9 +1863,8 @@ void dcn401_reset_back_end_for_pipe( pipe_ctx->stream_res.tg->funcs->set_odm_bypass ( pipe_ctx->stream_res.tg, &pipe_ctx->stream->timing); -if (pipe_ctx->stream_res.tg->funcs->set_drr) - pipe_ctx->stream_res.tg->funcs->set_drr ( - pipe_ctx->stream_res.tg,NULL ); +set_drr_and_clear_adjust_pending (pipe_ctx, pipe_ctx->stream,NULL ); +/* TODO - convert symclk_ref_cnts for otg to a bit map to solve * the case where the same symclk is shared across multiple otg * instances
drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h +6 -0
@@ -46,6 +46,7 @@ struct dce_hwseq;struct link_resource ;struct dc_dmub_cmd ;struct pg_block_update ; +struct drr_params ;struct subvp_pipe_control_lock_fast_params {struct dc *dc;
@@ -521,6 +522,11 @@ void set_p_state_switch_method(struct dc_state *context, struct pipe_ctx *pipe_ctx); +void set_drr_and_clear_adjust_pending ( +struct pipe_ctx *pipe_ctx, +struct dc_stream_state *stream, +struct drr_params *params); +void hwss_execute_sequence (struct dc *dc,struct block_sequence block_sequence[],int num_steps);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 198/642 drm/amd/display: Fix incorrect DPCD configs while Replay/PSR switch
In reply to Sasha LevinFrom: Leon Huang <[email protected]>
[ Upstream commit 0d9cabc8f591ea1cd97c071b853b75b155c13259 ]
[Why]
When switching between PSR/Replay,
the DPCD config of previous mode is not cleared, resulting in unexpected behavior in TCON.
[How]
Initialize the DPCD in setup function
--- .../link/protocols/link_edp_panel_control.c | 25 ++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c +22 -3
@@ -675,6 +675,18 @@ bool edp_setup_psr(struct dc_link *link,if (!link)return false; +//Clear PSR cfg +memset (&psr_configuration,0 ,sizeof (psr_configuration)); +dm_helpers_dp_write_dpcd ( + link->ctx, + link, +DP_PSR_EN_CFG , + &psr_configuration.raw, +sizeof (psr_configuration.raw)); + +if (link->psr_settings.psr_version ==DC_PSR_VERSION_UNSUPPORTED ) +return false; + dc = link->ctx->dc; dmcu = dc->res_pool->dmcu; psr = dc->res_pool->psr;
@@ -685,9 +697,6 @@ bool edp_setup_psr(struct dc_link *link,if (!dc_get_edp_link_panel_inst (dc, link, &panel_inst))return false; - -memset (&psr_configuration,0 ,sizeof (psr_configuration)); - psr_configuration.bits.ENABLE =1 ; psr_configuration.bits.CRC_VERIFICATION =1 ; psr_configuration.bits.FRAME_CAPTURE_INDICATION =
@@ -950,6 +959,16 @@ bool edp_setup_replay(struct dc_link *link, const struct dc_stream_state *streamif (!link)return false; +//Clear Replay config +dm_helpers_dp_write_dpcd (link->ctx, link, +DP_SINK_PR_ENABLE_AND_CONFIGURATION , + (uint8_t *)&(replay_config.raw),sizeof (uint8_t )); + +if (!(link->replay_settings.config.replay_supported)) +return false; + + link->replay_settings.config.replay_error_status.raw =0 ; + dc = link->ctx->dc; replay = dc->res_pool->replay;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 199/642 gfs2: Check for empty queue in run_queue
In reply to Sasha LevinFrom: Andreas Gruenbacher <[email protected]>
[ Upstream commit d838605fea6eabae3746a276fd448f6719eb3926 ]
In run_queue(), check if the queue of pending requests is empty instead of blindly assuming that it won't be.
--- fs/gfs2/glock.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
fs/gfs2/glock.c +8 -3
@@ -843,12 +843,13 @@ static void run_queue(struct gfs2_glock *gl, const int nonblock) __releases(&gl->gl_lockref.lock) __acquires(&gl->gl_lockref.lock) { -struct gfs2_holder *gh =NULL ; +struct gfs2_holder *gh;if (test_bit (GLF_LOCK , &gl->gl_flags))return ;set_bit (GLF_LOCK , &gl->gl_flags); +/* While a demote is in progress, the GLF_LOCK flag must be set. */ GLOCK_BUG_ON (gl,test_bit (GLF_DEMOTE_IN_PROGRESS , &gl->gl_flags)); if (test_bit(GLF_DEMOTE, &gl->gl_flags) &&
@@ -860,18 +861,22 @@ __acquires(&gl->gl_lockref.lock)set_bit (GLF_DEMOTE_IN_PROGRESS , &gl->gl_flags);GLOCK_BUG_ON (gl, gl->gl_demote_state ==LM_ST_EXCLUSIVE ); gl->gl_target = gl->gl_demote_state; +do_xmote (gl,NULL , gl->gl_target); +return ; }else {if (test_bit (GLF_DEMOTE , &gl->gl_flags))gfs2_demote_wake (gl);if (do_promote (gl)) goto out_unlock; gh =find_first_waiter (gl); +if (!gh) + goto out_unlock; gl->gl_target = gh->gh_state;if (!(gh->gh_flags & (LM_FLAG_TRY |LM_FLAG_TRY_1CB )))do_error (gl,0 );/* Fail queued try locks */ +do_xmote (gl, gh, gl->gl_target); +return ; } -do_xmote (gl, gh, gl->gl_target); -return ; out_sched:clear_bit (GLF_LOCK , &gl->gl_flags);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 200/642 auxdisplay: charlcd: Partially revert "Move hwidth and bwidth to struct hd44780_common"
In reply to Sasha LevinFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 09965a142078080fe7807bab0f6f1890cb5987a4 ]
Commit 2545c1c948a6 ("auxdisplay: Move hwidth and bwidth to struct hd44780_common") makes charlcd_alloc() argument-less effectively dropping the single allocation for the struct charlcd_priv object along with the driver specific one. Restore that behaviour here.
--- drivers/auxdisplay/charlcd.c | 5 +++-- drivers/auxdisplay/charlcd.h | 5 +++-- drivers/auxdisplay/hd44780.c | 2 +- drivers/auxdisplay/lcd2s.c | 2 +- drivers/auxdisplay/panel.c | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-)
drivers/auxdisplay/charlcd.c +3 -2
@@ -595,18 +595,19 @@ static int charlcd_init(struct charlcd *lcd)return 0 ; } -struct charlcd *charlcd_alloc (void ) +struct charlcd *charlcd_alloc (unsigned int drvdata_size) {struct charlcd_priv *priv;struct charlcd *lcd; - priv =kzalloc (sizeof (*priv),GFP_KERNEL ); + priv =kzalloc (sizeof (*priv) + drvdata_size,GFP_KERNEL );if (!priv)return NULL ; priv->esc_seq.len =-1 ; lcd = &priv->lcd; + lcd->drvdata = priv->drvdata;return lcd; }
drivers/auxdisplay/charlcd.h +3 -2
@@ -51,7 +51,7 @@ struct charlcd {unsigned long y; } addr; -void *drvdata; +void *drvdata;/* Set by charlcd_alloc() */ };/**
@@ -95,7 +95,8 @@ struct charlcd_ops { };void charlcd_backlight (struct charlcd *lcd,enum charlcd_onoff on); -struct charlcd *charlcd_alloc (void ); + +struct charlcd *charlcd_alloc (unsigned int drvdata_size);void charlcd_free (struct charlcd *lcd);int charlcd_register (struct charlcd *lcd);
drivers/auxdisplay/hd44780.c +1 -1
@@ -226,7 +226,7 @@ static int hd44780_probe(struct platform_device *pdev)if (!hdc)return -ENOMEM ; - lcd =charlcd_alloc (); + lcd =charlcd_alloc (0 );if (!lcd) goto fail1;
drivers/auxdisplay/lcd2s.c +1 -1
@@ -307,7 +307,7 @@ static int lcd2s_i2c_probe(struct i2c_client *i2c)if (err <0 )return err; - lcd =charlcd_alloc (); + lcd =charlcd_alloc (0 );if (!lcd)return -ENOMEM ;
drivers/auxdisplay/panel.c +1 -1
@@ -835,7 +835,7 @@ static void lcd_init(void)if (!hdc)return ; - charlcd =charlcd_alloc (); + charlcd =charlcd_alloc (0 );if (!charlcd) {kfree (hdc);return ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 201/642 ASoC: qcom: sm8250: explicitly set format in sm8250_be_hw_params_fixup()
In reply to Sasha LevinFrom: Alexey Klimov <[email protected]>
[ Upstream commit 89be3c15a58b2ccf31e969223c8ac93ca8932d81 ]
Setting format to s16le is required for compressed playback on compatible soundcards.
--- sound/soc/qcom/sm8250.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/qcom/sm8250.c +3 -0
@@ -7,6 +7,7 @@#include <sound/soc.h> #include <sound/soc-dapm.h> #include <sound/pcm.h> +#include <sound/pcm_params.h> #include <linux/soundwire/sdw.h> #include <sound/jack.h> #include <linux/input-event-codes.h>
@@ -39,9 +40,11 @@ static int sm8250_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, SNDRV_PCM_HW_PARAM_RATE);struct snd_interval *channels =hw_param_interval (params,SNDRV_PCM_HW_PARAM_CHANNELS ); +struct snd_mask *fmt =hw_param_mask (params,SNDRV_PCM_HW_PARAM_FORMAT ); rate->min = rate->max =48000 ; channels->min = channels->max =2 ; +snd_mask_set_format (fmt,SNDRV_PCM_FORMAT_S16_LE );return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 202/642 badblocks: Fix a nonsense WARN_ON() which checks whether a u64 variable < 0
In reply to Sasha LevinFrom: Coly Li <[email protected]>
[ Upstream commit 7e76336e14de9a2b67af96012ddd46c5676cf340 ]
In _badblocks_check(), there are lines of code like this,
1246 sectors -= len;
[snipped]
1251 WARN_ON(sectors < 0);
The WARN_ON() at line 1257 doesn't make sense because sectors is unsigned long long type and never to be <0.
Fix it by checking directly checking whether sectors is less than len.
--- block/badblocks.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
block/badblocks.c +3 -2
@@ -1246,14 +1246,15 @@ static int _badblocks_check(struct badblocks *bb, sector_t s, sector_t sectors, len = sectors; update_sectors: +/* This situation should never happen */ +WARN_ON (sectors < len); + s += len; sectors -= len;if (sectors >0 ) goto re_check; -WARN_ON (sectors <0 ); -if (unacked_badblocks >0 ) rv =-1 ;else if (acked_badblocks >0 )
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 203/642 block: acquire q->limits_lock while reading sysfs attributes
In reply to Sasha LevinFrom: Nilay Shroff <[email protected]>
[ Upstream commit 6e51a1279cd60cb93e3379ff140d8fa6c39ecf20 ]
There're few sysfs attributes(RW) whose store method is protected with q->limits_lock, however the corresponding show method of these attributes run holding q->sysfs_lock and that doesn't make sense as ideally the show method of these attributes should also run holding q->limits_lock instead of q->sysfs_lock. Hence update the show method of these sysfs attributes so that reading of these attributes acquire q->limits_lock instead of q->sysfs_lock.
Similarly, there're few sysfs attributes(RO) whose show method is currently protected with q->sysfs_lock however updates to these attributes could occur using atomic limit update APIs such as queue_ limits_start_update() and queue_limits_commit_update() which run holding q->limits_lock. So that means that reading these attributes holding q->sysfs_lock doesn't make sense. Hence update the show method of these sysfs attributes(RO) such that they run with holding q-> limits_lock instead of q->sysfs_lock.
We have defined a new macro QUEUE_LIM_RO_ENTRY() which uses new ->show_ limit() method and it runs holding q->limits_lock. All existing sysfs attributes(RO) which needs protection using q->limits_lock while reading have been now updated to use this new macro for initialization.
Also, the existing QUEUE_LIM_RW_ENTRY() is updated to use new ->show_ limit() method for reading attributes instead of existing ->show() method. As ->show_limit() runs holding q->limits_lock, the existing sysfs attributes(RW) requiring protection are now inherently protected using q->limits_lock instead of q->sysfs_lock.
--- block/blk-sysfs.c | 102 +++++++++++++++++++++++++++++----------------- 1 file changed, 65 insertions(+), 37 deletions(-)
block/blk-sysfs.c +65 -37
@@ -23,9 +23,12 @@struct queue_sysfs_entry {struct attribute attr;ssize_t (*show)(struct gendisk *disk,char *page); +ssize_t (*show_limit)(struct gendisk *disk,char *page); +ssize_t (*store)(struct gendisk *disk,const char *page,size_t count);int (*store_limit)(struct gendisk *disk,const char *page,size_t count,struct queue_limits *lim); +void (*load_module)(struct gendisk *disk,const char *page,size_t count); };
@@ -412,10 +415,16 @@ static struct queue_sysfs_entry _prefix##_entry = { \ .store = _prefix##_store, \ }; +#define QUEUE_LIM_RO_ENTRY (_prefix, _name) \ +static struct queue_sysfs_entry _prefix##_entry = { \ + .attr = { .name = _name, .mode = 0444 }, \ + .show_limit = _prefix##_show, \ +} +#define QUEUE_LIM_RW_ENTRY (_prefix, _name) \ static struct queue_sysfs_entry _prefix##_entry = { \ .attr = { .name = _name, .mode = 0644 }, \ - .show = _prefix##_show, \ + .show_limit = _prefix##_show, \ .store_limit = _prefix##_store, \ }
@@ -430,39 +439,39 @@ static struct queue_sysfs_entry _prefix##_entry = { \QUEUE_RW_ENTRY (queue_requests,"nr_requests" );QUEUE_RW_ENTRY (queue_ra,"read_ahead_kb" );QUEUE_LIM_RW_ENTRY (queue_max_sectors,"max_sectors_kb" ); -QUEUE_RO_ENTRY (queue_max_hw_sectors,"max_hw_sectors_kb" ); -QUEUE_RO_ENTRY (queue_max_segments,"max_segments" ); -QUEUE_RO_ENTRY (queue_max_integrity_segments,"max_integrity_segments" ); -QUEUE_RO_ENTRY (queue_max_segment_size,"max_segment_size" ); +QUEUE_LIM_RO_ENTRY (queue_max_hw_sectors,"max_hw_sectors_kb" ); +QUEUE_LIM_RO_ENTRY (queue_max_segments,"max_segments" ); +QUEUE_LIM_RO_ENTRY (queue_max_integrity_segments,"max_integrity_segments" ); +QUEUE_LIM_RO_ENTRY (queue_max_segment_size,"max_segment_size" );QUEUE_RW_LOAD_MODULE_ENTRY (elv_iosched,"scheduler" ); -QUEUE_RO_ENTRY (queue_logical_block_size,"logical_block_size" ); -QUEUE_RO_ENTRY (queue_physical_block_size,"physical_block_size" ); -QUEUE_RO_ENTRY (queue_chunk_sectors,"chunk_sectors" ); -QUEUE_RO_ENTRY (queue_io_min,"minimum_io_size" ); -QUEUE_RO_ENTRY (queue_io_opt,"optimal_io_size" ); +QUEUE_LIM_RO_ENTRY (queue_logical_block_size,"logical_block_size" ); +QUEUE_LIM_RO_ENTRY (queue_physical_block_size,"physical_block_size" ); +QUEUE_LIM_RO_ENTRY (queue_chunk_sectors,"chunk_sectors" ); +QUEUE_LIM_RO_ENTRY (queue_io_min,"minimum_io_size" ); +QUEUE_LIM_RO_ENTRY (queue_io_opt,"optimal_io_size" ); -QUEUE_RO_ENTRY (queue_max_discard_segments,"max_discard_segments" ); -QUEUE_RO_ENTRY (queue_discard_granularity,"discard_granularity" ); -QUEUE_RO_ENTRY (queue_max_hw_discard_sectors,"discard_max_hw_bytes" ); +QUEUE_LIM_RO_ENTRY (queue_max_discard_segments,"max_discard_segments" ); +QUEUE_LIM_RO_ENTRY (queue_discard_granularity,"discard_granularity" ); +QUEUE_LIM_RO_ENTRY (queue_max_hw_discard_sectors,"discard_max_hw_bytes" );QUEUE_LIM_RW_ENTRY (queue_max_discard_sectors,"discard_max_bytes" );QUEUE_RO_ENTRY (queue_discard_zeroes_data,"discard_zeroes_data" ); -QUEUE_RO_ENTRY (queue_atomic_write_max_sectors,"atomic_write_max_bytes" ); -QUEUE_RO_ENTRY (queue_atomic_write_boundary_sectors, +QUEUE_LIM_RO_ENTRY (queue_atomic_write_max_sectors,"atomic_write_max_bytes" ); +QUEUE_LIM_RO_ENTRY (queue_atomic_write_boundary_sectors,"atomic_write_boundary_bytes" ); -QUEUE_RO_ENTRY (queue_atomic_write_unit_max,"atomic_write_unit_max_bytes" ); -QUEUE_RO_ENTRY (queue_atomic_write_unit_min,"atomic_write_unit_min_bytes" ); +QUEUE_LIM_RO_ENTRY (queue_atomic_write_unit_max,"atomic_write_unit_max_bytes" ); +QUEUE_LIM_RO_ENTRY (queue_atomic_write_unit_min,"atomic_write_unit_min_bytes" );QUEUE_RO_ENTRY (queue_write_same_max,"write_same_max_bytes" ); -QUEUE_RO_ENTRY (queue_max_write_zeroes_sectors,"write_zeroes_max_bytes" ); -QUEUE_RO_ENTRY (queue_max_zone_append_sectors,"zone_append_max_bytes" ); -QUEUE_RO_ENTRY (queue_zone_write_granularity,"zone_write_granularity" ); +QUEUE_LIM_RO_ENTRY (queue_max_write_zeroes_sectors,"write_zeroes_max_bytes" ); +QUEUE_LIM_RO_ENTRY (queue_max_zone_append_sectors,"zone_append_max_bytes" ); +QUEUE_LIM_RO_ENTRY (queue_zone_write_granularity,"zone_write_granularity" ); -QUEUE_RO_ENTRY (queue_zoned,"zoned" ); +QUEUE_LIM_RO_ENTRY (queue_zoned,"zoned" );QUEUE_RO_ENTRY (queue_nr_zones,"nr_zones" ); -QUEUE_RO_ENTRY (queue_max_open_zones,"max_open_zones" ); -QUEUE_RO_ENTRY (queue_max_active_zones,"max_active_zones" ); +QUEUE_LIM_RO_ENTRY (queue_max_open_zones,"max_open_zones" ); +QUEUE_LIM_RO_ENTRY (queue_max_active_zones,"max_active_zones" );QUEUE_RW_ENTRY (queue_nomerges,"nomerges" );QUEUE_LIM_RW_ENTRY (queue_iostats_passthrough,"iostats_passthrough" );
@@ -470,16 +479,16 @@ QUEUE_RW_ENTRY(queue_rq_affinity, "rq_affinity");QUEUE_RW_ENTRY (queue_poll,"io_poll" );QUEUE_RW_ENTRY (queue_poll_delay,"io_poll_delay" );QUEUE_LIM_RW_ENTRY (queue_wc,"write_cache" ); -QUEUE_RO_ENTRY (queue_fua,"fua" ); -QUEUE_RO_ENTRY (queue_dax,"dax" ); +QUEUE_LIM_RO_ENTRY (queue_fua,"fua" ); +QUEUE_LIM_RO_ENTRY (queue_dax,"dax" );QUEUE_RW_ENTRY (queue_io_timeout,"io_timeout" ); -QUEUE_RO_ENTRY (queue_virt_boundary_mask,"virt_boundary_mask" ); -QUEUE_RO_ENTRY (queue_dma_alignment,"dma_alignment" ); +QUEUE_LIM_RO_ENTRY (queue_virt_boundary_mask,"virt_boundary_mask" ); +QUEUE_LIM_RO_ENTRY (queue_dma_alignment,"dma_alignment" );/* legacy alias for logical_block_size: */ static struct queue_sysfs_entry queue_hw_sector_size_entry = { - .attr = {.name ="hw_sector_size" , .mode =0444 }, - .show = queue_logical_block_size_show, + .attr = {.name ="hw_sector_size" , .mode =0444 }, + .show_limit = queue_logical_block_size_show, };QUEUE_LIM_RW_ENTRY (queue_rotational,"rotational" );
@@ -561,7 +570,9 @@ QUEUE_RW_ENTRY(queue_wb_lat, "wbt_lat_usec");/* Common attributes for bio-based and request-based queues. */ static struct attribute *queue_attrs[] = { - &queue_ra_entry.attr, +/* +* Attributes which are protected with q->limits_lock. +*/ &queue_max_hw_sectors_entry.attr, &queue_max_sectors_entry.attr, &queue_max_segments_entry.attr,
@@ -577,37 +588,46 @@ static struct attribute *queue_attrs[] = { &queue_discard_granularity_entry.attr, &queue_max_discard_sectors_entry.attr, &queue_max_hw_discard_sectors_entry.attr, - &queue_discard_zeroes_data_entry.attr, &queue_atomic_write_max_sectors_entry.attr, &queue_atomic_write_boundary_sectors_entry.attr, &queue_atomic_write_unit_min_entry.attr, &queue_atomic_write_unit_max_entry.attr, - &queue_write_same_max_entry.attr, &queue_max_write_zeroes_sectors_entry.attr, &queue_max_zone_append_sectors_entry.attr, &queue_zone_write_granularity_entry.attr, &queue_rotational_entry.attr, &queue_zoned_entry.attr, - &queue_nr_zones_entry.attr, &queue_max_open_zones_entry.attr, &queue_max_active_zones_entry.attr, - &queue_nomerges_entry.attr, &queue_iostats_passthrough_entry.attr, &queue_iostats_entry.attr, &queue_stable_writes_entry.attr, &queue_add_random_entry.attr, - &queue_poll_entry.attr, &queue_wc_entry.attr, &queue_fua_entry.attr, &queue_dax_entry.attr, - &queue_poll_delay_entry.attr, &queue_virt_boundary_mask_entry.attr, &queue_dma_alignment_entry.attr, + +/* +* Attributes which are protected with q->sysfs_lock. +*/ + &queue_ra_entry.attr, + &queue_discard_zeroes_data_entry.attr, + &queue_write_same_max_entry.attr, + &queue_nr_zones_entry.attr, + &queue_nomerges_entry.attr, + &queue_poll_entry.attr, + &queue_poll_delay_entry.attr, + NULL, };/* Request-based queue attributes that are not relevant for bio-based queues. */ static struct attribute *blk_mq_queue_attrs[] = { +/* +* Attributes which are protected with q->sysfs_lock. +*/ &queue_requests_entry.attr, &elv_iosched_entry.attr, &queue_rq_affinity_entry.attr,
@@ -666,8 +686,16 @@ queue_attr_show(struct kobject *kobj, struct attribute *attr, char *page) struct gendisk *disk = container_of(kobj, struct gendisk, queue_kobj);ssize_t res; -if (!entry->show) +if (!entry->show && !entry->show_limit)return -EIO ; + +if (entry->show_limit) { +mutex_lock (&disk->queue->limits_lock); + res = entry->show_limit (disk, page); +mutex_unlock (&disk->queue->limits_lock); +return res; + } +mutex_lock (&disk->queue->sysfs_lock); res = entry->show (disk, page);mutex_unlock (&disk->queue->sysfs_lock);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 204/642 coresight-etb10: change etb_drvdata spinlock's type to raw_spinlock_t
In reply to Sasha LevinFrom: Yeoreum Yun <[email protected]>
[ Upstream commit 6b80c0abe475ed1017c5e862636049aa1cc17a1a ]
In coresight-etb10 drivers, etb_drvdata->spinlock can be held during __schedule() by perf_event_task_sched_out()/in().
Since etb_drvdata->spinlock type is spinlock_t and perf_event_task_sched_out()/in() is called after acquiring rq_lock, which is raw_spinlock_t (an unsleepable lock),
this poses an issue in PREEMPT_RT kernel where spinlock_t is sleepable.
To address this, change type etb_drvdata->spinlock in coresight-etb10 drivers, which can be called by perf_event_task_sched_out()/in(),
from spinlock_t to raw_spinlock_t.
--- drivers/hwtracing/coresight/coresight-etb10.c | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/hwtracing/coresight/coresight-etb10.c +13 -13
@@ -84,7 +84,7 @@ struct etb_drvdata {struct clk *atclk;struct coresight_device *csdev;struct miscdevice miscdev; -spinlock_t spinlock; +raw_spinlock_t spinlock;local_t reading;pid_t pid;u8 *buf;
@@ -145,7 +145,7 @@ static int etb_enable_sysfs(struct coresight_device *csdev)unsigned long flags;struct etb_drvdata *drvdata =dev_get_drvdata (csdev->dev.parent); -spin_lock_irqsave (&drvdata->spinlock, flags); +raw_spin_lock_irqsave (&drvdata->spinlock, flags);/* Don't messup with perf sessions. */ if (coresight_get_mode (csdev) ==CS_MODE_PERF ) {
@@ -163,7 +163,7 @@ static int etb_enable_sysfs(struct coresight_device *csdev) csdev->refcnt++; out: -spin_unlock_irqrestore (&drvdata->spinlock, flags); +raw_spin_unlock_irqrestore (&drvdata->spinlock, flags);return ret; }
@@ -176,7 +176,7 @@ static int etb_enable_perf(struct coresight_device *csdev, void *data)struct perf_output_handle *handle = data;struct cs_buffers *buf =etm_perf_sink_config (handle); -spin_lock_irqsave (&drvdata->spinlock, flags); +raw_spin_lock_irqsave (&drvdata->spinlock, flags);/* No need to continue if the component is already in used by sysFS. */ if (coresight_get_mode (drvdata->csdev) ==CS_MODE_SYSFS ) {
@@ -219,7 +219,7 @@ static int etb_enable_perf(struct coresight_device *csdev, void *data) } out: -spin_unlock_irqrestore (&drvdata->spinlock, flags); +raw_spin_unlock_irqrestore (&drvdata->spinlock, flags);return ret; }
@@ -352,11 +352,11 @@ static int etb_disable(struct coresight_device *csdev)struct etb_drvdata *drvdata =dev_get_drvdata (csdev->dev.parent);unsigned long flags; -spin_lock_irqsave (&drvdata->spinlock, flags); +raw_spin_lock_irqsave (&drvdata->spinlock, flags); csdev->refcnt--;if (csdev->refcnt) { -spin_unlock_irqrestore (&drvdata->spinlock, flags); +raw_spin_unlock_irqrestore (&drvdata->spinlock, flags);return -EBUSY ; }
@@ -366,7 +366,7 @@ static int etb_disable(struct coresight_device *csdev)/* Dissociate from monitored process. */ drvdata->pid =-1 ;coresight_set_mode (csdev,CS_MODE_DISABLED ); -spin_unlock_irqrestore (&drvdata->spinlock, flags); +raw_spin_unlock_irqrestore (&drvdata->spinlock, flags);dev_dbg (&csdev->dev,"ETB disabled\n" );return 0 ;
@@ -443,7 +443,7 @@ static unsigned long etb_update_buffer(struct coresight_device *csdev, capacity = drvdata->buffer_depth *ETB_FRAME_SIZE_WORDS ; -spin_lock_irqsave (&drvdata->spinlock, flags); +raw_spin_lock_irqsave (&drvdata->spinlock, flags);/* Don't do anything if another tracer is using this sink */ if (csdev->refcnt !=1 )
@@ -566,7 +566,7 @@ static unsigned long etb_update_buffer(struct coresight_device *csdev,__etb_enable_hw (drvdata);CS_LOCK (drvdata->base); out: -spin_unlock_irqrestore (&drvdata->spinlock, flags); +raw_spin_unlock_irqrestore (&drvdata->spinlock, flags);return to_read; }
@@ -587,13 +587,13 @@ static void etb_dump(struct etb_drvdata *drvdata) {unsigned long flags; -spin_lock_irqsave (&drvdata->spinlock, flags); +raw_spin_lock_irqsave (&drvdata->spinlock, flags);if (coresight_get_mode (drvdata->csdev) ==CS_MODE_SYSFS ) {__etb_disable_hw (drvdata);etb_dump_hw (drvdata);__etb_enable_hw (drvdata); } -spin_unlock_irqrestore (&drvdata->spinlock, flags); +raw_spin_unlock_irqrestore (&drvdata->spinlock, flags);dev_dbg (&drvdata->csdev->dev,"ETB dumped\n" ); }
@@ -746,7 +746,7 @@ static int etb_probe(struct amba_device *adev, const struct amba_id *id) drvdata->base = base; desc.access =CSDEV_ACCESS_IOMEM (base); -spin_lock_init (&drvdata->spinlock); +raw_spin_lock_init (&drvdata->spinlock); drvdata->buffer_depth =etb_get_buffer_depth (drvdata);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 205/642 coresight: change coresight_trace_id_map's lock type to raw_spinlock_t
In reply to Sasha LevinFrom: Yeoreum Yun <[email protected]>
[ Upstream commit 4cf364ca57d851e192ce02e98d314d22fa514895 ]
coresight_trace_id_map->lock can be acquired while coresight devices' drvdata_lock.
But the drvdata_lock can be raw_spinlock_t (i.e) coresight-etm4x.
To address this, change type of coresight_trace_id_map->lock to raw_spinlock_t
--- drivers/hwtracing/coresight/coresight-core.c | 2 +- .../hwtracing/coresight/coresight-trace-id.c | 22 +++++++++---------- include/linux/coresight.h | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-)
drivers/hwtracing/coresight/coresight-core.c +1 -1
@@ -1249,7 +1249,7 @@ struct coresight_device *coresight_register(struct coresight_desc *desc)if (csdev->type ==CORESIGHT_DEV_TYPE_SINK || csdev->type ==CORESIGHT_DEV_TYPE_LINKSINK ) { -spin_lock_init (&csdev->perf_sink_id_map.lock); +raw_spin_lock_init (&csdev->perf_sink_id_map.lock); csdev->perf_sink_id_map.cpu_map =alloc_percpu (atomic_t);if (!csdev->perf_sink_id_map.cpu_map) {kfree (csdev);
drivers/hwtracing/coresight/coresight-trace-id.c +11 -11
@@ -22,7 +22,7 @@ enum trace_id_flags { static DEFINE_PER_CPU(atomic_t, id_map_default_cpu_ids) = ATOMIC_INIT(0);static struct coresight_trace_id_map id_map_default = { .cpu_map = &id_map_default_cpu_ids, - .lock =__SPIN_LOCK_UNLOCKED (id_map_default.lock) + .lock =__RAW_SPIN_LOCK_UNLOCKED (id_map_default.lock) };/* #define TRACE_ID_DEBUG 1 */
@@ -131,11 +131,11 @@ static void coresight_trace_id_release_all(struct coresight_trace_id_map *id_mapunsigned long flags;int cpu; -spin_lock_irqsave (&id_map->lock, flags); +raw_spin_lock_irqsave (&id_map->lock, flags);bitmap_zero (id_map->used_ids,CORESIGHT_TRACE_IDS_MAX );for_each_possible_cpu (cpu)atomic_set (per_cpu_ptr (id_map->cpu_map, cpu),0 ); -spin_unlock_irqrestore (&id_map->lock, flags); +raw_spin_unlock_irqrestore (&id_map->lock, flags);DUMP_ID_MAP (id_map); }
@@ -144,7 +144,7 @@ static int _coresight_trace_id_get_cpu_id(int cpu, struct coresight_trace_id_mapunsigned long flags;int id; -spin_lock_irqsave (&id_map->lock, flags); +raw_spin_lock_irqsave (&id_map->lock, flags);/* check for existing allocation for this CPU */ id =_coresight_trace_id_read_cpu_id (cpu, id_map);
@@ -171,7 +171,7 @@ static int _coresight_trace_id_get_cpu_id(int cpu, struct coresight_trace_id_mapatomic_set (per_cpu_ptr (id_map->cpu_map, cpu), id); get_cpu_id_out_unlock: -spin_unlock_irqrestore (&id_map->lock, flags); +raw_spin_unlock_irqrestore (&id_map->lock, flags);DUMP_ID_CPU (cpu, id);DUMP_ID_MAP (id_map);
@@ -188,12 +188,12 @@ static void _coresight_trace_id_put_cpu_id(int cpu, struct coresight_trace_id_maif (!id)return ; -spin_lock_irqsave (&id_map->lock, flags); +raw_spin_lock_irqsave (&id_map->lock, flags);coresight_trace_id_free (id, id_map);atomic_set (per_cpu_ptr (id_map->cpu_map, cpu),0 ); -spin_unlock_irqrestore (&id_map->lock, flags); +raw_spin_unlock_irqrestore (&id_map->lock, flags);DUMP_ID_CPU (cpu, id);DUMP_ID_MAP (id_map); }
@@ -204,9 +204,9 @@ static int coresight_trace_id_map_get_system_id(struct coresight_trace_id_map *iunsigned long flags;int id; -spin_lock_irqsave (&id_map->lock, flags); +raw_spin_lock_irqsave (&id_map->lock, flags); id =coresight_trace_id_alloc_new_id (id_map, preferred_id, traceid_flags); -spin_unlock_irqrestore (&id_map->lock, flags); +raw_spin_unlock_irqrestore (&id_map->lock, flags);DUMP_ID (id);DUMP_ID_MAP (id_map);
@@ -217,9 +217,9 @@ static void coresight_trace_id_map_put_system_id(struct coresight_trace_id_map * {unsigned long flags; -spin_lock_irqsave (&id_map->lock, flags); +raw_spin_lock_irqsave (&id_map->lock, flags);coresight_trace_id_free (id, id_map); -spin_unlock_irqrestore (&id_map->lock, flags); +raw_spin_unlock_irqrestore (&id_map->lock, flags);DUMP_ID (id);DUMP_ID_MAP (id_map);
include/linux/coresight.h +1 -1
@@ -238,7 +238,7 @@ struct coresight_trace_id_map {DECLARE_BITMAP (used_ids,CORESIGHT_TRACE_IDS_MAX );atomic_t __percpu *cpu_map;atomic_t perf_cs_etm_session_active; -spinlock_t lock; +raw_spinlock_t lock; };/**
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 206/642 iommu/vt-d: Move scalable mode ATS enablement to probe path
In reply to Sasha LevinFrom: Lu Baolu <[email protected]>
[ Upstream commit 5518f239aff1baf772c5748da3add7243c5fb5df ]
Device ATS is currently enabled when a domain is attached to the device and disabled when the domain is detached. This creates a limitation:
when the IOMMU is operating in scalable mode and IOPF is enabled, the device's domain cannot be changed.
The previous code enables ATS when a domain is set to a device's RID and disables it during RID domain switch. So, if a PASID is set with a domain requiring PRI, ATS should remain enabled until the domain is removed. During the PASID domain's lifecycle, if the RID's domain changes, PRI will be disrupted because it depends on ATS, which is disabled when the blocking domain is set for the device's RID.
Remove this limitation by moving ATS enablement to the device probe path.
--- drivers/iommu/intel/iommu.c | 51 ++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 24 deletions(-)
drivers/iommu/intel/iommu.c +27 -24
@@ -1172,32 +1172,28 @@ static bool dev_needs_extra_dtlb_flush(struct pci_dev *pdev)return true; } -static void iommu_enable_pci_caps (struct device_domain_info *info) +static void iommu_enable_pci_ats (struct device_domain_info *info) {struct pci_dev *pdev; -if (!dev_is_pci (info->dev)) +if (!info->ats_supported)return ; pdev =to_pci_dev (info->dev); -if (info->ats_supported &&pci_ats_page_aligned (pdev) && - !pci_enable_ats (pdev,VTD_PAGE_SHIFT )) +if (!pci_ats_page_aligned (pdev)) +return ; + +if (!pci_enable_ats (pdev,VTD_PAGE_SHIFT )) info->ats_enabled =1 ; } -static void iommu_disable_pci_caps (struct device_domain_info *info) +static void iommu_disable_pci_ats (struct device_domain_info *info) { -struct pci_dev *pdev; - -if (!dev_is_pci (info->dev)) +if (!info->ats_enabled)return ; - pdev =to_pci_dev (info->dev); - -if (info->ats_enabled) { -pci_disable_ats (pdev); - info->ats_enabled =0 ; - } +pci_disable_ats (to_pci_dev (info->dev)); + info->ats_enabled =0 ; }static void intel_flush_iotlb_all (struct iommu_domain *domain)
@@ -1556,12 +1552,19 @@ domain_context_mapping(struct dmar_domain *domain, struct device *dev)struct device_domain_info *info =dev_iommu_priv_get (dev);struct intel_iommu *iommu = info->iommu;u8 bus = info->bus, devfn = info->devfn; +int ret;if (!dev_is_pci (dev))return domain_context_mapping_one (domain, iommu, bus, devfn); -return pci_for_each_dma_alias (to_pci_dev (dev), - domain_context_mapping_cb, domain); + ret =pci_for_each_dma_alias (to_pci_dev (dev), + domain_context_mapping_cb, domain); +if (ret) +return ret; + +iommu_enable_pci_ats (info); + +return 0 ; }/* Return largest possible superpage level for a given mapping */
@@ -1843,8 +1846,6 @@ static int dmar_domain_attach_device(struct dmar_domain *domain,if (ret) goto out_block_translation; -iommu_enable_pci_caps (info); - ret =cache_tag_assign_domain (domain, dev,IOMMU_NO_PASID );if (ret) goto out_block_translation;
@@ -3210,6 +3211,7 @@ static void domain_context_clear(struct device_domain_info *info)pci_for_each_dma_alias (to_pci_dev (info->dev), &domain_context_clear_one_cb, info); +iommu_disable_pci_ats (info); }/*
@@ -3226,7 +3228,6 @@ void device_block_translation(struct device *dev)if (info->domain)cache_tag_unassign_domain (info->domain, dev,IOMMU_NO_PASID ); -iommu_disable_pci_caps (info);if (!dev_is_real_dma_subdevice (dev)) {if (sm_supported (iommu)) intel_pasid_tear_down_entry(iommu, dev,
@@ -3761,6 +3762,9 @@ static struct iommu_device *intel_iommu_probe_device(struct device *dev) !pci_enable_pasid(pdev, info->pasid_supported & ~1)) info->pasid_enabled = 1; +if (sm_supported (iommu)) +iommu_enable_pci_ats (info); +return &iommu->iommu; free_table:intel_pasid_free_table (dev);
@@ -3777,6 +3781,8 @@ static void intel_iommu_release_device(struct device *dev)struct device_domain_info *info =dev_iommu_priv_get (dev);struct intel_iommu *iommu = info->iommu; +iommu_disable_pci_ats (info); +if (info->pasid_enabled) {pci_disable_pasid (to_pci_dev (dev)); info->pasid_enabled =0 ;
@@ -4415,13 +4421,10 @@ static int identity_domain_attach_dev(struct iommu_domain *domain, struct deviceif (dev_is_real_dma_subdevice (dev))return 0 ; -if (sm_supported (iommu)) { +if (sm_supported (iommu)) ret =intel_pasid_setup_pass_through (iommu, dev,IOMMU_NO_PASID ); -if (!ret) -iommu_enable_pci_caps (info); - }else { +else ret =device_setup_pass_through (dev); - }return ret; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 207/642 iommu/vt-d: Check if SVA is supported when attaching the SVA domain
In reply to Sasha LevinFrom: Jason Gunthorpe <[email protected]>
[ Upstream commit 607ba1bb096110751f6aa4b46666e0ba024ab3c2 ]
Attach of a SVA domain should fail if SVA is not supported, move the check for SVA support out of IOMMU_DEV_FEAT_SVA and into attach.
Also check when allocating a SVA domain to match other drivers.
--- drivers/iommu/intel/iommu.c | 37 +------------------------------ drivers/iommu/intel/svm.c | 43 +++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 36 deletions(-)
drivers/iommu/intel/iommu.c +1 -36
@@ -3869,41 +3869,6 @@ static struct iommu_group *intel_iommu_device_group(struct device *dev)return generic_device_group (dev); } -static int intel_iommu_enable_sva (struct device *dev) -{ -struct device_domain_info *info =dev_iommu_priv_get (dev); -struct intel_iommu *iommu; - -if (!info || dmar_disabled) -return -EINVAL ; - - iommu = info->iommu; -if (!iommu) -return -EINVAL ; - -if (!(iommu->flags &VTD_FLAG_SVM_CAPABLE )) -return -ENODEV ; - -if (!info->pasid_enabled || !info->ats_enabled) -return -EINVAL ; - -/* -* Devices having device-specific I/O fault handling should not -* support PCI/PRI. The IOMMU side has no means to check the -* capability of device-specific IOPF. Therefore, IOMMU can only -* default that if the device driver enables SVA on a non-PRI -* device, it will handle IOPF in its own way. -*/ -if (!info->pri_supported) -return 0 ; - -/* Devices supporting PRI should have it enabled. */ -if (!info->pri_enabled) -return -EINVAL ; - -return 0 ; -} -static int context_flip_pri (struct device_domain_info *info,bool enable) {struct intel_iommu *iommu = info->iommu;
@@ -4024,7 +3989,7 @@ intel_iommu_dev_enable_feat(struct device *dev, enum iommu_dev_features feat)return intel_iommu_enable_iopf (dev);case IOMMU_DEV_FEAT_SVA : -return intel_iommu_enable_sva (dev); +return 0 ;default :return -ENODEV ;
drivers/iommu/intel/svm.c +43 -0
61 lines not on this page · raw message
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 208/642 iommu/amd/pgtbl_v2: Improve error handling
In reply to Sasha LevinFrom: Vasant Hegde <[email protected]>
[ Upstream commit 36a1cfd497435ba5e37572fe9463bb62a7b1b984 ]
Return -ENOMEM if v2_alloc_pte() fails to allocate memory.
--- drivers/iommu/amd/io_pgtable_v2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/amd/io_pgtable_v2.c +1 -1
@@ -254,7 +254,7 @@ static int iommu_v2_map_pages(struct io_pgtable_ops *ops, unsigned long iova, pte =v2_alloc_pte (cfg->amd.nid, pgtable->pgd, iova, map_size, gfp, &updated);if (!pte) { - ret = -EINVAL ; + ret = -ENOMEM ; goto out; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 209/642 fs/pipe: Limit the slots in pipe_resize_ring()
In reply to Sasha LevinFrom: K Prateek Nayak <[email protected]>
[ Upstream commit cf3d0c54b21c4a351d4f94cf188e9715dbd1ef5b ]
Limit the number of slots in pipe_resize_ring() to the maximum value representable by pipe->{head,tail}. Values beyond the max limit can lead to incorrect pipe occupancy related calculations where the pipe will never appear full.
--- fs/pipe.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/pipe.c +4 -0
@@ -1271,6 +1271,10 @@ int pipe_resize_ring(struct pipe_inode_info *pipe, unsigned int nr_slots)struct pipe_buffer *bufs;unsigned int head, tail, mask, n; +/* nr_slots larger than limits of pipe->{head,tail} */ +if (unlikely (nr_slots > (pipe_index_t)-1u )) +return -EINVAL ; + bufs =kcalloc (nr_slots,sizeof (*bufs),GFP_KERNEL_ACCOUNT | __GFP_NOWARN);if (unlikely (!bufs))
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 210/642 cpufreq: tegra186: Share policy per cluster
In reply to Sasha LevinFrom: Aaron Kling <[email protected]>
[ Upstream commit be4ae8c19492cd6d5de61ccb34ffb3f5ede5eec8 ]
This functionally brings tegra186 in line with tegra210 and tegra194, sharing a cpufreq policy between all cores in a cluster.
--- drivers/cpufreq/tegra186-cpufreq.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/cpufreq/tegra186-cpufreq.c +7 -0
@@ -73,11 +73,18 @@ static int tegra186_cpufreq_init(struct cpufreq_policy *policy) {struct tegra186_cpufreq_data *data =cpufreq_get_driver_data ();unsigned int cluster = data->cpus[policy->cpu].bpmp_cluster_id; +u32 cpu; policy->freq_table = data->clusters[cluster].table; policy->cpuinfo.transition_latency =300 *1000 ; policy->driver_data =NULL ; +/* set same policy for all cpus in a cluster */ +for (cpu =0 ; cpu <ARRAY_SIZE (tegra186_cpus); cpu++) { +if (data->cpus[cpu].bpmp_cluster_id == cluster) +cpumask_set_cpu (cpu, policy->cpus); + } +return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 211/642 watchdog: s3c2410_wdt: Fix PMU register bits for ExynosAutoV920 SoC
In reply to Sasha LevinFrom: Kyunghwan Seo <[email protected]>
[ Upstream commit 480ee8a260e6f87cbcdaff77ac2cbf6dc03f0f4f ]
Fix the PMU register bits for the ExynosAutoV920 SoC. This SoC has different bit information compared to its previous version, ExynosAutoV9, and we have made the necessary adjustments.
rst_stat_bit:
- ExynosAutoV920 cl0 : 0
- ExynosAutoV920 cl1 : 1
cnt_en_bit:
- ExynosAutoV920 cl0 : 8
- ExynosAutoV920 cl1 : 8
--- drivers/watchdog/s3c2410_wdt.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/watchdog/s3c2410_wdt.c +6 -4
@@ -72,6 +72,8 @@#define EXYNOS850_CLUSTER1_WDTRESET_BIT 23#define EXYNOSAUTOV9_CLUSTER0_WDTRESET_BIT 25#define EXYNOSAUTOV9_CLUSTER1_WDTRESET_BIT 24 +#define EXYNOSAUTOV920_CLUSTER0_WDTRESET_BIT 0 +#define EXYNOSAUTOV920_CLUSTER1_WDTRESET_BIT 1#define GS_CLUSTER0_NONCPU_OUT 0x1220#define GS_CLUSTER1_NONCPU_OUT 0x1420
@@ -312,9 +314,9 @@ static const struct s3c2410_wdt_variant drv_data_exynosautov920_cl0 = { .mask_bit = 2, .mask_reset_inv = true, .rst_stat_reg = EXYNOS5_RST_STAT_REG_OFFSET, - .rst_stat_bit = EXYNOSAUTOV9_CLUSTER0_WDTRESET_BIT, + .rst_stat_bit = EXYNOSAUTOV920_CLUSTER0_WDTRESET_BIT, .cnt_en_reg = EXYNOSAUTOV920_CLUSTER0_NONCPU_OUT, - .cnt_en_bit = 7, + .cnt_en_bit = 8, .quirks =QUIRK_HAS_WTCLRINT_REG |QUIRK_HAS_PMU_MASK_RESET |QUIRK_HAS_PMU_RST_STAT |QUIRK_HAS_PMU_CNT_EN | QUIRK_HAS_DBGACK_BIT,
@@ -325,9 +327,9 @@ static const struct s3c2410_wdt_variant drv_data_exynosautov920_cl1 = { .mask_bit = 2, .mask_reset_inv = true, .rst_stat_reg = EXYNOS5_RST_STAT_REG_OFFSET, - .rst_stat_bit = EXYNOSAUTOV9_CLUSTER1_WDTRESET_BIT, + .rst_stat_bit = EXYNOSAUTOV920_CLUSTER1_WDTRESET_BIT, .cnt_en_reg = EXYNOSAUTOV920_CLUSTER1_NONCPU_OUT, - .cnt_en_bit = 7, + .cnt_en_bit = 8, .quirks =QUIRK_HAS_WTCLRINT_REG |QUIRK_HAS_PMU_MASK_RESET |QUIRK_HAS_PMU_RST_STAT |QUIRK_HAS_PMU_CNT_EN | QUIRK_HAS_DBGACK_BIT,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 212/642 watchdog: aspeed: Update bootstatus handling
In reply to Sasha LevinFrom: Chin-Ting Kuo <[email protected]>
[ Upstream commit 5c03f9f4d36292150c14ebd90788c4d3273ed9dc ]
The boot status in the watchdog device struct is updated during controller probe stage. Application layer can get the boot status through the command, cat /sys/class/watchdog/watchdogX/bootstatus. The bootstatus can be,WDIOF_CARDRESET => System is reset due to WDT timeout occurs.
Others => Other reset events, e.g., power on reset.
On ASPEED platforms, boot status is recorded in the SCU registers.
- AST2400: Only a bit is used to represent system reset triggered by any WDT controller.
- AST2500/AST2600: System reset triggered by different WDT controllers can be distinguished by different SCU bits.
Besides, on AST2400 and AST2500, since alternating boot event is also triggered by using WDT timeout mechanism, it is classified as WDIOF_CARDRESET.
--- drivers/watchdog/aspeed_wdt.c | 81 ++++++++++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 2 deletions(-)
drivers/watchdog/aspeed_wdt.c +79 -2
@@ -11,21 +11,30 @@#include <linux/io.h> #include <linux/kernel.h> #include <linux/kstrtox.h> +#include <linux/mfd/syscon.h> #include <linux/module.h> #include <linux/of.h> #include <linux/of_irq.h> #include <linux/platform_device.h> +#include <linux/regmap.h> #include <linux/watchdog.h> static bool nowayout =WATCHDOG_NOWAYOUT ;module_param (nowayout, bool,0 ); MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); +struct aspeed_wdt_scu { +const char *compatible; +u32 reset_status_reg; +u32 wdt_reset_mask; +u32 wdt_reset_mask_shift; +};struct aspeed_wdt_config {u32 ext_pulse_width_mask;u32 irq_shift;u32 irq_mask; +struct aspeed_wdt_scu scu; };struct aspeed_wdt {
@@ -39,18 +48,36 @@ static const struct aspeed_wdt_config ast2400_config = { .ext_pulse_width_mask = 0xff, .irq_shift = 0, .irq_mask = 0, + .scu = { + .compatible = "aspeed,ast2400-scu", + .reset_status_reg = 0x3c, + .wdt_reset_mask = 0x1, + .wdt_reset_mask_shift = 1, + }, };static const struct aspeed_wdt_config ast2500_config = { .ext_pulse_width_mask =0xfffff , .irq_shift =12 , .irq_mask =GENMASK (31 ,12 ), + .scu = { + .compatible ="aspeed,ast2500-scu" , + .reset_status_reg =0x3c , + .wdt_reset_mask =0x1 , + .wdt_reset_mask_shift =2 , + }, };static const struct aspeed_wdt_config ast2600_config = { .ext_pulse_width_mask =0xfffff , .irq_shift =0 , .irq_mask =GENMASK (31 ,10 ), + .scu = { + .compatible ="aspeed,ast2600-scu" , + .reset_status_reg =0x74 , + .wdt_reset_mask =0xf , + .wdt_reset_mask_shift =16 , + }, };static const struct of_device_id aspeed_wdt_of_table[] = {
@@ -213,6 +240,56 @@ static int aspeed_wdt_restart(struct watchdog_device *wdd,return 0 ; } +static void aspeed_wdt_update_bootstatus (struct platform_device *pdev, +struct aspeed_wdt *wdt) +{ +const struct resource *res; +struct aspeed_wdt_scu scu = wdt->cfg->scu; +struct regmap *scu_base; +u32 reset_mask_width; +u32 reset_mask_shift; +u32 idx =0 ; +u32 status; +int ret; + +if (!of_device_is_compatible (pdev->dev.of_node,"aspeed,ast2400-wdt" )) { + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); + idx = ((intptr_t )wdt->base &0x00000fff ) /resource_size (res); + } + + scu_base =syscon_regmap_lookup_by_compatible (scu.compatible); +if (IS_ERR (scu_base)) { + wdt->wdd.bootstatus =WDIOS_UNKNOWN ; +return ; + } + + ret =regmap_read (scu_base, scu.reset_status_reg, &status); +if (ret) { + wdt->wdd.bootstatus =WDIOS_UNKNOWN ; +return ; + } + + reset_mask_width =hweight32 (scu.wdt_reset_mask); + reset_mask_shift = scu.wdt_reset_mask_shift + + reset_mask_width * idx; + +if (status & (scu.wdt_reset_mask << reset_mask_shift)) + wdt->wdd.bootstatus =WDIOF_CARDRESET ; + +/* clear wdt reset event flag */ +if (of_device_is_compatible (pdev->dev.of_node,"aspeed,ast2400-wdt" ) || +of_device_is_compatible (pdev->dev.of_node,"aspeed,ast2500-wdt" )) { + ret =regmap_read (scu_base, scu.reset_status_reg, &status); +if (!ret) { + status &= ~(scu.wdt_reset_mask << reset_mask_shift); +regmap_write (scu_base, scu.reset_status_reg, status); + } + }else { +regmap_write (scu_base, scu.reset_status_reg, + scu.wdt_reset_mask << reset_mask_shift); + } +} +/* access_cs0 shows if cs0 is accessible, hence the reverted bit */ static ssize_t access_cs0_show (struct device *dev,struct device_attribute *attr,char *buf)
@@ -458,10 +535,10 @@ static int aspeed_wdt_probe(struct platform_device *pdev)writel (duration -1 , wdt->base +WDT_RESET_WIDTH ); } +aspeed_wdt_update_bootstatus (pdev, wdt); + status =readl (wdt->base +WDT_TIMEOUT_STATUS );if (status &WDT_TIMEOUT_STATUS_BOOT_SECONDARY ) { - wdt->wdd.bootstatus =WDIOF_CARDRESET ; -if (of_device_is_compatible (np,"aspeed,ast2400-wdt" ) ||of_device_is_compatible (np,"aspeed,ast2500-wdt" )) wdt->wdd.groups = bswitch_groups;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 213/642 PCI: endpoint: pci-epf-test: Fix double free that causes kernel to oops
In reply to Sasha LevinFrom: Christian Bruel <[email protected]>
[ Upstream commit 934e9d137d937706004c325fa1474f9e3f1ba10a ]
Fix a kernel oops found while testing the stm32_pcie Endpoint driver with handling of PERST# deassertion:
During EP initialization, pci_epf_test_alloc_space() allocates all BARs, which are further freed if epc_set_bar() fails (for instance, due to no free inbound window).
However, when pci_epc_set_bar() fails, the error path:
pci_epc_set_bar() ->
pci_epf_free_space()
does not clear the previous assignment to epf_test->reg[bar].
Then, if the host reboots, the PERST# deassertion restarts the BAR allocation sequence with the same allocation failure (no free inbound window), creating a double free situation since epf_test->reg[bar] was deallocated and is still non-NULL.
Thus, make sure that pci_epf_alloc_space() and pci_epf_free_space() invocations are symmetric, and as such, set epf_test->reg[bar] to NULL when memory is freed.
--- drivers/pci/endpoint/functions/pci-epf-test.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/endpoint/functions/pci-epf-test.c +2 -0
@@ -738,6 +738,7 @@ static int pci_epf_test_set_bar(struct pci_epf *epf)if (ret) {pci_epf_free_space (epf, epf_test->reg[bar], bar,PRIMARY_INTERFACE ); + epf_test->reg[bar] =NULL ;dev_err (dev,"Failed to set BAR%d\n" , bar);if (bar == test_reg_bar)return ret;
@@ -929,6 +930,7 @@ static void pci_epf_test_free_space(struct pci_epf *epf)pci_epf_free_space (epf, epf_test->reg[bar], bar,PRIMARY_INTERFACE ); + epf_test->reg[bar] =NULL ; } }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 214/642 misc: pci_endpoint_test: Give disabled BARs a distinct error code
In reply to Sasha LevinFrom: Niklas Cassel <[email protected]>
[ Upstream commit 7e80bbef1d697dbce7a39cfad0df770880fe3f29 ]
The current code returns -ENOMEM if test->bar[barno] is NULL.
There can be two reasons why test->bar[barno] is NULL:
1) The pci_ioremap_bar() call in pci_endpoint_test_probe() failed.
2) The BAR was skipped, because it is disabled by the endpoint.
Many PCI endpoint controller drivers will disable all BARs in their init function. A disabled BAR will have a size of 0.
A PCI endpoint function driver will be able to enable any BAR that is not marked as BAR_RESERVED (which means that the BAR should not be touched by the EPF driver).
Thus, perform check if the size is 0, before checking if test->bar[barno] is NULL, such that we can return different errors.
This will allow the selftests to return SKIP instead of FAIL for disabled BARs.
--- drivers/misc/pci_endpoint_test.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/misc/pci_endpoint_test.c +4 -2
@@ -295,11 +295,13 @@ static int pci_endpoint_test_bar(struct pci_endpoint_test *test,struct pci_dev *pdev = test->pdev;int buf_size; + bar_size =pci_resource_len (pdev, barno); +if (!bar_size) +return -ENODATA ; +if (!test->bar[barno])return -ENOMEM ; - bar_size =pci_resource_len (pdev, barno); -if (barno == test->test_reg_bar) bar_size =0x4 ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 215/642 selftests: pci_endpoint: Skip disabled BARs
In reply to Sasha LevinFrom: Niklas Cassel <[email protected]>
[ Upstream commit af1451b6738ec7cf91f2914f53845424959ec4ee ]
Currently BARs that have been disabled by the endpoint controller driver will result in a test FAIL.
Returning FAIL for a BAR that is disabled seems overly pessimistic.
There are EPC that disables one or more BARs intentionally.
One reason for this is that there are certain EPCs that are hardwired to expose internal PCIe controller registers over a certain BAR, so the EPC driver disables such a BAR, such that the host will not overwrite random registers during testing.
Such a BAR will be disabled by the EPC driver's init function, and the BAR will be marked as BAR_RESERVED, such that it will be unavailable to endpoint function drivers.
Let's return FAIL only for BARs that are actually enabled and failed the test, and let's return skip for BARs that are not even enabled.
--- tools/testing/selftests/pci_endpoint/pci_endpoint_test.c | 2 ++ 1 file changed, 2 insertions(+)
tools/testing/selftests/pci_endpoint/pci_endpoint_test.c +2 -0
@@ -65,6 +65,8 @@ TEST_F(pci_ep_bar, BAR_TEST)int ret;pci_ep_ioctl (PCITEST_BAR , variant->barno); +if (ret == -ENODATA ) +SKIP (return,"BAR is disabled" ); EXPECT_FALSE(ret) TH_LOG("Test failed for BAR%d", variant->barno); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 216/642 crypto: lzo - Fix compression buffer overrun
In reply to Sasha LevinFrom: Herbert Xu <[email protected]>
[ Upstream commit cc47f07234f72cbd8e2c973cdbf2a6730660a463 ]
Unlike the decompression code, the compression code in LZO never checked for output overruns. It instead assumes that the caller always provides enough buffer space, disregarding the buffer length provided by the caller.
Add a safe compression interface that checks for the end of buffer before each write. Use the safe interface in crypto/lzo.
--- crypto/lzo-rle.c | 2 +- crypto/lzo.c | 2 +- include/linux/lzo.h | 8 +++ lib/lzo/Makefile | 2 +- lib/lzo/lzo1x_compress.c | 102 +++++++++++++++++++++++++--------- lib/lzo/lzo1x_compress_safe.c | 18 ++++++ 6 files changed, 106 insertions(+), 28 deletions(-) create mode 100644 lib/lzo/lzo1x_compress_safe.c
crypto/lzo-rle.c +1 -1
@@ -55,7 +55,7 @@ static int __lzorle_compress(const u8 *src, unsigned int slen,size_t tmp_len = *dlen;/* size_t(ulong) <-> uint on 64 bit */ int err; - err =lzorle1x_1_compress (src, slen, dst, &tmp_len, ctx); + err =lzorle1x_1_compress_safe (src, slen, dst, &tmp_len, ctx);if (err !=LZO_E_OK )return -EINVAL ;
crypto/lzo.c +1 -1
@@ -55,7 +55,7 @@ static int __lzo_compress(const u8 *src, unsigned int slen,size_t tmp_len = *dlen;/* size_t(ulong) <-> uint on 64 bit */ int err; - err =lzo1x_1_compress (src, slen, dst, &tmp_len, ctx); + err =lzo1x_1_compress_safe (src, slen, dst, &tmp_len, ctx);if (err !=LZO_E_OK )return -EINVAL ;
include/linux/lzo.h +8 -0
@@ -24,10 +24,18 @@int lzo1x_1_compress (const unsigned char *src,size_t src_len,unsigned char *dst,size_t *dst_len,void *wrkmem); +/* Same as above but does not write more than dst_len to dst. */ +int lzo1x_1_compress_safe (const unsigned char *src,size_t src_len, +unsigned char *dst,size_t *dst_len,void *wrkmem); +/* This requires 'wrkmem' of size LZO1X_1_MEM_COMPRESS */ int lzorle1x_1_compress (const unsigned char *src,size_t src_len,unsigned char *dst,size_t *dst_len,void *wrkmem); +/* Same as above but does not write more than dst_len to dst. */ +int lzorle1x_1_compress_safe (const unsigned char *src,size_t src_len, +unsigned char *dst,size_t *dst_len,void *wrkmem); +/* safe decompression with overrun testing */ int lzo1x_decompress_safe (const unsigned char *src,size_t src_len,unsigned char *dst,size_t *dst_len);
lib/lzo/Makefile +1 -1
@@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only -lzo_compress-objs := lzo1x_compress.o +lzo_compress-objs := lzo1x_compress.o lzo1x_compress_safe.o lzo_decompress-objs := lzo1x_decompress_safe.o obj-$(CONFIG_LZO_COMPRESS) += lzo_compress.o
lib/lzo/lzo1x_compress.c +77 -25
241 lines not on this page · raw message
lib/lzo/lzo1x_compress_safe.c new file +18 -0
@@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* LZO1X Compressor from LZO +* +* Copyright (C) 1996-2012 Markus F.X.J. Oberhumer <[email protected]> +* +* The full LZO package can be found at: +* http://www.oberhumer.com/opensource/lzo/ +* +* Changed for Linux kernel use by: +* Nitin Gupta <[email protected]> +* Richard Purdie <[email protected]> +*/ + +#define LZO_SAFE (name) name##_safe +#define HAVE_OP (x) ((size_t)(op_end - op) >= (size_t)(x)) + +#include "lzo1x_compress.c"
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 217/642 crypto: mxs-dcp - Only set OTP_KEY bit for OTP key
In reply to Sasha LevinFrom: Sven Schwermer <[email protected]>
[ Upstream commit caa9dbb76ff52ec848a57245062aaeaa07740adc ]
While MXS_DCP_CONTROL0_OTP_KEY is set, the CRYPTO_KEY (DCP_PAES_KEY_OTP) is used even if the UNIQUE_KEY (DCP_PAES_KEY_UNIQUE) is selected. This is not clearly documented, but this implementation is consistent with NXP's downstream kernel fork and optee_os.
--- drivers/crypto/mxs-dcp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/crypto/mxs-dcp.c +4 -4
@@ -265,12 +265,12 @@ static int mxs_dcp_run_aes(struct dcp_async_ctx *actx,MXS_DCP_CONTROL0_INTERRUPT |MXS_DCP_CONTROL0_ENABLE_CIPHER ; -if (key_referenced) -/* Set OTP key bit to select the key via KEY_SELECT. */ - desc->control0 |=MXS_DCP_CONTROL0_OTP_KEY ; -else +if (!key_referenced)/* Payload contains the key. */ desc->control0 |=MXS_DCP_CONTROL0_PAYLOAD_KEY ; +else if (actx->key[0 ] ==DCP_PAES_KEY_OTP ) +/* Set OTP key bit to select the key via KEY_SELECT. */ + desc->control0 |=MXS_DCP_CONTROL0_OTP_KEY ;if (rctx->enc) desc->control0 |=MXS_DCP_CONTROL0_CIPHER_ENCRYPT ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 218/642 drm/amdkfd: Set per-process flags only once for gfx9/10/11/12
In reply to Sasha LevinFrom: Harish Kasiviswanathan <[email protected]>
[ Upstream commit 61972cd93af70738a6ad7f93e17cc7f68a01e182 ]
Define set_cache_memory_policy() for these asics and move all static changes from update_qpd() which is called each time a queue is created to set_cache_memory_policy() which is called once during process initialization
--- .../amd/amdkfd/kfd_device_queue_manager_v10.c | 41 +++++++++++-------- .../amd/amdkfd/kfd_device_queue_manager_v11.c | 41 +++++++++++-------- .../amd/amdkfd/kfd_device_queue_manager_v12.c | 41 +++++++++++-------- .../amd/amdkfd/kfd_device_queue_manager_v9.c | 36 +++++++++++++++- 4 files changed, 107 insertions(+), 52 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_v10.c +24 -17
@@ -31,10 +31,17 @@ static int update_qpd_v10(struct device_queue_manager *dqm, struct qcm_process_device *qpd);static void init_sdma_vm_v10 (struct device_queue_manager *dqm,struct queue *q,struct qcm_process_device *qpd); +static bool set_cache_memory_policy_v10 (struct device_queue_manager *dqm, +struct qcm_process_device *qpd, +enum cache_policy default_policy, +enum cache_policy alternate_policy, +void __user *alternate_aperture_base, +uint64_t alternate_aperture_size);void device_queue_manager_init_v10 (struct device_queue_manager_asic_ops *asic_ops) { + asic_ops->set_cache_memory_policy = set_cache_memory_policy_v10; asic_ops->update_qpd = update_qpd_v10; asic_ops->init_sdma_vm = init_sdma_vm_v10; asic_ops->mqd_manager_init = mqd_manager_init_v10;
@@ -49,27 +56,27 @@ static uint32_t compute_sh_mem_bases_64bit(struct kfd_process_device *pdd) private_base; } -static int update_qpd_v10 (struct device_queue_manager *dqm, -struct qcm_process_device *qpd) +static bool set_cache_memory_policy_v10 (struct device_queue_manager *dqm, +struct qcm_process_device *qpd, +enum cache_policy default_policy, +enum cache_policy alternate_policy, +void __user *alternate_aperture_base, +uint64_t alternate_aperture_size) { -struct kfd_process_device *pdd; - - pdd =qpd_to_pdd (qpd); - -/* check if sh_mem_config register already configured */ -if (qpd->sh_mem_config ==0 ) { - qpd->sh_mem_config = - (SH_MEM_ALIGNMENT_MODE_UNALIGNED << -SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT ) | - (3 <<SH_MEM_CONFIG__INITIAL_INST_PREFETCH__SHIFT ); - qpd->sh_mem_ape1_limit =0 ; - qpd->sh_mem_ape1_base =0 ; - } - - qpd->sh_mem_bases =compute_sh_mem_bases_64bit (pdd); + qpd->sh_mem_config = (SH_MEM_ALIGNMENT_MODE_UNALIGNED << +SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT ) | + (3 <<SH_MEM_CONFIG__INITIAL_INST_PREFETCH__SHIFT ); + qpd->sh_mem_ape1_limit =0 ; + qpd->sh_mem_ape1_base =0 ; + qpd->sh_mem_bases =compute_sh_mem_bases_64bit (qpd_to_pdd (qpd));pr_debug ("sh_mem_bases 0x%X\n" , qpd->sh_mem_bases); +return true; +} +static int update_qpd_v10 (struct device_queue_manager *dqm, +struct qcm_process_device *qpd) +{return 0 ; }
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_v11.c +24 -17
62 lines not on this page · raw message
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_v12.c +24 -17
62 lines not on this page · raw message
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_v9.c +35 -1
@@ -30,10 +30,17 @@ static int update_qpd_v9(struct device_queue_manager *dqm, struct qcm_process_device *qpd);static void init_sdma_vm_v9 (struct device_queue_manager *dqm,struct queue *q,struct qcm_process_device *qpd); +static bool set_cache_memory_policy_v9 (struct device_queue_manager *dqm, +struct qcm_process_device *qpd, +enum cache_policy default_policy, +enum cache_policy alternate_policy, +void __user *alternate_aperture_base, +uint64_t alternate_aperture_size);void device_queue_manager_init_v9 (struct device_queue_manager_asic_ops *asic_ops) { + asic_ops->set_cache_memory_policy = set_cache_memory_policy_v9; asic_ops->update_qpd = update_qpd_v9; asic_ops->init_sdma_vm = init_sdma_vm_v9; asic_ops->mqd_manager_init = mqd_manager_init_v9;
@@ -48,10 +55,37 @@ static uint32_t compute_sh_mem_bases_64bit(struct kfd_process_device *pdd) private_base; } +static bool set_cache_memory_policy_v9 (struct device_queue_manager *dqm, +struct qcm_process_device *qpd, +enum cache_policy default_policy, +enum cache_policy alternate_policy, +void __user *alternate_aperture_base, +uint64_t alternate_aperture_size) +{ + qpd->sh_mem_config =SH_MEM_ALIGNMENT_MODE_UNALIGNED << +SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT ; + +if (dqm->dev->kfd->noretry) + qpd->sh_mem_config |=1 <<SH_MEM_CONFIG__RETRY_DISABLE__SHIFT ; + +if (KFD_GC_VERSION (dqm->dev->kfd) ==IP_VERSION (9 ,4 ,3 ) || +KFD_GC_VERSION (dqm->dev->kfd) ==IP_VERSION (9 ,4 ,4 ) || +KFD_GC_VERSION (dqm->dev->kfd) ==IP_VERSION (9 ,5 ,0 )) + qpd->sh_mem_config |= (1 <<SH_MEM_CONFIG__F8_MODE__SHIFT ); + + qpd->sh_mem_ape1_limit =0 ; + qpd->sh_mem_ape1_base =0 ; + qpd->sh_mem_bases =compute_sh_mem_bases_64bit (qpd_to_pdd (qpd)); + +pr_debug ("sh_mem_bases 0x%X sh_mem_config 0x%X\n" , qpd->sh_mem_bases, + qpd->sh_mem_config); +return true; +} +static int update_qpd_v9 (struct device_queue_manager *dqm,struct qcm_process_device *qpd) { -struct kfd_process_device *pdd; +struct kfd_process_device *pdd =qpd_to_pdd (qpd); pdd =qpd_to_pdd (qpd);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 219/642 drm/amdkfd: Set per-process flags only once cik/vi
In reply to Sasha LevinFrom: Harish Kasiviswanathan <[email protected]>
[ Upstream commit 289e68503a4533b014f8447e2af28ad44c92c221 ]
Set per-process static sh_mem config only once during process initialization. Move all static changes from update_qpd() which is called each time a queue is created to set_cache_memory_policy() which is called once during process initialization.
set_cache_memory_policy() is currently defined only for cik and vi family. So this commit only focuses on these two. A separate commit will address other asics.
--- .../drm/amd/amdkfd/kfd_device_queue_manager.c | 39 +--------- .../amd/amdkfd/kfd_device_queue_manager_cik.c | 69 ++++++++++++------ .../amd/amdkfd/kfd_device_queue_manager_vi.c | 71 ++++++++++++------- 3 files changed, 94 insertions(+), 85 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +3 -36
@@ -2491,14 +2491,6 @@ static int destroy_queue_cpsch(struct device_queue_manager *dqm,return retval; } -/* -* Low bits must be 0000/FFFF as required by HW, high bits must be 0 to -* stay in user mode. -*/ -#define APE1_FIXED_BITS_MASK 0xFFFF80000000FFFFULL -/* APE1 limit is inclusive and 64K aligned. */ -#define APE1_LIMIT_ALIGNMENT 0xFFFF - static bool set_cache_memory_policy(struct device_queue_manager *dqm, struct qcm_process_device *qpd, enum cache_policy default_policy,
@@ -2513,34 +2505,6 @@ static bool set_cache_memory_policy(struct device_queue_manager *dqm,dqm_lock (dqm); -if (alternate_aperture_size ==0 ) { -/* base > limit disables APE1 */ - qpd->sh_mem_ape1_base =1 ; - qpd->sh_mem_ape1_limit =0 ; - }else { -/* -* In FSA64, APE1_Base[63:0] = { 16{SH_MEM_APE1_BASE[31]}, -* SH_MEM_APE1_BASE[31:0], 0x0000 } -* APE1_Limit[63:0] = { 16{SH_MEM_APE1_LIMIT[31]}, -* SH_MEM_APE1_LIMIT[31:0], 0xFFFF } -* Verify that the base and size parameters can be -* represented in this format and convert them. -* Additionally restrict APE1 to user-mode addresses. -*/ - -uint64_t base = (uintptr_t )alternate_aperture_base; -uint64_t limit = base + alternate_aperture_size -1 ; - -if (limit <= base || (base &APE1_FIXED_BITS_MASK ) !=0 || - (limit &APE1_FIXED_BITS_MASK ) !=APE1_LIMIT_ALIGNMENT ) { - retval = false; - goto out; - } - - qpd->sh_mem_ape1_base = base >>16 ; - qpd->sh_mem_ape1_limit = limit >>16 ; - } - retval = dqm->asic_ops.set_cache_memory_policy( dqm, qpd,
@@ -2549,6 +2513,9 @@ static bool set_cache_memory_policy(struct device_queue_manager *dqm, alternate_aperture_base, alternate_aperture_size); +if (retval) + goto out; +if ((dqm->sched_policy ==KFD_SCHED_POLICY_NO_HWS ) && (qpd->vmid !=0 ))program_sh_mem_settings (dqm, qpd);
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_cik.c +46 -23
95 lines not on this page · raw message
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_vi.c +45 -26
97 lines not on this page · raw message
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 220/642 drm/amdkfd: clear F8_MODE for gfx950
In reply to Sasha LevinFrom: Alex Sierra <[email protected]>
[ Upstream commit 59228c6631f902fa826dc61321ab377ba8aadec5 ]
Default F8_MODE should be OCP format on gfx950.
--- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_v9.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager_v9.c +1 -2
@@ -98,8 +98,7 @@ static int update_qpd_v9(struct device_queue_manager *dqm, qpd->sh_mem_config |=1 <<SH_MEM_CONFIG__RETRY_DISABLE__SHIFT ;if (KFD_GC_VERSION (dqm->dev->kfd) ==IP_VERSION (9 ,4 ,3 ) || -KFD_GC_VERSION (dqm->dev->kfd) ==IP_VERSION (9 ,4 ,4 ) || -KFD_GC_VERSION (dqm->dev->kfd) ==IP_VERSION (9 ,5 ,0 )) +KFD_GC_VERSION (dqm->dev->kfd) ==IP_VERSION (9 ,4 ,4 )) qpd->sh_mem_config |= (1 <<SH_MEM_CONFIG__F8_MODE__SHIFT );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 221/642 drm/amdgpu: increase RAS bad page threshold
In reply to Sasha LevinFrom: Tao Zhou <[email protected]>
[ Upstream commit 334dc5fcc3f177823115ec4e075259997c16d4a7 ]
For default policy, driver will issue an RMA event when the number of bad pages is greater than 8 physical rows, rather than reaches 8 physical rows, don't rely on threshold configurable parameters in default mode.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c +3 -3
@@ -748,7 +748,7 @@ amdgpu_ras_eeprom_update_header(struct amdgpu_ras_eeprom_control *control)/* Modify the header if it exceeds. */ if (amdgpu_bad_page_threshold !=0 && - control->ras_num_bad_pages >= ras->bad_page_cnt_threshold) { + control->ras_num_bad_pages > ras->bad_page_cnt_threshold) {dev_warn (adev->dev,"Saved bad pages %d reaches threshold value %d\n" , control->ras_num_bad_pages, ras->bad_page_cnt_threshold);
@@ -806,7 +806,7 @@ amdgpu_ras_eeprom_update_header(struct amdgpu_ras_eeprom_control *control)*/ if (amdgpu_bad_page_threshold !=0 && control->tbl_hdr.version ==RAS_TABLE_VER_V2_1 && - control->ras_num_bad_pages < ras->bad_page_cnt_threshold) + control->ras_num_bad_pages <= ras->bad_page_cnt_threshold) control->tbl_rai.health_percent = ((ras->bad_page_cnt_threshold - control->ras_num_bad_pages) *100 ) / ras->bad_page_cnt_threshold;
@@ -1451,7 +1451,7 @@ int amdgpu_ras_eeprom_check(struct amdgpu_ras_eeprom_control *control) res);return -EINVAL ; } -if (ras->bad_page_cnt_threshold > control->ras_num_bad_pages) { +if (ras->bad_page_cnt_threshold >= control->ras_num_bad_pages) {/* This means that, the threshold was increased since * the last time the system was booted, and now, * ras->bad_page_cnt_threshold - control->num_recs > 0,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 222/642 drm/amdgpu: Fix missing drain retry fault the last entry
In reply to Sasha LevinFrom: Emily Deng <[email protected]>
[ Upstream commit fe2fa3be3d59ba67d6de54a0064441ec233cb50c ]
While the entry get in svm_range_unmap_from_cpu is the last entry, and the entry is page fault, it also need to be dropped. So for equal case, it also need to be dropped.
v2:
Only modify the svm_range_restore_pages.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h | 3 +++ drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h +3 -0
@@ -78,6 +78,9 @@ struct amdgpu_ih_ring {#define amdgpu_ih_ts_after (t1, t2) \ (((int64_t)((t2) << 16) - (int64_t)((t1) << 16)) > 0LL) +#define amdgpu_ih_ts_after_or_equal (t1, t2) \ + (((int64_t)((t2) << 16) - (int64_t)((t1) << 16)) >= 0LL) +/* provided by the ih block */ struct amdgpu_ih_funcs {/* ring read/write ptr handling, called from interrupt context */
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +1 -1
@@ -3024,7 +3024,7 @@ svm_range_restore_pages(struct amdgpu_device *adev, unsigned int pasid,/* check if this page fault time stamp is before svms->checkpoint_ts */ if (svms->checkpoint_ts[gpuidx] !=0 ) { -if (amdgpu_ih_ts_after (ts, svms->checkpoint_ts[gpuidx])) { +if (amdgpu_ih_ts_after_or_equal (ts, svms->checkpoint_ts[gpuidx])) {pr_debug ("draining retry fault, drop fault 0x%llx\n" , addr); r = -EAGAIN ; goto out_unlock_svms;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 223/642 arm64: tegra: p2597: Fix gpio for vdd-1v8-dis regulator
In reply to Sasha LevinFrom: Diogo Ivo <[email protected]>
[ Upstream commit f34621f31e3be81456c903287f7e4c0609829e29 ]
According to the board schematics the enable pin of this regulator is connected to gpio line #9 of the first instance of the TCA9539 GPIO expander, so adjust it.
--- arch/arm64/boot/dts/nvidia/tegra210-p2597.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/nvidia/tegra210-p2597.dtsi +1 -1
@@ -1686,7 +1686,7 @@ vdd_1v8_dis: regulator-vdd-1v8-dis { regulator-min-microvolt = <1800000>; regulator-max-microvolt = <1800000>; regulator-always-on; - gpio = <&exp1 14 GPIO_ACTIVE_HIGH>; + gpio = <&exp1 9 GPIO_ACTIVE_HIGH>; enable-active-high; vin-supply = <&vdd_1v8>; };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 224/642 arm64: tegra: Resize aperture for the IGX PCIe C5 slot
In reply to Sasha LevinFrom: Jon Hunter <[email protected]>
[ Upstream commit 6d4bfe6d86af1ef52bdb4592c9afb2037f24f2c4 ]
Some discrete graphics cards such as the NVIDIA RTX A6000 support resizable BARs. When connecting an A6000 card to the NVIDIA IGX Orin platform, resizing the BAR1 aperture to 8GB fails because the current device-tree configuration for the PCIe C5 slot cannot support this. Fix this by updating the device-tree 'reg' and 'ranges' properties for the PCIe C5 slot to support this.
--- .../boot/dts/nvidia/tegra234-p3740-0002+p3701-0008.dts | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm64/boot/dts/nvidia/tegra234-p3740-0002+p3701-0008.dts +10 -0
@@ -302,6 +302,16 @@ pcie@14160000 { }; pcie@141a0000 { + reg = <0x00 0x141a0000 0x0 0x00020000 /* appl registers (128K) */ + 0x00 0x3a000000 0x0 0x00040000 /* configuration space (256K) */ + 0x00 0x3a040000 0x0 0x00040000 /* iATU_DMA reg space (256K) */ + 0x00 0x3a080000 0x0 0x00040000 /* DBI reg space (256K) */ + 0x2e 0x20000000 0x0 0x10000000>; /* ECAM (256MB) */ + + ranges = <0x81000000 0x00 0x3a100000 0x00 0x3a100000 0x0 0x00100000 /* downstream I/O (1MB) */ + 0x82000000 0x00 0x40000000 0x2e 0x30000000 0x0 0x08000000 /* non-prefetchable memory (128MB) */ + 0xc3000000 0x28 0x00000000 0x28 0x00000000 0x6 0x20000000>; /* prefetchable memory (25088MB) */ + status = "okay"; vddio-pex-ctl-supply = <&vdd_1v8_ls>; phys = <&p2u_nvhs_0>, <&p2u_nvhs_1>, <&p2u_nvhs_2>,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 225/642 powerpc/prom_init: Fixup missing #size-cells on PowerBook6,7
In reply to Sasha LevinFrom: Andreas Schwab <[email protected]>
[ Upstream commit 7e67ef889c9ab7246547db73d524459f47403a77 ]
Similar to the PowerMac3,1, the PowerBook6,7 is missing the #size-cells property on the i2s node.
Depends-on: commit 045b14ca5c36 ("of: WARN on deprecated #address-cells/#size-cells handling")
--- arch/powerpc/kernel/prom_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kernel/prom_init.c +2 -2
@@ -2889,11 +2889,11 @@ static void __init fixup_device_tree_pmac(void)char type[8 ];phandle node; -// Some pmacs are missing #size-cells on escc nodes +// Some pmacs are missing #size-cells on escc or i2s nodes for (node =0 ;prom_next_node (&node); ) { type[0 ] ='\0' ;prom_getprop (node,"device_type" , type,sizeof (type)); -if (prom_strcmp (type,"escc" )) +if (prom_strcmp (type,"escc" ) &&prom_strcmp (type,"i2s" ))continue ;if (prom_getproplen (node,"#size-cells" ) !=PROM_ERROR )
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 226/642 ALSA: seq: Improve data consistency at polling
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit e3cd33ab17c33bd8f1a9df66ec83a15dd8f7afbb ]
snd_seq_poll() calls snd_seq_write_pool_allocated() that reads out a field in client->pool object, while it can be updated concurrently via ioctls, as reported by syzbot. The data race itself is harmless, as it's merely a poll() call, and the state is volatile. OTOH, the read out of poll object info from the caller side is fragile, and we can leave it better in snd_seq_pool_poll_wait() alone.
A similar pattern is seen in snd_seq_kernel_client_write_poll(), too, which is called from the OSS sequencer.
This patch drops the pool checks from the caller side and add the pool->lock in snd_seq_pool_poll_wait() for better data consistency.
--- sound/core/seq/seq_clientmgr.c | 5 +---- sound/core/seq/seq_memory.c | 1 + 2 files changed, 2 insertions(+), 4 deletions(-)
sound/core/seq/seq_clientmgr.c +1 -4
@@ -1150,8 +1150,7 @@ static __poll_t snd_seq_poll(struct file *file, poll_table * wait)if (snd_seq_file_flags (file) &SNDRV_SEQ_LFLG_OUTPUT ) {/* check if data is available in the pool */ -if (!snd_seq_write_pool_allocated (client) || -snd_seq_pool_poll_wait (client->pool, file, wait)) +if (snd_seq_pool_poll_wait (client->pool, file, wait)) mask |=EPOLLOUT |EPOLLWRNORM ; }
@@ -2586,8 +2585,6 @@ int snd_seq_kernel_client_write_poll(int clientid, struct file *file, poll_tableif (client ==NULL )return -ENXIO ; -if (!snd_seq_write_pool_allocated (client)) -return 1 ;if (snd_seq_pool_poll_wait (client->pool, file, wait))return 1 ;return 0 ;
sound/core/seq/seq_memory.c +1 -0
@@ -427,6 +427,7 @@ int snd_seq_pool_poll_wait(struct snd_seq_pool *pool, struct file *file, poll_table *wait) {poll_wait (file, &pool->output_sleep, wait); +guard (spinlock_irq)(&pool->lock);return snd_seq_output_ok (pool); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 227/642 tcp: bring back NUMA dispersion in inet_ehash_locks_alloc()
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit f8ece40786c9342249aa0a1b55e148ee23b2a746 ]
We have platforms with 6 NUMA nodes and 480 cpus.
inet_ehash_locks_alloc() currently allocates a single 64KB page to hold all ehash spinlocks. This adds more pressure on a single node.
Change inet_ehash_locks_alloc() to use vmalloc() to spread the spinlocks on all online nodes, driven by NUMA policies.
At boot time, NUMA policy is interleave=all, meaning that tcp_hashinfo.ehash_locks gets hash dispersion on all nodes.
Tested:
lack5:~# grep inet_ehash_locks_alloc /proc/vmallocinfo 0x00000000d9aec4d1-0x00000000a828b652 69632 inet_ehash_locks_alloc+0x90/0x100 pages=16 vmalloc N0=2 N1=3 N2=3 N3=3 N4=3 N5=2
lack5:~# echo 8192 >/proc/sys/net/ipv4/tcp_child_ehash_entries lack5:~# numactl --interleave=all unshare -n bash -c "grep inet_ehash_locks_alloc /proc/vmallocinfo" 0x000000004e99d30c-0x00000000763f3279 36864 inet_ehash_locks_alloc+0x90/0x100 pages=8 vmalloc N0=1 N1=2 N2=2 N3=1 N4=1 N5=1 0x00000000d9aec4d1-0x00000000a828b652 69632 inet_ehash_locks_alloc+0x90/0x100 pages=16 vmalloc N0=2 N1=3 N2=3 N3=3 N4=3 N5=2
lack5:~# numactl --interleave=0,5 unshare -n bash -c "grep inet_ehash_locks_alloc /proc/vmallocinfo" 0x00000000fd73a33e-0x0000000004b9a177 36864 inet_ehash_locks_alloc+0x90/0x100 pages=8 vmalloc N0=4 N5=4 0x00000000d9aec4d1-0x00000000a828b652 69632 inet_ehash_locks_alloc+0x90/0x100 pages=16 vmalloc N0=2 N1=3 N2=3 N3=3 N4=3 N5=2
lack5:~# echo 1024 >/proc/sys/net/ipv4/tcp_child_ehash_entries lack5:~# numactl --interleave=all unshare -n bash -c "grep inet_ehash_locks_alloc /proc/vmallocinfo" 0x00000000db07d7a2-0x00000000ad697d29 8192 inet_ehash_locks_alloc+0x90/0x100 pages=1 vmalloc N2=1 0x00000000d9aec4d1-0x00000000a828b652 69632 inet_ehash_locks_alloc+0x90/0x100 pages=16 vmalloc N0=2 N1=3 N2=3 N3=3 N4=3 N5=2
--- net/ipv4/inet_hashtables.c | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-)
net/ipv4/inet_hashtables.c +26 -11
@@ -1230,22 +1230,37 @@ int inet_ehash_locks_alloc(struct inet_hashinfo *hashinfo) {unsigned int locksz =sizeof (spinlock_t);unsigned int i, nblocks =1 ; +spinlock_t *ptr =NULL ; -if (locksz !=0 ) { -/* allocate 2 cache lines or at least one spinlock per cpu */ - nblocks =max (2U *L1_CACHE_BYTES / locksz,1U ); - nblocks =roundup_pow_of_two (nblocks *num_possible_cpus ()); +if (locksz ==0 ) + goto set_mask; -/* no more locks than number of hash buckets */ - nblocks =min (nblocks, hashinfo->ehash_mask +1 ); +/* Allocate 2 cache lines or at least one spinlock per cpu. */ + nblocks =max (2U *L1_CACHE_BYTES / locksz,1U ) *num_possible_cpus (); - hashinfo->ehash_locks =kvmalloc_array (nblocks, locksz,GFP_KERNEL ); -if (!hashinfo->ehash_locks) -return -ENOMEM ; +/* At least one page per NUMA node. */ + nblocks =max (nblocks,num_online_nodes () *PAGE_SIZE / locksz); + + nblocks =roundup_pow_of_two (nblocks); + +/* No more locks than number of hash buckets. */ + nblocks =min (nblocks, hashinfo->ehash_mask +1 ); -for (i =0 ; i < nblocks; i++) -spin_lock_init (&hashinfo->ehash_locks[i]); +if (num_online_nodes () >1 ) { +/* Use vmalloc() to allow NUMA policy to spread pages +* on all available nodes if desired. +*/ + ptr =vmalloc_array (nblocks, locksz); + } +if (!ptr) { + ptr =kvmalloc_array (nblocks, locksz,GFP_KERNEL ); +if (!ptr) +return -ENOMEM ; } +for (i =0 ; i < nblocks; i++) +spin_lock_init (&ptr[i]); + hashinfo->ehash_locks = ptr; +set_mask: hashinfo->ehash_locks_mask = nblocks -1 ;return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 228/642 rseq: Fix segfault on registration when rseq_cs is non-zero
In reply to Sasha LevinFrom: Michael Jeanson <[email protected]>
[ Upstream commit fd881d0a085fc54354414aed990ccf05f282ba53 ]
The rseq_cs field is documented as being set to 0 by user-space prior to registration, however this is not currently enforced by the kernel. This can result in a segfault on return to user-space if the value stored in the rseq_cs field doesn't point to a valid struct rseq_cs.
The correct solution to this would be to fail the rseq registration when the rseq_cs field is non-zero. However, some older versions of glibc will reuse the rseq area of previous threads without clearing the rseq_cs field and will also terminate the process if the rseq registration fails in a secondary thread. This wasn't caught in testing because in this case the leftover rseq_cs does point to a valid struct rseq_cs.
What we can do is clear the rseq_cs field on registration when it's non-zero which will prevent segfaults on registration and won't break the glibc versions that reuse rseq areas on thread creation.
--- kernel/rseq.c | 60 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 48 insertions(+), 12 deletions(-)
kernel/rseq.c +48 -12
@@ -236,6 +236,29 @@ static int rseq_reset_rseq_cpu_node_id(struct task_struct *t)return -EFAULT ; } +/* +* Get the user-space pointer value stored in the 'rseq_cs' field. +*/ +static int rseq_get_rseq_cs_ptr_val (struct rseq __user *rseq,u64 *rseq_cs) +{ +if (!rseq_cs) +return -EFAULT ; + +#ifdef CONFIG_64BIT +if (get_user (*rseq_cs, &rseq->rseq_cs)) +return -EFAULT ; +#else +if (copy_from_user (rseq_cs, &rseq->rseq_cs,sizeof (*rseq_cs))) +return -EFAULT ; +#endif + +return 0 ; +} + +/* +* If the rseq_cs field of 'struct rseq' contains a valid pointer to +* user-space, copy 'struct rseq_cs' from user-space and validate its fields. +*/ static int rseq_get_rseq_cs (struct task_struct *t,struct rseq_cs *rseq_cs) {struct rseq_cs __user *urseq_cs;
@@ -244,17 +267,16 @@ static int rseq_get_rseq_cs(struct task_struct *t, struct rseq_cs *rseq_cs)u32 sig;int ret; -#ifdef CONFIG_64BIT -if (get_user (ptr, &t->rseq->rseq_cs)) -return -EFAULT ; -#else -if (copy_from_user (&ptr, &t->rseq->rseq_cs,sizeof (ptr))) -return -EFAULT ; -#endif + ret =rseq_get_rseq_cs_ptr_val (t->rseq, &ptr); +if (ret) +return ret; + +/* If the rseq_cs pointer is NULL, return a cleared struct rseq_cs. */ if (!ptr) {memset (rseq_cs,0 ,sizeof (*rseq_cs));return 0 ; } +/* Check that the pointer value fits in the user-space process space. */ if (ptr >=TASK_SIZE )return -EINVAL ; urseq_cs = (struct rseq_cs __user *)(unsigned long )ptr;
@@ -330,7 +352,7 @@ static int rseq_need_restart(struct task_struct *t, u32 cs_flags)return !!event_mask; } -static int clear_rseq_cs (struct task_struct *t) +static int clear_rseq_cs (struct rseq __user *rseq) {/* * The rseq_cs field is set to NULL on preemption or signal
@@ -341,9 +363,9 @@ static int clear_rseq_cs(struct task_struct *t)* Set rseq_cs to NULL. */ #ifdef CONFIG_64BIT -return put_user (0UL , &t->rseq->rseq_cs); +return put_user (0UL , &rseq->rseq_cs);#else -if (clear_user (&t->rseq->rseq_cs,sizeof (t->rseq->rseq_cs))) +if (clear_user (&rseq->rseq_cs,sizeof (rseq->rseq_cs)))return -EFAULT ;return 0 ;#endif
@@ -375,11 +397,11 @@ static int rseq_ip_fixup(struct pt_regs *regs)* Clear the rseq_cs pointer and return. */ if (!in_rseq_cs (ip, &rseq_cs)) -return clear_rseq_cs (t); +return clear_rseq_cs (t->rseq); ret =rseq_need_restart (t, rseq_cs.flags);if (ret <=0 )return ret; - ret =clear_rseq_cs (t); + ret =clear_rseq_cs (t->rseq);if (ret)return ret; trace_rseq_ip_fixup(ip, rseq_cs.start_ip, rseq_cs.post_commit_offset,
@@ -453,6 +475,7 @@ SYSCALL_DEFINE4(rseq, struct rseq __user *, rseq, u32, rseq_len, int, flags, u32, sig) { int ret; +u64 rseq_cs;if (flags &RSEQ_FLAG_UNREGISTER ) {if (flags & ~RSEQ_FLAG_UNREGISTER )
@@ -507,6 +530,19 @@ SYSCALL_DEFINE4(rseq, struct rseq __user *, rseq, u32, rseq_len,return -EINVAL ;if (!access_ok (rseq, rseq_len))return -EFAULT ; + +/* +* If the rseq_cs pointer is non-NULL on registration, clear it to +* avoid a potential segfault on return to user-space. The proper thing +* to do would have been to fail the registration but this would break +* older libcs that reuse the rseq area for new threads without +* clearing the fields. +*/ +if (rseq_get_rseq_cs_ptr_val (rseq, &rseq_cs)) +return -EFAULT ; +if (rseq_cs &&clear_rseq_cs (rseq)) +return -EFAULT ; +#ifdef CONFIG_DEBUG_RSEQ /* * Initialize the in-kernel rseq fields copy for validation of
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 229/642 rtc: ds1307: stop disabling alarms on probe
In reply to Sasha LevinFrom: Alexandre Belloni <[email protected]>
[ Upstream commit dcec12617ee61beed928e889607bf37e145bf86b ]
It is a bad practice to disable alarms on probe or remove as this will prevent alarms across reboots.
--- drivers/rtc/rtc-ds1307.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/rtc/rtc-ds1307.c +1 -3
@@ -1807,10 +1807,8 @@ static int ds1307_probe(struct i2c_client *client)* For some variants, be sure alarms can trigger when we're * running on Vbackup (BBSQI/BBSQW) */ -if (want_irq || ds1307_can_wakeup_device) { +if (want_irq || ds1307_can_wakeup_device) regs[0 ] |=DS1337_BIT_INTCN | chip->bbsqi_bit; - regs[0 ] &= ~(DS1337_BIT_A2IE |DS1337_BIT_A1IE ); - }regmap_write (ds1307->regmap,DS1337_REG_CONTROL , regs[0 ]);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 230/642 ieee802154: ca8210: Use proper setters and getters for bitwise types
In reply to Sasha LevinFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 169b2262205836a5d1213ff44dca2962276bece1 ]
Sparse complains that the driver doesn't respect the bitwise types:
drivers/net/ieee802154/ca8210.c:1796:27: warning: incorrect type in assignment (different base types)drivers/net/ieee802154/ca8210.c:1796:27: expected restricted __le16 [addressable] [assigned] [usertype] pan_iddrivers/net/ieee802154/ca8210.c:1796:27: got unsigned short [usertype]drivers/net/ieee802154/ca8210.c:1801:25: warning: incorrect type in assignment (different base types)drivers/net/ieee802154/ca8210.c:1801:25: expected restricted __le16 [addressable] [assigned] [usertype] pan_iddrivers/net/ieee802154/ca8210.c:1801:25: got unsigned short [usertype]drivers/net/ieee802154/ca8210.c:1928:28: warning: incorrect type in argument 3 (different base types)drivers/net/ieee802154/ca8210.c:1928:28: expected unsigned short [usertype] dst_pan_iddrivers/net/ieee802154/ca8210.c:1928:28: got restricted __le16 [addressable] [usertype] pan_id
Use proper setters and getters for bitwise types.
Note, in accordance with [1] the protocol is little endian.
--- drivers/net/ieee802154/ca8210.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/ieee802154/ca8210.c +4 -5
@@ -1446,8 +1446,7 @@ static u8 mcps_data_request( command.pdata.data_req.src_addr_mode = src_addr_mode; command.pdata.data_req.dst.mode = dst_address_mode;if (dst_address_mode !=MAC_MODE_NO_ADDR ) { - command.pdata.data_req.dst.pan_id[0 ] =LS_BYTE (dst_pan_id); - command.pdata.data_req.dst.pan_id[1 ] =MS_BYTE (dst_pan_id); +put_unaligned_le16 (dst_pan_id, command.pdata.data_req.dst.pan_id);if (dst_address_mode ==MAC_MODE_SHORT_ADDR ) { command.pdata.data_req.dst.address[0 ] =LS_BYTE ( dst_addr->short_address
@@ -1795,12 +1794,12 @@ static int ca8210_skb_rx( } hdr.source.mode = data_ind[0 ];dev_dbg (&priv->spi->dev,"srcAddrMode: %#03x\n" , hdr.source.mode); - hdr.source.pan_id = *(u16 *)&data_ind[1 ]; + hdr.source.pan_id =cpu_to_le16 (get_unaligned_le16 (&data_ind[1 ]));dev_dbg (&priv->spi->dev,"srcPanId: %#06x\n" , hdr.source.pan_id);memcpy (&hdr.source.extended_addr, &data_ind[3 ],8 ); hdr.dest.mode = data_ind[11 ];dev_dbg (&priv->spi->dev,"dstAddrMode: %#03x\n" , hdr.dest.mode); - hdr.dest.pan_id = *(u16 *)&data_ind[12 ]; + hdr.dest.pan_id =cpu_to_le16 (get_unaligned_le16 (&data_ind[12 ]));dev_dbg (&priv->spi->dev,"dstPanId: %#06x\n" , hdr.dest.pan_id);memcpy (&hdr.dest.extended_addr, &data_ind[14 ],8 );
@@ -1927,7 +1926,7 @@ static int ca8210_skb_tx( status = mcps_data_request( header.source.mode, header.dest.mode, - header.dest.pan_id, + le16_to_cpu(header.dest.pan_id), (union macaddr *)&header.dest.extended_addr, skb->len - mac_len, &skb->data[mac_len],
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 231/642 drm/xe: Nuke VM's mapping upon close
In reply to Sasha LevinFrom: Matthew Brost <[email protected]>
[ Upstream commit 074e40d9c2a84939fe28d7121d3469db50f34a3d ]
Clear root PT entry and invalidate entire VM's address space when closing the VM. Will prevent the GPU from accessing any of the VM's memory after closing.
v2:
- s/vma/vm in kernel doc (CI)
- Don't nuke migration VM as this occur at driver unload (CI)
v3:
- Rebase and pull into SVM series (Thomas)
- Wait for pending binds (Thomas)
v5:
- Remove xe_gt_tlb_invalidation_fence_fini in error case (Matt Auld)
- Drop local migration bool (Thomas)
v7:
- Add drm_dev_enter/exit protecting invalidation (CI, Matt Auld)
--- drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c | 22 ++++++++++++++ drivers/gpu/drm/xe/xe_gt_tlb_invalidation.h | 2 ++ drivers/gpu/drm/xe/xe_pt.c | 14 +++++++++ drivers/gpu/drm/xe/xe_pt.h | 3 ++ drivers/gpu/drm/xe/xe_vm.c | 32 +++++++++++++++++++++ 5 files changed, 73 insertions(+)
drivers/gpu/drm/xe/xe_gt_tlb_invalidation.c +22 -0
@@ -418,6 +418,28 @@ int xe_gt_tlb_invalidation_range(struct xe_gt *gt,return send_tlb_invalidation (>->uc.guc, fence, action, len); } +/** +* xe_gt_tlb_invalidation_vm - Issue a TLB invalidation on this GT for a VM +* @gt: graphics tile +* @vm: VM to invalidate +* +* Invalidate entire VM's address space +*/ +void xe_gt_tlb_invalidation_vm (struct xe_gt *gt,struct xe_vm *vm) +{ +struct xe_gt_tlb_invalidation_fence fence; +u64 range =1ull << vm->xe->info.va_bits; +int ret; + +xe_gt_tlb_invalidation_fence_init (gt, &fence, true); + + ret =xe_gt_tlb_invalidation_range (gt, &fence,0 , range, vm->usm.asid); +if (ret <0 ) +return ; + +xe_gt_tlb_invalidation_fence_wait (&fence); +} +/** * xe_gt_tlb_invalidation_vma - Issue a TLB invalidation on this GT for a VMA * @gt: GT structure
drivers/gpu/drm/xe/xe_gt_tlb_invalidation.h +2 -0
@@ -12,6 +12,7 @@struct xe_gt ;struct xe_guc ; +struct xe_vm ;struct xe_vma ;int xe_gt_tlb_invalidation_init_early (struct xe_gt *gt);
@@ -21,6 +22,7 @@ int xe_gt_tlb_invalidation_ggtt(struct xe_gt *gt);int xe_gt_tlb_invalidation_vma (struct xe_gt *gt,struct xe_gt_tlb_invalidation_fence *fence,struct xe_vma *vma); +void xe_gt_tlb_invalidation_vm (struct xe_gt *gt,struct xe_vm *vm);int xe_gt_tlb_invalidation_range (struct xe_gt *gt,struct xe_gt_tlb_invalidation_fence *fence,u64 start,u64 end,u32 asid);
drivers/gpu/drm/xe/xe_pt.c +14 -0
@@ -218,6 +218,20 @@ void xe_pt_destroy(struct xe_pt *pt, u32 flags, struct llist_head *deferred)xe_pt_free (pt); } +/** +* xe_pt_clear() - Clear a page-table. +* @xe: xe device. +* @pt: The page-table. +* +* Clears page-table by setting to zero. +*/ +void xe_pt_clear (struct xe_device *xe,struct xe_pt *pt) +{ +struct iosys_map *map = &pt->bo->vmap; + +xe_map_memset (xe, map,0 ,0 ,SZ_4K ); +} +/** * DOC: Pagetable building *
drivers/gpu/drm/xe/xe_pt.h +3 -0
@@ -13,6 +13,7 @@ struct dma_fence;struct xe_bo ;struct xe_device ;struct xe_exec_queue ; +struct xe_svm_range ;struct xe_sync_entry ;struct xe_tile ;struct xe_vm ;
@@ -35,6 +36,8 @@ void xe_pt_populate_empty(struct xe_tile *tile, struct xe_vm *vm,void xe_pt_destroy (struct xe_pt *pt,u32 flags,struct llist_head *deferred); +void xe_pt_clear (struct xe_device *xe,struct xe_pt *pt); +int xe_pt_update_ops_prepare (struct xe_tile *tile,struct xe_vma_ops *vops);struct dma_fence *xe_pt_update_ops_run (struct xe_tile *tile,struct xe_vma_ops *vops);
drivers/gpu/drm/xe/xe_vm.c +32 -0
@@ -8,6 +8,7 @@#include <linux/dma-fence-array.h> #include <linux/nospec.h> +#include <drm/drm_drv.h> #include <drm/drm_exec.h> #include <drm/drm_print.h> #include <drm/ttm/ttm_tt.h>
@@ -1582,9 +1583,40 @@ struct xe_vm *xe_vm_create(struct xe_device *xe, u32 flags)static void xe_vm_close (struct xe_vm *vm) { +struct xe_device *xe = vm->xe; +bool bound; +int idx; + + bound =drm_dev_enter (&xe->drm, &idx); +down_write (&vm->lock); + vm->size =0 ; + +if (!((vm->flags &XE_VM_FLAG_MIGRATION ))) { +struct xe_tile *tile; +struct xe_gt *gt; +u8 id; + +/* Wait for pending binds */ +dma_resv_wait_timeout (xe_vm_resv (vm), +DMA_RESV_USAGE_BOOKKEEP , + false,MAX_SCHEDULE_TIMEOUT ); + +if (bound) { +for_each_tile (tile, xe, id) +if (vm->pt_root[id]) +xe_pt_clear (xe, vm->pt_root[id]); + +for_each_gt (gt, xe, id) +xe_gt_tlb_invalidation_vm (gt, vm); + } + } +up_write (&vm->lock); + +if (bound) +drm_dev_exit (idx); }void xe_vm_close_and_put (struct xe_vm *vm)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 232/642 drm/xe: Retry BO allocation
In reply to Sasha LevinFrom: Matthew Brost <[email protected]>
[ Upstream commit 1d724a2f1b2c3f0cba4975784a808482e0631adf ]
TTM doesn't support fair eviction via WW locking, this mitigated in by using retry loops in exec and preempt rebind worker. Extend this retry loop to BO allocation. Once TTM supports fair eviction this patch can be reverted.
v4:
- Keep line break (Stuart)
--- drivers/gpu/drm/xe/xe_bo.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/xe/xe_bo.c +7 -0
@@ -2142,6 +2142,7 @@ int xe_gem_create_ioctl(struct drm_device *dev, void *data,struct xe_file *xef =to_xe_file (file);struct drm_xe_gem_create *args = data;struct xe_vm *vm =NULL ; +ktime_t end =0 ;struct xe_bo *bo;unsigned int bo_flags;u32 handle;
@@ -2214,6 +2215,10 @@ int xe_gem_create_ioctl(struct drm_device *dev, void *data, vm =xe_vm_lookup (xef, args->vm_id);if (XE_IOCTL_DBG (xe, !vm))return -ENOENT ; + } + +retry: +if (vm) { err =xe_vm_lock (vm, true);if (err) goto out_vm;
@@ -2227,6 +2232,8 @@ int xe_gem_create_ioctl(struct drm_device *dev, void *data,if (IS_ERR (bo)) { err =PTR_ERR (bo); +if (xe_vm_validate_should_retry (NULL , err, &end)) + goto retry; goto out_vm; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 233/642 soc: samsung: include linux/array_size.h where needed
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 4c57930f68d90e0d52c396d058cfa9ed8447a6c4 ]
This does not necessarily get included through asm/io.h:
drivers/soc/samsung/exynos3250-pmu.c:120:18: error: use of undeclared identifier 'ARRAY_SIZE'
120 | for (i = 0; i < ARRAY_SIZE(exynos3250_list_feed); i++) {
| ^drivers/soc/samsung/exynos5250-pmu.c:162:18: error: use of undeclared identifier 'ARRAY_SIZE'
162 | for (i = 0; i < ARRAY_SIZE(exynos5_list_both_cnt_feed); i++) {
| ^
--- drivers/soc/samsung/exynos-asv.c | 1 + drivers/soc/samsung/exynos-chipid.c | 1 + drivers/soc/samsung/exynos-pmu.c | 1 + drivers/soc/samsung/exynos-usi.c | 1 + drivers/soc/samsung/exynos3250-pmu.c | 1 + drivers/soc/samsung/exynos5250-pmu.c | 1 + drivers/soc/samsung/exynos5420-pmu.c | 1 + 7 files changed, 7 insertions(+)
drivers/soc/samsung/exynos-asv.c +1 -0
@@ -9,6 +9,7 @@* Samsung Exynos SoC Adaptive Supply Voltage support */ +#include <linux/array_size.h> #include <linux/cpu.h> #include <linux/device.h> #include <linux/energy_model.h>
drivers/soc/samsung/exynos-chipid.c +1 -0
@@ -12,6 +12,7 @@* Samsung Exynos SoC Adaptive Supply Voltage and Chip ID support */ +#include <linux/array_size.h> #include <linux/device.h> #include <linux/errno.h> #include <linux/mfd/syscon.h>
drivers/soc/samsung/exynos-pmu.c +1 -0
@@ -5,6 +5,7 @@// // Exynos - CPU PMU(Power Management Unit) support +#include <linux/array_size.h> #include <linux/arm-smccc.h> #include <linux/of.h> #include <linux/of_address.h>
drivers/soc/samsung/exynos-usi.c +1 -0
@@ -6,6 +6,7 @@* Samsung Exynos USI driver (Universal Serial Interface). */ +#include <linux/array_size.h> #include <linux/clk.h> #include <linux/mfd/syscon.h> #include <linux/module.h>
drivers/soc/samsung/exynos3250-pmu.c +1 -0
@@ -5,6 +5,7 @@// // Exynos3250 - CPU PMU (Power Management Unit) support +#include <linux/array_size.h> #include <linux/soc/samsung/exynos-regs-pmu.h> #include <linux/soc/samsung/exynos-pmu.h>
drivers/soc/samsung/exynos5250-pmu.c +1 -0
@@ -5,6 +5,7 @@// // Exynos5250 - CPU PMU (Power Management Unit) support +#include <linux/array_size.h> #include <linux/soc/samsung/exynos-regs-pmu.h> #include <linux/soc/samsung/exynos-pmu.h>
drivers/soc/samsung/exynos5420-pmu.c +1 -0
@@ -5,6 +5,7 @@// // Exynos5420 - CPU PMU (Power Management Unit) support +#include <linux/array_size.h> #include <linux/pm.h> #include <linux/soc/samsung/exynos-regs-pmu.h> #include <linux/soc/samsung/exynos-pmu.h>
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 234/642 ARM: tegra: Switch DSI-B clock parent to PLLD on Tegra114
In reply to Sasha LevinFrom: Svyatoslav Ryhel <[email protected]>
[ Upstream commit 2b3db788f2f614b875b257cdb079adadedc060f3 ]
PLLD is usually used as parent clock for internal video devices, like DSI for example, while PLLD2 is used as parent for HDMI.
--- arch/arm/boot/dts/nvidia/tegra114.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/nvidia/tegra114.dtsi +1 -1
@@ -139,7 +139,7 @@ dsib: dsi@54400000 { reg = <0x54400000 0x00040000>; clocks = <&tegra_car TEGRA114_CLK_DSIB>, <&tegra_car TEGRA114_CLK_DSIBLP>, - <&tegra_car TEGRA114_CLK_PLL_D2_OUT0>; + <&tegra_car TEGRA114_CLK_PLL_D_OUT0>; clock-names = "dsi", "lp", "parent"; resets = <&tegra_car 82>; reset-names = "dsi";
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 235/642 media: c8sectpfe: Call of_node_put(i2c_bus) only once in c8sectpfe_probe()
In reply to Sasha LevinFrom: Markus Elfring <[email protected]>
[ Upstream commit b773530a34df0687020520015057075f8b7b4ac4 ]
An of_node_put(i2c_bus) call was immediately used after a pointer check for an of_find_i2c_adapter_by_node() call in this function implementation. Thus call such a function only once instead directly before the check.
This issue was transformed by using the Coccinelle software.
--- drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/platform/st/sti/c8sectpfe/c8sectpfe-core.c +1 -2
@@ -797,13 +797,12 @@ static int c8sectpfe_probe(struct platform_device *pdev) } tsin->i2c_adapter =of_find_i2c_adapter_by_node (i2c_bus); +of_node_put (i2c_bus);if (!tsin->i2c_adapter) {dev_err (&pdev->dev,"No i2c adapter found\n" ); -of_node_put (i2c_bus); ret = -ENODEV ; goto err_node_put; } -of_node_put (i2c_bus);/* Acquire reset GPIO and activate it */ tsin->rst_gpio = devm_fwnode_gpiod_get(dev,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 236/642 media: cec: use us_to_ktime() where appropriate
In reply to Sasha LevinFrom: Vitaliy Shevtsov <[email protected]>
[ Upstream commit c0c1a6bf80e9075e3f6b81fd542550d8eb91e57a ]
[Why]
There are several ns_to_ktime() calls that require using nanoseconds. It is better to replace them with us_to_ktime() to make code clear, getting rid of multiplication by 1000.
Also the timer function code may have an integer wrap-around issue. Since both tx_custom_low_usecs and tx_custom_high_usecs can be set to up to 9999999 from the user space via cec_pin_error_inj_parse_line(), this may cause usecs to be overflowed when adap->monitor_pin_cnt is zero and usecs is multiplied by 1000.
[How]
Take advantage of using an appropriate helper func us_to_ktime() instead of ns_to_ktime() to improve readability and to make the code clearer. And this also mitigates possible integer wrap-arounds when usecs value is too large and it is multiplied by 1000.
Found by Linux Verification Center (linuxtesting.org) with Svace.
--- drivers/media/cec/core/cec-pin.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/media/cec/core/cec-pin.c +5 -6
@@ -873,19 +873,19 @@ static enum hrtimer_restart cec_pin_timer(struct hrtimer *timer)if (pin->wait_usecs >150 ) { pin->wait_usecs -=100 ; pin->timer_ts =ktime_add_us (ts,100 ); -hrtimer_forward_now (timer,ns_to_ktime (100000 )); +hrtimer_forward_now (timer,us_to_ktime (100 ));return HRTIMER_RESTART ; }if (pin->wait_usecs >100 ) { pin->wait_usecs /=2 ; pin->timer_ts =ktime_add_us (ts, pin->wait_usecs);hrtimer_forward_now (timer, -ns_to_ktime (pin->wait_usecs *1000 )); +us_to_ktime (pin->wait_usecs));return HRTIMER_RESTART ; } pin->timer_ts =ktime_add_us (ts, pin->wait_usecs);hrtimer_forward_now (timer, -ns_to_ktime (pin->wait_usecs *1000 )); +us_to_ktime (pin->wait_usecs)); pin->wait_usecs =0 ;return HRTIMER_RESTART ; }
@@ -1020,13 +1020,12 @@ static enum hrtimer_restart cec_pin_timer(struct hrtimer *timer)if (!adap->monitor_pin_cnt || usecs <=150 ) { pin->wait_usecs =0 ; pin->timer_ts =ktime_add_us (ts, usecs); -hrtimer_forward_now (timer, -ns_to_ktime (usecs *1000 )); +hrtimer_forward_now (timer,us_to_ktime (usecs));return HRTIMER_RESTART ; } pin->wait_usecs = usecs -100 ; pin->timer_ts =ktime_add_us (ts,100 ); -hrtimer_forward_now (timer,ns_to_ktime (100000 )); +hrtimer_forward_now (timer,us_to_ktime (100 ));return HRTIMER_RESTART ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 237/642 usb: xhci: set page size to the xHCI-supported size
In reply to Sasha LevinFrom: Niklas Neronin <[email protected]>
[ Upstream commit 68c1f1671650b49bbd26e6a65ddcf33f2565efa3 ]
The current xHCI driver does not validate whether a page size of 4096 bytes is supported. Address the issue by setting the page size to the value supported by the xHCI controller, as read from the Page Size register. In the event of an unexpected value; default to a 4K page size.
Additionally, this commit removes unnecessary debug messages and instead prints the supported and used page size once.
The xHCI controller supports page sizes of (2^{(n+12)}) bytes, where 'n' is the Page Size Bit. Only one page size is supported, with a maximum page size of 128 KB.
--- drivers/usb/host/xhci-mem.c | 34 ++++++++++++++++++---------------- drivers/usb/host/xhci.h | 8 ++++---- 2 files changed, 22 insertions(+), 20 deletions(-)
drivers/usb/host/xhci-mem.c +18 -16
@@ -1953,7 +1953,6 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) xhci->interrupters =NULL ; xhci->page_size =0 ; - xhci->page_shift =0 ; xhci->usb2_rhub.bus_state.bus_suspended =0 ; xhci->usb3_rhub.bus_state.bus_suspended =0 ; }
@@ -2372,6 +2371,22 @@ xhci_create_secondary_interrupter(struct usb_hcd *hcd, unsigned int segs, }EXPORT_SYMBOL_GPL (xhci_create_secondary_interrupter); +static void xhci_hcd_page_size (struct xhci_hcd *xhci) +{ +u32 page_size; + + page_size =readl (&xhci->op_regs->page_size) &XHCI_PAGE_SIZE_MASK ; +if (!is_power_of_2 (page_size)) { +xhci_warn (xhci,"Invalid page size register = 0x%x\n" , page_size); +/* Fallback to 4K page size, since that's common */ + page_size =1 ; + } + + xhci->page_size = page_size <<12 ; +xhci_dbg_trace (xhci, trace_xhci_dbg_init,"HCD page size set to %iK" , + xhci->page_size >>10 ); +} +int xhci_mem_init (struct xhci_hcd *xhci,gfp_t flags) {struct xhci_interrupter *ir;
@@ -2379,7 +2394,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)dma_addr_t dma;unsigned int val, val2;u64 val_64; -u32 page_size, temp; +u32 temp;int i;INIT_LIST_HEAD (&xhci->cmd_list);
@@ -2388,20 +2403,7 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)INIT_DELAYED_WORK (&xhci->cmd_timer, xhci_handle_command_timeout);init_completion (&xhci->cmd_ring_stop_completion); - page_size =readl (&xhci->op_regs->page_size); -xhci_dbg_trace (xhci, trace_xhci_dbg_init, -"Supported page size register = 0x%x" , page_size); - val =ffs (page_size) -1 ; -if (val <16 ) -xhci_dbg_trace (xhci, trace_xhci_dbg_init, -"Supported page size of %iK" , (1 << (val +12 )) /1024 ); -else -xhci_warn (xhci,"WARN: no supported page size\n" ); -/* Use 4K pages, since that's common and the minimum the HC supports */ - xhci->page_shift =12 ; - xhci->page_size =1 << xhci->page_shift; -xhci_dbg_trace (xhci, trace_xhci_dbg_init, -"HCD page size set to %iK" , xhci->page_size /1024 ); +xhci_hcd_page_size (xhci);/* * Program the Number of Device Slots Enabled field in the CONFIG
drivers/usb/host/xhci.h +4 -4
@@ -211,6 +211,9 @@ struct xhci_op_regs {#define CONFIG_CIE (1 << 9)/* bits 10:31 - reserved and should be preserved */ +/* bits 15:0 - HCD page shift bit */ +#define XHCI_PAGE_SIZE_MASK 0xffff +/** * struct xhci_intr_reg - Interrupt Register Set * @irq_pending: IMAN - Interrupt Management Register. Used to enable
@@ -1514,10 +1517,7 @@ struct xhci_hcd {u16 max_interrupters;/* imod_interval in ns (I * 250ns) */ u32 imod_interval; -/* 4KB min, 128MB max */ -int page_size; -/* Valid values are 12 to 20, inclusive */ -int page_shift; +u32 page_size;/* MSI-X/MSI vectors */ int nvecs;/* optional clocks */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 238/642 dm cache: prevent BUG_ON by blocking retries on failed device resumes
In reply to Sasha LevinFrom: Ming-Hung Tsai <[email protected]>
[ Upstream commit 5da692e2262b8f81993baa9592f57d12c2703dea ]
A cache device failing to resume due to mapping errors should not be retried, as the failure leaves a partially initialized policy object. Repeating the resume operation risks triggering BUG_ON when reloading cache mappings into the incomplete policy object.
Reproduce steps:
1. create a cache metadata consisting of 512 or more cache blocks, with some mappings stored in the first array block of the mapping array. Here we use cache_restore v1.0 to build the metadata.
cat <<EOF >> cmeta.xml
<superblock uuid="" block_size="128" nr_cache_blocks="512" \
policy="smq" hint_width="4">
<mappings>
<mapping cache_block="0" origin_block="0" dirty="false"/>
</mappings>
</superblock>
EOF
dmsetup create cmeta --table "0 8192 linear /dev/sdc 0" cache_restore -i cmeta.xml -o /dev/mapper/cmeta --metadata-version=2 dmsetup remove cmeta
2. wipe the second array block of the mapping array to simulate data degradations.
mapping_root=$(dd if=/dev/sdc bs=1c count=8 skip=192 \
2>/dev/null | hexdump -e '1/8 "%u\n"')
ablock=$(dd if=/dev/sdc bs=1c count=8 skip=$((4096*mapping_root+2056)) \
2>/dev/null | hexdump -e '1/8 "%u\n"')
dd if=/dev/zero of=/dev/sdc bs=4k count=1 seek=$ablock
3. try bringing up the cache device. The resume is expected to fail due to the broken array block.
dmsetup create cmeta --table "0 8192 linear /dev/sdc 0" dmsetup create cdata --table "0 65536 linear /dev/sdc 8192" dmsetup create corig --table "0 524288 linear /dev/sdc 262144" dmsetup create cache --notable
dmsetup load cache --table "0 524288 cache /dev/mapper/cmeta \/dev/mapper/cdata /dev/mapper/corig 128 2 metadata2 writethrough smq 0" dmsetup resume cache
4. try resuming the cache again. An unexpected BUG_ON is triggered while loading cache mappings.
dmsetup resume cache
Kernel logs:
(snip)
------------[ cut here ]------------ kernel BUG at drivers/md/dm-cache-policy-smq.c:752! Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN NOPTI CPU: 0 UID: 0 PID: 332 Comm: dmsetup Not tainted 6.13.4 #3 RIP: 0010:smq_load_mapping+0x3e5/0x570
Fix by disallowing resume operations for devices that failed the initial attempt.
--- drivers/md/dm-cache-target.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/md/dm-cache-target.c +24 -0
@@ -2899,6 +2899,27 @@ static dm_cblock_t get_cache_dev_size(struct cache *cache)return to_cblock (size); } +static bool can_resume (struct cache *cache) +{ +/* +* Disallow retrying the resume operation for devices that failed the +* first resume attempt, as the failure leaves the policy object partially +* initialized. Retrying could trigger BUG_ON when loading cache mappings +* into the incomplete policy object. +*/ +if (cache->sized && !cache->loaded_mappings) { +if (get_cache_mode (cache) !=CM_WRITE ) +DMERR ("%s: unable to resume a failed-loaded cache, please check metadata." , +cache_device_name (cache)); +else +DMERR ("%s: unable to resume cache due to missing proper cache table reload" , +cache_device_name (cache)); +return false; + } + +return true; +} +static bool can_resize (struct cache *cache,dm_cblock_t new_size) {if (from_cblock (new_size) >from_cblock (cache->cache_size)) {
@@ -2947,6 +2968,9 @@ static int cache_preresume(struct dm_target *ti)struct cache *cache = ti->private;dm_cblock_t csize =get_cache_dev_size (cache); +if (!can_resume (cache)) +return -EINVAL ; +/* * Check to see if the cache has resized. */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 239/642 soc: mediatek: mtk-mutex: Add DPI1 SOF/EOF to MT8188 mutex tables
In reply to Sasha LevinFrom: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit 694e0b7c1747603243da874de9cbbf8cb806ca44 ]
MT8188 uses DPI1 to output to the HDMI controller: add the Start of Frame and End of Frame configuration for the DPI1 IP to the tables to unblock generation and sending of these signals to the GCE.
--- drivers/soc/mediatek/mtk-mutex.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/soc/mediatek/mtk-mutex.c +6 -0
@@ -155,6 +155,7 @@#define MT8188_MUTEX_MOD_DISP1_VPP_MERGE3 23#define MT8188_MUTEX_MOD_DISP1_VPP_MERGE4 24#define MT8188_MUTEX_MOD_DISP1_DISP_MIXER 30 +#define MT8188_MUTEX_MOD_DISP1_DPI1 38#define MT8188_MUTEX_MOD_DISP1_DP_INTF1 39#define MT8195_MUTEX_MOD_DISP_OVL0 0
@@ -289,6 +290,7 @@#define MT8188_MUTEX_SOF_DSI0 1#define MT8188_MUTEX_SOF_DP_INTF0 3#define MT8188_MUTEX_SOF_DP_INTF1 4 +#define MT8188_MUTEX_SOF_DPI1 5#define MT8195_MUTEX_SOF_DSI0 1#define MT8195_MUTEX_SOF_DSI1 2#define MT8195_MUTEX_SOF_DP_INTF0 3
@@ -301,6 +303,7 @@#define MT8188_MUTEX_EOF_DSI0 (MT8188_MUTEX_SOF_DSI0 << 7)#define MT8188_MUTEX_EOF_DP_INTF0 (MT8188_MUTEX_SOF_DP_INTF0 << 7)#define MT8188_MUTEX_EOF_DP_INTF1 (MT8188_MUTEX_SOF_DP_INTF1 << 7) +#define MT8188_MUTEX_EOF_DPI1 (MT8188_MUTEX_SOF_DPI1 << 7)#define MT8195_MUTEX_EOF_DSI0 (MT8195_MUTEX_SOF_DSI0 << 7)#define MT8195_MUTEX_EOF_DSI1 (MT8195_MUTEX_SOF_DSI1 << 7)#define MT8195_MUTEX_EOF_DP_INTF0 (MT8195_MUTEX_SOF_DP_INTF0 << 7)
@@ -472,6 +475,7 @@ static const u8 mt8188_mutex_mod[DDP_COMPONENT_ID_MAX] = { [DDP_COMPONENT_PWM0] = MT8188_MUTEX_MOD2_DISP_PWM0, [DDP_COMPONENT_DP_INTF0] = MT8188_MUTEX_MOD_DISP_DP_INTF0, [DDP_COMPONENT_DP_INTF1] = MT8188_MUTEX_MOD_DISP1_DP_INTF1, + [DDP_COMPONENT_DPI1] = MT8188_MUTEX_MOD_DISP1_DPI1, [DDP_COMPONENT_ETHDR_MIXER] = MT8188_MUTEX_MOD_DISP1_DISP_MIXER, [DDP_COMPONENT_MDP_RDMA0] = MT8188_MUTEX_MOD_DISP1_MDP_RDMA0, [DDP_COMPONENT_MDP_RDMA1] = MT8188_MUTEX_MOD_DISP1_MDP_RDMA1,
@@ -686,6 +690,8 @@ static const u16 mt8188_mutex_sof[DDP_MUTEX_SOF_MAX] = { [MUTEX_SOF_SINGLE_MODE] = MUTEX_SOF_SINGLE_MODE, [MUTEX_SOF_DSI0 ] = MT8188_MUTEX_SOF_DSI0 | MT8188_MUTEX_EOF_DSI0, + [MUTEX_SOF_DPI1 ] = + MT8188_MUTEX_SOF_DPI1 | MT8188_MUTEX_EOF_DPI1, [MUTEX_SOF_DP_INTF0 ] = MT8188_MUTEX_SOF_DP_INTF0 | MT8188_MUTEX_EOF_DP_INTF0, [MUTEX_SOF_DP_INTF1] =
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 240/642 orangefs: Do not truncate file size
In reply to Sasha LevinFrom: "Matthew Wilcox (Oracle)" <[email protected]>
[ Upstream commit 062e8093592fb866b8e016641a8b27feb6ac509d ]
'len' is used to store the result of i_size_read(), so making 'len' a size_t results in truncation to 4GiB on 32-bit systems.
--- fs/orangefs/inode.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
fs/orangefs/inode.c +3 -4
@@ -23,9 +23,9 @@ static int orangefs_writepage_locked(struct page *page,struct orangefs_write_range *wr =NULL ;struct iov_iter iter;struct bio_vec bv; -size_t len, wlen; +size_t wlen;ssize_t ret; -loff_t off; +loff_t len, off;set_page_writeback (page);
@@ -91,8 +91,7 @@ static int orangefs_writepages_work(struct orangefs_writepages *ow,struct orangefs_write_range *wrp, wr;struct iov_iter iter;ssize_t ret; -size_t len; -loff_t off; +loff_t len, off;int i; len =i_size_read (inode);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 241/642 drm/gem: Test for imported GEM buffers with helper
In reply to Sasha LevinFrom: Thomas Zimmermann <[email protected]>
[ Upstream commit b57aa47d39e94dc47403a745e2024664e544078c ]
Add drm_gem_is_imported() that tests if a GEM object's buffer has been imported. Update the GEM code accordingly.
GEM code usually tests for imports if import_attach has been set in struct drm_gem_object. But attaching a dma-buf on import requires a DMA-capable importer device, which is not the case for many serial busses like USB or I2C. The new helper tests if a GEM object's dma-buf has been created from the GEM object.
--- drivers/gpu/drm/drm_gem.c | 4 ++-- include/drm/drm_gem.h | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_gem.c +2 -2
@@ -348,7 +348,7 @@ int drm_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev,return -ENOENT ;/* Don't allow imported objects to be mapped */ -if (obj->import_attach) { +if (drm_gem_is_imported (obj)) { ret = -EINVAL ; goto out; }
@@ -1178,7 +1178,7 @@ void drm_gem_print_info(struct drm_printer *p, unsigned int indent, drm_vma_node_start(&obj->vma_node));drm_printf_indent (p, indent,"size=%zu\n" , obj->size);drm_printf_indent (p, indent,"imported=%s\n" , -str_yes_no (obj->import_attach)); +str_yes_no (drm_gem_is_imported (obj)));if (obj->funcs->print_info) obj->funcs->print_info (p, indent, obj);
include/drm/drm_gem.h +14 -0
@@ -35,6 +35,7 @@*/ #include <linux/kref.h> +#include <linux/dma-buf.h> #include <linux/dma-resv.h> #include <linux/list.h> #include <linux/mutex.h>
@@ -575,6 +576,19 @@ static inline bool drm_gem_object_is_shared_for_memory_stats(struct drm_gem_objereturn (obj->handle_count >1 ) || obj->dma_buf; } +/** +* drm_gem_is_imported() - Tests if GEM object's buffer has been imported +* @obj: the GEM object +* +* Returns: +* True if the GEM object's buffer has been imported, false otherwise +*/ +static inline bool drm_gem_is_imported (const struct drm_gem_object *obj) +{ +/* The dma-buf's priv field points to the original GEM object. */ +return obj->dma_buf && (obj->dma_buf->priv != obj); +} +#ifdef CONFIG_LOCKDEP /** * drm_gem_gpuva_set_lock() - Set the lock protecting accesses to the gpuva list.
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 242/642 net: phylink: use pl->link_interface in phylink_expects_phy()
In reply to Sasha LevinFrom: Choong Yong Liang <[email protected]>
[ Upstream commit b63263555eaafbf9ab1a82f2020bbee872d83759 ]
The phylink_expects_phy() function allows MAC drivers to check if they are expecting a PHY to attach. The checking condition in phylink_expects_phy() aims to achieve the same result as the checking condition in phylink_attach_phy().
However, the checking condition in phylink_expects_phy() uses pl->link_config.interface, while phylink_attach_phy() uses pl->link_interface.
Initially, both pl->link_interface and pl->link_config.interface are set to SGMII, and pl->cfg_link_an_mode is set to MLO_AN_INBAND.
When the interface switches from SGMII to 2500BASE-X, pl->link_config.interface is updated by phylink_major_config(). At this point, pl->cfg_link_an_mode remains MLO_AN_INBAND, and pl->link_config.interface is set to 2500BASE-X. Subsequently, when the STMMAC interface is taken down administratively and brought back up, it is blocked by phylink_expects_phy().
Since phylink_expects_phy() and phylink_attach_phy() aim to achieve the same result, phylink_expects_phy() should check pl->link_interface, which never changes, instead of pl->link_config.interface, which is updated by phylink_major_config().
--- drivers/net/phy/phylink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/phylink.c +1 -1
@@ -2074,7 +2074,7 @@ bool phylink_expects_phy(struct phylink *pl) {if (pl->cfg_link_an_mode ==MLO_AN_FIXED || (pl->cfg_link_an_mode ==MLO_AN_INBAND && -phy_interface_mode_is_8023z (pl->link_config.interface))) +phy_interface_mode_is_8023z (pl->link_interface)))return false;return true; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 243/642 blk-throttle: don't take carryover for prioritized processing of metadata
In reply to Sasha LevinFrom: Ming Lei <[email protected]>
[ Upstream commit a9fc8868b350cbf4ff730a4ea9651319cc669516 ]
Commit 29390bb5661d ("blk-throttle: support prioritized processing of metadata") takes bytes/ios carryover for prioritized processing of metadata. Turns out we can support it by charging it directly without trimming slice, and the result is same with carryover.
--- block/blk-throttle.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
block/blk-throttle.c +5 -10
@@ -1623,13 +1623,6 @@ static bool tg_within_limit(struct throtl_grp *tg, struct bio *bio, bool rw)return tg_may_dispatch (tg, bio,NULL ); } -static void tg_dispatch_in_debt (struct throtl_grp *tg,struct bio *bio,bool rw) -{ -if (!bio_flagged (bio,BIO_BPS_THROTTLED )) - tg->carryover_bytes[rw] -=throtl_bio_data_size (bio); - tg->carryover_ios[rw]--; -} -bool __blk_throtl_bio (struct bio *bio) {struct request_queue *q =bdev_get_queue (bio->bi_bdev);
@@ -1666,10 +1659,12 @@ bool __blk_throtl_bio(struct bio *bio)/* * IOs which may cause priority inversions are * dispatched directly, even if they're over limit. -* Debts are handled by carryover_bytes/ios while -* calculating wait time. +* +* Charge and dispatch directly, and our throttle +* control algorithm is adaptive, and extra IO bytes +* will be throttled for paying the debt */ -tg_dispatch_in_debt (tg, bio, rw); +throtl_charge_bio (tg, bio); }else {/* if above limits, break to queue */ break ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 244/642 remoteproc: qcom_wcnss: Handle platforms with only single power domain
In reply to Sasha LevinFrom: Matti Lehtimäki <[email protected]>
[ Upstream commit 65991ea8a6d1e68effdc01d95ebe39f1653f7b71 ]
Both MSM8974 and MSM8226 have only CX as power domain with MX & PX being handled as regulators. Handle this case by reodering pd_names to have CX first, and handling that the driver core will already attach a single power domain internally.
--- drivers/remoteproc/qcom_wcnss.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-)
drivers/remoteproc/qcom_wcnss.c +26 -7
@@ -117,10 +117,10 @@ static const struct wcnss_data pronto_v1_data = { .pmu_offset = 0x1004, .spare_offset = 0x1088, - .pd_names = { "mx", "cx" }, + .pd_names = { "cx", "mx" }, .vregs = (struct wcnss_vreg_info[]) { - {"vddmx" ,950000 ,1150000 ,0 }, {"vddcx" , .super_turbo = true}, + {"vddmx" ,950000 ,1150000 ,0 }, {"vddpx" ,1800000 ,1800000 ,0 }, }, .num_pd_vregs = 2,
@@ -131,10 +131,10 @@ static const struct wcnss_data pronto_v2_data = { .pmu_offset = 0x1004, .spare_offset = 0x1088, - .pd_names = { "mx", "cx" }, + .pd_names = { "cx", "mx" }, .vregs = (struct wcnss_vreg_info[]) { - {"vddmx" ,1287500 ,1287500 ,0 }, {"vddcx" , .super_turbo = true }, + {"vddmx" ,1287500 ,1287500 ,0 }, {"vddpx" ,1800000 ,1800000 ,0 }, }, .num_pd_vregs = 2,
@@ -397,8 +397,17 @@ static irqreturn_t wcnss_stop_ack_interrupt(int irq, void *dev)static int wcnss_init_pds (struct qcom_wcnss *wcnss,const char *const pd_names[WCNSS_MAX_PDS ]) { +struct device *dev = wcnss->dev;int i, ret; +/* Handle single power domain */ +if (dev->pm_domain) { + wcnss->pds[0 ] = dev; + wcnss->num_pds =1 ; +pm_runtime_enable (dev); +return 0 ; + } +for (i =0 ; i <WCNSS_MAX_PDS ; i++) {if (!pd_names[i])break ;
@@ -418,8 +427,15 @@ static int wcnss_init_pds(struct qcom_wcnss *wcnss,static void wcnss_release_pds (struct qcom_wcnss *wcnss) { +struct device *dev = wcnss->dev;int i; +/* Handle single power domain */ +if (wcnss->num_pds ==1 && dev->pm_domain) { +pm_runtime_disable (dev); +return ; + } +for (i =0 ; i < wcnss->num_pds; i++)dev_pm_domain_detach (wcnss->pds[i], false); }
@@ -437,10 +453,13 @@ static int wcnss_init_regulators(struct qcom_wcnss *wcnss,* the regulators for the power domains. For old device trees we need to * reserve extra space to manage them through the regulator interface. */ -if (wcnss->num_pds) - info += num_pd_vregs; -else +if (wcnss->num_pds) { + info += wcnss->num_pds; +/* Handle single power domain case */ + num_vregs += num_pd_vregs - wcnss->num_pds; + }else { num_vregs += num_pd_vregs; + } bulk = devm_kcalloc(wcnss->dev, num_vregs, sizeof(struct regulator_bulk_data),
Signature · 1 line
2.39.5