···105105 G coefficient for temperature equation.106106 Default for series 5 = 60000107107 Default for series 6 = 57400108108- multipleOf: 1000108108+ multipleOf: 100109109 minimum: 1000110110 $ref: /schemas/types.yaml#/definitions/uint32111111···114114 H coefficient for temperature equation.115115 Default for series 5 = 200000116116 Default for series 6 = 249400117117- multipleOf: 1000117117+ multipleOf: 100118118 minimum: 1000119119 $ref: /schemas/types.yaml#/definitions/uint32120120···131131 J coefficient for temperature equation.132132 Default for series 5 = -100133133 Default for series 6 = 0134134- multipleOf: 1000134134+ multipleOf: 100135135 maximum: 0136136 $ref: /schemas/types.yaml#/definitions/int32137137
···11-* Universal Asynchronous Receiver/Transmitter (UART)22-33-- compatible: "cavium,octeon-3860-uart"44-55- Compatibility with all cn3XXX, cn5XXX and cn6XXX SOCs.66-77-- reg: The base address of the UART register bank.88-99-- interrupts: A single interrupt specifier.1010-1111-- current-speed: Optional, the current bit rate in bits per second.1212-1313-Example:1414- uart1: serial@1180000000c00 {1515- compatible = "cavium,octeon-3860-uart","ns16550";1616- reg = <0x11800 0x00000c00 0x0 0x400>;1717- current-speed = <115200>;1818- interrupts = <0 35>;1919- };
···11-* NXP LPC1850 UART22-33-Required properties:44-- compatible : "nxp,lpc1850-uart", "ns16550a".55-- reg : offset and length of the register set for the device.66-- interrupts : should contain uart interrupt.77-- clocks : phandle to the input clocks.88-- clock-names : required elements: "uartclk", "reg".99-1010-Optional properties:1111-- dmas : Two or more DMA channel specifiers following the1212- convention outlined in bindings/dma/dma.txt1313-- dma-names : Names for the dma channels, if present. There must1414- be at least one channel named "tx" for transmit1515- and named "rx" for receive.1616-1717-Since it's also possible to also use the of_serial.c driver all1818-parameters from 8250.txt also apply but are optional.1919-2020-Example:2121-uart0: serial@40081000 {2222- compatible = "nxp,lpc1850-uart", "ns16550a";2323- reg = <0x40081000 0x1000>;2424- reg-shift = <2>;2525- interrupts = <24>;2626- clocks = <&ccu2 CLK_APB0_UART0>, <&ccu1 CLK_CPU_UART0>;2727- clock-names = "uartclk", "reg";2828-};
···6565packets but should only process up to ``budget`` number of6666Rx packets. Rx processing is usually much more expensive.67676868-In other words, it is recommended to ignore the budget argument when6969-performing TX buffer reclamation to ensure that the reclamation is not7070-arbitrarily bounded; however, it is required to honor the budget argument7171-for RX processing.6868+In other words for Rx processing the ``budget`` argument limits how many6969+packets driver can process in a single poll. Rx specific APIs like page7070+pool or XDP cannot be used at all when ``budget`` is 0.7171+skb Tx processing should happen regardless of the ``budget``, but if7272+the argument is 0 driver cannot call any XDP (or page pool) APIs.72737374.. warning::74757575- The ``budget`` argument may be 0 if core tries to only process Tx completions7676- and no Rx packets.7676+ The ``budget`` argument may be 0 if core tries to only process7777+ skb Tx completions and no Rx or XDP packets.77787879The poll method returns the amount of work done. If the driver still7980has outstanding work to do (e.g. ``budget`` was exhausted)
+2
MAINTAINERS
···18651865L: asahi@lists.linux.dev18661866L: alsa-devel@alsa-project.org (moderated for non-subscribers)18671867S: Maintained18681868+F: Documentation/devicetree/bindings/sound/adi,ssm3515.yaml18681869F: Documentation/devicetree/bindings/sound/apple,*18691870F: sound/soc/apple/*18701871F: sound/soc/codecs/cs42l83-i2c.c18721872+F: sound/soc/codecs/ssm3515.c1871187318721874ARM/APPLE MACHINE SUPPORT18731875M: Hector Martin <marcan@marcan.st>
···727727#define DBG_SS_ACTIVE_PENDING __vcpu_single_flag(sflags, BIT(5))728728/* PMUSERENR for the guest EL0 is on physical CPU */729729#define PMUSERENR_ON_CPU __vcpu_single_flag(sflags, BIT(6))730730+/* WFI instruction trapped */731731+#define IN_WFI __vcpu_single_flag(sflags, BIT(7))730732731733732734/* Pointer to the vcpu's SVE FFR for sve_{save,load}_state() */
+9-17
arch/arm64/include/asm/kvm_pgtable.h
···608608kvm_pte_t kvm_pgtable_stage2_mkyoung(struct kvm_pgtable *pgt, u64 addr);609609610610/**611611- * kvm_pgtable_stage2_mkold() - Clear the access flag in a page-table entry.611611+ * kvm_pgtable_stage2_test_clear_young() - Test and optionally clear the access612612+ * flag in a page-table entry.612613 * @pgt: Page-table structure initialised by kvm_pgtable_stage2_init*().613614 * @addr: Intermediate physical address to identify the page-table entry.615615+ * @size: Size of the address range to visit.616616+ * @mkold: True if the access flag should be cleared.614617 *615618 * The offset of @addr within a page is ignored.616619 *617617- * If there is a valid, leaf page-table entry used to translate @addr, then618618- * clear the access flag in that entry.620620+ * Tests and conditionally clears the access flag for every valid, leaf621621+ * page-table entry used to translate the range [@addr, @addr + @size).619622 *620623 * Note that it is the caller's responsibility to invalidate the TLB after621624 * calling this function to ensure that the updated permissions are visible622625 * to the CPUs.623626 *624624- * Return: The old page-table entry prior to clearing the flag, 0 on failure.627627+ * Return: True if any of the visited PTEs had the access flag set.625628 */626626-kvm_pte_t kvm_pgtable_stage2_mkold(struct kvm_pgtable *pgt, u64 addr);629629+bool kvm_pgtable_stage2_test_clear_young(struct kvm_pgtable *pgt, u64 addr,630630+ u64 size, bool mkold);627631628632/**629633 * kvm_pgtable_stage2_relax_perms() - Relax the permissions enforced by a···648644 */649645int kvm_pgtable_stage2_relax_perms(struct kvm_pgtable *pgt, u64 addr,650646 enum kvm_pgtable_prot prot);651651-652652-/**653653- * kvm_pgtable_stage2_is_young() - Test whether a page-table entry has the654654- * access flag set.655655- * @pgt: Page-table structure initialised by kvm_pgtable_stage2_init*().656656- * @addr: Intermediate physical address to identify the page-table entry.657657- *658658- * The offset of @addr within a page is ignored.659659- *660660- * Return: True if the page-table entry has the access flag set, false otherwise.661661- */662662-bool kvm_pgtable_stage2_is_young(struct kvm_pgtable *pgt, u64 addr);663647664648/**665649 * kvm_pgtable_stage2_flush_range() - Clean and invalidate data cache to Point
···847847int vec_set_vector_length(struct task_struct *task, enum vec_type type,848848 unsigned long vl, unsigned long flags)849849{850850+ bool free_sme = false;851851+850852 if (flags & ~(unsigned long)(PR_SVE_VL_INHERIT |851853 PR_SVE_SET_VL_ONEXEC))852854 return -EINVAL;···899897 task->thread.fp_type = FP_STATE_FPSIMD;900898 }901899902902- if (system_supports_sme() && type == ARM64_VEC_SME) {903903- task->thread.svcr &= ~(SVCR_SM_MASK |904904- SVCR_ZA_MASK);905905- clear_thread_flag(TIF_SME);900900+ if (system_supports_sme()) {901901+ if (type == ARM64_VEC_SME ||902902+ !(task->thread.svcr & (SVCR_SM_MASK | SVCR_ZA_MASK))) {903903+ /*904904+ * We are changing the SME VL or weren't using905905+ * SME anyway, discard the state and force a906906+ * reallocation.907907+ */908908+ task->thread.svcr &= ~(SVCR_SM_MASK |909909+ SVCR_ZA_MASK);910910+ clear_thread_flag(TIF_SME);911911+ free_sme = true;912912+ }906913 }907914908915 if (task == current)909916 put_cpu_fpsimd_context();910917911918 /*912912- * Force reallocation of task SVE and SME state to the correct913913- * size on next use:919919+ * Free the changed states if they are not in use, SME will be920920+ * reallocated to the correct size on next use and we just921921+ * allocate SVE now in case it is needed for use in streaming922922+ * mode.914923 */915915- sve_free(task);916916- if (system_supports_sme() && type == ARM64_VEC_SME)924924+ if (system_supports_sve()) {925925+ sve_free(task);926926+ sve_alloc(task, true);927927+ }928928+929929+ if (free_sme)917930 sme_free(task);918931919932 task_set_vl(task, type, vl);
···827827 assign_clear_set_bit(tpt, CNTHCTL_EL1PCEN << 10, set, clr);828828 assign_clear_set_bit(tpc, CNTHCTL_EL1PCTEN << 10, set, clr);829829830830- /* This only happens on VHE, so use the CNTKCTL_EL1 accessor */831831- sysreg_clear_set(cntkctl_el1, clr, set);830830+ /* This only happens on VHE, so use the CNTHCTL_EL2 accessor. */831831+ sysreg_clear_set(cnthctl_el2, clr, set);832832}833833834834void kvm_timer_vcpu_load(struct kvm_vcpu *vcpu)···15631563void kvm_timer_init_vhe(void)15641564{15651565 if (cpus_have_final_cap(ARM64_HAS_ECV_CNTPOFF))15661566- sysreg_clear_set(cntkctl_el1, 0, CNTHCTL_ECV);15661566+ sysreg_clear_set(cnthctl_el2, 0, CNTHCTL_ECV);15671567}1568156815691569int kvm_arm_timer_set_attr(struct kvm_vcpu *vcpu, struct kvm_device_attr *attr)
+24-4
arch/arm64/kvm/arm.c
···53535454DECLARE_KVM_NVHE_PER_CPU(struct kvm_cpu_context, kvm_hyp_ctxt);55555656-static bool vgic_present;5656+static bool vgic_present, kvm_arm_initialised;57575858static DEFINE_PER_CPU(unsigned char, kvm_arm_hardware_enabled);5959DEFINE_STATIC_KEY_FALSE(userspace_irqchip_in_use);6060+6161+bool is_kvm_arm_initialised(void)6262+{6363+ return kvm_arm_initialised;6464+}60656166int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu)6267{···718713 */719714 preempt_disable();720715 kvm_vgic_vmcr_sync(vcpu);721721- vgic_v4_put(vcpu, true);716716+ vcpu_set_flag(vcpu, IN_WFI);717717+ vgic_v4_put(vcpu);722718 preempt_enable();723719724720 kvm_vcpu_halt(vcpu);725721 vcpu_clear_flag(vcpu, IN_WFIT);726722727723 preempt_disable();724724+ vcpu_clear_flag(vcpu, IN_WFI);728725 vgic_v4_load(vcpu);729726 preempt_enable();730727}···794787 if (kvm_check_request(KVM_REQ_RELOAD_GICv4, vcpu)) {795788 /* The distributor enable bits were changed */796789 preempt_disable();797797- vgic_v4_put(vcpu, false);790790+ vgic_v4_put(vcpu);798791 vgic_v4_load(vcpu);799792 preempt_enable();800793 }···1874186718751868int kvm_arch_hardware_enable(void)18761869{18771877- int was_enabled = __this_cpu_read(kvm_arm_hardware_enabled);18701870+ int was_enabled;1878187118721872+ /*18731873+ * Most calls to this function are made with migration18741874+ * disabled, but not with preemption disabled. The former is18751875+ * enough to ensure correctness, but most of the helpers18761876+ * expect the later and will throw a tantrum otherwise.18771877+ */18781878+ preempt_disable();18791879+18801880+ was_enabled = __this_cpu_read(kvm_arm_hardware_enabled);18791881 _kvm_arch_hardware_enable(NULL);1880188218811883 if (!was_enabled) {18821884 kvm_vgic_cpu_up();18831885 kvm_timer_cpu_up();18841886 }18871887+18881888+ preempt_enable();1885188918861890 return 0;18871891}···24992481 err = kvm_init(sizeof(struct kvm_vcpu), 0, THIS_MODULE);25002482 if (err)25012483 goto out_subs;24842484+24852485+ kvm_arm_initialised = true;2502248625032487 return 0;25042488
+8
arch/arm64/kvm/hyp/hyp-entry.S
···154154 esb155155 stp x0, x1, [sp, #-16]!156156662:157157+ /*158158+ * spectre vectors __bp_harden_hyp_vecs generate br instructions at runtime159159+ * that jump at offset 8 at __kvm_hyp_vector.160160+ * As hyp .text is guarded section, it needs bti j.161161+ */162162+ bti j157163 b \target158164159165check_preamble_length 661b, 662b···171165 nop172166 stp x0, x1, [sp, #-16]!173167662:168168+ /* Check valid_vect */169169+ bti j174170 b \target175171176172check_preamble_length 661b, 662b
+10
arch/arm64/kvm/hyp/nvhe/host.S
···297297298298 ret299299SYM_CODE_END(__kvm_hyp_host_forward_smc)300300+301301+/*302302+ * kvm_host_psci_cpu_entry is called through br instruction, which requires303303+ * bti j instruction as compilers (gcc and llvm) doesn't insert bti j for external304304+ * functions, but bti c instead.305305+ */306306+SYM_CODE_START(kvm_host_psci_cpu_entry)307307+ bti j308308+ b __kvm_host_psci_cpu_entry309309+SYM_CODE_END(kvm_host_psci_cpu_entry)
···244244{245245 int ret;246246247247- if (!is_protected_kvm_enabled())247247+ if (!is_protected_kvm_enabled() || !is_kvm_arm_initialised())248248 return 0;249249250250 /*
···2424#include <linux/bug.h>2525#include <linux/mm.h>2626#include <linux/mmzone.h>2727+#include <linux/kfence.h>27282829static void *trans_alloc(struct trans_pgd_info *info)2930{···4241 * the temporary mappings we use during restore.4342 */4443 set_pte(dst_ptep, pte_mkwrite(pte));4545- } else if (debug_pagealloc_enabled() && !pte_none(pte)) {4444+ } else if ((debug_pagealloc_enabled() ||4545+ is_kfence_address((void *)addr)) && !pte_none(pte)) {4646 /*4747 * debug_pagealloc will removed the PTE_VALID bit if4848 * the page isn't in use by the resume kernel. It may have
···2727#include <linux/elf-randomize.h>28282929/*3030- * Construct an artificial page offset for the mapping based on the physical3030+ * Construct an artificial page offset for the mapping based on the virtual3131 * address of the kernel file mapping variable.3232+ * If filp is zero the calculated pgoff value aliases the memory of the given3333+ * address. This is useful for io_uring where the mapping shall alias a kernel3434+ * address and a userspace adress where both the kernel and the userspace3535+ * access the same memory region.3236 */3333-#define GET_FILP_PGOFF(filp) \3434- (filp ? (((unsigned long) filp->f_mapping) >> 8) \3535- & ((SHM_COLOUR-1) >> PAGE_SHIFT) : 0UL)3737+#define GET_FILP_PGOFF(filp, addr) \3838+ ((filp ? (((unsigned long) filp->f_mapping) >> 8) \3939+ & ((SHM_COLOUR-1) >> PAGE_SHIFT) : 0UL) \4040+ + (addr >> PAGE_SHIFT))36413742static unsigned long shared_align_offset(unsigned long filp_pgoff,3843 unsigned long pgoff)···117112 do_color_align = 0;118113 if (filp || (flags & MAP_SHARED))119114 do_color_align = 1;120120- filp_pgoff = GET_FILP_PGOFF(filp);115115+ filp_pgoff = GET_FILP_PGOFF(filp, addr);121116122117 if (flags & MAP_FIXED) {123118 /* Even MAP_FIXED mappings must reside within TASK_SIZE */
···744744 }745745746746 task_ref = &win->vas_win.task_ref;747747+ /*748748+ * VAS mmap (coproc_mmap()) and its fault handler749749+ * (vas_mmap_fault()) are called after holding mmap lock.750750+ * So hold mmap mutex after mmap_lock to avoid deadlock.751751+ */752752+ mmap_write_lock(task_ref->mm);747753 mutex_lock(&task_ref->mmap_mutex);748754 vma = task_ref->vma;749755 /*···758752 */759753 win->vas_win.status |= flag;760754761761- mmap_write_lock(task_ref->mm);762755 /*763756 * vma is set in the original mapping. But this mapping764757 * is done with mmap() after the window is opened with ioctl.···767762 if (vma)768763 zap_vma_pages(vma);769764770770- mmap_write_unlock(task_ref->mm);771765 mutex_unlock(&task_ref->mmap_mutex);766766+ mmap_write_unlock(task_ref->mm);772767 /*773768 * Close VAS window in the hypervisor, but do not774769 * free vas_window struct since it may be reused
···411411 u16 _rc, _rrc;412412 int cc = 0;413413414414- /* Make sure the counter does not reach 0 before calling s390_uv_destroy_range */415415- atomic_inc(&kvm->mm->context.protected_count);414414+ /*415415+ * Nothing to do if the counter was already 0. Otherwise make sure416416+ * the counter does not reach 0 before calling s390_uv_destroy_range.417417+ */418418+ if (!atomic_inc_not_zero(&kvm->mm->context.protected_count))419419+ return 0;416420417421 *rc = 1;418422 /* If the current VM is protected, destroy it */
+2
arch/s390/mm/fault.c
···421421 vma_end_read(vma);422422 if (!(fault & VM_FAULT_RETRY)) {423423 count_vm_vma_lock_event(VMA_LOCK_SUCCESS);424424+ if (likely(!(fault & VM_FAULT_ERROR)))425425+ fault = 0;424426 goto out;425427 }426428 count_vm_vma_lock_event(VMA_LOCK_RETRY);
···697697}698698699699static bool gp_try_fixup_and_notify(struct pt_regs *regs, int trapnr,700700- unsigned long error_code, const char *str)700700+ unsigned long error_code, const char *str,701701+ unsigned long address)701702{702702- if (fixup_exception(regs, trapnr, error_code, 0))703703+ if (fixup_exception(regs, trapnr, error_code, address))703704 return true;704705705706 current->thread.error_code = error_code;···760759 goto exit;761760 }762761763763- if (gp_try_fixup_and_notify(regs, X86_TRAP_GP, error_code, desc))762762+ if (gp_try_fixup_and_notify(regs, X86_TRAP_GP, error_code, desc, 0))764763 goto exit;765764766765 if (error_code)···1358135713591358#define VE_FAULT_STR "VE fault"1360135913611361-static void ve_raise_fault(struct pt_regs *regs, long error_code)13601360+static void ve_raise_fault(struct pt_regs *regs, long error_code,13611361+ unsigned long address)13621362{13631363 if (user_mode(regs)) {13641364 gp_user_force_sig_segv(regs, X86_TRAP_VE, error_code, VE_FAULT_STR);13651365 return;13661366 }1367136713681368- if (gp_try_fixup_and_notify(regs, X86_TRAP_VE, error_code, VE_FAULT_STR))13681368+ if (gp_try_fixup_and_notify(regs, X86_TRAP_VE, error_code,13691369+ VE_FAULT_STR, address)) {13691370 return;13711371+ }1370137213711371- die_addr(VE_FAULT_STR, regs, error_code, 0);13731373+ die_addr(VE_FAULT_STR, regs, error_code, address);13721374}1373137513741376/*···14351431 * it successfully, treat it as #GP(0) and handle it.14361432 */14371433 if (!tdx_handle_virt_exception(regs, &ve))14381438- ve_raise_fault(regs, 0);14341434+ ve_raise_fault(regs, 0, ve.gla);1439143514401436 cond_local_irq_disable(regs);14411437}
+1-2
block/blk-core.c
···11441144{11451145 if (!list_empty(&plug->cb_list))11461146 flush_plug_callbacks(plug, from_schedule);11471147- if (!rq_list_empty(plug->mq_list))11481148- blk_mq_flush_plug_list(plug, from_schedule);11471147+ blk_mq_flush_plug_list(plug, from_schedule);11491148 /*11501149 * Unconditionally flush out cached requests, even if the unplug11511150 * event came from schedule. Since we know hold references to the
+4
block/blk-iocost.c
···25162516 u64 seek_pages = 0;25172517 u64 cost = 0;2518251825192519+ /* Can't calculate cost for empty bio */25202520+ if (!bio->bi_iter.bi_size)25212521+ goto out;25222522+25192523 switch (bio_op(bio)) {25202524 case REQ_OP_READ:25212525 coef_seqio = ioc->params.lcoefs[LCOEF_RSEQIO];
+8-1
block/blk-mq.c
···27542754{27552755 struct request *rq;2756275627572757- if (rq_list_empty(plug->mq_list))27572757+ /*27582758+ * We may have been called recursively midway through handling27592759+ * plug->mq_list via a schedule() in the driver's queue_rq() callback.27602760+ * To avoid mq_list changing under our feet, clear rq_count early and27612761+ * bail out specifically if rq_count is 0 rather than checking27622762+ * whether the mq_list is empty.27632763+ */27642764+ if (plug->rq_count == 0)27582765 return;27592766 plug->rq_count = 0;27602767
···1414#include <linux/mm.h>1515#include <linux/moduleparam.h>1616#include <linux/mutex.h>1717+#include <linux/overflow.h>1718#include <linux/pci.h>1819#include <linux/scatterlist.h>1920#include <linux/types.h>···367366 if (in_trans->hdr.len % 8 != 0)368367 return -EINVAL;369368370370- if (msg_hdr_len + in_trans->hdr.len > QAIC_MANAGE_EXT_MSG_LENGTH)369369+ if (size_add(msg_hdr_len, in_trans->hdr.len) > QAIC_MANAGE_EXT_MSG_LENGTH)371370 return -ENOSPC;372371373372 trans_wrapper = add_wrapper(wrappers,···419418 }420419421420 ret = get_user_pages_fast(xfer_start_addr, nr_pages, 0, page_list);422422- if (ret < 0 || ret != nr_pages) {423423- ret = -EFAULT;421421+ if (ret < 0)424422 goto free_page_list;423423+ if (ret != nr_pages) {424424+ nr_pages = ret;425425+ ret = -EFAULT;426426+ goto put_pages;425427 }426428427429 sgt = kmalloc(sizeof(*sgt), GFP_KERNEL);···561557 msg = &wrapper->msg;562558 msg_hdr_len = le32_to_cpu(msg->hdr.len);563559564564- if (msg_hdr_len > (UINT_MAX - QAIC_MANAGE_EXT_MSG_LENGTH))565565- return -EINVAL;566566-567560 /* There should be enough space to hold at least one ASP entry. */568568- if (msg_hdr_len + sizeof(*out_trans) + sizeof(struct wire_addr_size_pair) >561561+ if (size_add(msg_hdr_len, sizeof(*out_trans) + sizeof(struct wire_addr_size_pair)) >569562 QAIC_MANAGE_EXT_MSG_LENGTH)570563 return -ENOMEM;571564···635634 msg = &wrapper->msg;636635 msg_hdr_len = le32_to_cpu(msg->hdr.len);637636638638- if (msg_hdr_len + sizeof(*out_trans) > QAIC_MANAGE_MAX_MSG_LENGTH)637637+ if (size_add(msg_hdr_len, sizeof(*out_trans)) > QAIC_MANAGE_MAX_MSG_LENGTH)639638 return -ENOSPC;640639641640 if (!in_trans->queue_size)···719718 msg = &wrapper->msg;720719 msg_hdr_len = le32_to_cpu(msg->hdr.len);721720722722- if (msg_hdr_len + in_trans->hdr.len > QAIC_MANAGE_MAX_MSG_LENGTH)721721+ if (size_add(msg_hdr_len, in_trans->hdr.len) > QAIC_MANAGE_MAX_MSG_LENGTH)723722 return -ENOSPC;724723725724 trans_wrapper = add_wrapper(wrappers, sizeof(*trans_wrapper));···749748 int ret;750749 int i;751750752752- if (!user_msg->count) {751751+ if (!user_msg->count ||752752+ user_msg->len < sizeof(*trans_hdr)) {753753 ret = -EINVAL;754754 goto out;755755 }···767765 }768766769767 for (i = 0; i < user_msg->count; ++i) {770770- if (user_len >= user_msg->len) {768768+ if (user_len > user_msg->len - sizeof(*trans_hdr)) {771769 ret = -EINVAL;772770 break;773771 }774772 trans_hdr = (struct qaic_manage_trans_hdr *)(user_msg->data + user_len);775775- if (user_len + trans_hdr->len > user_msg->len) {773773+ if (trans_hdr->len < sizeof(trans_hdr) ||774774+ size_add(user_len, trans_hdr->len) > user_msg->len) {776775 ret = -EINVAL;777776 break;778777 }···956953 int ret;957954 int i;958955959959- if (msg_hdr_len > QAIC_MANAGE_MAX_MSG_LENGTH)956956+ if (msg_hdr_len < sizeof(*trans_hdr) ||957957+ msg_hdr_len > QAIC_MANAGE_MAX_MSG_LENGTH)960958 return -EINVAL;961959962960 user_msg->len = 0;963961 user_msg->count = le32_to_cpu(msg->hdr.count);964962965963 for (i = 0; i < user_msg->count; ++i) {964964+ u32 hdr_len;965965+966966+ if (msg_len > msg_hdr_len - sizeof(*trans_hdr))967967+ return -EINVAL;968968+966969 trans_hdr = (struct wire_trans_hdr *)(msg->data + msg_len);967967- if (msg_len + le32_to_cpu(trans_hdr->len) > msg_hdr_len)970970+ hdr_len = le32_to_cpu(trans_hdr->len);971971+ if (hdr_len < sizeof(*trans_hdr) ||972972+ size_add(msg_len, hdr_len) > msg_hdr_len)968973 return -EINVAL;969974970975 switch (le32_to_cpu(trans_hdr->type)) {
+2
drivers/ata/pata_parport/aten.c
···139139};140140141141MODULE_LICENSE("GPL");142142+MODULE_AUTHOR("Grant R. Guenther <grant@torque.net>");143143+MODULE_DESCRIPTION("ATEN EH-100 parallel port IDE adapter protocol driver");142144module_pata_parport_driver(aten);
+2
drivers/ata/pata_parport/bpck.c
···502502};503503504504MODULE_LICENSE("GPL");505505+MODULE_AUTHOR("Grant R. Guenther <grant@torque.net>");506506+MODULE_DESCRIPTION("MicroSolutions BACKPACK parallel port IDE adapter protocol driver");505507module_pata_parport_driver(bpck);
+2-1
drivers/ata/pata_parport/bpck6.c
···459459460460MODULE_LICENSE("GPL");461461MODULE_AUTHOR("Micro Solutions Inc.");462462-MODULE_DESCRIPTION("BACKPACK Protocol module, compatible with PARIDE");462462+MODULE_DESCRIPTION("Micro Solutions BACKPACK parallel port IDE adapter "463463+ "(version 6 drives) protocol driver");463464module_pata_parport_driver(bpck6);
+2
drivers/ata/pata_parport/comm.c
···201201};202202203203MODULE_LICENSE("GPL");204204+MODULE_AUTHOR("Grant R. Guenther <grant@torque.net>");205205+MODULE_DESCRIPTION("DataStor Commuter parallel port IDE adapter protocol driver");204206module_pata_parport_driver(comm);
+2
drivers/ata/pata_parport/dstr.c
···230230};231231232232MODULE_LICENSE("GPL");233233+MODULE_AUTHOR("Grant R. Guenther <grant@torque.net>");234234+MODULE_DESCRIPTION("DataStor EP2000 parallel port IDE adapter protocol driver");233235module_pata_parport_driver(dstr);
+3
drivers/ata/pata_parport/epat.c
···358358}359359360360MODULE_LICENSE("GPL");361361+MODULE_AUTHOR("Grant R. Guenther <grant@torque.net>");362362+MODULE_DESCRIPTION("Shuttle Technologies EPAT parallel port IDE adapter "363363+ "protocol driver");361364module_init(epat_init)362365module_exit(epat_exit)
+3
drivers/ata/pata_parport/epia.c
···306306};307307308308MODULE_LICENSE("GPL");309309+MODULE_AUTHOR("Grant R. Guenther <grant@torque.net>");310310+MODULE_DESCRIPTION("Shuttle Technologies EPIA parallel port IDE adapter "311311+ "protocol driver");309312module_pata_parport_driver(epia);
+3
drivers/ata/pata_parport/fit2.c
···132132};133133134134MODULE_LICENSE("GPL");135135+MODULE_AUTHOR("Grant R. Guenther <grant@torque.net>");136136+MODULE_DESCRIPTION("Fidelity International Technology parallel port IDE adapter"137137+ "(older models) protocol driver");135138module_pata_parport_driver(fit2);
+3
drivers/ata/pata_parport/fit3.c
···193193};194194195195MODULE_LICENSE("GPL");196196+MODULE_AUTHOR("Grant R. Guenther <grant@torque.net>");197197+MODULE_DESCRIPTION("Fidelity International Technology parallel port IDE adapter"198198+ "(newer models) protocol driver");196199module_pata_parport_driver(fit3);
+2
drivers/ata/pata_parport/friq.c
···259259};260260261261MODULE_LICENSE("GPL");262262+MODULE_AUTHOR("Grant R. Guenther <grant@torque.net>");263263+MODULE_DESCRIPTION("Freecom IQ parallel port IDE adapter protocol driver");262264module_pata_parport_driver(friq);
+2
drivers/ata/pata_parport/frpw.c
···293293};294294295295MODULE_LICENSE("GPL");296296+MODULE_AUTHOR("Grant R. Guenther <grant@torque.net>");297297+MODULE_DESCRIPTION("Freecom Power parallel port IDE adapter protocol driver");296298module_pata_parport_driver(frpw);
+3
drivers/ata/pata_parport/kbic.c
···301301}302302303303MODULE_LICENSE("GPL");304304+MODULE_AUTHOR("Grant R. Guenther <grant@torque.net>");305305+MODULE_DESCRIPTION("KingByte Information Systems KBIC-951A and KBIC-971A "306306+ "parallel port IDE adapter protocol driver");304307module_init(kbic_init)305308module_exit(kbic_exit)
+2
drivers/ata/pata_parport/ktti.c
···106106};107107108108MODULE_LICENSE("GPL");109109+MODULE_AUTHOR("Grant R. Guenther <grant@torque.net>");110110+MODULE_DESCRIPTION("KT Technology parallel port IDE adapter protocol driver");109111module_pata_parport_driver(ktti);
+2
drivers/ata/pata_parport/on20.c
···142142};143143144144MODULE_LICENSE("GPL");145145+MODULE_AUTHOR("Grant R. Guenther <grant@torque.net>");146146+MODULE_DESCRIPTION("Onspec 90c20 parallel port IDE adapter protocol driver");145147module_pata_parport_driver(on20);
+2
drivers/ata/pata_parport/on26.c
···310310};311311312312MODULE_LICENSE("GPL");313313+MODULE_AUTHOR("Grant R. Guenther <grant@torque.net>");314314+MODULE_DESCRIPTION("Onspec 90c26 parallel port IDE adapter protocol driver");313315module_pata_parport_driver(on26);
+4
drivers/base/regmap/regcache-rbtree.c
···471471 unsigned int start, end;472472 int ret;473473474474+ map->async = true;475475+474476 rbtree_ctx = map->cache;475477 for (node = rb_first(&rbtree_ctx->root); node; node = rb_next(node)) {476478 rbnode = rb_entry(node, struct regcache_rbtree_node, node);···500498 if (ret != 0)501499 return ret;502500 }501501+502502+ map->async = false;503503504504 return regmap_async_complete(map);505505}
-3
drivers/base/regmap/regcache.c
···368368 if (!map->cache_dirty)369369 goto out;370370371371- map->async = true;372372-373371 /* Apply any patch first */374372 map->cache_bypass = true;375373 for (i = 0; i < map->patch_regs; i++) {···390392391393out:392394 /* Restore the bypass state */393393- map->async = false;394395 map->cache_bypass = bypass;395396 map->no_sync_defaults = false;396397 map->unlock(map->lock_arg);
···17751775/*17761776 * If max_loop is specified, create that many devices upfront.17771777 * This also becomes a hard limit. If max_loop is not specified,17781778+ * the default isn't a hard limit (as before commit 85c50197716c17791779+ * changed the default value from 0 for max_loop=0 reasons), just17781780 * create CONFIG_BLK_DEV_LOOP_MIN_COUNT loop devices at module17791781 * init time. Loop devices can be requested on-demand with the17801782 * /dev/loop-control interface, or be instantiated by accessing17811783 * a 'dead' device node.17821784 */17831785static int max_loop = CONFIG_BLK_DEV_LOOP_MIN_COUNT;17841784-module_param(max_loop, int, 0444);17861786+17871787+#ifdef CONFIG_BLOCK_LEGACY_AUTOLOAD17881788+static bool max_loop_specified;17891789+17901790+static int max_loop_param_set_int(const char *val,17911791+ const struct kernel_param *kp)17921792+{17931793+ int ret;17941794+17951795+ ret = param_set_int(val, kp);17961796+ if (ret < 0)17971797+ return ret;17981798+17991799+ max_loop_specified = true;18001800+ return 0;18011801+}18021802+18031803+static const struct kernel_param_ops max_loop_param_ops = {18041804+ .set = max_loop_param_set_int,18051805+ .get = param_get_int,18061806+};18071807+18081808+module_param_cb(max_loop, &max_loop_param_ops, &max_loop, 0444);17851809MODULE_PARM_DESC(max_loop, "Maximum number of loop devices");18101810+#else18111811+module_param(max_loop, int, 0444);18121812+MODULE_PARM_DESC(max_loop, "Initial number of loop devices");18131813+#endif18141814+17861815module_param(max_part, int, 0444);17871816MODULE_PARM_DESC(max_part, "Maximum number of partitions per loop device");17881817···21222093 put_disk(lo->lo_disk);21232094}2124209520962096+#ifdef CONFIG_BLOCK_LEGACY_AUTOLOAD21252097static void loop_probe(dev_t dev)21262098{21272099 int idx = MINOR(dev) >> part_shift;2128210021292129- if (max_loop && idx >= max_loop)21012101+ if (max_loop_specified && max_loop && idx >= max_loop)21302102 return;21312103 loop_add(idx);21322104}21052105+#else21062106+#define loop_probe NULL21072107+#endif /* !CONFIG_BLOCK_LEGACY_AUTOLOAD */2133210821342109static int loop_control_remove(int idx)21352110{···23142281static int __init max_loop_setup(char *str)23152282{23162283 max_loop = simple_strtol(str, NULL, 0);22842284+#ifdef CONFIG_BLOCK_LEGACY_AUTOLOAD22852285+ max_loop_specified = true;22862286+#endif23172287 return 1;23182288}23192289
+9-4
drivers/dma-buf/dma-resv.c
···571571 dma_resv_for_each_fence_unlocked(&cursor, fence) {572572573573 if (dma_resv_iter_is_restarted(&cursor)) {574574+ struct dma_fence **new_fences;574575 unsigned int count;575576576577 while (*num_fences)···580579 count = cursor.num_fences + 1;581580582581 /* Eventually re-allocate the array */583583- *fences = krealloc_array(*fences, count,584584- sizeof(void *),585585- GFP_KERNEL);586586- if (count && !*fences) {582582+ new_fences = krealloc_array(*fences, count,583583+ sizeof(void *),584584+ GFP_KERNEL);585585+ if (count && !new_fences) {586586+ kfree(*fences);587587+ *fences = NULL;588588+ *num_fences = 0;587589 dma_resv_iter_end(&cursor);588590 return -ENOMEM;589591 }592592+ *fences = new_fences;590593 }591594592595 (*fences)[(*num_fences)++] = dma_fence_get(fence);
···6868 enum AMDGPU_XCP_IP_BLOCK ip_blk;6969 uint32_t inst_mask;70707171- ring->xcp_id = ~0;7171+ ring->xcp_id = AMDGPU_XCP_NO_PARTITION;7272 if (adev->xcp_mgr->mode == AMDGPU_XCP_MODE_NONE)7373 return;7474···177177 u32 sel_xcp_id;178178 int i;179179180180- if (fpriv->xcp_id == ~0) {180180+ if (fpriv->xcp_id == AMDGPU_XCP_NO_PARTITION) {181181 u32 least_ref_cnt = ~0;182182183183 fpriv->xcp_id = 0;
+1
drivers/gpu/drm/amd/amdgpu/psp_v13_0.c
···4949MODULE_FIRMWARE("amdgpu/psp_13_0_11_toc.bin");5050MODULE_FIRMWARE("amdgpu/psp_13_0_11_ta.bin");5151MODULE_FIRMWARE("amdgpu/psp_13_0_6_sos.bin");5252+MODULE_FIRMWARE("amdgpu/psp_13_0_6_ta.bin");52535354/* For large FW files the time to complete can be very long */5455#define USBC_PD_POLLING_LIMIT_S 240
+103-153
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
···424424425425 spin_lock_irqsave(&adev_to_drm(adev)->event_lock, flags);426426427427- if (amdgpu_crtc->pflip_status != AMDGPU_FLIP_SUBMITTED){428428- DC_LOG_PFLIP("amdgpu_crtc->pflip_status = %d !=AMDGPU_FLIP_SUBMITTED(%d) on crtc:%d[%p] \n",429429- amdgpu_crtc->pflip_status,430430- AMDGPU_FLIP_SUBMITTED,431431- amdgpu_crtc->crtc_id,432432- amdgpu_crtc);427427+ if (amdgpu_crtc->pflip_status != AMDGPU_FLIP_SUBMITTED) {428428+ DC_LOG_PFLIP("amdgpu_crtc->pflip_status = %d !=AMDGPU_FLIP_SUBMITTED(%d) on crtc:%d[%p]\n",429429+ amdgpu_crtc->pflip_status,430430+ AMDGPU_FLIP_SUBMITTED,431431+ amdgpu_crtc->crtc_id,432432+ amdgpu_crtc);433433 spin_unlock_irqrestore(&adev_to_drm(adev)->event_lock, flags);434434 return;435435 }···883883}884884885885/* Prototypes of private functions */886886-static int dm_early_init(void* handle);886886+static int dm_early_init(void *handle);887887888888/* Allocate memory for FBC compressed data */889889static void amdgpu_dm_fbc_init(struct drm_connector *connector)···12821282 pa_config->system_aperture.start_addr = (uint64_t)logical_addr_low << 18;12831283 pa_config->system_aperture.end_addr = (uint64_t)logical_addr_high << 18;1284128412851285- pa_config->system_aperture.agp_base = (uint64_t)agp_base << 24 ;12851285+ pa_config->system_aperture.agp_base = (uint64_t)agp_base << 24;12861286 pa_config->system_aperture.agp_bot = (uint64_t)agp_bot << 24;12871287 pa_config->system_aperture.agp_top = (uint64_t)agp_top << 24;12881288···13471347 if (amdgpu_in_reset(adev))13481348 goto skip;1349134913501350+ if (offload_work->data.bytes.device_service_irq.bits.UP_REQ_MSG_RDY ||13511351+ offload_work->data.bytes.device_service_irq.bits.DOWN_REP_MSG_RDY) {13521352+ dm_handle_mst_sideband_msg_ready_event(&aconnector->mst_mgr, DOWN_OR_UP_MSG_RDY_EVENT);13531353+ spin_lock_irqsave(&offload_work->offload_wq->offload_lock, flags);13541354+ offload_work->offload_wq->is_handling_mst_msg_rdy_event = false;13551355+ spin_unlock_irqrestore(&offload_work->offload_wq->offload_lock, flags);13561356+ goto skip;13571357+ }13581358+13501359 mutex_lock(&adev->dm.dc_lock);13511360 if (offload_work->data.bytes.device_service_irq.bits.AUTOMATED_TEST) {13521361 dc_link_dp_handle_automated_test(dc_link);···13741365 DP_TEST_RESPONSE,13751366 &test_response.raw,13761367 sizeof(test_response));13771377- }13781378- else if ((dc_link->connector_signal != SIGNAL_TYPE_EDP) &&13681368+ } else if ((dc_link->connector_signal != SIGNAL_TYPE_EDP) &&13791369 dc_link_check_link_loss_status(dc_link, &offload_work->data) &&13801370 dc_link_dp_allow_hpd_rx_irq(dc_link)) {13811371 /* offload_work->data is from handle_hpd_rx_irq->···15621554 mutex_init(&adev->dm.dc_lock);15631555 mutex_init(&adev->dm.audio_lock);1564155615651565- if(amdgpu_dm_irq_init(adev)) {15571557+ if (amdgpu_dm_irq_init(adev)) {15661558 DRM_ERROR("amdgpu: failed to initialize DM IRQ support.\n");15671559 goto error;15681560 }···17041696 if (amdgpu_dc_debug_mask & DC_DISABLE_STUTTER)17051697 adev->dm.dc->debug.disable_stutter = true;1706169817071707- if (amdgpu_dc_debug_mask & DC_DISABLE_DSC) {16991699+ if (amdgpu_dc_debug_mask & DC_DISABLE_DSC)17081700 adev->dm.dc->debug.disable_dsc = true;17091709- }1710170117111702 if (amdgpu_dc_debug_mask & DC_DISABLE_CLOCK_GATING)17121703 adev->dm.dc->debug.disable_clock_gate = true;···19491942 mutex_destroy(&adev->dm.audio_lock);19501943 mutex_destroy(&adev->dm.dc_lock);19511944 mutex_destroy(&adev->dm.dpia_aux_lock);19521952-19531953- return;19541945}1955194619561947static int load_dmcu_fw(struct amdgpu_device *adev)···19571952 int r;19581953 const struct dmcu_firmware_header_v1_0 *hdr;1959195419601960- switch(adev->asic_type) {19551955+ switch (adev->asic_type) {19611956#if defined(CONFIG_DRM_AMD_DC_SI)19621957 case CHIP_TAHITI:19631958 case CHIP_PITCAIRN:···27142709 struct dc_scaling_info scaling_infos[MAX_SURFACES];27152710 struct dc_flip_addrs flip_addrs[MAX_SURFACES];27162711 struct dc_stream_update stream_update;27172717- } * bundle;27122712+ } *bundle;27182713 int k, m;2719271427202715 bundle = kzalloc(sizeof(*bundle), GFP_KERNEL);···2744273927452740cleanup:27462741 kfree(bundle);27472747-27482748- return;27492742}2750274327512744static int dm_resume(void *handle)···29572954 .set_powergating_state = dm_set_powergating_state,29582955};2959295629602960-const struct amdgpu_ip_block_version dm_ip_block =29612961-{29572957+const struct amdgpu_ip_block_version dm_ip_block = {29622958 .type = AMD_IP_BLOCK_TYPE_DCE,29632959 .major = 1,29642960 .minor = 0,···30023000 caps->ext_caps = &aconnector->dc_link->dpcd_sink_ext_caps;30033001 caps->aux_support = false;3004300230053005- if (caps->ext_caps->bits.oled == 1 /*||30063006- caps->ext_caps->bits.sdr_aux_backlight_control == 1 ||30073007- caps->ext_caps->bits.hdr_aux_backlight_control == 1*/)30033003+ if (caps->ext_caps->bits.oled == 130043004+ /*30053005+ * ||30063006+ * caps->ext_caps->bits.sdr_aux_backlight_control == 1 ||30073007+ * caps->ext_caps->bits.hdr_aux_backlight_control == 130083008+ */)30083009 caps->aux_support = true;3009301030103011 if (amdgpu_backlight == 0)···3241323632423237}3243323832443244-static void dm_handle_mst_sideband_msg(struct amdgpu_dm_connector *aconnector)32453245-{32463246- u8 esi[DP_PSR_ERROR_STATUS - DP_SINK_COUNT_ESI] = { 0 };32473247- u8 dret;32483248- bool new_irq_handled = false;32493249- int dpcd_addr;32503250- int dpcd_bytes_to_read;32513251-32523252- const int max_process_count = 30;32533253- int process_count = 0;32543254-32553255- const struct dc_link_status *link_status = dc_link_get_status(aconnector->dc_link);32563256-32573257- if (link_status->dpcd_caps->dpcd_rev.raw < 0x12) {32583258- dpcd_bytes_to_read = DP_LANE0_1_STATUS - DP_SINK_COUNT;32593259- /* DPCD 0x200 - 0x201 for downstream IRQ */32603260- dpcd_addr = DP_SINK_COUNT;32613261- } else {32623262- dpcd_bytes_to_read = DP_PSR_ERROR_STATUS - DP_SINK_COUNT_ESI;32633263- /* DPCD 0x2002 - 0x2005 for downstream IRQ */32643264- dpcd_addr = DP_SINK_COUNT_ESI;32653265- }32663266-32673267- dret = drm_dp_dpcd_read(32683268- &aconnector->dm_dp_aux.aux,32693269- dpcd_addr,32703270- esi,32713271- dpcd_bytes_to_read);32723272-32733273- while (dret == dpcd_bytes_to_read &&32743274- process_count < max_process_count) {32753275- u8 ack[DP_PSR_ERROR_STATUS - DP_SINK_COUNT_ESI] = {};32763276- u8 retry;32773277- dret = 0;32783278-32793279- process_count++;32803280-32813281- DRM_DEBUG_DRIVER("ESI %02x %02x %02x\n", esi[0], esi[1], esi[2]);32823282- /* handle HPD short pulse irq */32833283- if (aconnector->mst_mgr.mst_state)32843284- drm_dp_mst_hpd_irq_handle_event(&aconnector->mst_mgr,32853285- esi,32863286- ack,32873287- &new_irq_handled);32883288-32893289- if (new_irq_handled) {32903290- /* ACK at DPCD to notify down stream */32913291- for (retry = 0; retry < 3; retry++) {32923292- ssize_t wret;32933293-32943294- wret = drm_dp_dpcd_writeb(&aconnector->dm_dp_aux.aux,32953295- dpcd_addr + 1,32963296- ack[1]);32973297- if (wret == 1)32983298- break;32993299- }33003300-33013301- if (retry == 3) {33023302- DRM_ERROR("Failed to ack MST event.\n");33033303- return;33043304- }33053305-33063306- drm_dp_mst_hpd_irq_send_new_request(&aconnector->mst_mgr);33073307- /* check if there is new irq to be handled */33083308- dret = drm_dp_dpcd_read(33093309- &aconnector->dm_dp_aux.aux,33103310- dpcd_addr,33113311- esi,33123312- dpcd_bytes_to_read);33133313-33143314- new_irq_handled = false;33153315- } else {33163316- break;33173317- }33183318- }33193319-33203320- if (process_count == max_process_count)33213321- DRM_DEBUG_DRIVER("Loop exceeded max iterations\n");33223322-}33233323-33243239static void schedule_hpd_rx_offload_work(struct hpd_rx_irq_offload_work_queue *offload_wq,33253240 union hpd_irq_data hpd_irq_data)33263241{···33023377 if (dc_link_dp_allow_hpd_rx_irq(dc_link)) {33033378 if (hpd_irq_data.bytes.device_service_irq.bits.UP_REQ_MSG_RDY ||33043379 hpd_irq_data.bytes.device_service_irq.bits.DOWN_REP_MSG_RDY) {33053305- dm_handle_mst_sideband_msg(aconnector);33803380+ bool skip = false;33813381+33823382+ /*33833383+ * DOWN_REP_MSG_RDY is also handled by polling method33843384+ * mgr->cbs->poll_hpd_irq()33853385+ */33863386+ spin_lock(&offload_wq->offload_lock);33873387+ skip = offload_wq->is_handling_mst_msg_rdy_event;33883388+33893389+ if (!skip)33903390+ offload_wq->is_handling_mst_msg_rdy_event = true;33913391+33923392+ spin_unlock(&offload_wq->offload_lock);33933393+33943394+ if (!skip)33953395+ schedule_hpd_rx_offload_work(offload_wq, hpd_irq_data);33963396+33063397 goto out;33073398 }33083399···34093468 aconnector = to_amdgpu_dm_connector(connector);34103469 dc_link = aconnector->dc_link;3411347034123412- if (DC_IRQ_SOURCE_INVALID != dc_link->irq_source_hpd) {34713471+ if (dc_link->irq_source_hpd != DC_IRQ_SOURCE_INVALID) {34133472 int_params.int_context = INTERRUPT_LOW_IRQ_CONTEXT;34143473 int_params.irq_source = dc_link->irq_source_hpd;34153474···34183477 (void *) aconnector);34193478 }3420347934213421- if (DC_IRQ_SOURCE_INVALID != dc_link->irq_source_hpd_rx) {34803480+ if (dc_link->irq_source_hpd_rx != DC_IRQ_SOURCE_INVALID) {3422348134233482 /* Also register for DP short pulse (hpd_rx). */34243483 int_params.int_context = INTERRUPT_LOW_IRQ_CONTEXT;···34273486 amdgpu_dm_irq_register_interrupt(adev, &int_params,34283487 handle_hpd_rx_irq,34293488 (void *) aconnector);34303430-34313431- if (adev->dm.hpd_rx_offload_wq)34323432- adev->dm.hpd_rx_offload_wq[dc_link->link_index].aconnector =34333433- aconnector;34343489 }34903490+34913491+ if (adev->dm.hpd_rx_offload_wq)34923492+ adev->dm.hpd_rx_offload_wq[connector->index].aconnector =34933493+ aconnector;34353494 }34363495}34373496···34443503 struct dc_interrupt_params int_params = {0};34453504 int r;34463505 int i;34473447- unsigned client_id = AMDGPU_IRQ_CLIENTID_LEGACY;35063506+ unsigned int client_id = AMDGPU_IRQ_CLIENTID_LEGACY;3448350734493508 int_params.requested_polarity = INTERRUPT_POLARITY_DEFAULT;34503509 int_params.current_polarity = INTERRUPT_POLARITY_DEFAULT;···34583517 * Base driver will call amdgpu_dm_irq_handler() for ALL interrupts34593518 * coming from DC hardware.34603519 * amdgpu_dm_irq_handler() will re-direct the interrupt to DC34613461- * for acknowledging and handling. */35203520+ * for acknowledging and handling.35213521+ */3462352234633523 /* Use VBLANK interrupt */34643524 for (i = 0; i < adev->mode_info.num_crtc; i++) {34653465- r = amdgpu_irq_add_id(adev, client_id, i+1 , &adev->crtc_irq);35253525+ r = amdgpu_irq_add_id(adev, client_id, i + 1, &adev->crtc_irq);34663526 if (r) {34673527 DRM_ERROR("Failed to add crtc irq id!\n");34683528 return r;···3471352934723530 int_params.int_context = INTERRUPT_HIGH_IRQ_CONTEXT;34733531 int_params.irq_source =34743474- dc_interrupt_to_irq_source(dc, i+1 , 0);35323532+ dc_interrupt_to_irq_source(dc, i + 1, 0);3475353334763534 c_irq_params = &adev->dm.vblank_params[int_params.irq_source - DC_IRQ_SOURCE_VBLANK1];34773535···35273585 struct dc_interrupt_params int_params = {0};35283586 int r;35293587 int i;35303530- unsigned client_id = AMDGPU_IRQ_CLIENTID_LEGACY;35883588+ unsigned int client_id = AMDGPU_IRQ_CLIENTID_LEGACY;3531358935323590 if (adev->family >= AMDGPU_FAMILY_AI)35333591 client_id = SOC15_IH_CLIENTID_DCE;···35443602 * Base driver will call amdgpu_dm_irq_handler() for ALL interrupts35453603 * coming from DC hardware.35463604 * amdgpu_dm_irq_handler() will re-direct the interrupt to DC35473547- * for acknowledging and handling. */36053605+ * for acknowledging and handling.36063606+ */3548360735493608 /* Use VBLANK interrupt */35503609 for (i = VISLANDS30_IV_SRCID_D1_VERTICAL_INTERRUPT0; i <= VISLANDS30_IV_SRCID_D6_VERTICAL_INTERRUPT0; i++) {···39924049}3993405039944051static int get_brightness_range(const struct amdgpu_dm_backlight_caps *caps,39953995- unsigned *min, unsigned *max)40524052+ unsigned int *min, unsigned int *max)39964053{39974054 if (!caps)39984055 return 0;···40124069static u32 convert_brightness_from_user(const struct amdgpu_dm_backlight_caps *caps,40134070 uint32_t brightness)40144071{40154015- unsigned min, max;40724072+ unsigned int min, max;4016407340174074 if (!get_brightness_range(caps, &min, &max))40184075 return brightness;···40254082static u32 convert_brightness_to_user(const struct amdgpu_dm_backlight_caps *caps,40264083 uint32_t brightness)40274084{40284028- unsigned min, max;40854085+ unsigned int min, max;4029408640304087 if (!get_brightness_range(caps, &min, &max))40314088 return brightness;···45054562static void amdgpu_dm_destroy_drm_device(struct amdgpu_display_manager *dm)45064563{45074564 drm_atomic_private_obj_fini(&dm->atomic_obj);45084508- return;45094565}4510456645114567/******************************************************************************···53365394{53375395 enum dc_color_depth depth = timing_out->display_color_depth;53385396 int normalized_clk;53975397+53395398 do {53405399 normalized_clk = timing_out->pix_clk_100hz / 10;53415400 /* YCbCr 4:2:0 requires additional adjustment of 1/2 */···55525609{55535610 struct dc_sink_init_data sink_init_data = { 0 };55545611 struct dc_sink *sink = NULL;56125612+55555613 sink_init_data.link = aconnector->dc_link;55565614 sink_init_data.sink_signal = aconnector->dc_link->connector_signal;55575615···56765732 return &aconnector->freesync_vid_base;5677573356785734 /* Find the preferred mode */56795679- list_for_each_entry (m, list_head, head) {57355735+ list_for_each_entry(m, list_head, head) {56805736 if (m->type & DRM_MODE_TYPE_PREFERRED) {56815737 m_pref = m;56825738 break;···57005756 * For some monitors, preferred mode is not the mode with highest57015757 * supported refresh rate.57025758 */57035703- list_for_each_entry (m, list_head, head) {57595759+ list_for_each_entry(m, list_head, head) {57045760 current_refresh = drm_mode_vrefresh(m);5705576157065762 if (m->hdisplay == m_pref->hdisplay &&···59726028 * This may not be an error, the use case is when we have no59736029 * usermode calls to reset and set mode upon hotplug. In this59746030 * case, we call set mode ourselves to restore the previous mode59755975- * and the modelist may not be filled in in time.60316031+ * and the modelist may not be filled in time.59766032 */59776033 DRM_DEBUG_DRIVER("No preferred mode found\n");59786034 } else {···59956051 drm_mode_set_crtcinfo(&mode, 0);5996605259976053 /*59985998- * If scaling is enabled and refresh rate didn't change59995999- * we copy the vic and polarities of the old timings60006000- */60546054+ * If scaling is enabled and refresh rate didn't change60556055+ * we copy the vic and polarities of the old timings60566056+ */60016057 if (!scale || mode_refresh != preferred_refresh)60026058 fill_stream_properties_from_drm_display_mode(60036059 stream, &mode, &aconnector->base, con_state, NULL,···6761681767626818 if (!state->duplicated) {67636819 int max_bpc = conn_state->max_requested_bpc;68206820+67646821 is_y420 = drm_mode_is_420_also(&connector->display_info, adjusted_mode) &&67656822 aconnector->force_yuv420_output;67666823 color_depth = convert_color_depth_from_display_info(connector,···70807135{70817136 struct drm_display_mode *m;7082713770837083- list_for_each_entry (m, &aconnector->base.probed_modes, head) {71387138+ list_for_each_entry(m, &aconnector->base.probed_modes, head) {70847139 if (drm_mode_equal(m, mode))70857140 return true;70867141 }···72407295 aconnector->as_type = ADAPTIVE_SYNC_TYPE_NONE;72417296 memset(&aconnector->vsdb_info, 0, sizeof(aconnector->vsdb_info));72427297 mutex_init(&aconnector->hpd_lock);72987298+ mutex_init(&aconnector->handle_mst_msg_ready);7243729972447300 /*72457301 * configure support HPD hot plug connector_>polled default value is 0···7400745474017455 link->priv = aconnector;7402745674037403- DRM_DEBUG_DRIVER("%s()\n", __func__);7404745774057458 i2c = create_i2c(link->ddc, link->link_index, &res);74067459 if (!i2c) {···80708125 * Only allow immediate flips for fast updates that don't80718126 * change memory domain, FB pitch, DCC state, rotation or80728127 * mirroring.81288128+ *81298129+ * dm_crtc_helper_atomic_check() only accepts async flips with81308130+ * fast updates.80738131 */81328132+ if (crtc->state->async_flip &&81338133+ acrtc_state->update_type != UPDATE_TYPE_FAST)81348134+ drm_warn_once(state->dev,81358135+ "[PLANE:%d:%s] async flip with non-fast update\n",81368136+ plane->base.id, plane->name);80748137 bundle->flip_addrs[planes_count].flip_immediate =80758138 crtc->state->async_flip &&80768139 acrtc_state->update_type == UPDATE_TYPE_FAST &&···81218168 * DRI3/Present extension with defined target_msc.81228169 */81238170 last_flip_vblank = amdgpu_get_vblank_counter_kms(pcrtc);81248124- }81258125- else {81718171+ } else {81268172 /* For variable refresh rate mode only:81278173 * Get vblank of last completed flip to avoid > 1 vrr81288174 * flips per video frame by use of throttling, but allow···84548502 dc_resource_state_copy_construct_current(dm->dc, dc_state);84558503 }8456850484578457- for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state,84588458- new_crtc_state, i) {85058505+ for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state,85068506+ new_crtc_state, i) {84598507 struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);8460850884618509 dm_old_crtc_state = to_dm_crtc_state(old_crtc_state);···84788526 dm_old_crtc_state = to_dm_crtc_state(old_crtc_state);8479852784808528 drm_dbg_state(state->dev,84818481- "amdgpu_crtc id:%d crtc_state_flags: enable:%d, active:%d, "84828482- "planes_changed:%d, mode_changed:%d,active_changed:%d,"84838483- "connectors_changed:%d\n",85298529+ "amdgpu_crtc id:%d crtc_state_flags: enable:%d, active:%d, planes_changed:%d, mode_changed:%d,active_changed:%d,connectors_changed:%d\n",84848530 acrtc->crtc_id,84858531 new_crtc_state->enable,84868532 new_crtc_state->active,···90549104 &commit->flip_done, 10*HZ);9055910590569106 if (ret == 0)90579057- DRM_ERROR("[CRTC:%d:%s] hw_done or flip_done "90589058- "timed out\n", crtc->base.id, crtc->name);91079107+ DRM_ERROR("[CRTC:%d:%s] hw_done or flip_done timed out\n",91089108+ crtc->base.id, crtc->name);9059910990609110 drm_crtc_commit_put(commit);90619111 }···91409190 return false;91419191}9142919291439143-static void set_freesync_fixed_config(struct dm_crtc_state *dm_new_crtc_state) {91939193+static void set_freesync_fixed_config(struct dm_crtc_state *dm_new_crtc_state)91949194+{91449195 u64 num, den, res;91459196 struct drm_crtc_state *new_crtc_state = &dm_new_crtc_state->base;91469197···92639312 goto skip_modeset;9264931392659314 drm_dbg_state(state->dev,92669266- "amdgpu_crtc id:%d crtc_state_flags: enable:%d, active:%d, "92679267- "planes_changed:%d, mode_changed:%d,active_changed:%d,"92689268- "connectors_changed:%d\n",93159315+ "amdgpu_crtc id:%d crtc_state_flags: enable:%d, active:%d, planes_changed:%d, mode_changed:%d,active_changed:%d,connectors_changed:%d\n",92699316 acrtc->crtc_id,92709317 new_crtc_state->enable,92719318 new_crtc_state->active,···92929343 old_crtc_state)) {92939344 new_crtc_state->mode_changed = false;92949345 DRM_DEBUG_DRIVER(92959295- "Mode change not required for front porch change, "92969296- "setting mode_changed to %d",93469346+ "Mode change not required for front porch change, setting mode_changed to %d",92979347 new_crtc_state->mode_changed);9298934892999349 set_freesync_fixed_config(dm_new_crtc_state);···93049356 struct drm_display_mode *high_mode;9305935793069358 high_mode = get_highest_refresh_rate_mode(aconnector, false);93079307- if (!drm_mode_equal(&new_crtc_state->mode, high_mode)) {93599359+ if (!drm_mode_equal(&new_crtc_state->mode, high_mode))93089360 set_freesync_fixed_config(dm_new_crtc_state);93099309- }93109361 }9311936293129363 ret = dm_atomic_get_state(state, &dm_state);···94739526 */94749527 for_each_oldnew_plane_in_state(state, other, old_other_state, new_other_state, i) {94759528 struct amdgpu_framebuffer *old_afb, *new_afb;95299529+94769530 if (other->type == DRM_PLANE_TYPE_CURSOR)94779531 continue;94789532···95729624 }9573962595749626 /* Core DRM takes care of checking FB modifiers, so we only need to95759575- * check tiling flags when the FB doesn't have a modifier. */96279627+ * check tiling flags when the FB doesn't have a modifier.96289628+ */95769629 if (!(fb->flags & DRM_MODE_FB_MODIFIERS)) {95779630 if (adev->family < AMDGPU_FAMILY_AI) {95789631 linear = AMDGPU_TILING_GET(afb->tiling_flags, ARRAY_MODE) != DC_ARRAY_2D_TILED_THIN1 &&95799579- AMDGPU_TILING_GET(afb->tiling_flags, ARRAY_MODE) != DC_ARRAY_1D_TILED_THIN1 &&96329632+ AMDGPU_TILING_GET(afb->tiling_flags, ARRAY_MODE) != DC_ARRAY_1D_TILED_THIN1 &&95809633 AMDGPU_TILING_GET(afb->tiling_flags, MICRO_TILE_MODE) == 0;95819634 } else {95829635 linear = AMDGPU_TILING_GET(afb->tiling_flags, SWIZZLE_MODE) == 0;···97999850 /* On DCE and DCN there is no dedicated hardware cursor plane. We get a98009851 * cursor per pipe but it's going to inherit the scaling and98019852 * positioning from the underlying pipe. Check the cursor plane's98029802- * blending properties match the underlying planes'. */98539853+ * blending properties match the underlying planes'.98549854+ */9803985598049856 new_cursor_state = drm_atomic_get_new_plane_state(state, cursor);98059805- if (!new_cursor_state || !new_cursor_state->fb) {98579857+ if (!new_cursor_state || !new_cursor_state->fb)98069858 return 0;98079807- }9808985998099860 dm_get_oriented_plane_size(new_cursor_state, &cursor_src_w, &cursor_src_h);98109861 cursor_scale_w = new_cursor_state->crtc_w * 1000 / cursor_src_w;···98499900 struct drm_connector_state *conn_state, *old_conn_state;98509901 struct amdgpu_dm_connector *aconnector = NULL;98519902 int i;99039903+98529904 for_each_oldnew_connector_in_state(state, connector, old_conn_state, conn_state, i) {98539905 if (!conn_state->crtc)98549906 conn_state = old_conn_state;···1028410334 }10285103351028610336 /* Store the overall update type for use later in atomic check. */1028710287- for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) {1033710337+ for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {1028810338 struct dm_crtc_state *dm_new_crtc_state =1028910339 to_dm_crtc_state(new_crtc_state);1029010340···1030610356 else if (ret == -EINTR || ret == -EAGAIN || ret == -ERESTARTSYS)1030710357 DRM_DEBUG_DRIVER("Atomic check stopped due to signal.\n");1030810358 else1030910309- DRM_DEBUG_DRIVER("Atomic check failed with err: %d \n", ret);1035910359+ DRM_DEBUG_DRIVER("Atomic check failed with err: %d\n", ret);10310103601031110361 trace_amdgpu_dm_atomic_check_finish(state, ret);1031210362
+7
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
···195195 */196196 bool is_handling_link_loss;197197 /**198198+ * @is_handling_mst_msg_rdy_event: Used to prevent inserting mst message199199+ * ready event when we're already handling mst message ready event200200+ */201201+ bool is_handling_mst_msg_rdy_event;202202+ /**198203 * @aconnector: The aconnector that this work queue is attached to199204 */200205 struct amdgpu_dm_connector *aconnector;···643638 struct drm_dp_mst_port *mst_output_port;644639 struct amdgpu_dm_connector *mst_root;645640 struct drm_dp_aux *dsc_aux;641641+ struct mutex handle_mst_msg_ready;642642+646643 /* TODO see if we can merge with ddc_bus or make a dm_connector */647644 struct amdgpu_i2c_adapter *i2c;648645
···398398 return -EINVAL;399399 }400400401401+ /*402402+ * Only allow async flips for fast updates that don't change the FB403403+ * pitch, the DCC state, rotation, etc.404404+ */405405+ if (crtc_state->async_flip &&406406+ dm_crtc_state->update_type != UPDATE_TYPE_FAST) {407407+ drm_dbg_atomic(crtc->dev,408408+ "[CRTC:%d:%s] async flips are only supported for fast updates\n",409409+ crtc->base.id, crtc->name);410410+ return -EINVAL;411411+ }412412+401413 /* In some use cases, like reset, no stream is attached */402414 if (!dm_crtc_state->stream)403415 return 0;
···11+/*22+ * Copyright 2020 Advanced Micro Devices, Inc.33+ *44+ * Permission is hereby granted, free of charge, to any person obtaining a55+ * copy of this software and associated documentation files (the "Software"),66+ * to deal in the Software without restriction, including without limitation77+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,88+ * and/or sell copies of the Software, and to permit persons to whom the99+ * Software is furnished to do so, subject to the following conditions:1010+ *1111+ * The above copyright notice and this permission notice shall be included in1212+ * all copies or substantial portions of the Software.1313+ *1414+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR1515+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,1616+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL1717+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR1818+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,1919+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR2020+ * OTHER DEALINGS IN THE SOFTWARE.2121+ *2222+ * Authors: AMD2323+ *2424+ */2525+2626+#ifndef __DC_OPTC_DCN301_H__2727+#define __DC_OPTC_DCN301_H__2828+2929+#include "dcn20/dcn20_optc.h"3030+#include "dcn30/dcn30_optc.h"3131+3232+void dcn301_timing_generator_init(struct optc *optc1);3333+void optc301_setup_manual_trigger(struct timing_generator *optc);3434+void optc301_set_drr(struct timing_generator *optc, const struct drr_params *params);3535+3636+#endif /* __DC_OPTC_DCN301_H__ */
···3838#include "i915_reg.h"3939#include "intel_pci_config.h"40404141-__diag_push();4242-__diag_ignore_all("-Woverride-init", "Allow overriding inherited members");4343-4441#define PLATFORM(x) .platform = (x)4542#define GEN(x) \4643 .__runtime.graphics.ip.ver = (x), \···842845};843846844847#undef PLATFORM845845-846846-__diag_pop();847848848849/*849850 * Make sure any device matches here are from most specific to most
···199199 return __intel_idle(dev, drv, index);200200}201201202202-static __always_inline int __intel_idle_hlt(struct cpuidle_device *dev,203203- struct cpuidle_driver *drv, int index)204204-{205205- raw_safe_halt();206206- raw_local_irq_disable();207207- return index;208208-}209209-210210-/**211211- * intel_idle_hlt - Ask the processor to enter the given idle state using hlt.212212- * @dev: cpuidle device of the target CPU.213213- * @drv: cpuidle driver (assumed to point to intel_idle_driver).214214- * @index: Target idle state index.215215- *216216- * Use the HLT instruction to notify the processor that the CPU represented by217217- * @dev is idle and it can try to enter the idle state corresponding to @index.218218- *219219- * Must be called under local_irq_disable().220220- */221221-static __cpuidle int intel_idle_hlt(struct cpuidle_device *dev,222222- struct cpuidle_driver *drv, int index)223223-{224224- return __intel_idle_hlt(dev, drv, index);225225-}226226-227227-static __cpuidle int intel_idle_hlt_irq_on(struct cpuidle_device *dev,228228- struct cpuidle_driver *drv, int index)229229-{230230- int ret;231231-232232- raw_local_irq_enable();233233- ret = __intel_idle_hlt(dev, drv, index);234234- raw_local_irq_disable();235235-236236- return ret;237237-}238238-239202/**240203 * intel_idle_s2idle - Ask the processor to enter the given idle state.241204 * @dev: cpuidle device of the target CPU.···12421279 .enter = NULL }12431280};1244128112451245-static struct cpuidle_state vmguest_cstates[] __initdata = {12461246- {12471247- .name = "C1",12481248- .desc = "HLT",12491249- .flags = MWAIT2flg(0x00) | CPUIDLE_FLAG_IRQ_ENABLE,12501250- .exit_latency = 5,12511251- .target_residency = 10,12521252- .enter = &intel_idle_hlt, },12531253- {12541254- .name = "C1L",12551255- .desc = "Long HLT",12561256- .flags = MWAIT2flg(0x00) | CPUIDLE_FLAG_TLB_FLUSHED,12571257- .exit_latency = 5,12581258- .target_residency = 200,12591259- .enter = &intel_idle_hlt, },12601260- {12611261- .enter = NULL }12621262-};12631263-12641282static const struct idle_cpu idle_cpu_nehalem __initconst = {12651283 .state_table = nehalem_cstates,12661284 .auto_demotion_disable_flags = NHM_C1_AUTO_DEMOTE | NHM_C3_AUTO_DEMOTE,···1841189718421898static void state_update_enter_method(struct cpuidle_state *state, int cstate)18431899{18441844- if (state->enter == intel_idle_hlt) {18451845- if (force_irq_on) {18461846- pr_info("forced intel_idle_irq for state %d\n", cstate);18471847- state->enter = intel_idle_hlt_irq_on;18481848- }18491849- return;18501850- }18511851- if (state->enter == intel_idle_hlt_irq_on)18521852- return; /* no update scenarios */18531853-18541900 if (state->flags & CPUIDLE_FLAG_INIT_XSTATE) {18551901 /*18561902 * Combining with XSTATE with IBRS or IRQ_ENABLE flags···18721938 pr_info("forced intel_idle_irq for state %d\n", cstate);18731939 state->enter = intel_idle_irq;18741940 }18751875-}18761876-18771877-/*18781878- * For mwait based states, we want to verify the cpuid data to see if the state18791879- * is actually supported by this specific CPU.18801880- * For non-mwait based states, this check should be skipped.18811881- */18821882-static bool should_verify_mwait(struct cpuidle_state *state)18831883-{18841884- if (state->enter == intel_idle_hlt)18851885- return false;18861886- if (state->enter == intel_idle_hlt_irq_on)18871887- return false;18881888-18891889- return true;18901941}1891194218921943static void __init intel_idle_init_cstates_icpu(struct cpuidle_driver *drv)···19222003 }1923200419242005 mwait_hint = flg2MWAIT(cpuidle_state_table[cstate].flags);19251925- if (should_verify_mwait(&cpuidle_state_table[cstate]) && !intel_idle_verify_cstate(mwait_hint))20062006+ if (!intel_idle_verify_cstate(mwait_hint))19262007 continue;1927200819282009 /* Structure copy. */···20562137 cpuidle_unregister_device(per_cpu_ptr(intel_idle_cpuidle_devices, i));20572138}2058213920592059-/*20602060- * Match up the latency and break even point of the bare metal (cpu based)20612061- * states with the deepest VM available state.20622062- *20632063- * We only want to do this for the deepest state, the ones that has20642064- * the TLB_FLUSHED flag set on the .20652065- *20662066- * All our short idle states are dominated by vmexit/vmenter latencies,20672067- * not the underlying hardware latencies so we keep our values for these.20682068- */20692069-static void __init matchup_vm_state_with_baremetal(void)20702070-{20712071- int cstate;20722072-20732073- for (cstate = 0; cstate < CPUIDLE_STATE_MAX; ++cstate) {20742074- int matching_cstate;20752075-20762076- if (intel_idle_max_cstate_reached(cstate))20772077- break;20782078-20792079- if (!cpuidle_state_table[cstate].enter)20802080- break;20812081-20822082- if (!(cpuidle_state_table[cstate].flags & CPUIDLE_FLAG_TLB_FLUSHED))20832083- continue;20842084-20852085- for (matching_cstate = 0; matching_cstate < CPUIDLE_STATE_MAX; ++matching_cstate) {20862086- if (!icpu->state_table[matching_cstate].enter)20872087- break;20882088- if (icpu->state_table[matching_cstate].exit_latency > cpuidle_state_table[cstate].exit_latency) {20892089- cpuidle_state_table[cstate].exit_latency = icpu->state_table[matching_cstate].exit_latency;20902090- cpuidle_state_table[cstate].target_residency = icpu->state_table[matching_cstate].target_residency;20912091- }20922092- }20932093-20942094- }20952095-}20962096-20972097-20982098-static int __init intel_idle_vminit(const struct x86_cpu_id *id)20992099-{21002100- int retval;21012101-21022102- cpuidle_state_table = vmguest_cstates;21032103-21042104- icpu = (const struct idle_cpu *)id->driver_data;21052105-21062106- pr_debug("v" INTEL_IDLE_VERSION " model 0x%X\n",21072107- boot_cpu_data.x86_model);21082108-21092109- intel_idle_cpuidle_devices = alloc_percpu(struct cpuidle_device);21102110- if (!intel_idle_cpuidle_devices)21112111- return -ENOMEM;21122112-21132113- /*21142114- * We don't know exactly what the host will do when we go idle, but as a worst estimate21152115- * we can assume that the exit latency of the deepest host state will be hit for our21162116- * deep (long duration) guest idle state.21172117- * The same logic applies to the break even point for the long duration guest idle state.21182118- * So lets copy these two properties from the table we found for the host CPU type.21192119- */21202120- matchup_vm_state_with_baremetal();21212121-21222122- intel_idle_cpuidle_driver_init(&intel_idle_driver);21232123-21242124- retval = cpuidle_register_driver(&intel_idle_driver);21252125- if (retval) {21262126- struct cpuidle_driver *drv = cpuidle_get_driver();21272127- printk(KERN_DEBUG pr_fmt("intel_idle yielding to %s\n"),21282128- drv ? drv->name : "none");21292129- goto init_driver_fail;21302130- }21312131-21322132- retval = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "idle/intel:online",21332133- intel_idle_cpu_online, NULL);21342134- if (retval < 0)21352135- goto hp_setup_fail;21362136-21372137- return 0;21382138-hp_setup_fail:21392139- intel_idle_cpuidle_devices_uninit();21402140- cpuidle_unregister_driver(&intel_idle_driver);21412141-init_driver_fail:21422142- free_percpu(intel_idle_cpuidle_devices);21432143- return retval;21442144-}21452145-21462140static int __init intel_idle_init(void)21472141{21482142 const struct x86_cpu_id *id;···20742242 id = x86_match_cpu(intel_idle_ids);20752243 if (id) {20762244 if (!boot_cpu_has(X86_FEATURE_MWAIT)) {20772077- if (boot_cpu_has(X86_FEATURE_HYPERVISOR))20782078- return intel_idle_vminit(id);20792245 pr_debug("Please enable MWAIT in BIOS SETUP\n");20802246 return -ENODEV;20812247 }
···1508150815091509 memcpy(bond_dev->broadcast, slave_dev->broadcast,15101510 slave_dev->addr_len);15111511+15121512+ if (slave_dev->flags & IFF_POINTOPOINT) {15131513+ bond_dev->flags &= ~(IFF_BROADCAST | IFF_MULTICAST);15141514+ bond_dev->flags |= (IFF_POINTOPOINT | IFF_NOARP);15151515+ }15111516}1512151715131518/* On bonding slaves other than the currently active slave, suppress
+2
drivers/net/can/usb/gs_usb.c
···10301030 usb_kill_anchored_urbs(&dev->tx_submitted);10311031 atomic_set(&dev->active_tx_urbs, 0);1032103210331033+ dev->can.state = CAN_STATE_STOPPED;10341034+10331035 /* reset the device */10341036 rc = gs_cmd_reset(dev);10351037 if (rc < 0)
+5-2
drivers/net/dsa/qca/qca8k-8xxx.c
···576576 .rd_table = &qca8k_readable_table,577577 .disable_locking = true, /* Locking is handled by qca8k read/write */578578 .cache_type = REGCACHE_NONE, /* Explicitly disable CACHE */579579- .max_raw_read = 32, /* mgmt eth can read/write up to 8 registers at time */580580- .max_raw_write = 32,579579+ .max_raw_read = 32, /* mgmt eth can read up to 8 registers at time */580580+ /* ATU regs suffer from a bug where some data are not correctly581581+ * written. Disable bulk write to correctly write ATU entry.582582+ */583583+ .use_single_write = true,581584};582585583586static int
+16-3
drivers/net/dsa/qca/qca8k-common.c
···244244}245245246246static int qca8k_fdb_search_and_insert(struct qca8k_priv *priv, u8 port_mask,247247- const u8 *mac, u16 vid)247247+ const u8 *mac, u16 vid, u8 aging)248248{249249 struct qca8k_fdb fdb = { 0 };250250 int ret;···261261 goto exit;262262263263 /* Rule exist. Delete first */264264- if (!fdb.aging) {264264+ if (fdb.aging) {265265 ret = qca8k_fdb_access(priv, QCA8K_FDB_PURGE, -1);266266 if (ret)267267 goto exit;268268+ } else {269269+ fdb.aging = aging;268270 }269271270272 /* Add port to fdb portmask */···290288291289 qca8k_fdb_write(priv, vid, 0, mac, 0);292290 ret = qca8k_fdb_access(priv, QCA8K_FDB_SEARCH, -1);291291+ if (ret < 0)292292+ goto exit;293293+294294+ ret = qca8k_fdb_read(priv, &fdb);293295 if (ret < 0)294296 goto exit;295297···816810 const u8 *addr = mdb->addr;817811 u16 vid = mdb->vid;818812819819- return qca8k_fdb_search_and_insert(priv, BIT(port), addr, vid);813813+ if (!vid)814814+ vid = QCA8K_PORT_VID_DEF;815815+816816+ return qca8k_fdb_search_and_insert(priv, BIT(port), addr, vid,817817+ QCA8K_ATU_STATUS_STATIC);820818}821819822820int qca8k_port_mdb_del(struct dsa_switch *ds, int port,···830820 struct qca8k_priv *priv = ds->priv;831821 const u8 *addr = mdb->addr;832822 u16 vid = mdb->vid;823823+824824+ if (!vid)825825+ vid = QCA8K_PORT_VID_DEF;833826834827 return qca8k_fdb_search_and_del(priv, BIT(port), addr, vid);835828}
+5-2
drivers/net/ethernet/atheros/atl1c/atl1c_main.c
···20942094 real_len = (((unsigned char *)ip_hdr(skb) - skb->data)20952095 + ntohs(ip_hdr(skb)->tot_len));2096209620972097- if (real_len < skb->len)20982098- pskb_trim(skb, real_len);20972097+ if (real_len < skb->len) {20982098+ err = pskb_trim(skb, real_len);20992099+ if (err)21002100+ return err;21012101+ }2099210221002103 hdr_len = skb_tcp_all_headers(skb);21012104 if (unlikely(skb->len == hdr_len)) {
+5-2
drivers/net/ethernet/atheros/atl1e/atl1e_main.c
···16411641 real_len = (((unsigned char *)ip_hdr(skb) - skb->data)16421642 + ntohs(ip_hdr(skb)->tot_len));1643164316441644- if (real_len < skb->len)16451645- pskb_trim(skb, real_len);16441644+ if (real_len < skb->len) {16451645+ err = pskb_trim(skb, real_len);16461646+ if (err)16471647+ return err;16481648+ }1646164916471650 hdr_len = skb_tcp_all_headers(skb);16481651 if (unlikely(skb->len == hdr_len)) {
···11381138 (lancer_chip(adapter) || BE3_chip(adapter) ||11391139 skb_vlan_tag_present(skb)) && is_ipv4_pkt(skb)) {11401140 ip = (struct iphdr *)ip_hdr(skb);11411141- pskb_trim(skb, eth_hdr_len + ntohs(ip->tot_len));11411141+ if (unlikely(pskb_trim(skb, eth_hdr_len + ntohs(ip->tot_len))))11421142+ goto tx_drop;11421143 }1143114411441145 /* If vlan tag is already inlined in the packet, skip HW VLAN
+14-4
drivers/net/ethernet/freescale/fec_main.c
···13701370}1371137113721372static void13731373-fec_enet_tx_queue(struct net_device *ndev, u16 queue_id)13731373+fec_enet_tx_queue(struct net_device *ndev, u16 queue_id, int budget)13741374{13751375 struct fec_enet_private *fep;13761376 struct xdp_frame *xdpf;···14141414 if (!skb)14151415 goto tx_buf_done;14161416 } else {14171417+ /* Tx processing cannot call any XDP (or page pool) APIs if14181418+ * the "budget" is 0. Because NAPI is called with budget of14191419+ * 0 (such as netpoll) indicates we may be in an IRQ context,14201420+ * however, we can't use the page pool from IRQ context.14211421+ */14221422+ if (unlikely(!budget))14231423+ break;14241424+14171425 xdpf = txq->tx_buf[index].xdp;14181426 if (bdp->cbd_bufaddr)14191427 dma_unmap_single(&fep->pdev->dev,···15141506 writel(0, txq->bd.reg_desc_active);15151507}1516150815171517-static void fec_enet_tx(struct net_device *ndev)15091509+static void fec_enet_tx(struct net_device *ndev, int budget)15181510{15191511 struct fec_enet_private *fep = netdev_priv(ndev);15201512 int i;1521151315221514 /* Make sure that AVB queues are processed first. */15231515 for (i = fep->num_tx_queues - 1; i >= 0; i--)15241524- fec_enet_tx_queue(ndev, i);15161516+ fec_enet_tx_queue(ndev, i, budget);15251517}1526151815271519static void fec_enet_update_cbd(struct fec_enet_priv_rx_q *rxq,···1864185618651857 do {18661858 done += fec_enet_rx(ndev, budget - done);18671867- fec_enet_tx(ndev);18591859+ fec_enet_tx(ndev, budget);18681860 } while ((done < budget) && fec_enet_collect_events(fep));1869186118701862 if (done < budget) {···3882387438833875 __netif_tx_lock(nq, cpu);3884387638773877+ /* Avoid tx timeout as XDP shares the queue with kernel stack */38783878+ txq_trans_cond_update(nq);38853879 for (i = 0; i < num_frames; i++) {38863880 if (fec_enet_txq_xmit_frame(fep, txq, frames[i]) < 0)38873881 break;
···52525353 for (i = 0; i < HNAE3_MAX_TC; i++) {5454 ets->prio_tc[i] = hdev->tm_info.prio_tc[i];5555- ets->tc_tx_bw[i] = hdev->tm_info.pg_info[0].tc_dwrr[i];5555+ if (i < hdev->tm_info.num_tc)5656+ ets->tc_tx_bw[i] = hdev->tm_info.pg_info[0].tc_dwrr[i];5757+ else5858+ ets->tc_tx_bw[i] = 0;56595760 if (hdev->tm_info.tc_info[i].tc_sch_mode ==5861 HCLGE_SCH_MODE_SP)···126123}127124128125static int hclge_ets_sch_mode_validate(struct hclge_dev *hdev,129129- struct ieee_ets *ets, bool *changed)126126+ struct ieee_ets *ets, bool *changed,127127+ u8 tc_num)130128{131129 bool has_ets_tc = false;132130 u32 total_ets_bw = 0;···141137 *changed = true;142138 break;143139 case IEEE_8021QAZ_TSA_ETS:140140+ if (i >= tc_num) {141141+ dev_err(&hdev->pdev->dev,142142+ "tc%u is disabled, cannot set ets bw\n",143143+ i);144144+ return -EINVAL;145145+ }146146+144147 /* The hardware will switch to sp mode if bandwidth is145148 * 0, so limit ets bandwidth must be greater than 0.146149 */···187176 if (ret)188177 return ret;189178190190- ret = hclge_ets_sch_mode_validate(hdev, ets, changed);179179+ ret = hclge_ets_sch_mode_validate(hdev, ets, changed, tc_num);191180 if (ret)192181 return ret;193182···227216 if (ret)228217 return ret;229218219219+ ret = hclge_tm_flush_cfg(hdev, true);220220+ if (ret)221221+ return ret;222222+230223 return hclge_notify_client(hdev, HNAE3_UNINIT_CLIENT);231224}232225···239224 int ret;240225241226 ret = hclge_notify_client(hdev, HNAE3_INIT_CLIENT);227227+ if (ret)228228+ return ret;229229+230230+ ret = hclge_tm_flush_cfg(hdev, false);242231 if (ret)243232 return ret;244233···332313 struct net_device *netdev = h->kinfo.netdev;333314 struct hclge_dev *hdev = vport->back;334315 u8 i, j, pfc_map, *prio_tc;316316+ int last_bad_ret = 0;335317 int ret;336318337319 if (!(hdev->dcbx_cap & DCB_CAP_DCBX_VER_IEEE))···370350 if (ret)371351 return ret;372352373373- ret = hclge_buffer_alloc(hdev);374374- if (ret) {375375- hclge_notify_client(hdev, HNAE3_UP_CLIENT);353353+ ret = hclge_tm_flush_cfg(hdev, true);354354+ if (ret)376355 return ret;377377- }378356379379- return hclge_notify_client(hdev, HNAE3_UP_CLIENT);357357+ /* No matter whether the following operations are performed358358+ * successfully or not, disabling the tm flush and notify359359+ * the network status to up are necessary.360360+ * Do not return immediately.361361+ */362362+ ret = hclge_buffer_alloc(hdev);363363+ if (ret)364364+ last_bad_ret = ret;365365+366366+ ret = hclge_tm_flush_cfg(hdev, false);367367+ if (ret)368368+ last_bad_ret = ret;369369+370370+ ret = hclge_notify_client(hdev, HNAE3_UP_CLIENT);371371+ if (ret)372372+ last_bad_ret = ret;373373+374374+ return last_bad_ret;380375}381376382377static int hclge_ieee_setapp(struct hnae3_handle *h, struct dcb_app *app)
···18391839void i40e_dbg_init(void)18401840{18411841 i40e_dbg_root = debugfs_create_dir(i40e_driver_name, NULL);18421842- if (!i40e_dbg_root)18421842+ if (IS_ERR(i40e_dbg_root))18431843 pr_info("init of debugfs failed\n");18441844}18451845
+6-5
drivers/net/ethernet/intel/iavf/iavf_main.c
···32503250 u32 val, oldval;32513251 u16 pending;3252325232533253- if (adapter->flags & IAVF_FLAG_PF_COMMS_FAILED)32543254- goto out;32553255-32563253 if (!mutex_trylock(&adapter->crit_lock)) {32573254 if (adapter->state == __IAVF_REMOVE)32583255 return;···32583261 goto out;32593262 }3260326332643264+ if (adapter->flags & IAVF_FLAG_PF_COMMS_FAILED)32653265+ goto unlock;32663266+32613267 event.buf_len = IAVF_MAX_AQ_BUF_SIZE;32623268 event.msg_buf = kzalloc(event.buf_len, GFP_KERNEL);32633269 if (!event.msg_buf)32643264- goto out;32703270+ goto unlock;3265327132663272 do {32673273 ret = iavf_clean_arq_element(hw, &event, &pending);···32793279 if (pending != 0)32803280 memset(event.msg_buf, 0, IAVF_MAX_AQ_BUF_SIZE);32813281 } while (pending);32823282- mutex_unlock(&adapter->crit_lock);3283328232843283 if (iavf_is_reset_in_progress(adapter))32853284 goto freedom;···3322332333233324freedom:33243325 kfree(event.msg_buf);33263326+unlock:33273327+ mutex_unlock(&adapter->crit_lock);33253328out:33263329 /* re-enable Admin queue interrupt cause */33273330 iavf_misc_irq_enable(adapter);
+14-12
drivers/net/ethernet/intel/ice/ice_ethtool_fdir.c
···12811281 ICE_FLOW_FLD_OFF_INVAL);12821282 }1283128312841284- /* add filter for outer headers */12851284 fltr_idx = ice_ethtool_flow_to_fltr(fsp->flow_type & ~FLOW_EXT);12851285+12861286+ assign_bit(fltr_idx, hw->fdir_perfect_fltr, perfect_filter);12871287+12881288+ /* add filter for outer headers */12861289 ret = ice_fdir_set_hw_fltr_rule(pf, seg, fltr_idx,12871290 ICE_FD_HW_SEG_NON_TUN);12881288- if (ret == -EEXIST)12891289- /* Rule already exists, free memory and continue */12901290- devm_kfree(dev, seg);12911291- else if (ret)12911291+ if (ret == -EEXIST) {12921292+ /* Rule already exists, free memory and count as success */12931293+ ret = 0;12941294+ goto err_exit;12951295+ } else if (ret) {12921296 /* could not write filter, free memory */12931297 goto err_exit;12981298+ }1294129912951300 /* make tunneled filter HW entries if possible */12961301 memcpy(&tun_seg[1], seg, sizeof(*seg));···13101305 devm_kfree(dev, tun_seg);13111306 }1312130713131313- if (perfect_filter)13141314- set_bit(fltr_idx, hw->fdir_perfect_fltr);13151315- else13161316- clear_bit(fltr_idx, hw->fdir_perfect_fltr);13171317-13181308 return ret;1319130913201310err_exit:13211311 devm_kfree(dev, tun_seg);13221312 devm_kfree(dev, seg);1323131313241324- return -EOPNOTSUPP;13141314+ return ret;13251315}1326131613271317/**···19141914 input->comp_report = ICE_FXD_FLTR_QW0_COMP_REPORT_SW_FAIL;1915191519161916 /* input struct is added to the HW filter list */19171917- ice_fdir_update_list_entry(pf, input, fsp->location);19171917+ ret = ice_fdir_update_list_entry(pf, input, fsp->location);19181918+ if (ret)19191919+ goto release_lock;1918192019191921 ret = ice_fdir_write_all_fltr(pf, input, true);19201922 if (ret)
+28-12
drivers/net/ethernet/intel/igc/igc_main.c
···316316 igc_clean_tx_ring(adapter->tx_ring[i]);317317}318318319319+static void igc_disable_tx_ring_hw(struct igc_ring *ring)320320+{321321+ struct igc_hw *hw = &ring->q_vector->adapter->hw;322322+ u8 idx = ring->reg_idx;323323+ u32 txdctl;324324+325325+ txdctl = rd32(IGC_TXDCTL(idx));326326+ txdctl &= ~IGC_TXDCTL_QUEUE_ENABLE;327327+ txdctl |= IGC_TXDCTL_SWFLUSH;328328+ wr32(IGC_TXDCTL(idx), txdctl);329329+}330330+331331+/**332332+ * igc_disable_all_tx_rings_hw - Disable all transmit queue operation333333+ * @adapter: board private structure334334+ */335335+static void igc_disable_all_tx_rings_hw(struct igc_adapter *adapter)336336+{337337+ int i;338338+339339+ for (i = 0; i < adapter->num_tx_queues; i++) {340340+ struct igc_ring *tx_ring = adapter->tx_ring[i];341341+342342+ igc_disable_tx_ring_hw(tx_ring);343343+ }344344+}345345+319346/**320347 * igc_setup_tx_resources - allocate Tx resources (Descriptors)321348 * @tx_ring: tx descriptor ring (for a specific queue) to setup···50855058 /* clear VLAN promisc flag so VFTA will be updated if necessary */50865059 adapter->flags &= ~IGC_FLAG_VLAN_PROMISC;5087506050615061+ igc_disable_all_tx_rings_hw(adapter);50885062 igc_clean_all_tx_rings(adapter);50895063 igc_clean_all_rx_rings(adapter);50905064}···73457317 igc_alloc_rx_buffers_zc(ring, igc_desc_unused(ring));73467318 else73477319 igc_alloc_rx_buffers(ring, igc_desc_unused(ring));73487348-}73497349-73507350-static void igc_disable_tx_ring_hw(struct igc_ring *ring)73517351-{73527352- struct igc_hw *hw = &ring->q_vector->adapter->hw;73537353- u8 idx = ring->reg_idx;73547354- u32 txdctl;73557355-73567356- txdctl = rd32(IGC_TXDCTL(idx));73577357- txdctl &= ~IGC_TXDCTL_QUEUE_ENABLE;73587358- txdctl |= IGC_TXDCTL_SWFLUSH;73597359- wr32(IGC_TXDCTL(idx), txdctl);73607320}7361732173627322void igc_disable_tx_ring(struct igc_ring *ring)
+1-1
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
···84798479 struct ixgbe_adapter *adapter = q_vector->adapter;8480848084818481 if (unlikely(skb_tail_pointer(skb) < hdr.network +84828482- VXLAN_HEADROOM))84828482+ vxlan_headroom(0)))84838483 return;8484848484858485 /* verify the port is recognized as VXLAN */
···218218219219void npc_program_mkex_hash(struct rvu *rvu, int blkaddr)220220{221221+ struct npc_mcam_kex_hash *mh = rvu->kpu.mkex_hash;221222 struct hw_cap *hwcap = &rvu->hw->cap;223223+ u8 intf, ld, hdr_offset, byte_len;222224 struct rvu_hwinfo *hw = rvu->hw;223223- u8 intf;225225+ u64 cfg;224226227227+ /* Check if hardware supports hash extraction */225228 if (!hwcap->npc_hash_extract)226229 return;227230231231+ /* Check if IPv6 source/destination address232232+ * should be hash enabled.233233+ * Hashing reduces 128bit SIP/DIP fields to 32bit234234+ * so that 224 bit X2 key can be used for IPv6 based filters as well,235235+ * which in turn results in more number of MCAM entries available for236236+ * use.237237+ *238238+ * Hashing of IPV6 SIP/DIP is enabled in below scenarios239239+ * 1. If the silicon variant supports hashing feature240240+ * 2. If the number of bytes of IP addr being extracted is 4 bytes ie241241+ * 32bit. The assumption here is that if user wants 8bytes of LSB of242242+ * IP addr or full 16 bytes then his intention is not to use 32bit243243+ * hash.244244+ */245245+ for (intf = 0; intf < hw->npc_intfs; intf++) {246246+ for (ld = 0; ld < NPC_MAX_LD; ld++) {247247+ cfg = rvu_read64(rvu, blkaddr,248248+ NPC_AF_INTFX_LIDX_LTX_LDX_CFG(intf,249249+ NPC_LID_LC,250250+ NPC_LT_LC_IP6,251251+ ld));252252+ hdr_offset = FIELD_GET(NPC_HDR_OFFSET, cfg);253253+ byte_len = FIELD_GET(NPC_BYTESM, cfg);254254+ /* Hashing of IPv6 source/destination address should be255255+ * enabled if,256256+ * hdr_offset == 8 (offset of source IPv6 address) or257257+ * hdr_offset == 24 (offset of destination IPv6)258258+ * address) and the number of byte to be259259+ * extracted is 4. As per hardware configuration260260+ * byte_len should be == actual byte_len - 1.261261+ * Hence byte_len is checked against 3 but nor 4.262262+ */263263+ if ((hdr_offset == 8 || hdr_offset == 24) && byte_len == 3)264264+ mh->lid_lt_ld_hash_en[intf][NPC_LID_LC][NPC_LT_LC_IP6][ld] = true;265265+ }266266+ }267267+268268+ /* Update hash configuration if the field is hash enabled */228269 for (intf = 0; intf < hw->npc_intfs; intf++) {229270 npc_program_mkex_hash_rx(rvu, blkaddr, intf);230271 npc_program_mkex_hash_tx(rvu, blkaddr, intf);
···328328 ret = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND2, MV_V2_PORT_CTRL,329329 MV_V2_PORT_CTRL_PWRDOWN);330330331331+ /* Sometimes, the power down bit doesn't clear immediately, and332332+ * a read of this register causes the bit not to clear. Delay333333+ * 100us to allow the PHY to come out of power down mode before334334+ * the next access.335335+ */336336+ udelay(100);337337+331338 if (phydev->drv->phy_id != MARVELL_PHY_ID_88X3310 ||332339 priv->firmware_ver < 0x00030000)333340 return ret;
···42194219 if (vi->has_rss || vi->has_rss_hash_report)42204220 virtnet_init_default_rss(vi);4221422142224222+ _virtnet_set_queues(vi, vi->curr_queue_pairs);42234223+42224224 /* serialize netdev register + virtio_device_ready() with ndo_open() */42234225 rtnl_lock();42244226···42584256 pr_debug("virtio_net: registering cpu notifier failed\n");42594257 goto free_unregister_netdev;42604258 }42614261-42624262- virtnet_set_queues(vi, vi->curr_queue_pairs);4263425942644260 /* Assume link up if device can't report link status,42654261 otherwise get link status from config. */
+107-58
drivers/net/vxlan/vxlan_core.c
···623623 return 1;624624}625625626626+static bool vxlan_parse_gpe_proto(struct vxlanhdr *hdr, __be16 *protocol)627627+{628628+ struct vxlanhdr_gpe *gpe = (struct vxlanhdr_gpe *)hdr;629629+630630+ /* Need to have Next Protocol set for interfaces in GPE mode. */631631+ if (!gpe->np_applied)632632+ return false;633633+ /* "The initial version is 0. If a receiver does not support the634634+ * version indicated it MUST drop the packet.635635+ */636636+ if (gpe->version != 0)637637+ return false;638638+ /* "When the O bit is set to 1, the packet is an OAM packet and OAM639639+ * processing MUST occur." However, we don't implement OAM640640+ * processing, thus drop the packet.641641+ */642642+ if (gpe->oam_flag)643643+ return false;644644+645645+ *protocol = tun_p_to_eth_p(gpe->next_protocol);646646+ if (!*protocol)647647+ return false;648648+649649+ return true;650650+}651651+626652static struct vxlanhdr *vxlan_gro_remcsum(struct sk_buff *skb,627653 unsigned int off,628654 struct vxlanhdr *vh, size_t hdrlen,···675649 return vh;676650}677651678678-static struct sk_buff *vxlan_gro_receive(struct sock *sk,679679- struct list_head *head,680680- struct sk_buff *skb)652652+static struct vxlanhdr *vxlan_gro_prepare_receive(struct sock *sk,653653+ struct list_head *head,654654+ struct sk_buff *skb,655655+ struct gro_remcsum *grc)681656{682682- struct sk_buff *pp = NULL;683657 struct sk_buff *p;684658 struct vxlanhdr *vh, *vh2;685659 unsigned int hlen, off_vx;686686- int flush = 1;687660 struct vxlan_sock *vs = rcu_dereference_sk_user_data(sk);688661 __be32 flags;689689- struct gro_remcsum grc;690662691691- skb_gro_remcsum_init(&grc);663663+ skb_gro_remcsum_init(grc);692664693665 off_vx = skb_gro_offset(skb);694666 hlen = off_vx + sizeof(*vh);695667 vh = skb_gro_header(skb, hlen, off_vx);696668 if (unlikely(!vh))697697- goto out;669669+ return NULL;698670699671 skb_gro_postpull_rcsum(skb, vh, sizeof(struct vxlanhdr));700672···700676701677 if ((flags & VXLAN_HF_RCO) && (vs->flags & VXLAN_F_REMCSUM_RX)) {702678 vh = vxlan_gro_remcsum(skb, off_vx, vh, sizeof(struct vxlanhdr),703703- vh->vx_vni, &grc,679679+ vh->vx_vni, grc,704680 !!(vs->flags &705681 VXLAN_F_REMCSUM_NOPARTIAL));706682707683 if (!vh)708708- goto out;684684+ return NULL;709685 }710686711687 skb_gro_pull(skb, sizeof(struct vxlanhdr)); /* pull vxlan header */···722698 }723699 }724700725725- pp = call_gro_receive(eth_gro_receive, head, skb);726726- flush = 0;701701+ return vh;702702+}727703704704+static struct sk_buff *vxlan_gro_receive(struct sock *sk,705705+ struct list_head *head,706706+ struct sk_buff *skb)707707+{708708+ struct sk_buff *pp = NULL;709709+ struct gro_remcsum grc;710710+ int flush = 1;711711+712712+ if (vxlan_gro_prepare_receive(sk, head, skb, &grc)) {713713+ pp = call_gro_receive(eth_gro_receive, head, skb);714714+ flush = 0;715715+ }716716+ skb_gro_flush_final_remcsum(skb, pp, flush, &grc);717717+ return pp;718718+}719719+720720+static struct sk_buff *vxlan_gpe_gro_receive(struct sock *sk,721721+ struct list_head *head,722722+ struct sk_buff *skb)723723+{724724+ const struct packet_offload *ptype;725725+ struct sk_buff *pp = NULL;726726+ struct gro_remcsum grc;727727+ struct vxlanhdr *vh;728728+ __be16 protocol;729729+ int flush = 1;730730+731731+ vh = vxlan_gro_prepare_receive(sk, head, skb, &grc);732732+ if (vh) {733733+ if (!vxlan_parse_gpe_proto(vh, &protocol))734734+ goto out;735735+ ptype = gro_find_receive_by_type(protocol);736736+ if (!ptype)737737+ goto out;738738+ pp = call_gro_receive(ptype->callbacks.gro_receive, head, skb);739739+ flush = 0;740740+ }728741out:729742 skb_gro_flush_final_remcsum(skb, pp, flush, &grc);730730-731743 return pp;732744}733745···773713 * 'skb->encapsulation' set.774714 */775715 return eth_gro_complete(skb, nhoff + sizeof(struct vxlanhdr));716716+}717717+718718+static int vxlan_gpe_gro_complete(struct sock *sk, struct sk_buff *skb, int nhoff)719719+{720720+ struct vxlanhdr *vh = (struct vxlanhdr *)(skb->data + nhoff);721721+ const struct packet_offload *ptype;722722+ int err = -ENOSYS;723723+ __be16 protocol;724724+725725+ if (!vxlan_parse_gpe_proto(vh, &protocol))726726+ return err;727727+ ptype = gro_find_complete_by_type(protocol);728728+ if (ptype)729729+ err = ptype->callbacks.gro_complete(skb, nhoff + sizeof(struct vxlanhdr));730730+ return err;776731}777732778733static struct vxlan_fdb *vxlan_fdb_alloc(struct vxlan_dev *vxlan, const u8 *mac,···16001525 unparsed->vx_flags &= ~VXLAN_GBP_USED_BITS;16011526}1602152716031603-static bool vxlan_parse_gpe_hdr(struct vxlanhdr *unparsed,16041604- __be16 *protocol,16051605- struct sk_buff *skb, u32 vxflags)16061606-{16071607- struct vxlanhdr_gpe *gpe = (struct vxlanhdr_gpe *)unparsed;16081608-16091609- /* Need to have Next Protocol set for interfaces in GPE mode. */16101610- if (!gpe->np_applied)16111611- return false;16121612- /* "The initial version is 0. If a receiver does not support the16131613- * version indicated it MUST drop the packet.16141614- */16151615- if (gpe->version != 0)16161616- return false;16171617- /* "When the O bit is set to 1, the packet is an OAM packet and OAM16181618- * processing MUST occur." However, we don't implement OAM16191619- * processing, thus drop the packet.16201620- */16211621- if (gpe->oam_flag)16221622- return false;16231623-16241624- *protocol = tun_p_to_eth_p(gpe->next_protocol);16251625- if (!*protocol)16261626- return false;16271627-16281628- unparsed->vx_flags &= ~VXLAN_GPE_USED_BITS;16291629- return true;16301630-}16311631-16321528static bool vxlan_set_mac(struct vxlan_dev *vxlan,16331529 struct vxlan_sock *vs,16341530 struct sk_buff *skb, __be32 vni)···17011655 * used by VXLAN extensions if explicitly requested.17021656 */17031657 if (vs->flags & VXLAN_F_GPE) {17041704- if (!vxlan_parse_gpe_hdr(&unparsed, &protocol, skb, vs->flags))16581658+ if (!vxlan_parse_gpe_proto(&unparsed, &protocol))17051659 goto drop;16601660+ unparsed.vx_flags &= ~VXLAN_GPE_USED_BITS;17061661 raw_proto = true;17071662 }17081663···25632516 }2564251725652518 ndst = &rt->dst;25662566- err = skb_tunnel_check_pmtu(skb, ndst, VXLAN_HEADROOM,25192519+ err = skb_tunnel_check_pmtu(skb, ndst, vxlan_headroom(flags & VXLAN_F_GPE),25672520 netif_is_any_bridge_port(dev));25682521 if (err < 0) {25692522 goto tx_error;···26242577 goto out_unlock;26252578 }2626257926272627- err = skb_tunnel_check_pmtu(skb, ndst, VXLAN6_HEADROOM,25802580+ err = skb_tunnel_check_pmtu(skb, ndst,25812581+ vxlan_headroom((flags & VXLAN_F_GPE) | VXLAN_F_IPV6),26282582 netif_is_any_bridge_port(dev));26292583 if (err < 0) {26302584 goto tx_error;···30813033 struct vxlan_rdst *dst = &vxlan->default_dst;30823034 struct net_device *lowerdev = __dev_get_by_index(vxlan->net,30833035 dst->remote_ifindex);30843084- bool use_ipv6 = !!(vxlan->cfg.flags & VXLAN_F_IPV6);3085303630863037 /* This check is different than dev->max_mtu, because it looks at30873038 * the lowerdev->mtu, rather than the static dev->max_mtu30883039 */30893040 if (lowerdev) {30903090- int max_mtu = lowerdev->mtu -30913091- (use_ipv6 ? VXLAN6_HEADROOM : VXLAN_HEADROOM);30413041+ int max_mtu = lowerdev->mtu - vxlan_headroom(vxlan->cfg.flags);30923042 if (new_mtu > max_mtu)30933043 return -EINVAL;30943044 }···34693423 tunnel_cfg.encap_rcv = vxlan_rcv;34703424 tunnel_cfg.encap_err_lookup = vxlan_err_lookup;34713425 tunnel_cfg.encap_destroy = NULL;34723472- tunnel_cfg.gro_receive = vxlan_gro_receive;34733473- tunnel_cfg.gro_complete = vxlan_gro_complete;34263426+ if (vs->flags & VXLAN_F_GPE) {34273427+ tunnel_cfg.gro_receive = vxlan_gpe_gro_receive;34283428+ tunnel_cfg.gro_complete = vxlan_gpe_gro_complete;34293429+ } else {34303430+ tunnel_cfg.gro_receive = vxlan_gro_receive;34313431+ tunnel_cfg.gro_complete = vxlan_gro_complete;34323432+ }3474343334753434 setup_udp_tunnel_sock(net, sock, &tunnel_cfg);34763435···37393688 struct vxlan_dev *vxlan = netdev_priv(dev);37403689 struct vxlan_rdst *dst = &vxlan->default_dst;37413690 unsigned short needed_headroom = ETH_HLEN;37423742- bool use_ipv6 = !!(conf->flags & VXLAN_F_IPV6);37433691 int max_mtu = ETH_MAX_MTU;36923692+ u32 flags = conf->flags;3744369337453694 if (!changelink) {37463746- if (conf->flags & VXLAN_F_GPE)36953695+ if (flags & VXLAN_F_GPE)37473696 vxlan_raw_setup(dev);37483697 else37493698 vxlan_ether_setup(dev);···3768371737693718 dev->needed_tailroom = lowerdev->needed_tailroom;3770371937713771- max_mtu = lowerdev->mtu - (use_ipv6 ? VXLAN6_HEADROOM :37723772- VXLAN_HEADROOM);37203720+ max_mtu = lowerdev->mtu - vxlan_headroom(flags);37733721 if (max_mtu < ETH_MIN_MTU)37743722 max_mtu = ETH_MIN_MTU;37753723···37793729 if (dev->mtu > max_mtu)37803730 dev->mtu = max_mtu;3781373137823782- if (use_ipv6 || conf->flags & VXLAN_F_COLLECT_METADATA)37833783- needed_headroom += VXLAN6_HEADROOM;37843784- else37853785- needed_headroom += VXLAN_HEADROOM;37323732+ if (flags & VXLAN_F_COLLECT_METADATA)37333733+ flags |= VXLAN_F_IPV6;37343734+ needed_headroom += vxlan_headroom(flags);37863735 dev->needed_headroom = needed_headroom;3787373637883737 memcpy(&vxlan->cfg, conf, sizeof(*conf));
+1-1
drivers/of/Kconfig
···55555656config OF_EARLY_FLATTREE5757 bool5858- select DMA_DECLARE_COHERENT if HAS_DMA5858+ select DMA_DECLARE_COHERENT if HAS_DMA && HAS_IOMEM5959 select OF_FLATTREE60606161config OF_PROMTREE
+1-1
drivers/of/platform.c
···552552 if (!of_get_property(node, "linux,opened", NULL) ||553553 !of_get_property(node, "linux,boot-display", NULL))554554 continue;555555- dev = of_platform_device_create(node, "of-display.0", NULL);555555+ dev = of_platform_device_create(node, "of-display", NULL);556556 of_node_put(node);557557 if (WARN_ON(!dev))558558 return -ENOMEM;
+1-1
drivers/phy/hisilicon/phy-hisi-inno-usb2.c
···184184 phy_set_drvdata(phy, &priv->ports[i]);185185 i++;186186187187- if (i > INNO_PHY_PORT_NUM) {187187+ if (i >= INNO_PHY_PORT_NUM) {188188 dev_warn(dev, "Support %d ports in maximum\n", i);189189 of_node_put(child);190190 break;
+1-1
drivers/phy/mediatek/phy-mtk-dp.c
···169169170170 regs = *(struct regmap **)dev->platform_data;171171 if (!regs)172172- return dev_err_probe(dev, EINVAL,172172+ return dev_err_probe(dev, -EINVAL,173173 "No data passed, requires struct regmap**\n");174174175175 dp_phy = devm_kzalloc(dev, sizeof(*dp_phy), GFP_KERNEL);
+1-1
drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
···253253 for (i = 0; i < ARRAY_SIZE(txpredivs); i++) {254254 ns_hdmipll_ck = 5 * tmds_clk * txposdiv * txpredivs[i];255255 if (ns_hdmipll_ck >= 5 * GIGA &&256256- ns_hdmipll_ck <= 1 * GIGA)256256+ ns_hdmipll_ck <= 12 * GIGA)257257 break;258258 }259259 if (i == (ARRAY_SIZE(txpredivs) - 1) &&
+50-28
drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c
···110110/**111111 * struct qcom_snps_hsphy - snps hs phy attributes112112 *113113+ * @dev: device structure114114+ *113115 * @phy: generic phy114116 * @base: iomapped memory space for snps hs phy115117 *116116- * @cfg_ahb_clk: AHB2PHY interface clock117117- * @ref_clk: phy reference clock118118+ * @num_clks: number of clocks119119+ * @clks: array of clocks118120 * @phy_reset: phy reset control119121 * @vregs: regulator supplies bulk data120122 * @phy_initialized: if PHY has been initialized correctly···124122 * @update_seq_cfg: tuning parameters for phy init125123 */126124struct qcom_snps_hsphy {125125+ struct device *dev;126126+127127 struct phy *phy;128128 void __iomem *base;129129130130- struct clk *cfg_ahb_clk;131131- struct clk *ref_clk;130130+ int num_clks;131131+ struct clk_bulk_data *clks;132132 struct reset_control *phy_reset;133133 struct regulator_bulk_data vregs[SNPS_HS_NUM_VREGS];134134···138134 enum phy_mode mode;139135 struct phy_override_seq update_seq_cfg[NUM_HSPHY_TUNING_PARAMS];140136};137137+138138+static int qcom_snps_hsphy_clk_init(struct qcom_snps_hsphy *hsphy)139139+{140140+ struct device *dev = hsphy->dev;141141+142142+ hsphy->num_clks = 2;143143+ hsphy->clks = devm_kcalloc(dev, hsphy->num_clks, sizeof(*hsphy->clks), GFP_KERNEL);144144+ if (!hsphy->clks)145145+ return -ENOMEM;146146+147147+ /*148148+ * TODO: Currently no device tree instantiation of the PHY is using the clock.149149+ * This needs to be fixed in order for this code to be able to use devm_clk_bulk_get().150150+ */151151+ hsphy->clks[0].id = "cfg_ahb";152152+ hsphy->clks[0].clk = devm_clk_get_optional(dev, "cfg_ahb");153153+ if (IS_ERR(hsphy->clks[0].clk))154154+ return dev_err_probe(dev, PTR_ERR(hsphy->clks[0].clk),155155+ "failed to get cfg_ahb clk\n");156156+157157+ hsphy->clks[1].id = "ref";158158+ hsphy->clks[1].clk = devm_clk_get(dev, "ref");159159+ if (IS_ERR(hsphy->clks[1].clk))160160+ return dev_err_probe(dev, PTR_ERR(hsphy->clks[1].clk),161161+ "failed to get ref clk\n");162162+163163+ return 0;164164+}141165142166static inline void qcom_snps_hsphy_write_mask(void __iomem *base, u32 offset,143167 u32 mask, u32 val)···197165 0, USB2_AUTO_RESUME);198166 }199167200200- clk_disable_unprepare(hsphy->cfg_ahb_clk);201168 return 0;202169}203170204171static int qcom_snps_hsphy_resume(struct qcom_snps_hsphy *hsphy)205172{206206- int ret;207207-208173 dev_dbg(&hsphy->phy->dev, "Resume QCOM SNPS PHY, mode\n");209209-210210- ret = clk_prepare_enable(hsphy->cfg_ahb_clk);211211- if (ret) {212212- dev_err(&hsphy->phy->dev, "failed to enable cfg ahb clock\n");213213- return ret;214214- }215174216175 return 0;217176}···214191 if (!hsphy->phy_initialized)215192 return 0;216193217217- qcom_snps_hsphy_suspend(hsphy);218218- return 0;194194+ return qcom_snps_hsphy_suspend(hsphy);219195}220196221197static int __maybe_unused qcom_snps_hsphy_runtime_resume(struct device *dev)···224202 if (!hsphy->phy_initialized)225203 return 0;226204227227- qcom_snps_hsphy_resume(hsphy);228228- return 0;205205+ return qcom_snps_hsphy_resume(hsphy);229206}230207231208static int qcom_snps_hsphy_set_mode(struct phy *phy, enum phy_mode mode,···395374 if (ret)396375 return ret;397376398398- ret = clk_prepare_enable(hsphy->cfg_ahb_clk);377377+ ret = clk_bulk_prepare_enable(hsphy->num_clks, hsphy->clks);399378 if (ret) {400400- dev_err(&phy->dev, "failed to enable cfg ahb clock, %d\n", ret);379379+ dev_err(&phy->dev, "failed to enable clocks, %d\n", ret);401380 goto poweroff_phy;402381 }403382404383 ret = reset_control_assert(hsphy->phy_reset);405384 if (ret) {406385 dev_err(&phy->dev, "failed to assert phy_reset, %d\n", ret);407407- goto disable_ahb_clk;386386+ goto disable_clks;408387 }409388410389 usleep_range(100, 150);···412391 ret = reset_control_deassert(hsphy->phy_reset);413392 if (ret) {414393 dev_err(&phy->dev, "failed to de-assert phy_reset, %d\n", ret);415415- goto disable_ahb_clk;394394+ goto disable_clks;416395 }417396418397 qcom_snps_hsphy_write_mask(hsphy->base, USB2_PHY_USB_PHY_CFG0,···469448470449 return 0;471450472472-disable_ahb_clk:473473- clk_disable_unprepare(hsphy->cfg_ahb_clk);451451+disable_clks:452452+ clk_bulk_disable_unprepare(hsphy->num_clks, hsphy->clks);474453poweroff_phy:475454 regulator_bulk_disable(ARRAY_SIZE(hsphy->vregs), hsphy->vregs);476455···482461 struct qcom_snps_hsphy *hsphy = phy_get_drvdata(phy);483462484463 reset_control_assert(hsphy->phy_reset);485485- clk_disable_unprepare(hsphy->cfg_ahb_clk);464464+ clk_bulk_disable_unprepare(hsphy->num_clks, hsphy->clks);486465 regulator_bulk_disable(ARRAY_SIZE(hsphy->vregs), hsphy->vregs);487466 hsphy->phy_initialized = false;488467···575554 if (!hsphy)576555 return -ENOMEM;577556557557+ hsphy->dev = dev;558558+578559 hsphy->base = devm_platform_ioremap_resource(pdev, 0);579560 if (IS_ERR(hsphy->base))580561 return PTR_ERR(hsphy->base);581562582582- hsphy->ref_clk = devm_clk_get(dev, "ref");583583- if (IS_ERR(hsphy->ref_clk))584584- return dev_err_probe(dev, PTR_ERR(hsphy->ref_clk),585585- "failed to get ref clk\n");563563+ ret = qcom_snps_hsphy_clk_init(hsphy);564564+ if (ret)565565+ return dev_err_probe(dev, ret, "failed to initialize clocks\n");586566587567 hsphy->phy_reset = devm_reset_control_get_exclusive(&pdev->dev, NULL);588568 if (IS_ERR(hsphy->phy_reset)) {
···150150 DMI_MATCH(DMI_PRODUCT_NAME, "Surface Go"),151151 },152152 },153153+ {154154+ .matches = {155155+ DMI_MATCH(DMI_SYS_VENDOR, "HP"),156156+ DMI_MATCH(DMI_PRODUCT_NAME, "HP Elite Dragonfly G2 Notebook PC"),157157+ },158158+ },153159 { }154160};155161···626620static int intel_hid_probe(struct platform_device *device)627621{628622 acpi_handle handle = ACPI_HANDLE(&device->dev);629629- unsigned long long mode;623623+ unsigned long long mode, dummy;630624 struct intel_hid_priv *priv;631625 acpi_status status;632626 int err;···698692 if (err)699693 goto err_remove_notify;700694701701- if (priv->array) {702702- unsigned long long dummy;695695+ intel_button_array_enable(&device->dev, true);703696704704- intel_button_array_enable(&device->dev, true);705705-706706- /* Call button load method to enable HID power button */707707- if (!intel_hid_evaluate_method(handle, INTEL_HID_DSM_BTNL_FN,708708- &dummy)) {709709- dev_warn(&device->dev,710710- "failed to enable HID power button\n");711711- }712712- }697697+ /*698698+ * Call button load method to enable HID power button699699+ * Always do this since it activates events on some devices without700700+ * a button array too.701701+ */702702+ if (!intel_hid_evaluate_method(handle, INTEL_HID_DSM_BTNL_FN, &dummy))703703+ dev_warn(&device->dev, "failed to enable HID power button\n");713704714705 device_init_wakeup(&device->dev, true);715706 /*
+4-4
drivers/platform/x86/msi-laptop.c
···208208 return -EINVAL;209209210210 if (quirks->ec_read_only)211211- return -EOPNOTSUPP;211211+ return 0;212212213213 /* read current device state */214214 result = ec_read(MSI_STANDARD_EC_COMMAND_ADDRESS, &rdata);···838838static void msi_init_rfkill(struct work_struct *ignored)839839{840840 if (rfk_wlan) {841841- rfkill_set_sw_state(rfk_wlan, !wlan_s);841841+ msi_rfkill_set_state(rfk_wlan, !wlan_s);842842 rfkill_wlan_set(NULL, !wlan_s);843843 }844844 if (rfk_bluetooth) {845845- rfkill_set_sw_state(rfk_bluetooth, !bluetooth_s);845845+ msi_rfkill_set_state(rfk_bluetooth, !bluetooth_s);846846 rfkill_bluetooth_set(NULL, !bluetooth_s);847847 }848848 if (rfk_threeg) {849849- rfkill_set_sw_state(rfk_threeg, !threeg_s);849849+ msi_rfkill_set_state(rfk_threeg, !threeg_s);850850 rfkill_threeg_set(NULL, !threeg_s);851851 }852852}
···11011101 struct ica_xcRB *xcrb,11021102 struct ap_message *ap_msg)11031103{11041104- int rc;11051104 struct response_type *rtype = ap_msg->private;11061105 struct {11071106 struct type6_hdr hdr;11081107 struct CPRBX cprbx;11091108 /* ... more data blocks ... */11101109 } __packed * msg = ap_msg->msg;11101110+ unsigned int max_payload_size;11111111+ int rc, delta;1111111211121112- /*11131113- * Set the queue's reply buffer length minus 128 byte padding11141114- * as reply limit for the card firmware.11151115- */11161116- msg->hdr.fromcardlen1 = min_t(unsigned int, msg->hdr.fromcardlen1,11171117- zq->reply.bufsize - 128);11181118- if (msg->hdr.fromcardlen2)11191119- msg->hdr.fromcardlen2 =11201120- zq->reply.bufsize - msg->hdr.fromcardlen1 - 128;11131113+ /* calculate maximum payload for this card and msg type */11141114+ max_payload_size = zq->reply.bufsize - sizeof(struct type86_fmt2_msg);11151115+11161116+ /* limit each of the two from fields to the maximum payload size */11171117+ msg->hdr.fromcardlen1 = min(msg->hdr.fromcardlen1, max_payload_size);11181118+ msg->hdr.fromcardlen2 = min(msg->hdr.fromcardlen2, max_payload_size);11191119+11201120+ /* calculate delta if the sum of both exceeds max payload size */11211121+ delta = msg->hdr.fromcardlen1 + msg->hdr.fromcardlen211221122+ - max_payload_size;11231123+ if (delta > 0) {11241124+ /*11251125+ * Sum exceeds maximum payload size, prune fromcardlen111261126+ * (always trust fromcardlen2)11271127+ */11281128+ if (delta > msg->hdr.fromcardlen1) {11291129+ rc = -EINVAL;11301130+ goto out;11311131+ }11321132+ msg->hdr.fromcardlen1 -= delta;11331133+ }1121113411221135 init_completion(&rtype->work);11231136 rc = ap_queue_message(zq->queue, ap_msg);
+4-3
drivers/scsi/sg.c
···14971497 int error;14981498 unsigned long iflags;1499149915001500- error = blk_get_queue(scsidp->request_queue);15011501- if (error)15021502- return error;15001500+ if (!blk_get_queue(scsidp->request_queue)) {15011501+ pr_warn("%s: get scsi_device queue failed\n", __func__);15021502+ return -ENODEV;15031503+ }1503150415041505 error = -ENOMEM;15051506 cdev = cdev_alloc();
+2-2
drivers/soundwire/amd_manager.c
···910910 return -ENOMEM;911911912912 amd_manager->acp_mmio = devm_ioremap(dev, res->start, resource_size(res));913913- if (IS_ERR(amd_manager->mmio)) {913913+ if (!amd_manager->acp_mmio) {914914 dev_err(dev, "mmio not found\n");915915- return PTR_ERR(amd_manager->mmio);915915+ return -ENOMEM;916916 }917917 amd_manager->instance = pdata->instance;918918 amd_manager->mmio = amd_manager->acp_mmio +
+4-4
drivers/soundwire/bus.c
···922922 "initializing enumeration and init completion for Slave %d\n",923923 slave->dev_num);924924925925- init_completion(&slave->enumeration_complete);926926- init_completion(&slave->initialization_complete);925925+ reinit_completion(&slave->enumeration_complete);926926+ reinit_completion(&slave->initialization_complete);927927928928 } else if ((status == SDW_SLAVE_ATTACHED) &&929929 (slave->status == SDW_SLAVE_UNATTACHED)) {···931931 "signaling enumeration completion for Slave %d\n",932932 slave->dev_num);933933934934- complete(&slave->enumeration_complete);934934+ complete_all(&slave->enumeration_complete);935935 }936936 slave->status = status;937937 mutex_unlock(&bus->bus_lock);···19511951 "signaling initialization completion for Slave %d\n",19521952 slave->dev_num);1953195319541954- complete(&slave->initialization_complete);19541954+ complete_all(&slave->initialization_complete);1955195519561956 /*19571957 * If the manager became pm_runtime active, the peripherals will be
+1-1
drivers/soundwire/qcom.c
···540540 status = (val >> (dev_num * SWRM_MCP_SLV_STATUS_SZ));541541542542 if ((status & SWRM_MCP_SLV_STATUS_MASK) == SDW_SLAVE_ALERT) {543543- ctrl->status[dev_num] = status;543543+ ctrl->status[dev_num] = status & SWRM_MCP_SLV_STATUS_MASK;544544 return dev_num;545545 }546546 }
+1
drivers/staging/media/atomisp/Kconfig
···1313 tristate "Intel Atom Image Signal Processor Driver"1414 depends on VIDEO_DEV && INTEL_ATOMISP1515 depends on PMIC_OPREGION1616+ select V4L2_FWNODE1617 select IOSF_MBI1718 select VIDEOBUF2_VMALLOC1819 select VIDEO_V4L2_SUBDEV_API
+6-6
drivers/video/console/sticon.c
···156156 return false;157157}158158159159-static int sticon_set_def_font(int unit, struct console_font *op)159159+static void sticon_set_def_font(int unit)160160{161161 if (font_data[unit] != STI_DEF_FONT) {162162 if (--FNTREFCOUNT(font_data[unit]) == 0) {···165165 }166166 font_data[unit] = STI_DEF_FONT;167167 }168168-169169- return 0;170168}171169172170static int sticon_set_font(struct vc_data *vc, struct console_font *op,···244246 vc->vc_video_erase_char, font_data[vc->vc_num]);245247246248 /* delete old font in case it is a user font */247247- sticon_set_def_font(unit, NULL);249249+ sticon_set_def_font(unit);248250249251 FNTREFCOUNT(cooked_font)++;250252 font_data[unit] = cooked_font;···262264263265static int sticon_font_default(struct vc_data *vc, struct console_font *op, char *name)264266{265265- return sticon_set_def_font(vc->vc_num, op);267267+ sticon_set_def_font(vc->vc_num);268268+269269+ return 0;266270}267271268272static int sticon_font_set(struct vc_data *vc, struct console_font *font,···297297298298 /* free memory used by user font */299299 for (i = 0; i < MAX_NR_CONSOLES; i++)300300- sticon_set_def_font(i, NULL);300300+ sticon_set_def_font(i);301301}302302303303static void sticon_clear(struct vc_data *conp, int sy, int sx, int height,
+28-46
drivers/video/console/vgacon.c
···6565 * Interface used by the world6666 */67676868-static const char *vgacon_startup(void);6969-static void vgacon_init(struct vc_data *c, int init);7070-static void vgacon_deinit(struct vc_data *c);7171-static void vgacon_cursor(struct vc_data *c, int mode);7272-static int vgacon_switch(struct vc_data *c);7373-static int vgacon_blank(struct vc_data *c, int blank, int mode_switch);7474-static void vgacon_scrolldelta(struct vc_data *c, int lines);7568static int vgacon_set_origin(struct vc_data *c);7676-static void vgacon_save_screen(struct vc_data *c);7777-static void vgacon_invert_region(struct vc_data *c, u16 * p, int count);6969+7870static struct uni_pagedict *vgacon_uni_pagedir;7971static int vgacon_refcount;8072···134142 write_vga(12, (c->vc_visible_origin - vga_vram_base) / 2);135143}136144137137-static void vgacon_restore_screen(struct vc_data *c)138138-{139139- if (c->vc_origin != c->vc_visible_origin)140140- vgacon_scrolldelta(c, 0);141141-}142142-143145static void vgacon_scrolldelta(struct vc_data *c, int lines)144146{145147 vc_scrolldelta_helper(c, lines, vga_rolled_over, (void *)vga_vram_base,146148 vga_vram_size);147149 vga_set_mem_top(c);150150+}151151+152152+static void vgacon_restore_screen(struct vc_data *c)153153+{154154+ if (c->vc_origin != c->vc_visible_origin)155155+ vgacon_scrolldelta(c, 0);148156}149157150158static const char *vgacon_startup(void)···437445 }438446}439447440440-static void vgacon_set_cursor_size(int xpos, int from, int to)448448+static void vgacon_set_cursor_size(int from, int to)441449{442450 unsigned long flags;443451 int curs, cure;···470478471479static void vgacon_cursor(struct vc_data *c, int mode)472480{481481+ unsigned int c_height;482482+473483 if (c->vc_mode != KD_TEXT)474484 return;475485476486 vgacon_restore_screen(c);477487488488+ c_height = c->vc_cell_height;489489+478490 switch (mode) {479491 case CM_ERASE:480492 write_vga(14, (c->vc_pos - vga_vram_base) / 2);481493 if (vga_video_type >= VIDEO_TYPE_VGAC)482482- vgacon_set_cursor_size(c->state.x, 31, 30);494494+ vgacon_set_cursor_size(31, 30);483495 else484484- vgacon_set_cursor_size(c->state.x, 31, 31);496496+ vgacon_set_cursor_size(31, 31);485497 break;486498487499 case CM_MOVE:···493497 write_vga(14, (c->vc_pos - vga_vram_base) / 2);494498 switch (CUR_SIZE(c->vc_cursor_type)) {495499 case CUR_UNDERLINE:496496- vgacon_set_cursor_size(c->state.x,497497- c->vc_cell_height -498498- (c->vc_cell_height <499499- 10 ? 2 : 3),500500- c->vc_cell_height -501501- (c->vc_cell_height <502502- 10 ? 1 : 2));500500+ vgacon_set_cursor_size(c_height -501501+ (c_height < 10 ? 2 : 3),502502+ c_height -503503+ (c_height < 10 ? 1 : 2));503504 break;504505 case CUR_TWO_THIRDS:505505- vgacon_set_cursor_size(c->state.x,506506- c->vc_cell_height / 3,507507- c->vc_cell_height -508508- (c->vc_cell_height <509509- 10 ? 1 : 2));506506+ vgacon_set_cursor_size(c_height / 3, c_height -507507+ (c_height < 10 ? 1 : 2));510508 break;511509 case CUR_LOWER_THIRD:512512- vgacon_set_cursor_size(c->state.x,513513- (c->vc_cell_height * 2) / 3,514514- c->vc_cell_height -515515- (c->vc_cell_height <516516- 10 ? 1 : 2));510510+ vgacon_set_cursor_size(c_height * 2 / 3, c_height -511511+ (c_height < 10 ? 1 : 2));517512 break;518513 case CUR_LOWER_HALF:519519- vgacon_set_cursor_size(c->state.x,520520- c->vc_cell_height / 2,521521- c->vc_cell_height -522522- (c->vc_cell_height <523523- 10 ? 1 : 2));514514+ vgacon_set_cursor_size(c_height / 2, c_height -515515+ (c_height < 10 ? 1 : 2));524516 break;525517 case CUR_NONE:526518 if (vga_video_type >= VIDEO_TYPE_VGAC)527527- vgacon_set_cursor_size(c->state.x, 31, 30);519519+ vgacon_set_cursor_size(31, 30);528520 else529529- vgacon_set_cursor_size(c->state.x, 31, 31);521521+ vgacon_set_cursor_size(31, 31);530522 break;531523 default:532532- vgacon_set_cursor_size(c->state.x, 1,533533- c->vc_cell_height);524524+ vgacon_set_cursor_size(1, c_height);534525 break;535526 }536527 break;537528 }538529}539530540540-static int vgacon_doresize(struct vc_data *c,531531+static void vgacon_doresize(struct vc_data *c,541532 unsigned int width, unsigned int height)542533{543534 unsigned long flags;···583600 }584601585602 raw_spin_unlock_irqrestore(&vga_lock, flags);586586- return 0;587603}588604589605static int vgacon_switch(struct vc_data *c)
+3
drivers/video/fbdev/au1200fb.c
···1732173217331733 /* Now hook interrupt too */17341734 irq = platform_get_irq(dev, 0);17351735+ if (irq < 0)17361736+ return irq;17371737+17351738 ret = request_irq(irq, au1200fb_handle_irq,17361739 IRQF_SHARED, "lcd", (void *)dev);17371740 if (ret) {
···16121612 }16131613}1614161416151615-static void fbcon_redraw(struct vc_data *vc, struct fbcon_display *p,16161616- int line, int count, int offset)16151615+static void fbcon_redraw(struct vc_data *vc, int line, int count, int offset)16171616{16181617 unsigned short *d = (unsigned short *)16191618 (vc->vc_origin + vc->vc_size_row * line);···1826182718271828 case SCROLL_REDRAW:18281829 redraw_up:18291829- fbcon_redraw(vc, p, t, b - t - count,18301830+ fbcon_redraw(vc, t, b - t - count,18301831 count * vc->vc_cols);18311832 fbcon_clear(vc, b - count, 0, count, vc->vc_cols);18321833 scr_memsetw((unsigned short *) (vc->vc_origin +···1912191319131914 case SCROLL_REDRAW:19141915 redraw_down:19151915- fbcon_redraw(vc, p, b - 1, b - t - count,19161916+ fbcon_redraw(vc, b - 1, b - t - count,19161917 -count * vc->vc_cols);19171918 fbcon_clear(vc, t, 0, count, vc->vc_cols);19181919 scr_memsetw((unsigned short *) (vc->vc_origin +
+3-1
drivers/video/fbdev/ep93xx-fb.c
···548548 }549549550550 ep93xxfb_set_par(info);551551- clk_prepare_enable(fbi->clk);551551+ err = clk_prepare_enable(fbi->clk);552552+ if (err)553553+ goto failed_check;552554553555 err = register_framebuffer(info);554556 if (err)
···349349 }350350 read_unlock(&fs_info->global_root_lock);351351352352+ if (btrfs_fs_compat_ro(fs_info, BLOCK_GROUP_TREE)) {353353+ num_bytes += btrfs_root_used(&fs_info->block_group_root->root_item);354354+ min_items++;355355+ }356356+352357 /*353358 * But we also want to reserve enough space so we can do the fallback354359 * global reserve for an unlink, which is an additional
+6-1
fs/btrfs/disk-io.c
···34383438 * For devices supporting discard turn on discard=async automatically,34393439 * unless it's already set or disabled. This could be turned off by34403440 * nodiscard for the same mount.34413441+ *34423442+ * The zoned mode piggy backs on the discard functionality for34433443+ * resetting a zone. There is no reason to delay the zone reset as it is34443444+ * fast enough. So, do not enable async discard for zoned mode.34413445 */34423446 if (!(btrfs_test_opt(fs_info, DISCARD_SYNC) ||34433447 btrfs_test_opt(fs_info, DISCARD_ASYNC) ||34443448 btrfs_test_opt(fs_info, NODISCARD)) &&34453445- fs_info->fs_devices->discardable) {34493449+ fs_info->fs_devices->discardable &&34503450+ !btrfs_is_zoned(fs_info)) {34463451 btrfs_set_and_info(fs_info, DISCARD_ASYNC,34473452 "auto enabling async discard");34483453 }
+17-7
fs/btrfs/free-space-tree.c
···15151515 if (prev_bit == 0 && bit == 1) {15161516 extent_start = offset;15171517 } else if (prev_bit == 1 && bit == 0) {15181518- total_found += add_new_free_space(block_group,15191519- extent_start,15201520- offset);15181518+ u64 space_added;15191519+15201520+ ret = add_new_free_space(block_group, extent_start,15211521+ offset, &space_added);15221522+ if (ret)15231523+ goto out;15241524+ total_found += space_added;15211525 if (total_found > CACHING_CTL_WAKE_UP) {15221526 total_found = 0;15231527 wake_up(&caching_ctl->wait);···15331529 }15341530 }15351531 if (prev_bit == 1) {15361536- total_found += add_new_free_space(block_group, extent_start,15371537- end);15321532+ ret = add_new_free_space(block_group, extent_start, end, NULL);15331533+ if (ret)15341534+ goto out;15381535 extent_count++;15391536 }15401537···15741569 end = block_group->start + block_group->length;1575157015761571 while (1) {15721572+ u64 space_added;15731573+15771574 ret = btrfs_next_item(root, path);15781575 if (ret < 0)15791576 goto out;···15901583 ASSERT(key.type == BTRFS_FREE_SPACE_EXTENT_KEY);15911584 ASSERT(key.objectid < end && key.objectid + key.offset <= end);1592158515931593- total_found += add_new_free_space(block_group, key.objectid,15941594- key.objectid + key.offset);15861586+ ret = add_new_free_space(block_group, key.objectid,15871587+ key.objectid + key.offset, &space_added);15881588+ if (ret)15891589+ goto out;15901590+ total_found += space_added;15951591 if (total_found > CACHING_CTL_WAKE_UP) {15961592 total_found = 0;15971593 wake_up(&caching_ctl->wait);
+8-2
fs/btrfs/transaction.c
···826826827827 trans = start_transaction(root, 0, TRANS_ATTACH,828828 BTRFS_RESERVE_NO_FLUSH, true);829829- if (trans == ERR_PTR(-ENOENT))830830- btrfs_wait_for_commit(root->fs_info, 0);829829+ if (trans == ERR_PTR(-ENOENT)) {830830+ int ret;831831+832832+ ret = btrfs_wait_for_commit(root->fs_info, 0);833833+ if (ret)834834+ return ERR_PTR(ret);835835+ }831836832837 return trans;833838}···936931 }937932938933 wait_for_commit(cur_trans, TRANS_STATE_COMPLETED);934934+ ret = cur_trans->aborted;939935 btrfs_put_transaction(cur_trans);940936out:941937 return ret;
+3
fs/btrfs/zoned.c
···805805 return -EINVAL;806806 }807807808808+ btrfs_clear_and_info(info, DISCARD_ASYNC,809809+ "zoned: async discard ignored and disabled for zoned mode");810810+808811 return 0;809812}810813
+143-35
fs/ext4/mballoc.c
···10061006 * fls() instead since we need to know the actual length while modifying10071007 * goal length.10081008 */10091009- order = fls(ac->ac_g_ex.fe_len);10091009+ order = fls(ac->ac_g_ex.fe_len) - 1;10101010 min_order = order - sbi->s_mb_best_avail_max_trim_order;10111011 if (min_order < 0)10121012 min_order = 0;10131013-10141014- if (1 << min_order < ac->ac_o_ex.fe_len)10151015- min_order = fls(ac->ac_o_ex.fe_len) + 1;1016101310171014 if (sbi->s_stripe > 0) {10181015 /*···10181021 */10191022 num_stripe_clusters = EXT4_NUM_B2C(sbi, sbi->s_stripe);10201023 if (1 << min_order < num_stripe_clusters)10211021- min_order = fls(num_stripe_clusters);10241024+ /*10251025+ * We consider 1 order less because later we round10261026+ * up the goal len to num_stripe_clusters10271027+ */10281028+ min_order = fls(num_stripe_clusters) - 1;10221029 }10301030+10311031+ if (1 << min_order < ac->ac_o_ex.fe_len)10321032+ min_order = fls(ac->ac_o_ex.fe_len);1023103310241034 for (i = order; i >= min_order; i--) {10251035 int frag_order;···47654761 int order, i;47664762 struct ext4_inode_info *ei = EXT4_I(ac->ac_inode);47674763 struct ext4_locality_group *lg;47684768- struct ext4_prealloc_space *tmp_pa, *cpa = NULL;47694769- ext4_lblk_t tmp_pa_start, tmp_pa_end;47644764+ struct ext4_prealloc_space *tmp_pa = NULL, *cpa = NULL;47654765+ loff_t tmp_pa_end;47704766 struct rb_node *iter;47714767 ext4_fsblk_t goal_block;47724768···47744770 if (!(ac->ac_flags & EXT4_MB_HINT_DATA))47754771 return false;4776477247774777- /* first, try per-file preallocation */47734773+ /*47744774+ * first, try per-file preallocation by searching the inode pa rbtree.47754775+ *47764776+ * Here, we can't do a direct traversal of the tree because47774777+ * ext4_mb_discard_group_preallocation() can paralelly mark the pa47784778+ * deleted and that can cause direct traversal to skip some entries.47794779+ */47784780 read_lock(&ei->i_prealloc_lock);47814781+47824782+ if (RB_EMPTY_ROOT(&ei->i_prealloc_node)) {47834783+ goto try_group_pa;47844784+ }47854785+47864786+ /*47874787+ * Step 1: Find a pa with logical start immediately adjacent to the47884788+ * original logical start. This could be on the left or right.47894789+ *47904790+ * (tmp_pa->pa_lstart never changes so we can skip locking for it).47914791+ */47794792 for (iter = ei->i_prealloc_node.rb_node; iter;47804793 iter = ext4_mb_pa_rb_next_iter(ac->ac_o_ex.fe_logical,47814781- tmp_pa_start, iter)) {47944794+ tmp_pa->pa_lstart, iter)) {47824795 tmp_pa = rb_entry(iter, struct ext4_prealloc_space,47834796 pa_node.inode_node);47974797+ }4784479847854785- /* all fields in this condition don't change,47864786- * so we can skip locking for them */47874787- tmp_pa_start = tmp_pa->pa_lstart;47884788- tmp_pa_end = tmp_pa->pa_lstart + EXT4_C2B(sbi, tmp_pa->pa_len);47994799+ /*48004800+ * Step 2: The adjacent pa might be to the right of logical start, find48014801+ * the left adjacent pa. After this step we'd have a valid tmp_pa whose48024802+ * logical start is towards the left of original request's logical start48034803+ */48044804+ if (tmp_pa->pa_lstart > ac->ac_o_ex.fe_logical) {48054805+ struct rb_node *tmp;48064806+ tmp = rb_prev(&tmp_pa->pa_node.inode_node);4789480747904790- /* original request start doesn't lie in this PA */47914791- if (ac->ac_o_ex.fe_logical < tmp_pa_start ||47924792- ac->ac_o_ex.fe_logical >= tmp_pa_end)47934793- continue;47944794-47954795- /* non-extent files can't have physical blocks past 2^32 */47964796- if (!(ext4_test_inode_flag(ac->ac_inode, EXT4_INODE_EXTENTS)) &&47974797- (tmp_pa->pa_pstart + EXT4_C2B(sbi, tmp_pa->pa_len) >47984798- EXT4_MAX_BLOCK_FILE_PHYS)) {48084808+ if (tmp) {48094809+ tmp_pa = rb_entry(tmp, struct ext4_prealloc_space,48104810+ pa_node.inode_node);48114811+ } else {47994812 /*48004800- * Since PAs don't overlap, we won't find any48014801- * other PA to satisfy this.48134813+ * If there is no adjacent pa to the left then finding48144814+ * an overlapping pa is not possible hence stop searching48154815+ * inode pa tree48164816+ */48174817+ goto try_group_pa;48184818+ }48194819+ }48204820+48214821+ BUG_ON(!(tmp_pa && tmp_pa->pa_lstart <= ac->ac_o_ex.fe_logical));48224822+48234823+ /*48244824+ * Step 3: If the left adjacent pa is deleted, keep moving left to find48254825+ * the first non deleted adjacent pa. After this step we should have a48264826+ * valid tmp_pa which is guaranteed to be non deleted.48274827+ */48284828+ for (iter = &tmp_pa->pa_node.inode_node;; iter = rb_prev(iter)) {48294829+ if (!iter) {48304830+ /*48314831+ * no non deleted left adjacent pa, so stop searching48324832+ * inode pa tree48334833+ */48344834+ goto try_group_pa;48354835+ }48364836+ tmp_pa = rb_entry(iter, struct ext4_prealloc_space,48374837+ pa_node.inode_node);48384838+ spin_lock(&tmp_pa->pa_lock);48394839+ if (tmp_pa->pa_deleted == 0) {48404840+ /*48414841+ * We will keep holding the pa_lock from48424842+ * this point on because we don't want group discard48434843+ * to delete this pa underneath us. Since group48444844+ * discard is anyways an ENOSPC operation it48454845+ * should be okay for it to wait a few more cycles.48024846 */48034847 break;48044804- }48054805-48064806- /* found preallocated blocks, use them */48074807- spin_lock(&tmp_pa->pa_lock);48084808- if (tmp_pa->pa_deleted == 0 && tmp_pa->pa_free &&48094809- likely(ext4_mb_pa_goal_check(ac, tmp_pa))) {48104810- atomic_inc(&tmp_pa->pa_count);48114811- ext4_mb_use_inode_pa(ac, tmp_pa);48484848+ } else {48124849 spin_unlock(&tmp_pa->pa_lock);48134813- read_unlock(&ei->i_prealloc_lock);48144814- return true;48154850 }48164816- spin_unlock(&tmp_pa->pa_lock);48174851 }48524852+48534853+ BUG_ON(!(tmp_pa && tmp_pa->pa_lstart <= ac->ac_o_ex.fe_logical));48544854+ BUG_ON(tmp_pa->pa_deleted == 1);48554855+48564856+ /*48574857+ * Step 4: We now have the non deleted left adjacent pa. Only this48584858+ * pa can possibly satisfy the request hence check if it overlaps48594859+ * original logical start and stop searching if it doesn't.48604860+ */48614861+ tmp_pa_end = (loff_t)tmp_pa->pa_lstart + EXT4_C2B(sbi, tmp_pa->pa_len);48624862+48634863+ if (ac->ac_o_ex.fe_logical >= tmp_pa_end) {48644864+ spin_unlock(&tmp_pa->pa_lock);48654865+ goto try_group_pa;48664866+ }48674867+48684868+ /* non-extent files can't have physical blocks past 2^32 */48694869+ if (!(ext4_test_inode_flag(ac->ac_inode, EXT4_INODE_EXTENTS)) &&48704870+ (tmp_pa->pa_pstart + EXT4_C2B(sbi, tmp_pa->pa_len) >48714871+ EXT4_MAX_BLOCK_FILE_PHYS)) {48724872+ /*48734873+ * Since PAs don't overlap, we won't find any other PA to48744874+ * satisfy this.48754875+ */48764876+ spin_unlock(&tmp_pa->pa_lock);48774877+ goto try_group_pa;48784878+ }48794879+48804880+ if (tmp_pa->pa_free && likely(ext4_mb_pa_goal_check(ac, tmp_pa))) {48814881+ atomic_inc(&tmp_pa->pa_count);48824882+ ext4_mb_use_inode_pa(ac, tmp_pa);48834883+ spin_unlock(&tmp_pa->pa_lock);48844884+ read_unlock(&ei->i_prealloc_lock);48854885+ return true;48864886+ } else {48874887+ /*48884888+ * We found a valid overlapping pa but couldn't use it because48894889+ * it had no free blocks. This should ideally never happen48904890+ * because:48914891+ *48924892+ * 1. When a new inode pa is added to rbtree it must have48934893+ * pa_free > 0 since otherwise we won't actually need48944894+ * preallocation.48954895+ *48964896+ * 2. An inode pa that is in the rbtree can only have it's48974897+ * pa_free become zero when another thread calls:48984898+ * ext4_mb_new_blocks48994899+ * ext4_mb_use_preallocated49004900+ * ext4_mb_use_inode_pa49014901+ *49024902+ * 3. Further, after the above calls make pa_free == 0, we will49034903+ * immediately remove it from the rbtree in:49044904+ * ext4_mb_new_blocks49054905+ * ext4_mb_release_context49064906+ * ext4_mb_put_pa49074907+ *49084908+ * 4. Since the pa_free becoming 0 and pa_free getting removed49094909+ * from tree both happen in ext4_mb_new_blocks, which is always49104910+ * called with i_data_sem held for data allocations, we can be49114911+ * sure that another process will never see a pa in rbtree with49124912+ * pa_free == 0.49134913+ */49144914+ WARN_ON_ONCE(tmp_pa->pa_free == 0);49154915+ }49164916+ spin_unlock(&tmp_pa->pa_lock);49174917+try_group_pa:48184918 read_unlock(&ei->i_prealloc_lock);4819491948204920 /* can we use group allocation? */
+14
fs/ext4/xattr.c
···17821782 memmove(here, (void *)here + size,17831783 (void *)last - (void *)here + sizeof(__u32));17841784 memset(last, 0, size);17851785+17861786+ /*17871787+ * Update i_inline_off - moved ibody region might contain17881788+ * system.data attribute. Handling a failure here won't17891789+ * cause other complications for setting an xattr.17901790+ */17911791+ if (!is_block && ext4_has_inline_data(inode)) {17921792+ ret = ext4_find_inline_data_nolock(inode);17931793+ if (ret) {17941794+ ext4_warning_inode(inode,17951795+ "unable to update i_inline_off");17961796+ goto out;17971797+ }17981798+ }17851799 } else if (s->not_found) {17861800 /* Insert new name. */17871801 size_t size = EXT4_XATTR_LEN(name_len);
+2-4
fs/file.c
···10421042 struct file *file = (struct file *)(v & ~3);1043104310441044 if (file && (file->f_mode & FMODE_ATOMIC_POS)) {10451045- if (file_count(file) > 1) {10461046- v |= FDPUT_POS_UNLOCK;10471047- mutex_lock(&file->f_pos_lock);10481048- }10451045+ v |= FDPUT_POS_UNLOCK;10461046+ mutex_lock(&file->f_pos_lock);10491047 }10501048 return v;10511049}
+100-189
fs/jbd2/checkpoint.c
···2727 *2828 * Called with j_list_lock held.2929 */3030-static inline void __buffer_unlink_first(struct journal_head *jh)3030+static inline void __buffer_unlink(struct journal_head *jh)3131{3232 transaction_t *transaction = jh->b_cp_transaction;3333···3838 if (transaction->t_checkpoint_list == jh)3939 transaction->t_checkpoint_list = NULL;4040 }4141-}4242-4343-/*4444- * Unlink a buffer from a transaction checkpoint(io) list.4545- *4646- * Called with j_list_lock held.4747- */4848-static inline void __buffer_unlink(struct journal_head *jh)4949-{5050- transaction_t *transaction = jh->b_cp_transaction;5151-5252- __buffer_unlink_first(jh);5353- if (transaction->t_checkpoint_io_list == jh) {5454- transaction->t_checkpoint_io_list = jh->b_cpnext;5555- if (transaction->t_checkpoint_io_list == jh)5656- transaction->t_checkpoint_io_list = NULL;5757- }5858-}5959-6060-/*6161- * Move a buffer from the checkpoint list to the checkpoint io list6262- *6363- * Called with j_list_lock held6464- */6565-static inline void __buffer_relink_io(struct journal_head *jh)6666-{6767- transaction_t *transaction = jh->b_cp_transaction;6868-6969- __buffer_unlink_first(jh);7070-7171- if (!transaction->t_checkpoint_io_list) {7272- jh->b_cpnext = jh->b_cpprev = jh;7373- } else {7474- jh->b_cpnext = transaction->t_checkpoint_io_list;7575- jh->b_cpprev = transaction->t_checkpoint_io_list->b_cpprev;7676- jh->b_cpprev->b_cpnext = jh;7777- jh->b_cpnext->b_cpprev = jh;7878- }7979- transaction->t_checkpoint_io_list = jh;8041}81428243/*···144183 struct buffer_head *bh = journal->j_chkpt_bhs[i];145184 BUFFER_TRACE(bh, "brelse");146185 __brelse(bh);186186+ journal->j_chkpt_bhs[i] = NULL;147187 }148188 *batch_count = 0;149189}···204242 jh = transaction->t_checkpoint_list;205243 bh = jh2bh(jh);206244207207- if (buffer_locked(bh)) {208208- get_bh(bh);209209- spin_unlock(&journal->j_list_lock);210210- wait_on_buffer(bh);211211- /* the journal_head may have gone by now */212212- BUFFER_TRACE(bh, "brelse");213213- __brelse(bh);214214- goto retry;215215- }216245 if (jh->b_transaction != NULL) {217246 transaction_t *t = jh->b_transaction;218247 tid_t tid = t->t_tid;···238285 spin_lock(&journal->j_list_lock);239286 goto restart;240287 }241241- if (!buffer_dirty(bh)) {288288+ if (!trylock_buffer(bh)) {289289+ /*290290+ * The buffer is locked, it may be writing back, or291291+ * flushing out in the last couple of cycles, or292292+ * re-adding into a new transaction, need to check293293+ * it again until it's unlocked.294294+ */295295+ get_bh(bh);296296+ spin_unlock(&journal->j_list_lock);297297+ wait_on_buffer(bh);298298+ /* the journal_head may have gone by now */299299+ BUFFER_TRACE(bh, "brelse");300300+ __brelse(bh);301301+ goto retry;302302+ } else if (!buffer_dirty(bh)) {303303+ unlock_buffer(bh);242304 BUFFER_TRACE(bh, "remove from checkpoint");243243- if (__jbd2_journal_remove_checkpoint(jh))244244- /* The transaction was released; we're done */305305+ /*306306+ * If the transaction was released or the checkpoint307307+ * list was empty, we're done.308308+ */309309+ if (__jbd2_journal_remove_checkpoint(jh) ||310310+ !transaction->t_checkpoint_list)245311 goto out;246246- continue;312312+ } else {313313+ unlock_buffer(bh);314314+ /*315315+ * We are about to write the buffer, it could be316316+ * raced by some other transaction shrink or buffer317317+ * re-log logic once we release the j_list_lock,318318+ * leave it on the checkpoint list and check status319319+ * again to make sure it's clean.320320+ */321321+ BUFFER_TRACE(bh, "queue");322322+ get_bh(bh);323323+ J_ASSERT_BH(bh, !buffer_jwrite(bh));324324+ journal->j_chkpt_bhs[batch_count++] = bh;325325+ transaction->t_chp_stats.cs_written++;326326+ transaction->t_checkpoint_list = jh->b_cpnext;247327 }248248- /*249249- * Important: we are about to write the buffer, and250250- * possibly block, while still holding the journal251251- * lock. We cannot afford to let the transaction252252- * logic start messing around with this buffer before253253- * we write it to disk, as that would break254254- * recoverability.255255- */256256- BUFFER_TRACE(bh, "queue");257257- get_bh(bh);258258- J_ASSERT_BH(bh, !buffer_jwrite(bh));259259- journal->j_chkpt_bhs[batch_count++] = bh;260260- __buffer_relink_io(jh);261261- transaction->t_chp_stats.cs_written++;328328+262329 if ((batch_count == JBD2_NR_BATCH) ||263263- need_resched() ||264264- spin_needbreak(&journal->j_list_lock))330330+ need_resched() || spin_needbreak(&journal->j_list_lock) ||331331+ jh2bh(transaction->t_checkpoint_list) == journal->j_chkpt_bhs[0])265332 goto unlock_and_flush;266333 }267334···295322 goto restart;296323 }297324298298- /*299299- * Now we issued all of the transaction's buffers, let's deal300300- * with the buffers that are out for I/O.301301- */302302-restart2:303303- /* Did somebody clean up the transaction in the meanwhile? */304304- if (journal->j_checkpoint_transactions != transaction ||305305- transaction->t_tid != this_tid)306306- goto out;307307-308308- while (transaction->t_checkpoint_io_list) {309309- jh = transaction->t_checkpoint_io_list;310310- bh = jh2bh(jh);311311- if (buffer_locked(bh)) {312312- get_bh(bh);313313- spin_unlock(&journal->j_list_lock);314314- wait_on_buffer(bh);315315- /* the journal_head may have gone by now */316316- BUFFER_TRACE(bh, "brelse");317317- __brelse(bh);318318- spin_lock(&journal->j_list_lock);319319- goto restart2;320320- }321321-322322- /*323323- * Now in whatever state the buffer currently is, we324324- * know that it has been written out and so we can325325- * drop it from the list326326- */327327- if (__jbd2_journal_remove_checkpoint(jh))328328- break;329329- }330325out:331326 spin_unlock(&journal->j_list_lock);332327 result = jbd2_cleanup_journal_tail(journal);···350409/* Checkpoint list management */351410352411/*353353- * journal_clean_one_cp_list412412+ * journal_shrink_one_cp_list354413 *355355- * Find all the written-back checkpoint buffers in the given list and356356- * release them. If 'destroy' is set, clean all buffers unconditionally.414414+ * Find all the written-back checkpoint buffers in the given list415415+ * and try to release them. If the whole transaction is released, set416416+ * the 'released' parameter. Return the number of released checkpointed417417+ * buffers.357418 *358419 * Called with j_list_lock held.359359- * Returns 1 if we freed the transaction, 0 otherwise.360420 */361361-static int journal_clean_one_cp_list(struct journal_head *jh, bool destroy)421421+static unsigned long journal_shrink_one_cp_list(struct journal_head *jh,422422+ bool destroy, bool *released)362423{363424 struct journal_head *last_jh;364425 struct journal_head *next_jh = jh;426426+ unsigned long nr_freed = 0;427427+ int ret;365428429429+ *released = false;366430 if (!jh)367431 return 0;368432···376430 jh = next_jh;377431 next_jh = jh->b_cpnext;378432379379- if (!destroy && __cp_buffer_busy(jh))380380- return 0;381381-382382- if (__jbd2_journal_remove_checkpoint(jh))383383- return 1;384384- /*385385- * This function only frees up some memory386386- * if possible so we dont have an obligation387387- * to finish processing. Bail out if preemption388388- * requested:389389- */390390- if (need_resched())391391- return 0;392392- } while (jh != last_jh);393393-394394- return 0;395395-}396396-397397-/*398398- * journal_shrink_one_cp_list399399- *400400- * Find 'nr_to_scan' written-back checkpoint buffers in the given list401401- * and try to release them. If the whole transaction is released, set402402- * the 'released' parameter. Return the number of released checkpointed403403- * buffers.404404- *405405- * Called with j_list_lock held.406406- */407407-static unsigned long journal_shrink_one_cp_list(struct journal_head *jh,408408- unsigned long *nr_to_scan,409409- bool *released)410410-{411411- struct journal_head *last_jh;412412- struct journal_head *next_jh = jh;413413- unsigned long nr_freed = 0;414414- int ret;415415-416416- if (!jh || *nr_to_scan == 0)417417- return 0;418418-419419- last_jh = jh->b_cpprev;420420- do {421421- jh = next_jh;422422- next_jh = jh->b_cpnext;423423-424424- (*nr_to_scan)--;425425- if (__cp_buffer_busy(jh))426426- continue;433433+ if (destroy) {434434+ ret = __jbd2_journal_remove_checkpoint(jh);435435+ } else {436436+ ret = jbd2_journal_try_remove_checkpoint(jh);437437+ if (ret < 0)438438+ continue;439439+ }427440428441 nr_freed++;429429- ret = __jbd2_journal_remove_checkpoint(jh);430442 if (ret) {431443 *released = true;432444 break;···392488393489 if (need_resched())394490 break;395395- } while (jh != last_jh && *nr_to_scan);491491+ } while (jh != last_jh);396492397493 return nr_freed;398494}···410506 unsigned long *nr_to_scan)411507{412508 transaction_t *transaction, *last_transaction, *next_transaction;413413- bool released;509509+ bool __maybe_unused released;414510 tid_t first_tid = 0, last_tid = 0, next_tid = 0;415511 tid_t tid = 0;416512 unsigned long nr_freed = 0;417417- unsigned long nr_scanned = *nr_to_scan;513513+ unsigned long freed;418514419515again:420516 spin_lock(&journal->j_list_lock);···443539 transaction = next_transaction;444540 next_transaction = transaction->t_cpnext;445541 tid = transaction->t_tid;446446- released = false;447542448448- nr_freed += journal_shrink_one_cp_list(transaction->t_checkpoint_list,449449- nr_to_scan, &released);450450- if (*nr_to_scan == 0)451451- break;452452- if (need_resched() || spin_needbreak(&journal->j_list_lock))453453- break;454454- if (released)455455- continue;456456-457457- nr_freed += journal_shrink_one_cp_list(transaction->t_checkpoint_io_list,458458- nr_to_scan, &released);543543+ freed = journal_shrink_one_cp_list(transaction->t_checkpoint_list,544544+ false, &released);545545+ nr_freed += freed;546546+ (*nr_to_scan) -= min(*nr_to_scan, freed);459547 if (*nr_to_scan == 0)460548 break;461549 if (need_resched() || spin_needbreak(&journal->j_list_lock))···468572 if (*nr_to_scan && next_tid)469573 goto again;470574out:471471- nr_scanned -= *nr_to_scan;472575 trace_jbd2_shrink_checkpoint_list(journal, first_tid, tid, last_tid,473473- nr_freed, nr_scanned, next_tid);576576+ nr_freed, next_tid);474577475578 return nr_freed;476579}···485590void __jbd2_journal_clean_checkpoint_list(journal_t *journal, bool destroy)486591{487592 transaction_t *transaction, *last_transaction, *next_transaction;488488- int ret;593593+ bool released;489594490595 transaction = journal->j_checkpoint_transactions;491596 if (!transaction)···496601 do {497602 transaction = next_transaction;498603 next_transaction = transaction->t_cpnext;499499- ret = journal_clean_one_cp_list(transaction->t_checkpoint_list,500500- destroy);604604+ journal_shrink_one_cp_list(transaction->t_checkpoint_list,605605+ destroy, &released);501606 /*502607 * This function only frees up some memory if possible so we503608 * dont have an obligation to finish processing. Bail out if···505610 */506611 if (need_resched())507612 return;508508- if (ret)509509- continue;510510- /*511511- * It is essential that we are as careful as in the case of512512- * t_checkpoint_list with removing the buffer from the list as513513- * we can possibly see not yet submitted buffers on io_list514514- */515515- ret = journal_clean_one_cp_list(transaction->516516- t_checkpoint_io_list, destroy);517517- if (need_resched())518518- return;519613 /*520614 * Stop scanning if we couldn't free the transaction. This521615 * avoids pointless scanning of transactions which still522616 * weren't checkpointed.523617 */524524- if (!ret)618618+ if (!released)525619 return;526620 } while (transaction != last_transaction);527621}···589705 jbd2_journal_put_journal_head(jh);590706591707 /* Is this transaction empty? */592592- if (transaction->t_checkpoint_list || transaction->t_checkpoint_io_list)708708+ if (transaction->t_checkpoint_list)593709 return 0;594710595711 /*···618734 __jbd2_journal_drop_transaction(journal, transaction);619735 jbd2_journal_free_transaction(transaction);620736 return 1;737737+}738738+739739+/*740740+ * Check the checkpoint buffer and try to remove it from the checkpoint741741+ * list if it's clean. Returns -EBUSY if it is not clean, returns 1 if742742+ * it frees the transaction, 0 otherwise.743743+ *744744+ * This function is called with j_list_lock held.745745+ */746746+int jbd2_journal_try_remove_checkpoint(struct journal_head *jh)747747+{748748+ struct buffer_head *bh = jh2bh(jh);749749+750750+ if (!trylock_buffer(bh))751751+ return -EBUSY;752752+ if (buffer_dirty(bh)) {753753+ unlock_buffer(bh);754754+ return -EBUSY;755755+ }756756+ unlock_buffer(bh);757757+758758+ /*759759+ * Buffer is clean and the IO has finished (we held the buffer760760+ * lock) so the checkpoint is done. We can safely remove the761761+ * buffer from this transaction.762762+ */763763+ JBUFFER_TRACE(jh, "remove from checkpoint list");764764+ return __jbd2_journal_remove_checkpoint(jh);621765}622766623767/*···709797 J_ASSERT(transaction->t_forget == NULL);710798 J_ASSERT(transaction->t_shadow_list == NULL);711799 J_ASSERT(transaction->t_checkpoint_list == NULL);712712- J_ASSERT(transaction->t_checkpoint_io_list == NULL);713800 J_ASSERT(atomic_read(&transaction->t_updates) == 0);714801 J_ASSERT(journal->j_committing_transaction != transaction);715802 J_ASSERT(journal->j_running_transaction != transaction);
+1-2
fs/jbd2/commit.c
···11411141 spin_lock(&journal->j_list_lock);11421142 commit_transaction->t_state = T_FINISHED;11431143 /* Check if the transaction can be dropped now that we are finished */11441144- if (commit_transaction->t_checkpoint_list == NULL &&11451145- commit_transaction->t_checkpoint_io_list == NULL) {11441144+ if (commit_transaction->t_checkpoint_list == NULL) {11461145 __jbd2_journal_drop_transaction(journal, commit_transaction);11471146 jbd2_journal_free_transaction(commit_transaction);11481147 }
+8-32
fs/jbd2/transaction.c
···17841784 * Otherwise, if the buffer has been written to disk,17851785 * it is safe to remove the checkpoint and drop it.17861786 */17871787- if (!buffer_dirty(bh)) {17881788- __jbd2_journal_remove_checkpoint(jh);17871787+ if (jbd2_journal_try_remove_checkpoint(jh) >= 0) {17891788 spin_unlock(&journal->j_list_lock);17901789 goto drop;17911790 }···20992100 __brelse(bh);21002101}2101210221022102-/*21032103- * Called from jbd2_journal_try_to_free_buffers().21042104- *21052105- * Called under jh->b_state_lock21062106- */21072107-static void21082108-__journal_try_to_free_buffer(journal_t *journal, struct buffer_head *bh)21092109-{21102110- struct journal_head *jh;21112111-21122112- jh = bh2jh(bh);21132113-21142114- if (buffer_locked(bh) || buffer_dirty(bh))21152115- goto out;21162116-21172117- if (jh->b_next_transaction != NULL || jh->b_transaction != NULL)21182118- goto out;21192119-21202120- spin_lock(&journal->j_list_lock);21212121- if (jh->b_cp_transaction != NULL) {21222122- /* written-back checkpointed metadata buffer */21232123- JBUFFER_TRACE(jh, "remove from checkpoint list");21242124- __jbd2_journal_remove_checkpoint(jh);21252125- }21262126- spin_unlock(&journal->j_list_lock);21272127-out:21282128- return;21292129-}21302130-21312103/**21322104 * jbd2_journal_try_to_free_buffers() - try to free page buffers.21332105 * @journal: journal for operation···21562186 continue;2157218721582188 spin_lock(&jh->b_state_lock);21592159- __journal_try_to_free_buffer(journal, bh);21892189+ if (!jh->b_transaction && !jh->b_next_transaction) {21902190+ spin_lock(&journal->j_list_lock);21912191+ /* Remove written-back checkpointed metadata buffer */21922192+ if (jh->b_cp_transaction != NULL)21932193+ jbd2_journal_try_remove_checkpoint(jh);21942194+ spin_unlock(&journal->j_list_lock);21952195+ }21602196 spin_unlock(&jh->b_state_lock);21612197 jbd2_journal_put_journal_head(jh);21622198 if (buffer_jbd(bh))
-2
fs/nfsd/nfs4state.c
···63416341 if (ZERO_STATEID(stateid) || ONE_STATEID(stateid) ||63426342 CLOSE_STATEID(stateid))63436343 return status;63446344- if (!same_clid(&stateid->si_opaque.so_clid, &cl->cl_clientid))63456345- return status;63466344 spin_lock(&cl->cl_lock);63476345 s = find_stateid_locked(cl, stateid);63486346 if (!s)
···159159#endif /* CONFIG_CIFS_NFSD_EXPORT */160160161161/* when changing internal version - update following two lines at same time */162162-#define SMB3_PRODUCT_BUILD 43163163-#define CIFS_VERSION "2.43"162162+#define SMB3_PRODUCT_BUILD 44163163+#define CIFS_VERSION "2.44"164164#endif /* _CIFSFS_H */
+13-4
fs/smb/client/ioctl.c
···433433 * Dump encryption keys. This is an old ioctl that only434434 * handles AES-128-{CCM,GCM}.435435 */436436- if (pSMBFile == NULL)437437- break;438436 if (!capable(CAP_SYS_ADMIN)) {439437 rc = -EACCES;440438 break;441439 }442440443443- tcon = tlink_tcon(pSMBFile->tlink);441441+ cifs_sb = CIFS_SB(inode->i_sb);442442+ tlink = cifs_sb_tlink(cifs_sb);443443+ if (IS_ERR(tlink)) {444444+ rc = PTR_ERR(tlink);445445+ break;446446+ }447447+ tcon = tlink_tcon(tlink);444448 if (!smb3_encryption_required(tcon)) {445449 rc = -EOPNOTSUPP;450450+ cifs_put_tlink(tlink);446451 break;447452 }448453 pkey_inf.cipher_type =···464459 rc = -EFAULT;465460 else466461 rc = 0;462462+ cifs_put_tlink(tlink);467463 break;468464 case CIFS_DUMP_FULL_KEY:469465 /*···476470 rc = -EACCES;477471 break;478472 }479479- tcon = tlink_tcon(pSMBFile->tlink);473473+ cifs_sb = CIFS_SB(inode->i_sb);474474+ tlink = cifs_sb_tlink(cifs_sb);475475+ tcon = tlink_tcon(tlink);480476 rc = cifs_dump_full_key(tcon, (void __user *)arg);477477+ cifs_put_tlink(tlink);481478 break;482479 case CIFS_IOC_NOTIFY:483480 if (!S_ISDIR(inode->i_mode)) {
···876876 msg.msg_flags |= MSG_MORE;877877 if (remain && pipe_occupancy(pipe->head, tail) > 0)878878 msg.msg_flags |= MSG_MORE;879879+ if (out->f_flags & O_NONBLOCK)880880+ msg.msg_flags |= MSG_DONTWAIT;879881880882 iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, bvec, bc,881883 len - remain);
+1-1
include/kvm/arm_vgic.h
···431431432432int vgic_v4_load(struct kvm_vcpu *vcpu);433433void vgic_v4_commit(struct kvm_vcpu *vcpu);434434-int vgic_v4_put(struct kvm_vcpu *vcpu, bool need_db);434434+int vgic_v4_put(struct kvm_vcpu *vcpu);435435436436/* CPU HP callbacks */437437void kvm_vgic_cpu_up(void);
-2
include/linux/blk-mq.h
···397397 */398398 struct blk_mq_tags *sched_tags;399399400400- /** @queued: Number of queued requests. */401401- unsigned long queued;402400 /** @run: Number of dispatched requests. */403401 unsigned long run;404402
+1-6
include/linux/jbd2.h
···614614 struct journal_head *t_checkpoint_list;615615616616 /*617617- * Doubly-linked circular list of all buffers submitted for IO while618618- * checkpointing. [j_list_lock]619619- */620620- struct journal_head *t_checkpoint_io_list;621621-622622- /*623617 * Doubly-linked circular list of metadata buffers being624618 * shadowed by log IO. The IO buffers on the iobuf list and625619 * the shadow buffers on this list match each other one for···14431449void __jbd2_journal_clean_checkpoint_list(journal_t *journal, bool destroy);14441450unsigned long jbd2_journal_shrink_checkpoint_list(journal_t *journal, unsigned long *nr_to_scan);14451451int __jbd2_journal_remove_checkpoint(struct journal_head *);14521452+int jbd2_journal_try_remove_checkpoint(struct journal_head *jh);14461453void jbd2_journal_destroy_checkpoint(journal_t *journal);14471454void __jbd2_journal_insert_checkpoint(struct journal_head *, transaction_t *);14481455
···1818 unsigned short sll_hatype;1919 unsigned char sll_pkttype;2020 unsigned char sll_halen;2121- unsigned char sll_addr[8];2121+ union {2222+ unsigned char sll_addr[8];2323+ /* Actual length is in sll_halen. */2424+ __DECLARE_FLEX_ARRAY(unsigned char, sll_addr_flex);2525+ };2226};23272428/* Packet types */
+27-27
io_uring/io_uring.c
···19481948 ret = io_issue_sqe(req, issue_flags);19491949 if (ret != -EAGAIN)19501950 break;19511951+19521952+ /*19531953+ * If REQ_F_NOWAIT is set, then don't wait or retry with19541954+ * poll. -EAGAIN is final for that case.19551955+ */19561956+ if (req->flags & REQ_F_NOWAIT)19571957+ break;19581958+19511959 /*19521960 * We can get EAGAIN for iopolled IO even though we're19531961 * forcing a sync submission from here, since we can't···34373429 unsigned long addr, unsigned long len,34383430 unsigned long pgoff, unsigned long flags)34393431{34403440- const unsigned long mmap_end = arch_get_mmap_end(addr, len, flags);34413441- struct vm_unmapped_area_info info;34423432 void *ptr;3443343334443434 /*···34513445 if (IS_ERR(ptr))34523446 return -ENOMEM;3453344734543454- info.flags = VM_UNMAPPED_AREA_TOPDOWN;34553455- info.length = len;34563456- info.low_limit = max(PAGE_SIZE, mmap_min_addr);34573457- info.high_limit = arch_get_mmap_base(addr, current->mm->mmap_base);34583458-#ifdef SHM_COLOUR34593459- info.align_mask = PAGE_MASK & (SHM_COLOUR - 1UL);34603460-#else34613461- info.align_mask = PAGE_MASK & (SHMLBA - 1UL);34623462-#endif34633463- info.align_offset = (unsigned long) ptr;34643464-34653448 /*34663466- * A failed mmap() very likely causes application failure,34673467- * so fall back to the bottom-up function here. This scenario34683468- * can happen with large stack limits and large mmap()34693469- * allocations.34493449+ * Some architectures have strong cache aliasing requirements.34503450+ * For such architectures we need a coherent mapping which aliases34513451+ * kernel memory *and* userspace memory. To achieve that:34523452+ * - use a NULL file pointer to reference physical memory, and34533453+ * - use the kernel virtual address of the shared io_uring context34543454+ * (instead of the userspace-provided address, which has to be 0UL34553455+ * anyway).34563456+ * For architectures without such aliasing requirements, the34573457+ * architecture will return any suitable mapping because addr is 0.34703458 */34713471- addr = vm_unmapped_area(&info);34723472- if (offset_in_page(addr)) {34733473- info.flags = 0;34743474- info.low_limit = TASK_UNMAPPED_BASE;34753475- info.high_limit = mmap_end;34763476- addr = vm_unmapped_area(&info);34773477- }34783478-34793479- return addr;34593459+ filp = NULL;34603460+ flags |= MAP_SHARED;34613461+ pgoff = 0; /* has been translated to ptr above */34623462+#ifdef SHM_COLOUR34633463+ addr = (uintptr_t) ptr;34643464+#else34653465+ addr = 0UL;34663466+#endif34673467+ return current->mm->get_unmapped_area(filp, addr, len, pgoff, flags);34803468}3481346934823470#else /* !CONFIG_MMU */···38703870 ctx->syscall_iopoll = 1;3871387138723872 ctx->compat = in_compat_syscall();38733873- if (!capable(CAP_IPC_LOCK))38733873+ if (!ns_capable_noaudit(&init_user_ns, CAP_IPC_LOCK))38743874 ctx->user = get_uid(current_user());3875387538763876 /*
+4
kernel/signal.c
···562562 if (handler != SIG_IGN && handler != SIG_DFL)563563 return false;564564565565+ /* If dying, we handle all new signals by ignoring them */566566+ if (fatal_signal_pending(tsk))567567+ return false;568568+565569 /* if ptraced, let the tracer determine */566570 return !tsk->ptrace;567571}
+13-1
kernel/trace/ring_buffer.c
···536536 unsigned flags;537537 int cpus;538538 atomic_t record_disabled;539539+ atomic_t resizing;539540 cpumask_var_t cpumask;540541541542 struct lock_class_key *reader_lock_key;···2168216721692168 /* prevent another thread from changing buffer sizes */21702169 mutex_lock(&buffer->mutex);21712171-21702170+ atomic_inc(&buffer->resizing);2172217121732172 if (cpu_id == RING_BUFFER_ALL_CPUS) {21742173 /*···23232322 atomic_dec(&buffer->record_disabled);23242323 }2325232423252325+ atomic_dec(&buffer->resizing);23262326 mutex_unlock(&buffer->mutex);23272327 return 0;23282328···23442342 }23452343 }23462344 out_err_unlock:23452345+ atomic_dec(&buffer->resizing);23472346 mutex_unlock(&buffer->mutex);23482347 return err;23492348}···55425539 if (local_read(&cpu_buffer_a->committing))55435540 goto out_dec;55445541 if (local_read(&cpu_buffer_b->committing))55425542+ goto out_dec;55435543+55445544+ /*55455545+ * When resize is in progress, we cannot swap it because55465546+ * it will mess the state of the cpu buffer.55475547+ */55485548+ if (atomic_read(&buffer_a->resizing))55495549+ goto out_dec;55505550+ if (atomic_read(&buffer_b->resizing))55455551 goto out_dec;5546555255475553 buffer_a->buffers[cpu] = cpu_buffer_b;
+2-1
kernel/trace/trace.c
···19281928 * place on this CPU. We fail to record, but we reset19291929 * the max trace buffer (no one writes directly to it)19301930 * and flag that it failed.19311931+ * Another reason is resize is in progress.19311932 */19321933 trace_array_printk_buf(tr->max_buffer.buffer, _THIS_IP_,19331933- "Failed to swap buffers due to commit in progress\n");19341934+ "Failed to swap buffers due to commit or resize in progress\n");19341935 }1935193619361937 WARN_ON_ONCE(ret && ret != -EAGAIN && ret != -EBUSY);
+2-1
kernel/trace/trace_events_hist.c
···66686668 goto out_unreg;6669666966706670 if (has_hist_vars(hist_data) || hist_data->n_var_refs) {66716671- if (save_hist_vars(hist_data))66716671+ ret = save_hist_vars(hist_data);66726672+ if (ret)66726673 goto out_unreg;66736674 }66746675
-4
kernel/trace/tracing_map.h
···272272extern u64 tracing_map_read_var(struct tracing_map_elt *elt, unsigned int i);273273extern u64 tracing_map_read_var_once(struct tracing_map_elt *elt, unsigned int i);274274275275-extern void tracing_map_set_field_descr(struct tracing_map *map,276276- unsigned int i,277277- unsigned int key_offset,278278- tracing_map_cmp_fn_t cmp_fn);279275extern int280276tracing_map_sort_entries(struct tracing_map *map,281277 struct tracing_map_sort_key *sort_keys,
+7-8
lib/sbitmap.c
···550550551551static void __sbitmap_queue_wake_up(struct sbitmap_queue *sbq, int nr)552552{553553- int i, wake_index;553553+ int i, wake_index, woken;554554555555 if (!atomic_read(&sbq->ws_active))556556 return;···567567 */568568 wake_index = sbq_index_inc(wake_index);569569570570- /*571571- * It is sufficient to wake up at least one waiter to572572- * guarantee forward progress.573573- */574574- if (waitqueue_active(&ws->wait) &&575575- wake_up_nr(&ws->wait, nr))576576- break;570570+ if (waitqueue_active(&ws->wait)) {571571+ woken = wake_up_nr(&ws->wait, nr);572572+ if (woken == nr)573573+ break;574574+ nr -= woken;575575+ }577576 }578577579578 if (wake_index != atomic_read(&sbq->wake_index))
+4
mm/memblock.c
···374374 kfree(memblock.reserved.regions);375375 else376376 memblock_free_late(addr, size);377377+ /* Reset to prevent UAF from stray frees. */378378+ memblock.reserved.regions = memblock_reserved_init_regions;379379+ memblock.reserved.cnt = 1;380380+ memblock_remove_region(&memblock.reserved, 0);377381 }378382379383 if (memblock.memory.regions != memblock_memory_init_regions) {
+16-12
mm/memory.c
···53935393 if (!vma_is_anonymous(vma) && !vma_is_tcp(vma))53945394 goto inval;5395539553965396- /* find_mergeable_anon_vma uses adjacent vmas which are not locked */53975397- if (!vma->anon_vma && !vma_is_tcp(vma))53985398- goto inval;53995399-54005396 if (!vma_start_read(vma))54015397 goto inval;53985398+53995399+ /*54005400+ * find_mergeable_anon_vma uses adjacent vmas which are not locked.54015401+ * This check must happen after vma_start_read(); otherwise, a54025402+ * concurrent mremap() with MREMAP_DONTUNMAP could dissociate the VMA54035403+ * from its anon_vma.54045404+ */54055405+ if (unlikely(!vma->anon_vma && !vma_is_tcp(vma)))54065406+ goto inval_end_read;5402540754035408 /*54045409 * Due to the possibility of userfault handler dropping mmap_lock, avoid54055410 * it for now and fall back to page fault handling under mmap_lock.54065411 */54075407- if (userfaultfd_armed(vma)) {54085408- vma_end_read(vma);54095409- goto inval;54105410- }54125412+ if (userfaultfd_armed(vma))54135413+ goto inval_end_read;5411541454125415 /* Check since vm_start/vm_end might change before we lock the VMA */54135413- if (unlikely(address < vma->vm_start || address >= vma->vm_end)) {54145414- vma_end_read(vma);54155415- goto inval;54165416- }54165416+ if (unlikely(address < vma->vm_start || address >= vma->vm_end))54175417+ goto inval_end_read;5417541854185419 /* Check if the VMA got isolated after we found it */54195420 if (vma->detached) {···5426542554275426 rcu_read_unlock();54285427 return vma;54285428+54295429+inval_end_read:54305430+ vma_end_read(vma);54295431inval:54305432 rcu_read_unlock();54315433 count_vm_vma_lock_event(VMA_LOCK_ABORT);
···25632563 ipv6_ifa_notify(0, ift);25642564 }2565256525662566- if ((create || list_empty(&idev->tempaddr_list)) &&25672567- idev->cnf.use_tempaddr > 0) {25662566+ /* Also create a temporary address if it's enabled but no temporary25672567+ * address currently exists.25682568+ * However, we get called with valid_lft == 0, prefered_lft == 0, create == false25692569+ * as part of cleanup (ie. deleting the mngtmpaddr).25702570+ * We don't want that to result in creating a new temporary ip address.25712571+ */25722572+ if (list_empty(&idev->tempaddr_list) && (valid_lft || prefered_lft))25732573+ create = true;25742574+25752575+ if (create && idev->cnf.use_tempaddr > 0) {25682576 /* When a new public address is created as described25692577 * in [ADDRCONF], also create a new temporary address.25702570- * Also create a temporary address if it's enabled but25712571- * no temporary address currently exists.25722578 */25732579 read_unlock_bh(&idev->lock);25742580 ipv6_create_tempaddr(ifp, false);
···217217218218static int nft_rbtree_gc_elem(const struct nft_set *__set,219219 struct nft_rbtree *priv,220220- struct nft_rbtree_elem *rbe)220220+ struct nft_rbtree_elem *rbe,221221+ u8 genmask)221222{222223 struct nft_set *set = (struct nft_set *)__set;223224 struct rb_node *prev = rb_prev(&rbe->node);224224- struct nft_rbtree_elem *rbe_prev = NULL;225225+ struct nft_rbtree_elem *rbe_prev;225226 struct nft_set_gc_batch *gcb;226227227228 gcb = nft_set_gc_batch_check(set, NULL, GFP_ATOMIC);228229 if (!gcb)229230 return -ENOMEM;230231231231- /* search for expired end interval coming before this element. */232232+ /* search for end interval coming before this element.233233+ * end intervals don't carry a timeout extension, they234234+ * are coupled with the interval start element.235235+ */232236 while (prev) {233237 rbe_prev = rb_entry(prev, struct nft_rbtree_elem, node);234234- if (nft_rbtree_interval_end(rbe_prev))238238+ if (nft_rbtree_interval_end(rbe_prev) &&239239+ nft_set_elem_active(&rbe_prev->ext, genmask))235240 break;236241237242 prev = rb_prev(prev);238243 }239244240240- if (rbe_prev) {245245+ if (prev) {246246+ rbe_prev = rb_entry(prev, struct nft_rbtree_elem, node);247247+241248 rb_erase(&rbe_prev->node, &priv->root);242249 atomic_dec(&set->nelems);250250+ nft_set_gc_batch_add(gcb, rbe_prev);243251 }244252245253 rb_erase(&rbe->node, &priv->root);···329321330322 /* perform garbage collection to avoid bogus overlap reports. */331323 if (nft_set_elem_expired(&rbe->ext)) {332332- err = nft_rbtree_gc_elem(set, priv, rbe);324324+ err = nft_rbtree_gc_elem(set, priv, rbe, genmask);333325 if (err < 0)334326 return err;335327
+1-1
net/packet/af_packet.c
···36013601 if (dev) {36023602 sll->sll_hatype = dev->type;36033603 sll->sll_halen = dev->addr_len;36043604- memcpy(sll->sll_addr, dev->dev_addr, dev->addr_len);36043604+ memcpy(sll->sll_addr_flex, dev->dev_addr, dev->addr_len);36053605 } else {36063606 sll->sll_hatype = 0; /* Bad: we have no ARPHRD_UNSPEC */36073607 sll->sll_halen = 0;
+14
net/sched/sch_mqprio.c
···290290 "Attribute type expected to be TCA_MQPRIO_MIN_RATE64");291291 return -EINVAL;292292 }293293+294294+ if (nla_len(attr) != sizeof(u64)) {295295+ NL_SET_ERR_MSG_ATTR(extack, attr,296296+ "Attribute TCA_MQPRIO_MIN_RATE64 expected to have 8 bytes length");297297+ return -EINVAL;298298+ }299299+293300 if (i >= qopt->num_tc)294301 break;295302 priv->min_rate[i] = nla_get_u64(attr);···319312 "Attribute type expected to be TCA_MQPRIO_MAX_RATE64");320313 return -EINVAL;321314 }315315+316316+ if (nla_len(attr) != sizeof(u64)) {317317+ NL_SET_ERR_MSG_ATTR(extack, attr,318318+ "Attribute TCA_MQPRIO_MAX_RATE64 expected to have 8 bytes length");319319+ return -EINVAL;320320+ }321321+322322 if (i >= qopt->num_tc)323323 break;324324 priv->max_rate[i] = nla_get_u64(attr);
···583583 n->capabilities, &n->bc_entry.inputq1,584584 &n->bc_entry.namedq, snd_l, &n->bc_entry.link)) {585585 pr_warn("Broadcast rcv link creation failed, no memory\n");586586- kfree(n);586586+ tipc_node_put(n);587587 n = NULL;588588 goto exit;589589 }
+16-7
net/unix/af_unix.c
···289289 return 0;290290}291291292292-static void unix_mkname_bsd(struct sockaddr_un *sunaddr, int addr_len)292292+static int unix_mkname_bsd(struct sockaddr_un *sunaddr, int addr_len)293293{294294+ struct sockaddr_storage *addr = (struct sockaddr_storage *)sunaddr;295295+ short offset = offsetof(struct sockaddr_storage, __data);296296+297297+ BUILD_BUG_ON(offset != offsetof(struct sockaddr_un, sun_path));298298+294299 /* This may look like an off by one error but it is a bit more295300 * subtle. 108 is the longest valid AF_UNIX path for a binding.296301 * sun_path[108] doesn't as such exist. However in kernel space297302 * we are guaranteed that it is a valid memory location in our298303 * kernel address buffer because syscall functions always pass299304 * a pointer of struct sockaddr_storage which has a bigger buffer300300- * than 108.305305+ * than 108. Also, we must terminate sun_path for strlen() in306306+ * getname_kernel().301307 */302302- ((char *)sunaddr)[addr_len] = 0;308308+ addr->__data[addr_len - offset] = 0;309309+310310+ /* Don't pass sunaddr->sun_path to strlen(). Otherwise, 108 will311311+ * cause panic if CONFIG_FORTIFY_SOURCE=y. Let __fortify_strlen()312312+ * know the actual buffer.313313+ */314314+ return strlen(addr->__data) + offset + 1;303315}304316305317static void __unix_remove_socket(struct sock *sk)···12201208 struct path parent;12211209 int err;1222121012231223- unix_mkname_bsd(sunaddr, addr_len);12241224- addr_len = strlen(sunaddr->sun_path) +12251225- offsetof(struct sockaddr_un, sun_path) + 1;12261226-12111211+ addr_len = unix_mkname_bsd(sunaddr, addr_len);12271212 addr = unix_create_addr(sunaddr, addr_len);12281213 if (!addr)12291214 return -ENOMEM;
+4-1
scripts/Makefile.build
···264264265265rust_allowed_features := new_uninit266266267267+# `--out-dir` is required to avoid temporaries being created by `rustc` in the268268+# current working directory, which may be not accessible in the out-of-tree269269+# modules case.267270rust_common_cmd = \268271 RUST_MODFILE=$(modfile) $(RUSTC_OR_CLIPPY) $(rust_flags) \269272 -Zallow-features=$(rust_allowed_features) \···275272 --extern alloc --extern kernel \276273 --crate-type rlib -L $(objtree)/rust/ \277274 --crate-name $(basename $(notdir $@)) \278278- --emit=dep-info=$(depfile)275275+ --out-dir $(dir $@) --emit=dep-info=$(depfile)279276280277# `--emit=obj`, `--emit=asm` and `--emit=llvm-ir` imply a single codegen unit281278# will be used. We explicitly request `-Ccodegen-units=1` in any case, and
+5-1
scripts/Makefile.host
···8686hostcxx_flags = -Wp,-MMD,$(depfile) \8787 $(KBUILD_HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \8888 $(HOSTCXXFLAGS_$(target-stem).o)8989-hostrust_flags = --emit=dep-info=$(depfile) \8989+9090+# `--out-dir` is required to avoid temporaries being created by `rustc` in the9191+# current working directory, which may be not accessible in the out-of-tree9292+# modules case.9393+hostrust_flags = --out-dir $(dir $@) --emit=dep-info=$(depfile) \9094 $(KBUILD_HOSTRUSTFLAGS) $(HOST_EXTRARUSTFLAGS) \9195 $(HOSTRUSTFLAGS_$(target-stem))9296
+1-1
scripts/clang-tools/gen_compile_commands.py
···1919_DEFAULT_LOG_LEVEL = 'WARNING'20202121_FILENAME_PATTERN = r'^\..*\.cmd$'2222-_LINE_PATTERN = r'^savedcmd_[^ ]*\.o := (.* )([^ ]*\.c) *(;|$)'2222+_LINE_PATTERN = r'^savedcmd_[^ ]*\.o := (.* )([^ ]*\.[cS]) *(;|$)'2323_VALID_LOG_LEVELS = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']2424# The tools/ directory adopts a different build system, and produces .cmd2525# files in a different format. Do not support it.
+4-7
scripts/kconfig/gconf.c
···636636{637637 GtkWidget *dialog;638638 const gchar *intro_text =639639- "Welcome to gkc, the GTK+ graphical configuration tool\n"639639+ "Welcome to gconfig, the GTK+ graphical configuration tool.\n"640640 "For each option, a blank box indicates the feature is disabled, a\n"641641 "check indicates it is enabled, and a dot indicates that it is to\n"642642 "be compiled as a module. Clicking on the box will cycle through the three states.\n"···647647 "Although there is no cross reference yet to help you figure out\n"648648 "what other options must be enabled to support the option you\n"649649 "are interested in, you can still view the help of a grayed-out\n"650650- "option.\n"651651- "\n"652652- "Toggling Show Debug Info under the Options menu will show \n"653653- "the dependencies, which you can then match by examining other options.";650650+ "option.";654651655652 dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd),656653 GTK_DIALOG_DESTROY_WITH_PARENT,···664667{665668 GtkWidget *dialog;666669 const gchar *about_text =667667- "gkc is copyright (c) 2002 Romain Lievin <roms@lpg.ticalc.org>.\n"670670+ "gconfig is copyright (c) 2002 Romain Lievin <roms@lpg.ticalc.org>.\n"668671 "Based on the source code from Roman Zippel.\n";669672670673 dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd),···682685{683686 GtkWidget *dialog;684687 const gchar *license_text =685685- "gkc is released under the terms of the GNU GPL v2.\n"688688+ "gconfig is released under the terms of the GNU GPL v2.\n"686689 "For more information, please see the source code or\n"687690 "visit http://www.fsf.org/licenses/licenses.html\n";688691
+1
sound/core/seq/seq_ports.c
···149149 write_lock_irq(&client->ports_lock);150150 list_for_each_entry(p, &client->ports_list_head, list) {151151 if (p->addr.port == port) {152152+ kfree(new_port);152153 num = -EBUSY;153154 goto unlock;154155 }
···507507 savediv / 2 - 1);508508 }509509510510- if (sai->soc_data->max_register >= FSL_SAI_MCTL) {511511- /* SAI is in master mode at this point, so enable MCLK */512512- regmap_update_bits(sai->regmap, FSL_SAI_MCTL,513513- FSL_SAI_MCTL_MCLK_EN, FSL_SAI_MCTL_MCLK_EN);514514- }515515-516510 return 0;517511}518512···713719 u32 xcsr, count = 100;714720715721 regmap_update_bits(sai->regmap, FSL_SAI_xCSR(tx, ofs),716716- FSL_SAI_CSR_TERE, 0);722722+ FSL_SAI_CSR_TERE | FSL_SAI_CSR_BCE, 0);717723718724 /* TERE will remain set till the end of current frame */719725 do {
+1
sound/soc/fsl/fsl_sai.h
···9191/* SAI Transmit/Receive Control Register */9292#define FSL_SAI_CSR_TERE BIT(31)9393#define FSL_SAI_CSR_SE BIT(30)9494+#define FSL_SAI_CSR_BCE BIT(28)9495#define FSL_SAI_CSR_FR BIT(25)9596#define FSL_SAI_CSR_SR BIT(24)9697#define FSL_SAI_CSR_xF_SHIFT 16
···1277127712781278 ret = snd_soc_tplg_component_load(component, &audioreach_tplg_ops, fw);12791279 if (ret < 0) {12801280- dev_err(dev, "tplg component load failed%d\n", ret);12811281- ret = -EINVAL;12801280+ if (ret != -EPROBE_DEFER)12811281+ dev_err(dev, "tplg component load failed: %d\n", ret);12821282 }1283128312841284 release_firmware(fw);
+4-2
sound/soc/soc-core.c
···19881988 /* probe all components used by DAI links on this card */19891989 ret = soc_probe_link_components(card);19901990 if (ret < 0) {19911991- dev_err(card->dev,19921992- "ASoC: failed to instantiate card %d\n", ret);19911991+ if (ret != -EPROBE_DEFER) {19921992+ dev_err(card->dev,19931993+ "ASoC: failed to instantiate card %d\n", ret);19941994+ }19931995 goto probe_end;19941996 }19951997
+7-3
sound/soc/soc-topology.c
···1732173217331733 ret = snd_soc_add_pcm_runtimes(tplg->comp->card, link, 1);17341734 if (ret < 0) {17351735- dev_err(tplg->dev, "ASoC: adding FE link failed\n");17351735+ if (ret != -EPROBE_DEFER)17361736+ dev_err(tplg->dev, "ASoC: adding FE link failed\n");17361737 goto err;17371738 }17381739···24932492 /* load the header object */24942493 ret = soc_tplg_load_header(tplg, hdr);24952494 if (ret < 0) {24962496- dev_err(tplg->dev,24972497- "ASoC: topology: could not load header: %d\n", ret);24952495+ if (ret != -EPROBE_DEFER) {24962496+ dev_err(tplg->dev,24972497+ "ASoC: topology: could not load header: %d\n",24982498+ ret);24992499+ }24982500 return ret;24992501 }25002502
+7-3
sound/soc/sof/amd/acp.c
···217217 unsigned int image_length)218218{219219 struct snd_sof_dev *sdev = adata->dev;220220+ const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata);220221 unsigned int tx_count, fw_qualifier, val;221222 int ret;222223···252251 return ret;253252 }254253255255- ret = psp_send_cmd(adata, MBOX_ACP_SHA_DMA_COMMAND);256256- if (ret)257257- return ret;254254+ /* psp_send_cmd only required for renoir platform (rev - 3) */255255+ if (desc->rev == 3) {256256+ ret = psp_send_cmd(adata, MBOX_ACP_SHA_DMA_COMMAND);257257+ if (ret)258258+ return ret;259259+ }258260259261 ret = snd_sof_dsp_read_poll_timeout(sdev, ACP_DSP_BAR, ACP_SHA_DSP_FW_QUALIFIER,260262 fw_qualifier, fw_qualifier & DSP_FW_RUN_ENABLE,
+4-5
sound/soc/sof/ipc3-dtrace.c
···186186 struct snd_sof_dfsentry *dfse = file->private_data;187187 struct sof_ipc_trace_filter_elem *elems = NULL;188188 struct snd_sof_dev *sdev = dfse->sdev;189189- loff_t pos = 0;190189 int num_elems;191190 char *string;192191 int ret;···200201 if (!string)201202 return -ENOMEM;202203203203- /* assert null termination */204204- string[count] = 0;205205- ret = simple_write_to_buffer(string, count, &pos, from, count);206206- if (ret < 0)204204+ if (copy_from_user(string, from, count)) {205205+ ret = -EFAULT;207206 goto error;207207+ }208208+ string[count] = '\0';208209209210 ret = trace_filter_parse(sdev, string, &num_elems, &elems);210211 if (ret < 0)
+22-12
sound/soc/tegra/tegra210_adx.c
···22//33// tegra210_adx.c - Tegra210 ADX driver44//55-// Copyright (c) 2021 NVIDIA CORPORATION. All rights reserved.55+// Copyright (c) 2021-2023 NVIDIA CORPORATION. All rights reserved.6677#include <linux/clk.h>88#include <linux/device.h>···175175 mc = (struct soc_mixer_control *)kcontrol->private_value;176176 enabled = adx->byte_mask[mc->reg / 32] & (1 << (mc->reg % 32));177177178178+ /*179179+ * TODO: Simplify this logic to just return from bytes_map[]180180+ *181181+ * Presently below is required since bytes_map[] is182182+ * tightly packed and cannot store the control value of 256.183183+ * Byte mask state is used to know if 256 needs to be returned.184184+ * Note that for control value of 256, the put() call stores 0185185+ * in the bytes_map[] and disables the corresponding bit in186186+ * byte_mask[].187187+ */178188 if (enabled)179189 ucontrol->value.integer.value[0] = bytes_map[mc->reg];180190 else181181- ucontrol->value.integer.value[0] = 0;191191+ ucontrol->value.integer.value[0] = 256;182192183193 return 0;184194}···202192 int value = ucontrol->value.integer.value[0];203193 struct soc_mixer_control *mc =204194 (struct soc_mixer_control *)kcontrol->private_value;195195+ unsigned int mask_val = adx->byte_mask[mc->reg / 32];205196206206- if (value == bytes_map[mc->reg])197197+ if (value >= 0 && value <= 255)198198+ mask_val |= (1 << (mc->reg % 32));199199+ else200200+ mask_val &= ~(1 << (mc->reg % 32));201201+202202+ if (mask_val == adx->byte_mask[mc->reg / 32])207203 return 0;208204209209- if (value >= 0 && value <= 255) {210210- /* update byte map and enable slot */211211- bytes_map[mc->reg] = value;212212- adx->byte_mask[mc->reg / 32] |= (1 << (mc->reg % 32));213213- } else {214214- /* reset byte map and disable slot */215215- bytes_map[mc->reg] = 0;216216- adx->byte_mask[mc->reg / 32] &= ~(1 << (mc->reg % 32));217217- }205205+ /* Update byte map and slot */206206+ bytes_map[mc->reg] = value % 256;207207+ adx->byte_mask[mc->reg / 32] = mask_val;218208219209 return 1;220210}
+22-18
sound/soc/tegra/tegra210_amx.c
···22//33// tegra210_amx.c - Tegra210 AMX driver44//55-// Copyright (c) 2021 NVIDIA CORPORATION. All rights reserved.55+// Copyright (c) 2021-2023 NVIDIA CORPORATION. All rights reserved.6677#include <linux/clk.h>88#include <linux/device.h>···203203 else204204 enabled = amx->byte_mask[0] & (1 << reg);205205206206+ /*207207+ * TODO: Simplify this logic to just return from bytes_map[]208208+ *209209+ * Presently below is required since bytes_map[] is210210+ * tightly packed and cannot store the control value of 256.211211+ * Byte mask state is used to know if 256 needs to be returned.212212+ * Note that for control value of 256, the put() call stores 0213213+ * in the bytes_map[] and disables the corresponding bit in214214+ * byte_mask[].215215+ */206216 if (enabled)207217 ucontrol->value.integer.value[0] = bytes_map[reg];208218 else209209- ucontrol->value.integer.value[0] = 0;219219+ ucontrol->value.integer.value[0] = 256;210220211221 return 0;212222}···231221 unsigned char *bytes_map = (unsigned char *)&amx->map;232222 int reg = mc->reg;233223 int value = ucontrol->value.integer.value[0];224224+ unsigned int mask_val = amx->byte_mask[reg / 32];234225235235- if (value == bytes_map[reg])226226+ if (value >= 0 && value <= 255)227227+ mask_val |= (1 << (reg % 32));228228+ else229229+ mask_val &= ~(1 << (reg % 32));230230+231231+ if (mask_val == amx->byte_mask[reg / 32])236232 return 0;237233238238- if (value >= 0 && value <= 255) {239239- /* Update byte map and enable slot */240240- bytes_map[reg] = value;241241- if (reg > 31)242242- amx->byte_mask[1] |= (1 << (reg - 32));243243- else244244- amx->byte_mask[0] |= (1 << reg);245245- } else {246246- /* Reset byte map and disable slot */247247- bytes_map[reg] = 0;248248- if (reg > 31)249249- amx->byte_mask[1] &= ~(1 << (reg - 32));250250- else251251- amx->byte_mask[0] &= ~(1 << reg);252252- }234234+ /* Update byte map and slot */235235+ bytes_map[reg] = value % 256;236236+ amx->byte_mask[reg / 32] = mask_val;253237254238 return 1;255239}
+8-8
tools/net/ynl/lib/ynl.py
···417417 pad = b'\x00' * ((4 - len(attr_payload) % 4) % 4)418418 return struct.pack('HH', len(attr_payload) + 4, nl_type) + attr_payload + pad419419420420- def _decode_enum(self, rsp, attr_spec):421421- raw = rsp[attr_spec['name']]420420+ def _decode_enum(self, raw, attr_spec):422421 enum = self.consts[attr_spec['enum']]423423- i = attr_spec.get('value-start', 0)424422 if 'enum-as-flags' in attr_spec and attr_spec['enum-as-flags']:423423+ i = 0425424 value = set()426425 while raw:427426 if raw & 1:···428429 raw >>= 1429430 i += 1430431 else:431431- value = enum.entries_by_val[raw - i].name432432- rsp[attr_spec['name']] = value432432+ value = enum.entries_by_val[raw].name433433+ return value433434434435 def _decode_binary(self, attr, attr_spec):435436 if attr_spec.struct_name:···437438 decoded = attr.as_struct(members)438439 for m in members:439440 if m.enum:440440- self._decode_enum(decoded, m)441441+ decoded[m.name] = self._decode_enum(decoded[m.name], m)441442 elif attr_spec.sub_type:442443 decoded = attr.as_c_array(attr_spec.sub_type)443444 else:···465466 else:466467 raise Exception(f'Unknown {attr_spec["type"]} with name {attr_spec["name"]}')467468469469+ if 'enum' in attr_spec:470470+ decoded = self._decode_enum(decoded, attr_spec)471471+468472 if not attr_spec.is_multi:469473 rsp[attr_spec['name']] = decoded470474 elif attr_spec.name in rsp:···475473 else:476474 rsp[attr_spec.name] = [decoded]477475478478- if 'enum' in attr_spec:479479- self._decode_enum(rsp, attr_spec)480476 return rsp481477482478 def _decode_extack_path(self, attrs, attr_set, offset, target):
···166166 elif ! iptables -V &> /dev/null; then167167 echo "SKIP: Could not run all tests without iptables tool"168168 exit $ksft_skip169169- fi170170-171171- if ! ip6tables -V &> /dev/null; then169169+ elif ! ip6tables -V &> /dev/null; then172170 echo "SKIP: Could not run all tests without ip6tables tool"173171 exit $ksft_skip174172 fi